extension-develop 2.0.0-alpha.21 → 2.0.0-alpha.23

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.
@@ -1,3 +1,3 @@
1
- "use strict";var D=Object.create;var m=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var s in n)m(t,s,{get:n[s],enumerable:!0})},b=(t,n,s,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of _(n))!C.call(t,r)&&r!==s&&m(t,r,{get:()=>n[r],enumerable:!(e=A(n,r))||e.enumerable});return t};var a=(t,n,s)=>(s=t!=null?D(P(t)):{},b(n||!t||!t.__esModule?m(s,"default",{value:t,enumerable:!0}):s,t)),L=t=>b(m({},"__esModule",{value:!0}),t);var Y={};U(Y,{default:()=>R});module.exports=L(Y);var x=a(require("path")),w=a(require("fs")),T=require("loader-utils"),M=require("schema-utils");var v=a(require("fs")),d=a(require("path")),E=a(require("parse5-utils"));var p=a(require("parse5-utils"));function g(t){try{return new URL(t),!0}catch{return!1}}function h(t,n){let{childNodes:s=[]}=t;for(let e of s)if(e.nodeName==="script"){let r=p.default.getAttribute(e,"src");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"script"})}else if(e.nodeName==="link"){let r=p.default.getAttribute(e,"href"),o=p.default.getAttribute(e,"rel");if(!r||g(r))continue;n(o==="dns-prefetch"||o==="icon"||o==="manifest"||o==="modulepreload"||o==="preconnect"||o==="prefetch"||o==="preload"||o==="prerender"?{filePath:r,childNode:e,assetType:"staticHref"}:{filePath:r,childNode:e,assetType:"css"})}else if(e.nodeName==="a"||e.nodeName==="area"){let r=p.default.getAttribute(e,"href");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"staticHref"})}else if(e.nodeName==="audio"||e.nodeName==="embed"||e.nodeName==="iframe"||e.nodeName==="img"||e.nodeName==="input"||e.nodeName==="source"||e.nodeName==="track"||e.nodeName==="video"){let r=p.default.getAttribute(e,"src");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"staticSrc"})}else h(e,n)}function N(t,n){let s={css:[],js:[],static:[]};if(!t)return s;let e=n||v.default.readFileSync(t,{encoding:"utf8"}),r=E.default.parse(e),o=(i,c)=>d.default.join(d.default.dirname(i),c.startsWith("/")?d.default.relative(d.default.dirname(i),c):c);for(let i of r.childNodes)if(i.nodeName==="html"){for(let c of i.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&h(c,({filePath:u,assetType:y})=>{let f=o(t,u);switch(y){case"script":s.js?.push(f);break;case"css":s.css?.push(f);break;case"staticSrc":case"staticHref":if(u.startsWith("#"))break;s.static?.push(f);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}var O=a(require("path")),$=a(require("fs")),z=require("child_process"),J=require("detect-package-manager");var q=a(require("path")),l=require("@colors/colors/safe");var j=a(require("path")),H=j.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),F=["chrome","edge"],W=["firefox"],Z=[...F,...W];function S(t){let n=O.default.join(t,"package.json");if(!$.default.existsSync(n))return!1;let s=JSON.parse($.default.readFileSync(n,"utf-8")),e=["react","vue","@angular/core","svelte","solid-js","preact"],r=s.dependencies||{},o=s.devDependencies||{};for(let i of e)if(r[i]||o[i])return!0;return!1}var V={type:"object",properties:{test:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"}}};function R(t){let n=this.getOptions(),s=n.manifestPath,e=x.default.dirname(s);(0,M.validate)(V,n,{name:"html:ensure-hmr-for-scripts",baseDataPath:"options"});let r=(0,T.urlToRequest)(this.resourcePath),o=`
1
+ "use strict";var R=Object.create;var m=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var s in n)m(t,s,{get:n[s],enumerable:!0})},b=(t,n,s,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of A(n))!C.call(t,r)&&r!==s&&m(t,r,{get:()=>n[r],enumerable:!(e=I(n,r))||e.enumerable});return t};var a=(t,n,s)=>(s=t!=null?R(P(t)):{},b(n||!t||!t.__esModule?m(s,"default",{value:t,enumerable:!0}):s,t)),L=t=>b(m({},"__esModule",{value:!0}),t);var G={};U(G,{default:()=>w});module.exports=L(G);var x=a(require("path")),T=a(require("fs")),S=require("loader-utils"),M=require("schema-utils");var v=a(require("fs")),d=a(require("path")),N=a(require("parse5-utils"));var f=a(require("parse5-utils"));function g(t){try{return new URL(t),!0}catch{return!1}}function h(t,n){let{childNodes:s=[]}=t;for(let e of s)if(e.nodeName==="script"){let r=f.default.getAttribute(e,"src");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"script"})}else if(e.nodeName==="link"){let r=f.default.getAttribute(e,"href"),i=f.default.getAttribute(e,"rel");if(!r||g(r))continue;n(i==="dns-prefetch"||i==="icon"||i==="manifest"||i==="modulepreload"||i==="preconnect"||i==="prefetch"||i==="preload"||i==="prerender"?{filePath:r,childNode:e,assetType:"staticHref"}:{filePath:r,childNode:e,assetType:"css"})}else if(e.nodeName==="a"||e.nodeName==="area"){let r=f.default.getAttribute(e,"href");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"staticHref"})}else if(e.nodeName==="audio"||e.nodeName==="embed"||e.nodeName==="iframe"||e.nodeName==="img"||e.nodeName==="input"||e.nodeName==="source"||e.nodeName==="track"||e.nodeName==="video"){let r=f.default.getAttribute(e,"src");if(!r||g(r))continue;n({filePath:r,childNode:e,assetType:"staticSrc"})}else h(e,n)}function j(t,n){let s={css:[],js:[],static:[]};if(!t)return s;let e=n||v.default.readFileSync(t,{encoding:"utf8"}),r=N.default.parse(e),i=(o,c)=>d.default.join(d.default.dirname(o),c.startsWith("/")?d.default.relative(d.default.dirname(o),c):c);for(let o of r.childNodes)if(o.nodeName==="html"){for(let c of o.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&h(c,({filePath:u,assetType:y})=>{let p=i(t,u);switch(y){case"script":s.js?.push(p);break;case"css":s.css?.push(p);break;case"staticSrc":case"staticHref":if(u.startsWith("#"))break;s.static?.push(p);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}var O=a(require("path")),$=a(require("fs")),z=require("child_process"),J=require("detect-package-manager");var q=a(require("path")),l=require("@colors/colors/safe");var E=a(require("path")),H=E.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),F=["chrome","edge"],W=["firefox"],Z=[...F,...W];function _(t){let n=O.default.join(t,"package.json");if(!$.default.existsSync(n))return!1;let s=JSON.parse($.default.readFileSync(n,"utf-8")),e=["react","vue","@angular/core","svelte","solid-js","preact"],r=s.dependencies||{},i=s.devDependencies||{};for(let o of e)if(r[o]||i[o])return!0;return!1}var V={type:"object",properties:{test:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"}}};function w(t){let n=this.getOptions(),s=n.manifestPath,e=x.default.dirname(s);(0,M.validate)(V,n,{name:"html:ensure-hmr-for-scripts",baseDataPath:"options"});let r=(0,S.urlToRequest)(this.resourcePath),i=`
2
2
  if (import.meta.webpackHot) { import.meta.webpackHot.accept() };
3
- `;if(S(e))return t;let i=n.includeList||{};for(let c of Object.entries(i)){let[,u]=c;if(u){if(!w.default.existsSync(u))return;let f=N(u)?.js||[];for(let k of f){let I=x.default.resolve(e,k);if(r.includes(I))return`${o}${t}`}}}return t}
3
+ `;if(_(e))return t;let o=n.includeList||{};for(let c of Object.entries(o)){let[,u]=c;if(u){if(!T.default.existsSync(u))return;let p=j(u)?.js||[];for(let k of p){let D=x.default.resolve(e,k);if(r.includes(D))return`${i}${t}`}}}return t}
@@ -1,10 +1,10 @@
1
- "use strict";var I=Object.create;var g=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var A=(e,n)=>{for(var r in n)g(e,r,{get:n[r],enumerable:!0})},y=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of D(n))!C.call(e,t)&&t!==r&&g(e,t,{get:()=>n[t],enumerable:!(i=_(n,t))||i.enumerable});return e};var a=(e,n,r)=>(r=e!=null?I(k(e)):{},y(n||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),L=e=>y(g({},"__esModule",{value:!0}),e);var G={};A(G,{default:()=>R});module.exports=L(G);var x=a(require("path")),O=require("loader-utils"),N=require("schema-utils");var m=a(require("path")),H=a(require("fs")),B=require("child_process"),z=require("detect-package-manager");var W=a(require("path")),o=require("@colors/colors/safe");var v=a(require("path")),P=v.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),b=["chrome","edge"],U=["firefox"],Q=[...b,...U];function E(e){return e.replace(/\\/g,"/")}function h(e,n={}){if(!n)return!1;let r=m.default.normalize(E(e));return Object.values(n).some(t=>typeof t!="string"?!1:E(t).includes(r))}function F(e,n){let r=m.default.relative(m.default.dirname(e),n);return!r.startsWith(".")&&!r.startsWith("..")&&(r="./"+r),r}var $=a(require("fs")),w=a(require("path"));function j(e,n){return(Array.isArray(e)?e||[]:e?[e]:[]).filter(t=>{let l=$.default.existsSync(t)&&!h(t,n),s=w.default.extname(t);return l&&(s===".js"||s===".mjs"||s===".jsx"||s===".ts"||s===".tsx")})}function S(e,n){return(Array.isArray(e)?e||[]:e?[e]:[]).filter(t=>$.default.existsSync(t)&&!h(t,n)&&(t.endsWith(".css")||t.endsWith(".scss")||t.endsWith(".sass")||t.endsWith(".less")))}var V={type:"object",properties:{test:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"}}},Y=`/**
1
+ "use strict";var D=Object.create;var m=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var L=(e,n)=>{for(var r in n)m(e,r,{get:n[r],enumerable:!0})},y=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of I(n))!C.call(e,t)&&t!==r&&m(e,t,{get:()=>n[t],enumerable:!(i=R(n,t))||i.enumerable});return e};var a=(e,n,r)=>(r=e!=null?D(k(e)):{},y(n||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),A=e=>y(m({},"__esModule",{value:!0}),e);var K={};L(K,{default:()=>M});module.exports=A(K);var x=a(require("path")),w=require("loader-utils"),S=require("schema-utils");var g=a(require("path")),q=a(require("fs")),B=require("child_process"),z=require("detect-package-manager");var W=a(require("path")),o=require("@colors/colors/safe");var v=a(require("path")),P=v.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),b=["chrome","edge"],U=["firefox"],Q=[...b,...U];function E(e){return e.replace(/\\/g,"/")}function h(e,n={}){if(!n)return!1;let r=g.default.normalize(E(e));return Object.values(n).some(t=>typeof t!="string"?!1:E(t).includes(r))}function N(e,n){let r=g.default.relative(g.default.dirname(e),n);return!r.startsWith(".")&&!r.startsWith("..")&&(r="./"+r),r}var $=a(require("fs")),F=a(require("path"));function _(e,n){return(Array.isArray(e)?e||[]:e?[e]:[]).filter(t=>{let l=$.default.existsSync(t)&&!h(t,n),s=F.default.extname(t);return l&&(s===".js"||s===".mjs"||s===".jsx"||s===".ts"||s===".tsx")})}function j(e,n){return(Array.isArray(e)?e||[]:e?[e]:[]).filter(t=>$.default.existsSync(t)&&!h(t,n)&&(t.endsWith(".css")||t.endsWith(".scss")||t.endsWith(".sass")||t.endsWith(".less")))}var V={type:"object",properties:{test:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"}}},G=`/**
2
2
  * Welcome to to your content_scripts CSS file during development!
3
3
  * To speed up the development process, your styles
4
4
  * are being injected directly into the head of the webpage,
5
5
  * and will be removed when you build your application, along
6
6
  * with this file. If you are seeing this file in a production build,
7
7
  * it means that something is wrong with your build configuration.
8
- */`;function R(e){let n=this.getOptions();(0,N.validate)(V,n,{name:"scripts:inject-content-css-during-dev",baseDataPath:"options"});let r=n.includeList||{},i=[],t=Object.entries(r).filter(([s,u])=>s.startsWith("content")&&u);if(!t.length)return e;for(let s of t){let[u,f]=s,c=[...j(f,n.excludeList||{})],p=S(f,n.excludeList||{});if(p.length&&!c.length){let d=x.default.resolve(__dirname,"minimum-content-file.mjs");c.push(d)}i.push({feature:u,scriptPath:c[0],cssImports:p.map(d=>F(c[0],d))})}let l=(0,O.urlToRequest)(this.resourcePath);return i.forEach(({feature:s,scriptPath:u,cssImports:f})=>{if(l.includes(u)){let c=f.map(p=>{let[,d]=s.split("/"),M=d.split("-")[1],T=x.default.basename(p);return`import(/* webpackChunkName: "${`web_accessible_resources/resource-${M}/${T.replace(".","_")}`}" */ '${p}').then(css => console.info('content_script.css loaded', css)).catch(err => console.error(err));`}).join(`
9
- `);this.emitFile(`${s}.css`,Y),e=`${c}
8
+ */`;function M(e){let n=this.getOptions();(0,S.validate)(V,n,{name:"scripts:inject-content-css-during-dev",baseDataPath:"options"});let r=n.includeList||{},i=[],t=Object.entries(r).filter(([s,u])=>s.startsWith("content")&&u);if(!t.length)return e;for(let s of t){let[u,d]=s,c=[..._(d,n.excludeList||{})],p=j(d,n.excludeList||{});if(p.length&&!c.length){let f=x.default.resolve(__dirname,"minimum-content-file.mjs");c.push(f)}i.push({feature:u,scriptPath:c[0],cssImports:p.map(f=>N(c[0],f))})}let l=(0,w.urlToRequest)(this.resourcePath);return i.forEach(({feature:s,scriptPath:u,cssImports:d})=>{if(l.includes(u)){let c=d.map(p=>{let[,f]=s.split("/"),O=f.split("-")[1],T=x.default.basename(p);return`import(/* webpackChunkName: "${`web_accessible_resources/resource-${O}/${T.replace(".","_")}`}" */ '${p}').then(css => console.info('content_script.css loaded', css)).catch(err => console.error(err));`}).join(`
9
+ `);this.emitFile(`${s}.css`,G),e=`${c}
10
10
  ${e}`}}),e}
package/dist/module.js CHANGED
@@ -1,117 +1,100 @@
1
- "use strict";var Lp=Object.create;var Ye=Object.defineProperty;var Ip=Object.getOwnPropertyDescriptor;var Op=Object.getOwnPropertyNames;var Ap=Object.getPrototypeOf,Mp=Object.prototype.hasOwnProperty;var Rp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tp=(t,e)=>{for(var s in e)Ye(t,s,{get:e[s],enumerable:!0})},Nr=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Op(e))!Mp.call(t,i)&&i!==s&&Ye(t,i,{get:()=>e[i],enumerable:!(r=Ip(e,i))||r.enumerable});return t};var a=(t,e,s)=>(s=t!=null?Lp(Ap(t)):{},Nr(e||!t||!t.__esModule?Ye(s,"default",{value:t,enumerable:!0}):s,t)),Np=t=>Nr(Ye({},"__esModule",{value:!0}),t);var Js=Rp((Rl,Up)=>{Up.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-alpha.21",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\\.ts'","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","browser-extension-manifest-fields":"^1.0.6","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","css-loader":"^6.10.0","csv-loader":"^3.0.5","detect-package-manager":"^3.0.2","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",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"},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",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@babel/core":"^7.24.9","@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@prefresh/webpack":"^4.0.1","@vue/compiler-sfc":"^3.4.34","babel-loader":"^9.1.3","babel-preset-modern-browser-extension":"^0.7.0",less:"^4.2.0","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:"^1.77.8","sass-loader":"^16.0.0",stylelint:"^16.7.0","stylelint-config-standard-scss":"^13.1.0","stylelint-webpack-plugin":"^5.0.1",tailwindcss:"^3.4.7","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var Il={};Tp(Il,{extensionBuild:()=>lp,extensionDev:()=>vp,extensionPreview:()=>Ep,extensionStart:()=>Fp});module.exports=Np(Il);var op=a(require("fs")),ap=a(require("path")),cp=a(require("webpack")),pp=require("webpack-merge");var Ge=a(require("path"));var bi=a(require("case-sensitive-paths-webpack-plugin"));var V=a(require("fs")),M=a(require("path")),hi=a(require("dotenv-webpack"));var zs=a(require("path")),f=require("@colors/colors/safe");var qr=a(require("path")),Ke=qr.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),te=["chrome","edge"],qp=["firefox"],Al=[...te,...qp];function w(t,e){return e==="error"?`${(0,f.bold)((0,f.red)("ERROR"))}`:`${e==="warn"?(0,f.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${t}`}function Ur(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Wr(t,e,s){if(!!1)return`${s.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${s.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Br(t,e,s){return`${w(t,"info")} ${(0,f.magenta)(e)} Integration Found
1
+ "use strict";var Lp=Object.create;var Ye=Object.defineProperty;var Ip=Object.getOwnPropertyDescriptor;var Op=Object.getOwnPropertyNames;var Mp=Object.getPrototypeOf,Ap=Object.prototype.hasOwnProperty;var Rp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Np=(t,e)=>{for(var s in e)Ye(t,s,{get:e[s],enumerable:!0})},Wr=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Op(e))!Ap.call(t,i)&&i!==s&&Ye(t,i,{get:()=>e[i],enumerable:!(r=Ip(e,i))||r.enumerable});return t};var a=(t,e,s)=>(s=t!=null?Lp(Mp(t)):{},Wr(e||!t||!t.__esModule?Ye(s,"default",{value:t,enumerable:!0}):s,t)),Tp=t=>Wr(Ye({},"__esModule",{value:!0}),t);var zs=Rp((Rl,Up)=>{Up.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-alpha.23",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\\.ts'","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","browser-extension-manifest-fields":"^1.0.6","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","css-loader":"^6.10.0","csv-loader":"^3.0.5","detect-package-manager":"^3.0.2","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",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"},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",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@babel/core":"^7.24.9","@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@prefresh/webpack":"^4.0.1","@vue/compiler-sfc":"^3.4.34","babel-loader":"^9.1.3","babel-preset-modern-browser-extension":"^0.7.0",less:"^4.2.0","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:"^1.77.8","sass-loader":"^16.0.0",stylelint:"^16.7.0","stylelint-config-standard-scss":"^13.1.0","stylelint-webpack-plugin":"^5.0.1",tailwindcss:"^3.4.7","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var Il={};Np(Il,{extensionBuild:()=>mp,extensionDev:()=>Sp,extensionPreview:()=>jp,extensionStart:()=>Fp});module.exports=Tp(Il);var pp=a(require("fs")),Mr=a(require("path")),lp=a(require("webpack")),fp=require("webpack-merge");var Ge=a(require("path"));var vi=a(require("case-sensitive-paths-webpack-plugin"));var V=a(require("fs")),A=a(require("path")),wi=a(require("dotenv-webpack"));var Hs=a(require("path")),f=require("@colors/colors/safe");var Br=a(require("path")),Ke=Br.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),te=["chrome","edge"],qp=["firefox"],Ml=[...te,...qp];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"?(0,f.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${t}`}function Jr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function zr(t,e,s){if(!!1)return`${s.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${s.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Hr(t,e,s){return`${x(e,"info")} is using ${e}. Installing required dependencies via ${(0,f.brightYellow)(s)}...`}function Vr(t){return`${x("env","success")} loaded file ${(0,f.brightGreen)("successfully")}.`}function v(t,e){return`${x(e,"info")}-based extension...`}function E(t,e){return`${x(e,"success")} installation completed. Run the program again and happy hacking.`}function Gr(t,e){return`${x(e,"info")} dependencies are being installed. This only happens for core contributors...`}function Xr(t,e){return`${x(e,"success")} dependencies installed ${(0,f.brightGreen)("successfully")}.`}function Zr(t,e,s){return`${x(t,"error")} ${e} Installation Error
2
2
 
3
- Installing required setup dependencies via ${(0,f.brightYellow)(s)}. This is a one time operation...`}function Jr(t){return`${w(t,"info")} loaded ${(0,f.brightYellow)("env")} file successfully.`}function v(t,e){return`${w(t,"info")} is using ${(0,f.magenta)(e)}.`}function E(t,e){return`${w(t,"success")} You Are All Set
4
-
5
- Run the program again to start hacking with ${(0,f.magenta)(e)} support.`}function zr(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 Hr(t,e){return`${w(t,"success")} ${e} Dependencies Installed ${(0,f.brightGreen)("Successfully")}.`}function Vr(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 Gr(t){return`${w(t,"error")} No Service Worker Support
3
+ Failed to detect package manager or install ${e} dependencies:
4
+ ${(0,f.red)(s?.toString()||"")}`}function Yr(t){return`${x(t,"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.
13
8
 
14
- Read more: ${(0,f.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Xr(t){return`${w(t,"error")} Insecure Content-Security-Policy
9
+ Read more: ${(0,f.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Kr(t){return`${x("content-security-policy","error")} Insecure Content-Security-Policy
15
10
 
16
- Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function Zr(t){return`${w(t,"error")} No Default Locale Specified
11
+ Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function Qr(t){return`${x("_locales","error")} No Default Locale Specified
17
12
 
18
- Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function je(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 Yr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
13
+ Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function je(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 ei(t,e){return`${x("manifest.json","error")} Wrong Manifest Field Type
19
14
 
20
15
  Field ${(0,f.brightYellow)("web_accessible_resources")} must be a string array in Manifest version 2.
21
16
 
22
- Read more: ${je(e)}`}function Kr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
17
+ Read more: ${je(e)}`}function ti(t,e){return`${x("manifest.json","error")} Wrong Manifest Field Type
23
18
 
24
19
  Field ${(0,f.brightYellow)("web_accessible_resources")} must be an array of objects in Manifest version 3.
25
20
 
26
- Read more: ${je(e)}`}function Qr(t,e,s){let i=s?.schemaPath?.split("/"),n=i?.slice(i.length-2).shift();return`${w(t,"error")} Deprecated Field
21
+ Read more: ${je(e)}`}function si(t,e,s){let i=s?.schemaPath?.split("/"),n=i?.slice(i.length-2).shift();return`${x("manifest.json","error")} Deprecated Field
27
22
 
28
23
  Field ${(0,f.brightYellow)(n||"")} is deprecated in Manifest V3. Update your manifest.json file to run your extension.
29
24
 
30
- Read more: ${je(e)}`}function ei(t,e,s){let r=e?.instancePath.replaceAll("/",".").slice(1)||"",i=e?.params.type;return`${w(t,"error")} Invalid Manifest Field
25
+ Read more: ${je(e)}`}function ri(t,e,s){let r=e?.instancePath.replaceAll("/",".").slice(1)||"",i=e?.params.type;return`${x("manifest.json","error")} Invalid Manifest Field
31
26
 
32
27
  Field ${(0,f.brightYellow)(r)} must be of type ${(0,f.brightBlue)(i)}.
33
28
 
34
- Read more: ${je(s)}`}function ti(t,e,s){return`${w(t,"error")} Missing Required Manifest Field
29
+ Read more: ${je(s)}`}function ii(t,e,s){return`${x(t,"error")} Missing Required Manifest Field
35
30
 
36
31
  Field ${(0,f.brightYellow)(s||"")} is required. Update your manifest.json file to run your extension.
37
32
 
38
- Read more: ${je(e)}`}function si(t,e){let s=e.split(".").pop(),r=`${w(t,"error")} Content Script Import
33
+ Read more: ${je(e)}`}function ni(t,e){let s=e.split(".").pop(),r=`${x(t,"error")} Content Script Import
39
34
 
40
35
  One of your ${s?.toUpperCase()} imports is also a content_script CSS in manifest.json.
41
- Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return r}function ri(t){return`${w(t,"error")} Top Level Await In Non-ECMAScript Module
36
+ Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return r}function oi(t){return`${x(t,"error")} Top Level Await In Non-ECMAScript Module
42
37
 
43
38
  Top-level await is only supported in ECMAScript modules.
44
39
  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 Qe(t,e,s){if(!e)throw new Error("This operation is impossible. Please report a bug.");switch(zs.default.extname(s)){case".js":case".ts":case".jsx":case".tsx":return Wp(t,e,s);case".css":case".scss":case".sass":case".less":return Bp(t,e,s);default:return Jp(t,e,s)}}function ae(t,e,s){let r=e.startsWith("content_scripts")?"content_scripts":e.replace("/","."),i=e.split("-")[1],n=e.startsWith("pages"),o=t.includes("content_scripts")?`(index ${i})
40
+ in your package.json or use the ${(0,f.brightYellow)(".mjs")} extension for your script files.`}function Qe(t,e,s){if(!e)throw new Error("This operation is impossible. Please report a bug.");switch(Hs.default.extname(s)){case".js":case".ts":case".jsx":case".tsx":return Wp(t,e,s);case".css":case".scss":case".sass":case".less":return Bp(t,e,s);default:return Jp(t,e,s)}}function ae(t,e,s){let r=e.startsWith("content_scripts")?"content_scripts":e.replace("/","."),i=e.split("-")[1],n=e.startsWith("pages"),o=t.includes("content_scripts")?`(index ${i})
46
41
 
47
- `:r;return`${w(t,"error")} File Not Found
42
+ `:r;return`${x("manifest.json","error")} File Not Found
48
43
 
49
44
  ${n?`Check the ${(0,f.brightYellow)("pages")} folder in your project root directory.
50
-
51
45
  `:`Check the ${(0,f.brightYellow)(o)} field in your manifest.json file.
52
-
53
- `}${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function et(t,e,s){return`${w(t,"error")} File Not Found
46
+ `}${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function et(t,e,s){return`${x("manifest.json","error")} File Not Found
54
47
 
55
48
  Check the ${(0,f.brightYellow)(e)} field in your manifest.json file.
49
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function ai(t,e){return`${x(t,"error")} Manifest Not Found
56
50
 
57
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function ii(t){return`${w(t,"error")} Manifest Not Found
58
-
59
- Ensure you have a manifest.json file at the root directory of your project.`}function ni(t,e){return`${w(t,"error")} Invalid Manifest
51
+ Ensure you have a manifest.json file at the root directory of your project.
52
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(e)}`}function ci(t,e){return`${x("manifest.json","error")} Invalid Manifest
60
53
 
61
- Update your manifest.json file and try again. `+e}function oi(t,e){let s=e&&`${(0,f.gray)("PATH")} ${(0,f.red)("REMOVED")} ${(0,f.underline)(e)}
62
- `,r=t&&`${(0,f.gray)("PATH")} ${(0,f.brightGreen)("ADDED")} ${(0,f.underline)(t)}`;return`Manifest Entry Point Modification
54
+ Update your manifest.json file and try again. `+(0,f.red)(e.toString())}function pi(t,e){let s=e&&`${(0,f.gray)("PATH")} ${(0,f.red)("REMOVED")} ${(0,f.underline)(e)}
55
+ `,r=t&&`${(0,f.gray)("PATH")} ${(0,f.brightGreen)("ADDED")} ${(0,f.underline)(t)}`;return`${x("manifest.json","error")} Manifest Entry Point Modification
63
56
 
64
57
  Changing the path of ${(0,f.brightYellow)("<script>")} or ${(0,f.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
65
-
66
- `+s+r}function ai(t,e,s,r,i){let n=t.charAt(0).toUpperCase()+t.slice(1);return`${w("manifest.json","error")} Manifest Entry Point Modification
58
+ `+s+r}function li(t,e,s,r,i){let n=t.charAt(0).toUpperCase()+t.slice(1);return`${x("manifest.json","error")} Manifest Entry Point Modification
67
59
 
68
60
  ${n} ${(0,f.brightYellow)(r)} in the ${(0,f.underline)(s+"/")} folder after compilation requires a server restart.
69
-
70
- ${(0,f.gray)("PATH")} ${(0,f.underline)(i)}`}function ci(t){return`${w(t,"warn")}`+v(t,"TypeScript").replace(".",`but no config file was found. Creating ${(0,f.brightYellow)("tsconfig.json")}...`)}function Hs(t,e,s){let r=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(!s.data)return`
71
-
72
- ${(0,f.bold)((0,f.red)("ERROR"))} in ${w(r,"error")} No data received from the extension client.
61
+ ${(0,f.gray)("PATH")} ${(0,f.underline)(i)}`}function fi(t){return`${x("TypeScript","info")} is being used but no config file was found. Creating ${(0,f.brightYellow)("tsconfig.json")}...`}function Vs(t,e,s){let r=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(!s.data)return`${x(r,"error")} No Client Data Received
73
62
 
74
63
  This error happens when the program can't get the data from your extension.
75
64
  There are many reasons this might happen. To fix, ensure that:
76
65
 
77
66
  - Your extension is set as enabled in ${(0,f.underline)(i)}
78
- - No previous ${Ur(e)} browser instance is open
67
+ - No previous ${Jr(e)} browser instance is open
79
68
 
80
69
  If that is not the case, restart both the ${(0,f.cyan)(t.name||"")} and the
81
70
  ${(0,f.brightYellow)("Manager Extension")} in ${(0,f.underline)(i)} and try again.
82
71
 
83
72
  If the issue still persists, please report a bug:
84
73
 
85
- `+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:n,management:o}=s.data;if(!o&&process.env.EXTENSION_ENV==="development")return`${w(r,"error")} No management API info received from client. Investigate.`;let{name:c,version:p}=o,l=Js().version;return`
74
+ `+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:n,management:o}=s.data;if(!o&&process.env.EXTENSION_ENV==="development")return`${x(r,"error")} No management API info received from client. Investigate.`;let{name:c,version:p}=o,l=zs().version;return`
86
75
  \u{1F9E9} ${(0,f.brightGreen)("Extension.js")} ${(0,f.gray)(`${l}`)}
87
76
  Extension Name ${(0,f.gray)(c)}
88
77
  Extension Version ${(0,f.gray)(p)}
89
- Extension ID ${(0,f.gray)(n)}`}function pi(t){return`This is your first run using Extension.js via ${Ur(t)}. Welcome! \u{1F389}
78
+ Extension ID ${(0,f.gray)(n)}`}function mi(t){return`This is your first run using Extension.js via ${Jr(t)}. Welcome! \u{1F389}
90
79
 
91
- \u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function li(t,e){return`${w(t,"error")} WebSocket: ${e}`}function fi(t,e,s){return`
92
-
93
- ${(0,f.bold)((0,f.red)("ERROR"))} in ${w(t,"error")} File Not Found
80
+ \u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function ui(t,e){return`${x("WebSocket","error")} General WebSocket Error:
81
+ ${(0,f.red)(e)}`}function di(t,e,s){return`${x("manifest.json","error")} File Not Found
94
82
 
95
83
  Check the ${(0,f.brightYellow)(e.replace("/","."))} field in your manifest.json file.
96
-
97
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}}`}function ui(t,e){return`${w(t,"error")} HTML Entry Point Modification
84
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function gi(t,e){return`${x(t,"error")} HTML Entry Point Modification
98
85
 
99
86
  Changing the path of ${(0,f.brightYellow)("<script>")} or ${(0,f.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
100
-
101
- ${(0,f.gray)("PATH")} ${e}`}function Wp(t,e,s){return`${w(t,"error")} File Not Found
87
+ ${(0,f.gray)("PATH")} ${e}`}function Wp(t,e,s){return`${x("HTML","error")} File Not Found
102
88
 
103
89
  Check your ${(0,f.brightYellow)("<script>")} tags in ${(0,f.underline)(e)}.
104
-
105
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Bp(t,e,s){return`${w(t,"error")} File Not Found
90
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Bp(t,e,s){return`${x("HTML","error")} File Not Found
106
91
 
107
92
  Check your ${(0,f.brightYellow)("<link>")} tags in ${(0,f.underline)(e)}.
108
-
109
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Jp(t,e,s){let r=zs.default.extname(s);return`${w(t,"error")} File Not Found
93
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Jp(t,e,s){let r=Hs.default.extname(s);return`${x("HTML","error")} File Not Found
110
94
 
111
95
  Check your ${(0,f.brightYellow)("*"+r)} assets in ${(0,f.underline)(e)}.
112
-
113
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function mi(){return`${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.
114
- By default, your ${(0,f.brightYellow)("manifest.json")} file is not being watched. To enable this feature, run:
96
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function hi(){return`${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.
97
+ By default, your manifest.json file is not being watched. To enable this feature, run:
115
98
 
116
99
  npx -y mkcert-cli \\
117
100
  ${(0,f.brightGreen)("--outDir")} ${(0,f.underline)(Ke)} \\
@@ -120,62 +103,62 @@ By default, your ${(0,f.brightYellow)("manifest.json")} file is not being watche
120
103
 
121
104
  This will enable the secure certificate needed for Firefox via ${(0,f.bold)("mkcert")}.
122
105
 
123
- Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/FiloSottile/mkcert")}`}function di(t,e){return`${w(t,"error")} Default port ${e} in use, choose a new port. `}function gi(t){return`${w(t,"error")} No Extension Id Specified
106
+ Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/FiloSottile/mkcert")}`}function yi(t,e){return`${x(t,"error")} Default port ${(0,f.brightYellow)(e.toString())} in use. Choose a new port. `}function bi(t){return`${x(t,"error")} Extension ID Not Defined
124
107
 
125
108
  For MAIN world content_scripts, the extension ID must be specified.
126
109
  Ensure your extension have a fixed ID and that the ${(0,f.brightYellow)("publicPath")}
127
- of your ${(0,f.brightYellow)("extension.config.js")} is defined as your extension URL.`}var tt=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(Jr(i)),new hi.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 Vs=a(require("fs")),yi=a(require("path")),st=class{apply(e){let s=yi.default.join(e.options.output.path||"","hot");Vs.default.existsSync(s)&&(Vs.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var rt=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new bi.default().apply(e),new tt({manifestPath:this.manifestPath}).apply(e),new st().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(Wr(i,r,s))})}};var qi=a(require("path")),Ui=a(require("mini-css-extract-plugin"));var Ai=a(require("mini-css-extract-plugin"));var le=a(require("path")),$e=a(require("fs"));var ce=a(require("path")),it=a(require("fs")),Gs=require("child_process"),xi=require("detect-package-manager");function vi(t,e){return Object.values(e||{}).some(s=>s===t)}function h(t,e,s){let r=ce.default.extname(e),n=P(e,s)?ce.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")),Xs(n||"")}function Xs(t){return t.replace(/\\/g,"/")}function P(t,e={}){if(!e)return!1;let s=ce.default.normalize(Xs(t));return Object.values(e).some(i=>typeof i!="string"?!1:Xs(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)}function nt(){return process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("pnpm")?"pnpm":!1}function wi(){return process.env.npm_execpath?"npm":!1}async function _(t,e,s){try{let r=await(0,xi.detect)();console.log(Br(t,e,r));let i="";r==="yarn"?i=`yarn --silent add ${s.join(" ")} --cwd ${__dirname} --optional`:r==="npm"||wi()?i=`npm --silent install ${s.join(" ")} --prefix ${__dirname} --save-optional`:nt()?i=`pnpm --silent add ${s.join(" ")} --prefix ${__dirname} --save-optional`:i=`${r} --silent install ${s.join(" ")} --cwd ${__dirname} --optional`,(0,Gs.execSync)(i,{stdio:"inherit"}),await new Promise(n=>setTimeout(n,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(zr(t,e)),r==="yarn"?i="yarn install --silent > /dev/null 2>&1":r==="npm"||wi()?i="npm install --silent > /dev/null 2>&1":nt()?i="pnpm install --silent > /dev/null 2>&1":i=`${r} install --silent > /dev/null 2>&1`,(0,Gs.execSync)(i,{stdio:"inherit"})),console.log(Hr(t,e))}catch(r){console.error(Vr(t,e,r))}}function ot(t){let e=ce.default.join(t,"package.json");if(!it.default.existsSync(e))return!1;let s=JSON.parse(it.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 _i(t){return!it.default.existsSync(ce.default.resolve(__dirname,`run-${t}-profile`))}function Si(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 pe(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"&&te.includes(e))&&(this[i.substring(o+1)]=n)})}var Pi=!1;function at(t){let e=le.default.join(t,"package.json"),s=le.default.join(t,"manifest.json");if(!$e.default.existsSync(e))return!1;let r=zp(t),i=require(e),n=i.devDependencies&&i.devDependencies.tailwindcss,o=i.dependencies&&i.dependencies.tailwindcss,c=!!r&&!!(n||o);if(c&&!Pi){let l=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(l,"Tailwind")),Pi=!0}return c}function zp(t){let e=le.default.join(t,"tailwind.config.mjs"),s=le.default.join(t,"tailwind.config.cjs"),r=le.default.join(t,"tailwind.config.js");if($e.default.existsSync(e))return e;if($e.default.existsSync(s))return s;if($e.default.existsSync(r))return r}var ct=a(require("path")),Ei=a(require("fs"));var ki=!1;function De(t){let e=ct.default.join(t,"package.json"),s=ct.default.join(t,"manifest.json");if(!Ei.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(!ki){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"SASS")),ki=!0}return!0}return!1}async function ji(t,e){if(!De(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],i=require(ct.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 pt=a(require("path")),Di=a(require("fs"));var $i=!1;function Ce(t){let e=pt.default.join(t,"package.json"),s=pt.default.join(t,"manifest.json"),i=require(s).name||"Extension.js";if(!Di.default.existsSync(e))return!1;let n=require(e),o=n.devDependencies&&n.devDependencies.less,c=n.dependencies&&n.dependencies.less;return o||c?($i||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"LESS")),$i=!0),!0):!1}async function Ci(t,e){if(!Ce(t))return[];try{require.resolve("less-loader")}catch{let r=require(pt.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 ue=a(require("path")),lt=a(require("fs"));var fe=!1;function Hp(t){let e=ue.default.join(t,"package.json"),s=ue.default.join(t,"manifest.json");if(!lt.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(lt.default.existsSync(e)){let o=require(e);if(o.dependencies&&o.dependencies.postcss||o.devDependencies&&o.devDependencies.postcss)return fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0}for(let o of r)if(lt.default.existsSync(ue.default.join(t,o)))return fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0;return at(t)?(fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0):!1}async function Fi(t,e){if(!Hp(t))return{};try{require.resolve("postcss-loader")}catch{let r=require(ue.default.join(t,"package.json")).name;!De(t)&&!Ce(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:ue.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 ft=a(require("path")),Ii=a(require("fs"));var Li=!1;function Fe(t){let e=ft.default.join(t,"package.json"),s=ft.default.join(t,"manifest.json");if(!Ii.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.vue,n=r.dependencies&&r.dependencies.vue;if((i||n)&&!Li){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Vue")),Li=!0}return!!i||!!n}async function Oi(t){if(!Fe(t))return;try{require.resolve("vue-loader")}catch{let i=["typescript"],o=require(ft.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=Ai.default.loader,r=[e.useMiniCssExtractPlugin?s:Fe(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{importLoaders:1}}].filter(Boolean);if(at(t)||De(t)||Ce(t)){let i=await Fi(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 D=a(require("path")),R=a(require("fs"));function Ti(t){let e=D.default.join(t,"stylelint.config.json"),s=D.default.join(t,".stylelintrc.js file"),r=D.default.join(t,"stylelint.config.mjs"),i=D.default.join(t,".stylelintrc.mjs"),n=D.default.join(t,"stylelint.config.cjs"),o=D.default.join(t,".stylelintrc.cjs"),c=D.default.join(t,".stylelintrc.json"),p=D.default.join(t,".stylelintrc"),l=D.default.join(t,".stylelintrc.yml"),u=D.default.join(t,".stylelintrc.yaml");if(R.default.existsSync(e))return e;if(R.default.existsSync(s))return s;if(R.default.existsSync(r))return r;if(R.default.existsSync(i))return i;if(R.default.existsSync(n))return n;if(R.default.existsSync(o))return o;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 Mi=!1;function Ri(t){let e=D.default.join(t,"package.json"),s=D.default.join(t,"manifest.json");if(!R.default.existsSync(e))return!1;let i=!!Ti(t);if(i&&!Mi){let o=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(o,"Stylelint")),Mi=!0}return i}async function Ni(t){if(!Ri(t))return[];try{require.resolve("stylelint")}catch{let r=["stylelint","stylelint-webpack-plugin","stylelint-config-standard-scss"],i=require(D.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:Ri(t)?Ti(t):D.default.join(__dirname,"stylelint.config.json"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",D.default.join(t,"node_modules")]})]}var ut=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=qi.default.dirname(this.manifestPath),r=[new Ui.default];r.forEach(p=>p.apply(e));let i=await Ni(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 ji(s,this.mode),c=await Ci(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 mt=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 Zs=a(require("path"));var de=a(require("path")),ht=a(require("fs"));var dt=a(require("path")),Bi=a(require("fs"));var Wi=!1;function X(t){let e=dt.default.join(t,"package.json"),s=dt.default.join(t,"manifest.json");if(!Bi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.preact,n=r.dependencies&&r.dependencies.preact;if((i||n)&&!Wi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Preact")),Wi=!0}return!!i||!!n}async function Ji(t){if(!X(t))return;try{require.resolve("@prefresh/webpack")}catch{let r=["@prefresh/webpack"],n=require(dt.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 me=a(require("path")),gt=a(require("fs"));var zi=!1;function T(t){let e=me.default.join(t,"package.json");if(!gt.default.existsSync(e))return!1;let s=Gp(t),r=require(e),i=require(me.default.join(t,"manifest.json")),n=i.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,c=r.dependencies&&r.dependencies.typescript;return zi||((o||c)&&(s?process.env.EXTENSION_ENV==="development"&&console.log(v(n,"TypeScript")):(console.log(ci(i)),Xp(t))),zi=!0),!!s&&!!(o||c)}function Vp(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:ot(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 Gp(t){let e=me.default.join(t,"tsconfig.json");if(gt.default.existsSync(e))return e}function Xp(t){gt.default.writeFileSync(me.default.join(t,"tsconfig.json"),JSON.stringify(Vp(t,{mode:"development"}),null,2))}async function Hi(t){if(!T(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],i=require(me.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"TypeScript",s),console.log(E(i,"TypeScript")),process.exit(0)}return!0}var Vi=!1,Gi=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Zp(t){let e=de.default.join(t,"package.json"),s=de.default.join(t,"manifest.json");if(!ht.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies["babel-core"],n=r.dependencies&&r.dependencies["babel-core"],o=Gi.some(c=>ht.default.existsSync(de.default.join(t,c)))||!!i||!!n;if(o&&!Vi){let p=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(v(p,"Babel")),Vi=!0}return o}function Yp(t){for(let e of Gi){let s=de.default.join(t,e);if(ht.default.existsSync(s))return s}}function Kp(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Yp(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 Xi(t,e){if(!Zp(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(de.default.join(e,"manifest.json")).name||"Extension.js";await _(p,"Babel",o),console.log(E(p,"Babel")),process.exit(0)}let s=T(e)?/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/:/\.(js|mjs|jsx|mjsx)$/,r=t.options.mode,i=await Hi(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Kp(e,{mode:r,typescript:i})}],alias:void 0}}var yt=a(require("path")),Yi=a(require("fs"));var Zi=!1;function ge(t){let e=yt.default.join(t,"package.json"),s=yt.default.join(t,"manifest.json");if(!Yi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.react,n=r.dependencies&&r.dependencies.react;if((i||n)&&!Zi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"React")),Zi=!0}return!!i||!!n}async function Ki(t){if(!ge(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(yt.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 bt=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Zs.default.dirname(this.manifestPath),r=await Xi(e,s),i=await Ki(s),n=await Ji(s),o=await Oi(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:[Zs.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:T(s)?"typescript":"ecmascript",tsx:T(s)&&(ge(s)||X(s)),jsx:!T(s)&&(ge(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 Ue=a(require("path"));var Nn=a(require("path"));var Qi=a(require("path"));function en(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return Qi.default.join(t,s)}var tn=a(require("path"));function sn(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return tn.default.join(t,s)}var wt=a(require("path"));function rn(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":wt.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":wt.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":wt.default.join(t,r)}}return s}var nn=a(require("path"));function on(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return nn.default.join(t,s)}var Ys=a(require("path"));function an(t,e){if(e.options_page){let r=e.options_page;return Ys.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return Ys.default.join(t,s)}var cn=a(require("path"));function pn(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return cn.default.join(t,s)}var ln=a(require("path"));function fn(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}`]=ln.default.join(t,n);return r}var un=a(require("path"));function mn(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return un.default.join(t,s)}var dn=a(require("path"));function gn(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return dn.default.join(t,s)}function Le(t,e){return{"action/default_popup":en(t,e),"browser_action/default_popup":sn(t,e),...rn(t,e),devtools_page:on(t,e),"options_ui/page":an(t,e),"page_action/default_popup":pn(t,e),...fn(t,e),"side_panel/default_path":mn(t,e),"sidebar_action/default_panel":gn(t,e)}}var Ks=a(require("path"));function hn(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Ks.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Ks.default.join(t,e.action.default_icon[r]));return s}var Qs=a(require("path"));function yn(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return Qs.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]=Qs.default.join(t,e.browser_action.default_icon[r]);s.push(i)}return s}var er=a(require("path"));function bn(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=er.default.join(t,s.light)),s.dark&&(s.dark=er.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var wn=a(require("path"));function xn(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let i=wn.default.join(t,e.icons[r]);s.push(i)}return s}var tr=a(require("path"));function vn(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return tr.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let i=tr.default.join(t,e.page_action.default_icon[r]);s.push(i)}return s}var _n=a(require("path"));function Sn(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:_n.default.join(t,e.sidebar_action.default_icon)}function Pn(t,e){return{action:hn(t,e),browser_action:yn(t,e),"browser_action/theme_icons":bn(t,e),icons:xn(t,e),page_action:vn(t,e),sidebar_action:Sn(t,e)}}var kn=a(require("path"));function En(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}`]=kn.default.join(t,i.path)}),s)}var jn=a(require("path"));function $n(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return jn.default.join(t,s)}function Dn(t,e){return{...En(t,e),"storage/managed_schema":$n(t,e)}}var Ie=a(require("path")),xt=a(require("fs"));function Cn(t,e){let s=Ie.default.join(Ie.default.dirname(e),"_locales"),r=[];if(xt.default.existsSync(s))for(let i of xt.default.readdirSync(s)){let n=Ie.default.join(s,i);for(let o of xt.default.readdirSync(n))r.push(Ie.default.join(t,"_locales",i,o))}return r}var Fn=a(require("path"));function Ln(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>Fn.default.join(t,r))}var In=a(require("path"));function On(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return In.default.join(t,s)}var sr=a(require("path"));function An(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=>sr.default.join(t,o))},r=n=>{if(n.css?.length!==0)return n.css?.map(o=>sr.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 Mn=a(require("path"));function Rn(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return Mn.default.join(t,s)}function Oe(t,e){return{"background/scripts":Ln(t,e),"background/service_worker":On(t,e),...An(t,e),"user_scripts/api_script":Rn(t,e)}}function Tn(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function he({manifestPath:t,browser:e}){let s=Nn.default.dirname(t),r=require(t),i=pe(r,e||"chrome");return{html:Le(s,i),icons:Pn(s,i),json:Dn(s,i),locales:Cn(s,t),scripts:Oe(s,i),web_accessible_resources:Tn(i)}}var ye=a(require("path"));var vt=a(require("fs")),Ae=a(require("path"));function _t(t,e){if(!vt.default.existsSync(t)||!vt.default.statSync(t).isDirectory())return[];let s=[];function r(i){let n=vt.default.readdirSync(i,{withFileTypes:!0});for(let o of n){let c=Ae.default.join(i,o.name);o.isDirectory()?r(c):o.isFile()&&e(o.name)&&s.push(c)}}return r(t),s}function St(t,e,s=""){return!e||!e.length?{}:e.reduce((r,i)=>{let n=Ae.default.extname(i),o=Ae.default.basename(i,n),c=s?`${s}/${o}`:Ae.default.relative(t,i);return{...r,[c]:i}},{})}function qn({manifestPath:t}){let e=ye.default.dirname(t),s={public:ye.default.join(e,"public"),pages:ye.default.join(e,"pages"),scripts:ye.default.join(e,"scripts")},r={public:_t(s.public,()=>!0),pages:_t(s.pages,n=>n.endsWith(".html")),scripts:_t(s.scripts,n=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(ye.default.extname(n)))};return{public:St(e,r.public),pages:St(e,r.pages,"pages"),scripts:St(e,r.scripts,"scripts")}}var Pt=a(require("path")),Un=a(require("webpack")),kt=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 Un.default.ProvidePlugin({r:[Pt.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(Pt.default.resolve(__dirname,"./resolver-loader.js")),include:[Pt.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 Wn=a(require("fs")),jt=a(require("webpack")),Bn=require("webpack");var Et=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:jt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,i;try{let c=Wn.default.readFileSync(r,"utf-8");i=JSON.parse(c)}catch(c){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new jt.default.WebpackError(ni(l,c)));return}let n=JSON.stringify(i,null,2);s.emitAsset("manifest.json",new Bn.sources.RawSource(n))})})}};var Ft=require("webpack");function Jn(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 zn=a(require("path"));var $t=t=>zn.default.basename(t);function Hn(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/${$t(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/${$t(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:h(`browser_action/${$t(s.light)}`,s.light,e)},...s.dark&&{dark:h(`browser_action/${$t(s.dark)}`,s.dark,e)}}))}}}}function Vn(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 Gn(t,e){return{...Jn(t,e),...Hn(t,e),...Vn(t,e)}}var Zn=a(require("path"));var Xn=t=>Zn.default.basename(t);function Yn(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/${Xn(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,h(`action/${Xn(r)}`,r,e)]))}}}}function Kn(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 Dt(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 Qn(t,e){return{...Yn(t,e),...Kn(t,e),...Dt(t,e)}}function eo(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function to(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 so(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 ro(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var io=a(require("path"));var Qp=t=>io.default.basename(t);function no(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,h(`icons/${Qp(r)}`,r,e)]))}}function oo(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function ao(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 po=a(require("path"));var co=t=>po.default.basename(t);function lo(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/${co(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/${co(r)}`,r,e)]))}}}}function fo(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 uo=a(require("path"));var el=t=>uo.default.basename(t);function mo(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/${el(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function go(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var ho=a(require("path"));var tl=t=>ho.default.basename(t);function yo(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${tl(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function bo(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 wo(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function xo(t,e){return{...eo(t,e),...to(t,e),...so(t,e),...ro(t,e),...no(t,e),...oo(t,e),...ao(t,e),...lo(t,e),...fo(t,e),...Dt(t,e),...mo(t,e),...go(t,e),...yo(t,e),...bo(t,e),...wo(t)}}function vo(t,e,s){let r=e||require(t);return JSON.stringify({...r,...xo(r,s),...Gn(r,s),...Qn(r,s)},null,2)}var Ct=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:Ft.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=G(s,this.manifestPath),i=vo(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 Ft.sources.RawSource(o);s.updateAsset("manifest.json",c)})})}};var _o=a(require("fs")),Lt=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=>{_o.default.existsSync(i)&&(r.has(i)||(r.add(i),s.fileDependencies.add(i)))})})}};var So=a(require("fs")),Po=a(require("path")),Ot=a(require("webpack"));var It=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=Po.default.extname(d),$=require(this.manifestPath).name||"Extension.js",k=ae($,p,d);So.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:Ot.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=Ot.default.WebpackError;this.handleErrors(s,r)})})}};var ko=a(require("fs")),Mt=a(require("webpack"));var At=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(!ko.default.existsSync(o)){r();return}let c=require(this.manifestPath),p=pe(c,this.browser),l=this.flattenAndSort(Object.values(Le(n,p))),u=this.flattenAndSort(Object.values(Oe(n,p)));s.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||"{}"),k=this.flattenAndSort(Object.values(Le(n,$))),U=this.flattenAndSort(Object.values(Oe(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],Ee=oi(H,W);d.errors.push(new Mt.default.WebpackError(Ee))}})})}r()})}};var Rt=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 It({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ct({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new Lt([this.manifestPath]).apply(e),new At({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ar=a(require("path"));var ir=a(require("fs")),qt=a(require("webpack")),Co=require("webpack");var Eo=a(require("fs")),we=a(require("path")),jo=a(require("parse5-utils"));var be=a(require("parse5-utils"));function Tt(t){try{return new URL(t),!0}catch{return!1}}function Me(t,e){let{childNodes:s=[]}=t;for(let r of s)if(r.nodeName==="script"){let i=be.default.getAttribute(r,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let i=be.default.getAttribute(r,"href"),n=be.default.getAttribute(r,"rel");if(!i||Tt(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=be.default.getAttribute(r,"href");if(!i||Tt(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=be.default.getAttribute(r,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:r,assetType:"staticSrc"})}else Me(r,e)}function C(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||Eo.default.readFileSync(t,{encoding:"utf8"}),i=jo.default.parse(r),n=(o,c)=>we.default.join(we.default.dirname(o),c.startsWith("/")?we.default.relative(we.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")&&Me(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 $o(t,e,s){let r=Object.keys(t).find(n=>{let o=t[n];return t[n]===e||C(o)?.js?.includes(e)||C(o)?.css?.includes(e)})||"",i=rr(e);return r?`/${r.replace(i,"")}${s}`:`${e.replace(i,"")}${s}`}function rr(t){switch(we.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 Do(t,e){return Object.values(e||{}).some(s=>s===t)}var Nt=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:qt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let o of n){let[c,p]=o;if(p){if(!ir.default.existsSync(p)){let u=ae(r,c,p);i.warnings.push(new qt.default.WebpackError(u));return}let l=ir.default.readFileSync(p,"utf8");if(!P(p,this.excludeList)){let u=new Co.sources.RawSource(l),d=Z(c,".html");i.emitAsset(d,u)}}}})})}};var Ut=a(require("fs")),xe=a(require("path")),Fo=a(require("webpack")),Re=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-assets-to-compilation",s=>{s.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Re.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=C(o,l)?.static,d=[...new Set(u)];for(let g of d)if(!g.includes("public/")){if(!Ut.default.existsSync(g)&&!Do(g,this.includeList)&&!xe.default.basename(g).startsWith("#")){let W=Qe(require(this.manifestPath).name,o,g);s.warnings.push(new Fo.default.WebpackError(W));return}let y=Ut.default.readFileSync(g),$=new Re.sources.RawSource(y),k=xe.default.join("assets",xe.default.basename(g));if(!s.getAsset(k))if(g.endsWith(".html")){let U=C(g),W=[...U?.js||[],...U?.css||[],...U?.static||[]];s.emitAsset(k,$),W.forEach(H=>{let Ee=Ut.default.readFileSync(H),B=new Re.sources.RawSource(Ee),Tr=xe.default.join("assets",xe.default.basename(H));s.getAsset(Tr)||s.emitAsset(Tr,B)})}else s.emitAsset(k,$)}}}}})})}};var Lo=a(require("path")),nr=a(require("fs"));var Bt=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(!nr.default.existsSync(n))return;let o=C(n),c=o?.js||[],p=o?.css||[],l=[...c,...p].filter(u=>!P(u,this.excludeList));if(e.options.mode==="development"){let u=Lo.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}nr.default.existsSync(n)&&(P(n,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var zt=require("webpack");var or=a(require("fs")),Y=a(require("path")),L=a(require("parse5-utils"));function Io(t,e,s,r,i){let n=or.default.readFileSync(s,{encoding:"utf8"}),o=L.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")&&Me(u,({filePath:d,childNode:g,assetType:y})=>{let $=Y.default.dirname(s),k=Y.default.resolve($,d),U=rr(k),W=P(Y.default.resolve($,d),i),H=Y.default.join("/",Y.default.normalize(d)),Ee=vi(k,r);switch(y){case"script":{W?l=L.default.setAttribute(g,"src",H):(l=L.default.remove(g),p=!0);break}case"css":{W?l=L.default.setAttribute(g,"href",H):(l=L.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(W)l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",H);else if(Ee){let B=$o(r,k,U);l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",B)}else{let B=Y.default.join("assets",Y.default.basename(k,U));or.default.existsSync(k)&&(l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",Z(B,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let d=L.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:Z(e,".css",!0)}],L.default.append(u,d)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let d=L.default.createNode("script");d.attrs=[{name:"src",value:Z(e,".js",!0)}],L.default.append(u,d)}}return L.default.serialize(o)}}var Jt=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:zt.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=Io(s,n,o,r,this.excludeList||{});if(!P(o,this.excludeList)&&c){let p=new zt.sources.RawSource(c),l=Z(n,".html");s.updateAsset(l,p)}}}})})}};var Oo=a(require("fs")),Ao=require("webpack");var Ht=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:Ao.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=C(n),c=new Set(s.fileDependencies);if(Oo.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 Mo=a(require("fs"));var Vt=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(!Mo.default.existsSync(i)){let o=require(this.manifestPath).name||"Extension.js";console.error(ae(o,s,i)),process.exit(1)}this.initialHtmlAssets[i]={js:C(i)?.js||[],css:C(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=C(o)?.js||[],p=C(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(ui(d,o))}}i()})}};var Ro=a(require("fs")),To=require("webpack");function rl(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(!Ro.default.existsSync(c))return null;let p=C(c),l=p?.js||[],u=p?.css||[];if(l.includes(n)||u.includes(n)){let d=Qe(require(t).name,c,n);return new To.WebpackError(d)}}}return null}var Gt=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=rl(this.manifestPath,this.includeList||{},r);n&&(s.errors[i]=n)})})})}};var Xt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Nt({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),new Jt({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:[ar.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ar.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),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),new Gt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var re=a(require("path"));var cr=a(require("fs")),No=a(require("path"));function qo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let n=cr.default.existsSync(i)&&!P(i,e),o=No.default.extname(i);return n&&(o===".js"||o===".mjs"||o===".jsx"||o===".ts"||o===".tsx")})}function Uo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>cr.default.existsSync(i)&&!P(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Zt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=this.includeList||{},r={};for(let[i,n]of Object.entries(s)){let o=qo(n,this.excludeList),c=Uo(n,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...c),(c.length||o.length)&&(r[i]={import:p})}e.options.entry={...e.options.entry,...r}}};var se=require("webpack"),il=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],nl=[...il,`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 } }`],Yt=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=ol();return r.addRuntimeModule(i,n),!0})})}};function ol(){class t extends se.RuntimeModule{constructor(){super("publicPath",se.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return se.Template.asString([...nl,`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 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 s=require(this.manifestPath);s.content_scripts?.some(r=>r.world&&r.world.toLowerCase()==="main")&&te.includes(this.browser)&&!s.key&&(console.error(gi(s.name||"")),process.exit(1))}};var Qt=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 Zt({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 Yt().apply(e),new Kt({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 lr=a(require("path")),Te=a(require("fs")),fr=a(require("webpack")),Ne=require("webpack");var ve=a(require("path")),es=a(require("fs"));function pr(t){let e=ve.default.join(ve.default.dirname(t),"_locales"),s=[];if(es.default.existsSync(e))for(let r of es.default.readdirSync(e)){let i=ve.default.join(e,r);for(let n of es.default.readdirSync(i))s.push(ve.default.join(ve.default.dirname(t),"_locales",r,n))}return s}var ts=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:Ne.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let i=require(this.manifestPath).name||"Extension.js";if(!Te.default.existsSync(this.manifestPath)){s.errors.push(new fr.default.WebpackError(ii(i)));return}if(s.errors.length>0)return;let n=pr(this.manifestPath);for(let o of Object.entries(n||[])){let[c,p]=o,l=p;if(l){if(!Te.default.existsSync(l)){s.warnings.push(new fr.default.WebpackError(et(i,c,l)));return}let u=Te.default.readFileSync(l),d=new Ne.sources.RawSource(u),g=e.options.context||lr.default.dirname(this.manifestPath);if(!P(l,this.excludeList)){let y=lr.default.relative(g,l);s.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ne.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=pr(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)Te.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var ss=a(require("fs")),Wo=a(require("webpack")),qe=require("webpack");var rs=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:qe.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(!ss.default.existsSync(p)){let g=require(this.manifestPath).name||"Extension.js";s.warnings.push(new Wo.default.WebpackError(et(g,n,p)));return}let l=ss.default.readFileSync(p),u=new qe.sources.RawSource(l);s.emitAsset(n+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:qe.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)||ss.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var ur=a(require("fs")),Bo=a(require("path")),ns=require("webpack");var is=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:ns.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(!ur.default.existsSync(p))continue;if(!P(p,this.excludeList)){let l=ur.default.readFileSync(p),u=new ns.sources.RawSource(l),d=Bo.default.basename(p),y=`${n.endsWith("theme_icons")?n.replace("theme_icons",""):n}/${d}`;s.emitAsset(y,u)}}}})})}};var Jo=a(require("fs")),zo=require("webpack"),os=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:zo.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);Jo.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var as=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new is({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new os({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ps=require("webpack");var cs=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 ps.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:ps.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 I=a(require("fs")),O=a(require("path")),Ho=a(require("chokidar")),ls=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=O.default.dirname(e);if(I.default.existsSync(s))return!0;I.default.mkdirSync(s,{recursive:!0})}copyFile(e,s){this.ensureDirectoryExistence(s),I.default.copyFileSync(e,s)}copyFolder(e,s){I.default.existsSync(s)||I.default.mkdirSync(s,{recursive:!0}),I.default.readdirSync(e).forEach(i=>{let n=O.default.join(e,i),o=O.default.join(s,i);I.default.statSync(n).isDirectory()?this.copyFolder(n,o):this.copyFile(n,o)})}apply(e){let s=O.default.dirname(this.options.manifestPath),r=O.default.join(s,"public"),i=e.options.output?.path||"";I.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let n=O.default.join(i,"public");I.default.existsSync(n)||I.default.mkdirSync(n,{recursive:!0}),I.default.existsSync(r)&&this.copyFolder(r,n)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let n=O.default.join(s,"public"),o=Ho.default.watch(n,{ignoreInitial:!0});o.on("add",c=>{let p=O.default.join(i,O.default.relative(s,c));this.copyFile(c,p)}),o.on("change",c=>{let p=O.default.join(i,O.default.relative(s,c));this.copyFile(c,p)}),o.on("unlink",c=>{let p=O.default.join(i,O.default.relative(s,c));I.default.existsSync(p)&&I.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var N=a(require("path")),mr=a(require("chokidar"));var fs=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let i=N.relative(process.cwd(),s),p=ai(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=mr.watch(r,{ignoreInitial:!0}),o=mr.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 us=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new ls({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new fs(s).apply(e)}};var ms=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=he({manifestPath:s}),i=qn({manifestPath:s});new kt({manifestPath:s,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:ge(Ue.default.dirname(this.manifestPath))||X(Ue.default.dirname(this.manifestPath))||Fe(Ue.default.dirname(this.manifestPath)),typescript:T(Ue.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new Rt({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:i.public}).apply(e),new Xt({manifestPath:s,includeList:{...r.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Qt({manifestPath:s,browser:this.browser,includeList:{...r.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new ts({manifestPath:s}).apply(e),new rs({manifestPath:s,includeList:r.json,excludeList:i.public}).apply(e),new as({manifestPath:s,includeList:r.icons,excludeList:i.public}).apply(e),new cs({manifestPath:s,includeList:{...r.scripts,...i.scripts},excludeList:i.public}).apply(e),new us({manifestPath:s}).apply(e)}};var Je=a(require("path"));var Vo=a(require("path")),Go=a(require("ws"));function ds(t,e){t.clients.forEach(s=>{s.readyState===Go.default.OPEN&&s.send(JSON.stringify(e))})}function Xo(t,e,s){if(!s||!e)return;let r=he({manifestPath:e}).locales,i=he({manifestPath:e}).scripts,n=he({manifestPath:e}).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}Vo.default.basename(s)==="manifest.json"&&ds(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&ds(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"&&ds(t,{changedFile:"service_worker"})}),Object.entries(n).forEach(([o,c])=>{c?.includes(s)&&o==="declarative_net_request"&&ds(t,{changedFile:"declarative_net_request"})})}var gr=a(require("path")),Qo=a(require("fs")),Be=a(require("ws"));var We=a(require("path")),al=a(require("http")),Yo=a(require("https")),dr=a(require("fs"));var Zo=t=>{if(!dr.default.existsSync(t))return;let e=We.default.basename(t);return dr.default.readFileSync(We.default.join(__dirname,"certs",e))};function Ko(t,e){let s={key:Zo(We.default.join(__dirname,"certs","localhost.key")),cert:Zo(We.default.join(__dirname,"certs","localhost.cert"))},r=Yo.default.createServer(s,(i,n)=>{n.writeHead(200),n.end()});return r.on("error",i=>{throw console.error(di(t,e)),new Error(i.message)}),{server:r,port:e}}function cl(t,e,s){switch(s){case"chrome":return new Be.default.Server({host:"localhost",port:e});case"edge":return new Be.default.Server({host:"localhost",port:e+1});case"firefox":return new Be.default.Server({server:Ko(t,e+2).server});default:return new Be.default.Server({host:"localhost",port:8888})}}async function ea(t,e){let s=t.options.context||"",r=require(gr.default.join(s,"manifest.json")),i=r.name||"Extension.js",n=e.port||8e3,o=cl(i,n,e.browser);if(o.on("connection",c=>{c.send(JSON.stringify({status:"serverReady"})),c.on("error",p=>{console.log(li(i,p))}),c.on("message",p=>{let l=JSON.parse(p.toString());if(l.status==="clientReady"){let u=require(gr.default.join(s,"manifest.json"));setTimeout(()=>{console.log(Hs(u,e.browser,l)),console.log("")},2500),_i(e.browser)&&setTimeout(()=>{console.log(pi(e.browser))},5e3)}})}),e.browser==="firefox"&&!Qo.default.existsSync(Ke)){let c=Si(r);console.log(Hs(r,e.browser,c)),console.log(""),console.log(mi()),console.log("")}return o}var ta=a(require("path")),hr=a(require("fs"));function sa(t,e){let s=ta.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let r=hr.default.readFileSync(s,"utf8"),i=r.replace(/__RELOAD_PORT__/g,e.toString());i!==r&&hr.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 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;sa(this.browser,this.port);let s=await ea(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=Je.default.relative(Je.default.dirname(this.manifestPath),o),p=Je.default.relative(process.cwd(),Je.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&Xo(s,this.manifestPath,o),i()})}};var yr=a(require("path"));function ra(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[yr.default.dirname(s)],exclude:/node_modules/,use:[{loader:yr.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:s,browser:e}}]})}var br=a(require("path"));function ia(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[br.default.dirname(s)],exclude:/node_modules/,use:[{loader:br.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:s,browser:e}}]})}var hs=require("webpack");var wr=a(require("content-security-policy-parser"));function na(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,wr.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 oa(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,wr.default)(e.extension_pages||""),r="";for(let i in s)r+=`${i} ${s.get(i)?.join(" ")}; `;return{extension_pages:r.trim()}}function aa(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 ca(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function xr(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 vr(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 gs=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?oa(s):na(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...xr(s,this.browser),...vr(s),web_accessible_resources:s.manifest_version===3?ca(s):aa(s)},i=JSON.stringify(r,null,2),n=new hs.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:hs.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 _r=a(require("fs")),_e=a(require("path")),pa=a(require("webpack-target-webextension"));var ys=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let i=_e.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),n=_e.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=_e.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=_e.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=_e.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e,s){if(!_r.default.existsSync(e)&&this.manifestPath){let i=require(this.manifestPath).name||"Extension.js",n=fi(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||!_r.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new pa.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var Sr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){te.includes(this.browser)&&ra(e,this.browser,this.manifestPath),this.browser==="firefox"&&ia(e,this.browser,this.manifestPath),new gs({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ys({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},la=Sr;var bs=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 la({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var fa=a(require("webpack")),ws=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new fa.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var vs=require("webpack");var xs=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let s=pe(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:vs.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=G(s,this.manifestPath),i=this.patchManifest(r),n=new vs.sources.RawSource(i);s.updateAsset("manifest.json",n)})})}};var _s=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 ws({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new xs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var _a=a(require("fs"));var ua=a(require("webpack")),ma=a(require("content-security-policy-parser"));function da(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=i=>{if(!i)return;let n=(0,ma.default)(i);if(n.get("script-src")&&n.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return Xr(o)}};if(t.manifest_version===3){let i=e?r(s):void 0;if(i)return new ua.default.WebpackError(i)}return null}var Pr=a(require("webpack"));function ga(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 Pr.default.WebpackError(Yr(n,e));if(t.manifest_version===3&&!i)return new Pr.default.WebpackError(Kr(n,e))}return null}var ha=a(require("webpack"));function ya(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new ha.default.WebpackError(Gr(s))}return null}var ba=a(require("path")),wa=a(require("fs")),xa=a(require("webpack"));function va(t,e){let s=ba.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return wa.default.existsSync(s)&&!t.default_locale?new xa.default.WebpackError(Zr(r)):null}var Ss=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let i=da(s),n=ga(s,r),o=ya(s,r),c=va(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(_a.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,n,o),r()})}};var Ia=a(require("fs")),Oa=a(require("ajv"));var Sa={$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 Pa(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 ka=a(require("path")),Ea=require("webpack");function ja(t,e,s){let r=t.options.context||"",i=ka.default.join(r,"manifest.json"),o=require(i).name||"Extension.js",c=e?.params.missingProperty;t.errors.push(new Ea.WebpackError(ti(o,s,c)))}var $a=a(require("path")),Da=require("webpack");function Ca(t,e,s){let r=t.options.context||"",i=$a.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new Da.WebpackError(ei(o,e,s)))}var Fa=a(require("path")),La=require("webpack");function kr(t,e,s){let r=t.options.context||"",i=Fa.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new La.WebpackError(Qr(o,s,e)))}var Ps=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let i=new Oa.default;Pa(i);let n={allOf:[Sa]},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"){ja(e,l,r);return}p&&(l?.keyword==="type"&&Ca(e,l,r),l?.keyword==="not"&&kr(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(Ia.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,n,o),r()})}};var Ra=a(require("fs")),jr=a(require("path"));var Er=a(require("webpack"));function Aa(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 Er.default.WebpackError(si(t,r))}return null}function Ma(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new Er.default.WebpackError(ri(s.name)):null}var ks=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=jr.default.join(jr.default.dirname(this.manifestPath),"package.json");if(!Ra.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=Aa(r,o),l=Ma(r,o);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),n()})})}};var Es=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new Ss({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new Ps({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ks({manifestPath:this.manifestPath}).apply(e)}};var Sc=a(require("os")),Dr=a(require("path"));var oc=a(require("fs")),ac=require("child_process");var ie=a(require("path")),Fs=a(require("fs"));var Ta={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}},Na={...Ta},qa={...Ta};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 He(t){return t.charAt(0).toUpperCase()+t.slice(1)}function js(t,e){let s=t==="firefox"?"Add-on":"Extension";return`${j(t,"success")} ${He(t)} ${s} running in ${(0,x.cyan)(e||"unknown")} mode.`}function $s(t,e){let s=He(t),r=e=="null"?`${s} browser is not installed.
128
-
129
- `:`Path to ${s} browser is not found.
130
-
131
- ${(0,x.red)("NOT FOUND")} ${(0,x.underline)(e)}
110
+ of your ${(0,f.brightYellow)("extension.config.js")} is defined as your extension URL.`}var tt=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=A.default.dirname(this.manifestPath),i=require(this.manifestPath).name||"Extension.js";(V.default.existsSync(A.default.join(s,".env"))||V.default.existsSync(A.default.join(s,".env.example"))||V.default.existsSync(A.default.join(s,".env.local"))||V.default.existsSync(A.default.join(s,".env.defaults")))&&(console.log(Vr(i)),new wi.default({path:V.default.existsSync(A.default.join(s,".env"))?A.default.join(s,".env"):V.default.existsSync(A.default.join(s,".env.local"))?A.default.join(s,".env.local"):A.default.join(s,".env.example"),allowEmptyValues:!0,defaults:V.default.existsSync(A.default.join(s,".env.defaults")),systemvars:!0}).apply(e))}};var Gs=a(require("fs")),xi=a(require("path")),st=class{apply(e){let s=xi.default.join(e.options.output.path||"","hot");Gs.default.existsSync(s)&&(Gs.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var rt=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new vi.default().apply(e),new tt({manifestPath:this.manifestPath}).apply(e),new st().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(zr(i,r,s))})}};var Bi=a(require("path")),Ji=a(require("mini-css-extract-plugin"));var Ni=a(require("mini-css-extract-plugin"));var le=a(require("path")),$e=a(require("fs"));var ce=a(require("path")),it=a(require("fs")),Xs=require("child_process"),Si=require("detect-package-manager");function Pi(t,e){return Object.values(e||{}).some(s=>s===t)}function h(t,e,s){let r=ce.default.extname(e),n=P(e,s)?ce.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")),Zs(n||"")}function Zs(t){return t.replace(/\\/g,"/")}function P(t,e={}){if(!e)return!1;let s=ce.default.normalize(Zs(t));return Object.values(e).some(i=>typeof i!="string"?!1:Zs(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)}function nt(){return process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("pnpm")?"pnpm":!1}function _i(){return process.env.npm_execpath?"npm":!1}async function S(t,e,s){try{let r=await(0,Si.detect)();console.log(Hr(t,e,r));let i="";r==="yarn"?i=`yarn --silent add ${s.join(" ")} --cwd ${__dirname} --optional`:r==="npm"||_i()?i=`npm --silent install ${s.join(" ")} --prefix ${__dirname} --save-optional`:nt()?i=`pnpm --silent add ${s.join(" ")} --prefix ${__dirname} --save-optional`:i=`${r} --silent install ${s.join(" ")} --cwd ${__dirname} --optional`,(0,Xs.execSync)(i,{stdio:"inherit"}),await new Promise(n=>setTimeout(n,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Gr(t,e)),r==="yarn"?i="yarn install --silent > /dev/null 2>&1":r==="npm"||_i()?i="npm install --silent > /dev/null 2>&1":nt()?i="pnpm install --silent > /dev/null 2>&1":i=`${r} install --silent > /dev/null 2>&1`,(0,Xs.execSync)(i,{stdio:"inherit"})),console.log(Xr(t,e))}catch(r){console.error(Zr(t,e,r))}}function ot(t){let e=ce.default.join(t,"package.json");if(!it.default.existsSync(e))return!1;let s=JSON.parse(it.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 ki(t){return!it.default.existsSync(ce.default.resolve(__dirname,`run-${t}-profile`))}function Ei(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 pe(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"&&te.includes(e))&&(this[i.substring(o+1)]=n)})}var ji=!1;function at(t){let e=le.default.join(t,"package.json"),s=le.default.join(t,"manifest.json");if(!$e.default.existsSync(e))return!1;let r=zp(t),i=require(e),n=i.devDependencies&&i.devDependencies.tailwindcss,o=i.dependencies&&i.dependencies.tailwindcss,c=!!r&&!!(n||o);if(c&&!ji){let l=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(l,"Tailwind")),ji=!0}return c}function zp(t){let e=le.default.join(t,"tailwind.config.mjs"),s=le.default.join(t,"tailwind.config.cjs"),r=le.default.join(t,"tailwind.config.js");if($e.default.existsSync(e))return e;if($e.default.existsSync(s))return s;if($e.default.existsSync(r))return r}var ct=a(require("path")),Ci=a(require("fs"));var $i=!1;function Ce(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.sass,n=r.dependencies&&r.dependencies.sass;if(i||n){if(!$i){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"SASS")),$i=!0}return!0}return!1}async function Di(t,e){if(!Ce(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],i=require(ct.default.join(t,"package.json")).name;await S(i,"PostCSS",r),await S(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 M(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await M(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await M(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await M(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var pt=a(require("path")),Li=a(require("fs"));var Fi=!1;function De(t){let e=pt.default.join(t,"package.json"),s=pt.default.join(t,"manifest.json"),i=require(s).name||"Extension.js";if(!Li.default.existsSync(e))return!1;let n=require(e),o=n.devDependencies&&n.devDependencies.less,c=n.dependencies&&n.dependencies.less;return o||c?(Fi||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"LESS")),Fi=!0),!0):!1}async function Ii(t,e){if(!De(t))return[];try{require.resolve("less-loader")}catch{let r=require(pt.default.join(t,"package.json")).name;await S(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 M(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await M(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var me=a(require("path")),lt=a(require("fs"));var fe=!1;function Hp(t){let e=me.default.join(t,"package.json"),s=me.default.join(t,"manifest.json");if(!lt.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(lt.default.existsSync(e)){let o=require(e);if(o.dependencies&&o.dependencies.postcss||o.devDependencies&&o.devDependencies.postcss)return fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0}for(let o of r)if(lt.default.existsSync(me.default.join(t,o)))return fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0;return at(t)?(fe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),fe=!0),!0):!1}async function Oi(t,e){if(!Hp(t))return{};try{require.resolve("postcss-loader")}catch{let r=require(me.default.join(t,"package.json")).name;!Ce(t)&&!De(t)&&await S(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:me.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 ft=a(require("path")),Ai=a(require("fs"));var Mi=!1;function Fe(t){let e=ft.default.join(t,"package.json"),s=ft.default.join(t,"manifest.json");if(!Ai.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.vue,n=r.dependencies&&r.dependencies.vue;if((i||n)&&!Mi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Vue")),Mi=!0}return!!i||!!n}async function Ri(t){if(!Fe(t))return;try{require.resolve("vue-loader")}catch{let i=["typescript"],o=require(ft.default.join(t,"manifest.json")).name||"Extension.js";await S(o,"TypeScript",i),await S(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 M(t,e){let s=Ni.default.loader,r=[e.useMiniCssExtractPlugin?s:Fe(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{importLoaders:1}}].filter(Boolean);if(at(t)||Ce(t)||De(t)){let i=await Oi(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")),R=a(require("fs"));function Ui(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"),m=C.default.join(t,".stylelintrc.yaml");if(R.default.existsSync(e))return e;if(R.default.existsSync(s))return s;if(R.default.existsSync(r))return r;if(R.default.existsSync(i))return i;if(R.default.existsSync(n))return n;if(R.default.existsSync(o))return o;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(m))return m}var Ti=!1;function qi(t){let e=C.default.join(t,"package.json"),s=C.default.join(t,"manifest.json");if(!R.default.existsSync(e))return!1;let i=!!Ui(t);if(i&&!Ti){let o=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(o,"Stylelint")),Ti=!0}return i}async function Wi(t){if(!qi(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 S(i,"Stylelint",r),console.log(E(i,"Stylelint")),process.exit(0)}let e=require("stylelint-webpack-plugin");return[new e({context:t,configFile:qi(t)?Ui(t):C.default.join(__dirname,"stylelint.config.json"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",C.default.join(t,"node_modules")]})]}var mt=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Bi.default.dirname(this.manifestPath),r=[new Ji.default];r.forEach(p=>p.apply(e));let i=await Wi(s);r.push(...i);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await M(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await M(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await M(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await M(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]}];e.options.plugins=[...e.options.plugins,...r].filter(Boolean);let o=await Di(s,this.mode),c=await Ii(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 ut=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 Ys=a(require("path"));var de=a(require("path")),ht=a(require("fs"));var dt=a(require("path")),Hi=a(require("fs"));var zi=!1;function X(t){let e=dt.default.join(t,"package.json"),s=dt.default.join(t,"manifest.json");if(!Hi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.preact,n=r.dependencies&&r.dependencies.preact;if((i||n)&&!zi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Preact")),zi=!0}return!!i||!!n}async function Vi(t){if(!X(t))return;try{require.resolve("@prefresh/webpack")}catch{let r=["@prefresh/webpack"],n=require(dt.default.join(t,"manifest.json")).name||"Extension.js";await S(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 ue=a(require("path")),gt=a(require("fs"));var Gi=!1;function N(t){let e=ue.default.join(t,"package.json");if(!gt.default.existsSync(e))return!1;let s=Gp(t),r=require(e),i=require(ue.default.join(t,"manifest.json")),n=i.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,c=r.dependencies&&r.dependencies.typescript;return Gi||((o||c)&&(s?process.env.EXTENSION_ENV==="development"&&console.log(v(n,"TypeScript")):(console.log(fi(i)),Xp(t))),Gi=!0),!!s&&!!(o||c)}function Vp(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:ot(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 Gp(t){let e=ue.default.join(t,"tsconfig.json");if(gt.default.existsSync(e))return e}function Xp(t){gt.default.writeFileSync(ue.default.join(t,"tsconfig.json"),JSON.stringify(Vp(t,{mode:"development"}),null,2))}async function Xi(t){if(!N(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],i=require(ue.default.join(t,"manifest.json")).name||"Extension.js";await S(i,"TypeScript",s),console.log(E(i,"TypeScript")),process.exit(0)}return!0}var Zi=!1,Yi=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Zp(t){let e=de.default.join(t,"package.json"),s=de.default.join(t,"manifest.json");if(!ht.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies["babel-core"],n=r.dependencies&&r.dependencies["babel-core"],o=Yi.some(c=>ht.default.existsSync(de.default.join(t,c)))||!!i||!!n;if(o&&!Zi){let p=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(v(p,"Babel")),Zi=!0}return o}function Yp(t){for(let e of Yi){let s=de.default.join(t,e);if(ht.default.existsSync(s))return s}}function Kp(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Yp(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 Ki(t,e){if(!Zp(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(de.default.join(e,"manifest.json")).name||"Extension.js";await S(p,"Babel",o),console.log(E(p,"Babel")),process.exit(0)}let s=N(e)?/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/:/\.(js|mjs|jsx|mjsx)$/,r=t.options.mode,i=await Xi(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Kp(e,{mode:r,typescript:i})}],alias:void 0}}var yt=a(require("path")),en=a(require("fs"));var Qi=!1;function ge(t){let e=yt.default.join(t,"package.json"),s=yt.default.join(t,"manifest.json");if(!en.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.react,n=r.dependencies&&r.dependencies.react;if((i||n)&&!Qi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"React")),Qi=!0}return!!i||!!n}async function tn(t){if(!ge(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(yt.default.join(t,"manifest.json")).name||"Extension.js";await S(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 bt=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Ys.default.dirname(this.manifestPath),r=await Ki(e,s),i=await tn(s),n=await Vi(s),o=await Ri(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:[Ys.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:N(s)?"typescript":"ecmascript",tsx:N(s)&&(ge(s)||X(s)),jsx:!N(s)&&(ge(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 Ue=a(require("path"));var Wn=a(require("path"));var sn=a(require("path"));function rn(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return sn.default.join(t,s)}var nn=a(require("path"));function on(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return nn.default.join(t,s)}var wt=a(require("path"));function an(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":wt.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":wt.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":wt.default.join(t,r)}}return s}var cn=a(require("path"));function pn(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return cn.default.join(t,s)}var Ks=a(require("path"));function ln(t,e){if(e.options_page){let r=e.options_page;return Ks.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return Ks.default.join(t,s)}var fn=a(require("path"));function mn(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return fn.default.join(t,s)}var un=a(require("path"));function dn(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}`]=un.default.join(t,n);return r}var gn=a(require("path"));function hn(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return gn.default.join(t,s)}var yn=a(require("path"));function bn(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return yn.default.join(t,s)}function Le(t,e){return{"action/default_popup":rn(t,e),"browser_action/default_popup":on(t,e),...an(t,e),devtools_page:pn(t,e),"options_ui/page":ln(t,e),"page_action/default_popup":mn(t,e),...dn(t,e),"side_panel/default_path":hn(t,e),"sidebar_action/default_panel":bn(t,e)}}var Qs=a(require("path"));function wn(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Qs.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Qs.default.join(t,e.action.default_icon[r]));return s}var er=a(require("path"));function xn(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return er.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]=er.default.join(t,e.browser_action.default_icon[r]);s.push(i)}return s}var tr=a(require("path"));function vn(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=tr.default.join(t,s.light)),s.dark&&(s.dark=tr.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var _n=a(require("path"));function Sn(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let i=_n.default.join(t,e.icons[r]);s.push(i)}return s}var sr=a(require("path"));function Pn(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return sr.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let i=sr.default.join(t,e.page_action.default_icon[r]);s.push(i)}return s}var kn=a(require("path"));function En(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:kn.default.join(t,e.sidebar_action.default_icon)}function jn(t,e){return{action:wn(t,e),browser_action:xn(t,e),"browser_action/theme_icons":vn(t,e),icons:Sn(t,e),page_action:Pn(t,e),sidebar_action:En(t,e)}}var $n=a(require("path"));function Cn(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}`]=$n.default.join(t,i.path)}),s)}var Dn=a(require("path"));function Fn(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return Dn.default.join(t,s)}function Ln(t,e){return{...Cn(t,e),"storage/managed_schema":Fn(t,e)}}var Ie=a(require("path")),xt=a(require("fs"));function In(t,e){let s=Ie.default.join(Ie.default.dirname(e),"_locales"),r=[];if(xt.default.existsSync(s))for(let i of xt.default.readdirSync(s)){let n=Ie.default.join(s,i);for(let o of xt.default.readdirSync(n))r.push(Ie.default.join(t,"_locales",i,o))}return r}var On=a(require("path"));function Mn(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>On.default.join(t,r))}var An=a(require("path"));function Rn(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return An.default.join(t,s)}var rr=a(require("path"));function Nn(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=>rr.default.join(t,o))},r=n=>{if(n.css?.length!==0)return n.css?.map(o=>rr.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 Tn=a(require("path"));function qn(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return Tn.default.join(t,s)}function Oe(t,e){return{"background/scripts":Mn(t,e),"background/service_worker":Rn(t,e),...Nn(t,e),"user_scripts/api_script":qn(t,e)}}function Un(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function he({manifestPath:t,browser:e}){let s=Wn.default.dirname(t),r=require(t),i=pe(r,e||"chrome");return{html:Le(s,i),icons:jn(s,i),json:Ln(s,i),locales:In(s,t),scripts:Oe(s,i),web_accessible_resources:Un(i)}}var ye=a(require("path"));var vt=a(require("fs")),Me=a(require("path"));function _t(t,e){if(!vt.default.existsSync(t)||!vt.default.statSync(t).isDirectory())return[];let s=[];function r(i){let n=vt.default.readdirSync(i,{withFileTypes:!0});for(let o of n){let c=Me.default.join(i,o.name);o.isDirectory()?r(c):o.isFile()&&e(o.name)&&s.push(c)}}return r(t),s}function St(t,e,s=""){return!e||!e.length?{}:e.reduce((r,i)=>{let n=Me.default.extname(i),o=Me.default.basename(i,n),c=s?`${s}/${o}`:Me.default.relative(t,i);return{...r,[c]:i}},{})}function Bn({manifestPath:t}){let e=ye.default.dirname(t),s={public:ye.default.join(e,"public"),pages:ye.default.join(e,"pages"),scripts:ye.default.join(e,"scripts")},r={public:_t(s.public,()=>!0),pages:_t(s.pages,n=>n.endsWith(".html")),scripts:_t(s.scripts,n=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(ye.default.extname(n)))};return{public:St(e,r.public),pages:St(e,r.pages,"pages"),scripts:St(e,r.scripts,"scripts")}}var Pt=a(require("path")),Jn=a(require("webpack")),kt=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 Jn.default.ProvidePlugin({r:[Pt.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(Pt.default.resolve(__dirname,"./resolver-loader.js")),include:[Pt.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 zn=a(require("fs")),jt=a(require("webpack")),Hn=require("webpack");var Et=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:jt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,i;try{let c=zn.default.readFileSync(r,"utf-8");i=JSON.parse(c)}catch(c){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new jt.default.WebpackError(ci(l,c)));return}let n=JSON.stringify(i,null,2);s.emitAsset("manifest.json",new Hn.sources.RawSource(n))})})}};var Ft=require("webpack");function Vn(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 Gn=a(require("path"));var $t=t=>Gn.default.basename(t);function Xn(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/${$t(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/${$t(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:h(`browser_action/${$t(s.light)}`,s.light,e)},...s.dark&&{dark:h(`browser_action/${$t(s.dark)}`,s.dark,e)}}))}}}}function Zn(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 Yn(t,e){return{...Vn(t,e),...Xn(t,e),...Zn(t,e)}}var Qn=a(require("path"));var Kn=t=>Qn.default.basename(t);function eo(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/${Kn(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,h(`action/${Kn(r)}`,r,e)]))}}}}function to(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 Ct(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 so(t,e){return{...eo(t,e),...to(t,e),...Ct(t,e)}}function ro(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function io(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 no(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 oo(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var ao=a(require("path"));var Qp=t=>ao.default.basename(t);function co(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,h(`icons/${Qp(r)}`,r,e)]))}}function po(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function lo(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 mo=a(require("path"));var fo=t=>mo.default.basename(t);function uo(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/${fo(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/${fo(r)}`,r,e)]))}}}}function go(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 ho=a(require("path"));var el=t=>ho.default.basename(t);function yo(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/${el(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function bo(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var wo=a(require("path"));var tl=t=>wo.default.basename(t);function xo(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${tl(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function vo(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 _o(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function So(t,e){return{...ro(t,e),...io(t,e),...no(t,e),...oo(t,e),...co(t,e),...po(t,e),...lo(t,e),...uo(t,e),...go(t,e),...Ct(t,e),...yo(t,e),...bo(t,e),...xo(t,e),...vo(t,e),..._o(t)}}function Po(t,e,s){let r=e||require(t);return JSON.stringify({...r,...So(r,s),...Yn(r,s),...so(r,s)},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((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:Ft.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=G(s,this.manifestPath),i=Po(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 Ft.sources.RawSource(o);s.updateAsset("manifest.json",c)})})}};var ko=a(require("fs")),Lt=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=>{ko.default.existsSync(i)&&(r.has(i)||(r.add(i),s.fileDependencies.add(i)))})})}};var Eo=a(require("fs")),jo=a(require("path")),Ot=a(require("webpack"));var It=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 m=this.extractPaths(l);for(let d of m){let g=jo.default.extname(d),$=require(this.manifestPath).name||"Extension.js";if(!Eo.default.existsSync(d)){let k=ae($,p,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:Ot.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=Ot.default.WebpackError;this.handleErrors(s,r)})})}};var $o=a(require("fs")),At=a(require("webpack"));var Mt=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(!$o.default.existsSync(o)){r();return}let c=require(this.manifestPath),p=pe(c,this.browser),l=this.flattenAndSort(Object.values(Le(n,p))),m=this.flattenAndSort(Object.values(Oe(n,p)));s.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",d=>{d.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:At.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let y=d.getAsset("manifest.json")?.source.source().toString(),$=JSON.parse(y||"{}"),k=this.flattenAndSort(Object.values(Le(n,$))),U=this.flattenAndSort(Object.values(Oe(n,$)));if(m.toString()!==U.toString()||l.toString()!==k.toString()){let W=l.filter(B=>!k.includes(B))[0],H=k.filter(B=>!l.includes(B))[0],Ee=pi(H,W);d.errors.push(new At.default.WebpackError(Ee))}})})}r()})}};var Rt=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 It({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Dt({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new Lt([this.manifestPath]).apply(e),new Mt({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var cr=a(require("path"));var nr=a(require("fs")),qt=a(require("webpack")),Io=require("webpack");var Co=a(require("fs")),we=a(require("path")),Do=a(require("parse5-utils"));var be=a(require("parse5-utils"));function Nt(t){try{return new URL(t),!0}catch{return!1}}function Ae(t,e){let{childNodes:s=[]}=t;for(let r of s)if(r.nodeName==="script"){let i=be.default.getAttribute(r,"src");if(!i||Nt(i))continue;e({filePath:i,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let i=be.default.getAttribute(r,"href"),n=be.default.getAttribute(r,"rel");if(!i||Nt(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=be.default.getAttribute(r,"href");if(!i||Nt(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=be.default.getAttribute(r,"src");if(!i||Nt(i))continue;e({filePath:i,childNode:r,assetType:"staticSrc"})}else Ae(r,e)}function D(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||Co.default.readFileSync(t,{encoding:"utf8"}),i=Do.default.parse(r),n=(o,c)=>we.default.join(we.default.dirname(o),c.startsWith("/")?we.default.relative(we.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")&&Ae(c,({filePath:p,assetType:l})=>{let m=n(t,p);switch(l){case"script":s.js?.push(m);break;case"css":s.css?.push(m);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;s.static?.push(m);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}function Fo(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=ir(e);return r?`/${r.replace(i,"")}${s}`:`${e.replace(i,"")}${s}`}function ir(t){switch(we.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 Lo(t,e){return Object.values(e||{}).some(s=>s===t)}var Tt=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:qt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let o of n){let[c,p]=o;if(p){if(!nr.default.existsSync(p)){let m=ae(r,c,p);i.warnings.push(new qt.default.WebpackError(m));return}let l=nr.default.readFileSync(p,"utf8");if(!P(p,this.excludeList)){let m=new Io.sources.RawSource(l),d=Z(c,".html");i.emitAsset(d,m)}}}})})}};var Ut=a(require("fs")),xe=a(require("path")),Oo=a(require("webpack")),Re=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-assets-to-compilation",s=>{s.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Re.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(),m=D(o,l)?.static,d=[...new Set(m)];for(let g of d)if(!g.includes("public/")){if(!Ut.default.existsSync(g)&&!Lo(g,this.includeList)&&!xe.default.basename(g).startsWith("#")){let W=Qe(require(this.manifestPath).name,o,g);s.warnings.push(new Oo.default.WebpackError(W));return}let y=Ut.default.readFileSync(g),$=new Re.sources.RawSource(y),k=xe.default.join("assets",xe.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 Ee=Ut.default.readFileSync(H),B=new Re.sources.RawSource(Ee),Ur=xe.default.join("assets",xe.default.basename(H));s.getAsset(Ur)||s.emitAsset(Ur,B)})}else s.emitAsset(k,$)}}}}})})}};var Mo=a(require("path")),or=a(require("fs"));var Bt=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(!or.default.existsSync(n))return;let o=D(n),c=o?.js||[],p=o?.css||[],l=[...c,...p].filter(m=>!P(m,this.excludeList));if(e.options.mode==="development"){let m=Mo.default.resolve(__dirname,"minimum-script-file.mjs");l.push(m)}or.default.existsSync(n)&&(P(n,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var zt=require("webpack");var ar=a(require("fs")),Y=a(require("path")),L=a(require("parse5-utils"));function Ao(t,e,s,r,i){let n=ar.default.readFileSync(s,{encoding:"utf8"}),o=L.default.parse(n),c=!!t.getAsset(e+".css"),p=!1;for(let l of o.childNodes)if(l.nodeName==="html"){for(let m of l.childNodes){if((m.nodeName==="head"||m.nodeName==="body")&&Ae(m,({filePath:d,childNode:g,assetType:y})=>{let $=Y.default.dirname(s),k=Y.default.resolve($,d),U=ir(k),W=P(Y.default.resolve($,d),i),H=Y.default.join("/",Y.default.normalize(d)),Ee=Pi(k,r);switch(y){case"script":{W?l=L.default.setAttribute(g,"src",H):(l=L.default.remove(g),p=!0);break}case"css":{W?l=L.default.setAttribute(g,"href",H):(l=L.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(W)l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",H);else if(Ee){let B=Fo(r,k,U);l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",B)}else{let B=Y.default.join("assets",Y.default.basename(k,U));ar.default.existsSync(k)&&(l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",Z(B,"",!0)))}break}default:break}}),m.nodeName==="head"&&c&&t.options.mode==="production"){let d=L.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:Z(e,".css",!0)}],L.default.append(m,d)}if(m.nodeName==="body"&&(p||t.options.mode!=="production")){let d=L.default.createNode("script");d.attrs=[{name:"src",value:Z(e,".js",!0)}],L.default.append(m,d)}}return L.default.serialize(o)}}var Jt=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:zt.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=Ao(s,n,o,r,this.excludeList||{});if(!P(o,this.excludeList)&&c){let p=new zt.sources.RawSource(c),l=Z(n,".html");s.updateAsset(l,p)}}}})})}};var Ro=a(require("fs")),No=require("webpack");var Ht=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:No.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(Ro.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 To=a(require("fs"));var Vt=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(!To.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:m}=this.initialHtmlAssets[o];if(this.hasEntriesChanged(p,m)||this.hasEntriesChanged(c,l)){let d=require(this.manifestPath).name;console.log(gi(d,o))}}i()})}};var qo=a(require("fs")),Uo=require("webpack");function rl(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(!qo.default.existsSync(c))return null;let p=D(c),l=p?.js||[],m=p?.css||[];if(l.includes(n)||m.includes(n)){let d=Qe(require(t).name,c,n);return new Uo.WebpackError(d)}}}return null}var Gt=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=rl(this.manifestPath,this.includeList||{},r);n&&(s.errors[i]=n)})})})}};var Xt=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 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),e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[cr.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(cr.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),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),new Gt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var re=a(require("path"));var pr=a(require("fs")),Wo=a(require("path"));function Bo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let n=pr.default.existsSync(i)&&!P(i,e),o=Wo.default.extname(i);return n&&(o===".js"||o===".mjs"||o===".jsx"||o===".ts"||o===".tsx")})}function Jo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>pr.default.existsSync(i)&&!P(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Zt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=this.includeList||{},r={};for(let[i,n]of Object.entries(s)){let o=Bo(n,this.excludeList),c=Jo(n,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...c),(c.length||o.length)&&(r[i]={import:p})}e.options.entry={...e.options.entry,...r}}};var se=require("webpack"),il=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],nl=[...il,`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 } }`],Yt=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=ol();return r.addRuntimeModule(i,n),!0})})}};function ol(){class t extends se.RuntimeModule{constructor(){super("publicPath",se.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return se.Template.asString([...nl,`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 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 s=require(this.manifestPath);s.content_scripts?.some(r=>r.world&&r.world.toLowerCase()==="main")&&te.includes(this.browser)&&!s.key&&(console.error(bi(s.name||"")),process.exit(1))}};var Qt=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 Zt({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 Yt().apply(e),new Kt({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 fr=a(require("path")),Ne=a(require("fs")),mr=a(require("webpack")),Te=require("webpack");var ve=a(require("path")),es=a(require("fs"));function lr(t){let e=ve.default.join(ve.default.dirname(t),"_locales"),s=[];if(es.default.existsSync(e))for(let r of es.default.readdirSync(e)){let i=ve.default.join(e,r);for(let n of es.default.readdirSync(i))s.push(ve.default.join(ve.default.dirname(t),"_locales",r,n))}return s}var ts=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:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let i=require(this.manifestPath).name||"Extension.js";if(!Ne.default.existsSync(this.manifestPath)){s.errors.push(new mr.default.WebpackError(ai(i,this.manifestPath)));return}if(s.errors.length>0)return;let n=lr(this.manifestPath);for(let o of Object.entries(n||[])){let[c,p]=o,l=p;if(l){if(!Ne.default.existsSync(l)){s.warnings.push(new mr.default.WebpackError(et(i,c,l)));return}let m=Ne.default.readFileSync(l),d=new Te.sources.RawSource(m),g=e.options.context||fr.default.dirname(this.manifestPath);if(!P(l,this.excludeList)){let y=fr.default.relative(g,l);s.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=lr(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)Ne.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var ss=a(require("fs")),zo=a(require("webpack")),qe=require("webpack");var rs=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:qe.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(!ss.default.existsSync(p)){let g=require(this.manifestPath).name||"Extension.js";s.warnings.push(new zo.default.WebpackError(et(g,n,p)));return}let l=ss.default.readFileSync(p),m=new qe.sources.RawSource(l);s.emitAsset(n+".json",m)}}})}),e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:qe.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)||ss.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var ur=a(require("fs")),Ho=a(require("path")),ns=require("webpack");var is=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:ns.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(!ur.default.existsSync(p))continue;if(!P(p,this.excludeList)){let l=ur.default.readFileSync(p),m=new ns.sources.RawSource(l),d=Ho.default.basename(p),y=`${n.endsWith("theme_icons")?n.replace("theme_icons",""):n}/${d}`;s.emitAsset(y,m)}}}})})}};var Vo=a(require("fs")),Go=require("webpack"),os=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:Go.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);Vo.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var as=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new is({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new os({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ps=require("webpack");var cs=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 m=r.content_scripts?.find(d=>d.js&&d.js.some(g=>g.includes(p)));if(m){let d=m.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 ps.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:ps.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(m=>{Array.from(n.getChunkModulesIterable(m)).forEach(g=>{n.getModuleChunks(g).forEach(y=>{y.auxiliaryFiles.forEach($=>{l.includes($)||l.push($)})})})}),o[p]=l}}),this.generateManifestPatches(s,o)})})}};var I=a(require("fs")),O=a(require("path")),Xo=a(require("chokidar")),ls=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=O.default.dirname(e);if(I.default.existsSync(s))return!0;I.default.mkdirSync(s,{recursive:!0})}copyFile(e,s){this.ensureDirectoryExistence(s),I.default.copyFileSync(e,s)}copyFolder(e,s){I.default.existsSync(s)||I.default.mkdirSync(s,{recursive:!0}),I.default.readdirSync(e).forEach(i=>{let n=O.default.join(e,i),o=O.default.join(s,i);I.default.statSync(n).isDirectory()?this.copyFolder(n,o):this.copyFile(n,o)})}apply(e){let s=O.default.dirname(this.options.manifestPath),r=O.default.join(s,"public"),i=e.options.output?.path||"";I.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let n=O.default.join(i,"public");I.default.existsSync(n)||I.default.mkdirSync(n,{recursive:!0}),I.default.existsSync(r)&&this.copyFolder(r,n)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let n=O.default.join(s,"public"),o=Xo.default.watch(n,{ignoreInitial:!0});o.on("add",c=>{let p=O.default.join(i,O.default.relative(s,c));this.copyFile(c,p)}),o.on("change",c=>{let p=O.default.join(i,O.default.relative(s,c));this.copyFile(c,p)}),o.on("unlink",c=>{let p=O.default.join(i,O.default.relative(s,c));I.default.existsSync(p)&&I.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var T=a(require("path")),dr=a(require("chokidar"));var fs=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let i=T.relative(process.cwd(),s),p=li(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=T.dirname(this.manifestPath),r=T.join(s,"pages"),i=T.join(s,"scripts"),n=dr.watch(r,{ignoreInitial:!0}),o=dr.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(T.extname(p))&&this.throwCompilationError("scripts",p,!0)}),o.on("unlink",p=>{c?.includes(T.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{n.close().catch(console.error),o.close().catch(console.error)})})}};var ms=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new ls({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new fs(s).apply(e)}};var us=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=he({manifestPath:s}),i=Bn({manifestPath:s});new kt({manifestPath:s,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:ge(Ue.default.dirname(this.manifestPath))||X(Ue.default.dirname(this.manifestPath))||Fe(Ue.default.dirname(this.manifestPath)),typescript:N(Ue.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new Rt({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:i.public}).apply(e),new Xt({manifestPath:s,includeList:{...r.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Qt({manifestPath:s,browser:this.browser,includeList:{...r.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new ts({manifestPath:s}).apply(e),new rs({manifestPath:s,includeList:r.json,excludeList:i.public}).apply(e),new as({manifestPath:s,includeList:r.icons,excludeList:i.public}).apply(e),new cs({manifestPath:s,includeList:{...r.scripts,...i.scripts},excludeList:i.public}).apply(e),new ms({manifestPath:s}).apply(e)}};var Je=a(require("path"));var Zo=a(require("path")),Yo=a(require("ws"));function ds(t,e){t.clients.forEach(s=>{s.readyState===Yo.default.OPEN&&s.send(JSON.stringify(e))})}function Ko(t,e,s){if(!s||!e)return;let r=he({manifestPath:e}).locales,i=he({manifestPath:e}).scripts,n=he({manifestPath:e}).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}Zo.default.basename(s)==="manifest.json"&&ds(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&ds(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([o,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(m=>m).includes(s)&&o==="background/service_worker"&&ds(t,{changedFile:"service_worker"})}),Object.entries(n).forEach(([o,c])=>{c?.includes(s)&&o==="declarative_net_request"&&ds(t,{changedFile:"declarative_net_request"})})}var hr=a(require("path")),sa=a(require("fs")),Be=a(require("ws"));var We=a(require("path")),al=a(require("http")),ea=a(require("https")),gr=a(require("fs"));var Qo=t=>{if(!gr.default.existsSync(t))return;let e=We.default.basename(t);return gr.default.readFileSync(We.default.join(__dirname,"certs",e))};function ta(t,e){let s={key:Qo(We.default.join(__dirname,"certs","localhost.key")),cert:Qo(We.default.join(__dirname,"certs","localhost.cert"))},r=ea.default.createServer(s,(i,n)=>{n.writeHead(200),n.end()});return r.on("error",i=>{throw console.error(yi(t,e)),new Error(i.message)}),{server:r,port:e}}function cl(t,e,s){switch(s){case"chrome":return new Be.default.Server({host:"localhost",port:e});case"edge":return new Be.default.Server({host:"localhost",port:e+1});case"firefox":return new Be.default.Server({server:ta(t,e+2).server});default:return new Be.default.Server({host:"localhost",port:8888})}}async function ra(t,e){let s=t.options.context||"",r=require(hr.default.join(s,"manifest.json")),i=r.name||"Extension.js",n=e.port||8e3,o=cl(i,n,e.browser);if(o.on("connection",c=>{c.send(JSON.stringify({status:"serverReady"})),c.on("error",p=>{console.log(ui(i,p))}),c.on("message",p=>{let l=JSON.parse(p.toString());if(l.status==="clientReady"){let m=require(hr.default.join(s,"manifest.json"));setTimeout(()=>{console.log(Vs(m,e.browser,l)),console.log("")},2500),ki(e.browser)&&setTimeout(()=>{console.log(mi(e.browser))},5e3)}})}),e.browser==="firefox"&&!sa.default.existsSync(Ke)){let c=Ei(r);console.log(Vs(r,e.browser,c)),console.log(""),console.log(hi()),console.log("")}return o}var ia=a(require("path")),yr=a(require("fs"));function na(t,e){let s=ia.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let r=yr.default.readFileSync(s,"utf8"),i=r.replace(/__RELOAD_PORT__/g,e.toString());i!==r&&yr.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 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;na(this.browser,this.port);let s=await ra(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=Je.default.relative(Je.default.dirname(this.manifestPath),o),p=Je.default.relative(process.cwd(),Je.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&Ko(s,this.manifestPath,o),i()})}};var br=a(require("path"));function oa(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[br.default.dirname(s)],exclude:/node_modules/,use:[{loader:br.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:s,browser:e}}]})}var wr=a(require("path"));function aa(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[wr.default.dirname(s)],exclude:/node_modules/,use:[{loader:wr.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:s,browser:e}}]})}var hs=require("webpack");var xr=a(require("content-security-policy-parser"));function ca(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,xr.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 pa(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,xr.default)(e.extension_pages||""),r="";for(let i in s)r+=`${i} ${s.get(i)?.join(" ")}; `;return{extension_pages:r.trim()}}function la(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 fa(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function vr(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 _r(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 gs=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?pa(s):ca(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...vr(s,this.browser),..._r(s),web_accessible_resources:s.manifest_version===3?fa(s):la(s)},i=JSON.stringify(r,null,2),n=new hs.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:hs.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 Sr=a(require("fs")),_e=a(require("path")),ma=a(require("webpack-target-webextension"));var ys=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let i=_e.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),n=_e.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=_e.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=_e.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=_e.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e,s){if(!Sr.default.existsSync(e)&&this.manifestPath){let i=require(this.manifestPath).name||"Extension.js",n=di(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||!Sr.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new ma.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var Pr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){te.includes(this.browser)&&oa(e,this.browser,this.manifestPath),this.browser==="firefox"&&aa(e,this.browser,this.manifestPath),new gs({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ys({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},ua=Pr;var bs=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 ua({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var da=a(require("webpack")),ws=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new da.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var vs=require("webpack");var xs=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let s=pe(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:vs.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=G(s,this.manifestPath),i=this.patchManifest(r),n=new vs.sources.RawSource(i);s.updateAsset("manifest.json",n)})})}};var _s=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 ws({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new xs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var ka=a(require("fs"));var ga=a(require("webpack")),ha=a(require("content-security-policy-parser"));function ya(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=i=>{if(!i)return;let n=(0,ha.default)(i);if(n.get("script-src")&&n.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return Kr(o)}};if(t.manifest_version===3){let i=e?r(s):void 0;if(i)return new ga.default.WebpackError(i)}return null}var kr=a(require("webpack"));function ba(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 kr.default.WebpackError(ei(n,e));if(t.manifest_version===3&&!i)return new kr.default.WebpackError(ti(n,e))}return null}var wa=a(require("webpack"));function xa(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new wa.default.WebpackError(Yr(s))}return null}var va=a(require("path")),_a=a(require("fs")),Sa=a(require("webpack"));function Pa(t,e){let s=va.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return _a.default.existsSync(s)&&!t.default_locale?new Sa.default.WebpackError(Qr(r)):null}var Ss=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let i=ya(s),n=ba(s,r),o=xa(s,r),c=Pa(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(ka.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,n,o),r()})}};var Aa=a(require("fs")),Ra=a(require("ajv"));var Ea={$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 ja(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 $a=a(require("path")),Ca=require("webpack");function Da(t,e,s){let r=t.options.context||"",i=$a.default.join(r,"manifest.json"),o=require(i).name||"Extension.js",c=e?.params.missingProperty;t.errors.push(new Ca.WebpackError(ii(o,s,c)))}var Fa=a(require("path")),La=require("webpack");function Ia(t,e,s){let r=t.options.context||"",i=Fa.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new La.WebpackError(ri(o,e,s)))}var Oa=a(require("path")),Ma=require("webpack");function Er(t,e,s){let r=t.options.context||"",i=Oa.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new Ma.WebpackError(si(o,s,e)))}var Ps=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let i=new Ra.default;ja(i);let n={allOf:[Ea]},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"){Da(e,l,r);return}p&&(l?.keyword==="type"&&Ia(e,l,r),l?.keyword==="not"&&Er(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(Aa.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,n,o),r()})}};var qa=a(require("fs")),$r=a(require("path"));var jr=a(require("webpack"));function Na(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 jr.default.WebpackError(ni(t,r))}return null}function Ta(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new jr.default.WebpackError(oi(s.name)):null}var ks=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=$r.default.join($r.default.dirname(this.manifestPath),"package.json");if(!qa.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=Na(r,o),l=Ta(r,o);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),n()})})}};var Es=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new Ss({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new Ps({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ks({manifestPath:this.manifestPath}).apply(e)}};var Ec=a(require("os")),Dr=a(require("path"));var pc=a(require("fs")),lc=require("child_process");var ie=a(require("path")),Fs=a(require("fs"));var Ua={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}},Wa={...Ua},Ba={...Ua};var w=require("@colors/colors/safe");function j(t,e){let s=e==="warn"?(0,w.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,w.cyan)("\u25BA\u25BA\u25BA"):e==="error"?`${(0,w.bold)((0,w.red)("ERROR"))} in ${He(t)} ${(0,w.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,w.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,w.gray)("")}${s}`}function He(t){return t.charAt(0).toUpperCase()+t.slice(1)}function js(t){let e=He(t);return`${j(t,"info")} Creating new ${e} user profile...`}function Ja(t){return`${j(t,"success")} Instance already running.`}function za(t){return`${j(t,"info")} Instance exited.`}function $s(t,e){let s=t==="firefox"?"Add-on":"Extension";return`${j(t,"success")} ${He(t)} ${s} running in ${(0,w.cyan)(e||"unknown")} mode.`}function Cs(t,e){let s=e=="null"?`Browser is not installed
132
111
 
133
- `;return`${j(t,"error")} ${r}Either install the ${s} or choose a different browser via ${(0,x.brightYellow)("--browser")} flag.`}function Ds(t){let e=He(t);return`${j(t,"info")} Creating new ${e} user profile...`}function Ua(t){return`${j(t,"success")} Instance already running.`}function Wa(t){return`${j(t,"info")} Instance exited.`}function Ba(t){return`${j(t,"error")} No Service Worker Support
112
+ `:`Can't find the browser path
134
113
 
135
- Firefox does not support the ${(0,x.brightYellow)("background.service_worker")} field yet.
136
- Update your manifest.json file to use ${(0,x.brightYellow)("background.scripts")} instead.
114
+ `;return`${j(t,"error")} ${s}Either install the missing browser or choose a different one via ${(0,w.brightYellow)("--browser")} flag.
115
+ ${(0,w.red)("NOT FOUND")} ${(0,w.underline)(e||He(t)+"BROWSER")}`}function Ha(t){return`${j(t,"error")} No Service Worker Support
137
116
 
138
- Read more: ${(0,x.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Ja(t,e){return`${j(t,"error")} Error launching ${He(t)}. Error:
117
+ Firefox does not support the ${(0,w.brightYellow)("background.service_worker")} field yet.
118
+ Update your manifest.json file to use ${(0,w.brightYellow)("background.scripts")} instead.
139
119
 
140
- ${(0,x.red)(e)}`}function za(t,e){return`${j(t,"error")} ${(0,x.red)(e.stack)}`}function Ha(t){return`${j(t,"error")} Unable to connect to ${He(t)}. Too many retries.`}function Va(t,e){return`${j(t,"error")} Error while installing temporary addon: ${(0,x.red)(e)}`}function Ga(t,e){return`${j(t,"error")} The path is not a directory.
120
+ Read more: ${(0,w.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Va(t,e){return`${j(t,"error")} Error launching browser:
121
+ ${(0,w.red)(e)}`}function Ga(t,e){return`${j(t,"error")} ${(0,w.red)(e.stack)}`}function Xa(t){return`${j(t,"error")} Unable to connect to ${He(t)}. Too many retries.`}function Za(t,e){return`${j(t,"error")} Error while installing temporary addon:
122
+ ${(0,w.red)(e)}`}function Ya(t,e){return`${j(t,"error")} Path is not directory
141
123
 
142
- ${(0,x.gray)("PATH")} ${(0,x.underline)(e)}
124
+ Please provide a valid directory path and try again.
125
+ ${(0,w.red)("NOT DIRECTORY")} ${(0,w.underline)(e)}`}function Ka(t){return`${j(t,"error")} Error parsing message length.`}function Qa(t){return`${j(t,"error")} ${(0,w.magenta)("MessagingClient")} connection closed.`}function ec(t,e){return`${j(t,"error")} Unexpected ${(0,w.magenta)("MessagingClient")} request without target actor: ${(0,w.brightYellow)(e)}`}function tc(t){return`${j(t,"error")} ${(0,w.magenta)("MessagingClient")} connection closed.`}function sc(t,e){return`${j(t,"error")} Target actor ${(0,w.brightYellow)(e)} already has an active request.`}function rc(t,e){return`${j(t,"error")} Error parsing packet: ${(0,w.red)(e)}`}function ic(t,e){return`${j(t,"error")} Message received without a sender actor:
126
+ ${(0,w.brightYellow)(JSON.stringify(e))}`}function nc(t,e){return`${j(t,"error")} Received unexpected message:
127
+ ${(0,w.red)(e)}`}var oc=a(require("progress"));function Ds(t,e){let r=new oc.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 ac(t,e,s){if(Fs.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`)))return e||ie.default.resolve(__dirname,`run-${t}-profile`);let i=JSON.stringify(t==="chrome"?Wa:Ba);return s||Ds(js(t),()=>{let n=ie.default.resolve(__dirname,`run-${t}-profile`),o=ie.default.join(n,"Default");Fs.default.mkdirSync(o,{recursive:!0});let c=ie.default.join(o,"Preferences");Fs.default.writeFileSync(c,i,"utf8")}),ie.default.resolve(__dirname,`run-${t}-profile`)}function cc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],s=ac(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 Pe=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}pc.default.existsSync(s)||(console.error(Cs(e,s)),process.exit());let r=cc(this),i=this.startingUrl?[this.startingUrl,...r]:[...r],n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,lc.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($s(this.browser,r.compilation.options.mode))},2e3),s=!0,i()})}};var Pc=a(require("fs")),kc=require("child_process");var Ve=a(require("fs")),Ls=a(require("path")),fc=a(require("os")),mc=a(require("which")),uc=process.platform==="darwin",ll=process.platform==="win32",fl=!uc&&!ll;function ml(){if(fl)try{return mc.default.sync("firefox")}catch{return null}else if(uc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Ls.default.join(fc.default.homedir(),t.slice(1));return Ve.default.existsSync(t)?t:Ve.default.existsSync(e)?e:null}else{let t=Ls.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=Ls.default.join(r,t);if(Ve.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(Ve.default.existsSync(r))return r;return null}}var Is=ml();var gc=a(require("path")),Os=a(require("fs")),Cr=a(require("firefox-profile"));var ul={"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 dc(t){return{...ul,...t}}function hc(t,e){let s=dc(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 dl(t,e){let s=new Cr.default({destinationDirectory:t});return hc(s,e)}function gl(t,e,s){let r;if(Os.default.statSync(e).isDirectory())r=e;else throw new Error(Ya(t,e));let n=new Cr.default({destinationDirectory:r});return hc(n,s)}function yc(t,e,s,r){let i,n=e||gc.default.resolve(__dirname,"run-firefox-data-dir");return Os.default.existsSync(n)?i=gl(t,n,s||{}):(r||Ds(js(t),()=>{}),Os.default.mkdirSync(n,{recursive:!0}),i=dl(n,s||{})),i}async function bc(t,e){let{browser:s,startingUrl:r,preferences:i,userDataDir:n,browserConsole:o=!1,browserFlags:c=[]}=e,p=yc(s,n,i),l=[];r&&l.push(`--url "${r}"`),o&&l.push("--jsconsole"),c&&l.push(...c);let m=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args "${c.join(" ")}"`,`--profile "${p.path()}"`,`--listen ${m}`,"--verbose"].join(" ")}var Sc=a(require("path"));var wc=a(require("net")),xc=a(require("events"));function hl(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(Ka(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 Ms=class extends xc.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=wc.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(Qa("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(ec("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(tc("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(sc("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}=hl("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(rc("firefox",r))),i&&this.disconnect(),!i):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(ic("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(nc("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function vc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function _c(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var yl=150,bl=1e3,As=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:yl}))try{let i=new Ms;return await i.connect(e),i}catch(i){if(_c("ECONNREFUSED",i))await new Promise(n=>setTimeout(n,bl)),s=i;else throw console.error(Ga(this.options.browser,i.stack)),i}throw console.error(Xa(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=Sc.default.join(p.replace(/"/g,"")),m=c===0&&s;try{let d=await o.request({to:"root",type:"getRoot"});await o.request({to:d.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:m})}catch(d){let g=vc(d);throw new Error(Za(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 Rs=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 "${Is}" --foreground --no-remote`;Pc.default.existsSync(Is)||(console.error(Cs(this.browser,Is)),process.exit());let r=await bc(e,this),i=`${s} ${r}`;ne=(0,kc.exec)(i,(o,c,p)=>{if(o!=null)throw o;p.includes("Unable to move the cache")?console.log(Ja(this.browser)):(console.log(za(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ne.stdout?.pipe(process.stdout),ne.stderr?.pipe(process.stderr));let n=new As(this);try{await n.installAddons(e)}catch(o){o?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Ha(this.browser)),process.exit(1)),console.error(Va(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($s(this.browser,r.compilation.options.mode))},2e3),await this.launchFirefox(e),s=!0,i()})}};var Ns=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"?Dr.default.join(Ec.default.tmpdir(),"extension-js",s,"profile"):Dr.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 Pe({...s,browser:"chrome"}).apply(e);break}case"edge":new Pe({...s,browser:"edge"}).apply(e);break;case"firefox":new Rs({...s,browser:"firefox"}).apply(e);break;default:{new Pe({...s,browser:this.browser}).apply(e);break}}}};function J(t,e){let s=Ge.default.join(t,"manifest.json"),r=Ge.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",Ge.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 rt({manifestPath:s}),new ut({manifestPath:s,mode:e.mode}),new mt({manifestPath:s,mode:e.mode}),new bt({manifestPath:s,mode:e.mode}),process.env.EXTENSION_ENV==="development"&&new Es({manifestPath:s,browser:e.browser}),new _s({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new us({manifestPath:s,browser:e.browser,mode:e.mode}),new bs({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),!e.noOpen&&new Ns({extension:[r,Ge.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 Ze=a(require("path")),rp=a(require("go-git-it"));var Xe=a(require("path")),Ts=a(require("fs")),u=require("@colors/colors/safe");function _(t){return`${t==="warn"?(0,u.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,u.cyan)("\u25BA\u25BA\u25BA"):t==="error"?`${(0,u.bold)((0,u.red)("ERROR"))} in Extension.js ${(0,u.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,u.brightGreen)("\u25BA\u25BA\u25BA")}`}function K(t){return`${_("error")} Manifest file not found.
143
128
 
144
- Please provide a valid directory path.`}function Xa(t){return`${j(t,"error")} Error parsing message length.`}function Za(t){return`${j(t,"error")} MessagingClient connection closed.`}function Ya(t,e){return`${j(t,"error")} Unexpected MessagingClient request without target actor: ${(0,x.brightYellow)(e)}`}function Ka(t){return`${j(t,"error")} MessagingClient connection closed.`}function Qa(t,e){return`${j(t,"error")} Target actor ${(0,x.brightYellow)(e)} already has an active request.`}function ec(t,e){return`${j(t,"error")} Error parsing packet: ${(0,x.red)(e)}`}function tc(t,e){return`${j(t,"error")} Message received without a sender actor: ${(0,x.brightYellow)(JSON.stringify(e))}`}function sc(t,e){return`${j(t,"error")} Received unexpected message: ${(0,x.red)(e)}`}var rc=a(require("progress"));function Cs(t,e){let r=new rc.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 ic(t,e,s){if(Fs.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`)))return e||ie.default.resolve(__dirname,`run-${t}-profile`);let i=JSON.stringify(t==="chrome"?Na:qa);return s||Cs(Ds(t),()=>{let n=ie.default.resolve(__dirname,`run-${t}-profile`),o=ie.default.join(n,"Default");Fs.default.mkdirSync(o,{recursive:!0});let c=ie.default.join(o,"Preferences");Fs.default.writeFileSync(c,i,"utf8")}),ie.default.resolve(__dirname,`run-${t}-profile`)}function nc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],s=ic(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 Pe=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}oc.default.existsSync(s)||(console.error($s(e,s)),process.exit());let r=nc(this),i=this.startingUrl?[this.startingUrl,...r]:[...r],n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,ac.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(js(this.browser,r.compilation.options.mode))},2e3),s=!0,i()})}};var vc=a(require("fs")),_c=require("child_process");var Ve=a(require("fs")),Ls=a(require("path")),cc=a(require("os")),pc=a(require("which")),lc=process.platform==="darwin",ll=process.platform==="win32",fl=!lc&&!ll;function ul(){if(fl)try{return pc.default.sync("firefox")}catch{return null}else if(lc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Ls.default.join(cc.default.homedir(),t.slice(1));return Ve.default.existsSync(t)?t:Ve.default.existsSync(e)?e:null}else{let t=Ls.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=Ls.default.join(r,t);if(Ve.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(Ve.default.existsSync(r))return r;return null}}var Is=ul();var uc=a(require("path")),Os=a(require("fs")),$r=a(require("firefox-profile"));var ml={"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 fc(t){return{...ml,...t}}function mc(t,e){let s=fc(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 dl(t,e){let s=new $r.default({destinationDirectory:t});return mc(s,e)}function gl(t,e,s){let r;if(Os.default.statSync(e).isDirectory())r=e;else throw new Error(Ga(t,e));let n=new $r.default({destinationDirectory:r});return mc(n,s)}function dc(t,e,s,r){let i,n=e||uc.default.resolve(__dirname,"run-firefox-data-dir");return Os.default.existsSync(n)?i=gl(t,n,s||{}):(r||Cs(Ds(t),()=>{}),Os.default.mkdirSync(n,{recursive:!0}),i=dl(n,s||{})),i}async function gc(t,e){let{browser:s,startingUrl:r,preferences:i,userDataDir:n,browserConsole:o=!1,browserFlags:c=[]}=e,p=dc(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 xc=a(require("path"));var hc=a(require("net")),yc=a(require("events"));function hl(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(Xa(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 As=class extends yc.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=hc.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(Za("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(Ya("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(Ka("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(Qa("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}=hl("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(ec("firefox",r))),i&&this.disconnect(),!i):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(tc("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(sc("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function bc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function wc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var yl=150,bl=1e3,Ms=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:yl}))try{let i=new As;return await i.connect(e),i}catch(i){if(wc("ECONNREFUSED",i))await new Promise(n=>setTimeout(n,bl)),s=i;else throw console.error(za(this.options.browser,i.stack)),i}throw console.error(Ha(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=xc.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=bc(d);throw new Error(Va(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 Rs=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 "${Is}" --foreground --no-remote`;vc.default.existsSync(Is)||(console.error($s(this.browser,Is)),process.exit());let r=await gc(e,this),i=`${s} ${r}`;ne=(0,_c.exec)(i,(o,c,p)=>{if(o!=null)throw o;p.includes("Unable to move the cache")?console.log(Ua(this.browser)):(console.log(Wa(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ne.stdout?.pipe(process.stdout),ne.stderr?.pipe(process.stderr));let n=new Ms(this);try{await n.installAddons(e)}catch(o){o?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Ba(this.browser)),process.exit(1)),console.error(Ja(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(js(this.browser,r.compilation.options.mode))},2e3),await this.launchFirefox(e),s=!0,i()})}};var Ts=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"?Dr.default.join(Sc.default.tmpdir(),"extension-js",s,"profile"):Dr.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 Pe({...s,browser:"chrome"}).apply(e);break}case"edge":new Pe({...s,browser:"edge"}).apply(e);break;case"firefox":new Rs({...s,browser:"firefox"}).apply(e);break;default:{new Pe({...s,browser:this.browser}).apply(e);break}}}};function J(t,e){let s=Ge.default.join(t,"manifest.json"),r=Ge.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",Ge.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 rt({manifestPath:s}),new mt({manifestPath:s,mode:e.mode}),new ut({manifestPath:s,mode:e.mode}),new bt({manifestPath:s,mode:e.mode}),process.env.EXTENSION_ENV==="development"&&new Es({manifestPath:s,browser:e.browser}),new _s({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new ms({manifestPath:s,browser:e.browser,mode:e.mode}),new bs({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),!e.noOpen&&new Ts({extension:[r,Ge.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 Ze=a(require("path")),ep=a(require("go-git-it"));var Xe=a(require("path")),Ns=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 qs(t){let e=t==="firefox"?"Add-on":"Extension";return`${S("info")} Building ${oe(t)} ${e} package...`}function Us(t,e){let s=Xe.default.join(t,"dist",e.browser||"chrome"),r=Xe.default.join(s,"manifest.json"),i=require(r),{name:n,version:o,hostPermissions:c,permissions:p}=i,l=Pc(t,i).defaultLocale,u=Pc(t,i).otherLocales.join(", "),d=`${l} ${u&&", "+u}`,g=c&&c.length,y=p&&p.length,$=Js().version;return`
145
- \u{1F9E9} ${(0,m.brightGreen)("Extension.js")} ${(0,m.gray)(`${$}`)}
146
- Extension Name ${(0,m.gray)(n)}
147
- Extension Version ${(0,m.gray)(o)}
148
- Locales ${(0,m.gray)(d)}
149
- Host Permissions ${(0,m.gray)(g?c.join(", "):"Browser defaults")}
150
- Permissions ${(0,m.gray)(y?p.join(", "):"Browser defaults")}
151
- `}function kc(t,e){let s=t==="production"?m.magenta:m.magenta,r=e==="firefox"?"Add-on":"Extension";return`${S("success")} ${oe(e)} ${r} ready for ${s(t||"unknown")}.`}function Ec(t,e,s){let r=e?.toJson(),i=Xe.default.join(t,"manifest.json"),n=JSON.parse(Ns.default.readFileSync(i,"utf8")),o=r?.assets,c=`${S("info")} Building ${(0,m.cyan)(n.name)} extension using ${oe(s)} defaults...
129
+ Ensure the path to your extension exists and try again.
130
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(t)}`}function qs(t){let e=t==="firefox"?"Add-on":"Extension";return`${_("info")} Building ${oe(t)} ${e} package...`}function Us(t,e){let s=Xe.default.join(t,"dist",e.browser||"chrome"),r=Xe.default.join(s,"manifest.json"),i=require(r),{name:n,version:o,hostPermissions:c,permissions:p}=i,l=jc(t,i).defaultLocale,m=jc(t,i).otherLocales.join(", "),d=`${l} ${m&&", "+m}`,g=c&&c.length,y=p&&p.length,$=zs().version;return`
131
+ \u{1F9E9} ${(0,u.brightGreen)("Extension.js")} ${(0,u.gray)(`${$}`)}
132
+ Extension Name ${(0,u.gray)(n)}
133
+ Extension Version ${(0,u.gray)(o)}
134
+ Locales ${(0,u.gray)(d)}
135
+ Host Permissions ${(0,u.gray)(g?c.join(", "):"Browser defaults")}
136
+ Permissions ${(0,u.gray)(y?p.join(", "):"Browser defaults")}
137
+ `}function $c(t,e){let s=t==="production"?u.brightBlue:u.brightBlue,r=e==="firefox"?"Add-on":"Extension";return`${_("success")} ${oe(e)} ${r} ready for ${s(t||"unknown")}.`}function Cc(t,e,s){let r=e?.toJson(),i=Xe.default.join(t,"manifest.json"),n=JSON.parse(Ts.default.readFileSync(i,"utf8")),o=r?.assets,c=`${_("info")} Building ${(0,u.cyan)(n.name)} extension using ${oe(s)} defaults...
152
138
 
153
139
  `,p=`
154
- Build completed in ${((r?.time||0)/1e3).toFixed(2)} seconds.`,l=`Build Target: ${(0,m.gray)(oe(s))}
155
- `,u=`Build Status: ${e?.hasErrors()?(0,m.red)("Failed"):(0,m.brightGreen)("Success")}
140
+ Build completed in ${((r?.time||0)/1e3).toFixed(2)} seconds.`,l=`Build Target: ${(0,u.gray)(oe(s))}
141
+ `,m=`Build Status: ${e?.hasErrors()?(0,u.red)("Failed"):(0,u.brightGreen)("Success")}
156
142
  `,d=`
157
- Version: ${(0,m.gray)(n.version)}
158
- `,g=`Size: ${(0,m.gray)(wl(o))}
159
- `,y="";return y+=c,y+=xl(o),y+=d,y+=g,y+=l,y+=u,y+=p,y}function jc(){return`${S("success")} No errors or warnings found. Your extension is ${(0,m.brightGreen)("ready for deployment")}.`}function $c(t,e){return`${S("info")} Fetching data...
160
-
161
- ${(0,m.gray)("URL")} ${(0,m.underline)(`https://github.com/${t}/${e}`)}`}function Dc(t){return`${S("info")} Downloading ${(0,m.cyan)(t)}...`}function Cc(t){return`
162
- ${S("info")} Creating a new browser extension...
163
-
164
- ${(0,m.gray)("PATH")} ${(0,m.underline)(`${process.cwd()}/${t}`)}`}function Fc(t){return`${S("info")} No ${(0,m.brightYellow)(".gitignore")} found, zipping all the content inside path:
165
-
166
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Lc(t){return`${S("info")} Packaging source files. Files in ${(0,m.brightYellow)(".gitignore")} will be excluded...
167
-
168
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}.`}function Ic(t){return`${S("info")} Packaging extension distribution files...
169
-
170
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Oc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${e}`)}, Target Browser: ${`${oe(t)}`}
171
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${s}`)} (source)
172
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (distribution)`}function Ac(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}.${e}`)}, Target Browser: ${`${oe(s)}`}
173
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} ${(0,m.gray)("(distribution)")}`}function Mc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${oe(s)}`}
174
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (source)`}function Rc(t){return`${S("error")} Failed to compress extension package. ${t}`}function Tc(t){return`${S("info")} ${t.name} (v${t.version}) has no type definitions. Writing...`}function Nc(t){return`${S("error")} Failed to write the extension type definition. ${(0,m.red)(t)}`}function qc(t){return`${S("info")} Downloading extension...
175
- ${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Uc(t){return`${S("info")} Unpackaging browser extension...
176
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Wc(){return`${S("info")} Browser extension unpackaged ${(0,m.brightGreen)("successfully")}. Compiling...`}function Bc(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 Pc(t,e){let s=e.default_locale,r=Xe.default.join(t,"_locales");if(!Ns.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let i=Ns.default.readdirSync(r).filter(n=>n!==s);return{defaultLocale:s,otherLocales:i}}function Jc(t){return`${(t/1024).toFixed(2)}KB`}function wl(t){let e=0;return t?.forEach(s=>{e+=s.size}),Jc(e)}function zc(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?` (${Jc(t[r].size)})`:"";s+=`${(0,m.gray)(e)}${(0,m.gray)(c)} ${r}${(0,m.gray)(p)}
177
- `,typeof t[r]=="object"&&!t[r].size&&(s+=zc(t[r],`${e}${o?" ":(0,m.gray)("\u2502 ")}`))}),s}function xl(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]})}),`.
178
- ${zc(e)}`}function Hc(t){return`${S("info")} is using ${(0,m.magenta)(t)}. ${(0,m.brightYellow)("This is very experimental")}.`}function Vc(t){return`${S("info")} Installing ${(0,m.cyan)(t)} dependencies...`}function Gc(t,e,s){return`Command ${t} ${e.join(" ")} failed with exit code ${s}`}function Xc(t){return`${S("info")} Can't install project dependencies. ${t.message||t.toString()}`}var Ws=a(require("path")),Zc=a(require("axios")),Yc=a(require("adm-zip"));var Cr=a(require("stream")),Kc=require("util"),vl=(0,Kc.promisify)(Cr.default.pipeline);async function Qc(t,e){let s=t.split("?")[0];try{console.log(qc(s));let r=await(0,Zc.default)({url:t,method:"GET",responseType:"stream"}),i=Ws.default.extname(s),n=Ws.default.basename(s,i),o=Ws.default.join(e,n);console.log(Uc(o));let c=[];await vl(r.data,new Cr.default.Writable({write(u,d,g){c.push(u),g()}}));let p=Buffer.concat(c);return new Yc.default(p).extractAllTo(o,!0),console.log(Wc()),o}catch(r){throw console.error(Bc(r)),r}}var _l=t=>{try{return new URL(t),!0}catch{return!1}};async function Sl(t,e){return await(0,ep.default)(t,process.cwd(),e),Ze.default.resolve(process.cwd(),Ze.default.basename(t))}async function Pl(t){return await Qc(t,process.cwd())}async function Q(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 Pl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],i=s.slice(1,3)[1];console.log($c(r,i));let n=Ze.default.basename(e.pathname),o=await Sl(t,Dc(n));return console.log(Cc(n)),o}}return Ze.default.resolve(process.cwd(),t)}var z=a(require("path")),tp=a(require("fs")),sp=a(require("ignore")),rp=a(require("tiny-glob")),Fr=a(require("adm-zip")),ip=a(require("slugify"));function kl(t){try{return tp.default.readFileSync(t,"utf8")}catch{return""}}function El(t){return(0,ip.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function jl(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function $l(t,e){let s=El(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function Dl(t){let e=z.default.join(t,".gitignore"),s=kl(e),r=(0,sp.default)();return s?r.add(s):console.log(Fc(t)),(await(0,rp.default)("**/*",{cwd:t,dot:!0})).filter(n=>!r.ignores(n))}async function np(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=$l(o,s),p=jl(e),l=z.default.join(i,`${c}.${p}`),u=z.default.join(r,`${c}-source.${p}`);if(s.zipSource){console.log(""),console.log(Lc(e));let d=new Fr.default;(await Dl(t)).forEach(y=>{d.addLocalFile(z.default.join(t,y),z.default.dirname(y))}),d.writeZip(u)}if(s.zip){console.log(""),console.log(Ic(l));let d=new Fr.default;d.addLocalFolder(i),d.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log(Oc(e,c,u,l))):s.zip?(console.log(""),console.log(Ac(c,p,e,l))):s.zipSource&&(console.log(""),console.log(Mc(c,p,e,u)))}catch(r){throw console.error(Rc(r)),r}}var Lr=a(require("fs")),Ir=a(require("path"));function ee(t){let e=Ir.default.join(t,"extension.config.js");if(Lr.default.existsSync(e)&&Cl(t)){let s=require(e);if(s&&s!=null&&s&&typeof s.config=="function")return s.config}return s=>s}function Cl(t){let e=Ir.default.join(t,"extension.config.js");return Lr.default.existsSync(e)?(console.log(Hc("extension.config.js")),!0):!1}async function lp(t,e){let s=await Q(t);!t?.startsWith("http")&&!op.default.existsSync(ap.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,pp.merge)(c),l=(0,cp.default)(p);await new Promise((u,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(Ec(s,y,r)),(e?.zip||e?.zipSource)&&await np(s,{...e,browser:r}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(jc()),u())})})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var Mr=a(require("fs")),Rr=a(require("path"));var Ar=a(require("path")),fp=a(require("webpack")),up=a(require("webpack-dev-server")),mp=require("webpack-merge");function Or(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function dp(t,{...e}){let s=J(t,{...e,mode:"development"}),i=ee(t)(s),n=(0,mp.merge)(i),o=(0,fp.default)(n),c={host:"127.0.0.1",allowedHosts:"all",static:Ar.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:ot(t)?void 0:{paths:[Ar.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 up.default(c,o);p.startCallback(l=>{l!=null&&console.log(`Error in the Extension.js runner: ${l.stack||""}`)}),process.on("ERROR",()=>{Or(p)}),process.on("SIGINT",()=>{Or(p)}),process.on("SIGTERM",()=>{Or(p)})}var Bs=a(require("path")),ke=a(require("fs/promises"));async function gp(t){let e=Bs.default.join(t,"extension-env.d.ts"),s=process.env.EXTENSION_ENV==="development"?Bs.default.resolve(process.cwd(),"programs/cli/types"):"./node_modules/extension/dist/types",r=`// Required Extension.js types for TypeScript projects.
143
+ Version: ${(0,u.gray)(n.version)}
144
+ `,g=`Size: ${(0,u.gray)(wl(o))}
145
+ `,y="";return y+=c,y+=xl(o),y+=d,y+=g,y+=l,y+=m,y+=p,y}function Dc(){return`${_("success")} No errors or warnings found. Your extension is ${(0,u.brightGreen)("ready for deployment")}.`}function Fc(t,e){return`${_("info")} Fetching data...
146
+ ${(0,u.gray)("URL")} ${(0,u.underline)(`https://github.com/${t}/${e}`)}`}function Lc(t){return`${_("info")} Downloading ${(0,u.cyan)(t)}...`}function Ic(t){return`
147
+ ${_("info")} Creating a new browser extension...
148
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(`${t}`)}`}function Oc(t){return`${_("info")} No ${(0,u.brightYellow)(".gitignore")} found, zipping all the content inside path:
149
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(t)}`}function Mc(t){return`${_("info")} Packaging source files. Files in ${(0,u.brightYellow)(".gitignore")} will be excluded...
150
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(t)}.`}function Ac(t){return`${_("info")} Packaging extension distribution files...
151
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(t)}`}function Rc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,u.brightYellow)(`${e}`)}, Target Browser: ${`${oe(t)}`}
152
+ ${(0,u.gray)("\u2514\u2500")} ${(0,u.underline)(`${s}`)} (source)
153
+ ${(0,u.gray)("\u2514\u2500")} ${(0,u.underline)(`${r}`)} (distribution)`}function Nc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,u.brightYellow)(`${t}.${e}`)}, Target Browser: ${`${oe(s)}`}
154
+ ${(0,u.gray)("\u2514\u2500")} ${(0,u.underline)(`${r}`)} ${(0,u.gray)("(distribution)")}`}function Tc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,u.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${oe(s)}`}
155
+ ${(0,u.gray)("\u2514\u2500")} ${(0,u.underline)(`${r}`)} (source)`}function qc(t){return`${_("error")} Failed to compress extension package.
156
+ ${(0,u.red)(t)}`}function Uc(t){return`${_("info")} ${t.name} (v${t.version}) has no type definitions. Writing...`}function Wc(t){return`${_("error")} Failed to write the extension type definition.
157
+ ${(0,u.red)(t)}`}function Bc(t){return`${_("info")} Downloading extension...
158
+ ${(0,u.gray)("URL")} ${(0,u.underline)(t)}`}function Jc(t){return`${_("info")} Unpackaging browser extension...
159
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(t)}`}function zc(){return`${_("info")} Browser extension unpackaged ${(0,u.brightGreen)("successfully")}. Compiling...`}function Hc(t){return`${_("error")} Failed to download or extract ZIP file. ${(0,u.red)(t)}`}function oe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function jc(t,e){let s=e.default_locale,r=Xe.default.join(t,"_locales");if(!Ts.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let i=Ts.default.readdirSync(r).filter(n=>n!==s);return{defaultLocale:s,otherLocales:i}}function Vc(t){return`${(t/1024).toFixed(2)}KB`}function wl(t){let e=0;return t?.forEach(s=>{e+=s.size}),Vc(e)}function Gc(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?` (${Vc(t[r].size)})`:"";s+=`${(0,u.gray)(e)}${(0,u.gray)(c)} ${r}${(0,u.gray)(p)}
160
+ `,typeof t[r]=="object"&&!t[r].size&&(s+=Gc(t[r],`${e}${o?" ":(0,u.gray)("\u2502 ")}`))}),s}function xl(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]})}),`.
161
+ ${Gc(e)}`}function Xc(t){return`${_("info")} Using ${(0,u.magenta)(t)}. ${(0,u.brightYellow)("This is very experimental")}.`}function Zc(t){return`${_("info")} Installing ${(0,u.cyan)(t)} dependencies...`}function Yc(t,e,s){return`${_("error")} Command ${t} ${e.join(" ")} failed with exit code ${s}`}function Kc(t){return`${_("error")} Can't install project dependencies. ${(0,u.red)(t.message||t.toString())}`}var Ws=a(require("path")),Qc=a(require("axios")),ep=a(require("adm-zip"));var Fr=a(require("stream")),tp=require("util"),vl=(0,tp.promisify)(Fr.default.pipeline);async function sp(t,e){let s=t.split("?")[0];try{console.log(Bc(s));let r=await(0,Qc.default)({url:t,method:"GET",responseType:"stream"}),i=Ws.default.extname(s),n=Ws.default.basename(s,i),o=Ws.default.join(e,n);console.log(Jc(o));let c=[];await vl(r.data,new Fr.default.Writable({write(m,d,g){c.push(m),g()}}));let p=Buffer.concat(c);return new ep.default(p).extractAllTo(o,!0),console.log(zc()),o}catch(r){throw console.error(Hc(r)),r}}var _l=t=>{try{return new URL(t),!0}catch{return!1}};async function Sl(t,e){return await(0,rp.default)(t,process.cwd(),e),Ze.default.resolve(process.cwd(),Ze.default.basename(t))}async function Pl(t){return await sp(t,process.cwd())}async function Q(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 Pl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],i=s.slice(1,3)[1];console.log(Fc(r,i));let n=Ze.default.basename(e.pathname),o=await Sl(t,Lc(n));return console.log(Ic(n)),o}}return Ze.default.resolve(process.cwd(),t)}var z=a(require("path")),ip=a(require("fs")),np=a(require("ignore")),op=a(require("tiny-glob")),Lr=a(require("adm-zip")),ap=a(require("slugify"));function kl(t){try{return ip.default.readFileSync(t,"utf8")}catch{return""}}function El(t){return(0,ap.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function jl(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function $l(t,e){let s=El(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function Cl(t){let e=z.default.join(t,".gitignore"),s=kl(e),r=(0,np.default)();return s?r.add(s):console.log(Oc(t)),(await(0,op.default)("**/*",{cwd:t,dot:!0})).filter(n=>!r.ignores(n))}async function cp(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=$l(o,s),p=jl(e),l=z.default.join(i,`${c}.${p}`),m=z.default.join(r,`${c}-source.${p}`);if(s.zipSource){console.log(""),console.log(Mc(e));let d=new Lr.default;(await Cl(t)).forEach(y=>{d.addLocalFile(z.default.join(t,y),z.default.dirname(y))}),d.writeZip(m)}if(s.zip){console.log(""),console.log(Ac(l));let d=new Lr.default;d.addLocalFolder(i),d.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log(Rc(e,c,m,l))):s.zip?(console.log(""),console.log(Nc(c,p,e,l))):s.zipSource&&(console.log(""),console.log(Tc(c,p,e,m)))}catch(r){throw console.error(qc(r)),r}}var Ir=a(require("fs")),Or=a(require("path"));function ee(t){let e=Or.default.join(t,"extension.config.js");if(Ir.default.existsSync(e)&&Dl(t)){let s=require(e);if(s&&s!=null&&s&&typeof s.config=="function")return s.config}return s=>s}function Dl(t){let e=Or.default.join(t,"extension.config.js");return Ir.default.existsSync(e)?(console.log(Xc("extension.config.js")),!0):!1}async function mp(t,e){let s=await Q(t);!t?.startsWith("http")&&!pp.default.existsSync(Mr.default.join(s,"manifest.json"))&&(console.log(K(Mr.default.join(s,"manifest.json"))),process.exit(1));try{let r=e?.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(m=>m?.constructor.name!=="plugin-browsers"&&m?.constructor.name!=="plugin-reload"),c=ee(s)({...i,plugins:n}),p=(0,fp.merge)(c),l=(0,lp.default)(p);await new Promise((m,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(Cc(s,y,r)),(e?.zip||e?.zipSource)&&await cp(s,{...e,browser:r}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(Dc()),m())})})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var Nr=a(require("fs")),Js=a(require("path"));var Rr=a(require("path")),up=a(require("webpack")),dp=a(require("webpack-dev-server")),gp=require("webpack-merge");function Ar(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function hp(t,{...e}){let s=J(t,{...e,mode:"development"}),i=ee(t)(s),n=(0,gp.merge)(i),o=(0,up.default)(n),c={host:"127.0.0.1",allowedHosts:"all",static:Rr.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:ot(t)?void 0:{paths:[Rr.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 dp.default(c,o);p.startCallback(l=>{l!=null&&console.log(`Error in the Extension.js runner: ${l.stack||""}`)}),process.on("ERROR",()=>{Ar(p)}),process.on("SIGINT",()=>{Ar(p)}),process.on("SIGTERM",()=>{Ar(p)})}var Bs=a(require("path")),ke=a(require("fs/promises"));async function yp(t){let e=Bs.default.join(t,"extension-env.d.ts"),s=process.env.EXTENSION_ENV==="development"?Bs.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",r=`// Required Extension.js types for TypeScript projects.
179
162
  // This file is auto-generated and should not be excluded.
180
163
  // If you need additional types, consider creating a new *.d.ts file and
181
164
  // referencing it in the "include" array of your tsconfig.json file.
@@ -184,4 +167,4 @@ ${zc(e)}`}function Hc(t){return`${S("info")} is using ${(0,m.magenta)(t)}. ${(0,
184
167
 
185
168
  // Polyfill types for browser.* APIs.
186
169
  /// <reference types="${s}/polyfill.d.ts" />
187
- `;try{await ke.default.access(e),(await ke.default.readFile(e,"utf8")).includes("develop/dist/types")&&await ke.default.writeFile(e,r),process.env.EXTENSION_ENV==="development"&&await ke.default.writeFile(e,r)}catch{let n=require(Bs.default.join(t,"manifest.json"));console.log(Tc(n));try{await ke.default.writeFile(e,r)}catch(o){console.log(Nc(o))}}}var hp=a(require("path")),yp=require("cross-spawn"),bp=a(require("fs")),wp=require("detect-package-manager");async function Fl(){let t=await(0,wp.detect)(),e="npm";if(nt())return"pnpm";switch(t){case"yarn":e="yarn";break;case"pnpm":e="pnpm";break;default:e="npm"}return e}function Ll(){return["install"]}async function xp(t){let e=hp.default.join(t,"node_modules"),s=await Fl(),r=Ll(),i=process.cwd();try{process.chdir(t),await bp.default.promises.mkdir(e,{recursive:!0});let n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,yp.spawn)(s,r,{stdio:n});await new Promise((c,p)=>{o.on("close",l=>{l!==0?p(new Error(Gc(s,r,l))):c()}),o.on("error",l=>{p(l)})})}catch(n){console.error(Xc(n)),process.exit(1)}finally{process.chdir(i)}}async function vp(t,e){let s=await Q(t),r=Rr.default.join(s,"manifest.json");!t?.startsWith("http")&&!Mr.default.existsSync(r)&&(console.log(K()),process.exit(1));try{T(s)&&await gp(s);let i=Rr.default.join(s,"node_modules");if(!Mr.default.existsSync(i)){let n=require(r).name;console.log(Vc(n)),await xp(s)}setTimeout(async()=>{await dp(s,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var _p=a(require("fs")),Sp=a(require("path")),Pp=a(require("webpack")),kp=require("webpack-merge");async function Ep(t,e){let s=await Q(t);!t?.startsWith("http")&&!_p.default.existsSync(Sp.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");console.log(qs(r));let c=ee(s)({...i,plugins:n}),p=(0,kp.merge)(c);(0,Pp.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(Us(s,{browser:r,mode:"production"}))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var jp=a(require("fs")),$p=a(require("path")),Dp=a(require("webpack")),Cp=require("webpack-merge");async function Fp(t,e){let s=await Q(t);!t?.startsWith("http")&&!jp.default.existsSync($p.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-reload");console.log(qs(r));let c=ee(s)({...i,plugins:n}),p=(0,Cp.merge)(c);(0,Dp.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(Us(s,e)),setTimeout(()=>{console.log(kc("production",r))},1500))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
170
+ `;try{await ke.default.access(e),(await ke.default.readFile(e,"utf8")).includes("develop/dist/types")&&await ke.default.writeFile(e,r),process.env.EXTENSION_ENV==="development"&&await ke.default.writeFile(e,r)}catch{let n=require(Bs.default.join(t,"manifest.json"));console.log(Uc(n));try{await ke.default.writeFile(e,r)}catch(o){console.log(Wc(o))}}}var bp=a(require("path")),wp=require("cross-spawn"),xp=a(require("fs")),vp=require("detect-package-manager");async function Fl(){let t=await(0,vp.detect)(),e="npm";if(nt())return"pnpm";switch(t){case"yarn":e="yarn";break;case"pnpm":e="pnpm";break;default:e="npm"}return e}function Ll(){return["install"]}async function _p(t){let e=bp.default.join(t,"node_modules"),s=await Fl(),r=Ll(),i=process.cwd();try{process.chdir(t),await xp.default.promises.mkdir(e,{recursive:!0});let n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,wp.spawn)(s,r,{stdio:n});await new Promise((c,p)=>{o.on("close",l=>{l!==0?p(new Error(Yc(s,r,l))):c()}),o.on("error",l=>{p(l)})})}catch(n){console.error(Kc(n)),process.exit(1)}finally{process.chdir(i)}}async function Sp(t,e){let s=await Q(t),r=Js.default.join(s,"manifest.json");!t?.startsWith("http")&&!Nr.default.existsSync(r)&&(console.log(K(Js.default.join(s,"manifest.json"))),process.exit(1));try{N(s)&&await yp(s);let i=Js.default.join(s,"node_modules");if(!Nr.default.existsSync(i)){let n=require(r).name;console.log(Zc(n)),await _p(s)}setTimeout(async()=>{await hp(s,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var Pp=a(require("fs")),Tr=a(require("path")),kp=a(require("webpack")),Ep=require("webpack-merge");async function jp(t,e){let s=await Q(t);!t?.startsWith("http")&&!Pp.default.existsSync(Tr.default.join(s,"manifest.json"))&&(console.log(K(Tr.default.join(s,"manifest.json"))),process.exit(1));try{let r=e.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(m=>m?.constructor.name==="plugin-browsers");console.log(qs(r));let c=ee(s)({...i,plugins:n}),p=(0,Ep.merge)(c);(0,kp.default)(p).run(async(m,d)=>{m&&(console.error(m.stack||m),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):console.log(Us(s,{browser:r,mode:"production"}))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var $p=a(require("fs")),qr=a(require("path")),Cp=a(require("webpack")),Dp=require("webpack-merge");async function Fp(t,e){let s=await Q(t);!t?.startsWith("http")&&!$p.default.existsSync(qr.default.join(s,"manifest.json"))&&(console.log(K(qr.default.join(s,"manifest.json"))),process.exit(1));try{let r=e.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(m=>m?.constructor.name!=="plugin-reload");console.log(qs(r));let c=ee(s)({...i,plugins:n}),p=(0,Dp.merge)(c);(0,Cp.default)(p).run((m,d)=>{m&&(console.error(m.stack||m),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):(console.log(Us(s,e)),setTimeout(()=>{console.log($c("production",r))},1500))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of a(e))!g.call(r,n)&&n!==t&&p(r,n,{get:()=>e[n],enumerable:!(s=l(e,n))||s.enumerable});return r};var v=r=>y(p({},"__esModule",{value:!0}),r);var U={};d(U,{default:()=>R});module.exports=v(U);var c={resolverNotFoundError(){console.error('Could not resolve file path. Ensure the file exists in the "public" or "pages" directory.')},resolverHtmlError:r=>(console.error(`Could not resolve path ${r}. Either add it to the "public" directory or create a page in the "pages" directory.`),r),resolverJsError:r=>`Could not resolve path ${r}. Either add it to the "public" directory or create a script in the "scripts" directory.`,resolverStaticError:r=>`Could not resolve path ${r}. If you want to preserve this file path, add the file to the "public" directory.`};function u(r){let e=r.split("/"),t=[];for(let s of e)s===".."||s==="."||s!==""&&t.push(s);return t.join("/")}function h(r){return r?.endsWith(".html")?(console.error(c.resolverHtmlError(r)),r):r?.endsWith(".js")?(console.error(c.resolverJsError(r)),r):(r&&console.error(c.resolverStaticError(r)),r)}var E={data:"__RESOLVER_MODULE_FILE_LIST__"};function o(r){if(!r)return c.resolverNotFoundError(),"";if(r?.startsWith("http")||r?.startsWith("chrome://")||r?.startsWith("about:"))return r;if(r?.startsWith("chrome-extension://")){let s=chrome.runtime.getURL("");if(r.startsWith(s)){let n=r.replace(s,"");return chrome.runtime.getURL(o(n))}return r}if(r?.startsWith("/_favicon"))return r;let e=Object.entries(E.data).find(([s,n])=>{let i=u(r);return n===i||n===`pages/${i}`||n===`scripts/${i}`?s:!1}),t=u(r);return t.includes("public/")?"/"+t:e&&e.length?e[0]:(r!=="/"&&h(r),r)}function f(r){if(typeof r=="string")return o(r);let e=t=>({...t,...t?.path&&{path:typeof t.path=="string"?o(t.path):Object.entries(t.path).reduce((s,[n,i])=>(s[n]=o(i),s),{})},...t?.popup&&{popup:o(t.popup)},...t?.url&&{url:Array.isArray(t?.url)?t?.url.map(s=>o(s)):o(t?.url)},...t?.iconUrl&&{iconUrl:o(t.iconUrl)},...t?.files&&{files:t.files.map(s=>o(s))},...t?.js&&{js:Array.isArray(t.js)?t.js.map(s=>o(s)):t.js},...t?.css&&{css:Array.isArray(t.css)?t.css.map(s=>o(s)):t.css}});return Array.isArray(r)?r.map(t=>e(t)):{...e(r||{})}}var m={solve:f},R=m;
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of a(e))!g.call(r,n)&&n!==t&&p(r,n,{get:()=>e[n],enumerable:!(s=l(e,n))||s.enumerable});return r};var v=r=>y(p({},"__esModule",{value:!0}),r);var U={};d(U,{default:()=>R});module.exports=v(U);var c={resolverNotFoundError(){console.error('Could not resolve file path. Ensure the file exists in the "public" or "pages" directory.')},resolverHtmlError:r=>(console.error(`Could not resolve path ${r}. Either add it to the "public" directory or create a page in the "pages" directory.`),r),resolverJsError:r=>`Could not resolve path ${r}. Either add it to the "public" directory or create a script in the "scripts" directory.`,resolverStaticError:r=>`Could not resolve path ${r}. If you want to preserve this file path, add the file to the "public" directory.`};function u(r){let e=r.split("/"),t=[];for(let s of e)s===".."||s==="."||s!==""&&t.push(s);return t.join("/")}function h(r){return r?.endsWith(".html")?(console.error(c.resolverHtmlError(r)),r):r?.endsWith(".js")?(console.error(c.resolverJsError(r)),r):(r&&console.error(c.resolverStaticError(r)),r)}var E={data:{"pages/index":"pages/index.html","scripts/content-script":"scripts/content-script.js"}};function o(r){if(!r)return c.resolverNotFoundError(),"";if(r?.startsWith("http")||r?.startsWith("chrome://")||r?.startsWith("about:"))return r;if(r?.startsWith("chrome-extension://")){let s=chrome.runtime.getURL("");if(r.startsWith(s)){let n=r.replace(s,"");return chrome.runtime.getURL(o(n))}return r}if(r?.startsWith("/_favicon"))return r;let e=Object.entries(E.data).find(([s,n])=>{let i=u(r);return n===i||n===`pages/${i}`||n===`scripts/${i}`?s:!1}),t=u(r);return t.includes("public/")?"/"+t:e&&e.length?e[0]:(r!=="/"&&h(r),r)}function f(r){if(typeof r=="string")return o(r);let e=t=>({...t,...t?.path&&{path:typeof t.path=="string"?o(t.path):Object.entries(t.path).reduce((s,[n,i])=>(s[n]=o(i),s),{})},...t?.popup&&{popup:o(t.popup)},...t?.url&&{url:Array.isArray(t?.url)?t?.url.map(s=>o(s)):o(t?.url)},...t?.iconUrl&&{iconUrl:o(t.iconUrl)},...t?.files&&{files:t.files.map(s=>o(s))},...t?.js&&{js:Array.isArray(t.js)?t.js.map(s=>o(s)):t.js},...t?.css&&{css:Array.isArray(t.css)?t.css.map(s=>o(s)):t.css}});return Array.isArray(r)?r.map(t=>e(t)):{...e(r||{})}}var m={solve:f},R=m;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=18"
10
10
  },
11
11
  "name": "extension-develop",
12
- "version": "2.0.0-alpha.21",
12
+ "version": "2.0.0-alpha.23",
13
13
  "description": "The develop step of Extension.js",
14
14
  "main": "./dist/module.js",
15
15
  "types": "./dist/module.d.ts",