extension-develop 2.0.0-alpha.9 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ensure-hmr-for-scripts.js +2 -2
- package/dist/extensions/chrome-manager-extension/manifest.json +3 -3
- package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/manifest.json +3 -3
- package/dist/extensions/chromium-based-manager-extension/pages/welcome.html +49 -0
- package/dist/extensions/edge-manager-extension/manifest.json +3 -3
- package/dist/extensions/edge-manager-extension/pages/welcome.html +1 -1
- package/dist/extensions/firefox-manager-extension/manifest.json +3 -3
- package/dist/extensions/firefox-manager-extension/pages/welcome.html +1 -1
- package/dist/extensions/gecko-based-manager-extension/background.js +57 -0
- package/dist/extensions/gecko-based-manager-extension/define-initial-tab.js +62 -0
- package/dist/extensions/gecko-based-manager-extension/images/logo.png +0 -0
- package/dist/extensions/gecko-based-manager-extension/manifest.json +16 -0
- package/dist/extensions/gecko-based-manager-extension/pages/sakura-dark.css +268 -0
- package/dist/extensions/gecko-based-manager-extension/pages/sakura.css +267 -0
- package/dist/extensions/{chromium-manager-extension → gecko-based-manager-extension}/pages/welcome.html +1 -1
- package/dist/extensions/gecko-based-manager-extension/pages/welcome.js +34 -0
- package/dist/extensions/gecko-based-manager-extension/reload-service.js +130 -0
- package/dist/inject-chromium-client-loader.js +2 -2
- package/dist/inject-content-css-during-dev.js +3 -3
- package/dist/inject-firefox-client-loader.js +9 -2
- package/dist/module.d.ts +33 -6
- package/dist/module.js +99 -111
- package/dist/resolver-loader.js +1 -1
- package/dist/resolver-module.mjs +1 -0
- package/package.json +21 -25
- package/dist/add-query-param-to-imported-css.js +0 -1
- package/dist/resolver-module.js +0 -1
- /package/dist/extensions/chrome-manager-extension/{public → images}/logo.png +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/background.js +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/define-initial-tab.js +0 -0
- /package/dist/extensions/{chromium-manager-extension/public → chromium-based-manager-extension/images}/logo.png +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/pages/sakura-dark.css +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/pages/sakura.css +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/pages/welcome.js +0 -0
- /package/dist/extensions/{chromium-manager-extension → chromium-based-manager-extension}/reload-service.js +0 -0
- /package/dist/extensions/edge-manager-extension/{public → images}/logo.png +0 -0
- /package/dist/extensions/firefox-manager-extension/{public → images}/logo.png +0 -0
package/dist/module.js
CHANGED
|
@@ -1,184 +1,172 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ap=Object.create;var rt=Object.defineProperty;var Rp=Object.getOwnPropertyDescriptor;var Tp=Object.getOwnPropertyNames;var Np=Object.getPrototypeOf,Up=Object.prototype.hasOwnProperty;var qp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wp=(t,e)=>{for(var r in e)rt(t,r,{get:e[r],enumerable:!0})},zs=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tp(e))!Up.call(t,i)&&i!==r&&rt(t,i,{get:()=>e[i],enumerable:!(s=Rp(e,i))||s.enumerable});return t};var a=(t,e,r)=>(r=t!=null?Ap(Np(t)):{},zs(e||!t||!t.__esModule?rt(r,"default",{value:t,enumerable:!0}):r,t)),Bp=t=>zs(rt({},"__esModule",{value:!0}),t);var qr=qp((ql,Jp)=>{Jp.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"2.0.0-beta.0",description:"The develop step of Extension.js",main:"./dist/module.js",types:"./dist/module.d.ts",files:["dist"],author:{name:"Cezar Augusto",email:"boss@cezaraugusto.net",url:"https://cezaraugusto.com"},scripts:{clean:"rm -rf dist",watch:"tsup-node ./module.ts --format cjs --dts --target=node18 --watch",compile:"tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",test:"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.*'","test:coverage":"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts' --coverage","test:build":"jest ./build.spec.ts --no-cache"},dependencies:{"@colors/colors":"^1.6.0","@swc/core":"^1.7.3","@types/firefox-webext-browser":"^120.0.4",acorn:"^8.12.1","acorn-walk":"^8.3.3","adm-zip":"^0.5.12",ajv:"^8.17.1",astring:"^1.8.6",axios:"^1.6.8","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.3","css-loader":"^6.10.0","csv-loader":"^3.0.5",dotenv:"^16.4.5","dotenv-webpack":"^8.0.1","edge-location":"^1.0.0","firefox-profile":"^4.6.0","fx-runner":"^1.4.0","go-git-it":"2.0.4",ignore:"^5.3.1","loader-utils":"^3.3.1",micromatch:"^4.0.7","mini-css-extract-plugin":"^2.8.1","package-manager-detector":"^0.2.0",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.45",progress:"^2.0.3","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9","vue-template-compiler":"^2.7.16","webextension-polyfill":"^0.12.0",webpack:"~5.92.0","webpack-dev-server":"^5.0.2","webpack-merge":"^6.0.1","webpack-target-webextension":"^1.1.2",which:"^4.0.0",ws:"^8.18.0"},devDependencies:{"@types/adm-zip":"^0.5.5","@types/case-sensitive-paths-webpack-plugin":"^2.1.9","@types/chrome":"^0.0.270","@types/cross-spawn":"^6.0.6","@types/dotenv-webpack":"^7.0.7","@types/jest":"^29.5.12","@types/loader-utils":"^2.0.6","@types/node":"^22.5.3","@types/webextension-polyfill":"^0.10.7","@types/ws":"^8.5.12",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@prefresh/webpack":"^4.0.1","babel-loader":"^9.1.3","less-loader":"^12.2.0","postcss-flexbugs-fixes":"^5.0.2","postcss-loader":"^8.1.1","postcss-normalize":"^10.0.1","postcss-preset-env":"^9.6.0","postcss-scss":"^4.0.9","react-refresh":"^0.14.2","react-refresh-typescript":"^2.0.9","resolve-url-loader":"^5.0.0","sass-loader":"^16.0.0","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var Rl={};Wp(Rl,{extensionBuild:()=>hp,extensionDev:()=>$p,extensionPreview:()=>Fp,extensionStart:()=>Mp});module.exports=Bp(Rl);var mp=a(require("fs")),Rs=a(require("path")),dp=a(require("webpack")),gp=require("webpack-merge");var et=a(require("path"));var Si=a(require("case-sensitive-paths-webpack-plugin"));var zr=a(require("fs")),nt=a(require("path")),oe=require("webpack"),Jr=a(require("dotenv"));var Wr=a(require("path")),f=require("@colors/colors/safe");var Js=a(require("path")),st=Js.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),Q=["chrome","edge"],zp=["firefox"],Nl=[...Q,...zp];var Hs=require("console");function x(t,e){return e==="error"?`${(0,f.bold)((0,f.red)("ERROR"))} in ${t} ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:e==="warn"?`${t} ${(0,f.brightYellow)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:`${e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)}`}function Vs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Gs(t,e,r){if(!!1)return`${r.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${r.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Xs(t,e){return`${(0,Hs.info)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}. Installing required dependencies via ${(0,f.brightYellow)(e)}...`}function Zs(){return`${(0,f.cyan)("\u25BA\u25BA\u25BA")} ${(0,f.magenta)(".env")} file loaded ${(0,f.brightGreen)("successfully")}.`}function S(t){return`${(0,f.cyan)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}...`}function D(t){return`${x(t,"success")} installation completed. Run the program again and happy hacking.`}function Ks(t){return`${x(t,"info")} dependencies are being installed. This only happens for core contributors...`}function Ys(t){return`${x(t,"success")} dependencies installed ${(0,f.brightGreen)("successfully")}.`}function Qs(t,e){return`${x("Integration","error")} ${t} Installation Error
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Run the program again to start hacking with ${(0,f.magenta)(e)} support.`}function Wr(t,e){return`${w(t,"info")} Installing Root Dependencies
|
|
6
|
-
|
|
7
|
-
Installing ${(0,f.magenta)(e)} dependencies in Extension.js root. This only happens for authors and contributors.`}function Br(t,e){return`${w(t,"success")} ${e} Dependencies Installed ${(0,f.brightGreen)("Successfully")}.`}function Jr(t,e,s){return`${w(t,"error")} ${(0,f.magenta)(e)} Installation Error
|
|
8
|
-
|
|
9
|
-
Failed to detect package manager or install ${(0,f.magenta)(e)} dependencies: ${(0,f.red)(s?.toString()||"")}`}function zr(t){return`${w(t,"error")} No Service Worker Support
|
|
3
|
+
Failed to detect package manager or install ${t} dependencies:
|
|
4
|
+
${(0,f.red)(e?.toString()||"")}`}function ei(){return`${x("Firefox runner","error")} No Service Worker Support
|
|
10
5
|
|
|
11
6
|
Firefox does not support the ${(0,f.brightYellow)("background.service_worker")} field yet.
|
|
12
7
|
Update your manifest.json file to use ${(0,f.brightYellow)("background.scripts")} instead.
|
|
8
|
+
If you really need to keep the ${(0,f.brightYellow)("service_worker")} field, prefix it with
|
|
9
|
+
${(0,f.brightYellow)("chromium:")} so it can target only Chromium-based browsers.
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
Mozilla bug: ${(0,f.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function ti(){return`${x("content-security-policy","error")} Insecure Content-Security-Policy
|
|
15
12
|
|
|
16
|
-
Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function
|
|
13
|
+
Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function ri(){return`${x("_locales","error")} No Default Locale Specified
|
|
17
14
|
|
|
18
|
-
Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function
|
|
15
|
+
Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function xe(t){return t==="chrome"?(0,f.underline)("https://developer.chrome.com/docs/extensions/reference/manifest"):(0,f.underline)("https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json")}function si(t){return`${x("manifest.json","error")} Wrong Manifest Field Type
|
|
19
16
|
|
|
20
17
|
Field ${(0,f.brightYellow)("web_accessible_resources")} must be a string array in Manifest version 2.
|
|
21
18
|
|
|
22
|
-
Read more: ${
|
|
19
|
+
Read more: ${xe(t)}`}function ii(t){return`${x("manifest.json","error")} Wrong Manifest Field Type
|
|
23
20
|
|
|
24
21
|
Field ${(0,f.brightYellow)("web_accessible_resources")} must be an array of objects in Manifest version 3.
|
|
25
22
|
|
|
26
|
-
Read more: ${
|
|
23
|
+
Read more: ${xe(t)}`}function oi(t,e){let s=e?.schemaPath?.split("/"),i=s?.slice(s.length-2).shift();return`${x("manifest.json","error")} Deprecated Field
|
|
27
24
|
|
|
28
|
-
Field ${(0,f.brightYellow)(
|
|
25
|
+
Field ${(0,f.brightYellow)(i||"")} is deprecated in Manifest V3. Update your manifest.json file to run your extension.
|
|
29
26
|
|
|
30
|
-
Read more: ${
|
|
27
|
+
Read more: ${xe(t)}`}function ni(t,e){let r=t?.instancePath.replaceAll("/",".").slice(1)||"",s=t?.params.type;return`${x("manifest.json","error")} Invalid Manifest Field
|
|
31
28
|
|
|
32
|
-
Field ${(0,f.brightYellow)(r)} must be of type ${(0,f.brightBlue)(
|
|
29
|
+
Field ${(0,f.brightYellow)(r)} must be of type ${(0,f.brightBlue)(s)}.
|
|
33
30
|
|
|
34
|
-
Read more: ${
|
|
31
|
+
Read more: ${xe(e)}`}function ai(t,e){return`${x("manifest.json","error")} Missing Required Manifest Field
|
|
35
32
|
|
|
36
|
-
Field ${(0,f.brightYellow)(
|
|
33
|
+
Field ${(0,f.brightYellow)(e||"")} is required. Update your manifest.json file to run your extension.
|
|
37
34
|
|
|
38
|
-
Read more: ${
|
|
35
|
+
Read more: ${xe(t)}`}function ci(t,e){let r=e.split(".").pop(),s=`${x(t,"error")} Content Script Import
|
|
39
36
|
|
|
40
|
-
One of your ${
|
|
41
|
-
Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return
|
|
37
|
+
One of your ${r?.toUpperCase()} imports is also a ${(0,f.brightYellow)("content_script")} CSS in manifest.json.
|
|
38
|
+
Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return s}function pi(t){return`${x(t,"error")} Top Level Await In Non-ECMAScript Module
|
|
42
39
|
|
|
43
40
|
Top-level await is only supported in ECMAScript modules.
|
|
44
41
|
To use it in your extension, make sure to set ${(0,f.brightYellow)('"type": "module"')}
|
|
45
|
-
in your package.json or use the ${(0,f.brightYellow)(".mjs")} extension for your script files.`}function
|
|
46
|
-
|
|
47
|
-
`:r;return`${w(t,"error")} File Not Found
|
|
48
|
-
|
|
49
|
-
${n?`Check the ${(0,f.brightYellow)("pages")} folder in your project root directory.
|
|
50
|
-
|
|
51
|
-
`:`Check the ${(0,f.brightYellow)(o)} field in your manifest.json file.
|
|
42
|
+
in your package.json or use the ${(0,f.brightYellow)(".mjs")} extension for your script files.`}function it(t,e){if(!t)throw new Error("This operation is impossible. Please report a bug.");switch(Wr.default.extname(e)){case".js":case".ts":case".jsx":case".tsx":return Hp(t,e);case".css":case".scss":case".sass":case".less":return Vp(t,e);default:return Gp(t,e)}}function ie(t,e,r){let s=e.startsWith("content_scripts")?"content_scripts":e.replace("/","."),i=e.split("-")[1],o=e.startsWith("pages"),n=t.includes("content_scripts")?`(index ${i})
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
`:s;return`${x("manifest.json","error")} File Not Found
|
|
54
45
|
|
|
55
|
-
Check the ${(0,f.brightYellow)(
|
|
46
|
+
${o?`Check the ${(0,f.brightYellow)("pages")} folder in your project root directory.
|
|
47
|
+
`:`Check the ${(0,f.brightYellow)(n)} field in your manifest.json file.
|
|
48
|
+
`}${(0,f.red)("NOT FOUND")} ${(0,f.underline)(r)}`}function ot(t,e){return`File Not Found
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
Check the ${(0,f.brightYellow)(t)} field in your manifest.json file.
|
|
51
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function li(t,e){return`${x(t,"error")} Manifest Not Found
|
|
58
52
|
|
|
59
|
-
Ensure you have a manifest.json file at the root directory of your project
|
|
53
|
+
Ensure you have a manifest.json file at the root directory of your project.
|
|
54
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function fi(t){return`${x("manifest.json","error")} Invalid Manifest
|
|
60
55
|
|
|
61
|
-
Update your manifest.json file and try again. `+
|
|
62
|
-
`,
|
|
56
|
+
Update your manifest.json file and try again. `+(0,f.red)(t.toString())}function ui(t,e){let r=e&&`${(0,f.gray)("PATH")} ${(0,f.red)("REMOVED")} ${(0,f.underline)(e)}
|
|
57
|
+
`,s=t&&`${(0,f.gray)("PATH")} ${(0,f.brightGreen)("ADDED")} ${(0,f.underline)(t)}`;return`$manifest.json ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Manifest Entry Point Modification
|
|
63
58
|
|
|
64
|
-
Changing the path of ${(0,f.brightYellow)("
|
|
65
|
-
|
|
66
|
-
`+s+r}function ii(t,e,s,r,i){let n=t.charAt(0).toUpperCase()+t.slice(1);return`${w("manifest.json","error")} Manifest Entry Point Modification
|
|
67
|
-
|
|
68
|
-
${n} ${(0,f.brightYellow)(r)} in the ${(0,f.underline)(s+"/")} folder after compilation requires a server restart.
|
|
59
|
+
Changing the path of ${(0,f.brightYellow)("HTML")} or ${(0,f.brightYellow)("script")} files in manifest.json after compilation requires a server restart.
|
|
60
|
+
`+r+s}function mi(t,e,r,s,i){let o=t.charAt(0).toUpperCase()+t.slice(1);return`${x("manifest.json","error")} Manifest Entry Point Modification
|
|
69
61
|
|
|
70
|
-
${(0,f.
|
|
71
|
-
|
|
72
|
-
${(0,f.bold)((0,f.red)("ERROR"))} in ${w(r,"error")} No data received from the extension client.
|
|
62
|
+
${o} ${(0,f.brightYellow)(s)} in the ${(0,f.underline)(r+"/")} folder after compilation requires a server restart.
|
|
63
|
+
${(0,f.gray)("PATH")} ${(0,f.underline)(i)}`}function di(){return`${x("TypeScript","info")} is being used but no config file was found. Creating ${(0,f.brightYellow)("tsconfig.json")}...`}function Br(t,e,r){let s=t.name||"Extension.js",i;switch(e){case"chrome":i="chrome://extensions";break;case"edge":i="edge://extensions";break;case"firefox":i="about:debugging#/runtime/this-firefox";break;default:i=""}if(!r.data)return`${x(s,"error")} No Client Data Received
|
|
73
64
|
|
|
74
65
|
This error happens when the program can't get the data from your extension.
|
|
75
66
|
There are many reasons this might happen. To fix, ensure that:
|
|
76
67
|
|
|
77
|
-
- Your extension is set as enabled in ${(0,f.underline)(i)}
|
|
78
|
-
|
|
68
|
+
- Your extension is set as enabled in ${(0,f.underline)(i)}
|
|
69
|
+
- No previous ${Vs(e)} browser instance is open
|
|
70
|
+
|
|
71
|
+
If that is not the case, restart both the ${(0,f.cyan)(t.name||"")} and the
|
|
72
|
+
${(0,f.brightYellow)("Manager Extension")} in ${(0,f.underline)(i)} and try again.
|
|
79
73
|
|
|
80
|
-
If
|
|
74
|
+
If the issue still persists, please report a bug:
|
|
81
75
|
|
|
82
|
-
`+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:
|
|
76
|
+
`+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:o,management:n}=r.data;if(!n&&process.env.EXTENSION_ENV==="development")return`${x(s,"error")} No management API info received from client. Investigate.`;let{name:c,version:p}=n,l=qr().version;return`
|
|
83
77
|
\u{1F9E9} ${(0,f.brightGreen)("Extension.js")} ${(0,f.gray)(`${l}`)}
|
|
84
78
|
Extension Name ${(0,f.gray)(c)}
|
|
85
79
|
Extension Version ${(0,f.gray)(p)}
|
|
86
|
-
Extension ID ${(0,f.gray)(
|
|
87
|
-
|
|
88
|
-
\u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function ai(t,e){return`${w(t,"error")} WebSocket: ${e}`}function ci(t,e,s){return`
|
|
80
|
+
Extension ID ${(0,f.gray)(o)}`}function gi(t){return`This is your first run using Extension.js via ${Vs(t)}. Welcome! \u{1F389}
|
|
89
81
|
|
|
90
|
-
${(0,f.
|
|
82
|
+
\u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function hi(t){return`${x("WebSocket","error")} General WebSocket Error:
|
|
83
|
+
${(0,f.red)(t)}`}function yi(t,e){return`${x("manifest.json","error")} File Not Found
|
|
91
84
|
|
|
92
|
-
Check the ${(0,f.brightYellow)(
|
|
93
|
-
|
|
94
|
-
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}}`}function pi(t,e){return`${w(t,"error")} HTML Entry Point Modification
|
|
85
|
+
Check the ${(0,f.brightYellow)(t.replace("/","."))} field in your manifest.json file.
|
|
86
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function bi(t){return`${x("HTML","error")} Entry Point Modification
|
|
95
87
|
|
|
96
88
|
Changing the path of ${(0,f.brightYellow)("<script>")} or ${(0,f.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
|
|
89
|
+
${(0,f.gray)("PATH")} ${(0,f.underline)(t)}`}function Hp(t,e){return`${x("HTML","error")} File Not Found
|
|
97
90
|
|
|
98
|
-
${(0,f.
|
|
99
|
-
|
|
100
|
-
Check your ${(0,f.brightYellow)("<script>")} tags in ${(0,f.underline)(e)}.
|
|
101
|
-
|
|
102
|
-
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Np(t,e,s){return`${w(t,"error")} File Not Found
|
|
91
|
+
Check your ${(0,f.brightYellow)("<script>")} tags in ${(0,f.underline)(t)}.
|
|
92
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function Vp(t,e){return`${x("HTML","error")} File Not Found
|
|
103
93
|
|
|
104
|
-
Check your ${(0,f.brightYellow)("<link>")} tags in ${(0,f.underline)(
|
|
94
|
+
Check your ${(0,f.brightYellow)("<link>")} tags in ${(0,f.underline)(t)}.
|
|
95
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function Gp(t,e){let r=Wr.default.extname(e);return`${x("HTML","warn")} File Not Found
|
|
105
96
|
|
|
106
|
-
${(0,f.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function li(){return`${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.
|
|
111
|
-
By default, your ${(0,f.brightYellow)("manifest.json")} file is not being watched. To enable this feature, run:
|
|
97
|
+
Check your ${(0,f.brightYellow)("*"+r)} assets in ${(0,f.underline)(t)}.
|
|
98
|
+
${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function wi(){return`${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.
|
|
99
|
+
By default, your manifest.json file is not being watched. To enable this feature, run:
|
|
112
100
|
|
|
113
101
|
npx -y mkcert-cli \\
|
|
114
|
-
${(0,f.brightGreen)("--outDir")} ${(0,f.underline)(
|
|
102
|
+
${(0,f.brightGreen)("--outDir")} ${(0,f.underline)(st)} \\
|
|
115
103
|
${(0,f.brightGreen)("--cert")} ${(0,f.brightYellow)("localhost.cert")} \\
|
|
116
104
|
${(0,f.brightGreen)("--key")} ${(0,f.brightYellow)("localhost.key")}
|
|
117
105
|
|
|
118
106
|
This will enable the secure certificate needed for Firefox via ${(0,f.bold)("mkcert")}.
|
|
119
107
|
|
|
120
|
-
Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/FiloSottile/mkcert")}`}function
|
|
121
|
-
|
|
122
|
-
For MAIN world content scripts, you must specify an extension ID.
|
|
123
|
-
Otherwise, the content script won't reload on changes.
|
|
124
|
-
Add an ${(0,f.brightYellow)("id")} field to your manifest.json file and try again.`}var Ke=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=M.default.dirname(this.manifestPath),i=require(this.manifestPath).name||"Extension.js";(V.default.existsSync(M.default.join(s,".env"))||V.default.existsSync(M.default.join(s,".env.example"))||V.default.existsSync(M.default.join(s,".env.local"))||V.default.existsSync(M.default.join(s,".env.defaults")))&&(console.log(Ur(i)),new mi.default({path:V.default.existsSync(M.default.join(s,".env"))?M.default.join(s,".env"):V.default.existsSync(M.default.join(s,".env.local"))?M.default.join(s,".env.local"):M.default.join(s,".env.example"),allowEmptyValues:!0,defaults:V.default.existsSync(M.default.join(s,".env.defaults")),systemvars:!0}).apply(e))}};var Js=a(require("fs")),di=a(require("path")),Qe=class{apply(e){let s=di.default.join(e.options.output.path||"","hot");Js.default.existsSync(s)&&(Js.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var et=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new gi.default().apply(e),new Ke({manifestPath:this.manifestPath}).apply(e),new Qe().apply(e),e.hooks.done.tap("develop:brand",s=>{s.compilation.name=void 0;let r=s.endTime-s.startTime,i=require(this.manifestPath).name;console.log(Nr(i,r,s))})}};var Mi=a(require("path")),Ti=a(require("mini-css-extract-plugin"));var Fi=a(require("mini-css-extract-plugin"));var ce=a(require("path")),ke=a(require("fs"));var te=a(require("path")),tt=a(require("fs")),zs=require("child_process"),hi=require("detect-package-manager");function yi(t,e){return Object.values(e||{}).some(s=>s===t)}function h(t,e,s){let r=te.default.extname(e),n=P(e,s)?te.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(r)&&(n=n.replace(r,".js")),[".html",".njk",".nunjucks"].includes(r)&&(n=n.replace(r,".html")),[".css",".scss",".sass",".less"].includes(r)&&(n=n.replace(r,".css")),Hs(n||"")}function Hs(t){return t.replace(/\\/g,"/")}function P(t,e={}){if(!e)return!1;let s=te.default.normalize(Hs(t));return Object.values(e).some(i=>typeof i!="string"?!1:Hs(i).includes(s))}function G(t,e){if(t.getAsset("manifest.json")||t.assets["manifest.json"]){let s=t.assets["manifest.json"].source().toString();return JSON.parse(s||"{}")}return require(e)}async function _(t,e,s){try{let r=await(0,hi.detect)();console.log(qr(t,e,r));let i=process.env._;if(!i)return null;let n=i.split(te.default.sep).pop()?.toLowerCase(),o="";r==="yarn"?o=`yarn --silent add ${s.join(" ")} --cwd ${__dirname} --optional`:r==="npm"||n==="npx"?o=`npm --silent install ${s.join(" ")} --prefix ${__dirname} --save-optional`:r==="pnpm"||n==="pnpx"?o=`pnpm --silent add ${s.join(" ")} --prefix ${__dirname} --save-optional`:o=`${r} --silent install ${s.join(" ")} --cwd ${__dirname} --optional`,(0,zs.execSync)(o,{stdio:"inherit"}),await new Promise(c=>setTimeout(c,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Wr(t,e)),r==="yarn"?o="yarn install --silent > /dev/null 2>&1":r==="npm"?o="npm install --silent > /dev/null 2>&1":r==="pnpm"?o="pnpm install --silent > /dev/null 2>&1":o=`${r} install --silent > /dev/null 2>&1`,(0,zs.execSync)(o,{stdio:"inherit"})),console.log(Br(t,e))}catch(r){console.error(Jr(t,e,r))}}function st(t){let e=te.default.join(t,"package.json");if(!tt.default.existsSync(e))return!1;let s=JSON.parse(tt.default.readFileSync(e,"utf-8")),r=["react","vue","@angular/core","svelte","solid-js","preact"],i=s.dependencies||{},n=s.devDependencies||{};for(let o of r)if(i[o]||n[o])return!0;return!1}function bi(t){return!tt.default.existsSync(te.default.resolve(__dirname,`run-${t}-profile`))}function wi(t){let e=t.name?.replace(/ /g,"-").toLowerCase();return{data:{id:`${e}@extension-js`,manifest:t,management:{id:`${e}@extension-js`,mayDisable:!0,optionsUrl:"",installType:"development",type:"extension",enabled:!0,name:t.name||"",description:t.description||"",version:t.version||"",hostPermissions:t.host_permissions||[],permissions:t.permissions||[],offlineEnabled:t.offline_enabled||!1,shortName:t.short_name||"",isApp:t.app&&t.app.background&&t.app.background.scripts}}}}function rt(t,e){return JSON.parse(JSON.stringify(t),function(i,n){let o=i.indexOf(":");if(o===-1)return n;let c=i.substring(0,o);(c===e||c==="chromium"&&Se.includes(e))&&(this[i.substring(o+1)]=n)})}var xi=!1;function it(t){let e=ce.default.join(t,"package.json"),s=ce.default.join(t,"manifest.json");if(!ke.default.existsSync(e))return!1;let r=Up(t),i=require(e),n=i.devDependencies&&i.devDependencies.tailwindcss,o=i.dependencies&&i.dependencies.tailwindcss,c=!!r&&!!(n||o);if(c&&!xi){let l=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(l,"Tailwind")),xi=!0}return c}function Up(t){let e=ce.default.join(t,"tailwind.config.mjs"),s=ce.default.join(t,"tailwind.config.cjs"),r=ce.default.join(t,"tailwind.config.js");if(ke.default.existsSync(e))return e;if(ke.default.existsSync(s))return s;if(ke.default.existsSync(r))return r}var nt=a(require("path")),_i=a(require("fs"));var vi=!1;function Ee(t){let e=nt.default.join(t,"package.json"),s=nt.default.join(t,"manifest.json");if(!_i.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.sass,n=r.dependencies&&r.dependencies.sass;if(i||n){if(!vi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"SASS")),vi=!0}return!0}return!1}async function Si(t,e){if(!Ee(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],i=require(nt.default.join(t,"package.json")).name;await _(i,"PostCSS",r),await _(i,"SASS",["sass","sass-loader","resolve-url-loader"]),console.log(E(i,"SASS")),process.exit(0)}return[{test:/\.(s(a|c)ss)$/,exclude:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var ot=a(require("path")),ki=a(require("fs"));var Pi=!1;function je(t){let e=ot.default.join(t,"package.json"),s=ot.default.join(t,"manifest.json"),i=require(s).name||"Extension.js";if(!ki.default.existsSync(e))return!1;let n=require(e),o=n.devDependencies&&n.devDependencies.less,c=n.dependencies&&n.dependencies.less;return o||c?(Pi||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"LESS")),Pi=!0),!0):!1}async function Ei(t,e){if(!je(t))return[];try{require.resolve("less-loader")}catch{let r=require(ot.default.join(t,"package.json")).name;await _(r,"LESS",["less","less-loader","resolve-url-loader"]),console.log(E(r,"LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var le=a(require("path")),at=a(require("fs"));var pe=!1;function Wp(t){let e=le.default.join(t,"package.json"),s=le.default.join(t,"manifest.json");if(!at.default.existsSync(e))return!1;let r=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"],n=require(s).name||"Extension.js";if(at.default.existsSync(e)){let o=require(e);if(o.dependencies&&o.dependencies.postcss||o.devDependencies&&o.devDependencies.postcss)return pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0}for(let o of r)if(at.default.existsSync(le.default.join(t,o)))return pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0;return it(t)?(pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0):!1}async function ji(t,e){if(!Wp(t))return{};try{require.resolve("postcss-loader")}catch{let r=require(le.default.join(t,"package.json")).name;!Ee(t)&&!je(t)&&await _(r,"PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(E(r,"PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:le.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}var ct=a(require("path")),Ci=a(require("fs"));var $i=!1;function $e(t){let e=ct.default.join(t,"package.json"),s=ct.default.join(t,"manifest.json");if(!Ci.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.vue,n=r.dependencies&&r.dependencies.vue;if((i||n)&&!$i){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Vue")),$i=!0}return!!i||!!n}async function Di(t){if(!$e(t))return;try{require.resolve("vue-loader")}catch{let i=["typescript"],o=require(ct.default.join(t,"manifest.json")).name||"Extension.js";await _(o,"TypeScript",i),await _(o,"Vue",["vue-loader","@vue/compiler-sfc","vue-template-compiler","vue-style-loader"]),console.log(E(o,"Vue")),process.exit(0)}let e=[{test:/\.vue$/,loader:require.resolve("vue-loader"),include:t,exclude:/node_modules/}];return{plugins:[new(require("vue-loader")).VueLoaderPlugin],loaders:e,alias:void 0}}async function A(t,e){let s=Fi.default.loader,r=[e.useMiniCssExtractPlugin?s:$e(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{importLoaders:1}}].filter(Boolean);if(it(t)||Ee(t)||je(t)){let i=await ji(t,e);i.loader&&r.push(i)}return e.loader&&r.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:e.mode==="development",root:t}},{loader:require.resolve(e.loader),options:{sourceMap:e.mode==="development"}}),r.filter(Boolean)}var C=a(require("path")),T=a(require("fs"));function Oi(t){let e=C.default.join(t,"stylelint.config.json"),s=C.default.join(t,".stylelintrc.js file"),r=C.default.join(t,"stylelint.config.mjs"),i=C.default.join(t,".stylelintrc.mjs"),n=C.default.join(t,"stylelint.config.cjs"),o=C.default.join(t,".stylelintrc.cjs"),c=C.default.join(t,".stylelintrc.json"),p=C.default.join(t,".stylelintrc"),l=C.default.join(t,".stylelintrc.yml"),u=C.default.join(t,".stylelintrc.yaml");if(T.default.existsSync(e))return e;if(T.default.existsSync(s))return s;if(T.default.existsSync(r))return r;if(T.default.existsSync(i))return i;if(T.default.existsSync(n))return n;if(T.default.existsSync(o))return o;if(T.default.existsSync(c))return c;if(T.default.existsSync(p))return p;if(T.default.existsSync(l))return l;if(T.default.existsSync(u))return u}var Li=!1;function Ii(t){let e=C.default.join(t,"package.json"),s=C.default.join(t,"manifest.json");if(!T.default.existsSync(e))return!1;let i=!!Oi(t);if(i&&!Li){let o=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(o,"Stylelint")),Li=!0}return i}async function Ai(t){if(!Ii(t))return[];try{require.resolve("stylelint")}catch{let r=["stylelint","stylelint-webpack-plugin","stylelint-config-standard-scss"],i=require(C.default.join(t,"package.json")).name;await _(i,"Stylelint",r),console.log(E(i,"Stylelint")),process.exit(0)}let e=require("stylelint-webpack-plugin");return[new e({context:t,configFile:Ii(t)?Oi(t):C.default.join(__dirname,"stylelint.config.json"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",C.default.join(t,"node_modules")]})]}var pt=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Mi.default.dirname(this.manifestPath),r=[new Ti.default];r.forEach(p=>p.apply(e));let i=await Ai(s);r.push(...i);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]}];e.options.plugins=[...e.options.plugins,...r].filter(Boolean);let o=await Si(s,this.mode),c=await Ei(s,this.mode);n.push(...o),n.push(...c),e.options.module.rules=[...e.options.module.rules,...n].filter(Boolean)}async apply(e){if(this.mode==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var lt=class{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async apply(e){let s={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},i=[...e.options.module.rules.some(n=>n&&n.test instanceof RegExp&&n.test.test(".svg")&&n.use!==void 0)?[]:[s],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}};var Vs=a(require("path"));var ue=a(require("path")),mt=a(require("fs"));var ft=a(require("path")),Ni=a(require("fs"));var Ri=!1;function X(t){let e=ft.default.join(t,"package.json"),s=ft.default.join(t,"manifest.json");if(!Ni.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.preact,n=r.dependencies&&r.dependencies.preact;if((i||n)&&!Ri){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Preact")),Ri=!0}return!!i||!!n}async function qi(t){if(!X(t))return;try{require.resolve("@prefresh/webpack")}catch{let r=["@prefresh/webpack"],n=require(ft.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"Preact",r),console.log(E(n,"Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var fe=a(require("path")),ut=a(require("fs"));var Ui=!1;function R(t){let e=fe.default.join(t,"package.json");if(!ut.default.existsSync(e))return!1;let s=Jp(t),r=require(e),i=require(fe.default.join(t,"manifest.json")),n=i.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,c=r.dependencies&&r.dependencies.typescript;return Ui||((o||c)&&(s?process.env.EXTENSION_ENV==="development"&&console.log(v(n,"TypeScript")):(console.log(ni(i)),zp(t))),Ui=!0),!!s&&!!(o||c)}function Bp(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:st(t)?"react-jsx":"preserve",lib:["dom","dom.iterable","esnext"],moduleResolution:"node",module:"esnext",resolveJsonModule:!0,strict:!0,target:"esnext",isolatedModules:!1,skipLibCheck:!0},exclude:["node_modules","dist"]}}function Jp(t){let e=fe.default.join(t,"tsconfig.json");if(ut.default.existsSync(e))return e}function zp(t){ut.default.writeFileSync(fe.default.join(t,"tsconfig.json"),JSON.stringify(Bp(t,{mode:"development"}),null,2))}async function Wi(t){if(!R(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],i=require(fe.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"TypeScript",s),console.log(E(i,"TypeScript")),process.exit(0)}return!0}var Bi=!1,Ji=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Hp(t){let e=ue.default.join(t,"package.json"),s=ue.default.join(t,"manifest.json");if(!mt.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies["babel-core"],n=r.dependencies&&r.dependencies["babel-core"],o=Ji.some(c=>mt.default.existsSync(ue.default.join(t,c)))||!!i||!!n;if(o&&!Bi){let p=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(v(p,"Babel")),Bi=!0}return o}function Vp(t){for(let e of Ji){let s=ue.default.join(t,e);if(mt.default.existsSync(s))return s}}function Gp(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Vp(t),compact:e.mode==="production",overrides:[s(e).overrides],presets:[...s(e).presets],plugins:[...s(e).plugins,process.env.NODE_ENV!=="test"&&e.mode==="development"&&X(t)&&require.resolve("react-refresh/babel")].filter(Boolean)}}async function zi(t,e){if(!Hp(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(ue.default.join(e,"manifest.json")).name||"Extension.js";await _(p,"Babel",o),console.log(E(p,"Babel")),process.exit(0)}let s=R(e)?/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/:/\.(js|mjs|jsx|mjsx)$/,r=t.options.mode,i=await Wi(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Gp(e,{mode:r,typescript:i})}],alias:void 0}}var dt=a(require("path")),Vi=a(require("fs"));var Hi=!1;function me(t){let e=dt.default.join(t,"package.json"),s=dt.default.join(t,"manifest.json");if(!Vi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.react,n=r.dependencies&&r.dependencies.react;if((i||n)&&!Hi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"React")),Hi=!0}return!!i||!!n}async function Gi(t){if(!me(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{let r=["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"],n=require(dt.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"React",r),console.log(E(n,"React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))({overlay:!1})],loaders:void 0,alias:void 0}}var gt=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Vs.default.dirname(this.manifestPath),r=await zi(e,s),i=await Gi(s),n=await qi(s),o=await Di(s);e.options.resolve.alias={...r?.alias||{},...i?.alias||{},...n?.alias||{},...o?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Vs.default.dirname(this.manifestPath)],exclude:/node_modules/,use:{loader:require.resolve("swc-loader"),options:{sync:!0,module:{type:"es6"},minify:this.mode==="production",isModule:!0,jsc:{target:"es2016",parser:{syntax:R(s)?"typescript":"ecmascript",tsx:R(s)&&(me(s)||X(s)),jsx:!R(s)&&(me(s)||X(s)),dynamicImport:!0},transform:{react:{development:this.mode==="development",refresh:this.mode==="development",runtime:"automatic",importSource:"react"}}}}}},...r?.loaders||[],...i?.loaders||[],...n?.loaders||[],...o?.loaders||[],...e.options.module.rules].filter(Boolean),i?.plugins?.forEach(c=>c.apply(e)),n?.plugins?.forEach(c=>c.apply(e)),o?.plugins?.forEach(c=>c.apply(e))}async apply(e){if(this.mode==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var Te=a(require("path"));var On=a(require("path"));var Xi=a(require("path"));function Zi(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return Xi.default.join(t,s)}var Yi=a(require("path"));function Ki(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return Yi.default.join(t,s)}var ht=a(require("path"));function Qi(t,e){let s={newtab:void 0};if(!e||!e.chrome_url_overrides)return{"chrome_url_overrides/newtab":void 0};if(e.chrome_url_overrides.history){let r=e.chrome_url_overrides.history;s={"chrome_url_overrides/history":ht.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":ht.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":ht.default.join(t,r)}}return s}var en=a(require("path"));function tn(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return en.default.join(t,s)}var Gs=a(require("path"));function sn(t,e){if(e.options_page){let r=e.options_page;return Gs.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return Gs.default.join(t,s)}var rn=a(require("path"));function nn(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return rn.default.join(t,s)}var on=a(require("path"));function an(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let s=e.sandbox.pages,r={};for(let[i,n]of s.entries())r[`sandbox/page-${i}`]=on.default.join(t,n);return r}var cn=a(require("path"));function pn(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return cn.default.join(t,s)}var ln=a(require("path"));function fn(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return ln.default.join(t,s)}function Ce(t,e){return{"action/default_popup":Zi(t,e),"browser_action/default_popup":Ki(t,e),...Qi(t,e),devtools_page:tn(t,e),"options_ui/page":sn(t,e),"page_action/default_popup":nn(t,e),...an(t,e),"side_panel/default_path":pn(t,e),"sidebar_action/default_panel":fn(t,e)}}var Xs=a(require("path"));function un(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Xs.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Xs.default.join(t,e.action.default_icon[r]));return s}var Zs=a(require("path"));function mn(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return Zs.default.join(t,e.browser_action.default_icon);for(let r in e.browser_action.default_icon){let i=e.browser_action.default_icon[r]=Zs.default.join(t,e.browser_action.default_icon[r]);s.push(i)}return s}var Ys=a(require("path"));function dn(t,e){if(!(!e||!e.browser_action||!e.browser_action.theme_icons)){for(let s of e.browser_action.theme_icons)s.light&&(s.light=Ys.default.join(t,s.light)),s.dark&&(s.dark=Ys.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var gn=a(require("path"));function hn(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let i=gn.default.join(t,e.icons[r]);s.push(i)}return s}var Ks=a(require("path"));function yn(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return Ks.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let i=Ks.default.join(t,e.page_action.default_icon[r]);s.push(i)}return s}var bn=a(require("path"));function wn(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:bn.default.join(t,e.sidebar_action.default_icon)}function xn(t,e){return{action:un(t,e),browser_action:mn(t,e),"browser_action/theme_icons":dn(t,e),icons:hn(t,e),page_action:yn(t,e),sidebar_action:wn(t,e)}}var vn=a(require("path"));function _n(t,e){let s={};return!e||!e.declarative_net_request||!e.declarative_net_request.rule_resources?{"declarative_net_request/rule_resources-0":void 0}:(e.declarative_net_request.rule_resources.forEach(i=>{s[`declarative_net_request/${i.id}`]=vn.default.join(t,i.path)}),s)}var Sn=a(require("path"));function Pn(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return Sn.default.join(t,s)}function kn(t,e){return{..._n(t,e),"storage/managed_schema":Pn(t,e)}}var En=a(require("path"));function jn(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>En.default.join(t,r))}var $n=a(require("path"));function Cn(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return $n.default.join(t,s)}var Qs=a(require("path"));function Dn(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let s=n=>{if(n.js?.length!==0)return n.js?.map(o=>Qs.default.join(t,o))},r=n=>{if(n.css?.length!==0)return n.css?.map(o=>Qs.default.join(t,o))},i={};for(let[n,o]of e.content_scripts.entries()){let c=s(o),p=r(o);i[`content_scripts/content-${n}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return i}var Fn=a(require("path"));function Ln(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return Fn.default.join(t,s)}function De(t,e){return{"background/scripts":jn(t,e),"background/service_worker":Cn(t,e),...Dn(t,e),"user_scripts/api_script":Ln(t,e)}}function In(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function Xp(t){function e(s){let r={};for(let i in s)if(s.hasOwnProperty(i)){let n=i.includes(":")?i.split(":")[1]:i;typeof s[i]=="object"&&!Array.isArray(s[i])?r[n]=e(s[i]):r[n]=s[i]}return r}return e(t)}function An({manifestPath:t}){let e=On.default.dirname(t),s=require(t),r=Xp(s);return{html:Ce(e,r),icons:xn(e,r),json:kn(e,r),scripts:De(e,r),web_accessible_resources:In(r)}}var de=a(require("path"));var yt=a(require("fs")),Fe=a(require("path"));function bt(t,e){if(!yt.default.existsSync(t)||!yt.default.statSync(t).isDirectory())return[];let s=[];function r(i){let n=yt.default.readdirSync(i,{withFileTypes:!0});for(let o of n){let c=Fe.default.join(i,o.name);o.isDirectory()?r(c):o.isFile()&&e(o.name)&&s.push(c)}}return r(t),s}function wt(t,e,s=""){return!e||!e.length?{}:e.reduce((r,i)=>{let n=Fe.default.extname(i),o=Fe.default.basename(i,n),c=s?`${s}/${o}`:Fe.default.relative(t,i);return{...r,[c]:i}},{})}function Mn({manifestPath:t}){let e=de.default.dirname(t),s={public:de.default.join(e,"public"),pages:de.default.join(e,"pages"),scripts:de.default.join(e,"scripts")},r={public:bt(s.public,()=>!0),pages:bt(s.pages,n=>n.endsWith(".html")),scripts:bt(s.scripts,n=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(de.default.extname(n)))};return{public:wt(e,r.public),pages:wt(e,r.pages,"pages"),scripts:wt(e,r.scripts,"scripts")}}var xt=a(require("path")),Tn=a(require("webpack")),vt=class{manifestPath;includeList;excludeList;loaderOptions;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList,this.loaderOptions=e.loaderOptions}apply(e){new Tn.default.ProvidePlugin({r:[xt.default.resolve(__dirname,"./resolver-module.js"),"default"]}).apply(e),e.options.module?.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,loader:require.resolve(xt.default.resolve(__dirname,"./resolver-loader.js")),include:[xt.default.dirname(this.manifestPath)],exclude:/node_modules/,options:{manifestPath:this.manifestPath,includeList:this.includeList,jsx:this.loaderOptions?this.loaderOptions.jsx:!1,typescript:this.loaderOptions?this.loaderOptions.typescript:!1,minify:this.loaderOptions?this.loaderOptions.minify:!1}})}};var Rn=a(require("fs")),St=a(require("webpack")),Nn=require("webpack");var _t=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){e.hooks.compilation.tap("manifest:emit-manifest",s=>{s.hooks.processAssets.tap({name:"manifest:emit-manifest",stage:St.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,i;try{let c=Rn.default.readFileSync(r,"utf-8");i=JSON.parse(c)}catch(c){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new St.default.WebpackError(si(l,c)));return}let n=JSON.stringify(i,null,2);s.emitAsset("manifest.json",new Nn.sources.RawSource(n))})})}};var jt=require("webpack");function qn(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:[...t.background.scripts.map(s=>h("background/scripts.js",s,e))]}}}}var Un=a(require("path"));var Pt=t=>Un.default.basename(t);function Wn(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${Pt(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([s,r])=>[s,h(`icons/${Pt(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:h(`browser_action/${Pt(s.light)}`,s.light,e)},...s.dark&&{dark:h(`browser_action/${Pt(s.dark)}`,s.dark,e)}}))}}}}function Bn(t,e){return t.declarative_net_request&&{declarative_net_request:{...t.declarative_net_request,rule_resources:t.declarative_net_request.rule_resources.map(s=>({...s,path:s.path&&h(`declarative_net_request/${s.id}.json`,s.path,e)}))}}}function Jn(t,e){return{...qn(t,e),...Wn(t,e),...Bn(t,e)}}var Hn=a(require("path"));var zn=t=>Hn.default.basename(t);function Vn(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${zn(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,h(`action/${zn(r)}`,r,e)]))}}}}function Gn(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function kt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function Xn(t,e){return{...Vn(t,e),...Gn(t,e),...kt(t,e)}}function Zn(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function Yn(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function Kn(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((s,r)=>{let i=[...new Set(s.js)],n=[...new Set(s.css)];return{...s,js:[...i.map(o=>h(`content_scripts/content-${r}.js`,o,e))],css:[...n.map(o=>h(`content_scripts/content-${r}.css`,o,e))]}})}}function Qn(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var eo=a(require("path"));var Zp=t=>eo.default.basename(t);function to(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,h(`icons/${Zp(r)}`,r,e)]))}}function so(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function ro(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var no=a(require("path"));var io=t=>no.default.basename(t);function oo(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${io(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([s,r])=>[s,h(`icons/${io(r)}`,r,e)]))}}}}function ao(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((s,r)=>h(`sandbox/page-${r}.html`,s,e))}}}}var co=a(require("path"));var Yp=t=>co.default.basename(t);function po(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${Yp(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function lo(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var fo=a(require("path"));var Kp=t=>fo.default.basename(t);function uo(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${Kp(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function mo(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function go(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function ho(t,e){return{...Zn(t,e),...Yn(t,e),...Kn(t,e),...Qn(t,e),...to(t,e),...so(t,e),...ro(t,e),...oo(t,e),...ao(t,e),...kt(t,e),...po(t,e),...lo(t,e),...uo(t,e),...mo(t,e),...go(t)}}function yo(t,e,s){let r=e||require(t);return JSON.stringify({...r,...ho(r,s),...Jn(r,s),...Xn(r,s)},null,2)}var Et=class{manifestPath;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.excludeList=e.excludeList}applyDevOverrides(e){return e.content_scripts?e.content_scripts.map((s,r)=>(s.css.length&&!s.js.length&&(s.js=[h(`content_scripts-${r}`,"dev.js",{})]),s)):{}}apply(e){e.hooks.thisCompilation.tap("manifest:update-manifest",s=>{s.hooks.processAssets.tap({name:"manifest:update-manifest",stage:jt.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=G(s,this.manifestPath),i=yo(this.manifestPath,r,this.excludeList||{}),n={...r,...JSON.parse(i)};e.options.mode!=="production"&&n.content_scripts&&(n.content_scripts=this.applyDevOverrides(n));let o=JSON.stringify(n,null,2),c=new jt.sources.RawSource(o);s.updateAsset("manifest.json",c)})})}};var bo=a(require("fs")),$t=class{dependencyList;constructor(e){this.dependencyList=e}apply(e){e.hooks.afterCompile.tap("ManifestPlugin (AddDependenciesPlugin)",s=>{if(s.errors?.length)return;let r=new Set(s.fileDependencies);this.dependencyList&&this.dependencyList.forEach(i=>{bo.default.existsSync(i)&&(r.has(i)||(r.add(i),s.fileDependencies.add(i)))})})}};var wo=a(require("fs")),xo=a(require("path")),Dt=a(require("webpack"));var Ct=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}extractPaths(e){let s=Array.isArray(e)?e:[e];if(typeof s[0]=="string")return s;let r=[];if(typeof e=="object"&&!Array.isArray(e)){let i=e;i.light&&r.push(i.light),i.dark&&r.push(i.dark)}return r}handleErrors(e,s){let r=[".png",".jpg",".jpeg",".svg",".gif",".webp"],i=[".json"],n=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],o=".html",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let d of u){let g=xo.default.extname(d),$=require(this.manifestPath).name||"Extension.js",k=ae($,p,d);wo.default.existsSync(d)||(r.includes(g)?e.errors.push(new s(k)):i.includes(g)?e.errors.push(new s(k)):n.includes(g)?e.errors.push(new s(k)):g===o?e.errors.push(new s(k)):e.errors.push(new s(k)))}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",s=>{s.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:Dt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=Dt.default.WebpackError;this.handleErrors(s,r)})})}};var vo=a(require("fs")),Lt=a(require("webpack"));var Ft=class{manifestPath;browser;includeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(s,r)=>{if((s.modifiedFiles||new Set).has(this.manifestPath)){let n=s.options.context||"",o=`${n}/package.json`;if(!vo.default.existsSync(o)){r();return}let c=require(this.manifestPath),p=rt(c,this.browser),l=this.flattenAndSort(Object.values(Ce(n,p))),u=this.flattenAndSort(Object.values(De(n,p)));s.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",d=>{d.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Lt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let y=d.getAsset("manifest.json")?.source.source().toString(),$=JSON.parse(y||"{}"),k=this.flattenAndSort(Object.values(Ce(n,$))),U=this.flattenAndSort(Object.values(De(n,$)));if(u.toString()!==U.toString()||l.toString()!==k.toString()){let W=l.filter(B=>!k.includes(B))[0],H=k.filter(B=>!l.includes(B))[0],_e=ri(H,W);d.errors.push(new Lt.default.WebpackError(_e))}})})}r()})}};var It=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new _t({manifestPath:this.manifestPath}).apply(e),new Ct({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Et({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new $t([this.manifestPath]).apply(e),new Ft({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ir=a(require("path"));var tr=a(require("fs")),Mt=a(require("webpack")),Eo=require("webpack");var _o=a(require("fs")),he=a(require("path")),So=a(require("parse5-utils"));var ge=a(require("parse5-utils"));function Ot(t){try{return new URL(t),!0}catch{return!1}}function Le(t,e){let{childNodes:s=[]}=t;for(let r of s)if(r.nodeName==="script"){let i=ge.default.getAttribute(r,"src");if(!i||Ot(i))continue;e({filePath:i,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let i=ge.default.getAttribute(r,"href"),n=ge.default.getAttribute(r,"rel");if(!i||Ot(i))continue;e(n==="dns-prefetch"||n==="icon"||n==="manifest"||n==="modulepreload"||n==="preconnect"||n==="prefetch"||n==="preload"||n==="prerender"?{filePath:i,childNode:r,assetType:"staticHref"}:{filePath:i,childNode:r,assetType:"css"})}else if(r.nodeName==="a"||r.nodeName==="area"){let i=ge.default.getAttribute(r,"href");if(!i||Ot(i))continue;e({filePath:i,childNode:r,assetType:"staticHref"})}else if(r.nodeName==="audio"||r.nodeName==="embed"||r.nodeName==="iframe"||r.nodeName==="img"||r.nodeName==="input"||r.nodeName==="source"||r.nodeName==="track"||r.nodeName==="video"){let i=ge.default.getAttribute(r,"src");if(!i||Ot(i))continue;e({filePath:i,childNode:r,assetType:"staticSrc"})}else Le(r,e)}function D(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||_o.default.readFileSync(t,{encoding:"utf8"}),i=So.default.parse(r),n=(o,c)=>he.default.join(he.default.dirname(o),c.startsWith("/")?he.default.relative(he.default.dirname(o),c):c);for(let o of i.childNodes)if(o.nodeName==="html"){for(let c of o.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Le(c,({filePath:p,assetType:l})=>{let u=n(t,p);switch(l){case"script":s.js?.push(u);break;case"css":s.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;s.static?.push(u);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}function Po(t,e,s){let r=Object.keys(t).find(n=>{let o=t[n];return t[n]===e||D(o)?.js?.includes(e)||D(o)?.css?.includes(e)})||"",i=er(e);return r?`/${r.replace(i,"")}${s}`:`${e.replace(i,"")}${s}`}function er(t){switch(he.default.extname(t)){case".js":case".mjs":case".ts":case".tsx":return".js";case".css":case".scss":case".sass":case".less":return".css";case".html":return".html";default:return".js"}}function Z(t,e,s){return s?`/${t}${e}`:`${t}${e}`}function ko(t,e){return Object.values(e||{}).some(s=>s===t)}var At=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=require(this.manifestPath).name||"Extension.js";e.hooks.thisCompilation.tap("html:emit-html-file",i=>{i.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Mt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let o of n){let[c,p]=o;if(p){if(!tr.default.existsSync(p)){let u=ae(r,c,p);i.warnings.push(new Mt.default.WebpackError(u));return}let l=tr.default.readFileSync(p,"utf8");if(!P(p,this.excludeList)){let u=new Eo.sources.RawSource(l),d=Z(c,".html");i.emitAsset(d,u)}}}})})}};var Tt=a(require("fs")),ye=a(require("path")),jo=a(require("webpack")),Ie=require("webpack");var Rt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-assets-to-compilation",s=>{s.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Ie.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(s.errors.length>0)return;let r=Object.entries(this.includeList||{});for(let i of r){let[n,o]=i,c=n+".html";if(o){let p=s.getAsset(c);if(p){let l=p.source.source().toString(),u=D(o,l)?.static,d=[...new Set(u)];for(let g of d)if(!g.includes("public/")){if(!Tt.default.existsSync(g)&&!ko(g,this.includeList)&&!ye.default.basename(g).startsWith("#")){let W=Ze(require(this.manifestPath).name,o,g);s.warnings.push(new jo.default.WebpackError(W));return}let y=Tt.default.readFileSync(g),$=new Ie.sources.RawSource(y),k=ye.default.join("assets",ye.default.basename(g));if(!s.getAsset(k))if(g.endsWith(".html")){let U=D(g),W=[...U?.js||[],...U?.css||[],...U?.static||[]];s.emitAsset(k,$),W.forEach(H=>{let _e=Tt.default.readFileSync(H),B=new Ie.sources.RawSource(_e),Ar=ye.default.join("assets",ye.default.basename(H));s.getAsset(Ar)||s.emitAsset(Ar,B)})}else s.emitAsset(k,$)}}}}})})}};var $o=a(require("path")),sr=a(require("fs"));var Nt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let s=this.includeList||{};for(let r of Object.entries(s)){let[i,n]=r;if(n){if(!sr.default.existsSync(n))return;let o=D(n),c=o?.js||[],p=o?.css||[],l=[...c,...p].filter(u=>!P(u,this.excludeList));if(e.options.mode==="development"){let u=$o.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}sr.default.existsSync(n)&&(P(n,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var Ut=require("webpack");var rr=a(require("fs")),Y=a(require("path")),F=a(require("parse5-utils"));function Co(t,e,s,r,i){let n=rr.default.readFileSync(s,{encoding:"utf8"}),o=F.default.parse(n),c=!!t.getAsset(e+".css"),p=!1;for(let l of o.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Le(u,({filePath:d,childNode:g,assetType:y})=>{let $=Y.default.dirname(s),k=Y.default.resolve($,d),U=er(k),W=P(Y.default.resolve($,d),i),H=Y.default.join("/",Y.default.normalize(d)),_e=yi(k,r);switch(y){case"script":{W?l=F.default.setAttribute(g,"src",H):(l=F.default.remove(g),p=!0);break}case"css":{W?l=F.default.setAttribute(g,"href",H):(l=F.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(W)l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",H);else if(_e){let B=Po(r,k,U);l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",B)}else{let B=Y.default.join("assets",Y.default.basename(k,U));rr.default.existsSync(k)&&(l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",Z(B,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let d=F.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:Z(e,".css",!0)}],F.default.append(u,d)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let d=F.default.createNode("script");d.attrs=[{name:"src",value:Z(e,".js",!0)}],F.default.append(u,d)}}return F.default.serialize(o)}}var qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("html:update-html-file",s=>{s.hooks.processAssets.tap({name:"html:update-html-file",stage:Ut.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[n,o]=i;if(o){let c=Co(s,n,o,r,this.excludeList||{});if(!P(o,this.excludeList)&&c){let p=new Ut.sources.RawSource(c),l=Z(n,".html");s.updateAsset(l,p)}}}})})}};var Do=a(require("fs")),Fo=require("webpack");var Wt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-to-file-dependencies",s=>{s.hooks.processAssets.tap({name:"html:add-to-file-dependencies",stage:Fo.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[,n]=i;if(n){let o=D(n),c=new Set(s.fileDependencies);if(Do.default.existsSync(n)){let p=[n,...o?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===n&&s.fileDependencies.add(l))}}}})})}};var Lo=a(require("fs"));var Bt=class{manifestPath;includeList;initialHtmlAssets={};constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}hasEntriesChanged(e,s){if(!s||!e||e.length!==s.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==s[r])return!0;return!1}storeInitialHtmlAssets(e){Object.entries(e).forEach(([s,r])=>{let i=r;if(i){if(!Lo.default.existsSync(i)){let o=require(this.manifestPath).name||"Extension.js";console.error(ae(o,s,i)),process.exit(1)}this.initialHtmlAssets[i]={js:D(i)?.js||[],css:D(i)?.css||[]}}})}apply(e){let s=this.includeList||{};this.storeInitialHtmlAssets(s),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(r,i)=>{let n=e.modifiedFiles||new Set,o=Array.from(n)[0];if(o&&this.initialHtmlAssets[o]){let c=D(o)?.js||[],p=D(o)?.css||[],{js:l,css:u}=this.initialHtmlAssets[o];if(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l)){let d=require(this.manifestPath).name;console.log(pi(d,o))}}i()})}};var Io=a(require("fs")),Oo=require("webpack");function el(t,e,s){let r="Module not found: Error: Can't resolve ",n=s.message.replace(r,"").split("'")[1];if(s.message.includes(r))for(let o of Object.entries(e)){let[,c]=o;if(c){if(!Io.default.existsSync(c))return null;let p=D(c),l=p?.js||[],u=p?.css||[];if(l.includes(n)||u.includes(n)){let d=Ze(require(t).name,c,n);return new Oo.WebpackError(d)}}}return null}var Jt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.compilation.tap("html:handle-common-errors",s=>{s.hooks.afterSeal.tapPromise("html:handle-common-errors",async()=>{s.errors.forEach((r,i)=>{let n=el(this.manifestPath,this.includeList||{},r);n&&(s.errors[i]=n)})})})}};var zt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new At({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Rt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Nt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ir.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ir.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new Wt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Bt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Jt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var re=a(require("path"));var nr=a(require("fs")),Ao=a(require("path"));function Mo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let n=nr.default.existsSync(i)&&!P(i,e),o=Ao.default.extname(i);return n&&(o===".js"||o===".mjs"||o===".jsx"||o===".ts"||o===".tsx")})}function To(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>nr.default.existsSync(i)&&!P(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Ht=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=this.includeList||{};for(let r of Object.entries(s)){let[i,n]=r,o=Mo(n,this.excludeList),c=To(n,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...c),(c.length||o.length)&&(e.options.entry={...e.options.entry,[i]:{import:p}})}}};var se=require("webpack"),tl=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],sl=[...tl,`var runtime = isBrowser ? browser : isChrome ? chrome : (typeof self === 'object' && self.addEventListener) ? { get runtime() { throw new Error("No chrome or browser runtime found") } } : { runtime: { getURL: x => x } }`],Vt=class t{apply(e){let{RuntimeGlobals:s}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",r=>{r.hooks.runtimeRequirementInTree.for(s.publicPath).tap(t.name,i=>{let n=rl();return r.addRuntimeModule(i,n),!0})})}};function rl(){class t extends se.RuntimeModule{constructor(){super("publicPath",se.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return se.Template.asString([...sl,`var path = ${JSON.stringify(this.compilation?.getPath(s||"",{hash:this.compilation.hash||"XXXX"}))}`,`${se.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var Gt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=require(this.manifestPath);if(s.content_scripts?.some(r=>r.world&&r.world.toLowerCase()==="main")){if(s.id||(console.error(ui(s.name||"")),process.exit(1)),this.browser==="firefox"){e.options.output.publicPath=`moz-extension://${s.id}/`;return}e.options.output.publicPath=`${this.browser}-extension://${s.id}/`}}};var Xt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Ht({manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(re.default.join(__dirname,"inject-content-css-during-dev.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(re.default.join(__dirname,"add-hmr-accept-code.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="production"&&new Vt().apply(e),new Gt({manifestPath:this.manifestPath,browser:this.browser||"chrome",includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:re.default.resolve(__dirname,"./add-query-param-to-imported-css.js"),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]})}};var ar=a(require("path")),Oe=a(require("fs")),cr=a(require("webpack")),Ae=require("webpack");var be=a(require("path")),Zt=a(require("fs"));function or(t){let e=be.default.join(be.default.dirname(t),"_locales"),s=[];if(Zt.default.existsSync(e))for(let r of Zt.default.readdirSync(e)){let i=be.default.join(e,r);for(let n of Zt.default.readdirSync(i))s.push(be.default.join(be.default.dirname(t),"_locales",r,n))}return s}var Yt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ae.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let i=require(this.manifestPath).name||"Extension.js";if(!Oe.default.existsSync(this.manifestPath)){s.errors.push(new cr.default.WebpackError(ti(i)));return}if(s.errors.length>0)return;let n=or(this.manifestPath);for(let o of Object.entries(n||[])){let[c,p]=o,l=p;if(l){if(!Oe.default.existsSync(l)){s.warnings.push(new cr.default.WebpackError(Ye(i,c,l)));return}let u=Oe.default.readFileSync(l),d=new Ae.sources.RawSource(u),g=e.options.context||ar.default.dirname(this.manifestPath);if(!P(l,this.excludeList)){let y=ar.default.relative(g,l);s.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ae.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=or(this.manifestPath);for(let i of Object.entries(r||[])){let[,n]=i;if(n){let o=new Set(s.fileDependencies),c=r||[];for(let p of c)Oe.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var Kt=a(require("fs")),Ro=a(require("webpack")),Me=require("webpack");var Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[n,o]=i,c=Array.isArray(o)?o:[o];for(let p of c)if(p&&!P(p,this.excludeList)){if(!Kt.default.existsSync(p)){let g=require(this.manifestPath).name||"Extension.js";s.warnings.push(new Ro.default.WebpackError(Ye(g,n,p)));return}let l=Kt.default.readFileSync(p),u=new Me.sources.RawSource(l);s.emitAsset(n+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[,n]=i,o=Array.isArray(n)?n:[n];for(let c of o)if(c){let p=new Set(s.fileDependencies);P(c,this.excludeList)||Kt.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var pr=a(require("fs")),No=a(require("path")),ts=require("webpack");var es=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:emit-file",s=>{s.hooks.processAssets.tap({name:"icons:emit-file",stage:ts.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[n,o]=i;if(o===void 0)continue;let c=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let p of c)if(p){if(!pr.default.existsSync(p))continue;if(!P(p,this.excludeList)){let l=pr.default.readFileSync(p),u=new ts.sources.RawSource(l),d=No.default.basename(p),y=`${n.endsWith("theme_icons")?n.replace("theme_icons",""):n}/${d}`;s.emitAsset(y,u)}}}})})}};var qo=a(require("fs")),Uo=require("webpack"),ss=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:add-to-file-dependencies",s=>{s.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:Uo.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[,n]=i,o=Array.isArray(n)?typeof n[0]=="string"?n:n.map(Object.values).flat():[n];for(let c of o)if(c){let p=new Set(s.fileDependencies);qo.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var rs=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new es({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new ss({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ns=require("webpack");var is=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,s){let r=G(e,this.manifestPath),i=r.web_accessible_resources||[],n=r.web_accessible_resources||[];for(let[p,l]of Object.entries(s)){let u=r.content_scripts?.find(d=>d.js&&d.js.some(g=>g.includes(p)));if(u){let d=u.matches||[];if(r.manifest_version===3){let g=i.find(y=>y.matches.some($=>d.includes($)));g?l.forEach(y=>{g.resources.includes(y)||g.resources.push(y)}):i.push({resources:l.filter(y=>!y.endsWith(".map")),matches:d})}else l.forEach(g=>{n.includes(g)||n.push(g)})}}r.manifest_version===3?r.web_accessible_resources=i:r.web_accessible_resources=Array.from(new Set(n));let o=JSON.stringify(r,null,2),c=new ns.sources.RawSource(o);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",s=>{s.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ns.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let r=[],i=Object.keys(this.includeList||{});for(let c of i.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?r.push(...c):typeof c=="string"&&r.push(c));let n=s.chunkGraph,o={};s.entrypoints.forEach((c,p)=>{if(r.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(n.getChunkModulesIterable(u)).forEach(g=>{n.getModuleChunks(g).forEach(y=>{y.auxiliaryFiles.forEach($=>{l.includes($)||l.push($)})})})}),o[p]=l}}),this.generateManifestPatches(s,o)})})}};var L=a(require("fs")),I=a(require("path")),Wo=a(require("chokidar")),os=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=I.default.dirname(e);if(L.default.existsSync(s))return!0;L.default.mkdirSync(s,{recursive:!0})}copyFile(e,s){this.ensureDirectoryExistence(s),L.default.copyFileSync(e,s)}copyFolder(e,s){L.default.existsSync(s)||L.default.mkdirSync(s,{recursive:!0}),L.default.readdirSync(e).forEach(i=>{let n=I.default.join(e,i),o=I.default.join(s,i);L.default.statSync(n).isDirectory()?this.copyFolder(n,o):this.copyFile(n,o)})}apply(e){let s=I.default.dirname(this.options.manifestPath),r=I.default.join(s,"public"),i=e.options.output?.path||"";L.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let n=I.default.join(i,"public");L.default.existsSync(n)||L.default.mkdirSync(n,{recursive:!0}),L.default.existsSync(r)&&this.copyFolder(r,n)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let n=I.default.join(s,"public"),o=Wo.default.watch(n,{ignoreInitial:!0});o.on("add",c=>{let p=I.default.join(i,I.default.relative(s,c));this.copyFile(c,p)}),o.on("change",c=>{let p=I.default.join(i,I.default.relative(s,c));this.copyFile(c,p)}),o.on("unlink",c=>{let p=I.default.join(i,I.default.relative(s,c));L.default.existsSync(p)&&L.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var N=a(require("path")),lr=a(require("chokidar"));var as=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let i=N.relative(process.cwd(),s),p=ii(r?"Adding":"Removing",r?"added":"removed",e,e==="pages"?"HTML pages":"script files",i);if(r){console.warn(p);return}console.error(p),process.exit(1)}apply(e){e.hooks.afterPlugins.tap("special-folders:warn-upon-folder-changes",()=>{let s=N.dirname(this.manifestPath),r=N.join(s,"pages"),i=N.join(s,"scripts"),n=lr.watch(r,{ignoreInitial:!0}),o=lr.watch(i,{ignoreInitial:!0}),c=e.options.resolve?.extensions;n.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),n.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),o.on("add",p=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p,!0)}),o.on("unlink",p=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{n.close().catch(console.error),o.close().catch(console.error)})})}};var cs=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new os({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new as(s).apply(e)}};var ps=class{static name="plugin-extension";manifestPath;browser;mode;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.mode=e.mode}apply(e){let s=this.manifestPath,r=An({manifestPath:s}),i=Mn({manifestPath:s});new vt({manifestPath:s,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:me(Te.default.dirname(this.manifestPath))||X(Te.default.dirname(this.manifestPath))||$e(Te.default.dirname(this.manifestPath)),typescript:R(Te.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new It({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:i.public}).apply(e),new zt({manifestPath:s,includeList:{...r.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Xt({manifestPath:s,browser:this.browser,includeList:{...r.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new Yt({manifestPath:s}).apply(e),new Qt({manifestPath:s,includeList:r.json,excludeList:i.public}).apply(e),new rs({manifestPath:s,includeList:r.icons,excludeList:i.public}).apply(e),new is({manifestPath:s,includeList:{...r.scripts,...i.scripts},excludeList:i.public}).apply(e),new cs({manifestPath:s}).apply(e)}};var qe=a(require("path"));var Bo=a(require("path")),Jo=a(require("ws")),fs=a(require("browser-extension-manifest-fields"));function ls(t,e){t.clients.forEach(s=>{s.readyState===Jo.default.OPEN&&s.send(JSON.stringify(e))})}function zo(t,e,s){if(!s||!e)return;let r=(0,fs.default)(e).locales,i=(0,fs.default)(e).scripts,n=(0,fs.default)(e).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}Bo.default.basename(s)==="manifest.json"&&ls(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&ls(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([o,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(s)&&o==="background/service_worker"&&ls(t,{changedFile:"service_worker"})}),Object.entries(n).forEach(([o,c])=>{c?.includes(s)&&o==="declarative_net_request"&&ls(t,{changedFile:"declarative_net_request"})})}var ur=a(require("path")),Xo=a(require("fs")),Ne=a(require("ws"));var Re=a(require("path")),il=a(require("http")),Vo=a(require("https")),fr=a(require("fs"));var Ho=t=>{if(!fr.default.existsSync(t))return;let e=Re.default.basename(t);return fr.default.readFileSync(Re.default.join(__dirname,"certs",e))};function Go(t,e){let s={key:Ho(Re.default.join(__dirname,"certs","localhost.key")),cert:Ho(Re.default.join(__dirname,"certs","localhost.cert"))},r=Vo.default.createServer(s,(i,n)=>{n.writeHead(200),n.end()});return r.on("error",i=>{throw console.error(fi(t,e)),new Error(i.message)}),{server:r,port:e}}function nl(t,e,s){switch(s){case"chrome":return new Ne.default.Server({host:"localhost",port:e});case"edge":return new Ne.default.Server({host:"localhost",port:e+1});case"firefox":return new Ne.default.Server({server:Go(t,e+2).server});default:return new Ne.default.Server({host:"localhost",port:8888})}}async function Zo(t,e){let s=t.options.context||"",r=require(ur.default.join(s,"manifest.json")),i=r.name||"Extension.js",n=e.port||8e3,o=nl(i,n,e.browser);if(o.on("connection",c=>{c.send(JSON.stringify({status:"serverReady"})),c.on("error",p=>{console.log(ai(i,p))}),c.on("message",p=>{let l=JSON.parse(p.toString());if(l.status==="clientReady"){let u=require(ur.default.join(s,"manifest.json"));setTimeout(()=>{console.log(Bs(u,e.browser,l)),console.log("")},2500),bi(e.browser)&&setTimeout(()=>{console.log(oi(e.browser))},5e3)}})}),e.browser==="firefox"&&!Xo.default.existsSync(Xe)){let c=wi(r);console.log(Bs(r,e.browser,c)),console.log(""),console.log(li()),console.log("")}return o}var Yo=a(require("path")),mr=a(require("fs"));function Ko(t,e){let s=Yo.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let r=mr.default.readFileSync(s,"utf8"),i=r.replace(/__RELOAD_PORT__/g,e.toString());i!==r&&mr.default.writeFileSync(s,i,"utf8")}catch(r){console.error(`Error processing file: ${r.message}`)}}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ue=class{manifestPath;port;browser;stats;constructor(e){this.manifestPath=e.manifestPath,this.port=e.port||8e3,this.browser=e.browser||"chrome",this.stats=e.stats}async apply(e){if(!this.manifestPath)return;Ko(this.browser,this.port);let s=await Zo(e,{...this,mode:e.options.mode,browser:this.browser,stats:this.stats,port:this.port});e.hooks.watchRun.tapAsync("reload:create-web-socket-server",(r,i)=>{let o=(r.modifiedFiles||new Set).values().next().value;if(!o){i();return}let c=qe.default.relative(qe.default.dirname(this.manifestPath),o),p=qe.default.relative(process.cwd(),qe.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&zo(s,this.manifestPath,o),i()})}};var dr=a(require("path"));function Qo(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[dr.default.dirname(s)],exclude:/node_modules/,use:[{loader:dr.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:s,browser:e}}]})}var gr=a(require("path"));function ea(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[gr.default.dirname(s)],exclude:/node_modules/,use:[{loader:gr.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:s,browser:e}}]})}var ms=require("webpack");var hr=a(require("content-security-policy-parser"));function ta(t){let e=t.content_security_policy;if(!e)return"script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";let s=(0,hr.default)(e);e="",s.get("script-src")||s.set("script-src",["'self' 'unsafe-eval' blob: filesystem:"]),s.get("script-src")?.includes("'unsafe-eval'")||s.set("script-src",["unsafe-eval"]);for(let r in s)e+=`${r} ${s.get(r)?.join(" ")};`;return e}function sa(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,hr.default)(e.extension_pages||""),r="";for(let i in s)r+=`${i} ${s.get(i)?.join(" ")}; `;return{extension_pages:r.trim()}}function ra(t){let e=["/*.json","/*.js","/*.css"],s=t.web_accessible_resources;if(!s||s.length===0)return e;let r=new Set(s);for(let i of e)r.has(i)||r.add(i);return Array.from(r)}function ia(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function yr(t,e){return t.background?{background:{...t.background}}:e==="firefox"?{background:{...t.background||{},scripts:["background/script.js"]}}:t.manifest_version===2?{background:{...t.background||{},scripts:["background/script.js"]}}:{background:{...t.background||{},service_worker:"background/service_worker.js"}}}function br(t){return t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:[...new Set(t.externally_connectable.ids||[]),"*"]}}:t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:["*"]}}:{}}var us=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let s=G(e,this.manifestPath),r={...s,content_security_policy:s.manifest_version===3?sa(s):ta(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...yr(s,this.browser),...br(s),web_accessible_resources:s.manifest_version===3?ia(s):ra(s)},i=JSON.stringify(r,null,2),n=new ms.sources.RawSource(i);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",n)}apply(e){e.hooks.thisCompilation.tap("run-chromium:apply-manifest-dev-defaults",s=>{s.hooks.processAssets.tap({name:"run-chromium:apply-manifest-dev-defaults",stage:ms.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},r=>{if(!this.manifestPath){let i="No manifest.json found in your extension bundle. Unable to patch manifest.json.";s&&e.webpack.WebpackError&&s.errors.push(new e.webpack.WebpackError(`run-chromium: ${i}`));return}this.generateManifestPatches(s)})})}};var wr=a(require("fs")),we=a(require("path")),na=a(require("webpack-target-webextension"));var ds=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let i=we.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),n=we.default.dirname(this.manifestPath),o=r.background;if(s==="firefox"){o=r["gecko:background"]||r["firefox:background"]||o;let c=o?.scripts||o?.["gecko:scripts"]||o?.["firefox:scripts"];if(c&&c.length>0){let p=we.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}else if(o=r["chromium:background"]||r["chrome:background"]||r["edge:background"]||o,r.manifest_version===3){let c=o?.service_worker||o?.["chromium:service_worker"]||o?.["chrome:service_worker"]||o?.["edge:service_worker"];if(c){let p=we.default.join(n,c);this.ensureFileExists(p,"background.service_worker")}else this.addDefaultEntry(e,"background/service_worker",i)}else if(r.manifest_version===2){let c=o?.scripts||o?.["chromium:scripts"]||o?.["chrome:scripts"]||o?.["edge:scripts"];if(c&&c.length>0){let p=we.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e,s){if(!wr.default.existsSync(e)&&this.manifestPath){let i=require(this.manifestPath).name||"Extension.js",n=ci(i,s,e);throw console.error(n),new Error(n)}}addDefaultEntry(e,s,r){e.options.entry={...e.options.entry,[s]:{import:[r]}}}getEntryName(e){if(e.background){if(e.manifest_version===3)return{serviceWorkerEntry:"background/service_worker"};if(e.manifest_version===2)return{pageEntry:"background/script"}}return{pageEntry:"background"}}apply(e){if(!this.manifestPath||!wr.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new na.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var xr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){Se.includes(this.browser)&&Qo(e,this.browser,this.manifestPath),this.browser==="firefox"&&ea(e,this.browser,this.manifestPath),new us({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ds({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},oa=xr;var gs=class{static name="plugin-reload";manifestPath;browser;port;stats;autoReload;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.port=e.port,this.stats=e.stats,this.autoReload=e.autoReload}apply(e){e.options.mode==="development"&&new Ue({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new oa({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var aa=a(require("webpack")),hs=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new aa.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var bs=require("webpack");var ys=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let s=rt(e,this.browser);return JSON.stringify(s,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-fields",s=>{s.hooks.processAssets.tap({name:"compatibility:browser-fields",stage:bs.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=G(s,this.manifestPath),i=this.patchManifest(r),n=new bs.sources.RawSource(i);s.updateAsset("manifest.json",n)})})}};var ws=class{static name="plugin-compatibility";manifestPath;browser;polyfill;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.polyfill=e.polyfill||!1}async apply(e){this.polyfill&&this.browser!=="firefox"&&new hs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ys({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var ba=a(require("fs"));var ca=a(require("webpack")),pa=a(require("content-security-policy-parser"));function la(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=i=>{if(!i)return;let n=(0,pa.default)(i);if(n.get("script-src")&&n.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return Hr(o)}};if(t.manifest_version===3){let i=e?r(s):void 0;if(i)return new ca.default.WebpackError(i)}return null}var vr=a(require("webpack"));function fa(t,e){let s=t.web_accessible_resources;if(s){let r=s.some(o=>typeof o=="string"),i=s.some(o=>typeof o=="object"||o.resources||o.matches),n=t.name||"Extension.js";if(t.manifest_version===2&&!r)return new vr.default.WebpackError(Gr(n,e));if(t.manifest_version===3&&!i)return new vr.default.WebpackError(Xr(n,e))}return null}var ua=a(require("webpack"));function ma(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new ua.default.WebpackError(zr(s))}return null}var da=a(require("path")),ga=a(require("fs")),ha=a(require("webpack"));function ya(t,e){let s=da.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return ga.default.existsSync(s)&&!t.default_locale?new ha.default.WebpackError(Vr(r)):null}var xs=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let i=la(s),n=fa(s,r),o=ma(s,r),c=ya(s,e);i&&e.errors.push(i),n&&e.errors.push(n),o&&e.options.mode==="production"&&e.errors.push(o),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(ba.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,n,o),r()})}};var Ca=a(require("fs")),Da=a(require("ajv"));var wa={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://json.schemastore.org/chrome-manifest.json",additionalProperties:!0,definitions:{action_v2:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{anyOf:[{type:"string",description:"FIXME: String form is deprecated."},{type:"object",description:"Icon for the main toolbar.",properties:{"19":{$ref:"#/definitions/icon"},"38":{$ref:"#/definitions/icon"}}}]}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},action_v3:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{type:"object",properties:{"16":{$ref:"#/definitions/icon"},"24":{$ref:"#/definitions/icon"},"32":{$ref:"#/definitions/icon"}}}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},command:{type:"object",if:{$comment:"Global shortcuts change the acceptable pattern for the suggested_key.",properties:{global:{const:!0}},required:["global"]},then:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl)\\+Shift\\+[0-9]"}}}}},else:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl|Alt|Option)\\+(Shift\\+)?[A-Z]"}}}}}},content_security_policy:{type:"string",description:"This introduces some fairly strict policies that will make extensions more secure by default, and provides you with the ability to create and enforce rules governing the types of content that can be loaded and executed by your extensions and applications.",format:"content-security-policy",default:"script-src 'self'; object-src 'self'"},glob_pattern:{type:"string",format:"glob-pattern"},icon:{$ref:"#/definitions/uri"},match_pattern:{type:"string",format:"match-pattern",pattern:"^((\\*|http|https|file|ftp|chrome-extension):\\/\\/(\\*|\\*\\.[^\\/\\*]+|[^\\/\\*]+)?(\\/.*))|urn:(\\*|.*)|<all_urls>$"},mime_type:{type:"string",format:"mime-type",pattern:"^(?:application|audio|image|message|model|multipart|text|video)\\/[-+.\\w]+$"},page:{$ref:"#/definitions/uri"},permissions:{type:"array",uniqueItems:!0,items:{type:"string",format:"permission"}},scripts:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}},uri:{type:"string"},version_string:{type:"string",pattern:"^(?:\\d{1,5}\\.){0,3}\\d{1,5}$"},web_resource:{type:"object",required:["resources"],properties:{resources:{type:"array",description:`An array of resources to be exposed. Resources are specified as strings and may contain * for wildcard matches. For example, "/images/*" exposes everything in the extension's /images directory recursively while "*.png" exposes all PNG files.`,items:{$ref:"#/definitions/glob_pattern"}},matches:{type:"array",description:"A list of URL match patterns specifying which pages can access the resources. Only the origin is used to match URLs; subdomains patterns (*.google.com) and paths are ignored.",items:{$ref:"#/definitions/match_pattern"}},extension_ids:{type:"array",description:"A list of extension IDs, specifying which extensions can access the resources.",items:{type:"string"}},use_dynamic_url:{type:"boolean",description:"If true, only allow resources to be accessible through dynamic ID. The dynamic ID is generated per session. It's regenerated on browser restart or extension reload."}}}},dependencies:{content_scripts:{not:{required:["script_badge"]}},script_badge:{not:{required:["content_scripts"]}}},else:{properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{persistent:{type:"boolean",description:"When false, makes the background page an event page (loaded only when needed).",default:!0},page:{$ref:"#/definitions/page",description:"Specify the HTML of the background page.",default:"background.html"},scripts:{$ref:"#/definitions/scripts",description:"A background page will be generated by the extension system that includes each of the files listed in the scripts property.",default:["background.js"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},browser_action:{$ref:"#/definitions/action_v2",description:"Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup."},page_action:{$ref:"#/definitions/action_v2",description:"Use the chrome.pageAction API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages."},content_security_policy:{$ref:"#/definitions/content_security_policy"},web_accessible_resources:{type:"array",description:"An array of strings specifying the paths (relative to the package root) of packaged resources that are expected to be usable in the context of a web page.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}}},dependencies:{page_action:{not:{required:["browser_action"]}},browser_action:{not:{required:["page_action"]}}}},if:{properties:{manifest_version:{const:3}}},properties:{manifest_version:{type:"number",description:"One integer specifying the version of the manifest file format your package requires.",enum:[2,3]},name:{type:"string",description:"The name of the extension",maxLength:45},version:{$ref:"#/definitions/version_string",description:"One to four dot-separated integers identifying the version of this extension."},default_locale:{type:"string",description:"Specifies the subdirectory of _locales that contains the default strings for this extension.",default:"en"},description:{type:"string",description:"A plain text description of the extension",maxLength:132},icons:{type:"object",description:"One or more icons that represent the extension, app, or theme. Recommended format: PNG; also BMP, GIF, ICO, JPEG.",minProperties:1,properties:{"16":{$ref:"#/definitions/icon",description:"Used as the favicon for an extension's pages and infobar."},"48":{$ref:"#/definitions/icon",description:"Used on the extension management page (chrome://extensions)."},"128":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."},"256":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."}}},chrome_url_overrides:{type:"object",description:"Override pages are a way to substitute an HTML file from your extension for a page that Google Chrome normally provides.",additionalProperties:!1,maxProperties:1,properties:{bookmarks:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the Bookmark Manager menu item from the Chrome menu or, on Mac, the Bookmark Manager item from the Bookmarks menu. You can also get to this page by entering the URL chrome://bookmarks.",default:"bookmarks.html"},history:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the History menu item from the Chrome menu or, on Mac, the Show Full History item from the History menu. You can also get to this page by entering the URL chrome://history.",default:"history.html"},newtab:{$ref:"#/definitions/page",description:"The page that appears when the user creates a new tab or window. You can also get to this page by entering the URL chrome://newtab.",default:"newtab.html"}}},commands:{type:"object",description:"Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.",patternProperties:{".*":{$ref:"#/definitions/command"},"^_execute_browser_action$":{$ref:"#/definitions/command"},"^_execute_page_action$":{$ref:"#/definitions/command"}}},content_scripts:{type:"array",description:"Content scripts are JavaScript files that run in the context of web pages.",minItems:1,uniqueItems:!0,items:{type:"object",required:["matches"],additionalProperties:!1,properties:{matches:{type:"array",description:"Specifies which pages this content script will be injected into.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},exclude_matches:{type:"array",description:"Excludes pages that this content script would otherwise be injected into.",uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},css:{type:"array",description:"The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.",uniqueItems:!0,items:{$ref:"#/definitions/uri"}},js:{$ref:"#/definitions/scripts",description:"The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array."},world:{type:"string",description:"The JavaScript world for a script to execute within.",enum:["ISOLATED","MAIN"],default:"ISOLATED"},run_at:{type:"string",description:"Controls when the files in js are injected.",enum:["document_start","document_end","document_idle"],default:"document_idle"},all_frames:{type:"boolean",description:"Controls whether the content script runs in all frames of the matching page, or only the top frame.",default:!1},include_globs:{type:"array",description:"Applied after matches to include only those URLs that also match this glob. Intended to emulate the @include Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},exclude_globs:{type:"array",description:"Applied after matches to exclude URLs that match this glob. Intended to emulate the @exclude Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},match_about_blank:{type:"boolean",description:"Whether to insert the content script on about:blank and about:srcdoc.",default:!1}}}},devtools_page:{$ref:"#/definitions/page",description:"A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more."},externally_connectable:{description:"Declares which extensions, apps, and web pages can connect to your extension via runtime.connect and runtime.sendMessage.",type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string",description:"The IDs of extensions or apps that are allowed to connect. If left empty or unspecified, no extensions or apps can connect."}},matches:{type:"array",items:{type:"string",description:"The URL patterns for web pages that are allowed to connect. This does not affect content scripts. If left empty or unspecified, no web pages can connect."}},accepts_tls_channel_id:{type:"boolean",default:!1,description:"Indicates that the extension would like to make use of the TLS channel ID of the web page connecting to it. The web page must also opt to send the TLS channel ID to the extension via setting includeTlsChannelId to true in runtime.connect's connectInfo or runtime.sendMessage's options."}}},file_browser_handlers:{type:"array",description:"You can use this API to enable users to upload files to your website.",minItems:1,items:{type:"object",required:["id","default_title","file_filters"],additionalProperties:!1,properties:{id:{type:"string",description:"Used by event handling code to differentiate between multiple file handlers"},default_title:{type:"string",description:"What the button will display."},file_filters:{type:"array",description:"Filetypes to match.",minItems:1,items:{type:"string"}}}}},homepage_url:{$ref:"#/definitions/uri",description:"The URL of the homepage for this extension."},incognito:{type:"string",description:"Specify how this extension will behave if allowed to run in incognito mode.",enum:["spanning","split","not_allowed"],default:"spanning"},input_components:{type:"array",description:"Allows your extension to handle keystrokes, set the composition, and manage the candidate window.",items:{type:"object",required:["name","type","id","description","language","layouts"],additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"},id:{type:"string"},description:{type:"string"},language:{type:"string"},layouts:{type:"array"}}}},key:{type:"string",description:"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."},minimum_chrome_version:{$ref:"#/definitions/version_string",description:"The version of Chrome that your extension, app, or theme requires, if any."},nacl_modules:{type:"array",description:"One or more mappings from MIME types to the Native Client module that handles each type.",minItems:1,uniqueItems:!0,items:{type:"object",required:["path","mime_type"],additionalProperties:!1,properties:{path:{$ref:"#/definitions/uri",description:"The location of a Native Client manifest (a .nmf file) within the extension directory."},mime_type:{$ref:"#/definitions/mime_type",description:"The MIME type for which the Native Client module will be registered as content handler."}}}},oauth2:{type:"object",description:"Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account.",required:["client_id","scopes"],additionalProperties:!1,properties:{client_id:{type:"string",description:"You need to register your app in the Google APIs Console to get the client ID."},scopes:{type:"array",minItems:1,items:{type:"string"}}}},offline_enabled:{type:"boolean",description:"Whether the app or extension is expected to work offline. When Chrome detects that it is offline, apps with this field set to true will be highlighted on the New Tab page."},omnibox:{type:"object",description:"The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.",required:["keyword"],additionalProperties:!1,properties:{keyword:{type:"string",description:"The keyword that will trigger your extension."}}},optional_permissions:{$ref:"#/definitions/permissions",description:"Use the chrome.permissions API to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary."},options_page:{$ref:"#/definitions/page",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, a link to it will be provided from the extensions management page at chrome://extensions. Clicking the Options link opens a new tab pointing at your options page.",default:"options.html"},options_ui:{type:"object",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, an Options link will be shown on the extensions management page at chrome://extensions which opens a dialogue containing your options page.",required:["page"],properties:{page:{type:"string",description:"The path to your options page, relative to your extension's root."},chrome_style:{type:"boolean",default:!0,description:"If true, a Chrome user agent stylesheet will be applied to your options page. The default value is false, but we recommend you enable it for a consistent UI with Chrome."},open_in_tab:{type:"boolean",default:!1,description:"If true, your extension's options page will be opened in a new tab rather than embedded in chrome://extensions. The default is false, and we recommend that you don't change it. This is only useful to delay the inevitable deprecation of the old options UI! It will be removed soon, so try not to use it. It will break."}}},permissions:{$ref:"#/definitions/permissions",description:"Permissions help to limit damage if your extension or app is compromised by malware. Some permissions are also displayed to users before installation, as detailed in Permission Warnings."},requirements:{type:"object",description:"Technologies required by the app or extension. Hosting sites such as the Chrome Web Store may use this list to dissuade users from installing apps or extensions that will not work on their computer.",additionalProperties:!1,properties:{plugins:{type:"object",description:"Indicates if an app or extension requires NPAPI to run. This requirement is enabled by default when the manifest includes the 'plugins' field.",required:["npapi"],additionalProperties:!1,properties:{npapi:{type:"boolean",default:!0}}},"3D":{type:"object",description:"The '3D' requirement denotes GPU hardware acceleration.",required:["features"],additionalProperties:!1,properties:{features:{type:"array",description:"List of the 3D-related features your app requires.",minItems:1,uniqueItems:!0,items:{type:"string",enum:["webgl"]}}}}}},sandbox:{type:"object",description:"Defines an collection of app or extension pages that are to be served in a sandboxed unique origin, and optionally a Content Security Policy to use with them.",required:["pages"],additionalProperties:!1,properties:{pages:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/page"}},content_security_policy:{$ref:"#/definitions/content_security_policy",default:"sandbox allow-scripts allow-forms"}}},short_name:{type:"string",description:"The short name is typically used where there is insufficient space to display the full name.",maxLength:12},update_url:{$ref:"#/definitions/uri",description:"If you publish using the Chrome Developer Dashboard, ignore this field. If you host your own extension or app: URL to an update manifest XML file."},tts_engine:{type:"object",description:"Register itself as a speech engine.",required:["voices"],additionalProperties:!1,properties:{voices:{type:"array",description:"Voices the extension can synthesize.",minItems:1,uniqueItems:!0,items:{type:"object",required:["voice_name","event_types"],additionalProperties:!1,properties:{voice_name:{type:"string",description:"Identifies the name of the voice and the engine used."},lang:{type:"string",description:"Almost always, a voice can synthesize speech in just a single language. When an engine supports more than one language, it can easily register a separate voice for each language."},gender:{type:"string",description:"If your voice corresponds to a male or female voice, you can use this parameter to help clients choose the most appropriate voice for their application."},event_types:{type:"array",description:"Events sent to update the client on the progress of speech synthesis.",minItems:1,uniqueItems:!0,items:{type:"string",description:"",enum:["start","word","sentence","marker","end","error"]}}}}}}},version_name:{type:"string",description:"In addition to the version field, which is used for update purposes, version_name can be set to a descriptive version string and will be used for display purposes if present."},chrome_settings_overrides:{},content_pack:{},current_locale:{},import:{},platforms:{},signature:{},spellcheck:{},storage:{},system_indicator:{}},required:["manifest_version","name","version"],then:{$comment:"browser_action and page_action are no longer present in v3",properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{service_worker:{type:"string",description:"The service worker js file."},type:{type:"string",enum:["module"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},host_permissions:{$ref:"#/definitions/permissions"},action:{$ref:"#/definitions/action_v3",description:"Used to control the toolbar button for your extension in Chrome's UI."},content_security_policy:{type:"object",properties:{extension_pages:{$ref:"#/definitions/content_security_policy",description:"This policy covers pages in your extension, including html files and service workers."},sandbox:{$ref:"#/definitions/content_security_policy",description:"This policy covers any sandboxed extension pages that your extension uses."}}},web_accessible_resources:{type:"array",description:"An array of objects that declare resource access rules. Each object maps an array of extension resources to an array of URLs and/or extension IDs that can access those resources.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/web_resource"}}},dependencies:{browser_action:{not:{required:["browser_action"]}},page_action:{not:{required:["page_action"]}}}},title:"JSON schema for Google Chrome extension manifest files",type:"object"};function xa(t){t.addFormat("permission",{type:"string",validate:e=>typeof e=="string"&&e.trim()!==""}),t.addFormat("content-security-policy",{type:"string",validate:e=>typeof e=="string"}),t.addFormat("glob-pattern",{type:"string",validate:e=>typeof e=="string"&&/[\*\?\[\]]/.test(e)}),t.addFormat("match-pattern",{type:"string",validate:e=>e==="<all_urls>"||e==="file:///"||e.startsWith("http://localhost")||e.startsWith("http:// ")||e.startsWith("http://*:*/*")?!0:typeof e=="string"&&/^(\*|http|https|file|ftp):\/\//.test(e)}),t.addFormat("uri",{type:"string",validate:e=>typeof e=="string"&&/^(\w+:)?\/\//.test(e)}),t.addFormat("mime-type",{type:"string",validate:e=>typeof e=="string"&&/^[a-z]+\/[a-z0-9\-\+]+$/.test(e)})}var va=a(require("path")),_a=require("webpack");function Sa(t,e,s){let r=t.options.context||"",i=va.default.join(r,"manifest.json"),o=require(i).name||"Extension.js",c=e?.params.missingProperty;t.errors.push(new _a.WebpackError(Kr(o,s,c)))}var Pa=a(require("path")),ka=require("webpack");function Ea(t,e,s){let r=t.options.context||"",i=Pa.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new ka.WebpackError(Yr(o,e,s)))}var ja=a(require("path")),$a=require("webpack");function _r(t,e,s){let r=t.options.context||"",i=ja.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new $a.WebpackError(Zr(o,s,e)))}var vs=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let i=new Da.default;xa(i);let n={allOf:[wa]},o=i.compile(n),c=o(s),p=s.manifest_version===3;if(!c&&o.errors){let l=o.errors[0];if(l?.keyword==="required"){Sa(e,l,r);return}p&&(l?.keyword==="type"&&Ea(e,l,r),l?.keyword==="not"&&_r(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(Ca.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,n,o),r()})}};var Ia=a(require("fs")),Pr=a(require("path"));var Sr=a(require("webpack"));function Fa(t,e){let s="Conflict: Multiple assets emit different content to the same filename ";if(e.message.includes(s)){let r=e.message.replace(s,"");if(r.startsWith("content_scripts"))return new Sr.default.WebpackError(Qr(t,r))}return null}function La(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new Sr.default.WebpackError(ei(s.name)):null}var _s=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=Pr.default.join(Pr.default.dirname(this.manifestPath),"package.json");if(!Ia.default.existsSync(s))return;let r=require(s).name;e.hooks.compilation.tap("develop:common-errors",i=>{i.hooks.afterSeal.tapAsync("develop:common-errors",n=>{i.errors.forEach((o,c)=>{let p=Fa(r,o),l=La(r,o);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),n()})})}};var Ss=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new xs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new vs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new _s({manifestPath:this.manifestPath}).apply(e)}};var wc=a(require("os")),Er=a(require("path"));var sc=a(require("fs")),rc=require("child_process");var ie=a(require("path")),$s=a(require("fs"));var Oa={alternate_error_pages:{enabled:!1},autofill:{enabled:!1},browser:{check_default_browser:!1,default_browser_setting_enabled:!1},default_apps:"install",distribution:{alternate_shortcut_text:!1,auto_launch_chrome:!1,import_bookmarks:!1,import_history:!1,import_home_page:!1,import_search_engine:!1,suppress_first_run_bubble:!0,do_not_register_for_update_launch:!0,make_chrome_default:!1,make_chrome_default_for_user:!1,require_eula:!1,suppress_first_run_default_browser_prompt:!0},dns_prefetching:{enabled:!1},download:{default_directory:"/tmp/",directory_upgrade:!0,open_pdf_in_adobe_reader:!1,prompt_for_download:!0},enable_do_not_track:!0,extensions:{theme:{use_system:!1},toolbarsize:-1,ui:{developer_mode:!0}},plugins:{plugins_list:[{enabled:!1,name:"Java(TM)"}],show_details:!0},profile:{password_manager_enabled:!1},safebrowsing:{enabled:!1,safebrowsingextended_reporting_enabled:!1},savefile:{default_directory:"/tmp",type:0},search:{suggest_enabled:!1},session:{restore_on_startup:1},sync:{suppress_start:!0},sync_promo:{show_on_first_run_allowed:!1,show_ntp_bubble:!1},translate:{enabled:!1}},Aa={...Oa},Ma={...Oa};var x=require("@colors/colors/safe");function j(t,e){let s=e==="warn"?(0,x.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,x.cyan)("\u25BA\u25BA\u25BA"):e==="error"?(0,x.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,x.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,x.gray)("")}${s}`}function We(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ps(t,e){let s=t==="firefox"?"Add-on":"Extension";return`${j(t,"success")} ${We(t)} ${s} running in ${(0,x.cyan)(e||"unknown")} mode.`}function ks(t,e){let s=We(t),r=e=="null"?`${s} browser is not installed.
|
|
108
|
+
Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/FiloSottile/mkcert")}`}function xi(t){return`${x("Port","error")} Selected port ${(0,f.brightYellow)(t.toString())} in use. Choose a new port. `}function vi(){return`${x("manifest.json","error")} Extension ID Not Defined
|
|
125
109
|
|
|
126
|
-
|
|
110
|
+
For MAIN world content_scripts, the extension ID must be specified.
|
|
111
|
+
Ensure your extension have a fixed ID and that the ${(0,f.brightYellow)("publicPath")}
|
|
112
|
+
of your ${(0,f.brightYellow)("extension.config.js")} is defined as your extension URL.`}var at=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=nt.default.dirname(this.manifestPath),s=e.options.mode||"development",i=[`.env.${this.browser}.${s}`,`.env.${this.browser}`,`.env.${s}`,".env.local",".env",".env.example"],o="";for(let d of i){let g=nt.default.join(r,d);if(zr.default.existsSync(g)){o=g;break}}if(!o)return;console.log(Zs());let n=Jr.default.config({path:o}).parsed||{},c=nt.default.join(r,".env.defaults"),l={...zr.default.existsSync(c)?Jr.default.config({path:c}).parsed||{}:{},...n,...process.env},u=Object.keys(l).filter(d=>d.startsWith("EXTENSION_PUBLIC_")).reduce((d,g)=>(d[`process.env.${g}`]=JSON.stringify(l[g]),d[`import.meta.env.${g}`]=JSON.stringify(l[g]),d),{});u["process.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["import.meta.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["process.env.EXTENSION_PUBLIC_ENV_MODE"]=JSON.stringify(s),u["import.meta.env.EXTENSION_PUBLIC_ENV_MODE"]=JSON.stringify(s),new oe.DefinePlugin(u).apply(e),e.hooks.thisCompilation.tap("manifest:update-manifest",d=>{d.hooks.processAssets.tap({name:"env:module",stage:oe.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},g=>{Object.keys(g).forEach(_=>{if(_.endsWith(".json")||_.endsWith(".html")){let v=d.assets[_].source().toString();v=v.replace(/\$EXTENSION_PUBLIC_[A-Z_]+/g,M=>{let T=M.slice(1);return l[T]||M}),d.updateAsset(_,new oe.sources.RawSource(v))}})})})}};var Hr=a(require("fs")),_i=a(require("path")),ct=class{apply(e){let r=_i.default.join(e.options.output.path||"","hot");if(Hr.default.existsSync(r))try{Hr.default.rmSync(r,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation.")}catch(s){console.error(`[CleanHotUpdatesPlugin] Failed to remove hot-update files: ${s.message}`)}}};var pt=class{static name="plugin-compilation";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new Si.default().apply(e),new at({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ct().apply(e),e.hooks.done.tap("develop:brand",r=>{r.compilation.name=void 0;let s=r.endTime-r.startTime,i=require(this.manifestPath).name;console.log(Gs(i,s,r))})}};var Hi=a(require("path")),Vi=a(require("mini-css-extract-plugin"));var Bi=a(require("mini-css-extract-plugin"));var ve=a(require("path")),_e=a(require("fs"));var ne=a(require("path")),lt=a(require("fs")),Vr=require("child_process"),ki=require("package-manager-detector");function Ei(t,e){return Object.values(e||{}).some(r=>r===t)}function h(t,e,r){let s=ne.default.extname(e),o=k(e,r)?ne.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(s)&&(o=o.replace(s,".js")),[".html",".njk",".nunjucks"].includes(s)&&(o=o.replace(s,".html")),[".css",".scss",".sass",".less"].includes(s)&&(o=o.replace(s,".css")),Gr(o||"")}function Gr(t){return t.replace(/\\/g,"/")}function k(t,e={}){if(!e)return!1;let r=ne.default.normalize(Gr(t));return Object.values(e).some(i=>typeof i!="string"?!1:Gr(i).includes(r))}function z(t,e){if(t.getAsset("manifest.json")||t.assets["manifest.json"]){let r=t.assets["manifest.json"].source().toString();return JSON.parse(r||"{}")}return require(e)}function ae(){return process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("pnpm")?"pnpm":!1}function Pi(){return process.env.npm_execpath?"npm":!1}async function C(t,e){try{let r=await(0,ki.detect)();console.log(Xs(t,r?.name||"unknown"));let s="";r?.name==="yarn"?s=`yarn --silent add ${e.join(" ")} --cwd ${__dirname} --optional`:r?.name==="npm"||Pi()?s=`npm --silent install ${e.join(" ")} --prefix ${__dirname} --save-optional`:ae()?s=`pnpm --silent add ${e.join(" ")} --prefix ${__dirname} --save-optional`:s=`${r} --silent install ${e.join(" ")} --cwd ${__dirname} --optional`,(0,Vr.execSync)(s,{stdio:"inherit"}),await new Promise(i=>setTimeout(i,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Ks(t)),r?.name==="yarn"?s="yarn install --silent > /dev/null 2>&1":r?.name==="npm"||Pi()?s="npm install --silent > /dev/null 2>&1":ae()?s="pnpm install --silent > /dev/null 2>&1":s=`${r} install --silent > /dev/null 2>&1`,(0,Vr.execSync)(s,{stdio:"inherit"})),console.log(Ys(t))}catch(r){console.error(Qs(t,r))}}function ft(t){let e=ne.default.join(t,"package.json");if(!lt.default.existsSync(e))return!1;let r=JSON.parse(lt.default.readFileSync(e,"utf-8")),s=["react","vue","@angular/core","svelte","solid-js","preact"],i=r.dependencies||{},o=r.devDependencies||{};for(let n of s)if(i[n]||o[n])return!0;return!1}function $i(t){return!lt.default.existsSync(ne.default.resolve(__dirname,`run-${t}-profile`))}function Ci(t){let e=t.name?.replace(/ /g,"-").toLowerCase();return{data:{id:`${e}@extension-js`,manifest:t,management:{id:`${e}@extension-js`,mayDisable:!0,optionsUrl:"",installType:"development",type:"extension",enabled:!0,name:t.name||"",description:t.description||"",version:t.version||"",hostPermissions:t.host_permissions||[],permissions:t.permissions||[],offlineEnabled:t.offline_enabled||!1,shortName:t.short_name||"",isApp:t.app&&t.app.background&&t.app.background.scripts}}}}function O(t,e){return JSON.parse(JSON.stringify(t),function(i,o){let n=i.indexOf(":");if(n===-1)return o;let c=i.substring(0,n);(c===e||c==="chromium"&&Q.includes(e))&&(this[i.substring(n+1)]=o)})}var ji=!1;function ut(t){let e=ve.default.join(t,"package.json");if(!_e.default.existsSync(e))return!1;let r=Xp(t),s=require(e),i=s.devDependencies&&s.devDependencies.tailwindcss,o=s.dependencies&&s.dependencies.tailwindcss,n=!!r&&!!(i||o);return n&&(ji||(process.env.EXTENSION_ENV==="development"&&console.log(S("Tailwind")),ji=!0)),n}function Xp(t){let e=ve.default.join(t,"tailwind.config.mjs"),r=ve.default.join(t,"tailwind.config.cjs"),s=ve.default.join(t,"tailwind.config.js");if(_e.default.existsSync(e))return e;if(_e.default.existsSync(r))return r;if(_e.default.existsSync(s))return s}var Fi=a(require("path")),Li=a(require("fs"));var Di=!1;function Se(t){let e=Fi.default.join(t,"package.json");if(!Li.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.sass,i=r.dependencies&&r.dependencies.sass;return s||i?(Di||(process.env.EXTENSION_ENV==="development"&&console.log(S("SASS")),Di=!0),!0):!1}async function Ii(t,e){if(!Se(t))return[];try{require.resolve("sass-loader")}catch{await C("PostCSS",["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),await C("SASS",["sass","sass-loader","resolve-url-loader"]),console.log(D("SASS")),process.exit(0)}return[{test:/\.(s(a|c)ss)$/,exclude:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await N(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await N(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await N(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await N(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var Mi=a(require("path")),Ai=a(require("fs"));var Oi=!1;function Pe(t){let e=Mi.default.join(t,"package.json");if(!Ai.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.less,i=r.dependencies&&r.dependencies.less;return s||i?(Oi||(process.env.EXTENSION_ENV==="development"&&console.log(S("LESS")),Oi=!0),!0):!1}async function Ri(t,e){if(!Pe(t))return[];try{require.resolve("less-loader")}catch{await C("LESS",["less","less-loader","resolve-url-loader"]),console.log(D("LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await N(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await N(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var dt=a(require("path")),mt=a(require("fs"));var ce=!1;function Zp(t){let e=dt.default.join(t,"package.json");if(!mt.default.existsSync(e))return!1;let r=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"];if(mt.default.existsSync(e)){let s=require(e);if(s.dependencies&&s.dependencies.postcss||s.devDependencies&&s.devDependencies.postcss)return ce||(process.env.EXTENSION_ENV==="development"&&console.log(S("PostCSS")),ce=!0),!0}for(let s of r)if(mt.default.existsSync(dt.default.join(t,s)))return ce||(process.env.EXTENSION_ENV==="development"&&console.log(S("PostCSS")),ce=!0),!0;return ut(t)?(ce||(process.env.EXTENSION_ENV==="development"&&console.log(S("PostCSS")),ce=!0),!0):!1}async function Ti(t,e){if(!Zp(t))return{};try{require.resolve("postcss-loader")}catch{!Se(t)&&!Pe(t)&&await C("PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(D("PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:dt.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}var Ui=a(require("path")),qi=a(require("fs"));var Ni=!1;function ke(t){let e=Ui.default.join(t,"package.json");if(!qi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.vue,i=r.dependencies&&r.dependencies.vue;return(s||i)&&(Ni||(process.env.EXTENSION_ENV==="development"&&console.log(S("Vue")),Ni=!0)),!!s||!!i}async function Wi(t){if(!ke(t))return;try{require.resolve("vue-loader")}catch{await C("TypeScript",["typescript"]),await C("Vue",["vue-loader","vue-template-compiler","vue-style-loader"]),console.log(D("Vue")),process.exit(0)}let e=[{test:/\.vue$/,loader:require.resolve("vue-loader"),include:t,exclude:/node_modules/}];return{plugins:[new(require("vue-loader")).VueLoaderPlugin],loaders:e,alias:void 0}}async function N(t,e){let r=Bi.default.loader,s=[e.useMiniCssExtractPlugin?r:ke(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{sourceMap:e.mode==="development"}}].filter(Boolean);if(ut(t)||Se(t)||Pe(t)){let i=await Ti(t,e);i.loader&&s.push(i)}return e.loader&&s.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:e.mode==="development",root:t}},{loader:require.resolve(e.loader),options:{sourceMap:e.mode==="development"}}),s.filter(Boolean)}var A=a(require("path")),R=a(require("fs"));function Kp(t){let e=A.default.join(t,"stylelint.config.json"),r=A.default.join(t,".stylelintrc.js file"),s=A.default.join(t,"stylelint.config.mjs"),i=A.default.join(t,".stylelintrc.mjs"),o=A.default.join(t,"stylelint.config.cjs"),n=A.default.join(t,".stylelintrc.cjs"),c=A.default.join(t,".stylelintrc.json"),p=A.default.join(t,".stylelintrc"),l=A.default.join(t,".stylelintrc.yml"),u=A.default.join(t,".stylelintrc.yaml");if(R.default.existsSync(e))return e;if(R.default.existsSync(r))return r;if(R.default.existsSync(s))return s;if(R.default.existsSync(i))return i;if(R.default.existsSync(o))return o;if(R.default.existsSync(n))return n;if(R.default.existsSync(c))return c;if(R.default.existsSync(p))return p;if(R.default.existsSync(l))return l;if(R.default.existsSync(u))return u}var zi=!1;function Yp(t){let e=A.default.join(t,"package.json");if(!R.default.existsSync(e))return!1;let s=!!Kp(t);return s&&(zi||(process.env.EXTENSION_ENV==="development"&&console.log(S("Stylelint")),zi=!0)),s}async function Ji(t){return Yp(t),[]}var gt=class t{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=Hi.default.dirname(this.manifestPath),i=[new Vi.default];i.forEach(l=>l.apply(e));let o=await Ji(s);i.push(...o);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{use:await N(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]},{test:/\.module\.css$/,oneOf:[{use:await N(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]}];e.options.plugins=[...e.options.plugins,...i].filter(Boolean);let c=await Ii(s,r),p=await Ri(s,r);n.push(...c),n.push(...p),e.options.module.rules=[...e.options.module.rules,...n].filter(Boolean)}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var ht=class{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async apply(e){let r={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},i=[...e.options.module.rules.some(o=>o&&o.test instanceof RegExp&&o.test.test(".svg")&&o.use!==void 0)?[]:[r],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}};var Kr=a(require("path"));var Xr=a(require("path")),Zr=a(require("fs"));var Gi=!1,Qp=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function el(t){let e=Xr.default.join(t,"package.json");if(!Zr.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies["babel-core"],i=r.dependencies&&r.dependencies["babel-core"],o=Qp.some(n=>Zr.default.existsSync(Xr.default.join(t,n)))||!!s||!!i;return o&&(Gi||(process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(S("Babel")),Gi=!0)),o}async function Xi(t,e){el(e)}var Ki=a(require("path")),Yi=a(require("fs"));var Zi=!1;function pe(t){let e=Ki.default.join(t,"package.json");if(!Yi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.preact,i=r.dependencies&&r.dependencies.preact;return(s||i)&&(Zi||(process.env.EXTENSION_ENV==="development"&&console.log(S("Preact")),Zi=!0)),!!s||!!i}async function Qi(t){if(!pe(t))return;try{require.resolve("@prefresh/webpack")}catch{await C("Preact",["@prefresh/webpack"]),console.log(D("Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var to=a(require("path")),ro=a(require("fs"));var eo=!1;function le(t){let e=to.default.join(t,"package.json");if(!ro.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.react,i=r.dependencies&&r.dependencies.react;return(s||i)&&(eo||(process.env.EXTENSION_ENV==="development"&&console.log(S("React")),eo=!0)),!!s||!!i}async function so(t){if(!le(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{await C("React",["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"]),console.log(D("React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))({overlay:!1})],loaders:void 0,alias:void 0}}var yt=a(require("path")),bt=a(require("fs"));var io=!1;function V(t){let e=yt.default.join(t,"package.json");if(!bt.default.existsSync(e))return!1;let r=rl(t),s=require(e),i=s.devDependencies&&s.devDependencies.typescript,o=s.dependencies&&s.dependencies.typescript;return io||((i||o)&&(r?process.env.EXTENSION_ENV==="development"&&console.log(S("TypeScript")):(console.log(di()),sl(t))),io=!0),!!r&&!!(i||o)}function tl(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:ft(t)?"react-jsx":"preserve",lib:["dom","dom.iterable","esnext"],moduleResolution:"node",module:"esnext",resolveJsonModule:!0,strict:!0,target:"esnext",isolatedModules:!1,skipLibCheck:!0},exclude:["node_modules","dist"]}}function rl(t){let e=yt.default.join(t,"tsconfig.json");if(bt.default.existsSync(e))return e}function sl(t){bt.default.writeFileSync(yt.default.join(t,"tsconfig.json"),JSON.stringify(tl(t,{mode:"development"}),null,2))}var wt=class t{static name="plugin-js-frameworks";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=Kr.default.dirname(this.manifestPath),i=await Xi(e,s),o=await so(s),n=await Qi(s),c=await Wi(s);e.options.resolve.alias={...i?.alias||{},...o?.alias||{},...n?.alias||{},...c?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Kr.default.dirname(this.manifestPath)],exclude:/node_modules/,use:{loader:require.resolve("swc-loader"),options:{sync:!0,module:{type:"es6"},minify:r==="production",isModule:!0,jsc:{target:"es2016",parser:{syntax:V(s)?"typescript":"ecmascript",tsx:V(s)&&(le(s)||pe(s)),jsx:!V(s)&&(le(s)||pe(s)),dynamicImport:!0},transform:{react:{development:r==="development",refresh:r==="development",runtime:"automatic",importSource:"react"}}}}}},...i?.loaders||[],...o?.loaders||[],...n?.loaders||[],...c?.loaders||[],...e.options.module.rules].filter(Boolean),o?.plugins?.forEach(p=>p.apply(e)),n?.plugins?.forEach(p=>p.apply(e)),c?.plugins?.forEach(p=>p.apply(e))}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var Ue=a(require("path"));var Jo=a(require("path"));var oo=a(require("path"));function no(t,e){if(!e||!e.action||!e.action.default_popup)return;let r=e.action.default_popup;return oo.default.join(t,r)}var ao=a(require("path"));function co(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let r=e.browser_action.default_popup;return ao.default.join(t,r)}var xt=a(require("path"));function po(t,e){let r={newtab:void 0};if(!e||!e.chrome_url_overrides)return{"chrome_url_overrides/newtab":void 0};if(e.chrome_url_overrides.history){let s=e.chrome_url_overrides.history;r={"chrome_url_overrides/history":xt.default.join(t,s)}}if(e.chrome_url_overrides.newtab){let s=e.chrome_url_overrides.newtab;r={"chrome_url_overrides/newtab":xt.default.join(t,s)}}if(e.chrome_url_overrides.bookmarks){let s=e.chrome_url_overrides.bookmarks;r={"chrome_url_overrides/bookmarks":xt.default.join(t,s)}}return r}var lo=a(require("path"));function fo(t,e){if(!e||!e.devtools_page)return;let r=e.devtools_page;return lo.default.join(t,r)}var Yr=a(require("path"));function uo(t,e){if(e.options_page){let s=e.options_page;return Yr.default.join(t,s)}if(!e||!e.options_ui||!e.options_ui.page)return;let r=e.options_ui.page;return Yr.default.join(t,r)}var mo=a(require("path"));function go(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let r=e.page_action.default_popup;return mo.default.join(t,r)}var ho=a(require("path"));function yo(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let r=e.sandbox.pages,s={};for(let[i,o]of r.entries())s[`sandbox/page-${i}`]=ho.default.join(t,o);return s}var bo=a(require("path"));function wo(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let r=e.side_panel.default_path;return bo.default.join(t,r)}var xo=a(require("path"));function vo(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let r=e.sidebar_action.default_panel;return xo.default.join(t,r)}function Ee(t,e){return{"action/default_popup":no(t,e),"browser_action/default_popup":co(t,e),...po(t,e),devtools_page:fo(t,e),"options_ui/page":uo(t,e),"page_action/default_popup":go(t,e),...yo(t,e),"side_panel/default_path":wo(t,e),"sidebar_action/default_panel":vo(t,e)}}var Qr=a(require("path"));function _o(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Qr.default.join(t,e.action.default_icon);let r=[];for(let s in e.action.default_icon)r.push(Qr.default.join(t,e.action.default_icon[s]));return r}var es=a(require("path"));function So(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let r=[];if(typeof e.browser_action.default_icon=="string")return es.default.join(t,e.browser_action.default_icon);for(let s in e.browser_action.default_icon){let i=e.browser_action.default_icon[s]=es.default.join(t,e.browser_action.default_icon[s]);r.push(i)}return r}var ts=a(require("path"));function Po(t,e){if(!(!e||!e.browser_action||!e.browser_action.theme_icons)){for(let r of e.browser_action.theme_icons)r.light&&(r.light=ts.default.join(t,r.light)),r.dark&&(r.dark=ts.default.join(t,r.dark)),r.size&&delete r.size;return e.browser_action.theme_icons}}var ko=a(require("path"));function Eo(t,e){if(!e||!e.icons)return;let r=[];for(let s in e.icons){let i=ko.default.join(t,e.icons[s]);r.push(i)}return r}var rs=a(require("path"));function $o(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return rs.default.join(t,e.page_action.default_icon);let r=[];for(let s in e.page_action.default_icon){let i=rs.default.join(t,e.page_action.default_icon[s]);r.push(i)}return r}var Co=a(require("path"));function jo(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:Co.default.join(t,e.sidebar_action.default_icon)}function Do(t,e){return{action:_o(t,e),browser_action:So(t,e),"browser_action/theme_icons":Po(t,e),icons:Eo(t,e),page_action:$o(t,e),sidebar_action:jo(t,e)}}var Fo=a(require("path"));function Lo(t,e){let r={};return!e||!e.declarative_net_request||!e.declarative_net_request.rule_resources?{"declarative_net_request/rule_resources-0":void 0}:(e.declarative_net_request.rule_resources.forEach(i=>{r[`declarative_net_request/${i.id}`]=Fo.default.join(t,i.path)}),r)}var Io=a(require("path"));function Oo(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let r=e.storage.managed_schema;return Io.default.join(t,r)}function Mo(t,e){return{...Lo(t,e),"storage/managed_schema":Oo(t,e)}}var $e=a(require("path")),Ce=a(require("fs"));function Ao(t,e){let r=$e.default.join($e.default.dirname(e),"_locales"),s=[];if(Ce.default.existsSync(r))for(let i of Ce.default.readdirSync(r)){let o=$e.default.join(r,i);if(o&&Ce.default.statSync(o).isDirectory())for(let n of Ce.default.readdirSync(o))s.push($e.default.join(t,"_locales",i,n))}return s}var Ro=a(require("path"));function To(t,e){if(!e||!e.background)return;let r=e.background.scripts;if(r)return r.map(s=>Ro.default.join(t,s))}var No=a(require("path"));function Uo(t,e){if(!e||!e.background)return;let r=e.background.service_worker;if(r)return No.default.join(t,r)}var ss=a(require("path"));function qo(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let r=o=>{if(o.js?.length!==0)return o.js?.map(n=>ss.default.join(t,n))},s=o=>{if(o.css?.length!==0)return o.css?.map(n=>ss.default.join(t,n))},i={};for(let[o,n]of e.content_scripts.entries()){let c=r(n),p=s(n);i[`content_scripts/content-${o}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return i}var Wo=a(require("path"));function Bo(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let r=e.user_scripts.api_script;return Wo.default.join(t,r)}function je(t,e){return{"background/scripts":To(t,e),"background/service_worker":Uo(t,e),...qo(t,e),"user_scripts/api_script":Bo(t,e)}}function zo(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function fe({manifestPath:t,browser:e}){let r=Jo.default.dirname(t),s=require(t),i=O(s,e||"chrome");return{html:Ee(r,i),icons:Do(r,i),json:Mo(r,i),locales:Ao(r,t),scripts:je(r,i),web_accessible_resources:zo(i)}}var ue=a(require("path"));var vt=a(require("fs")),De=a(require("path"));function _t(t,e){if(!vt.default.existsSync(t)||!vt.default.statSync(t).isDirectory())return[];let r=[];function s(i){let o=vt.default.readdirSync(i,{withFileTypes:!0});for(let n of o){let c=De.default.join(i,n.name);n.isDirectory()?s(c):n.isFile()&&e(n.name)&&r.push(c)}}return s(t),r}function St(t,e,r=""){return!e||!e.length?{}:e.reduce((s,i)=>{let o=De.default.extname(i),n=De.default.basename(i,o),c=r?`${r}/${n}`:De.default.relative(t,i);return{...s,[c]:i}},{})}function Ho({manifestPath:t}){let e=ue.default.dirname(t),r={public:ue.default.join(e,"public"),pages:ue.default.join(e,"pages"),scripts:ue.default.join(e,"scripts")},s={public:_t(r.public,()=>!0),pages:_t(r.pages,o=>o.endsWith(".html")),scripts:_t(r.scripts,o=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(ue.default.extname(o)))};return{public:St(e,s.public),pages:St(e,s.pages,"pages"),scripts:St(e,s.scripts,"scripts")}}var Pt=a(require("path")),Vo=a(require("webpack")),kt=class{manifestPath;browser;includeList;excludeList;loaderOptions;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList,this.loaderOptions=e.loaderOptions}apply(e){new Vo.default.ProvidePlugin({r:[Pt.default.resolve(__dirname,"./resolver-module.mjs"),"default"]}).apply(e),e.options.module?.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,loader:require.resolve(Pt.default.resolve(__dirname,"./resolver-loader.js")),include:[Pt.default.dirname(this.manifestPath)],exclude:/node_modules/,options:{manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList,jsx:this.loaderOptions?this.loaderOptions.jsx:!1,typescript:this.loaderOptions?this.loaderOptions.typescript:!1,minify:this.loaderOptions?this.loaderOptions.minify:!1}})}};var Go=a(require("fs")),$t=a(require("webpack")),Xo=require("webpack");var Et=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){e.hooks.compilation.tap("manifest:emit-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:emit-manifest",stage:$t.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let s=this.manifestPath,i;try{let c=Go.default.readFileSync(s,"utf-8");i=JSON.parse(c),"$schema"in i&&delete i.$schema}catch(c){r.errors.push(new $t.default.WebpackError(fi(c)));return}let o=JSON.stringify(i,null,2);r.emitAsset("manifest.json",new Xo.sources.RawSource(o))})})}};var $n=a(require("path")),Fe=require("webpack");function Zo(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:[...t.background.scripts.map(r=>h("background/scripts.js",r,e))]}}}}var Ko=a(require("path"));var Ct=t=>Ko.default.basename(t);function Yo(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${Ct(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([r,s])=>[r,h(`icons/${Ct(s)}`,s,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(r=>({...r,...r.light&&{light:h(`browser_action/${Ct(r.light)}`,r.light,e)},...r.dark&&{dark:h(`browser_action/${Ct(r.dark)}`,r.dark,e)}}))}}}}function Qo(t,e){return t.declarative_net_request&&{declarative_net_request:{...t.declarative_net_request,rule_resources:t.declarative_net_request.rule_resources.map(r=>({...r,path:r.path&&h(`declarative_net_request/${r.id}.json`,r.path,e)}))}}}function en(t,e){return{...Zo(t,e),...Yo(t,e),...Qo(t,e)}}var rn=a(require("path"));var tn=t=>rn.default.basename(t);function sn(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${tn(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([r,s])=>[r,h(`action/${tn(s)}`,s,e)]))}}}}function on(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function jt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function nn(t,e){return{...sn(t,e),...on(t,e),...jt(t,e)}}function an(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function cn(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function pn(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((r,s)=>{let i=[...new Set(r.js)],o=[...new Set(r.css)];return{...r,js:[...i.map(n=>h(`content_scripts/content-${s}.js`,n,e))],css:[...o.map(n=>h(`content_scripts/content-${s}.css`,n,e))]}})}}function ln(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var fn=a(require("path"));var il=t=>fn.default.basename(t);function un(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([r,s])=>[r,h(`icons/${il(s)}`,s,e)]))}}function mn(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function dn(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var hn=a(require("path"));var gn=t=>hn.default.basename(t);function yn(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${gn(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([r,s])=>[r,h(`icons/${gn(s)}`,s,e)]))}}}}function bn(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((r,s)=>h(`sandbox/page-${s}.html`,r,e))}}}}var wn=a(require("path"));var ol=t=>wn.default.basename(t);function xn(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${ol(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function vn(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var _n=a(require("path"));var nl=t=>_n.default.basename(t);function Sn(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${nl(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function Pn(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function kn(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function En(t,e){return{...an(t,e),...cn(t,e),...pn(t,e),...ln(t,e),...un(t,e),...mn(t,e),...dn(t,e),...yn(t,e),...bn(t,e),...jt(t,e),...xn(t,e),...vn(t,e),...Sn(t,e),...Pn(t,e),...kn(t)}}function is(t,e,r){let s=e||require(t);return JSON.stringify({...s,...En(s,r),...en(s,r),...nn(s,r)},null,2)}var Dt=class{manifestPath;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.excludeList=e.excludeList}applyDevOverrides(e){return e.content_scripts?e.content_scripts.map((r,s)=>(r.css.length&&!r.js.length&&(r.js=[h(`content_scripts-${s}`,"dev.js",{})]),r)):{}}applyProdOverrides(e,r){return r.content_scripts?r.content_scripts.map((s,i)=>{if(s.js.length&&!s.css.length){let o=e.options.output?.path||"";s.css=s.js.map(n=>{let c=$n.default.join(o,n.replace(".js",".css"));return h(`content_scripts/content-${i}.css`,c,{})})}return s}):{}}apply(e){e.hooks.thisCompilation.tap("manifest:update-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:update-manifest",stage:Fe.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(r.errors.length>0)return;let s=z(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};e.options.mode==="development"&&o.content_scripts&&(o.content_scripts=this.applyDevOverrides(o)),e.options.mode==="development"&&o.content_scripts&&(o.content_scripts=this.applyDevOverrides(o));let n=JSON.stringify(o,null,2),c=new Fe.sources.RawSource(n);r.updateAsset("manifest.json",c)}),e.options.mode==="production"&&r.hooks.afterProcessAssets.tap("manifest:update-manifest",()=>{if(r.errors.length>0)return;let s=z(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};o.content_scripts&&(o.content_scripts=this.applyProdOverrides(e,o));let n=JSON.stringify(o,null,2),c=new Fe.sources.RawSource(n);r.updateAsset("manifest.json",c)})})}};var Cn=a(require("fs")),Ft=class{dependencyList;constructor(e){this.dependencyList=e}apply(e){e.hooks.afterCompile.tap("ManifestPlugin (AddDependenciesPlugin)",r=>{if(r.errors?.length)return;let s=new Set(r.fileDependencies);this.dependencyList&&this.dependencyList.forEach(i=>{Cn.default.existsSync(i)&&(s.has(i)||(s.add(i),r.fileDependencies.add(i)))})})}};var jn=a(require("fs")),Dn=a(require("path")),It=a(require("webpack"));var Lt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}extractPaths(e){let r=Array.isArray(e)?e:[e];if(typeof r[0]=="string")return r;let s=[];if(typeof e=="object"&&!Array.isArray(e)){let i=e;i.light&&s.push(i.light),i.dark&&s.push(i.dark)}return s}handleErrors(e,r){let s=[".png",".jpg",".jpeg",".svg",".gif",".webp"],i=[".json"],o=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],n=".html",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let d of u){let g=Dn.default.extname(d),_=require(this.manifestPath).name||"Extension.js";if(!jn.default.existsSync(d)){if(d.startsWith("/"))return;let v=ie(_,p,d);s.includes(g)?e.errors.push(new r(v)):i.includes(g)?e.errors.push(new r(v)):o.includes(g)?e.errors.push(new r(v)):g===n?e.errors.push(new r(v)):e.errors.push(new r(v))}}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",r=>{r.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:It.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let s=It.default.WebpackError;this.handleErrors(r,s)})})}};var Fn=a(require("fs")),Mt=a(require("webpack"));var Ot=class{manifestPath;browser;includeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(r,s)=>{if((r.modifiedFiles||new Set).has(this.manifestPath)){let o=r.options.context||"",n=`${o}/package.json`;if(!Fn.default.existsSync(n)){s();return}let c=require(this.manifestPath),p=O(c,this.browser),l=this.flattenAndSort(Object.values(Ee(o,p))),u=this.flattenAndSort(Object.values(je(o,p)));r.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",d=>{d.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Mt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let y=d.getAsset("manifest.json")?.source.source().toString(),_=JSON.parse(y||"{}"),v=this.flattenAndSort(Object.values(Ee(o,_))),M=this.flattenAndSort(Object.values(je(o,_)));if(u.toString()!==M.toString()||l.toString()!==v.toString()){let T=l.filter(B=>!v.includes(B))[0],W=v.filter(B=>!l.includes(B))[0],we=ui(W,T);d.errors.push(new Mt.default.WebpackError(we))}})})}s()})}};var At=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Et({manifestPath:this.manifestPath}).apply(e),new Lt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Dt({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new Ft([this.manifestPath]).apply(e),new Ot({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ps=a(require("path"));var ns=a(require("fs")),Nt=a(require("webpack")),An=require("webpack");var Ln=a(require("fs")),de=a(require("path")),In=a(require("parse5-utils"));var me=a(require("parse5-utils"));function Rt(t){try{return new URL(t),!0}catch{return!1}}function Le(t,e){let{childNodes:r=[]}=t;for(let s of r)if(s.nodeName==="script"){let i=me.default.getAttribute(s,"src");if(!i||Rt(i))continue;e({filePath:i,childNode:s,assetType:"script"})}else if(s.nodeName==="link"){let i=me.default.getAttribute(s,"href"),o=me.default.getAttribute(s,"rel");if(!i||Rt(i))continue;e(o==="dns-prefetch"||o==="icon"||o==="manifest"||o==="modulepreload"||o==="preconnect"||o==="prefetch"||o==="preload"||o==="prerender"?{filePath:i,childNode:s,assetType:"staticHref"}:{filePath:i,childNode:s,assetType:"css"})}else if(s.nodeName==="a"||s.nodeName==="area"){let i=me.default.getAttribute(s,"href");if(!i||Rt(i))continue;e({filePath:i,childNode:s,assetType:"staticHref"})}else if(s.nodeName==="audio"||s.nodeName==="embed"||s.nodeName==="iframe"||s.nodeName==="img"||s.nodeName==="input"||s.nodeName==="source"||s.nodeName==="track"||s.nodeName==="video"){let i=me.default.getAttribute(s,"src");if(!i||Rt(i))continue;e({filePath:i,childNode:s,assetType:"staticSrc"})}else Le(s,e)}function j(t,e){let r={css:[],js:[],static:[]};if(!t)return r;let s=e||Ln.default.readFileSync(t,{encoding:"utf8"}),i=In.default.parse(s),o=(n,c)=>de.default.join(de.default.dirname(n),c.startsWith("/")?de.default.relative(de.default.dirname(n),c):c);for(let n of i.childNodes)if(n.nodeName==="html"){for(let c of n.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Le(c,({filePath:p,assetType:l})=>{let u=o(t,p);switch(l){case"script":r.js?.push(u);break;case"css":r.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;r.static?.push(u);break;default:break}});return{css:r.css,js:r.js,static:r.static}}}function On(t,e,r){let s=Object.keys(t).find(o=>{let n=t[o];return t[o]===e||j(n)?.js?.includes(e)||j(n)?.css?.includes(e)})||"",i=os(e);return s?`/${s.replace(i,"")}${r}`:`${e.replace(i,"")}${r}`}function os(t){switch(de.default.extname(t)){case".js":case".mjs":case".ts":case".tsx":return".js";case".css":case".scss":case".sass":case".less":return".css";case".html":return".html";default:return".js"}}function G(t,e,r){return r?`/${t}${e}`:`${t}${e}`}function Mn(t,e){return Object.values(e||{}).some(r=>r===t)}var Tt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let s=require(this.manifestPath).name||"Extension.js";e.hooks.thisCompilation.tap("html:emit-html-file",i=>{i.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Nt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let o=Object.entries(this.includeList||{});for(let n of o){let[c,p]=n;if(p){if(!ns.default.existsSync(p)){let u=ie(s,c,p);i.warnings.push(new Nt.default.WebpackError(u));return}let l=ns.default.readFileSync(p,"utf8");if(!k(p,this.excludeList)){let u=new An.sources.RawSource(l),d=G(c,".html");i.emitAsset(d,u)}}}})})}};var Ut=a(require("fs")),ge=a(require("path")),Rn=a(require("webpack")),Ie=require("webpack");var qt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-assets-to-compilation",r=>{r.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Ie.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(r.errors.length>0)return;let s=Object.entries(this.includeList||{});for(let i of s){let[o,n]=i,c=o+".html";if(n){let p=r.getAsset(c);if(p){let l=p.source.source().toString(),u=j(n,l)?.static,d=[...new Set(u)];for(let g of d)if(!g.startsWith("/")){if(!Ut.default.existsSync(g)&&!Mn(g,this.includeList)&&!ge.default.basename(g).startsWith("#")){let T=it(n,g);g.startsWith("/")||r.warnings.push(new Rn.default.WebpackError(T));return}let y=Ut.default.readFileSync(g),_=new Ie.sources.RawSource(y),v=ge.default.join("assets",ge.default.basename(g));if(!r.getAsset(v))if(g.endsWith(".html")){let M=j(g),T=[...M?.js||[],...M?.css||[],...M?.static||[]];r.emitAsset(v,_),T.forEach(W=>{let we=Ut.default.readFileSync(W),B=new Ie.sources.RawSource(we),Bs=ge.default.join("assets",ge.default.basename(W));r.getAsset(Bs)||r.emitAsset(Bs,B)})}else r.emitAsset(v,_)}}}}})})}};var Tn=a(require("path")),as=a(require("fs"));var Wt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=this.includeList||{};for(let s of Object.entries(r)){let[i,o]=s;if(o){if(!as.default.existsSync(o))return;let n=j(o),c=n?.js||[],p=n?.css||[],l=[...c,...p].filter(u=>!k(u,this.excludeList));if(e.options.mode==="development"){let u=Tn.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}as.default.existsSync(o)&&(k(o,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var zt=require("webpack");var cs=a(require("fs")),X=a(require("path")),F=a(require("parse5-utils"));function Nn(t,e,r,s,i){let o=cs.default.readFileSync(r,{encoding:"utf8"}),n=F.default.parse(o),c=!!t.getAsset(e+".css"),p=!1;for(let l of n.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Le(u,({filePath:d,childNode:g,assetType:y})=>{let _=X.default.dirname(r),v=X.default.resolve(_,d),M=os(v),T=k(X.default.resolve(_,d),i),W=X.default.join("/",X.default.normalize(d)),we=Ei(v,s);switch(y){case"script":{T?l=F.default.setAttribute(g,"src",W):(l=F.default.remove(g),p=!0);break}case"css":{T?l=F.default.setAttribute(g,"href",W):(l=F.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(T)l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",W);else if(we){let B=On(s,v,M);l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",B)}else{let B=X.default.join("assets",X.default.basename(v,M));cs.default.existsSync(v)&&(l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",G(B,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let d=F.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:G(e,".css",!0)}],F.default.append(u,d)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let d=F.default.createNode("script");d.attrs=[{name:"src",value:G(e,".js",!0)}],F.default.append(u,d)}}return F.default.serialize(n)}}var Bt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("html:update-html-file",r=>{r.hooks.processAssets.tap({name:"html:update-html-file",stage:zt.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n){let c=Nn(r,o,n,s,this.excludeList||{});if(!k(n,this.excludeList)&&c){let p=new zt.sources.RawSource(c),l=G(o,".html");r.updateAsset(l,p)}}}})})}};var Un=a(require("fs")),qn=require("webpack");var Jt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"html:add-to-file-dependencies",stage:qn.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i;if(o){let n=j(o),c=new Set(r.fileDependencies);if(Un.default.existsSync(o)){let p=[o,...n?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===o&&r.fileDependencies.add(l))}}}})})}};var Wn=a(require("fs"));var Ht=class{manifestPath;includeList;initialHtmlAssets={};constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}hasEntriesChanged(e,r){if(!r||!e||e.length!==r.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!0;return!1}storeInitialHtmlAssets(e){Object.entries(e).forEach(([r,s])=>{let i=s;if(i){if(!Wn.default.existsSync(i)){let n=require(this.manifestPath).name||"Extension.js";console.error(ie(n,r,i)),process.exit(1)}this.initialHtmlAssets[i]={js:j(i)?.js||[],css:j(i)?.css||[]}}})}apply(e){let r=this.includeList||{};this.storeInitialHtmlAssets(r),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(s,i)=>{let o=e.modifiedFiles||new Set,n=Array.from(o)[0];if(n&&this.initialHtmlAssets[n]){let c=j(n)?.js||[],p=j(n)?.css||[],{js:l,css:u}=this.initialHtmlAssets[n];(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l))&&console.log(bi(n))}i()})}};var Bn=a(require("fs")),zn=require("webpack");function cl(t,e){let r="Module not found: Error: Can't resolve ",i=e.message.replace(r,"").split("'")[1];if(e.message.includes(r))for(let o of Object.entries(t)){let[,n]=o;if(n){if(!Bn.default.existsSync(n))return null;let c=j(n),p=c?.js?.filter(u=>!u.startsWith("/"))||[],l=c?.css?.filter(u=>!u.startsWith("/"))||[];if(p.includes(i)||l.includes(i)){let u=it(n,i);return new zn.WebpackError(u)}}}return null}var Vt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.compilation.tap("html:handle-common-errors",r=>{r.hooks.afterSeal.tapPromise("html:handle-common-errors",async()=>{r.errors.forEach((s,i)=>{let o=cl(this.includeList||{},s);o&&(r.errors[i]=o)})})})}};var Gt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Tt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Wt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Bt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ps.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ps.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new Jt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ht({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Vt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var Oe=a(require("path"));var ls=a(require("fs")),Jn=a(require("path"));function Hn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let o=ls.default.existsSync(i)&&!k(i,e),n=Jn.default.extname(i);return o&&(n===".js"||n===".mjs"||n===".jsx"||n===".ts"||n===".tsx")})}function Vn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>ls.default.existsSync(i)&&!k(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Xt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=this.includeList||{},s={};for(let[i,o]of Object.entries(r)){let n=Hn(o,this.excludeList),c=Vn(o,this.excludeList),p=[...n];e.options.mode==="production"&&p.push(...c),(c.length||n.length)&&(s[i]={import:p})}e.options.entry={...e.options.entry,...s}}};var ee=require("webpack"),pl=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],ll=[...pl,`var runtime = isBrowser ? browser : isChrome ? chrome : (typeof self === 'object' && self.addEventListener) ? { get runtime() { throw new Error("No chrome or browser runtime found") } } : { runtime: { getURL: x => x } }`],Zt=class t{apply(e){let{RuntimeGlobals:r}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",s=>{s.hooks.runtimeRequirementInTree.for(r.publicPath).tap(t.name,i=>{let o=fl();return s.addRuntimeModule(i,o),!0})})}};function fl(){class t extends ee.RuntimeModule{constructor(){super("publicPath",ee.RuntimeModule.STAGE_BASIC)}generate(){let r=this.compilation?.outputOptions.publicPath;return ee.Template.asString([...ll,`var path = ${JSON.stringify(this.compilation?.getPath(r||"",{hash:this.compilation.hash||"XXXX"}))}`,`${ee.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var Kt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=require(this.manifestPath);r.content_scripts?.some(s=>s.world&&s.world.toLowerCase()==="main")&&Q.includes(this.browser)&&!r.key&&(console.error(vi()),process.exit(1))}};var Yt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Xt({manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Oe.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Oe.default.join(__dirname,"inject-content-css-during-dev.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Oe.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Oe.default.join(__dirname,"add-hmr-accept-code.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="production"&&new Zt().apply(e),new Kt({manifestPath:this.manifestPath,browser:this.browser||"chrome",includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e)}};var Ae=a(require("path")),Re=a(require("fs")),us=a(require("webpack")),Te=require("webpack");var he=a(require("path")),Me=a(require("fs"));function fs(t){let e=he.default.join(he.default.dirname(t),"_locales"),r=[];if(Me.default.existsSync(e))for(let s of Me.default.readdirSync(e)){let i=he.default.join(e,s);if(i&&Me.default.statSync(i).isDirectory())for(let o of Me.default.readdirSync(i))r.push(he.default.join(he.default.dirname(t),"_locales",s,o))}return r}var Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let i=require(this.manifestPath).name||"Extension.js";if(!Re.default.existsSync(this.manifestPath)){r.errors.push(new us.default.WebpackError(li(i,this.manifestPath)));return}if(r.errors.length>0)return;let o=fs(this.manifestPath);for(let n of Object.entries(o||[])){let[c,p]=n,l=p;if(l){if(Ae.default.extname(l)!==".json")continue;if(!Re.default.existsSync(l)){r.warnings.push(new us.default.WebpackError(ot(c,l)));return}let u=Re.default.readFileSync(l),d=new Te.sources.RawSource(u),g=e.options.context||Ae.default.dirname(this.manifestPath);if(!k(l,this.excludeList)){let y=Ae.default.relative(g,l);r.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=fs(this.manifestPath);for(let i of Object.entries(s||[])){let[,o]=i;if(o){let n=new Set(r.fileDependencies),c=s||[];for(let p of c)Re.default.existsSync(p)&&Ae.default.extname(p)===".json"&&(n.has(p)||(n.add(p),r.fileDependencies.add(p)))}}})})}};var er=a(require("fs")),Gn=a(require("webpack")),Ne=require("webpack");var tr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:Ne.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i,c=Array.isArray(n)?n:[n];for(let p of c)if(p&&!k(p,this.excludeList)){if(!er.default.existsSync(p)){r.warnings.push(new Gn.default.WebpackError(ot(o,p)));return}let l=er.default.readFileSync(p),u=new Ne.sources.RawSource(l);r.emitAsset(o+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:Ne.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?o:[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);k(c,this.excludeList)||er.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var ms=a(require("fs")),Xn=a(require("path")),sr=require("webpack");var rr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:emit-file",r=>{r.hooks.processAssets.tap({name:"icons:emit-file",stage:sr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n===void 0)continue;let c=Array.isArray(n)?typeof n[0]=="string"?n:n.map(Object.values).flat():[n];for(let p of c)if(p){if(!ms.default.existsSync(p))continue;if(!k(p,this.excludeList)){let l=ms.default.readFileSync(p),u=new sr.sources.RawSource(l),d=Xn.default.basename(p),y=`${o.endsWith("theme_icons")?o.replace("theme_icons",""):o}/${d}`;r.emitAsset(y,u)}}}})})}};var Zn=a(require("fs")),Kn=require("webpack"),ir=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:Kn.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);Zn.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var or=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new rr({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new ir({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ar=require("webpack");function Yn(t){return t.map(e=>{try{let r=new URL(e.replace(/^\*:\/\//,"https://"));return e.endsWith(r.pathname)?`${e.substring(0,e.length-r.pathname.length)}/*`:r.pathname==="/"?`${e}/*`:e}catch{return e}})}var nr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,r){let s=z(e,this.manifestPath),i=s.web_accessible_resources||[],o=s.web_accessible_resources||[];for(let[p,l]of Object.entries(r)){let u=s.content_scripts?.find(d=>d.js&&d.js.some(g=>g.includes(p)));if(u){let d=u.matches||[];if(s.manifest_version===3){let g=i.find(y=>y.matches.some(_=>d.includes(_)));g?l.forEach(y=>{!g.resources.includes(y)&&!y.endsWith(".map")&&g.resources.push(y)}):i.push({resources:l.filter(y=>!y.endsWith(".map")),matches:Yn(d)})}else l.forEach(g=>{o.includes(g)||o.push(g)})}}s.manifest_version===3?i.length>0&&(s.web_accessible_resources=i):o.length>0&&(s.web_accessible_resources=Array.from(new Set(o)));let n=JSON.stringify(s,null,2),c=new ar.sources.RawSource(n);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",r=>{r.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ar.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let s=[],i=Object.keys(this.includeList||{});for(let c of i.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?s.push(...c):typeof c=="string"&&s.push(c));let o=r.chunkGraph,n={};r.entrypoints.forEach((c,p)=>{if(s.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(o.getChunkModulesIterable(u)).forEach(g=>{o.getModuleChunks(g).forEach(y=>{y.auxiliaryFiles.forEach(_=>{l.includes(_)||l.push(_)})})})}),n[p]=l}}),this.generateManifestPatches(r,n)})})}};var L=a(require("fs")),I=a(require("path")),Qn=a(require("chokidar")),cr=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let r=I.default.dirname(e);if(L.default.existsSync(r))return!0;L.default.mkdirSync(r,{recursive:!0})}copyFile(e,r){this.ensureDirectoryExistence(r),L.default.copyFileSync(e,r)}copyFolder(e,r){L.default.existsSync(r)||L.default.mkdirSync(r,{recursive:!0}),L.default.readdirSync(e).forEach(i=>{let o=I.default.join(e,i),n=I.default.join(r,i);L.default.statSync(o).isDirectory()?this.copyFolder(o,n):this.copyFile(o,n)})}apply(e){let r=I.default.dirname(this.options.manifestPath),s=I.default.join(r,"public"),i=e.options.output?.path||"";L.default.existsSync(s)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let o=I.default.join(i,"/");L.default.existsSync(o)||L.default.mkdirSync(o,{recursive:!0}),L.default.existsSync(s)&&this.copyFolder(s,o)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let o=I.default.join(r,"public"),n=Qn.default.watch(o,{ignoreInitial:!0});n.on("add",c=>{let p=I.default.join(i,I.default.relative(r,c));this.copyFile(c,p)}),n.on("change",c=>{let p=I.default.join(i,I.default.relative(r,c));this.copyFile(c,p)}),n.on("unlink",c=>{let p=I.default.join(i,I.default.relative(r,c));L.default.existsSync(p)&&L.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{n.close().catch(console.error)})}))}};var U=a(require("path")),ds=a(require("chokidar"));var pr=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,r,s){let i=U.relative(process.cwd(),r),p=mi(s?"Adding":"Removing",s?"added":"removed",e,e==="pages"?"HTML pages":"script files",i);if(s){console.warn(p);return}console.error(p),process.exit(1)}apply(e){e.hooks.afterPlugins.tap("special-folders:warn-upon-folder-changes",()=>{let r=U.dirname(this.manifestPath),s=U.join(r,"pages"),i=U.join(r,"scripts"),o=ds.watch(s,{ignoreInitial:!0}),n=ds.watch(i,{ignoreInitial:!0}),c=e.options.resolve?.extensions;o.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),o.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),n.on("add",p=>{c?.includes(U.extname(p))&&this.throwCompilationError("scripts",p,!0)}),n.on("unlink",p=>{c?.includes(U.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{o.close().catch(console.error),n.close().catch(console.error)})})}};var lr=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:r}=this.options;new cr({manifestPath:r}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new pr(r).apply(e)}};var fr=class{static name="plugin-extension";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=this.manifestPath,s=fe({manifestPath:r,browser:this.browser}),i=Ho({manifestPath:r,browser:this.browser});process.env.EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN==="true"&&new kt({manifestPath:r,browser:this.browser,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:le(Ue.default.dirname(this.manifestPath))||pe(Ue.default.dirname(this.manifestPath))||ke(Ue.default.dirname(this.manifestPath)),typescript:V(Ue.default.dirname(this.manifestPath)),minify:e.options.mode==="production"}}).apply(e),new At({browser:this.browser,manifestPath:r,includeList:{...s.html,...s.icons,...s.json,...s.scripts},excludeList:i.public}).apply(e),new Gt({manifestPath:r,includeList:{...s.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Yt({manifestPath:r,browser:this.browser,includeList:{...s.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new Qt({manifestPath:r}).apply(e),new tr({manifestPath:r,includeList:s.json,excludeList:i.public}).apply(e),new or({manifestPath:r,includeList:s.icons,excludeList:i.public}).apply(e),new nr({manifestPath:r,includeList:{...s.scripts,...i.scripts},excludeList:i.public}).apply(e),new lr({manifestPath:r}).apply(e)}};var Be=a(require("path"));var ea=a(require("path")),ta=a(require("ws"));function ur(t,e){t.clients.forEach(r=>{r.readyState===ta.default.OPEN&&r.send(JSON.stringify(e))})}function ra(t,e,r){if(!r||!e)return;let s=fe({manifestPath:e}).locales,i=fe({manifestPath:e}).scripts,o=fe({manifestPath:e}).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}ea.default.basename(r)==="manifest.json"&&ur(t,{changedFile:"manifest.json"}),s?.forEach(n=>{n.includes(r)&&ur(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([n,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(r)&&n==="background/service_worker"&&ur(t,{changedFile:"service_worker"})}),Object.entries(o).forEach(([n,c])=>{c?.includes(r)&&n==="declarative_net_request"&&ur(t,{changedFile:"declarative_net_request"})})}var hs=a(require("path")),na=a(require("fs")),We=a(require("ws"));var qe=a(require("path")),ul=a(require("http")),ia=a(require("https")),gs=a(require("fs"));var sa=t=>{if(!gs.default.existsSync(t))return;let e=qe.default.basename(t);return gs.default.readFileSync(qe.default.join(__dirname,"certs",e))};function oa(t){let e={key:sa(qe.default.join(__dirname,"certs","localhost.key")),cert:sa(qe.default.join(__dirname,"certs","localhost.cert"))},r=ia.default.createServer(e,(s,i)=>{i.writeHead(200),i.end()});return r.on("error",s=>{throw console.error(xi(t)),new Error(s.message)}),{server:r,port:t}}function ml(t,e){switch(e){case"chrome":return new We.default.Server({host:"localhost",port:t});case"edge":return new We.default.Server({host:"localhost",port:t+1});case"firefox":return new We.default.Server({server:oa(t+2).server});default:return new We.default.Server({host:"localhost",port:8888})}}async function aa(t,e){let r=t.options.context||"",s=require(hs.default.join(r,"manifest.json")),i=e.port||8e3,o=ml(i,e.browser);if(o.on("connection",n=>{n.send(JSON.stringify({status:"serverReady"})),n.on("error",c=>{console.log(hi(c))}),n.on("message",c=>{let p=JSON.parse(c.toString());if(p.status==="clientReady"){let l=require(hs.default.join(r,"manifest.json"));setTimeout(()=>{console.log(Br(l,e.browser,p)),console.log("")},2500),$i(e.browser)&&setTimeout(()=>{console.log(gi(e.browser))},5e3)}})}),e.browser==="firefox"||e.browser==="gecko-based"){let n=Ci(s);console.log(Br(s,e.browser,n)),console.log(""),na.default.existsSync(st)||(console.log(wi()),console.log(""))}return o}var ca=a(require("path")),ys=a(require("fs"));function pa(t,e){let r=ca.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let s=ys.default.readFileSync(r,"utf8"),i=s.replace(/__RELOAD_PORT__/g,e.toString());i!==s&&ys.default.writeFileSync(r,i,"utf8")}catch(s){console.error(`Error processing file: ${s.message}`)}}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var ze=class{manifestPath;port;browser;stats;constructor(e){this.manifestPath=e.manifestPath,this.port=e.port||8e3,this.browser=e.browser||"chrome",this.stats=e.stats}async apply(e){if(!this.manifestPath)return;pa(this.browser,this.port);let r=await aa(e,{...this,mode:e.options.mode,browser:this.browser,stats:this.stats,port:this.port});e.hooks.watchRun.tapAsync("reload:create-web-socket-server",(s,i)=>{let n=(s.modifiedFiles||new Set).values().next().value;if(!n){i();return}let c=Be.default.relative(Be.default.dirname(this.manifestPath),n),p=Be.default.relative(process.cwd(),Be.default.dirname(n));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&ra(r,this.manifestPath,n),i()})}};var bs=a(require("path"));function la(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[bs.default.dirname(r)],exclude:/node_modules/,use:[{loader:bs.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:r,browser:e}}]})}var ws=a(require("path"));function fa(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ws.default.dirname(r)],exclude:/node_modules/,use:[{loader:ws.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:r,browser:e}}]})}var dr=require("webpack");var xs=a(require("content-security-policy-parser"));function ua(t){let e="";for(let r in t)e+=`${r} ${t[r].join(" ")}; `;return e.trim()}function ma(t){let e=t.content_security_policy;if(!e)return"script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";let r=(0,xs.default)(e);if(!r.get("script-src"))r.set("script-src",["'self'","'unsafe-eval'","blob:","filesystem:"]);else{let i=r.get("script-src")||[];i.includes("'unsafe-eval'")||i.push("'unsafe-eval'"),i.includes("blob:")||i.push("blob:"),i.includes("filesystem:")||i.push("filesystem:"),r.set("script-src",i)}r.get("object-src")||r.set("object-src",["'self'","blob:","filesystem:"]);let s=Object.fromEntries(r.entries());return ua(s)}function da(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self';"};let r=(0,xs.default)(e.extension_pages||""),s={};for(let n in s)r.get(n)||r.set(n,s[n]);let i=Object.fromEntries(r.entries());return{extension_pages:ua(i)}}function ga(t){let e=["/*.json","/*.js","/*.css"],r=t.web_accessible_resources;if(!r||r.length===0)return e;let s=new Set(r);for(let i of e)s.has(i)||s.add(i);return Array.from(s)}function ha(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function vs(t,e){return t.background?{background:{...t.background}}:e==="firefox"||e==="gecko-based"?{background:{...t.background||{},scripts:["background/script.js"]}}:t.manifest_version===2?{background:{...t.background||{},scripts:["background/script.js"]}}:{background:{...t.background||{},service_worker:"background/service_worker.js"}}}function _s(t){return t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:[...new Set(t.externally_connectable.ids||[]),"*"]}}:t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:["*"]}}:{}}var mr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let r=z(e,this.manifestPath),s={...r,content_security_policy:r.manifest_version===3?da(r):ma(r),...r.manifest_version===3?r.permissions?{permissions:[...new Set(["scripting",...r.permissions])]}:{permissions:["scripting"]}:{},...vs(r,this.browser),..._s(r),web_accessible_resources:r.manifest_version===3?ha(r):ga(r)},i=JSON.stringify(s,null,2),o=new dr.sources.RawSource(i);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",o)}apply(e){e.hooks.thisCompilation.tap("run-chromium:apply-manifest-dev-defaults",r=>{r.hooks.processAssets.tap({name:"run-chromium:apply-manifest-dev-defaults",stage:dr.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},s=>{if(!this.manifestPath){let i="No manifest.json found in your extension bundle. Unable to patch manifest.json.";r&&e.webpack.WebpackError&&r.errors.push(new e.webpack.WebpackError(`run-chromium: ${i}`));return}this.generateManifestPatches(r)})})}};var Ss=a(require("fs")),Je=a(require("path")),ya=a(require("webpack-target-webextension"));var gr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,r,s){let i=Je.default.resolve(__dirname,r==="firefox"||r==="gecko-based"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),o=O(s,r);if(r==="firefox"||r==="gecko-based"){o=s.background;let n=o?.scripts;n&&n.length>0?this.ensureFileExists(n[0]):this.addDefaultEntry(e,"background/script",i)}else{let n=Je.default.dirname(this.manifestPath);if(o=s.background,s.manifest_version===3){let c=o?.service_worker;if(c){let p=Je.default.join(n,c);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/service_worker",i)}else if(s.manifest_version===2){let c=o?.scripts;if(c&&c.length>0){let p=Je.default.join(n,c[0]);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/script",i)}}}ensureFileExists(e){if(!Ss.default.existsSync(e)&&this.manifestPath){let s=require(this.manifestPath).name||"Extension.js",i=yi(s,e);throw console.error(i),new Error(i)}}addDefaultEntry(e,r,s){e.options.entry={...e.options.entry,[r]:{import:[s]}}}getEntryName(e){if(e.background){if(e.manifest_version===3)return{serviceWorkerEntry:"background/service_worker"};if(e.manifest_version===2)return{pageEntry:"background/script"}}return{pageEntry:"background"}}apply(e){if(!this.manifestPath||!Ss.default.lstatSync(this.manifestPath).isFile())return;let r=require(this.manifestPath),s=O(r,this.browser);this.handleBackground(e,this.browser,s),new ya.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var Ps=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){(Q.includes(this.browser)||this.browser==="chromium-based")&&la(e,this.browser,this.manifestPath),(this.browser==="firefox"||this.browser==="gecko-based")&&fa(e,this.browser,this.manifestPath),new mr({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new gr({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},ba=Ps;var hr=class{static name="plugin-reload";manifestPath;browser;port;stats;autoReload;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.port=e.port,this.stats=e.stats,this.autoReload=e.autoReload}apply(e){e.options.mode==="development"&&new ze({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new ba({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var wa=a(require("webpack")),yr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new wa.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var wr=require("webpack");var br=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let r=O(e,this.browser);return JSON.stringify(r,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-fields",r=>{r.hooks.processAssets.tap({name:"compatibility:browser-fields",stage:wr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let s=z(r,this.manifestPath),i=this.patchManifest(s),o=new wr.sources.RawSource(i);r.updateAsset("manifest.json",o)})})}};var xr=class{static name="plugin-compatibility";manifestPath;browser;polyfill;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.polyfill=e.polyfill||!1}async apply(e){this.polyfill&&this.browser!=="firefox"&&new yr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new br({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var Da=a(require("fs"));var xa=a(require("webpack")),va=a(require("content-security-policy-parser"));function _a(t){let e=t.content_security_policy,r=t.content_security_policy?.extension_pages,s=i=>{if(!i)return;let o=(0,va.default)(i);if(o.get("script-src")&&o.get("script-src")?.includes("'unsafe-eval'"))return ti()};if(t.manifest_version===3){let i=e?s(r):void 0;if(i)return new xa.default.WebpackError(i)}return null}var ks=a(require("webpack"));function Sa(t,e){let r=t.web_accessible_resources;if(r){let s=r.some(o=>typeof o=="string"),i=r.some(o=>typeof o=="object"||o.resources||o.matches);if(t.manifest_version===2&&!s)return new ks.default.WebpackError(si(e));if(t.manifest_version===3&&!i)return new ks.default.WebpackError(ii(e))}return null}var Pa=a(require("webpack"));function ka(t,e){return(e==="firefox"||e==="gecko-based")&&t.background?.service_worker?new Pa.default.WebpackError(ei()):null}var Ea=a(require("path")),$a=a(require("fs")),Ca=a(require("webpack"));function ja(t,e){let r=Ea.default.join(e.options.context||"","_locales");return $a.default.existsSync(r)&&!t.default_locale?new Ca.default.WebpackError(ri()):null}var vr=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,r,s){let i=_a(r),o=Sa(r,s),n=ka(r,s),c=ja(r,e);i&&e.errors.push(i),o&&e.errors.push(o),n&&e.options.mode==="production"&&e.errors.push(n),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Da.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleRuntimeErrors(r,o,n),s()})}};var Ta=a(require("fs")),Na=a(require("ajv"));var Fa={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://json.schemastore.org/chrome-manifest.json",additionalProperties:!0,definitions:{action_v2:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{anyOf:[{type:"string",description:"FIXME: String form is deprecated."},{type:"object",description:"Icon for the main toolbar.",properties:{"19":{$ref:"#/definitions/icon"},"38":{$ref:"#/definitions/icon"}}}]}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},action_v3:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{type:"object",properties:{"16":{$ref:"#/definitions/icon"},"24":{$ref:"#/definitions/icon"},"32":{$ref:"#/definitions/icon"}}}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},command:{type:"object",if:{$comment:"Global shortcuts change the acceptable pattern for the suggested_key.",properties:{global:{const:!0}},required:["global"]},then:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl)\\+Shift\\+[0-9]"}}}}},else:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl|Alt|Option)\\+(Shift\\+)?[A-Z]"}}}}}},content_security_policy:{type:"string",description:"This introduces some fairly strict policies that will make extensions more secure by default, and provides you with the ability to create and enforce rules governing the types of content that can be loaded and executed by your extensions and applications.",format:"content-security-policy",default:"script-src 'self'; object-src 'self'"},glob_pattern:{type:"string",format:"glob-pattern"},icon:{$ref:"#/definitions/uri"},match_pattern:{type:"string",format:"match-pattern",pattern:"^((\\*|http|https|file|ftp|chrome-extension):\\/\\/(\\*|\\*\\.[^\\/\\*]+|[^\\/\\*]+)?(\\/.*))|urn:(\\*|.*)|<all_urls>$"},mime_type:{type:"string",format:"mime-type",pattern:"^(?:application|audio|image|message|model|multipart|text|video)\\/[-+.\\w]+$"},page:{$ref:"#/definitions/uri"},permissions:{type:"array",uniqueItems:!0,items:{type:"string",format:"permission"}},scripts:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}},uri:{type:"string"},version_string:{type:"string",pattern:"^(?:\\d{1,5}\\.){0,3}\\d{1,5}$"},web_resource:{type:"object",required:["resources"],properties:{resources:{type:"array",description:`An array of resources to be exposed. Resources are specified as strings and may contain * for wildcard matches. For example, "/images/*" exposes everything in the extension's /images directory recursively while "*.png" exposes all PNG files.`,items:{$ref:"#/definitions/glob_pattern"}},matches:{type:"array",description:"A list of URL match patterns specifying which pages can access the resources. Only the origin is used to match URLs; subdomains patterns (*.google.com) and paths are ignored.",items:{$ref:"#/definitions/match_pattern"}},extension_ids:{type:"array",description:"A list of extension IDs, specifying which extensions can access the resources.",items:{type:"string"}},use_dynamic_url:{type:"boolean",description:"If true, only allow resources to be accessible through dynamic ID. The dynamic ID is generated per session. It's regenerated on browser restart or extension reload."}}}},dependencies:{content_scripts:{not:{required:["script_badge"]}},script_badge:{not:{required:["content_scripts"]}}},else:{properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{persistent:{type:"boolean",description:"When false, makes the background page an event page (loaded only when needed).",default:!0},page:{$ref:"#/definitions/page",description:"Specify the HTML of the background page.",default:"background.html"},scripts:{$ref:"#/definitions/scripts",description:"A background page will be generated by the extension system that includes each of the files listed in the scripts property.",default:["background.js"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},browser_action:{$ref:"#/definitions/action_v2",description:"Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup."},page_action:{$ref:"#/definitions/action_v2",description:"Use the chrome.pageAction API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages."},content_security_policy:{$ref:"#/definitions/content_security_policy"},web_accessible_resources:{type:"array",description:"An array of strings specifying the paths (relative to the package root) of packaged resources that are expected to be usable in the context of a web page.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}}},dependencies:{page_action:{not:{required:["browser_action"]}},browser_action:{not:{required:["page_action"]}}}},if:{properties:{manifest_version:{const:3}}},properties:{manifest_version:{type:"number",description:"One integer specifying the version of the manifest file format your package requires.",enum:[2,3]},name:{type:"string",description:"The name of the extension",maxLength:45},version:{$ref:"#/definitions/version_string",description:"One to four dot-separated integers identifying the version of this extension."},default_locale:{type:"string",description:"Specifies the subdirectory of _locales that contains the default strings for this extension.",default:"en"},description:{type:"string",description:"A plain text description of the extension",maxLength:132},icons:{type:"object",description:"One or more icons that represent the extension, app, or theme. Recommended format: PNG; also BMP, GIF, ICO, JPEG.",minProperties:1,properties:{"16":{$ref:"#/definitions/icon",description:"Used as the favicon for an extension's pages and infobar."},"48":{$ref:"#/definitions/icon",description:"Used on the extension management page (chrome://extensions)."},"128":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."},"256":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."}}},chrome_url_overrides:{type:"object",description:"Override pages are a way to substitute an HTML file from your extension for a page that Google Chrome normally provides.",additionalProperties:!1,maxProperties:1,properties:{bookmarks:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the Bookmark Manager menu item from the Chrome menu or, on Mac, the Bookmark Manager item from the Bookmarks menu. You can also get to this page by entering the URL chrome://bookmarks.",default:"bookmarks.html"},history:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the History menu item from the Chrome menu or, on Mac, the Show Full History item from the History menu. You can also get to this page by entering the URL chrome://history.",default:"history.html"},newtab:{$ref:"#/definitions/page",description:"The page that appears when the user creates a new tab or window. You can also get to this page by entering the URL chrome://newtab.",default:"newtab.html"}}},commands:{type:"object",description:"Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.",patternProperties:{".*":{$ref:"#/definitions/command"},"^_execute_browser_action$":{$ref:"#/definitions/command"},"^_execute_page_action$":{$ref:"#/definitions/command"}}},content_scripts:{type:"array",description:"Content scripts are JavaScript files that run in the context of web pages.",minItems:1,uniqueItems:!0,items:{type:"object",required:["matches"],additionalProperties:!1,properties:{matches:{type:"array",description:"Specifies which pages this content script will be injected into.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},exclude_matches:{type:"array",description:"Excludes pages that this content script would otherwise be injected into.",uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},css:{type:"array",description:"The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.",uniqueItems:!0,items:{$ref:"#/definitions/uri"}},js:{$ref:"#/definitions/scripts",description:"The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array."},world:{type:"string",description:"The JavaScript world for a script to execute within.",enum:["ISOLATED","MAIN"],default:"ISOLATED"},run_at:{type:"string",description:"Controls when the files in js are injected.",enum:["document_start","document_end","document_idle"],default:"document_idle"},all_frames:{type:"boolean",description:"Controls whether the content script runs in all frames of the matching page, or only the top frame.",default:!1},include_globs:{type:"array",description:"Applied after matches to include only those URLs that also match this glob. Intended to emulate the @include Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},exclude_globs:{type:"array",description:"Applied after matches to exclude URLs that match this glob. Intended to emulate the @exclude Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},match_about_blank:{type:"boolean",description:"Whether to insert the content script on about:blank and about:srcdoc.",default:!1}}}},devtools_page:{$ref:"#/definitions/page",description:"A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more."},externally_connectable:{description:"Declares which extensions, apps, and web pages can connect to your extension via runtime.connect and runtime.sendMessage.",type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string",description:"The IDs of extensions or apps that are allowed to connect. If left empty or unspecified, no extensions or apps can connect."}},matches:{type:"array",items:{type:"string",description:"The URL patterns for web pages that are allowed to connect. This does not affect content scripts. If left empty or unspecified, no web pages can connect."}},accepts_tls_channel_id:{type:"boolean",default:!1,description:"Indicates that the extension would like to make use of the TLS channel ID of the web page connecting to it. The web page must also opt to send the TLS channel ID to the extension via setting includeTlsChannelId to true in runtime.connect's connectInfo or runtime.sendMessage's options."}}},file_browser_handlers:{type:"array",description:"You can use this API to enable users to upload files to your website.",minItems:1,items:{type:"object",required:["id","default_title","file_filters"],additionalProperties:!1,properties:{id:{type:"string",description:"Used by event handling code to differentiate between multiple file handlers"},default_title:{type:"string",description:"What the button will display."},file_filters:{type:"array",description:"Filetypes to match.",minItems:1,items:{type:"string"}}}}},homepage_url:{$ref:"#/definitions/uri",description:"The URL of the homepage for this extension."},incognito:{type:"string",description:"Specify how this extension will behave if allowed to run in incognito mode.",enum:["spanning","split","not_allowed"],default:"spanning"},input_components:{type:"array",description:"Allows your extension to handle keystrokes, set the composition, and manage the candidate window.",items:{type:"object",required:["name","type","id","description","language","layouts"],additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"},id:{type:"string"},description:{type:"string"},language:{type:"string"},layouts:{type:"array"}}}},key:{type:"string",description:"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."},minimum_chrome_version:{$ref:"#/definitions/version_string",description:"The version of Chrome that your extension, app, or theme requires, if any."},nacl_modules:{type:"array",description:"One or more mappings from MIME types to the Native Client module that handles each type.",minItems:1,uniqueItems:!0,items:{type:"object",required:["path","mime_type"],additionalProperties:!1,properties:{path:{$ref:"#/definitions/uri",description:"The location of a Native Client manifest (a .nmf file) within the extension directory."},mime_type:{$ref:"#/definitions/mime_type",description:"The MIME type for which the Native Client module will be registered as content handler."}}}},oauth2:{type:"object",description:"Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account.",required:["client_id","scopes"],additionalProperties:!1,properties:{client_id:{type:"string",description:"You need to register your app in the Google APIs Console to get the client ID."},scopes:{type:"array",minItems:1,items:{type:"string"}}}},offline_enabled:{type:"boolean",description:"Whether the app or extension is expected to work offline. When Chrome detects that it is offline, apps with this field set to true will be highlighted on the New Tab page."},omnibox:{type:"object",description:"The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.",required:["keyword"],additionalProperties:!1,properties:{keyword:{type:"string",description:"The keyword that will trigger your extension."}}},optional_permissions:{$ref:"#/definitions/permissions",description:"Use the chrome.permissions API to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary."},options_page:{$ref:"#/definitions/page",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, a link to it will be provided from the extensions management page at chrome://extensions. Clicking the Options link opens a new tab pointing at your options page.",default:"options.html"},options_ui:{type:"object",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, an Options link will be shown on the extensions management page at chrome://extensions which opens a dialogue containing your options page.",required:["page"],properties:{page:{type:"string",description:"The path to your options page, relative to your extension's root."},chrome_style:{type:"boolean",default:!0,description:"If true, a Chrome user agent stylesheet will be applied to your options page. The default value is false, but we recommend you enable it for a consistent UI with Chrome."},open_in_tab:{type:"boolean",default:!1,description:"If true, your extension's options page will be opened in a new tab rather than embedded in chrome://extensions. The default is false, and we recommend that you don't change it. This is only useful to delay the inevitable deprecation of the old options UI! It will be removed soon, so try not to use it. It will break."}}},permissions:{$ref:"#/definitions/permissions",description:"Permissions help to limit damage if your extension or app is compromised by malware. Some permissions are also displayed to users before installation, as detailed in Permission Warnings."},requirements:{type:"object",description:"Technologies required by the app or extension. Hosting sites such as the Chrome Web Store may use this list to dissuade users from installing apps or extensions that will not work on their computer.",additionalProperties:!1,properties:{plugins:{type:"object",description:"Indicates if an app or extension requires NPAPI to run. This requirement is enabled by default when the manifest includes the 'plugins' field.",required:["npapi"],additionalProperties:!1,properties:{npapi:{type:"boolean",default:!0}}},"3D":{type:"object",description:"The '3D' requirement denotes GPU hardware acceleration.",required:["features"],additionalProperties:!1,properties:{features:{type:"array",description:"List of the 3D-related features your app requires.",minItems:1,uniqueItems:!0,items:{type:"string",enum:["webgl"]}}}}}},sandbox:{type:"object",description:"Defines an collection of app or extension pages that are to be served in a sandboxed unique origin, and optionally a Content Security Policy to use with them.",required:["pages"],additionalProperties:!1,properties:{pages:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/page"}},content_security_policy:{$ref:"#/definitions/content_security_policy",default:"sandbox allow-scripts allow-forms"}}},short_name:{type:"string",description:"The short name is typically used where there is insufficient space to display the full name.",maxLength:12},update_url:{$ref:"#/definitions/uri",description:"If you publish using the Chrome Developer Dashboard, ignore this field. If you host your own extension or app: URL to an update manifest XML file."},tts_engine:{type:"object",description:"Register itself as a speech engine.",required:["voices"],additionalProperties:!1,properties:{voices:{type:"array",description:"Voices the extension can synthesize.",minItems:1,uniqueItems:!0,items:{type:"object",required:["voice_name","event_types"],additionalProperties:!1,properties:{voice_name:{type:"string",description:"Identifies the name of the voice and the engine used."},lang:{type:"string",description:"Almost always, a voice can synthesize speech in just a single language. When an engine supports more than one language, it can easily register a separate voice for each language."},gender:{type:"string",description:"If your voice corresponds to a male or female voice, you can use this parameter to help clients choose the most appropriate voice for their application."},event_types:{type:"array",description:"Events sent to update the client on the progress of speech synthesis.",minItems:1,uniqueItems:!0,items:{type:"string",description:"",enum:["start","word","sentence","marker","end","error"]}}}}}}},version_name:{type:"string",description:"In addition to the version field, which is used for update purposes, version_name can be set to a descriptive version string and will be used for display purposes if present."},chrome_settings_overrides:{},content_pack:{},current_locale:{},import:{},platforms:{},signature:{},spellcheck:{},storage:{},system_indicator:{}},required:["manifest_version","name","version"],then:{$comment:"browser_action and page_action are no longer present in v3",properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{service_worker:{type:"string",description:"The service worker js file."},type:{type:"string",enum:["module"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},host_permissions:{$ref:"#/definitions/permissions"},action:{$ref:"#/definitions/action_v3",description:"Used to control the toolbar button for your extension in Chrome's UI."},content_security_policy:{type:"object",properties:{extension_pages:{$ref:"#/definitions/content_security_policy",description:"This policy covers pages in your extension, including html files and service workers."},sandbox:{$ref:"#/definitions/content_security_policy",description:"This policy covers any sandboxed extension pages that your extension uses."}}},web_accessible_resources:{type:"array",description:"An array of objects that declare resource access rules. Each object maps an array of extension resources to an array of URLs and/or extension IDs that can access those resources.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/web_resource"}}},dependencies:{browser_action:{not:{required:["browser_action"]}},page_action:{not:{required:["page_action"]}}}},title:"JSON schema for Google Chrome extension manifest files",type:"object"};function La(t){t.addFormat("permission",{type:"string",validate:e=>typeof e=="string"&&e.trim()!==""}),t.addFormat("content-security-policy",{type:"string",validate:e=>typeof e=="string"}),t.addFormat("glob-pattern",{type:"string",validate:e=>typeof e=="string"&&/[\*\?\[\]]/.test(e)}),t.addFormat("match-pattern",{type:"string",validate:e=>e==="<all_urls>"||e==="file:///"||e.startsWith("http://localhost")||e.startsWith("http:// ")||e.startsWith("http://*:*/*")?!0:typeof e=="string"&&/^(\*|http|https|file|ftp):\/\//.test(e)}),t.addFormat("uri",{type:"string",validate:e=>typeof e=="string"&&/^(\w+:)?\/\//.test(e)}),t.addFormat("mime-type",{type:"string",validate:e=>typeof e=="string"&&/^[a-z]+\/[a-z0-9\-\+]+$/.test(e)})}var Ia=require("webpack");function Oa(t,e,r){let s=e?.params.missingProperty;t.errors.push(new Ia.WebpackError(ai(r,s)))}var Ma=require("webpack");function Aa(t,e,r){t.warnings.push(new Ma.WebpackError(ni(e,r)))}var Ra=require("webpack");function Es(t,e,r){t.warnings.push(new Ra.WebpackError(oi(r,e)))}var _r=class{options;constructor(e){this.options=e}handleSchemaErrors(e,r,s){let i=new Na.default;La(i);let o={allOf:[Fa]},n=i.compile(o),c=O(r,s),p=n(c),l=c.manifest_version===3;if(!p&&n.errors){let u=n.errors[0];if(u?.keyword==="required"){Oa(e,u,s);return}l&&(u?.keyword==="type"&&Aa(e,u,s),u?.keyword==="not"&&Es(e,u,s))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Ta.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleSchemaErrors(r,o,n),s()})}};var Wa=a(require("fs")),Cs=a(require("path"));var $s=a(require("webpack"));function Ua(t,e){let r="Conflict: Multiple assets emit different content to the same filename ";if(e.message.includes(r)){let s=e.message.replace(r,"");if(s.startsWith("content_scripts"))return new $s.default.WebpackError(ci(t,s))}return null}function qa(t,e){let r=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new $s.default.WebpackError(pi(r.name)):null}var Sr=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let r=Cs.default.join(Cs.default.dirname(this.manifestPath),"package.json");if(!Wa.default.existsSync(r))return;let s=require(r).name;e.hooks.compilation.tap("develop:common-errors",i=>{i.hooks.afterSeal.tapAsync("develop:common-errors",o=>{i.errors.forEach((n,c)=>{let p=Ua(s,n),l=qa(s,n);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),o()})})}};var Pr=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new vr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new _r({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new Sr({manifestPath:this.manifestPath}).apply(e)}};var rp=a(require("os")),Os=a(require("path"));var fc=a(require("fs")),uc=a(require("path")),mc=require("child_process");var te=a(require("path")),Ge=a(require("fs"));var Ba={alternate_error_pages:{enabled:!1},autofill:{enabled:!1},browser:{check_default_browser:!1,default_browser_setting_enabled:!1},default_apps:"install",distribution:{alternate_shortcut_text:!1,auto_launch_chrome:!1,import_bookmarks:!1,import_history:!1,import_home_page:!1,import_search_engine:!1,suppress_first_run_bubble:!0,do_not_register_for_update_launch:!0,make_chrome_default:!1,make_chrome_default_for_user:!1,require_eula:!1,suppress_first_run_default_browser_prompt:!0},dns_prefetching:{enabled:!1},download:{default_directory:"/tmp/",directory_upgrade:!0,open_pdf_in_adobe_reader:!1,prompt_for_download:!0},enable_do_not_track:!0,extensions:{theme:{use_system:!1},toolbarsize:-1,ui:{developer_mode:!0}},plugins:{plugins_list:[{enabled:!1,name:"Java(TM)"}],show_details:!0},profile:{password_manager_enabled:!1},safebrowsing:{enabled:!1,safebrowsingextended_reporting_enabled:!1},savefile:{default_directory:"/tmp",type:0},search:{suggest_enabled:!1},session:{restore_on_startup:1},sync:{suppress_start:!0},sync_promo:{show_on_first_run_allowed:!1,show_ntp_bubble:!1},translate:{enabled:!1}},za={...Ba},Ja={...Ba};var b=require("@colors/colors/safe");function E(t,e){let r=e==="warn"?(0,b.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,b.cyan)("\u25BA\u25BA\u25BA"):e==="error"?`${(0,b.bold)((0,b.red)("ERROR"))} in ${He(t)} ${(0,b.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,b.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,b.gray)("")}${r}`}function He(t){return t.charAt(0).toUpperCase()+t.slice(1)}function kr(t){let e=He(t);return`${E(t,"info")} Creating new ${e} user profile...`}function Ha(t){return`${E(t,"success")} Instance already running.`}function Va(t){return`${E(t,"info")} Instance exited.`}function Er(t,e){let r=t==="firefox"||t==="gecko-based"?"Add-on":"Extension";return`${E(t,"success")} ${He(t)} ${r} running in ${(0,b.brightBlue)(e||"unknown")} mode.`}function Ve(t,e){let r=e=="null"?`Browser is not installed
|
|
127
113
|
|
|
128
|
-
|
|
114
|
+
`:`Can't find the browser path
|
|
129
115
|
|
|
130
|
-
`;return`${
|
|
116
|
+
`;return`${E(t,"error")} ${r}Either install the missing browser or choose a different one via ${(0,b.brightYellow)("--browser")} flag.
|
|
117
|
+
${(0,b.red)("NOT FOUND")} ${(0,b.underline)(e||He(t)+"BROWSER")}`}function Ga(t){return`${E(t,"error")} No Service Worker Support
|
|
131
118
|
|
|
132
|
-
Firefox does not support the ${(0,
|
|
133
|
-
Update your manifest.json file to use ${(0,
|
|
119
|
+
Firefox does not support the ${(0,b.brightYellow)("background.service_worker")} field yet.
|
|
120
|
+
Update your manifest.json file to use ${(0,b.brightYellow)("background.scripts")} instead.
|
|
134
121
|
|
|
135
|
-
Read more: ${(0,
|
|
122
|
+
Read more: ${(0,b.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Xa(t,e){return`${E(t,"error")} Error launching browser:
|
|
123
|
+
${(0,b.red)(e)}`}function Za(t,e){return`${E(t,"error")} ${(0,b.red)(e.stack)}`}function Ka(t){return`${E(t,"error")} Unable to connect to ${He(t)}. Too many retries.`}function Ya(t,e){return`${E(t,"error")} Error while installing temporary addon:
|
|
124
|
+
${(0,b.red)(e)}`}function Qa(t,e){return`${E(t,"error")} Path is not directory
|
|
136
125
|
|
|
137
|
-
|
|
126
|
+
Please provide a valid directory path and try again.
|
|
127
|
+
${(0,b.red)("NOT DIRECTORY")} ${(0,b.underline)(e)}`}function ec(t){return`${E(t,"error")} Error parsing message length.`}function tc(t){return`${E(t,"error")} ${(0,b.magenta)("MessagingClient")} connection closed.`}function rc(t,e){return`${E(t,"error")} Unexpected ${(0,b.magenta)("MessagingClient")} request without target actor: ${(0,b.brightYellow)(e)}`}function sc(t){return`${E(t,"error")} ${(0,b.magenta)("MessagingClient")} connection closed.`}function ic(t,e){return`${E(t,"error")} Target actor ${(0,b.brightYellow)(e)} already has an active request.`}function oc(t,e){return`${E(t,"error")} Error parsing packet: ${(0,b.red)(e)}`}function nc(t,e){return`${E(t,"error")} Message received without a sender actor:
|
|
128
|
+
${(0,b.brightYellow)(JSON.stringify(e))}`}function ac(t,e){return`${E(t,"error")} Received unexpected message:
|
|
129
|
+
${(0,b.red)(e)}`}var cc=a(require("progress"));function $r(t,e){let s=new cc.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),i=setInterval(()=>{let o=Math.random()*10*1024;s.tick(o),s.complete&&(clearInterval(i),e())},50)}function pc(t,e,r){if(e&&Ge.default.existsSync(e))return e;if(Ge.default.existsSync(te.default.resolve(__dirname,`run-${t}-profile`)))return te.default.resolve(__dirname,`run-${t}-profile`);let i=JSON.stringify({...t==="chrome"?za:Ja,...r});return $r(kr(t),()=>{let o=te.default.resolve(__dirname,`run-${t}-profile`),n=te.default.join(o,"Default");Ge.default.mkdirSync(n,{recursive:!0});let c=te.default.join(n,"Preferences");Ge.default.writeFileSync(c,i,"utf8")}),te.default.resolve(__dirname,`run-${t}-profile`)}function lc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],r=pc(t.browser,t.profile,t.preferences);return[`--load-extension=${e.join()}`,`--user-data-dir=${r}`,"--no-first-run","--disable-client-side-phishing-detection","--disable-component-extensions-with-background-pages","--disable-default-apps","--disable-features=InterestFeedContentSuggestions","--disable-features=Translate","--hide-scrollbars","--mute-audio","--no-default-browser-check","--no-first-run","--ash-no-nudges","--disable-search-engine-choice-screen","--disable-features=MediaRoute","--use-mock-keychain","--disable-background-networking","--disable-breakpad","--disable-component-update","--disable-domain-reliability","--disable-features=AutofillServerCommunicatio","--disable-features=CertificateTransparencyComponentUpdate","--disable-sync","--disable-features=OptimizationHints","--disable-features=DialMediaRouteProvider","--no-pings","--enable-features=SidePanelUpdates",...t.browserFlags||[]]}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Xe=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;chromiumBinary;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile||e.userDataDir,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.chromiumBinary=e.chromiumBinary}launchChromium(e){let r;switch(e){case"chrome":r=require(`${e}-location`);break;case"edge":r=require(`${e}-location`)();break;case"chromium-based":r=uc.default.normalize(this.chromiumBinary);break;default:r=require(`${e}`);break}fc.default.existsSync(r)||(console.error(Ve(e,r)),process.exit());let s=lc(this),i=this.startingUrl?[this.startingUrl,...s]:[...s],o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,mc.spawn)(`${r}`,i,{stdio:o});process.env.EXTENSION_ENV==="development"&&(n.stdout?.pipe(process.stdout),n.stderr?.pipe(process.stderr))}apply(e){let r=!1;e.hooks.done.tapAsync("run-browsers:module",(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}this.launchChromium(this.browser),setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),r=!0,i()})}};var ep=a(require("fs")),tp=a(require("path")),Is=require("child_process");var Ze=a(require("fs")),Cr=a(require("path")),dc=a(require("os")),gc=a(require("which")),hc=process.platform==="darwin",gl=process.platform==="win32",hl=!hc&&!gl;function yl(){if(hl)try{return gc.default.sync("firefox")}catch{return null}else if(hc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Cr.default.join(dc.default.homedir(),t.slice(1));return Ze.default.existsSync(t)?t:Ze.default.existsSync(e)?e:null}else{let t=Cr.default.join("Mozilla Firefox","firefox.exe"),e=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]];for(let s of e)if(s){let i=Cr.default.join(s,t);if(Ze.default.existsSync(i))return i}let r=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let s of r)if(Ze.default.existsSync(s))return s;return null}}var yc=yl();var Fs=a(require("path")),Ir=a(require("fs")),Ls=a(require("firefox-profile"));var bl={"app.update.enabled":!1,"browser.dom.window.dump.enabled":!0,"browser.formfill.enable":!1,"browser.link.open_newwindow":3,"browser.sessionstore.enabled":!1,"browser.shell.checkDefaultBrowser":!1,"browser.sync.enabled":!1,"browser.startup.page":0,"browser.startup.homepage_welcome_url":"about:blank","browser.startup.homepage_welcome_url_additional":"about:blank","browser.urlbar.suggest.bookmark":!1,"browser.urlbar.suggest.clipboard":!1,"browser.urlbar.suggest.history":!1,"browser.urlbar.suggest.openpage":!1,"browser.urlbar.suggest.remotetab":!1,"browser.urlbar.suggest.searches":!1,"browser.urlbar.suggest.topsites":!1,"browser.urlbar.suggest.engines":!1,"browser.urlbar.suggest.calculator":!1,"browser.urlbar.suggest.recentsearches":!1,"datareporting.policy.dataSubmissionEnabled":!1,"datareporting.policy.firstRunURL":"","devtools.browserconsole.contentMessages":!0,"devtools.chrome.enabled":!0,"devtools.debugger.prompt-connection":!1,"devtools.debugger.remote-enabled":!0,"devtools.errorconsole.enabled":!0,"extensions.installDistroAddons":!1,"extensions.autoDisableScopes":10,"extensions.chrome.enabled":!0,"extensions.logging.enabled":!1,"extensions.checkCompatibility.nightly":!1,"extensions.update.enabled":!1,"extensions.update.notifyUser":!1,"extensions.enabledScopes":5,"extensions.getAddons.cache.enabled":!1,"network.prefetch.next":!1,"network.speculative.preconnect.enabled":!1,"toolkit.telemetry.enabled":!1,"toolkit.telemetry.archive.enabled":!1,"toolkit.telemetry.newProfilePing.enabled":!1,"toolkit.recovery.enabled":!1,"urlclassifier.updateinterval":172800,"security.enterprise_roots.enabled":!0,"xpinstall.signatures.required":!1};function js(t){return{...bl,...t}}var Ye=a(require("fs")),Qe=a(require("path"));var Ke=a(require("path")),jr=a(require("fs")),m=require("@colors/colors/safe");function P(t){return`${t==="warn"?(0,m.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,m.cyan)("\u25BA\u25BA\u25BA"):t==="error"?`${(0,m.bold)((0,m.red)("ERROR"))} in Extension.js ${(0,m.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,m.brightGreen)("\u25BA\u25BA\u25BA")}`}function Z(t){return`${P("error")} Manifest file not found.
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Please provide a valid directory path.`}function za(t){return`${j(t,"error")} Error parsing message length.`}function Ha(t){return`${j(t,"error")} MessagingClient connection closed.`}function Va(t,e){return`${j(t,"error")} Unexpected MessagingClient request without target actor: ${(0,x.brightYellow)(e)}`}function Ga(t){return`${j(t,"error")} MessagingClient connection closed.`}function Xa(t,e){return`${j(t,"error")} Target actor ${(0,x.brightYellow)(e)} already has an active request.`}function Za(t,e){return`${j(t,"error")} Error parsing packet: ${(0,x.red)(e)}`}function Ya(t,e){return`${j(t,"error")} Message received without a sender actor: ${(0,x.brightYellow)(JSON.stringify(e))}`}function Ka(t,e){return`${j(t,"error")} Received unexpected message: ${(0,x.red)(e)}`}var Qa=a(require("progress"));function js(t,e){let r=new Qa.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),i=setInterval(()=>{let n=Math.random()*10*1024;r.tick(n),r.complete&&(clearInterval(i),e())},50)}function ec(t,e,s){if($s.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`)))return e||ie.default.resolve(__dirname,`run-${t}-profile`);let i=JSON.stringify(t==="chrome"?Aa:Ma);return s||js(Es(t),()=>{let n=ie.default.resolve(__dirname,`run-${t}-profile`),o=ie.default.join(n,"Default");$s.default.mkdirSync(o,{recursive:!0});let c=ie.default.join(o,"Preferences");$s.default.writeFileSync(c,i,"utf8")}),ie.default.resolve(__dirname,`run-${t}-profile`)}function tc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],s=ec(t.browser,t.profile,!1);return[`--load-extension=${e.join()}`,`--user-data-dir=${s}`,"--no-first-run","--disable-client-side-phishing-detection","--disable-component-extensions-with-background-pages","--disable-default-apps","--disable-features=InterestFeedContentSuggestions","--disable-features=Translate","--hide-scrollbars","--mute-audio","--no-default-browser-check","--no-first-run","--ash-no-nudges","--disable-search-engine-choice-screen","--disable-features=MediaRoute","--use-mock-keychain","--disable-background-networking","--disable-breakpad","--disable-component-update","--disable-domain-reliability","--disable-features=AutofillServerCommunicatio","--disable-features=CertificateTransparencyComponentUpdate","--disable-sync","--disable-features=OptimizationHints","--disable-features=DialMediaRouteProvider","--no-pings","--enable-features=SidePanelUpdates",...t.browserFlags||[]]}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var ve=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile||e.userDataDir,this.preferences=e.preferences,this.startingUrl=e.startingUrl}launchChromium(e){let s;switch(e){case"chrome":s=require(`${e}-location`);break;case"edge":s=require(`${e}-location`)();break;default:s=require(`${e}`);break}sc.default.existsSync(s)||(console.error(ks(e,s)),process.exit());let r=tc(this),i=this.startingUrl?[this.startingUrl,...r]:[...r],n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,rc.spawn)(s,i,{stdio:n});process.env.EXTENSION_ENV==="development"&&(o.stdout?.pipe(process.stdout),o.stderr?.pipe(process.stderr))}apply(e){let s=!1;e.hooks.done.tapAsync("run-browsers:module",(r,i)=>{if(r.compilation.errors.length>0){i();return}if(s){i();return}this.launchChromium(this.browser),setTimeout(()=>{console.log(Ps(this.browser,r.compilation.options.mode))},2e3),s=!0,i()})}};var yc=a(require("fs")),bc=require("child_process");var Be=a(require("fs")),Cs=a(require("path")),ic=a(require("os")),nc=a(require("which")),oc=process.platform==="darwin",al=process.platform==="win32",cl=!oc&&!al;function pl(){if(cl)try{return nc.default.sync("firefox")}catch{return null}else if(oc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Cs.default.join(ic.default.homedir(),t.slice(1));return Be.default.existsSync(t)?t:Be.default.existsSync(e)?e:null}else{let t=Cs.default.join("Mozilla Firefox","firefox.exe"),e=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]];for(let r of e)if(r){let i=Cs.default.join(r,t);if(Be.default.existsSync(i))return i}let s=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let r of s)if(Be.default.existsSync(r))return r;return null}}var Ds=pl();var cc=a(require("path")),Fs=a(require("fs")),kr=a(require("firefox-profile"));var ll={"app.update.enabled":!1,"browser.dom.window.dump.enabled":!0,"browser.formfill.enable":!1,"browser.link.open_newwindow":3,"browser.sessionstore.enabled":!1,"browser.shell.checkDefaultBrowser":!1,"browser.sync.enabled":!1,"browser.startup.page":0,"browser.startup.homepage_welcome_url":"about:blank","browser.startup.homepage_welcome_url_additional":"about:blank","browser.urlbar.suggest.bookmark":!1,"browser.urlbar.suggest.clipboard":!1,"browser.urlbar.suggest.history":!1,"browser.urlbar.suggest.openpage":!1,"browser.urlbar.suggest.remotetab":!1,"browser.urlbar.suggest.searches":!1,"browser.urlbar.suggest.topsites":!1,"browser.urlbar.suggest.engines":!1,"browser.urlbar.suggest.calculator":!1,"browser.urlbar.suggest.recentsearches":!1,"datareporting.policy.dataSubmissionEnabled":!1,"datareporting.policy.firstRunURL":"","devtools.browserconsole.contentMessages":!0,"devtools.chrome.enabled":!0,"devtools.debugger.prompt-connection":!1,"devtools.debugger.remote-enabled":!0,"devtools.errorconsole.enabled":!0,"extensions.installDistroAddons":!1,"extensions.autoDisableScopes":10,"extensions.chrome.enabled":!0,"extensions.logging.enabled":!1,"extensions.checkCompatibility.nightly":!1,"extensions.update.enabled":!1,"extensions.update.notifyUser":!1,"extensions.enabledScopes":5,"extensions.getAddons.cache.enabled":!1,"network.prefetch.next":!1,"network.speculative.preconnect.enabled":!1,"toolkit.telemetry.enabled":!1,"toolkit.telemetry.archive.enabled":!1,"toolkit.telemetry.newProfilePing.enabled":!1,"toolkit.recovery.enabled":!1,"urlclassifier.updateinterval":172800,"security.enterprise_roots.enabled":!0,"xpinstall.signatures.required":!1};function ac(t){return{...ll,...t}}function pc(t,e){let s=ac(e);Object.keys(s).forEach(n=>{t.setPreference(n,s[n])});let i=Object.keys(e);return i.length>0&&i.forEach(n=>{t.setPreference(n,e[n])}),t.updatePreferences(),t}function fl(t,e){let s=new kr.default({destinationDirectory:t});return pc(s,e)}function ul(t,e,s){let r;if(Fs.default.statSync(e).isDirectory())r=e;else throw new Error(Ja(t,e));let n=new kr.default({destinationDirectory:r});return pc(n,s)}function lc(t,e,s,r){let i,n=e||cc.default.resolve(__dirname,"run-firefox-data-dir");return Fs.default.existsSync(n)?i=ul(t,n,s||{}):(r||js(Es(t),()=>{}),Fs.default.mkdirSync(n,{recursive:!0}),i=fl(n,s||{})),i}async function fc(t,e){let{browser:s,startingUrl:r,preferences:i,userDataDir:n,browserConsole:o=!1,browserFlags:c=[]}=e,p=lc(s,n,i),l=[];r&&l.push(`--url "${r}"`),o&&l.push("--jsconsole"),c&&l.push(...c);let u=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args "${c.join(" ")}"`,`--profile "${p.path()}"`,`--listen ${u}`,"--verbose"].join(" ")}var hc=a(require("path"));var uc=a(require("net")),mc=a(require("events"));function ml(t,e){let s=e.toString(),r=s.indexOf(":");if(r<1)return{remainingData:e};let i=parseInt(s.substring(0,r),10);if(isNaN(i))return{remainingData:e,error:new Error(za(t)),fatal:!0};if(e.length-(r+1)<i)return{remainingData:e};let n=e.slice(r+1,r+1+i),o=e.slice(r+1+i);try{let c=JSON.parse(n.toString());return{remainingData:o,parsedMessage:c}}catch(c){return{remainingData:o,error:c,fatal:!1}}}var Ls=class extends mc.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((s,r)=>{try{let i={port:e,host:"127.0.0.1"},n=uc.default.createConnection(i,()=>{s()});this.connection=n,n.on("data",this.onData.bind(this)),n.on("error",r),n.on("end",this.onEnd.bind(this)),n.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:s,reject:r})}catch(i){r(i)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(Ha("firefox"))))}rejectAllRequests(e){this.activeRequests.forEach(s=>{s.reject(e)}),this.activeRequests.clear(),this.pendingRequests.forEach(({deferred:s})=>{s.reject(e)}),this.pendingRequests=[]}async request(e){let s=typeof e=="string"?{to:"root",type:e}:e;if(!s.to)throw new Error(Va("firefox",s.type));return await new Promise((r,i)=>{let n={resolve:r,reject:i};this.pendingRequests.push({request:s,deferred:n}),this.flushPendingRequests()})}flushPendingRequests(){this.pendingRequests=this.pendingRequests.filter(({request:e,deferred:s})=>{if(this.activeRequests.has(e.to))return!0;if(!this.connection)throw new Error(Ga("firefox"));try{let r=`${Buffer.from(JSON.stringify(e)).length}:${JSON.stringify(e)}`;this.connection.write(r),this.expectReply(e.to,s)}catch(r){s.reject(r)}return!1})}expectReply(e,s){if(this.activeRequests.has(e))throw new Error(Xa("firefox",e));this.activeRequests.set(e,s)}onData(e){for(this.incomingData=Buffer.concat([this.incomingData,e]);this.readMessage(););}readMessage(){let{remainingData:e,parsedMessage:s,error:r,fatal:i}=ml("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(Za("firefox",r))),i&&this.disconnect(),!i):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(Ya("firefox",e)));return}let s=this.activeRequests.get(e.from);s?(this.activeRequests.delete(e.from),e.error?s.reject(e):s.resolve(e),this.flushPendingRequests()):this.emit("error",new Error(Ka("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function dc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function gc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var dl=150,gl=1e3,Is=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:dl}))try{let i=new Ls;return await i.connect(e),i}catch(i){if(gc("ECONNREFUSED",i))await new Promise(n=>setTimeout(n,gl)),s=i;else throw console.error(Ua(this.options.browser,i.stack)),i}throw console.error(Wa(this.options.browser)),s}async installAddons(e){let{devtools:s}=this.options,r=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],i=e.options.devServer?.port,n=i?i+100:9222,o=await this.connectClient(n);for(let[c,p]of r.entries()){let l=hc.default.join(p.replace(/"/g,"")),u=c===0&&s;try{let d=await o.request({to:"root",type:"getRoot"});await o.request({to:d.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(d){let g=dc(d);throw new Error(Ba(this.options.browser,g))}}}};var ne=null;process.on("SIGINT",()=>{ne&&ne.kill("SIGINT"),process.exit()});process.on("SIGTERM",()=>{ne&&ne.kill("SIGTERM"),process.exit()});var Os=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;constructor(e){this.extension=e.extension,this.browser=e.browser||"firefox",this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl}async launchFirefox(e){let s=`fx-runner start --binary "${Ds}" --foreground --no-remote`;yc.default.existsSync(Ds)||(console.error(ks(this.browser,Ds)),process.exit());let r=await fc(e,this),i=`${s} ${r}`;ne=(0,bc.exec)(i,(o,c,p)=>{if(o!=null)throw o;p.includes("Unable to move the cache")?console.log(Ta(this.browser)):(console.log(Ra(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ne.stdout?.pipe(process.stdout),ne.stderr?.pipe(process.stderr));let n=new Is(this);try{await n.installAddons(e)}catch(o){o?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Na(this.browser)),process.exit(1)),console.error(qa(this.browser,o)),process.exit(1)}}apply(e){let s=!1;e.hooks.done.tapAsync("run-firefox:module",async(r,i)=>{if(r.compilation.errors.length>0){i();return}if(s){i();return}setTimeout(()=>{console.log(Ps(this.browser,r.compilation.options.mode))},2e3),await this.launchFirefox(e),s=!0,i()})}};var As=class{static name="plugin-browsers";extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[]],this.browser=e.browser,this.browserFlags=e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[],this.userDataDir=e.userDataDir,this.profile=e.profile||"",this.preferences=e.preferences||{},this.startingUrl=e.startingUrl||""}getProfilePath(e,s,r){return r||(e.options.mode==="production"?Er.default.join(wc.default.tmpdir(),"extension-js",s,"profile"):Er.default.resolve(__dirname,`run-${s}-profile`))}apply(e){let s={stats:!0,extension:this.extension,browser:this.browser,browserFlags:this.browserFlags||[],userDataDir:this.getProfilePath(e,this.browser,this.userDataDir||this.profile)};switch(this.browser){case"chrome":{new ve({...s,browser:"chrome"}).apply(e);break}case"edge":new ve({...s,browser:"edge"}).apply(e);break;case"firefox":new Os({...s,browser:"firefox"}).apply(e);break;default:{new ve({...s,browser:this.browser}).apply(e);break}}}};function J(t,e){let s=Je.default.join(t,"manifest.json"),r=Je.default.join(t,`dist/${e.browser}`),i=require(s);return{mode:e.mode||"development",entry:{},target:"web",context:t,devtool:i.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(n){return!n.startsWith("hot/background")}},path:r,publicPath:"/",hotUpdateChunkFilename:"hot/[id].[fullhash].hot-update.js",hotUpdateMainFilename:"hot/[runtime].[fullhash].hot-update.json",environment:{bigIntLiteral:!0,dynamicImport:!0}},resolve:{modules:["node_modules",Je.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new et({manifestPath:s}),new lt({manifestPath:s,mode:e.mode}),new pt({manifestPath:s,mode:e.mode}),new gt({manifestPath:s,mode:e.mode}),process.env.EXTENSION_ENV==="development"&&new Ss({manifestPath:s,browser:e.browser}),new ws({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new ps({manifestPath:s,browser:e.browser,mode:e.mode}),new gs({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),!e.noOpen&&new As({extension:[r,Je.default.join(__dirname,"extensions",`${e.browser}-manager-extension`)],browser:e.browser,startingUrl:e.startingUrl,profile:e.profile||e.userDataDir,preferences:e.preferences,browserFlags:e.browserFlags})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var He=a(require("path")),Zc=a(require("go-git-it"));var ze=a(require("path")),Ms=a(require("fs")),m=require("@colors/colors/safe");function S(t){return`${t==="warn"?(0,m.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,m.magenta)("\u25BA\u25BA\u25BA"):t==="error"?(0,m.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,m.brightGreen)("\u25BA\u25BA\u25BA")}`}function K(){return`${S("error")} Manifest file not found. Ensure the path to your extension exists and try again.`}function Ts(t){let e=t==="firefox"?"Add-on":"Extension";return`${S("info")} Building ${oe(t)} ${e} package...`}function Rs(t,e){let s=ze.default.join(t,"dist",e.browser||"chrome"),r=ze.default.join(s,"manifest.json"),i=require(r),{name:n,version:o,hostPermissions:c,permissions:p}=i,l=xc(t,i).defaultLocale,u=xc(t,i).otherLocales.join(", "),d=`${l} ${u&&", "+u}`,g=c&&c.length,y=p&&p.length,$=Us().version;return`
|
|
142
|
-
|
|
143
|
-
Extension
|
|
144
|
-
Extension Version ${(0,m.gray)(o)}
|
|
131
|
+
Ensure the path to your extension exists and try again.
|
|
132
|
+
${(0,m.red)("NOT FOUND")} ${(0,m.underline)(t)}`}function Dr(t){let e=t==="firefox"||t==="gecko-based"?"Add-on":"Extension";return`${P("info")} Building ${re(t)} ${e} package...`}function Fr(t,e){let r=Ke.default.join(t,"dist",e.browser||"chrome"),s=Ke.default.join(r,"manifest.json"),i=require(s),{name:o,version:n,hostPermissions:c,permissions:p}=i,l=bc(t,i).defaultLocale,u=bc(t,i).otherLocales.join(", "),d=`${l} ${u&&", "+u}`,g=c&&c.length,y=p&&p.length,_=qr().version;return`
|
|
133
|
+
\u{1F9E9} ${(0,m.brightGreen)("Extension.js")} ${(0,m.gray)(`${_}`)}
|
|
134
|
+
Extension Name ${(0,m.gray)(o)}
|
|
135
|
+
Extension Version ${(0,m.gray)(n)}
|
|
145
136
|
Locales ${(0,m.gray)(d)}
|
|
146
137
|
Host Permissions ${(0,m.gray)(g?c.join(", "):"Browser defaults")}
|
|
147
138
|
Permissions ${(0,m.gray)(y?p.join(", "):"Browser defaults")}
|
|
148
|
-
`}function
|
|
139
|
+
`}function wc(t,e){let r=t==="production"?m.brightBlue:m.brightBlue,s=e==="firefox"||e==="gecko-based"?"Add-on":"Extension";return`${P("success")} ${re(e)} ${s} ready for ${r(t||"unknown")}.`}function xc(t,e,r){let s=e?.toJson(),i=Ke.default.join(t,"manifest.json"),o=JSON.parse(jr.default.readFileSync(i,"utf8")),n=s?.assets,c=`${P("info")} Building ${(0,m.cyan)(o.name)} extension using ${re(r)} defaults...
|
|
149
140
|
|
|
150
141
|
`,p=`
|
|
151
|
-
Build completed in ${((
|
|
142
|
+
Build completed in ${((s?.time||0)/1e3).toFixed(2)} seconds.`,l=`Build Target: ${(0,m.gray)(re(r))}
|
|
152
143
|
`,u=`Build Status: ${e?.hasErrors()?(0,m.red)("Failed"):(0,m.brightGreen)("Success")}
|
|
153
144
|
`,d=`
|
|
154
|
-
Version: ${(0,m.gray)(
|
|
155
|
-
`,g=`Size: ${(0,m.gray)(
|
|
156
|
-
`,y="";return y+=c,y+=
|
|
157
|
-
|
|
158
|
-
${(
|
|
159
|
-
${
|
|
160
|
-
|
|
161
|
-
${(0,m.gray)("PATH")} ${(0,m.underline)(
|
|
162
|
-
|
|
163
|
-
${(0,m.gray)("
|
|
164
|
-
|
|
165
|
-
${(0,m.gray)("
|
|
166
|
-
|
|
167
|
-
${(0,m.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Tc(t){return`${S("info")} Unpackaging browser extension...
|
|
173
|
-
${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Rc(){return`${S("info")} Browser extension unpackaged ${(0,m.brightGreen)("successfully")}. Compiling...`}function Nc(t){return`${S("error")} Failed to download or extract ZIP file. ${(0,m.red)(t)}`}function oe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xc(t,e){let s=e.default_locale,r=ze.default.join(t,"_locales");if(!Ms.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let i=Ms.default.readdirSync(r).filter(n=>n!==s);return{defaultLocale:s,otherLocales:i}}function qc(t){return`${(t/1024).toFixed(2)}KB`}function hl(t){let e=0;return t?.forEach(s=>{e+=s.size}),qc(e)}function Uc(t,e=""){let s="";return Object.keys(t).forEach((r,i,n)=>{let o=i===n.length-1,c=o?"\u2514\u2500":"\u251C\u2500",p=t[r].size?` (${qc(t[r].size)})`:"";s+=`${(0,m.gray)(e)}${(0,m.gray)(c)} ${r}${(0,m.gray)(p)}
|
|
174
|
-
`,typeof t[r]=="object"&&!t[r].size&&(s+=Uc(t[r],`${e}${o?" ":(0,m.gray)("\u2502 ")}`))}),s}function yl(t){let e={};return t?.forEach(s=>{let r=s.name.split("/"),i=e;r.forEach((n,o)=>{i[n]||(i[n]={}),o===r.length-1?i[n]={size:s.size}:i=i[n]})}),`.
|
|
175
|
-
${Uc(e)}`}function Wc(t){return`${S("info")} is using ${(0,m.magenta)(t)}. ${(0,m.brightYellow)("This is very experimental")}.`}function Bc(t){return`${S("info")} Installing ${(0,m.cyan)(t)} dependencies...`}function Jc(t,e,s){return`Command ${t} ${e.join(" ")} failed with exit code ${s}`}function zc(t){return`${S("info")} Can't install project dependencies. ${t.message||t.toString()}`}var Ns=a(require("path")),Hc=a(require("axios")),Vc=a(require("adm-zip"));var jr=a(require("stream")),Gc=require("util"),bl=(0,Gc.promisify)(jr.default.pipeline);async function Xc(t,e){let s=t.split("?")[0];try{console.log(Mc(s));let r=await(0,Hc.default)({url:t,method:"GET",responseType:"stream"}),i=Ns.default.extname(s),n=Ns.default.basename(s,i),o=Ns.default.join(e,n);console.log(Tc(o));let c=[];await bl(r.data,new jr.default.Writable({write(u,d,g){c.push(u),g()}}));let p=Buffer.concat(c);return new Vc.default(p).extractAllTo(o,!0),console.log(Rc()),o}catch(r){throw console.error(Nc(r)),r}}var wl=t=>{try{return new URL(t),!0}catch{return!1}};async function xl(t,e){return await(0,Zc.default)(t,process.cwd(),e),He.default.resolve(process.cwd(),He.default.basename(t))}async function vl(t){return await Xc(t,process.cwd())}async function Q(t){if(!t)return process.cwd();if(wl(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await vl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],i=s.slice(1,3)[1];console.log(Pc(r,i));let n=He.default.basename(e.pathname),o=await xl(t,kc(n));return console.log(Ec(n)),o}}return He.default.resolve(process.cwd(),t)}var z=a(require("path")),Yc=a(require("fs")),Kc=a(require("ignore")),Qc=a(require("tiny-glob")),$r=a(require("adm-zip")),ep=a(require("slugify"));function _l(t){try{return Yc.default.readFileSync(t,"utf8")}catch{return""}}function Sl(t){return(0,ep.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function Pl(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function kl(t,e){let s=Sl(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function El(t){let e=z.default.join(t,".gitignore"),s=_l(e),r=(0,Kc.default)();return s?r.add(s):console.log(jc(t)),(await(0,Qc.default)("**/*",{cwd:t,dot:!0})).filter(n=>!r.ignores(n))}async function tp(t,{browser:e="chrome",...s}){try{let r=z.default.join(t,"dist"),i=z.default.join(r,e),n=s.zipSource?t:i,o=require(z.default.join(n,"manifest.json")),c=kl(o,s),p=Pl(e),l=z.default.join(i,`${c}.${p}`),u=z.default.join(r,`${c}-source.${p}`);if(s.zipSource){console.log(""),console.log($c(e));let d=new $r.default;(await El(t)).forEach(y=>{d.addLocalFile(z.default.join(t,y),z.default.dirname(y))}),d.writeZip(u)}if(s.zip){console.log(""),console.log(Cc(l));let d=new $r.default;d.addLocalFolder(i),d.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log(Dc(e,c,u,l))):s.zip?(console.log(""),console.log(Fc(c,p,e,l))):s.zipSource&&(console.log(""),console.log(Lc(c,p,e,u)))}catch(r){throw console.error(Ic(r)),r}}var Cr=a(require("fs")),Dr=a(require("path"));function ee(t){let e=Dr.default.join(t,"extension.config.js");if(Cr.default.existsSync(e)&&jl(t)){let s=require(e);if(s&&s!=null&&s&&typeof s.config=="function")return s.config}return s=>s}function jl(t){let e=Dr.default.join(t,"extension.config.js");return Cr.default.existsSync(e)?(console.log(Wc("extension.config.js")),!0):!1}async function op(t,e){let s=await Q(t);!t?.startsWith("http")&&!sp.default.existsSync(rp.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e?.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=ee(s)({...i,plugins:n}),p=(0,np.merge)(c),l=(0,ip.default)(p);await new Promise((u,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(_c(s,y,r)),(e?.zip||e?.zipSource)&&await tp(s,{...e,browser:r}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(Sc()),u())})})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var Ir=a(require("fs")),Or=a(require("path"));var Lr=a(require("path")),ap=a(require("webpack")),cp=a(require("webpack-dev-server")),pp=require("webpack-merge");function Fr(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function lp(t,{...e}){let s=J(t,{...e,mode:"development"}),i=ee(t)(s),n=(0,pp.merge)(i),o=(0,ap.default)(n),c={host:"127.0.0.1",allowedHosts:"all",static:Lr.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:st(t)?void 0:{paths:[Lr.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},p=new cp.default(c,o);p.startCallback(l=>{l!=null&&console.log(`Error in the Extension.js runner: ${l.stack||""}`)}),process.on("ERROR",()=>{Fr(p)}),process.on("SIGINT",()=>{Fr(p)}),process.on("SIGTERM",()=>{Fr(p)})}var qs=a(require("path")),Ve=a(require("fs/promises"));async function fp(t){let e=qs.default.join(t,"extension-env.d.ts"),s=process.env.EXTENSION_ENV==="development"?qs.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",r=`// Required Extension.js types for TypeScript projects.
|
|
145
|
+
Version: ${(0,m.gray)(o.version)}
|
|
146
|
+
`,g=`Size: ${(0,m.gray)(wl(n))}
|
|
147
|
+
`,y="";return y+=c,y+=xl(n),y+=d,y+=g,y+=l,y+=u,y+=p,y}function vc(){return`${P("success")} No errors or warnings found. Your extension is ${(0,m.brightGreen)("ready for deployment")}.`}function _c(t,e){return`${P("info")} Fetching data...
|
|
148
|
+
${(0,m.gray)("URL")} ${(0,m.underline)(`https://github.com/${t}/${e}`)}`}function Sc(t){return`${P("info")} Downloading ${(0,m.cyan)(t)}...`}function Pc(t){return`
|
|
149
|
+
${P("info")} Creating a new browser extension...
|
|
150
|
+
${(0,m.gray)("PATH")} ${(0,m.underline)(`${t}`)}`}function kc(t){return`${P("info")} No ${(0,m.brightYellow)(".gitignore")} found, zipping all the content inside path:
|
|
151
|
+
${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Ec(t){return`${P("info")} Packaging source files. Files in ${(0,m.brightYellow)(".gitignore")} will be excluded...
|
|
152
|
+
${(0,m.gray)("PATH")} ${(0,m.underline)(t)}.`}function $c(t){return`${P("info")} Packaging extension distribution files...
|
|
153
|
+
${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Cc(t,e,r,s){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${e}`)}, Target Browser: ${`${re(t)}`}
|
|
154
|
+
${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (source)
|
|
155
|
+
${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${s}`)} (distribution)`}function jc(t,e,r,s){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}.${e}`)}, Target Browser: ${`${re(r)}`}
|
|
156
|
+
${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${s}`)} ${(0,m.gray)("(distribution)")}`}function Dc(t,e,r,s){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${re(r)}`}
|
|
157
|
+
${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${s}`)} (source)`}function Fc(t){return`${P("error")} Failed to compress extension package.
|
|
158
|
+
${(0,m.red)(t)}`}function Lc(t){return`${P("info")} Writing type definitions for ${(0,m.cyan)(t.name||"")}...`}function Ic(t){return`${P("error")} Failed to write the extension type definition.
|
|
159
|
+
${(0,m.red)(t)}`}function Oc(t){return`${P("info")} Downloading extension...
|
|
160
|
+
${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Mc(t){return`${P("info")} Unpackaging browser extension...
|
|
161
|
+
${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Ac(){return`${P("info")} Browser extension unpackaged ${(0,m.brightGreen)("successfully")}. Compiling...`}function Rc(t){return`${P("error")} Failed to download or extract ZIP file. ${(0,m.red)(t)}`}function re(t){return t.charAt(0).toUpperCase()+t.slice(1)}function bc(t,e){let r=e.default_locale,s=Ke.default.join(t,"_locales");if(!jr.default.existsSync(s))return{defaultLocale:"Browser defaults",otherLocales:[]};let i=jr.default.readdirSync(s).filter(o=>o!==r);return{defaultLocale:r,otherLocales:i}}function Tc(t){return`${(t/1024).toFixed(2)}KB`}function wl(t){let e=0;return t?.forEach(r=>{e+=r.size}),Tc(e)}function Nc(t,e=""){let r="";return Object.keys(t).forEach((s,i,o)=>{let n=i===o.length-1,c=n?"\u2514\u2500":"\u251C\u2500",p=t[s].size?` (${Tc(t[s].size)})`:"";r+=`${(0,m.gray)(e)}${(0,m.gray)(c)} ${s}${(0,m.gray)(p)}
|
|
162
|
+
`,typeof t[s]=="object"&&!t[s].size&&(r+=Nc(t[s],`${e}${n?" ":(0,m.gray)("\u2502 ")}`))}),r}function xl(t){let e={};return t?.forEach(r=>{let s=r.name.split("/"),i=e;s.forEach((o,n)=>{i[o]||(i[o]={}),n===s.length-1?i[o]={size:r.size}:i=i[o]})}),`.
|
|
163
|
+
${Nc(e)}`}function Uc(t){return`${P("info")} Using ${(0,m.magenta)(t)}. ${(0,m.brightYellow)("This is very experimental")}.`}function qc(){return`${P("info")} Installing project dependencies...`}function Wc(t,e,r){return`${P("error")} Command ${t} ${e.join(" ")} failed with exit code ${r}`}function Bc(t){return`${P("error")} Can't install project dependencies. ${(0,m.red)(t.message||t.toString())}`}function K(t){let e=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(e)&&Ds(t)){let r=require(e);if(r&&r!=null&&r&&typeof r.config=="function")return r.config}return r=>r}function Jc(t,e){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&Ds(t)){let s=require(r);if(s&&s!=null)return s[e]}return{}}function Lr(t,e){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&Ds(t)){let s=require(r);if(s&&s.browsers!=null)return s.browsers[e]}return{}}var zc=!1;function Ds(t){let e=Qe.default.join(t,"extension.config.js");return Ye.default.existsSync(e)?(zc||(console.log(Uc("extension.config.js")),zc=!0),!0):!1}function Hc(t,e){let r={...Lr(Fs.default.resolve(__dirname,"run-firefox"),"firefox"),...js(e)};Object.keys(r).forEach(o=>{t.setPreference(o,r[o])});let i=Object.keys(e);return i.length>0&&i.forEach(o=>{t.setPreference(o,e[o])}),t.updatePreferences(),t}function vl(t,e){let r=new Ls.default({destinationDirectory:t});return Hc(r,e)}function _l(t,e,r){let s;if(Ir.default.statSync(e).isDirectory())s=e;else throw new Error(Qa(t,e));let o=new Ls.default({destinationDirectory:s});return Hc(o,r)}function Vc(t,e,r){let s,i=e||Fs.default.resolve(__dirname,"run-firefox-data-dir"),c={...js(r||{}),...r};return Ir.default.existsSync(i)?s=_l(t,i,c):($r(kr(t),()=>{}),Ir.default.mkdirSync(i,{recursive:!0}),s=vl(i,c)),s}async function Gc(t,e){let{browser:r,startingUrl:s,preferences:i,userDataDir:o,browserFlags:n=[]}=e,c=Vc(r,o,i),p=[];s&&p.push(`--url=${s}`),n&&p.push(...n);let l=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args="${p.join(" ")}"`,`--profile="${c.path()}"`,`--listen=${l}`,"--verbose"].join(" ")}var Qc=a(require("path"));var Xc=a(require("net")),Zc=a(require("events"));function Sl(t,e){let r=e.toString(),s=r.indexOf(":");if(s<1)return{remainingData:e};let i=parseInt(r.substring(0,s),10);if(isNaN(i))return{remainingData:e,error:new Error(ec(t)),fatal:!0};if(e.length-(s+1)<i)return{remainingData:e};let o=e.slice(s+1,s+1+i),n=e.slice(s+1+i);try{let c=JSON.parse(o.toString());return{remainingData:n,parsedMessage:c}}catch(c){return{remainingData:n,error:c,fatal:!1}}}var Or=class extends Zc.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((r,s)=>{try{let i={port:e,host:"127.0.0.1"},o=Xc.default.createConnection(i,()=>{r()});this.connection=o,o.on("data",this.onData.bind(this)),o.on("error",s),o.on("end",this.onEnd.bind(this)),o.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:r,reject:s})}catch(i){s(i)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(tc("firefox"))))}rejectAllRequests(e){this.activeRequests.forEach(r=>{r.reject(e)}),this.activeRequests.clear(),this.pendingRequests.forEach(({deferred:r})=>{r.reject(e)}),this.pendingRequests=[]}async request(e){let r=typeof e=="string"?{to:"root",type:e}:e;if(!r.to)throw new Error(rc("firefox",r.type));return await new Promise((s,i)=>{let o={resolve:s,reject:i};this.pendingRequests.push({request:r,deferred:o}),this.flushPendingRequests()})}flushPendingRequests(){this.pendingRequests=this.pendingRequests.filter(({request:e,deferred:r})=>{if(this.activeRequests.has(e.to))return!0;if(!this.connection)throw new Error(sc("firefox"));try{let s=`${Buffer.from(JSON.stringify(e)).length}:${JSON.stringify(e)}`;this.connection.write(s),this.expectReply(e.to,r)}catch(s){r.reject(s)}return!1})}expectReply(e,r){if(this.activeRequests.has(e))throw new Error(ic("firefox",e));this.activeRequests.set(e,r)}onData(e){for(this.incomingData=Buffer.concat([this.incomingData,e]);this.readMessage(););}readMessage(){let{remainingData:e,parsedMessage:r,error:s,fatal:i}=Sl("firefox",this.incomingData);return this.incomingData=e,s?(this.emit("error",new Error(oc("firefox",s))),i&&this.disconnect(),!i):r?(this.handleMessage(r),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(nc("firefox",e)));return}let r=this.activeRequests.get(e.from);r?(this.activeRequests.delete(e.from),e.error?r.reject(e):r.resolve(e),this.flushPendingRequests()):this.emit("error",new Error(ac("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function Kc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function Yc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var Pl=150,kl=1e3,Mr=class{options;constructor(e){this.options=e}async connectClient(e){let r;for(let s of Array.from({length:Pl}))try{let i=new Or;return await i.connect(e),i}catch(i){if(Yc("ECONNREFUSED",i))await new Promise(o=>setTimeout(o,kl)),r=i;else throw console.error(Za(this.options.browser,i.stack)),i}throw console.error(Ka(this.options.browser)),r}async installAddons(e){let{devtools:r}=this.options,s=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],i=e.options.devServer?.port,o=i?i+100:9222,n=await this.connectClient(o);for(let[c,p]of s.entries()){let l=Qc.default.join(p.replace(/"/g,"")),u=c===0&&r;try{let d=await n.request({to:"root",type:"getRoot"});await n.request({to:d.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(d){let g=Kc(d);throw new Error(Ya(this.options.browser,g))}}}};var se=null;process.on("SIGINT",()=>{se&&se.kill("SIGINT"),process.exit()});process.on("SIGTERM",()=>{se&&se.kill("SIGTERM"),process.exit()});var Ar=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;geckoBinary;constructor(e){this.extension=e.extension,this.browser=e.browser||"firefox",this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.geckoBinary=e.geckoBinary}async getFxRunnerCommand(){let e=ae()?"pnpm dlx fx-runner":"npm exec fx-runner";try{return await new Promise((r,s)=>{(0,Is.exec)(`${e} --version`,i=>{i?s(i):r(null)})}),e}catch{console.error(Ve("firefox",e)),process.exit(1)}}async launchFirefox(e,r){let s=await this.getFxRunnerCommand(),i;switch(r.browser){case"gecko-based":i=tp.default.normalize(this.geckoBinary);break;default:i=yc;break}let o=`${s} start --binary "${i}" --foreground --no-remote`;ep.default.existsSync(i||"")||(console.error(Ve(this.browser,i||"")),process.exit(1));let n=await Gc(e,r),c=`${o} ${n}`;se=(0,Is.exec)(c,(l,u,d)=>{if(l!=null)throw l;d.includes("Unable to move the cache")?console.log(Ha(this.browser)):(console.log(Va(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(se.stdout?.pipe(process.stdout),se.stderr?.pipe(process.stderr));let p=new Mr(this);try{await p.installAddons(e)}catch(l){l?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Ga(this.browser)),process.exit(1)),console.error(Xa(this.browser,l)),process.exit(1)}}apply(e){let r=!1;e.hooks.done.tapAsync("run-firefox:module",async(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),await this.launchFirefox(e,{browser:this.browser,browserFlags:this.browserFlags,userDataDir:this.userDataDir,profile:this.profile,preferences:this.preferences,startingUrl:this.startingUrl,mode:s.compilation.options.mode}),r=!0,i()})}};var Rr=class{static name="plugin-browsers";extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;chromiumBinary;geckoBinary;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[]],this.browser=e.browser||"chrome",this.browserFlags=e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[],this.userDataDir=e.userDataDir,this.profile=e.profile||"",this.preferences=e.preferences||{},this.startingUrl=e.startingUrl||"",this.chromiumBinary=e.chromiumBinary,this.geckoBinary=e.geckoBinary}getProfilePath(e,r,s){return s||(e.options.mode==="production"?Os.default.join(rp.default.tmpdir(),"extension-js",r,"profile"):Os.default.resolve(__dirname,`run-${r}-profile`))}apply(e){let s={...{stats:!0,extension:this.extension,browser:this.browser,browserFlags:this.browserFlags||[],userDataDir:this.getProfilePath(e,this.browser,this.userDataDir||this.profile),startingUrl:this.startingUrl,chromiumBinary:this.chromiumBinary,geckoBinary:this.geckoBinary},...Lr(e.context,this.browser)};switch(this.browser){case"chrome":case"edge":case"chromium-based":{new Xe(s).apply(e);break}case"firefox":case"gecko-based":new Ar(s).apply(e);break;default:{new Xe({...s,browser:"chrome"}).apply(e);break}}}};function J(t,e){let r=et.default.join(t,"manifest.json"),s=O(require(r),e.browser),i=et.default.join(t,`dist/${e.browser}`),o=e.chromiumBinary?"chromium-based":e.geckoBinary?"gecko-based":e.browser;return{mode:e.mode||"development",entry:{},target:"web",context:t,devtool:s.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(n){return!n.startsWith("hot/background")}},path:i,publicPath:"/",hotUpdateChunkFilename:"hot/[id].[fullhash].hot-update.js",hotUpdateMainFilename:"hot/[runtime].[fullhash].hot-update.json",environment:{bigIntLiteral:!0,dynamicImport:!0}},resolve:{modules:["node_modules",et.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new pt({manifestPath:r,browser:o}),new ht({manifestPath:r}),new gt({manifestPath:r}),new wt({manifestPath:r}),process.env.EXPERIMENTAL_ERRORS_PLUGIN==="true"&&new Pr({manifestPath:r,browser:o}),new xr({manifestPath:r,browser:o,polyfill:e.polyfill}),new fr({manifestPath:r,browser:o}),new hr({manifestPath:r,browser:o,stats:!0,port:e.port||8e3}),!e.noOpen&&new Rr({extension:[i,et.default.join(__dirname,"extensions",`${o}-manager-extension`)],browser:o,startingUrl:e.startingUrl,profile:e.profile||e.userDataDir,preferences:e.preferences,browserFlags:e.browserFlags,chromiumBinary:e.chromiumBinary,geckoBinary:e.geckoBinary})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var tt=a(require("path")),ap=a(require("go-git-it"));var Tr=a(require("path")),sp=a(require("axios")),ip=a(require("adm-zip"));var Ms=a(require("stream")),op=require("util"),El=(0,op.promisify)(Ms.default.pipeline);async function np(t,e){let r=t.split("?")[0];try{console.log(Oc(r));let s=await(0,sp.default)({url:t,method:"GET",responseType:"stream"}),i=Tr.default.extname(r),o=Tr.default.basename(r,i),n=Tr.default.join(e,o);console.log(Mc(n));let c=[];await El(s.data,new Ms.default.Writable({write(u,d,g){c.push(u),g()}}));let p=Buffer.concat(c);return new ip.default(p).extractAllTo(n,!0),console.log(Ac()),n}catch(s){throw console.error(Rc(s)),s}}var $l=t=>{try{return new URL(t),!0}catch{return!1}};async function Cl(t,e){return await(0,ap.default)(t,process.cwd(),e),tt.default.resolve(process.cwd(),tt.default.basename(t))}async function jl(t){return await np(t,process.cwd())}async function Y(t){if(!t)return process.cwd();if($l(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await jl(t);let r=e.pathname.split("/"),s=r.slice(1,3)[0],i=r.slice(1,3)[1];console.log(_c(s,i));let o=tt.default.basename(e.pathname),n=await Cl(t,Sc(o));return console.log(Pc(o)),n}}return tt.default.resolve(process.cwd(),t)}var H=a(require("path")),cp=a(require("fs")),pp=a(require("ignore")),lp=a(require("tiny-glob")),As=a(require("adm-zip")),fp=a(require("slugify"));function Dl(t){try{return cp.default.readFileSync(t,"utf8")}catch{return""}}function Fl(t){return(0,fp.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function Ll(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function Il(t,e){let r=Fl(e.zipFilename||t.name);return e.zipFilename?r:`${r}-${t.version}`}async function Ol(t){let e=H.default.join(t,".gitignore"),r=Dl(e),s=(0,pp.default)();return r?s.add(r):console.log(kc(t)),(await(0,lp.default)("**/*",{cwd:t,dot:!0})).filter(o=>!s.ignores(o))}async function up(t,{browser:e="chrome",...r}){try{let s=H.default.join(t,"dist"),i=H.default.join(s,e),o=r.zipSource?t:i,n=require(H.default.join(o,"manifest.json")),c=Il(n,r),p=Ll(e),l=H.default.join(i,`${c}.${p}`),u=H.default.join(s,`${c}-source.${p}`);if(r.zipSource){console.log(""),console.log(Ec(u));let d=new As.default;(await Ol(t)).forEach(y=>{d.addLocalFile(H.default.join(t,y),H.default.dirname(y))}),d.writeZip(u)}if(r.zip){console.log(""),console.log($c(l));let d=new As.default;d.addLocalFolder(i),d.writeZip(l)}r.zip&&r.zipSource?(console.log(""),console.log(Cc(e,c,u,l))):r.zip?(console.log(""),console.log(jc(c,p,e,l))):r.zipSource&&(console.log(""),console.log(Dc(c,p,e,u)))}catch(s){throw console.error(Fc(s)),s}}async function hp(t,e){let r=await Y(t);!t?.startsWith("http")&&!mp.default.existsSync(Rs.default.join(r,"manifest.json"))&&(console.log(Z(Rs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e?.browser||"chrome",i=J(r,{...e,browser:s,mode:"production"}),o=i.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=K(r)({...i,plugins:o}),p=(0,gp.merge)(c),l=(0,dp.default)(p);await new Promise((u,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(xc(r,y,s)),(e?.zip||e?.zipSource)&&await up(r,{...e,browser:s}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(vc()),u())})})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var Us=a(require("fs")),Ur=a(require("path"));var Ns=a(require("path")),yp=a(require("webpack")),bp=a(require("webpack-dev-server")),wp=require("webpack-merge");function Ts(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function xp(t,{...e}){let r=Jc(t,"dev"),s=J(t,{...e,...r,mode:"development"}),o=K(t)(s),n=(0,wp.merge)(o),c=(0,yp.default)(n),p={host:"127.0.0.1",allowedHosts:"all",static:Ns.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:ft(t)?void 0:{paths:[Ns.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},l=new bp.default(p,c);l.startCallback(u=>{u!=null&&console.log(`Error in the Extension.js runner: ${u.stack||""}`)}),process.on("ERROR",()=>{Ts(l)}),process.on("SIGINT",()=>{Ts(l)}),process.on("SIGTERM",()=>{Ts(l)})}var Nr=a(require("path")),be=a(require("fs/promises"));async function vp(t){let e=Nr.default.join(t,"extension-env.d.ts"),r=process.env.EXTENSION_ENV==="development"?Nr.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",s=`// Required Extension.js types for TypeScript projects.
|
|
176
164
|
// This file is auto-generated and should not be excluded.
|
|
177
165
|
// If you need additional types, consider creating a new *.d.ts file and
|
|
178
166
|
// referencing it in the "include" array of your tsconfig.json file.
|
|
179
167
|
// See https://www.typescriptlang.org/tsconfig#include for more information.
|
|
180
|
-
/// <reference types="${
|
|
168
|
+
/// <reference types="${r}/index.d.ts" />
|
|
181
169
|
|
|
182
170
|
// Polyfill types for browser.* APIs.
|
|
183
|
-
/// <reference types="${
|
|
184
|
-
`;try{await
|
|
171
|
+
/// <reference types="${r}/polyfill.d.ts" />
|
|
172
|
+
`;try{await be.default.access(e),(await be.default.readFile(e,"utf8")).includes("develop/dist/types")&&await be.default.writeFile(e,s),process.env.EXTENSION_ENV==="development"&&await be.default.writeFile(e,s)}catch{let o=require(Nr.default.join(t,"manifest.json"));console.log(Lc(o));try{await be.default.writeFile(e,s)}catch(n){console.log(Ic(n))}}}var _p=a(require("path")),Sp=require("cross-spawn"),Pp=a(require("fs")),kp=require("package-manager-detector");async function Ml(){let t=await(0,kp.detect)(),e="npm";if(ae())return"pnpm";switch(t?.name){case"yarn":e="yarn";break;case"pnpm":e="pnpm";break;default:e="npm"}return e}function Al(){return["install"]}async function Ep(t){let e=_p.default.join(t,"node_modules"),r=await Ml(),s=Al(),i=process.cwd();try{process.chdir(t),await Pp.default.promises.mkdir(e,{recursive:!0});let o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,Sp.spawn)(r,s,{stdio:o});await new Promise((c,p)=>{n.on("close",l=>{l!==0?p(new Error(Wc(r,s,l))):c()}),n.on("error",l=>{p(l)})})}catch(o){console.error(Bc(o)),process.exit(1)}finally{process.chdir(i)}}async function $p(t,e){let r=await Y(t),s=Ur.default.join(r,"manifest.json");!t?.startsWith("http")&&!Us.default.existsSync(s)&&(console.log(Z(Ur.default.join(r,"manifest.json"))),process.exit(1));try{V(r)&&await vp(r);let i=Ur.default.join(r,"node_modules");Us.default.existsSync(i)||(console.log(qc()),await Ep(r)),setTimeout(async()=>{await xp(r,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var Cp=a(require("fs")),qs=a(require("path")),jp=a(require("webpack")),Dp=require("webpack-merge");async function Fp(t,e){let r=await Y(t);!t?.startsWith("http")&&!Cp.default.existsSync(qs.default.join(r,"manifest.json"))&&(console.log(Z(qs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome",i=J(r,{...e,browser:s,mode:"production"}),o=i.plugins?.filter(u=>u?.constructor.name==="plugin-browsers");console.log(Dr(s));let c=K(r)({...i,plugins:o}),p=(0,Dp.merge)(c);(0,jp.default)(p).run(async(u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):console.log(Fr(r,{browser:s,mode:"production"}))})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var Lp=a(require("fs")),Ws=a(require("path")),Ip=a(require("webpack")),Op=require("webpack-merge");async function Mp(t,e){let r=await Y(t);!t?.startsWith("http")&&!Lp.default.existsSync(Ws.default.join(r,"manifest.json"))&&(console.log(Z(Ws.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome",i=J(r,{...e,browser:s,mode:"production"}),o=i.plugins?.filter(u=>u?.constructor.name!=="plugin-reload");console.log(Dr(s));let c=K(r)({...i,plugins:o}),p=(0,Op.merge)(c);(0,Ip.default)(p).run((u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):(console.log(Fr(r,e)),setTimeout(()=>{console.log(wc("production",s))},1500))})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
|