"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const core_utils_1 = require("@electron-forge/core-utils");
const log_symbols_1 = __importDefault(require("log-symbols"));
async function locateElectronExecutable(dir, packageJSON) {
    const electronModulePath = await (0, core_utils_1.getElectronModulePath)(dir, packageJSON);
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    let electronExecPath = require(electronModulePath || path_1.default.resolve(dir, 'node_modules/electron'));
    if (typeof electronExecPath !== 'string') {
        console.warn(log_symbols_1.default.warning, 'Returned Electron executable path is not a string, defaulting to a hardcoded location. Value:', electronExecPath);
        electronExecPath = require(path_1.default.resolve(dir, 'node_modules/electron'));
    }
    return electronExecPath;
}
exports.default = locateElectronExecutable;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWxlY3Ryb24tZXhlY3V0YWJsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2VsZWN0cm9uLWV4ZWN1dGFibGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxnREFBd0I7QUFFeEIsMkRBQW1FO0FBQ25FLDhEQUFxQztBQUl0QixLQUFLLFVBQVUsd0JBQXdCLENBQUMsR0FBVyxFQUFFLFdBQXdCO0lBQzFGLE1BQU0sa0JBQWtCLEdBQXVCLE1BQU0sSUFBQSxrQ0FBcUIsRUFBQyxHQUFHLEVBQUUsV0FBVyxDQUFDLENBQUM7SUFFN0YsOERBQThEO0lBQzlELElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixJQUFJLGNBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLHVCQUF1QixDQUFDLENBQUMsQ0FBQztJQUVqRyxJQUFJLE9BQU8sZ0JBQWdCLEtBQUssUUFBUSxFQUFFO1FBQ3hDLE9BQU8sQ0FBQyxJQUFJLENBQUMscUJBQVUsQ0FBQyxPQUFPLEVBQUUsK0ZBQStGLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztRQUNwSixnQkFBZ0IsR0FBRyxPQUFPLENBQUMsY0FBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsdUJBQXVCLENBQUMsQ0FBQyxDQUFDO0tBQ3hFO0lBRUQsT0FBTyxnQkFBZ0IsQ0FBQztBQUMxQixDQUFDO0FBWkQsMkNBWUMifQ==