"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const get_installations_1 = __importDefault(require("./get-installations")); const fs_exists_promised_1 = __importDefault(require("../utils/fs-exists-promised")); const find_alias_1 = __importDefault(require("../utils/find-alias")); //Const const DEFAULT_ALIAS = { cmd: '', macOpenCmdTemplate: 'open -n -a "{{{path}}}" --args {{{pageUrl}}}' }; //API /** * Returns information about the specified browser. * @function * @async * @name getBrowserInfo * @param {string} browser - A browser alias ('chrome', 'firefox', etc.) or a path to the browser's executable file. * @returns {BrowserInfo} An object that contains information about the specified browser. */ async function default_1(browser) { const installations = await get_installations_1.default(); const browserAsAlias = browser.trim().toLowerCase(); if (installations[browserAsAlias]) return installations[browserAsAlias]; if (!await fs_exists_promised_1.default(browser)) return null; const detectedAlias = find_alias_1.default(browser); const { cmd, macOpenCmdTemplate } = detectedAlias ? detectedAlias.alias : DEFAULT_ALIAS; return { path: browser, cmd, macOpenCmdTemplate }; } exports.default = default_1; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWJyb3dzZXItaW5mby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hcGkvZ2V0LWJyb3dzZXItaW5mby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDRFQUFtRDtBQUNuRCxxRkFBaUQ7QUFDakQscUVBQTRDO0FBRzVDLE9BQU87QUFDUCxNQUFNLGFBQWEsR0FBRztJQUNsQixHQUFHLEVBQWlCLEVBQUU7SUFDdEIsa0JBQWtCLEVBQUUsOENBQThDO0NBQ3JFLENBQUM7QUFHRixLQUFLO0FBQ0w7Ozs7Ozs7R0FPRztBQUNZLEtBQUssb0JBQVcsT0FBTztJQUNsQyxNQUFNLGFBQWEsR0FBRyxNQUFNLDJCQUFnQixFQUFFLENBQUM7SUFFL0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