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MAAM,EAAe,mNAAmN,SAKxO,aAJM,WAAW,QAAQ,EAAc,QAAuC,EAAS,WAAW,QAAS,CACvG,SAAU,QAA2C,EAAW,GAAG,QACnE,MAAO,IAAI,QAAQ,QAAQ,MAAM,CAAE,WAAW,MAE3C,OAAO,QAAQ,KAAK,QAAuC,EAAS,WAAW,QAAS,QAA2C,EAAW,GAAG,QAC5J,CACA,MAAO,GACH,MAAM,IAAI,MAAM,EACpB,CACJ,IACA,QAAQ,MAAQ","file":"/npm/node-crxdl@0.0.7-alpha.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-crxdl@0.0.7-alpha.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.crxdl = exports.getExtensionId = void 0;\nconst download_1 = __importDefault(require(\"download\"));\nconst https_1 = __importDefault(require(\"https\"));\nconst path_1 = __importDefault(require(\"path\"));\nconst temp_dir_1 = __importDefault(require(\"temp-dir\"));\nconst CWS_PATTERN = /^https?:\\/\\/chrome.google.com\\/webstore\\/.+?\\/([a-z]{32})(?=[\\/#?]|$)/;\nconst getExtensionId = (url) => {\n    let match = CWS_PATTERN.exec(url);\n    if (match)\n        return match[1];\n    return null;\n};\nexports.getExtensionId = getExtensionId;\nconst crxdl = ({ url, output, filename, }) => __awaiter(void 0, void 0, void 0, function* () {\n    try {\n        const extensionId = url.length === 32 ? url : exports.getExtensionId(url);\n        if (!extensionId)\n            throw new Error(\"Failed to parse extension id\");\n        const extensionUrl = `https://clients2.google.com/service/update2/crx?response=redirect&os=win&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=76.0.3809.132&acceptformat=crx2,crx3&x=id%3D${extensionId}%26uc`;\n        yield download_1.default(extensionUrl, output !== null && output !== void 0 ? output : temp_dir_1.default, {\n            filename: filename !== null && filename !== void 0 ? filename : `${extensionId}.crx`,\n            agent: new https_1.default.Agent({ keepAlive: true }),\n        });\n        return path_1.default.join(output !== null && output !== void 0 ? output : temp_dir_1.default, filename !== null && filename !== void 0 ? filename : `${extensionId}.crx`);\n    }\n    catch (error) {\n        throw new Error(error);\n    }\n});\nexports.crxdl = crxdl;\n"]}