UNPKG

code-server

Version:

Run VS Code on a remote server.

214 lines • 1.06 MB
"use strict";var kG=Object.create;var tf=Object.defineProperty;var Fk=Object.getOwnPropertyDescriptor;var RG=Object.getOwnPropertyNames;var AG=Object.getPrototypeOf,DG=Object.prototype.hasOwnProperty;var ri=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var P=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},ex=(t,e)=>{for(var r in e)tf(t,r,{get:e[r],enumerable:!0})},Uk=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of RG(e))!DG.call(t,i)&&i!==r&&tf(t,i,{get:()=>e[i],enumerable:!(n=Fk(e,i))||n.enumerable});return t};var v=(t,e,r)=>(r=t!=null?kG(AG(t)):{},Uk(e||!t||!t.__esModule?tf(r,"default",{value:t,enumerable:!0}):r,t)),tx=t=>Uk(tf({},"__esModule",{value:!0}),t),I=(t,e,r,n)=>{for(var i=n>1?void 0:n?Fk(e,r):e,o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=(n?s(e,r,i):s(i))||i);return n&&i&&tf(e,r,i),i},g=(t,e)=>(r,n)=>e(r,n,t);var ge=P((_pe,qk)=>{"use strict";var rx=Object.defineProperty,OG=Object.getOwnPropertyDescriptor,LG=Object.getOwnPropertyNames,NG=Object.prototype.hasOwnProperty,MG=(t,e)=>{for(var r in e)rx(t,r,{get:e[r],enumerable:!0})},BG=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of LG(e))!NG.call(t,i)&&i!==r&&rx(t,i,{get:()=>e[i],enumerable:!(n=OG(e,i))||n.enumerable});return t},FG=t=>BG(rx({},"__esModule",{value:!0}),t),Wk={};MG(Wk,{config:()=>qG,t:()=>Hk});qk.exports=FG(Wk);var UG=require("fs"),jG=require("fs/promises");async function WG(t){if(t.protocol==="file:")return await(0,jG.readFile)(t,"utf8");if(t.protocol==="http:"||t.protocol==="https:"){let e=await fetch(t.toString(),{headers:{"Accept-Encoding":"gzip, deflate",Accept:"application/json"},redirect:"follow"});if(!e.ok){let n=`Unexpected ${e.status} response while trying to read ${t}`;try{n+=`: ${await e.text()}`}catch{}throw new Error(n)}return await e.text()}throw new Error("Unsupported protocol")}function HG(t){return(0,UG.readFileSync)(t,"utf8")}var rf;function qG(t){if("contents"in t){typeof t.contents=="string"?rf=JSON.parse(t.contents):rf=t.contents;return}if("fsPath"in t){let e=HG(t.fsPath),r=JSON.parse(e);rf=jk(r)?r.contents.bundle:r;return}if(t.uri){let e=t.uri;return typeof t.uri=="string"&&(e=new URL(t.uri)),new Promise((r,n)=>{WG(e).then(i=>{try{let o=JSON.parse(i);rf=jk(o)?o.contents.bundle:o,r()}catch(o){n(o)}}).catch(i=>{n(i)})})}}function Hk(...t){let e=t[0],r,n,i;if(typeof e=="string")r=e,n=e,t.splice(0,1),i=!t||typeof t[0]!="object"?t:t[0];else if(e instanceof Array){let s=t.slice(1);if(e.length!==s.length+1)throw new Error("expected a string as the first argument to l10n.t");let a=e[0];for(let c=1;c<e.length;c++)a+=`{${c-1}}`+e[c];return Hk(a,...s)}else n=e.message,r=n,e.comment&&e.comment.length>0&&(r+=`/${Array.isArray(e.comment)?e.comment.join(""):e.comment}`),i=e.args??{};let o=rf?.[r];return o?typeof o=="string"?qm(o,i):o.comment?qm(o.message,i):qm(n,i):qm(n,i)}var $G=/{([^}]+)}/g;function qm(t,e){return Object.keys(e).length===0?t:t.replace($G,(r,n)=>e[n]??r)}function jk(t){return typeof t?.contents?.bundle=="object"&&typeof t?.version=="string"}});var Do=P(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.findWindowsCandidates=dr.sort=dr.preferredEdgePath=dr.preferredFirefoxPath=dr.preferredChromePath=dr.escapeRegexSpecialChars=dr.canAccess=void 0;var t4=require("path");async function uf({access:t},e){if(!e)return!1;try{return await t(e),!0}catch{return!1}}dr.canAccess=uf;var r4="/\\.?*()^${}|[]+";function n4(t,e){let r=r4.split("").filter(i=>!e||e.indexOf(i)<0).join("").replace(/[\\\]]/g,"\\$&"),n=new RegExp(`[${r}]`,"g");return t.replace(n,"\\$&")}dr.escapeRegexSpecialChars=n4;async function i4(t,e){if(await uf(t,e.CHROME_PATH))return e.CHROME_PATH}dr.preferredChromePath=i4;async function o4(t,e){if(await uf(t,e.FIREFOX_PATH))return e.FIREFOX_PATH}dr.preferredFirefoxPath=o4;async function s4(t,e){if(await uf(t,e.EDGE_PATH))return e.EDGE_PATH}dr.preferredEdgePath=s4;function a4(t,e){return[...t].filter(n=>!!n).map(n=>{let i=e.find(o=>o.regex.test(n));return i?{path:n,weight:i.weight,quality:i.quality}:{path:n,weight:10,quality:"dev"}}).sort((n,i)=>i.weight-n.weight).map(n=>({path:n.path,quality:n.quality}))}dr.sort=a4;async function c4(t,e,r){let n=[t.LOCALAPPDATA,t.PROGRAMFILES,t["PROGRAMFILES(X86)"]].filter(o=>!!o),i=[];for(let o of n)for(let s of r){let a=t4.win32.join(o,s.name);i.push(uf(e,a).then(c=>c?{path:a,quality:s.type}:void 0))}return(await Promise.all(i)).filter(o=>!!o)}dr.findWindowsCandidates=c4});var rg=P(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});tg.DarwinFinderBase=void 0;var u4=require("path"),l4=require("fs"),mx=Do(),tR=/( \(0x[a-f0-9]+\))/,gx=class{constructor(e=process.env,r=l4.promises,n=n){this.env=e,this.fs=r,this.execa=n,this.lsRegisterCommand="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump",this.wellKnownPaths=[]}async findWhere(e){for(let r of this.wellKnownPaths)if(e(r)&&await(0,mx.canAccess)(this.fs,r.path))return r;return(await this.findAll()).find(e)}findAll(){var e;return(e=this.foundAll)!==null&&e!==void 0||(this.foundAll=this.findAllInner()),this.foundAll}async findLaunchRegisteredApps(e,r,n){let{stdout:i}=await this.execa.command(`${this.lsRegisterCommand} | awk 'tolower($0) ~ /${e.toLowerCase()}${tR.source}?$/ { $1=""; print $0 }'`,{shell:!0,stdio:"pipe"}),o=[...r,...i.split(`
`).map(c=>c.trim().replace(tR,""))].filter(c=>!!c),s=this.getPreferredPath();s&&o.push(s);let a=new Set;for(let c of o)for(let u of n){let l=u4.posix.join(c.trim(),u);try{await this.fs.access(l),a.add(l)}catch{}}return a}createPriorities(e){let r=this.env.HOME&&(0,mx.escapeRegexSpecialChars)(this.env.HOME),n=this.getPreferredPath(),i=e.reduce((o,s)=>[...o,{regex:new RegExp(`^/Applications/.*${s.name}`),weight:s.weight+100,quality:s.quality},{regex:new RegExp(`^${r}/Applications/.*${s.name}`),weight:s.weight,quality:s.quality},{regex:new RegExp(`^/Volumes/.*${s.name}`),weight:s.weight-100,quality:s.quality}],[]);return n&&i.unshift({regex:new RegExp((0,mx.escapeRegexSpecialChars)(n)),weight:151,quality:"custom"}),i}};tg.DarwinFinderBase=gx});var rR=P(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});ng.DarwinChromeBrowserFinder=void 0;var p4=Do(),d4=rg(),yx=class extends d4.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",quality:"stable"},{path:"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",quality:"canary"},{path:"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta",quality:"beta"},{path:"/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev",quality:"dev"}]}async findAllInner(){let e=["/Contents/MacOS/Google Chrome Canary","/Contents/MacOS/Google Chrome Beta","/Contents/MacOS/Google Chrome Dev","/Contents/MacOS/Google Chrome"],r=["/Applications/Google Chrome.app","/Applications/Google Chrome Canary.app"],n=await this.findLaunchRegisteredApps("google chrome[A-Za-z() ]*.app",r,e);return(0,p4.sort)(n,this.createPriorities([{name:"Chrome.app",weight:0,quality:"stable"},{name:"Chrome Canary.app",weight:1,quality:"canary"},{name:"Chrome Beta.app",weight:2,quality:"beta"},{name:"Chrome Dev.app",weight:3,quality:"dev"}]))}getPreferredPath(){return this.env.CHROME_PATH}};ng.DarwinChromeBrowserFinder=yx});var nR=P(ig=>{"use strict";Object.defineProperty(ig,"__esModule",{value:!0});ig.DarwinEdgeBrowserFinder=void 0;var f4=Do(),h4=rg(),bx=class extends h4.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",quality:"stable"},{path:"/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary",quality:"canary"},{path:"/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta",quality:"beta"},{path:"/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev",quality:"dev"}]}async findAllInner(){let e=["/Contents/MacOS/Microsoft Edge Canary","/Contents/MacOS/Microsoft Edge Beta","/Contents/MacOS/Microsoft Edge Dev","/Contents/MacOS/Microsoft Edge"],r=["/Applications/Microsoft Edge.app"],n=await this.findLaunchRegisteredApps("Microsoft Edge[A-Za-z ]*.app",r,e);return(0,f4.sort)(n,this.createPriorities([{name:"Microsoft Edge.app",weight:0,quality:"stable"},{name:"Microsoft Edge Canary.app",weight:1,quality:"canary"},{name:"Microsoft Edge Beta.app",weight:2,quality:"beta"},{name:"Microsoft Edge Dev.app",weight:3,quality:"dev"}]))}getPreferredPath(){return this.env.EDGE_PATH}};ig.DarwinEdgeBrowserFinder=bx});var iR=P(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.DarwinFirefoxBrowserFinder=void 0;var m4=Do(),g4=rg(),vx=class extends g4.DarwinFinderBase{constructor(){super(...arguments),this.wellKnownPaths=[{path:"/Applications/Firefox.app/Contents/MacOS/firefox",quality:"stable"},{path:"/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox",quality:"dev"},{path:"/Applications/Firefox Nightly.app/Contents/MacOS/firefox",quality:"canary"}]}async findAllInner(){let e=["/Contents/MacOS/firefox"],r=["/Applications/Firefox.app"],n=await this.findLaunchRegisteredApps("Firefox[A-Za-z ]*.app",r,e);return(0,m4.sort)(n,this.createPriorities([{name:"Firefox.app",weight:0,quality:"stable"},{name:"Firefox Nightly.app",weight:1,quality:"canary"},{name:"Firefox Developer Edition.app",weight:2,quality:"dev"}]))}getPreferredPath(){return this.env.FIREFOX_PATH}};og.DarwinFirefoxBrowserFinder=vx});var ag=P(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});sg.LinuxChromeBrowserFinder=void 0;var y4=require("path"),Iu=Do(),wx=require("child_process"),b4=require("os"),v4=require("fs"),oR=/\r?\n/,Sx=class{constructor(e=process.env,r=v4.promises){this.env=e,this.fs=r,this.pathEnvironmentVar="CHROME_PATH",this.priorities=[{regex:/chrome-wrapper$/,weight:54,quality:"custom"},{regex:/google-chrome-dev$/,weight:53,quality:"dev"},{regex:/google-chrome-canary$/,weight:52,quality:"canary"},{regex:/google-chrome-unstable$/,weight:51,quality:"canary"},{regex:/google-chrome-canary$/,weight:51,quality:"canary"},{regex:/google-chrome-stable$/,weight:50,quality:"stable"},{regex:/(google-)?chrome$/,weight:49,quality:"stable"},{regex:/chromium-browser$/,weight:48,quality:"custom"},{regex:/chromium$/,weight:47,quality:"custom"}],this.executablesOnPath=["google-chrome-unstable","google-chrome-dev","google-chrome-beta","google-chrome-canary","google-chrome-stable","google-chrome","chromium-browser","chromium"]}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){let e=new Set,r=this.env[this.pathEnvironmentVar];r&&await(0,Iu.canAccess)(this.fs,r)&&e.add(r),[y4.posix.join((0,b4.homedir)(),".local/share/applications/"),"/usr/share/applications/","/usr/bin","/opt/google"].forEach(s=>{for(let a in this.findChromeExecutables(s))e.add(a)}),await Promise.all(this.executablesOnPath.map(async s=>{try{let a=(0,wx.execFileSync)("which",[s],{stdio:"pipe"}).toString().split(oR)[0];await(0,Iu.canAccess)(this.fs,a)&&e.add(a)}catch{}}));let o=r?[{regex:new RegExp((0,Iu.escapeRegexSpecialChars)(r)),weight:101,quality:"custom"}].concat(this.priorities):this.priorities;return(0,Iu.sort)(e,o)}async findChromeExecutables(e){let r=/(^[^ ]+).*/,n=`^Exec=/.*/(${this.executablesOnPath.join("|")})-.*`,i=[];if(await(0,Iu.canAccess)(this.fs,e)){let o;try{o=(0,wx.execSync)(`grep -ERI "${n}" ${e} | awk -F '=' '{print $2}'`)}catch{o=(0,wx.execSync)(`grep -Er "${n}" ${e} | awk -F '=' '{print $2}'`)}let s=o.toString().split(oR).map(a=>a.replace(r,"$1"));await Promise.all(s.map(async a=>{await(0,Iu.canAccess)(this.fs,a)&&i.push(a)}))}return i}};sg.LinuxChromeBrowserFinder=Sx});var sR=P(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.LinuxEdgeBrowserFinder=void 0;var w4=ag(),_x=class extends w4.LinuxChromeBrowserFinder{constructor(){super(...arguments),this.pathEnvironmentVar="EDGE_PATH",this.executablesOnPath=["microsoft-edge-dev","microsoft-edge-beta","microsoft-edge-stable","microsoft-edge"],this.priorities=[{regex:/microsoft-edge\-wrapper$/,weight:52,quality:"custom"},{regex:/microsoft-edge\-dev$/,weight:51,quality:"dev"},{regex:/microsoft-edge\-beta$/,weight:51,quality:"beta"},{regex:/microsoft-edge\-stable$/,weight:50,quality:"stable"},{regex:/microsoft-edge$/,weight:49,quality:"stable"}]}};cg.LinuxEdgeBrowserFinder=_x});var aR=P(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.LinuxFirefoxBrowserFinder=void 0;var S4=ag(),xx=class extends S4.LinuxChromeBrowserFinder{constructor(){super(...arguments),this.pathEnvironmentVar="FIREFOX_PATH",this.executablesOnPath=["firefox-aurora","firefox-dev","firefox-developer","firefox-trunk","firefox-nightly","firefox"],this.priorities=[{regex:/firefox\-aurora$/,weight:51,quality:"dev"},{regex:/firefox\-dev$/,weight:51,quality:"dev"},{regex:/firefox\-developer$/,weight:51,quality:"dev"},{regex:/firefox\-trunk'$/,weight:50,quality:"canary"},{regex:/firefox\-nightly'$/,weight:50,quality:"canary"},{regex:/firefox$/,weight:49,quality:"stable"}]}};ug.LinuxFirefoxBrowserFinder=xx});var uR=P(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});lg.WindowsChromeBrowserFinder=void 0;var _4=require("path"),cR=Do(),x4=require("fs"),Ix=class{constructor(e=process.env,r=x4.promises){this.env=e,this.fs=r}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){let e=_4.win32.sep,r=[{name:`${e}Google${e}Chrome Dev${e}Application${e}chrome.exe`,type:"dev"},{name:`${e}Google${e}Chrome SxS${e}Application${e}chrome.exe`,type:"canary"},{name:`${e}Google${e}Chrome Beta${e}Application${e}chrome.exe`,type:"beta"},{name:`${e}Google${e}Chrome${e}Application${e}chrome.exe`,type:"stable"}],n=await(0,cR.findWindowsCandidates)(this.env,this.fs,r),i=await(0,cR.preferredChromePath)(this.fs,this.env);return i&&n.unshift({path:i,quality:"custom"}),n}};lg.WindowsChromeBrowserFinder=Ix});var pR=P(pg=>{"use strict";Object.defineProperty(pg,"__esModule",{value:!0});pg.WindowsEdgeBrowserFinder=void 0;var fr=require("path"),I4=require("fs"),lR=Do(),Cx=class{constructor(e=process.env,r=I4.promises){this.env=e,this.fs=r}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){let e=[{name:`${fr.sep}Microsoft${fr.sep}Edge SxS${fr.sep}Application${fr.sep}msedge.exe`,type:"canary"},{name:`${fr.sep}Microsoft${fr.sep}Edge Dev${fr.sep}Application${fr.sep}msedge.exe`,type:"dev"},{name:`${fr.sep}Microsoft${fr.sep}Edge Beta${fr.sep}Application${fr.sep}msedge.exe`,type:"beta"},{name:`${fr.sep}Microsoft${fr.sep}Edge${fr.sep}Application${fr.sep}msedge.exe`,type:"stable"}],r=await(0,lR.findWindowsCandidates)(this.env,this.fs,e),n=await(0,lR.preferredEdgePath)(this.fs,this.env);return n&&r.unshift({path:n,quality:"custom"}),r}};pg.WindowsEdgeBrowserFinder=Cx});var fR=P(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});dg.WindowsFirefoxBrowserFinder=void 0;var C4=require("path"),dR=Do(),T4=require("fs"),Tx=class{constructor(e=process.env,r=T4.promises){this.env=e,this.fs=r}async findWhere(e){return(await this.findAll()).find(e)}async findAll(){let e=C4.win32.sep,r=[{name:`${e}Firefox Developer Edition${e}firefox.exe`,type:"dev"},{name:`${e}Firefox Nightly${e}firefox.exe`,type:"canary"},{name:`${e}Mozilla Firefox${e}firefox.exe`,type:"stable"}],n=await(0,dR.findWindowsCandidates)(this.env,this.fs,r),i=await(0,dR.preferredFirefoxPath)(this.fs,this.env);return i&&n.unshift({path:i,quality:"custom"}),n}};dg.WindowsFirefoxBrowserFinder=Tx});var Px=P(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.FirefoxBrowserFinder=rn.EdgeBrowserFinder=rn.ChromeBrowserFinder=rn.isQuality=rn.allQualities=void 0;var P4=rR(),E4=nR(),k4=iR(),R4=ag(),A4=sR(),D4=aR(),O4=uR(),L4=pR(),N4=fR(),M4={canary:null,stable:null,beta:null,dev:null,custom:null};rn.allQualities=new Set(Object.keys(M4));var B4=t=>rn.allQualities.has(t);rn.isQuality=B4;rn.ChromeBrowserFinder=process.platform==="win32"?O4.WindowsChromeBrowserFinder:process.platform==="darwin"?P4.DarwinChromeBrowserFinder:R4.LinuxChromeBrowserFinder;rn.EdgeBrowserFinder=process.platform==="win32"?L4.WindowsEdgeBrowserFinder:process.platform==="darwin"?E4.DarwinEdgeBrowserFinder:A4.LinuxEdgeBrowserFinder;rn.FirefoxBrowserFinder=process.platform==="win32"?N4.WindowsFirefoxBrowserFinder:process.platform==="darwin"?k4.DarwinFirefoxBrowserFinder:D4.LinuxFirefoxBrowserFinder});var bR=P((qpe,yR)=>{yR.exports=gR;gR.sync=U4;var hR=require("fs");function F4(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function mR(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:F4(e,r)}function gR(t,e,r){hR.stat(t,function(n,i){r(n,n?!1:mR(i,t,e))})}function U4(t,e){return mR(hR.statSync(t),t,e)}});var xR=P(($pe,_R)=>{_R.exports=wR;wR.sync=j4;var vR=require("fs");function wR(t,e,r){vR.stat(t,function(n,i){r(n,n?!1:SR(i,e))})}function j4(t,e){return SR(vR.statSync(t),e)}function SR(t,e){return t.isFile()&&W4(t,e)}function W4(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,p=r&u||r&c&&i===s||r&a&&n===o||r&l&&o===0;return p}});var CR=P((Gpe,IR)=>{var Vpe=require("fs"),fg;process.platform==="win32"||global.TESTING_WINDOWS?fg=bR():fg=xR();IR.exports=Ex;Ex.sync=H4;function Ex(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Ex(t,e||{},function(o,s){o?i(o):n(s)})})}fg(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function H4(t,e){try{return fg.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var DR=P((zpe,AR)=>{var Cu=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",TR=require("path"),q4=Cu?";":":",PR=CR(),ER=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),kR=(t,e)=>{let r=e.colon||q4,n=t.match(/\//)||Cu&&t.match(/\\/)?[""]:[...Cu?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Cu?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Cu?i.split(r):[""];return Cu&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},RR=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=kR(t,e),s=[],a=u=>new Promise((l,p)=>{if(u===n.length)return e.all&&s.length?l(s):p(ER(t));let d=n[u],f=/^".*"$/.test(d)?d.slice(1,-1):d,h=TR.join(f,t),m=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;l(c(m,u,0))}),c=(u,l,p)=>new Promise((d,f)=>{if(p===i.length)return d(a(l+1));let h=i[p];PR(u+h,{pathExt:o},(m,x)=>{if(!m&&x)if(e.all)s.push(u+h);else return d(u+h);return d(c(u,l,p+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},$4=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=kR(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=TR.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let p=0;p<n.length;p++){let d=l+n[p];try{if(PR.sync(d,{pathExt:i}))if(e.all)o.push(d);else return d}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw ER(t)};AR.exports=RR;RR.sync=$4});var Rx=P((Kpe,kx)=>{"use strict";var OR=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};kx.exports=OR;kx.exports.default=OR});var BR=P((Jpe,MR)=>{"use strict";var LR=require("path"),V4=DR(),G4=Rx();function NR(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=V4.sync(t.command,{path:r[G4({env:r})],pathExt:e?LR.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=LR.resolve(i?t.options.cwd:"",s)),s}function z4(t){return NR(t)||NR(t,!0)}MR.exports=z4});var FR=P((Xpe,Dx)=>{"use strict";var Ax=/([()\][%!^"`<>&|;, *?])/g;function K4(t){return t=t.replace(Ax,"^$1"),t}function J4(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Ax,"^$1"),e&&(t=t.replace(Ax,"^$1")),t}Dx.exports.command=K4;Dx.exports.argument=J4});var jR=P((Ype,UR)=>{"use strict";UR.exports=/^#!(.*)/});var HR=P((Qpe,WR)=>{"use strict";var X4=jR();WR.exports=(t="")=>{let e=t.match(X4);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var $R=P((Zpe,qR)=>{"use strict";var Ox=require("fs"),Y4=HR();function Q4(t){let r=Buffer.alloc(150),n;try{n=Ox.openSync(t,"r"),Ox.readSync(n,r,0,150,0),Ox.closeSync(n)}catch{}return Y4(r.toString())}qR.exports=Q4});var KR=P((ede,zR)=>{"use strict";var Z4=require("path"),VR=BR(),GR=FR(),e6=$R(),t6=process.platform==="win32",r6=/\.(?:com|exe)$/i,n6=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function i6(t){t.file=VR(t);let e=t.file&&e6(t.file);return e?(t.args.unshift(t.file),t.command=e,VR(t)):t.file}function o6(t){if(!t6)return t;let e=i6(t),r=!r6.test(e);if(t.options.forceShell||r){let n=n6.test(e);t.command=Z4.normalize(t.command),t.command=GR.command(t.command),t.args=t.args.map(o=>GR.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function s6(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:o6(n)}zR.exports=s6});var YR=P((tde,XR)=>{"use strict";var Lx=process.platform==="win32";function Nx(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function a6(t,e){if(!Lx)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=JR(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function JR(t,e){return Lx&&t===1&&!e.file?Nx(e.original,"spawn"):null}function c6(t,e){return Lx&&t===1&&!e.file?Nx(e.original,"spawnSync"):null}XR.exports={hookChildProcess:a6,verifyENOENT:JR,verifyENOENTSync:c6,notFoundError:Nx}});var eA=P((rde,Tu)=>{"use strict";var QR=require("child_process"),Mx=KR(),Bx=YR();function ZR(t,e,r){let n=Mx(t,e,r),i=QR.spawn(n.command,n.args,n.options);return Bx.hookChildProcess(i,n),i}function u6(t,e,r){let n=Mx(t,e,r),i=QR.spawnSync(n.command,n.args,n.options);return i.error=i.error||Bx.verifyENOENTSync(i.status,n),i}Tu.exports=ZR;Tu.exports.spawn=ZR;Tu.exports.sync=u6;Tu.exports._parse=Mx;Tu.exports._enoent=Bx});var rA=P((nde,tA)=>{"use strict";tA.exports=t=>{let e=typeof t=="string"?`
`:10,r=typeof t=="string"?"\r":13;return t[t.length-1]===e&&(t=t.slice(0,t.length-1)),t[t.length-1]===r&&(t=t.slice(0,t.length-1)),t}});var oA=P((ide,pf)=>{"use strict";var lf=require("path"),nA=Rx(),iA=t=>{t={cwd:process.cwd(),path:process.env[nA()],execPath:process.execPath,...t};let e,r=lf.resolve(t.cwd),n=[];for(;e!==r;)n.push(lf.join(r,"node_modules/.bin")),e=r,r=lf.resolve(r,"..");let i=lf.resolve(t.cwd,t.execPath,"..");return n.push(i),n.concat(t.path).join(lf.delimiter)};pf.exports=iA;pf.exports.default=iA;pf.exports.env=t=>{t={env:process.env,...t};let e={...t.env},r=nA({env:e});return t.path=e[r],e[r]=pf.exports(t),e}});var aA=P((ode,Fx)=>{"use strict";var sA=(t,e)=>{for(let r of Reflect.ownKeys(e))Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t};Fx.exports=sA;Fx.exports.default=sA});var uA=P((sde,mg)=>{"use strict";var l6=aA(),hg=new WeakMap,cA=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,n=0,i=t.displayName||t.name||"<anonymous>",o=function(...s){if(hg.set(o,++n),n===1)r=t.apply(this,s),t=null;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return r};return l6(o,t),hg.set(o,n),o};mg.exports=cA;mg.exports.default=cA;mg.exports.callCount=t=>{if(!hg.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return hg.get(t)}});var lA=P(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});gg.SIGNALS=void 0;var p6=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];gg.SIGNALS=p6});var Ux=P(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.SIGRTMAX=Pu.getRealtimeSignals=void 0;var d6=function(){let t=dA-pA+1;return Array.from({length:t},f6)};Pu.getRealtimeSignals=d6;var f6=function(t,e){return{name:`SIGRT${e+1}`,number:pA+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}},pA=34,dA=64;Pu.SIGRTMAX=dA});var fA=P(yg=>{"use strict";Object.defineProperty(yg,"__esModule",{value:!0});yg.getSignals=void 0;var h6=require("os"),m6=lA(),g6=Ux(),y6=function(){let t=(0,g6.getRealtimeSignals)();return[...m6.SIGNALS,...t].map(b6)};yg.getSignals=y6;var b6=function({name:t,number:e,description:r,action:n,forced:i=!1,standard:o}){let{signals:{[t]:s}}=h6.constants,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});var mA=P(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.signalsByNumber=Eu.signalsByName=void 0;var v6=require("os"),hA=fA(),w6=Ux(),S6=function(){return(0,hA.getSignals)().reduce(_6,{})},_6=function(t,{name:e,number:r,description:n,supported:i,action:o,forced:s,standard:a}){return{...t,[e]:{name:e,number:r,description:n,supported:i,action:o,forced:s,standard:a}}},x6=S6();Eu.signalsByName=x6;var I6=function(){let t=(0,hA.getSignals)(),e=w6.SIGRTMAX+1,r=Array.from({length:e},(n,i)=>C6(i,t));return Object.assign({},...r)},C6=function(t,e){let r=T6(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},T6=function(t,e){let r=e.find(({name:n})=>v6.constants.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},P6=I6();Eu.signalsByNumber=P6});var yA=P((pde,gA)=>{"use strict";var{signalsByName:E6}=mA(),k6=({timedOut:t,timeout:e,errorCode:r,signal:n,signalDescription:i,exitCode:o,isCanceled:s})=>t?`timed out after ${e} milliseconds`:s?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${i})`:o!==void 0?`failed with exit code ${o}`:"failed",R6=({stdout:t,stderr:e,all:r,error:n,signal:i,exitCode:o,command:s,escapedCommand:a,timedOut:c,isCanceled:u,killed:l,parsed:{options:{timeout:p}}})=>{o=o===null?void 0:o,i=i===null?void 0:i;let d=i===void 0?void 0:E6[i].description,f=n&&n.code,m=`Command ${k6({timedOut:c,timeout:p,errorCode:f,signal:i,signalDescription:d,exitCode:o,isCanceled:u})}: ${s}`,x=Object.prototype.toString.call(n)==="[object Error]",C=x?`${m}
${n.message}`:m,O=[C,e,t].filter(Boolean).join(`
`);return x?(n.originalMessage=n.message,n.message=O):n=new Error(O),n.shortMessage=C,n.command=s,n.escapedCommand=a,n.exitCode=o,n.signal=i,n.signalDescription=d,n.stdout=t,n.stderr=e,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!c,n.isCanceled=u,n.killed=l&&!c,n};gA.exports=R6});var vA=P((dde,jx)=>{"use strict";var bg=["stdin","stdout","stderr"],A6=t=>bg.some(e=>t[e]!==void 0),bA=t=>{if(!t)return;let{stdio:e}=t;if(e===void 0)return bg.map(n=>t[n]);if(A6(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${bg.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return e;if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,bg.length);return Array.from({length:r},(n,i)=>e[i])};jx.exports=bA;jx.exports.node=t=>{let e=bA(t);return e==="ipc"?"ipc":e===void 0||typeof e=="string"?[e,e,e,"ipc"]:e.includes("ipc")?e:[...e,"ipc"]}});var wA=P((fde,vg)=>{vg.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&vg.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&vg.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var xA=P((hde,hf)=>{var D6=require("assert"),df=wA(),O6=/^win/i.test(process.platform),wg=require("events");typeof wg!="function"&&(wg=wg.EventEmitter);var ar;process.__signal_exit_emitter__?ar=process.__signal_exit_emitter__:(ar=process.__signal_exit_emitter__=new wg,ar.count=0,ar.emitted={});ar.infinite||(ar.setMaxListeners(1/0),ar.infinite=!0);hf.exports=function(t,e){D6.equal(typeof t,"function","a callback must be provided for exit handler"),ff===!1&&SA();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){ar.removeListener(r,t),ar.listeners("exit").length===0&&ar.listeners("afterexit").length===0&&Hx()};return ar.on(r,t),n};hf.exports.unload=Hx;function Hx(){ff&&(ff=!1,df.forEach(function(t){try{process.removeListener(t,qx[t])}catch{}}),process.emit=Wx,process.reallyExit=_A,ar.count-=1)}function ku(t,e,r){ar.emitted[t]||(ar.emitted[t]=!0,ar.emit(t,e,r))}var qx={};df.forEach(function(t){qx[t]=function(){var r=process.listeners(t);r.length===ar.count&&(Hx(),ku("exit",null,t),ku("afterexit",null,t),O6&&t==="SIGHUP"&&(t="SIGINT"),process.kill(process.pid,t))}});hf.exports.signals=function(){return df};hf.exports.load=SA;var ff=!1;function SA(){ff||(ff=!0,ar.count+=1,df=df.filter(function(t){try{return process.on(t,qx[t]),!0}catch{return!1}}),process.emit=N6,process.reallyExit=L6)}var _A=process.reallyExit;function L6(t){process.exitCode=t||0,ku("exit",process.exitCode,null),ku("afterexit",process.exitCode,null),_A.call(process,process.exitCode)}var Wx=process.emit;function N6(t,e){if(t==="exit"){e!==void 0&&(process.exitCode=e);var r=Wx.apply(this,arguments);return ku("exit",process.exitCode,null),ku("afterexit",process.exitCode,null),r}else return Wx.apply(this,arguments)}});var CA=P((mde,IA)=>{"use strict";var M6=require("os"),B6=xA(),F6=1e3*5,U6=(t,e="SIGTERM",r={})=>{let n=t(e);return j6(t,e,r,n),n},j6=(t,e,r,n)=>{if(!W6(e,r,n))return;let i=q6(r),o=setTimeout(()=>{t("SIGKILL")},i);o.unref&&o.unref()},W6=(t,{forceKillAfterTimeout:e},r)=>H6(t)&&e!==!1&&r,H6=t=>t===M6.constants.signals.SIGTERM||typeof t=="string"&&t.toUpperCase()==="SIGTERM",q6=({forceKillAfterTimeout:t=!0})=>{if(t===!0)return F6;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},$6=(t,e)=>{t.kill()&&(e.isCanceled=!0)},V6=(t,e,r)=>{t.kill(e),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:e}))},G6=(t,{timeout:e,killSignal:r="SIGTERM"},n)=>{if(e===0||e===void 0)return n;let i,o=new Promise((a,c)=>{i=setTimeout(()=>{V6(t,r,c)},e)}),s=n.finally(()=>{clearTimeout(i)});return Promise.race([o,s])},z6=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},K6=async(t,{cleanup:e,detached:r},n)=>{if(!e||r)return n;let i=B6(()=>{t.kill()});return n.finally(()=>{i()})};IA.exports={spawnedKill:U6,spawnedCancel:$6,setupTimeout:G6,validateTimeout:z6,setExitHandler:K6}});var PA=P((gde,TA)=>{"use strict";var Ci=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Ci.writable=t=>Ci(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Ci.readable=t=>Ci(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Ci.duplex=t=>Ci.writable(t)&&Ci.readable(t);Ci.transform=t=>Ci.duplex(t)&&typeof t._transform=="function"&&typeof t._transformState=="object";TA.exports=Ci});var kA=P((yde,EA)=>{"use strict";var{PassThrough:J6}=require("stream");EA.exports=t=>{t={...t};let{array:e}=t,{encoding:r}=t,n=r==="buffer",i=!1;e?i=!(r||n):r=r||"utf8",n&&(r=null);let o=new J6({objectMode:i});r&&o.setEncoding(r);let s=0,a=[];return o.on("data",c=>{a.push(c),i?s=a.length:s+=c.length}),o.getBufferedValue=()=>e?a:n?Buffer.concat(a,s):a.join(""),o.getBufferedLength=()=>s,o}});var RA=P((bde,mf)=>{"use strict";var{constants:X6}=require("buffer"),Y6=require("stream"),{promisify:Q6}=require("util"),Z6=kA(),ez=Q6(Y6.pipeline),Sg=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function $x(t,e){if(!t)throw new Error("Expected a stream");e={maxBuffer:1/0,...e};let{maxBuffer:r}=e,n=Z6(e);return await new Promise((i,o)=>{let s=a=>{a&&n.getBufferedLength()<=X6.MAX_LENGTH&&(a.bufferedData=n.getBufferedValue()),o(a)};(async()=>{try{await ez(t,n),i()}catch(a){s(a)}})(),n.on("data",()=>{n.getBufferedLength()>r&&s(new Sg)})}),n.getBufferedValue()}mf.exports=$x;mf.exports.buffer=(t,e)=>$x(t,{...e,encoding:"buffer"});mf.exports.array=(t,e)=>$x(t,{...e,array:!0});mf.exports.MaxBufferError=Sg});var DA=P((vde,AA)=>{"use strict";var{PassThrough:tz}=require("stream");AA.exports=function(){var t=[],e=new tz({objectMode:!0});return e.setMaxListeners(0),e.add=r,e.isEmpty=n,e.on("unpipe",i),Array.prototype.slice.call(arguments).forEach(r),e;function r(o){return Array.isArray(o)?(o.forEach(r),this):(t.push(o),o.once("end",i.bind(null,o)),o.once("error",e.emit.bind(e,"error")),o.pipe(e,{end:!1}),this)}function n(){return t.length==0}function i(o){t=t.filter(function(s){return s!==o}),!t.length&&e.readable&&e.end()}}});var MA=P((wde,NA)=>{"use strict";var LA=PA(),OA=RA(),rz=DA(),nz=(t,e)=>{e===void 0||t.stdin===void 0||(LA(e)?e.pipe(t.stdin):t.stdin.end(e))},iz=(t,{all:e})=>{if(!e||!t.stdout&&!t.stderr)return;let r=rz();return t.stdout&&r.add(t.stdout),t.stderr&&r.add(t.stderr),r},Vx=async(t,e)=>{if(t){t.destroy();try{return await e}catch(r){return r.bufferedData}}},Gx=(t,{encoding:e,buffer:r,maxBuffer:n})=>{if(!(!t||!r))return e?OA(t,{encoding:e,maxBuffer:n}):OA.buffer(t,{maxBuffer:n})},oz=async({stdout:t,stderr:e,all:r},{encoding:n,buffer:i,maxBuffer:o},s)=>{let a=Gx(t,{encoding:n,buffer:i,maxBuffer:o}),c=Gx(e,{encoding:n,buffer:i,maxBuffer:o}),u=Gx(r,{encoding:n,buffer:i,maxBuffer:o*2});try{return await Promise.all([s,a,c,u])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},Vx(t,a),Vx(e,c),Vx(r,u)])}},sz=({input:t})=>{if(LA(t))throw new TypeError("The `input` option cannot be a stream in sync mode")};NA.exports={handleInput:nz,makeAllStream:iz,getSpawnedResult:oz,validateInputSync:sz}});var FA=P((Sde,BA)=>{"use strict";var az=(async()=>{})().constructor.prototype,cz=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(az,t)]),uz=(t,e)=>{for(let[r,n]of cz){let i=typeof e=="function"?(...o)=>Reflect.apply(n.value,e(),o):n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}return t},lz=t=>new Promise((e,r)=>{t.on("exit",(n,i)=>{e({exitCode:n,signal:i})}),t.on("error",n=>{r(n)}),t.stdin&&t.stdin.on("error",n=>{r(n)})});BA.exports={mergePromise:uz,getSpawnedPromise:lz}});var WA=P((_de,jA)=>{"use strict";var UA=(t,e=[])=>Array.isArray(e)?[t,...e]:[t],pz=/^[\w.-]+$/,dz=/"/g,fz=t=>typeof t!="string"||pz.test(t)?t:`"${t.replace(dz,'\\"')}"`,hz=(t,e)=>UA(t,e).join(" "),mz=(t,e)=>UA(t,e).map(r=>fz(r)).join(" "),gz=/ +/g,yz=t=>{let e=[];for(let r of t.trim().split(gz)){let n=e[e.length-1];n&&n.endsWith("\\")?e[e.length-1]=`${n.slice(0,-1)} ${r}`:e.push(r)}return e};jA.exports={joinCommand:hz,getEscapedCommand:mz,parseCommand:yz}});var Ig=P((xde,Ru)=>{"use strict";var bz=require("path"),zx=require("child_process"),vz=eA(),wz=rA(),Sz=oA(),_z=uA(),_g=yA(),qA=vA(),{spawnedKill:xz,spawnedCancel:Iz,setupTimeout:Cz,validateTimeout:Tz,setExitHandler:Pz}=CA(),{handleInput:Ez,getSpawnedResult:kz,makeAllStream:Rz,validateInputSync:Az}=MA(),{mergePromise:HA,getSpawnedPromise:Dz}=FA(),{joinCommand:$A,parseCommand:VA,getEscapedCommand:GA}=WA(),Oz=1e3*1e3*100,Lz=({env:t,extendEnv:e,preferLocal:r,localDir:n,execPath:i})=>{let o=e?{...process.env,...t}:t;return r?Sz.env({env:o,cwd:n,execPath:i}):o},zA=(t,e,r={})=>{let n=vz._parse(t,e,r);return t=n.command,e=n.args,r=n.options,r={maxBuffer:Oz,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,...r},r.env=Lz(r),r.stdio=qA(r),process.platform==="win32"&&bz.basename(t,".exe")==="cmd"&&e.unshift("/q"),{file:t,args:e,options:r,parsed:n}},gf=(t,e,r)=>typeof e!="string"&&!Buffer.isBuffer(e)?r===void 0?void 0:"":t.stripFinalNewline?wz(e):e,xg=(t,e,r)=>{let n=zA(t,e,r),i=$A(t,e),o=GA(t,e);Tz(n.options);let s;try{s=zx.spawn(n.file,n.args,n.options)}catch(f){let h=new zx.ChildProcess,m=Promise.reject(_g({error:f,stdout:"",stderr:"",all:"",command:i,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return HA(h,m)}let a=Dz(s),c=Cz(s,n.options,a),u=Pz(s,n.options,c),l={isCanceled:!1};s.kill=xz.bind(null,s.kill.bind(s)),s.cancel=Iz.bind(null,s,l);let d=_z(async()=>{let[{error:f,exitCode:h,signal:m,timedOut:x},C,O,y]=await kz(s,n.options,u),T=gf(n.options,C),E=gf(n.options,O),M=gf(n.options,y);if(f||h!==0||m!==null){let k=_g({error:f,exitCode:h,signal:m,stdout:T,stderr:E,all:M,command:i,escapedCommand:o,parsed:n,timedOut:x,isCanceled:l.isCanceled,killed:s.killed});if(!n.options.reject)return k;throw k}return{command:i,escapedCommand:o,exitCode:0,stdout:T,stderr:E,all:M,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Ez(s,n.options.input),s.all=Rz(s,n.options),HA(s,d)};Ru.exports=xg;Ru.exports.sync=(t,e,r)=>{let n=zA(t,e,r),i=$A(t,e),o=GA(t,e);Az(n.options);let s;try{s=zx.spawnSync(n.file,n.args,n.options)}catch(u){throw _g({error:u,stdout:"",stderr:"",all:"",command:i,escapedCommand:o,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let a=gf(n.options,s.stdout,s.error),c=gf(n.options,s.stderr,s.error);if(s.error||s.status!==0||s.signal!==null){let u=_g({stdout:a,stderr:c,error:s.error,signal:s.signal,exitCode:s.status,command:i,escapedCommand:o,parsed:n,timedOut:s.error&&s.error.code==="ETIMEDOUT",isCanceled:!1,killed:s.signal!==null});if(!n.options.reject)return u;throw u}return{command:i,escapedCommand:o,exitCode:0,stdout:a,stderr:c,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}};Ru.exports.command=(t,e)=>{let[r,...n]=VA(t);return xg(r,n,e)};Ru.exports.commandSync=(t,e)=>{let[r,...n]=VA(t);return xg.sync(r,n,e)};Ru.exports.node=(t,e,r={})=>{e&&!Array.isArray(e)&&typeof e=="object"&&(r=e,e=[]);let n=qA.node(r),i=process.execArgv.filter(a=>!a.startsWith("--inspect")),{nodePath:o=process.execPath,nodeOptions:s=i}=r;return xg(o,[...s,t,...Array.isArray(e)?e:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:n,shell:!1})}});var Et=P(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.NON_CUSTOM_TAG_KEYS=Oe.PRE_DESTROY=Oe.POST_CONSTRUCT=Oe.DESIGN_PARAM_TYPES=Oe.PARAM_TYPES=Oe.TAGGED_PROP=Oe.TAGGED=Oe.MULTI_INJECT_TAG=Oe.INJECT_TAG=Oe.OPTIONAL_TAG=Oe.UNMANAGED_TAG=Oe.NAME_TAG=Oe.NAMED_TAG=void 0;Oe.NAMED_TAG="named";Oe.NAME_TAG="name";Oe.UNMANAGED_TAG="unmanaged";Oe.OPTIONAL_TAG="optional";Oe.INJECT_TAG="inject";Oe.MULTI_INJECT_TAG="multi_inject";Oe.TAGGED="inversify:tagged";Oe.TAGGED_PROP="inversify:tagged_props";Oe.PARAM_TYPES="inversify:paramtypes";Oe.DESIGN_PARAM_TYPES="design:paramtypes";Oe.POST_CONSTRUCT="post_construct";Oe.PRE_DESTROY="pre_destroy";function Nz(){return[Oe.INJECT_TAG,Oe.MULTI_INJECT_TAG,Oe.NAME_TAG,Oe.UNMANAGED_TAG,Oe.NAMED_TAG,Oe.OPTIONAL_TAG]}Oe.NON_CUSTOM_TAG_KEYS=Nz()});var xn=P(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.TargetTypeEnum=_s.BindingTypeEnum=_s.BindingScopeEnum=void 0;var Mz={Request:"Request",Singleton:"Singleton",Transient:"Transient"};_s.BindingScopeEnum=Mz;var Bz={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};_s.BindingTypeEnum=Bz;var Fz={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"};_s.TargetTypeEnum=Fz});var xs=P(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});Cg.id=void 0;var Uz=0;function jz(){return Uz++}Cg.id=jz});var JA=P(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});Tg.Binding=void 0;var KA=xn(),Wz=xs(),Hz=(function(){function t(e,r){this.id=(0,Wz.id)(),this.activated=!1,this.serviceIdentifier=e,this.scope=r,this.type=KA.BindingTypeEnum.Invalid,this.constraint=function(n){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===KA.BindingScopeEnum.Singleton?this.activated:!1,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},t})();Tg.Binding=Hz});var hr=P(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.STACK_OVERFLOW=re.CIRCULAR_DEPENDENCY_IN_FACTORY=re.ON_DEACTIVATION_ERROR=re.PRE_DESTROY_ERROR=re.POST_CONSTRUCT_ERROR=re.ASYNC_UNBIND_REQUIRED=re.MULTIPLE_POST_CONSTRUCT_METHODS=re.MULTIPLE_PRE_DESTROY_METHODS=re.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=re.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=re.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=re.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=re.ARGUMENTS_LENGTH_MISMATCH=re.INVALID_DECORATOR_OPERATION=re.INVALID_TO_SELF_VALUE=re.LAZY_IN_SYNC=re.INVALID_FUNCTION_BINDING=re.INVALID_MIDDLEWARE_RETURN=re.NO_MORE_SNAPSHOTS_AVAILABLE=re.INVALID_BINDING_TYPE=re.NOT_IMPLEMENTED=re.CIRCULAR_DEPENDENCY=re.UNDEFINED_INJECT_ANNOTATION=re.MISSING_INJECT_ANNOTATION=re.MISSING_INJECTABLE_ANNOTATION=re.NOT_REGISTERED=re.CANNOT_UNBIND=re.AMBIGUOUS_MATCH=re.KEY_NOT_FOUND=re.NULL_ARGUMENT=re.DUPLICATED_METADATA=re.DUPLICATED_INJECTABLE_DECORATOR=void 0;re.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.";re.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:";re.NULL_ARGUMENT="NULL argument";re.KEY_NOT_FOUND="Key Not Found";re.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:";re.CANNOT_UNBIND="Could not unbind serviceIdentifier:";re.NOT_REGISTERED="No matching bindings found for serviceIdentifier:";re.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:";re.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";var qz=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifier to  overcome this limitation."};re.UNDEFINED_INJECT_ANNOTATION=qz;re.CIRCULAR_DEPENDENCY="Circular dependency found:";re.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.";re.INVALID_BINDING_TYPE="Invalid binding type:";re.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.";re.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!";re.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!";var $z=function(t){return"You are attempting to construct '"+t+`' in a synchronous way
 but it has asynchronous dependencies.`};re.LAZY_IN_SYNC=$z;re.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier";re.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";var Vz=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+(t[0]+" must be >= than the number of constructor arguments of its base class.")};re.ARGUMENTS_LENGTH_MISMATCH=Vz;re.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.";re.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE='Invalid Container option. Default scope must be a string ("singleton" or "transient").';re.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean";re.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean";re.MULTIPLE_PRE_DESTROY_METHODS="Cannot apply @preDestroy decorator multiple times in the same class";re.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";re.ASYNC_UNBIND_REQUIRED="Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)";var Gz=function(t,e){return"@postConstruct error in class "+t+": "+e};re.POST_CONSTRUCT_ERROR=Gz;var zz=function(t,e){return"@preDestroy error in class "+t+": "+e};re.PRE_DESTROY_ERROR=zz;var Kz=function(t,e){return"onDeactivation() error in class "+t+": "+e};re.ON_DEACTIVATION_ERROR=Kz;var Jz=function(t,e){return"It looks like there is a circular dependency in one of the '"+t+"' bindings. Please investigate bindings with "+("service identifier '"+e+"'.")};re.CIRCULAR_DEPENDENCY_IN_FACTORY=Jz;re.STACK_OVERFLOW="Maximum call stack size exceeded"});var Jx=P(Ti=>{"use strict";var Xz=Ti&&Ti.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Yz=Ti&&Ti.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Qz=Ti&&Ti.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xz(e,t,r);return Yz(e,t),e};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.MetadataReader=void 0;var Kx=Qz(Et()),Zz=(function(){function t(){}return t.prototype.getConstructorMetadata=function(e){var r=Reflect.getMetadata(Kx.PARAM_TYPES,e),n=Reflect.getMetadata(Kx.TAGGED,e);return{compilerGeneratedMetadata:r,userGeneratedMetadata:n||{}}},t.prototype.getPropertiesMetadata=function(e){var r=Reflect.getMetadata(Kx.TAGGED_PROP,e)||[];return r},t})();Ti.MetadataReader=Zz});var XA=P(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});Pg.BindingCount=void 0;Pg.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}});var Xx=P(In=>{"use strict";var e8=In&&In.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),t8=In&&In.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),r8=In&&In.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e8(e,t,r);return t8(e,t),e};Object.defineProperty(In,"__esModule",{value:!0});In.tryAndThrowErrorIfStackOverflow=In.isStackOverflowExeption=void 0;var n8=r8(hr());function YA(t){return t instanceof RangeError||t.message===n8.STACK_OVERFLOW}In.isStackOverflowExeption=YA;var i8=function(t,e){try{return t()}catch(r){throw YA(r)&&(r=e()),r}};In.tryAndThrowErrorIfStackOverflow=i8});var Ka=P(kt=>{"use strict";var o8=kt&&kt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),s8=kt&&kt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),a8=kt&&kt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o8(e,t,r);return s8(e,t),e};Object.defineProperty(kt,"__esModule",{value:!0});kt.getSymbolDescription=kt.circularDependencyToException=kt.listMetadataForTarget=kt.listRegisteredBindingsForServiceIdentifier=kt.getServiceIdentifierAsString=kt.getFunctionName=void 0;var c8=a8(hr());function QA(t){if(typeof t=="function"){var e=t;return e.name}else{if(typeof t=="symbol")return t.toString();var e=t;return e}}kt.getServiceIdentifierAsString=QA;function u8(t,e,r){var n="",i=r(t,e);return i.length!==0&&(n=`
Registered bindings:`,i.forEach(function(o){var s="Object";o.implementationType!==null&&(s=tD(o.implementationType)),n=n+`
 `+s,o.constraint.metaData&&(n=n+" - "+o.constraint.metaData)})),n}kt.listRegisteredBindingsForServiceIdentifier=u8;function ZA(t,e){return t.parentRequest===null?!1:t.parentRequest.serviceIdentifier===e?!0:ZA(t.parentRequest,e)}function l8(t){function e(n,i){i===void 0&&(i=[]);var o=QA(n.serviceIdentifier);return i.push(o),n.parentRequest!==null?e(n.parentRequest,i):i}var r=e(t);return r.reverse().join(" --> ")}function eD(t){t.childRequests.forEach(function(e){if(ZA(e,e.serviceIdentifier)){var r=l8(e);throw new Error(c8.CIRCULAR_DEPENDENCY+" "+r)}else eD(e)})}kt.circularDependencyToException=eD;function p8(t,e){if(e.isTagged()||e.isNamed()){var r="",n=e.getNamedTag(),i=e.getCustomTags();return n!==null&&(r+=n.toString()+`
`),i!==null&&i.forEach(function(o){r+=o.toString()+`
`})," "+t+`
 `+t+" - "+r}else return" "+t}kt.listMetadataForTarget=p8;function tD(t){if(t.name)return t.name;var e=t.toString(),r=e.match(/^function\s*([^\s(]+)/);return r?r[1]:"Anonymous function: "+e}kt.getFunctionName=tD;function d8(t){return t.toString().slice(7,-1)}kt.getSymbolDescription=d8});var rD=P(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});Eg.Context=void 0;var f8=xs(),h8=(function(){function t(e){this.id=(0,f8.id)(),this.container=e}return t.prototype.addPlan=function(e){this.plan=e},t.prototype.setCurrentRequest=function(e){this.currentRequest=e},t})();Eg.Context=h8});var oi=P(Pi=>{"use strict";var m8=Pi&&Pi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),g8=Pi&&Pi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),y8=Pi&&Pi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m8(e,t,r);return g8(e,t),e};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.Metadata=void 0;var b8=y8(Et()),v8=(function(){function t(e,r){this.key=e,this.value=r}return t.prototype.toString=function(){return this.key===b8.NAMED_TAG?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t})();Pi.Metadata=v8});var nD=P(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.Plan=void 0;var w8=(function(){function t(e,r){this.parentContext=e,this.rootRequest=r}return t})();kg.Plan=w8});var Ag=P(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});Rg.LazyServiceIdentifier=void 0;var S8=(function(){function t(e){this._cb=e}return t.prototype.unwrap=function(){return this._cb()},t})();Rg.LazyServiceIdentifier=S8});var iD=P(Dg=>{"use strict";Object.defineProperty(Dg,"__esModule",{value:!0});Dg.QueryableString=void 0;var _8=(function(){function t(e){this.str=e}return t.prototype.startsWith=function(e){return this.str.indexOf(e)===0},t.prototype.endsWith=function(e){var r="",n=e.split("").reverse().join("");return r=this.str.split("").reverse().join(""),this.startsWith.call({str:r},n)},t.prototype.contains=function(e){return this.str.indexOf(e)!==-1},t.prototype.equals=function(e){return this.str===e},t.prototype.value=function(){return this.str},t})();Dg.QueryableString=_8});var Yx=P(Ei=>{"use strict";var x8=Ei&&Ei.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),I8=Ei&&Ei.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),C8=Ei&&Ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x8(e,t,r);return I8(e,t),e};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.Target=void 0;var Oo=C8(Et()),T8=xs(),P8=Ka(),oD=oi(),E8=iD(),k8=(function(){function t(e,r,n,i){this.id=(0,T8.id)(),this.type=e,this.serviceIdentifier=n;var o=typeof r=="symbol"?(0,P8.getSymbolDescription)(r):r;this.name=new E8.QueryableString(o||""),this.identifier=r,this.metadata=new Array;var s=null;typeof i=="string"?s=new oD.Metadata(Oo.NAMED_TAG,i):i instanceof oD.Metadata&&(s=i),s!==null&&this.metadata.push(s)}return t.prototype.hasTag=function(e){for(var r=0,n=this.metadata;r<n.length;r++){var i=n[r];if(i.key===e)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(Oo.MULTI_INJECT_TAG)},t.prototype.matchesArray=function(e){return this.matchesTag(Oo.MULTI_INJECT_TAG)(e)},t.prototype.isNamed=function(){return this.hasTag(Oo.NAMED_TAG)},t.prototype.isTagged=function(){return this.metadata.some(function(e){return Oo.NON_CUSTOM_TAG_KEYS.every(function(r){return e.key!==r})})},t.prototype.isOptional=function(){return this.matchesTag(Oo.OPTIONAL_TAG)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter(function(e){return e.key===Oo.NAMED_TAG})[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter(function(e){return Oo.NON_CUSTOM_TAG_KEYS.every(function(r){return e.key!==r})}):null},t.prototype.matchesNamedTag=function(e){return this.matchesTag(Oo.NAMED_TAG)(e)},t.prototype.matchesTag=function(e){var r=this;return function(n){for(var i=0,o=r.metadata;i<o.length;i++){var s=o[i];if(s.key===e&&s.value===n)return!0}return!1}},t})();Ei.Target=k8});var fD=P(mr=>{"use strict";var R8=mr&&mr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),A8=mr&&mr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),sD=mr&&mr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R8(e,t,r);return A8(e,t),e},Og=mr&&mr.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(mr,"__esModule",{value:!0});mr.getFunctionName=mr.getBaseClassDependencyCount=mr.getDependencies=void 0;var D8=Ag(),Qx=sD(hr()),aD=xn(),yf=sD(Et()),Zx=Ka();Object.defineProperty(mr,"getFunctionName",{enumerable:!0,get:function(){return Zx.getFunctionName}});var cD=Yx();function O8(t,e){var r=(0,Zx.getFunctionName)(e);return uD(t,r,e,!1)}mr.getDependencies=O8;function uD(t,e,r,n){var i=t.getConstructorMetadata(r),o=i.compilerGeneratedMetadata;if(o===void 0){var s=Qx.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(s)}var a=i.userGeneratedMetadata,c=Object.keys(a),u=r.length===0&&c.length>0,l=c.length>r.length,p=u||l?c.length:r.length,d=N8(n,e,o,a,p),f=lD(t,r,e),h=Og(Og([],d,!0),f,!0);return h}function L8(t,e,r,n,i){var o=i[t.toString()]||[],s=dD(o),a=s.unmanaged!==!0,c=n[t],u=s.inject||s.multiInject;if(c=u||c,c instanceof D8.LazyServiceIdentifier&&(c=c.unwrap()),a){var l=c===Object,p=c===Function,d=c===void 0,f=l||p||d;if(!e&&f){var h=Qx.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+r+".";throw new Error(h)}var m=new cD.Target(aD.TargetTypeEnum.ConstructorArgument,s.targetName,c);return m.metadata=o,m}return null}function N8(t,e,r,n,i){for(var o=[],s=0;s<i;s++){var a=s,c=L8(a,t,e,r,n);c!==null&&o.push(c)}return o}function M8(t,e,r,n){var i=t||e;if(i===void 0){var o=Qx.MISSING_INJECTABLE_ANNOTATION+" for property "+String(r)+" in class "+n+".";throw new Error(o)}return i}function lD(t,e,r){for(var n=t.getPropertiesMetadata(e),i=[],o=Object.getOwnPropertySymbols(n),s=Object.keys(n),a=s.concat(o),c=0,u=a;c<u.length;c++){var l=u[c],p=n[l],d=dD(p),f=d.targetName||l,h=M8(d.inject,d.multiInject,l,r),m=new cD.Target(aD.TargetTypeEnum.ClassProperty,f,h);m.metadata=p,i.push(m)}var x=Object.getPrototypeOf(e.prototype).constructor;if(x!==Object){var C=lD(t,x,r);i=Og(Og([],i,!0),C,!0)}return i}function pD(t,e){var r=Object.getPrototypeOf(e.prototype).constructor;if(r!==Object){var n=(0,Zx.getFunctionName)(r),i=uD(t,n,r,!0),o=i.map(function(c){return c.metadata.filter(function(u){return u.key===yf.UNMANAGED_TAG})}),s=[].concat.apply([],o).length,a=i.length-s;return a>0?a:pD(t,r)}else return 0}mr.getBaseClassDependencyCount=pD;function dD(t){var e={};return t.forEach(function(r){e[r.key.toString()]=r.value}),{inject:e[yf.INJECT_TAG],multiInject:e[yf.MULTI_INJECT_TAG],targetName:e[yf.NAME_TAG],unmanaged:e[yf.UNMANAGED_TAG]}}});var hD=P(Lg=>{"use strict";Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Request=void 0;var B8=xs(),F8=(function(){function t(e,r,n,i,o){this.id=(0,B8.id)(),this.serviceIdentifier=e,this.parentContext=r,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=n===null?new Map:null}return t.prototype.addChildRequest=function(e,r,n){var i=new t(e,this.parentContext,this,r,n);return this.childRequests.push(i),i},t})();Lg.Request=F8});var iI=P(Mr=>{"use strict";var U8=Mr&&Mr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),j8=Mr&&Mr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),yD=Mr&&Mr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U8(e,t,r);return j8(e,t),e};Object.defineProperty(Mr,"__esModule",{value:!0});Mr.getBindingDictionary=Mr.createMockRequest=Mr.plan=void 0;var Ng=XA(),tI=yD(hr()),bD=xn(),mD=yD(Et()),W8=Xx(),Au=Ka(),vD=rD(),rI=oi(),H8=nD(),eI=fD(),nI=hD(),wD=Yx();function SD(t){return t._bindingDictionary}Mr.getBindingDictionary=SD;function q8(t,e,r,n,i,o){var s=t?mD.MULTI_INJECT_TAG:mD.INJECT_TAG,a=new rI.Metadata(s,r),c=new wD.Target(e,n,r,a);if(i!==void 0){var u=new rI.Metadata(i,o);c.metadata.push(u)}return c}function gD(t,e,r,n,i){var o=bf(r.container,i.serviceIdentifier),s=[];return o.length===Ng.BindingCount.NoBindingsAvailable&&r.container.options.autoBindInjectable&&typeof i.serviceIdentifier=="function"&&t.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(r.container.bind(i.serviceIdentifier).toSelf(),o=bf(r.container,i.serviceIdentifier)),e?s=o:s=o.filter(function(a){var c=new nI.Request(a.serviceIdentifier,r,n,a,i);return a.constraint(c)}),$8(i.serviceIdentifier,s,i,r.container),s}function $8(t,e,r,n){switch(e.length){case Ng.BindingCount.NoBindingsAvailable:if(r.isOptional())return e;var i=(0,Au.getServiceIdentifierAsString)(t),o=tI.NOT_REGISTERED;throw o+=(0,Au.listMetadataForTarget)(i,r),o+=(0,Au.listRegisteredBindingsForServiceIdentifier)(n,i,bf),new Error(o);case Ng.BindingCount.OnlyOneBindingAvailable:return e;case Ng.BindingCount.MultipleBindingsAvailable:default:if(r.isArray())return e;var i=(0,Au.getServiceIdentifierAsString)(t),o=tI.AMBIGUOUS_MATCH+" "+i;throw o+=(0,Au.listRegisteredBindingsForServiceIdentifier)(n,i,bf),new Error(o)}}function _D(t,e,r,n,i,o){var s,a;if(i===null){s=gD(t,e,n,null,o),a=new nI.Request(r,n,null,s,o);var c=new H8.Plan(n,a);n.addPlan(c)}else s=gD(t,e,n,i,o),a=i.addChildRequest(o.serviceIdentifier,s,o);s.forEach(function(u){var l=null;if(o.isArray())l=a.addChildRequest(u.serviceIdentifier,u,o);else{if(u.cache)return;l=a}if(u.type===bD.BindingTypeEnum.Instance&&u.implementationType!==null){var p=(0,eI.getDependencies)(t,u.implementationType);if(!n.container.options.skipBaseClassChecks){var d=(0,eI.getBaseClassDependencyCount)(t,u.implementationType);if(p.length<d){var f=tI.ARGUMENTS_LENGTH_MISMATCH((0,eI.getFunctionName)(u.implementationType));throw new Error(f)}}p.forEach(function(h){_D(t,!1,h.serviceIdentifier,n,l,h)})}})}function bf(t,e){var r=[],n=SD(t);return n.hasKey(e)?r=n.get(e):t.parent!==null&&(r=bf(t.parent,e)),r}function V8(t,e,r,n,i,o,s,a){a===void 0&&(a=!1);var c=new vD.Context(e),u=q8(r,n,i,"",o,s);try{return _D(t,a,i,c,null,u),c}catch(l){throw(0,W8.isStackOverflowExeption)(l)&&(0,Au.circularDependencyToException)(c.plan.rootRequest),l}}Mr.plan=V8;function G8(t,e,r,n){var i=new wD.Target(bD.TargetTypeEnum.Variable,"",e,new rI.Metadata(r,n)),o=new vD.Context(t),s=new nI.Request(e,o,null,[],i);return s}Mr.createMockRequest=G8});var vf=P(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.isPromiseOrContainsPromise=Du.isPromise=void 0;function oI(t){var e=typeof t=="object"&&t!==null||typeof t=="function";return e&&typeof t.then=="function"}Du.isPromise=oI;function z8(t){return oI(t)?!0:Array.isArray(t)&&t.some(oI)}Du.isPromiseOrContainsPromise=z8});var xD=P(ki=>{"use strict";var K8=ki&&ki.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},J8=ki&&ki.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(ki,"__esModule",{value:!0});ki.saveToScope=ki.tryGetFromScope=void 0;var Mg=xn(),X8=vf(),Y8=function(t,e){return e.scope===Mg.BindingScopeEnum.Singleton&&e.activated?e.cache:e.scope===Mg.BindingScopeEnum.Request&&t.has(e.id)?t.get(e.id):null};ki.tryGetFromScope=Y8;var Q8=function(t,e,r){e.scope===Mg.BindingScopeEnum.Singleton&&eK(e,r),e.scope===Mg.BindingScopeEnum.Request&&Z8(t,e,r)};ki.saveToScope=Q8;var Z8=function(t,e,r){t.has(e.id)||t.set(e.id,r)},eK=function(t,e){t.cache=e,t.activated=!0,(0,X8.isPromise)(e)&&tK(t,e)},tK=function(t,e){return K8(void 0,void 0,void 0,function(){var r,n;return J8(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return r=i.sent(),t.cache=r,[3,3];case 2:throw n=i.sent(),t.cache=null,t.activated=!1,n;case 3:return[2]}})})}});var ID=P(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.FactoryType=void 0;var rK;(function(t){t.DynamicValue="toDynamicValue",t.Factory="toFactory",t.Provider="toProvider"})(rK=wf.FactoryType||(wf.FactoryType={}))});var aI=P(Br=>{"use strict";var nK=Br&&Br.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),iK=Br&&Br.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),oK=Br&&Br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nK(e,t,r);return iK(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.getFactoryDetails=Br.ensureFullyBound=Br.multiBindToService=void 0;var sK=Ka(),aK=oK(hr()),Ri=xn(),sI=ID(),cK=function(t){return function(e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.forEach(function(i){return t.bind(i).toService(e)})}}};Br.multiBindToService=cK;var uK=function(t){var e=null;switch(t.type){case Ri.BindingTypeEnum.ConstantValue:case Ri.BindingTypeEnum.Function:e=t.cache;break;case Ri.BindingTypeEnum.Constructor:case Ri.BindingTypeEnum.Instance:e=t.implementationType;break;case Ri.BindingTypeEnum.DynamicValue:e=t.dynamicValue;break;case Ri.BindingTypeEnum.Provider:e=t.provider;break;case Ri.BindingTypeEnum.Factory:e=t.factory;break}if(e===null){var r=(0,sK.getServiceIdentifierAsString)(t.serviceIdentifier);throw new Error(aK.INVALID_BINDING_TYPE+" "+r)}};Br.ensureFullyBound=uK;var lK=function(t){switch(t.type){case Ri.BindingTypeEnum.Factory:return{factory:t.factory,factoryType:sI.FactoryType.Factory};case Ri.BindingTypeEnum.Provider:return{factory:t.provider,factoryType:sI.FactoryType.Provider};case Ri.BindingTypeEnum.DynamicValue:return{factory:t.dynamicValue,factoryType:sI.FactoryType.DynamicValue};default:throw new Error("Unexpected factory type "+t.type)}};Br.getFactoryDetails=lK});var RD=P(qt=>{"use strict";var Ou=qt&&qt.__assign||function(){return Ou=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Ou.apply(this,arguments)},pK=qt&&qt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),dK=qt&&qt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),fK=qt&&qt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pK(e,t,r);return dK(e,t),e},PD=qt&&qt.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},ED=qt&&qt.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},hK=qt&&qt.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(qt,"__esModule",{value:!0});qt.resolveInstance=void 0;var cI=hr(),lI=xn(),uI=fK(Et()),pI=vf();function mK(t,e){return t.reduce(function(r,n){var i=e(n),o=n.target.type;return o===lI.TargetTypeEnum.ConstructorArgument?r.constructorInjections.push(i):(r.propertyRequests.push(n),r.propertyInjections.push(i)),r.isAsync||(r.isAsync=(0,pI.isPromiseOrContainsPromise)(i)),r},{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}function gK(t,e,r){var n;if(e.length>0){var i=mK(e,r),o=Ou(Ou({},i),{constr:t});i.isAsync?n=yK(o):n=kD(o)}else n=new t;return n}function kD(t){var e,r=new((e=t.constr).bind.apply(e,hK([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach(function(n,i){var o=n.target.identifier,s=t.propertyInjections[i];(!n.target.isOptional()||s!==void 0)&&(r[o]=s)}),r}function yK(t){return PD(this,void 0,void 0,function(){var e,r;return ED(this,function(n){switch(n.label){case 0:return[4,CD(t.constructorInjections)];case 1:return e=n.sent(),[4,CD(t.propertyInjections)];case 2:return r=n.sent(),[2,kD(Ou(Ou({},t),{constructorInjections:e,propertyInjections:r}))]}})})}function CD(t){return PD(this,void 0,void 0,function(){var e,r,n,i;return ED(this,function(o){for(e=[],r=0,n=t;r<n.length;r++)i=n[r],Array.isArray(i)?e.push(Promise.all(i)):e.push(i);return[2,Promise.all(e)]})})}function TD(t,e){var r=bK(t,e);return(0,pI.isPromise)(r)?r.then(function(){return e}):e}function bK(t,e){var r,n;if(Reflect.hasMetadata(uI.POST_CONSTRUCT,t)){var i=Reflect.getMetadata(uI.POST_CONSTRUCT,t);try{return(n=(r=e)[i.value])===null||n===void 0?void 0:n.call(r)}catch(o){if(o instanceof Error)throw new Error((0,cI.POST_CONSTRUCT_ERROR)(t.name,o.message))}}}function vK(t,e){t.scope!==lI.BindingScopeEnum.Singleton&&wK(t,e)}function wK(t,e){var r="Class cannot be instantiated in "+(t.scope===lI.BindingScopeEnum.Request?"request":"transient")+" scope.";if(typeof t.onDeactivation=="function")throw new Error((0,cI.ON_DEACTIVATION_ERROR)(e.name,r));if(Reflect.hasMetadata(uI.PRE_DESTROY,e))throw new Error((0,cI.PRE_DESTROY_ERROR)(e.name,r))}function SK(t,e,r,n){vK(t,e);var i=gK(e,r,n);return(0,pI.isPromise)(i)?i.then(function(o){return TD(e,o)}):TD(e,i)}qt.resolveInstance=SK});var ND=P(Fr=>{"use strict";var _K=Fr&&Fr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),xK=Fr&&Fr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),IK=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_K(e,t,r);return xK(e,t),e},CK=Fr&&Fr.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},TK=Fr&&Fr.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.resolve=void 0;var PK=IK(hr()),Bg=xn(),EK=iI(),AD=xD(),dI=vf(),OD=aI(),kK=Xx(),RK=RD(),fI=function(t){return function(e){e.parentContext.setCurrentRequest(e);var r=e.bindings,n=e.childRequests,i=e.target&&e.target.isArray(),o=!e.parentRequest||!e.parentRequest.target||!e.target||!e.parentRequest.target.matchesArray(e.target.serviceIdentifier);if(i&&o)return n.map(function(a){var c=fI(t);return c(a)});if(e.target.isOptional()&&r.length===0)return;var s=r[0];return LK(t,e,s)}},AK=function(t,e){var r=(0,OD.getFactoryDetails)(t);return(0,kK.tryAndThrowErrorIfStackOverflow)(function(){return r.factory.bind(t)(e)},function(){return new Error(PK.CIRCULAR_DEPENDENCY_IN_FACTORY(r.factoryType,e.currentRequest.serviceIdentifier.toString()))})},DK=function(t,e,r){var n,i=e.childRequests;switch((0,OD.ensureFullyBound)(r),r.type){case Bg.BindingTypeEnum.ConstantValue:case Bg.BindingTypeEnum.Function:n=r.cache;break;case Bg.BindingTypeEnum.Constructor:n=r.implementationType;break;case Bg.BindingTypeEnum.Instance:n=(0,RK.resolveInstance)(r,r.implementationType,i,fI(t));break;default:n=AK(r,e.parentContext)}return n},OK=function(t,e,r){var n=(0,AD.tryGetFromScope)(t,e);return n!==null||(n=r(),(0,AD.saveToScope)(t,e,n)),n},LK=function(t,e,r){return OK(t,r,function(){var n=DK(t,e,r);return(0,dI.isPromise)(n)?n=n.then(function(i){return DD(e,r,i)}):n=DD(e,r,n),n})};function DD(t,e,r){var n=NK(t.parentContext,e,r),i=FK(t.parentContext.container),o,s=i.next();do{o=s.value;var a=t.parentContext,c=t.serviceIdentifier,u=BK(o,c);(0,dI.isPromise)(n)?n=LD(u,a,n):n=MK(u,a,n),s=i.next()}while(s.done!==!0&&!(0,EK.getBindingDictionary)(o).hasKey(t.serviceIdentifier));return n}var NK=function(t,e,r){var n;return typeof e.onActivation=="function"?n=e.onActivation(t,r):n=r,n},MK=function(t,e,r){for(var n=t.next();!n.done;){if(r=n.value(e,r),(0,dI.isPromise)(r))return LD(t,e,r);n=t.next()}return r},LD=function(t,e,r){return CK(void 0,void 0,void 0,function(){var n,i;return TK(this,function(o){switch(o.label){case 0:return[4,r];case 1:n=o.sent(),i=t.next(),o.label=2;case 2:return i.done?[3,4]:[4,i.value(e,n)];case 3:return n=o.sent(),i=t.next(),[3,2];case 4:return[2,n]}})})},BK=function(t,e){var r=t._activations;return r.hasKey(e)?r.get(e).values():[].values()},FK=function(t){for(var e=[t],r=t.parent;r!==null;)e.push(r),r=r.parent;var n=function(){var o=e.pop();return o!==void 0?{done:!1,value:o}:{done:!0,value:void 0}},i={next:n};return i};function UK(t){var e=fI(t.plan.rootRequest.requestScope);return e(t.plan.rootRequest)}Fr.resolve=UK});var hI=P(gr=>{"use strict";var jK=gr&&gr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),WK=gr&&gr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),HK=gr&&gr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jK(e,t,r);return WK(e,t),e};Object.defineProperty(gr,"__esModule",{value:!0});gr.typeConstraint=gr.namedConstraint=gr.taggedConstraint=gr.traverseAncerstors=void 0;var qK=HK(Et()),$K=oi(),MD=function(t,e){var r=t.parentRequest;return r!==null?e(r)?!0:MD(r,e):!1};gr.traverseAncerstors=MD;var BD=function(t){return function(e){var r=function(n){return n!==null&&n.target!==null&&n.target.matchesTag(t)(e)};return r.metaData=new $K.Metadata(t,e),r}};gr.taggedConstraint=BD;var VK=BD(qK.NAMED_TAG);gr.namedConstraint=VK;var GK=function(t){return function(e){var r=null;if(e!==null)if(r=e.bindings[0],typeof t=="string"){var n=r.serviceIdentifier;return n===t}else{var i=e.bindings[0].implementationType;return t===i}return!1}};gr.typeConstraint=GK});var Ug=P(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});Fg.BindingWhenSyntax=void 0;var Tr=jg(),Bt=hI(),zK=(function(){function t(e){this._binding=e}return t.prototype.when=function(e){return this._binding.constraint=e,new Tr.BindingOnSyntax(this._binding)},t.prototype.whenTargetNamed=function(e){return this._binding.constraint=(0,Bt.namedConstraint)(e),new Tr.BindingOnSyntax(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){if(e===null)return!1;var r=e.target!==null&&!e.target.isNamed()&&!e.target.isTagged();return r},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenTargetTagged=function(e,r){return this._binding.constraint=(0,Bt.taggedConstraint)(e)(r),new Tr.BindingOnSyntax(this._binding)},t.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(r){return r!==null&&(0,Bt.typeConstraint)(e)(r.parentRequest)},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenParentNamed=function(e){return this._binding.constraint=function(r){return r!==null&&(0,Bt.namedConstraint)(e)(r.parentRequest)},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenParentTagged=function(e,r){return this._binding.constraint=function(n){return n!==null&&(0,Bt.taggedConstraint)(e)(r)(n.parentRequest)},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(r){return r!==null&&(0,Bt.traverseAncerstors)(r,(0,Bt.typeConstraint)(e))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(r){return r!==null&&!(0,Bt.traverseAncerstors)(r,(0,Bt.typeConstraint)(e))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(r){return r!==null&&(0,Bt.traverseAncerstors)(r,(0,Bt.namedConstraint)(e))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(r){return r!==null&&!(0,Bt.traverseAncerstors)(r,(0,Bt.namedConstraint)(e))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorTagged=function(e,r){return this._binding.constraint=function(n){return n!==null&&(0,Bt.traverseAncerstors)(n,(0,Bt.taggedConstraint)(e)(r))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorTagged=function(e,r){return this._binding.constraint=function(n){return n!==null&&!(0,Bt.traverseAncerstors)(n,(0,Bt.taggedConstraint)(e)(r))},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(r){return r!==null&&(0,Bt.traverseAncerstors)(r,e)},new Tr.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(r){return r!==null&&!(0,Bt.traverseAncerstors)(r,e)},new Tr.BindingOnSyntax(this._binding)},t})();Fg.BindingWhenSyntax=zK});var jg=P(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.BindingOnSyntax=void 0;var FD=Ug(),KK=(function(){function t(e){this._binding=e}return t.prototype.onActivation=function(e){return this._binding.onActivation=e,new FD.BindingWhenSyntax(this._binding)},t.prototype.onDeactivation=function(e){return this._binding.onDeactivation=e,new FD.BindingWhenSyntax(this._binding)},t})();Wg.BindingOnSyntax=KK});var mI=P(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.BindingWhenOnSyntax=void 0;var JK=jg(),XK=Ug(),YK=(function(){function t(e){this._binding=e,this._bindingWhenSyntax=new XK.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new JK.BindingOnSyntax(this._binding)}return t.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},t.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(e,r){return this._bindingWhenSyntax.whenTargetTagged(e,r)},t.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},t.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},t.prototype.whenParentTagged=function(e,r){return this._bindingWhenSyntax.whenParentTagged(e,r)},t.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},t.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},t.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},t.prototype.whenAnyAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,r)},t.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},t.prototype.whenNoAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenNoAncestorTagged(e,r)},t.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},t.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},t.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},t.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},t})();Hg.BindingWhenOnSyntax=YK});var UD=P(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.BindingInSyntax=void 0;var gI=xn(),yI=mI(),QK=(function(){function t(e){this._binding=e}return t.prototype.inRequestScope=function(){return this._binding.scope=gI.BindingScopeEnum.Request,new yI.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=gI.BindingScopeEnum.Singleton,new yI.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=gI.BindingScopeEnum.Transient,new yI.BindingWhenOnSyntax(this._binding)},t})();qg.BindingInSyntax=QK});var jD=P($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});$g.BindingInWhenOnSyntax=void 0;var ZK=UD(),e9=jg(),t9=Ug(),r9=(function(){function t(e){this._binding=e,this._bindingWhenSyntax=new t9.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new e9.BindingOnSyntax(this._binding),this._bindingInSyntax=new ZK.BindingInSyntax(e)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},t.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(e,r){return this._bindingWhenSyntax.whenTargetTagged(e,r)},t.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},t.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},t.prototype.whenParentTagged=function(e,r){return this._bindingWhenSyntax.whenParentTagged(e,r)},t.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},t.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},t.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},t.prototype.whenAnyAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,r)},t.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},t.prototype.whenNoAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenNoAncestorTagged(e,r)},t.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},t.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},t.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},t.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},t})();$g.BindingInWhenOnSyntax=r9});var qD=P(Ai=>{"use strict";var n9=Ai&&Ai.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),i9=Ai&&Ai.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),o9=Ai&&Ai.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n9(e,t,r);return i9(e,t),e};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.BindingToSyntax=void 0;var WD=o9(hr()),Pr=xn(),HD=jD(),Lu=mI(),s9=(function(){function t(e){this._binding=e}return t.prototype.to=function(e){return this._binding.type=Pr.BindingTypeEnum.Instance,this._binding.implementationType=e,new HD.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if(typeof this._binding.serviceIdentifier!="function")throw new Error(""+WD.INVALID_TO_SELF_VALUE);var e=this._binding.serviceIdentifier;return this.to(e)},t.prototype.toConstantValue=function(e){return this._binding.type=Pr.BindingTypeEnum.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=Pr.BindingScopeEnum.Singleton,new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(e){return this._binding.type=Pr.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new HD.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(e){return this._binding.type=Pr.BindingTypeEnum.Constructor,this._binding.implementationType=e,this._binding.scope=Pr.BindingScopeEnum.Singleton,new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(e){return this._binding.type=Pr.BindingTypeEnum.Factory,this._binding.factory=e,this._binding.scope=Pr.BindingScopeEnum.Singleton,new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(e){if(typeof e!="function")throw new Error(WD.INVALID_FUNCTION_BINDING);var r=this.toConstantValue(e);return this._binding.type=Pr.BindingTypeEnum.Function,this._binding.scope=Pr.BindingScopeEnum.Singleton,r},t.prototype.toAutoFactory=function(e){return this._binding.type=Pr.BindingTypeEnum.Factory,this._binding.factory=function(r){var n=function(){return r.container.get(e)};return n},this._binding.scope=Pr.BindingScopeEnum.Singleton,new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toAutoNamedFactory=function(e){return this._binding.type=Pr.BindingTypeEnum.Factory,this._binding.factory=function(r){return function(n){return r.container.getNamed(e,n)}},new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(e){return this._binding.type=Pr.BindingTypeEnum.Provider,this._binding.provider=e,this._binding.scope=Pr.BindingScopeEnum.Singleton,new Lu.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(e){this.toDynamicValue(function(r){return r.container.get(e)})},t})();Ai.BindingToSyntax=s9});var $D=P(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ContainerSnapshot=void 0;var a9=(function(){function t(){}return t.of=function(e,r,n,i,o){var s=new t;return s.bindings=e,s.middleware=r,s.deactivations=i,s.activations=n,s.moduleActivationStore=o,s},t})();Vg.ContainerSnapshot=a9});var VD=P(Gg=>{"use strict";Object.defineProperty(Gg,"__esModule",{value:!0});Gg.isClonable=void 0;function c9(t){return typeof t=="object"&&t!==null&&"clone"in t&&typeof t.clone=="function"}Gg.isClonable=c9});var bI=P(Di=>{"use strict";var u9=Di&&Di.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l9=Di&&Di.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),p9=Di&&Di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u9(e,t,r);return l9(e,t),e};Object.defineProperty(Di,"__esModule",{value:!0});Di.Lookup=void 0;var Ja=p9(hr()),d9=VD(),f9=(function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(e,r){if(e==null)throw new Error(Ja.NULL_ARGUMENT);if(r==null)throw new Error(Ja.NULL_ARGUMENT);var n=this._map.get(e);n!==void 0?n.push(r):this._map.set(e,[r])},t.prototype.get=function(e){if(e==null)throw new Error(Ja.NULL_ARGUMENT);var r=this._map.get(e);if(r!==void 0)return r;throw new Error(Ja.KEY_NOT_FOUND)},t.prototype.remove=function(e){if(e==null)throw new Error(Ja.NULL_ARGUMENT);if(!this._map.delete(e))throw new Error(Ja.KEY_NOT_FOUND)},t.prototype.removeIntersection=function(e){var r=this;this.traverse(function(n,i){var o=e.hasKey(n)?e.get(n):void 0;if(o!==void 0){var s=i.filter(function(a){return!o.some(function(c){return a===c})});r._setValue(n,s)}})},t.prototype.removeByCondition=function(e){var r=this,n=[];return this._map.forEach(function(i,o){for(var s=[],a=0,c=i;a<c.length;a++){var u=c[a],l=e(u);l?n.push(u):s.push(u)}r._setValue(o,s)}),n},t.prototype.hasKey=function(e){if(e==null)throw new Error(Ja.NULL_ARGUMENT);return this._map.has(e)},t.prototype.clone=function(){var e=new t;return this._map.forEach(function(r,n){r.forEach(function(i){return e.add(n,(0,d9.isClonable)(i)?i.clone():i)})}),e},t.prototype.traverse=function(e){this._map.forEach(function(r,n){e(n,r)})},t.prototype._setValue=function(e,r){r.length>0?this._map.set(e,r):this._map.delete(e)},t})();Di.Lookup=f9});var zD=P(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});zg.ModuleActivationStore=void 0;var GD=bI(),h9=(function(){function t(){this._map=new Map}return t.prototype.remove=function(e){if(this._map.has(e)){var r=this._map.get(e);return this._map.delete(e),r}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(e,r,n){this._getModuleActivationHandlers(e).onDeactivations.add(r,n)},t.prototype.addActivation=function(e,r,n){this._getModuleActivationHandlers(e).onActivations.add(r,n)},t.prototype.clone=function(){var e=new t;return this._map.forEach(function(r,n){e._map.set(n,{onActivations:r.onActivations.clone(),onDeactivations:r.onDeactivations.clone()})}),e},t.prototype._getModuleActivationHandlers=function(e){var r=this._map.get(e);return r===void 0&&(r=this._getEmptyHandlersStore(),this._map.set(e,r)),r},t.prototype._getEmptyHandlersStore=function(){var e={onActivations:new GD.Lookup,onDeactivations:new GD.Lookup};return e},t})();zg.ModuleActivationStore=h9});var JD=P($t=>{"use strict";var Jg=$t&&$t.__assign||function(){return Jg=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Jg.apply(this,arguments)},m9=$t&&$t.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),g9=$t&&$t.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),KD=$t&&$t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m9(e,t,r);return g9(e,t),e},Cn=$t&&$t.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{u(n.next(l))}catch(p){s(p)}}function c(l){try{u(n.throw(l))}catch(p){s(p)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})},Tn=$t&&$t.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},y9=$t&&$t.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty($t,"__esModule",{value:!0});$t.Container=void 0;var b9=JA(),si=KD(hr()),Nu=xn(),Xa=KD(Et()),v9=Jx(),Kg=iI(),w9=ND(),S9=qD(),Ya=vf(),_9=xs(),x9=Ka(),I9=$D(),Sf=bI(),C9=zD(),T9=(function(){function t(e){var r=e||{};if(typeof r!="object")throw new Error(""+si.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(r.defaultScope===void 0)r.defaultScope=Nu.BindingScopeEnum.Transient;else if(r.defaultScope!==Nu.BindingScopeEnum.Singleton&&r.defaultScope!==Nu.BindingScopeEnum.Transient&&r.defaultScope!==Nu.BindingScopeEnum.Request)throw new Error(""+si.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(r.autoBindInjectable===void 0)r.autoBindInjectable=!1;else if(typeof r.autoBindInjectable!="boolean")throw new Error(""+si.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(r.skipBaseClassChecks===void 0)r.skipBaseClassChecks=!1;else if(typeof r.skipBaseClassChecks!="boolean")throw new Error(""+si.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:r.autoBindInjectable,defaultScope:r.defaultScope,skipBaseClassChecks:r.skipBaseClassChecks},this.id=(0,_9.id)(),this._bindingDictionary=new Sf.Lookup,this._snapshots=[],this._middleware=null,this._activations=new Sf.Lookup,this._deactivations=new Sf.Lookup,this.parent=null,this._metadataReader=new v9.MetadataReader,this._moduleActivationStore=new C9.ModuleActivationStore}return t.merge=function(e,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=new t,s=y9([e,r],n,!0).map(function(u){return(0,Kg.getBindingDictionary)(u)}),a=(0,Kg.getBindingDictionary)(o);function c(u,l){u.traverse(function(p,d){d.forEach(function(f){l.add(f.serviceIdentifier,f.clone())})})}return s.forEach(function(u){c(u,a)}),o},t.prototype.load=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=this._getContainerModuleHelpersFactory(),i=0,o=e;i<o.length;i++){var s=o[i],a=n(s.id);s.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction,a.unbindAsyncFunction,a.onActivationFunction,a.onDeactivationFunction)}},t.prototype.loadAsync=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Cn(this,void 0,void 0,function(){var n,i,o,s,a;return Tn(this,function(c){switch(c.label){case 0:n=this._getContainerModuleHelpersFactory(),i=0,o=e,c.label=1;case 1:return i<o.length?(s=o[i],a=n(s.id),[4,s.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction,a.unbindAsyncFunction,a.onActivationFunction,a.onDeactivationFunction)]):[3,4];case 2:c.sent(),c.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},t.prototype.unload=function(){for(var e=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];r.forEach(function(i){var o=e._removeModuleBindings(i.id);e._deactivateSingletons(o),e._removeModuleHandlers(i.id)})},t.prototype.unloadAsync=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Cn(this,void 0,void 0,function(){var n,i,o,s;return Tn(this,function(a){switch(a.label){case 0:n=0,i=e,a.label=1;case 1:return n<i.length?(o=i[n],s=this._removeModuleBindings(o.id),[4,this._deactivateSingletonsAsync(s)]):[3,4];case 2:a.sent(),this._removeModuleHandlers(o.id),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.bind=function(e){var r=this.options.defaultScope||Nu.BindingScopeEnum.Transient,n=new b9.Binding(e,r);return this._bindingDictionary.add(e,n),new S9.BindingToSyntax(n)},t.prototype.rebind=function(e){return this.unbind(e),this.bind(e)},t.prototype.rebindAsync=function(e){return Cn(this,void 0,void 0,function(){return Tn(this,function(r){switch(r.label){case 0:return[4,this.unbindAsync(e)];case 1:return r.sent(),[2,this.bind(e)]}})})},t.prototype.unbind=function(e){if(this._bindingDictionary.hasKey(e)){var r=this._bindingDictionary.get(e);this._deactivateSingletons(r)}this._removeServiceFromDictionary(e)},t.prototype.unbindAsync=function(e){return Cn(this,void 0,void 0,function(){var r;return Tn(this,function(n){switch(n.label){case 0:return this._bindingDictionary.hasKey(e)?(r=this._bindingDictionary.get(e),[4,this._deactivateSingletonsAsync(r)]):[3,2];case 1:n.sent(),n.label=2;case 2:return this._removeServiceFromDictionary(e),[2]}})})},t.prototype.unbindAll=function(){var e=this;this._bindingDictionary.traverse(function(r,n){e._deactivateSingletons(n)}),this._bindingDictionary=new Sf.Lookup},t.prototype.unbindAllAsync=function(){return Cn(this,void 0,void 0,function(){var e,r=this;return Tn(this,function(n){switch(n.label){case 0:return e=[],this._bindingDictionary.traverse(function(i,o){e.push(r._deactivateSingletonsAsync(o))}),[4,Promise.all(e)];case 1:return n.sent(),this._bindingDictionary=new Sf.Lookup,[2]}})})},t.prototype.onActivation=function(e,r){this._activations.add(e,r)},t.prototype.onDeactivation=function(e,r){this._deactivations.add(e,r)},t.prototype.isBound=function(e){var r=this._bindingDictionary.hasKey(e);return!r&&this.parent&&(r=this.parent.isBound(e)),r},t.prototype.isCurrentBound=function(e){return this._bindingDictionary.hasKey(e)},t.prototype.isBoundNamed=function(e,r){return this.isBoundTagged(e,Xa.NAMED_TAG,r)},t.prototype.isBoundTagged=function(e,r,n){var i=!1;if(this._bindingDictionary.hasKey(e)){var o=this._bindingDictionary.get(e),s=(0,Kg.createMockRequest)(this,e,r,n);i=o.some(function(a){return a.constraint(s)})}return!i&&this.parent&&(i=this.parent.isBoundTagged(e,r,n)),i},t.prototype.snapshot=function(){this._snapshots.push(I9.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},t.prototype.restore=function(){var e=this._snapshots.pop();if(e===void 0)throw new Error(si.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=e.bindings,this._activations=e.activations,this._deactivations=e.deactivations,this._middleware=e.middleware,this._moduleActivationStore=e.moduleActivationStore},t.prototype.createChild=function(e){var r=new t(e||this.options);return r.parent=this,r},t.prototype.applyMiddleware=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=e.reduce(function(i,o){return o(i)},n)},t.prototype.applyCustomMetadataReader=function(e){this._metadataReader=e},t.prototype.get=function(e){var r=this._getNotAllArgs(e,!1);return this._getButThrowIfAsync(r)},t.prototype.getAsync=function(e){return Cn(this,void 0,void 0,function(){var r;return Tn(this,function(n){return r=this._getNotAllArgs(e,!1),[2,this._get(r)]})})},t.prototype.getTagged=function(e,r,n){var i=this._getNotAllArgs(e,!1,r,n);return this._getButThrowIfAsync(i)},t.prototype.getTaggedAsync=function(e,r,n){return Cn(this,void 0,void 0,function(){var i;return Tn(this,function(o){return i=this._getNotAllArgs(e,!1,r,n),[2,this._get(i)]})})},t.prototype.getNamed=function(e,r){return this.getTagged(e,Xa.NAMED_TAG,r)},t.prototype.getNamedAsync=function(e,r){return this.getTaggedAsync(e,Xa.NAMED_TAG,r)},t.prototype.getAll=function(e){var r=this._getAllArgs(e);return this._getButThrowIfAsync(r)},t.prototype.getAllAsync=function(e){var r=this._getAllArgs(e);return this._getAll(r)},t.prototype.getAllTagged=function(e,r,n){var i=this._getNotAllArgs(e,!0,r,n);return this._getButThrowIfAsync(i)},t.prototype.getAllTaggedAsync=function(e,r,n){var i=this._getNotAllArgs(e,!0,r,n);return this._getAll(i)},t.prototype.getAllNamed=function(e,r){return this.getAllTagged(e,Xa.NAMED_TAG,r)},t.prototype.getAllNamedAsync=function(e,r){return this.getAllTaggedAsync(e,Xa.NAMED_TAG,r)},t.prototype.resolve=function(e){var r=this.isBound(e);r||this.bind(e).toSelf();var n=this.get(e);return r||this.unbind(e),n},t.prototype._preDestroy=function(e,r){var n,i;if(Reflect.hasMetadata(Xa.PRE_DESTROY,e)){var o=Reflect.getMetadata(Xa.PRE_DESTROY,e);return(i=(n=r)[o.value])===null||i===void 0?void 0:i.call(n)}},t.prototype._removeModuleHandlers=function(e){var r=this._moduleActivationStore.remove(e);this._activations.removeIntersection(r.onActivations),this._deactivations.removeIntersection(r.onDeactivations)},t.prototype._removeModuleBindings=function(e){return this._bindingDictionary.removeByCondition(function(r){return r.moduleId===e})},t.prototype._deactivate=function(e,r){var n=this,i=Object.getPrototypeOf(r).constructor;try{if(this._deactivations.hasKey(e.serviceIdentifier)){var o=this._deactivateContainer(r,this._deactivations.get(e.serviceIdentifier).values());if((0,Ya.isPromise)(o))return this._handleDeactivationError(o.then(function(){return n._propagateContainerDeactivationThenBindingAndPreDestroyAsync(e,r,i)}),i)}var s=this._propagateContainerDeactivationThenBindingAndPreDestroy(e,r,i);if((0,Ya.isPromise)(s))return this._handleDeactivationError(s,i)}catch(a){if(a instanceof Error)throw new Error(si.ON_DEACTIVATION_ERROR(i.name,a.message))}},t.prototype._handleDeactivationError=function(e,r){return Cn(this,void 0,void 0,function(){var n;return Tn(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return i.sent(),[3,3];case 2:if(n=i.sent(),n instanceof Error)throw new Error(si.ON_DEACTIVATION_ERROR(r.name,n.message));return[3,3];case 3:return[2]}})})},t.prototype._deactivateContainer=function(e,r){for(var n=this,i=r.next();i.value;){var o=i.value(e);if((0,Ya.isPromise)(o))return o.then(function(){return n._deactivateContainerAsync(e,r)});i=r.next()}},t.prototype._deactivateContainerAsync=function(e,r){return Cn(this,void 0,void 0,function(){var n;return Tn(this,function(i){switch(i.label){case 0:n=r.next(),i.label=1;case 1:return n.value?[4,n.value(e)]:[3,3];case 2:return i.sent(),n=r.next(),[3,1];case 3:return[2]}})})},t.prototype._getContainerModuleHelpersFactory=function(){var e=this,r=function(l,p){l._binding.moduleId=p},n=function(l){return function(p){var d=e.bind(p);return r(d,l),d}},i=function(){return function(l){return e.unbind(l)}},o=function(){return function(l){return e.unbindAsync(l)}},s=function(){return function(l){return e.isBound(l)}},a=function(l){return function(p){var d=e.rebind(p);return r(d,l),d}},c=function(l){return function(p,d){e._moduleActivationStore.addActivation(l,p,d),e.onActivation(p,d)}},u=function(l){return function(p,d){e._moduleActivationStore.addDeactivation(l,p,d),e.onDeactivation(p,d)}};return function(l){return{bindFunction:n(l),isboundFunction:s(),onActivationFunction:c(l),onDeactivationFunction:u(l),rebindFunction:a(l),unbindFunction:i(),unbindAsyncFunction:o()}}},t.prototype._getAll=function(e){return Promise.all(this._get(e))},t.prototype._get=function(e){var r=Jg(Jg({},e),{contextInterceptor:function(i){return i},targetType:Nu.TargetTypeEnum.Variable});if(this._middleware){var n=this._middleware(r);if(n==null)throw new Error(si.INVALID_MIDDLEWARE_RETURN);return n}return this._planAndResolve()(r)},t.prototype._getButThrowIfAsync=function(e){var r=this._get(e);if((0,Ya.isPromiseOrContainsPromise)(r))throw new Error(si.LAZY_IN_SYNC(e.serviceIdentifier));return r},t.prototype._getAllArgs=function(e){var r={avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:e};return r},t.prototype._getNotAllArgs=function(e,r,n,i){var o={avoidConstraints:!1,isMultiInject:r,serviceIdentifier:e,key:n,value:i};return o},t.prototype._planAndResolve=function(){var e=this;return function(r){var n=(0,Kg.plan)(e._metadataReader,e,r.isMultiInject,r.targetType,r.serviceIdentifier,r.key,r.value,r.avoidConstraints);n=r.contextInterceptor(n);var i=(0,w9.resolve)(n);return i}},t.prototype._deactivateIfSingleton=function(e){var r=this;if(e.activated)return(0,Ya.isPromise)(e.cache)?e.cache.then(function(n){return r._deactivate(e,n)}):this._deactivate(e,e.cache)},t.prototype._deactivateSingletons=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r],o=this._deactivateIfSingleton(i);if((0,Ya.isPromise)(o))throw new Error(si.ASYNC_UNBIND_REQUIRED)}},t.prototype._deactivateSingletonsAsync=function(e){return Cn(this,void 0,void 0,function(){var r=this;return Tn(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(i){return r._deactivateIfSingleton(i)}))];case 1:return n.sent(),[2]}})})},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(e,r,n){return this.parent?this._deactivate.bind(this.parent)(e,r):this._bindingDeactivationAndPreDestroy(e,r,n)},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(e,r,n){return Cn(this,void 0,void 0,function(){return Tn(this,function(i){switch(i.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(e,r)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(e,r,n)];case 3:i.sent(),i.label=4;case 4:return[2]}})})},t.prototype._removeServiceFromDictionary=function(e){try{this._bindingDictionary.remove(e)}catch{throw new Error(si.CANNOT_UNBIND+" "+(0,x9.getServiceIdentifierAsString)(e))}},t.prototype._bindingDeactivationAndPreDestroy=function(e,r,n){var i=this;if(typeof e.onDeactivation=="function"){var o=e.onDeactivation(r);if((0,Ya.isPromise)(o))return o.then(function(){return i._preDestroy(n,r)})}return this._preDestroy(n,r)},t.prototype._bindingDeactivationAndPreDestroyAsync=function(e,r,n){return Cn(this,void 0,void 0,function(){return Tn(this,function(i){switch(i.label){case 0:return typeof e.onDeactivation!="function"?[3,2]:[4,e.onDeactivation(r)];case 1:i.sent(),i.label=2;case 2:return[4,this._preDestroy(n,r)];case 3:return i.sent(),[2]}})})},t})();$t.Container=T9});var YD=P(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.AsyncContainerModule=Mu.ContainerModule=void 0;var XD=xs(),P9=(function(){function t(e){this.id=(0,XD.id)(),this.registry=e}return t})();Mu.ContainerModule=P9;var E9=(function(){function t(e){this.id=(0,XD.id)(),this.registry=e}return t})();Mu.AsyncContainerModule=E9});var QD=P(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});Xg.getFirstArrayDuplicate=void 0;function k9(t){for(var e=new Set,r=0,n=t;r<n.length;r++){var i=n[r];if(e.has(i))return i;e.add(i)}}Xg.getFirstArrayDuplicate=k9});var Lo=P(yr=>{"use strict";var R9=yr&&yr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),A9=yr&&yr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),e1=yr&&yr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R9(e,t,r);return A9(e,t),e};Object.defineProperty(yr,"__esModule",{value:!0});yr.createTaggedDecorator=yr.tagProperty=yr.tagParameter=yr.decorate=void 0;var Yg=e1(hr()),t1=e1(Et()),D9=QD();function O9(t){return t.prototype!==void 0}function L9(t){if(t!==void 0)throw new Error(Yg.INVALID_DECORATOR_OPERATION)}function r1(t,e,r,n){L9(e),i1(t1.TAGGED,t,r.toString(),n)}yr.tagParameter=r1;function n1(t,e,r){if(O9(t))throw new Error(Yg.INVALID_DECORATOR_OPERATION);i1(t1.TAGGED_PROP,t.constructor,e,r)}yr.tagProperty=n1;function N9(t){var e=[];if(Array.isArray(t)){e=t;var r=(0,D9.getFirstArrayDuplicate)(e.map(function(n){return n.key}));if(r!==void 0)throw new Error(Yg.DUPLICATED_METADATA+" "+r.toString())}else e=[t];return e}function i1(t,e,r,n){var i=N9(n),o={};Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var s=o[r];if(s===void 0)s=[];else for(var a=function(p){if(i.some(function(d){return d.key===p.key}))throw new Error(Yg.DUPLICATED_METADATA+" "+p.key.toString())},c=0,u=s;c<u.length;c++){var l=u[c];a(l)}s.push.apply(s,i),o[r]=s,Reflect.defineMetadata(t,o,e)}function M9(t){return function(e,r,n){typeof n=="number"?r1(e,r,n,t):n1(e,r,t)}}yr.createTaggedDecorator=M9;function ZD(t,e){Reflect.decorate(t,e)}function B9(t,e){return function(r,n){e(r,n,t)}}function F9(t,e,r){typeof r=="number"?ZD([B9(r,t)],e):typeof r=="string"?Reflect.decorate([t],e,r):ZD([t],e)}yr.decorate=F9});var s1=P(Oi=>{"use strict";var U9=Oi&&Oi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),j9=Oi&&Oi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),o1=Oi&&Oi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U9(e,t,r);return j9(e,t),e};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.injectable=void 0;var W9=o1(hr()),vI=o1(Et());function H9(){return function(t){if(Reflect.hasOwnMetadata(vI.PARAM_TYPES,t))throw new Error(W9.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(vI.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(vI.PARAM_TYPES,e,t),t}}Oi.injectable=H9});var a1=P(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});Qg.tagged=void 0;var q9=oi(),$9=Lo();function V9(t,e){return(0,$9.createTaggedDecorator)(new q9.Metadata(t,e))}Qg.tagged=V9});var c1=P(Li=>{"use strict";var G9=Li&&Li.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),z9=Li&&Li.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),K9=Li&&Li.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G9(e,t,r);return z9(e,t),e};Object.defineProperty(Li,"__esModule",{value:!0});Li.named=void 0;var J9=K9(Et()),X9=oi(),Y9=Lo();function Q9(t){return(0,Y9.createTaggedDecorator)(new X9.Metadata(J9.NAMED_TAG,t))}Li.named=Q9});var wI=P(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});Zg.injectBase=void 0;var Z9=hr(),e7=oi(),t7=Lo();function r7(t){return function(e){return function(r,n,i){if(e===void 0){var o=typeof r=="function"?r.name:r.constructor.name;throw new Error((0,Z9.UNDEFINED_INJECT_ANNOTATION)(o))}return(0,t7.createTaggedDecorator)(new e7.Metadata(t,e))(r,n,i)}}}Zg.injectBase=r7});var u1=P(Ni=>{"use strict";var n7=Ni&&Ni.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),i7=Ni&&Ni.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),o7=Ni&&Ni.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n7(e,t,r);return i7(e,t),e};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.inject=void 0;var s7=o7(Et()),a7=wI(),c7=(0,a7.injectBase)(s7.INJECT_TAG);Ni.inject=c7});var l1=P(Mi=>{"use strict";var u7=Mi&&Mi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l7=Mi&&Mi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),p7=Mi&&Mi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u7(e,t,r);return l7(e,t),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.optional=void 0;var d7=p7(Et()),f7=oi(),h7=Lo();function m7(){return(0,h7.createTaggedDecorator)(new f7.Metadata(d7.OPTIONAL_TAG,!0))}Mi.optional=m7});var p1=P(Bi=>{"use strict";var g7=Bi&&Bi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),y7=Bi&&Bi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),b7=Bi&&Bi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g7(e,t,r);return y7(e,t),e};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.unmanaged=void 0;var v7=b7(Et()),w7=oi(),S7=Lo();function _7(){return function(t,e,r){var n=new w7.Metadata(v7.UNMANAGED_TAG,!0);(0,S7.tagParameter)(t,e,r,n)}}Bi.unmanaged=_7});var d1=P(Fi=>{"use strict";var x7=Fi&&Fi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),I7=Fi&&Fi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),C7=Fi&&Fi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x7(e,t,r);return I7(e,t),e};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.multiInject=void 0;var T7=C7(Et()),P7=wI(),E7=(0,P7.injectBase)(T7.MULTI_INJECT_TAG);Fi.multiInject=E7});var f1=P(Ui=>{"use strict";var k7=Ui&&Ui.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),R7=Ui&&Ui.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),A7=Ui&&Ui.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k7(e,t,r);return R7(e,t),e};Object.defineProperty(Ui,"__esModule",{value:!0});Ui.targetName=void 0;var D7=A7(Et()),O7=oi(),L7=Lo();function N7(t){return function(e,r,n){var i=new O7.Metadata(D7.NAME_TAG,t);(0,L7.tagParameter)(e,r,n,i)}}Ui.targetName=N7});var SI=P(ey=>{"use strict";Object.defineProperty(ey,"__esModule",{value:!0});ey.propertyEventDecorator=void 0;var M7=oi();function B7(t,e){return function(){return function(r,n){var i=new M7.Metadata(t,n);if(Reflect.hasOwnMetadata(t,r.constructor))throw new Error(e);Reflect.defineMetadata(t,i,r.constructor)}}}ey.propertyEventDecorator=B7});var m1=P(ji=>{"use strict";var F7=ji&&ji.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),U7=ji&&ji.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),h1=ji&&ji.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F7(e,t,r);return U7(e,t),e};Object.defineProperty(ji,"__esModule",{value:!0});ji.postConstruct=void 0;var j7=h1(hr()),W7=h1(Et()),H7=SI(),q7=(0,H7.propertyEventDecorator)(W7.POST_CONSTRUCT,j7.MULTIPLE_POST_CONSTRUCT_METHODS);ji.postConstruct=q7});var y1=P(Wi=>{"use strict";var $7=Wi&&Wi.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),V7=Wi&&Wi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),g1=Wi&&Wi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$7(e,t,r);return V7(e,t),e};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.preDestroy=void 0;var G7=g1(hr()),z7=g1(Et()),K7=SI(),J7=(0,K7.propertyEventDecorator)(z7.PRE_DESTROY,G7.MULTIPLE_PRE_DESTROY_METHODS);Wi.preDestroy=J7});var b1=P(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.interfaces=void 0;var _I;_I||(_I={});ty.interfaces=_I});var H=P(te=>{"use strict";var X7=te&&te.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Y7=te&&te.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Q7=te&&te.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X7(e,t,r);return Y7(e,t),e};Object.defineProperty(te,"__esModule",{value:!0});te.multiBindToService=te.getServiceIdentifierAsString=te.typeConstraint=te.namedConstraint=te.taggedConstraint=te.traverseAncerstors=te.decorate=te.interfaces=te.id=te.MetadataReader=te.preDestroy=te.postConstruct=te.targetName=te.multiInject=te.unmanaged=te.optional=te.LazyServiceIdentifer=te.LazyServiceIdentifier=te.inject=te.named=te.tagged=te.injectable=te.createTaggedDecorator=te.ContainerModule=te.AsyncContainerModule=te.TargetTypeEnum=te.BindingTypeEnum=te.BindingScopeEnum=te.Container=te.METADATA_KEY=void 0;var Z7=Q7(Et());te.METADATA_KEY=Z7;var eJ=JD();Object.defineProperty(te,"Container",{enumerable:!0,get:function(){return eJ.Container}});var xI=xn();Object.defineProperty(te,"BindingScopeEnum",{enumerable:!0,get:function(){return xI.BindingScopeEnum}});Object.defineProperty(te,"BindingTypeEnum",{enumerable:!0,get:function(){return xI.BindingTypeEnum}});Object.defineProperty(te,"TargetTypeEnum",{enumerable:!0,get:function(){return xI.TargetTypeEnum}});var v1=YD();Object.defineProperty(te,"AsyncContainerModule",{enumerable:!0,get:function(){return v1.AsyncContainerModule}});Object.defineProperty(te,"ContainerModule",{enumerable:!0,get:function(){return v1.ContainerModule}});var tJ=Lo();Object.defineProperty(te,"createTaggedDecorator",{enumerable:!0,get:function(){return tJ.createTaggedDecorator}});var rJ=s1();Object.defineProperty(te,"injectable",{enumerable:!0,get:function(){return rJ.injectable}});var nJ=a1();Object.defineProperty(te,"tagged",{enumerable:!0,get:function(){return nJ.tagged}});var iJ=c1();Object.defineProperty(te,"named",{enumerable:!0,get:function(){return iJ.named}});var oJ=u1();Object.defineProperty(te,"inject",{enumerable:!0,get:function(){return oJ.inject}});var sJ=Ag();Object.defineProperty(te,"LazyServiceIdentifier",{enumerable:!0,get:function(){return sJ.LazyServiceIdentifier}});var aJ=Ag();Object.defineProperty(te,"LazyServiceIdentifer",{enumerable:!0,get:function(){return aJ.LazyServiceIdentifier}});var cJ=l1();Object.defineProperty(te,"optional",{enumerable:!0,get:function(){return cJ.optional}});var uJ=p1();Object.defineProperty(te,"unmanaged",{enumerable:!0,get:function(){return uJ.unmanaged}});var lJ=d1();Object.defineProperty(te,"multiInject",{enumerable:!0,get:function(){return lJ.multiInject}});var pJ=f1();Object.defineProperty(te,"targetName",{enumerable:!0,get:function(){return pJ.targetName}});var dJ=m1();Object.defineProperty(te,"postConstruct",{enumerable:!0,get:function(){return dJ.postConstruct}});var fJ=y1();Object.defineProperty(te,"preDestroy",{enumerable:!0,get:function(){return fJ.preDestroy}});var hJ=Jx();Object.defineProperty(te,"MetadataReader",{enumerable:!0,get:function(){return hJ.MetadataReader}});var mJ=xs();Object.defineProperty(te,"id",{enumerable:!0,get:function(){return mJ.id}});var gJ=b1();Object.defineProperty(te,"interfaces",{enumerable:!0,get:function(){return gJ.interfaces}});var yJ=Lo();Object.defineProperty(te,"decorate",{enumerable:!0,get:function(){return yJ.decorate}});var ry=hI();Object.defineProperty(te,"traverseAncerstors",{enumerable:!0,get:function(){return ry.traverseAncerstors}});Object.defineProperty(te,"taggedConstraint",{enumerable:!0,get:function(){return ry.taggedConstraint}});Object.defineProperty(te,"namedConstraint",{enumerable:!0,get:function(){return ry.namedConstraint}});Object.defineProperty(te,"typeConstraint",{enumerable:!0,get:function(){return ry.typeConstraint}});var bJ=Ka();Object.defineProperty(te,"getServiceIdentifierAsString",{enumerable:!0,get:function(){return bJ.getServiceIdentifierAsString}});var vJ=aI();Object.defineProperty(te,"multiBindToService",{enumerable:!0,get:function(){return vJ.multiBindToService}})});var S1=P(()=>{var w1;(function(t){(function(e){var r=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:a(),n=i(t);typeof r.Reflect<"u"&&(n=i(r.Reflect,n)),e(n,r),typeof r.Reflect>"u"&&(r.Reflect=t);function i(c,u){return function(l,p){Object.defineProperty(c,l,{configurable:!0,writable:!0,value:p}),u&&u(l,p)}}function o(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function a(){return o()||s()}})(function(e,r){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",a=typeof Object.create=="function",c={__proto__:[]}instanceof Array,u=!a&&!c,l={create:a?function(){return Z_(Object.create(null))}:c?function(){return Z_({__proto__:null})}:function(){return Z_({})},has:u?function(R,N){return n.call(R,N)}:function(R,N){return N in R},get:u?function(R,N){return n.call(R,N)?R[N]:void 0}:function(R,N){return R[N]}},p=Object.getPrototypeOf(Function),d=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:IG(),f=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:CG(),h=typeof WeakMap=="function"?WeakMap:TG(),m=i?Symbol.for("@reflect-metadata:registry"):void 0,x=SG(),C=_G(x);function O(R,N,U,J){if(ee(U)){if(!D(R))throw new TypeError;if(!fe(N))throw new TypeError;return B(R,N)}else{if(!D(R))throw new TypeError;if(!xe(N))throw new TypeError;if(!xe(J)&&!ee(J)&&!yt(J))throw new TypeError;return yt(J)&&(J=void 0),U=se(U),F(R,N,U,J)}}e("decorate",O);function y(R,N){function U(J,he){if(!xe(J))throw new TypeError;if(!ee(he)&&!Ie(he))throw new TypeError;K(R,N,J,he)}return U}e("metadata",y);function T(R,N,U,J){if(!xe(U))throw new TypeError;return ee(J)||(J=se(J)),K(R,N,U,J)}e("defineMetadata",T);function E(R,N,U){if(!xe(N))throw new TypeError;return ee(U)||(U=se(U)),G(R,N,U)}e("hasMetadata",E);function M(R,N,U){if(!xe(N))throw new TypeError;return ee(U)||(U=se(U)),b(R,N,U)}e("hasOwnMetadata",M);function k(R,N,U){if(!xe(N))throw new TypeError;return ee(U)||(U=se(U)),S(R,N,U)}e("getMetadata",k);function A(R,N,U){if(!xe(N))throw new TypeError;return ee(U)||(U=se(U)),pe(R,N,U)}e("getOwnMetadata",A);function W(R,N){if(!xe(R))throw new TypeError;return ee(N)||(N=se(N)),Se(R,N)}e("getMetadataKeys",W);function Z(R,N){if(!xe(R))throw new TypeError;return ee(N)||(N=se(N)),ue(R,N)}e("getOwnMetadataKeys",Z);function _(R,N,U){if(!xe(N))throw new TypeError;if(ee(U)||(U=se(U)),!xe(N))throw new TypeError;ee(U)||(U=se(U));var J=ef(N,U,!1);return ee(J)?!1:J.OrdinaryDeleteMetadata(R,N,U)}e("deleteMetadata",_);function B(R,N){for(var U=R.length-1;U>=0;--U){var J=R[U],he=J(N);if(!ee(he)&&!yt(he)){if(!fe(he))throw new TypeError;N=he}}return N}function F(R,N,U,J){for(var he=R.length-1;he>=0;--he){var _t=R[he],Mt=_t(N,U,J);if(!ee(Mt)&&!yt(Mt)){if(!xe(Mt))throw new TypeError;J=Mt}}return J}function G(R,N,U){var J=b(R,N,U);if(J)return!0;var he=Q_(N);return yt(he)?!1:G(R,he,U)}function b(R,N,U){var J=ef(N,U,!1);return ee(J)?!1:Su(J.OrdinaryHasOwnMetadata(R,N,U))}function S(R,N,U){var J=b(R,N,U);if(J)return pe(R,N,U);var he=Q_(N);if(!yt(he))return S(R,he,U)}function pe(R,N,U){var J=ef(N,U,!1);if(!ee(J))return J.OrdinaryGetOwnMetadata(R,N,U)}function K(R,N,U,J){var he=ef(U,J,!0);he.OrdinaryDefineOwnMetadata(R,N,U,J)}function Se(R,N){var U=ue(R,N),J=Q_(R);if(J===null)return U;var he=Se(J,N);if(he.length<=0)return U;if(U.length<=0)return he;for(var _t=new f,Mt=[],Ee=0,Q=U;Ee<Q.length;Ee++){var ie=Q[Ee],ne=_t.has(ie);ne||(_t.add(ie),Mt.push(ie))}for(var ae=0,ke=he;ae<ke.length;ae++){var ie=ke[ae],ne=_t.has(ie);ne||(_t.add(ie),Mt.push(ie))}return Mt}function ue(R,N){var U=ef(R,N,!1);return U?U.OrdinaryOwnMetadataKeys(R,N):[]}function Le(R){if(R===null)return 1;switch(typeof R){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return R===null?1:6;default:return 6}}function ee(R){return R===void 0}function yt(R){return R===null}function sr(R){return typeof R=="symbol"}function xe(R){return typeof R=="object"?R!==null:typeof R=="function"}function X(R,N){switch(Le(R)){case 0:return R;case 1:return R;case 2:return R;case 3:return R;case 4:return R;case 5:return R}var U=N===3?"string":N===5?"number":"default",J=ot(R,o);if(J!==void 0){var he=J.call(R,U);if(xe(he))throw new TypeError;return he}return ei(R,U==="default"?"number":U)}function ei(R,N){if(N==="string"){var U=R.toString;if(z(U)){var J=U.call(R);if(!xe(J))return J}var he=R.valueOf;if(z(he)){var J=he.call(R);if(!xe(J))return J}}else{var he=R.valueOf;if(z(he)){var J=he.call(R);if(!xe(J))return J}var _t=R.toString;if(z(_t)){var J=_t.call(R);if(!xe(J))return J}}throw new TypeError}function Su(R){return!!R}function L(R){return""+R}function se(R){var N=X(R,3);return sr(N)?N:L(N)}function D(R){return Array.isArray?Array.isArray(R):R instanceof Object?R instanceof Array:Object.prototype.toString.call(R)==="[object Array]"}function z(R){return typeof R=="function"}function fe(R){return typeof R=="function"}function Ie(R){switch(Le(R)){case 3:return!0;case 4:return!0;default:return!1}}function le(R,N){return R===N||R!==R&&N!==N}function ot(R,N){var U=R[N];if(U!=null){if(!z(U))throw new TypeError;return U}}function st(R){var N=ot(R,s);if(!z(N))throw new TypeError;var U=N.call(R);if(!xe(U))throw new TypeError;return U}function Lk(R){return R.value}function Nk(R){var N=R.next();return N.done?!1:N}function Mk(R){var N=R.return;N&&N.call(R)}function Q_(R){var N=Object.getPrototypeOf(R);if(typeof R!="function"||R===p||N!==p)return N;var U=R.prototype,J=U&&Object.getPrototypeOf(U);if(J==null||J===Object.prototype)return N;var he=J.constructor;return typeof he!="function"||he===R?N:he}function wG(){var R;!ee(m)&&typeof r.Reflect<"u"&&!(m in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(R=xG(r.Reflect));var N,U,J,he=new h,_t={registerProvider:Mt,getProvider:Q,setProvider:ne};return _t;function Mt(ae){if(!Object.isExtensible(_t))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case R===ae:break;case ee(N):N=ae;break;case N===ae:break;case ee(U):U=ae;break;case U===ae:break;default:J===void 0&&(J=new f),J.add(ae);break}}function Ee(ae,ke){if(!ee(N)){if(N.isProviderFor(ae,ke))return N;if(!ee(U)){if(U.isProviderFor(ae,ke))return N;if(!ee(J))for(var et=st(J);;){var xt=Nk(et);if(!xt)return;var ti=Lk(xt);if(ti.isProviderFor(ae,ke))return Mk(et),ti}}}if(!ee(R)&&R.isProviderFor(ae,ke))return R}function Q(ae,ke){var et=he.get(ae),xt;return ee(et)||(xt=et.get(ke)),ee(xt)&&(xt=Ee(ae,ke),ee(xt)||(ee(et)&&(et=new d,he.set(ae,et)),et.set(ke,xt))),xt}function ie(ae){if(ee(ae))throw new TypeError;return N===ae||U===ae||!ee(J)&&J.has(ae)}function ne(ae,ke,et){if(!ie(et))throw new Error("Metadata provider not registered.");var xt=Q(ae,ke);if(xt!==et){if(!ee(xt))return!1;var ti=he.get(ae);ee(ti)&&(ti=new d,he.set(ae,ti)),ti.set(ke,et)}return!0}}function SG(){var R;return!ee(m)&&xe(r.Reflect)&&Object.isExtensible(r.Reflect)&&(R=r.Reflect[m]),ee(R)&&(R=wG()),!ee(m)&&xe(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:R}),R}function _G(R){var N=new h,U={isProviderFor:function(ie,ne){var ae=N.get(ie);return ee(ae)?!1:ae.has(ne)},OrdinaryDefineOwnMetadata:Mt,OrdinaryHasOwnMetadata:he,OrdinaryGetOwnMetadata:_t,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:Q};return x.registerProvider(U),U;function J(ie,ne,ae){var ke=N.get(ie),et=!1;if(ee(ke)){if(!ae)return;ke=new d,N.set(ie,ke),et=!0}var xt=ke.get(ne);if(ee(xt)){if(!ae)return;if(xt=new d,ke.set(ne,xt),!R.setProvider(ie,ne,U))throw ke.delete(ne),et&&N.delete(ie),new Error("Wrong provider for target.")}return xt}function he(ie,ne,ae){var ke=J(ne,ae,!1);return ee(ke)?!1:Su(ke.has(ie))}function _t(ie,ne,ae){var ke=J(ne,ae,!1);if(!ee(ke))return ke.get(ie)}function Mt(ie,ne,ae,ke){var et=J(ae,ke,!0);et.set(ie,ne)}function Ee(ie,ne){var ae=[],ke=J(ie,ne,!1);if(ee(ke))return ae;for(var et=ke.keys(),xt=st(et),ti=0;;){var Bk=Nk(xt);if(!Bk)return ae.length=ti,ae;var PG=Lk(Bk);try{ae[ti]=PG}catch(EG){try{Mk(xt)}finally{throw EG}}ti++}}function Q(ie,ne,ae){var ke=J(ne,ae,!1);if(ee(ke)||!ke.delete(ie))return!1;if(ke.size===0){var et=N.get(ne);ee(et)||(et.delete(ae),et.size===0&&N.delete(et))}return!0}}function xG(R){var N=R.defineMetadata,U=R.hasOwnMetadata,J=R.getOwnMetadata,he=R.getOwnMetadataKeys,_t=R.deleteMetadata,Mt=new h,Ee={isProviderFor:function(Q,ie){var ne=Mt.get(Q);return ee(ne)?he(Q,ie).length?(ee(ne)&&(ne=new f,Mt.set(Q,ne)),ne.add(ie),!0):!1:ne.has(ie)},OrdinaryDefineOwnMetadata:N,OrdinaryHasOwnMetadata:U,OrdinaryGetOwnMetadata:J,OrdinaryOwnMetadataKeys:he,OrdinaryDeleteMetadata:_t};return Ee}function ef(R,N,U){var J=x.getProvider(R,N);if(!ee(J))return J;if(U){if(x.setProvider(R,N,C))return C;throw new Error("Illegal state.")}}function IG(){var R={},N=[],U=(function(){function Ee(Q,ie,ne){this._index=0,this._keys=Q,this._values=ie,this._selector=ne}return Ee.prototype["@@iterator"]=function(){return this},Ee.prototype[s]=function(){return this},Ee.prototype.next=function(){var Q=this._index;if(Q>=0&&Q<this._keys.length){var ie=this._selector(this._keys[Q],this._values[Q]);return Q+1>=this._keys.length?(this._index=-1,this._keys=N,this._values=N):this._index++,{value:ie,done:!1}}return{value:void 0,done:!0}},Ee.prototype.throw=function(Q){throw this._index>=0&&(this._index=-1,this._keys=N,this._values=N),Q},Ee.prototype.return=function(Q){return this._index>=0&&(this._index=-1,this._keys=N,this._values=N),{value:Q,done:!0}},Ee})(),J=(function(){function Ee(){this._keys=[],this._values=[],this._cacheKey=R,this._cacheIndex=-2}return Object.defineProperty(Ee.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ee.prototype.has=function(Q){return this._find(Q,!1)>=0},Ee.prototype.get=function(Q){var ie=this._find(Q,!1);return ie>=0?this._values[ie]:void 0},Ee.prototype.set=function(Q,ie){var ne=this._find(Q,!0);return this._values[ne]=ie,this},Ee.prototype.delete=function(Q){var ie=this._find(Q,!1);if(ie>=0){for(var ne=this._keys.length,ae=ie+1;ae<ne;ae++)this._keys[ae-1]=this._keys[ae],this._values[ae-1]=this._values[ae];return this._keys.length--,this._values.length--,le(Q,this._cacheKey)&&(this._cacheKey=R,this._cacheIndex=-2),!0}return!1},Ee.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=R,this._cacheIndex=-2},Ee.prototype.keys=function(){return new U(this._keys,this._values,he)},Ee.prototype.values=function(){return new U(this._keys,this._values,_t)},Ee.prototype.entries=function(){return new U(this._keys,this._values,Mt)},Ee.prototype["@@iterator"]=function(){return this.entries()},Ee.prototype[s]=function(){return this.entries()},Ee.prototype._find=function(Q,ie){if(!le(this._cacheKey,Q)){this._cacheIndex=-1;for(var ne=0;ne<this._keys.length;ne++)if(le(this._keys[ne],Q)){this._cacheIndex=ne;break}}return this._cacheIndex<0&&ie&&(this._cacheIndex=this._keys.length,this._keys.push(Q),this._values.push(void 0)),this._cacheIndex},Ee})();return J;function he(Ee,Q){return Ee}function _t(Ee,Q){return Q}function Mt(Ee,Q){return[Ee,Q]}}function CG(){var R=(function(){function N(){this._map=new d}return Object.defineProperty(N.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),N.prototype.has=function(U){return this._map.has(U)},N.prototype.add=function(U){return this._map.set(U,U),this},N.prototype.delete=function(U){return this._map.delete(U)},N.prototype.clear=function(){this._map.clear()},N.prototype.keys=function(){return this._map.keys()},N.prototype.values=function(){return this._map.keys()},N.prototype.entries=function(){return this._map.entries()},N.prototype["@@iterator"]=function(){return this.keys()},N.prototype[s]=function(){return this.keys()},N})();return R}function TG(){var R=16,N=l.create(),U=J();return(function(){function Q(){this._key=J()}return Q.prototype.has=function(ie){var ne=he(ie,!1);return ne!==void 0?l.has(ne,this._key):!1},Q.prototype.get=function(ie){var ne=he(ie,!1);return ne!==void 0?l.get(ne,this._key):void 0},Q.prototype.set=function(ie,ne){var ae=he(ie,!0);return ae[this._key]=ne,this},Q.prototype.delete=function(ie){var ne=he(ie,!1);return ne!==void 0?delete ne[this._key]:!1},Q.prototype.clear=function(){this._key=J()},Q})();function J(){var Q;do Q="@@WeakMap@@"+Ee();while(l.has(N,Q));return N[Q]=!0,Q}function he(Q,ie){if(!n.call(Q,U)){if(!ie)return;Object.defineProperty(Q,U,{value:l.create()})}return Q[U]}function _t(Q,ie){for(var ne=0;ne<ie;++ne)Q[ne]=Math.random()*255|0;return Q}function Mt(Q){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(Q)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(Q)):_t(new Uint8Array(Q),Q):_t(new Array(Q),Q)}function Ee(){var Q=Mt(R);Q[6]=Q[6]&79|64,Q[8]=Q[8]&191|128;for(var ie="",ne=0;ne<R;++ne){var ae=Q[ne];(ne===4||ne===6||ne===8)&&(ie+="-"),ae<16&&(ie+="0"),ie+=ae.toString(16).toLowerCase()}return ie}}function Z_(R){return R.__=void 0,delete R.__,R}})})(w1||(w1={}))});var bL=P((Fme,pc)=>{var gL={};gL.__wbindgen_placeholder__=pc.exports;var eo,{TextDecoder:WX}=require("util"),Gy=null;function oC(){return(Gy===null||Gy.byteLength===0)&&(Gy=new Uint8Array(eo.memory.buffer)),Gy}function HX(t,e){return t=t>>>0,oC().subarray(t/1,t/1+e)}var Wo=new Array(128).fill(void 0);Wo.push(void 0,null,!0,!1);function zy(t){return Wo[t]}var Ff=Wo.length;function qX(t){t<132||(Wo[t]=Ff,Ff=t)}function $X(t){let e=zy(t);return qX(t),e}var yL=new WX("utf-8",{ignoreBOM:!0,fatal:!0});yL.decode();function VX(t,e){return t=t>>>0,yL.decode(oC().subarray(t,t+e))}var nC=0;function hL(t,e){let r=e(t.length*1,1)>>>0;return oC().set(t,r/1),nC=t.length,r}function GX(t){Ff===Wo.length&&Wo.push(Wo.length+1);let e=Ff;return Ff=Wo[e],Wo[e]=t,e}var mL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>eo.__wbg_hasher_free(t>>>0,1)),iC=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,mL.unregister(this),e}free(){let e=this.__destroy_into_raw();eo.__wbg_hasher_free(e,0)}constructor(){let e=eo.hasher_new();return this.__wbg_ptr=e>>>0,mL.register(this,this.__wbg_ptr,this),this}update(e){let r=hL(e,eo.__wbindgen_malloc),n=nC;eo.hasher_update(this.__wbg_ptr,r,n)}digest(e){var r=hL(e,eo.__wbindgen_malloc),n=nC;eo.hasher_digest(this.__wbg_ptr,r,n,GX(e))}};pc.exports.Hasher=iC;pc.exports.__wbindgen_copy_to_typed_array=function(t,e,r){new Uint8Array(zy(r).buffer,zy(r).byteOffset,zy(r).byteLength).set(HX(t,e))};pc.exports.__wbindgen_object_drop_ref=function(t){$X(t)};pc.exports.__wbindgen_throw=function(t,e){throw new Error(VX(t,e))};var zX=require("path").join(__dirname,"chromehash_bg.wasm"),KX=require("fs").readFileSync(zX),JX=new WebAssembly.Module(KX),XX=new WebAssembly.Instance(JX,gL);eo=XX.exports;pc.exports.__wasm=eo});var IL=P(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.normalizeShaBuffer=cn.shaHashFile=cn.hashFile=cn.shaHash=cn.hash=void 0;var SL=bL(),_L=require("fs"),vL=require("string_decoder"),xL=require("crypto"),Jy=Buffer.alloc(20),YX=t=>{let e=new SL.Hasher;return e.update(tY(t)),e.digest(Jy),e.free(),Jy.toString("hex")};cn.hash=YX;var QX=t=>{let e=(0,xL.createHash)("sha256");return e.update((0,cn.normalizeShaBuffer)(t)),e.digest("hex")};cn.shaHash=QX;var ZX=async(t,e=4096)=>{e%2===1&&e++;let r=Buffer.alloc(e),n=new SL.Hasher,i;try{i=await _L.promises.open(t,"r");let o=await i.read(r,0,r.length,null),s=r.slice(0,o.bytesRead);if(Yy(s))for(n.update(s.slice(2));o.bytesRead===r.length;)o=await i.read(r,0,r.length,null),n.update(r.slice(0,o.bytesRead));else if(Qy(s))for(n.update(s.slice(2).swap16());o.bytesRead===r.length;)o=await i.read(r,0,r.length,null),n.update(r.slice(0,o.bytesRead).swap16());else if(Xy(s)){let a=new vL.StringDecoder("utf8");for(n.update(Buffer.from(a.write(s.slice(3)),"utf16le"));o.bytesRead===r.length;)o=await i.read(r,0,r.length,null),n.update(Buffer.from(a.write(r.slice(0,o.bytesRead)),"utf16le"))}else{let a=new vL.StringDecoder("utf8");for(n.update(Buffer.from(a.write(s),"utf16le"));o.bytesRead===r.length;)o=await i.read(r,0,r.length,null),n.update(Buffer.from(a.write(r.slice(0,o.bytesRead)),"utf16le"))}return n.digest(Jy),Jy.toString("hex")}finally{n.free(),i!==void 0&&await i.close()}};cn.hashFile=ZX;var Ky={stream:!0},eY=async(t,e=4096)=>{e%2===1&&e++;let r=Buffer.alloc(e),n=(0,xL.createHash)("sha256"),i;try{i=await _L.promises.open(t,"r");let o=await i.read(r,0,r.length,null),s=r.slice(0,o.bytesRead);if(Yy(s)){let a=new TextDecoder("utf-16le");for(n.update(a.decode(s.slice(2),Ky));o.bytesRead>0;)o=await i.read(r,0,r.length,null),n.update(a.decode(r.slice(0,o.bytesRead),Ky))}else if(Qy(s)){let a=new TextDecoder("utf-16be");for(n.update(a.decode(s.slice(2),Ky));o.bytesRead>0;)o=await i.read(r,0,r.length,null),n.update(a.decode(r.slice(0,o.bytesRead),Ky))}else if(Xy(s))for(n.update(s.slice(3));o.bytesRead>0;)o=await i.read(r,0,r.length,null),n.update(r.slice(0,o.bytesRead));else for(n.update(s);o.bytesRead>0;)o=await i.read(r,0,r.length,null),n.update(r.slice(0,o.bytesRead));return n.digest("hex")}finally{await i?.close()}};cn.shaHashFile=eY;var Xy=t=>t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191,Yy=t=>t.length>=2&&t[0]===255&&t[1]===254,Qy=t=>t.length>=2&&t[0]===254&&t[1]===255,tY=t=>Xy(t)?wL(t.slice(3)):Yy(t)?t.slice(2):Qy(t)?t.slice(2).swap16():wL(t),rY=t=>Xy(t)?t.slice(3):Yy(t)?new TextEncoder().encode(new TextDecoder("utf-16le").decode(t.slice(2))):Qy(t)?new TextEncoder().encode(new TextDecoder("utf-16be").decode(t.slice(2))):t;cn.normalizeShaBuffer=rY;var wL=t=>Buffer.from(t.toString("utf8"),"utf16le")});var pb=P(An=>{"use strict";An.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;An.find=(t,e)=>t.nodes.find(r=>r.type===e);An.exceedsLimit=(t,e,r=1,n)=>n===!1||!An.isInteger(t)||!An.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;An.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};An.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;An.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;An.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;An.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);An.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var db=P((Hye,JL)=>{"use strict";var KL=pb();JL.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&KL.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&KL.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var YL=P((qye,XL)=>{"use strict";XL.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var sN=P(($ye,oN)=>{"use strict";var QL=YL(),gc=(t,e,r)=>{if(QL(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(QL(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+o+s+a;if(gc.cache.hasOwnProperty(c))return gc.cache[c].result;let u=Math.min(t,e),l=Math.max(t,e);if(Math.abs(u-l)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let p=iN(t)||iN(e),d={min:t,max:e,a:u,b:l},f=[],h=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),u<0){let m=l<0?Math.abs(l):1;h=ZL(m,Math.abs(u),d,n),u=d.a=0}return l>=0&&(f=ZL(u,l,d,n)),d.negatives=h,d.positives=f,d.result=_Y(h,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+h.length>1&&(d.result=`(?:${d.result})`),gc.cache[c]=d,d.result};function _Y(t,e,r){let n=pC(t,e,"-",!1,r)||[],i=pC(e,t,"",!1,r)||[],o=pC(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function xY(t,e){let r=1,n=1,i=tN(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=tN(t,r);for(i=rN(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=rN(e+1,n)-1;return o=[...o],o.sort(TY),o}function IY(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=CY(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[c,u]=n[a];c===u?o+=c:c!=="0"||u!=="9"?o+=PY(c,u,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function ZL(t,e,r,n){let i=xY(t,e),o=[],s=t,a;for(let c=0;c<i.length;c++){let u=i[c],l=IY(String(s),String(u),n),p="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+nN(a.count),s=u+1;continue}r.isPadded&&(p=EY(u,r,n)),l.string=p+l.pattern+nN(l.count),o.push(l),s=u+1,a=l}return o}function pC(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!eN(e,"string",a)&&o.push(r+a),n&&eN(e,"string",a)&&o.push(r+a)}return o}function CY(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function TY(t,e){return t>e?1:e>t?-1:0}function eN(t,e,r){return t.some(n=>n[e]===r)}function tN(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function rN(t,e){return t-t%Math.pow(10,e)}function nN(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function PY(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function iN(t){return/^-?(0+)\d/.test(t)}function EY(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}gc.cache={};gc.clearCache=()=>gc.cache={};oN.exports=gc});var hC=P((Vye,fN)=>{"use strict";var kY=require("util"),cN=sN(),aN=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),RY=t=>e=>t===!0?Number(e):String(e),dC=t=>typeof t=="number"||typeof t=="string"&&t!=="",jf=t=>Number.isInteger(+t),fC=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},AY=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,DY=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},hb=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},OY=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>hb(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>hb(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},uN=(t,e,r,n)=>{if(r)return cN(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},lN=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return cN(t,e,r)},pN=(...t)=>new RangeError("Invalid range arguments: "+kY.inspect(...t)),dN=(t,e,r)=>{if(r.strictRanges===!0)throw pN([t,e]);return[]},LY=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},NY=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw pN([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),c=String(e),u=String(r);r=Math.max(Math.abs(r),1);let l=fC(a)||fC(c)||fC(u),p=l?Math.max(a.length,c.length,u.length):0,d=l===!1&&AY(t,e,n)===!1,f=n.transform||RY(d);if(n.toRegex&&r===1)return uN(hb(t,p),hb(e,p),!0,n);let h={negatives:[],positives:[]},m=O=>h[O<0?"negatives":"positives"].push(Math.abs(O)),x=[],C=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?m(i):x.push(DY(f(i,C),p,d)),i=s?i-r:i+r,C++;return n.toRegex===!0?r>1?OY(h,n,p):lN(x,null,{wrap:!1,...n}):x},MY=(t,e,r=1,n={})=>{if(!jf(t)&&t.length>1||!jf(e)&&e.length>1)return dN(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,c=Math.min(o,s),u=Math.max(o,s);if(n.toRegex&&r===1)return uN(c,u,!1,n);let l=[],p=0;for(;a?o>=s:o<=s;)l.push(i(o,p)),o=a?o-r:o+r,p++;return n.toRegex===!0?lN(l,null,{wrap:!1,options:n}):l},fb=(t,e,r,n={})=>{if(e==null&&dC(t))return[t];if(!dC(t)||!dC(e))return dN(t,e,n);if(typeof r=="function")return fb(t,e,1,{transform:r});if(aN(r))return fb(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,jf(r)?jf(t)&&jf(e)?NY(t,e,r,i):MY(t,e,Math.max(Math.abs(r),1),i):r!=null&&!aN(r)?LY(r,i):fb(t,e,1,r)};fN.exports=fb});var gN=P((Gye,mN)=>{"use strict";var BY=hC(),hN=pb(),FY=(t,e={})=>{let r=(n,i={})=>{let o=hN.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,c=e.escapeInvalid===!0?"\\":"",u="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=hN.reduce(n.nodes),p=BY(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let l of n.nodes)u+=r(l,n);return u};return r(t)};mN.exports=FY});var vN=P((zye,bN)=>{"use strict";var UY=hC(),yN=db(),ll=pb(),yc=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ll.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(yc(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?yc(i,o,r):i+o);return ll.flatten(n)},jY=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(yc(a.pop(),yN(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(yc(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let p=ll.reduce(i.nodes);if(ll.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=UY(...p,e);d.length===0&&(d=yN(i,e)),a.push(yc(a.pop(),d)),i.nodes=[];return}let c=ll.encloseBrace(i),u=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,u=l.queue;for(let p=0;p<i.nodes.length;p++){let d=i.nodes[p];if(d.type==="comma"&&i.type==="brace"){p===1&&u.push(""),u.push("");continue}if(d.type==="close"){a.push(yc(a.pop(),u,c));continue}if(d.value&&d.type!=="open"){u.push(yc(u.pop(),d.value));continue}d.nodes&&n(d,i)}return u};return ll.flatten(n(t))};bN.exports=jY});var SN=P((Kye,wN)=>{"use strict";wN.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"	",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var TN=P((Jye,CN)=>{"use strict";var WY=db(),{MAX_LENGTH:_N,CHAR_BACKSLASH:mC,CHAR_BACKTICK:HY,CHAR_COMMA:qY,CHAR_DOT:$Y,CHAR_LEFT_PARENTHESES:VY,CHAR_RIGHT_PARENTHESES:GY,CHAR_LEFT_CURLY_BRACE:zY,CHAR_RIGHT_CURLY_BRACE:KY,CHAR_LEFT_SQUARE_BRACKET:xN,CHAR_RIGHT_SQUARE_BRACKET:IN,CHAR_DOUBLE_QUOTE:JY,CHAR_SINGLE_QUOTE:XY,CHAR_NO_BREAK_SPACE:YY,CHAR_ZERO_WIDTH_NOBREAK_SPACE:QY}=SN(),ZY=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(_N,r.maxLength):_N;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,c=0,u=t.length,l=0,p=0,d,f=()=>t[l++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(h({type:"bos"});l<u;)if(s=o[o.length-1],d=f(),!(d===QY||d===YY)){if(d===mC){h({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===IN){h({type:"text",value:"\\"+d});continue}if(d===xN){c++;let m;for(;l<u&&(m=f());){if(d+=m,m===xN){c++;continue}if(m===mC){d+=f();continue}if(m===IN&&(c--,c===0))break}h({type:"text",value:d});continue}if(d===VY){s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:d});continue}if(d===GY){if(s.type!=="paren"){h({type:"text",value:d});continue}s=o.pop(),h({type:"text",value:d}),s=o[o.length-1];continue}if(d===JY||d===XY||d===HY){let m=d,x;for(e.keepQuotes!==!0&&(d="");l<u&&(x=f());){if(x===mC){d+=x+f();continue}if(x===m){e.keepQuotes===!0&&(d+=x);break}d+=x}h({type:"text",value:d});continue}if(d===zY){p++;let x={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};s=h(x),o.push(s),h({type:"open",value:d});continue}if(d===KY){if(s.type!=="brace"){h({type:"text",value:d});continue}let m="close";s=o.pop(),s.close=!0,h({type:m,value:d}),p--,s=o[o.length-1];continue}if(d===qY&&p>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:WY(s)}]}h({type:"comma",value:d}),s.commas++;continue}if(d===$Y&&p>0&&s.commas===0){let m=s.nodes;if(p===0||m.length===0){h({type:"text",value:d});continue}if(a.type==="dot"){if(s.range=[],a.value+=d,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let x=m[m.length-1];x.value+=a.value+d,a=x,s.ranges--;continue}h({type:"dot",value:d});continue}h({type:"text",value:d})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let m=o[o.length-1],x=m.nodes.indexOf(s);m.nodes.splice(x,1,...s.nodes)}while(o.length>0);return h({type:"eos"}),i};CN.exports=ZY});var kN=P((Xye,EN)=>{"use strict";var PN=db(),eQ=gN(),tQ=vN(),rQ=TN(),un=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=un.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(un.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};un.parse=(t,e={})=>rQ(t,e);un.stringify=(t,e={})=>PN(typeof t=="string"?un.parse(t,e):t,e);un.compile=(t,e={})=>(typeof t=="string"&&(t=un.parse(t,e)),eQ(t,e));un.expand=(t,e={})=>{typeof t=="string"&&(t=un.parse(t,e));let r=tQ(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};un.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?un.compile(t,e):un.expand(t,e);EN.exports=un});var Wf=P((Yye,LN)=>{"use strict";var nQ=require("path"),ro="\\\\/",RN=`[^${ro}]`,iQ=0,$o="\\.",oQ="\\+",sQ="\\?",mb="\\/",aQ="(?=.)",AN="[^/]",gC=`(?:${mb}|$)`,DN=`(?:^|${mb})`,yC=`${$o}{1,2}${gC}`,cQ=`(?!${$o})`,uQ=`(?!${DN}${yC})`,lQ=`(?!${$o}{0,1}${gC})`,pQ=`(?!${yC})`,dQ=`[^.${mb}]`,fQ=`${AN}*?`,ON={DOT_LITERAL:$o,PLUS_LITERAL:oQ,QMARK_LITERAL:sQ,SLASH_LITERAL:mb,ONE_CHAR:aQ,QMARK:AN,END_ANCHOR:gC,DOTS_SLASH:yC,NO_DOT:cQ,NO_DOTS:uQ,NO_DOT_SLASH:lQ,NO_DOTS_SLASH:pQ,QMARK_NO_DOT:dQ,STAR:fQ,START_ANCHOR:DN},hQ={...ON,SLASH_LITERAL:`[${ro}]`,QMARK:RN,STAR:`${RN}*?`,DOTS_SLASH:`${$o}{1,2}(?:[${ro}]|$)`,NO_DOT:`(?!${$o})`,NO_DOTS:`(?!(?:^|[${ro}])${$o}{1,2}(?:[${ro}]|$))`,NO_DOT_SLASH:`(?!${$o}{0,1}(?:[${ro}]|$))`,NO_DOTS_SLASH:`(?!${$o}{1,2}(?:[${ro}]|$))`,QMARK_NO_DOT:`[^.${ro}]`,START_ANCHOR:`(?:^|[${ro}])`,END_ANCHOR:`(?:[${ro}]|$)`},mQ={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};LN.exports={DEFAULT_MAX_EXTGLOB_RECURSION:iQ,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:mQ,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:nQ.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?hQ:ON}}});var Hf=P(Hr=>{"use strict";var gQ=require("path"),yQ=process.platform==="win32",{REGEX_BACKSLASH:bQ,REGEX_REMOVE_BACKSLASH:vQ,REGEX_SPECIAL_CHARS:wQ,REGEX_SPECIAL_CHARS_GLOBAL:SQ}=Wf();Hr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Hr.hasRegexChars=t=>wQ.test(t);Hr.isRegexChar=t=>t.length===1&&Hr.hasRegexChars(t);Hr.escapeRegex=t=>t.replace(SQ,"\\$1");Hr.toPosixSlashes=t=>t.replace(bQ,"/");Hr.removeBackslashes=t=>t.replace(vQ,e=>e==="\\"?"":e);Hr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Hr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:yQ===!0||gQ.sep==="\\";Hr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Hr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Hr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Hr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var HN=P((Zye,WN)=>{"use strict";var NN=Hf(),{CHAR_ASTERISK:bC,CHAR_AT:_Q,CHAR_BACKWARD_SLASH:qf,CHAR_COMMA:xQ,CHAR_DOT:vC,CHAR_EXCLAMATION_MARK:wC,CHAR_FORWARD_SLASH:jN,CHAR_LEFT_CURLY_BRACE:SC,CHAR_LEFT_PARENTHESES:_C,CHAR_LEFT_SQUARE_BRACKET:IQ,CHAR_PLUS:CQ,CHAR_QUESTION_MARK:MN,CHAR_RIGHT_CURLY_BRACE:TQ,CHAR_RIGHT_PARENTHESES:BN,CHAR_RIGHT_SQUARE_BRACKET:PQ}=Wf(),FN=t=>t===jN||t===qf,UN=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},EQ=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,u=-1,l=0,p=0,d=!1,f=!1,h=!1,m=!1,x=!1,C=!1,O=!1,y=!1,T=!1,E=!1,M=0,k,A,W={value:"",depth:0,isGlob:!1},Z=()=>u>=n,_=()=>c.charCodeAt(u+1),B=()=>(k=A,c.charCodeAt(++u));for(;u<n;){A=B();let pe;if(A===qf){O=W.backslashes=!0,A=B(),A===SC&&(C=!0);continue}if(C===!0||A===SC){for(M++;Z()!==!0&&(A=B());){if(A===qf){O=W.backslashes=!0,B();continue}if(A===SC){M++;continue}if(C!==!0&&A===vC&&(A=B())===vC){if(d=W.isBrace=!0,h=W.isGlob=!0,E=!0,i===!0)continue;break}if(C!==!0&&A===xQ){if(d=W.isBrace=!0,h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===TQ&&(M--,M===0)){C=!1,d=W.isBrace=!0,E=!0;break}}if(i===!0)continue;break}if(A===jN){if(o.push(u),s.push(W),W={value:"",depth:0,isGlob:!1},E===!0)continue;if(k===vC&&u===l+1){l+=2;continue}p=u+1;continue}if(r.noext!==!0&&(A===CQ||A===_Q||A===bC||A===MN||A===wC)===!0&&_()===_C){if(h=W.isGlob=!0,m=W.isExtglob=!0,E=!0,A===wC&&u===l&&(T=!0),i===!0){for(;Z()!==!0&&(A=B());){if(A===qf){O=W.backslashes=!0,A=B();continue}if(A===BN){h=W.isGlob=!0,E=!0;break}}continue}break}if(A===bC){if(k===bC&&(x=W.isGlobstar=!0),h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===MN){if(h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===IQ){for(;Z()!==!0&&(pe=B());){if(pe===qf){O=W.backslashes=!0,B();continue}if(pe===PQ){f=W.isBracket=!0,h=W.isGlob=!0,E=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&A===wC&&u===l){y=W.negated=!0,l++;continue}if(r.noparen!==!0&&A===_C){if(h=W.isGlob=!0,i===!0){for(;Z()!==!0&&(A=B());){if(A===_C){O=W.backslashes=!0,A=B();continue}if(A===BN){E=!0;break}}continue}break}if(h===!0){if(E=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let F=c,G="",b="";l>0&&(G=c.slice(0,l),c=c.slice(l),p-=l),F&&h===!0&&p>0?(F=c.slice(0,p),b=c.slice(p)):h===!0?(F="",b=c):F=c,F&&F!==""&&F!=="/"&&F!==c&&FN(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),r.unescape===!0&&(b&&(b=NN.removeBackslashes(b)),F&&O===!0&&(F=NN.removeBackslashes(F)));let S={prefix:G,input:t,start:l,base:F,glob:b,isBrace:d,isBracket:f,isGlob:h,isExtglob:m,isGlobstar:x,negated:y,negatedExtglob:T};if(r.tokens===!0&&(S.maxDepth=0,FN(A)||s.push(W),S.tokens=s),r.parts===!0||r.tokens===!0){let pe;for(let K=0;K<o.length;K++){let Se=pe?pe+1:l,ue=o[K],Le=t.slice(Se,ue);r.tokens&&(K===0&&l!==0?(s[K].isPrefix=!0,s[K].value=G):s[K].value=Le,UN(s[K]),S.maxDepth+=s[K].depth),(K!==0||Le!=="")&&a.push(Le),pe=ue}if(pe&&pe+1<t.length){let K=t.slice(pe+1);a.push(K),r.tokens&&(s[s.length-1].value=K,UN(s[s.length-1]),S.maxDepth+=s[s.length-1].depth)}S.slashes=o,S.parts=a}return S};WN.exports=EQ});var zN=P((ebe,GN)=>{"use strict";var $f=Wf(),Sr=Hf(),{MAX_LENGTH:gb,POSIX_REGEX_SOURCE:kQ,REGEX_NON_SPECIAL_CHARS:RQ,REGEX_SPECIAL_CHARS_BACKREF:AQ,REPLACEMENTS:qN}=$f,DQ=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Sr.escapeRegex(i)).join("..")}return r},pl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,$N=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},OQ=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},VN=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OQ(e))return e.replace(/\\(.)/g,"$1")},LQ=t=>{let e=t.map(VN).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},xC=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},NQ=t=>{let e=0,r=[];for(;e<t.length;){let i=xC(t.slice(e),!1);if(!i||i.type!=="*")return;let o=$N(i.body).map(a=>a.trim());if(o.length!==1)return;let s=VN(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Sr.escapeRegex(r[0]):`[${r.map(i=>Sr.escapeRegex(i)).join("")}]`}*`},MQ=t=>{let e=0,r=t.trim(),n=xC(r);for(;n;)e++,r=n.body.trim(),n=xC(r);return e},BQ=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:$f.DEFAULT_MAX_EXTGLOB_RECURSION,n=$N(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||LQ(n)))return{risky:!0};for(let i of n){let o=NQ(i);if(o)return{risky:!0,safeOutput:o};if(MQ(i)>r)return{risky:!0}}return{risky:!1}},IC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=qN[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(gb,r.maxLength):gb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Sr.isWindows(e),u=$f.globChars(c),l=$f.extglobChars(u),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:x,NO_DOT_SLASH:C,NO_DOTS_SLASH:O,QMARK:y,QMARK_NO_DOT:T,STAR:E,START_ANCHOR:M}=u,k=L=>`(${a}(?:(?!${M}${L.dot?m:p}).)*?)`,A=r.dot?"":x,W=r.dot?y:T,Z=r.bash===!0?k(r):E;r.capture&&(Z=`(${Z})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Sr.removePrefix(t,_),i=t.length;let B=[],F=[],G=[],b=o,S,pe=()=>_.index===i-1,K=_.peek=(L=1)=>t[_.index+L],Se=_.advance=()=>t[++_.index]||"",ue=()=>t.slice(_.index+1),Le=(L="",se=0)=>{_.consumed+=L,_.index+=se},ee=L=>{_.output+=L.output!=null?L.output:L.value,Le(L.value)},yt=()=>{let L=1;for(;K()==="!"&&(K(2)!=="("||K(3)==="?");)Se(),_.start++,L++;return L%2===0?!1:(_.negated=!0,_.start++,!0)},sr=L=>{_[L]++,G.push(L)},xe=L=>{_[L]--,G.pop()},X=L=>{if(b.type==="globstar"){let se=_.braces>0&&(L.type==="comma"||L.type==="brace"),D=L.extglob===!0||B.length&&(L.type==="pipe"||L.type==="paren");L.type!=="slash"&&L.type!=="paren"&&!se&&!D&&(_.output=_.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=Z,_.output+=b.output)}if(B.length&&L.type!=="paren"&&(B[B.length-1].inner+=L.value),(L.value||L.output)&&ee(L),b&&b.type==="text"&&L.type==="text"){b.value+=L.value,b.output=(b.output||"")+L.value;return}L.prev=b,s.push(L),b=L},ei=(L,se)=>{let D={...l[se],conditions:1,inner:""};D.prev=b,D.parens=_.parens,D.output=_.output,D.startIndex=_.index,D.tokensIndex=s.length;let z=(r.capture?"(":"")+D.open;sr("parens"),X({type:L,value:se,output:_.output?"":h}),X({type:"paren",extglob:!0,value:Se(),output:z}),B.push(D)},Su=L=>{let se=t.slice(L.startIndex,_.index+1),D=t.slice(L.startIndex+2,_.index),z=BQ(D,r);if((L.type==="plus"||L.type==="star")&&z.risky){let le=z.safeOutput?(L.output?"":h)+(r.capture?`(${z.safeOutput})`:z.safeOutput):void 0,ot=s[L.tokensIndex];ot.type="text",ot.value=se,ot.output=le||Sr.escapeRegex(se);for(let st=L.tokensIndex+1;st<s.length;st++)s[st].value="",s[st].output="",delete s[st].suffix;_.output=L.output+ot.output,_.backtrack=!0,X({type:"paren",extglob:!0,value:S,output:""}),xe("parens");return}let fe=L.close+(r.capture?")":""),Ie;if(L.type==="negate"){let le=Z;if(L.inner&&L.inner.length>1&&L.inner.includes("/")&&(le=k(r)),(le!==Z||pe()||/^\)+$/.test(ue()))&&(fe=L.close=`)$))${le}`),L.inner.includes("*")&&(Ie=ue())&&/^\.[^\\/.]+$/.test(Ie)){let ot=IC(Ie,{...e,fastpaths:!1}).output;fe=L.close=`)${ot})${le})`}L.prev.type==="bos"&&(_.negatedExtglob=!0)}X({type:"paren",extglob:!0,value:S,output:fe}),xe("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let L=!1,se=t.replace(AQ,(D,z,fe,Ie,le,ot)=>Ie==="\\"?(L=!0,D):Ie==="?"?z?z+Ie+(le?y.repeat(le.length):""):ot===0?W+(le?y.repeat(le.length):""):y.repeat(fe.length):Ie==="."?p.repeat(fe.length):Ie==="*"?z?z+Ie+(le?Z:""):Z:z?D:`\\${D}`);return L===!0&&(r.unescape===!0?se=se.replace(/\\/g,""):se=se.replace(/\\+/g,D=>D.length%2===0?"\\\\":D?"\\":"")),se===t&&r.contains===!0?(_.output=t,_):(_.output=Sr.wrapOutput(se,_,e),_)}for(;!pe();){if(S=Se(),S==="\0")continue;if(S==="\\"){let D=K();if(D==="/"&&r.bash!==!0||D==="."||D===";")continue;if(!D){S+="\\",X({type:"text",value:S});continue}let z=/^\\+/.exec(ue()),fe=0;if(z&&z[0].length>2&&(fe=z[0].length,_.index+=fe,fe%2!==0&&(S+="\\")),r.unescape===!0?S=Se():S+=Se(),_.brackets===0){X({type:"text",value:S});continue}}if(_.brackets>0&&(S!=="]"||b.value==="["||b.value==="[^")){if(r.posix!==!1&&S===":"){let D=b.value.slice(1);if(D.includes("[")&&(b.posix=!0,D.includes(":"))){let z=b.value.lastIndexOf("["),fe=b.value.slice(0,z),Ie=b.value.slice(z+2),le=kQ[Ie];if(le){b.value=fe+le,_.backtrack=!0,Se(),!o.output&&s.indexOf(b)===1&&(o.output=h);continue}}}(S==="["&&K()!==":"||S==="-"&&K()==="]")&&(S=`\\${S}`),S==="]"&&(b.value==="["||b.value==="[^")&&(S=`\\${S}`),r.posix===!0&&S==="!"&&b.value==="["&&(S="^"),b.value+=S,ee({value:S});continue}if(_.quotes===1&&S!=='"'){S=Sr.escapeRegex(S),b.value+=S,ee({value:S});continue}if(S==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&X({type:"text",value:S});continue}if(S==="("){sr("parens"),X({type:"paren",value:S});continue}if(S===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(pl("opening","("));let D=B[B.length-1];if(D&&_.parens===D.parens+1){Su(B.pop());continue}X({type:"paren",value:S,output:_.parens?")":"\\)"}),xe("parens");continue}if(S==="["){if(r.nobracket===!0||!ue().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(pl("closing","]"));S=`\\${S}`}else sr("brackets");X({type:"bracket",value:S});continue}if(S==="]"){if(r.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){X({type:"text",value:S,output:`\\${S}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(pl("opening","["));X({type:"text",value:S,output:`\\${S}`});continue}xe("brackets");let D=b.value.slice(1);if(b.posix!==!0&&D[0]==="^"&&!D.includes("/")&&(S=`/${S}`),b.value+=S,ee({value:S}),r.literalBrackets===!1||Sr.hasRegexChars(D))continue;let z=Sr.escapeRegex(b.value);if(_.output=_.output.slice(0,-b.value.length),r.literalBrackets===!0){_.output+=z,b.value=z;continue}b.value=`(${a}${z}|${b.value})`,_.output+=b.value;continue}if(S==="{"&&r.nobrace!==!0){sr("braces");let D={type:"brace",value:S,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};F.push(D),X(D);continue}if(S==="}"){let D=F[F.length-1];if(r.nobrace===!0||!D){X({type:"text",value:S,output:S});continue}let z=")";if(D.dots===!0){let fe=s.slice(),Ie=[];for(let le=fe.length-1;le>=0&&(s.pop(),fe[le].type!=="brace");le--)fe[le].type!=="dots"&&Ie.unshift(fe[le].value);z=DQ(Ie,r),_.backtrack=!0}if(D.comma!==!0&&D.dots!==!0){let fe=_.output.slice(0,D.outputIndex),Ie=_.tokens.slice(D.tokensIndex);D.value=D.output="\\{",S=z="\\}",_.output=fe;for(let le of Ie)_.output+=le.output||le.value}X({type:"brace",value:S,output:z}),xe("braces"),F.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,X({type:"text",value:S});continue}if(S===","){let D=S,z=F[F.length-1];z&&G[G.length-1]==="braces"&&(z.comma=!0,D="|"),X({type:"comma",value:S,output:D});continue}if(S==="/"){if(b.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),b=o;continue}X({type:"slash",value:S,output:f});continue}if(S==="."){if(_.braces>0&&b.type==="dot"){b.value==="."&&(b.output=p);let D=F[F.length-1];b.type="dots",b.output+=S,b.value+=S,D.dots=!0;continue}if(_.braces+_.parens===0&&b.type!=="bos"&&b.type!=="slash"){X({type:"text",value:S,output:p});continue}X({type:"dot",value:S,output:p});continue}if(S==="?"){if(!(b&&b.value==="(")&&r.noextglob!==!0&&K()==="("&&K(2)!=="?"){ei("qmark",S);continue}if(b&&b.type==="paren"){let z=K(),fe=S;if(z==="<"&&!Sr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(z)||z==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(fe=`\\${S}`),X({type:"text",value:S,output:fe});continue}if(r.dot!==!0&&(b.type==="slash"||b.type==="bos")){X({type:"qmark",value:S,output:T});continue}X({type:"qmark",value:S,output:y});continue}if(S==="!"){if(r.noextglob!==!0&&K()==="("&&(K(2)!=="?"||!/[!=<:]/.test(K(3)))){ei("negate",S);continue}if(r.nonegate!==!0&&_.index===0){yt();continue}}if(S==="+"){if(r.noextglob!==!0&&K()==="("&&K(2)!=="?"){ei("plus",S);continue}if(b&&b.value==="("||r.regex===!1){X({type:"plus",value:S,output:d});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||_.parens>0){X({type:"plus",value:S});continue}X({type:"plus",value:d});continue}if(S==="@"){if(r.noextglob!==!0&&K()==="("&&K(2)!=="?"){X({type:"at",extglob:!0,value:S,output:""});continue}X({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let D=RQ.exec(ue());D&&(S+=D[0],_.index+=D[0].length),X({type:"text",value:S});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=S,b.output=Z,_.backtrack=!0,_.globstar=!0,Le(S);continue}let L=ue();if(r.noextglob!==!0&&/^\([^?]/.test(L)){ei("star",S);continue}if(b.type==="star"){if(r.noglobstar===!0){Le(S);continue}let D=b.prev,z=D.prev,fe=D.type==="slash"||D.type==="bos",Ie=z&&(z.type==="star"||z.type==="globstar");if(r.bash===!0&&(!fe||L[0]&&L[0]!=="/")){X({type:"star",value:S,output:""});continue}let le=_.braces>0&&(D.type==="comma"||D.type==="brace"),ot=B.length&&(D.type==="pipe"||D.type==="paren");if(!fe&&D.type!=="paren"&&!le&&!ot){X({type:"star",value:S,output:""});continue}for(;L.slice(0,3)==="/**";){let st=t[_.index+4];if(st&&st!=="/")break;L=L.slice(3),Le("/**",3)}if(D.type==="bos"&&pe()){b.type="globstar",b.value+=S,b.output=k(r),_.output=b.output,_.globstar=!0,Le(S);continue}if(D.type==="slash"&&D.prev.type!=="bos"&&!Ie&&pe()){_.output=_.output.slice(0,-(D.output+b.output).length),D.output=`(?:${D.output}`,b.type="globstar",b.output=k(r)+(r.strictSlashes?")":"|$)"),b.value+=S,_.globstar=!0,_.output+=D.output+b.output,Le(S);continue}if(D.type==="slash"&&D.prev.type!=="bos"&&L[0]==="/"){let st=L[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(D.output+b.output).length),D.output=`(?:${D.output}`,b.type="globstar",b.output=`${k(r)}${f}|${f}${st})`,b.value+=S,_.output+=D.output+b.output,_.globstar=!0,Le(S+Se()),X({type:"slash",value:"/",output:""});continue}if(D.type==="bos"&&L[0]==="/"){b.type="globstar",b.value+=S,b.output=`(?:^|${f}|${k(r)}${f})`,_.output=b.output,_.globstar=!0,Le(S+Se()),X({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-b.output.length),b.type="globstar",b.output=k(r),b.value+=S,_.output+=b.output,_.globstar=!0,Le(S);continue}let se={type:"star",value:S,output:Z};if(r.bash===!0){se.output=".*?",(b.type==="bos"||b.type==="slash")&&(se.output=A+se.output),X(se);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&r.regex===!0){se.output=S,X(se);continue}(_.index===_.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(_.output+=C,b.output+=C):r.dot===!0?(_.output+=O,b.output+=O):(_.output+=A,b.output+=A),K()!=="*"&&(_.output+=h,b.output+=h)),X(se)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(pl("closing","]"));_.output=Sr.escapeLast(_.output,"["),xe("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(pl("closing",")"));_.output=Sr.escapeLast(_.output,"("),xe("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(pl("closing","}"));_.output=Sr.escapeLast(_.output,"{"),xe("braces")}if(r.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&X({type:"maybe_slash",value:"",output:`${f}?`}),_.backtrack===!0){_.output="";for(let L of _.tokens)_.output+=L.output!=null?L.output:L.value,L.suffix&&(_.output+=L.suffix)}return _};IC.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(gb,r.maxLength):gb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=qN[t]||t;let o=Sr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:h}=$f.globChars(o),m=r.dot?p:l,x=r.dot?d:l,C=r.capture?"":"?:",O={negated:!1,prefix:""},y=r.bash===!0?".*?":f;r.capture&&(y=`(${y})`);let T=A=>A.noglobstar===!0?y:`(${C}(?:(?!${h}${A.dot?u:s}).)*?)`,E=A=>{switch(A){case"*":return`${m}${c}${y}`;case".*":return`${s}${c}${y}`;case"*.*":return`${m}${y}${s}${c}${y}`;case"*/*":return`${m}${y}${a}${c}${x}${y}`;case"**":return m+T(r);case"**/*":return`(?:${m}${T(r)}${a})?${x}${c}${y}`;case"**/*.*":return`(?:${m}${T(r)}${a})?${x}${y}${s}${c}${y}`;case"**/.*":return`(?:${m}${T(r)}${a})?${s}${c}${y}`;default:{let W=/^(.*?)\.(\w+)$/.exec(A);if(!W)return;let Z=E(W[1]);return Z?Z+s+W[2]:void 0}}},M=Sr.removePrefix(t,O),k=E(M);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};GN.exports=IC});var JN=P((tbe,KN)=>{"use strict";var FQ=require("path"),UQ=HN(),CC=zN(),TC=Hf(),jQ=Wf(),WQ=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Tt(d,e,r));return d=>{for(let f of l){let h=f(d);if(h)return h}return!1}}let n=WQ(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=TC.isWindows(e),s=n?Tt.compileRe(t,e):Tt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};c=Tt(i.ignore,l,r)}let u=(l,p=!1)=>{let{isMatch:d,match:f,output:h}=Tt.test(l,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:l,output:h,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(m),d===!1?(m.isMatch=!1,p?m:!1):c(l)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,p?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),p?m:!0)};return r&&(u.state=a),u};Tt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?TC.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r,n=TC.isWindows(r))=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(FQ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):CC(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>UQ(t,e);Tt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=CC.fastpaths(t,e)),i.output||(i=CC(t,e)),Tt.compileRe(i,e,r,n)};Tt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Tt.constants=jQ;KN.exports=Tt});var YN=P((rbe,XN)=>{"use strict";XN.exports=JN()});var Vf=P((nbe,rM)=>{"use strict";var ZN=require("util"),eM=kN(),no=YN(),PC=Hf(),QN=t=>t===""||t==="./",tM=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},rt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=l=>{o.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let p=no(String(e[l]),{...r,onResult:a},!0),d=p.state.negated||p.state.negatedExtglob;d&&s++;for(let f of t){let h=p(f,!0);(d?!h.isMatch:h.isMatch)&&(d?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let u=(s===e.length?[...o]:[...i]).filter(l=>!n.has(l));if(r&&u.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return u};rt.match=rt;rt.matcher=(t,e)=>no(t,e);rt.isMatch=(t,e,r)=>no(e,r)(t);rt.any=rt.isMatch;rt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(rt(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};rt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ZN.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>rt.contains(t,n,r));if(typeof e=="string"){if(QN(t)||QN(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return rt.isMatch(t,e,{...r,contains:!0})};rt.matchKeys=(t,e,r)=>{if(!PC.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=rt(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};rt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=no(String(i),r);if(n.some(s=>o(s)))return!0}return!1};rt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=no(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};rt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ZN.inspect(t)}"`);return[].concat(e).every(n=>no(n,r)(t))};rt.capture=(t,e,r)=>{let n=PC.isWindows(r),o=no.makeRe(String(t),{...r,capture:!0}).exec(n?PC.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};rt.makeRe=(...t)=>no.makeRe(...t);rt.scan=(...t)=>no.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of eM(String(n),e))r.push(no.parse(i,e));return r};rt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!tM(t)?[t]:eM(t,e)};rt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return rt.braces(t,{...e,expand:!0})};rt.hasBraces=tM;rM.exports=rt});var Go=P((owe,CM)=>{"use strict";var xM=["nodebuffer","arraybuffer","fragments"],IM=typeof Blob<"u";IM&&xM.push("blob");CM.exports={BINARY_TYPES:xM,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:IM,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Jf=P((swe,Tb)=>{"use strict";var{EMPTY_BUFFER:YQ}=Go(),MC=Buffer[Symbol.species];function QQ(t,e){if(t.length===0)return YQ;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return n<e?new MC(r.buffer,r.byteOffset,n):r}function TM(t,e,r,n,i){for(let o=0;o<i;o++)r[n+o]=t[o]^e[o&3]}function PM(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function ZQ(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function BC(t){if(BC.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new MC(t):ArrayBuffer.isView(t)?e=new MC(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),BC.readOnly=!1),e}Tb.exports={concat:QQ,mask:TM,toArrayBuffer:ZQ,toBuffer:BC,unmask:PM};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=require("bufferutil");Tb.exports.mask=function(e,r,n,i,o){o<48?TM(e,r,n,i,o):t.mask(e,r,n,i,o)},Tb.exports.unmask=function(e,r){e.length<32?PM(e,r):t.unmask(e,r)}}catch{}});var RM=P((awe,kM)=>{"use strict";var EM=Symbol("kDone"),FC=Symbol("kRun"),UC=class{constructor(e){this[EM]=()=>{this.pending--,this[FC]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[FC]()}[FC](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[EM])}}};kM.exports=UC});var xl=P((cwe,LM)=>{"use strict";var Xf=require("zlib"),AM=Jf(),eZ=RM(),{kStatusCode:DM}=Go(),tZ=Buffer[Symbol.species],rZ=Buffer.from([0,0,255,255]),Eb=Symbol("permessage-deflate"),zo=Symbol("total-length"),Sl=Symbol("callback"),Ws=Symbol("buffers"),_l=Symbol("error"),Pb,jC=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Pb){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Pb=new eZ(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Sl];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),e}decompress(e,r,n){Pb.add(i=>{this._decompress(e,r,(o,s)=>{i(),n(o,s)})})}compress(e,r,n){Pb.add(i=>{this._compress(e,r,(o,s)=>{i(),n(o,s)})})}_decompress(e,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?Xf.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Xf.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[Eb]=this,this._inflate[zo]=0,this._inflate[Ws]=[],this._inflate.on("error",iZ),this._inflate.on("data",OM)}this._inflate[Sl]=n,this._inflate.write(e),r&&this._inflate.write(rZ),this._inflate.flush(()=>{let o=this._inflate[_l];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=AM.concat(this._inflate[Ws],this._inflate[zo]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zo]=0,this._inflate[Ws]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(e,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?Xf.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Xf.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[zo]=0,this._deflate[Ws]=[],this._deflate.on("data",nZ)}this._deflate[Sl]=n,this._deflate.write(e),this._deflate.flush(Xf.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=AM.concat(this._deflate[Ws],this._deflate[zo]);r&&(o=new tZ(o.buffer,o.byteOffset,o.length-4)),this._deflate[Sl]=null,this._deflate[zo]=0,this._deflate[Ws]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,o)})}};LM.exports=jC;function nZ(t){this[Ws].push(t),this[zo]+=t.length}function OM(t){if(this[zo]+=t.length,this[Eb]._maxPayload<1||this[zo]<=this[Eb]._maxPayload){this[Ws].push(t);return}this[_l]=new RangeError("Max payload size exceeded"),this[_l].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_l][DM]=1009,this.removeListener("data",OM),this.reset()}function iZ(t){if(this[Eb]._inflate=null,this[_l]){this[Sl](this[_l]);return}t[DM]=1007,this[Sl](t)}});var Il=P((uwe,kb)=>{"use strict";var{isUtf8:NM}=require("buffer"),{hasBlob:oZ}=Go(),sZ=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function aZ(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function WC(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function cZ(t){return oZ&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}kb.exports={isBlob:cZ,isValidStatusCode:aZ,isValidUTF8:WC,tokenChars:sZ};if(NM)kb.exports.isValidUTF8=function(t){return t.length<24?WC(t):NM(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=require("utf-8-validate");kb.exports.isValidUTF8=function(e){return e.length<32?WC(e):t(e)}}catch{}});var GC=P((lwe,HM)=>{"use strict";var{Writable:uZ}=require("stream"),MM=xl(),{BINARY_TYPES:lZ,EMPTY_BUFFER:BM,kStatusCode:pZ,kWebSocket:dZ}=Go(),{concat:HC,toArrayBuffer:fZ,unmask:hZ}=Jf(),{isValidStatusCode:mZ,isValidUTF8:FM}=Il(),Rb=Buffer[Symbol.species],Ln=0,UM=1,jM=2,WM=3,qC=4,$C=5,Ab=6,VC=class extends uZ{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||lZ[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[dZ]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Ln}_write(e,r,n){if(this._opcode===8&&this._state==Ln)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Rb(n.buffer,n.byteOffset+e,n.length-e),new Rb(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],i=r.length-e;e>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),i),this._buffers[0]=new Rb(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case Ln:this.getInfo(e);break;case UM:this.getPayloadLength16(e);break;case jM:this.getPayloadLength64(e);break;case WM:this.getMask();break;case qC:this.getData(e);break;case $C:case Ab:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[MM.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=UM:this._payloadLength===127?this._state=jM:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=WM:this._state=qC}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=qC}getData(e){let r=BM;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&hZ(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=$C,this.decompress(r,e);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(n);return}this._messageLength=this._totalPayloadLength,this._fragments.push(r)}this.dataMessage(e)}decompress(e,r){this._extensions[MM.extensionName].decompress(e,this._fin,(i,o)=>{if(i)return r(i);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let s=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(s);return}this._fragments.push(o)}this.dataMessage(r),this._state===Ln&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=Ln;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=HC(n,r):this._binaryType==="arraybuffer"?i=fZ(HC(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=Ln):(this._state=Ab,setImmediate(()=>{this.emit("message",i,!0),this._state=Ln,this.startLoop(e)}))}else{let i=HC(n,r);if(!this._skipUTF8Validation&&!FM(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(o);return}this._state===$C||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=Ln):(this._state=Ab,setImmediate(()=>{this.emit("message",i,!1),this._state=Ln,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,BM),this.end();else{let n=e.readUInt16BE(0);if(!mZ(n)){let o=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(o);return}let i=new Rb(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!FM(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(o);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=Ln;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=Ln):(this._state=Ab,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=Ln,this.startLoop(r)}))}createError(e,r,n,i,o){this._loop=!1,this._errored=!0;let s=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=o,s[pZ]=i,s}};HM.exports=VC});var JC=P((dwe,VM)=>{"use strict";var{Duplex:pwe}=require("stream"),{randomFillSync:gZ}=require("crypto"),{types:{isUint8Array:yZ}}=require("util"),qM=xl(),{EMPTY_BUFFER:bZ,kWebSocket:vZ,NOOP:wZ}=Go(),{isBlob:Cl,isValidStatusCode:SZ}=Il(),{mask:$M,toBuffer:Sc}=Jf(),Nn=Symbol("kByteLength"),_Z=Buffer.alloc(4),Db=8*1024,_c,Tl=Db,li=0,xZ=1,IZ=2,zC=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=li,this.onerror=wZ,this[vZ]=void 0}static frame(e,r){let n,i=!1,o=2,s=!1;r.mask&&(n=r.maskBuffer||_Z,r.generateMask?r.generateMask(n):(Tl===Db&&(_c===void 0&&(_c=Buffer.alloc(Db)),gZ(_c,0,Db),Tl=0),n[0]=_c[Tl++],n[1]=_c[Tl++],n[2]=_c[Tl++],n[3]=_c[Tl++]),s=(n[0]|n[1]|n[2]|n[3])===0,o=6);let a;typeof e=="string"?(!r.mask||s)&&r[Nn]!==void 0?a=r[Nn]:(e=Buffer.from(e),a=e.length):(a=e.length,i=r.mask&&r.readOnly&&!s);let c=a;a>=65536?(o+=8,c=127):a>125&&(o+=2,c=126);let u=Buffer.allocUnsafe(i?a+o:o);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),r.mask?(u[1]|=128,u[o-4]=n[0],u[o-3]=n[1],u[o-2]=n[2],u[o-1]=n[3],s?[u,e]:i?($M(e,n,u,o,a),[u]):($M(e,n,e,0,a),[u,e])):[u,e]}close(e,r,n,i){let o;if(e===void 0)o=bZ;else{if(typeof e!="number"||!SZ(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");if(o=Buffer.allocUnsafe(2+a),o.writeUInt16BE(e,0),typeof r=="string")o.write(r,2);else if(yZ(r))o.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[Nn]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==li?this.enqueue([this.dispatch,o,!1,s,i]):this.sendFrame(t.frame(o,s),i)}ping(e,r,n){let i,o;if(typeof e=="string"?(i=Buffer.byteLength(e),o=!1):Cl(e)?(i=e.size,o=!1):(e=Sc(e),i=e.length,o=Sc.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Nn]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};Cl(e)?this._state!==li?this.enqueue([this.getBlobData,e,!1,s,n]):this.getBlobData(e,!1,s,n):this._state!==li?this.enqueue([this.dispatch,e,!1,s,n]):this.sendFrame(t.frame(e,s),n)}pong(e,r,n){let i,o;if(typeof e=="string"?(i=Buffer.byteLength(e),o=!1):Cl(e)?(i=e.size,o=!1):(e=Sc(e),i=e.length,o=Sc.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Nn]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};Cl(e)?this._state!==li?this.enqueue([this.getBlobData,e,!1,s,n]):this.getBlobData(e,!1,s,n):this._state!==li?this.enqueue([this.dispatch,e,!1,s,n]):this.sendFrame(t.frame(e,s),n)}send(e,r,n){let i=this._extensions[qM.extensionName],o=r.binary?2:1,s=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Cl(e)?(a=e.size,c=!1):(e=Sc(e),a=e.length,c=Sc.readOnly),this._firstFragment?(this._firstFragment=!1,s&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=a>=i._threshold),this._compress=s):(s=!1,o=0),r.fin&&(this._firstFragment=!0);let u={[Nn]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:c,rsv1:s};Cl(e)?this._state!==li?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==li?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,i){this._bufferedBytes+=n[Nn],this._state=IZ,e.arrayBuffer().then(o=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(KC,this,a,i);return}this._bufferedBytes-=n[Nn];let s=Sc(o);r?this.dispatch(s,r,n,i):(this._state=li,this.sendFrame(t.frame(s,n),i),this.dequeue())}).catch(o=>{process.nextTick(CZ,this,o,i)})}dispatch(e,r,n,i){if(!r){this.sendFrame(t.frame(e,n),i);return}let o=this._extensions[qM.extensionName];this._bufferedBytes+=n[Nn],this._state=xZ,o.compress(e,n.fin,(s,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");KC(this,c,i);return}this._bufferedBytes-=n[Nn],this._state=li,n.readOnly=!1,this.sendFrame(t.frame(a,n),i),this.dequeue()})}dequeue(){for(;this._state===li&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][Nn],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][Nn],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};VM.exports=zC;function KC(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let i=t._queue[n],o=i[i.length-1];typeof o=="function"&&o(e)}}function CZ(t,e,r){KC(t,e,r),t.onerror(e)}});var eB=P((fwe,ZM)=>{"use strict";var{kForOnEventAttribute:Yf,kListener:XC}=Go(),GM=Symbol("kCode"),zM=Symbol("kData"),KM=Symbol("kError"),JM=Symbol("kMessage"),XM=Symbol("kReason"),Pl=Symbol("kTarget"),YM=Symbol("kType"),QM=Symbol("kWasClean"),Ko=class{constructor(e){this[Pl]=null,this[YM]=e}get target(){return this[Pl]}get type(){return this[YM]}};Object.defineProperty(Ko.prototype,"target",{enumerable:!0});Object.defineProperty(Ko.prototype,"type",{enumerable:!0});var xc=class extends Ko{constructor(e,r={}){super(e),this[GM]=r.code===void 0?0:r.code,this[XM]=r.reason===void 0?"":r.reason,this[QM]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[GM]}get reason(){return this[XM]}get wasClean(){return this[QM]}};Object.defineProperty(xc.prototype,"code",{enumerable:!0});Object.defineProperty(xc.prototype,"reason",{enumerable:!0});Object.defineProperty(xc.prototype,"wasClean",{enumerable:!0});var El=class extends Ko{constructor(e,r={}){super(e),this[KM]=r.error===void 0?null:r.error,this[JM]=r.message===void 0?"":r.message}get error(){return this[KM]}get message(){return this[JM]}};Object.defineProperty(El.prototype,"error",{enumerable:!0});Object.defineProperty(El.prototype,"message",{enumerable:!0});var Qf=class extends Ko{constructor(e,r={}){super(e),this[zM]=r.data===void 0?null:r.data}get data(){return this[zM]}};Object.defineProperty(Qf.prototype,"data",{enumerable:!0});var TZ={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[Yf]&&i[XC]===e&&!i[Yf])return;let n;if(t==="message")n=function(o,s){let a=new Qf("message",{data:s?o:o.toString()});a[Pl]=this,Ob(e,this,a)};else if(t==="close")n=function(o,s){let a=new xc("close",{code:o,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Pl]=this,Ob(e,this,a)};else if(t==="error")n=function(o){let s=new El("error",{error:o,message:o.message});s[Pl]=this,Ob(e,this,s)};else if(t==="open")n=function(){let o=new Ko("open");o[Pl]=this,Ob(e,this,o)};else return;n[Yf]=!!r[Yf],n[XC]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[XC]===e&&!r[Yf]){this.removeListener(t,r);break}}};ZM.exports={CloseEvent:xc,ErrorEvent:El,Event:Ko,EventTarget:TZ,MessageEvent:Qf};function Ob(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var Lb=P((hwe,tB)=>{"use strict";var{tokenChars:Zf}=Il();function co(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function PZ(t){let e=Object.create(null),r=Object.create(null),n=!1,i=!1,o=!1,s,a,c=-1,u=-1,l=-1,p=0;for(;p<t.length;p++)if(u=t.charCodeAt(p),s===void 0)if(l===-1&&Zf[u]===1)c===-1&&(c=p);else if(p!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=p);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1&&(l=p);let f=t.slice(c,l);u===44?(co(e,f,r),r=Object.create(null)):s=f,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(a===void 0)if(l===-1&&Zf[u]===1)c===-1&&(c=p);else if(u===32||u===9)l===-1&&c!==-1&&(l=p);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1&&(l=p),co(r,t.slice(c,l),!0),u===44&&(co(e,s,r),r=Object.create(null),s=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=t.slice(c,p),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(i){if(Zf[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1?c=p:n||(n=!0),i=!1}else if(o)if(Zf[u]===1)c===-1&&(c=p);else if(u===34&&c!==-1)o=!1,l=p;else if(u===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(u===34&&t.charCodeAt(p-1)===61)o=!0;else if(l===-1&&Zf[u]===1)c===-1&&(c=p);else if(c!==-1&&(u===32||u===9))l===-1&&(l=p);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${p}`);l===-1&&(l=p);let f=t.slice(c,l);n&&(f=f.replace(/\\/g,""),n=!1),co(r,a,f),u===44&&(co(e,s,r),r=Object.create(null),s=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(c===-1||o||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=p);let d=t.slice(c,l);return s===void 0?co(e,d,r):(a===void 0?co(r,d,!0):n?co(r,a,d.replace(/\\/g,"")):co(r,a,d),co(e,s,r)),e}function EZ(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(i=>{let o=n[i];return Array.isArray(o)||(o=[o]),o.map(s=>s===!0?i:`${i}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}tB.exports={format:EZ,parse:PZ}});var Fb=P((ywe,fB)=>{"use strict";var kZ=require("events"),RZ=require("https"),AZ=require("http"),iB=require("net"),DZ=require("tls"),{randomBytes:OZ,createHash:LZ}=require("crypto"),{Duplex:mwe,Readable:gwe}=require("stream"),{URL:YC}=require("url"),Hs=xl(),NZ=GC(),MZ=JC(),{isBlob:BZ}=Il(),{BINARY_TYPES:rB,CLOSE_TIMEOUT:FZ,EMPTY_BUFFER:Nb,GUID:UZ,kForOnEventAttribute:QC,kListener:jZ,kStatusCode:WZ,kWebSocket:Kt,NOOP:oB}=Go(),{EventTarget:{addEventListener:HZ,removeEventListener:qZ}}=eB(),{format:$Z,parse:VZ}=Lb(),{toBuffer:GZ}=Jf(),sB=Symbol("kAborted"),ZC=[8,13],Jo=["CONNECTING","OPEN","CLOSING","CLOSED"],zZ=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,dt=class t extends kZ{constructor(e,r,n){super(),this._binaryType=rB[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Nb,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),aB(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){rB.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let i=new NZ({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),o=new MZ(e,this._extensions,n.generateMask);this._receiver=i,this._sender=o,this._socket=e,i[Kt]=this,o[Kt]=this,e[Kt]=this,i.on("conclude",XZ),i.on("drain",YZ),i.on("error",QZ),i.on("message",ZZ),i.on("ping",eee),i.on("pong",tee),o.onerror=ree,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",lB),e.on("data",Bb),e.on("end",pB),e.on("error",dB),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Hs.extensionName]&&this._extensions[Hs.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),uB(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){eT(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Nb,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){eT(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Nb,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){eT(this,e,n);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Hs.extensionName]||(i.compress=!1),this._sender.send(e||Nb,i,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(dt,"CONNECTING",{enumerable:!0,value:Jo.indexOf("CONNECTING")});Object.defineProperty(dt.prototype,"CONNECTING",{enumerable:!0,value:Jo.indexOf("CONNECTING")});Object.defineProperty(dt,"OPEN",{enumerable:!0,value:Jo.indexOf("OPEN")});Object.defineProperty(dt.prototype,"OPEN",{enumerable:!0,value:Jo.indexOf("OPEN")});Object.defineProperty(dt,"CLOSING",{enumerable:!0,value:Jo.indexOf("CLOSING")});Object.defineProperty(dt.prototype,"CLOSING",{enumerable:!0,value:Jo.indexOf("CLOSING")});Object.defineProperty(dt,"CLOSED",{enumerable:!0,value:Jo.indexOf("CLOSED")});Object.defineProperty(dt.prototype,"CLOSED",{enumerable:!0,value:Jo.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(dt.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(dt.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[QC])return e[jZ];return null},set(e){for(let r of this.listeners(t))if(r[QC]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[QC]:!0})}})});dt.prototype.addEventListener=HZ;dt.prototype.removeEventListener=qZ;fB.exports=dt;function aB(t,e,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:FZ,protocolVersion:ZC[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,t._closeTimeout=i.closeTimeout,!ZC.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${ZC.join(", ")})`);let o;if(e instanceof YC)o=e;else try{o=new YC(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}o.protocol==="http:"?o.protocol="ws:":o.protocol==="https:"&&(o.protocol="wss:"),t._url=o.href;let s=o.protocol==="wss:",a=o.protocol==="ws+unix:",c;if(o.protocol!=="ws:"&&!s&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!o.pathname?c="The URL's pathname is empty":o.hash&&(c="The URL contains a fragment identifier"),c){let m=new SyntaxError(c);if(t._redirects===0)throw m;Mb(t,m);return}let u=s?443:80,l=OZ(16).toString("base64"),p=s?RZ.request:AZ.request,d=new Set,f;if(i.createConnection=i.createConnection||(s?JZ:KZ),i.defaultPort=i.defaultPort||u,i.port=o.port||u,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"},i.path=o.pathname+o.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(f=new Hs({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers["Sec-WebSocket-Extensions"]=$Z({[Hs.extensionName]:f.offer()})),r.length){for(let m of r){if(typeof m!="string"||!zZ.test(m)||d.has(m))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(m)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),a){let m=i.path.split(":");i.socketPath=m[0],i.path=m[1]}let h;if(i.followRedirects){if(t._redirects===0){t._originalIpc=a,t._originalSecure=s,t._originalHostOrSocketPath=a?i.socketPath:o.host;let m=n&&n.headers;if(n={...n,headers:{}},m)for(let[x,C]of Object.entries(m))n.headers[x.toLowerCase()]=C}else if(t.listenerCount("redirect")===0){let m=a?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:o.host===t._originalHostOrSocketPath;(!m||t._originalSecure&&!s)&&(delete i.headers.authorization,delete i.headers.cookie,m||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),h=t._req=p(i),t._redirects&&t.emit("redirect",t.url,h)}else h=t._req=p(i);i.timeout&&h.on("timeout",()=>{pn(t,h,"Opening handshake has timed out")}),h.on("error",m=>{h===null||h[sB]||(h=t._req=null,Mb(t,m))}),h.on("response",m=>{let x=m.headers.location,C=m.statusCode;if(x&&i.followRedirects&&C>=300&&C<400){if(++t._redirects>i.maxRedirects){pn(t,h,"Maximum redirects exceeded");return}h.abort();let O;try{O=new YC(x,e)}catch{let T=new SyntaxError(`Invalid URL: ${x}`);Mb(t,T);return}aB(t,O,r,n)}else t.emit("unexpected-response",h,m)||pn(t,h,`Unexpected server response: ${m.statusCode}`)}),h.on("upgrade",(m,x,C)=>{if(t.emit("upgrade",m),t.readyState!==dt.CONNECTING)return;h=t._req=null;let O=m.headers.upgrade;if(O===void 0||O.toLowerCase()!=="websocket"){pn(t,x,"Invalid Upgrade header");return}let y=LZ("sha1").update(l+UZ).digest("base64");if(m.headers["sec-websocket-accept"]!==y){pn(t,x,"Invalid Sec-WebSocket-Accept header");return}let T=m.headers["sec-websocket-protocol"],E;if(T!==void 0?d.size?d.has(T)||(E="Server sent an invalid subprotocol"):E="Server sent a subprotocol but none was requested":d.size&&(E="Server sent no subprotocol"),E){pn(t,x,E);return}T&&(t._protocol=T);let M=m.headers["sec-websocket-extensions"];if(M!==void 0){if(!f){pn(t,x,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let k;try{k=VZ(M)}catch{pn(t,x,"Invalid Sec-WebSocket-Extensions header");return}let A=Object.keys(k);if(A.length!==1||A[0]!==Hs.extensionName){pn(t,x,"Server indicated an extension that was not requested");return}try{f.accept(k[Hs.extensionName])}catch{pn(t,x,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Hs.extensionName]=f}t.setSocket(x,C,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(h,t):h.end()}function Mb(t,e){t._readyState=dt.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function KZ(t){return t.path=t.socketPath,iB.connect(t)}function JZ(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=iB.isIP(t.host)?"":t.host),DZ.connect(t)}function pn(t,e,r){t._readyState=dt.CLOSING;let n=new Error(r);Error.captureStackTrace(n,pn),e.setHeader?(e[sB]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Mb,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function eT(t,e,r){if(e){let n=BZ(e)?e.size:GZ(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Jo[t.readyState]})`);process.nextTick(r,n)}}function XZ(t,e){let r=this[Kt];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[Kt]!==void 0&&(r._socket.removeListener("data",Bb),process.nextTick(cB,r._socket),t===1005?r.close():r.close(t,e))}function YZ(){let t=this[Kt];t.isPaused||t._socket.resume()}function QZ(t){let e=this[Kt];e._socket[Kt]!==void 0&&(e._socket.removeListener("data",Bb),process.nextTick(cB,e._socket),e.close(t[WZ])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function nB(){this[Kt].emitClose()}function ZZ(t,e){this[Kt].emit("message",t,e)}function eee(t){let e=this[Kt];e._autoPong&&e.pong(t,!this._isServer,oB),e.emit("ping",t)}function tee(t){this[Kt].emit("pong",t)}function cB(t){t.resume()}function ree(t){let e=this[Kt];e.readyState!==dt.CLOSED&&(e.readyState===dt.OPEN&&(e._readyState=dt.CLOSING,uB(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function uB(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function lB(){let t=this[Kt];if(this.removeListener("close",lB),this.removeListener("data",Bb),this.removeListener("end",pB),t._readyState=dt.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[Kt]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",nB),t._receiver.on("finish",nB))}function Bb(t){this[Kt]._receiver.write(t)||this.pause()}function pB(){let t=this[Kt];t._readyState=dt.CLOSING,t._receiver.end(),this.end()}function dB(){let t=this[Kt];this.removeListener("error",dB),this.on("error",oB),t&&(t._readyState=dt.CLOSING,this.destroy())}});var yB=P((vwe,gB)=>{"use strict";var bwe=Fb(),{Duplex:nee}=require("stream");function hB(t){t.emit("close")}function iee(){!this.destroyed&&this._writableState.finished&&this.destroy()}function mB(t){this.removeListener("error",mB),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function oee(t,e){let r=!0,n=new nee({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(o,s){let a=!s&&n._readableState.objectMode?o.toString():o;n.push(a)||t.pause()}),t.once("error",function(o){n.destroyed||(r=!1,n.destroy(o))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(i,o){if(t.readyState===t.CLOSED){o(i),process.nextTick(hB,n);return}let s=!1;t.once("error",function(c){s=!0,o(c)}),t.once("close",function(){s||o(i),process.nextTick(hB,n)}),r&&t.terminate()},n._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(i)});return}t._socket!==null&&(t._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){i()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(i,o,s){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(i,o,s)});return}t.send(i,s)},n.on("end",iee),n.on("error",mB),n}gB.exports=oee});var tT=P((wwe,bB)=>{"use strict";var{tokenChars:see}=Il();function aee(t){let e=new Set,r=-1,n=-1,i=0;for(i;i<t.length;i++){let s=t.charCodeAt(i);if(n===-1&&see[s]===1)r===-1&&(r=i);else if(i!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=i);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let o=t.slice(r,i);if(e.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return e.add(o),e}bB.exports={parse:aee}});var CB=P((_we,IB)=>{"use strict";var cee=require("events"),Ub=require("http"),{Duplex:Swe}=require("stream"),{createHash:uee}=require("crypto"),vB=Lb(),Ic=xl(),lee=tT(),pee=Fb(),{CLOSE_TIMEOUT:dee,GUID:fee,kWebSocket:hee}=Go(),mee=/^[+/0-9A-Za-z]{22}==$/,wB=0,SB=1,xB=2,rT=class extends cee{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:dee,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:pee,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ub.createServer((n,i)=>{let o=Ub.STATUS_CODES[426];i.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),i.end(o)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=gee(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,o,s)=>{this.handleUpgrade(i,o,s,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=wB}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===xB){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(eh,this);return}if(e&&this.once("close",e),this._state!==SB)if(this._state=SB,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(eh,this):process.nextTick(eh,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{eh(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,i){r.on("error",_B);let o=e.headers["sec-websocket-key"],s=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Cc(this,e,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Cc(this,e,r,400,"Invalid Upgrade header");return}if(o===void 0||!mee.test(o)){Cc(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){Cc(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){th(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=lee.parse(c)}catch{Cc(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&l!==void 0){let d=new Ic({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=vB.parse(l);f[Ic.extensionName]&&(d.accept(f[Ic.extensionName]),p[Ic.extensionName]=d)}catch{Cc(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let d={origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(d,(f,h,m,x)=>{if(!f)return th(r,h||401,m,x);this.completeUpgrade(p,o,u,e,r,n,i)});return}if(!this.options.verifyClient(d))return th(r,401)}this.completeUpgrade(p,o,u,e,r,n,i)}completeUpgrade(e,r,n,i,o,s,a){if(!o.readable||!o.writable)return o.destroy();if(o[hee])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>wB)return th(o,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${uee("sha1").update(r+fee).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),l._protocol=p)}if(e[Ic.extensionName]){let p=e[Ic.extensionName].params,d=vB.format({[Ic.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${d}`),l._extensions=e}this.emit("headers",u,i),o.write(u.concat(`\r
`).join(`\r
`)),o.removeListener("error",_B),l.setSocket(o,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(eh,this)})),a(l,i)}};IB.exports=rT;function gee(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function eh(t){t._state=xB,t.emit("close")}function _B(){this.destroy()}function th(t,e,r,n){r=r||Ub.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Ub.STATUS_CODES[e]}\r
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
`)+`\r
\r
`+r)}function Cc(t,e,r,n,i,o){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Cc),t.emit("wsClientError",s,r,e)}else th(r,n,i,o)}});var $B=P((aSe,qB)=>{"use strict";qB.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var GB=P((cSe,VB)=>{VB.exports=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}});var JB=P((uSe,KB)=>{"use strict";var kee=GB(),Ree=Array.prototype.concat,Aee=Array.prototype.slice,zB=KB.exports=function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];kee(o)?r=Ree.call(r,Aee.call(o)):r.push(o)}return r};zB.wrap=function(t){return function(){return t(zB(arguments))}}});var ZB=P((lSe,QB)=>{var ih=$B(),oh=JB(),XB=Object.hasOwnProperty,YB={};for(Vb in ih)XB.call(ih,Vb)&&(YB[ih[Vb]]=Vb);var Vb,dn=QB.exports={to:{},get:{}};dn.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=dn.get.hsl(t),n="hsl";break;case"hwb":r=dn.get.hwb(t),n="hwb";break;default:r=dn.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};dn.get.rgb=function(t){if(!t)return null;var e=/^#([a-f0-9]{3,4})$/i,r=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^(\w+)$/,s=[0,0,0,1],a,c,u;if(a=t.match(r)){for(u=a[2],a=a[1],c=0;c<3;c++){var l=c*2;s[c]=parseInt(a.slice(l,l+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(a=t.match(e)){for(a=a[1],u=a[3],c=0;c<3;c++)s[c]=parseInt(a[c]+a[c],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(a=t.match(n)){for(c=0;c<3;c++)s[c]=parseInt(a[c+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=t.match(i)){for(c=0;c<3;c++)s[c]=Math.round(parseFloat(a[c+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=t.match(o))?a[1]==="transparent"?[0,0,0,0]:XB.call(ih,a[1])?(s=ih[a[1]],s[3]=1,s):null:null;for(c=0;c<3;c++)s[c]=Gs(s[c],0,255);return s[3]=Gs(s[3],0,1),s};dn.get.hsl=function(t){if(!t)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),i=(parseFloat(r[1])%360+360)%360,o=Gs(parseFloat(r[2]),0,100),s=Gs(parseFloat(r[3]),0,100),a=Gs(isNaN(n)?1:n,0,1);return[i,o,s,a]}return null};dn.get.hwb=function(t){if(!t)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),i=(parseFloat(r[1])%360+360)%360,o=Gs(parseFloat(r[2]),0,100),s=Gs(parseFloat(r[3]),0,100),a=Gs(isNaN(n)?1:n,0,1);return[i,o,s,a]}return null};dn.to.hex=function(){var t=oh(arguments);return"#"+Gb(t[0])+Gb(t[1])+Gb(t[2])+(t[3]<1?Gb(Math.round(t[3]*255)):"")};dn.to.rgb=function(){var t=oh(arguments);return t.length<4||t[3]===1?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"};dn.to.rgb.percent=function(){var t=oh(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||t[3]===1?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"};dn.to.hsl=function(){var t=oh(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};dn.to.hwb=function(){var t=oh(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};dn.to.keyword=function(t){return YB[t.slice(0,3)]};function Gs(t,e,r){return Math.min(Math.max(e,t),r)}function Gb(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var tF=P((pSe,eF)=>{"use strict";eF.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var uT=P((dSe,nF)=>{var sh=tF(),rF={};for(let t of Object.keys(sh))rF[sh[t]]=t;var oe={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};nF.exports=oe;for(let t of Object.keys(oe)){if(!("channels"in oe[t]))throw new Error("missing channels property: "+t);if(!("labels"in oe[t]))throw new Error("missing channel labels property: "+t);if(oe[t].labels.length!==oe[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=oe[t];delete oe[t].channels,delete oe[t].labels,Object.defineProperty(oe[t],"channels",{value:e}),Object.defineProperty(oe[t],"labels",{value:r})}oe.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),o=Math.max(e,r,n),s=o-i,a,c;o===i?a=0:e===o?a=(r-n)/s:r===o?a=2+(n-e)/s:n===o&&(a=4+(e-r)/s),a=Math.min(a*60,360),a<0&&(a+=360);let u=(i+o)/2;return o===i?c=0:u<=.5?c=s/(o+i):c=s/(2-o-i),[a,c*100,u*100]};oe.rgb.hsv=function(t){let e,r,n,i,o,s=t[0]/255,a=t[1]/255,c=t[2]/255,u=Math.max(s,a,c),l=u-Math.min(s,a,c),p=function(d){return(u-d)/6/l+1/2};return l===0?(i=0,o=0):(o=l/u,e=p(s),r=p(a),n=p(c),s===u?i=n-r:a===u?i=1/3+e-n:c===u&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,o*100,u*100]};oe.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=oe.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,o*100,n*100]};oe.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),o=(1-e-i)/(1-i)||0,s=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[o*100,s*100,a*100,i*100]};function Dee(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}oe.rgb.keyword=function(t){let e=rF[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(sh)){let o=sh[i],s=Dee(t,o);s<r&&(r=s,n=i)}return n};oe.keyword.rgb=function(t){return sh[t]};oe.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,o=e*.2126+r*.7152+n*.0722,s=e*.0193+r*.1192+n*.9505;return[i*100,o*100,s*100]};oe.rgb.lab=function(t){let e=oe.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let o=116*n-16,s=500*(r-n),a=200*(n-i);return[o,s,a]};oe.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,o,s;if(r===0)return s=n*255,[s,s,s];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,c=[0,0,0];for(let u=0;u<3;u++)o=e+1/3*-(u-1),o<0&&o++,o>1&&o--,6*o<1?s=a+(i-a)*6*o:2*o<1?s=i:3*o<2?s=a+(i-a)*(2/3-o)*6:s=a,c[u]=s*255;return c};oe.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,o=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=o<=1?o:2-o;let s=(n+r)/2,a=n===0?2*i/(o+i):2*r/(n+r);return[e,a*100,s*100]};oe.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,o=e-Math.floor(e),s=255*n*(1-r),a=255*n*(1-r*o),c=255*n*(1-r*(1-o));switch(n*=255,i){case 0:return[n,c,s];case 1:return[a,n,s];case 2:return[s,n,c];case 3:return[s,a,n];case 4:return[c,s,n];case 5:return[n,s,a]}};oe.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),o,s;s=(2-r)*n;let a=(2-r)*i;return o=r*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]};oe.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,o;i>1&&(r/=i,n/=i);let s=Math.floor(6*e),a=1-n;o=6*e-s,(s&1)!==0&&(o=1-o);let c=r+o*(a-r),u,l,p;switch(s){default:case 6:case 0:u=a,l=c,p=r;break;case 1:u=c,l=a,p=r;break;case 2:u=r,l=a,p=c;break;case 3:u=r,l=c,p=a;break;case 4:u=c,l=r,p=a;break;case 5:u=a,l=r,p=c;break}return[u*255,l*255,p*255]};oe.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,o=1-Math.min(1,e*(1-i)+i),s=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[o*255,s*255,a*255]};oe.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,o,s;return i=e*3.2406+r*-1.5372+n*-.4986,o=e*-.9689+r*1.8758+n*.0415,s=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[i*255,o*255,s*255]};oe.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,o=500*(e-r),s=200*(r-n);return[i,o,s]};oe.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,o,s;o=(e+16)/116,i=r/500+o,s=o-n/200;let a=o**3,c=i**3,u=s**3;return o=a>.008856?a:(o-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,s=u>.008856?u:(s-16/116)/7.787,i*=95.047,o*=100,s*=108.883,[i,o,s]};oe.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let s=Math.sqrt(r*r+n*n);return[e,s,i]};oe.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,o=r*Math.cos(i),s=r*Math.sin(i);return[e,o,s]};oe.rgb.ansi16=function(t,e=null){let[r,n,i]=t,o=e===null?oe.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),o===0)return 30;let s=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return o===2&&(s+=60),s};oe.hsv.ansi16=function(t){return oe.rgb.ansi16(oe.hsv.rgb(t),t[2])};oe.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};oe.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,o=(e>>2&1)*r*255;return[n,i,o]};oe.ansi256.rgb=function(t){if(t>=232){let o=(t-232)*10+8;return[o,o,o]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};oe.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};oe.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,o=n>>8&255,s=n&255;return[i,o,s]};oe.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),o=Math.min(Math.min(e,r),n),s=i-o,a,c;return s<1?a=o/(1-s):a=0,s<=0?c=0:i===e?c=(r-n)/s%6:i===r?c=2+(n-e)/s:c=4+(e-r)/s,c/=6,c%=1,[c*360,s*100,a*100]};oe.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};oe.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};oe.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],o=e%1*6,s=o%1,a=1-s,c=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=s,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=s;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=s,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return c=(1-r)*n,[(r*i[0]+c)*255,(r*i[1]+c)*255,(r*i[2]+c)*255]};oe.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};oe.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};oe.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};oe.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],i*100,o*100]};oe.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};oe.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};oe.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};oe.gray.hsl=function(t){return[0,0,t[0]]};oe.gray.hsv=oe.gray.hsl;oe.gray.hwb=function(t){return[0,100,t[0]]};oe.gray.cmyk=function(t){return[0,0,0,t[0]]};oe.gray.lab=function(t){return[t[0],0,0]};oe.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};oe.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var oF=P((fSe,iF)=>{var zb=uT();function Oee(){let t={},e=Object.keys(zb);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function Lee(t){let e=Oee(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(zb[n]);for(let o=i.length,s=0;s<o;s++){let a=i[s],c=e[a];c.distance===-1&&(c.distance=e[n].distance+1,c.parent=n,r.unshift(a))}}return e}function Nee(t,e){return function(r){return e(t(r))}}function Mee(t,e){let r=[e[t].parent,t],n=zb[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=Nee(zb[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}iF.exports=function(t){let e=Lee(t),r={},n=Object.keys(e);for(let i=n.length,o=0;o<i;o++){let s=n[o];e[s].parent!==null&&(r[s]=Mee(s,e))}return r}});var aF=P((hSe,sF)=>{var lT=uT(),Bee=oF(),Ol={},Fee=Object.keys(lT);function Uee(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function jee(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let o=i.length,s=0;s<o;s++)i[s]=Math.round(i[s]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}Fee.forEach(t=>{Ol[t]={},Object.defineProperty(Ol[t],"channels",{value:lT[t].channels}),Object.defineProperty(Ol[t],"labels",{value:lT[t].labels});let e=Bee(t);Object.keys(e).forEach(n=>{let i=e[n];Ol[t][n]=jee(i),Ol[t][n].raw=Uee(i)})});sF.exports=Ol});var lF=P((mSe,uF)=>{var Ll=ZB(),fn=aF(),cF=["keyword","gray","hex"],pT={};for(let t of Object.keys(fn))pT[[...fn[t].labels].sort().join("")]=t;var Kb={};function Jt(t,e){if(!(this instanceof Jt))return new Jt(t,e);if(e&&e in cF&&(e=null),e&&!(e in fn))throw new Error("Unknown model: "+e);let r,n;if(t==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof Jt)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if(typeof t=="string"){let i=Ll.get(t);if(i===null)throw new Error("Unable to parse color from string: "+t);this.model=i.model,n=fn[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(t.length>0){this.model=e||"rgb",n=fn[this.model].channels;let i=Array.prototype.slice.call(t,0,n);this.color=dT(i,n),this.valpha=typeof t[n]=="number"?t[n]:1}else if(typeof t=="number")this.model="rgb",this.color=[t>>16&255,t>>8&255,t&255],this.valpha=1;else{this.valpha=1;let i=Object.keys(t);"alpha"in t&&(i.splice(i.indexOf("alpha"),1),this.valpha=typeof t.alpha=="number"?t.alpha:0);let o=i.sort().join("");if(!(o in pT))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=pT[o];let{labels:s}=fn[this.model],a=[];for(r=0;r<s.length;r++)a.push(t[s[r]]);this.color=dT(a)}if(Kb[this.model])for(n=fn[this.model].channels,r=0;r<n;r++){let i=Kb[this.model][r];i&&(this.color[r]=i(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Jt.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in Ll.to?this:this.rgb();e=e.round(typeof t=="number"?t:1);let r=e.valpha===1?e.color:[...e.color,this.valpha];return Ll.to[e.model](r)},percentString(t){let e=this.rgb().round(typeof t=="number"?t:1),r=e.valpha===1?e.color:[...e.color,this.valpha];return Ll.to.rgb.percent(r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let t={},{channels:e}=fn[this.model],{labels:r}=fn[this.model];for(let n=0;n<e;n++)t[r[n]]=this.color[n];return this.valpha!==1&&(t.alpha=this.valpha),t},unitArray(){let t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,this.valpha!==1&&t.push(this.valpha),t},unitObject(){let t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,this.valpha!==1&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new Jt([...this.color.map(Hee(t)),this.valpha],this.model)},alpha(t){return t!==void 0?new Jt([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:bt("rgb",0,Ut(255)),green:bt("rgb",1,Ut(255)),blue:bt("rgb",2,Ut(255)),hue:bt(["hsl","hsv","hsl","hwb","hcg"],0,t=>(t%360+360)%360),saturationl:bt("hsl",1,Ut(100)),lightness:bt("hsl",2,Ut(100)),saturationv:bt("hsv",1,Ut(100)),value:bt("hsv",2,Ut(100)),chroma:bt("hcg",1,Ut(100)),gray:bt("hcg",2,Ut(100)),white:bt("hwb",1,Ut(100)),wblack:bt("hwb",2,Ut(100)),cyan:bt("cmyk",0,Ut(100)),magenta:bt("cmyk",1,Ut(100)),yellow:bt("cmyk",2,Ut(100)),black:bt("cmyk",3,Ut(100)),x:bt("xyz",0,Ut(95.047)),y:bt("xyz",1,Ut(100)),z:bt("xyz",2,Ut(108.833)),l:bt("lab",0,Ut(100)),a:bt("lab",1),b:bt("lab",2),keyword(t){return t!==void 0?new Jt(t):fn[this.model].keyword(this.color)},hex(t){return t!==void 0?new Jt(t):Ll.to.hex(this.rgb().round().color)},hexa(t){if(t!==void 0)return new Jt(t);let e=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),Ll.to.hex(e)+r},rgbNumber(){let t=this.rgb().color;return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255},luminosity(){let t=this.rgb().color,e=[];for(let[r,n]of t.entries()){let i=n/255;e[r]=i<=.04045?i/12.92:((i+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){let e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level(t){let e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){let t=this.rgb().color;return(t[0]*2126+t[1]*7152+t[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){let e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){let e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){let e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){let e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){let e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){let e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){let t=this.rgb().color,e=t[0]*.3+t[1]*.59+t[2]*.11;return Jt.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){let e=this.hsl(),r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);let r=t.rgb(),n=this.rgb(),i=e===void 0?.5:e,o=2*i-1,s=r.alpha()-n.alpha(),a=((o*s===-1?o:(o+s)/(1+o*s))+1)/2,c=1-a;return Jt.rgb(a*r.red()+c*n.red(),a*r.green()+c*n.green(),a*r.blue()+c*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(let t of Object.keys(fn)){if(cF.includes(t))continue;let{channels:e}=fn[t];Jt.prototype[t]=function(...r){return this.model===t?new Jt(this):r.length>0?new Jt(r,t):new Jt([...qee(fn[this.model][t].raw(this.color)),this.valpha],t)},Jt[t]=function(...r){let n=r[0];return typeof n=="number"&&(n=dT(r,e)),new Jt(n,t)}}function Wee(t,e){return Number(t.toFixed(e))}function Hee(t){return function(e){return Wee(e,t)}}function bt(t,e,r){t=Array.isArray(t)?t:[t];for(let n of t)(Kb[n]||(Kb[n]=[]))[e]=r;return t=t[0],function(n){let i;return n!==void 0?(r&&(n=r(n)),i=this[t](),i.color[e]=n,i):(i=this[t]().color[e],r&&(i=r(i)),i)}}function Ut(t){return function(e){return Math.max(0,Math.min(t,e))}}function qee(t){return Array.isArray(t)?t:[t]}function dT(t,e){for(let r=0;r<e;r++)typeof t[r]!="number"&&(t[r]=0);return t}uF.exports=Jt});var dU=P(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.makeDataUriToBuffer=void 0;var wte=t=>e=>{if(e=String(e),!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let r=e.indexOf(",");if(r===-1||r<=4)throw new TypeError("malformed data: URI");let n=e.substring(5,r).split(";"),i="",o=!1,s=n[0]||"text/plain",a=s;for(let l=1;l<n.length;l++)n[l]==="base64"?o=!0:n[l]&&(a+=`;${n[l]}`,n[l].indexOf("charset=")===0&&(i=n[l].substring(8)));!n[0]&&!i.length&&(a+=";charset=US-ASCII",i="US-ASCII");let c=unescape(e.substring(r+1)),u=o?t.base64ToArrayBuffer(c):t.stringToBuffer(c);return{type:s,typeFull:a,charset:i,buffer:u}};Ev.makeDataUriToBuffer=wte});var hU=P(kv=>{"use strict";Object.defineProperty(kv,"__esModule",{value:!0});kv.dataUriToBuffer=void 0;var Ste=dU();function fU(t){if(t.byteLength===t.buffer.byteLength)return t.buffer;let e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(t),e}function _te(t){return fU(Buffer.from(t,"base64"))}function xte(t){return fU(Buffer.from(t,"ascii"))}kv.dataUriToBuffer=(0,Ste.makeDataUriToBuffer)({stringToBuffer:xte,base64ToArrayBuffer:_te})});var l2=P((UTe,u2)=>{"use strict";var aie=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),cie=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),uie=new Set([500,502,503,504]),lie={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},pie={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function Yo(t){let e=parseInt(t,10);return isFinite(e)?e:0}function die(t){return t?uie.has(t.status):!0}function yP(t){let e={};if(!t)return e;let r=t.trim().split(/,/);for(let n of r){let[i,o]=n.split(/=/,2);e[i.trim()]=o===void 0?!0:o.trim().replace(/^"|"$/g,"")}return e}function fie(t){let e=[];for(let r in t){let n=t[r];e.push(n===!0?r:r+"="+n)}if(e.length)return e.join(", ")}u2.exports=class{constructor(e,r,{shared:n,cacheHeuristic:i,immutableMinTimeToLive:o,ignoreCargoCult:s,_fromObject:a}={}){if(a){this._fromObject(a);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=n!==!1,this._ignoreCargoCult=!!s,this._cacheHeuristic=i!==void 0?i:.1,this._immutableMinTtl=o!==void 0?o:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=yP(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=yP(e.headers["cache-control"]),this._ignoreCargoCult&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":fie(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&cie.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||aie.has(this._status)))}_hasExplicitExpiration(){return!!(this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires)}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){return!this.evaluateRequest(e).revalidation}_evaluateRequestHitResult(e){return{response:{headers:this.responseHeaders()},revalidation:e}}_evaluateRequestRevalidation(e,r){return{synchronous:r,headers:this.revalidationHeaders(e)}}_evaluateRequestMissResult(e){return{response:void 0,revalidation:this._evaluateRequestRevalidation(e,!0)}}evaluateRequest(e){if(this._assertRequestHasHeaders(e),this._rescc["must-revalidate"])return this._evaluateRequestMissResult(e);if(!this._requestMatches(e,!1))return this._evaluateRequestMissResult(e);let r=yP(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)?this._evaluateRequestMissResult(e):r["max-age"]&&this.age()>Yo(r["max-age"])?this._evaluateRequestMissResult(e):r["min-fresh"]&&this.maxAge()-this.age()<Yo(r["min-fresh"])?this._evaluateRequestMissResult(e):this.stale()?"max-stale"in r&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge())?this._evaluateRequestHitResult(void 0):this.useStaleWhileRevalidate()?this._evaluateRequestHitResult(this._evaluateRequestRevalidation(e,!1)):this._evaluateRequestMissResult(e):this._evaluateRequestHitResult(void 0)}_requestMatches(e,r){return!!((!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e))}_allowsStoringAuthenticated(){return!!(this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"])}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let n of r)if(e.headers[n]!==this._reqHeaders[n])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let n in e)lie[n]||(r[n]=e[n]);if(e.connection){let n=e.connection.trim().split(/\s*,\s*/);for(let i of n)delete r[i]}if(r.warning){let n=r.warning.split(/,/).filter(i=>!/^\s*1[0-9][0-9]/.test(i));n.length?r.warning=n.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return Yo(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return Yo(this._rescc["s-maxage"])}if(this._rescc["max-age"])return Yo(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let n=Date.parse(this._resHeaders.expires);return Number.isNaN(n)||n<r?0:Math.max(e,(n-r)/1e3)}if(this._resHeaders["last-modified"]){let n=Date.parse(this._resHeaders["last-modified"]);if(isFinite(n)&&r>n)return Math.max(e,(r-n)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+Yo(this._rescc["stale-if-error"]),n=e+Yo(this._rescc["stale-while-revalidate"]);return Math.round(Math.max(0,e,r,n)*1e3)}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+Yo(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){let e=Yo(this._rescc["stale-while-revalidate"]);return e>0&&this.maxAge()+e>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._ignoreCargoCult=!!e.icc,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,icc:this._ignoreCargoCult,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let i=r["if-none-match"].split(/,/).filter(o=>!/^\s*W\//.test(o));i.length?r["if-none-match"]=i.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&die(r))return{policy:this,modified:!1,matches:!0};if(!r||!r.headers)throw Error("Response headers missing");let n=!1;r.status!==void 0&&r.status!=304?n=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?n=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?n=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?n=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(n=!0);let i={shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl,ignoreCargoCult:this._ignoreCargoCult};if(!n)return{policy:new this.constructor(e,r,i),modified:r.status!=304,matches:!1};let o={};for(let a in this._resHeaders)o[a]=a in r.headers&&!pie[a]?r.headers[a]:this._resHeaders[a];let s=Object.assign({},r,{status:this._status,method:this._method,headers:o});return{policy:new this.constructor(e,s,i),modified:!1,matches:!0}}}});async function eE(){if(GW.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Xoe("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var VW,GW,zW,Xoe,KW=ri(()=>{VW=require("node:util"),GW=v(require("node:process"),1),zW=require("node:child_process"),Xoe=(0,VW.promisify)(zW.execFile)});async function YW(t,{humanReadableOutput:e=!0}={}){if(JW.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],{stdout:n}=await Yoe("osascript",["-e",t,r]);return n.trim()}var JW,XW,tE,Yoe,QW=ri(()=>{JW=v(require("node:process"),1),XW=require("node:util"),tE=require("node:child_process"),Yoe=(0,XW.promisify)(tE.execFile)});async function rE(t){return YW(`tell application "Finder" to set app_path to application file id "${t}" as string
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var ZW=ri(()=>{QW()});async function nE(t=Qoe){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new aw(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=Zoe[n];if(!i)throw new aw(`Unknown browser ID: ${n}`);return i}var eH,tH,Qoe,Zoe,aw,rH=ri(()=>{eH=require("node:util"),tH=require("node:child_process"),Qoe=(0,eH.promisify)(tH.execFile),Zoe={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},aw=class extends Error{}});var sH={};ex(sH,{default:()=>oH});async function oH(){if(cw.default.platform==="darwin"){let t=await eE();return{name:await rE(t),id:t}}if(cw.default.platform==="linux"){let{stdout:t}=await ese("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:tse(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(cw.default.platform==="win32")return nE();throw new Error("Only macOS, Linux, and Windows are supported")}var nH,cw,iH,ese,tse,aH=ri(()=>{nH=require("node:util"),cw=v(require("node:process"),1),iH=require("node:child_process");KW();ZW();rH();ese=(0,nH.promisify)(iH.execFile),tse=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var dH=P((nke,pH)=>{"use strict";function nse(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}pH.exports=nse});var hH=P((ike,oE)=>{"use strict";var ise=dH();function fH(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),r<1)throw new Error("fastqueue concurrency must be greater than 1");var n=ise(ose),i=null,o=null,s=0,a=null,c={push:m,drain:Hn,saturated:Hn,pause:l,paused:!1,concurrency:r,running:u,resume:f,idle:h,length:p,getQueue:d,unshift:x,empty:Hn,kill:O,killAndDrain:y,error:T};return c;function u(){return s}function l(){c.paused=!0}function p(){for(var E=i,M=0;E;)E=E.next,M++;return M}function d(){for(var E=i,M=[];E;)M.push(E.value),E=E.next;return M}function f(){if(c.paused){c.paused=!1;for(var E=0;E<c.concurrency;E++)s++,C()}}function h(){return s===0&&c.length()===0}function m(E,M){var k=n.get();k.context=t,k.release=C,k.value=E,k.callback=M||Hn,k.errorHandler=a,s===c.concurrency||c.paused?o?(o.next=k,o=k):(i=k,o=k,c.saturated()):(s++,e.call(t,k.value,k.worked))}function x(E,M){var k=n.get();k.context=t,k.release=C,k.value=E,k.callback=M||Hn,s===c.concurrency||c.paused?i?(k.next=i,i=k):(i=k,o=k,c.saturated()):(s++,e.call(t,k.value,k.worked))}function C(E){E&&n.release(E);var M=i;M?c.paused?s--:(o===i&&(o=null),i=M.next,M.next=null,e.call(t,M.value,M.worked),o===null&&c.empty()):--s===0&&c.drain()}function O(){i=null,o=null,c.drain=Hn}function y(){i=null,o=null,c.drain(),c.drain=Hn}function T(E){a=E}}function Hn(){}function ose(){this.value=null,this.callback=Hn,this.next=null,this.release=Hn,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=Hn,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function sse(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(l,p){e.call(this,l).then(function(d){p(null,d)},p)}var i=fH(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=c,i.drained=u,i;function a(l){var p=new Promise(function(d,f){o(l,function(h,m){if(h){f(h);return}d(m)})});return p.catch(Hn),p}function c(l){var p=new Promise(function(d,f){s(l,function(h,m){if(h){f(h);return}d(m)})});return p.catch(Hn),p}function u(){if(i.idle())return new Promise(function(d){d()});var l=i.drain,p=new Promise(function(d){i.drain=function(){l(),d()}});return p}}oE.exports=fH;oE.exports.promise=sse});var Lh=P((oke,vH)=>{"use strict";var ase=require("path"),mo="\\\\/",mH=`[^${mo}]`,cse=0,rs="\\.",use="\\+",lse="\\?",pw="\\/",pse="(?=.)",gH="[^/]",sE=`(?:${pw}|$)`,yH=`(?:^|${pw})`,aE=`${rs}{1,2}${sE}`,dse=`(?!${rs})`,fse=`(?!${yH}${aE})`,hse=`(?!${rs}{0,1}${sE})`,mse=`(?!${aE})`,gse=`[^.${pw}]`,yse=`${gH}*?`,bH={DOT_LITERAL:rs,PLUS_LITERAL:use,QMARK_LITERAL:lse,SLASH_LITERAL:pw,ONE_CHAR:pse,QMARK:gH,END_ANCHOR:sE,DOTS_SLASH:aE,NO_DOT:dse,NO_DOTS:fse,NO_DOT_SLASH:hse,NO_DOTS_SLASH:mse,QMARK_NO_DOT:gse,STAR:yse,START_ANCHOR:yH},bse={...bH,SLASH_LITERAL:`[${mo}]`,QMARK:mH,STAR:`${mH}*?`,DOTS_SLASH:`${rs}{1,2}(?:[${mo}]|$)`,NO_DOT:`(?!${rs})`,NO_DOTS:`(?!(?:^|[${mo}])${rs}{1,2}(?:[${mo}]|$))`,NO_DOT_SLASH:`(?!${rs}{0,1}(?:[${mo}]|$))`,NO_DOTS_SLASH:`(?!${rs}{1,2}(?:[${mo}]|$))`,QMARK_NO_DOT:`[^.${mo}]`,START_ANCHOR:`(?:^|[${mo}])`,END_ANCHOR:`(?:[${mo}]|$)`},vse={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};vH.exports={DEFAULT_MAX_EXTGLOB_RECURSION:cse,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:vse,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:ase.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?bse:bH}}});var dw=P(Jr=>{"use strict";var wse=require("path"),Sse=process.platform==="win32",{REGEX_BACKSLASH:_se,REGEX_REMOVE_BACKSLASH:xse,REGEX_SPECIAL_CHARS:Ise,REGEX_SPECIAL_CHARS_GLOBAL:Cse}=Lh();Jr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Jr.hasRegexChars=t=>Ise.test(t);Jr.isRegexChar=t=>t.length===1&&Jr.hasRegexChars(t);Jr.escapeRegex=t=>t.replace(Cse,"\\$1");Jr.toPosixSlashes=t=>t.replace(_se,"/");Jr.removeBackslashes=t=>t.replace(xse,e=>e==="\\"?"":e);Jr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Jr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Sse===!0||wse.sep==="\\";Jr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Jr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Jr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Jr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var PH=P((ake,TH)=>{"use strict";var wH=dw(),{CHAR_ASTERISK:cE,CHAR_AT:Tse,CHAR_BACKWARD_SLASH:Nh,CHAR_COMMA:Pse,CHAR_DOT:uE,CHAR_EXCLAMATION_MARK:lE,CHAR_FORWARD_SLASH:CH,CHAR_LEFT_CURLY_BRACE:pE,CHAR_LEFT_PARENTHESES:dE,CHAR_LEFT_SQUARE_BRACKET:Ese,CHAR_PLUS:kse,CHAR_QUESTION_MARK:SH,CHAR_RIGHT_CURLY_BRACE:Rse,CHAR_RIGHT_PARENTHESES:_H,CHAR_RIGHT_SQUARE_BRACKET:Ase}=Lh(),xH=t=>t===CH||t===Nh,IH=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Dse=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,u=-1,l=0,p=0,d=!1,f=!1,h=!1,m=!1,x=!1,C=!1,O=!1,y=!1,T=!1,E=!1,M=0,k,A,W={value:"",depth:0,isGlob:!1},Z=()=>u>=n,_=()=>c.charCodeAt(u+1),B=()=>(k=A,c.charCodeAt(++u));for(;u<n;){A=B();let pe;if(A===Nh){O=W.backslashes=!0,A=B(),A===pE&&(C=!0);continue}if(C===!0||A===pE){for(M++;Z()!==!0&&(A=B());){if(A===Nh){O=W.backslashes=!0,B();continue}if(A===pE){M++;continue}if(C!==!0&&A===uE&&(A=B())===uE){if(d=W.isBrace=!0,h=W.isGlob=!0,E=!0,i===!0)continue;break}if(C!==!0&&A===Pse){if(d=W.isBrace=!0,h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===Rse&&(M--,M===0)){C=!1,d=W.isBrace=!0,E=!0;break}}if(i===!0)continue;break}if(A===CH){if(o.push(u),s.push(W),W={value:"",depth:0,isGlob:!1},E===!0)continue;if(k===uE&&u===l+1){l+=2;continue}p=u+1;continue}if(r.noext!==!0&&(A===kse||A===Tse||A===cE||A===SH||A===lE)===!0&&_()===dE){if(h=W.isGlob=!0,m=W.isExtglob=!0,E=!0,A===lE&&u===l&&(T=!0),i===!0){for(;Z()!==!0&&(A=B());){if(A===Nh){O=W.backslashes=!0,A=B();continue}if(A===_H){h=W.isGlob=!0,E=!0;break}}continue}break}if(A===cE){if(k===cE&&(x=W.isGlobstar=!0),h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===SH){if(h=W.isGlob=!0,E=!0,i===!0)continue;break}if(A===Ese){for(;Z()!==!0&&(pe=B());){if(pe===Nh){O=W.backslashes=!0,B();continue}if(pe===Ase){f=W.isBracket=!0,h=W.isGlob=!0,E=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&A===lE&&u===l){y=W.negated=!0,l++;continue}if(r.noparen!==!0&&A===dE){if(h=W.isGlob=!0,i===!0){for(;Z()!==!0&&(A=B());){if(A===dE){O=W.backslashes=!0,A=B();continue}if(A===_H){E=!0;break}}continue}break}if(h===!0){if(E=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let F=c,G="",b="";l>0&&(G=c.slice(0,l),c=c.slice(l),p-=l),F&&h===!0&&p>0?(F=c.slice(0,p),b=c.slice(p)):h===!0?(F="",b=c):F=c,F&&F!==""&&F!=="/"&&F!==c&&xH(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),r.unescape===!0&&(b&&(b=wH.removeBackslashes(b)),F&&O===!0&&(F=wH.removeBackslashes(F)));let S={prefix:G,input:t,start:l,base:F,glob:b,isBrace:d,isBracket:f,isGlob:h,isExtglob:m,isGlobstar:x,negated:y,negatedExtglob:T};if(r.tokens===!0&&(S.maxDepth=0,xH(A)||s.push(W),S.tokens=s),r.parts===!0||r.tokens===!0){let pe;for(let K=0;K<o.length;K++){let Se=pe?pe+1:l,ue=o[K],Le=t.slice(Se,ue);r.tokens&&(K===0&&l!==0?(s[K].isPrefix=!0,s[K].value=G):s[K].value=Le,IH(s[K]),S.maxDepth+=s[K].depth),(K!==0||Le!=="")&&a.push(Le),pe=ue}if(pe&&pe+1<t.length){let K=t.slice(pe+1);a.push(K),r.tokens&&(s[s.length-1].value=K,IH(s[s.length-1]),S.maxDepth+=s[s.length-1].depth)}S.slashes=o,S.parts=a}return S};TH.exports=Dse});var DH=P((cke,AH)=>{"use strict";var Mh=Lh(),Ir=dw(),{MAX_LENGTH:fw,POSIX_REGEX_SOURCE:Ose,REGEX_NON_SPECIAL_CHARS:Lse,REGEX_SPECIAL_CHARS_BACKREF:Nse,REPLACEMENTS:EH}=Mh,Mse=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Ir.escapeRegex(i)).join("..")}return r},gp=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,kH=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Bse=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},RH=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Bse(e))return e.replace(/\\(.)/g,"$1")},Fse=t=>{let e=t.map(RH).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},fE=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Use=t=>{let e=0,r=[];for(;e<t.length;){let i=fE(t.slice(e),!1);if(!i||i.type!=="*")return;let o=kH(i.body).map(a=>a.trim());if(o.length!==1)return;let s=RH(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Ir.escapeRegex(r[0]):`[${r.map(i=>Ir.escapeRegex(i)).join("")}]`}*`},jse=t=>{let e=0,r=t.trim(),n=fE(r);for(;n;)e++,r=n.body.trim(),n=fE(r);return e},Wse=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Mh.DEFAULT_MAX_EXTGLOB_RECURSION,n=kH(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||Fse(n)))return{risky:!0};for(let i of n){let o=Use(i);if(o)return{risky:!0,safeOutput:o};if(jse(i)>r)return{risky:!0}}return{risky:!1}},hE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=EH[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(fw,r.maxLength):fw,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Ir.isWindows(e),u=Mh.globChars(c),l=Mh.extglobChars(u),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:x,NO_DOT_SLASH:C,NO_DOTS_SLASH:O,QMARK:y,QMARK_NO_DOT:T,STAR:E,START_ANCHOR:M}=u,k=L=>`(${a}(?:(?!${M}${L.dot?m:p}).)*?)`,A=r.dot?"":x,W=r.dot?y:T,Z=r.bash===!0?k(r):E;r.capture&&(Z=`(${Z})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Ir.removePrefix(t,_),i=t.length;let B=[],F=[],G=[],b=o,S,pe=()=>_.index===i-1,K=_.peek=(L=1)=>t[_.index+L],Se=_.advance=()=>t[++_.index]||"",ue=()=>t.slice(_.index+1),Le=(L="",se=0)=>{_.consumed+=L,_.index+=se},ee=L=>{_.output+=L.output!=null?L.output:L.value,Le(L.value)},yt=()=>{let L=1;for(;K()==="!"&&(K(2)!=="("||K(3)==="?");)Se(),_.start++,L++;return L%2===0?!1:(_.negated=!0,_.start++,!0)},sr=L=>{_[L]++,G.push(L)},xe=L=>{_[L]--,G.pop()},X=L=>{if(b.type==="globstar"){let se=_.braces>0&&(L.type==="comma"||L.type==="brace"),D=L.extglob===!0||B.length&&(L.type==="pipe"||L.type==="paren");L.type!=="slash"&&L.type!=="paren"&&!se&&!D&&(_.output=_.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=Z,_.output+=b.output)}if(B.length&&L.type!=="paren"&&(B[B.length-1].inner+=L.value),(L.value||L.output)&&ee(L),b&&b.type==="text"&&L.type==="text"){b.value+=L.value,b.output=(b.output||"")+L.value;return}L.prev=b,s.push(L),b=L},ei=(L,se)=>{let D={...l[se],conditions:1,inner:""};D.prev=b,D.parens=_.parens,D.output=_.output,D.startIndex=_.index,D.tokensIndex=s.length;let z=(r.capture?"(":"")+D.open;sr("parens"),X({type:L,value:se,output:_.output?"":h}),X({type:"paren",extglob:!0,value:Se(),output:z}),B.push(D)},Su=L=>{let se=t.slice(L.startIndex,_.index+1),D=t.slice(L.startIndex+2,_.index),z=Wse(D,r);if((L.type==="plus"||L.type==="star")&&z.risky){let le=z.safeOutput?(L.output?"":h)+(r.capture?`(${z.safeOutput})`:z.safeOutput):void 0,ot=s[L.tokensIndex];ot.type="text",ot.value=se,ot.output=le||Ir.escapeRegex(se);for(let st=L.tokensIndex+1;st<s.length;st++)s[st].value="",s[st].output="",delete s[st].suffix;_.output=L.output+ot.output,_.backtrack=!0,X({type:"paren",extglob:!0,value:S,output:""}),xe("parens");return}let fe=L.close+(r.capture?")":""),Ie;if(L.type==="negate"){let le=Z;if(L.inner&&L.inner.length>1&&L.inner.includes("/")&&(le=k(r)),(le!==Z||pe()||/^\)+$/.test(ue()))&&(fe=L.close=`)$))${le}`),L.inner.includes("*")&&(Ie=ue())&&/^\.[^\\/.]+$/.test(Ie)){let ot=hE(Ie,{...e,fastpaths:!1}).output;fe=L.close=`)${ot})${le})`}L.prev.type==="bos"&&(_.negatedExtglob=!0)}X({type:"paren",extglob:!0,value:S,output:fe}),xe("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let L=!1,se=t.replace(Nse,(D,z,fe,Ie,le,ot)=>Ie==="\\"?(L=!0,D):Ie==="?"?z?z+Ie+(le?y.repeat(le.length):""):ot===0?W+(le?y.repeat(le.length):""):y.repeat(fe.length):Ie==="."?p.repeat(fe.length):Ie==="*"?z?z+Ie+(le?Z:""):Z:z?D:`\\${D}`);return L===!0&&(r.unescape===!0?se=se.replace(/\\/g,""):se=se.replace(/\\+/g,D=>D.length%2===0?"\\\\":D?"\\":"")),se===t&&r.contains===!0?(_.output=t,_):(_.output=Ir.wrapOutput(se,_,e),_)}for(;!pe();){if(S=Se(),S==="\0")continue;if(S==="\\"){let D=K();if(D==="/"&&r.bash!==!0||D==="."||D===";")continue;if(!D){S+="\\",X({type:"text",value:S});continue}let z=/^\\+/.exec(ue()),fe=0;if(z&&z[0].length>2&&(fe=z[0].length,_.index+=fe,fe%2!==0&&(S+="\\")),r.unescape===!0?S=Se():S+=Se(),_.brackets===0){X({type:"text",value:S});continue}}if(_.brackets>0&&(S!=="]"||b.value==="["||b.value==="[^")){if(r.posix!==!1&&S===":"){let D=b.value.slice(1);if(D.includes("[")&&(b.posix=!0,D.includes(":"))){let z=b.value.lastIndexOf("["),fe=b.value.slice(0,z),Ie=b.value.slice(z+2),le=Ose[Ie];if(le){b.value=fe+le,_.backtrack=!0,Se(),!o.output&&s.indexOf(b)===1&&(o.output=h);continue}}}(S==="["&&K()!==":"||S==="-"&&K()==="]")&&(S=`\\${S}`),S==="]"&&(b.value==="["||b.value==="[^")&&(S=`\\${S}`),r.posix===!0&&S==="!"&&b.value==="["&&(S="^"),b.value+=S,ee({value:S});continue}if(_.quotes===1&&S!=='"'){S=Ir.escapeRegex(S),b.value+=S,ee({value:S});continue}if(S==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&X({type:"text",value:S});continue}if(S==="("){sr("parens"),X({type:"paren",value:S});continue}if(S===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(gp("opening","("));let D=B[B.length-1];if(D&&_.parens===D.parens+1){Su(B.pop());continue}X({type:"paren",value:S,output:_.parens?")":"\\)"}),xe("parens");continue}if(S==="["){if(r.nobracket===!0||!ue().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(gp("closing","]"));S=`\\${S}`}else sr("brackets");X({type:"bracket",value:S});continue}if(S==="]"){if(r.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){X({type:"text",value:S,output:`\\${S}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(gp("opening","["));X({type:"text",value:S,output:`\\${S}`});continue}xe("brackets");let D=b.value.slice(1);if(b.posix!==!0&&D[0]==="^"&&!D.includes("/")&&(S=`/${S}`),b.value+=S,ee({value:S}),r.literalBrackets===!1||Ir.hasRegexChars(D))continue;let z=Ir.escapeRegex(b.value);if(_.output=_.output.slice(0,-b.value.length),r.literalBrackets===!0){_.output+=z,b.value=z;continue}b.value=`(${a}${z}|${b.value})`,_.output+=b.value;continue}if(S==="{"&&r.nobrace!==!0){sr("braces");let D={type:"brace",value:S,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};F.push(D),X(D);continue}if(S==="}"){let D=F[F.length-1];if(r.nobrace===!0||!D){X({type:"text",value:S,output:S});continue}let z=")";if(D.dots===!0){let fe=s.slice(),Ie=[];for(let le=fe.length-1;le>=0&&(s.pop(),fe[le].type!=="brace");le--)fe[le].type!=="dots"&&Ie.unshift(fe[le].value);z=Mse(Ie,r),_.backtrack=!0}if(D.comma!==!0&&D.dots!==!0){let fe=_.output.slice(0,D.outputIndex),Ie=_.tokens.slice(D.tokensIndex);D.value=D.output="\\{",S=z="\\}",_.output=fe;for(let le of Ie)_.output+=le.output||le.value}X({type:"brace",value:S,output:z}),xe("braces"),F.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,X({type:"text",value:S});continue}if(S===","){let D=S,z=F[F.length-1];z&&G[G.length-1]==="braces"&&(z.comma=!0,D="|"),X({type:"comma",value:S,output:D});continue}if(S==="/"){if(b.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),b=o;continue}X({type:"slash",value:S,output:f});continue}if(S==="."){if(_.braces>0&&b.type==="dot"){b.value==="."&&(b.output=p);let D=F[F.length-1];b.type="dots",b.output+=S,b.value+=S,D.dots=!0;continue}if(_.braces+_.parens===0&&b.type!=="bos"&&b.type!=="slash"){X({type:"text",value:S,output:p});continue}X({type:"dot",value:S,output:p});continue}if(S==="?"){if(!(b&&b.value==="(")&&r.noextglob!==!0&&K()==="("&&K(2)!=="?"){ei("qmark",S);continue}if(b&&b.type==="paren"){let z=K(),fe=S;if(z==="<"&&!Ir.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(b.value==="("&&!/[!=<:]/.test(z)||z==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(fe=`\\${S}`),X({type:"text",value:S,output:fe});continue}if(r.dot!==!0&&(b.type==="slash"||b.type==="bos")){X({type:"qmark",value:S,output:T});continue}X({type:"qmark",value:S,output:y});continue}if(S==="!"){if(r.noextglob!==!0&&K()==="("&&(K(2)!=="?"||!/[!=<:]/.test(K(3)))){ei("negate",S);continue}if(r.nonegate!==!0&&_.index===0){yt();continue}}if(S==="+"){if(r.noextglob!==!0&&K()==="("&&K(2)!=="?"){ei("plus",S);continue}if(b&&b.value==="("||r.regex===!1){X({type:"plus",value:S,output:d});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||_.parens>0){X({type:"plus",value:S});continue}X({type:"plus",value:d});continue}if(S==="@"){if(r.noextglob!==!0&&K()==="("&&K(2)!=="?"){X({type:"at",extglob:!0,value:S,output:""});continue}X({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let D=Lse.exec(ue());D&&(S+=D[0],_.index+=D[0].length),X({type:"text",value:S});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=S,b.output=Z,_.backtrack=!0,_.globstar=!0,Le(S);continue}let L=ue();if(r.noextglob!==!0&&/^\([^?]/.test(L)){ei("star",S);continue}if(b.type==="star"){if(r.noglobstar===!0){Le(S);continue}let D=b.prev,z=D.prev,fe=D.type==="slash"||D.type==="bos",Ie=z&&(z.type==="star"||z.type==="globstar");if(r.bash===!0&&(!fe||L[0]&&L[0]!=="/")){X({type:"star",value:S,output:""});continue}let le=_.braces>0&&(D.type==="comma"||D.type==="brace"),ot=B.length&&(D.type==="pipe"||D.type==="paren");if(!fe&&D.type!=="paren"&&!le&&!ot){X({type:"star",value:S,output:""});continue}for(;L.slice(0,3)==="/**";){let st=t[_.index+4];if(st&&st!=="/")break;L=L.slice(3),Le("/**",3)}if(D.type==="bos"&&pe()){b.type="globstar",b.value+=S,b.output=k(r),_.output=b.output,_.globstar=!0,Le(S);continue}if(D.type==="slash"&&D.prev.type!=="bos"&&!Ie&&pe()){_.output=_.output.slice(0,-(D.output+b.output).length),D.output=`(?:${D.output}`,b.type="globstar",b.output=k(r)+(r.strictSlashes?")":"|$)"),b.value+=S,_.globstar=!0,_.output+=D.output+b.output,Le(S);continue}if(D.type==="slash"&&D.prev.type!=="bos"&&L[0]==="/"){let st=L[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(D.output+b.output).length),D.output=`(?:${D.output}`,b.type="globstar",b.output=`${k(r)}${f}|${f}${st})`,b.value+=S,_.output+=D.output+b.output,_.globstar=!0,Le(S+Se()),X({type:"slash",value:"/",output:""});continue}if(D.type==="bos"&&L[0]==="/"){b.type="globstar",b.value+=S,b.output=`(?:^|${f}|${k(r)}${f})`,_.output=b.output,_.globstar=!0,Le(S+Se()),X({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-b.output.length),b.type="globstar",b.output=k(r),b.value+=S,_.output+=b.output,_.globstar=!0,Le(S);continue}let se={type:"star",value:S,output:Z};if(r.bash===!0){se.output=".*?",(b.type==="bos"||b.type==="slash")&&(se.output=A+se.output),X(se);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&r.regex===!0){se.output=S,X(se);continue}(_.index===_.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(_.output+=C,b.output+=C):r.dot===!0?(_.output+=O,b.output+=O):(_.output+=A,b.output+=A),K()!=="*"&&(_.output+=h,b.output+=h)),X(se)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(gp("closing","]"));_.output=Ir.escapeLast(_.output,"["),xe("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(gp("closing",")"));_.output=Ir.escapeLast(_.output,"("),xe("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(gp("closing","}"));_.output=Ir.escapeLast(_.output,"{"),xe("braces")}if(r.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&X({type:"maybe_slash",value:"",output:`${f}?`}),_.backtrack===!0){_.output="";for(let L of _.tokens)_.output+=L.output!=null?L.output:L.value,L.suffix&&(_.output+=L.suffix)}return _};hE.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(fw,r.maxLength):fw,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=EH[t]||t;let o=Ir.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:h}=Mh.globChars(o),m=r.dot?p:l,x=r.dot?d:l,C=r.capture?"":"?:",O={negated:!1,prefix:""},y=r.bash===!0?".*?":f;r.capture&&(y=`(${y})`);let T=A=>A.noglobstar===!0?y:`(${C}(?:(?!${h}${A.dot?u:s}).)*?)`,E=A=>{switch(A){case"*":return`${m}${c}${y}`;case".*":return`${s}${c}${y}`;case"*.*":return`${m}${y}${s}${c}${y}`;case"*/*":return`${m}${y}${a}${c}${x}${y}`;case"**":return m+T(r);case"**/*":return`(?:${m}${T(r)}${a})?${x}${c}${y}`;case"**/*.*":return`(?:${m}${T(r)}${a})?${x}${y}${s}${c}${y}`;case"**/.*":return`(?:${m}${T(r)}${a})?${s}${c}${y}`;default:{let W=/^(.*?)\.(\w+)$/.exec(A);if(!W)return;let Z=E(W[1]);return Z?Z+s+W[2]:void 0}}},M=Ir.removePrefix(t,O),k=E(M);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};AH.exports=hE});var LH=P((uke,OH)=>{"use strict";var Hse=require("path"),qse=PH(),mE=DH(),gE=dw(),$se=Lh(),Vse=t=>t&&typeof t=="object"&&!Array.isArray(t),Pt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Pt(d,e,r));return d=>{for(let f of l){let h=f(d);if(h)return h}return!1}}let n=Vse(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=gE.isWindows(e),s=n?Pt.compileRe(t,e):Pt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};c=Pt(i.ignore,l,r)}let u=(l,p=!1)=>{let{isMatch:d,match:f,output:h}=Pt.test(l,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:l,output:h,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(m),d===!1?(m.isMatch=!1,p?m:!1):c(l)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,p?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),p?m:!0)};return r&&(u.state=a),u};Pt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?gE.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Pt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Pt.matchBase=(t,e,r,n=gE.isWindows(r))=>(e instanceof RegExp?e:Pt.makeRe(e,r)).test(Hse.basename(t));Pt.isMatch=(t,e,r)=>Pt(e,r)(t);Pt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Pt.parse(r,e)):mE(t,{...e,fastpaths:!1});Pt.scan=(t,e)=>qse(t,e);Pt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Pt.toRegex(a,e);return n===!0&&(c.state=t),c};Pt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=mE.fastpaths(t,e)),i.output||(i=mE(t,e)),Pt.compileRe(i,e,r,n)};Pt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Pt.constants=$se;OH.exports=Pt});var MH=P((lke,NH)=>{"use strict";NH.exports=LH()});var yE=P((pke,BH)=>{BH.exports=function(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return"/";var r=t.length;if(r<=1)return t;var n="";if(r>4&&t[3]==="\\"){var i=t[2];(i==="?"||i===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),n="//")}var o=t.split(/[/\\]+/);return e!==!1&&o[o.length-1]===""&&o.pop(),n+o.join("/")}});var qH=P((WH,HH)=>{"use strict";Object.defineProperty(WH,"__esModule",{value:!0});var jH=MH(),Gse=yE(),FH="!",zse={returnIndex:!1},Kse=t=>Array.isArray(t)?t:[t],Jse=(t,e)=>{if(typeof t=="function")return t;if(typeof t=="string"){let r=jH(t,e);return n=>t===n||r(n)}return t instanceof RegExp?r=>t.test(r):r=>!1},UH=(t,e,r,n)=>{let i=Array.isArray(r),o=i?r[0]:r;if(!i&&typeof o!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(o));let s=Gse(o,!1);for(let c=0;c<e.length;c++){let u=e[c];if(u(s))return n?-1:!1}let a=i&&[s].concat(r.slice(1));for(let c=0;c<t.length;c++){let u=t[c];if(i?u(...a):u(s))return n?c:!0}return n?-1:!1},bE=(t,e,r=zse)=>{if(t==null)throw new TypeError("anymatch: specify first argument");let n=typeof r=="boolean"?{returnIndex:r}:r,i=n.returnIndex||!1,o=Kse(t),s=o.filter(c=>typeof c=="string"&&c.charAt(0)===FH).map(c=>c.slice(1)).map(c=>jH(c,n)),a=o.filter(c=>typeof c!="string"||typeof c=="string"&&c.charAt(0)!==FH).map(c=>Jse(c,n));return e==null?(c,u=!1)=>UH(a,s,c,typeof u=="boolean"?u:!1):UH(a,s,e,i)};bE.default=bE;HH.exports=bE});var VH=P((dke,$H)=>{$H.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var zH=P((fke,GH)=>{GH.exports=typeof process<"u"&&typeof process.nextTick=="function"?process.nextTick.bind(process):VH()});var JH=P((mke,KH)=>{KH.exports=class{constructor(e){if(!(e>0)||(e-1&e)!==0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return this.buffer[this.btm]===void 0}}});var QH=P((yke,YH)=>{var XH=JH();YH.exports=class{constructor(e){this.hwm=e||16,this.head=new XH(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(e){if(this.length++,!this.head.push(e)){let r=this.head;this.head=r.next=new XH(2*this.head.buffer.length),this.head.push(e)}}shift(){this.length!==0&&this.length--;let e=this.tail.shift();if(e===void 0&&this.tail.next){let r=this.tail.next;return this.tail.next=null,this.tail=r,this.tail.shift()}return e}peek(){let e=this.tail.peek();return e===void 0&&this.tail.next?this.tail.next.peek():e}isEmpty(){return this.length===0}}});var Sq=P((bke,wq)=>{var{EventEmitter:Xse}=require("events"),vw=new Error("Stream was destroyed"),vE=new Error("Premature close"),nq=zH(),iq=QH(),Ot=(1<<27)-1,Xc=1,TE=2,zc=4,Bh=8,oq=Ot^Xc,Yse=Ot^TE,$h=16,Fh=32,Sp=64,pa=128,Uh=256,PE=512,Kc=1024,wE=2048,EE=4096,kE=8192,fi=16384,yp=32768,ww=65536,sq=Uh|PE,Qse=$h|ww,Zse=Sp|$h,eae=EE|pa,tae=Ot^$h,rae=Ot^Sp,nae=Ot^(Sp|ww),iae=Ot^ww,oae=Ot^Uh,sae=Ot^(pa|kE),aae=Ot^Kc,ZH=Ot^sq,aq=Ot^yp,cae=Ot^Fh,da=1<<17,vp=2<<17,Vh=4<<17,Jc=8<<17,Gh=16<<17,Yc=32<<17,SE=64<<17,bp=128<<17,RE=256<<17,wp=512<<17,cq=Ot^(da|RE),uq=Ot^Vh,uae=Ot^wp,lae=Ot^Gh,pae=Ot^Jc,lq=Ot^bp,dae=Ot^vp,jh=$h|da,pq=Ot^jh,AE=fi|Yc,ns=zc|Bh|TE,yn=ns|Xc,dq=ns|AE,fae=uq&rae,DE=bp|yp,hae=DE&pq,fq=yn|hae,mae=yn|Kc|fi,eq=yn|fi|pa,gae=yn|Kc|pa,yae=yn|EE|pa|kE,bae=yn|$h|Kc|fi|ww,vae=ns|Kc|fi,wae=Fh|yn|yp|Sp,Sae=yn|wp|Yc,_ae=Jc|Gh,hq=Jc|da,xae=Jc|Gh|yn|da,tq=yn|da|Jc,Iae=Vh|da,Cae=da|RE,Tae=yn|wp|hq|Yc,Pae=Gh|ns|wp|Yc,Eae=vp|yn|bp|Vh,hw=Symbol.asyncIterator||Symbol("asyncIterator"),mw=class{constructor(e,{highWaterMark:r=16384,map:n=null,mapWritable:i,byteLength:o,byteLengthWritable:s}={}){this.stream=e,this.queue=new iq,this.highWaterMark=r,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||o||vq,this.map=i||n,this.afterWrite=Aae.bind(this),this.afterUpdateNextTick=Lae.bind(this)}get ended(){return(this.stream._duplexState&Yc)!==0}push(e){return this.map!==null&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered<this.highWaterMark?(this.stream._duplexState|=Jc,!0):(this.stream._duplexState|=_ae,!1)}shift(){let e=this.queue.shift();return this.buffered-=this.byteLength(e),this.buffered===0&&(this.stream._duplexState&=pae),e}end(e){typeof e=="function"?this.stream.once("finish",e):e!=null&&this.push(e),this.stream._duplexState=(this.stream._duplexState|wp)&uq}autoBatch(e,r){let n=[],i=this.stream;for(n.push(e);(i._duplexState&tq)===hq;)n.push(i._writableState.shift());if((i._duplexState&yn)!==0)return r(null);i._writev(n,r)}update(){let e=this.stream;e._duplexState|=vp;do{for(;(e._duplexState&tq)===Jc;){let r=this.shift();e._duplexState|=Cae,e._write(r,this.afterWrite)}(e._duplexState&Iae)===0&&this.updateNonPrimary()}while(this.continueUpdate()===!0);e._duplexState&=dae}updateNonPrimary(){let e=this.stream;if((e._duplexState&Tae)===wp){e._duplexState=(e._duplexState|da)&uae,e._final(Rae.bind(this));return}if((e._duplexState&ns)===zc){(e._duplexState&DE)===0&&(e._duplexState|=jh,e._destroy(mq.bind(this)));return}(e._duplexState&fq)===Xc&&(e._duplexState=(e._duplexState|jh)&oq,e._open(gq.bind(this)))}continueUpdate(){return(this.stream._duplexState&bp)===0?!1:(this.stream._duplexState&=lq,!0)}updateCallback(){(this.stream._duplexState&Eae)===Vh?this.update():this.updateNextTick()}updateNextTick(){(this.stream._duplexState&bp)===0&&(this.stream._duplexState|=bp,(this.stream._duplexState&vp)===0&&nq(this.afterUpdateNextTick))}},_E=class{constructor(e,{highWaterMark:r=16384,map:n=null,mapReadable:i,byteLength:o,byteLengthReadable:s}={}){this.stream=e,this.queue=new iq,this.highWaterMark=r,this.buffered=0,this.error=null,this.pipeline=null,this.byteLength=s||o||vq,this.map=i||n,this.pipeTo=null,this.afterRead=Dae.bind(this),this.afterUpdateNextTick=Oae.bind(this)}get ended(){return(this.stream._duplexState&fi)!==0}pipe(e,r){if(this.pipeTo!==null)throw new Error("Can only pipe to one destination");if(typeof r!="function"&&(r=null),this.stream._duplexState|=PE,this.pipeTo=e,this.pipeline=new IE(this.stream,e,r),r&&this.stream.on("error",rq),qh(e))e._writableState.pipeline=this.pipeline,r&&e.on("error",rq),e.on("finish",this.pipeline.finished.bind(this.pipeline));else{let n=this.pipeline.done.bind(this.pipeline,e),i=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",n),e.on("close",i),e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",kae.bind(this)),this.stream.emit("piping",e),e.emit("pipe",this.stream)}push(e){let r=this.stream;return e===null?(this.highWaterMark=0,r._duplexState=(r._duplexState|Kc)&nae,!1):(this.map!==null&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),r._duplexState=(r._duplexState|pa)&iae,this.buffered<this.highWaterMark)}shift(){let e=this.queue.shift();return this.buffered-=this.byteLength(e),this.buffered===0&&(this.stream._duplexState&=sae),e}unshift(e){let r=[this.map!==null?this.map(e):e];for(;this.buffered>0;)r.push(this.shift());for(let n=0;n<r.length-1;n++){let i=r[n];this.buffered+=this.byteLength(i),this.queue.push(i)}this.push(r[r.length-1])}read(){let e=this.stream;if((e._duplexState&eq)===pa){let r=this.shift();return this.pipeTo!==null&&this.pipeTo.write(r)===!1&&(e._duplexState&=ZH),(e._duplexState&wE)!==0&&e.emit("data",r),r}return null}drain(){let e=this.stream;for(;(e._duplexState&eq)===pa&&(e._duplexState&sq)!==0;){let r=this.shift();this.pipeTo!==null&&this.pipeTo.write(r)===!1&&(e._duplexState&=ZH),(e._duplexState&wE)!==0&&e.emit("data",r)}}update(){let e=this.stream;e._duplexState|=Fh;do{for(this.drain();this.buffered<this.highWaterMark&&(e._duplexState&bae)===0;)e._duplexState|=Qse,e._read(this.afterRead),this.drain();(e._duplexState&yae)===eae&&(e._duplexState|=kE,e.emit("readable")),(e._duplexState&Zse)===0&&this.updateNonPrimary()}while(this.continueUpdate()===!0);e._duplexState&=cae}updateNonPrimary(){let e=this.stream;if((e._duplexState&gae)===Kc&&(e._duplexState=(e._duplexState|fi)&aae,e.emit("end"),(e._duplexState&dq)===AE&&(e._duplexState|=zc),this.pipeTo!==null&&this.pipeTo.end()),(e._duplexState&ns)===zc){(e._duplexState&DE)===0&&(e._duplexState|=jh,e._destroy(mq.bind(this)));return}(e._duplexState&fq)===Xc&&(e._duplexState=(e._duplexState|jh)&oq,e._open(gq.bind(this)))}continueUpdate(){return(this.stream._duplexState&yp)===0?!1:(this.stream._duplexState&=aq,!0)}updateCallback(){(this.stream._duplexState&wae)===Sp?this.update():this.updateNextTick()}updateNextTick(){(this.stream._duplexState&yp)===0&&(this.stream._duplexState|=yp,(this.stream._duplexState&Fh)===0&&nq(this.afterUpdateNextTick))}},xE=class{constructor(e){this.data=null,this.afterTransform=Mae.bind(e),this.afterFinal=null}},IE=class{constructor(e,r,n){this.from=e,this.to=r,this.afterPipe=n,this.error=null,this.pipeToFinished=!1}finished(){this.pipeToFinished=!0}done(e,r){if(r&&(this.error=r),e===this.to&&(this.to=null,this.from!==null)){((this.from._duplexState&fi)===0||!this.pipeToFinished)&&this.from.destroy(this.error||new Error("Writable stream closed prematurely"));return}if(e===this.from&&(this.from=null,this.to!==null)){(e._duplexState&fi)===0&&this.to.destroy(this.error||new Error("Readable stream closed before ending"));return}this.afterPipe!==null&&this.afterPipe(this.error),this.to=this.from=this.afterPipe=null}};function kae(){this.stream._duplexState|=PE,this.updateCallback()}function Rae(t){let e=this.stream;t&&e.destroy(t),(e._duplexState&ns)===0&&(e._duplexState|=Yc,e.emit("finish")),(e._duplexState&dq)===AE&&(e._duplexState|=zc),e._duplexState&=cq,(e._duplexState&vp)===0?this.update():this.updateNextTick()}function mq(t){let e=this.stream;!t&&this.error!==vw&&(t=this.error),t&&e.emit("error",t),e._duplexState|=Bh,e.emit("close");let r=e._readableState,n=e._writableState;if(r!==null&&r.pipeline!==null&&r.pipeline.done(e,t),n!==null){for(;n.drains!==null&&n.drains.length>0;)n.drains.shift().resolve(!1);n.pipeline!==null&&n.pipeline.done(e,t)}}function Aae(t){let e=this.stream;t&&e.destroy(t),e._duplexState&=cq,this.drains!==null&&Nae(this.drains),(e._duplexState&xae)===Gh&&(e._duplexState&=lae,(e._duplexState&SE)===SE&&e.emit("drain")),this.updateCallback()}function Dae(t){t&&this.stream.destroy(t),this.stream._duplexState&=tae,this.updateCallback()}function Oae(){(this.stream._duplexState&Fh)===0&&(this.stream._duplexState&=aq,this.update())}function Lae(){(this.stream._duplexState&vp)===0&&(this.stream._duplexState&=lq,this.update())}function Nae(t){for(let e=0;e<t.length;e++)--t[e].writes===0&&(t.shift().resolve(!0),e--)}function gq(t){let e=this.stream;t&&e.destroy(t),(e._duplexState&zc)===0&&((e._duplexState&mae)===0&&(e._duplexState|=Sp),(e._duplexState&Sae)===0&&(e._duplexState|=Vh),e.emit("open")),e._duplexState&=pq,e._writableState!==null&&e._writableState.updateCallback(),e._readableState!==null&&e._readableState.updateCallback()}function Mae(t,e){e!=null&&this.push(e),this._writableState.afterWrite(t)}function Bae(t){this._readableState!==null&&(t==="data"&&(this._duplexState|=wE|Uh,this._readableState.updateNextTick()),t==="readable"&&(this._duplexState|=EE,this._readableState.updateNextTick())),this._writableState!==null&&t==="drain"&&(this._duplexState|=SE,this._writableState.updateNextTick())}var Wh=class extends Xse{constructor(e){super(),this._duplexState=0,this._readableState=null,this._writableState=null,e&&(e.open&&(this._open=e.open),e.destroy&&(this._destroy=e.destroy),e.predestroy&&(this._predestroy=e.predestroy),e.signal&&e.signal.addEventListener("abort",qae.bind(this))),this.on("newListener",Bae)}_open(e){e(null)}_destroy(e){e(null)}_predestroy(){}get readable(){return this._readableState!==null?!0:void 0}get writable(){return this._writableState!==null?!0:void 0}get destroyed(){return(this._duplexState&Bh)!==0}get destroying(){return(this._duplexState&ns)!==0}destroy(e){(this._duplexState&ns)===0&&(e||(e=vw),this._duplexState=(this._duplexState|zc)&fae,this._readableState!==null&&(this._readableState.highWaterMark=0,this._readableState.error=e),this._writableState!==null&&(this._writableState.highWaterMark=0,this._writableState.error=e),this._duplexState|=TE,this._predestroy(),this._duplexState&=Yse,this._readableState!==null&&this._readableState.updateNextTick(),this._writableState!==null&&this._writableState.updateNextTick())}},gw=class t extends Wh{constructor(e){super(e),this._duplexState|=Xc|Yc,this._readableState=new _E(this,e),e&&(e.read&&(this._read=e.read),e.eagerOpen&&this._readableState.updateNextTick())}_read(e){e(null)}pipe(e,r){return this._readableState.updateNextTick(),this._readableState.pipe(e,r),e}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(e){return this._readableState.updateNextTick(),this._readableState.push(e)}unshift(e){return this._readableState.updateNextTick(),this._readableState.unshift(e)}resume(){return this._duplexState|=Uh,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=oae,this}static _fromAsyncIterator(e,r){let n,i=new t({...r,read(s){e.next().then(o).then(s.bind(null,null)).catch(s)},predestroy(){n=e.return()},destroy(s){if(!n)return s(null);n.then(s.bind(null,null)).catch(s)}});return i;function o(s){s.done?i.push(null):i.push(s.value)}}static from(e,r){if(Wae(e))return e;if(e[hw])return this._fromAsyncIterator(e[hw](),r);Array.isArray(e)||(e=e===void 0?[]:[e]);let n=0;return new t({...r,read(i){this.push(n===e.length?null:e[n++]),i(null)}})}static isBackpressured(e){return(e._duplexState&vae)!==0||e._readableState.buffered>=e._readableState.highWaterMark}static isPaused(e){return(e._duplexState&Uh)===0}[hw](){let e=this,r=null,n=null,i=null;return this.on("error",u=>{r=u}),this.on("readable",o),this.on("close",s),{[hw](){return this},next(){return new Promise(function(u,l){n=u,i=l;let p=e.read();p!==null?a(p):(e._duplexState&Bh)!==0&&a(null)})},return(){return c(null)},throw(u){return c(u)}};function o(){n!==null&&a(e.read())}function s(){n!==null&&a(null)}function a(u){i!==null&&(r?i(r):u===null&&(e._duplexState&fi)===0?i(vw):n({value:u,done:u===null}),i=n=null)}function c(u){return e.destroy(u),new Promise((l,p)=>{if(e._duplexState&Bh)return l({value:void 0,done:!0});e.once("close",function(){u?p(u):l({value:void 0,done:!0})})})}}},yw=class extends Wh{constructor(e){super(e),this._duplexState|=Xc|fi,this._writableState=new mw(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final),e.eagerOpen&&this._writableState.updateNextTick())}_writev(e,r){r(null)}_write(e,r){this._writableState.autoBatch(e,r)}_final(e){e(null)}static isBackpressured(e){return(e._duplexState&Pae)!==0}static drained(e){if(e.destroyed)return Promise.resolve(!1);let r=e._writableState,i=($ae(e)?Math.min(1,r.queue.length):r.queue.length)+(e._duplexState&RE?1:0);return i===0?Promise.resolve(!0):(r.drains===null&&(r.drains=[]),new Promise(o=>{r.drains.push({writes:i,resolve:o})}))}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}},Hh=class extends gw{constructor(e){super(e),this._duplexState=Xc,this._writableState=new mw(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final))}_writev(e,r){r(null)}_write(e,r){this._writableState.autoBatch(e,r)}_final(e){e(null)}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}},bw=class extends Hh{constructor(e){super(e),this._transformState=new xE(this),e&&(e.transform&&(this._transform=e.transform),e.flush&&(this._flush=e.flush))}_write(e,r){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=e:this._transform(e,this._transformState.afterTransform)}_read(e){if(this._transformState.data!==null){let r=this._transformState.data;this._transformState.data=null,e(null),this._transform(r,this._transformState.afterTransform)}else e(null)}destroy(e){super.destroy(e),this._transformState.data!==null&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(e,r){r(null,e)}_flush(e){e(null)}_final(e){this._transformState.afterFinal=e,this._flush(Fae.bind(this))}},CE=class extends bw{};function Fae(t,e){let r=this._transformState.afterFinal;if(t)return r(t);e!=null&&this.push(e),this.push(null),r(null)}function Uae(...t){return new Promise((e,r)=>yq(...t,n=>{if(n)return r(n);e()}))}function yq(t,...e){let r=Array.isArray(t)?[...t,...e]:[t,...e],n=r.length&&typeof r[r.length-1]=="function"?r.pop():null;if(r.length<2)throw new Error("Pipeline requires at least 2 streams");let i=r[0],o=null,s=null;for(let u=1;u<r.length;u++)o=r[u],qh(i)?i.pipe(o,c):(a(i,!0,u>1,c),i.pipe(o)),i=o;if(n){let u=!1,l=qh(o)||!!(o._writableState&&o._writableState.autoDestroy);o.on("error",p=>{s===null&&(s=p)}),o.on("finish",()=>{u=!0,l||n(s)}),l&&o.on("close",()=>n(s||(u?null:vE)))}return o;function a(u,l,p,d){u.on("error",d),u.on("close",f);function f(){if(l&&u._readableState&&!u._readableState.ended||p&&u._writableState&&!u._writableState.ended)return d(vE)}}function c(u){if(!(!u||s)){s=u;for(let l of r)l.destroy(u)}}}function bq(t){return!!t._readableState||!!t._writableState}function qh(t){return typeof t._duplexState=="number"&&bq(t)}function jae(t){let e=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e===vw?null:e}function Wae(t){return qh(t)&&t.readable}function Hae(t){return typeof t=="object"&&t!==null&&typeof t.byteLength=="number"}function vq(t){return Hae(t)?t.byteLength:1024}function rq(){}function qae(){this.destroy(new Error("Stream aborted."))}function $ae(t){return t._writev!==yw.prototype._writev&&t._writev!==Hh.prototype._writev}wq.exports={pipeline:yq,pipelinePromise:Uae,isStream:bq,isStreamx:qh,getStreamError:jae,Stream:Wh,Writable:yw,Readable:gw,Duplex:Hh,Transform:bw,PassThrough:CE}});var xq=P((vke,_q)=>{_q.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var OE=P((wke,Cq)=>{var Vae=xq(),Iq={"{":"}","(":")","[":"]"},Gae=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=Iq[a];if(c){var u=t.indexOf(c,e);u!==-1&&(e=u+1)}if(t[e]==="!")return!0}else e++}return!1},zae=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=Iq[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Cq.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(Vae(e))return!0;var n=Gae;return r&&r.strict===!1&&(n=zae),n(e)}});var Pq=P((Ske,Tq)=>{"use strict";var Kae=OE(),Jae=require("path").posix.dirname,Xae=require("os").platform()==="win32",Sw="/",Yae=/\\/g,Qae=/\\([!*?|[\](){}])/g;Tq.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&Xae&&e.indexOf(Sw)<0&&(e=e.replace(Yae,Sw)),Zae(e)&&(e+=Sw),e+="a";do e=Jae(e);while(ece(e));return e.replace(Qae,"$1")};function Zae(t){var e=t.slice(-1),r;switch(e){case"}":r="{";break;case"]":r="[";break;default:return!1}var n=t.indexOf(r);return n<0?!1:t.slice(n+1,-1).includes(Sw)}function ece(t){return/\([^()]+$/.test(t)||t[0]==="{"||t[0]==="["||/[^\\][{[]/.test(t)?!0:Kae(t)}});var _w=P((_ke,Eq)=>{"use strict";Eq.exports=function(t){if(typeof t!="string")throw new TypeError("expected a string");var e={negated:!1,pattern:t,original:t};return t.charAt(0)==="!"&&t.charAt(1)!=="("&&(e.negated=!0,e.pattern=t.slice(1)),e}});var Oq=P((xke,Dq)=>{"use strict";var xw=require("path"),tce=_w();Dq.exports=function(t,e){var r=e||{},n=Rq(r.cwd?r.cwd:process.cwd());n=xw.resolve(n),n=LE(n),n=kq(n);var i=r.root;i&&(i=Rq(i),i=LE(i),(process.platform==="win32"||!xw.isAbsolute(i))&&(i=LE(xw.resolve(i))),i=kq(i));var o=t.slice(-1),s=tce(t);return t=s.pattern,t.slice(0,2)==="./"&&(t=t.slice(2)),t.length===1&&t==="."&&(t=""),i&&t.charAt(0)==="/"?t=Aq(i,t):(!xw.isAbsolute(t)||t.slice(0,1)==="\\")&&(t=Aq(n,t)),o==="/"&&t.slice(-1)!=="/"&&(t+="/"),s.negated?"!"+t:t};function kq(t){return t.replace(/([({[\]})*?!])/g,"\\$1")}function Rq(t){return t.replace(/\\([({[\]})*?!])/g,"$1")}function LE(t){return t.replace(/\\/g,"/")}function Aq(t,e){if(t.charAt(t.length-1)==="/"&&(t=t.slice(0,-1)),e.charAt(0)==="/"&&(e=e.slice(1)),!e)return t;for(;e.slice(0,3)==="../";)t=t.slice(0,t.lastIndexOf("/")),e=e.slice(3);return t+"/"+e}});var Mq=P((Ike,Nq)=>{"use strict";var rce=require("fs"),NE=require("path"),nce=require("events"),ice=hH(),oce=qH(),sce=Sq().Readable,ace=OE(),cce=Pq(),Lq=yE(),uce=_w(),lce=Oq(),pce="File not found with singular glob: ",dce=" (if this was purposeful, use `allowEmpty` option)";function fce(t){return ace(t)}function hce(){var t={withFileTypes:!0},e=new nce,r=ice(i,1);r.drain=function(){e.emit("end")},r.error(n);function n(o){o&&e.emit("error",o)}e.pause=function(){r.pause()},e.resume=function(){r.resume()},e.end=function(){r.kill()},e.walk=function(o){r.push(o)};function i(o,s){rce.readdir(o,t,a);function a(u,l){if(u)return s(u);l.forEach(c),s()}function c(u){var l=NE.join(o,u.name);e.emit("path",l,u),u.isDirectory()&&r.push(l)}}return e}function mce(t){var e=!1;t.forEach(r);function r(n,i){if(typeof n!="string")throw new Error("Invalid glob at index "+i);var o=uce(n);o.negated===!1&&(e=!0)}if(e===!1)throw new Error("Missing positive glob")}function gce(t){if(typeof t.cwd!="string")throw new Error("The `cwd` option must be a string");if(typeof t.dot!="boolean")throw new Error("The `dot` option must be a boolean");if(typeof t.cwdbase!="boolean")throw new Error("The `cwdbase` option must be a boolean");if(typeof t.uniqueBy!="string"&&typeof t.uniqueBy!="function")throw new Error("The `uniqueBy` option must be a string or function");if(typeof t.allowEmpty!="boolean")throw new Error("The `allowEmpty` option must be a boolean");if(t.base&&typeof t.base!="string")throw new Error("The `base` option must be a string if specified");if(!Array.isArray(t.ignore))throw new Error("The `ignore` option must be a string or array")}function yce(t){var e=new Set;if(typeof t=="string")return n;return i;function r(o){return e.has(o)?!1:(e.add(o),!0)}function n(o){return r(o[t])}function i(o){return r(t(o))}}function bce(t,e){Array.isArray(t)||(t=[t]),mce(t);var r=Object.assign({},{cwd:process.cwd(),dot:!1,cwdbase:!1,uniqueBy:"path",allowEmpty:!1,ignore:[]},e);r.ignore=typeof r.ignore=="string"?[r.ignore]:r.ignore,gce(r),r.cwd=Lq(NE.resolve(r.cwd),!0);var n=r.base;r.cwdbase&&(n=r.cwd);var i=hce(),o=new sce({highWaterMark:r.highWaterMark,read:l,predestroy:p}),s=t.map(d);r.ignore=r.ignore.map(d);var a=s.map(fce),c=oce(s,null,r),u=yce(r.uniqueBy);i.on("path",f),i.once("end",h),i.once("error",m),i.walk(r.cwd);function l(x){i.resume(),x()}function p(){i.end()}function d(x){return lce(x,r)}function f(x,C){var O=c(x,!0);if(O===-1&&C.isDirectory()&&(O=c(x+NE.sep,!0)),O!==-1){a[O]=!0;var y=n||cce(s[O]),T={cwd:r.cwd,base:y,path:Lq(x,!0)},E=u(T);if(E){var M=o.push(T);M||i.pause()}}}function h(){var x=!1;a.forEach(function(C,O){if(r.allowEmpty!==!0&&!C){x=!0;var y=new Error(pce+s[O]+dce);return o.destroy(y)}}),x===!1&&o.push(null)}function m(x){o.destroy(x)}return o}Nq.exports=bce});var Fq=P((Tke,Bq)=>{"use strict";Bq.exports=function(){return/^[\\\/]{2,}[^\\\/]+[\\\/]+[^\\\/]+/}});var jq=P((Pke,Uq)=>{"use strict";var vce=Fq()();Uq.exports=function(t){if(typeof t!="string")throw new TypeError("expected a string");return vce.test(t)}});var Hq=P((Eke,Wq)=>{"use strict";var wce=jq();Wq.exports=function(e){if(typeof e!="string")throw new TypeError("expected filepath to be a string");return!wce(e)&&!/^([a-z]:)?[\\\/]/i.test(e)}});var qq=P((ME,BE)=>{(function(t){ME&&typeof ME=="object"&&typeof BE<"u"?BE.exports=t():typeof define=="function"&&define.amd?define([],t):typeof window<"u"?window.isWindows=t():typeof global<"u"?global.isWindows=t():typeof self<"u"?self.isWindows=t():this.isWindows=t()})(function(){"use strict";return function(){return process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(process.env.OSTYPE))}})});var Vq=P((kke,$q)=>{"use strict";var Sce=Hq(),_ce=qq();$q.exports=zh;function zh(t){if(typeof t!="string")throw new TypeError("isAbsolute expects a string.");return _ce()?zh.win32(t):zh.posix(t)}zh.posix=function(e){return e.charAt(0)==="/"};zh.win32=function(e){return/[a-z]/i.test(e.charAt(0))&&e.charAt(1)===":"&&e.charAt(2)==="\\"||e.slice(0,2)==="\\\\"?!0:!Sce(e)}});var Qq=P((Rke,Yq)=>{"use strict";var Gq=require("path"),xce=_w(),zq=Vq();Yq.exports=function(t,e){var r=e||{},n=Jq(r.cwd?r.cwd:process.cwd());n=Gq.resolve(n),n=FE(n),n=Kq(n);var i=r.root;i&&(i=Jq(i),i=FE(i),(process.platform==="win32"||!zq(i))&&(i=FE(Gq.resolve(i))),i=Kq(i)),t.slice(0,2)==="./"&&(t=t.slice(2)),t.length===1&&t==="."&&(t="");var o=t.slice(-1),s=xce(t);return t=s.pattern,i&&t.charAt(0)==="/"?t=Xq(i,t):(!zq(t)||t.slice(0,1)==="\\")&&(t=Xq(n,t)),o==="/"&&t.slice(-1)!=="/"&&(t+="/"),s.negated?"!"+t:t};function Kq(t){return t.replace(/([({[\]})*?!])/g,"\\$1")}function Jq(t){return t.replace(/\\([({[\]})*?!])/g,"$1")}function FE(t){return t.replace(/\\/g,"/")}function Xq(t,e){return t.charAt(t.length-1)==="/"&&(t=t.slice(0,-1)),e.charAt(0)==="/"&&(e=e.slice(1)),e?t+"/"+e:t}});var R$=P((n1e,k$)=>{try{k$.exports=require("./win32-app-container-tokens.win32-arm64-msvc-4ZJZ3U55.node")}catch{}});var D$=P((i1e,A$)=>{try{A$.exports=require("./win32-app-container-tokens.win32-x64-msvc-VCQE7GJP.node")}catch{}});var J$=P((nLe,Wce)=>{Wce.exports={name:"dotenv",version:"16.4.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Q$=P((iLe,cs)=>{var Kw=require("fs"),QE=require("path"),Hce=require("os"),qce=require("crypto"),$ce=J$(),ZE=$ce.version,Vce=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Gce(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
`);let n;for(;(n=Vce.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
`),o=o.replace(/\\r/g,"\r")),e[i]=o}return e}function zce(t){let e=Y$(t),r=Qt.configDotenv({path:e});if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=X$(t).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),c=Xce(r,a);o=Qt.decrypt(c.ciphertext,c.key);break}catch(a){if(s+1>=i)throw a}return Qt.parse(o)}function Kce(t){console.log(`[dotenv@${ZE}][INFO] ${t}`)}function Jce(t){console.log(`[dotenv@${ZE}][WARN] ${t}`)}function Jw(t){console.log(`[dotenv@${ZE}][DEBUG] ${t}`)}function X$(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Xce(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=t.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function Y$(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)Kw.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=QE.resolve(process.cwd(),".env.vault");return Kw.existsSync(e)?e:null}function Yce(t){return t[0]==="~"?QE.join(Hce.homedir(),t.slice(1)):t}function Qce(t){Kce("Loading env from encrypted .env.vault");let e=Qt._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),Qt.populate(r,e,t),{parsed:e}}function Zce(t){let e=QE.resolve(process.cwd(),".env"),r="utf8",n=!!(t&&t.debug);if(t){if(t.path!=null){let i=t.path;if(Array.isArray(i)){for(let o of t.path)if(Kw.existsSync(o)){i=o;break}}e=Yce(i)}t.encoding!=null?r=t.encoding:n&&Jw("No encoding is specified. UTF-8 is used by default")}try{let i=Qt.parse(Kw.readFileSync(e,{encoding:r})),o=process.env;return t&&t.processEnv!=null&&(o=t.processEnv),Qt.populate(o,i,t),{parsed:i}}catch(i){return n&&Jw(`Failed to load ${e} ${i.message}`),{error:i}}}function eue(t){if(X$(t).length===0)return Qt.configDotenv(t);let e=Y$(t);return e?Qt._configVault(t):(Jce(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),Qt.configDotenv(t))}function tue(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=qce.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,c=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||c){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(u){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw s}}function rue(t,e,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override);if(typeof e!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(e))Object.prototype.hasOwnProperty.call(t,o)?(i===!0&&(t[o]=e[o]),n&&Jw(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):t[o]=e[o]}var Qt={configDotenv:Zce,_configVault:Qce,_parseVault:zce,config:eue,decrypt:tue,parse:Gce,populate:rue};cs.exports.configDotenv=Qt.configDotenv;cs.exports._configVault=Qt._configVault;cs.exports._parseVault=Qt._parseVault;cs.exports.config=Qt.config;cs.exports.decrypt=Qt.decrypt;cs.exports.parse=Qt.parse;cs.exports.populate=Qt.populate;cs.exports=Qt});var l0=P(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.TargetPopulation=ka.Filters=ka.VSCodeFilterProvider=void 0;var yS=require("vscode"),u0=class t{constructor(e,r,n){this.extensionName=e,this.extensionVersion=r,this.targetPopulation=n}static trimVersionSuffix(e){let r=/\-[a-zA-Z0-9]+$/;return e.split(r)[0]}getFilterValue(e){switch(e){case _o.ApplicationVersion:return t.trimVersionSuffix(yS.version);case _o.Build:return yS.env.appName;case _o.ClientId:return yS.env.machineId;case _o.ExtensionName:return this.extensionName;case _o.ExtensionVersion:return t.trimVersionSuffix(this.extensionVersion);case _o.Language:return yS.env.language;case _o.TargetPopulation:return this.targetPopulation;default:return""}}getFilters(){let e=new Map,r=Object.values(_o);for(let n of r)e.set(n,this.getFilterValue(n));return e}};ka.VSCodeFilterProvider=u0;var _o;(function(t){t.Market="X-MSEdge-Market",t.CorpNet="X-FD-Corpnet",t.ApplicationVersion="X-VSCode-AppVersion",t.Build="X-VSCode-Build",t.ClientId="X-MSEdge-ClientId",t.ExtensionName="X-VSCode-ExtensionName",t.ExtensionVersion="X-VSCode-ExtensionVersion",t.Language="X-VSCode-Language",t.TargetPopulation="X-VSCode-TargetPopulation"})(_o||(ka.Filters=_o={}));var NV;(function(t){t.Team="team",t.Internal="internal",t.Insiders="insider",t.Public="public"})(NV||(ka.TargetPopulation=NV={}))});var MV=P(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});bS.BaseFeatureProvider=void 0;var p0=class{constructor(e){this.telemetry=e,this.isFetching=!1}async getFeatures(){if(this.isFetching&&this.fetchPromise)return this.fetchPromise;this.fetchPromise=this.fetch();let e=await this.fetchPromise;return this.isFetching=!1,this.fetchPromise=void 0,e}};bS.BaseFeatureProvider=p0});var BV=P(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.FilteredFeatureProvider=void 0;var wue=MV(),d0=class extends wue.BaseFeatureProvider{constructor(e,r){super(e),this.telemetry=e,this.filterProviders=r,this.cachedTelemetryEvents=[]}getFilters(){let e=new Map;for(let r of this.filterProviders){let n=r.getFilters();for(let i of n.keys()){let o=n.get(i);e.set(i,o)}}return e}PostEventToTelemetry(e){if(this.cachedTelemetryEvents.includes(e))return;let r=JSON.stringify(e);this.telemetry.postEvent("report-headers",new Map([["ABExp.headers",r]])),this.cachedTelemetryEvents.push(e)}};vS.FilteredFeatureProvider=d0});var FV=P(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});Ra.TasApiFeatureProvider=Ra.TASAPI_FETCHERROR_EVENTNAME=void 0;var Sue=BV();Ra.TASAPI_FETCHERROR_EVENTNAME="call-tas-error";var f0="ErrorType",h0=class extends Sue.FilteredFeatureProvider{constructor(e,r,n){super(r,n),this.httpClient=e,this.telemetry=r,this.filterProviders=n}async fetch(){let e=this.getFilters(),r={};for(let a of e.keys()){let c=e.get(a);r[a]=c}let n;try{n=await this.httpClient.get({headers:r})}catch(a){let c=a,u=new Map;c.responseReceived&&!c.responseOk?u.set(f0,"ServerError"):c.responseReceived===!1?u.set(f0,"NoResponse"):u.set(f0,"GenericError"),this.telemetry.postEvent(Ra.TASAPI_FETCHERROR_EVENTNAME,u)}if(!n)throw Error(Ra.TASAPI_FETCHERROR_EVENTNAME);e.keys.length>0&&this.PostEventToTelemetry(r);let i=n.data,o=i.Configs,s=[];for(let a of o)if(a.Parameters)for(let c of Object.keys(a.Parameters)){let u=c+(a.Parameters[c]?"":"cf");s.includes(u)||s.push(u)}return{features:s,assignmentContext:i.AssignmentContext,configs:o}}};Ra.TasApiFeatureProvider=h0});var UV=P(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.HttpClient=td.FetchError=void 0;var ed=class extends Error{constructor(e,r,n){super(e),this.responseReceived=r,this.responseOk=n}};td.FetchError=ed;var m0=class{constructor(e){this.endpoint=e}async get(e){let r=await fetch(this.endpoint,{method:"GET",headers:e?.headers});if(!r)throw new ed("No response received",!1);if(!r.ok)throw new ed("Response not ok",!0,!1);let n=await r.json();if(!n)throw new ed("No data received",!1);return{data:n}}};td.HttpClient=m0});var jV=P(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});wS.MemoryKeyValueStorage=void 0;var g0=class{constructor(){this.storage=new Map}async getValue(e,r){return this.storage.has(e)?await Promise.resolve(this.storage.get(e)):await Promise.resolve(r||void 0)}setValue(e,r){this.storage.set(e,r)}};wS.MemoryKeyValueStorage=g0});var WV=P(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});SS.ExperimentationServiceBase=void 0;var _ue=jV(),y0=class{get features(){return this._features}set features(e){this._features=e,this.telemetry&&this.telemetry.setSharedProperty(this.assignmentContextTelemetryPropertyName,this.features.assignmentContext)}constructor(e,r,n,i,o){this.telemetry=e,this.assignmentContextTelemetryPropertyName=r,this.telemetryEventName=n,this.storageKey=i,this.storage=o,this.featuresConsumed=!1,this.cachedTelemetryEvents=[],this._features={features:[],assignmentContext:"",configs:[]},this.storageKey||(this.storageKey="ABExp.Features"),this.storage||(o=new _ue.MemoryKeyValueStorage),this.loadCachePromise=this.loadCachedFeatureData(),this.initializePromise=this.loadCachePromise,this.initialFetch=new Promise((s,a)=>{this.resolveInitialFetchPromise=s})}async getFeaturesAsync(e=!1){if(this.fetchPromise!=null){try{await this.fetchPromise}catch{}return this.features}if(!this.featureProviders||this.featureProviders.length===0)return Promise.resolve({features:[],assignmentContext:"",configs:[]});try{this.fetchPromise=Promise.all(this.featureProviders.map(async n=>await n.getFeatures()));let r=await this.fetchPromise;this.updateFeatures(r,e)}catch{}return this.fetchPromise=void 0,this.resolveInitialFetchPromise&&(this.resolveInitialFetchPromise(),this.resolveInitialFetchPromise=void 0),this.features}updateFeatures(e,r=!1){let n={features:[],assignmentContext:"",configs:[]};for(let i of e){for(let o of i.features)n.features.includes(o)||n.features.push(o);for(let o of i.configs){let s=n.configs.find(a=>a.Id===o.Id);s?s.Parameters=Object.assign(Object.assign({},s.Parameters),o.Parameters):n.configs.push(o)}n.assignmentContext+=i.assignmentContext}(r||!this.featuresConsumed)&&(this.features=n),this.storage&&this.storage.setValue(this.storageKey,n)}async loadCachedFeatureData(){let e;this.storage&&(e=await this.storage.getValue(this.storageKey),e!==void 0&&e.configs===void 0&&(e.configs=[])),this.features.features.length===0&&(this.features=e||{features:[],assignmentContext:"",configs:[]})}isFlightEnabled(e){return this.featuresConsumed=!0,this.PostEventToTelemetry(e),this.features.features.includes(e)}async isCachedFlightEnabled(e){return await this.loadCachePromise,this.featuresConsumed=!0,this.PostEventToTelemetry(e),this.features.features.includes(e)}async isFlightEnabledAsync(e){let r=await this.getFeaturesAsync(!0);return this.featuresConsumed=!0,this.PostEventToTelemetry(e),r.features.includes(e)}getTreatmentVariable(e,r){this.featuresConsumed=!0,this.PostEventToTelemetry(`${e}.${r}`);let n=this.features.configs.find(i=>i.Id===e);return n?.Parameters[r]}async getTreatmentVariableAsync(e,r,n){if(n){let i=this.featuresConsumed,o=this.getTreatmentVariable(e,r);if(o===void 0)this.featuresConsumed=i;else return o}return await this.getFeaturesAsync(!0),this.getTreatmentVariable(e,r)}PostEventToTelemetry(e){this.cachedTelemetryEvents.includes(e)||(this.telemetry.postEvent(this.telemetryEventName,new Map([["ABExp.queriedFeature",e]])),this.cachedTelemetryEvents.push(e))}invokeInit(){this.init()}addFeatureProvider(...e){if(!(e==null||this.featureProviders==null))for(let r of e)this.featureProviders.push(r)}};SS.ExperimentationServiceBase=y0});var HV=P(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});_S.PollingService=void 0;var b0=class{constructor(e){this.fetchInterval=e}StopPolling(){clearInterval(this.intervalHandle),this.intervalHandle=void 0}OnPollTick(e){this.onTick=e}StartPolling(e=!1){this.intervalHandle&&this.StopPolling(),this.onTick!=null&&(e&&this.onTick().then(()=>{}).catch(()=>{}),this.intervalHandle=setInterval(async()=>{await this.onTick()},this.fetchInterval),this.intervalHandle.unref&&this.intervalHandle.unref())}};_S.PollingService=b0});var qV=P(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});xS.ExperimentationServiceAutoPolling=void 0;var xue=WV(),Iue=HV(),v0=class extends xue.ExperimentationServiceBase{constructor(e,r,n,i,o,s,a){if(super(e,i,o,s,a),this.telemetry=e,this.filterProviders=r,this.refreshRateMs=n,this.assignmentContextTelemetryPropertyName=i,this.telemetryEventName=o,this.storageKey=s,this.storage=a,n<1e3&&n!==0)throw new Error("The minimum refresh rate for polling is 1000 ms (1 second). If you wish to deactivate this auto-polling use value of 0.");n>0&&(this.pollingService=new Iue.PollingService(n),this.pollingService.OnPollTick(async()=>{await super.getFeaturesAsync()}))}init(){this.pollingService?this.pollingService.StartPolling(!0):super.getFeaturesAsync()}async getFeaturesAsync(e=!1){if(this.pollingService){this.pollingService.StopPolling();let r=await super.getFeaturesAsync(e);return this.pollingService.StartPolling(),r}else return await super.getFeaturesAsync(e)}};xS.ExperimentationServiceAutoPolling=v0});var $V=P(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});CS.ExperimentationService=void 0;var Cue=FV(),Tue=UV(),Pue=qV(),IS=class extends Pue.ExperimentationServiceAutoPolling{constructor(e){super(e.telemetry,e.filterProviders||[],e.refetchInterval!=null?e.refetchInterval:0,e.assignmentContextTelemetryPropertyName,e.telemetryEventName,e.storageKey,e.keyValueStorage),this.options=e,this.invokeInit()}init(){this.featureProviders=[],this.addFeatureProvider(new Cue.TasApiFeatureProvider(new Tue.HttpClient(this.options.endpoint),this.telemetry,this.filterProviders)),super.init()}};CS.ExperimentationService=IS;IS.REFRESH_RATE_IN_MINUTES=30});var VV=P(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0});TS.ExperimentationService=void 0;var Eue=$V();Object.defineProperty(TS,"ExperimentationService",{enumerable:!0,get:function(){return Eue.ExperimentationService}})});var GV=P(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});PS.MementoKeyValueStorage=void 0;var w0=class{constructor(e){this.mementoGlobalStorage=e}async getValue(e,r){return await this.mementoGlobalStorage.get(e)||r}setValue(e,r){this.mementoGlobalStorage.update(e,r)}};PS.MementoKeyValueStorage=w0});var zV=P(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});var S0=class{constructor(){this.initializePromise=Promise.resolve(),this.initialFetch=Promise.resolve()}isFlightEnabled(e){return!1}isCachedFlightEnabled(e){return Promise.resolve(!1)}isFlightEnabledAsync(e){return Promise.resolve(!1)}getTreatmentVariable(e,r){}getTreatmentVariableAsync(e,r){return Promise.resolve(void 0)}};_0.default=S0});var JV=P(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.getExperimentationServiceAsync=rd.getExperimentationService=void 0;var kue=l0(),Rue=VV(),x0=require("vscode"),Aue=GV(),Due=zV(),Oue="https://default.exp-tas.com/vscode/ab",Lue="query-expfeature",Nue="abexp.assignmentcontext",Mue="VSCode.ABExp.FeatureData",Bue=1e3*60*30;function KV(t,e,r,n,i,...o){if(!i)throw new Error("Memento storage was not provided.");let s=x0.workspace.getConfiguration("telemetry");if(!(x0.env.isTelemetryEnabled===void 0?s.get("enableTelemetry",!0):x0.env.isTelemetryEnabled))return new Due.default;let u=[new kue.VSCodeFilterProvider(t,e,r),...o],l=new Aue.MementoKeyValueStorage(i);return new Rue.ExperimentationService({filterProviders:u,telemetry:n,storageKey:Mue,keyValueStorage:l,featuresTelemetryPropertyName:"",assignmentContextTelemetryPropertyName:Nue,telemetryEventName:Lue,endpoint:Oue,refetchInterval:Bue})}rd.getExperimentationService=KV;async function Fue(t,e,r,n,i,...o){let s=KV(t,e,r,n,i,...o);return await s.initializePromise,s}rd.getExperimentationServiceAsync=Fue});var YV=P(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.TargetPopulation=Aa.getExperimentationServiceAsync=Aa.getExperimentationService=void 0;var XV=JV();Object.defineProperty(Aa,"getExperimentationService",{enumerable:!0,get:function(){return XV.getExperimentationService}});Object.defineProperty(Aa,"getExperimentationServiceAsync",{enumerable:!0,get:function(){return XV.getExperimentationServiceAsync}});var Uue=l0();Object.defineProperty(Aa,"TargetPopulation",{enumerable:!0,get:function(){return Uue.TargetPopulation}})});function hu(t,e=!1){let r=t.length,n=0,i="",o=0,s=16,a=0,c=0,u=0,l=0,p=0;function d(y,T){let E=0,M=0;for(;E<y||!T;){let k=t.charCodeAt(n);if(k>=48&&k<=57)M=M*16+k-48;else if(k>=65&&k<=70)M=M*16+k-65+10;else if(k>=97&&k<=102)M=M*16+k-97+10;else break;n++,E++}return E<y&&(M=-1),M}function f(y){n=y,i="",o=0,s=16,p=0}function h(){let y=n;if(t.charCodeAt(n)===48)n++;else for(n++;n<t.length&&kd(t.charCodeAt(n));)n++;if(n<t.length&&t.charCodeAt(n)===46)if(n++,n<t.length&&kd(t.charCodeAt(n)))for(n++;n<t.length&&kd(t.charCodeAt(n));)n++;else return p=3,t.substring(y,n);let T=n;if(n<t.length&&(t.charCodeAt(n)===69||t.charCodeAt(n)===101))if(n++,(n<t.length&&t.charCodeAt(n)===43||t.charCodeAt(n)===45)&&n++,n<t.length&&kd(t.charCodeAt(n))){for(n++;n<t.length&&kd(t.charCodeAt(n));)n++;T=n}else p=3;return t.substring(y,T)}function m(){let y="",T=n;for(;;){if(n>=r){y+=t.substring(T,n),p=2;break}let E=t.charCodeAt(n);if(E===34){y+=t.substring(T,n),n++;break}if(E===92){if(y+=t.substring(T,n),n++,n>=r){p=2;break}switch(t.charCodeAt(n++)){case 34:y+='"';break;case 92:y+="\\";break;case 47:y+="/";break;case 98:y+="\b";break;case 102:y+="\f";break;case 110:y+=`
`;break;case 114:y+="\r";break;case 116:y+="	";break;case 117:let k=d(4,!0);k>=0?y+=String.fromCharCode(k):p=4;break;default:p=5}T=n;continue}if(E>=0&&E<=31)if(hm(E)){y+=t.substring(T,n),p=2;break}else p=6;n++}return y}function x(){if(i="",p=0,o=n,c=a,l=u,n>=r)return o=r,s=17;let y=t.charCodeAt(n);if(U0(y)){do n++,i+=String.fromCharCode(y),y=t.charCodeAt(n);while(U0(y));return s=15}if(hm(y))return n++,i+=String.fromCharCode(y),y===13&&t.charCodeAt(n)===10&&(n++,i+=`
`),a++,u=n,s=14;switch(y){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,i=m(),s=10;case 47:let T=n-1;if(t.charCodeAt(n+1)===47){for(n+=2;n<r&&!hm(t.charCodeAt(n));)n++;return i=t.substring(T,n),s=12}if(t.charCodeAt(n+1)===42){n+=2;let E=r-1,M=!1;for(;n<E;){let k=t.charCodeAt(n);if(k===42&&t.charCodeAt(n+1)===47){n+=2,M=!0;break}n++,hm(k)&&(k===13&&t.charCodeAt(n)===10&&n++,a++,u=n)}return M||(n++,p=1),i=t.substring(T,n),s=13}return i+=String.fromCharCode(y),n++,s=16;case 45:if(i+=String.fromCharCode(y),n++,n===r||!kd(t.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=h(),s=11;default:for(;n<r&&C(y);)n++,y=t.charCodeAt(n);if(o!==n){switch(i=t.substring(o,n),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(y),n++,s=16}}function C(y){if(U0(y)||hm(y))return!1;switch(y){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function O(){let y;do y=x();while(y>=12&&y<=15);return y}return{setPosition:f,getPosition:()=>n,scan:e?O:x,getToken:()=>s,getTokenValue:()=>i,getTokenOffset:()=>o,getTokenLength:()=>n-o,getTokenStartLine:()=>c,getTokenStartCharacter:()=>o-l,getTokenError:()=>p}}function U0(t){return t===32||t===9}function hm(t){return t===10||t===13}function kd(t){return t>=48&&t<=57}var W5,qS=ri(()=>{"use strict";(function(t){t[t.lineFeed=10]="lineFeed",t[t.carriageReturn=13]="carriageReturn",t[t.space=32]="space",t[t._0=48]="_0",t[t._1=49]="_1",t[t._2=50]="_2",t[t._3=51]="_3",t[t._4=52]="_4",t[t._5=53]="_5",t[t._6=54]="_6",t[t._7=55]="_7",t[t._8=56]="_8",t[t._9=57]="_9",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.asterisk=42]="asterisk",t[t.backslash=92]="backslash",t[t.closeBrace=125]="closeBrace",t[t.closeBracket=93]="closeBracket",t[t.colon=58]="colon",t[t.comma=44]="comma",t[t.dot=46]="dot",t[t.doubleQuote=34]="doubleQuote",t[t.minus=45]="minus",t[t.openBrace=123]="openBrace",t[t.openBracket=91]="openBracket",t[t.plus=43]="plus",t[t.slash=47]="slash",t[t.formFeed=12]="formFeed",t[t.tab=9]="tab"})(W5||(W5={}))});var Sn,Rd,j0,H5,q5=ri(()=>{Sn=new Array(20).fill(0).map((t,e)=>" ".repeat(e)),Rd=200,j0={" ":{"\n":new Array(Rd).fill(0).map((t,e)=>`
`+" ".repeat(e)),"\r":new Array(Rd).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(Rd).fill(0).map((t,e)=>`\r
`+" ".repeat(e))},"	":{"\n":new Array(Rd).fill(0).map((t,e)=>`
`+"	".repeat(e)),"\r":new Array(Rd).fill(0).map((t,e)=>"\r"+"	".repeat(e)),"\r\n":new Array(Rd).fill(0).map((t,e)=>`\r
`+"	".repeat(e))}},H5=[`
`,"\r",`\r
`]});function $S(t,e,r){let n,i,o,s,a;if(e){for(s=e.offset,a=s+e.length,o=s;o>0&&!mm(t,o-1);)o--;let E=a;for(;E<t.length&&!mm(t,E);)E++;i=t.substring(o,E),n=dle(i,r)}else i=t,n=0,o=0,s=0,a=t.length;let c=fle(r,t),u=H5.includes(c),l=0,p=0,d;r.insertSpaces?d=Sn[r.tabSize||4]??Ad(Sn[1],r.tabSize||4):d="	";let f=d==="	"?"	":" ",h=hu(i,!1),m=!1;function x(){if(l>1)return Ad(c,l)+Ad(d,n+p);let E=d.length*(n+p);return!u||E>j0[f][c].length?c+Ad(d,n+p):E<=0?c:j0[f][c][E]}function C(){let E=h.scan();for(l=0;E===15||E===14;)E===14&&r.keepLines?l+=1:E===14&&(l=1),E=h.scan();return m=E===16||h.getTokenError()!==0,E}let O=[];function y(E,M,k){!m&&(!e||M<a&&k>s)&&t.substring(M,k)!==E&&O.push({offset:M,length:k-M,content:E})}let T=C();if(r.keepLines&&l>0&&y(Ad(c,l),0,0),T!==17){let E=h.getTokenOffset()+o,M=d.length*n<20&&r.insertSpaces?Sn[d.length*n]:Ad(d,n);y(M,o,E)}for(;T!==17;){let E=h.getTokenOffset()+h.getTokenLength()+o,M=C(),k="",A=!1;for(;l===0&&(M===12||M===13);){let Z=h.getTokenOffset()+o;y(Sn[1],E,Z),E=h.getTokenOffset()+h.getTokenLength()+o,A=M===12,k=A?x():"",M=C()}if(M===2)T!==1&&p--,r.keepLines&&l>0||!r.keepLines&&T!==1?k=x():r.keepLines&&(k=Sn[1]);else if(M===4)T!==3&&p--,r.keepLines&&l>0||!r.keepLines&&T!==3?k=x():r.keepLines&&(k=Sn[1]);else{switch(T){case 3:case 1:p++,r.keepLines&&l>0||!r.keepLines?k=x():k=Sn[1];break;case 5:r.keepLines&&l>0||!r.keepLines?k=x():k=Sn[1];break;case 12:k=x();break;case 13:l>0?k=x():A||(k=Sn[1]);break;case 6:r.keepLines&&l>0?k=x():A||(k=Sn[1]);break;case 10:r.keepLines&&l>0?k=x():M===6&&!A&&(k="");break;case 7:case 8:case 9:case 11:case 2:case 4:r.keepLines&&l>0?k=x():(M===12||M===13)&&!A?k=Sn[1]:M!==5&&M!==17&&(m=!0);break;case 16:m=!0;break}l>0&&(M===12||M===13)&&(k=x())}M===17&&(r.keepLines&&l>0?k=x():k=r.insertFinalNewline?c:"");let W=h.getTokenOffset()+o;y(k,E,W),T=M}return O}function Ad(t,e){let r="";for(let n=0;n<e;n++)r+=t;return r}function dle(t,e){let r=0,n=0,i=e.tabSize||4;for(;r<t.length;){let o=t.charAt(r);if(o===Sn[1])n++;else if(o==="	")n+=i;else break;r++}return Math.floor(n/i)}function fle(t,e){for(let r=0;r<e.length;r++){let n=e.charAt(r);if(n==="\r")return r+1<e.length&&e.charAt(r+1)===`
`?`\r
`:"\r";if(n===`
`)return`
`}return t&&t.eol||`
`}function mm(t,e){return`\r
`.indexOf(t.charAt(e))!==-1}var W0=ri(()=>{"use strict";qS();q5()});function $5(t,e){let r=[],n=new Object,i,o={value:{},offset:0,length:0,type:"object",parent:void 0},s=!1;function a(c,u,l,p){o.value=c,o.offset=u,o.length=l,o.type=p,o.colonOffset=void 0,i=o}try{bm(t,{onObjectBegin:(c,u)=>{if(e<=c)throw n;i=void 0,s=e>c,r.push("")},onObjectProperty:(c,u,l)=>{if(e<u||(a(c,u,l,"property"),r[r.length-1]=c,e<=u+l))throw n},onObjectEnd:(c,u)=>{if(e<=c)throw n;i=void 0,r.pop()},onArrayBegin:(c,u)=>{if(e<=c)throw n;i=void 0,r.push(0)},onArrayEnd:(c,u)=>{if(e<=c)throw n;i=void 0,r.pop()},onLiteralValue:(c,u,l)=>{if(e<u||(a(c,u,l,z5(c)),e<=u+l))throw n},onSeparator:(c,u,l)=>{if(e<=u)throw n;if(c===":"&&i&&i.type==="property")i.colonOffset=u,s=!1,i=void 0;else if(c===","){let p=r[r.length-1];typeof p=="number"?r[r.length-1]=p+1:(s=!0,r[r.length-1]=""),i=void 0}}})}catch(c){if(c!==n)throw c}return{path:r,previousNode:i,isAtPropertyKey:s,matches:c=>{let u=0;for(let l=0;u<c.length&&l<r.length;l++)if(c[u]===r[l]||c[u]==="*")u++;else if(c[u]!=="**")return!1;return u===c.length}}}function V5(t,e=[],r=gm.DEFAULT){let n=null,i=[],o=[];function s(c){Array.isArray(i)?i.push(c):n!==null&&(i[n]=c)}return bm(t,{onObjectBegin:()=>{let c={};s(c),o.push(i),i=c,n=null},onObjectProperty:c=>{n=c},onObjectEnd:()=>{i=o.pop()},onArrayBegin:()=>{let c=[];s(c),o.push(i),i=c,n=null},onArrayEnd:()=>{i=o.pop()},onLiteralValue:s,onError:(c,u,l)=>{e.push({error:c,offset:u,length:l})}},r),i[0]}function GS(t,e=[],r=gm.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(c){n.type==="property"&&(n.length=c-n.offset,n=n.parent)}function o(c){return n.children.push(c),c}bm(t,{onObjectBegin:c=>{n=o({type:"object",offset:c,length:-1,parent:n,children:[]})},onObjectProperty:(c,u,l)=>{n=o({type:"property",offset:u,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:c,offset:u,length:l,parent:n})},onObjectEnd:(c,u)=>{i(c+u),n.length=c+u-n.offset,n=n.parent,i(c+u)},onArrayBegin:(c,u)=>{n=o({type:"array",offset:c,length:-1,parent:n,children:[]})},onArrayEnd:(c,u)=>{n.length=c+u-n.offset,n=n.parent,i(c+u)},onLiteralValue:(c,u,l)=>{o({type:z5(c),offset:u,length:l,parent:n,value:c}),i(u+l)},onSeparator:(c,u,l)=>{n.type==="property"&&(c===":"?n.colonOffset=u:c===","&&i(u))},onError:(c,u,l)=>{e.push({error:c,offset:u,length:l})}},r);let a=n.children[0];return a&&delete a.parent,a}function ym(t,e){if(!t)return;let r=t;for(let n of e)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let i=!1;for(let o of r.children)if(Array.isArray(o.children)&&o.children[0].value===n&&o.children.length===2){r=o.children[1],i=!0;break}if(!i)return}else{let i=n;if(r.type!=="array"||i<0||!Array.isArray(r.children)||i>=r.children.length)return;r=r.children[i]}return r}function H0(t){if(!t.parent||!t.parent.children)return[];let e=H0(t.parent);if(t.parent.type==="property"){let r=t.parent.children[0].value;e.push(r)}else if(t.parent.type==="array"){let r=t.parent.children.indexOf(t);r!==-1&&e.push(r)}return e}function VS(t){switch(t.type){case"array":return t.children.map(VS);case"object":let e=Object.create(null);for(let r of t.children){let n=r.children[1];n&&(e[r.children[0].value]=VS(n))}return e;case"null":case"string":case"number":case"boolean":return t.value;default:return}}function mle(t,e,r=!1){return e>=t.offset&&e<t.offset+t.length||r&&e===t.offset+t.length}function q0(t,e,r=!1){if(mle(t,e,r)){let n=t.children;if(Array.isArray(n))for(let i=0;i<n.length&&n[i].offset<=e;i++){let o=q0(n[i],e,r);if(o)return o}return t}}function bm(t,e,r=gm.DEFAULT){let n=hu(t,!1),i=[],o=0;function s(G){return G?()=>o===0&&G(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(G){return G?b=>o===0&&G(b,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(G){return G?b=>o===0&&G(b,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice()):()=>!0}function u(G){return G?()=>{o>0?o++:G(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice())===!1&&(o=1)}:()=>!0}function l(G){return G?()=>{o>0&&o--,o===0&&G(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let p=u(e.onObjectBegin),d=c(e.onObjectProperty),f=l(e.onObjectEnd),h=u(e.onArrayBegin),m=l(e.onArrayEnd),x=c(e.onLiteralValue),C=a(e.onSeparator),O=s(e.onComment),y=a(e.onError),T=r&&r.disallowComments,E=r&&r.allowTrailingComma;function M(){for(;;){let G=n.scan();switch(n.getTokenError()){case 4:k(14);break;case 5:k(15);break;case 3:k(13);break;case 1:T||k(11);break;case 2:k(12);break;case 6:k(16);break}switch(G){case 12:case 13:T?k(10):O();break;case 16:k(1);break;case 15:case 14:break;default:return G}}}function k(G,b=[],S=[]){if(y(G),b.length+S.length>0){let pe=n.getToken();for(;pe!==17;){if(b.indexOf(pe)!==-1){M();break}else if(S.indexOf(pe)!==-1)break;pe=M()}}}function A(G){let b=n.getTokenValue();return G?x(b):(d(b),i.push(b)),M(),!0}function W(){switch(n.getToken()){case 11:let G=n.getTokenValue(),b=Number(G);isNaN(b)&&(k(2),b=0),x(b);break;case 7:x(null);break;case 8:x(!0);break;case 9:x(!1);break;default:return!1}return M(),!0}function Z(){return n.getToken()!==10?(k(3,[],[2,5]),!1):(A(!1),n.getToken()===6?(C(":"),M(),F()||k(4,[],[2,5])):k(5,[],[2,5]),i.pop(),!0)}function _(){p(),M();let G=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(G||k(4,[],[]),C(","),M(),n.getToken()===2&&E)break}else G&&k(6,[],[]);Z()||k(4,[],[2,5]),G=!0}return f(),n.getToken()!==2?k(7,[2],[]):M(),!0}function B(){h(),M();let G=!0,b=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(b||k(4,[],[]),C(","),M(),n.getToken()===4&&E)break}else b&&k(6,[],[]);G?(i.push(0),G=!1):i[i.length-1]++,F()||k(4,[],[4,5]),b=!0}return m(),G||i.pop(),n.getToken()!==4?k(8,[4],[]):M(),!0}function F(){switch(n.getToken()){case 3:return B();case 1:return _();case 10:return A(!0);default:return W()}}return M(),n.getToken()===17?r.allowEmptyContent?!0:(k(4,[],[]),!1):F()?(n.getToken()!==17&&k(9,[],[]),!0):(k(4,[],[]),!1)}function G5(t,e){let r=hu(t),n=[],i,o=0,s;do switch(s=r.getPosition(),i=r.scan(),i){case 12:case 13:case 17:o!==s&&n.push(t.substring(o,s)),e!==void 0&&n.push(r.getTokenValue().replace(/[^\r\n]/g,e)),o=r.getPosition();break}while(i!==17);return n.join("")}function z5(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}var gm,$0=ri(()=>{"use strict";qS();(function(t){t.DEFAULT={allowTrailingComma:!1}})(gm||(gm={}))});function K5(t,e,r,n){let i=e.slice(),s=GS(t,[]),a,c;for(;i.length>0&&(c=i.pop(),a=ym(s,i),a===void 0&&r!==void 0);)typeof c=="string"?r={[c]:r}:r=[r];if(a)if(a.type==="object"&&typeof c=="string"&&Array.isArray(a.children)){let u=ym(a,[c]);if(u!==void 0)if(r===void 0){if(!u.parent)throw new Error("Malformed AST");let l=a.children.indexOf(u.parent),p,d=u.parent.offset+u.parent.length;if(l>0){let f=a.children[l-1];p=f.offset+f.length}else p=a.offset+1,a.children.length>1&&(d=a.children[1].offset);return mu(t,{offset:p,length:d-p,content:""},n)}else return mu(t,{offset:u.offset,length:u.length,content:JSON.stringify(r)},n);else{if(r===void 0)return[];let l=`${JSON.stringify(c)}: ${JSON.stringify(r)}`,p=n.getInsertionIndex?n.getInsertionIndex(a.children.map(f=>f.children[0].value)):a.children.length,d;if(p>0){let f=a.children[p-1];d={offset:f.offset+f.length,length:0,content:","+l}}else a.children.length===0?d={offset:a.offset+1,length:0,content:l}:d={offset:a.offset+1,length:0,content:l+","};return mu(t,d,n)}}else if(a.type==="array"&&typeof c=="number"&&Array.isArray(a.children)){let u=c;if(u===-1){let l=`${JSON.stringify(r)}`,p;if(a.children.length===0)p={offset:a.offset+1,length:0,content:l};else{let d=a.children[a.children.length-1];p={offset:d.offset+d.length,length:0,content:","+l}}return mu(t,p,n)}else if(r===void 0&&a.children.length>=0){let l=c,p=a.children[l],d;if(a.children.length===1)d={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===l){let f=a.children[l-1],h=f.offset+f.length,m=a.offset+a.length;d={offset:h,length:m-2-h,content:""}}else d={offset:p.offset,length:a.children[l+1].offset-p.offset,content:""};return mu(t,d,n)}else if(r!==void 0){let l,p=`${JSON.stringify(r)}`;if(!n.isArrayInsertion&&a.children.length>c){let d=a.children[c];l={offset:d.offset,length:d.length,content:p}}else if(a.children.length===0||c===0)l={offset:a.offset+1,length:0,content:a.children.length===0?p:p+","};else{let d=c>a.children.length?a.children.length:c,f=a.children[d-1];l={offset:f.offset+f.length,length:0,content:","+p}}return mu(t,l,n)}else throw new Error(`Can not ${r===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${u} as length is not sufficient`)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${a.type}`);else{if(r===void 0)throw new Error("Can not delete in empty document");return mu(t,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(r)},n)}}function mu(t,e,r){if(!r.formattingOptions)return[e];let n=zS(t,e),i=e.offset,o=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!mm(n,i-1);)i--;for(;o<n.length&&!mm(n,o);)o++}let s=$S(n,{offset:i,length:o-i},{...r.formattingOptions,keepLines:!1});for(let c=s.length-1;c>=0;c--){let u=s[c];n=zS(n,u),i=Math.min(i,u.offset),o=Math.max(o,u.offset+u.length),o+=u.content.length-u.length}let a=t.length-(n.length-o)-i;return[{offset:i,length:a,content:n.substring(i,o)}]}function zS(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var J5=ri(()=>{"use strict";W0();$0()});var K0={};ex(K0,{ParseErrorCode:()=>z0,ScanError:()=>V0,SyntaxKind:()=>G0,applyEdits:()=>Ale,createScanner:()=>ble,findNodeAtLocation:()=>_le,findNodeAtOffset:()=>xle,format:()=>kle,getLocation:()=>vle,getNodePath:()=>Ile,getNodeValue:()=>Cle,modify:()=>Rle,parse:()=>wle,parseTree:()=>Sle,printParseErrorCode:()=>Ele,stripComments:()=>Ple,visit:()=>Tle});function Ele(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function kle(t,e,r){return $S(t,e,r)}function Rle(t,e,r,n){return K5(t,e,r,n)}function Ale(t,e){let r=e.slice(0).sort((i,o)=>{let s=i.offset-o.offset;return s===0?i.length-o.length:s}),n=t.length;for(let i=r.length-1;i>=0;i--){let o=r[i];if(o.offset+o.length<=n)t=zS(t,o);else throw new Error("Overlapping edit");n=o.offset}return t}var ble,V0,G0,vle,wle,Sle,_le,xle,Ile,Cle,Tle,Ple,z0,J0=ri(()=>{"use strict";W0();J5();qS();$0();ble=hu;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(V0||(V0={}));(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(G0||(G0={}));vle=$5,wle=V5,Sle=GS,_le=ym,xle=q0,Ile=H0,Cle=VS,Tle=bm,Ple=G5;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(z0||(z0={}))});var E3=P(ir=>{"use strict";var Ule="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",jle="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",lk="numeric",pk="ascii",dk="alpha",Pm="asciinumeric",Cm="alphanumeric",fk="domain",y3="emoji",Wle="scheme",Hle="slashscheme",sk="whitespace";function qle(t,e){return t in e||(e[t]=[]),e[t]}function yu(t,e,r){e[lk]&&(e[Pm]=!0,e[Cm]=!0),e[pk]&&(e[Pm]=!0,e[dk]=!0),e[Pm]&&(e[Cm]=!0),e[dk]&&(e[Cm]=!0),e[Cm]&&(e[fk]=!0),e[y3]&&(e[fk]=!0);for(let n in e){let i=qle(n,r);i.indexOf(t)<0&&i.push(t)}}function $le(t,e){let r={};for(let n in e)e[n].indexOf(t)>=0&&(r[n]=!0);return r}function Nr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nr.groups={};Nr.prototype={accepts(){return!!this.t},go(t){let e=this,r=e.j[t];if(r)return r;for(let n=0;n<e.jr.length;n++){let i=e.jr[n][0],o=e.jr[n][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,r,n){for(let i=0;i<t.length;i++)this.tt(t[i],e,r,n)},tr(t,e,r,n){n=n||Nr.groups;let i;return e&&e.j?i=e:(i=new Nr(e),r&&n&&yu(e,r,n)),this.jr.push([t,i]),i},ts(t,e,r,n){let i=this,o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,r,n)},tt(t,e,r,n){n=n||Nr.groups;let i=this;if(e&&e.j)return i.j[t]=e,e;let o=e,s,a=i.go(t);if(a?(s=new Nr,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Nr,o){if(n)if(s.t&&typeof s.t=="string"){let c=Object.assign($le(s.t,n),r);yu(o,c,n)}else r&&yu(o,r,n);s.t=o}return i.j[t]=s,s}};var Te=(t,e,r,n,i)=>t.ta(e,r,n,i),vt=(t,e,r,n,i)=>t.tr(e,r,n,i),f3=(t,e,r,n,i)=>t.ts(e,r,n,i),V=(t,e,r,n,i)=>t.tt(e,r,n,i),gs="WORD",hk="UWORD",b3="ASCIINUMERICAL",v3="ALPHANUMERICAL",Om="LOCALHOST",mk="TLD",gk="UTLD",o_="SCHEME",Gd="SLASH_SCHEME",wk="NUM",yk="WS",Sk="NL",Em="OPENBRACE",km="CLOSEBRACE",c_="OPENBRACKET",u_="CLOSEBRACKET",l_="OPENPAREN",p_="CLOSEPAREN",d_="OPENANGLEBRACKET",f_="CLOSEANGLEBRACKET",h_="FULLWIDTHLEFTPAREN",m_="FULLWIDTHRIGHTPAREN",g_="LEFTCORNERBRACKET",y_="RIGHTCORNERBRACKET",b_="LEFTWHITECORNERBRACKET",v_="RIGHTWHITECORNERBRACKET",w_="FULLWIDTHLESSTHAN",S_="FULLWIDTHGREATERTHAN",__="AMPERSAND",x_="APOSTROPHE",I_="ASTERISK",Ha="AT",C_="BACKSLASH",T_="BACKTICK",P_="CARET",qa="COLON",_k="COMMA",E_="DOLLAR",Po="DOT",k_="EQUALS",xk="EXCLAMATION",Yn="HYPHEN",Rm="PERCENT",R_="PIPE",A_="PLUS",D_="POUND",Am="QUERY",Ik="QUOTE",w3="FULLWIDTHMIDDLEDOT",Ck="SEMI",Eo="SLASH",Dm="TILDE",O_="UNDERSCORE",S3="EMOJI",L_="SYM",_3=Object.freeze({__proto__:null,ALPHANUMERICAL:v3,AMPERSAND:__,APOSTROPHE:x_,ASCIINUMERICAL:b3,ASTERISK:I_,AT:Ha,BACKSLASH:C_,BACKTICK:T_,CARET:P_,CLOSEANGLEBRACKET:f_,CLOSEBRACE:km,CLOSEBRACKET:u_,CLOSEPAREN:p_,COLON:qa,COMMA:_k,DOLLAR:E_,DOT:Po,EMOJI:S3,EQUALS:k_,EXCLAMATION:xk,FULLWIDTHGREATERTHAN:S_,FULLWIDTHLEFTPAREN:h_,FULLWIDTHLESSTHAN:w_,FULLWIDTHMIDDLEDOT:w3,FULLWIDTHRIGHTPAREN:m_,HYPHEN:Yn,LEFTCORNERBRACKET:g_,LEFTWHITECORNERBRACKET:b_,LOCALHOST:Om,NL:Sk,NUM:wk,OPENANGLEBRACKET:d_,OPENBRACE:Em,OPENBRACKET:c_,OPENPAREN:l_,PERCENT:Rm,PIPE:R_,PLUS:A_,POUND:D_,QUERY:Am,QUOTE:Ik,RIGHTCORNERBRACKET:y_,RIGHTWHITECORNERBRACKET:v_,SCHEME:o_,SEMI:Ck,SLASH:Eo,SLASH_SCHEME:Gd,SYM:L_,TILDE:Dm,TLD:mk,UNDERSCORE:O_,UTLD:gk,UWORD:hk,WORD:gs,WS:yk}),Co=/[a-z]/,zd=new RegExp("\\p{L}","u"),s_=new RegExp("\\p{Emoji}","u"),Vle=/\ufe0f/,To=/\d/,a_=/\s/,Gle=Object.freeze({__proto__:null,ASCII_LETTER:Co,DIGIT:To,EMOJI:s_,EMOJI_VARIATION:Vle,LETTER:zd,SPACE:a_}),h3="\r",ak=`
`,zle="\uFE0F",Kle="\u200D",ck="\uFFFC",n_=null,i_=null;function Jle(t=[]){let e={};Nr.groups=e;let r=new Nr;n_==null&&(n_=m3(Ule)),i_==null&&(i_=m3(jle)),V(r,"'",x_),V(r,"{",Em),V(r,"}",km),V(r,"[",c_),V(r,"]",u_),V(r,"(",l_),V(r,")",p_),V(r,"<",d_),V(r,">",f_),V(r,"\uFF08",h_),V(r,"\uFF09",m_),V(r,"\u300C",g_),V(r,"\u300D",y_),V(r,"\u300E",b_),V(r,"\u300F",v_),V(r,"\uFF1C",w_),V(r,"\uFF1E",S_),V(r,"&",__),V(r,"*",I_),V(r,"@",Ha),V(r,"`",T_),V(r,"^",P_),V(r,":",qa),V(r,",",_k),V(r,"$",E_),V(r,".",Po),V(r,"=",k_),V(r,"!",xk),V(r,"-",Yn),V(r,"%",Rm),V(r,"|",R_),V(r,"+",A_),V(r,"#",D_),V(r,"?",Am),V(r,'"',Ik),V(r,"/",Eo),V(r,";",Ck),V(r,"~",Dm),V(r,"_",O_),V(r,"\\",C_),V(r,"\u30FB",w3);let n=vt(r,To,wk,{[lk]:!0});vt(n,To,n);let i=vt(n,Co,b3,{[Pm]:!0}),o=vt(n,zd,v3,{[Cm]:!0}),s=vt(r,Co,gs,{[pk]:!0});vt(s,To,i),vt(s,Co,s),vt(i,To,i),vt(i,Co,i);let a=vt(r,zd,hk,{[dk]:!0});vt(a,Co),vt(a,To,o),vt(a,zd,a),vt(o,To,o),vt(o,Co),vt(o,zd,o);let c=V(r,ak,Sk,{[sk]:!0}),u=V(r,h3,yk,{[sk]:!0}),l=vt(r,a_,yk,{[sk]:!0});V(r,ck,l),V(u,ak,c),V(u,ck,l),vt(u,a_,l),V(l,h3),V(l,ak),vt(l,a_,l),V(l,ck,l);let p=vt(r,s_,S3,{[y3]:!0});V(p,"#"),vt(p,s_,p),V(p,zle,p);let d=V(p,Kle);V(d,"#"),vt(d,s_,p);let f=[[Co,s],[To,i]],h=[[Co,null],[zd,a],[To,o]];for(let m=0;m<n_.length;m++)Wa(r,n_[m],mk,gs,f);for(let m=0;m<i_.length;m++)Wa(r,i_[m],gk,hk,h);yu(mk,{tld:!0,ascii:!0},e),yu(gk,{utld:!0,alpha:!0},e),Wa(r,"file",o_,gs,f),Wa(r,"mailto",o_,gs,f),Wa(r,"http",Gd,gs,f),Wa(r,"https",Gd,gs,f),Wa(r,"ftp",Gd,gs,f),Wa(r,"ftps",Gd,gs,f),yu(o_,{scheme:!0,ascii:!0},e),yu(Gd,{slashscheme:!0,ascii:!0},e),t=t.sort((m,x)=>m[0]>x[0]?1:-1);for(let m=0;m<t.length;m++){let x=t[m][0],O=t[m][1]?{[Wle]:!0}:{[Hle]:!0};x.indexOf("-")>=0?O[fk]=!0:Co.test(x)?To.test(x)?O[Pm]=!0:O[pk]=!0:O[lk]=!0,f3(r,x,x,O)}return f3(r,"localhost",Om,{ascii:!0}),r.jd=new Nr(L_),{start:r,tokens:Object.assign({groups:e},_3)}}function x3(t,e){let r=I3(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=r.length,i=[],o=0,s=0;for(;s<n;){let a=t,c=null,u=0,l=null,p=-1,d=-1;for(;s<n&&(c=a.go(r[s]));)a=c,a.accepts()?(p=0,d=0,l=a):p>=0&&(p+=r[s].length,d++),u+=r[s].length,o+=r[s].length,s++;o-=p,s-=d,u-=p,i.push({t:l.t,v:e.slice(o-u,o),s:o-u,e:o})}return i}function I3(t){let e=[],r=t.length,n=0;for(;n<r;){let i=t.charCodeAt(n),o,s=i<55296||i>56319||n+1===r||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);e.push(s),n+=s.length}return e}function Wa(t,e,r,n,i){let o,s=e.length;for(let a=0;a<s-1;a++){let c=e[a];t.j[c]?o=t.j[c]:(o=new Nr(n),o.jr=i.slice(),t.j[c]=o),t=o}return o=new Nr(r),o.jr=i.slice(),t.j[e[s-1]]=o,o}function m3(t){let e=[],r=[],n=0,i="0123456789";for(;n<t.length;){let o=0;for(;i.indexOf(t[n+o])>=0;)o++;if(o>0){e.push(r.join(""));for(let s=parseInt(t.substring(n,n+o),10);s>0;s--)r.pop();n+=o}else r.push(t[n]),n++}return e}var Kd={defaultProtocol:"http",events:null,format:g3,formatHref:g3,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Mm(t,e=null){let r=Object.assign({},Kd);t&&(r=Object.assign(r,t instanceof Mm?t.o:t));let n=r.ignoreTags,i=[];for(let o=0;o<n.length;o++)i.push(n[o].toUpperCase());this.o=r,e&&(this.defaultRender=e),this.ignoreTags=i}Mm.prototype={o:Kd,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,r){let n=e!=null,i=this.o[t];return i&&(typeof i=="object"?(i=r.t in i?i[r.t]:Kd[t],typeof i=="function"&&n&&(i=i(e,r))):typeof i=="function"&&n&&(i=i(e,r.t,r)),i)},getObj(t,e,r){let n=this.o[t];return typeof n=="function"&&e!=null&&(n=n(e,r.t,r)),n},render(t){let e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function g3(t){return t}var Xle=Object.freeze({__proto__:null,Options:Mm,defaults:Kd});function Lm(t,e){this.t="token",this.v=t,this.tk=e}Lm.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),r=t.get("truncate",e,this),n=t.get("format",e,this);return r&&n.length>r?n.substring(0,r)+"\u2026":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Kd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,r=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",r,this),i=t.get("tagName",r,e),o=this.toFormattedString(t),s={},a=t.get("className",r,e),c=t.get("target",r,e),u=t.get("rel",r,e),l=t.getObj("attributes",r,e),p=t.getObj("events",r,e);return s.href=n,a&&(s.class=a),c&&(s.target=c),u&&(s.rel=u),l&&Object.assign(s,l),{tagName:i,attributes:s,content:o,eventListeners:p}}};function Jd(t,e){class r extends Lm{constructor(i,o){super(i,o),this.t=t}}for(let n in e)r.prototype[n]=e[n];return r.t=t,r}var bk=Jd("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),vk=Jd("text"),C3=Jd("nl"),Tm=Jd("url",{isLink:!0,toHref(t=Kd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==Om&&t[1].t===qa}}),T3=Object.freeze({__proto__:null,Base:Lm,Email:bk,MultiToken:Lm,Nl:C3,Text:vk,Url:Tm,createTokenClass:Jd}),Xn=t=>new Nr(t);function Yle({groups:t}){let e=t.domain.concat([__,I_,Ha,C_,T_,P_,E_,k_,Yn,wk,Rm,R_,A_,D_,Eo,L_,Dm,O_]),r=[x_,qa,_k,Po,xk,Rm,Am,Ik,Ck,d_,f_,Em,km,u_,c_,l_,p_,h_,m_,g_,y_,b_,v_,w_,S_],n=[__,x_,I_,C_,T_,P_,E_,k_,Yn,Em,km,Rm,R_,A_,D_,Am,Eo,L_,Dm,O_],i=Xn(),o=V(i,Dm);Te(o,n,o),Te(o,t.domain,o);let s=Xn(),a=Xn(),c=Xn();Te(i,t.domain,s),Te(i,t.scheme,a),Te(i,t.slashscheme,c),Te(s,n,o),Te(s,t.domain,s);let u=V(s,Ha);V(o,Ha,u),V(a,Ha,u),V(c,Ha,u);let l=V(o,Po);Te(l,n,o),Te(l,t.domain,o);let p=Xn();Te(u,t.domain,p),Te(p,t.domain,p);let d=V(p,Po);Te(d,t.domain,p);let f=Xn(bk);Te(d,t.tld,f),Te(d,t.utld,f),V(u,Om,f);let h=V(p,Yn);V(h,Yn,h),Te(h,t.domain,p),Te(f,t.domain,p),V(f,Po,d),V(f,Yn,h);let m=V(f,qa);Te(m,t.numeric,bk);let x=V(s,Yn),C=V(s,Po);V(x,Yn,x),Te(x,t.domain,s),Te(C,n,o),Te(C,t.domain,s);let O=Xn(Tm);Te(C,t.tld,O),Te(C,t.utld,O),Te(O,t.domain,s),Te(O,n,o),V(O,Po,C),V(O,Yn,x),V(O,Ha,u);let y=V(O,qa),T=Xn(Tm);Te(y,t.numeric,T);let E=Xn(Tm),M=Xn();Te(E,e,E),Te(E,r,M),Te(M,e,E),Te(M,r,M),V(O,Eo,E),V(T,Eo,E);let k=V(a,qa),A=V(c,qa),W=V(A,Eo),Z=V(W,Eo);Te(a,t.domain,s),V(a,Po,C),V(a,Yn,x),Te(c,t.domain,s),V(c,Po,C),V(c,Yn,x),Te(k,t.domain,E),V(k,Eo,E),V(k,Am,E),Te(Z,t.domain,E),Te(Z,e,E),V(Z,Eo,E);let _=[[Em,km],[c_,u_],[l_,p_],[d_,f_],[h_,m_],[g_,y_],[b_,v_],[w_,S_]];for(let B=0;B<_.length;B++){let[F,G]=_[B],b=V(E,F);V(M,F,b),V(b,G,E);let S=Xn(Tm);Te(b,e,S);let pe=Xn();Te(b,r),Te(S,e,S),Te(S,r,pe),Te(pe,e,S),Te(pe,r,pe),V(S,G,E),V(pe,G,E)}return V(i,Om,O),V(i,Sk,C3),{start:i,tokens:_3}}function Qle(t,e,r){let n=r.length,i=0,o=[],s=[];for(;i<n;){let a=t,c=null,u=null,l=0,p=null,d=-1;for(;i<n&&!(c=a.go(r[i].t));)s.push(r[i++]);for(;i<n&&(u=c||a.go(r[i].t));)c=null,a=u,a.accepts()?(d=0,p=a):d>=0&&d++,i++,l++;if(d<0)i-=l,i<n&&(s.push(r[i]),i++);else{s.length>0&&(o.push(uk(vk,e,s)),s=[]),i-=d,l-=d;let f=p.t,h=r.slice(i-l,i);o.push(uk(f,e,h))}}return s.length>0&&o.push(uk(vk,e,s)),o}function uk(t,e,r){let n=r[0].s,i=r[r.length-1].e,o=e.slice(n,i);return new t(o,r)}var Nm=typeof console<"u"&&console&&console.warn||(()=>{}),Tk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ae={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Zle(){return Nr.groups={},Ae.scanner=null,Ae.parser=null,Ae.tokenQueue=[],Ae.pluginQueue=[],Ae.customSchemes=[],Ae.initialized=!1,Ae}function epe(t,e){if(typeof e!="function")throw new Error(`linkifyjs: Invalid token plugin ${e} (expects function)`);for(let r=0;r<Ae.tokenQueue.length;r++)if(t===Ae.tokenQueue[r][0]){Nm(`linkifyjs: token plugin "${t}" already registered - will be overwritten`),Ae.tokenQueue[r]=[t,e];return}Ae.tokenQueue.push([t,e]),Ae.initialized&&Nm(`linkifyjs: already initialized - will not register token plugin "${t}" ${Tk}`)}function tpe(t,e){if(typeof e!="function")throw new Error(`linkifyjs: Invalid plugin ${e} (expects function)`);for(let r=0;r<Ae.pluginQueue.length;r++)if(t===Ae.pluginQueue[r][0]){Nm(`linkifyjs: plugin "${t}" already registered - will be overwritten`),Ae.pluginQueue[r]=[t,e];return}Ae.pluginQueue.push([t,e]),Ae.initialized&&Nm(`linkifyjs: already initialized - will not register plugin "${t}" ${Tk}`)}function rpe(t,e=!1){if(Ae.initialized&&Nm(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Tk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);Ae.customSchemes.push([t,e])}function P3(){Ae.scanner=Jle(Ae.customSchemes);for(let t=0;t<Ae.tokenQueue.length;t++)Ae.tokenQueue[t][1]({scanner:Ae.scanner});Ae.parser=Yle(Ae.scanner.tokens);for(let t=0;t<Ae.pluginQueue.length;t++)Ae.pluginQueue[t][1]({scanner:Ae.scanner,parser:Ae.parser});return Ae.initialized=!0,Ae}function N_(t){return Ae.initialized||P3(),Qle(Ae.parser.start,t,x3(Ae.scanner.start,t))}N_.scan=x3;function npe(t,e=null,r=null){if(e&&typeof e=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);r=e,e=null}let n=new Mm(r),i=N_(t),o=[];for(let s=0;s<i.length;s++){let a=i[s];a.isLink&&(!e||a.t===e)&&n.check(a)&&o.push(a.toFormattedObject(n))}return o}function ipe(t,e=null){let r=N_(t);return r.length===1&&r[0].isLink&&(!e||r[0].t===e)}ir.MultiToken=Lm;ir.Options=Mm;ir.State=Nr;ir.createTokenClass=Jd;ir.find=npe;ir.init=P3;ir.multi=T3;ir.options=Xle;ir.regexp=Gle;ir.registerCustomProtocol=rpe;ir.registerPlugin=tpe;ir.registerTokenPlugin=epe;ir.reset=Zle;ir.stringToArray=I3;ir.test=ipe;ir.text=T3;ir.tokenize=N_});var wpe={};ex(wpe,{activate:()=>bpe,deactivate:()=>vpe});module.exports=tx(wpe);var bG=v(ge()),vG=require("os"),St=v(require("vscode"));var nf=new Map([["pwa-node","node"],["pwa-chrome","chrome"],["pwa-extensionHost","extensionHost"],["pwa-msedge","msedge"],["pwa-editor-browser","editor-browser"]]),bs=t=>nf.get(t)||t,VG={"pwa-extensionHost":null,"node-terminal":null,"pwa-node":null,"pwa-chrome":null,"pwa-msedge":null,"pwa-editor-browser":null},GG={"extension.js-debug.addCustomBreakpoints":null,"extension.js-debug.addXHRBreakpoints":null,"extension.js-debug.editXHRBreakpoints":null,"extension.pwa-node-debug.attachNodeProcess":null,"extension.js-debug.clearAutoAttachVariables":null,"extension.js-debug.setAutoAttachVariables":null,"extension.js-debug.autoAttachToProcess":null,"extension.js-debug.createDebuggerTerminal":null,"extension.js-debug.createDiagnostics":null,"extension.js-debug.getDiagnosticLogs":null,"extension.js-debug.debugLink":null,"extension.js-debug.npmScript":null,"extension.js-debug.pickNodeProcess":null,"extension.js-debug.prettyPrint":null,"extension.js-debug.removeXHRBreakpoint":null,"extension.js-debug.removeAllCustomBreakpoints":null,"extension.js-debug.revealPage":null,"extension.js-debug.startProfile":null,"extension.js-debug.stopProfile":null,"extension.js-debug.toggleSkippingFile":null,"extension.node-debug.startWithStopOnEntry":null,"extension.js-debug.requestCDPProxy":null,"extension.js-debug.openEdgeDevTools":null,"extension.js-debug.callers.add":null,"extension.js-debug.callers.goToCaller":null,"extension.js-debug.callers.gotToTarget":null,"extension.js-debug.callers.remove":null,"extension.js-debug.callers.removeAll":null,"extension.js-debug.enableSourceMapStepping":null,"extension.js-debug.disableSourceMapStepping":null,"extension.js-debug.network.viewRequest":null,"extension.js-debug.network.copyUri":null,"extension.js-debug.network.openBody":null,"extension.js-debug.network.openBodyInHex":null,"extension.js-debug.network.replayXHR":null,"extension.js-debug.network.clear":null,"extension.js-debug.completion.nodeTool":null},xpe=new Set(Object.keys(GG)),nx=new Set(Object.keys(VG)),vs=t=>nx.has(t);var $m="jsDebugNetworkFs",be=(t,e,r)=>t.registerCommand(e,r),Vm=async(t,e,...r)=>await t.executeCommand(e,...r);var Xe=(t,e,r)=>t.getConfiguration(void 0,r).get(e),ix=(t,e,r,n)=>t.getConfiguration().update(e,r,n);var ws=async(t,e,r)=>await t.executeCommand("setContext",e,r);var Qk=require("os");var ni="node:",ii="<node_internals>";var at=t=>!!t,_u=t=>Gm(t,e=>e!==null),$k=t=>Gm(t,e=>e!==void 0),Ga=t=>(e=>e instanceof t),xu=(t,e)=>{debugger;throw new Error(e.replace("{value}",JSON.stringify(t)))};function Gm(t,e){let r={};for(let n of Object.keys(t)){let i=t[n];e(i,n)&&(r[n]=i)}return r}function ko(t,e){let r={};for(let n of Object.keys(t)){let i=t[n];r[n]=e(i,n)}return r}function Vk(t,e){let r={};for(let n of Object.keys(t))e(n,t[n])&&(r[n]=t[n]);return r}function Gk(...t){if(t.length===0)return{};let e={},r=Object.create(null);for(let n of t)if(n)for(let i of Object.keys(n)){let o=i.toLowerCase();r[o]?e[r[o]]=n[i]:(r[o]=i,e[i]=n[i])}return e}function zk(t,e){if(t.hasOwnProperty(e))return t[e];let r=e.toLowerCase();for(let n of Object.keys(t))if(n.toLowerCase()===r)return t[n]}var ox=Symbol("unset");function me(t){let e=ox,r=(...n)=>(e===ox&&(r.value=e=t(...n)),e);return r.forget=()=>{e=ox,r.value=void 0},r.value=void 0,r}function Ro(t){let e=new Map,r=n=>{if(e.has(n))return e.get(n);let i=t(n);return e.set(n,i),i};return r.clear=()=>e.clear(),r}function Kk(t){let e,r=n=>(e?.arg===n||(e={arg:n,val:t(n)}),e.val);return r.clear=()=>e=void 0,r}function Jk(t,e){let r,n=()=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e()},t)};return n.clear=()=>{r&&(clearTimeout(r),r=void 0)},n}function Xk(t,e){let r,n=()=>{r===void 0&&(r=setTimeout(()=>{r=void 0,e()},t))};return n.queued=()=>!!r,n.clear=()=>{r&&(clearTimeout(r),r=void 0)},n}async function Yk(t,e){let r=[],n=[];for(let i of t)await e(i)?r.push(i):n.push(i);return[r,n]}function Ao(t){let e=[];for(let r of t)e=e.concat(r);return e}var zG=2**31-1,zm=()=>{let t=0;return()=>t++&zG};var Re=Symbol("AnyLaunchConfiguration"),of={type:"",name:"",request:"",trace:!1,outputCapture:"console",timeout:1e4,timeouts:{},showAsyncStacks:!0,skipFiles:[],smartStep:!0,sourceMaps:!0,sourceMapRenames:!0,pauseForSourceMap:!0,resolveSourceMapLocations:null,rootPath:"${workspaceFolder}",outFiles:["${workspaceFolder}/**/*.(m|c|)js","!**/node_modules/**"],sourceMapPathOverrides:Xm("${workspaceFolder}"),enableContentValidation:!0,cascadeTerminateToConfigurations:[],enableDWARF:!0,__workspaceFolder:"",__remoteFilePrefix:void 0,__breakOnConditionalError:!1,customDescriptionGenerator:void 0,customPropertiesGenerator:void 0},sf={...of,cwd:"${workspaceFolder}",env:{},envFile:null,pauseForSourceMap:!1,sourceMaps:!0,localRoot:null,remoteRoot:null,resolveSourceMapLocations:["**","!**/node_modules/**"],autoAttachChildProcesses:!0,runtimeSourcemapPausePatterns:[],skipFiles:[`${ii}/**`]},Km={...sf,showAsyncStacks:{onceBreakpointResolved:16},type:"node-terminal",request:"launch",name:"JavaScript Debug Terminal"},KG={...sf,type:"node-terminal",request:"attach",name:Km.name,showAsyncStacks:{onceBreakpointResolved:16},delegateId:-1},af={...sf,type:"pwa-extensionHost",name:"Debug Extension",request:"launch",args:["--extensionDevelopmentPath=${workspaceFolder}"],outFiles:["${workspaceFolder}/out/**/*.js"],resolveSourceMapLocations:["${workspaceFolder}/**","!**/node_modules/**"],rendererDebugOptions:{},runtimeExecutable:"${execPath}",autoAttachChildProcesses:!1,debugWebviews:!1,debugWebWorkerHost:!1,__sessionId:""},JG={...sf,type:"pwa-node",request:"launch",program:"",cwd:"${workspaceFolder}",stopOnEntry:!1,console:"internalConsole",restart:!1,args:[],runtimeExecutable:"node",runtimeVersion:"default",runtimeArgs:[],profileStartup:!1,attachSimplePort:null,experimentalNetworking:"auto",killBehavior:"forceful"},cf={...of,type:"pwa-chrome",request:"attach",address:"localhost",port:0,disableNetworkCache:!0,pathMapping:{},url:null,restart:!1,urlFilter:"",sourceMapPathOverrides:Xm("${webRoot}"),webRoot:"${workspaceFolder}",server:null,browserAttachLocation:"workspace",targetSelection:"automatic",vueComponentPaths:["${workspaceFolder}/**/*.vue","!**/node_modules/**"],perScriptSourcemaps:"auto"},sx={...cf,type:"pwa-msedge",useWebView:!1},Jm={...cf,type:"pwa-chrome",request:"launch",cwd:null,file:null,env:{},urlFilter:"*",includeDefaultArgs:!0,includeLaunchArgs:!0,runtimeArgs:null,runtimeExecutable:"*",userDataDir:!0,browserLaunchLocation:"workspace",profileStartup:!1,cleanUp:"wholeBrowser",killBehavior:"forceful"},ax={...Jm,type:"pwa-msedge",useWebView:!1},Zk={...of,disableNetworkCache:!0,pathMapping:{},url:null,urlFilter:"",sourceMapPathOverrides:Xm("${webRoot}"),webRoot:"${workspaceFolder}",server:null,vueComponentPaths:["${workspaceFolder}/**/*.vue","!**/node_modules/**"],perScriptSourcemaps:"auto"},cx={...Zk,type:"pwa-editor-browser",request:"attach"},ux={...Zk,type:"pwa-editor-browser",request:"launch",url:"http://localhost:8080"},lx={...sf,type:"pwa-node",attachExistingChildren:!0,address:"localhost",port:9229,restart:!1,request:"attach",continueOnAttach:!1};function Xm(t){return{"webpack:///./~/*":`${t}/node_modules/*`,"webpack:////*":"/*","webpack://@?:*/?:*/*":`${t}/*`,"webpack://?:*/*":`${t}/*`,"webpack:///([a-z]):/(.+)":"$1:/$2","meteor://\u{1F4BB}app/*":`${t}/*`,"turbopack://[project]/*":"${workspaceFolder}/*","turbopack:///[project]/*":"${workspaceFolder}/*"}}var Ym=t=>{!t.sourceMapPathOverrides&&t.cwd&&(t.sourceMapPathOverrides=Xm(t.cwd)),t.resolveSourceMapLocations===void 0&&(t.resolveSourceMapLocations=t.outFiles)};function px({...t}){return Ym(t),t.request==="attach"?{...lx,...t}:{...JG,...t}}function XG(t,e){return t.request==="attach"?{...cf,browserAttachLocation:e,...t}:{...Jm,browserLaunchLocation:e,...t}}function YG(t,e){return t.request==="attach"?{...sx,browserAttachLocation:e,...t}:{...ax,browserLaunchLocation:e,...t}}function QG(t){return t.request==="attach"?{...cx,...t}:{...ux,...t}}function ZG(t){let e={...af,...t};return e.skipFiles=[...e.skipFiles,"**/node_modules.asar/**","**/bootstrap-fork.js"],e}function dx(t){return Ym(t),t.request==="launch"?{...Km,...t}:{...KG,...t}}function Ss(t,e){let r,n=e==="remote"?"ui":"workspace";switch(t.type){case"pwa-node":r=px(t);break;case"pwa-msedge":r=YG(t,n);break;case"pwa-chrome":r=XG(t,n);break;case"pwa-extensionHost":r=ZG(t);break;case"node-terminal":r=dx(t);break;case"pwa-editor-browser":r=QG(t);break;default:throw xu(t,"Unknown config: {value}")}return hx(r)}function fx(t){let e="${workspaceFolder}",r={...t,rootPath:void 0,outFiles:t.outFiles.filter(n=>!n.includes(e)),sourceMapPathOverrides:Gm(t.sourceMapPathOverrides,n=>!n.includes("${workspaceFolder}"))};return"vueComponentPaths"in r&&(r.vueComponentPaths=r.vueComponentPaths.filter(n=>!n.includes(e))),"resolveSourceMapLocations"in r&&(r.resolveSourceMapLocations=r.resolveSourceMapLocations?.filter(n=>!n.includes(e))??null),"cwd"in r&&r.cwd?.includes(e)&&(r.cwd=r.request==="launch"&&r.type==="pwa-node"?(0,Qk.homedir)():void 0),"webRoot"in r&&r.webRoot?.includes(e)&&(r.webRoot="/"),r}function hx(t){return t.__workspaceFolder||(t=fx(t)),t=Ii(t,"workspaceFolder",t.__workspaceFolder),t=Ii(t,"webRoot","webRoot"in t?t.webRoot:t.__workspaceFolder),t}function Ii(t,e,r){let n;if(typeof t=="string")n=t.replace(new RegExp(`\\$\\{${e}\\}`,"g"),()=>{if(!r)throw new Error(`Unable to resolve \${${e}} in configuration (${JSON.stringify(e)})`);return r});else if(t instanceof Array)n=t.map(i=>Ii(i,e,r));else if(typeof t=="object"&&t){let i={};for(let[o,s]of Object.entries(t))i[Ii(o,e,r)]=Ii(s,e,r);n=i}else n=t;return n}var Qm=["javascript","typescript","typescriptreact","javascriptreact","fsharp","html","wat","c","cpp","rust","zig"],Zm="js-debug",za="1.140.0",e4="ms-vscode",eg=Zm.includes("nightly"),eR=`${e4}.${Zm}`;var F_=v(Px()),O3=v(Ig()),B_=require("fs"),U_=v(H()),n$e=v(S1());var Bf=require("fs"),Vt=v(H()),Hy=v(require("path"));var j=class{constructor(){this._listeners=new Set;this.event=(e,r,n)=>{let i={listener:e,thisArg:r};this._listeners.add(i);let o={dispose:()=>{o.dispose=()=>{},this._listeners.delete(i)}};return n&&n.push(o),o}}get size(){return this._listeners.size}fire(e){let r=!this._deliveryQueue;this._deliveryQueue||(this._deliveryQueue=[]);for(let n of this._listeners)this._deliveryQueue.push({data:n,event:e});if(r){for(let n=0;n<this._deliveryQueue.length;n++){let{data:i,event:o}=this._deliveryQueue[n];i.listener.call(i.thisArg,o)}this._deliveryQueue=void 0}}dispose(){this._listeners.clear(),this._deliveryQueue&&(this._deliveryQueue=[])}},_f=class{constructor(){this.map=new Map;this.listeners=this.map}listen(e,r){let n=this.map.get(e);n||(n=new j,this.map.set(e,n));let i=n.event(r);return{dispose:me(()=>{i.dispose(),n?.size===0&&this.map.delete(e)})}}emit(e,r){this.listeners.get(e)?.fire(r)}};var Qa=v(H()),Cf=v(require("path"));var C1=require("crypto"),T1=v(Ig()),P1=require("os"),Me=v(require("path"));var No=v(require("fs")),_1=v(require("util"));async function Mo({access:t},e){if(!e)return!1;try{return await t(e),!0}catch{return!1}}async function CI(t,e,r){try{await t.copyFile(e,r)}catch(n){try{if(await Mo(t,r))await t.unlink(r),await t.copyFile(e,r);else throw n}catch{throw n}}}async function Er({stat:t},e){if(e)try{return await t(e)}catch{return}}async function x1({lstat:t},e){if(e)try{return await t(e)}catch{return}}async function I1({copyFile:t,rename:e,unlink:r},n,i){try{await e(n,i)}catch{await t(n,i),await r(n)}}function iy(t){return new Promise(e=>{No.readFile(t,"utf8",async(r,n)=>{e(r?"":n)})})}var Pfe=_1.promisify(No.writeFile);var br=Symbol("FsUtils"),nn=class{constructor(e){this.fs=e}realPath(e){return this.fs.realpath(e)}async exists(e){try{return await this.fs.access(e,No.constants.F_OK),!0}catch{return!1}}readFile(e){return this.fs.readFile(e)}},II=class{constructor(e){this.dap=e}async realPath(){throw new Error("not implemented")}async exists(e){try{let{doesExists:r}=await this.dap.remoteFileExistsRequest({localFilePath:e});return r}catch{return!1}}readFile(){throw new Error("not implemented")}},ny=class{constructor(e,r,n){this.remoteFilePrefix=e;this.localFsUtils=r;this.remoteFsUtils=n}static create(e,r,n){let i=new nn(r);return e!==void 0?new this(e.toLowerCase(),i,new II(n)):i}async exists(e){return this.selectFs(e).exists(e)}async readFile(e){return this.selectFs(e).readFile(e)}async realPath(e){return this.selectFs(e).realPath(e)}selectFs(e){return e.toLowerCase().startsWith(this.remoteFilePrefix)?this.remoteFsUtils:this.localFsUtils}};var wJ=process.platform==="win32"?"\\\\.\\pipe\\":(0,P1.tmpdir)(),SJ=0,oy=()=>Me.join(wJ,`node-cdp.${process.pid}-${(0,C1.randomBytes)(4).toString("hex")}-${SJ++}.sock`);function _J(t){return process.platform!=="win32"?[""]:t.lookup("PATHEXT")?.split(";")||[".exe"]}async function sy(t,e,r){let n;if(process.platform==="win32"){let i=r.WINDIR||"C:\\Windows";n=Me.join(i,"System32","where.exe")}else n="/usr/bin/which";try{if(await Er(t,n)){let o=(await(0,T1.default)(n,[e],{env:_u(r)})).stdout.split(/\r?\n/);if(process.platform==="win32"){let s=String(r.PATHEXT||".exe").toUpperCase().split(";");for(let a of o){let c=Me.extname(a).toUpperCase();if(c&&s.includes(c))return a}}else if(o.length>0)return o[0];return}return e}catch{}}async function TI(t,e,r){if(e){if(process.platform==="win32"&&!Me.extname(e))for(let n of _J(r)){let i=e+n;if(await Er(t,i))return i}if(await Er(t,e))return e}}var E1=t=>t.includes(`.asar${Me.sep}`);function Is(...t){return Me.posix.isAbsolute(t[0])?ze(Me.posix.join(...t)):Me.win32.isAbsolute(t[0])?Me.win32.join(...t):Me.join(...t)}function on(...t){return Me.posix.isAbsolute(t[0])?Me.posix.resolve(...t):Me.win32.isAbsolute(t[0])?Me.win32.resolve(...t):Me.resolve(...t)}function If(t,e){return Me.posix.isAbsolute(t)?Me.posix.relative(t,e):Me.win32.isAbsolute(t)?Me.win32.relative(t,e):Me.relative(t,e)}var xJ=/\/|\\/,xf="file:///",k1=t=>t.startsWith(xf)&&t[xf.length+1]===":",PI=t=>t.split(xJ);function Bu(t,e=!1){if(!t)return t;if(k1(t)){let r=xf.length;t=xf+t[r].toLowerCase()+t.substr(r+1)}else cy(t)&&(t=(e?t[0].toUpperCase():t[0].toLowerCase())+t.substr(1));return t}function ft(t,e=!1){if(!t)return t;if(t=Bu(t,e),k1(t)){let r=xf.length;t=t.substr(0,r+1)+t.substr(r+1).replace(/\//g,"\\")}else cy(t)&&(t=t.replace(/\//g,"\\"));return t}function ze(t){return t.replace(/\\\//g,"/").replace(/\\/g,"/")}var ay=(t,e)=>{let r=Me.relative(t,e);return r.length&&!Me.isAbsolute(r)&&!r.startsWith("..")},Fu=(t,e)=>{let r=Me.relative(t,e);return!Me.isAbsolute(r)&&!r.startsWith("..")},EI=t=>t.startsWith("\\\\"),cy=t=>/^[A-Za-z]:/.test(t)||EI(t);var Uu=class{get empty(){return this.patterns.length===0}constructor({rootPath:e,patterns:r}){!e||!r?(this.rootPath="",this.patterns=[]):(this.rootPath=e,this.patterns=r.map(n=>{let i=n.startsWith("!");return{negated:i,pattern:n.slice(i?1:0)}}))}*explode(){for(let e=0;e<this.patterns.length;e++){let{negated:r,pattern:n}=this.patterns[e];if(r)continue;let i=Cf.resolve(this.rootPath,n).split(/[\\/]/g),o=i.findIndex(c=>c.includes("*"));if(o===-1){yield{cwd:i.slice(0,-1).join("/"),pattern:i[i.length-1],negations:[]};continue}let s=i.slice(0,o).join("/"),a=[];for(let c=e+1;c<this.patterns.length;c++){let{negated:u,pattern:l}=this.patterns[c];if(u)if(l.startsWith("**"))a.push(ze(l));else{let p=Cf.relative(s,Cf.resolve(this.rootPath,l));p.startsWith("..")||a.push(ze(p))}}yield{cwd:s,negations:a,pattern:i.slice(o).join("/")}}}};Uu=I([(0,Qa.injectable)()],Uu);var Hi=class extends Uu{constructor({rootPath:e,outFiles:r}){super({rootPath:e,patterns:r})}};Hi=I([(0,Qa.injectable)(),g(0,(0,Qa.inject)(Re))],Hi);var Bo=class extends Uu{constructor(e){super({rootPath:e.rootPath,patterns:"vueComponentPaths"in e?e.vueComponentPaths:[]})}};Bo=I([(0,Qa.injectable)(),g(0,(0,Qa.inject)(Re))],Bo);var A1=require("crypto"),D1=require("os"),O1=v(require("path"));var ly=require("fs"),R1=require("path"),CJ=(t,e)=>e instanceof Error?{message:e.message,stack:e.stack}:typeof e=="bigint"?e.toString():e,uy=class{constructor(e,r){this.file=e;this.dap=r;try{(0,ly.mkdirSync)((0,R1.dirname)(e),{recursive:!0})}catch{}this.stream=(0,ly.createWriteStream)(e)}async setup(){this.dap?.output({category:"console",output:`Verbose logs are written to:
${this.file}
`})}dispose(){this.stream&&(this.stream.end(),this.stream=void 0)}write(e){this.stream&&this.stream.write(JSON.stringify(e,CJ)+`
`)}};var TJ={runtime:null,"runtime.sourcecreate":null,"runtime.assertion":null,"runtime.launch":null,"runtime.target":null,"runtime.welcome":null,"runtime.exception":null,"runtime.sourcemap":null,"runtime.breakpoints":null,"sourcemap.parsing":null,"perf.function":null,"cdp.send":null,"cdp.receive":null,"dap.send":null,"dap.receive":null,internal:null,proxyActivity:null},Bfe=Object.keys(TJ),Y=Symbol("ILogger");function kI(t,e=(0,D1.tmpdir)()){if(t===!1)return{stdio:!1,logFile:null};let r={stdio:!0,logFile:O1.join(e,`vscode-debugadapter-${(0,A1.randomBytes)(4).toString("hex")}.json`)};return t===!0?r:{...r,...t}}function L1(t,e){let r=kI(e),n={sinks:[]};return r.logFile&&n.sinks.push(new uy(r.logFile,t)),n}var PJ=44;var N1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",EJ=new Uint8Array(64),B1=new Uint8Array(128);for(let t=0;t<N1.length;t++){let e=N1.charCodeAt(t);EJ[t]=e,B1[e]=t}function Tf(t,e){let r=0,n=0,i=0;do{let s=t.next();i=B1[s],r|=(i&31)<<n,n+=5}while(i&32);let o=r&1;return r>>>=1,o&&(r=-2147483648|-r),e+r}function M1(t,e){return t.pos>=e?!1:t.peek()!==PJ}var Ufe=1024*16;var kJ=class{constructor(t){this.pos=0,this.buffer=t}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(t){let{buffer:e,pos:r}=this,n=e.indexOf(t,r);return n===-1?e.length:n}};function F1(t){let{length:e}=t,r=new kJ(t),n=[],i=0,o=0,s=0,a=0,c=0;do{let u=r.indexOf(";"),l=[],p=!0,d=0;for(i=0;r.pos<u;){let f;i=Tf(r,i),i<d&&(p=!1),d=i,M1(r,u)?(o=Tf(r,o),s=Tf(r,s),a=Tf(r,a),M1(r,u)?(c=Tf(r,c),f=[i,o,s,a,c]):f=[i,o,s,a]):f=[i],l.push(f),r.pos++}p||RJ(l),n.push(l),r.pos=u+1}while(r.pos<=e);return n}function RJ(t){t.sort(AJ)}function AJ(t,e){return t[0]-e[0]}var DJ=/^[\w+.-]+:\/\//,OJ=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,LJ=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i,It;(function(t){t[t.Empty=1]="Empty",t[t.Hash=2]="Hash",t[t.Query=3]="Query",t[t.RelativePath=4]="RelativePath",t[t.AbsolutePath=5]="AbsolutePath",t[t.SchemeRelative=6]="SchemeRelative",t[t.Absolute=7]="Absolute"})(It||(It={}));function NJ(t){return DJ.test(t)}function MJ(t){return t.startsWith("//")}function W1(t){return t.startsWith("/")}function BJ(t){return t.startsWith("file:")}function U1(t){return/^[.?#]/.test(t)}function py(t){let e=OJ.exec(t);return H1(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}function FJ(t){let e=LJ.exec(t),r=e[2];return H1("file:","",e[1]||"","",W1(r)?r:"/"+r,e[3]||"",e[4]||"")}function H1(t,e,r,n,i,o,s){return{scheme:t,user:e,host:r,port:n,path:i,query:o,hash:s,type:It.Absolute}}function j1(t){if(MJ(t)){let r=py("http:"+t);return r.scheme="",r.type=It.SchemeRelative,r}if(W1(t)){let r=py("http://foo.com"+t);return r.scheme="",r.host="",r.type=It.AbsolutePath,r}if(BJ(t))return FJ(t);if(NJ(t))return py(t);let e=py("http://foo.com/"+t);return e.scheme="",e.host="",e.type=t?t.startsWith("?")?It.Query:t.startsWith("#")?It.Hash:It.RelativePath:It.Empty,e}function UJ(t){if(t.endsWith("/.."))return t;let e=t.lastIndexOf("/");return t.slice(0,e+1)}function jJ(t,e){q1(e,e.type),t.path==="/"?t.path=e.path:t.path=UJ(e.path)+t.path}function q1(t,e){let r=e<=It.RelativePath,n=t.path.split("/"),i=1,o=0,s=!1;for(let c=1;c<n.length;c++){let u=n[c];if(!u){s=!0;continue}if(s=!1,u!=="."){if(u===".."){o?(s=!0,o--,i--):r&&(n[i++]=u);continue}n[i++]=u,o++}}let a="";for(let c=1;c<i;c++)a+="/"+n[c];(!a||s&&!a.endsWith("/.."))&&(a+="/"),t.path=a}function $1(t,e){if(!t&&!e)return"";let r=j1(t),n=r.type;if(e&&n!==It.Absolute){let o=j1(e),s=o.type;switch(n){case It.Empty:r.hash=o.hash;case It.Hash:r.query=o.query;case It.Query:case It.RelativePath:jJ(r,o);case It.AbsolutePath:r.user=o.user,r.host=o.host,r.port=o.port;case It.SchemeRelative:r.scheme=o.scheme}s>n&&(n=s)}q1(r,n);let i=r.query+r.hash;switch(n){case It.Hash:case It.Query:return i;case It.RelativePath:{let o=r.path.slice(1);return o?U1(e||t)&&!U1(o)?"./"+o+i:o+i:i||"."}case It.AbsolutePath:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}function HJ(t){if(!t)return"";let e=t.lastIndexOf("/");return t.slice(0,e+1)}function qJ(t,e){let r=HJ(t),n=e?e+"/":"";return i=>$1(n+(i||""),r)}var ai=0,AI=1,DI=2,OI=3,G1=4,z1=1,K1=2;function $J(t,e){let r=V1(t,0);if(r===t.length)return t;e||(t=t.slice());for(let n=r;n<t.length;n=V1(t,n+1))t[n]=GJ(t[n],e);return t}function V1(t,e){for(let r=e;r<t.length;r++)if(!VJ(t[r]))return r;return t.length}function VJ(t){for(let e=1;e<t.length;e++)if(t[e][ai]<t[e-1][ai])return!1;return!0}function GJ(t,e){return e||(t=t.slice()),t.sort(J1)}function J1(t,e){return t[ai]-e[ai]}function zJ(t,e){let r=e.map(()=>[]);for(let n=0;n<t.length;n++){let i=t[n];for(let o=0;o<i.length;o++){let s=i[o];if(s.length===1)continue;let a=s[AI],c=s[DI],u=s[OI],l=r[a];(l[c]||(l[c]=[])).push([u,n,s[ai]])}}for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let s=i[o];s&&s.sort(J1)}}return r}var Za=!1;function KJ(t,e,r,n){for(;r<=n;){let i=r+(n-r>>1),o=t[i][ai]-e;if(o===0)return Za=!0,i;o<0?r=i+1:n=i-1}return Za=!1,r-1}function X1(t,e,r){for(let n=r+1;n<t.length&&t[n][ai]===e;r=n++);return r}function Y1(t,e,r){for(let n=r-1;n>=0&&t[n][ai]===e;r=n--);return r}function Q1(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function JJ(t,e,r,n){let{lastKey:i,lastNeedle:o,lastIndex:s}=r,a=0,c=t.length-1;if(n===i){if(e===o)return Za=s!==-1&&t[s][ai]===e,s;e>=o?a=s===-1?0:s:c=s}return r.lastKey=n,r.lastNeedle=e,r.lastIndex=KJ(t,e,a,c)}function LI(t){return typeof t=="string"?JSON.parse(t):t}var fy=function(t,e){let r=LI(t);if(!("sections"in r))return new hy(r,e);let n=[],i=[],o=[],s=[],a=[];Z1(r,e,n,i,o,s,a,0,0,1/0,1/0);let c={version:3,file:r.file,names:s,sources:i,sourcesContent:o,mappings:n,ignoreList:a};return QJ(c)};function Z1(t,e,r,n,i,o,s,a,c,u,l){let{sections:p}=t;for(let d=0;d<p.length;d++){let{map:f,offset:h}=p[d],m=u,x=l;if(d+1<p.length){let C=p[d+1].offset;m=Math.min(u,a+C.line),m===u?x=Math.min(l,c+C.column):m<u&&(x=c+C.column)}XJ(f,e,r,n,i,o,s,a+h.line,c+h.column,m,x)}}function XJ(t,e,r,n,i,o,s,a,c,u,l){let p=LI(t);if("sections"in p)return Z1(...arguments);let d=new hy(p,e),f=n.length,h=o.length,m=ec(d),{resolvedSources:x,sourcesContent:C,ignoreList:O}=d;if(RI(n,x),RI(o,d.names),C)RI(i,C);else for(let y=0;y<x.length;y++)i.push(null);if(O)for(let y=0;y<O.length;y++)s.push(O[y]+f);for(let y=0;y<m.length;y++){let T=a+y;if(T>u)return;let E=YJ(r,T),M=y===0?c:0,k=m[y];for(let A=0;A<k.length;A++){let W=k[A],Z=M+W[ai];if(T===u&&Z>=l)return;if(W.length===1){E.push([Z]);continue}let _=f+W[AI],B=W[DI],F=W[OI];E.push(W.length===4?[Z,_,B,F]:[Z,_,B,F,h+W[G1]])}}}function RI(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}function YJ(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}var eO="`line` must be greater than 0 (lines start at line 1)",tO="`column` must be greater than or equal to 0 (columns start at column 0)",ju=-1,Fo=1,hy=class{constructor(t,e){let r=typeof t=="string";if(!r&&t._decodedMemo)return t;let n=LI(t),{version:i,file:o,names:s,sourceRoot:a,sources:c,sourcesContent:u}=n;this.version=i,this.file=o,this.names=s||[],this.sourceRoot=a,this.sources=c,this.sourcesContent=u,this.ignoreList=n.ignoreList||n.x_google_ignoreList||void 0;let l=qJ(e,a);this.resolvedSources=c.map(l);let{mappings:p}=n;if(typeof p=="string")this._encoded=p,this._decoded=void 0;else if(Array.isArray(p))this._encoded=void 0,this._decoded=$J(p,r);else throw n.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(n)}`);this._decodedMemo=Q1(),this._bySources=void 0,this._bySourceMemos=void 0}};function ec(t){var e;return(e=t)._decoded||(e._decoded=F1(t._encoded))}function rO(t,e){let{line:r,column:n,bias:i}=e;if(r--,r<0)throw new Error(eO);if(n<0)throw new Error(tO);let o=ec(t);if(r>=o.length)return dy(null,null,null,null);let s=o[r],a=NI(s,t._decodedMemo,r,n,i||Fo);if(a===-1)return dy(null,null,null,null);let c=s[a];if(c.length===1)return dy(null,null,null,null);let{names:u,resolvedSources:l}=t;return dy(l[c[AI]],c[DI]+1,c[OI],c.length===5?u[c[G1]]:null)}function nO(t,e){let{source:r,line:n,column:i,bias:o}=e;return sO(t,r,n,i,o||Fo,!1)}function iO(t,e){let{source:r,line:n,column:i,bias:o}=e;return sO(t,r,n,i,o||ju,!0)}function oO(t,e){let r=ec(t),{names:n,resolvedSources:i}=t;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let c=s[a],u=o+1,l=c[0],p=null,d=null,f=null,h=null;c.length!==1&&(p=i[c[1]],d=c[2]+1,f=c[3]),c.length===5&&(h=n[c[4]]),e({generatedLine:u,generatedColumn:l,source:p,originalLine:d,originalColumn:f,name:h})}}}function QJ(t,e){let r=new hy(ZJ(t,[]),e);return r._decoded=t.mappings,r}function ZJ(t,e){return{version:t.version,file:t.file,names:t.names,sourceRoot:t.sourceRoot,sources:t.sources,sourcesContent:t.sourcesContent,mappings:e,ignoreList:t.ignoreList||t.x_google_ignoreList}}function dy(t,e,r,n){return{source:t,line:e,column:r,name:n}}function Pf(t,e){return{line:t,column:e}}function NI(t,e,r,n,i){let o=JJ(t,n,e,r);return Za?o=(i===ju?X1:Y1)(t,n,o):i===ju&&o++,o===-1||o===t.length?-1:o}function eX(t,e,r,n,i){let o=NI(t,e,r,n,Fo);if(!Za&&i===ju&&o++,o===-1||o===t.length)return[];let s=Za?n:t[o][ai];Za||(o=Y1(t,s,o));let a=X1(t,s,o),c=[];for(;o<=a;o++){let u=t[o];c.push(Pf(u[z1]+1,u[K1]))}return c}function sO(t,e,r,n,i,o){var s,a;if(r--,r<0)throw new Error(eO);if(n<0)throw new Error(tO);let{sources:c,resolvedSources:u}=t,l=c.indexOf(e);if(l===-1&&(l=u.indexOf(e)),l===-1)return o?[]:Pf(null,null);let p=(s=t)._bySourceMemos||(s._bySourceMemos=c.map(Q1)),f=((a=t)._bySources||(a._bySources=zJ(ec(t),p)))[l][r];if(f==null)return o?[]:Pf(null,null);let h=p[l];if(o)return eX(f,h,r,n,i);let m=NI(f,h,r,n,i);if(m===-1)return Pf(null,null);let x=f[m];return Pf(x[z1]+1,x[K1])}var Yi=v(H());var my=class extends Error{constructor(r,n,i){super(`Unexpected ${r} response from ${n}: ${i??"<empty body>"}`);this.statusCode=r;this.url=n;this.body=i}},tc=Symbol("IResourceProvider");var _e=t=>isFinite(t)?new Promise(e=>setTimeout(e,t)):new Promise(()=>{}),aO=(t,e)=>{let r=setTimeout(t,e);return{dispose:()=>clearTimeout(r)}};function qi(t){return new Promise((e,r)=>{let n=t.length;for(let i of t)i.then(o=>{o?(e(o),n=-1):--n===0&&e(void 0)}).catch(r)})}async function cO(t,e){for(let r=0;r<t.length;r++)if(await e(t[r]))return r;return-1}function Ue(){let t=null,e=null,r=!1,n,i=new Promise((o,s)=>{t=a=>{r=!0,n=a,o(a)},e=a=>{r=!0,s(a)}});return{resolve:t,reject:e,promise:i,get settledValue(){return n},hasSettled:()=>r}}var Ke=v(ge());var q=class extends Error{get cause(){return this._cause}constructor(e){super("__errorMarker"in e?e.error.format:e.format),this._cause="__errorMarker"in e?e.error:e}};function uO(t,e){t.output({category:"console",output:e+`
`})}function Ve(t,e=9222){return{__errorMarker:!0,error:{id:e,format:t,showUser:!1}}}function Ge(t,e=9223){return{__errorMarker:!0,error:{id:e,format:t,showUser:!0}}}var MI=()=>Ge(Ke.t("Attribute 'runtimeVersion' requires Node.js version manager 'nvs', 'nvm' or 'fnm' to be installed."),9224),lO=()=>Ge(Ke.t("Attribute 'runtimeVersion' with a flavor/architecture requires 'nvs' to be installed."),9225),pO=()=>Ge(Ke.t("Attribute 'runtimeVersion' requires Node.js version manager 'nvm-windows' or 'nvs'."),9226),BI=(t,e)=>Ge(Ke.t("Node.js version '{0}' not installed using version manager {1}.",t,e),9226),dO=t=>Ge(Ke.t("Cannot launch debug target in terminal ({0}).",t),9227),fO=t=>Ge(Ke.t("Can't load environment variables from file ({0}).",t),9228),hO=t=>Ge(Ke.t("The configured `cwd` {0} does not exist.",t),9245),FI=(t,e)=>Ge(Ke.t(`Can't find Node.js binary "{0}": {1}. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json`,t,e),9229),mO=(t,e)=>Ge(Ke.t('The Node version in "{0}" is outdated (version {1}), we require at least Node 8.x.',e,t),9230),UI=t=>Ge(Ke.t('Invalid hit condition "{0}". Expected an expression like "> 42" or "== 2".',t),9231),Wu=()=>Ge(Ke.t("An error occurred taking a profile from the target."),9235),gO=()=>Ge(Ke.t("Please stop the running profile before starting a new one."),9236),yO=t=>Ve(t,9238),gy=(t,e,r)=>Ge(e==="*"&&!r.length?Ke.t('Unable to find an installation of the browser on your system. Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json.'):Ke.t('Unable to find {0} version {1}. Available auto-discovered versions are: {2}. You can set the "runtimeExecutable" in your launch.json to one of these, or provide an absolute path to the browser executable.',t,e,JSON.stringify([...new Set(r)])),9233),Cs=t=>Ge(Ke.t('Unable to launch browser: "{0}"',t.message),9240),$i=t=>Ge(t??Ke.t("Unable to attach to browser"),9242),yy=()=>Ge(Ke.t('Target page not found. You may need to update your "urlFilter" to match the page you want to debug.'),9241);var bO=()=>Ve(Ke.t("Variables not available in async stacks"),9234),Ts=(t,e)=>Ge(Ke.t("Syntax error setting breakpoint with condition {0} on line {1}: {2}",JSON.stringify(t.condition),t.line,e),9237),jI=()=>Ve(Ke.t("Thread not found"),9244),by=(t,e)=>Ge(Ke.t("Could not read source map for {0}: {1}",t,e)),vO=()=>Ge(Ke.t("UWP webview debugging is not available on your platform.")),wO=()=>Ge(Ke.t("Networking not available.")),SO=()=>Ge(Ke.t("Could not connect to any UWP Webview pipe. Make sure your webview is hosted in debug mode, and that the `pipeName` in your `launch.json` is correct.")),Ef=()=>Ge(Ke.t("Could not find a location for the variable")),_O=()=>Ve(Ke.t('Missing source information. Did you set "originalUrl" or "source"?')),xO=t=>typeof t=="object"&&!!t&&"__errorMarker"in t,IO=(t,e)=>t instanceof q&&t.cause.id===e,CO=t=>Ge(Ke.t("The browser process exited with code {0} before connecting to the debug server. Make sure the `runtimeExecutable` is configured correctly and that it can run without errors.",t));var TO=new WeakSet;var tX="Request",rX=t=>t.endsWith("Request"),Ur=Symbol("IDapApi"),qu=Symbol("IRootDapApi"),Hu=class{constructor(e,r){this.transport=e;this.logger=r;this._pendingRequests=new Map;this._requestHandlers=new Map;this._eventListeners=new Map;this.disposables=[];this._initialized=Ue();this.closed=!1;this._sequence=1,this.disposables.push(this.transport.messageReceived(n=>this._onMessage(n.message,n.receivedTime))),this._dap=this._createApi()}get initializedBlocker(){return this._initialized.promise}attachTelemetry(e){this.telemetryReporter=e,e.attachDap(this._dap)}dap(){return this._dap}_createApi(){return new Proxy({},{get:(e,r)=>{if(r!=="then")return r==="on"?(n,i)=>(this._requestHandlers.set(n,i),()=>this._requestHandlers.delete(n)):r==="off"?n=>this._requestHandlers.delete(n):n=>{if(rX(r))return this.enqueueRequest(r.slice(0,-tX.length),n);this._send({seq:0,type:"event",event:r,body:n})}}})}createTestApi(){let e=(i,o)=>{let s=this._eventListeners.get(i);s||(s=new Set,this._eventListeners.set(i,s)),s.add(o)},r=(i,o)=>{let s=this._eventListeners.get(i);s&&s.delete(o)},n=(i,o)=>new Promise(s=>{let a=c=>{o&&!o(c)||(r(i,a),s(c))};e(i,a)});return new Proxy({},{get:(i,o)=>o==="on"?e:o==="off"?r:o==="once"?n:s=>this.enqueueRequest(o,s)})}enqueueRequest(e,r){return new Promise(n=>{let i={seq:0,type:"request",command:e,arguments:r||{}};this._send(i),this._pendingRequests.set(i.seq,n)})}stop(){this.closed=!0,this.transport.close()}_send(e,r){if(this.closed)this.logger.warn("dap.send","Not sending message because the connection has ended",e),r?.();else{e.seq=this._sequence++;let n=e.type!=="event"||!TO.has(e.body);this.transport.send(e,n,r)}}async _onMessage(e,r){if(e.type==="request"){let n={seq:0,type:"response",request_seq:e.seq,command:e.command,success:!0};try{let i=this._requestHandlers.get(e.command);if(!i)console.error(`Unknown request: ${e.command}`);else{let o=await i(e.arguments);if(xO(o))this._send({...n,success:!1,message:o.error.format,body:{error:o.error}});else{let s={...n,body:o};n.command==="initialize"?(this._send(s),this._initialized.resolve(this)):n.command==="disconnect"?this._send({...n,body:o},()=>{this.stop()}):this._send(s)}}this.telemetryReporter?.reportOperation("dapOperation",e.command,r.elapsed().ms)}catch(i){i instanceof q?this._send({...n,success:!1,body:{error:i.cause}}):(console.error(i),this._send({...n,success:!1,body:{error:{id:9221,format:`Error processing ${e.command}: ${i.stack||i.message}`,showUser:!1,sendTelemetry:!1}}})),this.telemetryReporter?.reportOperation("dapOperation",e.command,r.elapsed().ms,i)}}if(e.type==="event"){let n=this._eventListeners.get(e.event)||new Set;for(let i of n)i(e.body)}if(e.type==="response"){let n=this._pendingRequests.get(e.request_seq);if(!this.logger.assert(n,`Expected callback for request sequence ID ${e.request_seq}`))return;if(this._pendingRequests.delete(e.request_seq),e.success)n(e.body);else{let i=e.body?.error?.format;n(i||e.message||"Unknown error")}}}};var wy=class{constructor(e,r){this.key=e;this.value=r}toString(){return`${this.key}: ${this.value}`}},Vi=class{constructor(e,r){this.projection=e;this.initialContents=r;let n=Array.from(r||[]).map(i=>[this.projection(i[0]),new wy(i[0],i[1])]);this.projectionToKeyAndValue=new Map(n)}clear(){this.projectionToKeyAndValue.clear()}delete(e){let r=this.projection(e);return this.projectionToKeyAndValue.delete(r)}forEach(e,r){this.projectionToKeyAndValue.forEach(n=>{e.call(r,n.value,n.key,this)},r)}get(e){let r=this.projection(e),n=this.projectionToKeyAndValue.get(r);return n?n.value:void 0}has(e){return this.projectionToKeyAndValue.has(this.projection(e))}set(e,r){return this.projectionToKeyAndValue.set(this.projection(e),new wy(e,r)),this}get size(){return this.projectionToKeyAndValue.size}*entries(){for(let e of this.projectionToKeyAndValue.values())yield[e.key,e.value]}*keys(){for(let e of this.projectionToKeyAndValue.values())yield e.key}*values(){for(let e of this.projectionToKeyAndValue.values())yield e.value}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return JSON.stringify(Array.from(this.entries()))}toString(){return`MapUsingProjection<${JSON.stringify([...this.entries()])}>`}};var je=Symbol("ISourcePathResolver");var sL=require("dns"),an=v(require("path")),Ji=require("url");var ZO=require("url");var XO=require("./vendor/acorn.js"),YO=require("crypto");var tt=class{constructor(e,r){this.lineNumber=e;this.columnNumber=r}get base0(){return this}get base1(){return new ct(this.lineNumber+1,this.columnNumber+1)}get base01(){return new jr(this.lineNumber,this.columnNumber+1)}compare(e){let r=e.base0;return this.lineNumber-r.lineNumber||this.columnNumber-r.columnNumber}},ct=class{constructor(e,r){this.lineNumber=e;this.columnNumber=r}get base0(){return new tt(this.lineNumber-1,this.columnNumber-1)}get base1(){return this}get base01(){return new jr(this.lineNumber-1,this.columnNumber)}compare(e){let r=e.base1;return this.lineNumber-r.lineNumber||this.columnNumber-r.columnNumber||0}},jr=class{constructor(e,r){this.lineNumber=e;this.columnNumber=r}get base0(){return new tt(this.lineNumber-1,this.columnNumber)}get base1(){return new ct(this.lineNumber,this.columnNumber+1)}get base01(){return this}compare(e){let r=e.base01;return this.lineNumber-r.lineNumber||this.columnNumber-r.columnNumber}},vr=class t{constructor(e,r){this.begin=e;this.end=r}static{this.ZERO=new t(new tt(0,0),new tt(0,0))}static{this.INFINITE=new t(new tt(0,0),new tt(1/0,1/0))}static simplify(e){if(e.length===0)return[];let r=e.slice().sort((o,s)=>o.begin.compare(s.begin)),n=[],i=r[0];for(let o=1;o<r.length;o++){let s=r[o];i.end.compare(s.begin)>=0?i=new t(i.begin,s.end):(n.push(i),i=s)}return n.push(i),n}contains(e){return e.compare(this.begin)>=0&&e.compare(this.end)<=0}containsRange(e){return this.contains(e.begin)&&this.contains(e.end)}toString(){let e=this.begin.base0,r=this.end.base0;return`Range[${e.lineNumber}:${e.columnNumber} -> ${r.lineNumber}:${r.columnNumber}]`}};var WI=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function nX(t,e){return t._indexes[e]}function HI(t,e){let r=nX(t,e);if(r!==void 0)return r;let{array:n,_indexes:i}=t,o=n.push(e);return i[e]=o-1}var iX=0,oX=1,sX=2,aX=3,cX=4,EO=-1,kO=class{constructor({file:t,sourceRoot:e}={}){this._names=new WI,this._sources=new WI,this._sourcesContent=[],this._mappings=[],this.file=t,this.sourceRoot=e,this._ignoreList=new WI}};function RO(t,e,r,n,i,o,s,a){return uX(!1,t,e,r,n,i,o,s,a)}function AO(t,e,r){let{_sources:n,_sourcesContent:i}=t,o=HI(n,e);i[o]=r}function DO(t){let{_mappings:e,_sources:r,_sourcesContent:n,_names:i,_ignoreList:o}=t;return dX(e),{version:3,file:t.file||void 0,names:i.array,sourceRoot:t.sourceRoot||void 0,sources:r.array,sourcesContent:n,mappings:e,ignoreList:o.array}}function uX(t,e,r,n,i,o,s,a,c){let{_mappings:u,_sources:l,_sourcesContent:p,_names:d}=e,f=lX(u,r),h=pX(f,n);if(!i)return t&&fX(f,h)?void 0:PO(f,h,[n]);let m=HI(l,i),x=a?HI(d,a):EO;if(m===p.length&&(p[m]=c??null),!(t&&hX(f,h,m,o,s,x)))return PO(f,h,a?[n,m,o,s,x]:[n,m,o,s])}function lX(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}function pX(t,e){let r=t.length;for(let n=r-1;n>=0;r=n--){let i=t[n];if(e>=i[iX])break}return r}function PO(t,e,r){for(let n=t.length;n>e;n--)t[n]=t[n-1];t[e]=r}function dX(t){let{length:e}=t,r=e;for(let n=r-1;n>=0&&!(t[n].length>0);r=n,n--);r<e&&(t.length=r)}function fX(t,e){return e===0?!0:t[e-1].length===1}function hX(t,e,r,n,i,o){if(e===0)return!1;let s=t[e-1];return s.length===1?!1:r===s[oX]&&n===s[sX]&&i===s[aX]&&o===(s.length===5?s[cX]:EO)}var Ey=require("./vendor/acorn.js");var{stringify:gX}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");var Sy={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},ci=17,yX={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:ci,ClassExpression:ci,FunctionExpression:ci,ObjectExpression:ci,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function $u(t,e){let{generator:r}=t;if(t.write("("),e!=null&&e.length>0){r[e[0].type](e[0],t);let{length:n}=e;for(let i=1;i<n;i++){let o=e[i];t.write(", "),r[o.type](o,t)}}t.write(")")}function UO(t,e,r,n){let i=t.expressionsPrecedence[e.type];if(i===ci)return!0;let o=t.expressionsPrecedence[r.type];return i!==o?!n&&i===15&&o===14&&r.operator==="**"||i<o:i!==13&&i!==14?!1:e.operator==="**"&&r.operator==="**"?!n:i===13&&o===13&&(e.operator==="??"||r.operator==="??")?!0:n?Sy[e.operator]<=Sy[r.operator]:Sy[e.operator]<Sy[r.operator]}function _y(t,e,r,n){let{generator:i}=t;UO(t,e,r,n)?(t.write("("),i[e.type](e,t),t.write(")")):i[e.type](e,t)}function bX(t,e,r,n){let i=e.split(`
`),o=i.length-1;if(t.write(i[0].trim()),o>0){t.write(n);for(let s=1;s<o;s++)t.write(r+i[s].trim()+n);t.write(r+i[o].trim())}}function kr(t,e,r,n){let{length:i}=e;for(let o=0;o<i;o++){let s=e[o];t.write(r),s.type[0]==="L"?t.write("// "+s.value.trim()+`
`,s):(t.write("/*"),bX(t,s.value,r,n),t.write("*/"+n))}}function vX(t){let e=t;for(;e!=null;){let{type:r}=e;if(r[0]==="C"&&r[1]==="a")return!0;if(r[0]==="M"&&r[1]==="e"&&r[2]==="m")e=e.object;else return!1}}function qI(t,e){let{generator:r}=t,{declarations:n}=e;t.write(e.kind+" ");let{length:i}=n;if(i>0){r.VariableDeclarator(n[0],t);for(let o=1;o<i;o++)t.write(", "),r.VariableDeclarator(n[o],t)}}var OO,LO,NO,MO,BO,FO,wX={Program(t,e){let r=e.indent.repeat(e.indentLevel),{lineEnd:n,writeComments:i}=e;i&&t.comments!=null&&kr(e,t.comments,r,n);let o=t.body,{length:s}=o;for(let a=0;a<s;a++){let c=o[a];i&&c.comments!=null&&kr(e,c.comments,r,n),e.write(r),this[c.type](c,e),e.write(n)}i&&t.trailingComments!=null&&kr(e,t.trailingComments,r,n)},BlockStatement:FO=function(t,e){let r=e.indent.repeat(e.indentLevel++),{lineEnd:n,writeComments:i}=e,o=r+e.indent;e.write("{");let s=t.body;if(s!=null&&s.length>0){e.write(n),i&&t.comments!=null&&kr(e,t.comments,o,n);let{length:a}=s;for(let c=0;c<a;c++){let u=s[c];i&&u.comments!=null&&kr(e,u.comments,o,n),e.write(o),this[u.type](u,e),e.write(n)}e.write(r)}else i&&t.comments!=null&&(e.write(n),kr(e,t.comments,o,n),e.write(r));i&&t.trailingComments!=null&&kr(e,t.trailingComments,o,n),e.write("}"),e.indentLevel--},ClassBody:FO,StaticBlock(t,e){e.write("static "),this.BlockStatement(t,e)},EmptyStatement(t,e){e.write(";")},ExpressionStatement(t,e){let r=e.expressionsPrecedence[t.expression.type];r===ci||r===3&&t.expression.left.type[0]==="O"?(e.write("("),this[t.expression.type](t.expression,e),e.write(")")):this[t.expression.type](t.expression,e),e.write(";")},IfStatement(t,e){e.write("if ("),this[t.test.type](t.test,e),e.write(") "),this[t.consequent.type](t.consequent,e),t.alternate!=null&&(e.write(" else "),this[t.alternate.type](t.alternate,e))},LabeledStatement(t,e){this[t.label.type](t.label,e),e.write(": "),this[t.body.type](t.body,e)},BreakStatement(t,e){e.write("break"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},ContinueStatement(t,e){e.write("continue"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},WithStatement(t,e){e.write("with ("),this[t.object.type](t.object,e),e.write(") "),this[t.body.type](t.body,e)},SwitchStatement(t,e){let r=e.indent.repeat(e.indentLevel++),{lineEnd:n,writeComments:i}=e;e.indentLevel++;let o=r+e.indent,s=o+e.indent;e.write("switch ("),this[t.discriminant.type](t.discriminant,e),e.write(") {"+n);let{cases:a}=t,{length:c}=a;for(let u=0;u<c;u++){let l=a[u];i&&l.comments!=null&&kr(e,l.comments,o,n),l.test?(e.write(o+"case "),this[l.test.type](l.test,e),e.write(":"+n)):e.write(o+"default:"+n);let{consequent:p}=l,{length:d}=p;for(let f=0;f<d;f++){let h=p[f];i&&h.comments!=null&&kr(e,h.comments,s,n),e.write(s),this[h.type](h,e),e.write(n)}}e.indentLevel-=2,e.write(r+"}")},ReturnStatement(t,e){e.write("return"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e)),e.write(";")},ThrowStatement(t,e){e.write("throw "),this[t.argument.type](t.argument,e),e.write(";")},TryStatement(t,e){if(e.write("try "),this[t.block.type](t.block,e),t.handler){let{handler:r}=t;r.param==null?e.write(" catch "):(e.write(" catch ("),this[r.param.type](r.param,e),e.write(") ")),this[r.body.type](r.body,e)}t.finalizer&&(e.write(" finally "),this[t.finalizer.type](t.finalizer,e))},WhileStatement(t,e){e.write("while ("),this[t.test.type](t.test,e),e.write(") "),this[t.body.type](t.body,e)},DoWhileStatement(t,e){e.write("do "),this[t.body.type](t.body,e),e.write(" while ("),this[t.test.type](t.test,e),e.write(");")},ForStatement(t,e){if(e.write("for ("),t.init!=null){let{init:r}=t;r.type[0]==="V"?qI(e,r):this[r.type](r,e)}e.write("; "),t.test&&this[t.test.type](t.test,e),e.write("; "),t.update&&this[t.update.type](t.update,e),e.write(") "),this[t.body.type](t.body,e)},ForInStatement:OO=function(t,e){e.write(`for ${t.await?"await ":""}(`);let{left:r}=t;r.type[0]==="V"?qI(e,r):this[r.type](r,e),e.write(t.type[3]==="I"?" in ":" of "),this[t.right.type](t.right,e),e.write(") "),this[t.body.type](t.body,e)},ForOfStatement:OO,DebuggerStatement(t,e){e.write("debugger;",t)},FunctionDeclaration:LO=function(t,e){e.write((t.async?"async ":"")+(t.generator?"function* ":"function ")+(t.id?t.id.name:""),t),$u(e,t.params),e.write(" "),this[t.body.type](t.body,e)},FunctionExpression:LO,VariableDeclaration(t,e){qI(e,t),e.write(";")},VariableDeclarator(t,e){this[t.id.type](t.id,e),t.init!=null&&(e.write(" = "),this[t.init.type](t.init,e))},ClassDeclaration(t,e){if(e.write("class "+(t.id?`${t.id.name} `:""),t),t.superClass){e.write("extends ");let{superClass:r}=t,{type:n}=r,i=e.expressionsPrecedence[n];(n[0]!=="C"||n[1]!=="l"||n[5]!=="E")&&(i===ci||i<e.expressionsPrecedence.ClassExpression)?(e.write("("),this[t.superClass.type](r,e),e.write(")")):this[r.type](r,e),e.write(" ")}this.ClassBody(t.body,e)},ImportDeclaration(t,e){e.write("import ");let{specifiers:r}=t,{length:n}=r,i=0;if(n>0){for(;i<n;){i>0&&e.write(", ");let o=r[i],s=o.type[6];if(s==="D")e.write(o.local.name,o),i++;else if(s==="N")e.write("* as "+o.local.name,o),i++;else break}if(i<n){for(e.write("{");;){let o=r[i],{name:s}=o.imported;if(e.write(s,o),s!==o.local.name&&e.write(" as "+o.local.name),++i<n)e.write(", ");else break}e.write("}")}e.write(" from ")}this.Literal(t.source,e),e.write(";")},ImportExpression(t,e){e.write("import("),this[t.source.type](t.source,e),e.write(")")},ExportDefaultDeclaration(t,e){e.write("export default "),this[t.declaration.type](t.declaration,e),e.expressionsPrecedence[t.declaration.type]!=null&&t.declaration.type[0]!=="F"&&e.write(";")},ExportNamedDeclaration(t,e){if(e.write("export "),t.declaration)this[t.declaration.type](t.declaration,e);else{e.write("{");let{specifiers:r}=t,{length:n}=r;if(n>0)for(let i=0;;){let o=r[i],{name:s}=o.local;if(e.write(s,o),s!==o.exported.name&&e.write(" as "+o.exported.name),++i<n)e.write(", ");else break}e.write("}"),t.source&&(e.write(" from "),this.Literal(t.source,e)),e.write(";")}},ExportAllDeclaration(t,e){t.exported!=null?e.write("export * as "+t.exported.name+" from "):e.write("export * from "),this.Literal(t.source,e),e.write(";")},MethodDefinition(t,e){t.static&&e.write("static ");let r=t.kind[0];(r==="g"||r==="s")&&e.write(t.kind+" "),t.value.async&&e.write("async "),t.value.generator&&e.write("*"),t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),$u(e,t.value.params),e.write(" "),this[t.value.body.type](t.value.body,e)},ClassExpression(t,e){this.ClassDeclaration(t,e)},ArrowFunctionExpression(t,e){e.write(t.async?"async ":"",t);let{params:r}=t;r!=null&&(r.length===1&&r[0].type[0]==="I"?e.write(r[0].name,r[0]):$u(e,t.params)),e.write(" => "),t.body.type[0]==="O"?(e.write("("),this.ObjectExpression(t.body,e),e.write(")")):this[t.body.type](t.body,e)},ThisExpression(t,e){e.write("this",t)},Super(t,e){e.write("super",t)},RestElement:NO=function(t,e){e.write("..."),this[t.argument.type](t.argument,e)},SpreadElement:NO,YieldExpression(t,e){e.write(t.delegate?"yield*":"yield"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e))},AwaitExpression(t,e){e.write("await ",t),_y(e,t.argument,t)},TemplateLiteral(t,e){let{quasis:r,expressions:n}=t;e.write("`");let{length:i}=n;for(let s=0;s<i;s++){let a=n[s],c=r[s];e.write(c.value.raw,c),e.write("${"),this[a.type](a,e),e.write("}")}let o=r[r.length-1];e.write(o.value.raw,o),e.write("`")},TemplateElement(t,e){e.write(t.value.raw,t)},TaggedTemplateExpression(t,e){_y(e,t.tag,t),this[t.quasi.type](t.quasi,e)},ArrayExpression:BO=function(t,e){if(e.write("["),t.elements.length>0){let{elements:r}=t,{length:n}=r;for(let i=0;;){let o=r[i];if(o!=null&&this[o.type](o,e),++i<n)e.write(", ");else{o==null&&e.write(", ");break}}}e.write("]")},ArrayPattern:BO,ObjectExpression(t,e){let r=e.indent.repeat(e.indentLevel++),{lineEnd:n,writeComments:i}=e,o=r+e.indent;if(e.write("{"),t.properties.length>0){e.write(n),i&&t.comments!=null&&kr(e,t.comments,o,n);let s=","+n,{properties:a}=t,{length:c}=a;for(let u=0;;){let l=a[u];if(i&&l.comments!=null&&kr(e,l.comments,o,n),e.write(o),this[l.type](l,e),++u<c)e.write(s);else break}e.write(n),i&&t.trailingComments!=null&&kr(e,t.trailingComments,o,n),e.write(r+"}")}else i?t.comments!=null?(e.write(n),kr(e,t.comments,o,n),t.trailingComments!=null&&kr(e,t.trailingComments,o,n),e.write(r+"}")):t.trailingComments!=null?(e.write(n),kr(e,t.trailingComments,o,n),e.write(r+"}")):e.write("}"):e.write("}");e.indentLevel--},Property(t,e){t.method||t.kind[0]!=="i"?this.MethodDefinition(t,e):(t.shorthand||(t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),e.write(": ")),this[t.value.type](t.value,e))},PropertyDefinition(t,e){if(t.static&&e.write("static "),t.computed&&e.write("["),this[t.key.type](t.key,e),t.computed&&e.write("]"),t.value==null){t.key.type[0]!=="F"&&e.write(";");return}e.write(" = "),this[t.value.type](t.value,e),e.write(";")},ObjectPattern(t,e){if(e.write("{"),t.properties.length>0){let{properties:r}=t,{length:n}=r;for(let i=0;this[r[i].type](r[i],e),++i<n;)e.write(", ")}e.write("}")},SequenceExpression(t,e){$u(e,t.expressions)},UnaryExpression(t,e){if(t.prefix){let{operator:r,argument:n,argument:{type:i}}=t;e.write(r);let o=UO(e,n,t);!o&&(r.length>1||i[0]==="U"&&(i[1]==="n"||i[1]==="p")&&n.prefix&&n.operator[0]===r&&(r==="+"||r==="-"))&&e.write(" "),o?(e.write(r.length>1?" (":"("),this[i](n,e),e.write(")")):this[i](n,e)}else this[t.argument.type](t.argument,e),e.write(t.operator)},UpdateExpression(t,e){t.prefix?(e.write(t.operator),this[t.argument.type](t.argument,e)):(this[t.argument.type](t.argument,e),e.write(t.operator))},AssignmentExpression(t,e){this[t.left.type](t.left,e),e.write(" "+t.operator+" "),this[t.right.type](t.right,e)},AssignmentPattern(t,e){this[t.left.type](t.left,e),e.write(" = "),this[t.right.type](t.right,e)},BinaryExpression:MO=function(t,e){let r=t.operator==="in";r&&e.write("("),_y(e,t.left,t,!1),e.write(" "+t.operator+" "),_y(e,t.right,t,!0),r&&e.write(")")},LogicalExpression:MO,ConditionalExpression(t,e){let{test:r}=t,n=e.expressionsPrecedence[r.type];n===ci||n<=e.expressionsPrecedence.ConditionalExpression?(e.write("("),this[r.type](r,e),e.write(")")):this[r.type](r,e),e.write(" ? "),this[t.consequent.type](t.consequent,e),e.write(" : "),this[t.alternate.type](t.alternate,e)},NewExpression(t,e){e.write("new ");let r=e.expressionsPrecedence[t.callee.type];r===ci||r<e.expressionsPrecedence.CallExpression||vX(t.callee)?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),$u(e,t.arguments)},CallExpression(t,e){let r=e.expressionsPrecedence[t.callee.type];r===ci||r<e.expressionsPrecedence.CallExpression?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),t.optional&&e.write("?."),$u(e,t.arguments)},ChainExpression(t,e){this[t.expression.type](t.expression,e)},MemberExpression(t,e){let r=e.expressionsPrecedence[t.object.type];r===ci||r<e.expressionsPrecedence.MemberExpression?(e.write("("),this[t.object.type](t.object,e),e.write(")")):this[t.object.type](t.object,e),t.computed?(t.optional&&e.write("?."),e.write("["),this[t.property.type](t.property,e),e.write("]")):(t.optional?e.write("?."):e.write("."),this[t.property.type](t.property,e))},MetaProperty(t,e){e.write(t.meta.name+"."+t.property.name,t)},Identifier(t,e){e.write(t.name,t)},PrivateIdentifier(t,e){e.write(`#${t.name}`,t)},Literal(t,e){t.raw!=null?e.write(t.raw,t):t.regex!=null?this.RegExpLiteral(t,e):t.bigint!=null?e.write(t.bigint+"n",t):e.write(gX(t.value),t)},RegExpLiteral(t,e){let{regex:r}=t;e.write(`/${r.pattern}/${r.flags}`,t)}},SX={};var $I=class{constructor(e){let r=e??SX;this.output="",r.output!=null?(this.output=r.output,this.write=this.writeToStream):this.output="",this.generator=r.generator!=null?r.generator:wX,this.expressionsPrecedence=r.expressionsPrecedence!=null?r.expressionsPrecedence:yX,this.indent=r.indent!=null?r.indent:"  ",this.lineEnd=r.lineEnd!=null?r.lineEnd:`
`,this.indentLevel=r.startingIndentLevel!=null?r.startingIndentLevel:0,this.writeComments=r.comments?r.comments:!1,r.sourceMap!=null&&(this.write=r.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=r.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
`).length-1,this.mapping={original:null,generated:this,name:void 0,source:r.sourceMap.file||r.sourceMap._file})}write(e){this.output+=e}writeToStream(e){this.output.write(e)}writeAndMap(e,r){this.output+=e,this.map(e,r)}writeToStreamAndMap(e,r){this.output.write(e),this.map(e,r)}map(e,r){if(r!=null){let{type:o}=r;if(o[0]==="L"&&o[2]==="n"){this.column=0,this.line++;return}if(r.loc!=null){let{mapping:s}=this;s.original=r.loc.start,s.name=r.name,this.sourceMap.addMapping(s)}if(o[0]==="T"&&o[8]==="E"||o[0]==="L"&&o[1]==="i"&&typeof r.value=="string"){let{length:s}=e,{column:a,line:c}=this;for(let u=0;u<s;u++)e[u]===`
`?(a=0,c++):a++;this.column=a,this.line=c;return}}let{length:n}=e,{lineEnd:i}=this;n>0&&(this.lineEndSize>0&&(i.length===1?e[n-1]===i:e.endsWith(i))?(this.line+=this.lineEndSize,this.column=0):this.column+=n)}toString(){return this.output}};function Uo(t,e){let r=new $I(e);return r.generator[t.type](t,r),r.output}var jO=require("./vendor/acorn.js"),Cy=require("./vendor/acorn-loose.js");var xy={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},_X=Object.keys(xy);for(let t of _X)Object.freeze(xy[t]);Object.freeze(xy);var VI=xy;var GI={ecmaVersion:"latest",locations:!0,allowAwaitOutsideFunction:!0,allowImportExportEverywhere:!0,allowReserved:!0,allowReturnOutsideFunction:!0},Ps=t=>t.start,zI=t=>t.end,WO=(t,e)=>t.slice(Ps(e),zI(e)),Gi=(t,e=!1)=>(e?jO.parse:Cy.parse)(t,GI),kf=t=>{let e=Gi(t);for(let r of e.body)r.type==="FunctionDeclaration"&&r.id&&(0,Cy.isDummy)(r.id)&&(r.id=null);return e.body};function HO(t,e,r){return e.length>1||e[0].type!=="FunctionDeclaration"?VO(t,e,!0,r):qO(t,[{type:"ReturnStatement",argument:{type:"CallExpression",optional:!1,arguments:[{type:"ThisExpression"},...t.map(n=>({type:"Identifier",name:n}))],callee:{type:"MemberExpression",property:{type:"Identifier",name:"call"},computed:!1,optional:!1,object:{type:"FunctionExpression",params:e[0].params,body:e[0].body}}}}],!0,r)}var qO=(t,e,r,n)=>{let i={type:"Identifier",name:"e"},s=n?[{type:"TryStatement",block:{type:"BlockStatement",body:e},handler:{type:"CatchClause",param:i,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"MemberExpression",object:i,property:{type:"Identifier",name:"stack"},computed:!1,optional:!1},operator:"||",right:{type:"MemberExpression",object:i,property:{type:"Identifier",name:"message"},computed:!1,optional:!1}},operator:"||",right:{type:"CallExpression",callee:{type:"Identifier",name:"String"},arguments:[i],optional:!1}}}]}}}]:e;return r?{type:"FunctionExpression",id:{type:"Identifier",name:"_generatedCode"},params:t.map(a=>({type:"Identifier",name:a})),body:{type:"BlockStatement",body:s}}:{type:"ArrowFunctionExpression",params:t.map(a=>({type:"Identifier",name:a})),expression:!1,body:{type:"BlockStatement",body:s}}},IX=(t,e)=>({type:"CallExpression",arguments:t.map(r=>({type:"Identifier",name:r})),callee:e,optional:!1}),$O=(t,e,r)=>IX(t,VO(t,e,r,!0));function VO(t,e,r,n){let i=e[e.length-1];if(i.type!=="ReturnStatement"){let o=CX(i);o&&(e=[...e.slice(0,-1),{type:"ReturnStatement",argument:o}])}return qO(t,e,r,n)}function CX(t){switch(t.type){case"ExpressionStatement":return t.expression;case"BlockStatement":return{type:"CallExpression",arguments:[],callee:{type:"ArrowFunctionExpression",params:[],expression:!1,body:t},optional:!1};case"ReturnStatement":return t.argument||void 0;default:return}}var Es=(t,e)=>{Iy(t,e)},Ty=(t,e)=>{let r=Iy(t,e);return r&&typeof r=="object"?r.replace:t},Iy=(t,e,r)=>{if(!t)return;let n=e.enter(t,r);if(n===0)return 0;if(n&&typeof n=="object")return n;if(n===1)return;let i=VI[t.type];if(i)for(let o of i){let s=t[o];if(s instanceof Array)for(let[a,c]of s.entries()){let u=Iy(c,e,t);if(u===0)return 0;u&&typeof u=="object"&&(s[a]=u.replace)}else if(s){let a=Iy(s,e,t);if(a===0)return 0;a&&typeof a=="object"&&(t[o]=a.replace)}}e.leave?.(t)};var Vu=class t{constructor(e,r,n,i,o){this.original=e;this.metadata=r;this.actualRoot=n;this.actualSources=i;this.hasNames=o;this.sourceActualToOriginal=new Map;this.sourceOriginalToActual=new Map;this.id=t.idCounter++;if(i.length!==e.sources.length)throw new Error("Expected actualSources.length === original.source.length");for(let s=0;s<i.length;s++){let a=i[s],c=e.sources[s];a!==null&&c!==null&&(this.sourceActualToOriginal.set(a,c),this.sourceOriginalToActual.set(c,a))}}static{this.idCounter=0}get sources(){return this.actualSources.slice()}get sourceRoot(){return this.actualRoot}computedSourceUrl(e){return ft(Py(cr(this.metadata.sourceMapUrl)?this.metadata.compiledPath:this.metadata.sourceMapUrl,this.sourceRoot+e))}originalPositionFor(e){let r=rO(this.original,e);return r.source&&(r.source=this.sourceOriginalToActual.get(r.source)??r.source),r}generatedPositionFor(e){let r=this.sourceActualToOriginal.get(e.source)??e.source;if(!isFinite(e.line)){let n=e.bias||Fo;return this.getBestGeneratedForOriginal(r,(i,o)=>TX(i,o)*n)}return nO(this.original,{...e,source:r})}allGeneratedPositionsFor(e){return iO(this.original,{...e,source:this.sourceActualToOriginal.get(e.source)??e.source})}sourceContentFor(e){e=this.sourceActualToOriginal.get(e)??e;let r=this.original.sources.indexOf(e);return r===-1?null:this.original.sourcesContent?.[r]??null}eachMapping(e){oO(this.original,e)}decodedMappings(){return ec(this.original)}names(){return this.original.names}getBestGeneratedForOriginal(e,r){let n;return this.eachMapping(i=>{i.source===e&&(!n||r(i,n)>0)&&(n=i)}),n?{column:n.generatedColumn,line:n.generatedLine}:{column:null,line:null}}},TX=({originalLine:t,originalColumn:e},{originalLine:r,originalColumn:n})=>(t||0)-(r||0)||(e||0)-(n||0);async function zO(t,e,r,n){let i=Ey.Parser.parse(e,{locations:!0,ecmaVersion:"latest"}),o=new kO({file:t}),s=Uo(i,{sourceMap:{addMapping:a=>RO(o,a.original.line-1,a.original.column,t,a.generated.line-1,a.generated.column)}});return AO(o,t,s),new Vu(new fy(DO(o)),{sourceMapUrl:n,compiledPath:r},"",[t],!1)}function KO(t){let e;try{e=Gi(t)}catch{return}let r=(c,u)=>({type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:c,right:u}}),n=!1,i=!1,o=Ty(e,{enter(c,u){switch(c.type){case"ClassDeclaration":return{replace:r(c.id||{type:"Identifier",name:"_default"},{...c,type:"ClassExpression"})};case"FunctionDeclaration":return{replace:r(c.id||{type:"Identifier",name:"_default"},{...c,type:"FunctionExpression"})};case"FunctionExpression":case"ArrowFunctionExpression":case"MethodDefinition":return 1;case"AwaitExpression":n=!0;return;case"ForOfStatement":c.await&&(n=!0);return;case"ReturnStatement":i=!0;return;case"VariableDeclaration":if(!u||!("body"in u)||!(u.body instanceof Array))return;let l=u.body,p=c.declarations.map(d=>({type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"void",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:d.id,right:d.init||{type:"Identifier",name:"undefined"}}}}));l.splice(l.indexOf(c),1,...p)}}});if(!n||i)return;let s=e.body[e.body.length-1];s.type==="ExpressionStatement"&&(e.body[e.body.length-1]={type:"ReturnStatement",argument:s.expression});let a={type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ArrowFunctionExpression",params:[],generator:!1,expression:!1,async:!0,body:{type:"BlockStatement",body:o.body}},arguments:[],optional:!1}};return Uo(a)}function Rf(t){try{let e=(0,Ey.parseExpressionAt)(t,0,GI);return e.end<t.length||e.type!=="ObjectExpression"?t:`(${t})`}catch{return t}}function Gu(t){if(!t)return;let e="sourceMappingURL",r=t.length,n=e.length,i=r,o=0;for(;;){if(i=t.lastIndexOf(e,i),i===-1||i<4)return;if(i-=4,t[i]==="/"&&t[i+1]==="/"&&!(t[i+2]!=="#"&&t[i+2]!=="@")&&!(t[i+3]!==" "&&t[i+3]!=="	")&&(o=i+4+n,!(o<r&&t[o]!=="=")))break}let s=t.substring(o+1),a=s.indexOf(`
`);return a!==-1&&(s=s.substring(0,a)),s.trim()}function ky(t,e,r){let n=r.generatedPositionFor({source:t,line:e.lineNumber,column:e.columnNumber-1,bias:Fo}),i=a=>{if(a.line===null||a.column===null)return 1e11;let c=r.originalPositionFor(a);return c.line!==null?Math.abs(e.lineNumber-c.line):1e11},o=i(n),s=r.allGeneratedPositionsFor({source:t,line:e.lineNumber,column:e.columnNumber-1}).filter(a=>a.line!==null&&a.column!==null).sort((a,c)=>a.line!==c.line?a.line-c.line:a.column-c.column).map(a=>[a,i(a)]);return s.push([n,o]),s.sort(([a,c],[u,l])=>c-l||a.line-u.line||a.column-u.column),s[0][0]}var KI=(t,e)=>!!e&&((e.type==="FunctionExpression"||e.type==="FunctionDeclaration"||e.type==="ArrowFunctionExpression")&&e.params.includes(t)||(e.type==="ForInStatement"||e.type==="ForOfStatement")&&e.left===t||e.type==="VariableDeclarator"&&e.id===t||e.type==="AssignmentPattern"&&e.left===t||e.type==="CatchClause"&&e.param===t||"kind"in e&&e.kind==="init"&&e.value===t||e.type==="RestElement"&&e.argument===t||e.type==="AssignmentPattern"&&e.left===t);function ks(t){try{new Function(t)}catch(e){return e}}function EX(t,e){let r=Gi(t),n,i;return Es(r,{enter:o=>{let s=o;e>=s.start&&e<s.end&&(o.type==="CallExpression"||o.type==="NewExpression"?i=o:n=o)}}),i||n}var GO=/^[^()]+/g;function JO(t,e){try{let n=EX(t,e);if(n&&"callee"in n){let i=n.callee;return{text:`${t.slice(i.start,i.end)}(...)`,start:i.start,end:i.end}}else{let i=n;return{text:t.slice(i.start,i.end),start:i.start,end:i.end}}}catch{}GO.lastIndex=e-1;let r=GO.exec(t);if(r)return{text:r[0],start:e,end:e+r[0].length}}var ht=(t=JI())=>`
//# sourceURL=${t}
`,JI=()=>`eval-${(0,YO.randomBytes)(4).toString("hex")}.cdp`;function zi(t,e){return kX(""+t,e)}function kX(t,e){let r=(0,XO.parseExpressionAt)(t,0,{ecmaVersion:"latest",locations:!0});if(r.type!=="FunctionExpression")throw new Error(`Could not find function declaration for:

${t}`);let n=r.params.map(a=>{if(a.type!=="Identifier")throw new Error("Parameter must be identifier");return a.name}),{start:i,end:o}=r.body,s=(a,c,u)=>{let l=c,p=[];for(let[d,f]of a.entries())l+=`let ${n[d]}=`,p.push(new vr(new tt(0,l.length),new tt(0,l.length+f.length))),l+=f,l+=";";return l+=t.slice(i+1,o-1),l+=u,l+=`
${ht(e)}`,{out:l,argRanges:p}};return{expr:(...a)=>s(a,"(()=>{","})();").out,exprArgRanges:(...a)=>s(a,"(()=>{","})();").argRanges,decl:(...a)=>s(a,"function(...runtimeArgs){","}").out}}var rc=class extends Error{constructor(r){super(r.text);this.details=r}},Af=class{constructor(e){this.objectId=e}};function Rt(t,e){let r=""+t,n=r.lastIndexOf("}");r=r.slice(0,n)+ht(e)+r.slice(n);let i=async({cdp:o,args:s,...a})=>{let c=await o.Runtime.callFunctionOn({functionDeclaration:r,arguments:s.map(u=>u instanceof Af?{objectId:u.objectId}:{value:u}),...a});if(!c)throw new rc({exceptionId:0,text:"No response from CDP",lineNumber:0,columnNumber:0});if(c.exceptionDetails)throw new rc(c.exceptionDetails);return c.result};return i.source=r,i}var QO=()=>"globalThis.__jsDebugIsReady = true; "+ht();var Df=new Set(["page","iframe","worker","service_worker"]),Dy=new Set(["page","iframe"]),XI=new Set(["page","iframe"]),RX=XI,Oy=class t{constructor(e,r,n,i,o,s,a,c,u){this._manager=e;this._targetInfo=r;this.launchConfig=s;this.sessionId=a;this.logger=c;this._attached=!1;this._onNameChangedEmitter=new j;this.onNameChanged=this._onNameChangedEmitter.event;this.entryBreakpoint=void 0;this._children=new Map;this.willWaitForDebugger=Promise.resolve();this.sourcePathResolver=this._manager._sourcePathResolver;this._cdp=n,n.pause(),this.parentTarget=i,this._waitingForDebugger=o,this._updateFromInfo(r),this._ondispose=u}get targetInfo(){return this._targetInfo}get targetId(){return this._targetInfo.targetId}get independentLifeycle(){return XI.has(this.type())}get supplementalConfig(){let e=this.type();return{__browserTargetType:e,__usePerformanceFromParent:e!=="page"}}targetOrigin(){return this._manager._targetOrigin}id(){return this.sessionId}cdp(){return this._cdp}name(){return this._computeName()}fileName(){return this._targetInfo.url}type(){return this._targetInfo.type}afterBind(){return this._cdp.resume(),Promise.resolve()}initialize(){return Promise.resolve()}async runIfWaitingForDebugger(){await Promise.all([!this._targetInfo.canAccessOpener&&this._cdp.Runtime.runIfWaitingForDebugger({}),this._cdp.Runtime.evaluate({expression:QO()})])}parent(){return this.parentTarget&&!Df.has(this.parentTarget.type())?this.parentTarget.parentTarget:this.parentTarget}children(){let e=[];for(let r of this._children.values())Df.has(r.type())?e.push(r):e.push(...r.children());return e}canStop(){return RX.has(this.type())}stop(){if(this._manager.targetList().includes(this))if(this.type()==="service_worker"){if(this._manager.serviceWorkerModel.stopWorker(this.id()),!this.parentTarget)return;this._manager.serviceWorkerModel.stopWorker(this.parentTarget.id())}else this._cdp.Target.closeTarget({targetId:this._targetInfo.targetId})}canRestart(){return XI.has(this.type())}restart(){this._cdp.Page.reload({})}waitingForDebugger(){return this._waitingForDebugger}canAttach(){return!this._attached}async attach(){return this._waitingForDebugger=!1,this._attached=!0,Promise.resolve(this._cdp)}canDetach(){return this._attached}async detach(){this._attached=!1,this._manager._detachedFromTarget(this.sessionId)}executionContextName(e){let r=e.auxData,n=e.name;if(!r)return n;let i=r.frameId,o=i?this._manager.frameModel.frameForId(i):void 0;return o&&r.isDefault&&!o.parentFrame()?"top":o&&r.isDefault?o.displayName():o?`${n}`:n}supportsCustomBreakpoints(){return Dy.has(this.type())}supportsXHRBreakpoints(){return Dy.has(this.type())}scriptUrlToUrl(e){return Rs(this._targetInfo.url,e)||e}_updateFromInfo(e){this._targetInfo={...e,type:this._targetInfo.type},this._onNameChangedEmitter.fire()}setComputeNameFn(e){this._customNameComputeFn=e,this._onNameChangedEmitter.fire()}_computeName(){let e=this._customNameComputeFn?.(this);if(e)return e;if(this.type()==="service_worker"){let i=this._manager.serviceWorkerModel.version(this.id());if(i)return i.label()+" [Service Worker]"}let r=this._targetInfo.title;if(!(r&&this._manager.targetList().some(i=>i instanceof t&&i!==this&&i._targetInfo.title===this._targetInfo.title)))return r;try{let i=new ZO.URL(this._targetInfo.url);i.protocol==="data:"?r=" <data>":i?r+=` (${this._targetInfo.url.replace(/^[a-z]+:\/\/|\/$/gi,"")})`:r+=` (${this._targetInfo.url})`}catch{r+=` (${this._targetInfo.url})`}return r}async _detached(){await this._manager.serviceWorkerModel.detached(this._cdp),this._ondispose(this)}};function Ly(t){return t instanceof Array?t:[t]}function eL(t,e,r){let n=0,i=t.length-1;for(;n<=i;){let o=(n+i)/2|0,s=r(t[o],e);if(s<0)n=o+1;else if(s>0)i=o-1;else return o}return n}function tL(t,e){let r=new Map;for(let n of t){let i=e(n),o=r.get(i);o?o.push(n):r.set(i,[n])}return r}function As(t){return t.next().value}function Ki(t,e){return t.length<=e?t:t.substr(0,e-1)+"\u2026"}function zu(t,e){if(t.length<=e)return t;let r=e>>1,n=e-r-1,i=t.codePointAt(t.length-n-1);i&&i>=65536&&(--n,++r);let o=t.codePointAt(r-1);return r>0&&o&&o>=65536&&--r,t.substr(0,r)+"\u2026"+t.substr(t.length-n,n)}var rL="/\\.?*()^${}|[]+",nL=t=>rL.includes(t);function Rr(t,e){let r=rL.split("").filter(i=>!e||e.indexOf(i)<0).join("").replace(/[\\\]]/g,"\\$&"),n=new RegExp(`[${r}]`,"g");return t.replace(n,"\\$&")}var Ds=class{constructor(e){this.source=e;this.lines=[];this.lines.push(0);for(let r=e.indexOf(`
`);r!==-1;r=e.indexOf(`
`,r+1))this.lines.push(r+1)}getLineOffset(e){return e>=this.lines.length?this.source.length:this.lines[e]}convert(e){let r=e.base0;if(r.lineNumber>this.lines.length)return this.source.length;let n=this.lines[r.lineNumber],i=this.lines[r.lineNumber+1]??this.source.length+1;return n+Math.min(i-n-1,r.columnNumber)}};var My=process.platform!=="win32";function QI(){return My}function By(t){return My?t:t.toLowerCase()}function Fy(t,e){return My?t===e:t.toLowerCase()===e.toLowerCase()}function ic(){return QI()?new Map:new Vi(By)}var iL=process.platform==="win32"?process.env.PATHEXT?.toLowerCase().split(";"):void 0,Nf=t=>{let e=By(an.basename(t));if(iL){for(let r of iL)if(e.endsWith(r))return e.slice(0,-r.length)}return e},oc=async(t,e)=>{for(;;){let r=await e(t);if(r!==void 0)return r;let n=an.dirname(t);if(n===t)return;t=n}},Ku=(t,e,r)=>oc(e,async n=>await t.exists(an.join(n,r))?n:void 0),DX=new Set(["localhost","127.0.0.1","::1"]),OX=new Set(["0.0.0.0","::","0000:0000:0000:0000:0000:0000:0000:0000"]),Ny=t=>DX.has(t.toLowerCase()),aL=t=>{try{return new Ji.URL(t).hostname.replace(/^\[|\]$/g,"")}catch{return t}},cL=t=>OX.has(aL(t)),Ju=Ro(async t=>{let e=aL(t);if(Ny(e))return!0;try{let r=await sL.promises.lookup(e);return Ny(r.address)}catch{return!1}});function Rs(t,e){try{return new Ji.URL(e,t).href}catch{}}function ZI(t){try{return new Ji.URL(t).pathname}catch{return}}function Py(t,e){try{return new Ji.URL(e),e}catch{}let r;try{r=new Ji.URL(t||"")}catch{return e}let n=r.protocol+"//";return r.username&&(n+=r.username+":"+r.password+"@"),n+=r.host,n+=an.dirname(r.pathname),n[n.length-1]!=="/"&&(n+="/"),n+=e,n}function Uy(t){try{return new Ji.URL(t),!0}catch{return!1}}function uL(t){return t.replace(/\/$/,"").replace(/\\$/,"")}var LX=/^https:\/\/([a-z0-9\-]+)\+\.vscode-resource\.vscode-(?:webview|cdn)\.net\/(.+)/i,oL="vscode-file://vscode-app/";function mt(t){let e=LX.exec(t);if(e)t=`${e[1]}:///${e[2]}`;else if(t.startsWith("vscode-webview-resource://"))t=new Ji.URL(t).pathname.replace(/%2F/gi,"/").replace(/^\/([a-z0-9\-]+)(\/{1,2})/i,(n,i,o)=>o.length===1?`${i}:///`:`${i}://`);else if(t.startsWith(oL))t=t.slice(oL.length);else if(!Wr(t))return;return t=t.replace("file:///",""),t=decodeURIComponent(t),t.startsWith("/")&&process.platform==="win32"&&t[1]!=="/"&&(t="/"+t),t[0]!=="/"&&!t.match(/^[A-Za-z]:/)&&(t="/"+t),ft(t)}function lL(t){return Wr(t)&&(t=t.replace("file:///","\\\\"),t=t.replace(/\//g,"\\"),t=decodeURIComponent(t)),t}function We(t){return eC==="win32"?"file:///"+Os(t):"file://"+Os(t)}function Xu(t){return t.startsWith("/")?"file://"+Os(t):"file:///"+Os(t)}function wr(t){return an.posix.isAbsolute(t)||an.win32.isAbsolute(t)}function cr(t){return!!t&&t.startsWith("data:")}var YI=(t,e,r)=>{if(!r||t===":"){e.add(t);return}if(t==="/"){e.add(`\\${t}`);return}nL(t)?e.add(`\\${t}`):e.add(t);let n=encodeURIComponent(t);t!=="\\"&&n!==t&&e.add(n)},NX=t=>{switch(t.size){case 0:return"";case 1:return As(t.values());default:let e=[...t];return e.some(r=>r.length>1)?`(?:${e.join("|")})`:`[${e.join("")}]`}},Of=new Set;function Lf(t,e,r,n,i=My){let o="";for(let s of t.slice(e,r))i?YI(s,Of,n):(YI(s.toLowerCase(),Of,n),YI(s.toUpperCase(),Of,n)),o+=NX(Of),Of.clear();return o}function Pn(t,[e,r]=[0,t.length]){if(r<=e)return t;let n=[],i=Lf(t,0,e,!1),o=Lf(t,r,t.length,!1),s=t.slice(e,r);for(let a of[decodeURIComponent(s),mt(s)]){if(!a)continue;let c=Lf(a,0,a.length,!0);n.push(MX(`${i}${c}${o}`).concat("($|\\?)"))}return n.join("|")}var MX=t=>t.replace(/^(file:\\\/\\\/\\\/)?([a-z]):/i,(e,r="",n)=>`${r}[${n.toUpperCase()}${n.toLowerCase()}]:`);function Wr(t){return t.startsWith("file:///")}var eC=process.platform;function Os(t){return t=jo(t),eC==="win32"?(EI(t)&&(t=t.slice(1)),t.split(/[\\//]/g).map((e,r)=>r>0?encodeURIComponent(e):e).join("/")):t.split("/").map(encodeURIComponent).join("/")}function jo(t){return t&&eC==="win32"&&t[1]===":"?t[0].toUpperCase()+t.substring(1):t}var Ls=(t,e=[])=>{let r=t.urlFilter||"file"in t&&t.file||t.url,n=r?jy(r,...e):void 0;return i=>!i.url.startsWith("devtools://")&&n?.(i.url)!==!1},Xi=t=>e=>e.type==="page"&&!e.url.startsWith("edge://force-signin")&&t(e);function BX(t){return!!t&&!an.isAbsolute(t)&&!!(0,Ji.parse)(t).protocol}var jy=(...t)=>{let e=i=>{i=i.toLowerCase();let o=mt(i);o?i=o:BX(i)&&i.includes("://")&&(i=i.substr(i.indexOf("://")+3)),i.endsWith("/")&&(i=i.substr(0,i.length-1));let s=i.indexOf("#");return s!==-1&&(i=i.slice(0,i[s-1]==="/"?s-1:s)),i},r=t.map(i=>Rr(e(i),"/*").replace(/(\/\*$)|\*/g,".*")),n=new RegExp("^("+r.join("|")+")$","g");return i=>(n.lastIndex=0,n.test(e(i)))};var Qi=Symbol("ISourceMapFactory"),tC=Symbol("IRootSourceMapFactory"),sc=class{constructor(e,r){this.root=e;this.resourceProvider=r}load(e){return this.root.load(this.resourceProvider,e)}guardSourceMapFn(e,r,n){return this.root.guardSourceMapFn(e,r,n)}};sc=I([(0,Yi.injectable)(),g(0,(0,Yi.inject)(tC)),g(1,(0,Yi.inject)(tc))],sc);var Mf=class{constructor(e,r,n){this.pathResolve=e;this.dap=r;this.logger=n;this.hasWarnedAboutMaps=new WeakSet}async load(e,r){let n=await this.parseSourceMap(e,r.sourceMapUrl),i;"sourceRoot"in n&&(i=n.sourceRoot,n.sourceRoot=void 0);let o=!1,s=[];if("sections"in n){s=[];let a=0;for(let c of n.sections){let u=c.map;s.push(...u.sources),u.sources=u.sources.map(()=>`source${a++}.js`),o||=!!u.names?.length}}else"sources"in n&&Array.isArray(n.sources)&&(s=n.sources,n.sources=n.sources.map((a,c)=>`source${c}.js`),o=!!n.names?.length);return new Vu(new fy(n),r,i??"",s,o)}async parseSourceMap(e,r){let n;try{n=await this.parseSourceMapDirect(e,r)}catch(i){if(n=await this.parsePathMappedSourceMap(e,r),!n)throw i}if("sections"in n){let i=await Promise.all(n.sections.map((o,s)=>"url"in o?this.parseSourceMap(e,o.url).then(a=>({offset:o.offset,map:a})).catch(a=>{this.logger.warn("sourcemap.parsing",`Error parsing nested map ${s}: ${a}`)}):o));n.sections=i.filter(at)}return n}async parsePathMappedSourceMap(e,r){if(cr(r))return;let n=await this.pathResolve.urlToAbsolutePath({url:r});if(n)try{return this.parseSourceMapDirect(e,n)}catch(i){this.logger.info("sourcemap.parsing","Parsing path mapped source map failed.",i)}}guardSourceMapFn(e,r,n){try{return r()}catch(i){if(!/error parsing/i.test(String(i.message)))throw i;if(!this.hasWarnedAboutMaps.has(e)){let o=by(e.metadata.compiledPath,i.message).error;this.dap.output({output:o.format+`
`,category:"stderr"}),this.hasWarnedAboutMaps.add(e)}return n()}}dispose(){}async parseSourceMapDirect(e,r){let n=mt(r);n&&(n=this.pathResolve.rebaseRemoteToLocal(n));let i=await e.fetch(n||r);if(!i.ok)throw i.error;let o=i.body;return o.slice(0,3)===")]}"&&(o=o.substring(o.indexOf(`
`))),JSON.parse(o)}};Mf=I([(0,Yi.injectable)(),g(0,(0,Yi.inject)(je)),g(1,(0,Yi.inject)(qu)),g(2,(0,Yi.inject)(Y))],Mf);var Ns=class extends Mf{constructor(){super(...arguments);this.knownMaps=new Vi(r=>r.toLowerCase())}load(r,n){let i=this.knownMaps.get(n.sourceMapUrl);if(!i)return this.loadNewSourceMap(r,n);let o=n.cacheKey,s=i.metadata.cacheKey;return i.reloadIfNoMtime?o&&s&&o===s?(i.reloadIfNoMtime=!1,i.prom):this.loadNewSourceMap(r,n):s&&o&&o!==s?this.loadNewSourceMap(r,n):i.prom}loadNewSourceMap(r,n){let i=super.load(r,n);return this.knownMaps.set(n.sourceMapUrl,{metadata:n,reloadIfNoMtime:!1,prom:i}),i}dispose(){this.knownMaps.clear()}invalidateCache(){for(let r of this.knownMaps.values())r.reloadIfNoMtime=!0}};Ns=I([(0,Yi.injectable)()],Ns);var pL=require("path");var Yu=Symbol("ISearchStrategy");var dL=async(t,e,r)=>{let n,o=`${(0,pL.basename)(t)}.map`;if(e.siblings.includes(o)&&(n=o),n||(typeof r>"u"&&(r=await iy(t)),n=Gu(r)),!(!n||(cr(n)||(n=Rs(We(t),n)),!n))&&!(!n.startsWith("data:")&&!n.startsWith("file://")))return{compiledPath:t,sourceMapUrl:n,cacheKey:e.mtime}};var Wy=async(t,e,r,n={})=>{let i=Date.now();try{return await r()}finally{t.verbose("perf.function","",{method:e,duration:Date.now()-i,...n})}};var rC=Symbol("InlineSourceMapUrl"),fL=10*1e3,ac=class{constructor(e){e.__workspaceCachePath&&(this.path=Hy.join(e.__workspaceCachePath,"bp-predict.json"))}async load(){if(this.value||!this.path)return this.value;try{this.value=JSON.parse(await Bf.promises.readFile(this.path,"utf-8"))}catch{}return this.value}async store(e){this.value=e,this.path&&(await Bf.promises.mkdir(Hy.dirname(this.path),{recursive:!0}),await Bf.promises.writeFile(this.path,JSON.stringify(e)))}};ac=I([(0,Vt.injectable)(),g(0,(0,Vt.inject)(Re))],ac);var Zi=class{constructor(e,r,n,i,o,s){this.outFiles=e;this.repo=r;this.logger=n;this.sourceMapFactory=i;this.sourcePathResolver=o;this.state=s}async createMapping(e){if(this.outFiles.empty)return new Map;let r=ic(),n=await this.state.load();try{let{state:i}=await this.repo.streamChildrenWithSourcemaps({files:this.outFiles,processMap:async o=>{let s=[],a=await this.sourceMapFactory.load(o);for(let c of a.sources){if(c===null)continue;let u=this.sourcePathResolver?await this.sourcePathResolver.urlToAbsolutePath({url:c,map:a}):mt(c);u&&s.push({...o,sourceMapUrl:cr(o.sourceMapUrl)?{[rC]:o.sourceMapUrl}:o.sourceMapUrl,resolvedPath:u,sourceUrl:c})}return{discovered:s,compiledPath:ft(o.compiledPath)}},onProcessedMap:({discovered:o})=>{for(let s of o){let a=r.get(s.resolvedPath);a||(a=new Set,r.set(s.resolvedPath,a)),a.add(s)}},lastState:n,...e});i&&this.state.store(i).catch(o=>this.logger.warn("runtime.exception","Error saving sourcemap cache",{error:o}))}catch(i){this.logger.warn("runtime.exception","Error reading sourcemaps from disk",{error:i})}return r}};Zi=I([(0,Vt.injectable)(),g(0,(0,Vt.inject)(Hi)),g(1,(0,Vt.inject)(Yu)),g(2,(0,Vt.inject)(Y)),g(3,(0,Vt.inject)(Qi)),g(4,(0,Vt.inject)(je)),g(5,(0,Vt.inject)(ac))],Zi);var Qu=class extends Zi{async getMetadataForPaths(e){this.sourcePathToCompiled||(this.sourcePathToCompiled=this.createInitialMapping());let r=await this.sourcePathToCompiled;return e.map(n=>r.get(n))}async createInitialMapping(){return Wy(this.logger,"BreakpointsPredictor.createInitialMapping",()=>this.createMapping())}};Qu=I([(0,Vt.injectable)()],Qu);var Zu=class extends Zi{constructor(){super(...arguments);this.sourcePathToCompiled=new Map}async getMetadataForPaths(r){let n=r.map(s=>this.sourcePathToCompiled.get(s)),i=r.map((s,a)=>a).filter(s=>!n[s]);if(i.length){let s=new Set(i.map(c=>ft(r[c]))),a=this.createMapping({filter:(c,u)=>!u||u.discovered.some(l=>s.has(l.resolvedPath))});for(let c of i)this.sourcePathToCompiled.set(r[c],a),n[c]=a}return await Promise.all(n.map(async(s,a)=>(await s).get(r[a])))}};Zu=I([(0,Vt.injectable)()],Zu);var uc=Symbol("IBreakpointsPredictor"),cc=class{constructor(e,r,n,i){this.bpSearch=e;this.outFiles=r;this.logger=n;this.sourceMapFactory=i;this.predictedLocations=new Map;this.longParseEmitter=new j;this.targetedMode=!1;this.onLongParse=this.longParseEmitter.event}async predictBreakpoints(e){if(!e.source.path||!e.breakpoints?.length)return;let r=await this.getMetadataForPaths([e.source.path]).then(i=>i[0]);if(!r)return;let n=async(i,o,s)=>{let a=typeof s.sourceMapUrl=="string"?s.sourceMapUrl:s.sourceMapUrl.hasOwnProperty(rC)?s.sourceMapUrl[rC]:await Bf.promises.readFile(s.compiledPath,"utf8").then(Gu);if(!a)return[];let c=await this.sourceMapFactory.load({...s,sourceMapUrl:a}),u=this.sourceMapFactory.guardSourceMapFn(c,()=>ky(s.sourceUrl,{lineNumber:i,columnNumber:o||1},c),()=>null);if(!u||u.line===null)return[];let l=await this.getMetadataForPaths([s.compiledPath]).then(p=>p[0]);return l?(await Promise.all([...l].map(d=>n(u.line,u.column,d)))).flat():[{absolutePath:s.compiledPath,lineNumber:u.line||1,columnNumber:u.column?u.column+1:1}]};for(let i of e.breakpoints??[]){let o=`${e.source.path}:${i.line}:${i.column||1}`;if(this.predictedLocations.has(o))return;let s=[];this.predictedLocations.set(o,s);for(let a of r)s.push(...await n(i.line,i.column||0,a))}}async getPredictionForSource(e){return this.getMetadataForPaths([e]).then(r=>r[0])}async getMetadataForPaths(e){let r=setTimeout(()=>{this.longParseEmitter.fire(),this.logger.warn("runtime.sourcemap","Long breakpoint predictor runtime",{longPredictionWarning:fL,patterns:[...this.outFiles.explode()].join(", ")})},fL),n=await this.bpSearch.getMetadataForPaths(e);return clearTimeout(r),n}predictedResolvedLocations(e){let r=`${e.absolutePath}:${e.lineNumber}:${e.columnNumber||1}`;return this.predictedLocations.get(r)??[]}};cc=I([(0,Vt.injectable)(),g(0,(0,Vt.inject)(Zi)),g(1,(0,Vt.inject)(Hi)),g(2,(0,Vt.inject)(Y)),g(3,(0,Vt.inject)(Qi))],cc);var so=v(H());var qy=class{constructor(e=!1,r=!1){this.verified=e;this.hit=r}},$y=class{constructor(){this._statisticsById=new Map}registerBreakpoints(e){e.forEach(r=>{r.id!==void 0&&!this._statisticsById.has(r.id)&&this._statisticsById.set(r.id,new qy(r.verified,!1))})}registerResolvedBreakpoint(e){this.getStatistics(e).verified=!0}registerBreakpointHit(e){this.getStatistics(e).hit=!0}getStatistics(e){let r=this._statisticsById.get(e);if(r!==void 0)return r;{let n=new qy;return this._statisticsById.set(e,n),n}}statistics(){let e=0,r=0,n=0;for(let i of this._statisticsById.values())e++,i.hit&&n++,i.verified&&r++;return{set:e,verified:r,hit:n}}};var cl=v(H());var qL=require("crypto"),ol=v(H());var FX=0,lt=Symbol("ICdpApi"),lc=class extends Error{constructor(r){super("<<message>>");this.method=r}setCause(r,n){return this.cause={code:r,message:n},this.message=`CDP error ${r} calling method ${this.method}: ${n}`,this.stack=this.stack?.replace("<<message>>",this.message),this}},ut=class{constructor(e,r,n){this.logger=r;this.telemetryReporter=n;this._connectionId=FX++;this._lastId=1e3;this._disposedSessions=new Map;this._onDisconnectedEmitter=new j;this.waitWrapper=jX();this.onDisconnected=this._onDisconnectedEmitter.event;this._transport=e,this._transport.onMessage(([i,o])=>this._onMessage(i,o)),this._transport.onEnd(()=>this._onTransportClose()),this._sessions=new Map,this._closed=!1,this._rootSession=new Vy(this,"",this.logger),this._sessions.set("",this._rootSession)}rootSession(){return this._rootSession.cdp()}_send(e,r={},n){let i=++this._lastId,o={id:i,method:e,params:r};n&&(o.sessionId=n);let s=JSON.stringify(o);return this.logger.verbose("cdp.send",void 0,{connectionId:this._connectionId,message:o}),this._transport.send(s),i}_onMessage(e,r){let n=JSON.parse(e),i=n;n.result&&n.result.scriptSource?i={...n,result:{...n.result,scriptSource:"<script source>"}}:n.method==="Debugger.scriptParsed"&&n.params&&cr(n.params.sourceMapURL)&&(i={...n,params:{...n.params,sourceMapURL:"<data source map url>"}}),this.logger.verbose("cdp.receive",void 0,{connectionId:this._connectionId,message:i});let o=this._sessions.get(n.sessionId||"");if(!o){let c=this._disposedSessions.get(n.sessionId);if(c){let u=(Date.now()-c.getTime())/1e3;this.logger.warn("internal",`Got message for a session disposed ${u} seconds ago`,{sessionId:n.sessionId,disposeOn:c});return}else throw new Error(`Unknown session id: ${n.sessionId} while processing: ${n.method}`)}let s=n.method,a;try{o._onMessage(n)}catch(c){a=c}s&&this.telemetryReporter.reportOperation("cdpOperation",s,r.elapsed().ms,a)}_onTransportClose(){if(!this._closed){this._closed=!0,this._transport.dispose(),this.logger.info("cdp.receive","Connection closed",{connectionId:this._connectionId});for(let e of this._sessions.values())e._onClose();this._sessions.clear(),this._onDisconnectedEmitter.fire()}}close(){this._onTransportClose()}isClosed(){return this._closed}createSession(e){let r=new Vy(this,e,this.logger);return this._sessions.set(e,r),r.cdp()}disposeSession(e){let r=this._sessions.get(e);r&&(r._onClose(),this._disposedSessions.set(r.sessionId(),new Date),this._sessions.delete(r.sessionId()))}},UX=+process.version.substring(1).split(".")[0]<11,Vy=class{constructor(e,r,n){this.logger=n;this._queue=[];this._prefixListeners=new _f;this._directListeners=new _f;this.paused=!1;this._callbacks=new Map,this._connection=e,this._sessionId=r,this._cdp=this._createApi()}pause(){this.paused=!0}resume(){if(!this.paused)return;this.paused=!1;let e=this._queue;this._queue=[],this.logger.verbose("cdp.receive","Dequeue messages",{message:e});for(let r of e)this._processResponse(r)}cdp(){return this._cdp}sessionId(){return this._sessionId}_createApi(){return new Proxy({},{get:(e,r)=>r==="pause"?()=>this.pause():r==="resume"?()=>this.resume():r==="session"?this:new Proxy({},{get:(n,i)=>{if(i!=="then")return i==="on"?(o,s)=>this.on(`${r}.${o}`,s):o=>this.send(`${r}.${i}`,o)}})})}on(e,r){return this._directListeners.listen(e,r)}onPrefix(e,r){return this._prefixListeners.listen(e,r)}send(e,r={}){return this.sendOrDie(e,r).catch(()=>{})}sendOrDie(e,r={}){if(!this._connection)return Promise.reject(new lc(e).setCause(0,"Connection is closed"));let n=this._connection._send(e,r,this._sessionId);return new Promise((i,o)=>{this._callbacks.set(n,{resolve:i,reject:o,from:new lc(e),method:e})})}_onMessage(e){if(this.paused&&e.id){this._processResponse(e);return}if(this._queue.length>0){this._queue.push(e);return}if(!UX&&!this.paused){this._processResponse(e);return}this._queue.push(e),this.paused||this._processQueue()}_processQueue(){this._connection?.waitWrapper(()=>{if(this.paused)return;let e=this._queue.shift();e&&(this._processResponse(e),this._queue.length&&this._processQueue())})}_processResponse(e){if(e.id===void 0){let n=e;this._directListeners.emit(n.method,n.params);for(let[i,o]of this._prefixListeners.listeners)n.method.startsWith(i)&&o.fire(n);return}let r=this._callbacks.get(e.id);r&&(this._callbacks.delete(e.id),"error"in e?r.reject(r.from.setCause(e.error.code,e.error.message)):"result"in e&&r.resolve(e.result))}async detach(){if(!this._connection)throw new Error("Session already detached. Most likely the target has been closed.");this._connection._send("Target.detachFromTarget",{},this._sessionId)}isClosed(){return!this._connection}_onClose(){for(let e of this._callbacks.values())e.reject(e.from.setCause(0,"Connection is closed"));this._callbacks.clear(),this._connection=void 0}};function jX(){if(parseInt(process.versions.node,10)>=11)return setImmediate;let t=!1,e=[],r=()=>{let n=e.shift();if(!n){t=!1;return}setImmediate(r),n()};return n=>{e.push(n),t||(t=!0,setImmediate(r))}}var nl=v(H());var DL=v(ge()),OL=require("path"),LL=require("url");var RL=require("fs");var PL=require("path"),EL=require("worker_threads");var Ms=v(IL()),eb=require("crypto"),sC=require("fs"),aC=require("worker_threads");var nY=t=>(0,eb.createHash)("sha256").update(t).digest("hex"),iY=Buffer.from("(function (exports, require, module, __filename, __dirname) { "),oY=Buffer.from(`
});`),sY=Buffer.from("(function (exports, require, module, __filename, __dirname, process, global, Buffer) { return function (exports, require, module, __filename, __dirname) { "),aY=Buffer.from(`
}.call(this, exports, require, module, __filename, __dirname); });`),cY=Buffer.from("#!"),uY=Buffer.from("\r")[0],lY=Buffer.from(`
`)[0],pY=(t,e)=>t.slice(0,e.length).equals(e),Zy=(t,...e)=>{if(t.length!==64)return(0,Ms.hash)(e.length===1?e[0]:Buffer.concat(e))===t;let r=(0,eb.createHash)("sha256");for(let o of e)r.update(o);if(r.digest("hex")===t)return!0;let n=e.length===1?e[0]:Buffer.concat(e),i=(0,Ms.normalizeShaBuffer)(n);return n===i?!1:(0,eb.createHash)("sha256").update(i).digest("hex")===t},CL=(t,e,r)=>{if(Zy(e,t))return!0;if(r){if(pY(t,cY)){let n=t.indexOf(lY);return t[n-1]===uY&&n--,Zy(e,t.subarray(n))}if(Zy(e,iY,t,oY))return!0}return!!Zy(e,sY,t,aY)},TL=t=>t instanceof Buffer?t:Buffer.from(t,"utf-8");async function dY(t){switch(t.type){case 0:try{let e=await sC.promises.readFile(t.file);return{id:t.id,hash:t.mode===0?(0,Ms.hash)(e):t.mode===2?nY(e):(0,Ms.shaHash)(e)}}catch{return{id:t.id}}case 1:try{return{id:t.id,hash:(0,Ms.hash)(TL(t.data))}}catch{return{id:t.id}}case 2:try{let e=await sC.promises.readFile(t.file);return{id:t.id,matches:CL(e,t.expected,t.checkNode)}}catch{return{id:t.id,matches:!1}}case 3:try{return{id:t.id,matches:CL(TL(t.data),t.expected,t.checkNode)}}catch{return{id:t.id,matches:!1}}}}function fY(t){t.on("message",e=>{dY(e).then(r=>t.postMessage(r))})}aC.parentPort&&fY(aC.parentPort);var tb=class{constructor(e=3,r=(0,PL.join)(__dirname,"hash.js")){this.maxFailures=e;this.hasherScriptPath=r;this.idCounter=0;this.failureCount=0;this.deferredMap=new Map;this.deferCleanup=Jk(3e4,()=>this.cleanup())}async hashBytes(e,r){return(await this.send({type:1,data:r,mode:e,id:this.idCounter++})).hash}async hashFile(e,r){return(await this.send({type:0,file:r,mode:e,id:this.idCounter++})).hash}async verifyBytes(e,r,n){return(await this.send({type:3,data:e,id:this.idCounter++,expected:r,checkNode:n})).matches}async verifyFile(e,r,n){return(await this.send({type:2,file:e,id:this.idCounter++,expected:r,checkNode:n})).matches}dispose(){this.cleanup(),this.deferCleanup.clear()}send(e){let r=this.getProcess();if(!r)throw new Error("hash.js process unexpectedly exited");this.deferCleanup();let n=Ue();return this.deferredMap.set(e.id,{deferred:n,request:e}),r.postMessage(e),n.promise}cleanup(){this.instance&&(this.instance.removeAllListeners("exit"),this.instance.terminate(),this.instance=void 0,this.failureCount=0)}getProcess(){if(this.instance)return this.instance;if(this.failureCount>this.maxFailures)return;let e=this.instance=new EL.Worker(this.hasherScriptPath);return e.setMaxListeners(1/0),e.on("message",r=>{let n=r,i=this.deferredMap.get(n.id);i&&(i.deferred.resolve(n),this.deferredMap.delete(n.id))}),e.on("exit",()=>{this.instance=void 0,this.failureCount++;let r=this.getProcess();if(r){this.deferCleanup();for(let{request:n}of this.deferredMap.values())r.postMessage(n)}else{for(let{deferred:n}of this.deferredMap.values())n.reject(new Error("hash.js process unexpectedly exited"));this.deferredMap.clear(),this.deferCleanup.clear()}}),e}};var kL=new tb;async function AL(t,e,r){return!t||E1(t)?void 0:e?(typeof r=="string"?await kL.verifyBytes(r,e,!0):await kL.verifyFile(t,e,!0))?t:void 0:await new nn(RL.promises).exists(t)?t:void 0}var dc=class{constructor(e,r,n,i,o,s,a,c){this.url=r;this.inlineScriptOffset=s;this.runtimeScriptOffset=a;this.contentHash=c;this._scripts=[];this.hasBeenAnnounced=!1;this.sourceReference=e.getSourceReference(r),this._contentGetter=me(i),this._container=e,this.absolutePath=n||"",this._fqname=this._fullyQualifiedName(),this._name=this._humanName(),this.setSourceMapUrl(o),this._existingAbsolutePath=this.checkContentHash(c)}get sendLazy(){return!this.url}checkContentHash(e){return AL(this.absolutePath,this.inlineScriptOffset||this.runtimeScriptOffset?void 0:e,this._container._fileContentOverridesForTest.get(this.absolutePath))}offsetScriptToSource(e){return this.runtimeScriptOffset?{...e,lineNumber:Math.max(1,e.lineNumber-this.runtimeScriptOffset.lineOffset),columnNumber:e.columnNumber-this.runtimeScriptOffset.columnOffset}:e}offsetSourceToScript(e){return this.runtimeScriptOffset?{...e,lineNumber:e.lineNumber+this.runtimeScriptOffset.lineOffset,columnNumber:e.columnNumber+this.runtimeScriptOffset.columnOffset}:e}async equalsDap(e){let r=await this._existingAbsolutePath;return r?!e.sourceReference&&r===e.path:e.sourceReference===this.sourceReference}setSourceMapUrl(e){if(!e){this.sourceMap=void 0;return}this.sourceMap={type:0,sourceByUrl:new Map,value:Ue(),metadata:e}}addScript(e){this._scripts.push(e)}filterScripts(e){this._scripts=this._scripts.filter(e)}get scripts(){return this._scripts}get getSuggestedMimeType(){if(this.url.endsWith(".wat"))return"text/wat";if(!/\.[^/]+$/.test(this.url)||this.url.includes("?"))return"text/javascript"}async content(){let e=await this._contentGetter();return this.inlineScriptOffset?.lineOffset&&(e=`
`.repeat(this.inlineScriptOffset.lineOffset)+e),e}async prettyPrint(){if(!this._container)return;if(fc(this)&&this.sourceMap.metadata.sourceMapUrl.endsWith("-pretty.map")){let c=this.sourceMap.value.settledValue;return c&&{map:c,source:[...this.sourceMap.sourceByUrl.values()][0]}}let e=await this.content();if(!e)return;let r=this.url||`eval://${this.sourceReference}.js`,n=r+"-pretty.map",o=r.split(/[\/\\]/).pop()+"-pretty.js",s=await zO(o,e,r,n);if(!s)return;this.setSourceMapUrl({compiledPath:this.absolutePath,sourceMapUrl:""}),this.sourceMap.value.resolve(s);let a=this;return await this._container._addSourceMapSources(a,s),{map:s,source:[...a.sourceMap.sourceByUrl.values()][0]}}async toDap(){let e=await this._existingAbsolutePath,r={name:this._name,path:this._fqname,sourceReference:this.sourceReference,presentationHint:this.blackboxed()?"deemphasize":void 0,origin:this.blackboxed()?DL.t("Skipped by skipFiles"):void 0};return e&&(r.sourceReference=0,r.path=e),this.hasBeenAnnounced||(this.hasBeenAnnounced=!0,this._container.emitLoadedSource(this)),r}existingAbsolutePath(){return this._existingAbsolutePath}async prettyName(){let e=await this._existingAbsolutePath;return e||this._fqname}_humanName(){if(wr(this._fqname)){for(let e of this._container.rootPaths)if(ay(e,this._fqname))return ze((0,OL.relative)(e,this._fqname))}return this._fqname}_fullyQualifiedName(){if(!this.url)return"<eval>/VM"+this.sourceReference;if(this.url.endsWith(".repl"))return"repl";if(this.url.startsWith(ni))return ii+"/"+this.url.slice(ni.length);if(this.absolutePath.startsWith(ii))return this.absolutePath;if(wr(this.url))return this.url;let e=mt(this.url);if(e)return e;let r=this.url;try{let n=[],i=new LL.URL(this.url);if(i.protocol==="data:")return"<eval>/VM"+this.sourceReference;i.hostname&&n.push(i.hostname),i.port&&n.push("\uA789"+i.port),i.pathname&&n.push(/^\/[a-z]:/.test(i.pathname)?i.pathname.slice(1):i.pathname);let o=i.searchParams?.toString();o&&n.push("?"+o),r=n.join("")}catch{}return r.endsWith("/")&&(r+="(index)"),this.inlineScriptOffset&&(r+=`\uA789${this.inlineScriptOffset.lineOffset+1}:${this.inlineScriptOffset.columnOffset+1}`),r}blackboxed(){return this._container.isSourceSkipped(this.url)}};var Uf;(n=>{async function t(i){return i.value.promise}n.waitForValue=t;function e(i,o){return i.type===0&&i.value.settledValue?Promise.resolve(i.value.settledValue):Promise.race([t(i),_e(o)])}n.waitForValueWithTimeout=e;async function r(i){return await t(i),i.sourceByUrl}n.waitForSources=r})(Uf||={});var Ct=class extends dc{constructor(){super(...arguments);this.compiledToSourceUrl=new Map}},rb=class extends dc{constructor(r,n,i){super(r,n.url,i,()=>Promise.resolve("Binary content not shown, see the decompiled WAT file"),void 0,void 0,void 0,void 0);this.event=n;this.sourceMap={type:1,value:Ue(),sourceByUrl:new Map}}checkContentHash(){return Promise.resolve(void 0)}offsetScriptToSource(r){return r}offsetSourceToScript(r){return r}},Ar=t=>!!t&&t instanceof dc&&!!t.sourceMap,fc=t=>Ar(t)&&t.sourceMap.type===0,hc=t=>Ar(t)&&t.sourceMap.type===1,cC=t=>!!t&&typeof t.getDisassembly=="function";function NL(t,e){if(!e)return t;let{lineNumber:r,columnNumber:n}=t;return e&&(r+=e.lineOffset,r<=1&&(n+=e.columnOffset)),{...t,lineNumber:r,columnNumber:n}}function ML(t,e){if(!e)return t;let{lineNumber:r,columnNumber:n}=t;return e&&(r=Math.max(1,r-e.lineOffset),r<=1&&(n=Math.max(1,n-e.columnOffset))),{...t,lineNumber:r,columnNumber:n}}var BL=t=>({lineNumber:t.lineNumber+1,columnNumber:t.columnNumber+1}),Ho=t=>({lineNumber:t.lineNumber-1,columnNumber:t.columnNumber-1});var FL=require("worker_threads");var el=require("worker_threads");function uC(t){let e=Gi(t),r=[],n=(s,{loc:a}=s,{loc:c}=s)=>{if(!a||!c)throw new Error("should include locations");r.push({start:a.start,end:c.end,depth:o.length}),o.push(s)},i=new Set,o=[];return Es(e,{enter:s=>{switch(s.type){case"FunctionDeclaration":case"ArrowFunctionExpression":n(s,s.params[0]||s.body,s.body),i.add(s.body);break;case"Program":n(s);break;case"ForStatement":case"ForOfStatement":case"ForInStatement":n(s),i.add(s.body);break;case"BlockStatement":i.has(s)||n(s);break}},leave:s=>{s===o[o.length-1]&&o.pop()}}),r}el.isMainThread||el.parentPort?.postMessage(uC(el.workerData));var tl=class t{constructor(e){this.range=e}static hydrate(e,r){let n=new t(new vr(new jr(e[0].start.line,e[0].start.column),new jr(e[0].end.line,e[0].end.column))),i=[n],o=1;for(let s=1;s<e.length;s++){let a=e[s];for(;a.depth<o;)o--,i[o].data=r(i[o]);let c=new t(new vr(new jr(a.start.line,a.start.column),new jr(a.end.line,a.end.column))),u=i[o-1];u.children??=[],u.children.push(c),i[o++]=c}for(let s=o-1;s>=0;s--)i[s].data=r(i[s]);return n}search(e){if(this.range.contains(e)){if(!this.children)return this;for(let r of this.children){let n=r.search(e);if(n)return n}return this}}findDeepest(e,r){if(this.range.contains(e)){if(this.children)for(let n of this.children){let i=n.findDeepest(e,r);if(i!==void 0)return i}return r(this)}}filterHoist(e){if(this.children)for(let r=0;r<this.children.length;r++){let n=this.children[r];if(n.filterHoist(e),!e(n)){let i=n.children||[];this.children.splice(r,1,...i),r--}}}forEach(e){e(this),this.children?.forEach(r=>r.forEach(e))}forEachDepthFirst(e){this.children?.forEach(r=>r.forEach(e)),e(this)}toJSON(){return{range:this.range,children:this.children}}},hY=1024*512;function UL(t,e){return t.length<hY?tl.hydrate(uC(t),e):new Promise((r,n)=>{let i=new FL.Worker(`${__dirname}/renameWorker.js`,{workerData:t});i.on("message",o=>r(tl.hydrate(o,e))),i.on("error",n),i.on("exit",()=>n("rename worker exited"))})}var jL=/[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/uy,WL=async(t,e)=>{let r=new Ds(t),n=new Set,i=e.decodedMappings(),o=e.names(),s=(u,l,p)=>{let d=u*2147483647+l;if(n.has(d))return;n.add(d);let f=new tt(u,l),h=r.convert(f);jL.lastIndex=h;let m=jL.exec(t);if(!m)return;let x=m[0];if(x!==p)return x},c=await UL(t,u=>{let l=u.range.begin.base0,p=u.range.end.base0,d;for(let f=l.lineNumber;f<=p.lineNumber;f++){let h=i[f];if(h)for(let m=0;m<h.length;m++){let x=h[m];if(x.length<=4)continue;let C=f,O=x[0];if(C===l.lineNumber&&l.columnNumber>O||C===p.lineNumber&&p.columnNumber<O)continue;let y=o[x[4]],T=s(C,O,y);T&&(d??=[],d.some(E=>E.compiled==T)||d.push({compiled:T,original:y}))}}return d});return c.filterHoist(u=>!!u.data),c};var Bs=Symbol("IRenameProvider"),rl=class{constructor(e,r,n){this.logger=e;this.sourceMapFactory=r;this.launchConfig=n;this.renames=new Map}provideOnStackframe(e){if(!this.launchConfig.sourceMapRenames)return En.None;let r=e.uiLocation();return r===void 0?En.None:"then"in r?r.then(n=>this.provideForSource(n?.source)):this.provideForSource(r?.source)}provideForSource(e){if(!this.launchConfig.sourceMapRenames||!(e instanceof Ct))return En.None;let r=As(e.compiledToSourceUrl.keys());if(!r)throw new Error("unreachable");if(!fc(r))return En.None;let n=this.renames.get(r.url);if(n)return n;let i=this.sourceMapFactory.load(r.sourceMap.metadata).then(async o=>{if(!o?.hasNames)return En.None;let s=await r.content();return s?await this.createFromSourceMap(o,s):En.None}).catch(()=>En.None);return this.renames.set(r.url,i),i}async createFromSourceMap(e,r){let n=Date.now(),i;try{i=await WL(r,e)}catch(s){return this.logger.info("runtime",`Error parsing content for source tree: ${s}}`,{url:e.metadata.compiledPath}),En.None}let o=Date.now();return this.logger.info("runtime",`renames calculated in ${o-n}ms`,{url:e.metadata.compiledPath}),new En(i)}};rl=I([(0,nl.injectable)(),g(0,(0,nl.inject)(Y)),g(1,(0,nl.inject)(Qi)),g(2,(0,nl.inject)(Re))],rl);var En=class t{constructor(e){this.renames=e}static{this.None=new t(new tl(vr.ZERO))}getOriginalName(e,r){return this.getClosestRename(r,n=>n.compiled===e)?.original}getCompiledName(e,r){return this.getClosestRename(r,n=>n.original===e)?.compiled}getClosestRename(e,r){return this.renames.findDeepest(e,n=>n.data?.find(r))}};var qo="$returnValue",mY="__js_debug_hoisted_",HL=()=>mY+(0,qL.randomBytes)(8).toString("hex"),kn=Symbol("IEvaluator"),il=class{constructor(e,r,n){this.cdp=e;this.renameProvider=r;this.logger=n}get hasReturnValue(){return!!this.returnValue}setReturnedValue(e){this.returnValue=e}prepare(e,{isInternalScript:r,hoist:n,renames:i,transformRanges:o}={}){r!==!1&&(e+=ht());let s=new Map;s.set(qo,HL());for(let u of n??[])s.set(u,HL());let{transformed:a,hoisted:c}=this.replaceVariableInExpression(e,s,i,o);return c.size?{canEvaluateDirectly:!1,invoke:(u,l)=>Promise.all([...s].map(async([p,d])=>{await this.hoistValue(p===qo?this.returnValue:await l?.(p),d)||(a=a.replaceAll(d,p))})).then(()=>this.cdp.Debugger.evaluateOnCallFrame({...u,expression:a}))}:{canEvaluateDirectly:!0,invoke:u=>this.cdp.Debugger.evaluateOnCallFrame({...u,expression:a})}}async evaluate(e,r={}){if(!("callFrameId"in e))return this.cdp.Runtime.evaluate(e);let n={...r},{location:i,stackFrame:o}=r,s;if(i)await Promise.all([Promise.resolve(this.renameProvider.provideForSource(i.source)).then(a=>{n.renames={mapping:a,position:i.position}}),o&&this.setupShadowedVariableHoisting(i,o).then(a=>{a&&(s=a.doHoist,n.hoist=[...a.hoistable])})]);else if(o){let a=await this.renameProvider.provideOnStackframe(o);n.renames={mapping:a,position:o.rawPosition}}return this.prepare(e.expression,n).invoke(e,s)}async hoistValue(e,r){if(e===void 0)return!1;let n=e?.objectId,i=`setTimeout(() => { delete globalThis.${r} }, 0)`,o;return n?o=await this.cdp.Runtime.callFunctionOn({objectId:n,functionDeclaration:`function() { globalThis.${r} = this; ${i}; ${ht()} }`}):o=await this.cdp.Runtime.evaluate({expression:`globalThis.${r} = ${JSON.stringify(e?.value)};${i};`+ht()}),!!o&&!o.exceptionDetails}async setupShadowedVariableHoisting({position:e,source:r,variables:n},i){let{scopes:o}=await i.scopes(),s=await cO(o,async u=>u.source&&u.line&&u.endLine&&new vr(new ct(u.line,u.column||1),new ct(u.endLine,u.endColumn||1/0)).contains(e)&&await r.equalsDap(u.source));if(s===-1)return;this.logger.verbose("runtime",`Evaluating expression in scope ${o[s].name}`);let a=new Set;return await Promise.all(o.slice(0,s).map(async u=>{let l=await n.getVariableNames({variablesReference:u.variablesReference});for(let{name:p}of l)a.add(p)})),{hoistable:a,doHoist:async u=>{for(let l=s;l<o.length;l++)return(await n.getVariableNames({variablesReference:o[l].variablesReference})).find(d=>d.name===u)?.remoteObject}}}replaceVariableInExpression(e,r,n,i){let o=new Set,s=!1,a=(d,f)=>({type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:d}},operator:"!==",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:d},alternate:f}),c=[],u=Gi(e),l=Ty(u,{enter(d,f){let h=d;if(d.type!=="Identifier"||e[h.start-1]===".")return;if(i){if(!d.loc)throw new Error("Node should have location");let C=new vr(new jr(d.loc.start.line,d.loc.start.column),new jr(d.loc.end.line,d.loc.end.column));if(!i.some(O=>O.containsRange(C)))return}let m=r.get(d.name);if(m)return o.add(d.name),s=!0,{replace:KI(d,f)?{type:"Identifier",name:m}:a(m,gY)};let x=n?.mapping.getCompiledName(d.name,n.position);if(x)return s=!0,{replace:KI(d,f)?{type:"Identifier",name:x}:a(x,d)}},leave:()=>{c.pop()}});if(!s)return{hoisted:o,transformed:e};let p=u.body[u.body.length-1].end;return{hoisted:o,transformed:Uo(l)+e.slice(p)}}};il=I([(0,ol.injectable)(),g(0,(0,ol.inject)(lt)),g(1,(0,ol.inject)(Bs)),g(2,(0,ol.inject)(Y))],il);var gY={type:"Identifier",name:"undefined"};var nb=class t{static parse(e,r,n,i){r=lC(r,n);let o=r&&ks(r);if(o)throw new q(Ts(e,o.message));let{canEvaluateDirectly:s,invoke:a}=i.prepare(r);return new t(s?r:a)}constructor(e){typeof e=="function"?this.invoke=e:this.breakCondition=e}async shouldStayPaused(e){return this.invoke?(await this.invoke({callFrameId:e.callFrames[0].callFrameId,returnByValue:!0}))?.result.value===!0:Promise.resolve(!0)}},lC=(t,e)=>`(()=>{try{return ${t};}catch(e){console.error(\`Breakpoint condition error: \${e.message||e}\`);return ${!!e}}})()`;var yY=/^(>|>=|={1,3}|<|<=|%)?\s*([0-9]+)$/,sl=class t{constructor(e){this.predicate=e;this.hits=0;this.breakCondition=void 0}shouldStayPaused(){return Promise.resolve(this.predicate(++this.hits))}static parse(e){let r=yY.exec(e);if(!r)throw new q(UI(e));let[,n="=",i]=r;return new t(bY(e,n,Number(i)))}},bY=(t,e,r)=>{switch(e){case"=":case"==":case"===":return n=>n===r;case">":return n=>n>r;case">=":return n=>n>=r;case"<":return n=>n<r;case"<=":return n=>n<=r;case"%":return n=>n%r===0;default:throw new q(UI(t))}};var $L=require("crypto"),ob=v(H());var ib=class{constructor(e){this.invoke=e;this.breakCondition=void 0}async shouldStayPaused(e){return await this.invoke({callFrameId:e.callFrames[0].callFrameId}),!1}};var mc=class{constructor(e,r){this.breakCondition=r;let n=r&&ks(r);if(n)throw new q(Ts(e,n.message))}shouldStayPaused(){return Promise.resolve(!0)}};var Fs=class{constructor(e){this.evaluator=e}compile(e,r){let n=this.logMessageToExpression(r),i=ks(n);if(i)throw new q(Ts(e,i.message));let{canEvaluateDirectly:o,invoke:s}=this.evaluator.prepare(n);return o?new mc(e,this.logMessageToExpression(r)):new ib(s)}serializeLogStatements(e){return $O([],e,!1)}logMessageToExpression(e){let r=u=>u.replace(/%/g,"%%"),n=[],i=[],o=0;for(;;){let u=e.indexOf("{",o);if(u===-1){n.push(r(e.slice(o)));break}n.push(r(e.slice(o,u)));let[l]=kf(e.slice(u));if(o=u+l.end,o-1===u+1||e[o-1]!=="}"){n.push(r(e.slice(u,o)));continue}if(l.type!=="BlockStatement")break;l.body.length===1&&l.body[0].type==="BlockStatement"&&(l.body=kf(`(${e.slice(u+1,o-2)}})`)),i.push(Uo(this.serializeLogStatements(l.body))),n.push("%O")}let a=`console.log(${[JSON.stringify(n.join("")),...i].join(", ")}), false`,c=(0,$L.createHash)("sha256").update(a).digest("hex").slice(0,7);return a+`
//# sourceURL=logpoint-${c}.cdp`}};Fs=I([(0,ob.injectable)(),g(0,(0,ob.inject)(kn))],Fs);var vY=new mc({line:0},void 0),vye=new mc({line:0},"false"),sb=Symbol("IBreakpointConditionFactory"),al=class{constructor(e,r,n){this.logPointCompiler=e;this.evaluator=r;this.breakOnError=n.__breakOnConditionalError}getConditionFor(e){return e.condition?nb.parse(e,e.condition,this.breakOnError,this.evaluator):e.logMessage?this.logPointCompiler.compile(e,e.logMessage):e.hitCondition?sl.parse(e.hitCondition):vY}};al=I([(0,cl.injectable)(),g(0,(0,cl.inject)(Fs)),g(1,(0,cl.inject)(kn)),g(2,(0,cl.inject)(Re))],al);var ub=require("path");var ab=(t,e)=>t.lineNumber===e.lineNumber&&t.columnNumber===e.columnNumber;var cb=t=>!("location"in t),VL=t=>"location"in t,wY=(t,e)=>t.url&&e===t.url||t.urlRegex&&new RegExp(t.urlRegex).test(e),ul=class{constructor(e,r,n){this._manager=e;this._source=r;this._originalPosition=n;this.isEnabled=!1;this.setInCdpScriptIds=new Set;this.cdpScriptIds=this.setInCdpScriptIds;this.cdpBreakpoints=[];this._cdpIds=new Set}get enabled(){return this.isEnabled}get cdpIds(){return this._cdpIds}get source(){return this._source}get originalPosition(){return this._originalPosition}async updateSourceLocation(e,r,n){this._source=r,this._originalPosition=n;let i=[];for(let o of this.cdpBreakpoints)o.state===1&&i.push(this.updateUiLocations(e,o.cdpId,o.locations));await Promise.all(i)}async refreshUiLocations(e){await Promise.all(this.cdpBreakpoints.filter(r=>r.state===1).map(r=>this.updateUiLocations(e,r.cdpId,r.locations)))}async enable(e){if(this.isEnabled)return;this.isEnabled=!0;let r=[this._setPredicted(e)],n=this._manager._sourceContainer.source(this.source);if((!n||!(n instanceof Ct))&&r.push(this._setByPath(e,n?.offsetSourceToScript(this.originalPosition)||this.originalPosition)),await Promise.all(r),n&&this.isEnabled){let i=await this._manager._sourceContainer.currentSiblingUiLocations({lineNumber:this.originalPosition.lineNumber,columnNumber:this.originalPosition.columnNumber,source:n});await Promise.all(i.map(o=>this._setByUiLocation(e,n.offsetSourceToScript(o))))}}async updateUiLocations(e,r,n){this.updateExistingCdpRef(r,a=>({...a,locations:n}));let i=(await Promise.all(n.map(a=>e.rawLocationToUiLocation(e.rawLocation(a))))).find(a=>!!a);if(!i)return;let o=this._manager._sourceContainer.source(this.source);if(!o)return;let s=await this._manager._sourceContainer.currentSiblingUiLocations(i);this.updateExistingCdpRef(r,a=>{let c=s.filter(u=>u.source===o);return{...a,locations:n,uiLocations:c.length?c:s}})}compare(e){let r=this.originalPosition,n=e.originalPosition;return r.lineNumber!==n.lineNumber?r.lineNumber-n.lineNumber:r.columnNumber-n.columnNumber}async disable(){if(!this.isEnabled)return;this.isEnabled=!1;let e=this.cdpBreakpoints.map(r=>this.removeCdpBreakpoint(r));await Promise.all(e)}async updateForNewLocations(e,r){let n=this._manager._sourceContainer.source(this.source);if(!n)return[];let i=await this._manager._sourceContainer.currentSiblingUiLocations({lineNumber:this.originalPosition.lineNumber,columnNumber:this.originalPosition.columnNumber,source:n},await r.source);if(!i.length)return[];let o=[];for(let s of i)o.push(this._setForSpecific(e,r,n.offsetSourceToScript(s)));for(let s of this.cdpBreakpoints){if(!cb(s.args)||!wY(s.args,r.url))continue;let a=s.args;i.some(c=>c.columnNumber-1===a.columnNumber&&c.lineNumber-1===a.lineNumber)||(this._manager.logger.verbose("runtime.sourcemap","Adjusted breakpoint due to overlaid sourcemap",{url:n.url}),o.push(this.removeCdpBreakpoint(s)))}return await Promise.all(o),i}executionContextWasCleared(){this.updateCdpRefs(e=>e.filter(r=>cb(r.args)))}hasResolvedAt(e,r){let{lineNumber:n,columnNumber:i}=r.base0;return this.cdpBreakpoints.some(o=>o.state===1&&o.locations.some(s=>s.scriptId===e&&s.lineNumber===n&&(s.columnNumber===void 0||s.columnNumber===i)))}getBreakCondition(){}updateExistingCdpRef(e,r){this.updateCdpRefs(n=>n.map(i=>i.state!==1||i.cdpId!==e?i:r(i)))}updateCdpRefs(e){let r=this;r.cdpBreakpoints=e(this.cdpBreakpoints);let n=new Set;this.setInCdpScriptIds.clear();for(let i of this.cdpBreakpoints)if(i.state===1){n.add(i.cdpId);for(let o of i.locations)this.setInCdpScriptIds.add(o.scriptId)}this._cdpIds=n}async _setPredicted(e){if(!this.source.path||!this._manager._breakpointsPredictor)return;let r=this._manager._breakpointsPredictor.predictedResolvedLocations({absolutePath:this.source.path,lineNumber:this.originalPosition.lineNumber,columnNumber:this.originalPosition.columnNumber}),n=[];for(let i of r){let o=this._manager._sourceContainer.sourcePathResolver.absolutePathToUrlRegexp(i.absolutePath);o!==void 0&&(typeof o=="string"?n.push(this._setByUrlRegexp(e,o,i)):n.push(o.then(s=>s?this._setByUrlRegexp(e,s,i):void 0)))}await Promise.all(n)}async _setByUiLocation(e,r){await Promise.all(r.source.scripts.map(n=>this._setForSpecific(e,n,r)))}async _setByPath(e,r){let n=this._manager._sourceContainer.source({path:this.source.path});if(!(n instanceof Ct&&[...n.compiledToSourceUrl.keys()].some(o=>o.absolutePath===this.source.path)))if(this.source.path){let i=await this._manager._sourceContainer.sourcePathResolver.absolutePathToUrlRegexp(this.source.path);if(!i)return;await this._setByUrlRegexp(e,i,r)}else{let o=this._manager._sourceContainer.source(this.source)?.url;if(!o)return;await this._setByUrl(e,o,r),this.source.path!==o&&this.source.path!==void 0&&await this._setByUrl(e,We(this.source.path),r)}}hasSetOnLocation(e,r){return this.cdpBreakpoints.find(n=>e.scriptId&&VL(n.args)&&n.args.location.scriptId===e.scriptId&&ab(n.args.location,r)||e.url&&!e.hasSourceURL&&cb(n.args)&&(n.args.urlRegex?new RegExp(n.args.urlRegex).test(e.url):e.url===n.args.url)&&ab(n.args,r))}hasSetOnLocationByUrl(e,r,n){return this.cdpBreakpoints.find(i=>{if(cb(i.args))return ab(i.args,n)?e==="url"?i.args.urlRegex?new RegExp(i.args.urlRegex).test(r):i.args.url===r:e==="re"&&i.args.urlRegex===r:!1;let o=this._manager._sourceContainer.getScriptById(i.args.location.scriptId);if(o)return ab(i.args.location,n)&&e==="re"?new RegExp(r).test(o.url):o.url===r})}async _setForSpecific(e,r,n){return r.url&&!r.hasSourceURL&&(!r.embedderName||r.embedderName===r.url)?this._setByUrl(e,r.url,n):this._setByScriptId(e,r,n)}async _setByUrl(e,r,n){n=Ho(n);let i=this.hasSetOnLocationByUrl("url",r,n);if(i){i.state===0&&await i.done;return}return this._setAny(e,{url:r,condition:this.getBreakCondition(),...n})}async _setByUrlRegexp(e,r,n){n=Ho(n);let i=this.hasSetOnLocationByUrl("re",r,n);if(i){i.state===0&&await i.done;return}return this._setAny(e,{urlRegex:r,condition:this.getBreakCondition(),...n})}async _setByScriptId(e,r,n){n=Ho(n);let i=this.hasSetOnLocation(r,n);if(i){i.state===0&&await i.done;return}return this._setAny(e,{condition:this.getBreakCondition(),location:{scriptId:r.scriptId,...n}})}async _setAny(e,r){if(!this.isEnabled)return;let n={state:0,args:r,deadletter:!1};n.done=(async()=>{let i=VL(r)?await e.cdp().Debugger.setBreakpoint(r):await e.cdp().Debugger.setBreakpointByUrl(r);if(!i)return;if(n.deadletter){await e.cdp().Debugger.removeBreakpoint({breakpointId:i.breakpointId});return}let o="actualLocation"in i?[i.actualLocation]:i.locations;this._manager._resolvedBreakpoints.set(i.breakpointId,this);let s={state:1,cdpId:i.breakpointId,args:r,locations:o,uiLocations:[]};return this.updateCdpRefs(a=>a.map(c=>c===n?s:c)),await this.updateUiLocations(e,i.breakpointId,o),s})(),this.updateCdpRefs(i=>[...i,n]),await n.done}async removeCdpBreakpoint(e){this.updateCdpRefs(r=>r.filter(n=>n!==e)),e.state===0?(e.deadletter=!0,await e.done):(await this._manager._thread?.cdp().Debugger.removeBreakpoint({breakpointId:e.cdpId}),this._manager._resolvedBreakpoints.delete(e.cdpId))}};var to=class t extends ul{constructor(r,n,i){super(r,n,{lineNumber:1,columnNumber:1});this.mode=i}static getModeKeyForSource(r,n){return r===1?(0,ub.basename)(n,(0,ub.extname)(n)||void 0):n}_setPredicted(){return Promise.resolve()}_setByPath(r,n){if(!this.source.path)return Promise.resolve();let i=t.getModeKeyForSource(this.mode,this.source.path);return this.mode===1?super._setByUrlRegexp(r,Rr(i),n):super._setByPath(r,n)}};var zL=v(ge());var Rn=class extends ul{constructor(r,n,i,o,s){super(r,i,{lineNumber:o.line,columnNumber:o.column||1});this.dapId=n;this.dapParams=o;this.condition=s;this.completedSet=Ue()}equivalentTo(r){return r.dapParams.column===this.dapParams.column&&r.dapParams.line===this.dapParams.line&&r.dapParams.hitCondition===this.dapParams.hitCondition&&r.dapParams.condition===this.dapParams.condition&&r.dapParams.logMessage===this.dapParams.logMessage}untilSetCompleted(){return this.completedSet.promise}markSetCompleted(){this.completedSet.resolve()}testHitCondition(r){return this.condition.shouldStayPaused(r)}async toDap(){let r=this.getResolvedUiLocation();this.lastAnnouncedUiLocation=r;let n=this.enabled&&r;return n?{id:this.dapId,verified:!0,source:await n.source.toDap(),line:n.lineNumber,column:n.columnNumber}:{id:this.dapId,verified:!1,message:zL.t("Unbound breakpoint")}}diagnosticDump(){return{source:this.source,params:this.dapParams,cdp:this.cdpBreakpoints}}getBreakCondition(){return this.condition.breakCondition}updateCdpRefs(r){super.updateCdpRefs(r),this.getResolvedUiLocation()!==this.lastAnnouncedUiLocation&&this.notifyResolved()}getResolvedUiLocation(){for(let r of this.cdpBreakpoints)if(r.state===1&&r.uiLocations.length)return r.uiLocations[0]}async notifyResolved(){await this.completedSet.promise,await this._manager.notifyBreakpointChange(this,!0)}};var lb=class extends Rn{constructor(e,r,n,i){super(e,r,n,i,new sl(()=>!1))}getResolvedUiLocation(){}};var nM=v(Vf());var Gf=class extends to{constructor(r,n){super(r,{path:n},1);this.pattern=n}async enable(r){if(this.isEnabled)return;this.isEnabled=!0;let n=(0,nM.makeRe)(ze(this.pattern),{contains:!0,lookbehinds:!1});await this._setAny(r,{urlRegex:n.source.replace(/([a-z]):/i,(i,o)=>`[${o.toLowerCase()}${o.toUpperCase()}]:`),lineNumber:0,columnNumber:0})}};var fl=v(H());var Us={dispose:()=>{}},Ce=class{constructor(e){this.disposed=!1;this.items=[];e&&(this.items=e.slice())}get isDisposed(){return this.disposed}callback(...e){for(let r of e)this.push({dispose:r})}push(...e){return this.disposed?(e.forEach(r=>r.dispose()),e[0]):(this.items.push(...e),e[0])}disposeObject(e){this.items=this.items.filter(r=>r!==e),e.dispose()}clear(){let e=Promise.all(this.items.map(r=>r.dispose()));return this.items=[],e}dispose(){let e=Promise.all(this.items.map(r=>r.dispose()));return this.items=[],this.disposed=!0,e}};var dl=Symbol("IExperimentationService");var At=Symbol("ITelemetryReporter");var HQ=/\/node_modules\/|^node\:/,qQ=2,iM=5e3,$Q=iM/2,pt=class{constructor(e,r,n){this.telemetry=r;this.experimentation=n;this.disposable=new Ce;this.hadBreakpoint=!1;this.didVerifyBreakpoint=!1;this.hadNonModuleSourcemap=!1;this.startedAt=Date.now();this.disposable.push(pt.didVerifyEmitter.event(()=>{this.didVerifyBreakpoint=!0})),pt.consecutiveQualifyingSessions>=qQ&&this.disposable.push(aO(async()=>{this.currentlyQualifying&&await this.experimentation.getTreatment("diagnosticPrompt",!0)&&(r.report("diagnosticPrompt",{event:"suggested"}),pt.didSuggest=!0,e.suggestDiagnosticTool({}))},iM))}get currentlyQualifying(){return this.hadBreakpoint&&!this.didVerifyBreakpoint&&this.hadNonModuleSourcemap}notifyHadBreakpoint(){this.hadBreakpoint=!0}notifyVerifiedBreakpoint(){this.didVerifyBreakpoint||(pt.didVerifyEmitter.fire(),pt.didSuggest&&(pt.didSuggest=!1,this.telemetry.report("diagnosticPrompt",{event:"resolved"})))}attach(e){if(!this.hadNonModuleSourcemap){let r=this.disposable.push(e.Debugger.on("scriptParsed",n=>{n.sourceMapURL&&!HQ.test(n.url)&&(this.hadNonModuleSourcemap=!0,this.disposable.disposeObject(r))}))}}dispose(){this.currentlyQualifying&&Date.now()-$Q>this.startedAt?pt.consecutiveQualifyingSessions++:pt.consecutiveQualifyingSessions=0,this.disposable.dispose()}};pt.consecutiveQualifyingSessions=0,pt.didVerifyEmitter=new j,pt.didSuggest=!1,pt=I([(0,fl.injectable)(),g(0,(0,fl.inject)(qu)),g(1,(0,fl.inject)(At)),g(2,(0,fl.inject)(dl))],pt);var Dn=v(H());function VQ(t){let e=[];for(let r=0,n=t.length;r<n;++r){let i=t.charCodeAt(r);if(i<128)e.push(i);else if(i<2048)e.push(192|i>>6,128|i&63);else if(i<55296||i>=57344)e.push(224|i>>12,128|i>>6&63,128|i&63);else{let o=65536+((i&1023)<<10|t.charCodeAt(++r)&1023);e.push(240|o>>18&7,128|o>>12&63,128|o>>6&63,128|o&63)}}return new Uint8Array(e)}var oM=VQ;var hl=2654435761,ml=2246822519,yb=3266489917,sM=668265263,aM=374761393;function EC(t,e=0){t=typeof t=="string"?oM(t):t;let r=t,n=e+aM&4294967295,i=0;if(r.length>=16){let s=[e+hl+ml&4294967295,e+ml&4294967295,e+0&4294967295,e-hl&4294967295],a=t,c=a.length-16,u=0;for(i=0;(i&4294967280)<=c;i+=4){let l=i,p=a[l+0]+(a[l+1]<<8),d=a[l+2]+(a[l+3]<<8),f=p*ml+(d*ml<<16),h=s[u]+f&4294967295;h=h<<13|h>>>19;let m=h&65535,x=h>>>16;s[u]=m*hl+(x*hl<<16)&4294967295,u=u+1&3}n=(s[0]<<1|s[0]>>>31)+(s[1]<<7|s[1]>>>25)+(s[2]<<12|s[2]>>>20)+(s[3]<<18|s[3]>>>14)&4294967295}n=n+t.length&4294967295;let o=t.length-4;for(;i<=o;i+=4){let s=i,a=r[s+0]+(r[s+1]<<8),c=r[s+2]+(r[s+3]<<8),u=a*yb+(c*yb<<16);n=n+u&4294967295,n=n<<17|n>>>15,n=(n&65535)*sM+((n>>>16)*sM<<16)&4294967295}for(;i<r.length;++i){let s=r[i];n=n+s*aM,n=n<<11|n>>>21,n=(n&65535)*hl+((n>>>16)*hl<<16)&4294967295}return n=n^n>>>15,n=((n&65535)*ml&4294967295)+((n>>>16)*ml<<16),n=n^n>>>13,n=((n&65535)*yb&4294967295)+((n>>>16)*yb<<16),n=n^n>>>16,n<0?n+4294967296:n}var gl=Symbol("IContainer"),io=Symbol("StoragePath"),qr=Symbol("IInitializeParams"),Dt=Symbol("VSCodeApi"),bc=Symbol("IsVSCode"),Ye=Symbol("ExtensionContext"),kC=Symbol("ProcessEnv"),RC=Symbol("execa"),ve=Symbol("FS"),ui="ExtensionLocation",vc=Symbol("IBrowserFinder");var yl=Symbol("SessionSubStates"),bb=new WeakMap,He=(t,e)=>{if(!(typeof e=="object"&&e&&"dispose"in e))return e;let r=e,n=bb.get(t.container);return n?n.push(r):bb.set(t.container,[r]),e},vb=t=>{bb.get(t)?.forEach(e=>e.dispose()),bb.delete(t)},_r=Symbol("IExtensionContribution"),Vo=Symbol("IDebugTerminalOptionsProviders");var Sb=v(H());var cM=v(require("fs")),wb=v(require("path")),uM=t=>{let e={};f(e);function r(m,x){return t({category:"telemetry",output:m,data:x})}let n=m=>r("js-debug/dap/operation",{...e,...m}),i=m=>r("js-debug/cdp/operation",{...e,...m}),o=m=>r("js-debug/error",{...e,...m}),s=m=>r("blazor-debug/blazorDebugException",{...e,...m}),a=m=>{e.browser=(m.targetProject||m.targetProject)+"/"+m.targetVersion,r("js-debug/browserVersion",{...e,...m})},c=m=>r("js-debug/breakpointStats",{...e,...m}),u=m=>r("js-debug/statistics",{...e,...m}),l=m=>{e.nodeVersion=m.version,r("js-debug/nodeRuntime",{...e,...m})},p=m=>{r("js-debug/launch",{...e,...m,parameters:JSON.stringify(m.parameters)})},d=m=>{r("js-debug/diagnosticPrompt",{...e,...m})};function f(m){try{let x=wb.resolve(wb.dirname(__filename),"..","..",".gitcommit");m.jsDebugCommitId=cM.readFileSync(x,"utf8")}catch{}}return{breakpointStats:c,statistics:u,browserVersion:a,cdpOperation:i,dapOperation:n,error:o,launch:p,nodeRuntime:l,diagnosticPrompt:d,setGlobalMetric:(m,x)=>{e[m]=x},blazorDebugException:s}};var zf=class{constructor(e=!0){this.isVSCode=e;this.measurements=Object.create(null)}add(e,r,n){let i=this.measurements[e];i||(i=this.measurements[e]={times:[],errors:[]}),i.times.push(r),n&&i.errors.push(n)}flush(){let e={errors:[]};for(let r in this.measurements){let{times:n,errors:i}=this.measurements[r],o={operation:r,totalTime:0,max:0,avg:0,stddev:0,count:n.length,failed:i.length};for(let s of n)o.totalTime+=s,o.max=Math.max(o.max,s);o.avg=o.totalTime/o.count;for(let s of n)o.stddev+=(s-o.avg)**2;o.stddev=Math.sqrt(o.stddev/(n.length-1)),e[o.operation]=o,e[`!${o.operation}.errors`]=i,this.isVSCode||(e[`${o.operation}.errors`]=i)}return this.measurements=Object.create(null),e}};var $r=class{constructor(e=!0){this.isVsCode=e;this.target=[];this.flushEmitter=new j;this.loggers=uM(e=>this.pushOutput(e));this.batchFlushTimeout={};this.batchers={dapOperation:new zf(this.isVsCode),cdpOperation:new zf(this.isVsCode)};this.onFlush=this.flushEmitter.event;this.setGlobalMetric=this.loggers.setGlobalMetric}report(e,...r){let n=this.loggers[e];n(...r)}reportOperation(e,r,n,i){this.batchers[e].add(r,n,i),this.batchFlushTimeout[e]===void 0&&(this.batchFlushTimeout[e]=setTimeout(()=>{this.report(e,this.batchers[e].flush()),this.batchFlushTimeout[e]=void 0},$r.batchFlushInterval))}attachDap(e){this.target instanceof Array&&this.target.forEach(r=>e.output(r)),this.target=e}flush(){this.flushEmitter.fire();let e=Object.entries(this.batchFlushTimeout);for(let[r,n]of e){let i=this.batchers[r].flush();i.length&&this.report(r,i),this.batchFlushTimeout[r]=void 0,clearTimeout(n)}}dispose(){for(let e of Object.values(this.batchFlushTimeout))e&&clearTimeout(e)}pushOutput(e){e.data=AC(e.data),this.target instanceof Array?this.target.push(e):this.target.output(e)}};$r.batchFlushInterval=5e3,$r=I([(0,Sb.injectable)(),g(0,(0,Sb.inject)(bc))],$r);var AC=t=>typeof t=="number"?Number(t.toFixed(1)):typeof t!="object"||!t?t:t instanceof Error?DC(t):t instanceof Array?t.map(AC):ko(t,AC),lM=/(?:[A-z]:)?(?:[\\/][^:]*)+[\\/]([^:]*:)/g;function DC(t){let e=String(t.message),r=String(t.name);lM.lastIndex=0;let n=typeof t.stack=="string"?t.stack.replace(lM,"$1"):void 0;return{error:{message:e,name:r,stack:n}}}var fM=require("crypto"),oo=v(H());var wc=Symbol("IDwarfModuleProvider");var Ib=Symbol("IWasmSymbolProvider"),LC=Symbol("IWasmWorkerFactory"),Cb=t=>t.replace(/\.wasm$/i,"")+".wat",bl=class{constructor(e,r){this.dwarf=e;this.launchConfig=r;this.cdpCounter=0;this.cdp=new Map;this.prompt=me(()=>this.dwarf.prompt())}async spawn(e){if(!this.launchConfig.enableDWARF)return null;this.worker??=this.dwarf.load().then(i=>{if(!i)return null;let o=i.spawn({getWasmGlobal:(s,a)=>this.loadWasmValue(`globals[${s}]`,a),getWasmLocal:(s,a)=>this.loadWasmValue(`locals[${s}]`,a),getWasmOp:(s,a)=>this.loadWasmValue(`stack[${s}]`,a),getWasmLinearMemory:(s,a,c)=>this.loadWasmValue(`[].slice.call(new Uint8Array(memories[0].buffer, ${+s}, ${+a}))`,c).then(u=>new Uint8Array(u).buffer)});return o.rpc.sendMessage("hello",[],!1),o});let r=await this.worker;if(!r)return null;let n=this.cdpCounter++;return this.cdp.set(n,e),{rpc:r.rpc,getStopId:i=>`${n}:${i}`,dispose:()=>(this.cdp.delete(n),this.cdp.size>0?Promise.resolve():(this.worker=void 0,r.dispose()))}}async dispose(){await this.worker?.then(e=>e?.dispose()),this.worker=Promise.resolve(null)}async loadWasmValue(e,r){let n=r,i=n.indexOf(":"),o=n.substring(0,i),s=n.substring(i+1),a=await this.cdp.get(+o)?.Debugger.evaluateOnCallFrame({callFrameId:s,expression:e+ht(),silent:!0,returnByValue:!0,throwOnSideEffect:!0});if(!a||a.exceptionDetails)throw new Error(`evaluate failed: ${a?.exceptionDetails?.text||"unknown"}`);return a.result.value}};bl=I([(0,oo.injectable)(),g(0,(0,oo.inject)(wc)),g(1,(0,oo.inject)(Re))],bl);var vl=class{constructor(e,r,n,i){this.dwarf=e;this.cdp=r;this.logger=n;this.launchConfig=i;this.worker=me(()=>this.dwarf.spawn(this.cdp))}async loadWasmSymbols(e){if(!this.launchConfig.enableDWARF)return this.defaultSymbols(e);let r=await this.worker();if(!r){let l=this.defaultSymbols(e);return l.onDidDisassemble=this.dwarf.prompt,l}let{rpc:n}=r,i=(0,fM.randomUUID)(),o;try{let l=e.debugSymbols;if(GQ(l)&&l.externalURL)o=new URL(l.externalURL);else if(Array.isArray(l)){let p=e.debugSymbols?.find(d=>(d.type==="EmbeddedDWARF"||d.type==="ExternalDWARF")&&d.externalURL);p?.externalURL&&(o=new URL(p.externalURL))}}catch{}let s=new URL(e.url),a=s.hostname==="localhost"?["127.0.0.1","[::1]","localhost"]:[s.hostname],c=o?.hostname==="localhost",u;for(let l of a){s.hostname=l,o&&c&&(o.hostname=l);try{u=await n.sendMessage("addRawModule",i,o?.toString(),{url:s.toString(),code:!o&&s.protocol.startsWith("wasm:")?await this.getBytecode(e.scriptId):void 0});break}catch(p){this.logger.warn("sourcemap.parsing",`failed to load wasm symbols for ${s}`,{error:p})}}return u?!(u instanceof Array)||u.length===0?(n.sendMessage("removeRawModule",i),this.defaultSymbols(e)):(this.logger.info("sourcemap.parsing","parsed files from wasm",{files:u}),new OC(e,this.cdp,i,r,u)):this.defaultSymbols(e)}async dispose(){await this.worker.value?.then(e=>e?.dispose())}defaultSymbols(e){return new _b(e,this.cdp,[])}async getBytecode(e){let n=(await this.cdp.Debugger.getScriptSource({scriptId:e}))?.bytecode;return n?Buffer.from(n,"base64").buffer:void 0}};vl=I([(0,oo.injectable)(),g(0,(0,oo.inject)(LC)),g(1,(0,oo.inject)(lt)),g(2,(0,oo.inject)(Y)),g(3,(0,oo.inject)(Re))],vl);var GQ=t=>!!t?.externalURL;var _b=class{constructor(e,r,n){this.event=e;this.cdp=r;this.doDisassemble=me(async()=>{let e=[],r;for await(let n of this.getDisassembledStream()){e=e.concat(n.lines);let i;if(r){let o=new Uint32Array(r.length+n.lines.length);i=r.length,o.set(r),r=o}else r=new Uint32Array(n.lines.length),i=0;for(let o=0;o<n.lines.length;o++)r[i+o]=n.bytecodeOffsets[o]}return r??=new Uint32Array(0),{lines:e,byteOffsetsOfLines:r}});this.decompiledUrl=Cb(e.url),n.push(this.decompiledUrl),this.files=n}async getDisassembly(){let{lines:e}=await this.doDisassemble();return this.onDidDisassemble?.(),e.join(`
`)}originalPositionFor(e){return this.disassembledPositionFor(e)}async disassembledPositionFor(e){let{byteOffsetsOfLines:r}=await this.doDisassemble(),n=eL(r,e.base0.columnNumber,(i,o)=>i-o);if(n!==r.length)return{url:this.decompiledUrl,position:new tt(n,0)}}async compiledPositionFor(e,r){if(e!==this.decompiledUrl)return[];let{byteOffsetsOfLines:n}=await this.doDisassemble(),{lineNumber:i}=r.base0;if(i>=n.length)return[];let o=n[r.base0.lineNumber];return[new tt(0,o)]}dispose(){}async*getDisassembledStream(){let{scriptId:e}=this.event,r=await this.cdp.Debugger.disassembleWasmModule({scriptId:e});if(r)for(yield r.chunk;r.streamId;){let n=await this.cdp.Debugger.nextWasmDisassemblyChunk({streamId:r.streamId});if(!n)return;yield n.chunk}}},OC=class extends _b{constructor(r,n,i,o,s){super(r,n,s);this.moduleId=i;this.worker=o;this.mappedLines=new Map}get codeOffset(){return this.event.codeOffset||0}async originalPositionFor(r){let n=await this.worker.rpc.sendMessage("rawLocationToSourceLocation",{codeOffset:r.base0.columnNumber-this.codeOffset,inlineFrameIndex:r.base0.lineNumber,rawModuleId:this.moduleId});return n.length?{position:new tt(n[0].lineNumber,n[0].columnNumber),url:n[0].sourceFileURL}:super.originalPositionFor(r)}async compiledPositionFor(r,n){if(r===this.decompiledUrl)return super.compiledPositionFor(r,n);let{lineNumber:i,columnNumber:o}=n.base0,s=await this.worker.rpc.sendMessage("sourceLocationToRawLocation",{lineNumber:i,columnNumber:o===0?-1:o,rawModuleId:this.moduleId,sourceFileURL:r});if(o===0&&s.length===0){let a=await this.getMappedLines(r),c=a.find(u=>u>i);if(!a.includes(i)&&c)return this.compiledPositionFor(r,new tt(c,0))}return s.filter(a=>a.rawModuleId===this.moduleId).map(a=>new tt(0,this.codeOffset+a.startOffset))}dispose(){return this.worker.rpc.sendMessage("removeRawModule",this.moduleId)}async getVariablesInScope(r,n){let i={codeOffset:n.base0.columnNumber-this.codeOffset,inlineFrameIndex:n.base0.lineNumber,rawModuleId:this.moduleId};return(await this.worker.rpc.sendMessage("listVariablesInScope",i)).map(s=>({name:s.name,scope:s.scope,type:s.type,evaluate:async()=>{let a=await this.worker.rpc.sendMessage("evaluate",s.name,i,this.worker.getStopId(r));return a?new xb(a,this.worker.rpc):pM}}))}async getFunctionStack(r){let n=await this.worker.rpc.sendMessage("getFunctionInfo",{codeOffset:r.base0.columnNumber-this.codeOffset,inlineFrameIndex:r.base0.lineNumber,rawModuleId:this.moduleId});return"frames"in n?n.frames:[]}async getStepSkipList(r,n,i,o){if(i===this.decompiledUrl)return[];let s={codeOffset:n.base0.columnNumber-this.codeOffset,inlineFrameIndex:n.base0.lineNumber,rawModuleId:this.moduleId},a=()=>o&&i?this.worker.rpc.sendMessage("sourceLocationToRawLocation",{lineNumber:o.base0.lineNumber,columnNumber:-1,rawModuleId:this.moduleId,sourceFileURL:i}):[],c;switch(r){case 2:{c=await this.worker.rpc.sendMessage("getInlinedFunctionRanges",s);break}case 1:{let u=await Promise.all([this.worker.rpc.sendMessage("getInlinedCalleesRanges",s),a()]);c=Ao(u);break}case 0:c=await a();break;default:c=[];break}return c.map(u=>new vr(new tt(0,u.startOffset+this.codeOffset),new tt(0,u.endOffset+this.codeOffset)))}async evaluate(r,n,i){try{let o=await this.worker.rpc.sendMessage("evaluate",i,{codeOffset:n.base0.columnNumber-this.codeOffset,inlineFrameIndex:n.base0.lineNumber,rawModuleId:this.moduleId},this.worker.getStopId(r));return o?new xb(o,this.worker.rpc):pM}catch(o){throw new q(Ve(o.message))}}getMappedLines(r){let n=this.mappedLines.get(r);if(n)return n;let i=(async()=>{try{let o=await this.worker.rpc.sendMessage("getMappedLines",this.moduleId,r);return new Uint32Array(o?.sort((s,a)=>s-a)||[])}catch{return new Uint32Array}})();return this.mappedLines.set(r,i),i}},pM={type:"null",description:"no properties"},xb=class t{constructor(e,r){if(this.type=e.type,this.description=e.description,this.linearMemoryAddress=e.linearMemoryAddress,this.linearMemorySize=e.linearMemoryAddress,e.objectId&&e.hasChildren){let n=e.objectId;this.getChildren=me(()=>this._getChildren(r,n))}}async _getChildren(e,r){return(await e.sendMessage("getProperties",r)).map(i=>({name:i.name,value:new t(i.value,e)}))}};var js=Symbol("IScriptSkipper");function hM(t){return typeof t.lineNumber=="number"&&typeof t.columnNumber=="number"&&!!t.source}var mM=()=>({source:null,line:null,column:null,name:null,lastColumn:null,isSourceMapLoadFailure:!0}),zQ=/\?t=[0-9]+$/,KQ=t=>t.endsWith(".hot-update.js")||zQ.test(t),JQ={load:0,resolveLocation:2e3,sourceMapMinPause:1e3,output:1e3,sourceMapCumulativePause:1e4},gM=(t,e)=>e instanceof Ct&&e.compiledToSourceUrl.has(t);var yM=2**31-1,Gt=class{constructor(e,r,n,i,o,s,a,c,u){this.sourceMapFactory=r;this.logger=n;this.launchConfig=i;this.initializeConfig=o;this.sourcePathResolver=s;this.scriptSkipper=a;this.resourceProvider=c;this.wasmSymbols=u;this.rootPaths=[];this.scriptsById=new Map;this.onSourceMappedSteppingChangeEmitter=new j;this.onScriptEmitter=new j;this._sourceByOriginalUrl=new Vi(e=>e.toLowerCase());this._sourceByReference=new Map;this._sourceMapSourcesByUrl=new Map;this._sourceByAbsolutePath=ic();this._sourceMapTimeouts=JQ;this._fileContentOverridesForTest=new Map;this._temporarilyDisabledSourceMaps=new Set;this._permanentlyDisabledSourceMaps=new Set;this.onScript=this.onScriptEmitter.event;this._statistics={fallbackSourceMapCount:0};this._doSourceMappedStepping=this.launchConfig.sourceMaps;this.onSourceMappedSteppingChange=this.onSourceMappedSteppingChangeEmitter.event;this._dap=e;let l="webRoot"in i?i.webRoot:i.rootPath;l&&(this.rootPaths=[l,on(l,"..","ClientApp")]),a.setSourceContainer(this),this.setSourceMapTimeouts({...this.sourceMapTimeouts(),...i.timeouts})}get sources(){return this._sourceByReference.values()}statistics(){return this._statistics}get doSourceMappedStepping(){return this._doSourceMappedStepping}set doSourceMappedStepping(e){e!==this._doSourceMappedStepping&&(this._doSourceMappedStepping=e,this.onSourceMappedSteppingChangeEmitter.fire(e))}setSourceMapTimeouts(e){this._sourceMapTimeouts=e}sourceMapTimeouts(){return this._sourceMapTimeouts}setFileContentOverrideForTest(e,r){r===void 0?this._fileContentOverridesForTest.delete(e):this._fileContentOverridesForTest.set(e,r)}async loadedSources(){let e=[];for(let r of this._sourceByReference.values())e.push(r.toDap());return await Promise.all(e)}source(e){if(e.sourceReference)return this._sourceByReference.get(e.sourceReference);if(e.path)return this._sourceByAbsolutePath.get(e.path)}isSourceSkipped(e){return this.scriptSkipper.isScriptSkipped(e)}addScriptById(e){this.scriptsById.set(e.scriptId,e),"source"in e&&this.onScriptEmitter.fire(e)}getSourceScriptById(e){return this.scriptsById.get(e)}getScriptById(e){let r=this.scriptsById.get(e);return r&&"source"in r?r:void 0}getSourceByOriginalUrl(e){return this._sourceByOriginalUrl.get(e)}getSourceReference(e){let r=EC(e)&yM;for(let n=0;n<65535;n++){if(!this._sourceByReference.has(r))return r;r===yM&&(r=0),r++}return this.logger.assert(!1,"Max iterations exceeding for source reference assignment"),r}async preferredUiLocation(e){let r=!1,n=4;for(;;){let i=await this._originalPositionFor(e);if(!hM(i)){n=r?void 0:i;break}e=i,r=!0,n=void 0}return{...e,isMapped:r,unmappedReason:n}}async currentSiblingUiLocations(e,r){let n=await this._uiLocations(e);return r?n.filter(i=>i.source===r):n}clear(e){this.scriptsById.clear();for(let r of this._sourceByReference.values())this.removeSource(r,e);this._sourceByReference.clear(),this.sourceMapFactory instanceof Ns&&this.sourceMapFactory.invalidateCache()}async _uiLocations(e){let[r,n]=await Promise.all([this.getSourceMapUiLocations(e),this.getCompiledLocations(e)]);return[...r,e,...n]}async getSourceMapUiLocations(e){let r=await this._originalPositionFor(e);if(!hM(r))return[];let n=await this.getSourceMapUiLocations(r);return n.push(r),n}async _originalPositionFor(e){if(!Ar(e.source))return 1;let r=await Uf.waitForValueWithTimeout(e.source.sourceMap,this._sourceMapTimeouts.resolveLocation);if(!r)return 2;if(this._doSourceMappedStepping)return this._originalPositionForMap(e,r);if(cC(r)){let n=await r.disassembledPositionFor(new ct(e.lineNumber,e.columnNumber)),i=n&&e.source.sourceMap.sourceByUrl.get(n.url);if(i)return i?{columnNumber:n.position.base1.lineNumber,lineNumber:n.position.base1.lineNumber,source:i}:3}return 0}async _originalPositionForMap(e,r){let n=e.source;if(!Ar(n))return 1;if(this._temporarilyDisabledSourceMaps.has(n)||this._permanentlyDisabledSourceMaps.has(n))return 0;let i=await this.getOptiminalOriginalPosition(r,ML(e,n.inlineScriptOffset));if(!i)return 3;let o=n.sourceMap.sourceByUrl.get(i.url);if(!o)return 3;let s=i.position.base1;return{lineNumber:s.lineNumber,columnNumber:s.columnNumber,source:o}}async getCompiledLocations(e){if(!(e.source instanceof Ct))return[];let r=[];for(let[n,i]of e.source.compiledToSourceUrl){let o=await Uf.waitForValueWithTimeout(n.sourceMap,this._sourceMapTimeouts.resolveLocation);if(!o)continue;let s;if("decompiledUrl"in o){let a=await o.compiledPositionFor(i,new ct(e.lineNumber,e.columnNumber));if(!a)continue;s=a.map(c=>({lineNumber:c.base1.lineNumber,columnNumber:c.base1.columnNumber,source:n}))}else{let a=this.sourceMapFactory.guardSourceMapFn(o,()=>ky(i,e,o),mM);if(!a||a.line===null)continue;let{lineNumber:c,columnNumber:u}=NL({lineNumber:a.line||1,columnNumber:(a.column||0)+1},n.inlineScriptOffset),l={lineNumber:c,columnNumber:u,source:n};s=[l,...await this.getCompiledLocations(l)]}r=r.concat(s)}return r}async getOptiminalOriginalPosition(e,r){if(cC(e))return await e.originalPositionFor(new ct(r.lineNumber,r.columnNumber));let n=this.sourceMapFactory.guardSourceMapFn(e,()=>{let i=e.originalPositionFor({line:r.lineNumber,column:r.columnNumber-1,bias:Fo});return i.line!==null?i:e.originalPositionFor({line:r.lineNumber,column:r.columnNumber-1,bias:ju})},mM);if(!(n.column===null||n.line===null||n.source===null))return{position:new jr(n.line,n.column),url:n.source}}async addSource(e,r,n,i,o,s){let a=await this.sourcePathResolver.urlToAbsolutePath({url:e.url});this.logger.verbose("runtime.sourcecreate","Creating source from url",{inputUrl:e.url,absolutePath:a});let c;return e.scriptLanguage==="WebAssembly"?c=new rb(this,e,a):c=new dc(this,e.url,a,r,n&&this.sourcePathResolver.shouldResolveSourceMap({sourceMapUrl:n,compiledPath:a||e.url})?{sourceMapUrl:n,compiledPath:a||e.url,cacheKey:e.hash}:void 0,i,o,s),this._addSource(c),c}async _addSource(e){let r=e.url&&this._sourceByOriginalUrl.get(e.url);r&&!gM(r,e)&&this.removeSource(r,!0),this._sourceByOriginalUrl.set(e.url,e),this._sourceByReference.set(e.sourceReference,e),e instanceof Ct&&this._sourceMapSourcesByUrl.set(e.url,e);let n=this._sourceByAbsolutePath.get(e.absolutePath);(n===void 0||n.url.length>=e.url.length||gM(n,e))&&this._sourceByAbsolutePath.set(e.absolutePath,e),this.scriptSkipper.initializeSkippingValueForSource(e),e.sendLazy||this.emitLoadedSource(e),fc(e)?this._finishAddSourceWithSourceMap(e):hc(e)&&this._finishAddSourceWithWasm(e)}async _finishAddSourceWithWasm(e){let r=await this.wasmSymbols.loadWasmSymbols(e.event),n=[];for(let i of r.files){let o,s,a;i===r.decompiledUrl?(o=Cb(e.absolutePath),s=Cb(e.url),a=()=>r.getDisassembly()):(o=await this.sourcePathResolver.urlToAbsolutePath({url:i}),s=o?We(o):i,a=()=>this.resourceProvider.fetch(s).then(u=>u.body)),this.logger.verbose("runtime.sourcecreate","Creating wasm source from source map",{inputUrl:i,absolutePath:o,resolvedUrl:s});let c=new Ct(this,s,o,a);c.compiledToSourceUrl.set(e,i),e.sourceMap.sourceByUrl.set(i,c),n.push(this._addSource(c))}await Promise.all(n),e.sourceMap.value.resolve(r)}async _finishAddSourceWithSourceMap(e){let r=e.sourceMap.value,n;try{n=await this.sourceMapFactory.load(e.sourceMap.metadata)}catch(i){if(this.initializeConfig.clientID==="visualstudio"){let o=e.sourceMap.metadata.sourceMapUrl;try{let s=await this.sourcePathResolver.urlToAbsolutePath({url:o});s&&(e.sourceMap.metadata.sourceMapUrl=We(s)),n=await this.sourceMapFactory.load(e.sourceMap.metadata),this._statistics.fallbackSourceMapCount++,this.logger.info("sourcemap.parsing","Failed to process original source-map; falling back to storage source-map",{fallbackSourceMapUrl:e.sourceMap.metadata.sourceMapUrl,originalSourceMapUrl:o,originalSourceMapError:DC(i)})}catch{}}if(n===void 0)return this._dap.output({output:by(e.url,i.message).error.format+`
`,category:"stderr"}),r.resolve(void 0)}if(this._sourceByReference.get(e.sourceReference)!==e)return r.resolve(void 0);this.logger.verbose("sourcemap.parsing","Creating sources from source map",{sourceMapId:n.id,metadata:n.metadata});try{await this._addSourceMapSources(e,n)}finally{r.resolve(n)}this.scriptSkipper.initializeSkippingValueForSource(e)}removeSource(e,r=!1){let n=this._sourceByReference.get(e.sourceReference);if(n!==void 0){if(this.logger.assert(e===n,"Expected source to be the same as the existing reference"),this._sourceByReference.delete(e.sourceReference),this._sourceByOriginalUrl.get(e.url)===e&&this._sourceByOriginalUrl.delete(e.url),e instanceof Ct){this._sourceMapSourcesByUrl.delete(e.url);for(let[i,o]of e.compiledToSourceUrl)i.sourceMap.sourceByUrl.delete(o)}this._sourceByAbsolutePath.delete(e.absolutePath),Ar(e)&&(this._permanentlyDisabledSourceMaps.delete(e),this._temporarilyDisabledSourceMaps.delete(e)),!r&&e.hasBeenAnnounced&&e.toDap().then(i=>this._dap.loadedSource({reason:"removed",source:i})),hc(e)&&e.sourceMap.value.promise.then(i=>i?.dispose()),Ar(e)&&this._removeSourceMapSources(e,r)}}emitLoadedSource(e){return e.hasBeenAnnounced=!0,e.toDap().then(r=>this._dap.loadedSource({reason:"new",source:r}))}async _addSourceMapSources(e,r){let n=[];for(let i of r.sources){if(i===null)continue;let o=await this.sourcePathResolver.urlToAbsolutePath({url:i,map:r}),s=o?We(o):r.computedSourceUrl(i),a=this._sourceMapSourcesByUrl.get(s);if(e===a)continue;if(a)if(KQ(e.url))this.removeSource(a);else{a.compiledToSourceUrl.set(e,i),e.sourceMap.sourceByUrl.set(i,a);continue}this.logger.verbose("runtime.sourcecreate","Creating source from source map",{inputUrl:i,sourceMapId:r.id,absolutePath:o,resolvedUrl:s});let c=o&&We(o),u=this.sourceMapFactory.guardSourceMapFn(r,()=>r.sourceContentFor(i),()=>null),l;if(u){let d=Gu(u);if(d&&(!cr(d)&&o?l=Rs(o?We(o):i,d):l=d),o&&l){let f={sourceMapUrl:l,compiledPath:o};this.sourcePathResolver.shouldResolveSourceMap(f)||(l=void 0)}}let p=new Ct(this,s,o,u!==null?()=>Promise.resolve(u):c?()=>this.resourceProvider.fetch(c).then(d=>d.body):()=>e.content(),l?{compiledPath:o||s,sourceMapUrl:l,cacheKey:r.metadata.cacheKey}:void 0,void 0,e.runtimeScriptOffset);p.compiledToSourceUrl.set(e,i),e.sourceMap.sourceByUrl.set(i,p),n.push(this._addSource(p))}await Promise.all(n)}_removeSourceMapSources(e,r){for(let n of e.sourceMap.sourceByUrl.keys()){let i=e.sourceMap.sourceByUrl.get(n);i&&(e.sourceMap.sourceByUrl.delete(n),i.compiledToSourceUrl.delete(e),!i.compiledToSourceUrl.size&&this.removeSource(i,r))}}async waitForSourceMapSources(e){return Ar(e)?[...(await Uf.waitForSources(e.sourceMap)).values()]:[]}async revealUiLocation(e){this._dap.revealLocationRequested({source:await e.source.toDap(),line:e.lineNumber,column:e.columnNumber})}disableSourceMapForSource(e,r=!1){r?this._permanentlyDisabledSourceMaps.add(e):this._temporarilyDisabledSourceMaps.add(e)}clearDisabledSourceMaps(e){e?this._temporarilyDisabledSourceMaps.delete(e):this._temporarilyDisabledSourceMaps.clear()}};Gt=I([(0,Dn.injectable)(),g(0,(0,Dn.inject)(Ur)),g(1,(0,Dn.inject)(Qi)),g(2,(0,Dn.inject)(Y)),g(3,(0,Dn.inject)(Re)),g(4,(0,Dn.inject)(qr)),g(5,(0,Dn.inject)(je)),g(6,(0,Dn.inject)(js)),g(7,(0,Dn.inject)(tc)),g(8,(0,Dn.inject)(Ib))],Gt);var bM=t=>t.originalPosition.columnNumber===1&&t.originalPosition.lineNumber===1,vM=500,wM=Symbol("DontCompare");var On=class{constructor(e,r,n,i,o,s,a){this.logger=n;this.launchConfig=i;this.conditionFactory=o;this.suggester=s;this._breakpointsPredictor=a;this._resolvedBreakpoints=new Map;this._totalBreakpointsCount=0;this._launchBlocker=new Set;this._predictorDisabledForTest=!1;this._breakpointsStatisticsCalculator=new $y;this.entryBreakpointMode=0;this._enabledFilter=()=>!0;this._byDapId=new Map;this._byPath=ic();this._byRef=new Map;this.moduleEntryBreakpoints=ic();this._dap=e,this._sourceContainer=r,a?.onLongParse(()=>e.longPrediction({})),r.onScript(c=>{c.source.then(u=>{let l=this._thread;l&&this._byRef.get(u.sourceReference)?.forEach(p=>p.updateForNewLocations(l,c))})}),r.onSourceMappedSteppingChange(()=>{if(this._thread)for(let c of this._byDapId.values())c.refreshUiLocations(this._thread)}),this._scriptSourceMapHandler=async(c,u)=>{if(!n.assert(this._thread,"Expected thread to be set for the breakpoint source map handler"))return[];let l=[],p=[u];for(let d=0;d<p.length;d++)for(let f of p[d]){let h=f.absolutePath,m=h?this._byPath.get(h):void 0;for(let C of m||[])l.push(C.updateForNewLocations(this._thread,c));let x=this._byRef.get(f.sourceReference);for(let C of x||[])l.push(C.updateForNewLocations(this._thread,c));f.sourceMap&&p.push(f.sourceMap.sourceByUrl.values())}return Ao(await Promise.all(l))}}get appliedByPath(){return this._byPath}get appliedByRef(){return this._byRef}hasAtLocation(e){let r=this._byPath.get(e.source.absolutePath)||[],n=this._byRef.get(e.source.sourceReference)||[];return r.concat(n).some(i=>i.originalPosition.columnNumber===e.columnNumber&&i.originalPosition.lineNumber===e.lineNumber)}async moveBreakpoints(e,r,n,i){let o=l=>Yk(l,async p=>{let d=await this._sourceContainer.getOptiminalOriginalPosition(n,p.originalPosition);if(!d)return!1;let f=d.position.base1;return p.updateSourceLocation(e,{path:i.absolutePath,sourceReference:i.sourceReference},{lineNumber:f.lineNumber,columnNumber:f.columnNumber,source:i}),!1}),s=r.absolutePath,a=i.absolutePath,c=s?this._byPath.get(s):void 0;if(c&&a){let[l,p]=await o(c);this._byPath.set(s,l),this._byPath.set(a,p)}let u=this._byRef.get(r.sourceReference);if(u){let[l,p]=await o(u);this._byRef.set(r.sourceReference,l),this._byRef.set(i.sourceReference,p)}}async updateEntryBreakpointMode(e,r){if(r===this.entryBreakpointMode)return;let n=[...this.moduleEntryBreakpoints.values()];this.moduleEntryBreakpoints.clear(),this.entryBreakpointMode=r,await Promise.all(n.map(i=>this.ensureModuleEntryBreakpoint(e,i.source)))}async applyEnabledFilter(e,r=wM){if(r!==wM&&this._enabledFilter!==r)return;this._enabledFilter=e||(()=>!0);let n=this._thread;n&&await Promise.all([...this._byDapId.values()].map(i=>this._enabledFilter(i)?i.enable(n):i.disable()))}async getBreakpointLocations(e,r,n,i){let o=n.base1,s=i.base1,[a,c]=await Promise.all([this._sourceContainer.currentSiblingUiLocations({source:r,lineNumber:o.lineNumber,columnNumber:o.columnNumber}),this._sourceContainer.currentSiblingUiLocations({source:r,lineNumber:s.lineNumber,columnNumber:s.columnNumber})]);if(a.length!==c.length)return this.logger.warn("internal","Expected to have the same number of start and end locations"),[];let u=[],l=[];for(let p=0;p<a.length;p++){let d=a[p],f=c[p];if(d.source!==f.source){this.logger.warn("internal","Expected to have the same number of start and end scripts");continue}let h=d.source;if(!h.scripts.length)continue;let{scriptId:m}=h.scripts[h.scripts.length-1];u.push(e.cdp().Debugger.getPossibleBreakpoints({restrictToFunction:!1,start:{scriptId:m,...h.offsetSourceToScript(Ho(d))},end:{scriptId:m,...h.offsetSourceToScript(Ho(f))}}).then(x=>{if(x?.locations)return Promise.all(x.locations.map(async C=>{let{lineNumber:O,columnNumber:y=0}=C,T=await this._sourceContainer.currentSiblingUiLocations({source:h,...h.offsetScriptToSource(BL({lineNumber:O,columnNumber:y}))});l.push({breakLocation:C,uiLocations:T})}))}))}return await Promise.all(u),l}setThread(e){this._thread=e,this._thread.cdp().Debugger.on("breakpointResolved",async r=>{let n=this._resolvedBreakpoints.get(r.breakpointId)||await _e(0).then(()=>this._resolvedBreakpoints.get(r.breakpointId));n&&n.updateUiLocations(e,r.breakpointId,[r.location])}),this._thread.setSourceMapDisabler(r=>{let n=[];for(let i of r){let o=this._resolvedBreakpoints.get(i);if(o){let s=this._sourceContainer.source(o.source);Ar(s)&&n.push(s)}}return n});for(let r of this._byPath.values())r.forEach(n=>this._setBreakpoint(n,e)),this.ensureModuleEntryBreakpoint(e,r[0]?.source);for(let r of this._byRef.values())r.forEach(n=>this._setBreakpoint(n,e));"runtimeSourcemapPausePatterns"in this.launchConfig&&this.launchConfig.runtimeSourcemapPausePatterns.length&&this.setRuntimeSourcemapPausePatterns(e,this.launchConfig.runtimeSourcemapPausePatterns),this._byDapId.size>0&&this._installSourceMapHandler(this._thread)}async launchBlocker(){Wy(this.logger,"BreakpointManager.launchBlocker",async()=>{this._predictorDisabledForTest||await Promise.all([...this._launchBlocker])})}setRuntimeSourcemapPausePatterns(e,r){return Promise.all(r.map(n=>this._setBreakpoint(new Gf(this,n),e)))}addLaunchBlocker(...e){for(let r of e)this._launchBlocker.add(r),r.finally(()=>this._launchBlocker.delete(r))}setPredictorDisabledForTest(e){this._predictorDisabledForTest=e}_installSourceMapHandler(e){let r=this.launchConfig.perScriptSourcemaps==="yes",n;r?n=Promise.all([this.updateEntryBreakpointMode(e,1),e.setScriptSourceMapHandler(!1,this._scriptSourceMapHandler)]).then(()=>!0):this._breakpointsPredictor&&!this.launchConfig.pauseForSourceMap?n=e.setScriptSourceMapHandler(!1,this._scriptSourceMapHandler):n=e.setScriptSourceMapHandler(!0,this._scriptSourceMapHandler),this._sourceMapHandlerInstalled={entryBpSet:n}}async _uninstallSourceMapHandler(e){e.setScriptSourceMapHandler(!1),this._sourceMapHandlerInstalled=void 0}_setBreakpoint(e,r){this._enabledFilter(e)&&this.addLaunchBlocker(Promise.race([_e(vM),e.enable(r)]))}async setBreakpoints(e,r){!this._sourceMapHandlerInstalled&&this._thread&&e.breakpoints?.length&&this._installSourceMapHandler(this._thread);let n=await this._sourceMapHandlerInstalled?.entryBpSet;e.source.path=ft(e.source.path,!0);let i=this._sourceContainer.source(e.source);if(!n&&this._breakpointsPredictor&&!i){let l=this._breakpointsPredictor.predictBreakpoints(e);this.addLaunchBlocker(l),await l}let o=this._thread;if(o?.debuggerReady.hasSettled()===!1){let l=o.debuggerReady.promise;this.addLaunchBlocker(l),await l}let s=l=>{let p={unbound:l.slice(),new:[],list:[]};if(!e.breakpoints)return p;for(let d=0;d<e.breakpoints.length;d++){let f=e.breakpoints[d],h;try{h=new Rn(this,r[d],e.source,f,this.conditionFactory.getConditionFor(f))}catch(C){if(!(C instanceof q))throw C;this._dap.output({category:"stderr",output:C.message}),h=new lb(this,r[d],e.source,f)}let m=p.unbound.findIndex(C=>C.equivalentTo(h)),x=p.unbound[m];x?.equivalentTo?.(h)?(p.list.push(x),p.unbound.splice(m,1)):(p.new.push(h),p.list.push(h),this._byDapId.set(h.dapId,h))}return p},a=()=>e.source.sourceReference?this._byRef.get(e.source.sourceReference):e.source.path?this._byPath.get(e.source.path):void 0,c=s(a()??[]);if(e.source.sourceReference)this._byRef.set(e.source.sourceReference,c.list);else if(e.source.path)this._byPath.set(e.source.path,c.list);else return{breakpoints:[]};if(c.unbound.length===0&&c.new.length===0)return{breakpoints:[]};if(this._totalBreakpointsCount-=c.unbound.length,await Promise.all(c.unbound.map(l=>(this._byDapId.delete(l.dapId),l.disable()))),this._totalBreakpointsCount+=c.new.length,this._thread&&(this._totalBreakpointsCount===0&&this._sourceMapHandlerInstalled?this._uninstallSourceMapHandler(this._thread):this._totalBreakpointsCount>0&&!this._sourceMapHandlerInstalled&&this._installSourceMapHandler(this._thread)),o&&c.new.length){this.ensureModuleEntryBreakpoint(o,e.source);let l=a(),p=Promise.all(c.new.filter(this._enabledFilter).filter(d=>l?.includes(d)).map(d=>d.enable(o)));this.addLaunchBlocker(Promise.race([_e(vM),p])),await p}let u=await Promise.all(c.list.map(l=>l.toDap()));return this._breakpointsStatisticsCalculator.registerBreakpoints(u),_e(0).then(()=>c.new.forEach(l=>l.markSetCompleted())),{breakpoints:u}}async notifyBreakpointChange(e,r){if(!this._byDapId.has(e.dapId))return;let n=await e.toDap();n.verified&&(this._breakpointsStatisticsCalculator.registerResolvedBreakpoint(e.dapId),this.suggester.notifyVerifiedBreakpoint()),r&&this._dap.breakpoint({reason:"changed",breakpoint:n})}isEntrypointBreak(e,r){return[...this.moduleEntryBreakpoints.values()].some(i=>i.enabled&&i.cdpScriptIds.has(r))?!0:e.some(i=>{let o=this._resolvedBreakpoints.get(i);return o&&(o instanceof to||bM(o))})}async disableEntrypointBreaks(e){await Promise.all([...this.moduleEntryBreakpoints.values()].map(r=>{if(r.enabled&&r.cdpScriptIds.has(e))return r.disable()}))}isEntrypointCdpBreak(e){return this._resolvedBreakpoints.get(e)instanceof to}async shouldPauseAt(e,r,n,i=!1){if(!r.length)return e.reason!=="instrumentation";let o=0,s=i?1:0;return await Promise.all(r.map(async a=>{if(n?.cdpId===a){o++;return}let c=this._resolvedBreakpoints.get(a);if(c instanceof to){this.entryBreakpointMode===0&&!(c instanceof Gf)&&c.disable(),s++;return}c instanceof Rn&&(await c.testHitCondition(e)?o++:s++)})),o>0||s===0}registerBreakpointsHit(e){for(let r of e){let n=this._resolvedBreakpoints.get(r);n instanceof Rn&&this._breakpointsStatisticsCalculator.registerBreakpointHit(n.dapId)}}statisticsForTelemetry(){return this._breakpointsStatisticsCalculator.statistics()}ensureModuleEntryBreakpoint(e,r){if(!r.path||(this._byPath.get(r.path)??[]).some(bM))return;let i=to.getModeKeyForSource(this.entryBreakpointMode,r.path);if(!r.path||this.moduleEntryBreakpoints.has(i))return;let o=new to(this,r,this.entryBreakpointMode);this.moduleEntryBreakpoints.set(r.path,o),this._setBreakpoint(o,e)}executionContextWasCleared(){for(let e of this._byDapId.values())e.executionContextWasCleared()}async reapply(){let e=[...this._byDapId.values()];if(await Promise.all(e.map(r=>r.disable())),this._thread){let r=this._thread;await Promise.all(e.map(n=>n.enable(r)))}}};On=I([(0,so.injectable)(),g(0,(0,so.inject)(Ur)),g(1,(0,so.inject)(Gt)),g(2,(0,so.inject)(Y)),g(3,(0,so.inject)(Re)),g(4,(0,so.inject)(sb)),g(5,(0,so.inject)(pt)),g(6,(0,so.inject)(uc))],On);var BB=require("crypto"),Al=v(H());var Qe=class t{static{this.Undefined=new t(void 0)}constructor(e){this.element=e,this.next=t.Undefined,this.prev=t.Undefined}},Kf=class{constructor(){this._first=Qe.Undefined;this._last=Qe.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Qe.Undefined}clear(){let e=this._first;for(;e!==Qe.Undefined;){let r=e.next;e.prev=Qe.Undefined,e.next=Qe.Undefined,e=r}this._first=Qe.Undefined,this._last=Qe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,r){let n=new Qe(e);if(this._first===Qe.Undefined)this._first=n,this._last=n;else if(r){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==Qe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Qe.Undefined){let e=this._last.element;return this._remove(this._last),e}}applyFilter(e){let r=this._first;for(;r!==Qe.Undefined;){let n=r.next;e(r.element)||this._remove(r),r=n}}_remove(e){if(e.prev!==Qe.Undefined&&e.next!==Qe.Undefined){let r=e.prev;r.next=e.next,e.next.prev=r}else e.prev===Qe.Undefined&&e.next===Qe.Undefined?(this._first=Qe.Undefined,this._last=Qe.Undefined):e.next===Qe.Undefined?(this._last=this._last.prev,this._last.next=Qe.Undefined):e.prev===Qe.Undefined&&(this._first=this._first.next,this._first.prev=Qe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Qe.Undefined;)yield e.element,e=e.next}};var Wb=v(H()),OB=v(require("net"));var ln=class extends q{constructor(e){super({id:9243,format:e,showUser:!0}),this._cause={id:9243,format:e,showUser:!0}}};function ao(t,e,r){if(e.isCancellationRequested)return Promise.reject(new ln(r||"Task cancelled"));let n=Ue(),i=e.onCancellationRequested(n.resolve);return Promise.race([n.promise.then(()=>{throw new ln(r||"Task cancelled")}),t.then(o=>(i.dispose(),o)).catch(o=>{throw i.dispose(),o})])}function SM(t,e){let r=new Ft(e),n=t.map(async i=>{try{return await i(r.token)}finally{r.cancel()}});return Promise.race(n)}var _M=Object.freeze(function(t,e){let r=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(r)}}}),zt=Object.freeze({isCancellationRequested:!1,onCancellationRequested:()=>({dispose:()=>{}})}),XQ=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_M}),Ft=class t{constructor(e){this._token=void 0;this._parentListener=void 0;this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}static withTimeout(e,r){let n=new t(r),i=n._token=new wl,o=setTimeout(()=>i.cancel(),e);return i.onCancellationRequested(()=>clearTimeout(o)),n}get token(){return this._token||(this._token=new wl),this._token}cancel(){this._token?this._token instanceof wl&&this._token.cancel():this._token=XQ}dispose(e=!1){e&&this.cancel(),this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof wl&&this._token.dispose():this._token=zt}},wl=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?_M:(this._emitter||(this._emitter=new j),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var iT=v(require("net"));var yee=v(yB(),1),bee=v(Lb(),1),vee=v(xl(),1),wee=v(GC(),1),See=v(JC(),1),_ee=v(tT(),1),TB=v(Fb(),1),nT=v(CB(),1);var PB=TB.default;var EB=(t,e)=>t+Math.floor(Math.random()*(e-t));async function qs({min:t=53e3,max:e=54e3,attempts:r=1e3,tester:n=RB}={},i=zt){let o=EB(t,e);for(let s=Math.min(r,e-t);;s--)try{return await n(o,i)}catch(a){if(s===0||a instanceof ln)throw a;o=o===e-1?t:o+1}}async function kB(t,e){try{return await RB(t,e),!0}catch{return!1}}function RB(t,e=zt){let r;return new Promise((n,i)=>{let o=iT.createServer();o.listen(t,"127.0.0.1",()=>{let s=o.address();o.close(()=>n(s.port))}),o.on("error",i),r=e.onCancellationRequested(()=>{o.close(),i(new ln("Port open lookup cancelled"))})}).finally(()=>r?.dispose())}var AB=(t,e)=>(r,n)=>{let i=iT.createServer(t);return i.listen(r,e),jb(i,n)},DB=t=>(e,r)=>jb(new nT.default({host:"127.0.0.1",...t,port:e}),r),jb=(t,e)=>{let r;return new Promise((n,i)=>{t.on("error",i),t.on("listening",()=>n(t)),r=e.onCancellationRequested(()=>{t.close(),i(new ln("Port open lookup cancelled"))})}).finally(()=>r?.dispose())};var LB=async(t,e,r,n,i=zt)=>{let o=r?await jb(OB.createServer(e).listen(r,n),i):await qs({tester:AB(e,n)},i),s=t.register(o.address().port);return o.on("close",()=>s.dispose()),o.on("error",()=>s.dispose()),o},Hb=async(t,e,r)=>{let n=await qs({tester:DB(e)},r),i=t.register(n.address().port);return n.on("close",()=>i.dispose()),n.on("error",()=>i.dispose()),n},nt=Symbol("IPortLeaseTracker"),kl=class{constructor(e){this.usedPorts=new Set;this.onRegistered=new j;this.isMandated=e==="remote"}register(e){return this.usedPorts.add(e),this.onRegistered.fire(e),{dispose:()=>this.usedPorts.delete(e)}}isRegistered(e,r=2e3){return this.usedPorts.has(e)?Promise.resolve(!0):e<53e3||e>=54e3?Promise.resolve(!1):SM([()=>_e(r).then(()=>!1),n=>new Promise(i=>{let o=this.onRegistered.event(s=>{s===e&&i(!0)});n.onCancellationRequested(()=>o.dispose())})])}};kl=I([(0,Wb.injectable)(),g(0,(0,Wb.inject)(ui))],kl);var NB="JsDebug",MB="*";var oT=class{constructor(){this.replays=new Map}addReplay(e,r,n){let i=this.replays.get(e);return i||(i=new Kf,this.replays.set(e,i)),i.push({event:`${e}.${r}`,params:n})}capture(e,r,n,i){let o=e[r];if(i===0)o.on(n,s=>this.addReplay(r,n,s));else if(i===2){let s;o.on(n,a=>{s?.(),s=this.addReplay(r,n,a)})}else{let s=new Kf;o.on(n,a=>{s.size===i.cap&&s.shift()?.(),s.push(this.addReplay(r,n,a))})}}filter(e,r){let n=this.replays.get(e);n&&n.applyFilter(r)}clearEvent(e,r){let n=`${e}.${r}`;this.filter(e,i=>i.event!==n)}clearDomain(e){this.replays.delete(e)}read(e){return this.replays.get(e)??[]}},qb=Symbol("ICdpProxyProvider"),Rl=class{constructor(e,r,n){this.cdp=e;this.portTracker=r;this.logger=n;this.disposables=new Ce;this.replay=new oT;this.jsDebugApi={subscribe:(e,{events:r})=>{for(let n of r)n.endsWith(MB)?e.pushDisposable(this.cdp.session.onPrefix(n.slice(0,-MB.length),i=>e.send({method:i.method,params:i.params}))):e.pushDisposable(this.cdp.session.on(n,i=>e.send({method:n,params:i})));return{}}};this.replay.capture(e,"CSS","styleSheetAdded",0),this.replay.capture(e,"Debugger","paused",2),this.replay.capture(e,"Runtime","executionContextCreated",{cap:50,type:1}),this.replay.capture(e,"Runtime","consoleAPICalled",{cap:50,type:1}),e.Debugger.on("resumed",()=>{this.replay.clearEvent("Debugger","paused")}),e.CSS.on("fontsUpdated",i=>{i.font&&this.replay.addReplay("CSS","fontsUpdated",i)}),e.CSS.on("styleSheetRemoved",i=>this.replay.filter("CSS",o=>o.params.styleSheetId!==i.styleSheetId))}async proxy(){this.server||(this.server=this.createServer());let{server:e,path:r}=await this.server,n=e.address();return{host:n.address,port:n.port,path:r}}async createServer(){let e=`/${(0,BB.randomBytes)(20).toString("hex")}`,r=await Hb(this.portTracker,{perMessageDeflate:!0,path:e});return this.logger.info("proxyActivity","activated cdp proxy"),r.on("connection",n=>{let i=new sT(n,this.logger);this.logger.info("proxyActivity","accepted proxy connection",{id:i.id}),n.on("close",()=>{this.logger.verbose("proxyActivity","closed proxy connection",{id:i.id}),this.disposables.disposeObject(i)}),n.on("message",async o=>{let s;try{s=JSON.parse(o.toString())}catch(d){return i.send({id:0,error:{code:-32700,message:d.message}})}this.logger.verbose("proxyActivity","received proxy message",s);let{method:a,params:c,id:u=0}=s,[l,p]=a.split(".");try{let d=l===NB?await this.invokeJsDebugDomainMethod(i,p,c):await this.invokeCdpMethod(i,l,p,c);i.send({id:u,result:d})}catch(d){let f=d instanceof lc&&d.cause?d.cause:{code:0,message:d.message};i.send({id:u,error:f})}})}),{server:r,path:e}}dispose(){this.disposables.dispose(),this.server?.then(e=>e.server.close()),this.server=void 0}invokeCdpMethod(e,r,n,i){let o=this.cdp.session.sendOrDie(`${r}.${n}`,i);switch(n){case"enable":for(let s of this.replay.read(r))e.send({method:s.event,params:s.params});break;case"disable":this.replay.clearDomain(r);break;default:}return o}invokeJsDebugDomainMethod(e,r,n){if(!this.jsDebugApi.hasOwnProperty(r))throw new lc(r).setCause(-32601,`${NB}.${r} not found`);return this.jsDebugApi[r](e,n)}};Rl=I([(0,Al.injectable)(),g(0,(0,Al.inject)(lt)),g(1,(0,Al.inject)(nt)),g(2,(0,Al.inject)(Y))],Rl);var Iee=0,sT=class{constructor(e,r){this.webSocket=e;this.logger=r;this.disposables=new Ce;this.id=Iee++}pushDisposable(e){this.disposables.push(e)}dispose(){this.disposables.dispose(),this.webSocket.close()}send(e){this.logger.verbose("proxyActivity","send proxy message",e),this.webSocket.send(JSON.stringify(e))}};var FB=v(H());var rh=Symbol("IClientCapabilies"),$s=class{};$s=I([(0,FB.injectable)()],$s);var jB=require("./vendor/acorn-loose.js"),nh=v(H());var aT=Rt(function(t,e,r){let n=r?"variable":"property",i=(l,p,d)=>{if(p!=="function")return n;if(l==="constructor")return"class";let f=String(d);return f.startsWith("class ")||f.includes("[native code]")&&/^[A-Z]/.test(l)?"class":r?"function":"method"},o=l=>{switch(typeof l){case"number":case"boolean":return`${l}`;case"object":return l===null?"null":l.constructor.name||"object";case"function":return`fn(${new Array(l.length).fill("?").join(", ")})`;default:return typeof l}},s=[],a=new Set,c="~",u=t===void 0?this:t;for(;u!=null;u=u.__proto__){c+="~";let l=Object.getOwnPropertyNames(u).filter(p=>p.startsWith(e)&&!p.match(/^\d+$/));for(let p of l){if(a.has(p))continue;a.add(p);let d=Object.getOwnPropertyDescriptor(u,p),f=n,h;try{let m=u[p];f=i(p,typeof d?.value,m),h=o(m)}catch{}s.push({label:p,sortText:c+p.replace(/^_+/,m=>"{".repeat(m.length)),type:f,detail:h})}r=!1}return{result:s,isArray:this instanceof Array}}),UB=zi(aT.source);var Cee=t=>{switch(t.type){case"ClassDeclaration":case"ClassExpression":return{type:"class",id:t.id};case"MethodDefinition":return{type:t.key?.type==="Identifier"&&t.key.name==="constructor"?"constructor":"method",id:t.key};case"VariableDeclarator":return{type:t.init?.type==="FunctionExpression"||t.init?.type==="ArrowFunctionExpression"?"function":"variable",id:t.id}}};function Tee(t){let e=!1;return Es(t,{enter(r){if(r.type==="CallExpression"||r.type==="NewExpression"||r.type==="UnaryExpression"&&r.operator==="delete"||r.type==="ClassBody")return e=!0,0}}),e}var $b=Symbol("ICompletions"),Pee=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function Eee(t){return t.unserializableValue?t.unserializableValue:t.type==="undefined"?"undefined":JSON.stringify(t.value)}var Dl=class{constructor(e,r){this.evaluator=e;this.cdp=r}async completions(e){let r=Gi(e.expression),n=new Ds(e.expression).convert(e.position),i=()=>Promise.resolve([]);return Es(r,{enter:(o,s)=>{let a=o;if(a.start<n&&n<=a.end){if(o.type==="MemberExpression"||o.type==="Identifier"&&s?.type==="MemberExpression"&&!s.computed&&s.object!==o){let c=o.type==="MemberExpression"?o:s;i=c.computed?()=>this.elementAccessCompleter(e,c,n):()=>this.propertyAccessCompleter(e,c,n)}else o.type==="Identifier"&&(i=()=>this.identifierCompleter(e,r,o,n));s=o}}}),i().then(o=>o.sort((s,a)=>s.sortText>a.sortText?1:-1))}async elementAccessCompleter(e,r,n){if(r.property.type!=="Literal"||typeof r.property.value!="string")return[];let i=e.expression.slice(Ps(r.property)+1,n);return(await this.defaultCompletions(e,i)).filter(s=>s.sortText!=="~~[").map(s=>({...s,text:JSON.stringify(s.text??s.label)+"]",start:Ps(r.property),length:zI(r.property)-Ps(r.property)}))}async identifierCompleter(e,r,n,i){let o=[],s=Ps(n);Es(r,{enter(u){let l=Cee(u);l?.id?.type==="Identifier"&&o.push({label:l.id.name,type:l.type,sortText:l.id.name})}});let a=e.expression.slice(s,i),c=[...o,...await this.defaultCompletions(e,a)];this.evaluator.hasReturnValue&&e.executionContextId!==void 0&&qo.startsWith(a)&&c.push({sortText:`~${qo}`,label:qo,type:"variable"});for(let u of c)u.start=s,u.length=i-s;return c}async propertyAccessCompleter(e,r,n){let{result:i,isArray:o}=await this.completePropertyAccess({executionContextId:e.executionContextId,stackFrame:e.stackFrame,expression:WO(e.expression,r.object),prefix:(0,jB.isDummy)(r.property)?"":e.expression.slice(Ps(r.property),n),throwOnSideEffect:Tee(r)}),s=Ps(r.property)-1;for(let a of i)Pee.test(a.label)||(a.text=`[${JSON.stringify(a.label)}]`,a.start=s,a.length=1);if(o){let a="index";i.unshift({label:`[${a}]`,text:`[${a}]`,type:"property",sortText:"~~[",start:s,selectionStart:1,selectionLength:a.length,length:1})}return i}async completePropertyAccess({executionContextId:e,stackFrame:r,expression:n,prefix:i,isInGlobalScope:o=!1,throwOnSideEffect:s=!1}){let a={expression:`(${n})`,objectGroup:"console",silent:!0,throwOnSideEffect:s},c=r&&r.callFrameId(),u=await this.evaluator.evaluate(c?{...a,callFrameId:c}:{...a,contextId:e},{stackFrame:r});if(!u||u.exceptionDetails)return{result:[],isArray:!1};if(!u.result.objectId){let l={...a,returnByValue:!0,throwOnSideEffect:!1,expression:UB.expr(Eee(u.result),JSON.stringify(i),JSON.stringify(o))},p=await this.evaluator.evaluate({...l,contextId:e});return!p||p.exceptionDetails?{result:[],isArray:!1}:p.result.value}try{return(await aT({cdp:this.cdp,args:[void 0,i,o],objectId:u.result.objectId,returnByValue:!0})).value}catch{return{result:[],isArray:!1}}finally{this.cdp.Runtime.releaseObject({objectId:u.result.objectId})}}async defaultCompletions(e,r=""){for(let n of["self","global","this"]){let{result:i}=await this.completePropertyAccess({executionContextId:e.executionContextId,stackFrame:e.stackFrame,expression:n,prefix:r,isInGlobalScope:!0});if(e.stackFrame){let o=r.toLowerCase(),s=new Set(i.map(a=>a.label));for(let a of await e.stackFrame.completions())s.has(a.label)||!a.label.toLowerCase().includes(o)||(s.add(a.label),i.push(a))}return i.push(...this.syntheticCompletions(e,r)),i}return this.syntheticCompletions(e,r)}syntheticCompletions(e,r){return this.evaluator.hasReturnValue&&qo.startsWith(r)?[{sortText:`~${qo}`,label:qo,type:"variable"}]:[]}};Dl=I([(0,nh.injectable)(),g(0,(0,nh.inject)(kn)),g(1,(0,nh.inject)(lt))],Dl);var WB=/^(\W*at .*\()(.*):(\d+):(\d+)(\))$/,HB=/^(\W*at )(.*):(\d+):(\d+)$/,Vs=class{constructor(e){this.stack=e}static isStackLike(e){return WB.test(e)||HB.test(e)}*[Symbol.iterator](){for(let e of this.stack.split(`
`)){let r=WB.exec(e)||HB.exec(e);if(!r){yield e+`
`;continue}let[,n,i,o,s,a]=r;n&&(yield n),yield new cT(i,new ct(Number(o),Number(s))),a&&(yield a),yield`
`}}},cT=class{constructor(e,r){this.path=e;this.position=r}toString(){return`${this.path}:${this.position.lineNumber}:${this.position.columnNumber}`}};var uo=class{constructor(e,r){this._tokens=[];this._separator=r||"",this._budget=e-1-this._separator.length}append(e){if(e.length>this.budget()){this.appendEllipsis();return}this._append(e)}_append(e){this._tokens.length&&(this._budget-=this._separator.length),this._tokens.push(e),this._budget-=e.length}appendEllipsis(){this._tokens[this._tokens.length-1]!=="\u2026"&&this._append("\u2026")}checkBudget(){return this._budget<=0&&this.appendEllipsis(),this._budget>0}budget(){return this._budget-(this._tokens.length?this._separator.length:0)}build(){return this._tokens.join(this._separator)}isEmpty(){return!this._tokens.length}};var dF=v(lF());var $ee=1e4;function Vee(t,e){if(!t.includes("%"))return[{type:"string",value:t}];let r=[];function n(c){if(!c)return;let u=r[r.length-1];u?.type==="string"?u.value+=c:r.push({type:"string",value:c})}function i(c,u,l){r.push({type:"specifier",specifier:c,precision:u,substitutionIndex:l})}let o=0,s=0,a=new RegExp(`%%|%(?:(\\d+)\\$)?(?:\\.(\\d*))?([${e.join("")}])`,"g");for(let c=a.exec(t);c;c=a.exec(t)){let u=c.index;if(u>o&&n(t.substring(o,u)),c[0]==="%%")n("%");else{let[,l,p,d]=c;l&&Number(l)>0&&(s=Number(l)-1);let f=p?Number(p):void 0;i(d,f,s),++s}o=u+c[0].length}return n(t.substring(o)),r}function fT(t,e,r){let n=Vee(t,Array.from(r.keys())),i=new Set,o=r.get("");if(!o)throw new Error("Expected to hav a default formatter");let s=new uo($ee),a=!1;for(let c=0;s.checkBudget()&&c<n.length;++c){let u=n[c];if(u.type==="string"){s.append(u.value);continue}let l=u.substitutionIndex;if(l>=e.length){s.append("%"+(u.precision||"")+u.specifier);continue}i.add(l),u.specifier==="c"&&(a=!0);let p=r.get(u.specifier)||o;s.append(p(e[l],{budget:s.budget(),quoted:!1,ansi:!0}))}a&&s.append("\x1B[0m");for(let c=0;s.checkBudget()&&c<e.length;++c)i.has(c)||(i.add(c),(t||c)&&s.append(" "),s.append(o(e[c],{budget:s.budget(),quoted:!1,ansi:!0})));return{result:s.build(),usedAllSubs:i.size===e.length}}function pF(t){try{return new dF.default(t).ansi256().object().ansi256}catch{}}function fF(t){let e=/\s*(.*?)\s*:\s*(.*?)\s*(?:;|$)/g,r="\x1B[0m",n=e.exec(t);for(;n!==null;){if(n.length===3)switch(n[1]){case"color":let i=pF(n[2]);i&&(r+=`\x1B[38;5;${i}m`);break;case"background":case"background-color":let o=pF(n[2]);o&&(r+=`\x1B[48;5;${o}m`);break;case"font-weight":n[2]==="bold"&&(r+="\x1B[1m");break;case"font-style":n[2]==="italic"&&(r+="\x1B[3m");break;case"text-decoration":n[2]==="underline"&&(r+="\x1B[4m");break;default:}n=e.exec(t)}return r}var mF=t=>t.replace(/\n/gm,"\\n").replace(/\r/gm,"\\r").replace(/\t/gm,"\\t"),zee={budget:1e5,quoted:!0},hF={budget:1e3,quoted:!0,postProcess:mF},Kee={budget:1/0,quoted:!1},Jee={budget:1e3,quoted:!0,postProcess:mF},Xee={budget:1e5,quoted:!0},Jb=t=>{switch(t){case"repl":return zee;case"hover":return hF;case"propertyValue":return hF;case"watch":return Jee;case"copy":case"clipboard":return Kee;default:return Xee}};var Yee=30,Qee=100,hT=20,Zee=1e4,ete=3,gF=120,mT=new Set(["null","regexp","date"]);function Tc(t){return t.type==="function"||t.type==="object"&&!mT.has(t.subtype)}function gT(t){return t.subtype==="array"||t.subtype==="typedarray"}function Pc(t,e,r){let n=Jb(e),i=Xb(t,n,r);return t.preview?.subtype==="regexp"?i:n.postProcess?.(i)??i}function Xb(t,e,r){return t.type==="function"?t.description?_F(t.description,e.budget):"<function>":t.type==="object"&&t.subtype==="node"?t.description:"preview"in t&&t.preview?Yb(t.preview,e.budget,r):SF(t,e,r)}function Yb(t,e,r){return gT(t)?tte(t,e):t.subtype==="internal#entry"?Ki(t.description||"",e):t.type==="function"?_F(t.description,e):Tc(t)?rte(t,e,r):ite(t,e,r)}function tte(t,e){let r=new uo(e),n=t.description,i=n.match(/[^(]*\(([\d]+)\)/);if(!i)return n;let o=parseInt(i[1],10);n.startsWith("Array(")&&(n=n.substring(5)),r.append(Ki(n,r.budget())),r.append(" ");let s=new uo(r.budget()-2,", "),a=-1;for(let c of t.properties){if(!s.checkBudget())break;if(isNaN(c.name))continue;let u=parseInt(c.name,10);u>a+1&&s.appendEllipsis(),a=u,s.append(ah(c,s.budget()))}o>a+1&&s.appendEllipsis();for(let c of t.properties){if(!s.checkBudget())break;isNaN(c.name)&&s.append(ah(c,s.budget(),c.name))}return t.overflow&&s.appendEllipsis(),r.append("["+s.build()+"]"),r.build()}function rte(t,e,r){let n=new uo(e," ");t.description!=="Object"&&t.description!=null&&n.append(Ki(t.description,n.budget()));let i=new Map,o=t.properties||[];for(let d of o)i.set(d.name,d);let s=i.get("[[PrimitiveValue]]");if(s)return n.append(`(${ah(s,n.budget()-2)})`),n.build();let a=i.get("[[PromiseStatus]]"),c=i.get("[[PromiseValue]]");if(a&&c)return a.value==="pending"?n.append(`{<${a.value}>}`):n.append(`{${ah(c,n.budget()-2,`<${a.value}>`)}}`),n.build();let u=i.get("[[GeneratorStatus]]");if(u)return n.append(`{<${u.value}>}`),n.build();let l=new uo(n.budget()-2,", ");for(let d of o){if(!l.checkBudget())break;l.append(ah(d,l.budget(),d.name))}for(let d of t.entries||[]){if(!l.checkBudget())break;if(d.key){let f=Yb(d.key,Math.min(hT,l.budget()),r),h=Yb(d.value,Math.min(hT,l.budget()-f.length-4),r);l.append(Nl(f," => ",h,l.budget()))}else l.append(Yb(d.value,Math.min(hT,l.budget()),r))}t.overflow&&l.appendEllipsis();let p=l.build();return p?n.append("{"+p+"}"):n.isEmpty()&&n.append("{}"),n.build()}function yF(t,e){return t.length<=e?t:"\u2026"}function nte(t,e){return t.length>=e?t.slice(0,e-1)+"\u2026":t}function ite(t,e,r){if(t.type==="object"&&t.subtype==="null")return yF("null",e);if(t.type==="undefined")return yF("undefined",e);if(t.type==="string"){let n=t.description??t.value;return r?.hex&&(n=Buffer.from(n,"utf8").toString("hex")),zu(n,e)}return t.type==="number"||t.type==="bigint"?ch(t,!1,e,r):nte(t.description||"",e)}function Nl(t,e,r,n){return t===void 0?zu(r,n):t.length+e.length>n?Ki(t,n):vF(`${t}${e}${zu(r,n-t.length-e.length)}`)}function ah(t,e,r){return e=Math.min(e,Qee),t.type==="function"?Nl(r,": ","\u0192",e):t.type==="object"&&t.value==="Object"?Nl(r,": ","{\u2026}",e):typeof t.value>"u"?Nl(r,": ",`<${t.type}>`,e):t.type==="string"?Nl(r,": ",wF(t.value),e):Nl(r,": ",t.value??"unknown",e)}function vF(t){return t.replaceAll("\x1B","\\x1b")}function wF(t){let e=t.includes("'")?t.includes('"')?t.includes("`")?"'":"`":'"':"'",r=new RegExp(`[${e}\\\\]`,"g");return`${e}${t.replace(r,"\\$&")}${e}`}function SF(t,{budget:e,quoted:r,ansi:n},i){if(t.type==="string"){let o=t.value||(t.description?t.description:"");i?.hex&&(o=Buffer.from(o,"utf8").toString("hex"),r=!1);let s=zu(o,r?e-2:e);return r&&(s=wF(s)),n?s:vF(s)}return t.type==="undefined"?"undefined":t.subtype==="null"?"null":t.type==="bigint"||t.type==="number"?ch(t,!1,e,i):t.description?Ki(t.description,Math.max(e,1e5)):Ki(String("value"in t?t.value:t.description),e)}function _F(t,e){let r=new uo(e),n=t.replace(/^function [gs]et /,"function ").replace(/^function [gs]et\(/,"function(").replace(/^[gs]et /,""),i=n.match(/^(async\s+function)/),o=n.startsWith("function*"),s=n.startsWith("*"),a=!o&&n.startsWith("function"),c=n.startsWith("class ")||n.startsWith("class{"),u=n.indexOf("=>"),l=!i&&!o&&!a&&!c&&u>0,p;if(c){p=n.substring(5);let h=/^[^{\s]+/.exec(p.trim()),m="";h&&(m=h[0].trim()||""),f("class",p,m)}else if(i)p=n.substring(i[1].length),f("async \u0192",p,d(p));else if(o)p=n.substring(9),f("\u0192*",p,d(p));else if(s)p=n.substring(1),f("\u0192*",p,d(p));else if(a)p=n.substring(8),f("\u0192",p,d(p));else if(l){let h=n;n.length>Yee&&(h=n.substring(0,u+2)+" {\u2026}"),f("",n,h)}else f("\u0192",n,d(n));return r.build();function d(h){let m=h.indexOf("("),x=h.match(/\)\s*{/),C=x&&x.index||0;if(m!==-1&&x&&C>m){let O=h.substring(0,m).trim()||"",y=h.substring(m,C+1);return O+y}return"()"}function f(h,m,x){r.checkBudget()&&(h.length&&r.append(h+" "),m=m.trim(),m.endsWith(" { [native code] }")&&(m=m.substring(0,m.length-18)),r.budget()>=m.length?r.append(m):r.append(x.replace(/\n/g," ")))}}function Ec(t){let e=t;if(e.type!=="object"||e.subtype==="null")return{title:SF(e,{budget:Zee,quoted:!1},void 0)};let r=e.description??e.className??"Error",n=/^\s+at\s/m.exec(r);if(!n){let i=r.lastIndexOf(`
`);return i===-1?{title:r}:{title:r.substring(0,i)}}return{title:r.substring(0,n.index-1),stackTrace:r.substring(n.index+2)}}function ch(t,e,r,n){if(t.type==="number"){if("unserializableValue"in t)return t.unserializableValue;let s=t.value!==void 0?t.value:+t.description;return n?.hex?s.toString(16):String(s)}if(t.type==="bigint"){let s=t.unserializableValue||t.description;return n?.hex?BigInt(s.slice(0,-1)).toString(16):s}let i=t,o=typeof i.value=="number"?i.value:+String(i.description);return Ki(String(e?Math.floor(o):o),r)}function ote(t,e){return zu(String(typeof t.value<"u"?t.value:t.description),e)}function xF(t){let e=[],r=new Set([void 0]),n=new Map;for(let l of t.properties.filter(p=>p.valuePreview)){let p=new Map;p.set(void 0,l.name),n.set(void 0,Math.max(n.get(void 0)||0,l.name.length)),e.push(p),l.valuePreview?.properties.map(d=>{d.value&&(r.add(d.name),p.set(d.name,d.value),n.set(d.name,Math.max(n.get(d.name)||0,d.value.length)))})}for(let l of r.values())l&&n.set(l,Math.max(n.get(l)||0,l.length));let i=Array.from(n.values()).reduce((l,p)=>l+p,0),o=gF-4-(r.size-1)*3;if(i>o){let l=o/i;for(let p of n.keys()){let d=Math.max(ete,n.get(p)*l|0);n.set(p,d)}}let s=[];for(let l of r.values())s.push("-".repeat(n.get(l)));let a="[-"+s.join("-|-")+"-]",c=[];c.push(a.replace("[","\u256D").replace(/\|/g,"\u252C").replace("]","\u256E").replace(/-/g,"\u2504"));let u=[];for(let l of r.values())u.push(bF(l||"",n.get(l)));c.push("\u250A "+u.join(" \u250A ")+" \u250A"),c.push(a.replace("[","\u251C").replace(/\|/g,"\u253C").replace("]","\u2524").replace(/-/g,"\u2504"));for(let l of e){let p=[];for(let d of r.values())p.push(bF(l.get(d)||"",n.get(d)));c.push("\u250A "+p.join(" \u250A ")+" \u250A")}return c.push(a.replace("[","\u2570").replace(/\|/g,"\u2534").replace("]","\u256F").replace(/-/g,"\u2504")),c.map(l=>Ki(l,gF)).join(`
`)}var yT=new Map([["",(t,e)=>Xb(t,e)],["s",(t,e)=>ote(t,e.budget)],["i",(t,e)=>ch(t,!0,e.budget,void 0)],["d",(t,e)=>ch(t,!0,e.budget,void 0)],["f",(t,e)=>ch(t,!1,e.budget,void 0)],["c",t=>fF(t.value)],["o",(t,e)=>Xb(t,e)],["O",(t,e)=>Xb(t,e)]]);function bF(t,e){return t.length===e?t:t.length<e?t+" ".repeat(e-t.length):Ki(t,e)}var zr=v(ge());var uh=v(H());async function bT(t){let e=await t.uiLocation();return e?e.source.blackboxed()?2:Ar(e.source)&&!e.isMapped&&e.unmappedReason===3?1:0:0}var ste=new Set(["breakpoint","exception","entry"]),ate=256,zs=class{constructor(e,r){this.launchConfig=e;this.logger=r;this._smartStepCount=0}resetSmartStepCount(){this._smartStepCount>0&&(this.logger.verbose("internal",`smartStep: skipped ${this._smartStepCount} steps`),this._smartStepCount=0)}async getSmartStepDirection(e,r){if(!this.launchConfig.smartStep)return;if(r?.reason==="pause"){this.resetSmartStepCount();return}if(ste.has(e.reason))return;let n=(await e.stackTrace.loadFrames(1)).find(Ga(xr));if((n&&await bT(n))===0){this.resetSmartStepCount();return}return this._smartStepCount++>ate?2:r?.reason==="step"?r.direction:0}};zs=I([(0,uh.injectable)(),g(0,(0,uh.inject)(Re)),g(1,(0,uh.inject)(Y))],zs);var CF=Rt(function(){return[Symbol.for("debug.description"),Symbol.for("nodejs.util.inspect.custom"),Symbol.for("debug.properties")]}),TF=zi(function(t,e){let r=!1,n={},i="<<default preview>>";if(typeof this!="object"||!this)return n;for(let o of Object.keys(this)){let s;try{s=this[o]}catch{continue}if(e)try{let a=e.call(s,i);if(a!==i){n[o]=String(a);continue}}catch(a){n[o]=`<<indescribable>>${JSON.stringify([String(a),o])}`;continue}if(typeof s=="object"&&s){let a;for(let c of runtimeArgs[0].slice(0,2))if(typeof s[c]=="function")try{a=s[c](2);break}catch{}!a&&!String(s.toString).includes("[native code]")&&(a=String(s)),a&&!a.startsWith("[object ")&&(n[o]=a.length>=t?a.slice(0,t)+"\u2026":a)}}try{r=typeof this[runtimeArgs[0][2]]=="function"}catch{}return{out:n,customProps:r}}),Qb=zi(function(t,e){if(e)try{let r="<<default preview>>",n=e.call(this,r);if(n!==r)return String(n)}catch(r){return`<<indescribable>>${JSON.stringify([String(r),"object"])}`}if(typeof this=="object"&&this){let r;for(let n of[Symbol.for("debug.description"),Symbol.for("nodejs.util.inspect.custom")])if(typeof this[n]=="function")try{r=this[n](2);break}catch{}if(!r&&!String(this.toString).includes("[native code]")&&(r=String(this)),r&&!r.startsWith("[object "))return r.length>=t?r.slice(0,t)+"\u2026":r}}),PF=zi(function(){let t=runtimeArgs[0][2];if(!(typeof this!="object"||!this)&&typeof this[t]=="function")try{let e=this[t]();if(typeof e=="object"&&e!==null)return e}catch{}});var Be=v(ge()),GF=require("crypto");var Vr=class t{constructor(e=process.hrtime()){this.value=e}get ms(){return this.s*1e3}get s(){return this.value[0]+this.value[1]/1e9}elapsed(){return new t().subtract(this)}subtract(e){let r=this.value[1]-e.value[1],n=this.value[0]-e.value[0];return r<0&&(r+=1e9,n--),new t([n,r])}};var Ml=class{constructor(e,r,n,i,o,s){this.launchConfig=e;this.targetInfo=r;this.parentTarget=n;this.targetOriginValue=i;this.cdp=o;this.logger=s;this.onNameChanged=new j().event;this.attached=!1;this.isWaitingForDebugger=!0;o.pause()}id(){return this.targetInfo.targetId}name(){return this.targetInfo.title}fileName(){return this.targetInfo.url}type(){return"node"}parent(){return this.parentTarget}children(){return[]}canStop(){return!1}stop(){}canRestart(){return!1}restart(){}canAttach(){return!this.attached}async attach(){return await this.cdp.Runtime.enable({}),this.launchConfig.noDebug||await this.cdp.Debugger.enable({}),this.attached=!0,this.cdp}canDetach(){return this.attached}async detach(){await this.cdp.Debugger.resume({}),await this.cdp.NodeWorker.detach({sessionId:this.targetInfo.targetId}),this.attached=!1}targetOrigin(){return this.targetOriginValue}afterBind(){return this.cdp.resume(),Promise.resolve()}async runIfWaitingForDebugger(){this.isWaitingForDebugger=!1,await this.cdp.Runtime.runIfWaitingForDebugger({})}initialize(){return Promise.resolve()}waitingForDebugger(){return this.isWaitingForDebugger}supportsCustomBreakpoints(){return!1}supportsXHRBreakpoints(){return!1}scriptUrlToUrl(e){return e[0]==="/"||process.platform==="win32"&&e[1]===":"&&e[2]==="\\"?We(e):e}executionContextName(){return this.targetInfo.title}};var it=v(ge()),Zb=new Map;function Bl(){if(Zb.size)return Zb;function t(o,s){for(let a of s)a.group=o,Zb.set(a.id,a)}function e(o,s){let a=s||o;return{id:"instrumentation:"+o,title:a,group:"",details:c=>{if(o==="webglErrorFired"){let u=c.webglErrorName;return u=u.replace(/^.*(0x[0-9a-f]+).*$/i,"$1"),{short:u,long:it.t('Paused on WebGL Error instrumentation breakpoint, error "{0}"',u)}}return o==="scriptBlockedByCSP"&&c.directiveText?{short:it.t('CSP violation "{0}"',c.directiveText),long:it.t('Paused on Content Security Policy violation instrumentation breakpoint, directive "{0}"',c.directiveText)}:{short:a,long:it.t('Paused on instrumentation breakpoint "{0}"',a)}},apply:async(c,u)=>(u?await c.EventBreakpoints.setInstrumentationBreakpoint({eventName:o}):await c.EventBreakpoints.removeInstrumentationBreakpoint({eventName:o}))?!0:!!(u?await c.DOMDebugger.setInstrumentationBreakpoint({eventName:o}):await c.DOMDebugger.removeInstrumentationBreakpoint({eventName:o}))}}function r(o,s,a){let c=s===void 0?"*":typeof s=="string"?[s]:s;return{id:"listener:"+o,title:a||o,group:"",details:u=>{let l=(u.targetName||"*").toLowerCase();return{short:l+"."+o,long:it.t('Paused on event listener breakpoint "{0}", triggered on "{1}"',o,l)}},apply:async(u,l)=>{let p=!0;for(let d of c)l?p=p&&!!await u.DOMDebugger.setEventListenerBreakpoint({eventName:o,targetName:d}):p=p&&!!await u.DOMDebugger.removeEventListenerBreakpoint({eventName:o,targetName:d});return p}}}t("Ad Auction Worklet",[e("beforeBidderWorkletBiddingStart",it.t("Bidder Bidding Phase Start")),e("beforeBidderWorkletReportingStart",it.t("Bidder Reporting Phase Start")),e("beforeSellerWorkletScoringStart",it.t("Seller Scoring Phase Start")),e("beforeSellerWorkletReportingStart",it.t("Seller Reporting Phase Start"))]),t("Animation",[e("requestAnimationFrame",it.t("Request Animation Frame")),e("cancelAnimationFrame",it.t("Cancel Animation Frame")),e("requestAnimationFrame.callback",it.t("Animation Frame Fired"))]),t("Canvas",[e("canvasContextCreated",it.t("Create canvas context")),e("webglErrorFired",it.t("WebGL Error Fired")),e("webglWarningFired",it.t("WebGL Warning Fired"))]),t("Clipboard",[r("copy"),r("cut"),r("paste"),r("beforecopy"),r("beforecut"),r("beforepaste")]),t("Control",[r("resize"),r("scroll"),r("scrollend"),r("zoom"),r("focus"),r("blur"),r("select"),r("change"),r("submit"),r("reset")]),t("Device",[r("deviceorientation"),r("devicemotion")]),t("DOM Mutation",[r("DOMActivate"),r("DOMFocusIn"),r("DOMFocusOut"),r("DOMAttrModified"),r("DOMCharacterDataModified"),r("DOMNodeInserted"),r("DOMNodeInsertedIntoDocument"),r("DOMNodeRemoved"),r("DOMNodeRemovedFromDocument"),r("DOMSubtreeModified"),r("DOMContentLoaded")]),t("Drag / Drop",[r("drag"),r("dragstart"),r("dragend"),r("dragenter"),r("dragover"),r("dragleave"),r("drop")]),t("Geolocation",[e("Geolocation.getCurrentPosition","getCurrentPosition"),e("Geolocation.watchPosition","watchPosition")]),t("Keyboard",[r("keydown"),r("keyup"),r("keypress"),r("input")]),t("Load",[r("load"),r("beforeunload"),r("unload"),r("abort"),r("error"),r("hashchange"),r("popstate"),r("navigate"),r("navigatesuccess"),r("navigateerror"),r("currentchange"),r("nagivateto"),r("navigatefrom"),r("finish"),r("dispose")]);let n=["audio","video"];t("Media",[r("play",n),r("pause",n),r("playing",n),r("canplay",n),r("canplaythrough",n),r("seeking",n),r("seeked",n),r("timeupdate",n),r("ended",n),r("ratechange",n),r("durationchange",n),r("volumechange",n),r("loadstart",n),r("progress",n),r("suspend",n),r("abort",n),r("error",n),r("emptied",n),r("stalled",n),r("loadedmetadata",n),r("loadeddata",n),r("waiting",n)]),t("Mouse",[r("auxclick"),r("click"),r("dblclick"),r("mousedown"),r("mouseup"),r("mouseover"),r("mousemove"),r("mouseout"),r("mouseenter"),r("mouseleave"),r("mousewheel"),r("wheel"),r("contextmenu")]),t("Notification",[e("Notification.requestPermission","requestPermission")]),t("Parse",[e("Element.setInnerHTML",it.t("Set innerHTML")),e("Document.write","document.write")]),t("Picture-in-Picture",[r("enterpictureinpicture","video"),r("leavepictureinpicture","video"),r("resize","PictureInPictureWindow"),r("enter","documentPictureInPicture")]),t("Pointer",[r("pointerover"),r("pointerout"),r("pointerenter"),r("pointerleave"),r("pointerdown"),r("pointerup"),r("pointermove"),r("pointercancel"),r("gotpointercapture"),r("lostpointercapture"),r("pointerrawupdate")]),t("Script",[e("scriptFirstStatement",it.t("Script First Statement")),e("scriptBlockedByCSP",it.t("Script Blocked by Content Security Policy"))]),t("Timer",[e("setTimeout"),e("clearTimeout"),e("setInterval"),e("clearInterval"),e("setTimeout.callback",it.t("setTimeout fired")),e("setInterval.callback",it.t("setInterval fired"))]),t("Touch",[r("touchstart"),r("touchmove"),r("touchend"),r("touchcancel")]),t("WebAudio",[e("audioContextCreated",it.t("Create AudioContext")),e("audioContextClosed",it.t("Close AudioContext")),e("audioContextResumed",it.t("Resume AudioContext")),e("audioContextSuspended",it.t("Suspend AudioContext"))]),t("Window",[e("DOMWindow.close","window.close")]),t("Worker",[r("message"),r("messageerror")]);let i=["xmlhttprequest","xmlhttprequestupload"];return t("XHR",[r("readystatechange",i),r("load",i),r("loadstart",i),r("loadend",i),r("abort",i),r("error",i),r("progress",i),r("timeout",i)]),Zb}var vT=JI(),EF=zi(function(){let t=["instantiate","instantiateStreaming","compile","compileStreaming"];for(let e of t){let r=WebAssembly[e];WebAssembly[e]=function(...n){return r.apply(this,n).then(i=>{if(!(n[0]instanceof WebAssembly.Module))debugger;return i})}}},vT);var ev=zi(function(t,e){let r=" ".repeat(e),n=`
`;function i(s){if(s instanceof Uint8Array)return Uint8Array;if(s instanceof Uint8ClampedArray)return Uint8ClampedArray;if(s instanceof Uint16Array)return Uint16Array;if(s instanceof Uint32Array)return Uint32Array;if(s instanceof BigUint64Array)return BigUint64Array;if(s instanceof Int8Array)return Int8Array;if(s instanceof Int32Array)return Int32Array;if(s instanceof BigInt64Array)return BigInt64Array;if(s instanceof Float32Array)return Float32Array;if(s instanceof Float64Array)return Float64Array}function o(s,a=0,c=[]){switch(typeof s){case"bigint":return`${s}n`;case"boolean":return s.toString();case"function":{let p=s.toString().replace(/^[^\s]+\(/,"function(").split(/\r?\n/g),d=/^$/;for(let f of p){let h=/^[ \t]+/.exec(f);if(h){d=new RegExp(`^[ \\t]{0,${h[0].length}}`);break}}return p.map((f,h)=>h===0?f:(f=f.replace(d,""),h===p.length-1?r.repeat(a)+f:r.repeat(a+1)+f)).join(n)}case"number":return`${s}`;case"object":if(s===null)return"null";if(c.includes(s))return"[Circular]";if(s instanceof Date)return`"${s.toISOString()}"`;if(typeof Node<"u"&&t instanceof Node)return t.outerHTML;let u=i(s);if(u)return`new ${u.name}([${s.join(", ")}])`;if(s instanceof ArrayBuffer)return`new Uint8Array([${new Uint8Array(s).join(", ")}]).buffer`;if(s instanceof Array)return["[",...s.map(p=>r.repeat(a+1)+o(p,a+1,[...c,s])+","),r.repeat(a)+"]"].join(n);let l=s;return["{",...Object.keys(l).map(p=>r.repeat(a+1)+(/^[$a-z_][0-9a-z_$]*$/i.test(p)?p:JSON.stringify(p))+": "+o(l[p],a+1,[...c,s])+","),r.repeat(a)+"}"].join(n);case"string":return s.includes(`
`)?"`"+s.replace(/[`\\\\]|\${/g,"\\$&")+"`":JSON.stringify(s);case"symbol":return s.toString();case"undefined":return"undefined";default:return String(s)}}try{return o(t)}catch{return""+t}}),kF=Rt(`
  function(spaces2) {
    const result = ${ev.expr("this","spaces2")};
    return result;
  }
`);var Mn=v(ge());var Ks=v(H());var RF=Rt(function(){let t={__proto__:this.__proto__},e=Object.getOwnPropertyNames(this);for(let r=0;r<e.length;++r){let n=e[r],i=n>>>0;if(String(i>>>0)===n&&i>>>0!==4294967295)continue;let o=Object.getOwnPropertyDescriptor(this,n);o&&Object.defineProperty(t,n,o)}return t});var AF=Rt(function(t,e){let r={},n=t===-1?0:t,i=e===-1?this.length:t+e;for(let o=n;o<i&&o<this.length;++o){let s=Object.getOwnPropertyDescriptor(this,o);s&&Object.defineProperty(r,o,s)}return r});var DF=Rt(function(t,e){let r={},n=t===-1?0:t,i=e===-1?this.childNodes.length:t+e;for(let o=n;o<i&&o<this.childNodes.length;++o){let s=this.childNodes[o];s.nodeName==="#comment"?r[o]=`<!-- ${s.textContent} -->`:s.nodeName==="#text"?r[o]=s.textContent||"":r[o]=s}return r});var OF=Rt(function(t){return t.call(this)});var wT=Rt(function(t,e){let{buffer:r,byteLength:n,byteOffset:i}=this instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&this instanceof SharedArrayBuffer?new DataView(this):this instanceof WebAssembly.Memory?new DataView(this.buffer):this,o=i+Math.min(t,n),s=Math.max(0,Math.min(e,n-t));return a(new Uint8Array(r,o,s));function a(c){let u="0123456789abcdef",l="";for(let p=0;p<c.length;p++){let d=c[p];l+=u[d>>>4]+u[d&15]}return l}});var ST=Rt(function(t,e){let r=c(e),{buffer:n,byteLength:i,byteOffset:o}=this instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&this instanceof SharedArrayBuffer?new DataView(this):this instanceof WebAssembly.Memory?new DataView(this.buffer):this,s=o+Math.min(t,i),a=Math.max(0,Math.min(r.length,i-t));return new Uint8Array(n,s,a).set(r.subarray(0,a)),a;function c(u){let l=new Uint8Array(u.length>>>1);for(let p=0;p<u.length;p+=2)l[p>>>1]=parseInt(u.slice(p,p+2),16);return l}});var Ul=(()=>{let t=0,e=2147483646;return()=>t++%e+1})(),MT=t=>{if(typeof t=="string")return{value:t};let e=t;return e.objectId?{objectId:e.objectId}:e.unserializableValue?{unserializableValue:e.unserializableValue}:{value:e.value}},ute=new Set(["typedarray","dataview","arraybuffer","webassemblymemory"]);var WF=1024,LF=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u,lte=/^#[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u,pte=t=>t.hasOwnProperty("configurable"),NF=(t,e,r)=>{let n=HO(t,kf(e),r);return Uo(n)},MF="<<indescribable>>",HF=t=>{if(!t.startsWith(MF))return t;let e,r;try{[e,r]=JSON.parse(t.slice(MF.length))}catch{return t}return Mn.t("{0} (couldn't describe: {1})",e,r)},_T=t=>!!t&&typeof t=="object"&&"readMemory"in t&&"writeMemory"in t,BF={PARAMETER:{name:Mn.t("Parameters"),sortOrder:-10},LOCAL:{name:Mn.t("Locals"),sortOrder:-9},GLOBAL:{name:Mn.t("Globals"),sortOrder:-8}},lh=class t{constructor(e,r,n,i,o,s,a,c){this.cdp=e;this.parent=r;this.vars=i;this.locationProvider=o;this.currentRef=s;this.settings=a;this.clientCapabilities=c;this.name=n.name,this.presentationHint=n.presentationHint,this.sortOrder=n.sortOrder||0,this.isCustomProperty=n.isCustomProperty}get customDescriptionGenerator(){return this.settings.customDescriptionGenerator}createVariable(e,r,...n){let i=new e(new t(this.cdp,this.currentRef?.(),r,this.vars,this.locationProvider,()=>i,this.settings,this.clientCapabilities),...n);return i.id>0&&this.vars.add(i),i}createVariableByType(e,r,n){if(gT(r))return this.createVariable(iv,e,r);if(r.objectId){if(r.type==="function")return this.createVariable(kT,e,r,n);if(r.subtype==="map"||r.subtype==="set")return this.createVariable(RT,e,r,n);if(r.subtype==="node")return this.createVariable(ET,e,r,n);if(!mT.has(r.subtype))return this.createVariable(Xs,e,r,n)}return this.createVariable(Gr,e,r)}createWasmVariable(e,r,n){return this.createVariable(dh,e,r,n)}async getDescriptionSymbols(e){return this.settings.descriptionSymbols??=CF({cdp:this.cdp,args:[],objectId:e}).then(r=>({objectId:r.objectId}),()=>({value:[]})),await this.settings.descriptionSymbols}async fetchObjectProperties(e){return Promise.all([this.cdp.Runtime.getProperties({objectId:e,accessorPropertiesOnly:!0,ownProperties:!1,generatePreview:!0}),this.cdp.Runtime.getProperties({objectId:e,ownProperties:!0,generatePreview:!0}),this.cdp.Runtime.callFunctionOn({functionDeclaration:TF.decl(`${WF}`,this.settings.customDescriptionGenerator||"null"),arguments:[await this.getDescriptionSymbols(e)],objectId:e,throwOnSideEffect:!0,returnByValue:!0}).then(r=>r?.result.value||{}).catch(()=>({}))])}async createObjectPropertyVars(e,r,n=!1){let i=[],o;if(this.settings.customPropertiesGenerator){let{result:p,errorDescription:d}=await this.evaluateCodeForObject(e,this.settings.customPropertiesGenerator,[]);p&&p.type!=="undefined"?e=p:i.push([this.createVariable(CT,{name:"",sortOrder:-1},p,p?.description||d||Mn.t("Unknown error"))])}if(!e.objectId)return[];r&&this.cdp.DotnetDebugger.setEvaluationOptions({options:r,type:"variable"});let[s,a,c]=await this.fetchObjectProperties(e.objectId);if(!s||!a)return[];if(!this.settings.customPropertiesGenerator&&c.customProps&&!n)try{let p=await this.cdp.Runtime.callFunctionOn({functionDeclaration:PF.decl(),arguments:[await this.getDescriptionSymbols(e.objectId)],objectId:e.objectId,throwOnSideEffect:!0});if(p&&p.result.objectId&&(o=e,e=p.result,[s,a,c]=await this.fetchObjectProperties(e.objectId),!s||!a))return[]}catch{}if(!s||!a)return[];let u=new Map,l=[];for(let p of s.result){if(p.symbol){l.push(p);continue}p.name==="__proto__"&&a.internalProperties?.some(d=>d.name==="[[Prototype]]")||u.set(p.name,p)}for(let p of a.result)p.get||p.set||(p.symbol?l.push(p):u.set(p.name,p));for(let p of[u.values(),l.values()])for(let d of p){if("symbol"in d&&d.symbol?.description==="Symbol(debug.properties)")continue;let f=o?{presentationHint:{kind:"virtual"},isCustomProperty:!!o}:void 0;i.push(this.createPropertyVar(d,e,c.out?.hasOwnProperty(d.name)?HF(c.out[d.name]):void 0,f))}for(let p of a.privateProperties??[]){let d=o?{presentationHint:{kind:"virtual",visibility:"private"},sortOrder:1,isCustomProperty:!!o}:{presentationHint:{visibility:"private"},sortOrder:1,isCustomProperty:!!o};i.push(this.createPropertyVar(p,e,void 0,d))}for(let p of a.internalProperties||[]){if(p.name==="[[StableObjectId]]")continue;let d;$F(p)?d=this.createFunctionLocationVariable(p):p.value!==void 0&&(d=this.createVariableByType({name:p.name,presentationHint:{visibility:"internal"},sortOrder:2},p.value)),d&&i.push([d])}return o&&i.push([this.createVariable(TT,{name:"...",presentationHint:{kind:"virtual",attributes:["readOnly"],visibility:"internal"},sortOrder:2},o)]),Ao(await Promise.all(i))}createFunctionLocationVariable(e){return this.createVariable(rv,{name:e.name,presentationHint:{visibility:"internal",attributes:["readOnly"]},sortOrder:2},e.value)}async createPropertyVar(e,r,n,i){let o=[],s=e.get&&e.get.type!=="undefined",a=e.set&&e.set.type!=="undefined",c={name:e.name,sortOrder:0,isCustomProperty:!1,...i,presentationHint:{...i?.presentationHint}};return i||(pte(e)?(e.enumerable===!1&&!s&&(c.presentationHint.visibility="internal",c.sortOrder=1),(e.writable===!1||s&&!a)&&(c.presentationHint.attributes=["readOnly"])):(c.presentationHint.visibility="private",c.sortOrder=1)),"value"in e&&e.value&&o.push(this.createVariableByType(c,e.value,n)),s?o.push(this.createVariable(OT,c,e.get,r)):a&&o.push(this.createVariable(DT,c,e.set)),o}async evaluateCodeForObject(e,r,n){try{let i=await this.cdp.Runtime.callFunctionOn({objectId:e.objectId,functionDeclaration:r,arguments:n.map(MT)});if(i){if(i.exceptionDetails===void 0)return{result:i.result};if(i&&i.result.description)return{errorDescription:i.result.description}}return{errorDescription:Mn.t("Unknown error")}}catch(i){return{errorDescription:i.stack||i.message||String(i)}}}},FF=t=>typeof t=="number"||/^[0-9]+$/.test(t),Gr=class t{constructor(e,r){this.context=e;this.remoteObject=r;this.id=Ul()}get name(){return this.context.name}get sortOrder(){return this.context.sortOrder}get accessor(){let{parent:e,name:r,isCustomProperty:n}=this.context;if(e instanceof ph)return e.accessor;if(!(e instanceof t))return this.context.name;if(n){let o=`${e.accessor}[Symbol.for(${JSON.stringify("debug.properties")})]()`;return FF(r)?`${o}[${r}]`:LF.test(r)?`${o}.${r}`:`${o}[${JSON.stringify(r)}]`}let i=e.context.parent;if(i instanceof t){if(this.remoteObject.subtype==="internal#entry")return`[...${i.accessor}.entries()][${+r}]`;if(e.remoteObject.subtype==="internal#entry")return`${e.accessor}[${this.name==="key"?0:1}]`}return FF(r)?`${e.accessor}[${r}]`:LF.test(r)?`${e.accessor}.${r}`:e.accessor==="this"&&lte.test(r)?`${e.accessor}.${r}`:`${e.accessor}[${JSON.stringify(r)}]`}async toDap(e,r){let n=this.context.name;return this.context.parent instanceof Fl&&(n=await this.context.parent.getRename(n)),Promise.resolve({name:n,value:Pc(this.remoteObject,e,r),evaluateName:this.accessor,type:this.remoteObject.type,variablesReference:0,presentationHint:this.context.presentationHint})}async setProperty(e,r){let n=await this.context.cdp.Runtime.callFunctionOn({objectId:this.remoteObject.objectId,functionDeclaration:`function(a) { return this[a] = ${r}; ${ht()} }`,arguments:[MT(e)],silent:!0});if(!n)throw new q(Ve(Mn.t("Unable to set variable value")));if(n.exceptionDetails)throw new q(qF(n.exceptionDetails));return this.context.createVariableByType({name:e},n.result)}async getChildren(e){return Promise.resolve([])}},tv=class{constructor(e){this.child=e;this.id=Ul()}getChildren(){return Promise.resolve([this.child])}},xT=class extends Gr{constructor(r,n,i,o){super(r,{type:i[0]?.type??"string"});this.value=n;this.args=i;this.stackTrace=o}toDap(){return Promise.resolve({name:this.context.name,value:this.value,variablesReference:this.stackTrace||this.args.some(Tc)?this.id:0})}getChildren(r){let n=[],{args:i,stackTrace:o}=this;for(let s=0;s<i.length;++s)Tc(i[s])&&n.push(this.context.createVariableByType({name:`arg${s}`,sortOrder:s},i[s]));return o&&n.push(this.context.createVariable(IT,{name:"",sortOrder:Number.MAX_SAFE_INTEGER},this.remoteObject,o)),Promise.resolve(n)}},IT=class extends Gr{constructor(r,n,i){super(r,n);this.stacktrace=i}async toDap(){return{name:"",value:await this.stacktrace.format(),variablesReference:0}}},rv=class extends Gr{constructor(e,r){super(e,r),this.location=r.value}async toDap(){return{name:this.context.name,value:await this.context.locationProvider.renderDebuggerLocation(this.location),variablesReference:0,presentationHint:{visibility:"internal"}}}},CT=class extends Gr{constructor(r,n,i){super(r,n);this.message=i}get accessor(){if(!(this.context.parent instanceof Gr))throw new Error("ErrorVariable must have a parent Variable");return this.context.parent.accessor}toDap(){return Promise.resolve({name:this.context.name,value:this.message,variablesReference:0})}},nv=Symbol("NoStringRepr"),Xs=class extends Gr{constructor(r,n,i){super(r,n);this.customStringRepr=i}async toDap(r,n){let[i,o]=await Promise.all([await super.toDap(r,n),await this.getValueRepresentation(r)]);return{...i,type:this.remoteObject.className||this.remoteObject.subtype||this.remoteObject.type,variablesReference:this.id,memoryReference:ute.has(this.remoteObject.subtype)?String(this.id):void 0,value:o}}async getValueRepresentation(r){if(typeof this.customStringRepr=="string")return this.customStringRepr;if(!this.context.parent&&this.remoteObject.objectId&&this.customStringRepr!==nv)try{let n=await this.context.cdp.Runtime.callFunctionOn({functionDeclaration:Qb.decl(`${WF}`,this.context.customDescriptionGenerator||"null"),objectId:this.remoteObject.objectId,returnByValue:!0});if(n?.result.value)return this.customStringRepr=HF(n.result.value)}catch{this.customStringRepr=nv}return this.context.name==="__proto__"&&this.remoteObject.description||Pc(this.remoteObject,r)}async readMemory(r,n){let i=await wT({cdp:this.context.cdp,args:[r,n],objectId:this.remoteObject.objectId,returnByValue:!0});return Buffer.from(i.value,"hex")}async writeMemory(r,n){return(await ST({cdp:this.context.cdp,args:[r,n.toString("hex")],objectId:this.remoteObject.objectId,returnByValue:!0})).value}getChildren(r){return this.context.createObjectPropertyVars(this.remoteObject,r.evaluationOptions)}},TT=class extends Xs{get accessor(){let{parent:e}=this.context;return e instanceof Gr?e.accessor:super.accessor}getChildren(e){return this.context.createObjectPropertyVars(this.remoteObject,e.evaluationOptions,!0)}},PT=class extends Xs{constructor(){super(...arguments);this.id=Ul()}get accessor(){return this.context.parent.accessor}async toDap(r,n){return Promise.resolve({...await super.toDap(r,n),value:"..."})}},ET=class extends Gr{constructor(){super(...arguments);this.description=me(()=>this.context.cdp.DOM.describeNode({objectId:this.remoteObject.objectId}))}async toDap(r,n){let o=(await this.description())?.node?.childNodeCount||0;return{...await super.toDap(r,n),value:await this.getValuePreview(r),variablesReference:this.id,indexedVariables:o>100?o:void 0,namedVariables:o>100?1:void 0}}async getChildren(r){switch(r?.filter){case"indexed":return this.getNodeChildren(r.start,r.count);case"named":return[this.getAttributesVar()];default:return[this.getAttributesVar(),...await this.getNodeChildren()]}}getAttributesVar(){return this.context.createVariable(PT,{name:Mn.t("Node Attributes"),presentationHint:{visibility:"internal"},sortOrder:Number.MAX_SAFE_INTEGER},this.remoteObject,void 0)}async getNodeChildren(r=-1,n=-1){let i;try{i=await DF({cdp:this.context.cdp,generatePreview:!1,args:[r,n],objectId:this.remoteObject.objectId})}catch{return[]}let o=await this.context.createObjectPropertyVars(i);return i.objectId&&await this.context.cdp.Runtime.releaseObject({objectId:i.objectId}),o}async getValuePreview(r){let n=await this.description();if(!n?.node)return"";let{localName:i,attributes:o,childNodeCount:s}=n.node,a=this.context.clientCapabilities.value?.supportsANSIStyling?!0:"",c=(a&&"\x1B[34m")+`<${i}`;if(o)for(let u=0;u<o.length;u+=2){let l=o[u],p=o[u+1];c+=` ${a&&"\x1B[34;1m"}${l}${a&&"\x1B[2m"}=${a&&"\x1B[33m"}${JSON.stringify(p)}`}return c+=(a&&"\x1B[34m")+">",s&&(c+=`${a&&"\x1B[2m"}...${a&&"\x1B[34m"}`),c+=`</${i}>${a&&"\x1B[0m"}`,c}},kT=class extends Xs{async toDap(e){let[r,n]=await Promise.all([super.toDap(e),this.context.cdp.Runtime.getProperties({objectId:this.remoteObject.objectId,ownProperties:!0,nonIndexedPropertiesOnly:!0})]),i=n?.internalProperties?.find($F);return i&&(r.valueLocationReference=this.context.createFunctionLocationVariable(i).id),r}},UF="[[Entries]]",RT=class extends Xs{constructor(r,n){super(r,n,nv);this.baseChildren=me(()=>super.getChildren({variablesReference:this.id}));this.isMap=n.subtype==="map";let i=n.preview;this.size=Number(i?.properties.find(o=>o.name==="size")?.value)??void 0}async toDap(r){let n=await super.toDap(r);return this.size&&this.size>100&&(n.indexedVariables=this.size),n}async getChildren(r){let n=await this.baseChildren();return[...(await n.find(o=>o.name===UF)?.getChildren(r)||[]).filter(o=>o.sortOrder===0),...n.filter(o=>o.name!==UF)]}},iv=class extends Xs{constructor(r,n){super(r,n,nv);this.length=0;let i=String(n.description).match(/\(([0-9]+)\)/);this.length=i?+i[1]:0}async toDap(r){return{...await super.toDap(r),indexedVariables:this.length>100?this.length:void 0,namedVariables:this.length>100?1:void 0}}async getChildren(r){switch(r?.filter){case"indexed":return this.getArraySlots(r);case"named":return this.getArrayProperties();default:return Promise.all([this.getArrayProperties(),this.getArraySlots()]).then(Ao)}}async getArrayProperties(){try{let r=await RF({cdp:this.context.cdp,args:[],objectId:this.remoteObject.objectId,generatePreview:!0});return this.context.createObjectPropertyVars(r)}catch{return[]}}async getArraySlots(r){let n=r&&typeof r.start<"u"?r.start:-1,i=r&&typeof r.count<"u"?r.count:-1,o;try{o=await AF({cdp:this.context.cdp,generatePreview:!1,args:[n,i],objectId:this.remoteObject.objectId})}catch{return[]}let s=await this.context.createObjectPropertyVars(o);return o.objectId&&await this.context.cdp.Runtime.releaseObject({objectId:o.objectId}),s}},AT=class extends iv{async toDap(e){return this.remoteObject.preview?{...await super.toDap(e),name:xF(this.remoteObject.preview)}:super.toDap(e)}},ph=class extends Gr{constructor(e,r){super(e,r)}getChildren(e){return this.context.createObjectPropertyVars(this.remoteObject)}},DT=class extends ph{async toDap(e,r){return{...await super.toDap(e,r),value:"write-only",variablesReference:this.id}}},OT=class extends ph{constructor(r,n,i){super(r,n);this.parentObject=i}async toDap(r,n){let i=await super.toDap(r,n);return i.variablesReference=this.id,i.presentationHint={...i.presentationHint,lazy:!0},i}async getChildren(r){try{let n=await OF({cdp:this.context.cdp,objectId:this.parentObject.objectId,args:[new Af(this.remoteObject.objectId)]});return[this.context.createVariableByType({name:this.name,presentationHint:this.context.presentationHint},n)]}catch(n){if(!(n instanceof rc))throw n}return super.getChildren(r)}},dh=class t{constructor(e,r,n){this.context=e;this.variable=r;this.scopeRef=n;this.id=Ul();this.sortOrder=0}static{this.presentationHint={attributes:["readOnly"]}}toDap(){return Promise.resolve({name:this.context.name,value:this.variable.description||"",variablesReference:this.variable.getChildren?this.id:0,memoryReference:this.variable.linearMemoryAddress?String(this.id):void 0,presentationHint:this.context.presentationHint})}async getChildren(){return(await this.variable.getChildren?.()||[]).map(r=>this.context.createVariable(t,{name:r.name,presentationHint:t.presentationHint},r.value,this.scopeRef))}async readMemory(e,r){let n=this.variable.linearMemoryAddress;if(n===void 0)return;let i=await this.context.cdp.Debugger.evaluateOnCallFrame({callFrameId:this.scopeRef.callFrameId,expression:`(${wT.source}).call(memories[0].buffer, ${+n+e}, ${+r}) ${ht()}`,returnByValue:!0});if(!i)throw new rc({exceptionId:0,text:"No response from CDP",lineNumber:0,columnNumber:0});return Buffer.from(i.result.value,"hex")}async writeMemory(e,r){let n=this.variable.linearMemoryAddress;return n===void 0?0:(await this.context.cdp.Debugger.evaluateOnCallFrame({callFrameId:this.scopeRef.callFrameId,expression:`(${ST.source}).call(memories[0].buffer, ${+n+e}, ${JSON.stringify(r.toString("hex"))}) ${ht()}`,returnByValue:!0}))?.result.value||0}},LT=class{constructor(e,r,n,i){this.context=e;this.kind=r;this.variables=n;this.scopeRef=i;this.id=Ul();this.sortOrder=BF[this.kind]?.sortOrder||0}toDap(){return Promise.resolve({name:BF[this.kind]?.name||this.kind,value:"",variablesReference:this.id})}getChildren(){return Promise.all(this.variables.map(async e=>{let r=await e.evaluate();return this.context.createVariable(dh,{name:e.name,presentationHint:dh.presentationHint},r,this.scopeRef)}))}},Fl=class{constructor(e,r,n,i,o){this.remoteObject=e;this.context=r;this.ref=n;this.extraProperties=i;this.renameProvider=o;this.id=Ul()}async getChildren(e){let r=await this.context.createObjectPropertyVars(this.remoteObject),n=new Set(r.map(i=>i.name));for(let i of this.extraProperties)n.has(i.name)||r.push(this.context.createVariableByType({name:i.name},i.value));return r}async getRename(e){return(await this.renameProvider.provideOnStackframe(this.ref.stackFrame)).getOriginalName(e,this.ref.stackFrame.rawPosition)||e}async setProperty(e,r){let n=await this.context.cdp.Debugger.evaluateOnCallFrame({expression:`${r} ${ht()}`,callFrameId:this.ref.callFrameId});if(!n)throw new q(Ge(Mn.t("Invalid expression")));if(n.exceptionDetails)throw new q(qF(n.exceptionDetails));return await this.context.cdp.Debugger.setVariableValue({callFrameId:this.ref.callFrameId,scopeNumber:this.ref.scopeNumber,variableName:e,newValue:MT(n.result)}),this.context.createVariableByType({name:e},n.result)}},NT=class{constructor(){this.value=new Map}get(e){return this.value.get(e)}add(e){this.value.set(e.id,e)}clear(){this.value.clear()}},Js=class{constructor(e,r,n,i,o,s){this.renameProvider=e;this.cdp=r;this.dap=n;this.launchConfig=i;this.clientCapabilities=o;this.locationProvider=s;this.vars=new NT;this.contextSettings={customDescriptionGenerator:i.customDescriptionGenerator&&NF(["defaultValue"],i.customDescriptionGenerator,!1),customPropertiesGenerator:i.customPropertiesGenerator&&NF([],i.customPropertiesGenerator,!1)}}createDetached(){return new Js(this.renameProvider,this.cdp,this.dap,this.launchConfig,this.clientCapabilities,this.locationProvider)}clear(){this.vars.clear()}createFloatingVariable(e,r){return this.createFloatingContext().createVariableByType({name:e},r)}createFloatingWasmVariable(e,r,n,i){let o=this.createFloatingContext(),s={stackFrame:n,callFrameId:i,scopeNumber:0};return o.createWasmVariable({name:e},r,s)}createVariableForOutput(e,r,n,i){let o=this.createFloatingContext(),s=r.length===1&&i==="table"?o.createVariable(AT,{name:""},r[0]):r.length===1&&Tc(r[0])&&!n?o.createVariableByType({name:""},r[0]):o.createVariable(xT,{name:""},e,r,n),a=new tv(s);return this.vars.add(a),a}createScope(e,r,n){let i=new Fl(e,new lh(this.cdp,void 0,{name:""},this.vars,this.locationProvider,()=>i,this.contextSettings,this.clientCapabilities),r,n,this.renameProvider);return this.vars.add(i),i}createWasmScope(e,r,n){let i=new LT(new lh(this.cdp,void 0,{name:""},this.vars,this.locationProvider,()=>i,this.contextSettings,this.clientCapabilities),e,r,n);return this.vars.add(i),i}hasVariable(e){return!!this.vars.get(e)}hasMemory(e){return _T(this.vars.get(Number(e)))}async readMemory(e,r,n){let i=this.vars.get(Number(e));return _T(i)?i.readMemory(r,n):void 0}async writeMemory(e,r,n){let i=this.vars.get(Number(e)),o=_T(i)?await i.writeMemory(r,n):0;return o>0&&this.dap.invalidated({areas:["variables"]}),o}async getVariableNames(e){let r=this.vars.get(e.variablesReference);return r?(await r.getChildren(e)).filter(Ga(Gr)):[]}async getVariables(e){let r=this.vars.get(e.variablesReference);if(!r)return[];let n=await r.getChildren(e);return(await Promise.all(n.map(o=>o.toDap(r instanceof Fl||r instanceof tv?"repl":"propertyValue",e.format).then(s=>({v:o,dap:s}))))).sort((o,s)=>o.v.sortOrder-s.v.sortOrder||+o.dap.name-+s.dap.name||o.dap.name.localeCompare(s.dap.name)).map(o=>o.dap)}async getLocations(e){let r=this.vars.get(e);if(!r||!(r instanceof rv))throw Ef();return r.location}async setVariable(e){let r=this.vars.get(e.variablesReference);if(!e.value)throw new q(Ge(Mn.t("Cannot set an empty value")));if(r instanceof Fl||r instanceof Gr)return await(await r.setProperty(e.name,e.value)).toDap("propertyValue",e.format);throw new q(Ve(Mn.t("Variable not found")))}createFloatingContext(){return new lh(this.cdp,void 0,{name:"<unnamed>"},this.vars,this.locationProvider,void 0,this.contextSettings,this.clientCapabilities)}};Js=I([(0,Ks.injectable)(),g(0,(0,Ks.inject)(Bs)),g(1,(0,Ks.inject)(lt)),g(2,(0,Ks.inject)(Ur)),g(3,(0,Ks.inject)(Re)),g(4,(0,Ks.inject)($s))],Js);function qF(t){let e=t.exception&&Ec(t.exception).title||t.text;return Ge(e)}function $F(t){return t.name==="[[FunctionLocation]]"&&!!t.value&&t.value.subtype==="internal#location"}var BT=class{constructor(e){this.description=e;this.sourceMapLoads=new Map;this.scripts=[]}get isDefault(){return this.description.auxData&&this.description.auxData.isDefault}async remove(e){await Promise.all(this.scripts.map(async r=>{let n=await r.source;n.filterScripts(i=>i.executionContextId!==this.description.id),n.scripts.length||e.removeSource(n)}))}},FT=class{constructor(e){this._obj=e;this._dapDeferred=Ue()}resolve(){this._dapDeferred.resolve(this._obj)}with(e){return this._dapDeferred.hasSettled()?e(this._obj):this._dapDeferred.promise.then(r=>e(r))}},fte=50,VF=(t,e)=>t.sourceReference===e.sourceReference&&Fy(t.path||"",e.path||""),hte=()=>`
//# sourceURL=eval-${(0,GF.randomBytes)(4).toString("hex")}.repl
`,UT=class{async enqueue(e,r){if(this.queue?.operation===e&&await new Promise(n=>setTimeout(n)),!this.queue||this.queue.operation!==e){let n=this.queue?.result.then(r,r)??r(),i=this.queue={operation:e,result:n.finally(()=>{this.queue===i&&(this.queue=void 0)})}}return this.queue.result}};var jl=class t{constructor(e,r,n,i,o,s,a,c,u,l,p,d,f,h,m){this.target=i;this.logger=s;this.evaluator=a;this.completer=c;this.launchConfig=u;this._breakpointManager=l;this.console=p;this.exceptionPause=d;this._smartStepper=f;this.shutdown=h;this._executionContexts=new Map;this._excludedCallers=[];this.stateQueue=new UT;this._onPausedEmitter=new j;this.disposed=!1;this.debuggerReady=Ue();this.onPaused=this._onPausedEmitter.event;this._dap=new FT(n),this._sourceContainer=e,this._cdp=r,this.id=t._lastThreadId++,this.replVariables=new Js(o,this._cdp,n,u,m,this),e.onSourceMappedSteppingChange(()=>this.refreshStackTrace()),this._initialize()}static{this._lastThreadId=0}static{this._allThreadsByDebuggerId=new Map}setExcludedCallers(e){this._excludedCallers=e}cdp(){return this._cdp}name(){return this.target.name()}pausedDetails(){return this._pausedDetails}pausedVariables(){return this._pausedVariables}defaultExecutionContext(){for(let e of this._executionContexts.values())if(e.isDefault)return e}resume(){return this.stateQueue.enqueue("resume",async()=>(this._sourceContainer.clearDisabledSourceMaps(),!await this._cdp.Debugger.resume({})&&this._pausedDetails!==void 0?Ve(Be.t("Unable to resume")):{allThreadsContinued:!1}))}pause(){return this.stateQueue.enqueue("pause",async()=>(this._expectedPauseReason={reason:"pause"},await this._cdp.Debugger.pause({})?{}:Ve(Be.t("Unable to pause"))))}stepOver(){return this.stateQueue.enqueue("stepOver",async()=>{this._expectedPauseReason={reason:"step",direction:1};let e=await this.getCurrentSkipList(1);return await this._cdp.Debugger.stepOver({skipList:e})?{}:Ve(Be.t("Unable to step next"))})}stepInto(e){return this.stateQueue.enqueue("stepInto",async()=>{this._waitingForStepIn={lastDetails:this._pausedDetails},this._expectedPauseReason={reason:"step",direction:0};let r=this._pausedDetails?.stepInTargets?.[e];if(r){let n=await this._cdp.Debugger.setBreakpoint({location:r.breakLocation});if(this._waitingForStepIn.intoTargetBreakpoint=n?.breakpointId,await this._cdp.Debugger.resume({}))return{}}else{let n=await this.getCurrentSkipList(0);if(await this._cdp.Debugger.stepInto({breakOnAsyncCall:!0,skipList:n}))return{}}return Ve(Be.t("Unable to step in"))})}stepOut(){return this.stateQueue.enqueue("stepOut",async()=>(this._expectedPauseReason={reason:"step",direction:2},await this._cdp.Debugger.stepOut({})?{}:Ve(Be.t("Unable to step out"))))}async getCurrentSkipList(e){if(!this._pausedDetails)return;let[r]=await this._pausedDetails.stackTrace.loadFrames(1);if(!r||!zF(r))return;let n=await r.getStepSkipList(e);if(n)return vr.simplify(n).map(i=>({start:i.begin.base0,end:i.end.base0,scriptId:r.root.scriptId}))}_stackFrameNotFoundError(){return Ve(Be.t("Stack frame not found"))}_evaluateOnAsyncFrameError(){return Ve(Be.t("Unable to evaluate on async stack frame"))}async restartFrame(e){let r=this._pausedDetails?.stackTrace.frame(e.frameId)?.root;if(!r)return this._stackFrameNotFoundError();let n=r.callFrameId();return n?await this._cdp.Debugger.restartFrame({callFrameId:n,mode:"StepInto"})?(this._expectedPauseReason={reason:"frame_entry",description:Be.t("Paused on frame entry")},r.canExplicitlyBeRestarted||await this._cdp.Debugger.stepInto({}),{}):Ge(Be.t("Frame could not be restarted")):Ge(Be.t("Cannot restart asynchronous frame"))}async stackTrace(e){return this._pausedDetails?this._pausedDetails.stackTrace.toDap(e):Ve(Be.t("Thread is not paused"))}async scopes(e){let r=this._pausedDetails?this._pausedDetails.stackTrace.frame(e.frameId):void 0;return r?r.scopes():this._stackFrameNotFoundError()}async exceptionInfo(){let e=this._pausedDetails&&this._pausedDetails.exception;if(!e)return Ve(Be.t("Thread is not paused on exception"));let r=Ec(e);return{exceptionId:r.title,breakMode:"all",details:{stackTrace:r.stackTrace,evaluateName:void 0}}}async revealPage(){return this._cdp.Page.bringToFront({}),{}}async completions(e){let r;if(e.frameId!==void 0){if(r=this._pausedDetails?this._pausedDetails.stackTrace.frame(e.frameId)?.root:void 0,!r)return this._stackFrameNotFoundError();if(!r.callFrameId())return this._evaluateOnAsyncFrameError()}if(e.line===1&&e.text.startsWith("cd "))return{targets:this.getExecutionContextCompletions(e)};let n=await this.completer.completions({executionContextId:this._selectedContext?this._selectedContext.description.id:void 0,stackFrame:r,expression:e.text,position:new ct(e.line||1,e.column)});return{targets:[...this.getExecutionContextCompletions(e),...n]}}getExecutionContextCompletions(e){if(e.line&&e.line>1)return[];let r=e.text.slice(0,e.column).trim();return[...this._executionContexts.values()].map(n=>`cd ${this.target.executionContextName(n.description)}`).filter(n=>n.startsWith(r)).map(n=>({label:n,start:0,length:e.text.length}))}async _evaluteWasm(e,r,n){if(!e)return;let i=e.root,o=i.callFrameId(),s=await i.scriptSource?.source;if(!hc(s)||!o)return;let a=await s.sourceMap.value.promise;if(!a.evaluate)return;let c=new tt(e instanceof hh?e.inlineFrameIndex:0,i.rawPosition.base0.columnNumber),u=await a.evaluate(o,c,r.expression);return await n.createFloatingWasmVariable(r.expression,u,i,o).toDap(r.context,r.format)}async _evaluteJs(e,r,n){let i,o;if(r.context==="clipboard"?(o=ev.exprArgRanges(r.expression,"2"),i={expression:ev.expr(r.expression,"2"),includeCommandLineAPI:!0,returnByValue:!0,objectGroup:"console"}):i={expression:r.expression,includeCommandLineAPI:!0,objectGroup:"console",generatePreview:!0,timeout:r.context==="hover"?this.getHoverEvalTimeout():void 0},r.context==="repl"){if(i.expression=Rf(i.expression),i.expression.indexOf("await")!==-1){let l=KO(i.expression);l&&(i.expression=l,i.awaitPromise=!0)}i.expression+=hte()}r.evaluationOptions&&this.cdp().DotnetDebugger.setEvaluationOptions({options:r.evaluationOptions,type:"evaluation"});let s;if(r.source&&r.line&&r.column){let l=this._pausedVariables,p=this._sourceContainer.source(r.source);p&&l&&(s={source:p,position:new ct(r.line,r.column),variables:l})}let a=e?.root.callFrameId(),c=this.evaluator.evaluate(a?{...i,callFrameId:a}:{...i,contextId:this._selectedContext?this._selectedContext.description.id:void 0},{isInternalScript:!1,stackFrame:e?.root,location:s,transformRanges:o});if(r.context==="repl")return await this._evaluateRepl(r,c,r.format);let u=await c;if(!u)throw new q(Ve(Be.t("Unable to evaluate")));if(u.exceptionDetails){let l=u.exceptionDetails.exception?Ec(u.exceptionDetails.exception).title:u.exceptionDetails.text;throw l.startsWith("Uncaught")||(l="Uncaught "+l),new q(Ve(l))}return n.createFloatingVariable(i.expression,u.result).toDap(r.context,r.format)}async evaluate(e){let r,n;if(e.frameId!==void 0){if(n=this._pausedDetails?this._pausedDetails.stackTrace.frame(e.frameId):void 0,!n)throw new q(this._stackFrameNotFoundError());if(r=n.root.callFrameId(),!r)throw new q(this._evaluateOnAsyncFrameError())}if(e.context==="repl"&&e.expression.startsWith("cd ")){let s=e.expression.substring(3).trim();for(let a of this._executionContexts.values())if(this.target.executionContextName(a.description)===s)return this._selectedContext=a,{result:`[${s}]`,variablesReference:0}}let i=r?this._pausedVariables:this.replVariables;if(!i)throw new q(Ve(Be.t("Unable to evaluate")));let o=await this._evaluteWasm(n,e,i)??await this._evaluteJs(n,e,i);return{type:o.type,result:o.value,variablesReference:o.variablesReference,namedVariables:o.namedVariables,indexedVariables:o.indexedVariables,memoryReference:o.memoryReference,valueLocationReference:o.valueLocationReference}}getHoverEvalTimeout(){let e=this.launchConfig.timeouts?.hoverEvaluation;if(e===void 0)return 500;if(!(e<=0))return e}async _evaluateRepl(e,r,n){let i=await r;if(!i)return{name:e.expression,value:"",variablesReference:0};if(i.exceptionDetails){let c=await new fh(i.exceptionDetails).toDap(this);throw new q(yO(c.output))}let o=this._selectedContext&&this.defaultExecutionContext()!==this._selectedContext?`\x1B[33m[${this.target.executionContextName(this._selectedContext.description)}] `:"",s=await this.replVariables.createFloatingVariable(e.expression,i.result).toDap("repl",n),a=Jb("repl").budget;return s.variablesReference===0&&s.value.length===a&&setImmediate(()=>this.console.enqueue(this,{toDap:()=>({output:Be.t("Output has been truncated to the first {0} characters. Run `{1}` to copy the full output.",a,`copy(${e.expression.trim()})`),category:"stdout"})})),{...s,value:`${o}${s.value}`}}_initialize(){this._cdp.Runtime.on("executionContextCreated",e=>{this._executionContextCreated(e.context)}),this._cdp.Runtime.on("executionContextDestroyed",e=>{this._executionContextDestroyed(e.executionContextId)}),this._cdp.Runtime.on("executionContextsCleared",()=>{this._ensureDebuggerEnabledAndRefreshDebuggerId(),this.replVariables.clear(),this._executionContextsCleared()}),this._cdp.Inspector.on("targetReloadedAfterCrash",()=>{this._breakpointManager.reapply()}),this.launchConfig.outputCapture==="console"&&(this._cdp.Runtime.on("consoleAPICalled",e=>{this.console.dispatch(this,e)}),this._cdp.Runtime.on("exceptionThrown",e=>{this.console.enqueue(this,new fh(e.exceptionDetails))})),this._cdp.Runtime.on("inspectRequested",e=>{e.hints.copyToClipboard?this._copyObjectToClipboard(e.object):e.hints.queryObjects?this.console.enqueue(this,new ov(e.object,this.cdp())):this._revealObject(e.object)}),this._cdp.Debugger.on("paused",async e=>this._onPaused(e)),this._cdp.Debugger.on("resumed",()=>this.onResumed()),this._cdp.Debugger.on("scriptParsed",e=>this._onScriptParsed(e)),this._cdp.Debugger.on("scriptFailedToParse",e=>this._onScriptParsed(e)),this._cdp.Runtime.enable({}),this._cdp.Profiler.enable({}),this._ensureDebuggerEnabledAndRefreshDebuggerId(),this.launchConfig.noDebug&&this.logger.info("runtime.launch","Running with noDebug, so debug domains are disabled"),this.target.initialize(),this._dap.with(e=>e.thread({reason:"started",threadId:this.id}))}dapInitialized(){this._dap.resolve()}async enableNetworking({mirrorEvents:e}){if(!await this._cdp.Network.enable({}))throw wO();return this._dap.with(n=>{for(let i of e)this._cdp.Network.on(i,o=>n.networkEvent({data:o,event:i}))}),{}}async getStepInTargets(e){let r=this._pausedDetails;if(!r)return[];let n=r.stackTrace.frames.find(l=>l.frameId===e);if(!(n instanceof xr))return[];let i=await n.uiLocation();if(!i)return[];let o=r.event.callFrames[0].location,[s,a]=await Promise.all([this._breakpointManager.getBreakpointLocations(this,i.source,new ct(i.lineNumber,1),new ct(i.lineNumber+1,1)).then(l=>l.filter(p=>p.breakLocation.lineNumber!==o.lineNumber||p.breakLocation.columnNumber!==o.columnNumber)),i.source.content()]),c=r.stepInTargets?.length||0;r.stepInTargets=r.stepInTargets?.concat(s)||s;let u=a&&new Ds(a);return s.map((l,p)=>{let d=l.uiLocations.find(h=>h.source===i.source);if(!d)return;if(!u)return{id:c+p,label:`Column ${d}`,line:d.lineNumber,column:d.columnNumber};let f=JO(a.slice(u.getLineOffset(d.lineNumber-1),u.getLineOffset(d.lineNumber)),d.columnNumber-1);if(f)return{id:c+p,label:f.text,line:d.lineNumber,column:f.start+1,endLine:d.lineNumber,endColumn:f.end+1}}).filter(at)}async refreshStackTrace(){this._pausedDetails&&(this._pausedDetails=await this._createPausedDetails(this._pausedDetails.event),this._onThreadResumed(),await this._onThreadPaused(this._pausedDetails))}_executionContextCreated(e){let r=new BT(e);return this._executionContexts.set(e.id,r),this._scriptWithSourceMapHandler&&this._installWasmPauseHandler(e.id),r}_installWasmPauseHandler(e){return this._cdp.Runtime.evaluate({expression:EF.expr(),silent:!0,contextId:e})}async _executionContextDestroyed(e){let r=this._executionContexts.get(e);r&&(this._executionContexts.delete(e),await this.shutdown.shutdownContext(),r.remove(this._sourceContainer))}async _executionContextsCleared(){let e=[...this._executionContexts.values()],r=this._pausedDetails;this._executionContexts.clear(),await this.shutdown.shutdownContext();for(let n of e)n.remove(this._sourceContainer);this._breakpointManager.executionContextWasCleared(),r&&r===this._pausedDetails&&!this.disposed&&this.onResumed()}_ensureDebuggerEnabledAndRefreshDebuggerId(){if(this.launchConfig.noDebug)return this.debuggerReady.resolve();this._cdp.Debugger.enable({}).then(e=>{this.debuggerReady.resolve(),e&&t._allThreadsByDebuggerId.set(e.debuggerId,this)}),this.exceptionPause.apply(this._cdp)}async _onPaused(e){let r=e.hitBreakpoints??[],n=e.reason==="Break on start"||e.reason==="debugCommand",i=e.callFrames[0]?.location,o=e.data?.scriptId||i?.scriptId,s=o&&this._sourceContainer.getSourceScriptById(o)?.url===vT,a=o&&(e.reason==="instrumentation"||this._breakpointManager.isEntrypointBreak(r,o)||r.some(p=>this._pauseOnSourceMapBreakpointIds?.includes(p))||s);if(this.evaluator.setReturnedValue(e.callFrames[0]?.returnValue),a){this.launchConfig.perScriptSourcemaps==="auto"&&this._shouldEnablePerScriptSms(e)&&await this._enablePerScriptSourcemaps(),e.data&&!n&&(e.data.__rewriteAs="breakpoint");let p=this._expectedPauseReason;if(s){let d=this._lastParsedWasmScriptIds;return this._lastParsedWasmScriptIds=void 0,d&&await Promise.all(d.map(f=>this._handleSourceMapPause(f,i))),this.resume()}else if(!(o&&await this._handleSourceMapPause(o,i))){if(!n){if(await this.isCrossThreadStep(e))e.data={...e.data,__rewriteAs:"step"};else if(!await this._breakpointManager.shouldPauseAt(e,r,this.target.entryBreakpoint,!0))if(p?.reason==="step"){if(p.direction!==0)return this._cdp.Debugger.resume({})}else return this.resume()}}}else if(!(e.reason==="exception"||e.reason==="promiseRejection"?await this.exceptionPause.shouldPauseAt(e):await this._breakpointManager.shouldPauseAt(e,r,this.target.entryBreakpoint,!1)))return this.resume();let c=this._waitingForStepIn?.intoTargetBreakpoint;if(c){e.hitBreakpoints?.includes(c)?(this._waitingForStepIn.intoTargetBreakpoint=void 0,await this._cdp.Debugger.removeBreakpoint({breakpointId:c}),await this._cdp.Debugger.stepInto({breakOnAsyncCall:!1})):this.resume();return}if(n&&("continueOnAttach"in this.launchConfig&&this.launchConfig.continueOnAttach||this.launchConfig.type==="pwa-extensionHost"||this.target instanceof Ml)){this.resume();return}let u=this._pausedDetails=await this._createPausedDetails(e);if(this._excludedCallers.length&&await this._matchesExcludedCaller(this._pausedDetails.stackTrace)){this.logger.info("runtime","Skipping pause due to excluded caller"),this.resume();return}let l=await this._smartStepper.getSmartStepDirection(u,this._expectedPauseReason);if(this._pausedDetails===u){switch(l){case 0:return this.stepInto();case 2:return this.stepOut();case 1:return this.stepOver();default:}this._waitingForStepIn=void 0,this._pausedVariables=this.replVariables.createDetached(),await this._onThreadPaused(u)}}async _matchesExcludedCaller(e){if(!this._excludedCallers.length)return!1;let r=e.frames[0],n=r instanceof xr&&await r.uiLocation();if(!n)return!1;let i,o,s=[];for(let{caller:a,target:c}of this._excludedCallers)if(!(c.line!==n.lineNumber||c.column!==n.columnNumber)&&(i??=await n.source.toDap(),!!VF(i,c.source))){o||(o=await e.loadFrames(fte).then(l=>Promise.all(l.slice(1).filter(Ga(xr)).map(p=>p.uiLocation()))));for(let u=0;u<o.length;u++){let l=o[u];if(!l||l.lineNumber!==a.line||l.columnNumber!==a.column)continue;let p=s[u]??=await l.source.toDap();if(VF(p,a.source))return!0}}return!1}onResumed(){this._pausedDetails=void 0,this._pausedVariables=void 0,this.evaluator.setReturnedValue(void 0),this._onThreadResumed()}async dispose(){await this.shutdown.shutdownAll(),this.disposed=!0;for(let[e,r]of t._allThreadsByDebuggerId)r===this&&t._allThreadsByDebuggerId.delete(e);this._removeAllScripts(!0),this._executionContextsCleared(),await this._dap.with(e=>e.thread({reason:"exited",threadId:this.id}))}rawLocation(e){if("location"in e){let r=e;return{lineNumber:Math.max(0,r.location.lineNumber)+1,columnNumber:Math.max(0,r.location.columnNumber||0)+1,scriptId:r.location.scriptId}}return{lineNumber:Math.max(0,e.lineNumber)+1,columnNumber:Math.max(0,e.columnNumber||0)+1,scriptId:e.scriptId}}rawLocationToUiLocation(e){if(!e.scriptId||this.disposed||this.launchConfig.noDebug)return;let r=this._sourceContainer.getScriptById(e.scriptId);return r?r.resolvedSource?this._sourceContainer.preferredUiLocation({...r.resolvedSource.offsetScriptToSource(e),source:r.resolvedSource}):r.source.then(n=>this._sourceContainer.preferredUiLocation({...n.offsetSourceToScript(e),source:n})):this.rawLocationToUiLocationWithWaiting(e)}async rawLocationToUiLocationWithWaiting(e){let r=e.scriptId?await this.getScriptByIdOrWait(e.scriptId):void 0;if(!r)return;let n=await r.source;return this._sourceContainer.preferredUiLocation({...n.offsetScriptToSource(e),source:n})}getScriptById(e){return this._sourceContainer.getScriptById(e)}getScriptByIdOrWait(e,r=500){return this._sourceContainer.getScriptById(e)||this.waitForScriptId(e,r)}waitForScriptId(e,r){return new Promise(n=>{let i=this._sourceContainer.onScript(s=>{s.scriptId===e&&(n(s),i.dispose(),clearTimeout(o))}),o=setTimeout(()=>{n(void 0),i.dispose()},r)})}async renderDebuggerLocation(e){let r=this.rawLocation(e),n=await this.rawLocationToUiLocation(r);return n?`@ ${await n.source.prettyName()}:${n.lineNumber}`:`@ VM${r.scriptId||"XX"}:${r.lineNumber}`}async updateCustomBreakpoints(e,r){if(!this.target.supportsCustomBreakpoints())return;this._enabledCustomBreakpoints??=new Set;let n=new Set;for(let o of e)n.add("x"+o);for(let o of r)n.add("e"+o);let i=[];for(let o of n)if(!this._enabledCustomBreakpoints.has(o)){let s=o.slice(1);i.push(o.startsWith("x")?this._cdp.DOMDebugger.setXHRBreakpoint({url:s}):Bl().get(s)?.apply(this._cdp,!0))}for(let o of this._enabledCustomBreakpoints)if(!n.has(o)){let s=o.slice(1);i.push(o.startsWith("x")?this._cdp.DOMDebugger.removeXHRBreakpoint({url:s}):Bl().get(s)?.apply(this._cdp,!1))}this._enabledCustomBreakpoints=n,await Promise.all(i)}async _createPausedDetails(e){let r=e.reason==="assert"||e.reason==="exception"||e.reason==="promiseRejection"||e.reason==="other"||e.reason==="ambiguous",n=e.hitBreakpoints?.filter(o=>!this._breakpointManager.isEntrypointCdpBreak(o))||[];if((n.length||!r)&&this._sourceContainer.clearDisabledSourceMaps(),e.hitBreakpoints&&this._sourceMapDisabler)for(let o of this._sourceMapDisabler(e.hitBreakpoints))this._sourceContainer.disableSourceMapForSource(o);let i=Xo.fromDebugger(this,e.callFrames,e.asyncStackTrace,e.asyncStackTraceId);if(e.data?.__rewriteAs==="breakpoint")return{thread:this,event:e,stackTrace:i,reason:"breakpoint",description:Be.t("Paused on breakpoint")};if(e.data?.__rewriteAs==="step")return{thread:this,event:e,stackTrace:i,reason:"step",description:Be.t("Paused")};switch(e.reason){case"assert":return{thread:this,event:e,stackTrace:i,reason:"exception",description:Be.t("Paused on assert")};case"debugCommand":return{thread:this,event:e,stackTrace:i,reason:"pause",description:Be.t("Paused on debug() call")};case"DOM":return{thread:this,event:e,stackTrace:i,reason:"data breakpoint",description:Be.t("Paused on DOM breakpoint")};case"EventListener":return this._resolveEventListenerBreakpointDetails(i,e);case"exception":return{thread:this,event:e,stackTrace:i,reason:"exception",description:Be.t("Paused on exception"),exception:e.data};case"promiseRejection":return{thread:this,event:e,stackTrace:i,reason:"exception",description:Be.t("Paused on {0}","promise rejection"),exception:e.data};case"instrumentation":return e.data&&e.data.scriptId?{thread:this,event:e,stackTrace:i,reason:"step",description:Be.t("Paused")}:{thread:this,event:e,stackTrace:i,reason:"function breakpoint",description:Be.t("Paused on instrumentation breakpoint")};case"XHR":return{thread:this,event:e,stackTrace:i,reason:"data breakpoint",description:Be.t("Paused on XMLHttpRequest or fetch")};case"OOM":return{thread:this,event:e,stackTrace:i,reason:"exception",description:Be.t("Paused before Out Of Memory exception")};default:if(n.length){let o=!1,s=this.target.entryBreakpoint;if(s&&n.includes(s.cdpId)){o=!0;let a=this._sourceContainer.source({path:mt(s.path)});a!==void 0&&(o=!(await this._sourceContainer.currentSiblingUiLocations({lineNumber:e.callFrames[0].location.lineNumber+1,columnNumber:(e.callFrames[0].location.columnNumber||0)+1,source:a}))?.some(u=>this._breakpointManager.hasAtLocation(u)))}return o||this._breakpointManager.registerBreakpointsHit(n),{thread:this,event:e,stackTrace:i,hitBreakpoints:e.hitBreakpoints,reason:o?"entry":"breakpoint",description:Be.t("Paused on breakpoint")}}return this._expectedPauseReason?{thread:this,event:e,stackTrace:i,description:Be.t("Paused"),...this._expectedPauseReason}:{thread:this,event:e,stackTrace:i,reason:"pause",description:Be.t("Paused on debugger statement")}}}_resolveEventListenerBreakpointDetails(e,r){let n=r.data,i=n&&n.eventName||"",o=Bl().get(i);if(o){let s=o.details(n);return{thread:this,event:r,stackTrace:e,reason:"function breakpoint",description:s.short,text:s.long}}return{thread:this,event:r,stackTrace:e,reason:"function breakpoint",description:Be.t("Paused on event listener")}}_clearDebuggerConsole(){return{category:"console",output:"\x1B[2J"}}_removeAllScripts(e=!1){this._sourceContainer.clear(e)}_onScriptParsed(e){let r={url:e.url,hasSourceURL:!!e.hasSourceURL,embedderName:e.embedderName,scriptId:e.scriptId,executionContextId:e.executionContextId};wr(e.url)&&(e.url=We(e.url));let n=this._sourceContainer.getScriptById(e.scriptId);if(n&&this._executionContexts.has(n.executionContextId))return;if(e.url.endsWith(".cdp")){this._sourceContainer.addScriptById(r);return}e.url&&(e.url=this.target.scriptUrlToUrl(e.url));let i=this._executionContexts.get(e.executionContextId);i||(this.logger.info("internal","Creating missing execution context id",e),i=this._executionContextCreated({id:e.executionContextId,name:"<autofilled>",origin:"",uniqueId:String(e.executionContextId)}));let s={...r,source:(async()=>{let a=this._sourceContainer.getSourceByOriginalUrl(e.url);if(e.hash&&a?.contentHash===e.hash)return a.addScript({scriptId:e.scriptId,url:e.url,embedderName:e.embedderName,hasSourceURL:!!e.hasSourceURL,executionContextId:e.executionContextId}),a;let c=async()=>{let f=await this._cdp.Debugger.getScriptSource({scriptId:e.scriptId});return f?f.scriptSource:void 0},u=e.startLine||e.startColumn?{lineOffset:e.startLine,columnOffset:e.startColumn}:void 0,l=e.url.endsWith("#vscode-extension")?{lineOffset:2,columnOffset:0}:void 0,p;e.sourceMapURL&&(p=cr(e.sourceMapURL)?e.sourceMapURL:e.url&&Rs(e.url,e.sourceMapURL)||e.url,p||this._dap.with(f=>uO(f,`Could not load source map from ${e.sourceMapURL}`))),e.scriptLanguage==="WebAssembly"&&(this._lastParsedWasmScriptIds??=[],this._lastParsedWasmScriptIds.push(e.scriptId));let d=await this._sourceContainer.addSource(e,c,p,u,l,!e.hasSourceURL&&this.launchConfig.enableContentValidation?e.hash:void 0);return d.addScript({scriptId:e.scriptId,url:e.url,embedderName:e.embedderName,hasSourceURL:!!e.hasSourceURL,executionContextId:e.executionContextId}),d})()};s.source.then(a=>s.resolvedSource=a),i.scripts.push(s),this._sourceContainer.addScriptById(s),(e.sourceMapURL||e.scriptLanguage==="WebAssembly")&&this._getOrStartLoadingSourceMaps(s)}async _handleSourceMapPause(e,r){this._pausedForSourceMapScriptId=e;let n=this._sourceContainer.sourceMapTimeouts().sourceMapMinPause,i=n+this._sourceContainer.sourceMapTimeouts().sourceMapCumulativePause,o=this._sourceContainer.getScriptById(e);if(!o)return this._pausedForSourceMapScriptId=void 0,!1;let s=new Vr,a=this._breakpointManager.disableEntrypointBreaks(e),c=await Promise.race([this._getOrStartLoadingSourceMaps(o),_e(i)]),u=s.elapsed().ms,l=this._sourceContainer.sourceMapTimeouts().sourceMapCumulativePause-Math.max(u-n,0);this._sourceContainer.setSourceMapTimeouts({...this._sourceContainer.sourceMapTimeouts(),sourceMapCumulativePause:l}),this.logger.verbose("internal","Blocked execution waiting for source-map",{timeSpentWallClockInMs:u,sourceMapCumulativePause:l}),c||this._dap.with(f=>f.output({category:"stderr",output:Be.t("WARNING: Processing source-maps of {0} took longer than {1} ms so we continued execution without waiting for all the breakpoints for the script to be set.",o.url||o.scriptId,i)})),console.assert(this._pausedForSourceMapScriptId===e),this._pausedForSourceMapScriptId=void 0,await a;let p=r?.lineNumber||0,d=r?.columnNumber;return!!c?.map(Ho).some(f=>f.lineNumber===p&&(d===void 0||d===f.columnNumber))}_getOrStartLoadingSourceMaps(e){let r=this._executionContexts.get(e.executionContextId);if(!r)return Promise.resolve([]);let n=r.sourceMapLoads.get(e.scriptId);if(n)return n;let i=e.source.then(o=>this._sourceContainer.waitForSourceMapSources(o)).then(o=>o.length&&this._scriptWithSourceMapHandler?this._scriptWithSourceMapHandler(e,o):[]);return r.sourceMapLoads.set(e.scriptId,i),i}async _revealObject(e){if(e.type!=="function"||e.objectId===void 0)return;let r=await this._cdp.Runtime.getProperties({objectId:e.objectId,ownProperties:!0});if(r)for(let n of r.internalProperties||[]){if(n.name!=="[[FunctionLocation]]"||!n.value||n.value.subtype!=="internal#location")continue;let i=await this.rawLocationToUiLocation(this.rawLocation(n.value.value));i&&this._sourceContainer.revealUiLocation(i);break}}async _copyObjectToClipboard(e){if(!e.objectId){this._dap.with(r=>r.copyRequested({text:Pc(e,"copy")}));return}try{let r=await kF({cdp:this.cdp(),objectId:e.objectId,args:[2],silent:!0,returnByValue:!0});this._dap.with(n=>n.copyRequested({text:r.value}))}catch{}finally{this.cdp().Runtime.releaseObject({objectId:e.objectId}).catch(()=>{})}}async _onThreadPaused(e){this._expectedPauseReason=void 0,this._onPausedEmitter.fire(e);let r;e.hitBreakpoints&&(r=await Promise.race([_e(1e3).then(()=>{}),Promise.all(e.hitBreakpoints.map(n=>this._breakpointManager._resolvedBreakpoints.get(n)).filter(Ga(Rn)).map(n=>n.untilSetCompleted().then(()=>n.dapId)))])),await _e(0),this._dap.with(n=>n.stopped({reason:e.reason,description:e.description,threadId:this.id,text:e.text,hitBreakpointIds:r,allThreadsStopped:!1}))}_onThreadResumed(){this._dap.with(e=>e.continued({threadId:this.id,allThreadsContinued:!1}))}isCrossThreadStep(e){if(!e.asyncStackTraceId||!e.asyncStackTraceId.debuggerId)return!1;let r=t.threadForDebuggerId(e.asyncStackTraceId.debuggerId);if(!r||!r._waitingForStepIn?.lastDetails)return!1;let n=r._waitingForStepIn.lastDetails.stackTrace;return r._cdp.Debugger.getStackTrace({stackTraceId:e.asyncStackTraceId}).then(i=>!i||!i.stackTrace.callFrames.length||!xr.fromRuntime(r,i.stackTrace.callFrames[0],!1).equivalentTo(n.frames[0])?!1:(r._waitingForStepIn=void 0,!0))}async setScriptSourceMapHandler(e,r){this._scriptWithSourceMapHandler=r;let n=e&&this._sourceContainer.sourceMapTimeouts().sourceMapMinPause&&r;if(n&&!this._pauseOnSourceMapBreakpointIds?.length){await this.debuggerReady.promise;let i=await Promise.all([this._cdp.Debugger.setInstrumentationBreakpoint({instrumentation:"beforeScriptWithSourceMapExecution"})]);this._pauseOnSourceMapBreakpointIds=i.map(o=>o?.breakpointId).filter(at)}else if(!n&&this._pauseOnSourceMapBreakpointIds?.length){let i=this._pauseOnSourceMapBreakpointIds;this._pauseOnSourceMapBreakpointIds=void 0,await Promise.all(i.map(o=>this._cdp.Debugger.removeBreakpoint({breakpointId:o})))}if(r){let i=Promise.all([...this._executionContexts.keys()].map(o=>this._installWasmPauseHandler(o)));await Promise.race([i,_e(100)])}return!!this._pauseOnSourceMapBreakpointIds?.length}async _enablePerScriptSourcemaps(){await this._breakpointManager.updateEntryBreakpointMode(this,1),await this.setScriptSourceMapHandler(!1,this._scriptWithSourceMapHandler)}_shouldEnablePerScriptSms(e){let r=this._sourceContainer.getScriptById(e.callFrames[0]?.location.scriptId);return r?r.url.includes("@vite/client")?!0:e.reason!=="instrumentation"||!cr(e.data?.sourceMapURL)?!1:r.url.startsWith("webpack")||r.url.startsWith("ng:"):!1}setSourceMapDisabler(e){this._sourceMapDisabler=e}static threadForDebuggerId(e){return t._allThreadsByDebuggerId.get(e)}async replacePathsInStackTrace(e){let r=[];for(let i of new Vs(e)){if(typeof i=="string"){r.push(i);continue}let o=this._sourceContainer.getSourceByOriginalUrl(We(i.path))||this._sourceContainer.getSourceByOriginalUrl(i.path);if(!o){r.push(i.toString());continue}r.push(this._sourceContainer.preferredUiLocation({columnNumber:i.position.base1.columnNumber,lineNumber:i.position.base1.lineNumber,source:o}).then(({source:s,lineNumber:a,columnNumber:c})=>`${s.absolutePath}:${a}:${c}`))}return(await Promise.all(r)).join("")}};var zF=t=>typeof t.uiLocation=="function",Xo=class t{constructor(e){this.thread=e;this.frames=[];this._frameById=new Map;this._lastInlineWasmExpanded=Promise.resolve(0);this._lastFrameThread=e}static fromRuntime(e,r){let n=new t(e);for(let i of r.callFrames)i.url.endsWith(".cdp")||n.frames.push(xr.fromRuntime(e,i,!1));return r.parentId?(n._asyncStackTraceId=r.parentId,console.assert(!r.parent)):n._appendStackTrace(e,r.parent),n}static fromDebugger(e,r,n,i){let o=new t(e);for(let s of r)o._appendFrame(xr.fromDebugger(e,s));return i?(o._asyncStackTraceId=i,console.assert(!n)):o._appendStackTrace(e,n),o}async loadFrames(e,r){return await this.expandAsyncStack(e,r),await this.expandWasmFrames(),this.frames}async expandAsyncStack(e,r){for(;this.frames.length<e&&this._asyncStackTraceId;){if(this._asyncStackTraceId.debuggerId&&(this._lastFrameThread=jl.threadForDebuggerId(this._asyncStackTraceId.debuggerId)),!this._lastFrameThread){this._asyncStackTraceId=void 0;break}r&&this._lastFrameThread.cdp().DotnetDebugger.setEvaluationOptions({options:{noFuncEval:r},type:"stackFrame"});let n=await this._lastFrameThread.cdp().Debugger.getStackTrace({stackTraceId:this._asyncStackTraceId});this._asyncStackTraceId=void 0,n&&this._appendStackTrace(this._lastFrameThread,n.stackTrace)}}expandWasmFrames(){return this._lastInlineWasmExpanded=this._lastInlineWasmExpanded.then(async e=>{for(;e<this.frames.length;e++){let r=this.frames[e];if(!(r instanceof xr))continue;let n=r.scriptSource?.resolvedSource;if(!hc(n))continue;let i=await n.sourceMap.value.promise;if(!i.getFunctionStack)continue;let o=await i.getFunctionStack(r.rawPosition);if(o.length===0)continue;let s=[];for(let a=0;a<o.length;a++){let c=new hh({source:n,thread:this.thread,inlineFrameIndex:a,name:o[a].name,root:r});this._frameById.set(c.frameId,c),s.push(c)}this._spliceFrames(e,1,...s),e+=o.length-1}return e})}frame(e){return this._frameById.get(e)}_appendStackTrace(e,r){for(console.assert(!r||!this._asyncStackTraceId);r;){if(r.description==="async function"&&r.callFrames.length&&r.callFrames.shift(),r.callFrames.length){this._appendFrame(new sv(r.description||"async"));for(let n of r.callFrames)this._appendFrame(xr.fromRuntime(e,n,!0))}r.parentId&&(this._asyncStackTraceId=r.parentId,console.assert(!r.parent)),r=r.parent}}_spliceFrames(e,r,...n){this.frames.splice(e,r,...n);for(let i of n)i instanceof sv||this._frameById.set(i.frameId,i)}_appendFrame(e){this._spliceFrames(this.frames.length,0,e)}async formatAsNative(){return await this.formatWithMapper(e=>e.formatAsNative())}async format(){return await this.formatWithMapper(e=>e.format())}async formatWithMapper(e){let r=await this.loadFrames(50);for(let i=r.length-1;i>=0;i--){let o=r[i];if(o instanceof xr&&o.isReplEval){r=r.slice(0,i+1);break}}let n=r.map(e);return(await Promise.all(n)).join(`
`)+`
`}async toDap(e){let r=e.startFrame||0,n=(e.levels||50)+r,i=await this.loadFrames(n,e.noFuncEval);n=Math.min(i.length,e.levels?n:i.length);let o=[];for(let s=r;s<n;s++)o.push(i[s].toDap(e.format));return{stackFrames:await Promise.all(o),totalFrames:this._asyncStackTraceId?1e6:i.length}}},WT=zm(),sv=class{constructor(e="async"){this.label=e;this.frameId=WT()}async toDap(){return{name:this.label,id:this.frameId,line:0,column:0,presentationHint:"label"}}async formatAsNative(){return`    --- ${this.label} ---`}async format(){return`\u25C0 ${this.label} \u25B6`}},KF="<anonymous>",mte=/^class\s+(.+) {($|\n)/;async function gte(t,e,r){if(!e.functionName)return KF;if(e.functionName.includes("."))return e.functionName;let n;if(e.this.objectId&&r&&(n=(await t.cdp().Runtime.callFunctionOn({functionDeclaration:Qb.decl("64","null"),objectId:e.this.objectId,returnByValue:!0}))?.result?.value),!n&&e.this.description){n=e.this.description;let s=mte.exec(n);s&&(n=s[1])}if(!n)return e.functionName;let i=n.indexOf(`
`);i!==-1&&(n=n.slice(0,i).trim());let o=e.functionName;return n===o?`${n}.constructor`:n?`${n}.${o}`:o}function yte(t){return t.functionName||KF}var xr=class t{constructor(e,r,n,i=!1){this.callFrame=r;this.isAsync=i;this.frameId=WT();this.root=this;this.getLocationInfo=me(async()=>{let e=this.uiLocation(),r=await bT(this),n=this.overrideName||("this"in this.callFrame?await gte(this._thread,this.callFrame,r===0):yte(this.callFrame));return{isSmartStepped:r,name:n,uiLocation:await e}});this.completions=me(async()=>{if(!this._scope)return[];let e=this._thread.pausedVariables();if(!e)return[];let r=[];for(let i=0;i<this._scope.chain.length;i++){let o=this._scopeVariable(i,this._scope);o&&r.push(e.getVariableNames({variablesReference:o.id}).then(s=>s.map(({name:a})=>({label:a,type:"property"}))))}let n=await Promise.all(r);return[].concat(...n)});this._rawLocation=n,this.uiLocation=me(()=>e.rawLocationToUiLocation(n)),this._thread=e;let o=n.scriptId?e.getScriptById(n.scriptId):void 0;this.isReplEval=o?o.url.endsWith(".repl"):!1}get rawPosition(){return new ct(this._rawLocation.lineNumber,this._rawLocation.columnNumber)}get rawScopeChain(){return this._scope?.chain||[]}static fromRuntime(e,r,n){return new t(e,r,e.rawLocation(r),n)}static fromDebugger(e,r){let n=new t(e,r,e.rawLocation(r));return n._scope={chain:r.scopeChain,thisObject:r.this,returnValue:r.returnValue,variables:new Array(r.scopeChain.length).fill(void 0),callFrameId:r.callFrameId},n}get scriptId(){return"scriptId"in this.callFrame?this.callFrame.scriptId:this.callFrame.location.scriptId}get scriptSource(){return this._thread._sourceContainer.getScriptById(this.scriptId)}get canExplicitlyBeRestarted(){return!!this.callFrame.canBeRestarted}equivalentTo(e){return e instanceof t&&e._rawLocation.columnNumber===this._rawLocation.columnNumber&&e._rawLocation.lineNumber===this._rawLocation.lineNumber&&e._rawLocation.scriptId===this._rawLocation.scriptId}callFrameId(){return this._scope?this._scope.callFrameId:void 0}async scopes(){let e=this._scope;if(!e)throw new q(bO());return{scopes:(await Promise.all(e.chain.map(async(n,i)=>{let o="",s;switch(n.type){case"global":o=zr.t("Global");break;case"local":o=zr.t("Local"),s="locals";break;case"with":o=zr.t("With Block"),s="locals";break;case"closure":o=zr.t("Closure"),s="arguments";break;case"catch":o=zr.t("Catch Block"),s="locals";break;case"block":o=zr.t("Block"),s="locals";break;case"script":o=zr.t("Script");break;case"eval":o=zr.t("Eval");break;case"module":o=zr.t("Module");break;default:o=n.type.substr(0,1).toUpperCase()+n.type.substr(1);break}n.name&&n.type==="closure"?o=zr.t("Closure ({0})",n.name):n.name&&(o=`${o}: ${n.name}`);let a=this._scopeVariable(i,e);if(!a)return;let c={name:o,presentationHint:s,expensive:n.type==="global"||n.type==="module",variablesReference:a.id};if(n.startLocation){let u=this._thread.rawLocation(n.startLocation),l=await this._thread.rawLocationToUiLocation(u);if(c.line=(l||u).lineNumber,c.column=(l||u).columnNumber,l&&(c.source=await l.source.toDap()),n.endLocation){let p=this._thread.rawLocation(n.endLocation),d=await this._thread.rawLocationToUiLocation(p);c.endLine=(d||p).lineNumber,c.endColumn=(d||p).columnNumber}}return c}))).filter(at)}}getStepSkipList(e){return Promise.resolve(void 0)}async toDap(e){let{isSmartStepped:r,name:n,uiLocation:i}=await this.getLocationInfo(),o=i?await i.source.toDap():void 0,s=r?"deemphasize":"normal";r&&o&&(o.origin=r===1?zr.t("Skipped by smartStep"):zr.t("Skipped by skipFiles"));let a=(i||this._rawLocation).lineNumber,c=(i||this._rawLocation).columnNumber,u=n;return o&&e&&(e.module&&(u+=` [${o.name}]`),e.line&&(u+=` Line ${a}`)),{id:this.frameId,name:u,line:a,column:c,source:o,presentationHint:s,canRestart:this.callFrame.canBeRestarted??!this.isAsync}}async formatAsNative(){let{name:e,uiLocation:r}=await this.getLocationInfo(),n=await r?.source.existingAbsolutePath()||await r?.source.prettyName()||this.callFrame.url,{lineNumber:i,columnNumber:o}=r||this._rawLocation;return`    at ${e} (${n}:${i}:${o})`}async format(){let{name:e,uiLocation:r}=await this.getLocationInfo(),n=await r?.source.prettyName()||"<unknown>",i=r||this._rawLocation,o=`${e} @ ${n}:${i.lineNumber}`;return i.columnNumber>1&&(o+=`:${i.columnNumber}`),o}_scopeVariable(e,r){let n=r.variables[e];if(n)return n;let i={stackFrame:this,callFrameId:r.callFrameId,scopeNumber:e},o=[];e===0&&(r.thisObject&&o.push({name:"this",value:r.thisObject}),r.returnValue&&o.push({name:zr.t("Return value"),value:r.returnValue}));let s=this._thread.pausedVariables();if(!s)return;let a=s.createScope(r.chain[e].object,i,o);return r.variables[e]=a}},jT={scopes:[]},hh=class{constructor(e){this.frameId=WT();this.name=e.name,this.root=e.root,this.thread=e.thread,this.source=e.source,this.inlineFrameIndex=e.inlineFrameIndex,this.wasmPosition=new tt(this.inlineFrameIndex,this.root.rawPosition.base0.columnNumber),this.uiLocation=me(()=>e.thread._sourceContainer.preferredUiLocation({columnNumber:e.root.rawPosition.base1.columnNumber,lineNumber:e.inlineFrameIndex+1,source:e.source}))}async formatAsNative(){let{columnNumber:e,lineNumber:r,source:n}=await this.uiLocation();return`    at ${this.name} (${n.url}:${r}:${e})`}async format(){let{columnNumber:e,lineNumber:r,source:n}=await this.uiLocation(),i=await n.prettyName()||"<unknown>";return`${this.name} @ ${i}:${r}:${e}`}async toDap(){let{columnNumber:e,lineNumber:r,source:n}=await this.uiLocation();return Promise.resolve({id:this.frameId,name:this.name,column:e,line:r,source:await n.toDap()})}async getStepSkipList(e){let r=this.source.sourceMap.value.settledValue;if(!r?.getStepSkipList)return;let n=await this.uiLocation();return n?r.getStepSkipList(e,this.wasmPosition,n.source.compiledToSourceUrl.get(this.source),new ct(n.lineNumber,n.columnNumber)):r.getStepSkipList(e,this.root.rawPosition)}async scopes(){let e=this.source.sourceMap.value.settledValue,r=this.root.callFrameId();if(!e||!r)return jT;let n=await e.getVariablesInScope?.(r,this.wasmPosition);if(!n)return jT;let i=this.thread.pausedVariables();if(!i)return jT;let o={stackFrame:this.root,callFrameId:r,scopeNumber:0};return{scopes:await Promise.all([...tL(n,s=>s.scope)].map(([s,a])=>i.createWasmScope(s,a,o).toDap("propertyValue").then(c=>({name:c.name,variablesReference:c.variablesReference,expensive:s!=="LOCAL"}))))}}};var JF=v(ge());var kc=class{constructor(e){this.event=e;this.stackTrace=me(e=>this.event.stackTrace?Xo.fromRuntime(e,this.event.stackTrace):void 0);this.getUiLocation=me(async e=>{let r=this.stackTrace(e);if(!r)return;let n;for(let i of r.frames){if(!(i instanceof xr))continue;let o=await i.uiLocation();if(o&&(n||(n=o),!o.source.blackboxed()))return{source:await o.source.toDap(),line:o.lineNumber,column:o.columnNumber}}if(n)return{source:await n.source.toDap(),line:n.lineNumber,column:n.columnNumber}})}formatDefaultString(e,r,n=!1){let o=r.length>1&&r[0].type==="string"?fT(r[0].value,r.slice(1),yT):fT("",r,yT),s=o.result+`
`;return o.usedAllSubs&&!r.some(Tc)?{output:s}:this.formatComplexStringOutput(e,s,r,n)}async formatComplexStringOutput(e,r,n,i){(n.some(s=>s.subtype==="error")||Vs.isStackLike(r))&&(await this.getUiLocation(e),r=await e.replacePathsInStackTrace(r),i=!0);let o=e.replVariables.createVariableForOutput(r,n,i?this.stackTrace(e):void 0);return{output:r,variablesReference:o.id}}},av=class extends kc{async toDap(e){return this.event.args[0]?.value==="console.assert"&&(this.event.args[0].value=JF.t("Assertion failed")),{category:"stderr",...await this.formatDefaultString(e,this.event.args,!0),...await this.getUiLocation(e)}}},Rc=class extends kc{constructor(r,n,i){super(r);this.includeStack=n;this.category=i}async toDap(r){return{category:this.category,...await this.formatDefaultString(r,this.event.args,this.includeStack),...await this.getUiLocation(r)}}},Ys=class extends Rc{constructor(e){super(e,!1,"stdout")}},cv=class extends Rc{constructor(e){super(e,!0,"stdout")}},uv=class extends Rc{constructor(e){super(e,!0,"stderr")}},lv=class extends Rc{constructor(e){super(e,!0,"stderr")}},pv=class extends kc{async toDap(e){return{category:"stdout",group:this.event.type==="startGroupCollapsed"?"startCollapsed":"start",...await this.formatDefaultString(e,this.event.args),...await this.getUiLocation(e)}}},dv=class extends Rc{constructor(e){super(e,!1,"stdout")}async toDap(e){return this.event.args[0]?.preview?{category:"stdout",output:"",variablesReference:e.replVariables.createVariableForOutput("",this.event.args,void 0,this.event.type).id,...await this.getUiLocation(e)}:super.toDap(e)}};var fh=class extends kc{constructor(){super(...arguments);this.stackTrace=me(r=>{if(this.event.stackTrace)return Xo.fromRuntime(r,this.event.stackTrace);if(this.event.scriptId)return Xo.fromRuntime(r,{callFrames:[{functionName:"(program)",lineNumber:this.event.lineNumber,columnNumber:this.event.columnNumber,scriptId:this.event.scriptId,url:this.event.url||""}]})})}async toDap(r){let n=this.event.exception?Ec(this.event.exception):{title:""},i=n.title;i.startsWith("Uncaught")||(i=`Uncaught ${this.event.exception?.className??"Error"} `+i);let o=this.stackTrace(r),s=this.event.exception&&!n.stackTrace?[this.event.exception]:[];return Vs.isStackLike(i)?i=await r.replacePathsInStackTrace(i):o&&(i+=`
`+await o.formatAsNative()),{category:"stderr",output:i,variablesReference:o||s.length?r.replVariables.createVariableForOutput(i,s,o).id:void 0,...await this.getUiLocation(r)}}};var fv=v(ge());var XF=Rt(function(){return this});var ov=class{constructor(e,r){this.protoObj=e;this.cdp=r}async toDap(e){if(!this.protoObj.objectId)return{category:"stderr",output:fv.t("Only objects can be queried")};let r=await this.cdp.Runtime.queryObjects({prototypeObjectId:this.protoObj.objectId,objectGroup:"console"});if(await this.cdp.Runtime.releaseObject({objectId:this.protoObj.objectId}),!r)return{category:"stderr",output:fv.t("Could not query the provided object")};let n;try{n=await XF({cdp:this.cdp,args:[],objectId:r.objects.objectId,objectGroup:"console",generatePreview:!0})}catch(s){return{category:"stderr",output:fv.t(s.message)}}let i="\x1B[32mobjects: "+Pc(n,"repl")+"\x1B[0m";return{category:"stdout",output:"",variablesReference:e.replVariables.createVariableForOutput(i,[n]).id}}};var hv=Symbol("IConsole");var gh=v(H());var YF=v(H());var Qs=Symbol("IShutdownParticipants"),Wl=class{constructor(){this.participants=[]}register(e,r){if(this.shutdownStage!==void 0&&this.shutdownStage>=e)return r(!0),Us;for(;this.participants.length<=e;)this.participants.push(new Set);return this.participants[e].add(r),{dispose:()=>this.participants[e].delete(r)}}async shutdownContext(){(this.shutdownStage===void 0||this.shutdownStage<0)&&await Promise.all([...this.participants[0]].map(e=>e(!1)))}async shutdownAll(){for(this.shutdownStage=0;this.shutdownStage<this.participants.length;this.shutdownStage++)await Promise.all([...this.participants[this.shutdownStage]].map(e=>e(!0)))}};Wl=I([(0,YF.injectable)()],Wl);var mh=class{toDap(){return{category:"console",output:"\x1B[2J"}}},mv=class{toDap(){return{category:"stdout",output:"",group:"end"}}};var gv=class{constructor(e){this.sink=e;this.q=[];this.disposed=!1;this.onDrainedEmitter=new j;this.onDrained=this.onDrainedEmitter.event}get length(){return this.q.length}enqueue(e){this.disposed||(this.q.push(new HT(e)),this.q.length===1&&this.process())}dispose(){this.disposed=!0,this.q=[]}async process(){let e=this.q.findIndex(r=>r.value===ZF);e===0?await this.q[0].wait:e===-1?(this.sink(QF(this.q)),this.q=[]):(this.sink(QF(this.q.slice(0,e))),this.q=this.q.slice(e)),this.q.length?this.process():this.onDrainedEmitter.fire()}},QF=t=>t.map(e=>e.value).filter(e=>e!==eU),ZF=Symbol("unsettled"),eU=Symbol("unsettled"),HT=class{constructor(e){this.value=ZF;e instanceof Promise?this.wait=e.then(r=>{this.value=r},()=>{this.value=eU}):(this.value=e,this.wait=Promise.resolve())}};var vte=new Set(["group","assert","count"]),Hl=class{constructor(e,r){this.dap=e;this.isDirty=!1;this.queue=new gv(e=>{for(let r of e)this.dap.output(r)});this.onDrained=this.queue.onDrained;r.register(0,async n=>{this.length&&await new Promise(i=>this.onDrained(i)),n&&this.dispose()})}get length(){return this.queue.length}dispose(){this.queue.dispose()}dispatch(e,r){let n=this.parse(r);n&&this.enqueue(e,n)}enqueue(e,r){if(!(r instanceof mh))this.isDirty=!0;else if(this.isDirty)this.isDirty=!1;else return;this.queue.enqueue(r.toDap(e))}parse(e){if(e.type==="log"){let r=e.stackTrace?.callFrames[0];if(r&&r.url==="internal/console/constructor.js"&&vte.has(r.functionName))return}switch(e.type){case"clear":return new mh;case"endGroup":return new mv;case"assert":return new av(e);case"table":return new dv(e);case"startGroup":case"startGroupCollapsed":return new pv(e);case"debug":case"log":case"info":return new Ys(e);case"trace":return new cv(e);case"error":return new lv(e);case"warning":return new uv(e);case"dir":case"dirxml":return new Ys(e);case"count":return new Ys(e);case"profile":case"profileEnd":return new Ys(e);case"timeEnd":return new Ys(e);default:try{xu(e.type,"unknown console message type")}catch{}}}};Hl=I([(0,gh.injectable)(),g(0,(0,gh.inject)(Ur)),g(1,(0,gh.inject)(Qs))],Hl);var Ac=v(H()),nU=require("os"),iU=require("path");var qT=require("path"),tU=(0,qT.join)(__dirname,"diagnosticTool.js"),rU=(0,qT.join)(__dirname,"diagnosticTool.css");var lo=Symbol("ITarget"),jt=Symbol("ILauncher");var Zs=class{constructor(e,r,n,i){this.fs=e;this.sources=r;this.breakpoints=n;this.target=i}async generateObject(){let[e]=await Promise.all([this.dumpSources()]);return{breakpoints:this.dumpBreakpoints(),sources:e,config:this.target.launchConfig}}async generateHtml(e=(0,iU.join)((0,nU.tmpdir)(),"js-debug-diagnostics.html")){return await this.fs.writeFile(e,`<!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>${await this.fs.readFile(rU,"utf-8")}<</style>
      </head>
      <body>
        <script>window.DUMP=${JSON.stringify(await this.generateObject())}</script>
        <script>${await this.fs.readFile(tU,"utf-8")}</script>
      </body>
      </html>`),e}dumpBreakpoints(){let e=[];for(let r of[this.breakpoints.appliedByPath,this.breakpoints.appliedByRef])for(let n of r.values())for(let i of n){let o=i.diagnosticDump();e.push({source:o.source,params:o.params,cdp:o.cdp.map(s=>s.state===1?{...s,uiLocations:s.uiLocations.map(a=>this.dumpUiLocation(a))}:{...s,done:void 0})})}return e}dumpSources(){let e=[],r=0;for(let n of this.sources.sources)e.push((async()=>({uniqueId:r++,url:n.url,sourceReference:n.sourceReference,absolutePath:n.absolutePath,actualAbsolutePath:await n.existingAbsolutePath(),scriptIds:n.scripts.map(i=>i.scriptId),prettyName:await n.prettyName(),compiledSourceRefToUrl:n instanceof Ct?[...n.compiledToSourceUrl.entries()].map(([i,o])=>[i.sourceReference,o]):void 0,sourceMap:fc(n)?{url:n.sourceMap.metadata.sourceMapUrl,metadata:n.sourceMap.metadata,sources:ko(Object.fromEntries(n.sourceMap.sourceByUrl),i=>i.sourceReference)}:void 0}))());return Promise.all(e)}dumpUiLocation(e){return{lineNumber:e.lineNumber,columnNumber:e.columnNumber,sourceReference:e.source.sourceReference}}};Zs=I([(0,Ac.injectable)(),g(0,(0,Ac.inject)(ve)),g(1,(0,Ac.inject)(Gt)),g(2,(0,Ac.inject)(On)),g(3,(0,Ac.inject)(lo))],Zs);var sU=v(ge()),yv=v(H());var oU="@vscode/dwarf-debugging",ql=class{constructor(e){this.dap=e;this.didPrompt=!1}async load(){try{return await import(oU)}catch{return}}prompt(){this.didPrompt||(this.didPrompt=!0,this.dap.output({output:sU.t("You may install the `{}` module via npm for enhanced WebAssembly debugging",oU),category:"console"}))}};ql=I([(0,yv.injectable)(),g(0,(0,yv.inject)(Ur))],ql);var ea=v(H());var Vl=Symbol("IExceptionPauseService");var $l=class{constructor(e,r,n,i,o){this.evaluator=e;this.scriptSkipper=r;this.dap=n;this.sourceContainer=o;this.state={cdp:"none"};this.blocker=Ue();this.noDebug=!!i.noDebug,this.breakOnError=i.__breakOnConditionalError,this.blocker.resolve()}get launchBlocker(){return this.blocker.promise}async setBreakpoints(e){if(!this.noDebug){try{this.state=this.parseBreakpointRequest(e)}catch(r){if(!(r instanceof q))throw r;this.dap.output({category:"stderr",output:r.message});return}this.cdp?await this.sendToCdp(this.cdp):this.state.cdp!=="none"&&this.blocker.hasSettled()&&(this.blocker=Ue())}}async shouldPauseAt(e){if(e.reason!=="exception"&&e.reason!=="promiseRejection"||this.state.cdp==="none"||e.callFrames.some(n=>this.sourceContainer.getSourceScriptById(n.location.scriptId)?.url.endsWith(".cdp"))||this.shouldScriptSkip(e))return!1;let r=this.state.condition;if(e.data?.uncaught){if(r.uncaught&&!await this.evalCondition(e,r.uncaught))return!1}else if(r.caught&&!await this.evalCondition(e,r.caught))return!1;return!0}async apply(e){this.cdp=e,this.state.cdp!=="none"&&await this.sendToCdp(e)}async sendToCdp(e){await e.Debugger.setPauseOnExceptions({state:this.state.cdp}),this.blocker.resolve()}async evalCondition(e,r){return!!(await r({callFrameId:e.callFrames[0].callFrameId},i=>i==="error"?e.data:void 0))?.result.value}shouldScriptSkip(e){if(e.data?.uncaught||!e.callFrames.length)return!1;let r=this.sourceContainer.getScriptById(e.callFrames[0].location.scriptId);return!!r&&this.scriptSkipper.isScriptSkipped(r.url)}parseBreakpointRequest(e){let r=(e.filterOptions??[]).concat(e.filters.map(a=>({filterId:a}))),n="none",i=[],o=[];for(let{filterId:a,condition:c}of r)a==="all"?(n="all",c&&i.push(a)):a==="uncaught"&&(n==="none"&&(n="uncaught"),c&&o.push(a));let s=a=>{if(a.length===0)return;let c="!!("+r.map(p=>p.condition).filter(at).join(") || !!(")+")",u=ks(c);if(u)throw new q(Ts({line:0,condition:c},u.message));let l=lC(c,this.breakOnError);return this.evaluator.prepare(l,{hoist:["error"]}).invoke};return n==="none"?{cdp:n}:{cdp:n,condition:{caught:s(i),uncaught:s(o)}}}};$l=I([(0,ea.injectable)(),g(0,(0,ea.inject)(kn)),g(1,(0,ea.inject)(js)),g(2,(0,ea.inject)(Ur)),g(3,(0,ea.inject)(Re)),g(4,(0,ea.inject)(Gt))],$l);var wv=v(H());var bv=class{constructor(){this.didEnable=new WeakSet}async retrieve(e){this.didEnable.has(e)||(this.didEnable.add(e),await e.Performance.enable({}));let r=await e.Performance.getMetrics({});if(!r)return{error:"Error in CDP"};let n={};for(let i of r.metrics)n[i.name]=i.value;return{metrics:n}}};var vv=class{async retrieve(e){let r=await e.Runtime.evaluate({expression:`({
        memory: process.memoryUsage(),
        cpu: process.cpuUsage(),
        timestamp: Date.now(),
        resourceUsage: process.resourceUsage && process.resourceUsage(),
      })${ht()}`,returnByValue:!0});return r?r.exceptionDetails?{error:r.exceptionDetails.text}:{metrics:r.result.value}:{error:"No response from CDP"}}};var Sv=Symbol("IPerformanceProvider"),Dc=class{constructor(e){this.target=e}create(){return this.target.type()==="node"?new vv:new bv}};Dc=I([(0,wv.injectable)(),g(0,(0,wv.inject)(lo))],Dc);var JT=v(ge()),uU=require("crypto"),ta=v(H()),lU=require("os"),pU=require("path");var Iv=v(H());var $T=v(ge()),Oc=v(H()),_v=require("path");var Gl=class{constructor(e){this.sources=e;this.locationIdCounter=0;this.locationsByRef=new Map}getLocationIdFor(e){let r=[e.functionName,e.url,e.scriptId,e.lineNumber,e.columnNumber].join(":"),n=this.locationsByRef.get(r);if(n)return n.id;let i=this.locationIdCounter++;return this.locationsByRef.set(r,{id:i,callFrame:e,locations:(async()=>{let o=await this.sources.getScriptById(e.scriptId)?.source;if(!o)return[];let s=await this.sources.currentSiblingUiLocations({lineNumber:e.lineNumber+1,columnNumber:e.columnNumber+1,source:o});return Promise.all(s.map(async a=>({...a,source:await a.source.toDap()})))})()}),i}getLocations(){return Promise.all([...this.locationsByRef.values()].sort((e,r)=>e.id-r.id).map(async e=>({callFrame:e.callFrame,locations:await e.locations})))}};var Xt=class{constructor(e,r,n,i){this.cdp=e;this.fs=r;this.sources=n;this.launchConfig=i}static canApplyTo(){return!0}async start(e,r){if(!await this.cdp.Profiler.start({}))throw new q(Wu());return new VT(this.cdp,this.fs,this.sources,this.launchConfig.__workspaceFolder,r)}async save(e,r){let n=await aU(e,this.sources,this.launchConfig.__workspaceFolder);(0,_v.isAbsolute)(r)||(r=(0,_v.join)(this.launchConfig.__workspaceFolder,r)),await this.fs.writeFile(r,JSON.stringify(n))}};Xt.type="cpu",Xt.extension=".cpuprofile",Xt.label=$T.t("CPU Profile"),Xt.description=$T.t("Generates a .cpuprofile file you can open in VS Code or the Edge/Chrome devtools"),Xt.editable=!0,Xt=I([(0,Oc.injectable)(),g(0,(0,Oc.inject)(lt)),g(1,(0,Oc.inject)(ve)),g(2,(0,Oc.inject)(Gt)),g(3,(0,Oc.inject)(Re))],Xt);var VT=class{constructor(e,r,n,i,o){this.cdp=e;this.fs=r;this.sources=n;this.workspaceFolder=i;this.file=o;this.stopEmitter=new j;this.disposed=!1;this.onUpdate=new j().event;this.onStop=this.stopEmitter.event}async dispose(){this.disposed||(this.disposed=!0,this.stopEmitter.fire())}async stop(){let e=await this.cdp.Profiler.stop({});if(!e)throw new q(Wu());await this.dispose();let r=await aU(e.profile,this.sources,this.workspaceFolder);await this.fs.writeFile(this.file,JSON.stringify(r))}};async function aU(t,e,r){let n=new Gl(e),i=t.nodes.map(o=>({...o,locationId:n.getLocationIdFor(o.callFrame),positionTicks:o.positionTicks?.map(s=>({...s,startLocationId:n.getLocationIdFor({...o.callFrame,lineNumber:s.line-1,columnNumber:0}),endLocationId:n.getLocationIdFor({...o.callFrame,lineNumber:s.line,columnNumber:0})}))}));return{...t,nodes:i,$vscode:{rootPath:r,locations:await n.getLocations()}}}var GT=v(ge()),Lc=v(H());var hn=class{constructor(e,r,n,i){this.cdp=e;this.fs=r;this.sources=n;this.launchConfig=i}static canApplyTo(){return!0}async start(e,r){if(await this.cdp.HeapProfiler.enable({}),!await this.cdp.HeapProfiler.startSampling({}))throw new q(Wu());return new zT(this.cdp,this.fs,this.sources,this.launchConfig.__workspaceFolder,r)}};hn.type="heap",hn.extension=".heapprofile",hn.label=GT.t("Heap Profile"),hn.description=GT.t("Generates a .heapprofile file you can open in VS Code or the Edge/Chrome devtools"),hn.editable=!0,hn=I([(0,Lc.injectable)(),g(0,(0,Lc.inject)(lt)),g(1,(0,Lc.inject)(ve)),g(2,(0,Lc.inject)(Gt)),g(3,(0,Lc.inject)(Re))],hn);var zT=class{constructor(e,r,n,i,o){this.cdp=e;this.fs=r;this.sources=n;this.workspaceFolder=i;this.file=o;this.stopEmitter=new j;this.disposed=!1;this.onUpdate=new j().event;this.onStop=this.stopEmitter.event}async dispose(){this.disposed||(this.disposed=!0,await this.cdp.HeapProfiler.disable({}),this.stopEmitter.fire())}async stop(){let e=await this.cdp.HeapProfiler.stopSampling({});if(!e)throw new q(Wu());await this.dispose();let r=await this.annotateSources(e.profile);await this.fs.writeFile(this.file,JSON.stringify(r))}async annotateSources(e){let r=new Gl(this.sources),n=(o,s)=>{s.locationId=r.getLocationIdFor(o.callFrame);for(let a of o.children){let c={...a,children:[]};s.children.push(c),n(a,c)}},i={...e.head,children:[]};return n(e.head,i),{...e,head:i,$vscode:{rootPath:this.workspaceFolder,locations:await r.getLocations()}}}};var KT=v(ge()),cU=require("fs"),xv=v(H());var mn=class{constructor(e){this.cdp=e;this.cdp.HeapProfiler.on("addHeapSnapshotChunk",({chunk:r})=>this.currentWriter?.stream.write(r))}static canApplyTo(){return!0}async start(e,r){return{onStop:new j().event,onUpdate:new j().event,dispose:()=>{},stop:async()=>{await this.cdp.HeapProfiler.enable({}),await this.dumpToFile(r),await this.cdp.HeapProfiler.disable({})}}}async dumpToFile(e){let{stream:r,promise:n}=this.currentWriter={stream:(0,cU.createWriteStream)(e),promise:this.cdp.HeapProfiler.takeHeapSnapshot({})};await n,r.end(),this.currentWriter=void 0}};mn.type="memory",mn.extension=".heapsnapshot",mn.label=KT.t("Heap Snapshot"),mn.description=KT.t("Generates a .heapsnapshot file you can open in VS Code or the Edge/Chrome devtools"),mn.instant=!0,mn=I([(0,xv.injectable)(),g(0,(0,xv.inject)(lt))],mn);var Cv=Symbol("IProfilerFactory"),Tv=()=>{let t=new Date;return["vscode-profile",t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,"0")).join("-")},Kr=class{constructor(e){this.container=e}get(e){let r=Kr.ctors.find(n=>n.type===e);if(!r)throw new Error(`Invalid profilter type ${e}`);return this.container.get(r)}};Kr.ctors=[Xt,hn,mn],Kr=I([(0,Iv.injectable)(),g(0,(0,Iv.inject)(gl))],Kr);var Pv=Symbol("IProfileController"),zl=class{constructor(e,r,n,i,o){this.cdp=e;this.factory=r;this.basicCpuProfiler=n;this.breakpoints=i;this.shutdown=o;this.seenConsoleProfileNames=Object.create(null)}connect(e,r){e.on("startProfile",async n=>(await this.start(e,r,n),{})),e.on("stopProfile",()=>this.stopProfiling(e)),this.cdp.Profiler.on("consoleProfileStarted",()=>{e.output({output:JT.t("Console profile started")+`
`,category:"console"})}),this.cdp.Profiler.on("consoleProfileFinished",async n=>{let i=this.saveConsoleProfile(e,n),o=this.shutdown.register(0,()=>i);await i,o.dispose()}),r.onPaused(()=>this.stopProfiling(e))}async start(e,r,n){if(this.profile)throw new q(gO());this.profile=this.startProfileInner(e,r,n).catch(i=>{throw this.profile=void 0,i}),await this.profile}async saveConsoleProfile(e,r){let n;if(r.title){n=r.title.replace(/[\/\\]/g,"-");let i=this.seenConsoleProfileNames[r.title]||0;this.seenConsoleProfileNames[r.title]=i+1,i>0&&(n+=`-${i}`)}else n=Tv();n+=Xt.extension,await this.basicCpuProfiler.save(r.profile,n),e.output({output:JT.t('CPU profile saved as "{0}" in your workspace folder',n)+`
`,category:"console"})}async startProfileInner(e,r,n){let i=!1,o;if(n.stopAtBreakpoint?.length){let l=new Set(n.stopAtBreakpoint);i=!0,o=p=>!(p instanceof Rn)||l.has(p.dapId)}else o=()=>!1;await this.breakpoints.applyEnabledFilter(o);let s=(0,pU.join)((0,lU.tmpdir)(),`vscode-js-profile-${(0,uU.randomBytes)(4).toString("hex")}`),a=await this.factory.get(n.type).start(n,s),c={file:s,profile:a,enableFilter:o,keptDebuggerOn:i};a.onUpdate(l=>e.profilerStateUpdate({label:l,running:!0})),a.onStop(()=>this.disposeProfile(c));let u=!!r.pausedDetails();return i?await r.resume():u&&(await this.cdp.Debugger.disable({}),u&&r.onResumed()),e.profileStarted({file:c.file,type:n.type}),c}async stopProfiling(e){let r=await this.profile?.catch(()=>{});return!r||!this.profile?{}:(this.profile=void 0,await r?.profile.stop(),e.profilerStateUpdate({label:"",running:!1}),{})}async disposeProfile({profile:e,enableFilter:r,keptDebuggerOn:n}){n||await this.cdp.Debugger.enable({}),await this.breakpoints.applyEnabledFilter(void 0,r),e.dispose()}};zl=I([(0,ta.injectable)(),g(0,(0,ta.inject)(lt)),g(1,(0,ta.inject)(Cv)),g(2,(0,ta.inject)(Xt)),g(3,(0,ta.inject)(On)),g(4,(0,ta.inject)(Qs))],zl);var jn=v(H());var BW=v(hU()),FW=require("dns");var OW=require("node:timers/promises");function mU(t){return Object.keys(t)}var bU=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Ite(t){return bU.includes(t)}var vU=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...bU];function Cte(t){return vU.includes(t)}var wU=["null","undefined","string","number","bigint","boolean","symbol"];function Tte(t){return wU.includes(t)}var eTe=["bound Function","positive number","negative number","Class","string with a number","null or undefined","Iterable","AsyncIterable","native Promise","EnumCase","string with a URL","truthy","falsy","primitive","integer","plain object","TypedArray","array-like","tuple-like","Node.js Stream","infinite number","empty array","non-empty array","empty string","empty string or whitespace","non-empty string","non-empty string and not whitespace","empty object","non-empty object","empty set","non-empty set","empty map","non-empty map","PropertyKey","even integer","finite number","negative integer","non-negative integer","non-negative number","odd integer","positive integer","safe integer","T","in range","predicate returns truthy for any value","predicate returns truthy for all values","valid Date","valid length","whitespace string",...vU,...wU],Fe=t=>{let e=Object.prototype.toString.call(t).slice(8,-1);if(new RegExp("HTML\\w+Element","v").test(e)&&nP(t))return"HTMLElement";if(Cte(e))return e};function gU(t){if(t===null)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"NaN":"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(Lv(t))return"Observable";if(Bn(t))return"Array";if(Kl(t))return"Buffer";let e=Fe(t);if(e!==void 0&&e!=="Object")return e;if(SU(t))return"Promise";if(Pte(t))throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}function SU(t){return Wt(t?.then)&&Wt(t?.catch)}function XT(t,e){try{return Reflect.apply(e,t,[]),!0}catch{return!1}}function Pte(t){return XT(t,String.prototype.valueOf)||XT(t,Boolean.prototype.valueOf)||XT(t,Number.prototype.valueOf)}var Av=Object.assign(gU,{all:CU,any:YT,array:Bn,arrayBuffer:TU,arrayLike:PU,arrayOf:kte,asyncFunction:EU,asyncGenerator:kU,asyncGeneratorFunction:RU,asyncIterable:QT,bigint:ZT,bigInt64Array:AU,bigUint64Array:DU,blob:OU,boolean:eP,boundFunction:LU,buffer:Kl,class:NU,dataView:MU,date:tP,detect:gU,directInstanceOf:BU,emptyArray:FU,emptyMap:UU,emptyObject:jU,emptySet:WU,emptyString:rP,emptyStringOrWhitespace:Dv,enumCase:HU,error:qU,evenInteger:$U,falsy:VU,finiteNumber:GU,float32Array:zU,float64Array:KU,formData:JU,function:Wt,generator:XU,generatorFunction:YU,htmlElement:nP,infinite:QU,inRange:ZU,int16Array:ej,int32Array:tj,int8Array:rj,integer:Jl,iterable:iP,map:Xl,nan:oP,nativePromise:sP,negativeInteger:nj,negativeNumber:ij,nodeStream:oj,nonEmptyArray:sj,nonEmptyMap:aj,nonEmptyObject:cj,nonEmptySet:uj,nonEmptyString:lj,nonEmptyStringAndNotWhitespace:pj,nonNegativeInteger:dj,nonNegativeNumber:fj,null:Yl,nullOrUndefined:Ov,number:Nc,numericString:hj,object:Ql,observable:Lv,oddInteger:mj,oneOf:Dte,plainObject:aP,positiveInteger:gj,positiveNumber:yj,primitive:cP,promise:bj,propertyKey:vj,regExp:wj,safeInteger:uP,set:Zl,sharedArrayBuffer:Sj,string:Fn,symbol:Nv,truthy:_j,tupleLike:xj,typedArray:Ij,uint16Array:Cj,uint32Array:Tj,uint8Array:Pj,uint8ClampedArray:Ej,undefined:ep,urlInstance:kj,urlSearchParams:Rj,urlString:Aj,optional:Ete,validDate:Dj,validLength:lP,weakMap:Oj,weakRef:Lj,weakSet:Nj,whitespaceString:pP});function _U(t){return e=>Jl(e)&&Math.abs(e%2)===t}function xU(t,e){if(t.length===0){if(!e)throw new TypeError("Invalid predicate array");return}for(let r of t)IU(r)}function IU(t){if(!Wt(t))throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`)}function CU(t,...e){if(Array.isArray(t)){let r=t;xU(r,e.length===0);let n=i=>r.every(o=>o(i));return e.length===0?n:Rv(Array.prototype.every,n,e)}return Rv(Array.prototype.every,t,e)}function YT(t,...e){if(Array.isArray(t)){let r=t;xU(r,e.length===0);let n=i=>r.some(o=>o(i));return e.length===0?n:Rv(Array.prototype.some,n,e)}return Rv(Array.prototype.some,t,e)}function Ete(t,e){return ep(t)||e(t)}function Bn(t,e){return Array.isArray(t)?Wt(e)?t.every(r=>e(r)):!0:!1}function TU(t){return Fe(t)==="ArrayBuffer"}function PU(t){return!Ov(t)&&!Wt(t)&&lP(t.length)}function kte(t){return e=>Bn(e)&&e.every(r=>t(r))}function EU(t){return Fe(t)==="AsyncFunction"}function kU(t){return QT(t)&&Wt(t.next)&&Wt(t.throw)}function RU(t){return Fe(t)==="AsyncGeneratorFunction"}function QT(t){return Wt(t?.[Symbol.asyncIterator])}function ZT(t){return typeof t=="bigint"}function AU(t){return Fe(t)==="BigInt64Array"}function DU(t){return Fe(t)==="BigUint64Array"}function OU(t){return Fe(t)==="Blob"}function eP(t){return t===!0||t===!1}function LU(t){return Wt(t)&&!Object.hasOwn(t,"prototype")}function Kl(t){return t?.constructor?.isBuffer?.(t)??!1}function NU(t){return Wt(t)&&new RegExp("^class(?:\\s+|\\{)","v").test(t.toString())}function MU(t){return Fe(t)==="DataView"}function tP(t){return Fe(t)==="Date"}function BU(t,e){return t==null?!1:Object.getPrototypeOf(t)===e.prototype}function FU(t){return Bn(t)&&t.length===0}function UU(t){return Xl(t)&&t.size===0}function jU(t){return Ql(t)&&!Wt(t)&&!Bn(t)&&!Xl(t)&&!Zl(t)&&Object.keys(t).length===0}function WU(t){return Zl(t)&&t.size===0}function rP(t){return Fn(t)&&t.length===0}function Dv(t){return rP(t)||pP(t)}function HU(t,e){let r=e;return Object.entries(r).some(([n,i])=>{if(!Fn(i))return i===t;let o=Number(n);return Number.isNaN(o)||String(o)!==n?i===t:i===t&&!(Object.hasOwn(r,i)&&r[i]===o)})}function qU(t){return Fe(t)==="Error"}function $U(t){return _U(0)(t)}function VU(t){return!t}function GU(t){return Number.isFinite(t)}function zU(t){return Fe(t)==="Float32Array"}function KU(t){return Fe(t)==="Float64Array"}function JU(t){return Fe(t)==="FormData"}function Wt(t){return typeof t=="function"}function XU(t){return iP(t)&&Wt(t?.next)&&Wt(t?.throw)}function YU(t){return Fe(t)==="GeneratorFunction"}var Rte=1,Ate=["innerHTML","ownerDocument","style","attributes","nodeValue"];function nP(t){return Ql(t)&&t.nodeType===Rte&&Fn(t.nodeName)&&!aP(t)&&Ate.every(e=>e in t)}function QU(t){return t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY}function ZU(t,e){if(Nc(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(Bn(e)&&e.length===2){if(Number.isNaN(e[0])||Number.isNaN(e[1]))throw new TypeError(`Invalid range: ${JSON.stringify(e)}`);return t>=Math.min(...e)&&t<=Math.max(...e)}throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)}function ej(t){return Fe(t)==="Int16Array"}function tj(t){return Fe(t)==="Int32Array"}function rj(t){return Fe(t)==="Int8Array"}function Jl(t){return Number.isInteger(t)}function iP(t){return Wt(t?.[Symbol.iterator])}function Xl(t){return Fe(t)==="Map"}function oP(t){return Number.isNaN(t)}function sP(t){return Fe(t)==="Promise"}function nj(t){return Jl(t)&&t<0}function ij(t){return Nc(t)&&t<0}function oj(t){return Ql(t)&&Wt(t.pipe)&&!Lv(t)}function sj(t){return Bn(t)&&t.length>0}function aj(t){return Xl(t)&&t.size>0}function cj(t){return Ql(t)&&!Wt(t)&&!Bn(t)&&!Xl(t)&&!Zl(t)&&Object.keys(t).length>0}function uj(t){return Zl(t)&&t.size>0}function lj(t){return Fn(t)&&t.length>0}function pj(t){return Fn(t)&&!Dv(t)}function dj(t){return Jl(t)&&t>=0}function fj(t){return Nc(t)&&t>=0}function Yl(t){return t===null}function Ov(t){return Yl(t)||ep(t)}function Nc(t){return typeof t=="number"&&!Number.isNaN(t)}function hj(t){return Fn(t)&&!Dv(t)&&t===t.trim()&&!Number.isNaN(Number(t))}function Ql(t){return!Yl(t)&&(typeof t=="object"||Wt(t))}function Lv(t){return t?Symbol.observable!==void 0&&t===t[Symbol.observable]?.()||t===t["@@observable"]?.():!1}function mj(t){return _U(1)(t)}function Dte(t){return e=>t.includes(e)}function aP(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function gj(t){return Jl(t)&&t>0}function yj(t){return Nc(t)&&t>0}function cP(t){return Yl(t)||Tte(typeof t)}function bj(t){return sP(t)||SU(t)}function vj(t){return YT([Fn,Nc,Nv],t)}function wj(t){return Fe(t)==="RegExp"}function uP(t){return Number.isSafeInteger(t)}function Zl(t){return Fe(t)==="Set"}function Sj(t){return Fe(t)==="SharedArrayBuffer"}function Fn(t){return typeof t=="string"}function Nv(t){return typeof t=="symbol"}function _j(t){return!!t}function xj(t,e){return Bn(e)&&Bn(t)&&e.length===t.length?e.every((r,n)=>r(t[n])):!1}function Ij(t){return Ite(Fe(t))}function Cj(t){return Fe(t)==="Uint16Array"}function Tj(t){return Fe(t)==="Uint32Array"}function Pj(t){return Fe(t)==="Uint8Array"}function Ej(t){return Fe(t)==="Uint8ClampedArray"}function ep(t){return t===void 0}function kj(t){return Fe(t)==="URL"}function Rj(t){return Fe(t)==="URLSearchParams"}function Aj(t){if(!Fn(t))return!1;try{return new URL(t),!0}catch{return!1}}function Dj(t){return tP(t)&&!oP(Number(t))}function lP(t){return uP(t)&&t>=0}function Oj(t){return Fe(t)==="WeakMap"}function Lj(t){return Fe(t)==="WeakRef"}function Nj(t){return Fe(t)==="WeakSet"}function pP(t){return Fn(t)&&new RegExp("^\\s+$","v").test(t)}function Rv(t,e,r){if(IU(e),r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)}function $(t,e){return`Expected value which is \`${t}\`, received value of type \`${Av(e)}\`.`}function Ote(t,e){return`Expected value which is not \`${t}\`, received value of type \`${Av(e)}\`.`}function yU(t){return Array.from(new Set(t))}var Lte=new Intl.ListFormat("en",{style:"long",type:"conjunction"}),Nte=new Intl.ListFormat("en",{style:"long",type:"disjunction"});function Mj(t,e){let r=yU((Bn(t)?t:[t]).map(i=>`\`${i}\``)),n=yU(e.map(i=>`\`${Av(i)}\``));return`Expected values which are ${Nte.format(r)}. Received values of type${n.length>1?"s":""} ${Lte.format(n)}.`}function ra(t,e){return(r,n)=>{if(t(r))throw new TypeError(n??Ote(e,r))}}var Mte=ra(ep,"undefined"),Bte=ra(Yl,"null"),Fte=ra(Ov,"null or undefined"),Ute=ra(Fn,"string"),jte=ra(eP,"boolean"),Wte=ra(Nv,"symbol"),Hte=ra(ZT,"bigint"),qte=ra(cP,"primitive"),$te={bigint:Hte,boolean:jte,null:Bte,nullOrUndefined:Fte,primitive:qte,string:Ute,symbol:Wte,undefined:Mte},we={all:Gte,any:zte,not:$te,optional:Kte,array:Jte,arrayBuffer:Xte,arrayLike:Yte,asyncFunction:Qte,asyncGenerator:Zte,asyncGeneratorFunction:ere,asyncIterable:tre,bigint:rre,bigInt64Array:nre,bigUint64Array:ire,blob:ore,boolean:sre,boundFunction:are,buffer:cre,class:ure,dataView:lre,date:pre,directInstanceOf:dre,emptyArray:fre,emptyMap:hre,emptyObject:mre,emptySet:gre,emptyString:yre,emptyStringOrWhitespace:bre,enumCase:vre,error:wre,evenInteger:Sre,falsy:_re,finiteNumber:xre,float32Array:Ire,float64Array:Cre,formData:Tre,function:Pre,generator:Ere,generatorFunction:kre,htmlElement:Rre,infinite:Are,inRange:Dre,int16Array:Ore,int32Array:Lre,int8Array:Nre,integer:Mre,iterable:Bre,map:Fre,nan:Ure,nativePromise:jre,negativeInteger:Wre,negativeNumber:Hre,nodeStream:qre,nonEmptyArray:$re,nonEmptyMap:Vre,nonEmptyObject:Gre,nonEmptySet:zre,nonEmptyString:Kre,nonEmptyStringAndNotWhitespace:Jre,nonNegativeInteger:Xre,nonNegativeNumber:Yre,null:Qre,nullOrUndefined:Zre,number:ene,numericString:tne,object:rne,observable:nne,oddInteger:ine,plainObject:one,positiveInteger:sne,positiveNumber:ane,primitive:cne,promise:une,propertyKey:lne,regExp:pne,safeInteger:dne,set:fne,sharedArrayBuffer:hne,string:mne,symbol:gne,truthy:yne,tupleLike:bne,typedArray:vne,uint16Array:wne,uint32Array:Sne,uint8Array:_ne,uint8ClampedArray:xne,undefined:Ine,urlInstance:Cne,urlSearchParams:Tne,urlString:Pne,validDate:Ene,validLength:kne,weakMap:Rne,weakRef:Ane,weakSet:Dne,whitespaceString:One},dP={isArray:"Array",isArrayBuffer:"ArrayBuffer",isArrayLike:"array-like",isAsyncFunction:"AsyncFunction",isAsyncGenerator:"AsyncGenerator",isAsyncGeneratorFunction:"AsyncGeneratorFunction",isAsyncIterable:"AsyncIterable",isBigint:"bigint",isBigInt64Array:"BigInt64Array",isBigUint64Array:"BigUint64Array",isBlob:"Blob",isBoolean:"boolean",isBoundFunction:"bound Function",isBuffer:"Buffer",isClass:"Class",isDataView:"DataView",isDate:"Date",isDirectInstanceOf:"T",isEmptyArray:"empty array",isEmptyMap:"empty map",isEmptyObject:"empty object",isEmptySet:"empty set",isEmptyString:"empty string",isEmptyStringOrWhitespace:"empty string or whitespace",isEnumCase:"EnumCase",isError:"Error",isEvenInteger:"even integer",isFalsy:"falsy",isFiniteNumber:"finite number",isFloat32Array:"Float32Array",isFloat64Array:"Float64Array",isFormData:"FormData",isFunction:"Function",isGenerator:"Generator",isGeneratorFunction:"GeneratorFunction",isHtmlElement:"HTMLElement",isInfinite:"infinite number",isInRange:"in range",isInt16Array:"Int16Array",isInt32Array:"Int32Array",isInt8Array:"Int8Array",isInteger:"integer",isIterable:"Iterable",isMap:"Map",isNan:"NaN",isNativePromise:"native Promise",isNegativeInteger:"negative integer",isNegativeNumber:"negative number",isNodeStream:"Node.js Stream",isNonEmptyArray:"non-empty array",isNonEmptyMap:"non-empty map",isNonEmptyObject:"non-empty object",isNonEmptySet:"non-empty set",isNonEmptyString:"non-empty string",isNonEmptyStringAndNotWhitespace:"non-empty string and not whitespace",isNonNegativeInteger:"non-negative integer",isNonNegativeNumber:"non-negative number",isNull:"null",isNullOrUndefined:"null or undefined",isNumber:"number",isNumericString:"string with a number",isObject:"Object",isObservable:"Observable",isOddInteger:"odd integer",isPlainObject:"plain object",isPositiveInteger:"positive integer",isPositiveNumber:"positive number",isPrimitive:"primitive",isPromise:"Promise",isPropertyKey:"PropertyKey",isRegExp:"RegExp",isSafeInteger:"safe integer",isSet:"Set",isSharedArrayBuffer:"SharedArrayBuffer",isString:"string",isSymbol:"symbol",isTruthy:"truthy",isTupleLike:"tuple-like",isTypedArray:"TypedArray",isUint16Array:"Uint16Array",isUint32Array:"Uint32Array",isUint8Array:"Uint8Array",isUint8ClampedArray:"Uint8ClampedArray",isUndefined:"undefined",isUrlInstance:"URL",isUrlSearchParams:"URLSearchParams",isUrlString:"string with a URL",isValidDate:"valid Date",isValidLength:"valid length",isWeakMap:"WeakMap",isWeakRef:"WeakRef",isWeakSet:"WeakSet",isWhitespaceString:"whitespace string"},Vte=mU(dP);function Bj(t){return Vte.includes(t)}function Gte(t,...e){if(e.length===0)throw new TypeError("Invalid number of values");if(!CU(t,...e)){let r=t,n=!Array.isArray(t)&&Bj(r.name)?dP[r.name]:"predicate returns truthy for all values";throw new TypeError(Mj(n,e))}}function zte(t,...e){if(e.length===0)throw new TypeError("Invalid number of values");if(!YT(t,...e)){let n=(Array.isArray(t)?t:[t]).map(i=>Bj(i.name)?dP[i.name]:"predicate returns truthy for any value");throw new TypeError(Mj(n,e))}}function Kte(t,e,r){ep(t)||e(t,r)}function Jte(t,e,r){if(!Bn(t))throw new TypeError(r??$("Array",t));if(e)for(let n of t)e(n,r)}function Xte(t,e){if(!TU(t))throw new TypeError(e??$("ArrayBuffer",t))}function Yte(t,e){if(!PU(t))throw new TypeError(e??$("array-like",t))}function Qte(t,e){if(!EU(t))throw new TypeError(e??$("AsyncFunction",t))}function Zte(t,e){if(!kU(t))throw new TypeError(e??$("AsyncGenerator",t))}function ere(t,e){if(!RU(t))throw new TypeError(e??$("AsyncGeneratorFunction",t))}function tre(t,e){if(!QT(t))throw new TypeError(e??$("AsyncIterable",t))}function rre(t,e){if(!ZT(t))throw new TypeError(e??$("bigint",t))}function nre(t,e){if(!AU(t))throw new TypeError(e??$("BigInt64Array",t))}function ire(t,e){if(!DU(t))throw new TypeError(e??$("BigUint64Array",t))}function ore(t,e){if(!OU(t))throw new TypeError(e??$("Blob",t))}function sre(t,e){if(!eP(t))throw new TypeError(e??$("boolean",t))}function are(t,e){if(!LU(t))throw new TypeError(e??$("bound Function",t))}function cre(t,e){if(!Kl(t))throw new TypeError(e??$("Buffer",t))}function ure(t,e){if(!NU(t))throw new TypeError(e??$("Class",t))}function lre(t,e){if(!MU(t))throw new TypeError(e??$("DataView",t))}function pre(t,e){if(!tP(t))throw new TypeError(e??$("Date",t))}function dre(t,e,r){if(!BU(t,e))throw new TypeError(r??$("T",t))}function fre(t,e){if(!FU(t))throw new TypeError(e??$("empty array",t))}function hre(t,e){if(!UU(t))throw new TypeError(e??$("empty map",t))}function mre(t,e){if(!jU(t))throw new TypeError(e??$("empty object",t))}function gre(t,e){if(!WU(t))throw new TypeError(e??$("empty set",t))}function yre(t,e){if(!rP(t))throw new TypeError(e??$("empty string",t))}function bre(t,e){if(!Dv(t))throw new TypeError(e??$("empty string or whitespace",t))}function vre(t,e,r){if(!HU(t,e))throw new TypeError(r??$("EnumCase",t))}function wre(t,e){if(!qU(t))throw new TypeError(e??$("Error",t))}function Sre(t,e){if(!$U(t))throw new TypeError(e??$("even integer",t))}function _re(t,e){if(!VU(t))throw new TypeError(e??$("falsy",t))}function xre(t,e){if(!GU(t))throw new TypeError(e??$("finite number",t))}function Ire(t,e){if(!zU(t))throw new TypeError(e??$("Float32Array",t))}function Cre(t,e){if(!KU(t))throw new TypeError(e??$("Float64Array",t))}function Tre(t,e){if(!JU(t))throw new TypeError(e??$("FormData",t))}function Pre(t,e){if(!Wt(t))throw new TypeError(e??$("Function",t))}function Ere(t,e){if(!XU(t))throw new TypeError(e??$("Generator",t))}function kre(t,e){if(!YU(t))throw new TypeError(e??$("GeneratorFunction",t))}function Rre(t,e){if(!nP(t))throw new TypeError(e??$("HTMLElement",t))}function Are(t,e){if(!QU(t))throw new TypeError(e??$("infinite number",t))}function Dre(t,e,r){if(!ZU(t,e))throw new TypeError(r??$("in range",t))}function Ore(t,e){if(!ej(t))throw new TypeError(e??$("Int16Array",t))}function Lre(t,e){if(!tj(t))throw new TypeError(e??$("Int32Array",t))}function Nre(t,e){if(!rj(t))throw new TypeError(e??$("Int8Array",t))}function Mre(t,e){if(!Jl(t))throw new TypeError(e??$("integer",t))}function Bre(t,e){if(!iP(t))throw new TypeError(e??$("Iterable",t))}function Fre(t,e){if(!Xl(t))throw new TypeError(e??$("Map",t))}function Ure(t,e){if(!oP(t))throw new TypeError(e??$("NaN",t))}function jre(t,e){if(!sP(t))throw new TypeError(e??$("native Promise",t))}function Wre(t,e){if(!nj(t))throw new TypeError(e??$("negative integer",t))}function Hre(t,e){if(!ij(t))throw new TypeError(e??$("negative number",t))}function qre(t,e){if(!oj(t))throw new TypeError(e??$("Node.js Stream",t))}function $re(t,e){if(!sj(t))throw new TypeError(e??$("non-empty array",t))}function Vre(t,e){if(!aj(t))throw new TypeError(e??$("non-empty map",t))}function Gre(t,e){if(!cj(t))throw new TypeError(e??$("non-empty object",t))}function zre(t,e){if(!uj(t))throw new TypeError(e??$("non-empty set",t))}function Kre(t,e){if(!lj(t))throw new TypeError(e??$("non-empty string",t))}function Jre(t,e){if(!pj(t))throw new TypeError(e??$("non-empty string and not whitespace",t))}function Xre(t,e){if(!dj(t))throw new TypeError(e??$("non-negative integer",t))}function Yre(t,e){if(!fj(t))throw new TypeError(e??$("non-negative number",t))}function Qre(t,e){if(!Yl(t))throw new TypeError(e??$("null",t))}function Zre(t,e){if(!Ov(t))throw new TypeError(e??$("null or undefined",t))}function ene(t,e){if(!Nc(t))throw new TypeError(e??$("number",t))}function tne(t,e){if(!hj(t))throw new TypeError(e??$("string with a number",t))}function rne(t,e){if(!Ql(t))throw new TypeError(e??$("Object",t))}function nne(t,e){if(!Lv(t))throw new TypeError(e??$("Observable",t))}function ine(t,e){if(!mj(t))throw new TypeError(e??$("odd integer",t))}function one(t,e){if(!aP(t))throw new TypeError(e??$("plain object",t))}function sne(t,e){if(!gj(t))throw new TypeError(e??$("positive integer",t))}function ane(t,e){if(!yj(t))throw new TypeError(e??$("positive number",t))}function cne(t,e){if(!cP(t))throw new TypeError(e??$("primitive",t))}function une(t,e){if(!bj(t))throw new TypeError(e??$("Promise",t))}function lne(t,e){if(!vj(t))throw new TypeError(e??$("PropertyKey",t))}function pne(t,e){if(!wj(t))throw new TypeError(e??$("RegExp",t))}function dne(t,e){if(!uP(t))throw new TypeError(e??$("safe integer",t))}function fne(t,e){if(!Zl(t))throw new TypeError(e??$("Set",t))}function hne(t,e){if(!Sj(t))throw new TypeError(e??$("SharedArrayBuffer",t))}function mne(t,e){if(!Fn(t))throw new TypeError(e??$("string",t))}function gne(t,e){if(!Nv(t))throw new TypeError(e??$("symbol",t))}function yne(t,e){if(!_j(t))throw new TypeError(e??$("truthy",t))}function bne(t,e,r){if(!xj(t,e))throw new TypeError(r??$("tuple-like",t))}function vne(t,e){if(!Ij(t))throw new TypeError(e??$("TypedArray",t))}function wne(t,e){if(!Cj(t))throw new TypeError(e??$("Uint16Array",t))}function Sne(t,e){if(!Tj(t))throw new TypeError(e??$("Uint32Array",t))}function _ne(t,e){if(!Pj(t))throw new TypeError(e??$("Uint8Array",t))}function xne(t,e){if(!Ej(t))throw new TypeError(e??$("Uint8ClampedArray",t))}function Ine(t,e){if(!ep(t))throw new TypeError(e??$("undefined",t))}function Cne(t,e){if(!kj(t))throw new TypeError(e??$("URL",t))}function Tne(t,e){if(!Rj(t))throw new TypeError(e??$("URLSearchParams",t))}function Pne(t,e){if(!Aj(t))throw new TypeError(e??$("string with a URL",t))}function Ene(t,e){if(!Dj(t))throw new TypeError(e??$("valid Date",t))}function kne(t,e){if(!lP(t))throw new TypeError(e??$("valid length",t))}function Rne(t,e){if(!Oj(t))throw new TypeError(e??$("WeakMap",t))}function Ane(t,e){if(!Lj(t))throw new TypeError(e??$("WeakRef",t))}function Dne(t,e){if(!Nj(t))throw new TypeError(e??$("WeakSet",t))}function One(t,e){if(!pP(t))throw new TypeError(e??$("whitespace string",t))}var w=Av;var DW=require("node:events");function pi(t){let e=new URL(t);return e.username="",e.password="",e.toString()}function Lne(t){return w.object(t)&&"_onResponse"in t}var Ne=class extends Error{name="RequestError";code="ERR_GOT_REQUEST_ERROR";input;stack;response;request;timings;constructor(e,r,n){if(super(e,{cause:r}),Error.captureStackTrace(this,this.constructor),r.code&&(this.code=r.code),this.input=r.input,Lne(n)?(Object.defineProperty(this,"request",{enumerable:!1,value:n}),Object.defineProperty(this,"response",{enumerable:!1,value:n.response}),this.options=n.options):this.options=n,this.timings=this.request?.timings,w.string(r.stack)&&w.string(this.stack)){let i=this.stack.indexOf(this.message)+this.message.length,o=this.stack.slice(i).split(`
`).toReversed(),s=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(`
`).toReversed();for(;s.length>0&&s[0]===o[0];)o.shift();this.stack=`${this.stack.slice(0,i)}${o.toReversed().join(`
`)}${s.toReversed().join(`
`)}`}}},Mv=class extends Ne{name="MaxRedirectsError";code="ERR_TOO_MANY_REDIRECTS";constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e)}},na=class extends Ne{name="HTTPError";code="ERR_NON_2XX_3XX_RESPONSE";constructor(e){super(`Request failed with status code ${e.statusCode} (${e.statusMessage}): ${e.request.options.method} ${pi(e.request.options.url)}`,{},e.request)}},yh=class extends Ne{name="CacheError";constructor(e,r){super(e.message,e,r),this.code="ERR_CACHE_ACCESS"}},bh=class extends Ne{name="UploadError";constructor(e,r){super(e.message,e,r),this.code="ERR_UPLOAD"}},tp=class extends Ne{name="TimeoutError";timings;event;constructor(e,r,n){super(e.message,e,n),this.event=e.event,this.timings=r}},Mc=class extends Ne{name="ReadError";code="ERR_READING_RESPONSE_STREAM";constructor(e,r){super(e.message,e,r),(e.code==="ECONNRESET"||e.code==="ERR_HTTP_CONTENT_LENGTH_MISMATCH")&&(this.code=e.code)}},Bv=class extends Ne{name="RetryError";code="ERR_RETRYING";constructor(e){super("Retrying",{},e)}},Fv=class extends Ne{name="AbortError";code="ERR_ABORTED";constructor(e){super("This operation was aborted.",{},e)}};var lp=v(require("node:process"),1),ZP=require("node:buffer"),RW=require("node:stream"),AW=require("node:events"),Rh=v(require("node:http"),1);var Nne=new TextEncoder;function Uv(t){return typeof t=="string"?Nne.encode(t).byteLength:ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof SharedArrayBuffer?t.byteLength:0}var Mne=t=>t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);function*Fj(t,e){if(!ArrayBuffer.isView(t))throw new TypeError("Expected data to be ArrayBufferView");if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("Expected chunkSize to be a positive integer");let r=Mne(t);for(let n=0;n<r.length;n+=e)yield r.subarray(n,n+e)}var Bne=Object.prototype.toString,Fne="[object Uint8Array]";function Une(t,e,r){return t?t.constructor===e?!0:Bne.call(t)===r:!1}function jne(t){return Une(t,Uint8Array,Fne)}function jj(t){if(!jne(t))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}function Wj(t,e){if(t.length===0)return new Uint8Array(0);e??=t.reduce((i,o)=>i+o.length,0);let r=new Uint8Array(e),n=0;for(let i of t)jj(i),r.set(i,n),n+=i.length;return r}var lTe={utf8:new globalThis.TextDecoder("utf8")};function Hj(t){if(typeof t!="string")throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}var Wne=new globalThis.TextEncoder;function Bc(t){return Hj(t),Wne.encode(t)}function Hne(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}var Uj=65535;function qne(t,{urlSafe:e=!1}={}){jj(t);let r="";for(let n=0;n<t.length;n+=Uj){let i=t.subarray(n,n+Uj);r+=globalThis.btoa(String.fromCodePoint.apply(void 0,i))}return e?Hne(r):r}function qj(t,{urlSafe:e=!1}={}){return Hj(t),qne(Bc(t),{urlSafe:e})}var pTe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));var h2=v(require("node:crypto"),1),m2=v(require("node:events"),1),Vv=v(require("node:stream"),1),_h=v(require("node:url"),1);var a2=require("node:events"),c2=require("node:stream/promises");function $ne(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function $j(t,{checkOpen:e=!0}={}){return $ne(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}var Vne=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),fP=class{#e;#o;#t=!1;#r=void 0;constructor(e,r){this.#e=e,this.#o=r}next(){let e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){let r=()=>this.#n(e);return this.#r?this.#r.then(r,r):r()}async#i(){if(this.#t)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(r){throw this.#r=void 0,this.#t=!0,this.#e.releaseLock(),r}return e.done&&(this.#r=void 0,this.#t=!0,this.#e.releaseLock()),e}async#n(e){if(this.#t)return{done:!0,value:e};if(this.#t=!0,!this.#o){let r=this.#e.cancel(e);return this.#e.releaseLock(),await r,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}},hP=Symbol();function Vj(){return this[hP].next()}Object.defineProperty(Vj,"name",{value:"next"});function Gj(t){return this[hP].return(t)}Object.defineProperty(Gj,"name",{value:"return"});var Gne=Object.create(Vne,{next:{enumerable:!0,configurable:!0,writable:!0,value:Vj},return:{enumerable:!0,configurable:!0,writable:!0,value:Gj}});function mP({preventCancel:t=!1}={}){let e=this.getReader(),r=new fP(e,t),n=Object.create(Gne);return n[hP]=r,n}var zj=t=>{if($j(t,{checkOpen:!1})&&vh.on!==void 0)return Kne(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(zne.call(t)==="[object ReadableStream]")return mP.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:zne}=Object.prototype,Kne=async function*(t){let e=new AbortController,r={};Jne(t,e,r);try{for await(let[n]of vh.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},Jne=async(t,e,r)=>{try{await vh.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},vh={};var Xj=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let u=zj(t),l=e();l.length=0;try{for await(let p of u){let d=Yne(p),f=r[d](p,l);Yj({convertedChunk:f,state:l,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Xne({state:l,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(l)}catch(p){let d=typeof p=="object"&&p!==null?p:new Error(p);throw d.bufferedData=a(l),d}},Xne=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&Yj({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},Yj=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){Kj(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&Kj(c,e,i,o),new jv},Kj=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Yne=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=Jj.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&Jj.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Jj}=Object.prototype,jv=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Qj=()=>{};var Zj=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},e2=t=>t.length;async function gP(t,e){return Xj(t,sie,e)}var Qne=()=>({contents:new ArrayBuffer(0)}),Zne=t=>eie.encode(t),eie=new TextEncoder,t2=t=>new Uint8Array(t),r2=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),tie=(t,e)=>t.slice(0,e),rie=(t,{contents:e,length:r},n)=>{let i=o2()?iie(e,n):nie(e,n);return new Uint8Array(i).set(t,r),i},nie=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(i2(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},iie=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:i2(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},i2=t=>n2**Math.ceil(Math.log(t)/Math.log(n2)),n2=2,oie=({contents:t,length:e})=>o2()?t:t.slice(0,e),o2=()=>"resize"in ArrayBuffer.prototype,sie={init:Qne,convertChunk:{string:Zne,buffer:t2,arrayBuffer:t2,dataView:r2,typedArray:r2,others:Zj},getSize:e2,truncateChunk:tie,addChunk:rie,getFinalChunk:Qj,finalize:oie};async function Wv(t,e){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return s2(await gP(t,e))}catch(r){throw r.bufferedData!==void 0&&(r.bufferedData=s2(r.bufferedData)),r}}var s2=t=>globalThis.Buffer.from(t);Object.assign(vh,{on:a2.on,finished:c2.finished});var $v=v(l2(),1);var bP=require("buffer"),Hv=(t,e=!0)=>{if(t==null)return"null";if(typeof t=="string")return JSON.stringify(e&&t.startsWith(":")?`:${t}`:t);if(bP.Buffer.isBuffer(t))return JSON.stringify(`:base64:${t.toString("base64")}`);if(t?.toJSON&&(t=t.toJSON()),typeof t=="object"){let r="",n=Array.isArray(t);r=n?"[":"{";let i=!0;for(let o in t){let s=typeof t[o]=="function"||!n&&t[o]===void 0;!Object.hasOwn(t,o)||s||(i||(r+=","),i=!1,n?r+=Hv(t[o],e):t[o]!==void 0&&(r+=`${Hv(o,!1)}:${Hv(t[o],e)}`))}return r+=n?"]":"}",r}return JSON.stringify(t)},vP=t=>Hv(t,!0),wP=t=>JSON.parse(t,(e,r)=>typeof r=="string"?r.startsWith(":base64:")?bP.Buffer.from(r.slice(8),"base64"):r.startsWith(":")?r.slice(1):r:r);var hie=class{_eventListeners;_maxListeners;constructor(){this._eventListeners=new Map,this._maxListeners=100}maxListeners(){return this._maxListeners}addListener(t,e){this.on(t,e)}on(t,e){this._eventListeners.has(t)||this._eventListeners.set(t,[]);let r=this._eventListeners.get(t);return r&&(r.length>=this._maxListeners&&console.warn(`MaxListenersExceededWarning: Possible event memory leak detected. ${r.length+1} ${t} listeners added. Use setMaxListeners() to increase limit.`),r.push(e)),this}removeListener(t,e){this.off(t,e)}off(t,e){let r=this._eventListeners.get(t)??[],n=r.indexOf(e);n!==-1&&r.splice(n,1),r.length===0&&this._eventListeners.delete(t)}once(t,e){let r=(...n)=>{e(...n),this.off(t,r)};this.on(t,r)}emit(t,...e){let r=this._eventListeners.get(t);if(r&&r.length>0)for(let n of r)n(...e)}listeners(t){return this._eventListeners.get(t)??[]}removeAllListeners(t){t?this._eventListeners.delete(t):this._eventListeners.clear()}setMaxListeners(t){this._maxListeners=t}},SP=hie,mie=class extends SP{_hookHandlers;constructor(){super(),this._hookHandlers=new Map}addHandler(t,e){let r=this._hookHandlers.get(t);r?r.push(e):this._hookHandlers.set(t,[e])}removeHandler(t,e){let r=this._hookHandlers.get(t);if(r){let n=r.indexOf(e);n!==-1&&r.splice(n,1)}}trigger(t,e){let r=this._hookHandlers.get(t);if(r)for(let n of r)try{n(e)}catch(i){this.emit("error",new Error(`Error in hook handler for event "${t}": ${i.message}`))}}get handlers(){return new Map(this._hookHandlers)}},gie=mie,yie=class extends SP{enabled=!0;hits=0;misses=0;sets=0;deletes=0;errors=0;constructor(t){super(),t!==void 0&&(this.enabled=t),this.reset()}hit(){this.enabled&&this.hits++}miss(){this.enabled&&this.misses++}set(){this.enabled&&this.sets++}delete(){this.enabled&&this.deletes++}hitsOrMisses(t){for(let e of t)e===void 0?this.miss():this.hit()}reset(){this.hits=0,this.misses=0,this.sets=0,this.deletes=0,this.errors=0}},bie=yie;var p2=["sqlite","postgres","mysql","mongo","redis","valkey","etcd"],wh=class extends SP{opts;iterator;hooks=new gie;stats=new bie(!1);_ttl;_namespace;_store=new Map;_serialize=vP;_deserialize=wP;_compression;_useKeyPrefix=!0;_throwOnErrors=!1;constructor(t,e){if(super(),e??={},t??={},this.opts={namespace:"keyv",serialize:vP,deserialize:wP,emitErrors:!0,store:new Map,...e},t&&t.get?this.opts.store=t:this.opts={...this.opts,...t},this._store=this.opts.store??new Map,this._compression=this.opts.compression,this._serialize=this.opts.serialize,this._deserialize=this.opts.deserialize,this.opts.namespace&&(this._namespace=this.opts.namespace),this._store){if(!this._isValidStorageAdapter(this._store))throw new Error("Invalid storage adapter");typeof this._store.on=="function"&&this._store.on("error",r=>this.emit("error",r)),this._store.namespace=this._namespace,typeof this._store[Symbol.iterator]=="function"&&this._store instanceof Map?this.iterator=this.generateIterator(this._store):"iterator"in this._store&&this._store.opts&&this._checkIterableAdapter()&&(this.iterator=this.generateIterator(this._store.iterator.bind(this._store)))}this.opts.stats&&(this.stats.enabled=this.opts.stats),this.opts.ttl&&(this._ttl=this.opts.ttl),this.opts.useKeyPrefix!==void 0&&(this._useKeyPrefix=this.opts.useKeyPrefix),this.opts.throwOnErrors!==void 0&&(this._throwOnErrors=this.opts.throwOnErrors)}get store(){return this._store}set store(t){if(this._isValidStorageAdapter(t))this._store=t,this.opts.store=t,typeof t.on=="function"&&t.on("error",e=>this.emit("error",e)),this._namespace&&(this._store.namespace=this._namespace),typeof t[Symbol.iterator]=="function"&&t instanceof Map?this.iterator=this.generateIterator(t):"iterator"in t&&t.opts&&this._checkIterableAdapter()&&(this.iterator=this.generateIterator(t.iterator?.bind(t)));else throw new Error("Invalid storage adapter")}get compression(){return this._compression}set compression(t){this._compression=t}get namespace(){return this._namespace}set namespace(t){this._namespace=t,this.opts.namespace=t,this._store.namespace=t,this.opts.store&&(this.opts.store.namespace=t)}get ttl(){return this._ttl}set ttl(t){this.opts.ttl=t,this._ttl=t}get serialize(){return this._serialize}set serialize(t){this.opts.serialize=t,this._serialize=t}get deserialize(){return this._deserialize}set deserialize(t){this.opts.deserialize=t,this._deserialize=t}get useKeyPrefix(){return this._useKeyPrefix}set useKeyPrefix(t){this._useKeyPrefix=t,this.opts.useKeyPrefix=t}get throwOnErrors(){return this._throwOnErrors}set throwOnErrors(t){this._throwOnErrors=t,this.opts.throwOnErrors=t}generateIterator(t){return async function*(){for await(let[r,n]of typeof t=="function"?t(this._store.namespace):t){let i=await this.deserializeData(n);if(!(this._useKeyPrefix&&this._store.namespace&&!r.includes(this._store.namespace))){if(typeof i.expires=="number"&&Date.now()>i.expires){await this.delete(r);continue}yield[this._getKeyUnprefix(r),i.value]}}}.bind(this)}_checkIterableAdapter(){return p2.includes(this._store.opts.dialect)||p2.some(t=>this._store.opts.url.includes(t))}_getKeyPrefix(t){return!this._useKeyPrefix||!this._namespace||t.startsWith(`${this._namespace}:`)?t:`${this._namespace}:${t}`}_getKeyPrefixArray(t){return!this._useKeyPrefix||!this._namespace?t:t.map(e=>`${this._namespace}:${e}`)}_getKeyUnprefix(t){return this._useKeyPrefix?t.split(":").splice(1).join(":"):t}_isValidStorageAdapter(t){return t instanceof Map||typeof t.get=="function"&&typeof t.set=="function"&&typeof t.delete=="function"&&typeof t.clear=="function"}async get(t,e){let{store:r}=this.opts,n=Array.isArray(t),i=n?this._getKeyPrefixArray(t):this._getKeyPrefix(t),o=c=>typeof c.expires=="number"&&Date.now()>c.expires;if(n)return e?.raw===!0?this.getMany(t,{raw:!0}):this.getMany(t,{raw:!1});this.hooks.trigger("preGet",{key:i});let s;try{s=await r.get(i)}catch(c){if(this.throwOnErrors)throw c}let a=typeof s=="string"||this.opts.compression?await this.deserializeData(s):s;if(a==null){this.hooks.trigger("postGet",{key:i,value:void 0}),this.stats.miss();return}if(o(a)){await this.delete(t),this.hooks.trigger("postGet",{key:i,value:void 0}),this.stats.miss();return}return this.hooks.trigger("postGet",{key:i,value:a}),this.stats.hit(),e?.raw?a:a.value}async getMany(t,e){let{store:r}=this.opts,n=this._getKeyPrefixArray(t),i=c=>typeof c.expires=="number"&&Date.now()>c.expires;if(this.hooks.trigger("preGetMany",{keys:n}),r.getMany===void 0){let c=n.map(async p=>{let d=await r.get(p),f=typeof d=="string"||this.opts.compression?await this.deserializeData(d):d;if(f!=null){if(i(f)){await this.delete(p);return}return e?.raw?f:f.value}}),l=(await Promise.allSettled(c)).map(p=>p.value);return this.hooks.trigger("postGetMany",l),l.length>0&&this.stats.hit(),l}let o=await r.getMany(n),s=[],a=[];for(let c in o){let u=o[c];if(typeof u=="string"&&(u=await this.deserializeData(u)),u==null){s.push(void 0);continue}if(i(u)){a.push(t[c]),s.push(void 0);continue}let l=e?.raw?u:u.value;s.push(l)}return a.length>0&&await this.deleteMany(a),this.hooks.trigger("postGetMany",s),s.length>0&&this.stats.hit(),s}async getRaw(t){let{store:e}=this.opts,r=this._getKeyPrefix(t);this.hooks.trigger("preGetRaw",{key:r});let n=await e.get(r);if(n==null){this.hooks.trigger("postGetRaw",{key:r,value:void 0}),this.stats.miss();return}let i=typeof n=="string"||this.opts.compression?await this.deserializeData(n):n;if(i!==void 0&&i.expires!==void 0&&i.expires!==null&&i.expires<Date.now()){this.hooks.trigger("postGetRaw",{key:r,value:void 0}),this.stats.miss(),await this.delete(t);return}return this.stats.hit(),this.hooks.trigger("postGetRaw",{key:r,value:i}),i}async getManyRaw(t){let{store:e}=this.opts,r=this._getKeyPrefixArray(t);if(t.length===0){let s=Array.from({length:t.length}).fill(void 0);return this.stats.misses+=t.length,this.hooks.trigger("postGetManyRaw",{keys:r,values:s}),s}let n=[];if(e.getMany===void 0){let s=r.map(async c=>{let u=await e.get(c);if(u!=null)return this.deserializeData(u)});n=(await Promise.allSettled(s)).map(c=>c.value)}else{let s=await e.getMany(r);for(let a of s)a!=null?n.push(await this.deserializeData(a)):n.push(void 0)}let i=[],o=s=>typeof s.expires=="number"&&Date.now()>s.expires;for(let[s,a]of n.entries())a!==void 0&&o(a)&&(i.push(r[s]),n[s]=void 0);return i.length>0&&await this.deleteMany(i),this.stats.hitsOrMisses(n),this.hooks.trigger("postGetManyRaw",{keys:r,values:n}),n}async set(t,e,r){let n={key:t,value:e,ttl:r};this.hooks.trigger("preSet",n);let i=this._getKeyPrefix(n.key);n.ttl??=this._ttl,n.ttl===0&&(n.ttl=void 0);let{store:o}=this.opts,s=typeof n.ttl=="number"?Date.now()+n.ttl:void 0;if(typeof n.value=="symbol")throw this.emit("error","symbol cannot be serialized"),new Error("symbol cannot be serialized");let a={value:n.value,expires:s},c=await this.serializeData(a),u=!0;try{let l=await o.set(i,c,n.ttl);typeof l=="boolean"&&(u=l)}catch(l){if(u=!1,this.emit("error",l),this._throwOnErrors)throw l}return this.hooks.trigger("postSet",{key:i,value:c,ttl:r}),this.stats.set(),u}async setMany(t){let e=[];try{if(this._store.setMany===void 0){let r=[];for(let i of t)r.push(this.set(i.key,i.value,i.ttl));e=await Promise.all(r)}else{let r=await Promise.all(t.map(async({key:n,value:i,ttl:o})=>{o??=this._ttl,o===0&&(o=void 0);let s=typeof o=="number"?Date.now()+o:void 0;if(typeof i=="symbol")throw this.emit("error","symbol cannot be serialized"),new Error("symbol cannot be serialized");let a={value:i,expires:s},c=await this.serializeData(a);return{key:this._getKeyPrefix(n),value:c,ttl:o}}));e=await this._store.setMany(r)}}catch(r){if(this.emit("error",r),this._throwOnErrors)throw r;e=t.map(()=>!1)}return e}async delete(t){let{store:e}=this.opts;if(Array.isArray(t))return this.deleteMany(t);let r=this._getKeyPrefix(t);this.hooks.trigger("preDelete",{key:r});let n=!0;try{let i=await e.delete(r);typeof i=="boolean"&&(n=i)}catch(i){if(n=!1,this.emit("error",i),this._throwOnErrors)throw i}return this.hooks.trigger("postDelete",{key:r,value:n}),this.stats.delete(),n}async deleteMany(t){try{let{store:e}=this.opts,r=this._getKeyPrefixArray(t);if(this.hooks.trigger("preDelete",{key:r}),e.deleteMany!==void 0)return await e.deleteMany(r);let n=r.map(async s=>e.delete(s)),o=(await Promise.all(n)).every(Boolean);return this.hooks.trigger("postDelete",{key:r,value:o}),o}catch(e){if(this.emit("error",e),this._throwOnErrors)throw e;return!1}}async clear(){this.emit("clear");let{store:t}=this.opts;try{await t.clear()}catch(e){if(this.emit("error",e),this._throwOnErrors)throw e}}async has(t){if(Array.isArray(t))return this.hasMany(t);let e=this._getKeyPrefix(t),{store:r}=this.opts;if(r.has!==void 0&&!(r instanceof Map))return r.has(e);let n;try{n=await r.get(e)}catch(i){if(this.emit("error",i),this._throwOnErrors)throw i;return!1}if(n){let i=await this.deserializeData(n);if(i)return i.expires===void 0||i.expires===null?!0:i.expires>Date.now()}return!1}async hasMany(t){let e=this._getKeyPrefixArray(t),{store:r}=this.opts;if(r.hasMany!==void 0)return r.hasMany(e);let n=[];for(let i of t)n.push(await this.has(i));return n}async disconnect(){let{store:t}=this.opts;if(this.emit("disconnect"),typeof t.disconnect=="function")return t.disconnect()}emit(t,...e){t==="error"&&!this.opts.emitErrors||super.emit(t,...e)}async serializeData(t){return this._serialize?this._compression?.compress?this._serialize({value:await this._compression.compress(t.value),expires:t.expires}):this._serialize(t):t}async deserializeData(t){if(!this._deserialize)return t;if(this._compression?.decompress&&typeof t=="string"){let e=await this._deserialize(t);return{value:await this._compression.decompress(e?.value),expires:e?.expires}}if(typeof t=="string")return this._deserialize(t)}};var vie=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function Sh(t,e){if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set([...Object.keys(t),...vie]),n={};for(let i of r)i in e||(n[i]={get(){let o=t[i];return typeof o=="function"?o.bind(t):o},set(o){t[i]=o},enumerable:!0,configurable:!1});return Object.defineProperties(e,n),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}var wie="text/plain",Sie="us-ascii",_P=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),_ie=new Set(["https:","http:","file:"]),xie=t=>{try{let{protocol:e}=new URL(t);return e.endsWith(":")&&!e.includes(".")&&!_ie.has(e)}catch{return!1}},Iie=(t,{stripHash:e})=>{let r=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(t);if(!r)throw new Error(`Invalid URL: ${t}`);let{type:n,data:i,hash:o}=r.groups,s=n.split(";"),a=s.at(-1)==="base64";a&&s.pop();let c=s.shift()?.toLowerCase()??"",l=[...s.map(d=>{let[f,h=""]=d.split("=").map(m=>m.trim());return f==="charset"&&(h=h.toLowerCase(),h===Sie)?"":`${f}${h?`=${h}`:""}`}).filter(Boolean)];a&&l.push("base64"),(l.length>0||c&&c!==wie)&&l.unshift(c);let p=e||!o?"":`#${o}`;return`data:${l.join(";")},${a?i.trim():i}${p}`};function xP(t,e){if(e={defaultProtocol:"http",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,removePath:!1,transformPath:!1,...e},typeof e.defaultProtocol=="string"&&!e.defaultProtocol.endsWith(":")&&(e.defaultProtocol=`${e.defaultProtocol}:`),t=t.trim(),/^data:/i.test(t))return Iie(t,e);if(xie(t))return t;let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let i=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&i.protocol==="https:"&&(i.protocol="http:"),e.forceHttps&&i.protocol==="http:"&&(i.protocol="https:"),e.stripAuthentication&&(i.username="",i.password=""),e.stripHash?i.hash="":e.stripTextFragment&&(i.hash=i.hash.replace(/#?:~:text.*?$/i,"")),i.pathname){let s=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,a=0,c="";for(;;){let l=s.exec(i.pathname);if(!l)break;let p=l[0],d=l.index,f=i.pathname.slice(a,d);c+=f.replace(/\/{2,}/g,"/"),c+=p,a=d+p.length}let u=i.pathname.slice(a,i.pathname.length);c+=u.replace(/\/{2,}/g,"/"),i.pathname=c}if(i.pathname)try{i.pathname=decodeURI(i.pathname).replace(/\\/g,"%5C")}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let s=i.pathname.split("/").filter(Boolean),a=s.at(-1);a&&_P(a,e.removeDirectoryIndex)&&(s.pop(),i.pathname=s.length>0?`/${s.join("/")}/`:"/")}if(e.removePath&&(i.pathname="/"),e.transformPath&&typeof e.transformPath=="function"){let s=i.pathname.split("/").filter(Boolean),a=e.transformPath(s);i.pathname=a?.length>0?`/${a.join("/")}`:"/"}if(i.hostname&&(i.hostname=i.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(i.hostname)&&(i.hostname=i.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let s of[...i.searchParams.keys()])_P(s,e.removeQueryParameters)&&i.searchParams.delete(s);if(!Array.isArray(e.keepQueryParameters)&&e.removeQueryParameters===!0&&(i.search=""),Array.isArray(e.keepQueryParameters)&&e.keepQueryParameters.length>0)for(let s of[...i.searchParams.keys()])_P(s,e.keepQueryParameters)||i.searchParams.delete(s);if(e.sortQueryParameters){let s=i.search;i.searchParams.sort();try{i.search=decodeURIComponent(i.search)}catch{}let a=s.slice(1).split("&").filter(c=>c&&!c.includes("="));for(let c of a){let u=decodeURIComponent(c);i.search=i.search.replace(`?${u}=`,`?${u}`).replace(`&${u}=`,`&${u}`)}}e.removeTrailingSlash&&(i.pathname=i.pathname.replace(/\/$/,"")),e.removeExplicitPort&&i.port&&(i.port="");let o=t;return t=i.toString(),!e.removeSingleSlash&&i.pathname==="/"&&!o.endsWith("/")&&i.hash===""&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||i.pathname==="/")&&i.hash===""&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}var d2=require("node:stream");function IP(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e.toLowerCase(),r]))}var rp=class extends d2.Readable{statusCode;headers;body;url;complete;constructor({statusCode:e,headers:r,body:n,url:i}){if(typeof e!="number")throw new TypeError("Argument `statusCode` should be a number");if(typeof r!="object")throw new TypeError("Argument `headers` should be an object");if(!(n instanceof Uint8Array))throw new TypeError("Argument `body` should be a buffer");if(typeof i!="string")throw new TypeError("Argument `url` should be a string");let o=!1;super({read(){if(!o){o=!0,this.push(n);return}this.push(null)}}),this.statusCode=e,this.headers=IP(r),this.body=n,this.url=i,this.complete=!0}};var qv=class extends Error{constructor(e){super(e.message),Object.defineProperties(this,Object.getOwnPropertyDescriptors(e))}},Qo=class extends Error{constructor(e){super(e.message),Object.defineProperties(this,Object.getOwnPropertyDescriptors(e))}};var PP=class{constructor(e,r){this.cache=new wh({namespace:"cacheable-request"}),this.hooks=new Map,this.request=()=>(n,i)=>{let o;if(typeof n=="string")o=CP(f2(n)),n={};else if(n instanceof _h.default.URL)o=CP(f2(n.toString())),n={};else{let[d,...f]=(n.path??"").split("?"),h=f.length>0?`?${f.join("?")}`:"";o=CP({...n,pathname:d,search:h})}n={headers:{},method:"GET",cache:!0,strictTtl:!1,automaticFailover:!1,...n,...Pie(o)},n.headers=Object.fromEntries(Cie(n.headers).map(([d,f])=>[d.toLowerCase(),f]));let s=new m2.default,a=xP(_h.default.format(o),{stripWWW:!1,removeTrailingSlash:!1,stripAuthentication:!1}),c=`${n.method}:${a}`;n.body&&n.method!==void 0&&["POST","PATCH","PUT"].includes(n.method)&&(n.body instanceof Vv.default.Readable?n.cache=!1:c+=`:${h2.default.createHash("md5").update(n.body).digest("hex")}`);let u=!1,l=!1,p=d=>{l=!0;let f=!1,h=()=>{},m=new Promise(C=>{h=()=>{f||(f=!0,C())}}),x=async C=>{if(u){C.status=C.statusCode;let y=$v.default.fromObject(u.cachePolicy),T=y.revalidatedPolicy(d,C);if(!T.modified){C.resume(),await new Promise(A=>{C.once("end",A)});let E=TP(T.policy.responseHeaders()),M=TP(y.responseHeaders()),k=["content-encoding","content-type","content-length","content-language","content-location","etag"];for(let A of k)M[A]!==void 0&&E[A]===void 0&&(E[A]=M[A]);C=new rp({statusCode:u.statusCode,headers:E,body:u.body,url:u.url}),C.cachePolicy=T.policy,C.fromCache=!0}}C.fromCache||(C.cachePolicy=new $v.default(d,C,d),C.fromCache=!1);let O;d.cache&&C.cachePolicy.storable()?(O=Tie(C),(async()=>{try{let y=Wv(C);await Promise.race([m,new Promise(k=>C.once("end",k)),new Promise(k=>C.once("close",k))]);let T=await y,E={url:C.url,statusCode:C.fromCache?u.statusCode:C.statusCode,body:T,cachePolicy:C.cachePolicy.toObject()},M=d.strictTtl?C.cachePolicy.timeToLive():void 0;if(d.maxTtl&&(M=M?Math.min(M,d.maxTtl):d.maxTtl),this.hooks.size>0)for(let k of this.hooks.keys())E=await this.runHook(k,E,C);await this.cache.set(c,E,M);}catch(y){s.emit("error",new Qo(y));}})()):d.cache&&u&&(async()=>{try{await this.cache.delete(c);}catch(y){s.emit("error",new Qo(y));}})(),s.emit("response",O??C),typeof i=="function"&&i(O??C)};try{let C=this.cacheRequest(d,x);C.once("error",h),C.once("abort",h),C.once("destroy",h),s.emit("request",C)}catch(C){s.emit("error",new qv(C))}};return(async()=>{let d=async h=>{await Promise.resolve();let m=h.cache?await this.cache.get(c):void 0;if(m===void 0&&!h.forceRefresh){p(h);return}let x=$v.default.fromObject(m.cachePolicy);if(x.satisfiesWithoutRevalidation(h)&&!h.forceRefresh){let C=TP(x.responseHeaders()),O=m.body,y=Buffer.from(O),T=new rp({statusCode:m.statusCode,headers:C,body:y,url:m.url});T.cachePolicy=x,T.fromCache=!0,s.emit("response",T),typeof i=="function"&&i(T)}else x.satisfiesWithoutRevalidation(h)&&Date.now()>=x.timeToLive()&&h.forceRefresh?(await this.cache.delete(c),h.headers=x.revalidationHeaders(h),p(h)):(u=m,h.headers=x.revalidationHeaders(h),p(h))},f=h=>s.emit("error",new Qo(h));if(this.cache instanceof wh){let h=this.cache;h.once("error",f),s.on("error",()=>{h.removeListener("error",f)}),s.on("response",()=>{h.removeListener("error",f)})}try{await d(n)}catch(h){n.automaticFailover&&!l&&p(n),s.emit("error",new Qo(h))}})(),s},this.addHook=(n,i)=>{this.hooks.has(n)||this.hooks.set(n,i)},this.removeHook=n=>this.hooks.delete(n),this.getHook=n=>this.hooks.get(n),this.runHook=async(n,...i)=>this.hooks.get(n)?.(...i),r&&(r instanceof wh?this.cache=r:this.cache=new wh({store:r,namespace:"cacheable-request"})),this.request=this.request.bind(this),this.cacheRequest=e}},Cie=Object.entries,Tie=t=>{let e=new Vv.PassThrough({autoDestroy:!1});return Sh(t,e),t.pipe(e)},Pie=t=>{let e={...t};return e.path=`${t.pathname||"/"}${t.search||""}`,delete e.pathname,delete e.search,e},CP=t=>({protocol:t.protocol,auth:t.auth,hostname:t.hostname||t.host||"localhost",port:t.port,pathname:t.pathname,search:t.search}),TP=t=>{let e=[];for(let r of Object.keys(t))e[r.toLowerCase()]=t[r];return e},f2=t=>{let e=new _h.URL(t);return{protocol:e.protocol,slashes:!0,auth:e.username||e.password?`${e.username}:${e.password}`:void 0,host:e.host,port:e.port,hostname:e.hostname,hash:e.hash,search:e.search,query:Object.fromEntries(e.searchParams),pathname:e.pathname,path:e.pathname+e.search,href:e.href}},g2=PP;var Gv=require("node:stream"),np=v(require("node:zlib"),1);var Eie=typeof np.default.createZstdDecompress=="function";function EP(t){let e=(t.headers["content-encoding"]||"").toLowerCase(),r=["gzip","deflate","br"];if(Eie&&r.push("zstd"),!r.includes(e))return t;let n=!0,i={...t.headers},o=new Gv.PassThrough({autoDestroy:!1});o.once("error",()=>{t.destroy()});function s(c){let u;e==="zstd"?u=np.default.createZstdDecompress():e==="br"?u=np.default.createBrotliDecompress():e==="deflate"&&c.length>0&&(c[0]&8)===0?u=np.default.createInflateRaw():u=np.default.createUnzip(),u.once("error",l=>{if(n&&!t.readable){o.end();return}o.destroy(l)}),a.pipe(u).pipe(o)}let a=new Gv.Transform({transform(c,u,l){if(n===!1){l(null,c);return}n=!1,s(c),l(null,c)},flush(c){n&&o.end(),c()}});return delete i["content-encoding"],delete i["content-length"],o.headers=i,Sh(t,o),t.pipe(a),o}var b2=require("node:events"),v2=require("node:util");function kie(t){return"encrypted"in t}var Rie=(t,e)=>{let r=typeof e=="function"?{connect:e}:e,n=()=>{r.connect?.(),kie(t)&&r.secureConnect&&(t.authorized?r.secureConnect():t.once("secureConnect",r.secureConnect)),r.close&&t.once("close",r.close)};if(t.writable&&!t.connecting)n();else if(t.connecting)t.once("connect",n);else if(t.destroyed&&r.close){let i="_hadError"in t?!!t._hadError:!1;r.close(i)}},y2=Rie;var kP=t=>Reflect.get(t,"__initial_connection_timings__"),Aie=(t,e)=>{Reflect.set(t,"__initial_connection_timings__",e)},Die=t=>{if(t.timings)return t.timings;let e={start:Date.now(),socket:void 0,lookup:void 0,connect:void 0,secureConnect:void 0,upload:void 0,response:void 0,end:void 0,error:void 0,abort:void 0,phases:{wait:void 0,dns:void 0,tcp:void 0,tls:void 0,request:void 0,firstByte:void 0,download:void 0,total:void 0}};t.timings=e;let r=s=>{s.once(b2.errorMonitor,()=>{e.error=Date.now(),e.phases.total=e.error-e.start})};r(t);let n=()=>{e.abort=Date.now(),e.phases.total=e.abort-e.start};t.prependOnceListener("abort",n);let i=s=>{if(e.socket=Date.now(),e.phases.wait=e.socket-e.start,v2.types.isProxy(s))return;if(s.writable&&!s.connecting){e.lookup=e.socket,e.connect=e.socket;let u=kP(s);u?(e.phases.dns=u.dnsPhase,e.phases.tcp=u.tcpPhase,e.phases.tls=u.tlsPhase,e.phases.tls!==void 0&&(e.secureConnect=e.socket)):(e.phases.dns=0,e.phases.tcp=0);return}let c=()=>{e.lookup=Date.now(),e.phases.dns=e.lookup-e.socket};s.prependOnceListener("lookup",c),y2(s,{connect(){e.connect=Date.now(),e.lookup===void 0&&(s.removeListener("lookup",c),e.lookup=e.socket,e.phases.dns=0),e.phases.tcp=e.connect-e.lookup,e.phases.tcp===0&&e.phases.dns&&e.phases.dns>0&&(e.phases.dns=0),kP(s)||Aie(s,{dnsPhase:e.phases.dns,tcpPhase:e.phases.tcp})},secureConnect(){e.secureConnect=Date.now(),e.phases.tls=e.secureConnect-e.connect;let u=kP(s);u&&(u.tlsPhase=e.phases.tls)}})};t.socket?i(t.socket):t.prependOnceListener("socket",i);let o=()=>{e.upload=Date.now();let s=e.secureConnect??e.connect;s!==void 0&&(e.phases.request=e.upload-s)};return t.writableFinished?o():t.prependOnceListener("finish",o),t.prependOnceListener("response",s=>{e.response=Date.now(),e.phases.firstByte=e.response-e.upload,s.timings=e,r(s),s.prependOnceListener("end",()=>{t.off("abort",n),s.off("aborted",n),e.phases.total===void 0&&(e.end=Date.now(),e.phases.download=e.end-e.response,e.phases.total=e.end-e.start)}),s.prependOnceListener("aborted",n)}),e},w2=Die;function RP(t,e){if(e&&"content-length"in e)return Number(e["content-length"]);if(!t)return 0;if(w.string(t))return Bc(t).byteLength;if(w.buffer(t))return t.length;if(w.typedArray(t))return t.byteLength}function xh(t,e,r){let n=new Map;for(let i of r){let o=(...s)=>{e.emit(i,...s)};n.set(i,o),t.on(i,o)}return()=>{for(let[i,o]of n)t.off(i,o)}}var _2=v(require("node:net"),1);function AP(){let t=[];return{once(e,r,n){e.once(r,n),t.push({origin:e,event:r,fn:n})},unhandleAll(){for(let{origin:e,event:r,fn:n}of t)e.removeListener(r,n);t.length=0}}}var S2=Symbol("reentry"),Oie=()=>{},gn=class extends Error{name="TimeoutError";code="ETIMEDOUT";event;constructor(e,r){super(`Timeout awaiting '${r}' for ${e}ms`),this.event=r}};function DP(t,e,r){if(S2 in t)return Oie;t[S2]=!0;let n=[],{once:i,unhandleAll:o}=AP(),s=new Set,a=(x,C,O)=>{let y=setTimeout(C,x,x,O);y.unref();let T=()=>{s.add(O),clearTimeout(y)};return n.push(T),T},{host:c,hostname:u}=r,l=(x,C)=>{setTimeout(()=>{s.has(C)||t.destroy(new gn(x,C))},0)},p=()=>{for(let x of n)x();o()};if(t.once("error",x=>{if(p(),t.listenerCount("error")===0)throw x}),e.request!==void 0){let x=a(e.request,l,"request");i(t,"response",C=>{i(C,"end",x)})}if(e.socket!==void 0){let{socket:x}=e,C=()=>{l(x,"socket")};t.setTimeout(x,C),n.push(()=>{t.removeListener("timeout",C)})}let d=e.lookup!==void 0,f=e.connect!==void 0,h=e.secureConnect!==void 0,m=e.send!==void 0;return(d||f||h||m)&&i(t,"socket",x=>{let{socketPath:C}=t;if(x.connecting){let O=!!(C??_2.default.isIP(u??c??"")!==0);if(d&&!O&&x.address().address===void 0){let y=a(e.lookup,l,"lookup");i(x,"lookup",y)}if(f){let y=()=>a(e.connect,l,"connect");O?i(x,"connect",y()):i(x,"lookup",T=>{T===null&&i(x,"connect",y())})}h&&r.protocol==="https:"&&i(x,"connect",()=>{let y=a(e.secureConnect,l,"secureConnect");i(x,"secureConnect",y)})}if(m){let O=()=>a(e.send,l,"send");x.connecting?i(x,"connect",()=>{i(t,"upload-complete",O())}):i(t,"upload-complete",O())}}),e.response!==void 0&&i(t,"upload-complete",()=>{let x=a(e.response,l,"response");i(t,"response",x)}),e.read!==void 0&&i(t,"response",x=>{let C=a(e.read,l,"read");i(x,"end",C)}),p}var Ih=class{weakMap=new WeakMap;map=new Map;set(e,r){typeof e=="object"?this.weakMap.set(e,r):this.map.set(e,r)}get(e){return typeof e=="object"?this.weakMap.get(e):this.map.get(e)}has(e){return typeof e=="object"?this.weakMap.has(e):this.map.has(e)}};var Lie=({attemptCount:t,retryOptions:e,error:r,retryAfter:n,computedValue:i})=>{if(r.name==="RetryError")return 1;if(t>e.limit)return 0;let o=e.methods.includes(r.options.method),s=e.errorCodes.includes(r.code),a=r.response&&e.statusCodes.includes(r.response.statusCode);if(!o||!s&&!a)return 0;if(r.response){if(n)return n>i?0:n;if(r.response.statusCode===413)return 0}let c=Math.random()*e.noise;return Math.min(2**(t-1)*1e3,e.backoffLimit)+c},x2=Lie;var Fc=require("node:util"),oW=require("node:tls"),sW=v(require("node:https"),1),aW=v(require("node:http"),1);function zv(t,{onConflict:e}={}){if(typeof t!="object"||t===null)throw new TypeError(`Expected an object, got ${t===null?"null":typeof t}`);let r={};for(let[n,i]of Object.entries(t)){let o=n.toLowerCase(),s=Object.hasOwn(r,o),a=s?r[o]:void 0,c=e&&s?e({key:o,newValue:i,existingValue:a}):i;Object.defineProperty(r,o,{value:c,writable:!0,enumerable:!0,configurable:!0})}return r}var I2=(t,e)=>{let r=[],n="",i=!1,o=!1,s=!1;for(let a of t){if(i&&s){n+=a,s=!1;continue}if(i&&a==="\\"){n+=a,s=!0;continue}if(a==='"'){i=!i,n+=a;continue}if(!i&&a==="<"){o=!0,n+=a;continue}if(!i&&a===">"){o=!1,n+=a;continue}if(!i&&!o&&a===e){r.push(n),n="";continue}n+=a}if(i)throw new Error(`Failed to parse Link header: ${t}`);return r.push(n),r};function OP(t){let e=[],r=I2(t,",");for(let n of r){let[i,...o]=I2(n,";"),s=i.trim();if(s[0]!=="<"||s.at(-1)!==">")throw new Error(`Invalid format of the Link header reference: ${s}`);let a=s.slice(1,-1),c={};if(a.includes("<")||a.includes(">"))throw new Error(`Invalid format of the Link header reference: ${s}`);if(o.length===0)throw new Error(`Unexpected end of Link header parameters: ${o.join(";")}`);for(let u of o){let l=u.trim(),p=l.indexOf("=");if(p===-1)throw new Error(`Failed to parse Link header: ${t}`);let d=l.slice(0,p).trim(),f=l.slice(p+1).trim();c[d]=f}e.push({reference:a,parameters:c})}return e}function Nie(t){return t.protocol==="unix:"||t.hostname==="unix"}function ia(t){if(Nie(t))return new RegExp("^(?<socketPath>[^:]+):","v").exec(`${t.pathname}${t.search}`)?.groups?.socketPath}var ur=require("node:dns"),D2=require("node:net"),O2=v(require("node:os"),1),L2=require("node:util"),C2={ttl:!0},Mie=new Set(["ENODATA","ENOTFOUND","ENOENT"]),T2=Math.floor(2147483647/1e3),Kv=t=>typeof t?.then=="function",Zo=()=>Date.now(),P2=(t,e)=>{let r=t.get(e);return r===void 0?!1:r<=Zo()?(t.delete(e),!1):!0},E2=(t,e=Zo())=>{for(let[r,n]of t)n<=e&&t.delete(r)},oa=(t,e)=>t!==void 0&&(t&e)===e,N2=()=>{let t=!1,e=!1;for(let r of Object.values(O2.default.networkInterfaces()))if(r!==void 0){for(let n of r)if(!n.internal&&(n.family==="IPv6"?e=!0:t=!0,t&&e))return{has4:t,has6:e}}return{has4:t,has6:e}},Bie=t=>{let e=new Error(`DNS cache lookup ENOTFOUND ${t}`);return e.code="ENOTFOUND",e.hostname=t,e},k2=t=>typeof t=="number"?{family:t}:t??{},Fie=(t,e,r)=>{let n=Math.min(t.ttl,r);return{address:t.address,family:e,expires:Zo()+n*1e3}},Uie=t=>t.map(e=>e.family===6?e:{...e,address:`::ffff:${e.address}`,family:6}),Jv=t=>{if(t.family===4||t.family===6)return t.family;if(t.family==="IPv4")return 4;if(t.family==="IPv6")return 6},M2=t=>t.order!==void 0?t.order:t.verbatim!==void 0?t.verbatim?"verbatim":"ipv4first":(0,ur.getDefaultResultOrder)(),jie=t=>{let e=Jv(t);return e===6&&oa(t.hints,ur.V4MAPPED)&&oa(t.hints,ur.ALL)?[6,4]:e!==void 0?[e]:M2(t)==="ipv6first"?[6,4]:[4,6]},R2=(t,e)=>{if(!oa(e.hints,ur.ADDRCONFIG))return t;let r=N2();return t.filter(n=>n===6?r.has6:r.has4)},Wie=(t,e)=>Jv(e)===6&&oa(e.hints,ur.V4MAPPED)&&!oa(e.hints,ur.ALL)&&t.every(r=>r.family!==6),LP=(t,e)=>`${t}:${e}`,Hie=(t,e)=>`${t}:${Jv(e)??0}:${e.hints??0}:${M2(e)}`,A2=t=>t.code!==void 0&&Mie.has(t.code),qie=({address:t,family:e})=>({address:t,family:e}),Ch=class{lookup;#e;#o;#t;#r=new Set;#i=new Map;#n=new Map;#s=new Map;#a=new Map;#p;#d;#c;#f=new Map;#l=new Map;#m=0;#h=0;constructor({cache:e=new Map,maxTtl:r=T2,fallbackDuration:n=3600,errorTtl:i=.15,resolver:o=new ur.promises.Resolver,lookup:s=ur.lookup}={}){this.#e=e,this.#o=o,this.#p=Math.min(r,T2),this.#d=n,this.#c=i,this.#t=s===!1?void 0:(0,L2.promisify)(s),this.lookup=this.#S.bind(this)}async lookupAsync(e,r){let n=k2(r),i=(0,D2.isIP)(e);if(i!==0){let a=[{address:e,family:i}];return n.all?a:a[0]}let o=await this.#x(e,n);if(o=this.#A(o,n),o.length===0)throw Bie(e);let s=o.map(a=>qie(a));return n.all?s:s[0]}clear(e){if(this.#h++,e===void 0){this.#m=this.#h,this.#f.clear();for(let r of this.#r)this.#e.delete(r);this.#r.clear(),this.#i.clear(),this.#n.clear(),this.#s.clear(),this.#a.clear();return}for(let r of[4,6]){let n=LP(e,r);this.#e.delete(n),this.#r.delete(n),this.#i.delete(n)}this.#l.has(e)&&this.#f.set(e,this.#h);for(let r of this.#n.keys())r.startsWith(`${e}:`)&&this.#n.delete(r);for(let r of this.#s.keys())r.startsWith(`${e}:`)&&this.#s.delete(r);for(let r of this.#a.keys())r.startsWith(`${e}:`)&&this.#a.delete(r)}#S(e,r,n){if(typeof r=="function"&&(n=r,r={}),n===void 0)throw new Error("Callback must be a function.");let i=k2(r);this.#_(e,i,n)}async#_(e,r,n){let i;try{i=await this.lookupAsync(e,r)}catch(o){queueMicrotask(()=>{n(o)});return}queueMicrotask(()=>{if(r.all){n(null,i);return}let o=i;n(null,o.address,o.family)})}async#x(e,r){this.#l.set(e,(this.#l.get(e)??0)+1);try{let n=Hie(e,r);if(P2(this.#s,n))return await this.#w(e,r,n);let i=R2(jie(r),r),o=this.#h,s=await this.#g(e,i,o);if(Wie(s,r)&&!i.includes(4)&&(i=R2([4],r),s=await this.#g(e,i,o)),s.length>0||this.#t===void 0)return s;if(P2(this.#a,n))return[];let a=await this.#w(e,r,n);return this.#u(e,o)&&(this.#C(),a.length>0&&this.#d>0?this.#s.set(n,Zo()+this.#d*1e3):a.length===0&&this.#c>0&&this.#a.set(n,Zo()+this.#c*1e3)),a}finally{this.#I(e)}}#I(e){let r=this.#l.get(e);if(r!==void 0){if(r>1){this.#l.set(e,r-1);return}this.#l.delete(e),this.#f.delete(e)}}#C(){let e=Zo();E2(this.#s,e),E2(this.#a,e)}async#g(e,r,n){if(r.length===1)return this.#y(e,r[0],n);let i=await Promise.allSettled(r.map(a=>this.#y(e,a,n))),o=i.flatMap(a=>a.status==="fulfilled"?a.value:[]);if(o.length>0)return o;let s=i.find(a=>a.status==="rejected");if(s!==void 0)throw s.reason instanceof Error?s.reason:new Error(String(s.reason));return[]}async#y(e,r,n){let i=LP(e,r),o=await this.#T(i,e);if(o!==void 0)return o.entries;if(!this.#u(e,n))return this.#b(e,r,n);let s=this.#i.get(i);if(s!==void 0)return s;let a=this.#b(e,r,n);this.#i.set(i,a);try{return await a}finally{this.#i.get(i)===a&&this.#i.delete(i)}}async#T(e,r){let n=this.#e.get(e);if(Kv(n)&&(n=await n),n!==void 0&&this.#u(r,n.clearVersion)){if(n.expires<=Zo()){this.#e.delete(e),this.#r.delete(e);return}return n}}async#b(e,r,n){let i=await this.#k(e,r),o=this.#R(i),s=LP(e,r);return this.#u(e,n)&&(o!==void 0?await this.#v(s,e,{entries:i,expires:o},n):i.length===0&&this.#c>0&&await this.#v(s,e,{entries:i,expires:Zo()+this.#c*1e3},n)),i}async#v(e,r,n,i){if(!this.#u(r,i)||(await this.#P(),await this.#e.set(e,{...n,clearVersion:i}),this.#r.add(e),this.#u(r,i)))return;let o=this.#e.get(e);Kv(o)&&(o=await o),o?.clearVersion===i&&!this.#u(r,o.clearVersion)&&(this.#e.delete(e),this.#r.delete(e))}async#P(){let e=Zo();await Promise.all([...this.#r].map(async r=>this.#E(r,e)))}async#E(e,r){let n=this.#e.get(e);if(Kv(n)&&(n=await n),n===void 0){this.#r.delete(e);return}if(n.expires>r)return;let i=this.#e.get(e);Kv(i)&&(i=await i),i?.clearVersion===n.clearVersion&&i.expires===n.expires&&(this.#e.delete(e),this.#r.delete(e))}#u(e,r){let n=this.#f.get(e)??this.#m;return r>=n}async#k(e,r){try{return(r===4?await this.#o.resolve4(e,C2):await this.#o.resolve6(e,C2)).map(i=>Fie(i,r,this.#p))}catch(n){if(A2(n))return[];throw n}}#R(e){let r=Number.POSITIVE_INFINITY;for(let n of e)n.expires!==void 0&&(r=Math.min(r,n.expires));return r===Number.POSITIVE_INFINITY?void 0:r}#A(e,r){if(oa(r.hints,ur.ADDRCONFIG)){let i=N2();e=e.filter(o=>o.family===6?i.has6:i.has4)}let n=Jv(r);if(n===6){let i=e.filter(o=>o.family===6);oa(r.hints,ur.V4MAPPED)?e=oa(r.hints,ur.ALL)||i.length===0?Uie(e):i:e=i}else n===4&&(e=e.filter(i=>i.family===4));return e}async#w(e,r,n){let i=this.#n.get(n);if(i!==void 0)return i;let o=this.#D(e,r);this.#n.set(n,o);try{return await o}finally{this.#n.get(n)===o&&this.#n.delete(n)}}async#D(e,r){if(this.#t===void 0)return[];let n;try{n=await this.#t(e,{...r,all:!0})}catch(i){if(A2(i))return[];throw i}return n.map(i=>({address:i.address,family:i.family}))}};var WP=require("node:buffer"),V2=require("node:events"),sa=v(require("node:http"),1),HP=v(require("node:http2"),1),qP=v(require("node:https"),1),Qv=require("node:stream"),G2=v(require("node:tls"),1),BP=require("node:url"),$P=v(require("node:net"),1);var{HTTP2_HEADER_AUTHORITY:op,HTTP2_HEADER_METHOD:z2,HTTP2_HEADER_PATH:K2,HTTP2_HEADER_SCHEME:J2,HTTP2_HEADER_STATUS:B2,HTTP2_METHOD_CONNECT:NP,NGHTTP2_CANCEL:$ie}=HP.default.constants,Vie=100,ip=new Map,F2=new WeakMap,Gie=0,U2=new Set(["connection","http2-settings","keep-alive","proxy-connection","transfer-encoding","upgrade"]),Xv=t=>t.toLowerCase()==="host"?op:t.toLowerCase(),j2=t=>{if(t===void 0)return[];let e=Array.isArray(t)?t:[t],r=[];for(let n of e)for(let i of String(n).split(",")){let o=i.trim().toLowerCase();o.length>0&&r.push(o)}return r},W2=t=>t===void 0?!0:Array.isArray(t)?t.length===1&&t[0].toLowerCase()==="trailers":String(t).trim().toLowerCase()==="trailers",zie=(t,e)=>{!ip.has(t)&&ip.size>=Vie&&ip.delete(ip.keys().next().value),ip.set(t,e)},H2=t=>{let e=F2.get(t);return e===void 0&&(e=Gie++,F2.set(t,e)),e},Kie=t=>{let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},FP=t=>t===void 0?["undefined"]:t===null?["null"]:typeof t=="function"?["function",H2(t)]:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?[typeof t,t]:typeof t=="bigint"?["bigint",t.toString()]:typeof t=="symbol"?["symbol",t.description]:Array.isArray(t)?["array",t.map(e=>FP(e))]:typeof t=="object"?ArrayBuffer.isView(t)?["bytes",WP.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64")]:Kie(t)?["object",Object.entries(t).sort(([e],[r])=>e.localeCompare(r)).map(([e,r])=>[e,FP(r)])]:["object-reference",H2(t)]:[typeof t],X2=t=>JSON.stringify(t.map(e=>FP(e))),Y2=t=>[t.ca,t.cert,t.key,t.pfx,t.rejectUnauthorized,t.servername,t.localAddress,t.lookup,t.family,t.minVersion,t.maxVersion,t.ciphers,t.honorCipherOrder,t.checkServerIdentity,t.passphrase,t.sigalgs,t.sessionTimeout,t.dhparam,t.ecdhCurve,t.crl,t.secureOptions,t.secureContext,t.secureProtocol],Yv=t=>{t._reuseSocket?.destroy(),delete t._reuseSocket,delete t._reuseSocketShouldPool},Q2=(t,e,r)=>{let n;return typeof t=="string"?n=(0,BP.urlToHttpOptions)(new URL(t)):t instanceof URL?n=(0,BP.urlToHttpOptions)(t):n={...t},typeof e=="function"||e===void 0?r=e:n={...n,...e},{options:n,callback:r}},VP=t=>{let e=t.protocol??"https:",r=e==="https:"?443:80;if(t.hostname===void 0&&t.host!==void 0)try{let u=new URL(`${e}//${t.host}`),l=t.port??u.port;return u.port=String(l===""?r:l),u}catch{}let n=t.hostname??t.host??"localhost",i=t.port??r,o=String(n),s=o.startsWith("[")&&o.endsWith("]")?o.slice(1,-1):o,a=$P.default.isIP(s)===6?`[${s}]`:s,c=new URL(`${e}//${a}`);return c.port=String(i),c},Jie=t=>t.port!==""?Number(t.port):t.protocol==="https:"?443:80,Xie=t=>{let{hostname:e}=t;return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e},Yie=t=>typeof t=="object"&&"https"in t&&t.https!==void 0&&t.https!==!1,Qie=t=>{let e=VP(t),r=(t.ALPNProtocols??["h2","http/1.1"]).join(",");return X2([e.host,r,...Y2(t)])},Zie=async(t,e)=>{let r=Qie(t),n=t.createConnection?void 0:ip.get(r);if(n!==void 0)return{alpnProtocol:n};let i=VP(t),{path:o,agent:s,h2session:a,_reuseSocket:c,_reuseSocketShouldPool:u,_alpnSocket:l,_socketTimeout:p,timeout:d,createConnection:f,checkServerIdentity:h,...m}=t,x=Jie(i),C=Xie(i),O=t.servername??($P.default.isIP(C)===0?C:void 0),y={...m,ALPNProtocols:t.ALPNProtocols??["h2","http/1.1"],host:C,port:x,servername:O};h&&(y.checkServerIdentity=h);let T=f?f(y,()=>{}):G2.default.connect(x,C,y);return t._alpnSocket=T,e._alpnSocket=T,new Promise((E,M)=>{let k=!1,A,W,Z=!1,_=()=>{A&&clearTimeout(A),W?.(),T.off("secureConnect",F),T.off("error",G),T.off("close",K),T.off("connect",pe),T.off("timeout",S),Z&&T.setTimeout(0),delete t._alpnSocket,delete e._alpnSocket},B=ue=>{k||(k=!0,_(),T.destroy(),M(ue))},F=()=>{if(k)return;k=!0,_();let ue=T.alpnProtocol??!1;t.createConnection||zie(r,ue),E({alpnProtocol:ue,socket:T})},G=ue=>{B(ue)},b=()=>{B(new gn(Number(d),"request"))},S=()=>{B(new gn(p,"socket"))},pe=()=>{Z=!0,T.setTimeout(p),T.once("timeout",S)},K=()=>{let ue=new Error("The HTTP/2 ALPN socket closed before negotiation completed");ue.code="ECONNRESET",B(ue)},Se=()=>{let ue=new Error("This operation was aborted.");ue.name="AbortError",ue.code="ERR_ABORTED",B(ue)};if(t.signal?.aborted){Se();return}T.once("secureConnect",F),T.once("error",G),T.once("close",K),p!==void 0&&(T.connecting?T.once("connect",pe):pe()),t.signal&&(t.signal.addEventListener("abort",Se,{once:!0}),W=()=>{t.signal?.removeEventListener("abort",Se)}),d!==void 0&&(A=setTimeout(b,Number(d)),A.unref())})},MP=t=>{let e=[];for(let[r,n]of Object.entries(t))if(!(r.startsWith(":")||n===void 0))if(Array.isArray(n))for(let i of n)e.push(r,i);else e.push(r,String(n));return e},q2=t=>{let e=[];for(let r=0;r<t.length;r+=2){let n=t[r];n.startsWith(":")||e.push(n,t[r+1])}return e},$2=t=>{let e={};for(let[r,n]of Object.entries(t))r.startsWith(":")||n===void 0||(e[r]=n);return e},eoe=t=>new Proxy(t.session.socket,{get(e,r,n){return r==="destroy"?t.destroy.bind(t):r==="destroyed"?t.destroyed:r==="setTimeout"?t.setTimeout.bind(t):Reflect.get(e,r,n)}}),UP=class extends Qv.Readable{stream;req;constructor(e,r,n){super({autoDestroy:!0,emitClose:!1,highWaterMark:n}),this.stream=e,this.req=r,this.socket=r.socket}aborted=!1;httpVersion="2.0";httpVersionMajor=2;httpVersionMinor=0;complete=!1;rawHeaders=[];rawTrailers=[];headers={};trailers={};statusCode;statusMessage;socket;url="";method;upgrade=!1;get connection(){return this.socket}set connection(e){this.socket=e}setTimeout(e,r){return this.req.setTimeout(e,r),this}_destroy(e,r){this.readableEnded||(this.aborted=!0),this.stream.destroy(e??void 0),r()}_read(){this.stream.resume()}_dump(){this.removeAllListeners("data"),this.resume()}},Th=class extends V2.EventEmitter{timeout;maxSessions;maxEmptySessions;sessions=new Map;pendingSessions=new Set;pendingSessionKeys=new Set;queue=[];emptySessionCount=0;sessionCount=0;settings={enablePush:!1,initialWindowSize:1024*1024*32};constructor({timeout:e=0,maxSessions:r=Number.POSITIVE_INFINITY,maxEmptySessions:n=10}={}){super(),this.timeout=e,this.maxSessions=r,this.maxEmptySessions=n}get protocol(){return"https:"}async request(e,r,n,i){let{session:o,reusedSocket:s}=await this.getSessionWithMetadata(e,r,!0);return{stream:o.request(n,i),reusedSocket:s}}async getSession(e,r={}){let{session:n}=await this.getSessionWithMetadata(e,r);return n}async getSessionWithMetadata(e,r={},n=!1){let i=typeof e=="string"?new URL(e):e,o=this.normalizeOptions(i,r),a=r._reuseSocket===void 0||r._reuseSocketShouldPool===!0?this.getAvailableSession(o):void 0;return a?(n&&this.reserveStream(a),Yv(r),{session:a,reusedSocket:!0}):new Promise((c,u)=>{let l={origin:i,options:r,reserveStream:n,resolve:c,reject:u};r._cancelSessionSetup=()=>{let p=this.queue.indexOf(l);p!==-1&&(this.queue.splice(p,1),delete r._cancelSessionSetup,Yv(r),u(new Error("HTTP/2 session setup canceled")))},this.queue.push(l),this.processQueue()})}normalizeOptions(e,r={}){return X2([e.origin,...Y2(r)])}closeEmptySessions(e=Number.POSITIVE_INFINITY){let r=0;for(let n of this.sessions.values())for(let i of n)if((i.currentStreamCount??0)===0&&(r++,i.close(),r>=e))return r;return r}destroy(e){for(let r of this.sessions.values())for(let n of r)n.destroy(e);for(let r of this.pendingSessions)r.destroy(e);for(this.sessions.clear(),this.pendingSessionKeys.clear();this.queue.length>0;){let r=this.queue.shift();delete r.options._cancelSessionSetup,Yv(r.options),r.reject(e??new Error("Agent has been destroyed"))}}getAvailableSession(e){let r=this.sessions.get(e);if(r)return r.find(n=>!n.destroyed&&!n.closed&&!n.gracefullyClosing&&(n.currentStreamCount??0)<(n.remoteSettings.maxConcurrentStreams??100))}processQueue(){let e=0;for(;e<this.queue.length;){let r=this.queue[e],n=this.normalizeOptions(r.origin,r.options),i=r.options._reuseSocket===void 0||r.options._reuseSocketShouldPool===!0,o=i?this.getAvailableSession(n):void 0;if(o){this.queue.splice(e,1),delete r.options._cancelSessionSetup,r.reserveStream&&this.reserveStream(o),Yv(r.options),r.resolve({session:o,reusedSocket:!0});continue}if(i&&this.pendingSessionKeys.has(n)){e++;continue}if(this.sessionCount>=this.maxSessions&&(this.closeEmptySessions(this.sessionCount-this.maxSessions+1),this.sessionCount>=this.maxSessions)){e++;continue}this.queue.splice(e,1),i&&this.pendingSessionKeys.add(n),this.createSession(r,n)}}reserveStream(e){e.ref(),e.currentStreamCount===0&&e.emptySessionCounted&&(this.emptySessionCount--,e.emptySessionCounted=!1),e.currentStreamCount=(e.currentStreamCount??0)+1,e.reservedStreamCount=(e.reservedStreamCount??0)+1}releaseStream(e,r){if(e.currentStreamCount=e.currentStreamCount-1,e.currentStreamCount===0){if(!r){e.close(),this.processQueue();return}if(this.emptySessionCount++,e.emptySessionCounted=!0,e.unref(),this.emptySessionCount>this.maxEmptySessions||e.gracefullyClosing){e.close();return}}this.processQueue()}createSession(e,r){this.sessionCount++;let{path:n,agent:i,h2session:o,_reuseSocketShouldPool:s,_socketTimeout:a,timeout:c,...u}=e.options,l={...u,settings:e.options.settings??this.settings,ALPNProtocols:["h2"]},p=l._reuseSocket,d=p===void 0||s===!0;l._reuseSocket&&(l.createConnection=()=>p,delete l._reuseSocket);let f;try{f=HP.default.connect(e.origin,l)}catch(_){this.sessionCount--,this.pendingSessionKeys.delete(r),delete e.options._cancelSessionSetup,p?.destroy(),e.reject(_),this.processQueue();return}this.pendingSessions.add(f),f.currentStreamCount=0,f.reservedStreamCount=0,f.emptySessionCounted=!1,f.gracefullyClosing=!1;let h=!1,m,x=!1,C=f.socket,O=C.removeListener.bind(C),y=()=>{m&&(clearTimeout(m),m=void 0)},T=()=>{O("connect",A),x&&(x=!1,f.off("timeout",k),!f.closed&&!f.destroyed&&f.setTimeout(this.timeout))},E=()=>{y(),T(),this.pendingSessions.delete(f),this.pendingSessionKeys.delete(r),delete e.options._cancelSessionSetup},M=_=>{h||(h=!0,E(),e.reject(_),queueMicrotask(()=>{f.destroy(_)}))},k=()=>{M(new gn(a,"socket"))},A=()=>{x=!0,f.setTimeout(a,k)};this.timeout>0&&f.setTimeout(this.timeout,()=>{f.destroy()}),a!==void 0&&(C.connecting?C.once("connect",A):A()),c!==void 0&&(m=setTimeout(()=>{M(new gn(Number(c),"request"))},Number(c)),m.unref());let W=()=>{f.emptySessionCounted&&(this.emptySessionCount--,f.emptySessionCounted=!1);let _=this.sessions.get(r);if(_){let B=_.indexOf(f);B!==-1&&_.splice(B,1),_.length===0&&this.sessions.delete(r)}};f.once("remoteSettings",()=>{if(!h){if(h=!0,E(),d){let _=this.sessions.get(r)??[];_.push(f),this.sessions.set(r,_)}this.emit("session",f),e.reserveStream&&this.reserveStream(f),e.resolve({session:f,reusedSocket:!1}),this.processQueue()}}),f.once("error",_=>{E(),h||(h=!0,e.reject(_)),W()}),f.once("goaway",()=>{f.gracefullyClosing=!0,f.currentStreamCount===0&&f.close()}),f.once("close",()=>{E(),this.sessionCount--,h||(h=!0,e.reject(new Error("The HTTP/2 session closed before settings were received"))),W(),this.processQueue()}),e.options._cancelSessionSetup=()=>{h||(h=!0,E(),e.reject(new Error("HTTP/2 session setup canceled")),f.destroy())};let Z=f.request.bind(f);f.request=(_,B)=>{let F=(f.reservedStreamCount??0)>0;if(F&&(f.reservedStreamCount=f.reservedStreamCount-1),f.gracefullyClosing)throw F&&this.releaseStream(f,d),new Error("The session is gracefully closing. No new streams are allowed.");F||this.reserveStream(f);let G;try{G=Z(_,B)}catch(b){throw this.releaseStream(f,d),b}return G.once("close",()=>{this.releaseStream(f,d)}),G}}},jP=class extends Qv.Writable{constructor(e,r,n){super({autoDestroy:!1,emitClose:!1});let i=Q2(e,r,n);if(this.options=i.options,this.callback=i.callback,this.method=(this.options.method??"GET").toUpperCase(),this.path=this.method===NP?String(this.options.path??""):String(this.options.path??"/"),this.protocol=String(this.options.protocol??"https:"),this.headers=Object.create(null),this.protocol!=="https:"&&!this.options.h2session)throw new Error(`Protocol "${this.protocol}" not supported. Expected "https:"`);let o=this.options.headers;if(o)for(let[a,c]of Object.entries(o))this.setHeader(a,c);this.options.auth&&!this.hasHeader("authorization")&&this.setHeader("authorization",`Basic ${WP.Buffer.from(this.options.auth).toString("base64")}`),this.callback&&this.once("response",this.callback);let s=VP(this.options);this.origin=s,this.hasHeader(op)||(this.headers[op]=this.method===NP?this.path:s.host),this.headers[z2]=this.method,this.method!==NP&&(this.headers[J2]=this.protocol.slice(0,-1),this.headers[K2]=this.path)}agent;aborted=!1;reusedSocket=!1;res;socket;connection;method;path;protocol;host;headersSent=!1;maxHeadersCount;options;callback;headers;origin;stream;pendingJobs=[];pendingAgentPromise;connectionHeaderNames=new Set;trailers;get isGotHttp2Request(){return!0}_write(e,r,n){let i=()=>{this.stream.write(e,r,n)};this.stream?i():this.pendingJobs.push({run:i,cancel:n}),this.flushHeaders()}_final(e){let r=()=>{this.trailers&&this.stream.once("wantTrailers",()=>{this.stream.sendTrailers(this.trailers)}),this.stream.end(e)};this.stream?r():this.pendingJobs.push({run:r,cancel:e}),this.flushHeaders()}_destroy(e,r){this.res&&typeof this.res._dump=="function"&&this.res._dump(),this.stream?this.stream.close($ie):(this.options._cancelSessionSetup?.(),e===null&&queueMicrotask(()=>{this.emit("close")})),this.pendingAgentPromise&&this.pendingAgentPromise.catch(()=>{}),this.stream||this.cancelPendingJobs(e??new Error("The HTTP/2 request was destroyed before a stream was created")),r(e)}abort(){this.res?.complete||(this.aborted||queueMicrotask(()=>{this.emit("abort")}),this.aborted=!0,this.destroy())}async flushHeaders(){if(!(this.headersSent||this.destroyed)){this.headersSent=!0;try{if(this.options.h2session){this.reusedSocket=!0,this.onStream(this.options.h2session.request(this.headers,{endStream:!1,waitForTrailers:this.trailers!==void 0}));return}this.agent=this.options.agent===!1?new Th({maxEmptySessions:0}):this.options.agent??Z2;let e=this.agent.request(this.origin,this.options,this.headers,{endStream:!1,waitForTrailers:this.trailers!==void 0});this.pendingAgentPromise=e;let{stream:r,reusedSocket:n}=await e;this.reusedSocket=n,this.onStream(r),this.pendingAgentPromise=void 0}catch(e){this.pendingAgentPromise=void 0,this.destroy(e)}}}addTrailers(e){if(this.headersSent)throw new Error("Cannot add trailers after the HTTP/2 stream has been created");let r=Object.create(null),n=new Set;for(let[i,o]of Object.entries(e)){(0,sa.validateHeaderName)(i),(0,sa.validateHeaderValue)(i,o);let s=i.toLowerCase();if(s==="connection"||s==="proxy-connection"){for(let a of j2(o))n.add(a),Reflect.deleteProperty(r,a);continue}U2.has(s)||n.has(s)||s==="te"&&!W2(o)||(r[s]=o)}this.trailers=r}setHeader(e,r){if(this.headersSent)throw new Error("Cannot set headers after they are sent to the client");(0,sa.validateHeaderName)(e),(0,sa.validateHeaderValue)(e,r);let n=e.toLowerCase();if(n==="connection"||n==="proxy-connection"){for(let i of j2(r))this.connectionHeaderNames.add(i),Reflect.deleteProperty(this.headers,Xv(i));return this}return U2.has(n)?this:this.connectionHeaderNames.has(n)?this:n==="te"&&!W2(r)?this:(this.headers[Xv(e)]=r,this)}getHeader(e){return this.headers[Xv(e)]}getHeaders(){return{...this.headers}}getHeaderNames(){return Object.keys(this.headers)}hasHeader(e){return this.getHeader(e)!==void 0}removeHeader(e){if(this.headersSent)throw new Error("Cannot remove headers after they are sent to the client");Reflect.deleteProperty(this.headers,Xv(e))}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let n=()=>{this.stream.setTimeout(e,r)};return this.stream?n():this.pendingJobs.push({run:n}),this}cancelPendingJobs(e){let r=this.pendingJobs;this.pendingJobs=[];for(let n of r)n.cancel?.(e)}onStream(e){if(this.stream=e,this.socket=eoe(e),this.connection=this.socket,this.destroyed){e.destroy();return}e.once("error",r=>{this.destroyed||this.destroy(r)}),e.once("aborted",()=>{this.res?(this.res.aborted=!0,this.res.emit("aborted"),this.res.destroy()):this.destroy(new Error("The server aborted the HTTP/2 stream"))}),e.once("response",(r,n,i)=>{let o=new UP(e,this,e.readableHighWaterMark),s=o;o.statusCode=Number(r[B2]),o.headers=$2(r),o.rawHeaders=i?q2(i):MP(r),o.url=`${this.origin.origin}${this.path}`,s.req=this,this.res=s,e.on("data",a=>{o.push(a)||e.pause()}),e.once("end",()=>{this.aborted||(o.complete=!0,o.push(null))}),this.emit("response",s)||o._dump()}),e.on("headers",(r,n,i)=>{this.emit("information",{statusCode:Number(r[B2]),statusMessage:"",httpVersion:"2.0",httpVersionMajor:2,httpVersionMinor:0,headers:$2(r),rawHeaders:i?q2(i):MP(r)})}),e.once("trailers",(r,n,i)=>{this.res&&(this.res.trailers=r,this.res.rawTrailers=Array.isArray(i)?i:MP(r))}),e.once("close",()=>{if(this.res){this.aborted&&(this.res.aborted=!0,this.res.emit("aborted"),this.res.destroy());let r=()=>{this.res.emit("close"),this.destroy(),this.emit("close")};this.res.readable?this.res.once("end",r):r();return}if(!this.destroyed){this.destroy(new Error("The HTTP/2 stream has been early terminated")),queueMicrotask(()=>{this.emit("close")});return}this.destroy(),this.emit("close")});for(let r of this.pendingJobs)r.run();this.pendingJobs=[],this.emit("socket",this.socket)}},Z2=new Th,GP=(t,e,r)=>new jP(t,e,r),toe=(t,e)=>typeof t=="object"&&!(t instanceof URL)?t:typeof e=="object"?e:{},roe=(t,e,r)=>{if(typeof e=="object"&&"https"in e&&(t.agent=e.https),t.ALPNProtocols=["http/1.1"],delete t.timeout,delete t._socketTimeout,t.headers){let n={...t.headers};Reflect.deleteProperty(n,z2),Reflect.deleteProperty(n,J2),Reflect.deleteProperty(n,K2),n[op]&&!n.host&&(n.host=n[op]),Reflect.deleteProperty(n,op),t.headers=n}return qP.default.request(t,r)},noe=(t,e,r)=>(t.agent=e.https,t.ALPNProtocols=["http/1.1"],delete t.timeout,delete t._socketTimeout,qP.default.request(t,r)),ioe=(t,e,r,n)=>(t.agent=typeof e=="object"&&"http2"in e?e.http2:e,r&&(t._reuseSocket=r,t._reuseSocketShouldPool=t.createConnection===void 0),GP(t,n)),ooe=async(t,e,r)=>{let n=toe(t,e),i=Q2(t,e,r);if(e=i.options,r=i.callback,e.ALPNProtocols??=["h2","http/1.1"],e.protocol??="https:",e.h2session)return GP(e,r);if(!(e.protocol==="https:"))return e.agent=e.agent?.http,sa.default.request(e,r);let s=e.agent;if(Yie(s)&&e.createConnection===void 0)return noe(e,s,r);let{alpnProtocol:a,socket:c}=await Zie(e,n);return a==="h2"?ioe(e,s,c,r):(c?.destroy(),roe(e,s,r))},soe={Agent:Th,auto:ooe,globalAgent:Z2,request:GP},Zv=soe;var aoe=t=>w.object(t)&&("http"in t||"https"in t||"http2"in t),coe=(t,e)=>aoe(e)?t.protocol==="https:"?e.https:e.http:e,uoe=async(t,e,r)=>{let n,i=!1,o=new Promise((s,a)=>{n=setTimeout(()=>{i=!0,a(new gn(e,"request"))},e),n.unref()});(async()=>{try{let s=await t;i&&r?.(s)}catch{}})();try{return await Promise.race([t,o])}finally{n&&clearTimeout(n)}};function cW(t,e){try{e()}catch(r){throw r instanceof Error&&(r.message=`Option '${t}': ${r.message}`),r}}function de(t,e,r){cW(t,()=>{we.any(e,r)})}function sp(t,e){cW(t,()=>{we.plainObject(e)})}function Dr(t,e){return t.origin===e.origin&&ia(t)===ia(e)}var ap=["host","cookie","cookie2","authorization","proxy-authorization"],loe=["content-length","content-encoding","content-language","content-location","content-type","transfer-encoding"];function eW(t){return t.protocol==="unix:"||ia(t)!==void 0}function ew(t,e){if(t instanceof URL)return t[e]!=="";if(!w.string(t))return!1;try{return new URL(t)[e]!==""}catch{return!1}}var Ph=(t,e,r)=>t.has(r)||(t.has("url")||t.has("prefixUrl"))&&e?.[r]!=="",poe=t=>new RegExp("^[a-z][\\d+\\-.a-z]*:\\/\\/","iv").test(t),uW=t=>new RegExp("^https?:(?!\\/\\/)","iv").test(t),doe=t=>new RegExp("^unix:","iv").test(t),nw=t=>w.urlInstance(t)||w.string(t)&&(poe(t)||t.startsWith("//")),tW=t=>t==="/"||t==="\\",foe=t=>t.length>1&&tW(t[0])&&tW(t[1]),hoe=t=>{let e=0;for(;e<t.length&&t.codePointAt(e)<=32;)e++;return t.slice(e)},moe=t=>{let e="";for(let r of t){let n=r.codePointAt(0);n!==9&&n!==10&&n!==13&&(e+=r)}return e},lW=(t,e)=>{if(!t.prefixUrl||t.allowAbsoluteUrls)return;let r=w.string(e)?hoe(moe(e)):e;if(nw(r)||w.string(r)&&(uW(r)||foe(r)||t.enableUnixSockets&&doe(r)))throw new Error("The `url` option must be relative when `allowAbsoluteUrls` is false and `prefixUrl` is set")},po=(t,e)=>{if(!t.prefixUrl||t.allowAbsoluteUrls)return;let r;try{r=new URL(t.prefixUrl)}catch{return}if(!Dr(r,e))throw new Error("The `url` option must stay on the same origin as `prefixUrl` when `allowAbsoluteUrls` is false")},es=t=>({url:t.url instanceof URL?new URL(t.url):void 0,prefixUrl:t.prefixUrl.toString(),allowAbsoluteUrls:t.allowAbsoluteUrls}),ts=(t,e,r)=>e.href!==r.url?.href||t.prefixUrl.toString()!==r.prefixUrl||t.allowAbsoluteUrls!==r.allowAbsoluteUrls;function iw(t,e,{username:r,password:n,baseUrl:i}={}){if(lW(t,e),w.string(e)&&t.url&&(e=new URL(e,i??t.url).toString()),t.allowAbsoluteUrls)t.prefixUrl="",t.url=e;else{let{allowAbsoluteUrls:o}=t;try{t.allowAbsoluteUrls=!0,t.url=e}finally{t.allowAbsoluteUrls=o}}return r!==void 0&&(t.username=r),n!==void 0&&(t.password=n),t.url}function tw(t){if(t.startsWith(":"))throw new TypeError(`HTTP/2 pseudo-headers are not supported in \`options.headers\`: ${t}`)}function aa(t,e){for(let[r,n]of Object.entries(e))r!=="__proto__"&&Reflect.set(t,r,n)}var goe=t=>t.setCookie.length===4&&t.getCookieString.length===0,yoe=t=>{t&&"destroy"in t&&w.function(t.destroy)&&("once"in t&&w.function(t.once)&&t.once("error",()=>{}),t.destroy())};function boe(t){for(let e of Object.keys(t)){if(e==="__proto__")continue;let r=t[e];de(`searchParams.${e}`,[w.string,w.number,w.boolean,w.null,w.undefined],r)}}var voe=new Map,rw,woe=()=>rw||(rw=new Ch,rw),Soe=t=>t?.[Symbol.toStringTag]==="QuickLRU"&&typeof t.evict=="function"?{get(e){return t.get(e)},set(e,r,n){return n===void 0?t.set(e,r):t.set(e,r,{maxAge:n}),!0},delete(e){return t.delete(e)},clear(){return t.clear()},has(e){return t.has(e)}}:t,_oe={request:void 0,agent:{http:void 0,https:void 0,http2:void 0},h2session:void 0,decompress:!0,timeout:{connect:void 0,lookup:void 0,read:void 0,request:void 0,response:void 0,secureConnect:void 0,send:void 0,socket:void 0},prefixUrl:"",body:void 0,form:void 0,json:void 0,cookieJar:void 0,ignoreInvalidCookies:!1,searchParams:void 0,dnsLookup:void 0,dnsCache:void 0,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],beforeCache:[],afterResponse:[]},followRedirect:!0,maxRedirects:10,cache:void 0,throwHttpErrors:!0,username:"",password:"",http2:!1,allowGetBody:!1,allowAbsoluteUrls:!0,copyPipedHeaders:!1,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:!1,dnsLookupIpVersion:void 0,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE","QUERY"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:void 0,calculateDelay:({computedValue:t})=>t,backoffLimit:Number.POSITIVE_INFINITY,noise:100,enforceRetryRules:!0},localAddress:void 0,method:"GET",createConnection:void 0,cacheOptions:{shared:void 0,cacheHeuristic:void 0,immutableMinTimeToLive:void 0,ignoreCargoCult:void 0},https:{alpnProtocols:void 0,rejectUnauthorized:void 0,checkServerIdentity:void 0,serverName:void 0,certificateAuthority:void 0,key:void 0,certificate:void 0,passphrase:void 0,pfx:void 0,ciphers:void 0,honorCipherOrder:void 0,minVersion:void 0,maxVersion:void 0,signatureAlgorithms:void 0,tlsSessionLifetime:void 0,dhparam:void 0,ecdhCurve:void 0,certificateRevocationLists:void 0,secureOptions:void 0},encoding:void 0,resolveBodyOnly:!1,isStream:!1,responseType:"text",url:void 0,pagination:{transform(t){return t.request.options.responseType==="json"?t.body:JSON.parse(t.body)},paginate({response:t}){let e=t.headers.link;if(typeof e!="string"||e.trim()==="")return!1;let n=OP(e).find(i=>i.parameters.rel==="next"||i.parameters.rel==='"next"');return n?{url:n.reference}:!1},filter:()=>!0,shouldContinue:()=>!0,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:!1},setHost:!0,maxHeaderSize:void 0,signal:void 0,enableUnixSockets:!1,strictContentLength:!0},rW=t=>{let{hooks:e,retry:r}=t;return{...t,context:{...t.context},cacheOptions:{...t.cacheOptions},https:{...t.https},agent:{...t.agent},headers:{...t.headers},retry:{...r,errorCodes:[...r.errorCodes],methods:[...r.methods],statusCodes:[...r.statusCodes]},timeout:{...t.timeout},hooks:{init:[...e.init],beforeRequest:[...e.beforeRequest],beforeError:[...e.beforeError],beforeRedirect:[...e.beforeRedirect],beforeRetry:[...e.beforeRetry],beforeCache:[...e.beforeCache],afterResponse:[...e.afterResponse]},searchParams:t.searchParams?new URLSearchParams(t.searchParams):void 0,pagination:{...t.pagination}}},xoe=t=>{let e={...t};if(Object.hasOwn(t,"context")&&w.object(t.context)&&(e.context={...t.context}),Object.hasOwn(t,"cacheOptions")&&w.object(t.cacheOptions)&&(e.cacheOptions={...t.cacheOptions}),Object.hasOwn(t,"https")&&w.object(t.https)&&(e.https={...t.https}),Object.hasOwn(t,"agent")&&w.object(t.agent)&&(e.agent={...t.agent}),Object.hasOwn(t,"headers")&&w.object(t.headers)&&(e.headers={...t.headers}),Object.hasOwn(t,"retry")&&w.object(t.retry)){let{retry:r}=t;e.retry={...r},w.array(r.errorCodes)&&(e.retry.errorCodes=[...r.errorCodes]),w.array(r.methods)&&(e.retry.methods=[...r.methods]),w.array(r.statusCodes)&&(e.retry.statusCodes=[...r.statusCodes])}if(Object.hasOwn(t,"timeout")&&w.object(t.timeout)&&(e.timeout={...t.timeout}),Object.hasOwn(t,"hooks")&&w.object(t.hooks)){let{hooks:r}=t;e.hooks={...r},w.array(r.init)&&(e.hooks.init=[...r.init]),w.array(r.beforeRequest)&&(e.hooks.beforeRequest=[...r.beforeRequest]),w.array(r.beforeError)&&(e.hooks.beforeError=[...r.beforeError]),w.array(r.beforeRedirect)&&(e.hooks.beforeRedirect=[...r.beforeRedirect]),w.array(r.beforeRetry)&&(e.hooks.beforeRetry=[...r.beforeRetry]),w.array(r.beforeCache)&&(e.hooks.beforeCache=[...r.beforeCache]),w.array(r.afterResponse)&&(e.hooks.afterResponse=[...r.afterResponse])}return Object.hasOwn(t,"searchParams")&&t.searchParams&&(w.string(t.searchParams)?e.searchParams=t.searchParams:t.searchParams instanceof URLSearchParams?e.searchParams=new URLSearchParams(t.searchParams):w.object(t.searchParams)&&(e.searchParams={...t.searchParams})),Object.hasOwn(t,"pagination")&&w.object(t.pagination)&&(e.pagination={...t.pagination}),e},Ioe=t=>{let e=[t.timeout.connect,t.timeout.lookup,t.timeout.request,t.timeout.secureConnect].filter(r=>typeof r=="number");return e.length>0?Math.min(...e):void 0},Coe=(t,e)=>{let r=t.agent.https!==void 0&&t.agent.https!==!1&&t.createConnection===void 0;return t.http2&&e.protocol==="https:"&&!t.h2session&&!r},di=(t,e)=>{t?.add(e)},pW=(t,e)=>{t.add(e)},nW=(t,e,r)=>{pW(t,r),di(e,r)},Toe=(t,e,r)=>{if(t)for(let n of new Set([...Object.keys(e),...Object.keys(r)]))e[n]!==r[n]&&di(t,n)},iW=(t,e,r)=>{let n=t.hooks?.init;if(n)for(let i of n)i(e,r)},Poe=new Set(["mutableDefaults","handlers","url","preserveHooks","isStream","__proto__"]),Un=class t{#e;#o;#t=!1;#r;#i;#n;constructor(e,r,n){if(de("input",[w.string,w.urlInstance,w.object,w.undefined],e),de("options",[w.object,w.undefined],r),de("defaults",[w.object,w.undefined],n),e instanceof t||r instanceof t)throw new TypeError("The defaults must be passed as the third argument");n?(this.#e=rW(n.#e),this.#r=[...n.#r],this.#i=new Set(n.#i)):(this.#e=rW(_oe),this.#r=[],this.#i=new Set),this.#o=this.#s();try{if(w.plainObject(e))try{this.merge(e),this.merge(r)}finally{this.url=e.url}else try{this.merge(r)}finally{if(r?.url!==void 0)if(e===void 0)this.url=r.url;else throw new TypeError("The `url` option is mutually exclusive with the `input` argument");else e!==void 0&&(this.url=e)}}catch(i){throw i.options=this,i}}merge(e){if(e){if(e instanceof t){let r=[...e.#r];for(let n of r)this.merge(n);return}e=xoe(e),iW(this,e,this),iW(e,e,this),this.#t=!0;try{let r=!1;for(let n of Object.keys(e)){if(Poe.has(n))continue;if(!(n in this))throw new Error(`Unexpected option: ${n}`);let i=e[n];i!==void 0&&(this[n]=i,r=!0)}r&&this.#r.push(e)}finally{this.#t=!1}}}get request(){return this.#e.request}set request(e){de("request",[w.function,w.undefined],e),this.#e.request=e}get agent(){return this.#e.agent}set agent(e){sp("agent",e);for(let r of Object.keys(e)){if(r==="__proto__")continue;if(!(r in this.#e.agent))throw new TypeError(`Unexpected agent option: ${r}`);let n=r==="http2"?[w.undefined,i=>i===!1]:[w.object,w.undefined,i=>i===!1];de(`agent.${r}`,n,e[r])}this.#t?aa(this.#e.agent,e):this.#e.agent={...e}}get h2session(){return this.#e.h2session}set h2session(e){this.#e.h2session=e}get decompress(){return this.#e.decompress}set decompress(e){we.boolean(e),this.#e.decompress=e}get timeout(){return this.#e.timeout}set timeout(e){sp("timeout",e);for(let r of Object.keys(e))if(r!=="__proto__"){if(!(r in this.#e.timeout))throw new Error(`Unexpected timeout option: ${r}`);de(`timeout.${r}`,[w.number,w.undefined],e[r])}this.#t?aa(this.#e.timeout,e):this.#e.timeout={...e}}get prefixUrl(){return this.#e.prefixUrl}set prefixUrl(e){if(de("prefixUrl",[w.string,w.urlInstance],e),e===""){this.#e.prefixUrl="";return}if(e=e.toString(),e.endsWith("/")||(e+="/"),this.#e.prefixUrl&&this.#e.url){let r=this.#e.url,n=new URL(r),{username:i,password:o}=r,s=new URL(r);s.username="",s.password="";let a=this.#e.prefixUrl.toString(),c=!1;if(nw(e)){let l=new URL(e);c=l.username!==""||l.password!==""}if(nw(this.#e.prefixUrl)){let l=new URL(this.#e.prefixUrl);l.username="",l.password="",a=l.href}r.href=e+s.href.slice(a.length);let u=Dr(n,r);i&&!r.username&&u&&!c&&(r.username=i),o&&!r.password&&u&&!c&&(r.password=o)}this.#e.prefixUrl=e,di(this.#n,"prefixUrl")}get body(){return this.#e.body}set body(e){de("body",[w.string,w.buffer,w.nodeStream,w.generator,w.asyncGenerator,w.iterable,w.asyncIterable,w.typedArray,w.undefined],e),w.nodeStream(e)&&we.truthy(e.readable),e!==void 0&&(we.undefined(this.#e.form),we.undefined(this.#e.json)),this.#e.body=e,di(this.#n,"body")}get form(){return this.#e.form}set form(e){de("form",[w.plainObject,w.undefined],e),e!==void 0&&(we.undefined(this.#e.body),we.undefined(this.#e.json)),this.#e.form=e,di(this.#n,"form")}get json(){return this.#e.json}set json(e){e!==void 0&&(we.undefined(this.#e.body),we.undefined(this.#e.form)),this.#e.json=e,di(this.#n,"json")}get url(){return this.#e.url}set url(e){if(de("url",[w.string,w.urlInstance,w.undefined],e),e===void 0){this.#e.url=void 0,di(this.#n,"url");return}if(w.string(e)&&e.startsWith("/"))throw new Error("`url` must not start with a slash");let r=e.toString();if(w.string(e)&&!this.prefixUrl&&uW(r))throw new Error("`url` protocol must be followed by `//`");let n=nw(e);lW(this,e);let i=n?r:`${this.prefixUrl}${r}`,o=new URL(i);if(this.#e.url=o,di(this.#n,"url"),eW(o)&&!this.#e.enableUnixSockets)throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled");if(o.protocol==="unix:"&&(o.href=`http://unix${o.pathname}${o.search}`),o.protocol!=="http:"&&o.protocol!=="https:"){let s=new Error(`Unsupported protocol: ${o.protocol}`);throw s.code="ERR_UNSUPPORTED_PROTOCOL",s}this.#e.username&&(o.username=this.#e.username,this.#e.username=""),this.#e.password&&(o.password=this.#e.password,this.#e.password=""),this.#e.searchParams&&(o.search=this.#e.searchParams.toString(),this.#e.searchParams=void 0)}get cookieJar(){return this.#e.cookieJar}set cookieJar(e){if(de("cookieJar",[w.object,w.undefined],e),e===void 0){this.#e.cookieJar=void 0;return}let{setCookie:r,getCookieString:n}=e;we.function(r),we.function(n),goe(e)?this.#e.cookieJar={setCookie:(0,Fc.promisify)(e.setCookie.bind(e)),getCookieString:(0,Fc.promisify)(e.getCookieString.bind(e))}:this.#e.cookieJar=e}get signal(){return this.#e.signal}set signal(e){de("signal",[w.object,w.undefined],e),this.#e.signal=e}get ignoreInvalidCookies(){return this.#e.ignoreInvalidCookies}set ignoreInvalidCookies(e){we.boolean(e),this.#e.ignoreInvalidCookies=e}get searchParams(){return this.#e.url?this.#e.url.searchParams:(this.#e.searchParams??=new URLSearchParams,this.#e.searchParams)}set searchParams(e){de("searchParams",[w.string,w.object,w.undefined],e);let r=this.#e.url;if(e===void 0){this.#e.searchParams=void 0,r&&(r.search="");return}let n=this.searchParams,i;if(w.string(e))i=new URLSearchParams(e);else if(e instanceof URLSearchParams)i=new URLSearchParams(e);else{boe(e),i=new URLSearchParams;for(let o of Object.keys(e)){if(o==="__proto__")continue;let s=e[o];s===null?i.append(o,""):s===void 0?n.delete(o):i.append(o,s)}}if(this.#t){for(let o of i.keys())n.delete(o);for(let[o,s]of i)n.append(o,s)}else r?r.search=i.toString():this.#e.searchParams=i}get dnsLookup(){return this.#e.dnsLookup}set dnsLookup(e){de("dnsLookup",[w.function,w.undefined],e),this.#e.dnsLookup=e}get dnsCache(){return this.#e.dnsCache}set dnsCache(e){de("dnsCache",[w.object,w.boolean,w.undefined],e),e===!0?this.#e.dnsCache=woe():e===!1?this.#e.dnsCache=void 0:(e!==void 0&&(de("dnsCache.lookup",[w.function],e.lookup),de("dnsCache.clear",[w.function,w.undefined],e.clear)),this.#e.dnsCache=e)}get context(){return this.#e.context}set context(e){we.object(e),this.#t?aa(this.#e.context,e):this.#e.context={...e}}get hooks(){return this.#e.hooks}set hooks(e){we.object(e);for(let r of Object.keys(e)){if(r==="__proto__")continue;if(!(r in this.#e.hooks))throw new Error(`Unexpected hook event: ${r}`);let n=r,i=e[n];if(de(`hooks.${r}`,[w.array,w.undefined],i),i)for(let o of i)we.function(o);if(this.#t)i&&this.#e.hooks[n].push(...i);else{if(!i)throw new Error(`Missing hook event: ${r}`);this.#e.hooks[r]=[...i]}}}get followRedirect(){return this.#e.followRedirect}set followRedirect(e){de("followRedirect",[w.boolean,w.function],e),this.#e.followRedirect=e}get maxRedirects(){return this.#e.maxRedirects}set maxRedirects(e){we.number(e),this.#e.maxRedirects=e}get cache(){return this.#e.cache}set cache(e){de("cache",[w.object,w.string,w.boolean,w.undefined],e),e===!0?this.#e.cache=voe:e===!1?this.#e.cache=void 0:this.#e.cache=Soe(e)}get throwHttpErrors(){return this.#e.throwHttpErrors}set throwHttpErrors(e){we.boolean(e),this.#e.throwHttpErrors=e}get username(){let e=this.#e.url,r=e?e.username:this.#e.username;return decodeURIComponent(r)}set username(e){we.string(e);let r=this.#e.url,n=encodeURIComponent(e);r?r.username=n:this.#e.username=n,di(this.#n,"username")}get password(){let e=this.#e.url,r=e?e.password:this.#e.password;return decodeURIComponent(r)}set password(e){we.string(e);let r=this.#e.url,n=encodeURIComponent(e);r?r.password=n:this.#e.password=n,di(this.#n,"password")}get http2(){return this.#e.http2}set http2(e){we.boolean(e),this.#e.http2=e}get allowGetBody(){return this.#e.allowGetBody}set allowGetBody(e){we.boolean(e),this.#e.allowGetBody=e}get allowAbsoluteUrls(){return this.#e.allowAbsoluteUrls}set allowAbsoluteUrls(e){we.boolean(e),this.#e.allowAbsoluteUrls=e}get copyPipedHeaders(){return this.#e.copyPipedHeaders}set copyPipedHeaders(e){we.boolean(e),this.#e.copyPipedHeaders=e}isHeaderExplicitlySet(e){return this.#i.has(e.toLowerCase())}shouldCopyPipedHeader(e){return!this.isHeaderExplicitlySet(e)}setPipedHeader(e,r){tw(e),this.#e.headers[e.toLowerCase()]=r}getInternalHeaders(){return this.#e.headers}setInternalHeader(e,r){tw(e),this.#e.headers[e.toLowerCase()]=r}deleteInternalHeader(e){delete this.#e.headers[e.toLowerCase()]}async trackStateMutations(e){let r=new Set;this.#n=r;try{return await e(r)}finally{this.#n=void 0}}clearBody(){this.body=void 0,this.json=void 0,this.form=void 0;for(let e of loe)this.deleteInternalHeader(e)}clearUnchangedCookieHeader(e,r){e?.hadCookieJar&&this.cookieJar===void 0&&!this.isHeaderExplicitlySet("cookie")&&!r?.has("cookie")&&this.headers.cookie===e.headers.cookie&&this.deleteInternalHeader("cookie")}restoreCookieHeader(e,r){if(e&&!Object.hasOwn(r??{},"cookie")){if(e.cookieWasExplicitlySet){this.headers.cookie=e.headers.cookie;return}delete this.headers.cookie,e.headers.cookie!==void 0&&this.setInternalHeader("cookie",e.headers.cookie)}}syncCookieHeaderAfterMerge(e,r){this.restoreCookieHeader(e,r),this.clearUnchangedCookieHeader(e)}stripUnchangedCrossOriginState(e,r,{clearBody:n=!0}={}){let i=this.getInternalHeaders(),o=this.#e.url;for(let s of ap)!r.has(s)&&i[s]===e.headers[s]&&this.deleteInternalHeader(s);Ph(r,o,"username")||(this.username=""),Ph(r,o,"password")||(this.password=""),n&&!r.has("body")&&!r.has("json")&&!r.has("form")&&ow(this,e)&&this.clearBody()}stripSensitiveHeaders(e,r,n){if(Dr(e,r))return;let i=zv(n.headers??{});for(let u of ap)i[u]===void 0&&this.deleteInternalHeader(u);let o=Object.hasOwn(n,"username")?n.username:void 0,s=Object.hasOwn(n,"password")?n.password:void 0,a=o!==void 0||ew(n.url,"username")||ew(n.prefixUrl,"username")||Eh(e,r,"username"),c=s!==void 0||ew(n.url,"password")||ew(n.prefixUrl,"password")||Eh(e,r,"password");!a&&this.username&&(this.username=""),!c&&this.password&&(this.password="")}get headers(){return this.#o}set headers(e){sp("headers",e);let r=zv(e);for(let n of Object.keys(r))tw(n);if(this.#t)aa(this.#e.headers,r);else{let n=this.#e.headers;this.#e.headers=r,this.#o=this.#s(),this.#i.clear(),Toe(this.#n,n,r)}for(let n of Object.keys(r))this.#t?nW(this.#i,this.#n,n):pW(this.#i,n)}get methodRewriting(){return this.#e.methodRewriting}set methodRewriting(e){we.boolean(e),this.#e.methodRewriting=e}get dnsLookupIpVersion(){return this.#e.dnsLookupIpVersion}set dnsLookupIpVersion(e){if(e!==void 0&&e!==4&&e!==6)throw new TypeError(`Invalid DNS lookup IP version: ${e}`);this.#e.dnsLookupIpVersion=e}get parseJson(){return this.#e.parseJson}set parseJson(e){we.function(e),this.#e.parseJson=e}get stringifyJson(){return this.#e.stringifyJson}set stringifyJson(e){we.function(e),this.#e.stringifyJson=e}get retry(){return this.#e.retry}set retry(e){if(sp("retry",e),de("retry.calculateDelay",[w.function,w.undefined],e.calculateDelay),de("retry.maxRetryAfter",[w.number,w.undefined],e.maxRetryAfter),de("retry.limit",[w.number,w.undefined],e.limit),de("retry.methods",[w.array,w.undefined],e.methods),de("retry.statusCodes",[w.array,w.undefined],e.statusCodes),de("retry.errorCodes",[w.array,w.undefined],e.errorCodes),de("retry.noise",[w.number,w.undefined],e.noise),de("retry.enforceRetryRules",[w.boolean,w.undefined],e.enforceRetryRules),e.noise&&Math.abs(e.noise)>100)throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${e.noise}`);for(let n of Object.keys(e))if(n!=="__proto__"&&!(n in this.#e.retry))throw new Error(`Unexpected retry option: ${n}`);this.#t?aa(this.#e.retry,e):this.#e.retry={...e};let{retry:r}=this.#e;r.methods=[...new Set(r.methods.map(n=>n.toUpperCase()))],r.statusCodes=[...new Set(r.statusCodes)],r.errorCodes=[...new Set(r.errorCodes)]}get localAddress(){return this.#e.localAddress}set localAddress(e){de("localAddress",[w.string,w.undefined],e),this.#e.localAddress=e}get method(){return this.#e.method}set method(e){we.string(e),this.#e.method=e.toUpperCase()}get createConnection(){return this.#e.createConnection}set createConnection(e){de("createConnection",[w.function,w.undefined],e),this.#e.createConnection=e}get cacheOptions(){return this.#e.cacheOptions}set cacheOptions(e){sp("cacheOptions",e),de("cacheOptions.shared",[w.boolean,w.undefined],e.shared),de("cacheOptions.cacheHeuristic",[w.number,w.undefined],e.cacheHeuristic),de("cacheOptions.immutableMinTimeToLive",[w.number,w.undefined],e.immutableMinTimeToLive),de("cacheOptions.ignoreCargoCult",[w.boolean,w.undefined],e.ignoreCargoCult);for(let r of Object.keys(e))if(r!=="__proto__"&&!(r in this.#e.cacheOptions))throw new Error(`Cache option \`${r}\` does not exist`);this.#t?aa(this.#e.cacheOptions,e):this.#e.cacheOptions={...e}}get https(){return this.#e.https}set https(e){sp("https",e),de("https.rejectUnauthorized",[w.boolean,w.undefined],e.rejectUnauthorized),de("https.checkServerIdentity",[w.function,w.undefined],e.checkServerIdentity),de("https.serverName",[w.string,w.undefined],e.serverName),de("https.certificateAuthority",[w.string,w.object,w.array,w.undefined],e.certificateAuthority),de("https.key",[w.string,w.object,w.array,w.undefined],e.key),de("https.certificate",[w.string,w.object,w.array,w.undefined],e.certificate),de("https.passphrase",[w.string,w.undefined],e.passphrase),de("https.pfx",[w.string,w.buffer,w.array,w.undefined],e.pfx),de("https.alpnProtocols",[w.array,w.undefined],e.alpnProtocols),de("https.ciphers",[w.string,w.undefined],e.ciphers),de("https.dhparam",[w.string,w.buffer,w.undefined],e.dhparam),de("https.signatureAlgorithms",[w.string,w.undefined],e.signatureAlgorithms),de("https.minVersion",[w.string,w.undefined],e.minVersion),de("https.maxVersion",[w.string,w.undefined],e.maxVersion),de("https.honorCipherOrder",[w.boolean,w.undefined],e.honorCipherOrder),de("https.tlsSessionLifetime",[w.number,w.undefined],e.tlsSessionLifetime),de("https.ecdhCurve",[w.string,w.undefined],e.ecdhCurve),de("https.certificateRevocationLists",[w.string,w.buffer,w.array,w.undefined],e.certificateRevocationLists),de("https.secureOptions",[w.number,w.undefined],e.secureOptions);for(let r of Object.keys(e))if(r!=="__proto__"&&!(r in this.#e.https))throw new Error(`HTTPS option \`${r}\` does not exist`);this.#t?aa(this.#e.https,e):this.#e.https={...e}}get encoding(){return this.#e.encoding}set encoding(e){if(e===null)throw new TypeError("To get a Uint8Array, set `options.responseType` to `buffer` instead");de("encoding",[w.string,w.undefined],e),this.#e.encoding=e}get resolveBodyOnly(){return this.#e.resolveBodyOnly}set resolveBodyOnly(e){we.boolean(e),this.#e.resolveBodyOnly=e}get isStream(){return this.#e.isStream}set isStream(e){we.boolean(e),this.#e.isStream=e}get responseType(){return this.#e.responseType}set responseType(e){if(e!=="text"&&e!=="buffer"&&e!=="json")throw new Error(`Invalid \`responseType\` option: ${e}`);this.#e.responseType=e}get pagination(){return this.#e.pagination}set pagination(e){we.object(e),this.#t?aa(this.#e.pagination,e):this.#e.pagination=e}get setHost(){return this.#e.setHost}set setHost(e){we.boolean(e),this.#e.setHost=e}get maxHeaderSize(){return this.#e.maxHeaderSize}set maxHeaderSize(e){de("maxHeaderSize",[w.number,w.undefined],e),this.#e.maxHeaderSize=e}get enableUnixSockets(){return this.#e.enableUnixSockets}set enableUnixSockets(e){we.boolean(e),this.#e.enableUnixSockets=e}get strictContentLength(){return this.#e.strictContentLength}set strictContentLength(e){we.boolean(e),this.#e.strictContentLength=e}toJSON(){return{...this.#e}}[Symbol.for("nodejs.util.inspect.custom")](e,r){return(0,Fc.inspect)(this.#e,r)}createNativeRequestOptions(){let e=this.#e,r=e.url,n=Coe(e,r),i=n?e.timeout.socket:void 0,o;r.protocol==="https:"?e.http2?o={...e.agent,http2:e.agent.http2??Zv.globalAgent}:o=e.agent.https:o=e.agent.http;let{https:s}=e,{pfx:a}=s;w.array(a)&&w.plainObject(a[0])&&(a=a.map(d=>({buf:d.buffer,passphrase:d.passphrase})));let c=ia(r);if(eW(r)&&!e.enableUnixSockets)throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled");let u;c!==void 0&&(u=new RegExp("^(?<socketPath>[^:]+):(?<path>.+)$","v").exec(`${r.pathname}${r.search}`)?.groups);let l=u?{socketPath:u.socketPath,path:u.path,host:""}:void 0;return{...e.cacheOptions,...l,ALPNProtocols:s.alpnProtocols,ca:s.certificateAuthority,cert:s.certificate,key:s.key,passphrase:s.passphrase,pfx:a,rejectUnauthorized:s.rejectUnauthorized,checkServerIdentity:s.checkServerIdentity??oW.checkServerIdentity,servername:s.serverName,ciphers:s.ciphers,honorCipherOrder:s.honorCipherOrder,minVersion:s.minVersion,maxVersion:s.maxVersion,sigalgs:s.signatureAlgorithms,sessionTimeout:s.tlsSessionLifetime,dhparam:s.dhparam,ecdhCurve:s.ecdhCurve,crl:s.certificateRevocationLists,secureOptions:s.secureOptions,lookup:e.dnsLookup??e.dnsCache?.lookup,family:e.dnsLookupIpVersion,agent:o,setHost:e.setHost,method:e.method,maxHeaderSize:e.maxHeaderSize,localAddress:e.localAddress,headers:e.headers,createConnection:e.createConnection,signal:e.http2?e.signal:void 0,timeout:n?Ioe(e):void 0,...i===void 0?{}:{_socketTimeout:i},h2session:e.h2session}}getRequestFunction(){let{request:e}=this.#e;return e?(n,i,o)=>{let s=Date.now(),a=coe(n,i.agent),c=Object.hasOwn(i,"_socketTimeout"),u=i.timeout!==void 0||c||a!==i.agent?{...i,agent:a,timeout:void 0}:i;c&&Reflect.deleteProperty(u,"_socketTimeout");let l=e(n,u,o);return w.promise(l)?this.#d(l,{url:n,options:i,callback:o,requestStartedAt:s}):l!==void 0?l:this.#p(n,i,o)}:this.#a()}freeze(){let e=this.#e;Object.freeze(e),Object.freeze(e.hooks),Object.freeze(e.hooks.afterResponse),Object.freeze(e.hooks.beforeCache),Object.freeze(e.hooks.beforeError),Object.freeze(e.hooks.beforeRedirect),Object.freeze(e.hooks.beforeRequest),Object.freeze(e.hooks.beforeRetry),Object.freeze(e.hooks.init),Object.freeze(e.https),Object.freeze(e.cacheOptions),Object.freeze(e.agent),Object.freeze(e.headers),Object.freeze(e.timeout),Object.freeze(e.retry),Object.freeze(e.retry.errorCodes),Object.freeze(e.retry.methods),Object.freeze(e.retry.statusCodes)}#s(){return new Proxy(this.#e.headers,{get(e,r,n){if(typeof r=="string"){if(Reflect.has(e,r))return Reflect.get(e,r,n);let i=r.toLowerCase();return Reflect.get(e,i,n)}return Reflect.get(e,r,n)},set:(e,r,n)=>{if(typeof r=="string"){let i=r.toLowerCase();tw(i);let o=Reflect.set(e,i,n);return o&&nW(this.#i,this.#n,i),o}return Reflect.set(e,r,n)},deleteProperty:(e,r)=>{if(typeof r=="string"){let n=r.toLowerCase(),i=Reflect.deleteProperty(e,n);return i&&(this.#i.delete(n),di(this.#n,n)),i}return Reflect.deleteProperty(e,r)}})}#a(){let e=this.#e.url;if(e)return this.#e.h2session?Zv.auto:e.protocol==="https:"?this.#e.http2?Zv.auto:sW.default.request:aW.default.request}#p(e,r,n){let i=this.#a();if(!i)throw new TypeError("The request function must return a value");let o=i(e,r,n);if(o===void 0)throw new TypeError("The request function must return a value");return w.promise(o)?this.#c(o):o}async#d(e,{url:r,options:n,callback:i,requestStartedAt:o}){let s=e;if(this.#e.timeout.request!==void 0){let c=this.#e.timeout.request-(Date.now()-o);s=uoe(e,Math.max(0,c),yoe)}let a=await s;if(a!==void 0)return a;if(this.#e.timeout.request!==void 0&&n.timeout!==void 0){let c=this.#e.timeout.request-(Date.now()-o);n.timeout=Math.min(n.timeout,Math.max(0,c))}return this.#p(r,n,i)}async#c(e){let r=await e;if(r===void 0)throw new TypeError("The request function must return a value");return r}},Uc=t=>({headers:{...t.getInternalHeaders()},hadCookieJar:t.cookieJar!==void 0,cookieWasExplicitlySet:t.isHeaderExplicitlySet("cookie"),username:t.username,password:t.password,body:t.body,json:t.json,form:t.form,bodySnapshot:zP(t.body),jsonSnapshot:zP(t.json),formSnapshot:zP(t.form)}),zP=t=>{if(t==null||typeof t!="object")return t;try{return structuredClone(t)}catch{return}},KP=(t,e,r)=>t!==e?!1:t==null||typeof t!="object"||r===void 0?!0:(0,Fc.isDeepStrictEqual)(t,r),Eh=(t,e,r)=>e[r]!==""&&e[r]!==t[r],ow=(t,e)=>KP(t.body,e.body,e.bodySnapshot)&&KP(t.json,e.json,e.jsonSnapshot)&&KP(t.form,e.form,e.formSnapshot);var dW=require("node:buffer");var fW=new WeakMap,Eoe=new TextDecoder,kh=t=>t===void 0||t.toLowerCase().replace("-","")==="utf8",jc=(t,e)=>kh(e)?Eoe.decode(t):dW.Buffer.from(t).toString(e),up=t=>{let{statusCode:e}=t,{followRedirect:r}=t.request.options,i=(typeof r=="function"?r(t):r)?299:399;return e>=200&&e<=i||e===304},cp=class extends Ne{name="ParseError";code="ERR_BODY_PARSE_FAILURE";constructor(e,r){let{options:n}=r.request;super(`${e.message} in "${pi(n.url)}"`,e,r.request)}},hW=(t,e)=>{fW.set(t,e)},JP=(t,e,r,n)=>{let{rawBody:i}=t,o=fW.get(t);try{if(e==="text")return o!==void 0?o:jc(i,n);if(e==="json"){if(i.length===0)return"";let s=o??jc(i,n);return r(s)}if(e==="buffer")return i}catch(s){throw new cp(s,t)}throw new cp({message:`Unknown body type '${e}'`,name:"Error"},t)};function koe(t){return t.writable&&!t.writableEnded}var mW=koe;var gW=require("node:crypto"),ca=v(require("node:diagnostics_channel"),1),Wc={requestCreate:ca.default.channel("got:request:create"),requestStart:ca.default.channel("got:request:start"),responseStart:ca.default.channel("got:response:start"),responseEnd:ca.default.channel("got:response:end"),retry:ca.default.channel("got:request:retry"),error:ca.default.channel("got:request:error"),redirect:ca.default.channel("got:response:redirect")};function yW(){return(0,gW.randomUUID)()}var Hc=(t,e)=>{t.hasSubscribers&&t.publish(e)};function bW(t){Hc(Wc.requestCreate,t)}function vW(t){Hc(Wc.requestStart,t)}function wW(t){Hc(Wc.responseStart,t)}function SW(t){Hc(Wc.responseEnd,t)}function _W(t){Hc(Wc.retry,t)}function xW(t){Hc(Wc.error,t)}function IW(t){Hc(Wc.redirect,t)}var Roe=w.string(lp.default.versions.brotli),Aoe=w.string(lp.default.versions.zstd),Doe=new Set(["GET","HEAD"]),Ooe=new Set(["authorization","content-length","proxy-authorization"]),XP=new Ih,Loe=new Set([301,302,303,307,308]),Noe=new Set(["EPIPE","ECONNRESET"]),Moe=new Set(["host","connection","authorization","cookie","cookie2","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","set-cookie","set-cookie2","te","trailer","transfer-encoding","upgrade"]),CW=new WeakSet,Boe=["socket","connect","continue","information","upgrade"],TW=()=>{},YP=()=>{let t=Date.now();return{start:t,error:t,phases:{total:0}}},PW=t=>{let e=new globalThis.Response(t);return{body:e.body,contentType:e.headers.get("content-type")??"multipart/form-data"}},Foe=t=>w.nodeStream(t)||t instanceof ReadableStream||w.generator(t)||w.asyncIterable(t)&&t[Symbol.asyncIterator]()===t||w.iterable(t)&&t[Symbol.iterator]()===t,EW=t=>{let{code:e}=t;return typeof e=="string"&&Noe.has(e)},Uoe=t=>{let e=new Set;for(let[r,n]of Object.entries(t)){let i=r.toLowerCase();if(i!=="connection"&&i!=="proxy-connection")continue;let o=Array.isArray(n)?n:[n];for(let s of o)if(typeof s=="string")for(let a of s.split(",")){let c=a.trim().toLowerCase();c.length>0&&e.add(c)}}return e},Yt=t=>{if(t instanceof globalThis.Error)return t;if(w.object(t)){let e=t,r=typeof e.message=="string"?e.message:"Non-error object thrown",n=new globalThis.Error(r,{cause:t});return typeof e.stack=="string"&&(n.stack=e.stack),typeof e.code=="string"&&(n.code=e.code),typeof e.input=="string"&&(n.input=e.input),n}return new globalThis.Error(String(t))},QP=t=>t?.url?pi(t.url):"",kW=(t,e)=>{let r=0;return e===t?r=1:e&&(r=t/e),{percent:r,transferred:t,total:e}},qc=class t extends RW.Duplex{["constructor"];_noPipe;options;response;requestUrl;redirectUrls=[];retryCount=0;_stopReading=!1;_stopRetry;_downloadedSize=0;_uploadedSize=0;_pipedServerResponses=new Set;_request;_responseSize;_bodySize;_nativeFormDataBody;_unproxyEvents;_triggerRead=!1;_jobs=[];_cancelTimeouts;_abortListenerDisposer;_flushed=!1;_aborted=!1;_expectedContentLength;_compressedBytesCount;_skipRequestEndInFinal=!1;_hasWrittenBody=!1;_hasWritableBody=!1;_discardBodyWrites=!1;_incrementalDecode;_requestId=yW();_requestInitialized=!1;constructor(e,r,n){super({autoDestroy:!1,highWaterMark:0}),this.on("pipe",o=>{if(this.options.copyPipedHeaders&&o?.headers){let s=Uoe(o.headers);for(let[a,c]of Object.entries(o.headers)){let u=a.toLowerCase();Moe.has(u)||s.has(u)||this.options.shouldCopyPipedHeader(u)&&this.options.setPipedHeader(u,c)}}}),this.on("newListener",o=>{if(o==="retry"&&this.listenerCount("retry")>0)throw new Error("A retry listener has been attached already.")});try{if(this.options=new Un(e,r,n),!this.options.url){if(this.options.prefixUrl==="")throw new TypeError("Missing `url` property");this.options.url=""}this.requestUrl=this.options.url,bW({requestId:this._requestId,url:QP(this.options),method:this.options.method})}catch(o){let{options:s}=o;s&&(this.options=s),this.flush=async()=>{this.flush=async()=>{},lp.default.nextTick(()=>{if(this.options)this._beforeError(Yt(o));else{let a=Yt(o),c=a instanceof Ne?a:new Ne(a.message,a,this);this.destroy(c)}})};return}let{body:i}=this.options;w.nodeStream(i)&&i.once("error",this._onBodyError)}async flush(){if(!this._flushed){this._flushed=!0;try{if(this._attachAbortListener(),this.destroyed||(await this._finalizeBody(),this.destroyed))return;if(this._hasWritableBody=this._canWriteBody(),await this._makeRequest(),this.destroyed){this._request?.destroy();return}for(let e of this._jobs)e();this._jobs.length=0,this._requestInitialized=!0}catch(e){this._beforeError(Yt(e))}}}_beforeError(e){if(this._stopReading)return;let{response:r,options:n}=this,i=this.retryCount+(e.name==="RetryError"?0:1);this._stopReading=!0,e instanceof gn?e=new tp(e,this.timings??YP(),this):e instanceof Ne||(e=new Ne(e.message,e,this));let o=e;(async()=>{if(r?.readable&&!r.rawBody&&!this._request?.socket?.destroyed&&(r.setEncoding(this.readableEncoding),await this._setRawBody(r)),r?.rawBody&&r.body===void 0)try{r.body=jc(r.rawBody,n.encoding)}catch{}if(this.listenerCount("retry")!==0){let s;try{let a;r&&"retry-after"in r.headers&&(a=Number(r.headers["retry-after"]),Number.isNaN(a)?a=Date.parse(r.headers["retry-after"])-Date.now():a*=1e3,a<=0&&(a=1));let c=n.retry,u=x2({attemptCount:i,retryOptions:c,error:o,retryAfter:a,computedValue:c.maxRetryAfter??n.timeout.request??Number.POSITIVE_INFINITY});c.enforceRetryRules&&u===0?s=0:s=await c.calculateDelay({attemptCount:i,retryOptions:c,error:o,retryAfter:a,computedValue:u})}catch(a){let c=Yt(a);this._error(new Ne(c.message,c,this));return}if(s){if(await new Promise(l=>{let p=setTimeout(l,s);this._stopRetry=()=>{clearTimeout(p),l()}}),this.destroyed)return;let a=this.options.body;try{for(let l of this.options.hooks.beforeRetry)await l(o,this.retryCount+1)}catch(l){let p=Yt(l);this._error(new Ne(p.message,p,this));return}if(this.destroyed)return;let c=this.options.body,u=a!==c;try{if(u){let l=a;if(this.options.body=void 0,this.destroy(),w.nodeStream(l)&&l!==c&&l.destroy(),w.nodeStream(c)&&(c.readableEnded||c.destroyed))throw new TypeError("The reassigned stream body must be readable. Ensure you provide a fresh, readable stream in the beforeRetry hook.");this.options.body=c}else this.destroy()}catch(l){let p=Yt(l);this._error(new Ne(p.message,p,this));return}_W({requestId:this._requestId,retryCount:this.retryCount+1,error:o,delay:s}),this.emit("retry",this.retryCount+1,e,l=>{let p=new t(void 0,l,n);return p.retryCount=this.retryCount+1,lp.default.nextTick(()=>{p.flush()}),p});return}}this._error(o)})()}_read(){this._triggerRead=!0;let{response:e}=this;if(e&&!this._stopReading){e.readableLength&&(this._triggerRead=!1);let r;for(;(r=e.read())!==null;){if(this._downloadedSize+=r.length,this._incrementalDecode)try{let i=typeof r=="string"?r:this._incrementalDecode.decoder.decode(r,{stream:!0});i.length>0&&this._incrementalDecode.chunks.push(i)}catch{this._incrementalDecode=void 0}let n=this.downloadProgress;if(n.percent<1&&this.emit("downloadProgress",n),this._stopReading||(this.push(r),this._stopReading))return}}}_write(e,r,n){let i=()=>{if(this._discardBodyWrites){n();return}this._hasWrittenBody=!0,this._writeRequest(e,r,n)};this._requestInitialized?i():this._jobs.push(i)}_final(e){let r=()=>{if(this._discardBodyWrites){this._hasWritableBody=!1,e();return}if(this._skipRequestEndInFinal){this._skipRequestEndInFinal=!1,e();return}let n=this._request;if(!n||n.destroyed){this._hasWritableBody=!1,e();return}n.end(i=>{if(!n?._writableState?.errored){if(this._hasWritableBody=!1,i){this._beforeError(i);return}this._emitUploadComplete(n),e()}})};this._requestInitialized?r():this._jobs.push(r)}_destroy(e,r){if(this._stopReading=!0,this.flush=async()=>{},this._stopRetry?.(),this._cancelTimeouts?.(),this._abortListenerDisposer?.[Symbol.dispose](),this._destroyInFlightAlpnSocket(),this.options){let{body:i}=this.options;w.nodeStream(i)&&i.destroy()}this._request&&this._request.destroy();let n=this._request?.timings;n&&w.undefined(n.end)&&!w.undefined(n.response)&&w.undefined(n.error)&&w.undefined(n.abort)&&(n.end=Date.now(),w.undefined(n.phases.total)&&(n.phases.download=n.end-n.response,n.phases.total=n.end-n.start)),e!==null&&!(e instanceof Error&&CW.has(e))&&!(e instanceof Ne)&&(e=e instanceof Error?new Ne(e.message,e,this):new Ne(String(e),{},this)),r(e)}pipe(e,r){return e instanceof Rh.ServerResponse&&this._pipedServerResponses.add(e),super.pipe(e,r)}unpipe(e){return e instanceof Rh.ServerResponse&&this._pipedServerResponses.delete(e),super.unpipe(e),this}_attachAbortListener(){if(this._abortListenerDisposer)return;let{signal:e}=this.options;if(!e)return;let r=()=>{this._destroyInFlightAlpnSocket(),e.reason?.name==="TimeoutError"?this.destroy(new tp(e.reason,this.timings??YP(),this)):this.destroy(new Fv(this))};e.aborted?r():this._abortListenerDisposer=(0,AW.addAbortListener)(e,r)}_destroyInFlightAlpnSocket(){this._requestOptions?._alpnSocket?.destroy()}_shouldIncrementallyDecodeBody(){let{responseType:e,encoding:r}=this.options;return!!this._noPipe&&(e==="text"||e==="json")&&kh(r)}_checkContentLengthMismatch(){if(this.options.strictContentLength&&this._expectedContentLength!==void 0){let e=this._compressedBytesCount??this._downloadedSize;if(e!==this._expectedContentLength)return this._beforeError(new Mc({message:`Content-Length mismatch: expected ${this._expectedContentLength} bytes, received ${e} bytes`,name:"Error",code:"ERR_HTTP_CONTENT_LENGTH_MISMATCH"},this)),!0}return!1}async _finalizeBody(){let{options:e}=this,r=e.getInternalHeaders(),n=!w.undefined(e.form),i=!w.undefined(e.json),o=!w.undefined(e.body),s=!this._methodCanHaveBody;if(n||i||o){if(s)throw new TypeError(`The \`${e.method}\` method cannot be used with a body`);let a=!w.string(r["content-type"]);if(o){if(e.body instanceof FormData){let{body:u,contentType:l}=PW(e.body);this._nativeFormDataBody={form:e.body,body:u,contentTypeWasGenerated:a},a&&(r["content-type"]=l),e.body=u}else if(Object.prototype.toString.call(e.body)==="[object FormData]")throw new TypeError("Non-native FormData is not supported. Use globalThis.FormData instead.")}else if(n){a&&(r["content-type"]="application/x-www-form-urlencoded");let{form:u}=e;e.form=void 0,e.body=new URLSearchParams(u).toString()}else{a&&(r["content-type"]="application/json");let{json:u}=e;e.json=void 0,e.body=e.stringifyJson(u)}let c=RP(e.body,r);w.undefined(r["content-length"])&&w.undefined(r["transfer-encoding"])&&!s&&!w.undefined(c)&&(r["content-length"]=String(c))}e.responseType==="json"&&!("accept"in r)&&(r.accept="application/json"),this._bodySize=Number(r["content-length"])||void 0}async _onResponseBase(e){if(this.isAborted)return;let{options:r}=this,{url:n}=r,i=e,o=e.statusCode,{method:s}=r,a=e.headers.location,c=Array.isArray(a)?a[0]:a,u=!!(c&&Loe.has(o)),l=s==="HEAD"||o>=100&&o<200||o===204||o===205||o===304,p=y=>(Object.hasOwn(y,"headers")||Object.defineProperty(y,"headers",{value:y.headers,enumerable:!0,writable:!0,configurable:!0}),y.statusMessage||=Rh.default.STATUS_CODES[o],y.url=pi(r.url),y.requestUrl=this.requestUrl,y.redirectUrls=this.redirectUrls,y.request=this,y.isFromCache=i.fromCache??!1,y.ip=this.ip,y.retryCount=this.retryCount,y.ok=up(y),y),d=p(e),f=u&&(typeof r.followRedirect=="function"?r.followRedirect(d):r.followRedirect);r.decompress&&!l&&!f&&(e=EP(e),d=p(e),r.strictContentLength&&e!==i&&(this._compressedBytesCount=0,i.on("data",y=>{this._compressedBytesCount+=Uv(y)})));let h=e!==i;this._responseSize=Number(e.headers["content-length"])||void 0,this.response=d,this._incrementalDecode=this._shouldIncrementallyDecodeBody()?{decoder:new globalThis.TextDecoder("utf8",{ignoreBOM:!0}),chunks:[]}:void 0,wW({requestId:this._requestId,url:d.url,statusCode:o,headers:e.headers,isFromCache:d.isFromCache}),e.once("error",y=>{!h&&e.complete&&this._responseSize===void 0&&y.code==="ECONNRESET"||(this._aborted=!0,this._beforeError(new Mc(y,this)))}),e.once("aborted",()=>{this._responseSize===void 0&&i.complete||(this._aborted=!0,this._checkContentLengthMismatch()||this._beforeError(new Mc({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this)))});let m=!1,x=()=>{!m||!e.readableEnded||(m=!1,!this._stopReading&&(this._checkContentLengthMismatch()||(this._responseSize=this._downloadedSize,this.emit("downloadProgress",this.downloadProgress),SW({requestId:this._requestId,url:d.url,statusCode:o,bodySize:this._downloadedSize,timings:this.timings}),this.push(null))))};f||e.once("end",x);let C=e.headers["set-cookie"],O=this._noPipe&&w.object(r.cookieJar)&&C!==void 0&&!f?this._setRawBody(e):void 0;if(w.object(r.cookieJar)&&C){let y=C.map(async T=>r.cookieJar.setCookie(T,n.toString()));r.ignoreInvalidCookies&&(y=y.map(async T=>{try{await T}catch{}}));try{await Promise.all(y)}catch(T){O&&await O,this._beforeError(Yt(T));return}}if(!this.isAborted){if(f){if(e.resume(),this._cancelTimeouts?.(),this._unproxyEvents?.(),this.redirectUrls.length>=r.maxRedirects){this._beforeError(new Mv(this));return}this._request=void 0,this._downloadedSize=0,this._uploadedSize=0;let y=new Un(void 0,void 0,this.options);try{let T=ZP.Buffer.from(c,"binary").toString(),E=new URL(T,n),M=ia(n),k=ia(E);if(E.protocol==="unix:"&&k===void 0){this._beforeError(new Ne("Cannot redirect to UNIX socket",{},this));return}if(k!==void 0&&M!==k){this._beforeError(new Ne("Cannot redirect to UNIX socket",{},this));return}let A=E.origin!==n.origin||M!==k,W=o===303&&y.method!=="GET"&&y.method!=="HEAD",Z=A&&(o===301||o===302)&&y.method==="POST",_=o!==307&&o!==308,B=y.methodRewriting&&_;W||Z||B?(y.method="GET",this._dropBody(y)):A&&_&&y.method!=="QUERY"&&this._hasBodyForRedirect(y)&&this._dropBody(y),A?(y.h2session=void 0,this._stripCrossOriginState(y,E)):(E.username=y.username,E.password=y.password);let{allowAbsoluteUrls:G}=y;try{y.allowAbsoluteUrls=!0,y.url=E}finally{y.allowAbsoluteUrls=G}this.redirectUrls.push(E);let b=es(y),S=y.body,pe=y.h2session,K=A?void 0:{...Uc(y),url:new URL(y.url)},Se=await y.trackStateMutations(async ee=>{for(let yt of y.hooks.beforeRedirect)await yt(y,d);return ee});ts(y,y.url,b)&&po(y,y.url),y.clearUnchangedCookieHeader(K,Se);let ue=this._nativeFormDataBody;if(o===307||o===308||y.method==="QUERY"){let ee=y.body===S,yt=Foe(S);if(!ee&&yt)this._destroyBody(S);else if(ee&&ue!==void 0&&y.body===ue.body){let{body:sr,contentType:xe}=PW(ue.form);ue.body=sr,y.body=sr,Se.has("content-type")?ue.contentTypeWasGenerated=!1:ue.contentTypeWasGenerated&&y.setInternalHeader("content-type",xe)}else if(ee&&(yt||w.undefined(y.body)&&(this._hasWrittenBody||this._hasWritableBody))){this._dropBody(y),this._beforeError(new Ne("Cannot follow redirect with a non-replayable body",{},this));return}}if(!A){let ee=K,yt=y.url,sr=!Dr(ee.url,yt);sr&&(o===301||o===302)&&y.method==="POST"&&(y.method="GET",this._dropBody(y)),sr&&(y.h2session===pe&&(y.h2session=void 0),_&&y.method!=="QUERY"&&this._hasUnchangedBodyForRedirect(y,ee,Se)&&this._dropBody(y),this._stripUnchangedCrossOriginState(y,yt,{...ee,changedState:Se,preserveUsername:Ph(Se,yt,"username")||Eh(ee.url,yt,"username"),preservePassword:Ph(Se,yt,"password")||Eh(ee.url,yt,"password")}))}IW({requestId:this._requestId,fromUrl:pi(n),toUrl:pi(y.url),statusCode:o}),this.emit("redirect",y,d),this.options=y,await this._makeRequest()}catch(T){this._beforeError(Yt(T));return}return}if(r.isStream&&r.throwHttpErrors&&!up(d)){this._beforeError(new na(d));return}if(!l&&(!h||r.strictContentLength)){let y=i.headers["content-length"];if(y!==void 0){let T=Number(y);!Number.isNaN(T)&&T>=0&&(this._expectedContentLength=T)}}if(this.emit("downloadProgress",this.downloadProgress),e.on("readable",()=>{this._triggerRead&&this._read()}),this.on("resume",()=>{e.resume()}),this.on("pause",()=>{e.pause()}),this._noPipe){let y=e.readableEnded||O!==void 0;y||(m=!0,x());let T=O?await O:await this._setRawBody(y?e:this);y&&(m=!0,x()),T&&this.emit("response",e);return}this.emit("response",e);for(let y of this._pipedServerResponses)if(!y.headersSent){for(let T in e.headers)if(Object.hasOwn(e.headers,T)){let E=e.headers[T];if(h&&(T==="content-encoding"||T==="content-length"))continue;E!==void 0&&y.setHeader(T,E)}y.statusCode=o}this._triggerRead&&this._read(),m=!0,x()}}async _setRawBody(e=this){try{let r=await e.toArray(),i=r.some(s=>typeof s!="string")?Wj(r.map(s=>typeof s=="string"?Bc(s):s)):Bc(r.join("")),o=e===this&&this._incrementalDecode!==void 0;if(!this.isAborted&&this.response){if(this.response.rawBody=i,e!==this&&(this._downloadedSize=i.byteLength),o)try{let{decoder:s,chunks:a}=this._incrementalDecode,c=s.decode();c.length>0&&a.push(c),hW(this.response,a.join(""))}catch{}return!0}}catch{}finally{this._incrementalDecode=void 0}return!1}async _onResponse(e){try{await this._onResponseBase(e)}catch(r){this._beforeError(Yt(r))}}_onRequest(e){let{options:r}=this,{timeout:n,url:i}=r;vW({requestId:this._requestId,url:QP(this.options),method:r.method,headers:r.headers}),w2(e);let{isGotHttp2Request:o}=e,s=n;if(o){let{socket:l,...p}=n;s=p}this._cancelTimeouts=DP(e,s,i);let a,c=r.cache?"cacheableResponse":"response";e.once(c,l=>{this._onResponse(l)});let u=l=>{this._aborted=!0,e.destroy();let p=l instanceof gn?new tp(l,this.timings??YP(),this):new Ne(l.message,l,this);this._beforeError(p)};e.once("error",l=>{if(a=l,this._request===e){if(EW(l)){queueMicrotask(()=>{this._isRequestStale(e)||u(l)});return}u(l)}}),r.cache||e.once("close",()=>{this._request!==e||e.res||this._stopReading||this._beforeError(a??new Mc({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}),this._unproxyEvents=xh(e,this,Boe),this._request=e,this.emit("uploadProgress",this.uploadProgress),this._sendBody(),this.emit("request",e)}_isRequestStale(e){return this._request!==e||!!e.res||e.destroyed||e.writableEnded}async _asyncWrite(e,r=this){return new Promise((n,i)=>{if(r===this){super.write(e,o=>{if(o){i(o);return}n()});return}this._writeRequest(e,void 0,o=>{if(o){i(o);return}n()},r)})}_sendBody(){let{body:e}=this.options,r=this.redirectUrls.length===0&&!this._discardBodyWrites?this:this._request??this;if(w.nodeStream(e))e.pipe(r);else if(w.buffer(e))this._writeBodyInChunks(e,r);else if(w.typedArray(e)){let n=e,i=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);this._writeBodyInChunks(i,r)}else w.asyncIterable(e)||w.iterable(e)&&!w.string(e)&&!Kl(e)?(async()=>{let n=r===this,i=this.options;try{for await(let o of e)if(this.options!==i||this.options.body!==e||(await this._asyncWrite(o,r),this.options!==i||this.options.body!==e))return;if(this.options===i&&this.options.body===e){if(n){super.end();return}await this._endWritableRequest(r)}}catch(o){if(this.options!==i||this.options.body!==e)return;this._beforeError(Yt(o))}})():w.undefined(e)?((this._noPipe??!1)||!this._methodCanHaveBody||r!==this)&&r.end():this._writeBodyInChunks(Bc(e),r)}_writeBodyInChunks(e,r){let n=r===this;(async()=>{let i;try{i=n?this._request:r;let o=i;if(!o){n&&super.end();return}if(o.destroyed)return;if(await this._writeChunksToRequest(e,o),this._isRequestStale(o)){this._finalizeStaleChunkedWrite(o,n);return}if(n){super.end();return}await this._endWritableRequest(o)}catch(o){let s=Yt(o);if(EW(s)){if(n&&i){let a=i,c=!1,u=()=>{c||!this._isRequestStale(a)||(c=!0,this._finalizeStaleChunkedWrite(a,!0))};u(),c||(a.once("response",u),queueMicrotask(u))}return}if(!n&&this._isRequestStale(r))return;this._beforeError(s)}})()}_finalizeStaleChunkedWrite(e,r){!e.destroyed&&!e.writableEnded&&e.destroy(),r&&(this._skipRequestEndInFinal=!0,super.end())}_emitUploadComplete(e){this._bodySize=this._uploadedSize,this.emit("uploadProgress",this.uploadProgress),e.emit("upload-complete")}async _endWritableRequest(e){await new Promise((r,n)=>{e.end(i=>{if(i){n(i);return}this._request===e&&!e.destroyed&&this._emitUploadComplete(e),r()})})}_stripCrossOriginState(e,r){for(let n of ap)e.deleteInternalHeader(n);e.username="",e.password="",r.username="",r.password=""}_stripUnchangedCrossOriginState(e,r,n){let i=e.getInternalHeaders();for(let o of ap)!n.changedState.has(o)&&i[o]===n.headers[o]&&e.deleteInternalHeader(o);n.preserveUsername||(e.username="",r.username=""),n.preservePassword||(e.password="",r.password="")}get _methodCanHaveBody(){return!Doe.has(this.options.method)||this.options.method==="GET"&&this.options.allowGetBody}_canWriteBody(){return!this._noPipe&&!this.isReadonly&&this._methodCanHaveBody}_hasBodyForRedirect(e){return!w.undefined(e.body)||!w.undefined(e.json)||!w.undefined(e.form)||this._hasWrittenBody||this._hasWritableBody}_hasUnchangedBodyForRedirect(e,r,n){return!n.has("body")&&!n.has("json")&&!n.has("form")&&this._hasBodyForRedirect(e)&&ow(e,r)}_dropBody(e){let{body:r}=this.options,n=!w.undefined(r)||!w.undefined(this.options.json)||!w.undefined(this.options.form);this.options.clearBody(),this._destroyBody(r),!n&&!this.writableEnded&&(this._skipRequestEndInFinal=!0,super.end()),e.clearBody(),this._bodySize=void 0,this._hasWrittenBody=!1,this._hasWritableBody=!1}_destroyBody(e){if(w.nodeStream(e)){let r=e;r.off("error",this._onBodyError),r.unpipe(),r.on("error",TW),r.destroy()}else if(w.asyncIterable(e)||w.iterable(e)&&!w.string(e)&&!Kl(e)){let r=e;if(typeof r.return=="function")try{let n=r.return();n instanceof Promise&&n.catch(TW)}catch{}}}_onBodyError=e=>{this._flushed?this._beforeError(new bh(e,this)):this.flush=async()=>{this.flush=async()=>{},this._beforeError(new bh(e,this))}};async _writeChunksToRequest(e,r){let i=()=>this._isRequestStale(r);for(let o of Fj(e,65536)){if(i())return;await new Promise((s,a)=>{this._writeRequest(o,void 0,c=>{if(i()){s();return}c?a(c):setImmediate(s)},r)})}}_prepareCache(e){if(XP.has(e))return;let r=new g2(((n,i)=>{let o=i&&(a=>{let{beforeCacheHooks:c,gotRequest:u}=n;if(!c||c.length===0){i(a);return}try{for(let l of c){let p=l(a);if(p===!1){a.headers["cache-control"]="no-cache, no-store, must-revalidate",a.headers.pragma="no-cache",a.headers.expires="0",i(a);return}if(w.promise(p))throw new TypeError("beforeCache hooks must be synchronous. The hook returned a Promise, but this hook must return synchronously. If you need async logic, use beforeRequest hook instead.");if(p!==void 0)throw new TypeError("beforeCache hook must return false or undefined. To modify the response, mutate it directly.")}}catch(l){let p=Yt(l);if(u){u._beforeError(p instanceof Ne?p:new Ne(p.message,p,u));return}console.error("Got: beforeCache hook error (request context unavailable):",p),i(a);return}i(a)}),s=n._request(n,o);return w.promise(s)&&(s.once=(a,c)=>{if(a==="error")(async()=>{try{await s}catch(u){c(u)}})();else if(a==="abort"||a==="destroy")(async()=>{try{(await s).once(a,c)}catch{}})();else throw new Error(`Unknown HTTP/2 promise event: ${a}`);return s}),s}),e);XP.set(e,r.request())}async _createCacheableRequest(e,r){return new Promise((n,i)=>{Object.assign(r,{protocol:e.protocol,hostname:w.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,host:w.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash===""?"":e.hash??null,search:e.search===""?"":e.search??null,pathname:e.pathname,href:e.href,path:`${e.pathname||""}${e.search||""}`,...w.string(e.port)&&e.port.length>0?{port:Number(e.port)}:{},...e.username||e.password?{auth:`${e.username||""}:${e.password||""}`}:{}});let o,s=XP.get(r.cache)(r,a=>{(async()=>{if(a._readableState.autoDestroy=!1,o){let c=()=>{a.req?a.complete=a.req.res.complete:a.complete===void 0&&(a.complete=!0)};a.prependOnceListener("end",c),c(),(await o).emit("cacheableResponse",a)}n(a)})()});s.once("error",i),s.once("request",a=>{o=a,n(o)})})}async _makeRequest(){let{options:e}=this,r=(B,F)=>B===F||w.undefined(B),n=(B,{currentHeader:F,explicitHeader:G,nextHeader:b,staleGeneratedHeader:S})=>{w.undefined(b)?!w.undefined(G)&&F===S?e.setInternalHeader(B,G):r(F,S)&&e.deleteInternalHeader(B):e.setInternalHeader(B,b)},i=(B,F,G)=>!G&&(B||F)?`Basic ${qj(`${B}:${F}`)}`:void 0,o=()=>{let B=e.getInternalHeaders();for(let F in B)if(w.undefined(B[F]))e.deleteInternalHeader(F);else{if(w.null(B[F]))throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${F}\` header`);if(Array.isArray(B[F])&&F==="transfer-encoding"){if(B[F].length!==1)throw new TypeError(`The \`${F}\` header must be a single value`);e.setInternalHeader(F,B[F][0])}else if(Array.isArray(B[F])&&Ooe.has(F)){if(B[F].length!==1)throw new TypeError(`The \`${F}\` header must be a single value`);e.setInternalHeader(F,B[F][0])}}return B},s=async B=>{if(!B)return;let F=await B.getCookieString(e.url.toString());return w.nonEmptyString(F)?F:void 0},a=o(),c=e.getInternalHeaders(),u=e.isHeaderExplicitlySet("authorization"),l=u?c.authorization:void 0,p=e.isHeaderExplicitlySet("cookie")?c.cookie:void 0,d=e.isHeaderExplicitlySet("authorization")&&w.undefined(c.authorization),f=e.isHeaderExplicitlySet("cookie")&&w.undefined(c.cookie);if(e.decompress&&w.undefined(a["accept-encoding"])){let B=["gzip","deflate"];Roe&&B.push("br"),Aoe&&B.push("zstd"),e.setInternalHeader("accept-encoding",B.join(", "))}let{username:h,password:m}=e,x=e.cookieJar,C=w.undefined(l)?i(h,m,d):void 0,O;w.undefined(C)||e.setInternalHeader("authorization",C),f||(O=await s(x),w.undefined(O)||e.setInternalHeader("cookie",O));let y,T=!1,E=e.url instanceof URL?new URL(e.url):void 0,M=es(e),k=E?Uc(e):void 0,A=new Set,W=await e.trackStateMutations(async B=>{for(let F of e.hooks.beforeRequest){let G=await F(e,{retryCount:this.retryCount});if(!w.undefined(G)){y=()=>G;break}}return B});if(E&&e.url instanceof URL&&ts(e,e.url,M)&&po(e,e.url),E&&e.url instanceof URL&&!Dr(E,e.url)){let B=new Set(W),F=e.getInternalHeaders(),G={};for(let S of ap)B.has(S)?G[S]=F[S]:(e.deleteInternalHeader(S),A.add(S));let b={headers:G};B.has("url")&&(b.url=e.url),B.has("prefixUrl")&&(b.prefixUrl=e.prefixUrl),B.has("username")&&(b.username=e.username),B.has("password")&&(b.password=e.password),e.stripSensitiveHeaders(E,e.url,b),this._discardBodyWrites=!0,this._hasWrittenBody=!1,this._hasWritableBody=!1,!B.has("body")&&!B.has("json")&&!B.has("form")&&ow(e,k)&&(e.clearBody(),this._bodySize=void 0)}if(y===void 0){let B=e.getInternalHeaders(),F=ue=>e.isHeaderExplicitlySet(ue)&&(Object.hasOwn(B,ue)||W.has(ue))&&w.undefined(B[ue]),G=B.authorization,b=B.cookie,S=F("authorization")||u&&!A.has("authorization")&&w.undefined(G),pe=w.undefined(b)&&(f||F("cookie"));o(),!w.undefined(B["transfer-encoding"])&&!w.undefined(B["content-length"])&&e.deleteInternalHeader("content-length"),S&&(T=!0,e.deleteInternalHeader("authorization"),W.has("authorization")&&w.undefined(l)&&!d&&delete e.headers.authorization);let K=!u&&!d&&!S?i(e.username,e.password,S):void 0,Se=e.cookieJar;if(!(W.has("authorization")&&!w.undefined(G))){let ue=A.has("authorization")||W.has("authorization")&&w.undefined(G)?void 0:l;n("authorization",{currentHeader:G,explicitHeader:ue,nextHeader:K,staleGeneratedHeader:C})}if(pe)e.deleteInternalHeader("cookie"),W.has("cookie")&&w.undefined(p)&&!f&&delete e.headers.cookie;else if(!W.has("cookie")){let ue=!f&&!pe?await s(Se):void 0,Le=A.has("cookie")?void 0:p;n("cookie",{currentHeader:b,explicitHeader:Le,nextHeader:ue,staleGeneratedHeader:O})}}y??=e.getRequestFunction();let Z=T?new URL(pi(e.url)):e.url;if(this._requestOptions=e.createNativeRequestOptions(),T&&(this._requestOptions.auth=void 0),e.cache){this._requestOptions._request=y,this._requestOptions.cache=e.cache,this._requestOptions.body=e.body,this._requestOptions.beforeCacheHooks=e.hooks.beforeCache,this._requestOptions.gotRequest=this;try{this._prepareCache(e.cache)}catch(B){throw new yh(Yt(B),this)}}let _=e.cache?this._createCacheableRequest:y;try{let B=Date.now(),F=e.timeout.request,G=!1,b=_(Z,this._requestOptions);if(w.promise(b)&&(b=await b,e.timeout.request!==void 0)){let S=e.timeout.request-(Date.now()-B);e.timeout.request=Math.max(0,S),G=!0}try{mW(b)?this._onRequest(b):this.writableEnded?this._onResponse(b):(this.once("finish",()=>{this._onResponse(b)}),this._sendBody())}finally{G&&(e.timeout.request=F)}}catch(B){throw B instanceof Qo?new yh(B,this):B}}async _error(e){try{if(this.options&&(!(e instanceof na)||this.options.throwHttpErrors)){let r=this.options.hooks.beforeError;if(r.length>0){for(let n of r)if(e=await n(e),!(e instanceof Error))throw new TypeError(`The \`beforeError\` hook must return an Error instance. Received ${w.string(e)?"string":typeof e}.`);e instanceof Ne||CW.add(e)}}}catch(r){let n=Yt(r);e=new Ne(n.message,n,this)}xW({requestId:this._requestId,url:QP(this.options),error:e,timings:this.timings}),this.destroy(e),this._noPipe&&lp.default.nextTick(()=>{this.emit("error",e)})}_writeRequest(e,r,n,i=this._request){if(!i||i.destroyed){n();return}i.write(e,r,o=>{if(!o&&!i.destroyed&&this._request===i){let s=typeof e=="string"?ZP.Buffer.from(e,r):e;this._uploadedSize+=Uv(s);let a=this.uploadProgress;a.percent<1&&this.emit("uploadProgress",a)}n(o)})}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??void 0}get downloadProgress(){return kW(this._downloadedSize,this._responseSize)}get uploadProgress(){return kW(this._uploadedSize,this._bodySize)}get timings(){return this._request?.timings}get isFromCache(){return this.response?.isFromCache}get reusedSocket(){return this._request?.reusedSocket}get isReadonly(){return!w.undefined(this.options?.body)||!w.undefined(this.options?.json)||!w.undefined(this.options?.form)}};var joe=new Set(["gzip","deflate","br","zstd"]),Woe=["request","response","redirect","uploadProgress","downloadProgress"];function sw(t){let e,r,n=new DW.EventEmitter,i=!1,o=new Promise((a,c)=>{let u=(l,p)=>{let d=t??new qc(void 0,void 0,p);d.retryCount=l,d._noPipe=!0,e=d,d.once("response",x=>{(async()=>{let C=(x.headers["content-encoding"]??"").toLowerCase(),O=joe.has(C),{options:y}=d;if(O&&!y.decompress)x.body=x.rawBody;else try{x.body=JP(x,y.responseType,y.parseJson,y.encoding)}catch(T){try{x.body=jc(x.rawBody)}catch(E){d._beforeError(new cp(Yt(E),x));return}if(up(x)){d._beforeError(Yt(T));return}}try{let T=y.hooks.afterResponse;for(let[E,M]of T.entries()){let k=y.url?new URL(y.url):void 0,A=es(y),W=k?Uc(y):void 0,Z=x.request.options,_=x;if(x=await Z.trackStateMutations(async B=>M(_,async F=>{let G=F.preserveHooks??!1,b=F===Z,S=b?B.has("body")||B.has("json")||B.has("form"):Object.hasOwn(F,"body")&&F.body!==void 0||Object.hasOwn(F,"json")&&F.json!==void 0||Object.hasOwn(F,"form")&&F.form!==void 0,pe=Object.hasOwn(F,"cookieJar")&&F.cookieJar===void 0;if(S&&!b&&y.clearBody(),!b&&pe&&(y.cookieJar=void 0),!b){let{url:Se,...ue}=F;y.merge(ue),y.syncCookieHeaderAfterMerge(W,ue.headers)}y.clearUnchangedCookieHeader(W,b?B:void 0);let K=y.url;if(k&&K instanceof URL&&ts(y,K,A)&&po(y,K),!b&&F.url===void 0&&k&&K instanceof URL&&!Dr(k,K)&&(y.stripSensitiveHeaders(k,K,F),S||y.clearBody()),F.url!==void 0){let Se=b?y.url:iw(y,F.url,F);k&&(b&&!Dr(k,Se)?y.stripUnchangedCrossOriginState(W,B,{clearBody:!S}):(y.stripSensitiveHeaders(k,Se,F),!Dr(k,Se)&&!S&&y.clearBody()))}throw G||(y.hooks.afterResponse=y.hooks.afterResponse.slice(0,E)),new Bv(d)})),!(w.object(x)&&w.number(x.statusCode)&&"body"in x))throw new TypeError("The `afterResponse` hook returned an invalid value")}}catch(T){d._beforeError(Yt(T));return}if(r=x,!up(x)){d._beforeError(new na(x));return}d.destroy(),i=!0,a(d.options.resolveBodyOnly?x.body:x)})()});let f=!1,h=x=>{if(!d._stopReading){d._beforeError(x);return}if(f)return;f=!0,i=!0;let{options:C}=d;if(x instanceof na&&!C.throwHttpErrors){let{response:O}=x;d.destroy(),a(C.resolveBodyOnly?O.body:O);return}c(x)};d.on("error",h);let m=d.options?.body;d.once("retry",(x,C)=>{if(t=void 0,i)return;let O=d.options.body;if(m===O&&(w.nodeStream(O)||O instanceof ReadableStream)){C.message="Cannot retry with consumed body stream",h(C);return}u(x,d.options)}),xh(d,n,Woe),w.undefined(t)&&d.flush()};u(0)});o.on=function(a,c){return n.on(a,c),this},o.once=function(a,c){return n.once(a,c),this},o.off=function(a,c){return n.off(a,c),this};let s=(a,c)=>{let u=(async()=>{await a;let{options:l}=r.request;if(c==="text"){let p=jc(r.rawBody,l.encoding);return kh(l.encoding)?p.replace(new RegExp("^\\u{FEFF}","v"),""):p}return JP(r,c,l.parseJson,l.encoding)})();return Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)),u};return o.json=function(){if(e.options){let{headers:a}=e.options;!e.writableFinished&&!("accept"in a)&&(a.accept="application/json")}return s(this,"json")},o.buffer=function(){return s(this,"buffer")},o.text=function(){return s(this,"text")},o}var Hoe=t=>w.function(t),qoe=["get","post","put","patch","head","delete","query"],$oe="The `url` option is not supported in options objects. Pass it as the first argument instead.",Ah=t=>{if(Object.hasOwn(t,"url"))throw new TypeError($oe)},LW=t=>{t={options:new Un(void 0,void 0,t.options),handlers:[...t.handlers],mutableDefaults:t.mutableDefaults},Object.defineProperty(t,"mutableDefaults",{enumerable:!0,configurable:!1,writable:!1});let e=(i,o,s,a)=>{w.plainObject(i)&&Ah(i),w.plainObject(o)&&Ah(o);let c=i,u=o;a&&(w.plainObject(i)?(c=Object.defineProperties({},Object.getOwnPropertyDescriptors(i)),Reflect.set(c,"isStream",!0)):w.plainObject(o)&&(u=Object.defineProperties({},Object.getOwnPropertyDescriptors(o)),Reflect.set(u,"isStream",!0)));let l=new qc(c,u,s);a&&l.options&&(l.options.isStream=!0);let p,d=l.options?.url instanceof URL?new URL(l.options.url):void 0,f=l.options?es(l.options):void 0,h=C=>{d&&f&&C?.url instanceof URL&&ts(C,C.url,f)&&po(C,C.url),l.options=C;let O=C?.isStream??a;return l._noPipe=!O,l.flush(),O?l:(p??=sw(l),p)},m=0,x=C=>{let y=(t.handlers[m++]??h)(C,x);if(w.promise(y)&&!l.options?.isStream&&(p??=sw(l),y!==p)){let T=Object.getOwnPropertyDescriptors(p);for(let E in T)E in y&&delete T[E];Object.defineProperties(y,T)}return y};return x(l.options)},r=((i,o,s=t.options)=>e(i,o,s,!1));r.extend=(...i)=>{let o=new Un(void 0,void 0,t.options),s=[...t.handlers],a;for(let c of i)Hoe(c)?(o.merge(c.defaults.options),s.push(...c.defaults.handlers),a=c.defaults.mutableDefaults):(Ah(c),o.merge(c),c.handlers&&s.push(...c.handlers),a=c.mutableDefaults);return LW({options:o,handlers:s,mutableDefaults:!!a})};let n=(async function*(i,o){w.plainObject(i)&&Ah(i),w.plainObject(o)&&Ah(o);let s=new Un(i,o,t.options);s.resolveBodyOnly=!1;let{pagination:a}=s;we.function(a.transform),we.function(a.shouldContinue),we.function(a.filter),we.function(a.paginate),we.number(a.countLimit),we.number(a.requestLimit),we.number(a.backoff);let c=[],{countLimit:u}=a,l=0;for(;l<a.requestLimit;){l!==0&&await(0,OW.setTimeout)(a.backoff);let p=await r(void 0,void 0,s),d=await a.transform(p),f=[];we.array(d);for(let T of d)if(a.filter({item:T,currentItems:f,allItems:c})&&(!a.shouldContinue({item:T,currentItems:f,allItems:c})||(yield T,a.stackAllItems&&c.push(T),f.push(T),--u<=0)))return;let h=p.request.options,m=h.url?new URL(h.url):void 0,x=es(h),C=m?Uc(h):void 0,[O,y]=await h.trackStateMutations(async T=>[a.paginate({response:p,currentItems:f,allItems:c}),T]);if(O===!1)return;if(O===p.request.options){if(s=p.request.options,s.clearUnchangedCookieHeader(C,y),m){let T=s.url;T&&ts(s,T,x)&&po(s,T),T&&!Dr(m,T)&&(s.prefixUrl="",s.stripUnchangedCrossOriginState(C,y))}}else{let T=s,E=T.url instanceof URL?new URL(T.url):void 0,M=es(T),k=Object.hasOwn(O,"body")&&O.body!==void 0||Object.hasOwn(O,"json")&&O.json!==void 0||Object.hasOwn(O,"form")&&O.form!==void 0,A=Object.hasOwn(O,"cookieJar")&&O.cookieJar===void 0;k&&T.clearBody(),A&&(T.cookieJar=void 0);let{url:W,...Z}=O;T.merge(Z),T.syncCookieHeaderAfterMerge(C,Z.headers),T.url instanceof URL&&ts(T,T.url,M)&&po(T,T.url),W===void 0&&m&&T.url instanceof URL&&!Dr(m,T.url)&&(T.stripSensitiveHeaders(m,T.url,O),k||T.clearBody()),m&&E&&!Dr(E,m)&&(T.stripSensitiveHeaders(E,m,O),k||T.clearBody());try{we.any([w.string,w.urlInstance,w.undefined],O.url)}catch(_){throw _ instanceof Error&&(_.message=`Option 'pagination.paginate.url': ${_.message}`),_}if(W!==void 0){let _=iw(T,W,{...O,baseUrl:m});(T.prefixUrl.toString()!==M.prefixUrl||T.allowAbsoluteUrls!==M.allowAbsoluteUrls)&&po(T,_),m&&(T.stripSensitiveHeaders(m,_,O),!Dr(m,_)&&!k&&T.clearBody())}s=T}l++}});r.paginate=n,r.paginate.all=(async(i,o)=>Array.fromAsync(n(i,o))),r.paginate.each=n,r.stream=((i,o)=>e(i,o,t.options,!0));for(let i of qoe)r[i]=((o,s)=>r(o,{...s,method:i})),r.stream[i]=((o,s)=>e(o,{...s,method:i},t.options,!0));return t.mutableDefaults||(Object.freeze(t.handlers),t.options.freeze()),Object.defineProperty(r,"defaults",{value:t,writable:!1,configurable:!1,enumerable:!0}),r},NW=LW;var Voe={options:new Un,handlers:[],mutableDefaults:!1},Goe=NW(Voe),MW=Goe;var $c=v(H());var pp=Symbol("IRequestOptionsProvider");var ua=class{constructor(e,r){this.fs=e;this.options=r;this.autoLocalhostPortFallbacks={}}async fetch(e,r=zt,n){try{let o=(0,BW.dataUriToBuffer)(e);return{ok:!0,url:e,body:new TextDecoder().decode(o.buffer),statusCode:200}}catch{}let i=wr(e)?e:mt(e);if(i)try{return{ok:!0,url:e,body:await this.fs.readFile(i,"utf-8"),statusCode:200}}catch(o){return{ok:!1,url:e,error:o,statusCode:200}}return this.fetchHttp(e,r,n)}async fetchJson(e,r,n){let i=await this.fetch(e,r,{Accept:"application/json",...n});if(!i.ok)return i;try{return{...i,body:JSON.parse(i.body)}}catch(o){return{...i,ok:!1,url:e,error:o}}}async fetchHttp(e,r,n){let i=new URL(e),o=i.protocol!=="http:",s=Number(i.port)??(o?443:80),a={headers:n,followRedirect:!0};o&&await Ju(e)&&(a.https={...a.https,rejectUnauthorized:!1}),this.options?.provideOptions(a,e);let c=i.hostname==="localhost";if(c&&this.autoLocalhostPortFallbacks[s]){let p=await this.requestHttp(i.toString(),a,r);return p.statusCode!==503?p:(delete this.autoLocalhostPortFallbacks[s],this.requestHttp(e,a,r))}let l=await this.requestHttp(e,a,r);if(l.statusCode===503&&c){let p;try{p=await FW.promises.lookup(i.hostname)}catch{return l}i.hostname=p.family===6?"127.0.0.1":"[::1]",l=await this.requestHttp(i.toString(),a,r),l.statusCode!==503&&(this.autoLocalhostPortFallbacks[s]=i.hostname)}return l}async requestHttp(e,r,n){this.options?.provideOptions(r,e);let i=new Ce,o=new AbortController;r.signal=o.signal;try{let s=MW(e,r);i.push(n.onCancellationRequested(()=>o.abort()));let a=await s;return{ok:!0,url:e,body:a.body,statusCode:a.statusCode}}catch(s){if(!(s instanceof Ne))throw s;let a=s.response?String(s.response?.body):s.message,c=s.response?.statusCode??503;return{ok:!1,body:a,statusCode:c,url:e,error:new my(c,e,a)}}finally{i.dispose()}}};ua=I([(0,$c.injectable)(),g(0,(0,$c.inject)(ve)),g(1,(0,$c.optional)()),g(1,(0,$c.inject)(pp))],ua);var Vc=class extends ua{constructor(r,n,i,o,s){super(r,s);this.logger=n;this.target=i;this.cdp=o;this.disposables=new Ce}dispose(){this.disposables.dispose()}async fetchHttp(r,n,i={}){let o=await super.fetchHttp(r,n,i);return o.ok?o:(this.logger.info("runtime","Network load failed, falling back to CDP",{url:r,res:o}),this.fetchOverBrowserNetwork(r,o))}async fetchOverBrowserNetwork(r,n){if(!this.cdp)return n;let i=await this.cdp.Network.loadNetworkResource({frameId:this.target?.targetInfo.targetId,url:r,options:{includeCredentials:!0,disableCache:!0}});if(!i||!i.resource.success||!i.resource.httpStatusCode||i.resource.httpStatusCode>=400||!i.resource.stream)return n;let o=Number(i.resource.headers?.["Content-Length"]);isNaN(o)&&(o=1/0);let s=[],a=0;for(;;){let c=await this.cdp.IO.read({handle:i.resource.stream,offset:a});if(!c)return this.logger.info("runtime","Stream error encountered in middle, falling back",{url:r}),n;let u=c.base64Encoded?Buffer.from(c.data,"base64").toString():c.data;if(a+=Buffer.byteLength(u,"utf-8"),s.push(u),a>=o){this.cdp.IO.close({handle:i.resource.stream});break}if(c.eof)break}return{ok:!0,body:s.join(""),statusCode:i.resource.httpStatusCode,url:r}}};Vc=I([(0,jn.injectable)(),g(0,(0,jn.inject)(ve)),g(1,(0,jn.inject)(Y)),g(2,(0,jn.optional)()),g(2,(0,jn.inject)(lo)),g(3,(0,jn.optional)()),g(3,(0,jn.inject)(lt)),g(4,(0,jn.optional)()),g(4,(0,jn.inject)(pp))],Vc);var la=v(H()),WW=v(Vf());function jW(t,e=Rr){let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(i.startsWith("!")){let o=UW(i.slice(1),e);for(let s=0;s<r.length;s++)r[s]=`^(?!${o.slice(1)})${r[s].slice(1)}`}else r.push(UW(i,e))}return r.map(n=>new RegExp(n,"i"))}function UW(t,e=Rr){let r=t.split("/"),n=[];for(let i=0;i<r.length;i++){let o=r[i];if(o==="**")i===0?n.push("(.+/)?"):i===r.length-1||n.push(".*/");else{if(o.includes("*")){let s=o.split("*");n.push(s.map(a=>e(a)).join("[^\\/]*"))}else n.push(e(o));n.push(i<r.length-1?"\\/":"$")}}return`^${n.join("")}`}function zoe(t){let e=/^<node_internals>[\/\\](.*)$/,r=t.map(n=>{n=n.trim();let i=e.exec(n);return i?i[1]:null}).filter(at);return r.length>0?r:void 0}function Koe(t,e){return e.filter(n=>!n.includes(ii)).map(n=>wr(n)?Xu(t.rebaseLocalToRemote(n)):ze(n)).map(By)}var fo=class{constructor({skipFiles:e},r,n,i,o){this.logger=n;this.cdp=i;this._regexForAuthored=Kk(e=>jW(e,r=>Lf(r,0,r.length,!0,!0)));this._scriptsWithSkipping=new Set;this._targetId=o.id(),this._rootTargetId=HW(o).id(),this._isUrlFromSourceMapSkipped=new Vi(s=>this._normalizeUrl(s)),this._authoredGlobs=Koe(r,e),this._nodeInternalsGlobs=zoe(e),this._initNodeInternals(o),this._updateSkippedDebounce=Xk(500,()=>this._updateGeneratedSkippedSources()),e.length&&this._updateGeneratedSkippedSources(),this._sharedSkipListener=fo.sharedSkipsEmitter.event(s=>{s.rootTargetId===this._rootTargetId&&s.targetId!==this._targetId&&this._toggleSkippingFile(s.params)})}dispose(){this._sharedSkipListener.dispose()}setSourceContainer(e){this._sourceContainer=e}_testSkipNodeInternal(e){return this._nodeInternalsGlobs?(e.startsWith(ni)&&(e=e.slice(ni.length)),(0,WW.default)([e],this._nodeInternalsGlobs).length>0):!1}_testSkipAuthored(e){return this._regexForAuthored(this._authoredGlobs).some(r=>r.test(e))}_isNodeInternal(e,r){return e.startsWith(ni)?!0:r?.has(e)||/^internal\/.+\.js$/.test(e)}async _updateGeneratedSkippedSources(){let e=this._regexForAuthored(this._authoredGlobs).map(n=>n.source),r=this._allNodeInternals?.settledValue;if(r){e.push(`^(${ni})?internal\\/`);for(let n of r)this._testSkipNodeInternal(n)&&e.push(`^(${ni})?${Rr(n)}$`)}await this.cdp.Debugger.setBlackboxPatterns({patterns:e})}_normalizeUrl(e){return ze(e.toLowerCase())}isScriptSkipped(e){return this._isNodeInternal(e,this._allNodeInternals?.settledValue)?this._testSkipNodeInternal(e):(e=this._normalizeUrl(e),this._isUrlFromSourceMapSkipped.get(e)===!0?!0:this._testSkipAuthored(e))}async _updateSourceWithSkippedSourceMappedSources(e,r){let n=this.isScriptSkipped(e.url),i=[],o=n;for(let a of e.sourceMap.sourceByUrl.values()){let c=this.isScriptSkipped(a.url);if(typeof c>"u"&&(c=n),c!==o){let[[u],[l]]=await Promise.all([this._sourceContainer.currentSiblingUiLocations({source:a,lineNumber:1,columnNumber:1},e),this._sourceContainer.currentSiblingUiLocations({source:a,lineNumber:1/0,columnNumber:1},e)]);u&&l?(i.push({lineNumber:u.lineNumber-1,columnNumber:u.columnNumber-1},{lineNumber:l.lineNumber-1,columnNumber:l.columnNumber-1}),o=!o):this.logger.error("internal","Could not map script beginning for "+a.sourceReference)}}let s=r;i.length||(s=s.filter(a=>this._scriptsWithSkipping.has(a.scriptId)),s.forEach(a=>this._scriptsWithSkipping.delete(a.scriptId))),s.map(({scriptId:a})=>this.cdp.Debugger.setBlackboxedRanges({scriptId:a,positions:i}))}initializeSkippingValueForSource(e){this._initializeSkippingValueForSource(e)}_initializeSkippingValueForSource(e,r=e.scripts){let n=e.url,i=this.isScriptSkipped(n);if(!i&&e.absolutePath&&this._testSkipAuthored(We(e.absolutePath))&&(this.setIsUrlBlackboxSkipped(n,!0),i=!0,this._updateSkippedDebounce()),Ar(e)){if(i)for(let o of e.sourceMap.sourceByUrl.values())this._isUrlFromSourceMapSkipped.set(o.url,!0);for(let o of e.sourceMap.sourceByUrl.values())this._initializeSkippingValueForSource(o,r);this._updateSourceWithSkippedSourceMappedSources(e,r)}}async _initNodeInternals(e){if(e.type()!=="node"||!this._nodeInternalsGlobs||this._allNodeInternals)return;let r=this._allNodeInternals=Ue(),n=await this.cdp.Runtime.evaluate({expression:"require('module').builtinModules"+ht(),returnByValue:!0,includeCommandLineAPI:!0});n&&!n.exceptionDetails?r.resolve(new Set(n.result.value.map(i=>i+".js"))):r.resolve(new Set),await this._updateGeneratedSkippedSources()}async _toggleSkippingFile(e){let r;e.resource&&wr(e.resource)&&(r=e.resource);let n={path:r,sourceReference:e.sourceReference},i=this._sourceContainer.source(n);if(!i)return{};let o=!this.isScriptSkipped(i.url);if(i instanceof Ct){this._isUrlFromSourceMapSkipped.set(i.url,o);let s=Array.from(i.compiledToSourceUrl.keys());await Promise.all(s.map(a=>this._updateSourceWithSkippedSourceMappedSources(a,a.scripts)))}else{if(Ar(i))for(let s of i.sourceMap.sourceByUrl.values())this._isUrlFromSourceMapSkipped.set(s.url,o);this.setIsUrlBlackboxSkipped(i.url,o),await this._updateGeneratedSkippedSources()}return{}}setIsUrlBlackboxSkipped(e,r){let n=e,i=`!${n}`,o=this._authoredGlobs.filter(s=>s!==n&&s!==i);this._regexForAuthored(o).some(s=>s.test(e))!==r&&(o.push(r?n:i),this._regexForAuthored.clear()),this._authoredGlobs=o}async toggleSkippingFile(e){let r=await this._toggleSkippingFile(e);return fo.sharedSkipsEmitter.fire({params:e,rootTargetId:this._rootTargetId,targetId:this._targetId}),r}};fo.sharedSkipsEmitter=new j,fo=I([(0,la.injectable)(),g(0,(0,la.inject)(Re)),g(1,(0,la.inject)(je)),g(2,(0,la.inject)(Y)),g(3,(0,la.inject)(lt)),g(4,(0,la.inject)(lo))],fo);function HW(t){let e=t.parent();return e?HW(e):t}var Dh=v(H()),$W=require("path");var qW=/^webpack:\/{3}([^/]+?\.vue)(\?[0-9a-z]*)?$/i,Joe=/^webpack:\/{3}\.\/.+\.vue\?[0-9a-z]+$/i,fp=Symbol("IVueFileMapper");var dp=class{constructor(e,r){this.files=e;this.search=r;this.getMapping=me(async()=>{let e=new Map;return await this.search.streamAllChildren(this.files,r=>e.set((0,$W.basename)(r),r)),e})}async lookup(e){let r=qW.exec(e);return r?(await this.getMapping()).get(r[1]):void 0}getVueHandling(e){return this.files.empty?0:qW.test(e)?1:Joe.test(e)?2:0}};dp=I([(0,Dh.injectable)(),g(0,(0,Dh.inject)(Bo)),g(1,(0,Dh.inject)(Yu))],dp);var ho=class{constructor(){this.changeEmitter=new j;this.addEmitter=new j;this.removeEmitter=new j;this.targetMap=new Map;this.onChanged=this.changeEmitter.event;this.onAdd=this.addEmitter.event;this.onRemove=this.removeEmitter.event}get size(){return this.targetMap.size}add(e,r){this.targetMap.set(e,r),this.addEmitter.fire([e,r]),this.changeEmitter.fire()}get(e){return this.targetMap.get(e)}remove(e){let r=this.targetMap.get(e);return r===void 0?!1:(this.targetMap.delete(e),this.removeEmitter.fire([e,r]),this.changeEmitter.fire(),!0)}value(){return this.targetMap.values()}};var Gc=v(H());var mp=Symbol("IDefaultBrowserProvider"),hp=class{constructor(e,r){this.location=e;this.vscode=r;this.lookup=me(async()=>{let e;return this.location==="remote"&&this.vscode?e=await this.vscode.commands.executeCommand("js-debug-companion.defaultBrowser"):e=(await Promise.resolve().then(()=>(aH(),sH)).then(n=>n.default())).name,["chrome","edge"].find(n=>e.toLowerCase().includes(n))??"other"})}};hp=I([(0,Gc.injectable)(),g(0,(0,Gc.inject)(ui)),g(1,(0,Gc.optional)()),g(1,(0,Gc.inject)(Dt))],hp);var uH=v(H()),lw=v(require("os"));var uw=class{async setup(){}dispose(){}write(e){if(e.level>2)throw new Error(e.message);console.log(JSON.stringify(e))}};var iE=class{constructor(e=512){this.size=e;this.items=[];this.i=0}write(e){this.items[this.i]=e,this.i=(this.i+1)%this.size}read(){return this.items.slice(this.i).concat(this.items.slice(0,this.i))}},Wn=class{constructor(){this.logTarget={queue:[]};this.logBuffer=new iE(1)}static async test(){let e=new Wn;return e.setup({sinks:[new uw],showWelcome:!1}),e}info(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:1})}verbose(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:0})}warn(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:2})}error(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:3})}fatal(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:4})}assert(e,r){if(e===!1||e===void 0||e===null){if(this.error("runtime.assertion",r,{error:new Error("Assertion failed")}),process.env.JS_DEBUG_THROW_ASSERTIONS)throw new Error(r);debugger;return!1}return!0}log(e){if(this.logBuffer.write(e),"queue"in this.logTarget){this.logTarget.queue.push(e);return}for(let r of this.logTarget.sinks)r.write(e)}getRecentLogs(){return this.logBuffer.read()}dispose(){if("sinks"in this.logTarget){for(let e of this.logTarget.sinks)e.dispose();this.logTarget={queue:[]}}}forTarget(){return this}async setup(e){if(await Promise.all(e.sinks.map(n=>n.setup())),e.showWelcome!==!1){let n=rse();for(let i of e.sinks)i.write(n)}let r=this.logTarget;this.logTarget={sinks:e.sinks.slice()},"sinks"in r?r.sinks.forEach(n=>n.dispose()):r.queue.forEach(n=>this.log(n))}};Wn.null=(()=>{let e=new Wn;return e.setup({sinks:[]}),e})(),Wn=I([(0,uH.injectable)()],Wn);var rse=()=>({timestamp:Date.now(),tag:"runtime.welcome",level:1,message:`${Zm} v${za} started`,metadata:{os:`${lw.platform()} ${lw.arch()}`,nodeVersion:process.version,adapterVersion:za}});var Oh=Symbol("MutableLaunchConfig"),lH=t=>{let e=new j;return new Proxy({},{ownKeys(){return Object.keys(t)},get(r,n){switch(n){case"update":return i=>{t=i,e.fire()};case"onChange":return e.event;default:return t[n]}}})};var e$=v(Mq()),Cw=v(H());var Qc=Symbol("touched"),fa;(c=>{function t(){return{children:{},[Qc]:1}}c.root=t;function e(u,l){return u[Qc]=1,a(u,s(l),0)}c.getPath=e;function r(u){u[Qc]=1}c.touch=r;function n(u){u[Qc]=2}c.touchAll=n;function i(u,l){let p=u.children[l]??={children:{}};return p[Qc]=1,p}c.getOrMakeChild=i;function o(u){if(u[Qc]){for(let[l,p]of Object.entries(u.children))switch(p[Qc]){case 1:o(p);break;case 2:break;default:delete u.children[l]}return u}}c.prune=o;function s(u){let l=u.split(/\/|\\/);return l[0]===""&&l.unshift(),l}function a(u,l,p){let d=i(u,l[p]);return p===l.length-1?d:a(d,l,p+1)}})(fa||={});var UE=require("fs"),jE=v(Vf()),Zc=require("path"),Zq=v(Qq());var Ice=/\//g,Iw=class{constructor(e){this.stat=Ro(e=>UE.promises.lstat(e));this.readdir=Ro(e=>UE.promises.readdir(e,{withFileTypes:!0}));this.alreadyProcessedFiles=new Set;this.fileEmitter=new j;this.onFile=this.fileEmitter.event;this.errorEmitter=new j;this.onError=this.errorEmitter.event;this.processor=e.fileProcessor,this.filter=e.filter,this.ignore=e.ignore.map(i=>jE.default.matcher((0,Zq.default)(ze(i),{cwd:e.cwd})));let r=(0,Zc.isAbsolute)(e.pattern)?(0,Zc.relative)(e.cwd,e.pattern):e.pattern,n=jE.default.parse(ze(r),{ignore:e.ignore,cwd:e.cwd,expand:!0});this.done=Promise.all(n.map(i=>{let o=[];for(let u=1;u<i.tokens.length;){let l=u+1;for(;l<i.tokens.length&&i.tokens[l].type!=="slash";)l++;let p=i.tokens[u];p.type==="globstar"?o.push("**"):l===u+1&&p.type==="text"?o.push(p.value):o.push(new RegExp("^"+i.tokens.slice(u,l).map(d=>d.output||d.value).join("")+"$")),u=l+1}let s=o[0]==="**"?[0,1]:[0],a=fa.getPath(e.cache,e.cwd),c={elements:o,seen:new Set};return Promise.all(s.map(u=>this.readSomething(c,u,e.cwd,[],a)))})).then(()=>{})}async readSomething(e,r,n,i,o){if(this.alreadyProcessedFiles.has(o))return;let s=`${r}:${n}`;if(e.seen.has(s))return;e.seen.add(s);let a;try{a=await this.stat(n)}catch(u){this.errorEmitter.fire({path:n,error:u});return}if(this.alreadyProcessedFiles.has(o))return;let c=o.data;if(c&&a.mtimeMs===c.mtime){if(c.type===0){let u=[],p=Object.entries(o.children).filter(([,d])=>d.data?.type!==0).map(([d])=>d);for(let[d,f]of Object.entries(o.children))u.push(f.data!==void 0?this.handleDirectoryEntry(e,r,n,{name:d,type:f.data.type},p,o):this.stat(n).then(h=>this.handleDirectoryEntry(e,r,n,{name:d,type:h.isFile()?1:0},p,o),()=>{}));await Promise.all(u)}else c.type===1&&(this.alreadyProcessedFiles.add(o),this.fileEmitter.fire(c.extracted));return}a.isDirectory()?await this.handleDir(e,r,a.mtimeMs,n,o):(this.alreadyProcessedFiles.add(o),await this.handleFile(a.mtimeMs,n,i,o))}applyFilterToFile(e,r,n){let i=n.children[e];if(this.alreadyProcessedFiles.has(i))return!1;if(!this.filter)return!0;let o=i.data?.type===1?i.data.extracted:void 0;return fa.touch(i),this.filter(r,o)}handleDirectoryEntry(e,r,n,i,o,s){let a=n+"/"+i.name,c=this.getDirectoryReadDescends(e,r,n,i);if(c===void 0)return;let u=fa.getOrMakeChild(s,i.name);if(!(i.type===1&&!this.applyFilterToFile(i.name,a,s)))return typeof c=="number"?this.readSomething(e,r+c,a,o,u):Promise.all(c.map(l=>this.readSomething(e,r+l,a,o,u)))}getDirectoryReadDescends(e,r,n,i){let o=n+"/"+i.name;if(this.ignore.some(c=>c(o)))return;let s=r===e.elements.length-1,a=e.elements[r];if(a==="**")return i.type===1?s?0:this.getDirectoryReadDescends(e,r+1,n,i):s?0:[0,1];if((a instanceof RegExp&&a.test(i.name)||a===i.name)&&(i.type===0?!s:s))return 1}async handleFile(e,r,n,i){let o=Zc.sep==="/"?r:r.replace(Ice,Zc.sep),s;try{s=await this.processor(o,{siblings:n,mtime:e})}catch(a){this.errorEmitter.fire({path:o,error:a});return}i.data={type:1,mtime:e,extracted:s},this.fileEmitter.fire(s)}async handleDir(e,r,n,i,o){let s;try{s=await this.readdir(i)}catch(u){this.errorEmitter.fire({path:i,error:u});return}let a=[],c=s.filter(u=>u.isFile()).map(u=>u.name);for(let u of s){if(u.name.startsWith("."))continue;let l;if(u.isDirectory())l=0;else if(u.isFile())l=1;else continue;a.push(this.handleDirectoryEntry(e,r,i,{name:u.name,type:l},c,o))}await Promise.all(a),o.data={type:0,mtime:n}}};var _p=class{constructor(e){this.logger=e}async streamAllChildren(e,r){let n=[];return await this.globForFiles(e,o=>n.push(r(ft(o.path)))),(await Promise.all(n)).filter(o=>o!==void 0)}async streamChildrenWithSourcemaps(e){let r=[],n=e.lastState||{},i={};return await Promise.all([...e.files.explode()].map(async s=>{let a=JSON.stringify(s),c=n[a]||fa.root();await this._streamChildrenWithSourcemaps(c,e,r,s);let u=fa.prune(c);u&&(i[a]=u)})),this.logger.info("sourcemap.parsing",`turboGlobStream search found ${r.length} files`),{values:(await Promise.all(r)).filter(at),state:i}}async _streamChildrenWithSourcemaps(e,r,n,i){let o=new Iw({pattern:i.pattern,ignore:i.negations,cwd:i.cwd,cache:e,filter:r.filter,fileProcessor:(s,a)=>dL(s,a).then(c=>c&&r.processMap(c))});o.onError(({path:s,error:a})=>{this.logger.warn("sourcemap.parsing","Error parsing source map",{error:a,path:s})}),o.onFile(s=>s&&n.push(r.onProcessedMap(s))),await o.done}async globForFiles(e,r){await Promise.all([...e.explode()].map(n=>new Promise((i,o)=>(0,e$.default)([n.pattern,"!**/*.asar/**"],{ignore:n.negations,cwd:n.cwd}).on("data",r).on("end",i).on("error",o))))}};_p=I([(0,Cw.injectable)(),g(0,(0,Cw.inject)(Y))],_p);var Mw=v(ge()),ya=v(H());var t$=v(require("path")),r$=require("url");var Tw=class{constructor(){this._onFrameAddedEmitter=new j;this._onFrameRemovedEmitter=new j;this._onFrameNavigatedEmitter=new j;this.onFrameAdded=this._onFrameAddedEmitter.event;this.onFrameRemoved=this._onFrameRemovedEmitter.event;this.onFrameNavigated=this._onFrameNavigatedEmitter.event;this._frames=new Map}attached(e,r){e.Page.enable({}),e.Page.getResourceTree({}).then(n=>{this._processCachedResources(e,n?n.frameTree:void 0,r)})}mainFrame(){return this._mainFrame}_processCachedResources(e,r,n){r&&this._addFramesRecursively(e,r,r.frame.parentId,n),e.Page.on("frameAttached",i=>{this._frameAttached(e,n,i.frameId,i.parentFrameId)}),e.Page.on("frameNavigated",i=>{this._frameNavigated(e,n,i.frame)}),e.Page.on("frameDetached",i=>{this._frameDetached(e,n,i.frameId)})}_addFrame(e,r,n){let i=new HE(this,e,r,n);return this._frames.set(i.id,i),i.isMainFrame()&&(this._mainFrame=i),this._onFrameAddedEmitter.fire(i),i}_frameAttached(e,r,n,i){let o=this._frames.get(n);return o||(o=this._addFrame(e,n,i)),o._ref(r),o}_frameNavigated(e,r,n){let i=this._frames.get(n.id);i||(i=this._frameAttached(e,r,n.id,n.parentId)),i._navigate(n,r),this._onFrameNavigatedEmitter.fire(i)}_frameDetached(e,r,n){let i=this._frames.get(n);i&&i._unref(r)}frameForId(e){return this._frames.get(e)}frames(){return Array.from(this._frames.values())}_addFramesRecursively(e,r,n,i){let o=r.frame,s=this._frames.get(o.id);s?(s._navigate(o,i),this._onFrameNavigatedEmitter.fire(s)):(s=this._addFrame(e,o.id,n),s._navigate(o,i));for(let a=0;r.childFrames&&a<r.childFrames.length;++a)this._addFramesRecursively(e,r.childFrames[a],s.id,i)}},HE=class{constructor(e,r,n,i){this._targets=new Set;this.cdp=r,this.model=e,this._parentFrameId=i,this.id=n,this._url=""}_ref(e){this._targets.add(e)}_navigate(e,r){this._name=e.name,this._url=e.url,this._securityOrigin=e.securityOrigin,this._unreachableUrl=e.unreachableUrl||"",this._ref(r),this._unrefChildFrames(r)}name(){return this._name||""}url(){return this._url}securityOrigin(){return this._securityOrigin}unreachableUrl(){return this._unreachableUrl}isMainFrame(){return!this._parentFrameId}parentFrame(){return this._parentFrameId?this.model.frameForId(this._parentFrameId):void 0}childFrames(){return this.model.frames().filter(e=>e._parentFrameId===this.id)}_unrefChildFrames(e){for(let r of this.childFrames())r._unref(e)}_unref(e){this._targets.delete(e),!this._targets.size&&(this._unrefChildFrames(e),this.model._frames.delete(this.id),this.model._onFrameRemovedEmitter.fire(this))}displayName(){return this._name?this._name:Cce(this._url)||`<iframe ${this.id}>`}};function WE(t,e){return t.length<=e?t:t.substr(0,e-1)+"\u2026"}function Cce(t){let e;try{e=new r$.URL(t)}catch{return WE(t,20)}if(e.protocol==="data")return WE(t,20);if(e.protocol==="blob"||t==="about:blank")return t;let r=t$.basename(e.pathname);return r||(r=(e.host||"")+"/"),r==="/"&&(r=WE(t,20)),r}var n$=require("url");var qE=class{constructor(e){this.versions=new Map;this.id=e.registrationId,this.scopeURL=e.scopeURL}},$E=class{constructor(e,r){this.revisions=[];this.registration=e,this.id=r.versionId,this.scriptURL=r.scriptURL,this._targetId=r.targetId,this._status=r.status,this._runningStatus=r.runningStatus}addRevision(e){this._targetId&&e.targetId&&this._targetId!==e.targetId&&console.error(`${this._targetId} !== ${e.targetId}`),e.targetId&&(this._targetId=e.targetId),this._status=e.status,this._runningStatus=e.runningStatus,this.revisions.unshift(e)}status(){return this._status}runningStatus(){return this._runningStatus}targetId(){return this._targetId}label(){let e=new n$.URL(this.registration.scopeURL),r=e.pathname.substr(1);r.endsWith("/")&&(r=r.substring(0,r.length-1));let n=r||`${e.host}`,i=this._status==="activated"?"":` ${this._status}`,o=this._runningStatus==="running"?"":` ${this._runningStatus}`;return`${n} #${this.id}${i}${o}`}},Pw=class t{constructor(e){this._registrations=new Map;this._versions=new Map;this._onDidChangeUpdater=new j;this.onDidChange=this._onDidChangeUpdater.event;this._targets=new Set;this._frameModel=e,t._instances.add(this)}static{this._instances=new Set}dispose(){t._instances.delete(this)}attached(e){this._targets.add(e),!this._cdp&&(this._cdp=e,e.ServiceWorker.enable({}),e.ServiceWorker.on("workerRegistrationUpdated",r=>this._workerRegistrationsUpdated(r.registrations)),e.ServiceWorker.on("workerVersionUpdated",r=>this._workerVersionsUpdated(r.versions)),t._mode!=="normal"&&this.setMode(t._mode))}async detached(e){this._targets.delete(e)}version(e){return this._versions.get(e)}registrations(){let e=[],r=this._frameModel.frames().map(n=>n.url());for(let n of this._registrations.values())for(let i of r)if(i.startsWith(n.scopeURL)){e.push(n);break}return e}registration(e){return this._registrations.get(e)}_workerVersionsUpdated(e){for(let r of e){let n=this._registrations.get(r.registrationId);if(!n)continue;let i=n.versions.get(r.versionId);i||(i=new $E(n,r),n.versions.set(r.versionId,i)),r.targetId&&this._versions.set(r.targetId,i),i.addRevision(r),i.status()==="redundant"&&i.runningStatus()==="stopped"&&(r.targetId&&this._versions.delete(r.targetId),n.versions.delete(i.id))}this._onDidChangeUpdater.fire()}_workerRegistrationsUpdated(e){for(let r of e)if(r.isDeleted){if(!this._registrations.has(r.registrationId))debugger;this._registrations.delete(r.registrationId)}else{if(this._registrations.has(r.registrationId))return;this._registrations.set(r.registrationId,new qE(r))}this._onDidChangeUpdater.fire()}static setModeForAll(e){t._mode=e;for(let r of t._instances)r.setMode(e)}setMode(e){if(this._cdp){this._cdp.ServiceWorker.setForceUpdateOnPageLoad({forceUpdateOnPageLoad:e==="force"});for(let r of this._targets.values())e==="bypass"?(r.Network.enable({}),r.Network.setBypassServiceWorker({bypass:!0})):r.Network.disable({})}}async stopWorker(e){if(!this._cdp)return;let r=this.version(e);r&&await this._cdp.ServiceWorker.stopWorker({versionId:r.id})}};var qn=class{constructor(e,r,n,i,o,s,a,c){this.process=r;this.logger=o;this.telemetry=s;this.launchParams=a;this._targets=new Map;this._detachedTargets=new Set;this.frameModel=new Tw;this.serviceWorkerModel=new Pw(this.frameModel);this._lifecycleQueue=Promise.resolve();this._onTargetAddedEmitter=new j;this._onTargetRemovedEmitter=new j;this.onTargetAdded=this._onTargetAddedEmitter.event;this.onTargetRemoved=this._onTargetRemovedEmitter.event;this._connection=e,this._sourcePathResolver=i,this._browser=n,this._targetOrigin=c,this.serviceWorkerModel.onDidChange(()=>{for(let u of this._targets.values())u.type()==="service_worker"&&u._onNameChangedEmitter.fire()})}static async connect(e,r,n,i,o,s,a){let u=await e.rootSession().Target.attachToBrowserTarget({});if(!u)return;let l=e.createSession(u.sessionId);return new this(e,r,l,n,o,s,i,a)}dispose(){this.serviceWorkerModel.dispose()}targetList(){return Array.from(this._targets.values()).filter(e=>Df.has(e.type()))}async getCandiateInfo(e){let r=await this._browser.Target.getTargets({});return r?e?r.targetInfos.filter(e):r.targetInfos:[]}async closeBrowser(){if(this.launchParams.request==="launch"){if(this.launchParams.cleanUp==="wholeBrowser")await this._browser.Browser.close({}),this.process?.kill();else for(let e of this._targets.values())await this._browser.Target.closeTarget({targetId:e.targetId}),this._connection.close();this.process=void 0}}waitForMainTarget(e){let r,n=new Promise(o=>r=o),i=async o=>{if([...this._targets.values()].some(c=>c.targetId===o.targetId)||this._detachedTargets.has(o.targetId)||e&&!e(o))return;let s=this._browser.Target.on("targetInfoChanged",c=>{c.targetInfo.targetId===o.targetId&&(o=c.targetInfo)}),a;try{a=await this._browser.Target.attachToTarget({targetId:o.targetId,flatten:!0})}finally{s.dispose()}if(!a){r(void 0);return}r(this.attachedToTarget(o,a.sessionId,!0))};return this._browser.Target.setDiscoverTargets({discover:!0}),this._browser.Target.on("targetCreated",this.enqueueLifecycleFn(o=>i(o.targetInfo))),this._browser.Target.on("targetInfoChanged",o=>this._targetInfoChanged(o.targetInfo,this.enqueueLifecycleFn(i))),this._browser.Target.on("detachedFromTarget",this.enqueueLifecycleFn(async o=>{o.targetId&&await this._detachedFromTarget(o.sessionId,!1)})),n}enqueueLifecycleFn(e){return r=>this._lifecycleQueue=this._lifecycleQueue.then(()=>e(r))}attachedToTarget(e,r,n,i,o=!0){let s=this._targets.get(r);if(s)return s;let a=this._connection.createSession(r),c=new Oy(this,e,a,i,n,this.launchParams,r,this.logger,()=>{this._connection.disposeSession(r),this._detachedFromTarget(r)});this._targets.set(r,c),i&&i._children.set(e.targetId,c),a.Target.on("attachedToTarget",async l=>{this.attachedToTarget(l.targetInfo,l.sessionId,l.waitingForDebugger,c)}),a.Target.on("detachedFromTarget",async l=>{l.targetId&&this._detachedFromTarget(l.sessionId,!1)}),a.Target.setAutoAttach({autoAttach:!0,waitForDebuggerOnStart:o,flatten:!0}),a.Network.setCacheDisabled({cacheDisabled:this.launchParams.disableNetworkCache}).catch(l=>this.logger.info("runtime.target","Error setting network cache state",l)),i||this.retrieveBrowserTelemetry(a);let u=e.type;return Dy.has(u)&&this.frameModel.attached(a,e.targetId),this.serviceWorkerModel.attached(a),this._onTargetAddedEmitter.fire(c),!Df.has(u)||u==="service_worker"?c.runIfWaitingForDebugger():u==="page"&&o&&!e.canAccessOpener&&a.Page.waitForDebugger({}),c}async retrieveBrowserTelemetry(e){try{let r=await e.Browser.getVersion({});if(!r)throw new Error("Undefined return from getVersion()");let n={targetCRDPVersion:r.protocolVersion,targetRevision:r.revision,targetUserAgent:r.userAgent,targetV8:r.jsVersion,targetVersion:"",targetProject:"",targetProduct:""};this.logger.verbose("runtime.target","Retrieved browser information",r);let i=(r.product||"").split("/");i.length===2?(n.targetProject=i[0],n.targetVersion=i[1]):n.targetProduct=r.product,this.telemetry.report("browserVersion",n)}catch(r){this.logger.warn("runtime.target","Error getting browser telemetry",r)}}async _detachedFromTarget(e,r=!0){let n=this._targets.get(e);if(n){this._targets.delete(e),n.parentTarget?._children.delete(e);try{await n._detached()}catch{}if(this._onTargetRemovedEmitter.fire(n),r&&(this._detachedTargets.add(n.targetId),await this._browser.Target.detachFromTarget({sessionId:e})),!this._targets.size&&this.launchParams.request==="launch")try{this.launchParams.cleanUp==="wholeBrowser"?await this._browser.Browser.close({}):(await this._browser.Target.closeTarget({targetId:n.id()}),this._connection.close())}catch{}}}async _targetInfoChanged(e,r){let n=[...this._targets.values()].filter(i=>i.targetId===e.targetId);if(!e.attached||!n.length)return n.length&&await Promise.all(n.map(i=>this._detachedFromTarget(i.sessionId,!1))),r(e);for(let i of n)i._updateFromInfo(e);for(let i of this._targets.values())i.targetId!==e.targetId&&i._onNameChangedEmitter.fire()}};var y$=v(require("child_process")),b$=require("fs");var Tce=50,Or=class t{constructor(e){this.messageEmitter=new j;this.endEmitter=new j;this.onMessage=this.messageEmitter.event;this.onEnd=this.endEmitter.event;this._ws=e,this._ws.addEventListener("message",r=>{this.messageEmitter.fire([r.data.toString("utf-8"),new Vr])}),this._ws.addEventListener("close",()=>{this.endEmitter.fire(),this._ws=void 0}),this._ws.addEventListener("error",()=>{})}static async create(e,r,n){let i=!e.startsWith("ws://"),o=await Ju(e);for(;;){let s=Date.now()+Tce;try{let a={headers:{host:n??"localhost"},perMessageDeflate:!1,maxPayload:268435456,rejectUnauthorized:!(i&&o),followRedirects:!0},c=new PB(e,[],a);return await ao(new Promise((u,l)=>{c.addEventListener("open",()=>u(new t(c))),c.addEventListener("error",p=>{let d=e===c.url?e:c.url.replace(/^http(s?):/,"ws$1:");if(d===e){l(p.error);return}this.create(d,r,n).then(u,l)})}),Ft.withTimeout(2e3,r).token,`Could not open ${e}`).catch(u=>{throw c.close(),u})}catch(a){if(r.isCancellationRequested)throw a;let c=s-Date.now();c>0&&await _e(c)}}}send(e){this._ws?.send(e)}dispose(){return new Promise(e=>{if(!this._ws)return e();this._ws.addEventListener("close",()=>e()),this._ws.close()})}};var Ew=v(require("path"));function Pce(t){let e=[/^APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL$/i,/^ELECTRON_.+$/i,/^GOOGLE_API_KEY$/i,/^VSCODE_.+$/i,/^SNAP(|_.*)$/i,/^GDK_PIXBUF_.+$/i];return new Lt(t).map((r,n)=>e.some(i=>i.test(r))?void 0:n)}var Lt=class t{constructor(e){this.defined=me(()=>_u(this.value));this.value=e?$k(e):{}}static{this.platform=process.platform}static{this.empty=new t({})}static{this.processEnv=me(()=>Pce(process.env))}lookup(e){return t.platform==="win32"?zk(this.value,e):this.value[e]}addToPath(e,r="append",n=!1){let i=t.platform==="win32"?"Path":"PATH",o=t.platform==="win32"?Ew.win32.delimiter:Ew.posix.delimiter,s=this.lookup(i);return n&&!s&&(s=`\${env:${i}}`),s?r==="append"?s=s+o+e:s=e+o+s:s=e,this.update(i,s)}addNodeOption(e){let r=this.lookup("NODE_OPTIONS");return this.update("NODE_OPTIONS",r?`${r} ${e}`:e)}update(e,r){return t.merge(this,{[e]:r})}merge(...e){return t.merge(this,...e)}map(e){return new t(ko(this.value,(r,n)=>e(n,r)))}static merge(...e){let r=e.map(i=>i instanceof t?i.value:i),n=t.platform==="win32"?Gk(...r):Object.assign({},...r);return new t(n)}};var i$=require("child_process");var Kh=class t extends Error{constructor(r,n,i,o,s){super(`${r} exited with code ${o||-1}: ${n}`);this.command=r;this.stderr=n;this.stdout=i;this.code=o;this.innerError=s}static fromExeca(r){return new t(r.command,r.stderr.toString(),r.stdout.toString(),r.exitCode)}};function kw(t,e,r){return new Promise((n,i)=>{let o=Jh(t,e,r?.cwd),s=(0,i$.spawn)(o.executable,o.args,{...r,cwd:o.cwd,shell:o.shell,stdio:"pipe"}),a=[],c=[];s.stderr.on("data",l=>a.push(l)),s.stdout.on("data",l=>c.push(l));let u=(l,p)=>i(new Kh(t,Buffer.concat(a).toString(),Buffer.concat(c).toString(),l,p));s.on("error",l=>u(void 0,l)),s.on("close",l=>l?u(l):n({stdout:Buffer.concat(c).toString(),stderr:Buffer.concat(a).toString()}))})}var Ece=/\.(bat|cmd)$/i,Jh=(t,e,r)=>(process.platform==="win32"&&(t=jo(t),r&&(r=jo(r.toString())),t.endsWith(".ps1")&&(e=["-File",t,...e],t="powershell.exe")),process.platform!=="win32"||!Ece.test(t)?{executable:t,args:e,shell:!1,cwd:r}:{executable:`"${t}"`,args:e.map(n=>n.includes(" ")?`"${n}"`:n),shell:!0,cwd:r});var o$=t=>{let e={};for(let r of t){let n=r.indexOf("=");n===-1?e[r]=null:e[r.slice(0,n)]=r.slice(n+1)}return e},Xh=t=>{let e=[];for(let r of Object.keys(t)){let n=t[r];n!==void 0&&e.push(n===null?r:`${r}=${n}`)}return e},xp=class t{constructor(e=[]){this.args=e;this.argMap=me(()=>o$(this.args))}add(e,r=null){return this.newThis(Xh({...this.argMap(),[e]:r}))}get(e){let r=this.argMap();return r.hasOwnProperty(e)?r[e]:void 0}remove(e){return this.newThis(Xh({...this.argMap(),[e]:void 0}))}merge(e){return this.newThis(Xh({...this.argMap(),...e instanceof t?e.argMap():o$(e)}))}filter(e){let r=this.argMap(),n=[];for(let i of Object.keys(r)){let o=r[i];e(i,o)&&n.push(o===null?i:`${i}=${o}`)}return this.newThis(n)}toArray(){return this.args.slice()}newThis(e){return new this.constructor(e)}};var s$="--remote-debugging-port",a$="--remote-debugging-pipe",ha=class t extends xp{static{this.default=new t(["--disable-background-networking","--disable-background-timer-throttling","--disable-backgrounding-occluded-windows","--disable-breakpad","--disable-client-side-phishing-detection","--disable-default-apps","--disable-dev-shm-usage","--disable-renderer-backgrounding","--disable-sync","--metrics-recording-only","--no-first-run","--no-default-browser-check"])}setConnection(e){return new t(Xh({...this.argMap(),[a$]:e==="pipe"?null:void 0,[s$]:e!=="pipe"?String(e):void 0}))}getSuggestedConnection(){let e=this.argMap();if(e.hasOwnProperty(a$))return"pipe";let r=e[s$];if(r!==void 0)return r&&Number(r)||0}};var VE=require("url");function Rw(t,e,r){let n=Ro(s=>{if(s)return new VE.URL(s);throw new Error(`A valid url wasn't supplied: <${s}>`)}),i={"url.hostname":()=>{let s=n(e).hostname;return s.endsWith(".localhost")?"localhost":s},"url.port":()=>n(e).port,browserInspectUri:()=>encodeURIComponent(r),browserInspectUriPath:()=>new VE.URL(r).pathname,wsProtocol:()=>n(e).protocol==="https:"?"wss":"ws"};return t.replace(/{([^\}]+)}/g,(s,a)=>i.hasOwnProperty(a)?i[a]():s)}var h$=v(require("readline"));var c$=require("stream"),ma=class extends c$.Transform{constructor(r){super();this.prefix=[];this.splitSuffix=Buffer.alloc(0);if(typeof r=="string"&&r.length===1)this.splitter=r.charCodeAt(0);else if(typeof r=="number")this.splitter=r;else throw new Error("not implemented here")}_transform(r,n,i){let o=0;for(;o<r.length;){let s=r.indexOf(this.splitter,o);if(s===-1)break;let a=r.subarray(o,s),c=this.prefix.length||this.splitSuffix.length?Buffer.concat([...this.prefix,a,this.splitSuffix]):a;this.push(c),this.prefix.length=0,o=s+1}o<r.length&&this.prefix.push(r.subarray(o)),i()}_flush(r){this.prefix.length&&this.push(Buffer.concat([...this.prefix,this.splitSuffix])),r()}};var go=class{constructor(e,r,n){this.logger=e;this.pipeWrite=r;this.pipeRead=n;this.messageEmitter=new j;this.endEmitter=new j;this.onMessage=this.messageEmitter.event;this.onEnd=this.endEmitter.event;this.onceEnded=me(()=>{this.streams&&(this.beforeClose(),this.streams.read.removeAllListeners(),this.pipeRead?.destroy(),this.streams.write.removeListener("end",this.onceEnded),this.streams.write.removeListener("error",this.onWriteError),this.streams.write.on("error",()=>{}),this.streams.write.end(),this.streams=void 0,this.endEmitter.fire())});this.onWriteError=e=>{this.logger.error("internal","pipeWrite error",{error:e})};let i=n||r;this.streams={read:i.on("error",o=>this.logger.error("internal","pipeRead error",{error:o})).pipe(new ma(0)).on("data",o=>this.messageEmitter.fire([o.toString(),new Vr])).on("end",this.onceEnded),write:r.on("end",this.onceEnded).on("error",this.onWriteError)}}send(e){this.streams?.write.write(e+"\0")}dispose(){this.onceEnded()}beforeClose(){}};var ga=class{constructor(e,r,n){this.pid=e;this.onExit=r;this.updateInterval(n)}dispose(){clearInterval(this.timer)}updateInterval(e=200){this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>{kce(this.pid)||(this.onExit(!0),this.dispose())},e)}};function kce(t){try{return process.kill(t,0),!0}catch{return!1}}var Aw=require("child_process"),GE=require("path");function hi(t,e,r="forceful"){if(r==="none")return!0;if(process.platform==="win32"){let n=process.env.WINDIR||"C:\\Windows",i=(0,GE.join)(n,"System32","taskkill.exe");try{return(0,Aw.execSync)(`${i} ${r==="forceful"?"/F":""} /T /PID ${t}`,{stdio:"pipe"}),!0}catch(o){return e.error("runtime.exception","Error running taskkill.exe",o),!1}}else try{let n=(0,GE.join)(__dirname,"./targets/node/terminateProcess.sh"),i=(0,Aw.spawnSync)("sh",[n,t.toString(),r==="forceful"?"9":"15"]);return i.stderr&&i.status?(e.error("runtime.exception","Error running terminateProcess",i),!1):!0}catch(n){return e.error("runtime.exception","Error running terminateProcess",n),!1}}var d$=require("fs");async function zE(t,e,r,n,i){let o=new ua(d$.promises),[s,a]=await Promise.all([l$(o,new URL("/json/version",t),e,i),n?l$(o,new URL("/json/list",t),e,i):Promise.resolve(void 0)]);if(!s.ok)r.verbose("runtime.launch","Error looking up /json/version",s);else if(s.body.webSocketDebuggerUrl){let c=p$(s.url,s.body.webSocketDebuggerUrl);return r.verbose("runtime.launch","Discovered target URL from /json/version",{url:s.body.webSocketDebuggerUrl,fixed:c}),c}if(a)if(!a.ok)r.verbose("runtime.launch","Error looking up /json/list",a);else{let c=p$(a.url,a.body[0].webSocketDebuggerUrl);return r.verbose("runtime.launch","Discovered target URL from /json/list",{url:a.body[0].webSocketDebuggerUrl,fixed:c}),c}throw new Error("Could not find any debuggable target")}async function l$(t,e,r,n){if(e.hostname!=="localhost")return t.fetchJson(e.toString(),r,{host:n??"localhost"});e.hostname="127.0.0.1";let i=e.toString();e.hostname="[::1]";let o=e.toString(),s=new Ft(r);try{let a;return await qi([i,o].map(async u=>(a=await t.fetchJson(u,s.token),a.ok&&a)))||a}finally{s.cancel()}}var f$=t=>async(e,r,n,i)=>{for(;;)try{return await zE(e,r,n,t,i)}catch(o){if(r.isCancellationRequested)throw new Error(`Could not connect to debug target at ${e}: ${o.message}`);await _e(200)}},Ip=f$(!0),Dw=f$(!1);function p$(t,e){let r=new URL(t),n=new URL(e);return n.host=r.host,n.toString()}var KE=async(t,e,r,n)=>{let i=r.connection===0?await Rce(e,n):await Dw(`http://localhost:${r.connection}`,n,t),o=r.inspectUri?Rw(r.inspectUri,r.url,i):i;for(;;)try{return await Or.create(o,n)}catch(s){if(n.isCancellationRequested)throw s;await _e(200)}},Ow=class{constructor(e){this.logger=e;this.pid=void 0;this.onExit=new j().event;this.onError=new j().event}async transport(e,r){return KE(this.logger,this,e,r)}kill(){}},Lw=class{constructor(e,r){this.pid=e;this.logger=r;this.stderr=void 0;this.stdout=void 0;this.exitEmitter=new j;this.onExit=this.exitEmitter.event;this.errorEmitter=new j;this.onError=this.errorEmitter.event;this.liveness=new ga(e,()=>this.exitEmitter.fire(0),1e3)}async transport(e,r){return KE(this.logger,this,e,r)}kill(){try{process.kill(this.pid)}catch{}this.liveness.updateInterval(200)}},Nw=class{constructor(e,r,n){this.cp=e;this.logger=r;this.killBehavior=n;this.pid=void 0;this.exitEmitter=new j;this.onExit=this.exitEmitter.event;this.errorEmitter=new j;this.onError=this.errorEmitter.event;e.on("exit",i=>this.exitEmitter.fire(i||0)),e.on("error",i=>this.errorEmitter.fire(i))}get stderr(){return this.cp.stderr}get stdio(){return this.cp.stdio}async transport(e,r){return e.connection==="pipe"?new go(this.logger,this.cp.stdio[3],this.cp.stdio[4]):KE(this.logger,this,e,r)}kill(){hi(this.cp.pid,this.logger,this.killBehavior)}};function Rce(t,e){if(!t.stderr)throw new Error("Cannot wait for a websocket for a target that lacks stderr");return new Promise((r,n)=>{let i=h$.createInterface({input:t.stderr}),o="",s=()=>u();i.on("line",l),i.on("close",s);let a=new Ce([t.onExit(()=>u()),t.onError(u)]),c=e.onCancellationRequested(()=>{p(),n(new ln(`Timed out after ${c} ms while trying to connect to the browser!`))});function u(d){p(),n(new Error(["Failed to launch browser!"+(d?" "+d.message:""),o,"","TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md",""].join(`
`)))}function l(d){o+=d+`
`;let f=d.match(/^DevTools listening on (ws:\/\/.*)$/);f&&(p(),r(f[1]))}function p(){c.dispose(),i.removeListener("line",l),i.removeListener("close",s),a.dispose()}})}async function m$(t,e,r,n){let i=t.launchUnelevatedRequest({process:e,args:r});return await ao(i,n,"Could not launch browser unelevated")}var g$=()=>{};async function v$(t,e,r,n,i,o,s={}){let{onStderr:a=g$,onStdout:c=g$,args:u=[],dumpio:l=!1,cwd:p=process.cwd(),env:d=Lt.empty,connection:f="pipe",cleanUp:h="wholeBrowser",url:m,killBehavior:x="forceful",inspectUri:C}=s,O=new ha(u),y=O.getSuggestedConnection();s.includeLaunchArgs!==!1?(O=JE(O,s),y===void 0&&(O=O.setConnection(f),y=f)):y===void 0&&(y="pipe");let T=["pipe","pipe","pipe"];y==="pipe"&&(l?T=["ignore","pipe","pipe","pipe","pipe"]:T=["ignore","ignore","ignore","pipe","pipe"]);let E,M=!!(i.supportsLaunchUnelevatedProcessRequest&&s.launchUnelevated);if(M&&typeof y=="number"&&y!==0){let A=await m$(t,e,O.toArray(),o);E=A.pid?new Lw(A.pid,r):new Ow(r)}else{r.info("runtime.launch",`Launching Chrome from ${e}`);let A=Jh(e,O.toArray(),await Mo(b$.promises,p)?p:process.cwd()),W=y$.spawn(A.executable,A.args,{detached:!0,env:d.defined(),shell:A.shell,cwd:A.cwd,stdio:T});if(W.pid===void 0)throw await Promise.race([_e(1e3).then(()=>new Error("Unable to launch the executable (undefined pid)")),new Promise(Z=>W.once("error",Z))]);E=new Nw(W,r,x)}l?(E.stderr?.on("data",A=>a(A.toString())),E.stdout?.on("data",A=>c(A.toString()))):(E.stderr?.resume(),E.stdout?.resume());let k=()=>{h==="wholeBrowser"&&E.kill()};process.on("exit",k),E.onExit(()=>process.removeListener("exit",k));try{if(s.promisedPort){let A;y=await Promise.race([s.promisedPort,new Promise((W,Z)=>{A=E.onExit(_=>{Z(new q(CO(_)))})})]).finally(()=>A.dispose())}return{process:E,canReconnect:typeof y=="number"&&!M,createConnection:async A=>{let W=await E.transport({connection:y,inspectUri:C||void 0,url:m||void 0},A);return new ut(W,r,n)}}}catch(A){throw E.kill(),A}}function JE(t,e={}){let{userDataDir:r=null,ignoreDefaultArgs:n=!1}=e,i=n===!0?new ha:ha.default;return n instanceof Array&&(i=i.filter(o=>!n.includes(o))),r&&(i=i.add("--user-data-dir",r)),i=i.merge(t),t.toArray().every(o=>o.startsWith("-"))&&e.hasUserNavigation&&(i=i.add("about:blank")),i}async function w$(t,e,r,n){let{browserWSEndpoint:i,browserURL:o}=t;if(i){let s=await Or.create(i,e);return new ut(s,r,n)}else if(o){let s=await Dw(o,e,r),a=t.inspectUri?Rw(t.inspectUri,t.pageURL,s):s,c=await Or.create(a,e);return new ut(c,r,n)}throw new Error("Either browserURL or browserWSEndpoint needs to be specified")}var $n=class{constructor(e,r,n){this.logger=e;this.pathResolver=r;this.vscode=n;this._disposables=[];this._onTerminatedEmitter=new j;this.onTerminated=this._onTerminatedEmitter.event;this._onTargetListChangedEmitter=new j;this.onTargetListChanged=this._onTargetListChangedEmitter.event;this.closeWhenTargetsEmpty=!0}dispose(){for(let e of this._disposables)e.dispose();this._disposables=[],this._attemptTimer&&clearTimeout(this._attemptTimer),this._targetManager&&this._targetManager.dispose()}resolveParams(e){return e.request==="attach"&&(e.type==="pwa-chrome"||e.type==="pwa-msedge"&&typeof e.useWebView!="object")&&e.browserAttachLocation==="workspace"}async launch(e,r){return this.resolveParams(e)?(this._lastLaunchParams={...e,timeout:1/0},await this.attemptToAttach(this._lastLaunchParams,r),{blockSessionTermination:!0}):{blockSessionTermination:!1}}_scheduleAttach(e,r){this._attemptTimer=setTimeout(()=>{this._attemptTimer=void 0,this.attemptToAttach(e,{...r,cancellationToken:zt})},1e3)}createTargetManager(e,r,n){return qn.connect(e,void 0,this.pathResolver,r,this.logger,n.telemetryReporter,n.targetOrigin)}async attemptToAttach(e,r){let n=await this.acquireConnectionForBrowser(r,e);this._connection=n,n.onDisconnected(()=>{this._connection=void 0,this._targetManager&&(this._targetManager.dispose(),this._targetManager=void 0,this._onTargetListChangedEmitter.fire()),this._lastLaunchParams===e&&e.restart?this._scheduleAttach(e,r):this._onTerminatedEmitter.fire({killed:!0,code:0})},void 0,this._disposables);let i=this._targetManager=await this.createTargetManager(n,e,r);if(!i)return;i.serviceWorkerModel.onDidChange(()=>this._onTargetListChangedEmitter.fire()),i.frameModel.onFrameNavigated(()=>this._onTargetListChangedEmitter.fire()),i.onTargetAdded(()=>{this._onTargetListChangedEmitter.fire()}),i.onTargetRemoved(()=>{this._onTargetListChangedEmitter.fire(),!i.targetList().length&&this.closeWhenTargetsEmpty&&(this._onTerminatedEmitter.fire({killed:!0,code:0}),this._connection?.close())});let o=await Promise.race([i.waitForMainTarget(await this.getTargetFilter(i,e)),_e(e.timeout).then(()=>{throw new q(yy())})]);return typeof o=="string"?o:void 0}async getTargetFilter(e,r){let n=Ls(r),i=Xi(n);if(r.targetSelection!=="pick")return i;let o=await e.getCandiateInfo(i);if(o.length===0)return i;if(o.length===1||!this.vscode)return c=>c.targetId===o[0].targetId;let s=Mw.t("Select a tab"),a=await this.vscode.window.showQuickPick(o.map(c=>({label:c.title,detail:c.url,targetId:c.targetId})),{matchOnDescription:!0,matchOnDetail:!0,placeHolder:s});return a?c=>c.targetId===a.targetId:i}async acquireConnectionForBrowser({telemetryReporter:e,cancellationToken:r},n){for(;this._lastLaunchParams===n;)try{return await this.acquireConnectionInner(e,n,r)}catch(i){if(r.isCancellationRequested)throw new q($i(Mw.t("Cannot connect to the target at {0}: {1}",`${n.address}:${n.port}`,i.message)));await _e(1e3)}throw new q($i(Mw.t("Cannot connect to the target at {0}: {1}",`${n.address}:${n.port}`,"Cancelled")))}async acquireConnectionInner(e,r,n){let i=`http://${r.address}:${r.port}`;return await w$({browserURL:i,inspectUri:r.inspectUri,pageURL:r.url},n,this.logger,e)}async terminate(){this._lastLaunchParams=void 0,this._connection?.close()}async restart(){if(this._targetManager)for(let e of this._targetManager.targetList())e.type()==="page"&&!e.name().startsWith("devtools://")&&e.restart()}targetList(){let e=this._targetManager;return e?e.targetList():[]}};$n=I([(0,ya.injectable)(),g(0,(0,ya.inject)(Y)),g(1,(0,ya.inject)(je)),g(2,(0,ya.optional)()),g(2,(0,ya.inject)(Dt))],$n);var mi=v(H());var _$=v(Px()),x$=v(ge()),Yh=v(require("fs")),ba=v(H()),Cp=v(require("path"));var yo=class{constructor(e,r,n,i,o){this.storagePath=e;this.logger=r;this.pathResolver=n;this.initializeParams=i;this.fs=o;this._disposables=new Ce;this._onTerminatedEmitter=new j;this.onTerminated=this._onTerminatedEmitter.event;this._onTargetListChangedEmitter=new j;this.onTargetListChanged=this._onTargetListChangedEmitter.event;this._terminatedCts=new Ft}dispose(){this._disposables.dispose()}async launchBrowser({runtimeExecutable:e,trace:r,includeDefaultArgs:n,includeLaunchArgs:i,runtimeArgs:o,userDataDir:s,env:a,cwd:c,port:u,url:l,file:p,inspectUri:d,webRoot:f,cleanUp:h,launchUnelevated:m,killBehavior:x},C,O,y,T){let E=await this.findBrowserPath(e||"stable"),M;return typeof s=="string"?M=Cp.resolve(s):s&&(M=Cp.resolve(Cp.join(this.storagePath,o?.includes("--headless")?".headless-profile":".profile"))),Yh.mkdirSync(this.storagePath,{recursive:!0}),M&&(Yh.mkdirSync(M,{recursive:!0}),M=Yh.realpathSync(M)),await v$(C,E,this.logger,y,this.initializeParams,O,{onStdout:k=>C.output({category:"stdout",output:k}),onStderr:k=>C.output({category:"stderr",output:k}),dumpio:typeof r=="boolean"?r:r.stdio,cleanUp:h,hasUserNavigation:!!(l||p),cwd:c||f||void 0,env:Lt.merge(Lt.processEnv(),a),args:o||[],userDataDir:M,connection:u||(d?0:"pipe"),launchUnelevated:m,ignoreDefaultArgs:!n,includeLaunchArgs:i,killBehavior:x,url:l,inspectUri:d,promisedPort:T})}getFilterForTarget(e){return Xi(Ls(e,["about:blank"]))}async doLaunch(e,r){let n;try{n=await this.launchBrowser(e,r.dap,r.cancellationToken,r.telemetryReporter)}catch(u){throw new q(Cs(u))}let i=new Ft(this._terminatedCts.token);n.process.onExit(()=>this.fireTerminatedEvent());let o=()=>n.canReconnect&&!i.token.isCancellationRequested,s=async u=>{if(this._targetManager?.dispose(),this._targetManager=void 0,this._onTargetListChangedEmitter.fire(),o()&&(await _e(1e3),o())){r.dap.output({category:"stderr",output:x$.t("Browser connection failed, will retry: {0}",u?.message||"Connection closed")});try{return await _e(2e3),await a()}catch{}}n.process.kill(),this.fireTerminatedEvent()},a=async()=>{if(!i.token.isCancellationRequested)try{let u=await n.createConnection(i.token),l=await this.launchCdp(e,n,u,{...r,cancellationToken:i.token});await this.finishLaunch(l,e),u.onDisconnected(()=>s())}catch(u){if(o())return s(u);throw n.process.kill(),new q(Cs(u))}},c=r.cancellationToken.onCancellationRequested(()=>i.cancel());try{await a()}finally{c.dispose()}}async launchCdp(e,r,n,i){if(this._connectionForTest=n,this._targetManager=await qn.connect(n,r.process,this.pathResolver,e,this.logger,i.telemetryReporter,i.targetOrigin),!this._targetManager)throw new q($i());this._targetManager.serviceWorkerModel.onDidChange(()=>this._onTargetListChangedEmitter.fire()),this._targetManager.frameModel.onFrameNavigated(()=>this._onTargetListChangedEmitter.fire()),this._disposables.push(this._targetManager),this._targetManager.onTargetAdded(()=>{this._onTargetListChangedEmitter.fire()}),this._targetManager.onTargetRemoved(()=>{this._onTargetListChangedEmitter.fire()});let o=this.getFilterForTarget(e),s=await ao(this._targetManager.waitForMainTarget(o),i.cancellationToken,"Could not attach to main target");if(!s)throw new q(yy());return s}async finishLaunch(e,r){if("skipNavigateForTest"in r)return;let n;if(r.file){let i=Cp.resolve(r.webRoot||r.rootPath||"",r.file),o=Math.min(i.includes("#")?i.indexOf("#"):1/0,i.includes("?")?i.indexOf("?"):1/0);isFinite(o)&&!await Er(this.fs,i)?n=We(i.slice(0,o))+i.slice(o):n=We(i)}else n=r.url;n&&await e.cdp().Page.navigate({url:n})}async launch(e,r){let n=this.resolveParams(e);return n?(await this.doLaunch(n,r),{blockSessionTermination:!0}):{blockSessionTermination:!1}}async terminate(){this._targetManager?await this._targetManager.closeBrowser():this.fireTerminatedEvent()}async restart(){for(let e of this.targetList())e.type()==="page"&&e.restart()}async findBrowserByExe(e,r){return r==="*"?(await e.findWhere(i=>i.quality==="stable")||(await e.findAll())[0])?.path:(0,_$.isQuality)(r)?(await e.findWhere(n=>n.quality===r))?.path:r}targetList(){let e=this._targetManager;return e?e.targetList():[]}connectionForTest(){return this._connectionForTest}fireTerminatedEvent(){this._terminatedCts.token.isCancellationRequested||(this._terminatedCts.cancel(),this._onTerminatedEmitter.fire({code:0,killed:!0}))}};yo=I([(0,ba.injectable)(),g(0,(0,ba.inject)(io)),g(1,(0,ba.inject)(Y)),g(2,(0,ba.inject)(je)),g(3,(0,ba.inject)(qr)),g(4,(0,ba.inject)(ve))],yo);var eu=class extends yo{constructor(r,n,i,o,s,a){super(r,n,s,a,o);this.browserFinder=i}resolveParams(r){return r.type==="pwa-chrome"&&r.request==="launch"&&r.browserLaunchLocation==="workspace"?r:void 0}async findBrowserPath(r){let n=await this.findBrowserByExe(this.browserFinder,r);if(!n||!await Mo(this.fs,n))throw new q(gy("Chrome",r,(await this.browserFinder.findAll()).map(i=>i.quality)));return n}};eu=I([(0,mi.injectable)(),g(0,(0,mi.inject)(io)),g(1,(0,mi.inject)(Y)),g(2,(0,mi.inject)(vc)),g(2,(0,mi.tagged)("browser","chrome")),g(3,(0,mi.inject)(ve)),g(4,(0,mi.inject)(je)),g(5,(0,mi.inject)(qr))],eu);var I$=require("crypto"),gi=v(H()),C$=require("net"),T$=require("os"),P$=require("path");var Ace=["--do-not-de-elevate"],Tp=class extends yo{constructor(r,n,i,o,s,a){super(r,n,s,a,o);this.browserFinder=i}resolveParams(r){return r.type==="pwa-msedge"&&r.request==="launch"&&r.browserLaunchLocation==="workspace"?r:void 0}launchBrowser(r,n,i,o){return super.launchBrowser({...r,runtimeArgs:r.runtimeArgs??Ace},n,i,o,r.useWebView?this.getWebviewPort(r,o):void 0)}getFilterForTarget(r){return r.useWebView&&r.urlFilter?Xi(Ls(r)):super.getFilterForTarget(r)}async getWebviewPort(r,n){let i=Ue();if(!r.runtimeExecutable)return i.resolve(r.port),i.promise;let o=r.runtimeExecutable.split(/\\|\//).pop(),s=`VSCode_${(0,I$.randomBytes)(12).toString("base64")}`,a=`\\\\.\\pipe\\WebView2\\Debugger\\${o}\\${s}`,c=(0,C$.createServer)(u=>{u.on("data",async l=>{let p=JSON.parse(l.toString()),d=p.devtoolsActivePort||"",f=parseInt(d.split(`
`).shift()||""),h=r.port||f;i.resolve(h);let m=`ws://${r.address}:${h}/devtools/${p.type}/${p.id}`,x=await Or.create(m,zt),C=new ut(x,this.logger,n);await C.rootSession().Runtime.runIfWaitingForDebugger({}),C.close()})});return c.on("error",i.reject),c.on("close",()=>i.resolve(r.port)),c.listen(a),r.userDataDir=r.userDataDir||(0,P$.join)((0,T$.tmpdir)(),`vscode-js-debug-userdatadir_${r.port}`),r.env=r.env||{},r.env.WEBVIEW2_USER_DATA_FOLDER=r.userDataDir.toString(),r.env.WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=`--remote-debugging-port=${r.port}`,r.env.WEBVIEW2_WAIT_FOR_SCRIPT_DEBUGGER="true",r.env.WEBVIEW2_PIPE_FOR_SCRIPT_DEBUGGER=s,i.promise}async findBrowserPath(r){let n=await this.findBrowserByExe(this.browserFinder,r);if(!n||!await Mo(this.fs,n))throw new q(gy("Edge",r,(await this.browserFinder.findAll()).map(i=>i.quality)));return n}};Tp=I([(0,gi.injectable)(),g(0,(0,gi.inject)(io)),g(1,(0,gi.inject)(Y)),g(2,(0,gi.inject)(vc)),g(2,(0,gi.tagged)("browser","edge")),g(3,(0,gi.inject)(ve)),g(4,(0,gi.inject)(je)),g(5,(0,gi.inject)(qr))],Tp);var is=v(H());var E$=require("crypto"),Bw=v(H());var Dce=0,bo=class{constructor(e){this.portLeaseTracker=e;this.teardown=new WeakMap}async launch(e,r,n){this.server&&this.server.close();let i=`/${(0,E$.randomBytes)(20).toString("hex")}`,o=this.server=await Hb(this.portLeaseTracker,{perMessageDeflate:!0,host:"127.0.0.1",path:i}),s=++Dce;e.launchBrowserInCompanion({...n,serverPort:o.address().port,path:i,launchId:s});let a=await ao(new Promise((u,l)=>{o.once("connection",u),o.once("error",l)}),r,"Timed out waiting for browser connection"),c=new Or(a);return this.teardown.set(c,()=>e.killCompanionBrowser({launchId:s})),c}close(e){this.teardown.get(e)?.()}dispose(){this.server?.close(),this.server=void 0}};bo=I([(0,Bw.injectable)(),g(0,(0,Bw.inject)(nt))],bo);var Pp=class extends $n{constructor(r,n,i,o){super(n,i,o);this.helper=r}resolveParams(r){return r.request==="attach"&&(r.type==="pwa-chrome"||r.type==="pwa-msedge")&&r.browserAttachLocation==="ui"}async acquireConnectionForBrowser(r,n){let i=await this.helper.launch(r.dap,r.cancellationToken,{type:n.type==="pwa-chrome"?"chrome":"edge",params:n,attach:{host:n.address,port:n.port}});return new ut(i,this.logger,r.telemetryReporter)}};Pp=I([(0,is.injectable)(),g(0,(0,is.inject)(bo)),g(1,(0,is.inject)(Y)),g(2,(0,is.inject)(je)),g(3,(0,is.optional)()),g(3,(0,is.inject)(Dt))],Pp);var os=v(H());var Ep=class extends yo{constructor(r,n,i,o,s,a){super(r,n,i,o,s);this.helper=a}resolveParams(r){return(r.type==="pwa-chrome"||r.type==="pwa-msedge")&&r.request==="launch"&&r.browserLaunchLocation==="ui"?r:void 0}async launchBrowser(r,n,i,o){let s=await this.helper.launch(n,i,{type:r.type==="pwa-chrome"?"chrome":"edge",browserArgs:JE(new ha(r.runtimeArgs||[]),{hasUserNavigation:!!r.url,ignoreDefaultArgs:!r.includeDefaultArgs}).setConnection(r.port||"pipe").toArray(),params:r});return{canReconnect:!1,createConnection:()=>Promise.resolve(new ut(s,this.logger,o)),process:{onExit:new j().event,onError:new j().event,transport:()=>Promise.resolve(s),kill:()=>this.helper.close(s)}}}async findBrowserPath(){throw new Error("not implemented")}};Ep=I([(0,os.injectable)(),g(0,(0,os.inject)(io)),g(1,(0,os.inject)(Y)),g(2,(0,os.inject)(je)),g(3,(0,os.inject)(qr)),g(4,(0,os.inject)(ve)),g(5,(0,os.inject)(bo))],Ep);var va=v(H()),O$=require("net"),L$=require("path");var Oce=me(()=>{if(process.arch==="arm64")return Promise.resolve().then(()=>v(R$()));if(process.arch==="x64")return Promise.resolve().then(()=>v(D$()));throw new Error(`Unsupported architecture ${process.arch}`)});function Fw(){if(process.platform!=="win32")throw new Error("Not running on Windows");return Oce()}var kp=class extends $n{constructor(e,r,n){super(e,r,n)}resolveParams(e){return e.request==="attach"&&e.type==="pwa-msedge"&&typeof e.useWebView=="object"}async acquireConnectionForBrowser(e,r){let{getAppContainerProcessTokens:n}=await Fw(),i=n().map(c=>(0,L$.join)(c,r.useWebView.pipeName));if(!i)throw new q(vO());let o=i.map(c=>(0,O$.connect)(c)),s;try{s=await ao(qi(o.map(c=>new Promise(u=>c.on("error",()=>u(void 0)).on("connect",()=>u(c))))),e.cancellationToken)}finally{for(let c of o)c!==s&&c.destroy()}if(!s)throw new q(SO());let a=new go(this.logger,s);return new ut(a,this.logger,e.telemetryReporter)}};kp=I([(0,va.injectable)(),g(0,(0,va.inject)(Y)),g(1,(0,va.inject)(je)),g(2,(0,va.optional)()),g(2,(0,va.inject)(Dt))],kp);var Dp=v(H());var bn=v(H());var Qh=Symbol("ILinkedBreakpointLocation");var W$=v(require("path"));var em=v(H()),_a=v(require("path")),j$=require("url");var N$=require("fs"),ss=v(require("path"));function Uw(t,e){return t?(t.endsWith("/")||(t+="/"),t+e):e}async function jw(t,e,r,n,i){e=mt(e)||e;let o;if(t){if(Wr(t))o=mt(t);else if(wr(t))o=await n(t,r,i)||t;else if(ss.isAbsolute(e))o=Mce(e,t);else{let s=ZI(e)||"/",a=await n(s,r,i),c=ss.dirname(a);o=Is(c,t)}i.verbose("sourcemap.parsing","resolved sourceRoot",{sourceRoot:t,absSourceRoot:o})}else if(ss.isAbsolute(e))o=ss.dirname(e),i.verbose("sourcemap.parsing","no sourceRoot specified, using script dirname",{absSourceRoot:o});else{let s=ZI(e)||"/placeholder.js",a=await n(s,r,i);o=a?ss.dirname(a):"",i.verbose("sourcemap.parsing","no sourceRoot specified, using webRoot + script path dirname",{absSourceRoot:o})}return o=uL(o),o=ft(o),o}var Zh=async(t,e,r)=>{if(!t||!t.startsWith("/"))return"";let n=Object.keys(e).sort((i,o)=>o.length-i.length);for(let i of n){if(!i)continue;let o=e[i];if(i[0]!=="/"&&(r.verbose("sourcemap.parsing",`Keys should be absolute: ${i}`),i="/"+i),Lce(i,t))return Nce(i,o,t)}return""},M$=(t,e)=>async(r,n,i)=>{if(process.platform==="win32"&&/^[a-z]:/i.test(r))return r;let o=await Ku(t,ss.dirname(e),"package.json");if(!o)return Zh(r,n,i);let s=await Zh(r,Vk(n,a=>a.length>=o.length),i);return process.platform!=="win32"&&r!=="/"&&!s&&(await N$.promises.stat(r).catch(()=>{}))?.isDirectory()?r:s||o};function Lce(t,e){return t===e?!0:(t.endsWith("/")||(t+="/"),e.startsWith(t))}function Nce(t,e,r){let n=decodeURIComponent(r.substring(t.length));return n?Is(e,n):e}function Mce(t,e){return on(ss.dirname(t),e)}var U$=v(Vf()),wa=v(require("path"));var qw="*",B$=new RegExp(Rr(qw),"g"),Ww="?:"+qw,Bce=new RegExp(Rr(Ww),"g"),XE=(t,e)=>{let r=e.match(t);return t.lastIndex=0,r?r.length:0},F$=new RegExp(`${Rr(Ww)}|${Rr(qw)}`,"g"),Hw=class{constructor(e,r){this.logger=r;this.replacers=[];let n=Object.keys(e).sort((i,o)=>o.replace(Ww,"*").length-i.replace(Ww,"*").length);for(let i of n){let o=e[i];if(!o.includes("*")&&/\$[0-9'`&]/.test(o)){this.replacers.push([new RegExp(`^${i}$`,"i"),o]);continue}let s=ze(i),a=`"${s}": "${o}"`,c=XE(B$,s)-XE(Bce,s);if(c>1){r.warn("runtime.sourcemap",`Warning: only one asterisk allowed in a sourceMapPathOverrides entry - ${a}`);continue}if(XE(B$,o)>c){r.warn("runtime.sourcemap",`The right side of a sourceMapPathOverrides entry must have 0 or 1 asterisks - ${a}}`);continue}let u="^",l=0;for(F$.lastIndex=0;;){let p=F$.exec(s);if(u+=Rr(s.slice(l,p?.index),"/"),!p)break;p[0]===qw?u+="(.*?)":u+=".*?",l=p.index+p[0].length}c===0&&(u+="([\\/\\\\].*)?",o+="*"),this.replacers.push([new RegExp(u+"$","i"),o.replace(/\$/g,"$$$$").replace(/\*/,"$1")])}}apply(e){let r=ze(e);for(let[n,i]of this.replacers){let o=r.replace(n,i);if(o!==r)return this.logger.verbose("runtime.sourcemap",`SourceMap: mapping ${e} => ${o}, via sourceMapPathOverrides entry - ${n.toString()}`),Is(o)}return e}};var Fce=/\x00/,Rp=class{constructor(e,r){this.options=e;this.logger=r;this.sourceMapOverrides=new Hw(this.options.sourceMapOverrides,this.logger);this.resolvePatterns=this.options.resolveSourceMapLocations?.map(e=>{let r=e.startsWith("!")?"!":"",n=e.slice(r.length).replace(/(?<!\.)\.[^./\\]+$/,".*");if(!wr(n))return ze(e);n=ze(on(n));let i=PI(this.options.workspaceFolder),o=PI(n),s=0;for(let a=0;a<i.length&&a<o.length&&o[a].toLowerCase()===i[a].toLowerCase();a++)s+=i[a].length+1;return n=n.slice(0,s).replace(/[\[\]\(\)\{\}\!\*]/g,"\\$&")+n.slice(s),r+n})}shouldResolveSourceMap({sourceMapUrl:e,compiledPath:r}){if(r.startsWith(ni))return!1;if(!this.resolvePatterns||this.resolvePatterns.length===0)return!0;let n=mt(e)||cr(e)&&r||e;if(n.startsWith("webpack-internal:///"))return!0;let i=cy(e)?!1:QI(),o=this.rebaseRemoteToLocal(n);return(0,U$.default)((o!==n?[n,o]:[n]).map(ze),this.resolvePatterns,{dot:!0,nocase:!i}).length>0}rebaseRemoteToLocal(e){if(!this.options.remoteRoot||!this.options.localRoot||!this.canMapPath(e))return Bu(wa.isAbsolute(e)?wa.resolve(e):e);let r=If(this.options.remoteRoot,e);if(r.startsWith(".."))return"";let n=Is(this.options.localRoot,r);return n=Bu(n),this.logger.verbose("runtime.sourcemap",`Mapped remoteToLocal: ${e} -> ${n}`),on(n)}rebaseLocalToRemote(e){if(!this.options.remoteRoot||!this.options.localRoot||!this.canMapPath(e))return e;let r=If(this.options.localRoot,e),n=Is(this.options.remoteRoot,r);return n=ft(n,!0),this.logger.verbose("runtime.sourcemap",`Mapped localToRemote: ${e} -> ${n}`),n}normalizeSourceMapUrl(e){e=e.replace(Fce,"");let r=e.lastIndexOf("?");return r!==-1&&e.slice(r-4,r)!==".vue"&&(e=e.slice(0,r)),e}canMapPath(e){return wa.posix.isAbsolute(e)||wa.win32.isAbsolute(e)||Wr(e)}};var YE="https?:\\/\\/[^\\/]+\\/",Sa=class extends Rp{constructor(r,n,i,o){super(i,o);this.vueMapper=r;this.fsUtils=n}absolutePathToUrlPath(r){r=_a.normalize(r);let{baseUrl:n,pathMapping:i}=this.options,o=["/",i["/"]],s=Object.entries(i).sort(([u,l],[p,d])=>d.length-l.length||p.length-u.length).find(([,u])=>Fu(u,r))||o;if(!s)return{url:We(r),needsWildcard:!1};if(n&&Wr(n))return{url:Xu(r),needsWildcard:!1};let a=Os(_a.relative(s[1],r)),c=s[0].replace(/\/$|^\//g,"");return c&&(a=c+"/"+a),!n&&!Uy(a)?{url:a,needsWildcard:!0}:{url:Py(n,a),needsWildcard:!1}}async urlToAbsolutePath({url:r,map:n}){let i=r.indexOf("?");return i!==-1&&r.slice(i-4,i)!==".vue"&&(r=r.slice(0,i)),n?this.sourceMapSourceToAbsolute(r,n):this.simpleUrlToAbsolute(r)}async simpleUrlToAbsolute(r){if(!r)return;if(r=this.sourceMapOverrides.apply(r),Wr(r)){let s=mt(r);if(await this.fsUtils.exists(s))return s;let a=lL(r);return await this.fsUtils.exists(a)?a:s}let n;try{let s=new j$.URL(r);if(!s.pathname||s.pathname==="/"?n="index.html":n=s.pathname,s.protocol==="webpack-internal:")return}catch{n=r}let i=_a.extname(n),o=n.replace(/^\//,"").split(/[\/\\]/);for(;o.length>0;){let s="/"+o.join("/"),a=await Zh(s,this.options.pathMapping,this.logger);if(a){if(!i&&await this.fsUtils.exists(a+".html"))return a+".html";if(await this.fsUtils.exists(a))return a}o.shift()}}async sourceMapSourceToAbsolute(r,n){if(!this.shouldResolveSourceMap(n.metadata))return;switch(this.vueMapper.getVueHandling(r)){case 2:return;case 1:let a=await this.vueMapper.lookup(r);if(a)return ft(a);break;default:}r=this.normalizeSourceMapUrl(r);let{pathMapping:i}=this.options,o=Uw(n.sourceRoot,r),s=this.sourceMapOverrides.apply(o);if(s!==o){s=ft(s);let a=on(i["/"],"..","ClientApp",If(i["/"],s));return this.options.clientID==="visualstudio"&&o.startsWith("webpack:///")&&!await this.fsUtils.exists(s)&&await this.fsUtils.exists(a)?a:s}return Wr(r)?mt(r):_a.isAbsolute(r)?ft(r):on(await jw(n.sourceRoot,n.metadata.compiledPath,i,Zh,this.logger),r)}absolutePathToUrlRegexp(r){let n=this.absolutePathToUrlPath(r),i=n.url,o=i.length;i.endsWith("index.html")?(o=i.length-10-1,i=i.slice(0,o)+"\\/?($|index(\\.html)?)"):i.endsWith(".html")&&(o=i.length-5,i=i.slice(0,o)+"(\\.html)?");let s=0;n.needsWildcard&&(i=YE+i,s=YE.length,o+=YE.length);let a=Pn(i,[s,o]);return n.needsWildcard?`${Pn(We(r))}|${a}`:a}};Sa=I([(0,em.injectable)(),g(0,(0,em.inject)(fp)),g(1,(0,em.inject)(br))],Sa);var $w=class extends Sa{constructor(r,n,i,o){super(r,n,i,o);this.blazorInCodespacesRegexpSubstitution="$1:\\$2";if(this.options.remoteFilePrefix){let s=`\\${W$.default.sep}`,a=this.options.remoteFilePrefix.replace(new RegExp(s,"g"),s);this.blazorInCodespacesRegexp=new RegExp(`^${a}${s}([A-z])\\$${s}(.*)$`)}else this.blazorInCodespacesRegexp=new RegExp("")}absolutePathToUrlRegexp(r){if(this.options.remoteFilePrefix){let n=r.replace(this.blazorInCodespacesRegexp,this.blazorInCodespacesRegexpSubstitution),o=Os(n).replace(/^(\w):(.*)$/,"$1$2"),s=Pn(o);if(s){let a=`dotnet://.*\\.dll/${s}`;return this.logger.verbose("runtime.breakpoints","absolutePathToUrlRegexp.blazor.remoteFs",{absolutePath:r,dotnetUrlRegexp:a}),a}}else{let n=We(r),i=Pn(n),o=super.absolutePathToUrlRegexp(r);return i.includes(o)?i:`${i}|${o}`}return super.absolutePathToUrlRegexp(r)}};var H$=require("url");function q$(t){if("file"in t&&t.file)return Xu(t.file);if(t.url)try{let e=new H$.URL(t.url);return e.pathname="/",e.search="",e.hash="",e.protocol==="data:"?void 0:e.href}catch{}}var tu=v(require("path")),V$=require("url");var $$="node:",as=class t extends Rp{constructor(r,n,i,o){super(i,o);this.fsUtils=r;this.linkedBp=n;this.options=i;this.logger=o}static shouldWarnAboutSymlinks(r){return"runtimeArgs"in r&&!r.runtimeArgs?.includes("--preserve-symlinks")}static getOptions(r){return{workspaceFolder:r.__workspaceFolder,resolveSourceMapLocations:r.resolveSourceMapLocations,basePath:r.cwd,sourceMapOverrides:r.sourceMapPathOverrides,remoteRoot:r.remoteRoot,localRoot:r.localRoot}}derive(r){return new t(this.fsUtils,this.linkedBp,{...this.options,...r},this.logger)}get resolutionOptions(){return this.options}async urlToAbsolutePath({url:r,map:n}){r=this.normalizeSourceMapUrl(r);let i=this.sourceMapOverrides.apply(r),o=i!==r;if(r=i,r.startsWith($$)&&this.options.basePath)return r=tu.join(this.options.basePath,"lib",r.slice($$.length)),r.endsWith(".js")||(r+=".js"),r;if(n)return this.sourceMapSourceToAbsolute(r,n,o);let s=mt(r);if(s)return this.rebaseRemoteToLocal(s);if(Uy(r))r=o?i:new V$.URL(r).pathname.slice(1);else if(tu.isAbsolute(r))r=this.sourceMapOverrides.apply(r);else return`${ii}/${r}`;let a=on(this.options.basePath??"",r);return this.rebaseRemoteToLocal(a)}absolutePathToUrl(r){return We(this.rebaseLocalToRemote(tu.normalize(r)))}async absolutePathToUrlRegexp(r){let n=r;try{n=await this.fsUtils.realPath(r)}catch{}return Fy(n,r)?Pn(this.absolutePathToUrl(r)):(this.linkedBp?.warn(),Pn(this.absolutePathToUrl(r))+"|"+Pn(this.absolutePathToUrl(n)))}async sourceMapSourceToAbsolute(r,n,i){if(!this.shouldResolveSourceMap(n.metadata))return;if(i)return Bu(r);let o=Uw(n.sourceRoot,r),s=this.sourceMapOverrides.apply(o);return s!==o?ft(s):Wr(r)?this.rebaseRemoteToLocal(mt(r)):!tu.isAbsolute(r)&&this.options.basePath?on(await jw(this.options.remoteRoot&&wr(n.sourceRoot)&&this.rebaseRemoteToLocal(n.sourceRoot)||n.sourceRoot,n.metadata.compiledPath,{"/":this.options.basePath},M$(this.fsUtils,n.metadata.compiledPath),this.logger),r):this.rebaseRemoteToLocal(r)||r}};var Lr=Symbol("ISourcePathResolverFactory"),yi=class{constructor(e,r){this.fsUtils=e;this.linkedBp=r}create(e,r){if(e.type==="pwa-node"||e.type==="node-terminal"||e.type==="pwa-extensionHost")return new as(this.fsUtils,as.shouldWarnAboutSymlinks(e)?this.linkedBp:void 0,as.getOptions(e),r);throw new Error(`Not usable for type ${e.type}`)}};yi=I([(0,bn.injectable)(),g(0,(0,bn.inject)(br)),g(1,(0,bn.optional)()),g(1,(0,bn.inject)(Qh))],yi);var Ap=class{constructor(e,r,n,i){this.initializeParams=e;this.vueMapper=r;this.fsUtils=n;this.linkedBp=i}create(e,r){if(e.type==="pwa-node"||e.type==="node-terminal"||e.type==="pwa-extensionHost")return new as(this.fsUtils,as.shouldWarnAboutSymlinks(e)?this.linkedBp:void 0,as.getOptions(e),r);{let n=!!e.inspectUri;return new(n?$w:Sa)(this.vueMapper,this.fsUtils,{workspaceFolder:e.__workspaceFolder,resolveSourceMapLocations:e.resolveSourceMapLocations,baseUrl:q$(e),localRoot:null,remoteRoot:null,pathMapping:{"/":e.webRoot,...e.pathMapping},sourceMapOverrides:e.sourceMapPathOverrides,clientID:this.initializeParams.clientID,remoteFilePrefix:e.__remoteFilePrefix},r)}}};Ap=I([(0,bn.injectable)(),g(0,(0,bn.inject)(qr)),g(1,(0,bn.inject)(fp)),g(2,(0,bn.inject)(br)),g(3,(0,bn.optional)()),g(3,(0,bn.inject)(Qh))],Ap);var G$=require("url");var Vw=class extends qn{constructor(){super(...arguments);this.baseFilter=Ls(this.launchParams);this.filter=r=>{let{debugWebWorkerExtHost:n,debugWebviews:i}=this.launchParams;return!!(n&&(r.type==="worker"&&r.title.startsWith("DebugExtensionHostWorker")||r.type==="page"&&r.title.includes("[Extension Development Host]"))||i&&r.type==="iframe"&&this.baseFilter(r))}}static async connectRenderer(r,n,i,o,s,a){let u=await r.rootSession().Target.attachToBrowserTarget({});if(!u)return;let l=r.createSession(u.sessionId);return new this(r,void 0,l,n,o,s,i,a)}waitForMainTarget(r){let n=this.launchParams;return n.debugWebWorkerExtHost&&this._browser.Target.on("targetCreated",this.enqueueLifecycleFn(async({targetInfo:i})=>{if(!i.url.includes(n.__sessionId))return;let o=await this._browser.Target.attachToTarget({targetId:i.targetId,flatten:!0});o&&this.attachedToTarget(i,o.sessionId,!1)})),super.waitForMainTarget(r)}attachedToTarget(r,n,i,o){let s=super.attachedToTarget(r,n,i||this.filter(r),o,!1);return r.type==="iframe"&&s.setComputeNameFn(Uce),s}},Uce=t=>{let e;try{e=new G$.URL(t.targetInfo.url)}catch{return}switch(e.searchParams.get("purpose")){case"customEditor":return`${e.searchParams.get("extensionId")} editor: ${e.host}`;case"notebookRenderer":return`Notebook Renderer: ${e.host}`;default:let r=e.searchParams.get("extensionId");return`Webview: ${r?r+" ":""} ${e.host}`}};var bi=class extends $n{constructor(r,n,i){super(r,n);this.pathResolverFactory=i;this.closeWhenTargetsEmpty=!1}async launch(r,n){if(r.type!=="pwa-extensionHost"||r.request!=="attach")return{blockSessionTermination:!1};let i=bi.debugIdTorendererDebugAddr.get(r.__sessionId);if(!i)return{blockSessionTermination:!1};let o=Ss({name:"Webview",type:"pwa-chrome",request:"attach",address:i,__workspaceFolder:r.__workspaceFolder,timeout:0,urlFilter:"",resolveSourceMapLocations:r.resolveSourceMapLocations,...r.rendererDebugOptions});return o.__sessionId=r.__sessionId,o.debugWebWorkerExtHost=r.debugWebWorkerHost,o.debugWebviews=r.debugWebviews,super.launch(o,n).catch(s=>this.logger.error("runtime.exception","Error in webview attach",{err:s})),{blockSessionTermination:!1}}async acquireConnectionInner(r,n,i){return new ut(await Or.create(n.address,i),this.logger,r)}async getTargetFilter(r){return r.filter}async createTargetManager(r,n,i){return new Vw(r,void 0,r.rootSession(),this.pathResolverFactory.create(n,this.logger),this.logger,i.telemetryReporter,n,i.targetOrigin)}};bi.debugIdTorendererDebugAddr=new Map,bi=I([(0,Dp.injectable)(),g(0,(0,Dp.inject)(Y)),g(1,(0,Dp.inject)(je)),g(2,(0,Dp.inject)(Lr))],bi);var K$=v(H());var xa=class t{constructor(){this.target={queue:[]}}connectTo(e){this.target={logger:e}}info(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:1})}verbose(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:0})}warn(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:2})}error(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:3})}fatal(e,r,n){this.log({tag:e,timestamp:Date.now(),message:r,metadata:n,level:4})}log(e){this.target&&("queue"in this.target?this.target.queue.push(e):this.target.logger.log(e))}getRecentLogs(){return this.target?"queue"in this.target?this.target.queue:this.target.logger.getRecentLogs():[]}assert(e,r){if(e===!1||e===void 0||e===null){if(this.error("runtime.assertion",r,{error:new Error("Assertion failed")}),process.env.JS_DEBUG_THROW_ASSERTIONS)throw new Error(r);debugger;return!1}return!0}setup(){throw new Error("A ProxyLogger cannot be setup()")}dispose(){this.target=void 0}forTarget(){return new t}};var z$=Symbol("ITargetOrigin"),Gw=class{constructor(e){this.id=e}},Op=class{constructor(e){this.id=e}};var zw=class{constructor(e,r){this.parentList=e;this.logger=r;this.targets=new ho;this.onTerminatedEmitter=new j;this.onTerminated=this.onTerminatedEmitter.event;this.onTargetListChanged=this.targets.onChanged;e.onAdd(([,n])=>{n.parent&&this.targets.get(n.parent.id)&&this.targets.add(n.id,n.target)}),e.onRemove(([n])=>{this.targets.remove(n)&&!this.targets.size&&this.onTerminatedEmitter.fire({killed:!0,code:0})})}async launch(e,r){if(e.type!=="node-terminal"||e.request!=="attach")return{blockSessionTermination:!1};let n=this.parentList.get(e.delegateId);if(n===void 0)return setTimeout(()=>this.onTerminatedEmitter.fire({killed:!0,code:0}),1),{blockSessionTermination:!0};let i=n.target.targetOrigin();if(!(i instanceof Op))throw new Error("Expected delegate session to have a mutable target origin");let o=n.target.logger;if(!(o instanceof xa))throw new Error("Expected delegate session to have a proxy logger");return i.id=r.targetOrigin.id,o.connectTo(this.logger),setTimeout(()=>{this.targets.add(e.delegateId,n.target),n.dap.connect(r.dap)},0),{blockSessionTermination:!0}}terminate(){for(let e of this.targets.value())e.stop();return Promise.resolve()}restart(){for(let e of this.targets.value())e.restart();return Promise.resolve()}targetList(){return[...this.targets.value()]}dispose(){this.terminate()}};var jce=0,vo=class{constructor(){this.delegateSessions=new ho;this.refsByTarget=new WeakMap}createLauncher(e){return new zw(this.delegateSessions,e)}addDelegate(e,r,n){let i={id:jce++,target:e,dap:r,parent:n&&this.refsByTarget.get(n)};return this.refsByTarget.set(e,i),this.delegateSessions.add(i.id,i),i.id}removeDelegate(e){let r=this.refsByTarget.get(e);r&&this.delegateSessions.remove(r.id)}};vo=I([(0,K$.injectable)()],vo);var dV=v(H());var qe=class t{constructor(e,r,n){this.major=e;this.minor=r;this.patch=n}static parse(e){let r=e.split(".").map(Number);if(r.length!==3||r.some(isNaN))throw new SyntaxError(`Input string '${e}' is not a semver`);return new t(r[0],r[1],r[2])}static min(e,r){return e.lt(r)?e:r}compare(e){return this.major-e.major||this.minor-e.minor||this.patch-e.patch}gt(e){return this.compare(e)>0}gte(e){return this.compare(e)>=0}lt(e){return this.compare(e)<0}lte(e){return this.compare(e)<=0}toString(){return`${this.major}.${this.minor}.${this.patch}`}};var cV=v(H());var sV=v(Q$()),wo=v(require("fs")),nu=v(H()),aV=v(require("net")),n0=v(require("os")),i0=v(require("path"));var Xw=class{constructor(e,r){this.sessionId=e;this.sink=r;this.onMessageEmitter=new j;this.onEndEmitter=new j;this.disposables=new Ce;this.onMessage=this.onMessageEmitter.event;this.onEnd=this.onEndEmitter.event;this.disposables.push(r.NodeWorker.on("detachedFromWorker",n=>{n.sessionId===e&&(this.onEndEmitter.fire(),this.dispose())}),r.NodeWorker.on("receivedMessageFromWorker",n=>{n.sessionId===e&&this.onMessageEmitter.fire([n.message,new Vr])}))}send(e){this.sink.NodeWorker.sendMessageToWorker({message:e,sessionId:this.sessionId})}dispose(){this.disposables.isDisposed||(this.disposables.dispose(),this.onEndEmitter.fire())}};var e0=":::",Yw=class{constructor(e){this.processEnv=e}get nodeOptions(){return this.processEnv.NODE_OPTIONS}set nodeOptions(e){e===void 0?delete this.processEnv.NODE_OPTIONS:this.processEnv.NODE_OPTIONS=e}get inspectorOptions(){let e=this.processEnv.VSCODE_INSPECTOR_OPTIONS;if(!e)return;let r=e.split(e0).reverse().find(n=>!!n);if(r)try{return JSON.parse(r)}catch{return}}set inspectorOptions(e){e===void 0?delete this.processEnv.VSCODE_INSPECTOR_OPTIONS:this.processEnv.VSCODE_INSPECTOR_OPTIONS=JSON.stringify(e)}unsetForTree(){delete this.processEnv.VSCODE_INSPECTOR_OPTIONS}updateInspectorOption(e,r){let n=this.inspectorOptions;n&&(this.inspectorOptions={...n,[e]:r})}};var t0=require("path"),Z$=(0,t0.join)(__dirname,"watchdog.js"),Qw=(0,t0.join)(__dirname,"bootloader.js");var nm=v(ge()),Xr=v(H()),Yr=require("path");var tm=v(H()),eV=require("path");var ru=Symbol("IPackageJsonProvider"),Zw={getPath:()=>Promise.resolve(void 0),getContents:()=>Promise.resolve(void 0)},Lp=class{constructor(e,r){this.fs=e;this.config=r;this.getPath=me(async()=>{if(this.config.type!=="pwa-node"||this.config.request!=="launch")return;let e=await Ku(this.fs,this.config.cwd,"package.json");return e?(0,eV.join)(e,"package.json"):void 0});this.getContents=me(async()=>{let e=await this.getPath();if(e)try{let r=await this.fs.readFile(e);return JSON.parse(r.toString())}catch{return}})}};Lp=I([(0,tm.injectable)(),g(0,(0,tm.inject)(br)),g(1,(0,tm.inject)(Re))],Lp);var Vn=Symbol("INodeBinaryProvider");function eS(t,e){return t.has(1)?e.addNodeOption("--inspect-publish-uid=http"):e}var nue=new Set(["npm","yarn","pnpm","tnpm","cnpm"]),tV=t=>nue.has((0,Yr.basename)(t,(0,Yr.extname)(t))),rV=(t,e)=>{if(!(!t||!tV(t)))return e.find(r=>!r.startsWith("-")&&r!=="run"&&r!=="run-script")},r0=new qe(12,0,0),iue=new qe(8,0,0),oue=[{inclusiveMin:new qe(16,0,0),inclusiveMax:new qe(16,3,99),message:nm.t("Some breakpoints might not work in your version of Node.js. We recommend upgrading for the latest bug, performance, and security fixes. Details: https://aka.ms/AAcsvqm")},{inclusiveMin:new qe(7,0,0),inclusiveMax:new qe(8,99,99),message:nm.t("You're running an outdated version of Node.js. We recommend upgrading for the latest bug, performance, and security fixes.")}],Zt=class{constructor(e,r){this.path=e;this.version=r;this.capabilities=new Set;r===void 0&&(r=r0),r.gte(new qe(12,0,0))&&this.capabilities.add(0),r.gte(new qe(12,6,0))&&this.capabilities.add(1),r.gte(new qe(22,14,0))&&r.lt(new qe(24,0,0))&&sue.includes(Nf(e))&&this.capabilities.add(2)}get isPreciselyKnown(){return this.version!==void 0}get warning(){if(this.version){for(let e of oue)if(e.inclusiveMax.gte(this.version)&&e.inclusiveMin.lte(this.version))return e}}has(e,r){return!this.isPreciselyKnown&&r!==void 0?r:this.capabilities.has(e)}},rm=class extends q{constructor(r,n){super(mO(r.toString(),n));this.version=r;this.location=n}},nV=["node","node64","electron"],sue=[...nV,"npx","npm"],aue=new Map([[11,new qe(12,0,0)],[10,new qe(12,0,0)],[9,new qe(12,0,0)],[8,new qe(12,0,0)],[7,new qe(12,0,0)],[6,new qe(12,0,0)],[5,new qe(10,0,0)],[4,new qe(10,0,0)],[3,new qe(10,0,0)],[2,new qe(8,0,0)],[1,new qe(8,0,0)]]),us=class{constructor(e,r,n,i){this.logger=e;this.fs=r;this.packageJson=n;this.launchConfig=i;this.knownGoodMappings=new Map}async resolveAndValidate(e,r="node",n,i){try{return await this.resolveAndValidateInner(e,r,n,i)}catch(o){if(!(o instanceof rm))throw o;if(await this.shouldTryDebuggingAnyway(o))return new Zt(o.location,o.version instanceof qe?o.version:void 0);throw o}}shouldTryDebuggingAnyway(e){return Promise.resolve(!1)}async resolveNodeModulesLocation(e,r,n){if(!n||(0,Yr.isAbsolute)(r)||!(0,Yr.isAbsolute)(n))return;let i=this.launchConfig.__workspaceFolder;if(i)return oc(n,o=>Fu(i,o)?TI(this.fs,(0,Yr.join)(o,"node_modules",".bin",r),e):Promise.resolve(void 0))}async resolveAndValidateInner(e,r,n,i){let o=await this.resolveBinaryLocation(r,e);if(o||(o=await this.resolveNodeModulesLocation(e,r,i)),this.logger.info("runtime.launch","Using binary at",{location:o,executable:r}),!o)throw new q(FI(r,nm.t("path does not exist")));if(n)return new Zt(o,new qe(n,0,0));let s=Nf(o);if(s==="deno")return new Zt(o,new qe(20,0,0));if(!nV.includes(s)){if(tV(o)){let m=await this.packageJson.getPath();m&&(e=e.addToPath((0,Yr.resolve)((0,Yr.dirname)(m),"node_modules/.bin"),"prepend"))}try{let m=await this.resolveAndValidateInner(e,"node",void 0,i);return new Zt(o,m.version)}catch(m){if(IO(m,9230))throw m;return new Zt(o,void 0)}}if(o.startsWith("/snap/"))return new Zt(o,void 0);let a=this.knownGoodMappings.get(o);if(a)return a;let c=await this.getVersionText(o,i);if(!c)return new Zt(o,void 0);this.logger.info("runtime.launch","Discovered version",{version:c});let u=/v([0-9]+)\.([0-9]+)\.([0-9]+)/.exec(c);if(!u)throw new rm(c,o);let[,l,p,d]=u.map(Number),f=new qe(l,p,d);if(s==="electron"){let m=await this.resolveAndValidate(e);f=qe.min(aue.get(f.major)??r0,m.version??r0)}if(f.lt(iue))throw new rm(f,o);let h=new Zt(o,f);return this.knownGoodMappings.set(o,h),h}async resolveBinaryLocation(e,r){return e&&(0,Yr.isAbsolute)(e)?await TI(this.fs,e,r):await sy(this.fs,e,r.value)}async getVersionText(e,r){try{let{stdout:n}=await kw(e,["--version"],{env:Lt.processEnv().defined(),cwd:r});return n.trim()}catch(n){throw r&&!(await Er(this.fs,r))?.isDirectory()?new q(hO(r)):new q(FI(e,n.message))}}};us=I([(0,Xr.injectable)(),g(0,(0,Xr.inject)(Y)),g(1,(0,Xr.inject)(ve)),g(2,(0,Xr.inject)(ru)),g(3,(0,Xr.inject)(Re))],us);var Np=class extends us{constructor(r,n,i,o,s){super(r,n,i,o);this.vscode=s}async shouldTryDebuggingAnyway({message:r}){if(!this.vscode)return!1;let n=nm.t("Yes");return await this.vscode.window.showErrorMessage(r,n)===n}};Np=I([g(0,(0,Xr.inject)(Y)),g(1,(0,Xr.inject)(ve)),g(2,(0,Xr.inject)(ru)),g(3,(0,Xr.inject)(Re)),g(4,(0,Xr.optional)()),g(4,(0,Xr.inject)(Dt))],Np);var iV=require("path");var Mp=class{constructor(e,r,n,i,o,s,a={},c){this.launchConfig=e;this.targetOriginValue=r;this.connection=n;this.targetInfo=o;this.logger=s;this.lifecycle=a;this._parent=c;this._serialize=Promise.resolve(void 0);this._attached=!1;this._onNameChangedEmitter=new j;this._onDisconnectEmitter=new j;this.entryBreakpoint=void 0;this.onDisconnect=this._onDisconnectEmitter.event;this.onNameChanged=this._onNameChangedEmitter.event;this.connection=n,this._cdp=i,i.pause(),this._waitingForDebugger=o.type==="waitingForDebugger",o.title?this._targetName=`${(0,iV.basename)(o.title)} [${o.processId}]`:this._targetName=`[${o.processId}]`,i.Target.on("targetDestroyed",()=>this.connection.close()),n.onDisconnected(()=>this._disconnected())}id(){return this.targetInfo.targetId}processId(){return this.targetInfo.processId}name(){return this._targetName}fileName(){return this.targetInfo.title}type(){return"node"}targetOrigin(){return this.targetOriginValue}parent(){return this._parent}async initialize(){this.lifecycle.initialized&&(this.entryBreakpoint=await this.lifecycle.initialized(this)||void 0)}waitingForDebugger(){return this._waitingForDebugger}scriptUrlToUrl(e){return e[0]==="/"||process.platform==="win32"&&e[1]===":"&&e[2]==="\\"?We(e):e}supportsCustomBreakpoints(){return!1}supportsXHRBreakpoints(){return!1}executionContextName(){return this._targetName}hasParent(){return!!this._parent}async runIfWaitingForDebugger(){await this._cdp.Runtime.runIfWaitingForDebugger({})}async _disconnected(){this._onDisconnectEmitter.fire()}canAttach(){return!this._attached}async attach(){return this._serialize=this._serialize.then(async()=>{if(!this._attached)return this._doAttach()}),this._serialize}async _doAttach(){this._waitingForDebugger=!1,this._attached=!0;let e=await this._cdp.Target.attachToTarget({targetId:this.targetInfo.targetId});if(!e){this.logger.info("runtime.launch","Failed to attach to target",{targetId:this.targetInfo.targetId});return}this._cdp.NodeWorker.enable({waitForDebuggerOnStart:!0}),e&&"__dynamicAttach"in e&&(await this._cdp.Runtime.enable({}),await this._cdp.Debugger.enable({}));let r;return this._cdp.Runtime.on("executionContextCreated",n=>{n.context.auxData&&n.context.auxData.isDefault&&(r=n.context.id)}),this._cdp.Runtime.on("executionContextDestroyed",n=>{n.executionContextId===r&&this.connection.close()}),this._cdp}async afterBind(){this._cdp.resume()}canDetach(){return this._attached}async detach(){this._serialize=this._serialize.then(async()=>{this._waitingForDebugger&&await(await this._doAttach())?.Runtime.runIfWaitingForDebugger({}),this._attached&&this._doDetach()})}async _doDetach(){await Promise.all([this._cdp.Target.detachFromTarget({targetId:this.targetInfo.targetId}),this._cdp.NodeWorker.disable({})]),this.connection.close(),this._attached=!1}canRestart(){return!1}restart(){}canStop(){return!0}stop(){try{this.lifecycle.close&&this.lifecycle.close(this)}finally{this.connection.close()}}};var Qr=class{constructor(e,r,n,i){this.pathProvider=e;this.logger=r;this.portLeaseTracker=n;this.pathResolverFactory=i;this.serverConnections=new Set;this.targets=new ho;this.onTerminatedEmitter=new j;this.onTerminated=this.onTerminatedEmitter.event;this.onTargetListChanged=this.targets.onChanged;this.bootloaderFile=me(this.getBootloaderFile.bind(this));this.seenOpeners=new Map}async launch(e,r){let n=this.resolveParams(e);if(!n)return{blockSessionTermination:!1};this._stopServer();let{server:i,pipe:o}=await this._startServer(r.telemetryReporter),s=this.logger.forTarget(),a=this.run={server:i,serverAddress:o,params:n,context:r,logger:s,pathResolver:this.pathResolverFactory.create(n,this.logger)};return await this.launchProgram(a),{blockSessionTermination:!0}}async terminate(){this.program?await this.program.stop():this.onProgramTerminated({code:0,killed:!0})}async restart(e){if(!this.run)return;let r=this.program;r&&(this.program=void 0,await r.stop(),await Promise.race([_e(2e3).then(()=>!1),Promise.all([...this.serverConnections].map(i=>new Promise(o=>i.onDisconnected(o))))])||(this.logger.warn("runtime.launch","Timeout waiting for server connections to close"),this.closeAllConnections())),await this.launchProgram({...this.run,params:e?this.resolveParams(e)??this.run.params:this.run.params,context:{...this.run.context,cancellationToken:this.run.params.timeout>0?Ft.withTimeout(this.run.params.timeout).token:zt}})}targetList(){return[...this.targets.value()]}dispose(){this._stopServer()}onProgramTerminated(e){this.onTerminatedEmitter.fire(e),this._stopServer(),this.program=void 0}resolveNodePath(e,r="node"){return this.pathProvider.resolveAndValidate(Lt.merge(Lt.processEnv(),this.getConfiguredEnvironment(e)),r,e.nodeVersionHint,e.cwd)}getConfiguredEnvironment(e){let r=Lt.empty;if(e.envFile)try{r=r.merge(uue(e.envFile))}catch(n){throw new q(fO(n.message))}return r.merge(e.env)}async resolveEnvironment({params:e,serverAddress:r},n,i){let o=this.getConfiguredEnvironment(e),s=await this.bootloaderFile(e.cwd,n),a={inspectorIpc:r,deferredMode:!1,waitForDebugger:"",execPath:await sy(wo.promises,"node",process.env),onlyEntrypoint:!e.autoAttachChildProcesses,verbose:e.trace===!0||typeof e.trace=="object"&&e.trace.stdio?!0:void 0,autoAttachMode:"always",mandatePortTracking:this.portLeaseTracker.isMandated?!0:void 0,...i},c={NODE_OPTIONS:` --require ${s.interpolatedPath} `,VSCODE_INSPECTOR_OPTIONS:e0+JSON.stringify(a),ELECTRON_RUN_AS_NODE:null},u=o.lookup("NODE_OPTIONS");u&&(c.NODE_OPTIONS+=` ${u} `);let l=Lt.processEnv().lookup("NODE_OPTIONS");return l&&(c.NODE_OPTIONS+=` ${l}`),o.merge({...c})}createLifecycle(e,r,n){return{}}async _startServer(e){let r=oy(),n=await new Promise((i,o)=>{let s=aV.createServer(a=>this._startSession(a,e)).on("error",o).listen(r,()=>i(s))});return{pipe:r,server:n}}_stopServer(){this.run?.server.close(),this.run=void 0,this.bootloaderFile.value?.then(e=>e.dispose()),this.bootloaderFile.forget(),this.closeAllConnections()}closeAllConnections(){this.serverConnections.forEach(e=>e.close()),this.serverConnections.clear()}async _startSession(e,r){if(!this.run)return;let{connection:n,cdp:i,targetInfo:o}=await this.acquireTarget(e,r,this.run.logger);if(!this.run){e.destroy();return}o.processId===void 0&&(o.processId=Number(o.targetId));let s=o.openerId;for(;s&&!this.targets.get(s)&&this.seenOpeners.has(s);)s=this.seenOpeners.get(s)?.openedBy;let a=new Mp(this.run.params,this.run.context.targetOrigin,n,i,o,this.run.logger,this.createLifecycle(i,this.run,o),s?this.targets.get(s):void 0);this.seenOpeners.set(o.targetId,{openedBy:o.openerId}),this.listenToWorkerDomain(i,r,a),this.targets.add(o.targetId,a),a.onDisconnect(()=>this.targets.remove(o.targetId))}async listenToWorkerDomain(e,r,n){e.NodeWorker.on("attachedToWorker",i=>{let o=new Xw(i.sessionId,e),s=new Ml(n.launchConfig,{attached:!0,canAccessOpener:!1,type:"node-worker",targetId:`${n.id()}-${i.sessionId}`,title:i.workerInfo.title,url:i.workerInfo.url,openerId:n.id()},n,n.targetOrigin(),new ut(o,n.logger,r).rootSession(),n.logger),a=new Ce;a.push(o),a.push(n.onDisconnect(()=>a.dispose())),a.push(o.onEnd(()=>a.dispose())),a.callback(()=>this.targets.remove(s.id())),this.targets.add(s.id(),s)})}async acquireTarget(e,r,n){let i=new ut(new go(n,e),n,r);this.serverConnections.add(i),i.onDisconnected(()=>this.serverConnections.delete(i));let o=i.rootSession(),{targetInfo:s}=await new Promise(u=>o.Target.on("targetCreated",u)),a=s,c=this.portLeaseTracker.register(a.processInspectorPort);return i.onDisconnected(()=>c.dispose()),{targetInfo:a,cdp:o,connection:i,logger:n}}async getBootloaderFile(e,r){let n=ze(Qw);if(!n.includes(" "))return{interpolatedPath:n,dispose:()=>{}};if(r.has(0))return{interpolatedPath:`"${n}"`,dispose:()=>{}};let i=`require(${JSON.stringify(n)})`;if(!n0.tmpdir().includes(" ")||!e){let a=i0.join(n0.tmpdir(),"vscode-js-debug-bootloader.js");return await wo.promises.writeFile(a,i),{interpolatedPath:a,dispose:()=>{}}}let o=".vscode-js-debug-bootloader.js",s=i0.join(e,o);return await wo.promises.writeFile(s,i),{interpolatedPath:`./${o}`,dispose:()=>wo.unlinkSync(s)}}async gatherTelemetryFromCdp(e,r){for(let n=0;n<8;n++){let i=await e.Runtime.evaluate({contextId:1,returnByValue:!0,expression:"typeof process === 'undefined' || process.pid === undefined ? 'process not defined' : ({ processId: process.pid, nodeVersion: process.version, architecture: process.arch })"+ht()});if(!this.program)return;if(!i||!i.result||!i.result.value){this.logger.error("runtime.target","Undefined result getting telemetry");return}if(typeof i.result.value!="object"){this.logger.info("runtime.target","Process not yet defined, will retry"),await _e(50*2**n);continue}let o=i.result.value;return r.context.telemetryReporter.report("nodeRuntime",{version:o.nodeVersion,arch:o.architecture}),this.program.gotTelemetery(o),o}}};Qr=I([(0,nu.injectable)(),g(0,(0,nu.inject)(Vn)),g(1,(0,nu.inject)(Y)),g(2,(0,nu.inject)(nt)),g(3,(0,nu.inject)(Lr))],Qr);function uue(t){if(!wo.existsSync(t))return{};let e=lue(wo.readFileSync(t,"utf8"));return sV.parse(Buffer.from(e))}function lue(t){return t&&t[0]==="\uFEFF"&&(t=t.substr(1)),t}var pue=["NODE_OPTIONS","VSCODE_INSPECTOR_OPTIONS"],Ia=class extends Qr{async appendEnvironmentVariables(e,r){let n="typeof Deno==='object'?'deno':typeof process==='undefined'||process.pid===undefined?'process not defined':(()=>{"+Object.entries(r.defined()).map(([i,o])=>{let s=JSON.stringify(i);return pue.includes(i)?`process.env[${s}]=(process.env[${s}]||'')+${JSON.stringify(o)}`:`process.env[${s}]=${JSON.stringify(o)}`}).join(";")+"})()"+ht();for(let i=0;i<200;i++){let o=await e.Runtime.evaluate({contextId:1,returnByValue:!0,expression:n});if(!o){this.logger.error("runtime.target","Undefined result setting child environment vars");return}if(!o.exceptionDetails&&o.result.value!=="process not defined")return;this.logger.error("runtime.target","Error setting child environment vars",o),await _e(50)}}};Ia=I([(0,cV.injectable)()],Ia);var tS=class{constructor(e,r){this.a=e;this.b=r;this.stopped=Promise.race([this.a.stopped.then(async e=>await this.b.stop()&&e),this.b.stopped.then(async e=>await this.a.stop()&&e)])}gotTelemetery(e){this.a.gotTelemetery(e),this.b.gotTelemetery(e)}async stop(){return(await Promise.all([this.a.stop(),this.b.stop()]))[0]}},rS=class{constructor(e,r,n){this.child=e;this.logger=r;this.killBehavior=n;this.killed=!1;this.stopped=new Promise((i,o)=>{e.once("exit",s=>i({killed:this.killed,code:s||0})),e.once("error",s=>o({killed:this.killed,code:1,error:s}))})}gotTelemetery(){}stop(){return this.killed=!0,hi(this.child.pid,this.logger,this.killBehavior),this.stopped}},ls=class{constructor(){this.stopped=new Promise(e=>this.stopDefer=e)}gotTelemetery(e){this.telemetry=e}stop(){return this.stopDefer({code:0,killed:!0}),this.stopped}},Ca=class extends ls{constructor(r){super();this.wd=r;r.onEnd(n=>{this.stopDefer(n),this.wd.dispose()})}stop(){return this.wd.dispose(),this.stopped}},Bp=class t{constructor(e,r,n){this.terminalResult=e;this.logger=r;this.killBehavior=n;this.didStop=!1;this.stopped=new Promise(e=>this.onStopped=r=>{this.didStop=!0,e({code:0,killed:r})});e.processId&&(this.liveness=new ga(e.processId,this.onStopped,t.terminationPollInterval))}static{this.terminationPollInterval=1e3}static{this.killConfirmInterval=200}gotTelemetery({processId:e}){if(this.didStop){hi(e,this.logger,this.killBehavior);return}this.liveness??=new ga(e,this.onStopped,1e3)}stop(){return this.didStop?this.stopped:(this.didStop=!0,this.liveness?(hi(this.liveness.pid,this.logger,this.killBehavior),this.liveness.updateInterval(t.killConfirmInterval)):this.terminalResult.shellProcessId?(hi(this.terminalResult.shellProcessId,this.logger,this.killBehavior),this.liveness=new ga(this.terminalResult.shellProcessId,this.onStopped,t.killConfirmInterval)):this.onStopped(!0),this.stopped)}};var pV=v(require("net"));var uV=require("crypto"),lV=()=>(0,uV.randomBytes)(12).toString("hex");var Gn=class t{constructor(e,r){this.info=e;this.server=r;this.onEndEmitter=new j;this.cts=new Ft;this.gracefulExit=!1;this.targetAlive=!1;this.targetInfo={targetId:this.info.ownId??lV(),processId:Number(this.info.pid)||0,type:this.info.waitForDebugger?"waitingForDebugger":"",title:this.info.scriptName,url:"file://"+this.info.scriptName,openerId:this.info.openerId,attached:!0,canAccessOpener:!1,processInspectorPort:Number(new URL(this.info.inspectorURL).port)};this.onEnd=this.onEndEmitter.event;this.listenToServer()}get isTargetAlive(){return this.targetAlive}static async attach(e){let r=await new Promise((i,o)=>{let s=pV.createConnection(e.ipcAddress,()=>i(s));s.on("error",o)}),n=new go(Wn.null,r);return new t(e,n)}listenToServer(){let{server:e,targetInfo:r}=this;e.send(JSON.stringify({method:"Target.targetCreated",params:{targetInfo:r}})),e.onMessage(async([n])=>{if(this.target&&!n.includes("Target.attachToTarget")&&!n.includes("Target.detachFromTarget")){this.target.send(n);return}let i=await this.execute(n);i&&e.send(JSON.stringify(i))}),e.onEnd(()=>{this.disposeTarget(),this.onEndEmitter.fire({killed:this.gracefulExit,code:this.gracefulExit?0:1})})}dispose(){this.gracefulExit=!0,this.cts.dispose(!0),this.disposeTarget(),this.server.dispose()}async execute(e){let r=JSON.parse(e);switch(r.method){case"Target.attachToTarget":return this.target&&this.disposeTarget(),this.target=await this.createTarget(),{id:r.id,result:{sessionId:this.targetInfo.targetId,__dynamicAttach:this.info.dynamicAttach?!0:void 0}};case"Target.detachFromTarget":return this.gracefulExit=!0,this.disposeTarget(),{id:r.id,result:{}};default:this.target?.send(r);return}}async createTarget(){this.gracefulExit=!1;let e=await Or.create(this.info.inspectorURL,this.cts.token,this.info.remoteHostHeader);return e.onMessage(([r])=>this.server.send(r)),e.onEnd(()=>{e&&this.server.send(JSON.stringify({method:"Target.targetDestroyed",params:{targetId:this.targetInfo.targetId,sessionId:this.targetInfo.targetId}})),this.targetAlive=!1,this.server.dispose()}),e}disposeTarget(){this.target&&(this.target.dispose(),this.target=void 0)}};var o0=class extends Ca{constructor(r,n){super(r);this.logger=n;this.stopped.then(()=>{this.telemetry&&hi(this.telemetry.processId,this.logger,"polite")})}},Fp=class extends Ia{constructor(){super(...arguments);this.restarting=!1}async restart(){this.restarting=!0,this.onProgramTerminated({code:0,killed:!0,restart:!0}),this.program?.stop()}resolveParams(r){return r.type==="pwa-extensionHost"&&r.request==="attach"?r:void 0}async launchProgram(r){let n=await Ip(`http://localhost:${r.params.port}`,r.context.cancellationToken,this.logger),i=await Gn.attach({ipcAddress:r.serverAddress,scriptName:"Extension Host",inspectorURL:n,waitForDebugger:!0,dynamicAttach:!0}),o=this.program=new o0(i,this.logger);this.program.stopped.then(s=>{o===this.program&&this.onProgramTerminated(s)})}createLifecycle(r,n,i){return i.openerId?{}:{initialized:()=>this.onFirstInitialize(r,n,i)}}async onFirstInitialize(r,n,i){this.setEnvironmentVariables(r,n,i.targetId);let o=await this.gatherTelemetryFromCdp(r,n),s=this.program;if(o&&s){let a=new Bp({processId:o.processId},this.logger,"forceful");a.stopped.then(()=>s.stop()),s.stopped.then(()=>{this.restarting||a.stop()})}}async setEnvironmentVariables(r,n,i){if(!n.params.autoAttachChildProcesses)return;let o=await this.resolveEnvironment(n,new Zt("node",qe.parse(process.versions.node)),{openerId:i});return this.appendEnvironmentVariables(r,o.update("ELECTRON_RUN_AS_NODE",null))}};Fp=I([(0,dV.injectable)()],Fp);var im=require("fs"),fV=v(H());var Up=class extends Qr{resolveParams(e){return e.type==="pwa-extensionHost"&&e.request==="launch"?e:void 0}async launchProgram(e){let r=e.params.port||await qs(),n=await e.context.dap.launchVSCodeRequest({args:due(e.params,r),env:this.getConfiguredEnvironment(e.params).defined(),debugRenderer:e.params.debugWebviews||e.params.debugWebWorkerHost});n.rendererDebugAddr&&bi.debugIdTorendererDebugAddr.set(e.params.__sessionId,n.rendererDebugAddr),this.program=new ls,this.program.stop()}};Up=I([(0,fV.injectable)()],Up);var due=(t,e)=>{let r=t.args.map(n=>{if(n.startsWith("-")){let i=n.split("=",2);return i.length===2&&((0,im.existsSync)(i[1])||(0,im.existsSync)(i[1]+".js"))?{prefix:i[0]+"=",path:i[1]}:{prefix:n}}else{try{let i=(0,im.lstatSync)(n);if(i.isDirectory())return{prefix:"--folder-uri=",path:n};if(i.isFile())return{prefix:"--file-uri=",path:n}}catch{}return{path:n}}});return t.noDebug||r.unshift({prefix:`--inspect-brk-extensions=${e}`}),r.unshift({prefix:`--debugId=${t.__sessionId}`}),r};var xV=v(ge()),iu=v(H());var hV=require("crypto"),om=require("fs"),mV=require("os"),gV=v(require("path")),nS=class t{constructor(){this.disposed=!1;this.path=gV.join((0,mV.tmpdir)(),`node-debug-callback-${(0,hV.randomBytes)(8).toString("hex")}`);this.file=om.promises.open(this.path,"w")}static{this.updateInterval=1e3}static{this.recencyDeadline=2e3}static isValid(e){try{let r=(0,om.readFileSync)(e);return r.length?r.readDoubleBE()>Date.now()-t.recencyDeadline:!1}catch{return!1}}async startTouchLoop(){await this.touch(),this.disposed||(this.updateInterval=setInterval(()=>this.touch(),t.updateInterval))}async touch(e=()=>Date.now()){let r=await this.file,n=Buffer.alloc(8);n.writeDoubleBE(e()),await r.write(n,0,n.length,0)}async dispose(){if(!this.disposed){this.disposed=!0,this.updateInterval&&clearInterval(this.updateInterval);try{await(await this.file).close(),await om.promises.unlink(this.path)}catch{}}}};var wV=require("fs");var bV=require("path");var yV=require("child_process");var iS=class{constructor(e=yV.spawn){this.spawn=e}lookup(e,r){return new Promise((n,i)=>{let o=this.createProcess(),s=this.createParser();o.on("error",i),o.stderr.on("error",a=>i(`Error finding processes: ${a.toString()}`)),o.stdout.pipe(new ma(`
`)).on("data",a=>{let c=s(a.toString());c&&(r=e(c,r))}),o.on("close",(a,c)=>{a===0?n(r):c?i(new Error(`process terminated with signal: ${c}`)):a&&i(new Error(`process terminated with exit code: ${a}`))})})}};var jp=class extends iS{constructor(r){super();this.fsUtils=r}async getWorkingDirectory(r){try{let{stdout:n}=await kw("lsof",["-a","-dcwd","-Fn",`-p${r}`]),i=n.trim().split(`
`).pop().slice(1);return i&&(0,bV.isAbsolute)(i)&&await this.fsUtils.exists(i)?i:void 0}catch(n){if(n instanceof Kh)return;throw n}}createProcess(){return this.spawn("ps",["-xo",`pid=PID,ppid=PPID,comm=${"a".repeat(256)},command=COMMAND`])}createParser(){let r;return n=>{if(!r){r=n.indexOf("COMMAND");return}let i=/^\W*([0-9]+)\W*([0-9]+)\W*/.exec(n);if(i)return{pid:Number(i[1]),ppid:Number(i[2]),command:n.slice(i[0].length,r).trim(),args:n.slice(r).trim()}}}};var oS=class extends jp{createProcess(){return this.spawn("ps",["-axo","pid=PID,ppid=PPID,comm:30,command=COMMAND"])}createParser(){let e=super.createParser();return r=>{let n=e(r);if(!n)return;let i=n.args.indexOf(n.command);if(i===-1)return n;for(i=i+n.command.length;i<n.args.length&&n.args[i]!==" ";)i++;return n.command=n.args.substr(0,i),n.args=n.args.substr(i+1),n}}};var sS=class{async getWorkingDirectory(){}async lookup(e,r){let n=await Fw();for(let i of n.getProcessInfo()){let o="",s,a=i.commandLine.indexOf('" ');if(a===-1){let c=i.commandLine.indexOf(" ");c===-1?s=i.commandLine:(s=i.commandLine.slice(0,c),o=i.commandLine.slice(c+1))}else s=i.commandLine.slice(1,a),o=i.commandLine.slice(a+2);r=e({args:o,command:s,date:i.creationDate*1e3,pid:i.processId,ppid:i.parentProcessId},r)}return r}};var vV=new nn(wV.promises),sm=process.platform==="win32"?new sS:process.platform==="darwin"?new jp(vV):new oS(vV),fue=me(()=>{let t=["--inspect(?:-brk)?","(?:=",["(?:",["(?:","(?<address>\\[[0-9a-f:]*\\]|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+|(?:[a-z][a-z0-9\\.]*))","(?::(?<port1>\\d+))?",")"],"|",["(?:",":?","(?<port2>\\d+)?",")"],")"],")?"].flat(1/0).join("");return new RegExp(t,"i")});function aS(t){let e=/--inspect-port=(\d+)/,r,n,i=fue().exec(t);if(i?.groups){let o=i.groups.port1||i.groups.port2;n=o?Number(o):9229,r=i.groups.address??"127.0.0.1"}return i=e.exec(t),i&&i.length===2&&(r||="127.0.0.1",n=parseInt(i[1])),{address:r,port:n}}async function SV(t,e,r,n=zt){let i=await hue(t.pid,r);if(!i)return[];let o=[],s=i.children.slice();for(;s.length;){let a=s.pop();s=s.concat(a.children);let{port:c}=aS(a.args);c&&o.push(zE(`http://${t.hostname}:${c}`,n,r,!0).then(u=>Gn.attach({ipcAddress:t.ipcAddress,scriptName:"Child Process",inspectorURL:u,waitForDebugger:!0,dynamicAttach:!0,pid:String(a.pid),openerId:e})).catch(u=>r.info("internal","Could not spawn WD for child process",{err:u,port:c,child:a})))}return(await Promise.all(o)).filter(a=>!!a)}async function hue(t,e){let r=new Map;r.set(0,{children:[],pid:0,ppid:0,command:"",args:""});try{await sm.lookup(({pid:i,ppid:o,command:s,args:a})=>(i!==o&&r.set(i,{pid:i,ppid:o,command:s,args:a,children:[]}),r),null)}catch(i){e.warn("internal","Error getting child process tree",i);return}let n=r.values();for(let i of n){let o=r.get(i.ppid);o&&o!==i&&o.children.push(i)}return!isNaN(t)&&t>0?r.get(t):r.get(0)}var _V=v(H());var So=class{create(e){return e===!1?new s0:e===!0?new cS({maxAttempts:1/0,delay:1e3}):new cS({maxAttempts:e.maxAttempts??1/0,delay:e.delay??1e3})}};So=I([(0,_V.injectable)()],So);var cS=class t{constructor(e,r=0){this.options=e;this.attempt=r}get delay(){return this.options.delay}next(){return this.attempt===this.options.maxAttempts?void 0:new t(this.options,this.attempt+1)}reset(){return this.attempt?new t(this.options):this}},s0=class{constructor(){this.delay=-1}next(){}reset(){return this}};var Wp=class extends Ia{constructor(r,n,i,o,s=new So){super(r,n,o,i);this.restarters=s}resolveParams(r){return r.type==="pwa-node"&&r.request==="attach"?r:void 0}async launchProgram(r){let n=async(o,s)=>{let a=this.program,c;try{r.params.websocketAddress?c=r.params.websocketAddress:c=await Ip(`http://${r.params.address}:${r.params.port}`,s&&r.params.timeout>0?Ft.withTimeout(r.params.timeout).token:r.context.cancellationToken,this.logger,r.params.remoteHostHeader)}catch(p){if(a&&a===s)return i(o,a,{killed:!1,code:1});throw p}let u=await Gn.attach({ipcAddress:r.serverAddress,scriptName:"Remote Process",inspectorURL:c,remoteHostHeader:r.params.remoteHostHeader,waitForDebugger:!0,dynamicAttach:!0}),l=this.program=new Ca(u);l.stopped.then(p=>i(o.reset(),l,p))},i=async(o,s,a)=>{if(this.program!==s)return;if(a.killed){this.onProgramTerminated(a);return}let c=o.next();if(!c){this.onProgramTerminated(a);return}r.context.dap.output({output:xV.t(`Lost connection to debugee, reconnecting in {0}ms\r
`,c.delay)});let u=new ls;this.program=u;let l=await Promise.race([_e(c.delay),u.stopped]);this.program===u&&(l?this.onProgramTerminated(a):n(c,u))};return n(this.restarters.create(r.params.restart))}async terminate(r){await super.terminate(),r&&this.telemetry&&hi(this.telemetry.processId,this.logger)}createLifecycle(r,n,i){if(i.openerId)return{};let o;return{initialized:async()=>{o=this.onFirstInitialize(r,n,i),await o},close:()=>{this.targetList().length&&this.program?.stop(),o?.then(s=>s.dispose())}}}async onFirstInitialize(r,n,i){let o=new nS;await o.startTouchLoop();let s=new Zt("node",void 0);try{s=await this.resolveNodePath(n.params)}catch{}let[a]=await Promise.all([this.gatherTelemetryFromCdp(r,n),this.setEnvironmentVariables(r,n,o.path,i.targetId,s)]);return this.telemetry=a,a&&n.params.attachExistingChildren&&SV({pid:a.processId,nodePath:s.path,hostname:n.params.address,ipcAddress:n.serverAddress},i.targetId,this.logger).catch(c=>this.logger.warn("internal","Error watching child processes",{err:c})),o}async setEnvironmentVariables(r,n,i,o,s){if(!n.params.autoAttachChildProcesses)return;if(!await Ju(n.params.address)){this.logger.warn("runtime.target","Cannot attach to children of remote process");return}let a=await this.resolveEnvironment(n,s,{requireLease:i,openerId:o});return this.appendEnvironmentVariables(r,a)}};Wp=I([(0,iu.injectable)(),g(0,(0,iu.inject)(Vn)),g(1,(0,iu.inject)(Y)),g(2,(0,iu.inject)(Lr)),g(3,(0,iu.inject)(nt))],Wp);var Cr=v(H()),$p=require("path");function uS(t){if(!t.runtimeArgs||t.attachSimplePort)return;let e=[];for(let r of t.runtimeArgs)/^--inspect-brk(=|$)/.test(r)?t.stopOnEntry=t.stopOnEntry||!0:e.push(r);t.runtimeArgs=e}var IV=require("crypto"),Hp=require("fs"),CV=require("os"),TV=v(require("path")),lS=class t{constructor(){this.path=TV.join((0,CV.tmpdir)(),`node-debug-callback-${(0,IV.randomBytes)(8).toString("hex")}`);this.disposed=!1}static{this.pollInterval=200}read(e=t.pollInterval){return this.readPromise?this.readPromise:(this.readPromise=new Promise((r,n)=>{let i=setInterval(()=>{if(this.disposed){clearInterval(i),r(void 0);return}if((0,Hp.existsSync)(this.path)){try{r(JSON.parse((0,Hp.readFileSync)(this.path,"utf-8")))}catch(o){n(o)}finally{this.dispose()}clearInterval(i)}},e)}),this.readPromise)}dispose(){if(!this.disposed){this.disposed=!0;try{(0,Hp.unlinkSync)(this.path)}catch{}}}};var ou=v(require("path"));var am=Symbol("IProgramLauncher"),pS=t=>{let e=t.program;if(e&&ou.isAbsolute(e)){let n=ou.relative(t.cwd,e);e=ou.isAbsolute(n)?n:`.${ou.sep}${n}`}let r=Ly(t.args).filter(n=>n!=="");return e?[...t.runtimeArgs,e,...r]:[...t.runtimeArgs,...r]};var mue=async(t,e)=>{if(typeof e.stopOnEntry=="string")return(0,$p.resolve)(e.cwd,e.stopOnEntry);if(e.program)return(0,$p.resolve)(e.cwd,e.program);for(let r of Ly(e.args)){if(r.startsWith("-"))continue;let n=(0,$p.resolve)(e.cwd,r);if(await t.exists(n))return n}},qp=class extends Qr{constructor(r,n,i,o,s,a,c,u,l,p){super(r,n,l,u);this.bpPredictor=i;this.launchers=o;this.restarters=s;this.fsUtils=a;this.packageJson=c;this.vscode=p}resolveParams(r){let n;if(r.type==="pwa-node"&&r.request==="launch"?n={...r}:"server"in r&&r.server&&"program"in r.server&&(n={...r.server}),!!n)return uS(n),n}async launchProgram(r){r.params.program&&(r.params.program=await this.tryGetCompiledFile(r.params.program)),this.attachSimplePort=await this.getSimpleAttachPortIfAny(r.params);let n=async i=>{this.program&&this.program.stop();let o=await this.resolveNodePath(r.params,r.params.runtimeExecutable||void 0),s=o.warning;s&&r.context.dap.output({category:"stderr",output:s.message});let a=new lS,c=await this.resolveEnvironment(r,o,{fileCallback:a.path});this.attachSimplePort?(r.params.attachSimplePort||r.context.dap.output({category:"stderr",output:"Using legacy attach mode for --inspect-brk in npm scripts. We recommend removing --inspect-brk, and using `stopOnEntry` in your launch.json if you need it."}),c=c.merge({NODE_OPTIONS:null})):c=eS(o,c);let u={...r.params,env:c.value},l="--experimental-network-inspection";r.params.experimentalNetworking==="off"||(o.has(2)||r.params.experimentalNetworking==="on")&&(u.runtimeArgs=[l,...u.runtimeArgs]);let p=this.launchers.find(f=>f.canLaunch(u));if(!p)throw new Error("Cannot find an appropriate launcher for the given set of options");let d=await p.launchProgram(o.path,u,r.context);if(this.attachSimplePort){let f=await Gn.attach({ipcAddress:r.serverAddress,scriptName:"Remote Process",inspectorURL:await Ip(`http://127.0.0.1:${this.attachSimplePort}`,r.context.cancellationToken,this.logger),waitForDebugger:!0,dynamicAttach:!0});d=new tS(d,new Ca(f))}else a.read().then(f=>{f&&d.gotTelemetery(f)});this.program=d,d.stopped.then(async f=>{if(a.dispose(),this.program!==d)return;if(f.killed||f.code===0){this.onProgramTerminated(f);return}let h=i.next();if(!h){this.onProgramTerminated(f);return}await _e(h.delay),this.program===d&&n(h)})};return n(this.restarters.create(r.params.restart))}async getSimpleAttachPortIfAny(r){if(r.attachSimplePort)return r.attachSimplePort;let n=rV(r.runtimeExecutable,r.runtimeArgs);if(!(!n||!(await this.packageJson.getContents())?.scripts?.[n]?.includes("--inspect-brk")))return r.port??9229}createLifecycle(r,n,{targetId:i}){return{initialized:async()=>{if(this.attachSimplePort&&await this.gatherTelemetryFromCdp(r,n),!n.params.stopOnEntry)return;let o=await mue(this.fsUtils,n.params);if(!o){this.logger.warn("runtime","Could not resolve program entrypointfrom args");return}let s="(?:entryBreakpoint){0}",a=We(o),c=Pn(a)+s,u=await r.Debugger.setBreakpointByUrl({urlRegex:c,lineNumber:0,columnNumber:0});return u?.breakpointId?{cdpId:u?.breakpointId,path:a}:void 0},close:()=>{let o=Number(i);if(o>0)try{process.kill(o)}catch{}}}}async tryGetCompiledFile(r){r=ft(r);let n=(0,$p.extname)(r);if(!n||n===".js"||!(this.vscode?Xe(this.vscode.workspace,"debug.javascript.resolveDebugEntrypoint"):!0))return r;let o=await this.bpPredictor.getPredictionForSource(r);if(!o||o.size===0)return r;let s=As(o.values());return s?(this.logger.info("runtime.launch","Updating entrypoint to compiled file",{from:r,to:s.compiledPath,candidates:o.size}),s.compiledPath):r}};qp=I([(0,Cr.injectable)(),g(0,(0,Cr.inject)(Vn)),g(1,(0,Cr.inject)(Y)),g(2,(0,Cr.inject)(uc)),g(3,(0,Cr.multiInject)(am)),g(4,(0,Cr.inject)(So)),g(5,(0,Cr.inject)(br)),g(6,(0,Cr.inject)(ru)),g(7,(0,Cr.inject)(Lr)),g(8,(0,Cr.inject)(nt)),g(9,(0,Cr.optional)()),g(9,(0,Cr.inject)(Dt))],qp);var Gp=v(require("fs")),PV=require("fs"),dS=v(H()),EV=v(require("os")),Nt=v(require("path"));var fS=Symbol("INvmResolver");var Vp=class{constructor(e=new nn(PV.promises),r=process.env,n=process.arch,i=process.platform,o=EV.homedir()){this.fsUtils=e;this.env=r;this.arch=n;this.platform=i;this.homedir=o}async resolveNvmVersionPath(e){let r,n=[],i=this.parseVersionString(e),o=this.env.NVS_HOME;if(!o){let s=this.platform==="win32"?Nt.join(this.env.LOCALAPPDATA||"","nvs"):Nt.join(this.env.HOME||"",".nvs");Gp.existsSync(s)&&(o=s)}if(i.nvsFormat||o){if(r=await this.resolveNvs(o,i),!r&&i.nvsFormat)throw new q(BI(e,"nvs"));n.push("nvs")}if(!r)if(this.platform==="win32")this.env.NVM_HOME&&(r=await this.resolveWindowsNvm(e),n.push("nvm-windows"));else{let s=this.env.NVM_DIR||Nt.join(this.homedir,".nvm");await this.fsUtils.exists(s)&&(r=await this.resolveUnixNvm(e),n.push("nvm"))}if(!r){let s=this.platform==="win32"?this.env.FNM_DIR||Nt.join(this.env.APPDATA||"","fnm"):this.env.FNM_DIR||Nt.join(this.homedir,".fnm");await this.fsUtils.exists(s)&&(r=await this.resolveFnm(e,s),n.push("fnm"))}if(!n.length)throw new q(MI());if(!r||!await this.fsUtils.exists(r))throw new q(BI(e,n.join("/")));return{directory:r,binary:await this.getBinaryInFolder(r)}}async getBinaryInFolder(e){return await qi(["node64.exe","node64"].map(r=>this.fsUtils.exists(Nt.join(e,r))))?"node64":"node"}async resolveNvs(e,{remoteName:r,semanticVersion:n,arch:i}){if(!e)throw new q(lO());let o=this.findBinFolderForVersion(Nt.join(e,r),n,s=>Gp.existsSync(Nt.join(s,i)));if(o)return this.platform!=="win32"?Nt.join(o,i,"bin"):Nt.join(o,i)}async resolveUnixNvm(e){let r=this.env.NVM_DIR;if(!r){let i=Nt.join(this.env.HOME||"",".nvm");await this.fsUtils.exists(i)&&(r=i)}if(!r)throw new q(MI());let n=this.findBinFolderForVersion(Nt.join(r,"versions","node"),`v${e}`);return n?Nt.join(n,"bin"):void 0}async resolveWindowsNvm(e){let r=this.env.NVM_HOME;if(!r)throw new q(pO());return this.findBinFolderForVersion(r,`v${e}`)}async resolveFnm(e,r){let n=this.findBinFolderForVersion(Nt.join(r,"node-versions"),`v${e}`);if(n)return this.platform==="win32"?Nt.join(n,"installation"):Nt.join(n,"installation","bin")}findBinFolderForVersion(e,r,n){if(!Gp.existsSync(e))return;let i=Gp.readdirSync(e);if(i.includes(r))return Nt.join(e,r);let o=i.filter(s=>s.startsWith(`${r}.`)).sort(gue).filter(s=>n?n(Nt.join(e,s)):!0).pop();return o?Nt.join(e,o):void 0}parseVersionString(e){let n=/^(([\w-]+)\/)?(v?(\d+(\.\d+(\.\d+)?)?))(\/((x86)|(32)|((x)?64)|(arm\w*)|(ppc\w*)))?$/i.exec(e);if(!n)throw new Error("Invalid version string: "+e);let i=!!(n[2]||n[8]),o=n[2]||"node",s=n[4]||"",a=yue(n[8]||this.arch);return{nvsFormat:i,remoteName:o,semanticVersion:s,arch:a}}};Vp=I([(0,dS.injectable)(),g(0,(0,dS.inject)(br))],Vp);var gue=(t,e)=>{let r=/([0-9]+)\.([0-9]+)\.([0-9]+)/.exec(t),n=/([0-9]+)\.([0-9]+)\.([0-9]+)/.exec(e);if(!r||!n)return(n?-1:0)+(r?1:0);let[,i,o,s]=r,[,a,c,u]=n;return Number(i)-Number(a)||Number(o)-Number(c)||Number(s)-Number(u)};function yue(t){switch(t){case"32":case"x86":case"ia32":return"x86";case"64":case"x64":case"amd64":return"x64";case"arm":let e=process.config.variables.arm_version;return e?"armv"+e+"l":"arm";default:return t}}var kV=require("child_process"),mS=v(H());var zp=class{constructor(e){this.logger=e}canLaunch(e){return e.console==="internalConsole"}async launchProgram(e,r,n){let{executable:i,args:o,shell:s,cwd:a}=Jh(e,pS(r),r.cwd);n.dap.output({category:"console",output:[i,...o].join(" ")+`
`});let c=(0,kV.spawn)(i,o,{shell:s,cwd:a,env:Lt.merge(Lt.processEnv(),r.env).defined()});return r.outputCapture==="console"?this.discardStdio(n.dap,c):this.captureStdio(n.dap,c),new rS(c,this.logger,r.killBehavior)}captureStdio(e,r){r.stdout.pipe(new hS).on("data",n=>e.output({category:"stdout",output:n.toString()})).resume(),r.stderr.pipe(new hS).on("data",n=>e.output({category:"stderr",output:n.toString()})).resume()}discardStdio(e,r){let n=[],i=()=>{n&&e.output({category:"stderr",output:Buffer.concat(n).toString()})},o=Buffer.from("Debugger attached."),s=a=>{a.includes(o)?(n=void 0,r.stderr.removeListener("data",s)):n&&n.push(a)};r.stderr.on("data",s),r.on("error",a=>{i(),e.output({category:"stderr",output:a.stack||a.message})}),r.on("exit",a=>{a!==null&&a>0&&(i(),e.output({category:"stderr",output:`Process exited with code ${a}\r
`}))}),r.stdout.resume(),r.stderr.resume()}};zp=I([(0,mS.injectable)(),g(0,(0,mS.inject)(Y))],zp);var hS=class extends ma{constructor(){super(3);this.etxSpotted=!1;this.splitSuffix=Buffer.from(`
`)}_transform(r,n,i){return!this.etxSpotted&&r.includes(3)&&(this.etxSpotted=!0),this.etxSpotted?super._transform(r,n,i):(this.push(r),i())}};var gS=v(H());var Kp=class{constructor(e){this.logger=e}canLaunch(e){return e.internalConsoleOptions,e.console!=="internalConsole"}async launchProgram(e,r,n){let i={kind:r.console==="integratedTerminal"?"integrated":"external",title:r.name,cwd:r.cwd,args:[e,...pS(r)],env:_u(r.env),argsCanBeInterpretedByShell:!Array.isArray(r.args)},o;try{o=await this.sendLaunchRequest(i,n)}catch(s){throw new q(dO(s.message))}return new Bp(o,this.logger,r.killBehavior)}sendLaunchRequest(e,r){return r.dap.runInTerminalRequest(e)}};Kp=I([(0,gS.injectable)(),g(0,(0,gS.inject)(Y))],Kp);var RV=v(H());var Jp=class{getTreatment(e,r){return Promise.resolve(r)}};Jp=I([(0,RV.injectable)()],Jp);var AV=v(H());var su=class{constructor(){this.flushEmitter=new j;this.onFlush=this.flushEmitter.event}report(){}reportOperation(){}attachDap(){}flush(){this.flushEmitter.fire()}dispose(){}};su=I([(0,AV.injectable)()],su);var au=Symbol("ITerminalLinkProvider");var Ta=v(ge()),Pa=v(H());var Xp=class{constructor(e){this.session=e;this.messageEmitter=new j;this.endEmitter=new j;this.onMessage=this.messageEmitter.event;this.onEnd=this.endEmitter.event;e.onDidReceiveMessage(r=>{this.messageEmitter.fire([typeof r=="string"?r:JSON.stringify(r),new Vr])}),e.onDidClose(()=>{this.endEmitter.fire()})}send(e){let r=JSON.parse(e);this.session.sendMessage(r)}dispose(){this.session.close()}};var Yp=class{constructor(e,r,n){this.logger=e;this.pathResolver=r;this.vscode=n;this._onTerminatedEmitter=new j;this.onTerminated=this._onTerminatedEmitter.event;this._onTargetListChangedEmitter=new j;this.onTargetListChanged=this._onTargetListChangedEmitter.event}dispose(){this._targetManager&&(this._targetManager.dispose(),this._targetManager=void 0)}async launch(e,r){if(e.type!=="pwa-editor-browser"||e.request!=="attach")return{blockSessionTermination:!1};if(!this.vscode)throw new q($i("VS Code API is not available"));let n=this.vscode,{window:i}=n,o=i.browserTabs;if(!o)throw new q($i("The browser tab API is not available. Is the proposal enabled?"));let a=e.urlFilter;if(a){let p=jy(a),d=o.filter(f=>p(f.url));if(d.length===1)return this.attachToTab(d[0],e,r)}let c=()=>{let p=a?jy(a):void 0,d=i.activeBrowserTab,f=[];d&&(!p||p(d.url))&&(f.push({label:Ta.t("Active"),kind:n.QuickPickItemKind.Separator}),f.push({label:d.title,detail:d.url,iconPath:d.icon,tab:d}));let h=(i.browserTabs??[]).filter(m=>m!==d&&(!p||p(m.url)));if(h.length>0){f.push({label:Ta.t("Other"),kind:n.QuickPickItemKind.Separator});for(let m of h)f.push({label:m.title,detail:m.url,iconPath:m.icon,tab:m})}return f.push({label:"",kind:n.QuickPickItemKind.Separator}),f.push({label:Ta.t("Open new\u2026"),iconPath:new n.ThemeIcon("add"),openNew:!0}),f},u=await new Promise(p=>{let d=n.window.createQuickPick();d.placeholder=Ta.t("Select a browser tab to debug"),d.matchOnDetail=!0,d.items=c();let f=[],h=()=>{d.items=c()};i.onDidOpenBrowserTab&&f.push(i.onDidOpenBrowserTab(h)),i.onDidCloseBrowserTab&&f.push(i.onDidCloseBrowserTab(h)),i.onDidChangeActiveBrowserTab&&f.push(i.onDidChangeActiveBrowserTab(h)),i.onDidChangeBrowserTabState&&f.push(i.onDidChangeBrowserTabState(h)),f.push(d.onDidAccept(()=>{p(d.selectedItems[0]),d.dispose()})),f.push(d.onDidHide(()=>{p(void 0),d.dispose()})),f.push(d),f.push({dispose:()=>f.forEach(m=>m.dispose())}),d.show()});if(!u)return this._onTerminatedEmitter.fire({killed:!0,code:0}),{blockSessionTermination:!1};let l;if(u.openNew){let p=await n.window.showInputBox({prompt:Ta.t("Enter a URL to open"),placeHolder:"https://example.com",validateInput:d=>{try{new URL(d);return}catch{return Ta.t("Please enter a valid URL")}}});if(!p)return this._onTerminatedEmitter.fire({killed:!0,code:0}),{blockSessionTermination:!1};if(!i.openBrowserTab)throw new q($i("The browser tab API is not available."));l=await i.openBrowserTab(p)}else l=u.tab;return this.attachToTab(l,e,r)}async attachToTab(e,r,n){let i=await e.startCDPSession(),o=new Xp(i),s=new ut(o,this.logger,n.telemetryReporter);s.onDisconnected(()=>{this._targetManager?.dispose(),this._targetManager=void 0,this._onTargetListChangedEmitter.fire(),this._onTerminatedEmitter.fire({killed:!0,code:0})});let a=await qn.connect(s,void 0,this.pathResolver,r,this.logger,n.telemetryReporter,n.targetOrigin);if(!a)throw s.close(),new q($i(Ta.t("Could not connect to browser target")));return this._targetManager=a,a.onTargetAdded(()=>this._onTargetListChangedEmitter.fire()),a.onTargetRemoved(()=>{this._onTargetListChangedEmitter.fire(),a.targetList().length||(this._onTerminatedEmitter.fire({killed:!0,code:0}),s.close())}),await a.waitForMainTarget(Xi(c=>c.type==="page")),{blockSessionTermination:!0}}async terminate(){this._targetManager?.dispose(),this._targetManager=void 0}async restart(){}targetList(){return this._targetManager?.targetList()??[]}};Yp=I([(0,Pa.injectable)(),g(0,(0,Pa.inject)(Y)),g(1,(0,Pa.inject)(je)),g(2,(0,Pa.optional)()),g(2,(0,Pa.inject)(Dt))],Yp);var a0=v(ge()),Ea=v(H());var Qp=class{constructor(e,r,n){this.logger=e;this.pathResolver=r;this.vscode=n;this._onTerminatedEmitter=new j;this.onTerminated=this._onTerminatedEmitter.event;this._onTargetListChangedEmitter=new j;this.onTargetListChanged=this._onTargetListChangedEmitter.event}dispose(){this._targetManager&&(this._targetManager.dispose(),this._targetManager=void 0)}async launch(e,r){if(e.type!=="pwa-editor-browser"||e.request!=="launch")return{blockSessionTermination:!1};if(!this.vscode)throw new q(Cs(new Error("VS Code API is not available")));let{window:n}=this.vscode;if(!n.openBrowserTab)throw new q(Cs(new Error("The browser tab API is not available. Is the proposal enabled?")));let i=e,o=i.url;if(!o)throw new q(Cs(new Error(a0.t('A "url" is required to launch an integrated browser'))));let a=await(await n.openBrowserTab("")).startCDPSession(),c=new Xp(a),u=new ut(c,this.logger,r.telemetryReporter);u.onDisconnected(()=>{this._targetManager?.dispose(),this._targetManager=void 0,this._onTargetListChangedEmitter.fire(),this._onTerminatedEmitter.fire({killed:!0,code:0})});let l=await qn.connect(u,void 0,this.pathResolver,{...i,cleanUp:"wholeBrowser"},this.logger,r.telemetryReporter,r.targetOrigin);if(!l)throw u.close(),new q(Cs(new Error(a0.t("Could not connect to browser target"))));this._targetManager=l,l.onTargetAdded(()=>this._onTargetListChangedEmitter.fire()),l.onTargetRemoved(()=>{this._onTargetListChangedEmitter.fire(),l.targetList().length||(this._onTerminatedEmitter.fire({killed:!0,code:0}),u.close())});let p=await l.waitForMainTarget(Xi(d=>d.type==="page"));return p&&await p.cdp().Page.navigate({url:o}),{blockSessionTermination:!0}}async terminate(){this._targetManager?.dispose(),this._targetManager=void 0}async restart(){if(this._targetManager)for(let e of this._targetManager.targetList())e.type()==="page"&&e.restart()}targetList(){return this._targetManager?.targetList()??[]}};Qp=I([(0,Ea.injectable)(),g(0,(0,Ea.inject)(Y)),g(1,(0,Ea.inject)(je)),g(2,(0,Ea.optional)()),g(2,(0,Ea.inject)(Dt))],Qp);var DV=require("crypto"),zn=v(H()),OV=require("os"),LV=v(require("path")),Zp=v(require("vscode"));var bue=1e3,vue=1e3,c0=class{constructor(e){this.terminal=e;this.stopped=new Promise(r=>{let n=Zp.window.onDidCloseTerminal(i=>{i===e&&(r({code:0,killed:!0}),n.dispose())})})}gotTelemetery(){}stop(){return this.terminal.sendText(""),setTimeout(()=>this.terminal.dispose(),1),this.stopped}},ps=class extends Qr{constructor(r,n,i,o,s,a,c){super(r,n,s,o);this.fs=i;this.optionsProviders=a;this.terminalLinkProvider=c;this.terminalCreatedEmitter=new j;this.callbackFile=LV.join((0,OV.tmpdir)(),`node-debug-callback-${(0,DV.randomBytes)(8).toString("hex")}`);this.onTerminalCreated=this.terminalCreatedEmitter.event}async getProcessTelemetry(){try{return JSON.parse(await this.fs.readFile(this.callbackFile,"utf-8"))}catch{return}}resolveParams(r){if(r.type==="node-terminal"&&r.request==="launch")return r;if(r.type==="pwa-chrome"&&r.server&&"command"in r.server)return r.server}async launchProgram(r){let n;try{n=await this.resolveNodePath(r.params)}catch(c){if(c instanceof q&&c.cause.id===9230)throw c;n=new Zt("node",void 0)}let i=await this.resolveEnvironment(r,n,{fileCallback:this.callbackFile}),o={name:r.params.name,cwd:r.params.cwd,iconPath:new Zp.ThemeIcon("debug"),env:eS(n,i).defined(),isTransient:!0};for(let c of this.optionsProviders){let u=await c.provideTerminalOptions(o);u&&(o=u)}let s=await this.createTerminal(o);this.terminalLinkProvider?.enableHandlingInTerminal(s),this.terminalCreatedEmitter.fire(s),s.show();let a=this.program=new c0(s);r.params.command&&await this.writeCommand(s,r.params.command),a.stopped.then(c=>{a===this.program&&this.onProgramTerminated(c)})}async writeCommand(r,n){if(!r.shellIntegration){let i;await Promise.race([_e(bue),new Promise(o=>{i=Zp.window.onDidChangeTerminalShellIntegration(s=>{s.terminal===r&&s.shellIntegration&&o()})})]),i.dispose()}r.shellIntegration?r.shellIntegration.executeCommand(n):(await Promise.race([r.processId,_e(vue)]),r.sendText(n,!0))}createTerminal(r){return Promise.resolve(Zp.window.createTerminal(r))}dispose(){super.dispose(),this.fs.unlink(this.callbackFile).catch(()=>{})}};ps=I([(0,zn.injectable)(),g(0,(0,zn.inject)(Vn)),g(1,(0,zn.inject)(Y)),g(2,(0,zn.inject)(ve)),g(3,(0,zn.inject)(Lr)),g(4,(0,zn.inject)(nt)),g(5,(0,zn.inject)(Vo)),g(6,(0,zn.optional)()),g(6,(0,zn.inject)(au))],ps);var cu=v(H()),cm=v(YV());var nd=class{constructor(e,r){r&&e instanceof $r&&(this.service=(0,cm.getExperimentationService)("ms-vscode.js-debug",za,eg?cm.TargetPopulation.Insiders:cm.TargetPopulation.Public,{setSharedProperty(n,i){e.setGlobalMetric(n,i)},postEvent(n,i){e.pushOutput({category:"telemetry",output:n,data:i})}},r.globalState))}dispose(){this.service?.pollingService?.StopPolling()}async getTreatment(e,r){if(!this.service)return r;try{return await this.service.getTreatmentVariableAsync("vscode",e,!0)}catch{return r}}};nd=I([(0,cu.injectable)(),g(0,(0,cu.inject)(At)),g(1,(0,cu.optional)()),g(1,(0,cu.inject)(Ye))],nd);var ES=v(H()),ZV=v(require("vscode"));var QV=v(H()),lr=v(require("vscode"));var $e=class{constructor(){this._onSessionAddedEmitter=new lr.EventEmitter;this._onSessionEndedEmitter=new lr.EventEmitter;this._disposables=[];this.sessions=new Map;this.onSessionAdded=this._onSessionAddedEmitter.event;this.onSessionEnded=this._onSessionEndedEmitter.event}static isConcreteSession(e){return!!e.configuration.__pendingTargetId}static pickSession(e,r){if(e.length<2)return e[0];let n=lr.window.createQuickPick();return n.title=r,n.items=e.map(i=>({label:i.name,id:i.id})),n.ignoreFocusOut=!0,new Promise(i=>{n.onDidAccept(()=>i(e.find(o=>o.id===n.selectedItems[0]?.id))),n.onDidHide(()=>i(void 0)),n.show()}).finally(()=>n.dispose())}get isDebugging(){return this.sessions.size>0}getById(e){return this.sessions.get(e)}isRunning(e){return[...this.sessions.values()].includes(e)}getByName(e){return[...this.sessions.values()].filter(r=>r.name===e)}getConcreteSessions(){return[...this.sessions.values()].filter($e.isConcreteSession)}getChildren(e){return[...this.sessions.values()].filter(r=>r.configuration.__parentId===e.id)}attach(){lr.debug.onDidStartDebugSession(e=>{vs(e.type)&&(this.sessions.set(e.id,e),this._onSessionAddedEmitter.fire(e))},void 0,this._disposables),lr.debug.onDidTerminateDebugSession(e=>{vs(e.type)&&(this.sessions.delete(e.id),this._onSessionEndedEmitter.fire(e))},void 0,this._disposables),lr.debug.onDidReceiveDebugSessionCustomEvent(e=>{if(vs(e.session.type)){if(e.event==="revealLocationRequested"){let r=e.body,n=lr.debug.asDebugSourceUri(e.body.source),i={};if(r.line){let o=new lr.Position((r.line||1)-1,(r.column||1)-1);i.selection=new lr.Range(o,o)}lr.window.showTextDocument(n,i)}else if(e.event==="copyRequested"){let r=e.body;lr.env.clipboard.writeText(r.text)}}},void 0,this._disposables)}dispose(){for(let e of this._disposables)e.dispose();this._disposables=[]}};$e=I([(0,QV.injectable)()],$e);var id=class{constructor(e){this.tracker=e}register(e){e.subscriptions.push(this.tracker.onSessionEnded(r=>{let n=r.configuration.cascadeTerminateToConfigurations;if(!(!n||!(n instanceof Array)))for(let i of n)for(let o of this.tracker.getByName(i))ZV.debug.stopDebugging(o)}))}};id=I([(0,ES.injectable)(),g(0,(0,ES.inject)($e))],id);var kS=Symbol("IDebugConfigurationResolver"),RS=Symbol("IDebugConfigurationProvider");var k0=v(H());var ld=v(ge()),fs=v(H()),f5=require("os"),pd=require("path"),lm=v(require("vscode"));var e5=v(H()),t5=v(require("vscode"));var wi=class{get type(){return this.getType()}get triggerKind(){return this.getTriggerKind()}async provideDebugConfigurations(e,r){try{let n=await this.provide(e,r);if(!n)return[];let i=n instanceof Array?n:[n],o=nf.get(this.type);if(o)for(let s of i)s.type===this.type&&(s.type=o);return i}catch(n){return t5.window.showErrorMessage(n.message,{modal:!0}),[]}}};wi=I([(0,e5.injectable)()],wi);var LS=v(H()),i5=require("path"),ds=v(require("vscode"));var um=v(H()),I0=v(require("vscode"));var r5=v(require("vscode")),od=class{constructor(e){this.key=e}set value(e){e!==this._value&&(this._value=e,r5.commands.executeCommand("setContext",this.key,e))}get value(){return this._value}};var n5=Symbol("Uninitialized"),AS=class{constructor(e,r){this.key=e;this.defaultValue=r;this._value=n5}write(e,r){r!==this.read(e)&&(this._value=r,e.update(this.key,r))}read(e){return this._value===n5&&(this._value=e.get(this.key)??this.defaultValue),this._value}};var DS=new AS("sourceSteppingEnabled",!0),sd=class{constructor(e,r){this.context=e;this.tracker=r}register(e){let r=new od("jsDebugIsMapSteppingDisabled");DS.read(this.context.workspaceState)===!1&&(r.value=!0);let n=i=>{r.value=!i,DS.write(this.context.workspaceState,i);for(let o of this.tracker.getConcreteSessions())o.customRequest("setSourceMapStepping",{enabled:i})};e.subscriptions.push(be(I0.commands,"extension.js-debug.enableSourceMapStepping",()=>{n(!0)}),be(I0.commands,"extension.js-debug.disableSourceMapStepping",()=>{n(!1)}))}};sd=I([(0,um.injectable)(),g(0,(0,um.inject)(Ye)),g(1,(0,um.inject)($e))],sd);var Zr=class{constructor(e){this.extensionContext=e}get type(){return this.getType()}async resolveDebugConfiguration(e,r,n){if(r.type&&(r.type=this.getType()),"__pendingTargetId"in r)return r;let i=r;i.sourceMaps??=DS.read(this.extensionContext.workspaceState);try{let o=await this.resolveDebugConfigurationAsync(e,i,n);return o&&this.commonResolution(o,e)}catch(o){ds.window.showErrorMessage(o.message,{modal:!0})}}applyDefaultRuntimeExecutable(e){if(e.runtimeExecutable)return;let r=Xe(ds.workspace,"debug.javascript.defaultRuntimeExecutable"),n=r?r[e.type]:void 0;n&&(e.runtimeExecutable=n)}commonResolution(e,r){return e.trace=kI(e.trace,this.extensionContext.logPath),e.__workspaceCachePath=this.extensionContext.storagePath,e.__breakOnConditionalError=Xe(ds.workspace,"debug.javascript.breakOnConditionalError",r)??!1,r?e.__workspaceFolder=r.uri.fsPath:(e.__workspaceFolder||=this.getSuggestedWorkspaceFolders(e).filter(at).filter(n=>!n.includes("${workspaceFolder}")).map(n=>(0,i5.isAbsolute)(n)?ds.workspace.getWorkspaceFolder(ds.Uri.file(n))?.uri.fsPath:n).find(at)||ds.workspace.workspaceFolders?.[0]?.uri.fsPath||"",e.__workspaceFolder?e=hx(e):e=fx(e)),e}getSuggestedWorkspaceFolders(e){return[]}};Zr=I([(0,LS.injectable)(),g(0,(0,LS.inject)(Ye))],Zr);var Da=v(ge()),cd=require("fs"),ad=v(H()),gt=v(require("path")),vn=v(require("vscode"));var o5=v(require("vscode"));function NS(t){o5.debug.activeDebugConsole.appendLine(t)}var uu=v(ge()),s5=require("child_process"),a5=require("fs"),c5=require("path"),en=v(require("vscode"));var jue=9229;async function u5(){let t=await T0();if(!t)return;let e=Xe(en.workspace,"debug.javascript.pickAndAttachOptions"),r={...lx,...e,name:"process",processId:t};await C0(new nn(a5.promises),r,!0),await en.debug.startDebugging(r.cwd?en.workspace.getWorkspaceFolder(en.Uri.file(r.cwd)):void 0,r)}async function C0(t,e,r=!1){let n=e.processId?.trim(),i=n&&que(n);if(!i||isNaN(i.pid))throw new Error(uu.t("Attach to process: '{0}' doesn't look like a process id.",n||"<unknown>"));if(i.port||Vue(i.pid),e.port=i.port||jue,delete e.processId,r){let o=await Wue(t,i.pid);o&&(e.cwd=o)}}async function Wue(t,e){let r=e&&await sm.getWorkingDirectory(e);if(!r)return en.workspace.workspaceFolders?.[0].uri.fsPath;let n=await Ku(t,r,"package.json");if(!n)return r;let i=en.workspace.getWorkspaceFolder(en.Uri.file(r));return!i||ay(i.uri.fsPath,n)?n:i.uri.fsPath}async function T0(){try{let t=await $ue();return t?t.pidAndPort:null}catch(t){return await en.window.showErrorMessage(uu.t("Process picker failed ({0})",t.message),{modal:!0}),null}}var Hue=(t,e)=>`${t}:${e??""}`,que=t=>{let[e,r]=t.split(":");return{pid:Number(e),port:r?Number(r):void 0}};async function $ue(){let t=/^(?:node|iojs)(?:$|\b)/i,e=0,r=en.window.createQuickPick();r.placeholder=uu.t("Pick the node.js process to attach to"),r.matchOnDescription=!0,r.matchOnDetail=!0,r.busy=!0,r.show();let n=!1,i=new Promise(s=>{r.onDidAccept(()=>s(r.selectedItems[0])),r.onDidHide(()=>s(void 0))});sm.lookup((s,a)=>{if(n)return a;process.platform==="win32"&&s.command.indexOf("\\??\\")===0&&(s.command=s.command.replace("\\??\\",""));let c=(0,c5.basename)(s.command,".exe"),{port:u}=aS(s.args);if(!u&&!t.test(c))return a;let l={label:c,description:s.args,pidAndPort:Hue(s.pid,u),sortKey:s.date?s.date:e++,detail:u?uu.t("process id: {0}, debug port: {1} ({2})",s.pid,u,"SIGUSR1"):uu.t("process id: {0} ({1})",s.pid,"SIGUSR1")},p=a.findIndex(d=>d.sortKey<l.sortKey);return a.splice(p===-1?a.length:p,0,l),r.items=a,a},[]).then(()=>r.busy=!1).catch(s=>{en.window.showErrorMessage(`Error listing processes: ${s.message}`),r.dispose()});let o=await i;return n=!0,r.dispose(),o}function Vue(t){try{if(process.platform==="win32"){let e=`node -e process._debugProcess(${t})`;(0,s5.execSync)(e)}else process.kill(t,"SIGUSR1")}catch(e){throw new Error(uu.t("Attach to process: cannot enable debug mode for process '{0}' ({1}).",t,e))}}var Oa=class extends Zr{constructor(r,n,i){super(r);this.nvmResolver=n;this.fsUtils=i}async resolveDebugConfigurationWithSubstitutedVariables(r,n){let i=n;if(i.type==="pwa-node"&&i.request==="attach"&&typeof i.processId=="string"&&await C0(this.fsUtils,i),"port"in i&&typeof i.port=="string"&&(i.port=Number(i.port)),"attachSimplePort"in i&&typeof i.attachSimplePort=="string"&&(i.attachSimplePort=Number(i.attachSimplePort)),i.cwd){let o=await Er(cd.promises,i.cwd);if(!o){vn.window.showErrorMessage(Da.t("The configured `cwd` {0} does not exist.",i.cwd),{modal:!0});return}if(!o.isDirectory()){vn.window.showErrorMessage(Da.t("The configured `cwd` {0} is not a folder.",i.cwd),{modal:!0});return}}return i}async resolveDebugConfigurationAsync(r,n,i){if(!n.name&&!n.type&&!n.request&&(n=await E0(r,!0,n),n.request==="launch"&&!n.program)){vn.window.showErrorMessage(Da.t("Cannot find a program to debug"),{modal:!0});return}if(n.cwd||(n.cwd=n.localRoot||P0(n.request==="launch"?n.program:void 0,r)),n.remoteRoot&&!n.localRoot&&(n.localRoot="${workspaceFolder}"),n.request==="launch"){if(this.applyDefaultRuntimeExecutable(n),n.runtimeExecutable&&Nf(n.runtimeExecutable)==="deno"&&!n.attachSimplePort){let s=await qs();n.attachSimplePort=s,n.continueOnAttach??=!0;let a=[`--inspect-brk=127.0.0.1:${s}`];n.runtimeArgs?(!n.runtimeArgs.includes("--allow-all")&&!n.runtimeArgs.includes("-A")&&a.push("--allow-all"),n.runtimeArgs.includes("run")?n.runtimeArgs=[...n.runtimeArgs,...a]:n.runtimeArgs=["run",...a,...n.runtimeArgs]):(a.push("--allow-all"),n.runtimeArgs=["run",...a])}let o=n.runtimeVersion;if(typeof o=="string"&&o!=="default"){let{directory:s,binary:a}=await this.nvmResolver.resolveNvmVersionPath(o);n.env=new Lt(n.env).addToPath(s,"prepend",!0).value,n.runtimeExecutable=!n.runtimeExecutable||n.runtimeExecutable==="node"?a:n.runtimeExecutable}if(n.console==="integratedTerminal"&&!n.internalConsoleOptions&&(n.internalConsoleOptions="neverOpen"),n.attachSimplePort===null||n.attachSimplePort===void 0)uS(n);else{if(n.attachSimplePort===0){n.attachSimplePort=await qs(void 0,i);let s=`--inspect-brk=${n.attachSimplePort}`;n.runtimeArgs=n.runtimeArgs?[...n.runtimeArgs,s]:[s]}n.continueOnAttach=!n.stopOnEntry,n.stopOnEntry=!1}await Gue(this.fsUtils,r,n)}return px(n)}getType(){return"pwa-node"}getSuggestedWorkspaceFolders(r){return[r.rootPath,r.cwd]}};Oa=I([(0,ad.injectable)(),g(0,(0,ad.inject)(Ye)),g(1,(0,ad.inject)(fS)),g(2,(0,ad.inject)(br))],Oa);function P0(t,e){if(e)return e.uri.fsPath;if(vn.workspace.workspaceFolders&&vn.workspace.workspaceFolders.length>0)return vn.workspace.workspaceFolders[0].uri.fsPath;if(t){if(t==="${file}")return"${fileDirname}";if(gt.isAbsolute(t))return gt.dirname(t)}return"${workspaceFolder}"}function l5(t,e){if(t&&(e=Ii(e,"workspaceFolder",t.uri.fsPath)),vn.workspace.workspaceFolders?.length&&(e=Ii(e,"workspaceRoot",vn.workspace.workspaceFolders[0].uri.fsPath)),gt.isAbsolute(e))return e;if(t)return gt.join(t.uri.fsPath,e)}async function Gue(t,e,r){if(r.outFiles||!e)return;let n;if(r.program?(n=l5(e,r.program),n&&(n=gt.dirname(n))):r.cwd&&(n=l5(e,r.cwd)),!n||Fu(e.uri.fsPath,n))return;let i=await oc(n,async o=>!o.includes("node_modules")&&await t.exists(gt.join(o,"package.json"))?o:void 0);if(i){let o=ze(gt.relative(e.uri.fsPath,i));o.length&&(r.outFiles=[...of.outFiles,`\${workspaceFolder}/${o}/**/*.js`,`!\${workspaceFolder}/${o}/**/node_modules/**`])}}var zue=["index.js","main.js"];async function E0(t,e,r){let n={type:"pwa-node",request:"launch",name:Da.t("Launch Program"),skipFiles:[`${ii}/**`]};r&&r.noDebug&&(n.noDebug=!0);let i=await p5(t,"package.json"),o,s=!1;if(i&&i.name==="mern-starter")return e&&NS(Da.t("Launch configuration for '{0}' project created.","Mern Starter")),Jue(n),n;if(i&&(o=await Yue(t,i,e),o&&e&&NS(Da.t("Launch configuration created based on 'package.json'."))),!o){let a=vn.window.activeTextEditor;a&&Qm.includes(a.document.languageId)&&(s=a.document.languageId!=="javascript",o=t?gt.relative(t.uri.fsPath,a.document.uri.fsPath):a.document.uri.fsPath,gt.isAbsolute(o)||(o="${workspaceFolder}"+gt.sep+o))}if(!o&&t){let a=t.uri.fsPath;o=await qi(zue.map(async c=>await Er(cd.promises,gt.join(a,c))&&"${workspaceFolder}"+gt.sep+c))}if(o||(o="${file}"),o&&(n.program=o,t||(n.__workspaceFolder=gt.dirname(o))),s||vn.workspace.textDocuments.some(a=>Xue(a.languageId))){e&&NS(Da.t("Adjust glob pattern(s) in the 'outFiles' attribute so that they cover the generated JavaScript."));let a="",c=await p5(t,"tsconfig.json");if(c?.compilerOptions?.outDir&&Kue()){let u=c.compilerOptions.outDir;gt.isAbsolute(u)||(a=u,a.indexOf("./")===0&&(a=a.substr(2)),a[a.length-1]!=="/"&&(a+="/")),n.preLaunchTask="tsc: build - tsconfig.json"}n.outFiles=["${workspaceFolder}/"+a+"**/*.js"]}return n}function Kue(){let t=vn.workspace.getConfiguration().get("typescript.tsc.autoDetect");return t!=="off"&&t!=="watch"}function Jue(t){t.request==="launch"&&(t.runtimeExecutable="nodemon",t.program="${workspaceFolder}/index.js",t.restart=!0,t.env={BABEL_DISABLE_CACHE:"1",NODE_ENV:"development"},t.console="integratedTerminal",t.internalConsoleOptions="neverOpen")}function Xue(t){return t==="typescript"||t==="coffeescript"}async function p5(t,e){if(t)try{let r=await cd.promises.readFile(gt.join(t.uri.fsPath,e),"utf8");return JSON.parse(r)}catch{}}async function Yue(t,e,r){let n;try{if(e.main?n=e.main:e.scripts&&typeof e.scripts.start=="string"&&(n=e.scripts.start.split(" ").pop()),n){let i;if(gt.isAbsolute(n)?i=n:(i=t?gt.join(t.uri.fsPath,n):void 0,n=gt.join("${workspaceFolder}",n)),r&&i&&!await Er(cd.promises,i)&&!await Er(cd.promises,i+".js"))return}}catch{}return n}var d5=v(require("vscode"));var ud=class extends Zr{async resolveDebugConfigurationAsync(e,r){if(r.cwd||(r.cwd=P0(void 0,e)),r.request==="launch"&&!r.command){await Vm(d5.commands,"extension.js-debug.createDebuggerTerminal",void 0,e);return}return r.remoteRoot&&!r.localRoot&&(r.localRoot="${workspaceFolder}"),dx(r)}getType(){return"node-terminal"}};var Que=t=>t.request==="launch",Zue=t=>t.request==="attach",La=class extends Zr{constructor(r,n,i,o,s){super(r);this.nodeProvider=n;this.terminalProvider=i;this.location=o;this.fs=s}async resolveBrowserCommon(r,n){if(n.request,n.server&&"program"in n.server){let o={...n.server,type:"pwa-node",request:"launch",name:`${n.name}: Server`};n.server=await this.nodeProvider.resolveDebugConfiguration(r,o)}else n.server&&"command"in n.server&&(n.server=await this.terminalProvider.resolveDebugConfiguration(r,{...n.server,type:"node-terminal",request:"launch",name:`${n.name}: Server`}));let i=this.location==="remote"?"ui":"workspace";if(Que(n)&&!n.browserLaunchLocation&&(n.browserLaunchLocation=i),Zue(n)&&!n.browserAttachLocation&&(n.browserAttachLocation=i),n.request==="launch"){let o=n;this.applyDefaultRuntimeExecutable(o)}}getSuggestedWorkspaceFolders(r){return[r.rootPath,r.webRoot]}async resolveDebugConfigurationWithSubstitutedVariables(r,n){if("__pendingTargetId"in n)return n;let i=n;if("port"in i&&typeof i.port=="string"&&(i.port=Number(i.port)),i.request==="launch"){let o=await this.ensureNoLockfile(i);if(o===void 0)return;i=o}return i}async ensureNoLockfile(r){if(r.request!=="launch")return r;let n=r;if(n.userDataDir===!1||n.port&&!await kB(n.port))return r;let i=typeof n.userDataDir=="string"?n.userDataDir:(0,pd.join)(this.extensionContext.storagePath??(0,f5.tmpdir)(),n.runtimeArgs?.includes("--headless")?".headless-profile":".profile"),o=(0,pd.join)(i,process.platform==="win32"?"lockfile":"SingletonLock");if(await qi([x1(this.fs,o),this.isVsCodeLocked((0,pd.join)(i,"code.lock"))])){let a=ld.t("Debug Anyway");if(await lm.window.showErrorMessage(ld.t("It looks like a browser is already running from {0}. Please close it before trying to debug, otherwise VS Code may not be able to connect to it.",n.userDataDir===!0?ld.t("an old debug session"):ld.t("the configured userDataDir")),{modal:!0},a)!==a)return}return{...r,userDataDir:i}}async isVsCodeLocked(r){try{let n=Number(await this.fs.readFile(r,"utf-8"));return process.kill(n,0),!0}catch{return!1}}};La=I([(0,fs.injectable)(),g(0,(0,fs.inject)(Ye)),g(1,(0,fs.inject)(Oa)),g(2,(0,fs.inject)(ud)),g(3,(0,fs.inject)(ui)),g(4,(0,fs.inject)(ve))],La);var Na=class extends wi{provide(){return this.createLaunchConfigFromContext()||this.getDefaultLaunch()}getTriggerKind(){return lm.DebugConfigurationProviderTriggerKind.Initial}createLaunchConfigFromContext(){let e=lm.window.activeTextEditor;if(e&&e.document.languageId==="html")return{type:this.getType(),request:"launch",name:`Open ${(0,pd.basename)(e.document.uri.fsPath)}`,file:e.document.uri.fsPath}}getDefaultLaunch(){return{type:this.getType(),request:"launch",name:ld.t("Launch Chrome against localhost"),url:"http://localhost:8080",webRoot:"${workspaceFolder}"}}};Na=I([(0,fs.injectable)()],Na);var dd=class extends La{async resolveDebugConfigurationAsync(e,r){if(!r.name&&!r.type&&!r.request){let n=new lu().createLaunchConfigFromContext();if(!n)return null;r=n}return await this.resolveBrowserCommon(e,r),r.request==="attach"?{...cf,...r}:{...Jm,...r}}getType(){return"pwa-chrome"}};dd=I([(0,k0.injectable)()],dd);var lu=class extends Na{getType(){return"pwa-chrome"}};lu=I([(0,k0.injectable)()],lu);var h5=v(ge()),R0=v(H());var fd=class extends La{async resolveDebugConfigurationAsync(e,r){if(!r.name&&!r.type&&!r.request){let n=new pu().createLaunchConfigFromContext();if(!n)return;r=n}return await this.resolveBrowserCommon(e,r),r.useWebView&&(r.timeout=r.timeout??0),r.request==="attach"?{...sx,...r}:{...ax,...r}}getType(){return"pwa-msedge"}};fd=I([(0,R0.injectable)()],fd);var pu=class extends Na{getType(){return"pwa-msedge"}getDefaultLaunch(){return{...super.getDefaultLaunch(),name:h5.t("Launch Edge against localhost")}}};pu=I([(0,R0.injectable)()],pu);var m5=v(ge()),A0=v(H()),g5=require("path"),hs=v(require("vscode"));var hd=class extends Zr{async resolveDebugConfigurationAsync(e,r){return hs.env.uiKind===hs.UIKind.Web?(hs.window.showErrorMessage("Integrated Browser debugging is only available on VS Code Desktop."),null):!r.name&&!r.type&&!r.request?null:r.request==="attach"?{...cx,...r}:{...ux,...r}}getType(){return"pwa-editor-browser"}getSuggestedWorkspaceFolders(e){return[e.rootPath,e.webRoot]}};hd=I([(0,A0.injectable)()],hd);var md=class extends wi{getType(){return"pwa-editor-browser"}getTriggerKind(){return hs.DebugConfigurationProviderTriggerKind.Initial}provide(){return this.createLaunchConfigFromContext()||this.getDefaultLaunch()}createLaunchConfigFromContext(){let e=hs.window.activeTextEditor;if(e&&e.document.languageId==="html")return{type:this.getType(),request:"launch",name:`Open ${(0,g5.basename)(e.document.uri.fsPath)}`,url:e.document.uri.toString()}}getDefaultLaunch(){return{type:this.getType(),request:"launch",name:m5.t("Launch Integrated Browser against localhost"),url:"http://localhost:8080",webRoot:"${workspaceFolder}"}}};md=I([(0,A0.injectable)()],md);var MS=v(ge()),y5=v(Ig()),D0=require("fs"),b5=v(H()),tr=v(require("path")),v5=v(require("vscode"));var ele=["workspace"],gd=class extends Zr{async resolveDebugConfigurationAsync(e,r){let n=new xp(r.args),i=await nle(e,r,n);if(r.debugWebWorkerHost===void 0){let o=i?.value.extensionKind??ele;r={...r,debugWebWorkerHost:o.length===1&&o[0]==="web"}}if(r.debugWebWorkerHost&&(r.outFiles=[],r.resolveSourceMapLocations=af.resolveSourceMapLocations),!r.outFiles&&i&&e){let o=await tle(e,i);o&&(r.outFiles=o,r.resolveSourceMapLocations??=af.resolveSourceMapLocations)}return Ym(r),Promise.resolve({...af,...r})}async resolveDebugConfigurationWithSubstitutedVariables(e,r){let n=r;try{let i=await ile(n);i&&(n.env={...n.env,...i.env},n.args=[...n.args||[],...i.config.launchArgs||[],`--extensionDevelopmentPath=${i.extensionDevelopmentPath}`,`--extensionTestsPath=${i.extensionTestsPath}`])}catch(i){if(i instanceof ln)return;throw i}return n}getType(){return"pwa-extensionHost"}};gd=I([(0,b5.injectable)()],gd);var tle=async(t,e)=>{if(!e.value.main)return;let r=tr.resolve(tr.dirname(e.path),e.value.main),n=tr.relative(t.uri.fsPath,tr.dirname(e.path)),o=tr.relative(tr.dirname(e.path),r).split(tr.sep)[0];return[tr.join("${workspaceFolder}",n,o,"**/*.js").replaceAll("\\","/")]},rle="--extensionDevelopmentPath",nle=async(t,e,r)=>{let n=r.get(rle);if(!n)return;let i=Ii(n,"workspaceFolder",t?.uri.fsPath??e.__workspaceFolder??"");try{let o=tr.join(i,"package.json"),s=await D0.promises.readFile(o,"utf-8");return{value:JSON.parse(s),path:o}}catch{return}},ile=async t=>{let{testConfiguration:e}=t,{testConfigurationLabel:r}=t;if(!e)return;let n=tr.join("node_modules","@vscode","test-cli","out","bin.mjs"),i=await oc(e,async c=>{let u=tr.join(c,n);return await Mo(D0.promises,u)?c:void 0});if(!i)throw new Error(MS.t("Cannot find `{0}` installed in {1}","@vscode/test-cli",tr.dirname(e)));let o=await(0,y5.default)(process.execPath,[tr.join(i,n),"--config",e,"--list-configuration"],{env:{...process.env,ELECTRON_RUN_AS_NODE:"1"}}),s=JSON.parse(o.stdout);if(s.length===1)return s[0];if(s.length&&!r&&(r=await v5.window.showQuickPick(s.map((c,u)=>c.config.label||String(u)),{title:MS.t("Select test configuration to run")}),!r))throw new ln("cancelled");let a=s.find((c,u)=>c.config.label===r||String(u)===r);if(!a)throw new Error(MS.t("Cannot find test configuration with label `{0}`, got: {1}",String(r),s.map((c,u)=>c.config.label||u).join(", ")));return a};var pm=v(ge()),B0=v(H()),Ma=v(require("path")),dm=v(require("vscode"));var yd=v(ge()),_5=v(require("fs")),BS=v(require("path")),Je=v(require("vscode"));var O0=require("vscode"),L0=async t=>{try{return await O0.commands.executeCommand("npm.scriptRunner",t?.uri)}catch{try{return await O0.commands.executeCommand("npm.packageManager",t?.uri)}catch{return"npm"}}},w5=async(t,e)=>{let r=await L0(e);return`${r} ${r==="node"?"--run":"run"} ${t}`};async function x5(t){let e=await M0(t?[t]:void 0);if(!e)return;let r=async a=>{let c=Je.workspace.getWorkspaceFolder(Je.Uri.file(a.directory));Vm(Je.commands,"extension.js-debug.createDebuggerTerminal",await w5(a.name,c),c,{cwd:a.directory})};if(e.length===1)return r(e[0]);let n=e.some(a=>a.directory!==e[0].directory),i=Je.window.createQuickPick(),o,s=[];for(let a of e)a.directory!==o&&n&&(s.push({label:BS.basename(a.directory),kind:Je.QuickPickItemKind.Separator}),o=a.directory),s.push({script:a,label:a.name,description:a.command});i.items=s,i.onDidAccept(async()=>{r(i.selectedItems[0].script),i.dispose()}),i.show()}var N0=(t,e)=>t.score>e.score?t:e;async function M0(t,e=!1){let r=t??Je.workspace.workspaceFolders??[];if(!r||r.length===0){e||Je.window.showErrorMessage(yd.t("You need to open a workspace folder to debug npm scripts."));return}let n=(await Promise.all(r.map(s=>Je.workspace.findFiles(new Je.RelativePattern(s,"**/package.json"),"**/{node_modules,.vscode-test}/**")))).flat();if(n.length===0){e||Je.window.showErrorMessage(yd.t("No package.json files found in your workspace."));return}let i=[],o={path:n[0].fsPath,score:0};for(let{fsPath:s}of new Set(n)){o=N0(o,{path:s,score:1});let a;try{a=JSON.parse(await iy(s))}catch(c){e||S5("showWarningMessage",yd.t("Could not read {0}: {1}",s,c.message),s),o=N0(o,{path:void 0,score:3});continue}if(o=N0(o,{path:void 0,score:2}),!!a.scripts)for(let c of Object.keys(a.scripts))i.push({directory:BS.dirname(s),name:c,command:a.scripts[c]})}if(i.length===0){o.path&&!e&&S5("showErrorMessage",yd.t("No npm scripts found in your package.json"),o.path);return}return i.sort((s,a)=>(s.name==="start"?-1:0)+(a.name==="start"?1:0)),i}var ole=`{
  "scripts": {
    
  }
}
`;async function S5(t,e,r){let n=yd.t("Edit package.json");if(await Je.window[t](e,n)!==n)return;if(_5.existsSync(r)){let a=await Je.workspace.openTextDocument(r);await Je.window.showTextDocument(a);return}let i=await Je.workspace.openTextDocument(Je.Uri.file(r).with({scheme:"untitled"})),o=await Je.window.showTextDocument(i);await o.edit(a=>a.insert(new Je.Position(0,0),ole));let s=new Je.Position(2,5);o.selection=new Je.Selection(s,s)}var bd=class extends wi{provide(e){return E0(e,!0)}getType(){return"pwa-node"}getTriggerKind(){return dm.DebugConfigurationProviderTriggerKind.Initial}};bd=I([(0,B0.injectable)()],bd);var sle=["cwd","program"],vd=class extends wi{async provide(e){let r=Ao(await Promise.all([this.getFromNpmScripts(e),this.getFromActiveFile()]));if(e)for(let n of r){let i=n;for(let o of sle){let s=i[o];s&&Ma.isAbsolute(s)&&(i[o]=Ma.join("${workspaceFolder}",Ma.relative(e.uri.fsPath,s)))}}return r}getType(){return"pwa-node"}getTriggerKind(){return dm.DebugConfigurationProviderTriggerKind.Dynamic}async getFromNpmScripts(e){let r={type:bs("node-terminal"),name:pm.t("JavaScript Debug Terminal"),request:"launch",cwd:e?.uri.fsPath};if(!e)return[r];let n=await M0([e],!0);if(!n)return[r];let i=await L0(e),o=n.some(s=>s.directory!==n[0].directory);return n.map(s=>({type:bs("node-terminal"),name:o?pm.t("Run Script: {0} ({1})",s.name,Ma.basename(s.directory)):pm.t("Run Script: {0}",s.name),request:"launch",command:`${i} run ${s.name}`,cwd:s.directory})).concat(r)}getFromActiveFile(){let e=dm.window.activeTextEditor;return!e||!Qm.includes(e.document.languageId)||e.document.uri.scheme!=="file"?[]:[{type:bs("pwa-node"),name:pm.t("Run Current File"),request:"launch",program:e.document.uri.fsPath}]}};vd=I([(0,B0.injectable)()],vd);var I5=[dd,fd,hd,gd,Oa,ud],C5=[lu,pu,md,bd,vd];var wd=v(ge()),E5=v(require("dns/promises")),fm=v(H()),FS=require("url"),tn=v(require("vscode"));async function T5(t,e=1e3){return Promise.race([E5.lookup(t),_e(e)])}async function P5(t,e){if(t){try{let r=new FS.URL(t);if(r.hostname)return await T5(r.hostname),t}catch{}try{let r=`http://${t}`,n=new FS.URL(r);if(await T5(n.hostname),!e||n.port)return r}catch{}}}var Sd=class{constructor(e,r){this.defaultBrowser=e;this.context=r}register(e){e.subscriptions.push(tn.commands.registerCommand("extension.js-debug.debugLink",r=>this.handle(r)))}async handle(e){if(e=e??await this.getLinkFromTextEditor()??await this.getLinkFromQuickInput(),!e)return;let r="pwa-chrome";try{await this.defaultBrowser.lookup()==="edge"&&(r="pwa-msedge")}catch{}let n=Xe(tn.workspace,"debug.javascript.debugByLinkOptions")??{},i={...typeof n=="string"?{}:n,type:bs(r),name:e,request:"launch",url:e};tn.debug.startDebugging(tn.workspace.workspaceFolders?.[0],i),this.persistConfig(i)}getLinkFromTextEditor(){let e=tn.window.activeTextEditor;if(e)return P5(e.document.getText(e.selection),!0)}async getLinkFromQuickInput(){let e=await tn.env.clipboard.readText(),r=await tn.window.showInputBox({value:await P5(e,!1)||this.mostRecentLink,placeHolder:"https://localhost:8080",validateInput:n=>{if(n&&!FS.URL.canParse(n))return wd.t("The URL provided is invalid")}});if(r)return this.mostRecentLink=r,r}async persistConfig(e){if(this.context.globalState.get("saveDebugLinks")===!1)return;let r=tn.workspace.getConfiguration("launch"),n=r.get("configurations")??[];if(n.some(a=>a.url===e.url))return;let i=wd.t("Yes"),o=wd.t("Never"),s=await tn.window.showInformationMessage(wd.t("Would you like to save a configuration in your launch.json for easy access later?"),i,wd.t("No"),o);s===o&&this.context.globalState.update("saveDebugLinks",!1),s===i&&await r.update("configurations",[...n,e])}};Sd=I([(0,fm.injectable)(),g(0,(0,fm.inject)(mp)),g(1,(0,fm.inject)(Ye))],Sd);var _d=v(ge()),Id=v(H()),wn=v(require("vscode"));var k5="neverRemind",xd=class{constructor(e,r,n){this.fs=e;this.context=r;this.tracker=n;this.dismissedForSession=!1;this.isPrompting=!1}register(e){e.subscriptions.push(be(wn.commands,"extension.js-debug.getDiagnosticLogs",async()=>{let r=await this.getTargetSession();if(!r)return;let n=await wn.window.showSaveDialog({filters:{JSON:["json"]}});n&&r.customRequest("saveDiagnosticLogs",{toFile:n.fsPath})}),be(wn.commands,"extension.js-debug.createDiagnostics",async()=>this.getDiagnosticInfo(await this.getTargetSession())),wn.debug.onDidReceiveDebugSessionCustomEvent(async r=>{if(r.event==="openDiagnosticTool")return this.openDiagnosticTool(r.body.file);if(r.event!=="suggestDiagnosticTool"||this.dismissedForSession||this.context.workspaceState.get(k5)||this.isPrompting)return;this.isPrompting=!0;let n=_d.t("Yes"),i=_d.t("Not Now"),o=_d.t("Never"),s=await wn.window.showInformationMessage("It looks like you might be having trouble with breakpoints. Would you like to open our diagnostic tool?",n,i,o);switch(this.isPrompting=!1,s){case n:this.getDiagnosticInfo(await this.getTargetSession(),!0);break;case o:e.workspaceState.update(k5,!0);break;case i:this.dismissedForSession=!0;break}}))}getTargetSession(){let e=wn.debug.activeDebugSession;if(!e||!vs(e?.type))return this.pickSession();if($e.isConcreteSession(e))return e;let r=this.tracker.getChildren(e);return r.length===1?r[0]:this.pickSession()}pickSession(){return $e.pickSession(this.tracker.getConcreteSessions(),_d.t("Select the session you want to inspect:"))}async getDiagnosticInfo(e,r=!1){if(!e||!this.tracker.isRunning(e)){wn.window.showErrorMessage(_d.t('It looks like your debug session has already ended. Try debugging again, then run the "Debug: Diagnose Breakpoint Problems" command.'));return}let{file:n}=await e.customRequest("createDiagnostics",{fromSuggestion:r});await this.openDiagnosticTool(n)}async openDiagnosticTool(e){let r=wn.window.createWebviewPanel("jsDebugDiagnostics","Debug Diagnostics",wn.ViewColumn.Active,{enableScripts:!0});r.webview.html=await this.fs.readFile(e,"utf-8")}};xd=I([(0,Id.injectable)(),g(0,(0,Id.inject)(ve)),g(1,(0,Id.inject)(Ye)),g(2,(0,Id.inject)($e))],xd);var Cd=v(ge()),R5=v(H()),Kn=v(require("vscode"));var du=class{register(e){e.subscriptions.push(Kn.debug.onDidReceiveDebugSessionCustomEvent(r=>{if(r.event!=="suggestDisableSourcemap"||!vs(r.session.type))return;let n=r.body;this.unmap(r.session,n.source).catch(i=>Kn.window.showErrorMessage(i.message))}))}async unmap(e,r){(Xe(Kn.workspace,"debug.javascript.unmapMissingSources")||await this.prompt())&&await e.customRequest("disableSourcemap",{source:r})}async prompt(){let e=Cd.t("Always"),r=Cd.t("Always in this Workspace"),n=Cd.t("Yes");switch(await Kn.window.showInformationMessage(Cd.t("This is a missing file path referenced by a sourcemap. Would you like to debug the compiled version instead?"),e,r,Cd.t("No"),n)){case e:return ix(Kn.workspace,"debug.javascript.unmapMissingSources",!0,Kn.ConfigurationTarget.Global),!0;case r:return ix(Kn.workspace,"debug.javascript.unmapMissingSources",!0,Kn.ConfigurationTarget.Workspace),!0;case n:return!0;default:return!1}}};du=I([(0,R5.injectable)()],du);var fu=v(ge()),US=v(H()),Si=v(require("vscode"));var A5="ms-vscode.wasm-dwarf-debugging",D5="dwarf.neverRemind",Td=class{constructor(e){this.context=e;this.didPromptForSession=this.context.workspaceState.get(D5,!1)}async load(){try{return await import("@vscode/dwarf-debugging")}catch{}let e=Si.extensions.getExtension(A5);if(e)return e.isActive||await e.activate(),e.exports}async prompt(){if(this.didPromptForSession)return;this.didPromptForSession=!0;let e=fu.t("Yes"),r=fu.t("Never"),n=await Si.window.showInformationMessage(fu.t({message:'VS Code can provide better debugging experience for WebAssembly via "DWARF Debugging" extension. Would you like to install it?',comment:'"DWARF Debugging" is the extension name and should not be localized.'}),e,fu.t("Not Now"),r);n===e?this.install():n===r&&this.context.workspaceState.update(D5,!0)}async install(){await Si.window.withProgress({location:Si.ProgressLocation.Notification,title:fu.t("Installing the DWARF debugger...")},async()=>{try{await Si.commands.executeCommand("workbench.extensions.installExtension",A5),Si.window.showInformationMessage(fu.t("Installation complete! The extension will be used after you restart your debug session."))}catch(e){Si.window.showErrorMessage(e.message||String(e))}})}};Td=I([(0,US.injectable)(),g(0,(0,US.inject)(Ye))],Td);var L5=v(ge()),jS=v(H()),Ba=v(require("vscode"));var O5=t=>{if(t?.type!=="pwa-msedge")return!1;let e=t.configuration.__browserTargetType;return e==="iframe"||e==="page"},cle="ms-edgedevtools.vscode-edge-devtools",ule="vscode-edge-devtools.attachToCurrentDebugTarget";function lle(t){let e=t;for(;e.parentSession;)e=e.parentSession;return e}var Pd=class{constructor(e){this.tracker=e}register(e){e.subscriptions.push(be(Ba.commands,"extension.js-debug.openEdgeDevTools",async()=>{let r=Ba.debug.activeDebugSession&&O5(Ba.debug.activeDebugSession)?Ba.debug.activeDebugSession:await $e.pickSession(this.tracker.getConcreteSessions().filter(O5),L5.t("Select the page where you want to open the devtools"));if(!r)return;let n=lle(r);try{return await Ba.commands.executeCommand(ule,r.id,n.configuration)}catch(i){if(i instanceof Error&&/command .+ not found/.test(i.message))return Ba.commands.executeCommand("workbench.extensions.action.showExtensionsWithIds",[cle]);throw i}}))}};Pd=I([(0,jS.injectable)(),g(0,(0,jS.inject)($e))],Pd);var U5=require("crypto"),WS=v(H()),j5=require("path"),Ze=v(require("vscode"));var N5=({name:t,line:e,column:r,source:n})=>`${t} (${(0,j5.basename)(String(n.path))}:${e}:${r})`,M5=({name:t,line:e,column:r,source:n})=>`${t} (${n.path}:${e}:${r})`,B5=async({line:t,column:e,source:r})=>{if(r.sourceReference!==0||!r.path)return;let n=Ze.Uri.file(r.path),i=await Ze.workspace.openTextDocument(n),o=await Ze.window.showTextDocument(i),s=new Ze.Position(t-1,e-1);o.revealRange(new Ze.Range(s,s)),o.selection=new Ze.Selection(s,s)},F0=class{constructor(e,r){this.caller=e;this.target=r;this.treeItem=new Ze.TreeItem(`${N5(e)} \u2192 ${N5(r)}`,Ze.TreeItemCollapsibleState.None),this.treeItem.tooltip=`Breaks at ${M5(r)} containing ${M5(e)} will be skipped`,this.id=this.treeItem.id=(0,U5.createHash)("sha256").update(JSON.stringify([e,r])).digest("base64")}toDap(){return{caller:this.caller,target:this.target}}},Ed=class{constructor(e){this.sessionTracker=e;this._onDidChangeTreeData=new Ze.EventEmitter;this.allCallers=new Map;this.lastHadCallers=!1;this.onDidChangeTreeData=this._onDidChangeTreeData.event}register(e){e.subscriptions.push(Ze.window.createTreeView("jsExcludedCallers",{treeDataProvider:this}),be(Ze.commands,"extension.js-debug.callers.add",async(r,n)=>{let i=await this.sessionTracker.getById(n.sessionId)?.customRequest("stackTrace",{threadId:0,startFrame:0,levels:1});if(!i?.stackFrames.length)return;let o=i.stackFrames[0],s=new F0({name:n.frameName,column:n.frameLocation.range.startColumn,line:n.frameLocation.range.startLineNumber,source:n.frameLocation.source},{name:o.name,column:o.column,line:o.line,source:o.source});this.allCallers.set(s.id,s),this.triggerUpdate()}),be(Ze.commands,"extension.js-debug.callers.goToCaller",r=>B5(r.caller)),be(Ze.commands,"extension.js-debug.callers.gotToTarget",r=>B5(r.target)),be(Ze.commands,"extension.js-debug.callers.remove",async r=>{this.allCallers.delete(r.id),this.triggerUpdate()}),be(Ze.commands,"extension.js-debug.callers.removeAll",()=>{this.allCallers.clear(),this.triggerUpdate()}),this.sessionTracker.onSessionAdded(r=>{this.allCallers.size>0&&this.sendCallersToSession(r)}))}getTreeItem(e){return e.treeItem}getChildren(e){return e?[]:[...this.allCallers.values()]}sendCallersToSession(e){e.customRequest("setExcludedCallers",{callers:[...this.allCallers.values()].map(r=>r.toDap())})}triggerUpdate(){this._onDidChangeTreeData.fire(void 0);for(let r of this.sessionTracker.getConcreteSessions())this.sendCallersToSession(r);let e=this.allCallers.size>0;e!==this.lastHadCallers&&(ws(Ze.commands,"jsDebugHasExcludedCallers",e),this.lastHadCallers=e)}};Ed=I([(0,WS.injectable)(),g(0,(0,WS.inject)($e))],Ed);var HS=v(H());var Fa=class{constructor(e){this.debugTerminalOptionsProviders=e}create(){return{registerDebugTerminalOptionsProvider:e=>(this.debugTerminalOptionsProviders.add(e),{dispose:()=>this.debugTerminalOptionsProviders.delete(e)})}}};Fa=I([(0,HS.injectable)(),g(0,(0,HS.inject)(Vo))],Fa);var Od=v(ge()),Q0=v(require("fs/promises")),X5=v(H()),Jn=v(require("path")),rr=v(require("vscode"));var _i=v(require("vscode")),{createScanner:Dle,parse:Ole,SyntaxKind:X0}=(J0(),tx(K0)),KS=class t{async selectAndInsertDebugConfig(e,r){let n=_i.window.activeTextEditor;if(n&&n.document===e){let i=_i.workspace.getWorkspaceFolder(e.uri),o=await this.getLaunchConfig(i);o&&await t.insertDebugConfiguration(e,r,o)}}static async insertDebugConfiguration(e,r,n){let i=t.getCursorPositionInConfigurationsArray(e,r);if(!i)return;let o=t.isCommaImmediatelyBeforeCursor(e,r)?"BeforeCursor":void 0,s=t.getTextForInsertion(n,i,o),a=new _i.WorkspaceEdit;a.insert(e.uri,r,s),await _i.workspace.applyEdit(a),Promise.resolve(_i.commands.executeCommand("editor.action.formatDocument")).then(()=>{})}static getTextForInsertion(e,r,n){let i=JSON.stringify(e);return r==="AfterItem"?n==="BeforeCursor"?i:`,${i}`:r==="BeforeItem"?`${i},`:i}static getCursorPositionInConfigurationsArray(e,r){if(t.isConfigurationArrayEmpty(e))return"InsideEmptyArray";let n=Dle(e.getText(),!0);n.setPosition(e.offsetAt(r));let i=n.scan();if(i===X0.CommaToken||i===X0.CloseBracketToken)return"AfterItem";if(i===X0.OpenBraceToken)return"BeforeItem"}static isConfigurationArrayEmpty(e){let r=Ole(e.getText(),[],{allowTrailingComma:!0,disallowComments:!1});return!r||!Array.isArray(r.configurations)||r.configurations.length===0}static isCommaImmediatelyBeforeCursor(e,r){let n=e.lineAt(r.line),i=e.getText(new _i.Range(n.range.start,r));if(i.trim().endsWith(","))return!0;if(i.trim().length!==0)return!1;let o=r.line-1;for(;o>0;){let s=e.lineAt(o).text;if(s.trim().endsWith(","))return!0;if(s.trim().length!==0)return!1;o-=1}return!1}};var{getLocation:Lle}=(J0(),tx(K0)),Dd=class{constructor(){this.hasNodeModules=new Map}register(e){e.subscriptions.push(rr.languages.registerCompletionItemProvider({language:"jsonc",pattern:"**/launch.json"},this),be(rr.commands,"extension.js-debug.completion.nodeTool",async(r,n)=>{await new Y0().selectAndInsertDebugConfig(r,n)}))}async provideCompletionItems(e,r,n){return await this.canProvideCompletions(e,r)?[{command:{command:"extension.js-debug.completion.nodeTool",title:Od.t("Run Node.js tool"),arguments:[e,r,n]},documentation:Od.t("Runs a Node.js command-line installed in the workspace node_modules."),sortText:"AAAA",preselect:!0,kind:rr.CompletionItemKind.Enum,label:Od.t("Run Node.js tool"),insertText:new rr.SnippetString}]:[]}async canProvideCompletions(e,r){if(Jn.basename(e.uri.fsPath)!=="launch.json")return!1;let n=Lle(e.getText(),e.offsetAt(r));if(!(n.path[0]==="configurations"&&n.path.length===2))return!1;let i=rr.workspace.getWorkspaceFolder(e.uri);if(!i)return!1;let o=this.hasNodeModules.get(i)??!!await Er(Q0,Jn.join(i.uri.fsPath,"node_modules",".bin"));return this.hasNodeModules.set(i,o),o}};Dd=I([(0,X5.injectable)()],Dd);var Y0=class extends KS{async getLaunchConfig(e){let r=rr.window.createQuickPick();r.title=Od.t("Select a tool to run"),r.busy=!0,r.show();let n=await this.getOptions(e);if(n.length===0){r.dispose(),rr.window.showWarningMessage(Od.t("No npm scripts found in the workspace folder."));return}let i=[];for(let{names:s,relativeDir:a}of n)a&&i.push({label:a,kind:rr.QuickPickItemKind.Separator,relativeDir:a}),i=i.concat(s.map(c=>({label:c,relativeDir:a})));r.busy=!1,r.items=i;let o=await new Promise(s=>{r.onDidAccept(()=>s(r.selectedItems[0])),r.onDidHide(()=>s(void 0))});if(r.dispose(),!!o)return{type:bs("pwa-node"),request:"launch",name:`Run ${o.label}`,runtimeExecutable:o.label,cwd:Jn.join("${workspaceFolder}",o.relativeDir).replaceAll("\\","/"),args:[]}}async getOptions(e){if(!e)return[];let r=await rr.workspace.findFiles(new rr.RelativePattern(e,"**/package.json"));return(await Promise.all(r.map(async i=>{try{let o=Jn.dirname(i.fsPath),s=await Q0.readdir(Jn.join(o,"node_modules",".bin")),a=new Set;for(let c of s){let u=Jn.extname(c);a.add(u?c.slice(0,-u.length):c)}return{relativeDir:Jn.relative(e.uri.fsPath,o),names:Array.from(a)}}catch{return}}))).filter(at)}};var Z0=v(ge()),vm=v(H());var Y5="linkBpWarnIgnored",Nle="https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_can-i-debug-if-im-using-symlinks",Ld=class{constructor(e,r){this.vscode=e;this.context=r;this.didWarn=this.context.workspaceState.get(Y5,!1)}async warn(){if(this.didWarn)return;this.didWarn=!0;let e=Z0.t("Read More"),r=Z0.t("Ignore"),n=await this.vscode.window.showWarningMessage("It looks like you have symlinked files. You might need to update your configuration to make this work as expected.",r,e);n===r?this.context.workspaceState.update(Y5,!0):n===e&&this.vscode.env.openExternal(this.vscode.Uri.parse(Nle))}};Ld=I([(0,vm.injectable)(),g(0,(0,vm.inject)(Dt)),g(1,(0,vm.inject)(Ye))],Ld);var wm=v(ge()),JS=v(H()),Z5=require("path"),ms=v(require("vscode"));var Q5="omitLongPredictions",Nd=class{constructor(e){this.context=e}register(e){e.subscriptions.push(ms.debug.onDidReceiveDebugSessionCustomEvent(r=>{r.event==="longPrediction"&&this.promptLongBreakpoint(r.session.workspaceFolder)}))}async promptLongBreakpoint(e){if(this.context.workspaceState.get(Q5))return;let r=wm.t("It's taking a while to configure your breakpoints. You can speed this up by updating the 'outFiles' in your launch.json."),n=wm.t("Open launch.json"),i=wm.t("Don't show again"),o=await ms.window.showWarningMessage(r,i,n);if(o===i){this.context.workspaceState.update(Q5,!0);return}if(o!==n)return;if(e||(e=await ms.window.showWorkspaceFolderPick()),!e){await ms.window.showWarningMessage(wm.t("No workspace folder open."));return}let s=await ms.workspace.openTextDocument((0,Z5.join)(e.uri.fsPath,".vscode","launch.json"));await ms.window.showTextDocument(s)}};Nd=I([(0,JS.injectable)(),g(0,(0,JS.inject)(Ye))],Nd);var ek=require("buffer"),XS=v(H()),ce=v(require("vscode"));var e3=Object.keys({requestWillBeSent:0,responseReceived:0,responseReceivedExtraInfo:0,loadingFailed:0,loadingFinished:0});var Md=class{constructor(e){this.debugSessionTracker=e;this.disposables=new Ce;this.activeListeners=new Ce;this.treeDataChangeEmitter=new ce.EventEmitter;this.models=new Map;this.onDidChangeTreeData=this.treeDataChangeEmitter.event;this.disposables.push(ce.debug.onDidChangeActiveDebugSession(()=>{this.listenToActiveSession()}),this.debugSessionTracker.onSessionEnded(r=>{this.models.delete(r.id)}),ce.debug.onDidReceiveDebugSessionCustomEvent(r=>{r.event==="networkEvent"&&this.models.get(r.session.id)?.append([r.body.event,r.body.data])}),this.debugSessionTracker.onSessionAdded(r=>{this.isEnabled()&&r.customRequest("enableNetworking",{mirrorEvents:e3}).then(()=>{this.models.set(r.id,new rk(r)),r===ce.debug.activeDebugSession&&this.listenToActiveSession()},()=>{})}),be(ce.commands,"extension.js-debug.network.viewRequest",async r=>{let n=await ce.workspace.openTextDocument(r.fsUri);await ce.window.showTextDocument(n)}),be(ce.commands,"extension.js-debug.network.copyUri",async r=>{await ce.env.clipboard.writeText(r.init.request.url)}),be(ce.commands,"extension.js-debug.network.openBody",async r=>{let n=await ce.workspace.openTextDocument(r.fsBodyUri);await ce.window.showTextDocument(n)}),be(ce.commands,"extension.js-debug.network.openBodyInHex",async r=>{await ce.commands.executeCommand("vscode.openWith",r.fsBodyUri,"hexEditor.hexedit")}),be(ce.commands,"extension.js-debug.network.replayXHR",async r=>{await r.session.customRequest("networkCall",{method:"replayXHR",params:{requestId:r.id}})}),be(ce.commands,"extension.js-debug.network.clear",()=>{for(let r of this.models.values())r.clear();this.treeDataChangeEmitter.fire()}))}getTreeItem(e){return e.toTreeItem()}getChildren(e){return!e&&this.current?this.current.allRequests:[]}register(e){e.subscriptions.push(ce.window.registerTreeDataProvider("jsDebugNetworkTree",this),ce.workspace.registerFileSystemProvider($m,new tk(this.debugSessionTracker,this.models),{isCaseSensitive:!0,isReadonly:!0}))}isEnabled(){return Xe(ce.workspace,"debug.javascript.enableNetworkView")}listenToActiveSession(){this.activeListeners.clear();let e=this.current=ce.debug.activeDebugSession&&this.models.get(ce.debug.activeDebugSession.id),r=!!e&&e.hasRequests;e&&this.activeListeners.push(e.onDidChange(n=>{this.treeDataChangeEmitter.fire(n.isNew?void 0:n.request),e.hasRequests&&!r&&(r=!0,ws(ce.commands,"jsDebugNetworkAvailable",!0))})),ws(ce.commands,"jsDebugNetworkAvailable",r),this.treeDataChangeEmitter.fire(void 0)}};Md=I([(0,XS.injectable)(),g(0,(0,XS.inject)($e))],Md);var tk=class{constructor(e,r){this.tracker=e;this.models=r;this.changeFileEmitter=new ce.EventEmitter;this.onDidChangeFile=this.changeFileEmitter.event}watch(e){let[r,n]=e.path.split("/").slice(1),i=this.models.get(r);return i?i.onDidChange(({request:o,isNew:s})=>{let a=e.with({path:`${r}/${o.id}`});s&&!n?this.changeFileEmitter.fire([{type:ce.FileChangeType.Created,uri:a}]):n===o.id&&this.changeFileEmitter.fire([{type:ce.FileChangeType.Changed,uri:a}])}):Us}async stat(e){let[r,n]=e.path.split("/").slice(1),i=this.models.get(r);if(!i)throw ce.FileSystemError.FileNotFound(e);if(!n)return{type:ce.FileType.Directory,ctime:0,mtime:0,size:0};let o=i.getRequest(n);if(!o)throw ce.FileSystemError.FileNotFound(e);return{type:ce.FileType.File,ctime:o.ctime,mtime:o.mtime,size:o.isComplete?await o.body().then(s=>s?.length||0):0}}readDirectory(){return[]}createDirectory(){}async readFile(e){let[r,n,i]=e.path.split("/").slice(1),o=this.models.get(r)?.getRequest(n);if(!o)throw ce.FileSystemError.FileNotFound(e);return i==="body"?o.isComplete?await o.body()||Buffer.from("Body not available"):Buffer.from("Response is still loading..."):Buffer.from(await o.toCurl(this.tracker.getById(r)))}writeFile(){}delete(){}rename(){}},rk=class{constructor(e){this.session=e;this.requests=new Map;this.didChangeEmitter=new ce.EventEmitter;this.onDidChange=this.didChangeEmitter.event}get allRequests(){return[...this.requests.values()]}get hasRequests(){return this.requests.size>0}getRequest(e){return this.requests.get(e)}clear(){this.requests.clear()}append([e,r]){if(e==="requestWillBeSent"){let n=new nk(r,this.session);this.requests.set(r.requestId,n),this.didChangeEmitter.fire({request:n,isNew:!0})}else if(e==="responseReceived"||e==="loadingFailed"||e==="loadingFinished"||e==="responseReceivedExtraInfo"){let n=this.requests.get(r.requestId);if(!n)return;e==="responseReceived"?n.response=r.response||{}:e==="loadingFailed"?n.failed=r:e==="loadingFinished"?n.finished=r:e==="responseReceivedExtraInfo"&&(n.responseExtra=r),n.mtime=Date.now(),this.didChangeEmitter.fire({request:n,isNew:!1})}else xu(e,"unexpected network event")}},nk=class{constructor(e,r){this.init=e;this.session=r;this.ctime=Date.now();this.mtime=Date.now();this.body=me(async()=>{try{let e=await this.session.customRequest("networkCall",{method:"getResponseBody",params:{requestId:this.init.requestId}});return e.body?e.base64Encoded?Buffer.from(e.body,"base64"):Buffer.from(e.body):this.session.type==="pwa-node"?Buffer.from("Response body inspection is not supported in Node.js yet."):void 0}catch{return}})}get isComplete(){return!!(this.finished||this.failed)}get id(){return this.init.requestId}get fsUri(){return ce.Uri.from({scheme:$m,path:`/${this.session.id}/${this.id}`})}get fsBodyUri(){return ce.Uri.from({scheme:$m,path:`/${this.session.id}/${this.id}/body`})}toTreeItem(){let e;this.isComplete?this.failed?e=new ce.ThemeIcon("error",new ce.ThemeColor("notebookStatusErrorIcon.foreground")):this.response&&this.response.status>=400?e=new ce.ThemeIcon("warning"):e=new ce.ThemeIcon("check",new ce.ThemeColor("notebookStatusSuccessIcon.foreground")):e=new ce.ThemeIcon("sync~spin",new ce.ThemeColor("notebookStatusRunningIcon.foreground"));let r="";this.failed?r+=`[${this.failed.errorText}] `:this.response&&(r+=`[${this.response.status}] `);let n,i;try{let s=new URL(this.init.request.url);n=s.host,i=s.pathname}catch{i=this.init.request.url}r+=`${this.init.request.method.toUpperCase()} ${i}`;let o=new ce.TreeItem(r,ce.TreeItemCollapsibleState.Collapsed);return o.iconPath=e,o.description=n,o.tooltip=this.init.request.url,o.id=this.init.requestId,o.collapsibleState=ce.TreeItemCollapsibleState.None,o}async toCurl(e){let r=this.toCurlCommand();if(!this.response)return r;let n=[r];n.push(`< HTTP ${this.responseExtra?.statusCode||this.response.status||"UNKOWN"}`);for(let o of Object.entries(this.responseExtra?.headers||this.response.headers||{}))n.push(`< ${o[0]}: ${o[1]}`);if(n.push("<"),this.failed&&(n.push("",`${this.failed.errorText}`),this.failed.blockedReason?n.push(`Blocked: ${this.failed.blockedReason}`):this.failed.corsErrorStatus&&n.push(`CORS error: ${this.failed.corsErrorStatus.corsError}`)),!this.isComplete||!e)return n.join(`
`);let i=await this.body()||Buffer.from("");if(!(0,ek.isUtf8)(i))n.push(`[binary data as base64]: ${i.toString("base64")}`);else{let o=i.toString();try{let s=JSON.parse(o);n.push(JSON.stringify(s,null,2))}catch{n.push(o)}}return n.join(`
`)}toCurlCommand(){let e=["curl","-v"];this.init.request.method!=="GET"&&e.push(`-X ${this.init.request.method}`);for(let[r,n]of Object.entries(this.init.request.headers||{}))e.push(`-H '${r}: ${n}'`);if(this.init.request.postDataEntries?.length){let r=this.init.request.postDataEntries.map(i=>i.bytes||"").join(""),n=Buffer.from(r,"base64");e.push((0,ek.isUtf8)(n)?`-d '${n.toString()}'`:"--data-binary '<data>'")}return e.push(`'${this.init.request.url}'`),e.join(" ")}};var YS=v(H()),Fd=require("vscode");var Bd=class{constructor(e){this.leaseTracker=e;this.cachedResolutions=new Array(16).fill("");this.cachedResolutionIndex=0}register(e){typeof Fd.workspace.registerPortAttributesProvider=="function"&&e.subscriptions.push(Fd.workspace.registerPortAttributesProvider({portRange:[53e3,54e3]},this))}async providePortAttributes({port:e,pid:r}){if(r&&this.cachedResolutions.includes(`${e}:${r}`))return{port:e,autoForwardAction:Fd.PortAutoForwardAction.Ignore};if(await this.leaseTracker.isRegistered(e)){if(r){let n=this.cachedResolutionIndex++%this.cachedResolutions.length;this.cachedResolutions[n]=`${e}:${r}`}return{port:e,autoForwardAction:Fd.PortAutoForwardAction.Ignore}}}};Bd=I([(0,YS.injectable)(),g(0,(0,YS.inject)(nt))],Bd);var QS=v(H()),r3=v(require("querystring")),_n=v(require("vscode"));var Ud=class{constructor(e){this.tracker=e;this.canPrettyPrintKey=new od("jsDebugCanPrettyPrint")}register(e){e.subscriptions.push(be(_n.commands,"extension.js-debug.prettyPrint",()=>this.prettifyActive()),_n.window.onDidChangeActiveTextEditor(r=>this.updateEditorState(r)),this.tracker.onSessionAdded(()=>this.updateEditorState(_n.window.activeTextEditor)),this.tracker.onSessionEnded(()=>this.updateEditorState(_n.window.activeTextEditor)))}async prettifyActive(){let e=_n.window.activeTextEditor;if(!e||!this.canPrettyPrint(e))return;let{sessionId:r,source:n}=Mle(e.document.uri),i=r&&this.tracker.getById(r),o;if(i?o=[{session:i,result:await t3(i,n,e.selection.start)}]:o=await Promise.all(this.tracker.getConcreteSessions().map(async s=>{let a=await t3(s,n,e.selection.start);return{session:s,result:a}})),!o.some(s=>s.result.didReveal)){let s=o.find(a=>a.result.source);if(s){let a=await _n.workspace.openTextDocument(Ble(s.session,s.result.source));await _n.window.showTextDocument(a)}}}canPrettyPrint(e){return this.tracker.isDebugging&&e.document.languageId==="javascript"&&!e.document.uri.path.endsWith("-pretty.js")}updateEditorState(e){if(!this.tracker.isDebugging){this.canPrettyPrintKey.value=void 0;return}e&&this.canPrettyPrint(e)&&e.document.uri.toString()!==this.canPrettyPrintKey.value?.[0]&&(this.canPrettyPrintKey.value=[e.document.uri.toString()])}};Ud=I([(0,QS.injectable)(),g(0,(0,QS.inject)($e))],Ud);var t3=(t,e,r)=>t.customRequest("prettyPrintSource",{source:e,line:r.line,column:r.character}),Mle=t=>{let e=r3.parse(t.query),r=e.session,n={path:t.fsPath,sourceReference:Number(e.ref)||0};return{sessionId:r,source:n}},Ble=(t,e)=>e.sourceReference?_n.Uri.from({scheme:"debug",path:e.path?.replace(/^\/+/g,"/"),query:`session=${t.id}&ref=${e.sourceReference}`}):_n.Uri.file(e.path||"");var Sm=v(ge()),_m=v(H()),i3=v(require("path")),xi=v(require("vscode"));var n3="breakpointTerminationWarnedSlow",jd=class{constructor(e,r){this.fs=e;this.context=r;this.sortOrder=2;this.id="breakpoint";this.label=Sm.t("Pick Breakpoint");this.description=Sm.t("Run until a specific breakpoint is hit")}async onPick(e,r){if(r)return new ZS(r);let n=xi.window.createQuickPick();n.canSelectMany=!0,n.matchOnDescription=!0,n.busy=!0;let i=await new Promise(o=>{n.onDidAccept(()=>o(n.selectedItems)),n.onDidHide(()=>o(void 0)),n.onDidChangeActive(async s=>{if(!s.length)return;let a=s[0].location,c=await xi.workspace.openTextDocument(a.uri);xi.window.showTextDocument(c,{selection:a.range,preview:!0,preserveFocus:!0})}),n.show(),(async()=>{let s=xi.debug.breakpoints.filter(u=>u.enabled&&u instanceof xi.SourceBreakpoint),a=await Promise.all(s.map(u=>e.getDebugProtocolBreakpoint(u))),c=await this.getCandidates(a,s);n.items=c,n.selectedItems=c,n.busy=!1})()});if(n.dispose(),!!i)return await this.warnSlowCode(),new ZS(i.map(o=>Number(o.id)))}async warnSlowCode(){this.context.workspaceState.get(n3)||(xi.window.showWarningMessage(Sm.t('Profiling with breakpoints enabled can change the performance of your code. It can be useful to validate your findings with the "duration" or "manual" termination conditions.'),Sm.t("Got it!")),await this.context.workspaceState.update(n3,!0))}async getCandidates(e,r){if(e.length!==r.length)throw new Error("Mismatched breakpoint array lengths");let n=Ro(o=>this.getFileLines(o));return(await Promise.all(r.map(async(o,s)=>{let a=e[s];if(!a||!a.id)return;let c=o.location,u=xi.workspace.getWorkspaceFolder(c.uri),l=u?i3.relative(u.uri.fsPath,c.uri.fsPath):c.uri.fsPath,p=await n(c.uri.fsPath);return{id:a.id,label:`${l}:${c.range.start.line}:${c.range.start.character}`,location:c,description:p?.[c.range.start.line]?.trim()}}))).filter(at)}async getFileLines(e){try{return(await this.fs.readFile(e,"utf-8")).split(`
`)}catch{return}}};jd=I([(0,_m.injectable)(),g(0,(0,_m.inject)(ve)),g(1,(0,_m.inject)(Ye))],jd);var ZS=class{constructor(e){this.breakpointIds=e}get customData(){return{stopAtBreakpoint:this.breakpointIds.slice()}}dispose(){}};var gu=v(ge()),o3=v(H()),s3=v(require("vscode"));var e_=v(ge()),xo=v(require("vscode"));var xm=class{constructor(e,r,n){this.session=e;this.impl=r;this.termination=n;this.statusChangeEmitter=new j;this.stopEmitter=new j;this._innerStatus=[];this.disposables=new Ce;this.state=0;this.onStatusChange=this.statusChangeEmitter.event;this.onStop=this.stopEmitter.event;this.disposables.push(xo.debug.onDidReceiveDebugSessionCustomEvent(i=>{i.session===e&&i.event==="profilerStateUpdate"&&this.onStateUpdate(i.body)}),xo.debug.onDidTerminateDebugSession(i=>{i===e&&this.stopEmitter.fire(void 0)})),n&&(this.disposables.push(n),n.attachTo?.(this))}get status(){return this._innerStatus.filter(e=>!!e).join(", ")||void 0}async start(){try{await xo.window.withProgress({location:xo.ProgressLocation.Window,title:e_.t("Starting profile...")},()=>this.session.customRequest("startProfile",{type:this.impl.type,...this.termination?.customData}))}catch(e){xo.window.showErrorMessage(e.message),this.stopEmitter.fire(void 0)}}dispose(){this.state=2,this.disposables.dispose()}setFile(e){this.file=e}async stop(){this.state===0&&(this.setStatus(-1,e_.t("Saving")),this.state=1,await xo.window.withProgress({location:xo.ProgressLocation.Window,title:e_.t("Stopping profile...")},()=>this.session.customRequest("stopProfile",{})))}onStateUpdate(e){if(e.running){this.setStatus(0,e.label);return}this.state=2,this.stopEmitter.fire(this.file),this.dispose()}setStatus(e,r){this.state===0&&(e===-1?this._innerStatus=[r]:this._innerStatus[e]=r,this.statusChangeEmitter.fire(this.status))}};var Wd=class{constructor(){this.sortOrder=1;this.id="duration";this.label=gu.t("Duration");this.description=gu.t("Run for a specific amount of time")}async onPick(e,r){if(r)return new t_(r*1e3);let n=s3.window.createInputBox();n.title=gu.t("Duration of Profile"),n.placeholder=gu.t('Profile duration in seconds, e.g "5"'),this.lastDuration&&(n.value=String(this.lastDuration)),n.onDidChangeValue(o=>{/^[0-9]+$/.test(o)?Number(o)<1?n.validationMessage=gu.t("Please enter a number greater than 1"):n.validationMessage=void 0:n.validationMessage=gu.t("Please enter a number")});let i=await new Promise(o=>{n.onDidAccept(()=>{if(n.validationMessage)return o(void 0);this.lastDuration=Number(n.value),o(new t_(this.lastDuration*1e3))}),n.onDidHide(()=>o(void 0)),n.show()});return n.dispose(),i}};Wd=I([(0,o3.injectable)()],Wd);var t_=class{constructor(e){this.duration=e;this.disposable=new Ce}attachTo(e){let r=Date.now()+this.duration,n=()=>e.setStatus(1,`${Math.round((r-Date.now())/1e3)}s`),i=setTimeout(()=>e.stop(),this.duration),o=setInterval(n,1e3);n(),this.disposable.callback(()=>{clearTimeout(i),clearInterval(o)})}dispose(){this.disposable.dispose()}};var ik=v(ge()),a3=v(H());var Hd=class{constructor(){this.sortOrder=0;this.id="manual";this.label=ik.t("Manual");this.description=ik.t("Run until manually stopped")}async onPick(){return new Im}};Hd=I([(0,a3.injectable)()],Hd);var Im=class{dispose(){}};var qd=Symbol("ITerminationConditionFactory");var Io=v(ge()),ja=v(H()),c3=require("os"),r_=require("path"),nr=v(require("vscode"));var Fle=t=>"__pendingTargetId"in t.configuration,Ua=class{constructor(e,r,n,i){this.tracker=e;this.fs=r;this.sessionStates=n;this.terminationConditions=i;this.activeSessions=new Map;this.disposables=new Ce;this.disposables.push(nr.debug.onDidReceiveDebugSessionCustomEvent(o=>{if(o.event!=="profileStarted")return;let s=o.body,a=this.activeSessions.get(o.session.id);a||(a=new xm(o.session,Kr.ctors.find(c=>c.type===s.type)||Kr.ctors[0],new Im),this.registerSession(a)),a.setFile(s.file)}))}async start(e){let r,n=[...this.tracker.getConcreteSessions()].filter(Fle);if(e.sessionId?r=n.find(u=>u.id===e.sessionId):r=await this.pickSession(n),!r)return;let i=r,o=this.activeSessions.get(i.id);if(o&&!await this.alreadyRunningSession(o))return;let s=await this.pickType(i,e.type);if(!s)return;let a;if(!s.instant&&(a=await this.pickTermination(i,e.termination),!a))return;let c=new xm(i,s,a);c&&(this.registerSession(c,e.onCompleteCommand),await c.start(),s.instant&&await c.stop())}async stop(e){let r;if(e)r=this.activeSessions.get(e);else{let n=await this.pickSession([...this.activeSessions.values()].map(i=>i.session));r=n&&this.activeSessions.get(n.id)}r&&(this.sessionStates.remove(r.session.id),await r.stop())}dispose(){for(let e of this.activeSessions.values())e.dispose();this.activeSessions.clear(),this.disposables.dispose()}registerSession(e,r){this.activeSessions.set(e.session.id,e),this.sessionStates.add(e.session.id,Io.t("Profiling")),e.onStatusChange(()=>this.updateStatusBar()),e.onStop(n=>{n&&this.openProfileFile(e,r,e.session,n),this.activeSessions.delete(e.session.id),e.dispose(),this.updateStatusBar()}),this.updateStatusBar()}async openProfileFile(e,r,n,i){if(r)return Promise.all([nr.commands.executeCommand(r,{contents:await this.fs.readFile(i,"utf-8"),basename:(0,r_.basename)(i)+e.impl.extension}),this.fs.unlink(i)]);let o=n.workspaceFolder?.uri.fsPath??nr.workspace.workspaceFolders?.[0].uri.fsPath??(0,c3.homedir)(),s=Tv()+e.impl.extension,a=nr.Uri.file((0,r_.join)(o,s));await I1(this.fs,i,a.fsPath),await nr.commands.executeCommand(e.impl.editable?"vscode.open":"revealInExplorer",a)}updateStatusBar(){if(this.activeSessions.size===0){this.statusBarItem?.hide(),ws(nr.commands,"jsDebugIsProfiling",!1);return}this.statusBarItem||(this.statusBarItem=nr.window.createStatusBarItem(nr.StatusBarAlignment.Right,500),this.statusBarItem.command="extension.js-debug.stopProfile"),ws(nr.commands,"jsDebugIsProfiling",!0);let e=As(this.activeSessions.values());e&&this.activeSessions.size===1?this.statusBarItem.text=e.status?Io.t("{0} Click to Stop Profiling ({1})","$(loading~spin)",e.status):Io.t("{0} Click to Stop Profiling","$(loading~spin)"):this.statusBarItem.text=Io.t("{0} Click to Stop Profiling ({1} sessions)","$(loading~spin)",this.activeSessions.size),this.statusBarItem.show()}async alreadyRunningSession(e){let r=Io.t("Yes"),n=Io.t("No");return await nr.window.showErrorMessage(Io.t("A profiling session is already running, would you like to stop it and start a new session?"),r,n)!==r?!1:(await this.stop(e.session.id),!0)}async pickSession(e){if(e.length===0)return;if(e.length===1)return e[0];let r=await nr.window.showQuickPick(e.map(n=>({label:n.name,id:n.id})));return r&&e.find(n=>n.id===r.id)}async pickType(e,r){let n=e.configuration;if(r)return Kr.ctors.find(o=>o.type===r&&o.canApplyTo(n));let i=await this.pickWithLastDefault(Io.t("Type of profile"),Kr.ctors.filter(o=>o.canApplyTo(n)),this.lastChosenType);return i&&(this.lastChosenType=i.label),i}async pickTermination(e,r){if(r){let i=typeof r=="string"?{type:r}:r;return this.terminationConditions.find(o=>o.id===i.type)?.onPick(e,...i.args??[])}let n=await this.pickWithLastDefault(Io.t("How long to run the profile"),this.terminationConditions,this.lastChosenTermination);return n&&(this.lastChosenTermination=n.label),n?.onPick(e)}async pickWithLastDefault(e,r,n){if(r.length<=1)return r[0];let i=nr.window.createQuickPick();i.title=e,i.items=r.slice().sort((s,a)=>s.label===n||a.label===n?s.label===n?-1:1:(s.sortOrder??0)-(a.sortOrder??0)).map(s=>({label:s.label,description:s.description,alwaysShow:!0}));let o=await new Promise(s=>{i.onDidAccept(()=>s(i.selectedItems[0]?.label)),i.onDidHide(()=>s(void 0)),i.show()});if(i.dispose(),!!o)return r.find(s=>s.label===o)}};Ua=I([(0,ja.injectable)(),g(0,(0,ja.inject)($e)),g(1,(0,ja.inject)(ve)),g(2,(0,ja.inject)(yl)),g(3,(0,ja.multiInject)(qd))],Ua);var l3=v(H()),p3=require("vscode");var u3=(t,e)=>{let r=t;for(let[n,i]of Object.entries(e))typeof i=="object"&&i?r[n]=Object.assign(r[n]||{},i):r[n]=i};var $d=class{constructor(){this.read=me(()=>Xe(p3.workspace,"debug.javascript.resourceRequestOptions"))}provideOptions(e){u3(e,this.read()||{})}};$d=I([(0,l3.injectable)()],$d);var d3=v(H()),ok=require("vscode");var Vd=class{register(e){e.subscriptions.push(be(ok.commands,"extension.node-debug.startWithStopOnEntry",()=>ok.commands.executeCommand("workbench.action.debug.start",{config:{stopOnEntry:!0}})))}};Vd=I([(0,d3.injectable)()],Vd);var Pk=v(ge()),M_=v(H()),k3=v(E3()),R3=require("url"),Ht=v(require("vscode"));var Xd=class{constructor(e){this.defaultBrowser=e;this.enabledTerminals=new WeakSet;this.disposable=new Ce;this.notifiedCantOpenOnWeb=!1;this.baseConfiguration=this.readConfig();this.disposable.push(Ht.workspace.onDidChangeConfiguration(r=>{r.affectsConfiguration("debug.javascript.debugByLinkOptions")&&(this.baseConfiguration=this.readConfig())}),Ht.window.registerTerminalLinkProvider(this))}enableHandlingInTerminal(e){this.enabledTerminals.add(e)}dispose(){this.disposable.dispose()}provideTerminalLinks(e){switch(this.baseConfiguration.enabled){case"off":return[];case"always":break;default:if(!this.enabledTerminals.has(e.terminal))return[]}let r=[],n=me(()=>{if("cwd"in e.terminal.creationOptions&&e.terminal.creationOptions.cwd){let i=Ht.workspace.getWorkspaceFolder(typeof e.terminal.creationOptions.cwd=="string"?Ht.Uri.file(e.terminal.creationOptions.cwd):e.terminal.creationOptions.cwd);if(i)return i}return Ht.workspace.workspaceFolders?.[0]});for(let i of(0,k3.find)(e.line,"url")){let o=-1;for(;(o=e.line.indexOf(i.value,o+1))!==-1;){let s;try{s=new R3.URL(i.href)}catch{continue}s.protocol==="http:"&&!i.value.startsWith("http:")&&!Ny(s.hostname)&&(s.protocol="https:"),!(s.protocol!=="http:"&&s.protocol!=="https:")&&r.push({startIndex:o,length:i.value.length,tooltip:Pk.t("Debug URL"),target:s,workspaceFolder:n()?.index})}}return r}async handleTerminalLink(e){await this.handleTerminalLinkInner(e)||Ht.env.openExternal(Ht.Uri.parse(e.target.toString()))}async handleTerminalLinkInner(e){if(!e.target)return!1;let r=e.target;if(Ht.env.uiKind===Ht.UIKind.Web)return this.notifiedCantOpenOnWeb||(Ht.window.showInformationMessage(Pk.t("We can't launch a browser in debug mode from here. If you want to debug this webpage, open this workspace from VS Code on your desktop.")),this.notifiedCantOpenOnWeb=!0),!1;cL(r.hostname)&&(r.hostname="localhost");let n="pwa-chrome";try{await this.defaultBrowser.lookup()==="edge"&&(n="pwa-msedge")}catch{}let i=e.workspaceFolder!==void 0?Ht.workspace.workspaceFolders?.[e.workspaceFolder]:void 0;return Ht.debug.startDebugging(i,{...this.baseConfiguration,type:n,name:r.toString(),request:"launch",url:r.toString()}),!0}readConfig(){let e=Xe(Ht.workspace,"debug.javascript.debugByLinkOptions");return typeof e=="boolean"&&(e=e?"on":"off"),typeof e=="string"?{enabled:e}:{enabled:"on",...e}}};Xd=I([(0,M_.injectable)(),g(0,(0,M_.inject)(mp))],Xd);var A3=t=>{t.bind(Dt).toConstantValue(require("vscode")),I5.forEach(e=>{t.bind(e).toSelf().inSingletonScope(),t.bind(kS).to(e)}),C5.forEach(e=>t.bind(RS).to(e).inSingletonScope()),t.bind(_r).to(Nd).inSingletonScope(),t.bind(_r).to(Sd).inSingletonScope(),t.bind(_r).to(id).inSingletonScope(),t.bind(_r).to(du).inSingletonScope(),t.bind(_r).to(xd).inSingletonScope(),t.bind(_r).to(Vd).inSingletonScope(),t.bind(_r).to(Bd).inSingletonScope(),t.bind(_r).to(Pd).inSingletonScope(),t.bind(_r).to(Ed).inSingletonScope(),t.bind(_r).to(Ud).inSingletonScope(),t.bind(_r).to(sd).inSingletonScope(),t.bind(_r).to(Md).inSingletonScope(),t.bind(_r).to(Dd).inSingletonScope().onActivation(He),t.bind(Qh).to(Ld).inSingletonScope(),t.bind($e).toSelf().inSingletonScope().onActivation(He),t.bind(Ua).toSelf().inSingletonScope().onActivation(He),t.bind(du).toSelf().inSingletonScope(),t.bind(wc).to(Td).inSingletonScope(),t.bind(au).to(Xd).inSingletonScope().onActivation(He),t.bind(qd).to(Wd).inSingletonScope(),t.bind(qd).to(Hd).inSingletonScope(),t.bind(qd).to(jd).inSingletonScope(),t.bind(Vo).toConstantValue(new Set),t.bind(Fa).toSelf().inSingletonScope()},D3=t=>{t.bind(jt).to(ps).onActivation(He),t.bind(jt).to(Qp).onActivation(He),t.bind(jt).to(Yp).onActivation(He),t.bind(pp).to($d).inSingletonScope(),t.bind(dl).to(nd).inSingletonScope().onActivation(He)};var L3=(t,e,r,n)=>{let i=new U_.Container;return i.parent=t,i.bind(Re).toConstantValue(e.launchConfig),i.bind(gl).toConstantValue(i),i.bind(Ur).toConstantValue(r),i.bind(lt).toConstantValue(n),i.bind(lo).toConstantValue(e),i.bind(z$).toConstantValue(e.targetOrigin()),i.bind(tc).to(Vc).inSingletonScope(),i.bind(rh).to($s).inSingletonScope(),i.bind(Qi).to(sc).inSingletonScope(),i.bind(sb).to(al).inSingletonScope(),i.bind(Fs).toSelf().inSingletonScope(),e.sourcePathResolver&&i.bind(je).toConstantValue(e.sourcePathResolver),i.bind(Dc).toSelf(),i.bind(Sv).toDynamicValue(o=>o.container.get(Dc).create()).inSingletonScope(),e.parent()&&(i.bind(uc).to(cc).inSingletonScope(),i.bind(Zi).to(Zu).inSingletonScope()),i.bind(At).to(process.env.DA_TEST_DISABLE_TELEMETRY?su:$r).inSingletonScope().onActivation(He),i.bind(On).toSelf().inSingletonScope(),i.bind(Gt).toSelf().inSingletonScope(),i.bind(Zs).toSelf().inSingletonScope(),i.bind(js).to(fo).inSingletonScope().onActivation(He),i.bind(zs).toSelf().inSingletonScope(),i.bind(Vl).to($l).inSingletonScope(),i.bind($b).to(Dl).inSingletonScope(),i.bind(kn).to(il).inSingletonScope(),i.bind(hv).to(Hl).inSingletonScope(),i.bind(Qs).to(Wl).inSingletonScope(),i.bind(Ib).to(vl).inSingletonScope().onActivation(He),i.bind(Xt).toSelf(),i.bind(hn).toSelf(),i.bind(mn).toSelf(),i.bind(Cv).to(Kr).inSingletonScope(),i.bind(Pv).to(zl).inSingletonScope(),i.bind(qb).to(Rl).inSingletonScope().onActivation(He),i},N3=t=>{let e=new U_.Container;e.parent=t,e.bind(gl).toConstantValue(e),e.bind(Y).to(Wn).inSingletonScope().onActivation(He),e.bind(tc).to(Vc).inSingletonScope(),e.bind(At).to(process.env.DA_TEST_DISABLE_TELEMETRY?su:$r).inSingletonScope().onActivation(He),e.bind(Hi).to(Hi).inSingletonScope(),e.bind(Bo).to(Bo).inSingletonScope(),e.bind(fp).to(dp).inSingletonScope(),e.bind(Yu).to(_p).inSingletonScope(),e.bind(Vn).to(Np),e.bind(bo).toSelf().inSingletonScope().onActivation(He),e.bind(So).toSelf(),e.bind(jt).to(bi).onActivation(He),e.bind(jt).to(Fp).onActivation(He),e.bind(jt).to(Up).onActivation(He),e.bind(jt).to(qp).onActivation(He),e.bind(am).to(zp),e.bind(am).to(Kp),e.bind(ru).to(Lp).inSingletonScope(),D3(e),e.bind(jt).to(Wp).onActivation(He),e.bind(eu).toSelf().inSingletonScope().onActivation(He),e.bind(jt).toService(eu),e.bind(jt).to(Tp).inSingletonScope().onActivation(He),e.bind(jt).to(Ep).inSingletonScope().onActivation(He),e.bind(jt).to(Pp).inSingletonScope().onActivation(He),e.bind(jt).to(kp).inSingletonScope().onActivation(He),e.bind(jt).to($n).onActivation(He),e.bind(jt).toDynamicValue(()=>t.get(vo).createLauncher(e.get(Y))).inSingletonScope(),e.isBound(wc)||e.bind(wc).to(ql).inSingletonScope(),e.bind(LC).to(bl).inSingletonScope().onActivation(He);let r=n=>i=>new n(i.container.get(kC),i.container.get(ve),i.container.get(RC));return e.bind(vc).toDynamicValue(r(F_.ChromeBrowserFinder)).inSingletonScope().whenTargetTagged("browser","chrome"),e.bind(vc).toDynamicValue(r(F_.EdgeBrowserFinder)).inSingletonScope().whenTargetTagged("browser","edge"),e},M3=t=>{let e=new U_.Container;return e.bind(gl).toConstantValue(e),e.bind(vo).toSelf().inSingletonScope(),e.bind(yi).toSelf().inSingletonScope(),e.bind(dl).to(Jp).inSingletonScope(),e.bind(yl).toConstantValue(new ho),e.bind(mp).to(hp).inSingletonScope(),e.bind(io).toConstantValue(t.storagePath),e.bind(bc).toConstantValue(t.isVsCode),e.bind(fS).to(Vp),e.bind(nt).to(kl).inSingletonScope(),e.bind(kC).toConstantValue(process.env),e.bind(RC).toConstantValue(O3.default),e.bind(ve).toConstantValue(B_.promises),e.bind(br).toConstantValue(new nn(B_.promises)),e.bind(ui).toConstantValue(t.isRemote?"remote":"local"),t.context&&e.bind(Ye).toConstantValue(t.context),A3(e),e},B3=(t,e,r)=>{t.bind(Oh).toConstantValue(lH(e)),t.bind(Re).toService(Oh),t.bind(Lr).to(Ap).inSingletonScope(),t.bind(qu).toConstantValue(r),t.bind(je).toDynamicValue(n=>n.container.get(Lr).create(e,n.container.get(Y))).inSingletonScope(),t.bind(br).toConstantValue(ny.create(e.__remoteFilePrefix,B_.promises,r)),t.bind(tC).to(Ns).inSingletonScope().onActivation(He),t.bind(Bs).to(rl).inSingletonScope(),t.bind(pt).toSelf().inSingletonScope().onActivation(He),t.bind(Qi).to(sc).inSingletonScope(),t.bind(ac).toSelf().inSingletonScope(),t.bind(uc).to(cc).inSingletonScope(),t.bind(Zi).to(Qu).inSingletonScope()};var V3=v(ge()),or=v(require("vscode"));var F3=v(ge()),ys=v(H()),Ek=v(require("path")),$a=v(require("vscode"));var bu=class extends Qr{constructor(r,n,i,o,s,a){super(r,n,a,s);this.extensionContext=i;this.fs=o;this.telemetryItems=new Map}get deferredSocketName(){let r=this.extensionContext.environmentVariableCollection.get("VSCODE_INSPECTOR_OPTIONS");return r?new Yw({VSCODE_INSPECTOR_OPTIONS:r.value}).inspectorOptions?.inspectorIpc:void 0}getProcessTelemetry(r){return Promise.resolve(r instanceof Mp?this.telemetryItems.get(r.processId()):void 0)}resolveParams(r){if(r.type==="node-terminal"&&r.request==="launch")return r}async launchProgram(r){await this.applyInspectorOptions(this.extensionContext.environmentVariableCollection,r),this.program=new ls,this.program.stopped.then(n=>this.onProgramTerminated(n))}async refreshVariables(){this.run&&await this.applyInspectorOptions(this.extensionContext.environmentVariableCollection,this.run)}async applyInspectorOptions(r,n){let i;try{i=await this.resolveNodePath(n.params)}catch(c){if(c instanceof q&&c.cause.id===9229)i=new Zt("node",void 0);else throw c}let o=Xe($a.workspace,"debug.javascript.autoAttachFilter"),a=(await this.resolveEnvironment(n,i,{deferredMode:!0,inspectorIpc:this.deferredSocketName??n.serverAddress+".deferred",autoAttachMode:o,aaPatterns:o==="smart"?this.readSmartPatterns():void 0})).defined();r.persistent=!0,r.description=new $a.MarkdownString(F3.t({message:'Enables Node.js [auto attach]({0}) debugging in "{1}" mode',comment:["{Locked='[auto attach]({0})'}","the 2nd placeholder is the setting value"],args:["https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_auto-attach",o]})),r.prepend("NODE_OPTIONS",a.NODE_OPTIONS),r.append("VSCODE_INSPECTOR_OPTIONS",a.VSCODE_INSPECTOR_OPTIONS)}readSmartPatterns(){let r=Xe($a.workspace,"debug.javascript.autoAttachSmartPattern"),n=$a.workspace.workspaceFolders?.length===1?$a.workspace.workspaceFolders[0].uri.fsPath:`{${$a.workspace.workspaceFolders?.map(i=>i.uri.fsPath).join(",")}}`;return r?.map(i=>i.replace("${workspaceFolder}",n)).map(ze)}async getBootloaderFile(r,n){let i=this.extensionContext.storagePath||this.extensionContext.globalStoragePath;if(i.includes(" ")&&n.isPreciselyKnown&&!n.has(0))throw new Bm(`The \`node\` version on your PATH is too old (${n.version?.major}), so we cannot enable auto-attach in your environment`,"https://github.com/microsoft/vscode-js-debug/issues/708");let o=Ek.join(i,"bootloader.js");try{await this.fs.mkdir(i)}catch{}await Promise.all([CI(this.fs,Qw,o),CI(this.fs,Z$,Ek.join(i,"watchdog.js"))]);let s=ze(o);return{interpolatedPath:s.includes(" ")?`"${s}"`:s,dispose:()=>{}}}async spawnForChild(r){if(!this.run)return;let n=Number(r.pid??"0");this.telemetryItems.set(n,r.telemetry);let i=await Gn.attach({...r,ipcAddress:this.run.serverAddress});i.onEnd(()=>{this.telemetryItems.delete(n),i.dispose()})}static clearVariables(r){r.environmentVariableCollection.clear()}};bu=I([(0,ys.injectable)(),g(0,(0,ys.inject)(Vn)),g(1,(0,ys.inject)(Y)),g(2,(0,ys.inject)(Ye)),g(3,(0,ys.inject)(ve)),g(4,(0,ys.inject)(Lr)),g(5,(0,ys.inject)(nt))],bu);var Bm=class extends Error{constructor(r,n){super(r);this.helpLink=n}};var W3=v(ge()),H3=require("os"),wt=v(require("vscode"));var U3=()=>{let t,e=Ue(),r=(n,i)=>i==="connect"?o=>{e.resolve(o),t=o}:i==="disconnect"?()=>{e=Ue(),t=void 0}:async(...o)=>(t||await e.promise)[i](...o);return new Proxy({},{get:r})};var Rk=(t,e,r={},n=()=>!0)=>{let i=new $r,o={...Xe(wt.workspace,"debug.javascript.terminalOptions"),internalConsoleOptions:"neverOpen"},s=U3();i.attachDap(s);let a=new Set,c=async u=>{let l=await e.getProcessTelemetry(u),p=l&&wt.Uri.file(l.cwd),d=p&&wt.workspace.getWorkspaceFolder(p);return d?d.uri:r.__workspaceFolder?wt.Uri.file(r.__workspaceFolder):wt.workspace.workspaceFolders?.[0].uri??p};return e.onTargetListChanged(async()=>{let u=await wt.workspace.requestWorkspaceTrust(),l=new Set;for(let p of e.targetList()){if(l.add(p),a.has(p)){a.delete(p);continue}let d=t.addDelegate(p,s,p.parent());if(!n(p)){p.detach();continue}if(p.targetInfo.openerId&&!p.parent()){p.detach();continue}if(!u){p.detach();continue}if(!p.parent()){let f=await c(p);wt.debug.startDebugging(f&&wt.workspace.getWorkspaceFolder(f),{...o,type:"node-terminal",name:"Node.js Process",request:"attach",delegateId:d,cwd:f?.fsPath,__workspaceFolder:f})}}for(let p of a)t.removeDelegate(p);a=l}),e.launch(Ss({...o,type:"node-terminal",name:Km.name,request:"launch",...r}),{dap:s,telemetryReporter:i,cancellationToken:zt,get targetOrigin(){return new Op("<unset>")}})},q3=Symbol("Abort"),j3=(0,H3.homedir)(),ope=process.platform==="win32"?t=>t:t=>t.startsWith(j3)?`~${t.slice(j3.length)}`:t;async function spe(){let t=wt.workspace.workspaceFolders;return!t||t.length<2?t?.[0]:(await wt.window.showQuickPick(t.map(r=>({label:r.name,description:ope(r.uri.fsPath),folder:r})),{placeHolder:W3.t("Select current working directory for new terminal")}))?.folder??q3}var kk=class extends ps{constructor(){super(...arguments);this.optionsReadyEmitter=new j;this.onOptionsReady=this.optionsReadyEmitter.event}createTerminal(r){return this.optionsReadyEmitter.fire(r),new Promise(n=>{let i=wt.window.onDidOpenTerminal(o=>{i.dispose(),n(o)})})}};function $3(t,e,r){let n=new Map,i=(s,a)=>new ps(a,s,r.get(ve),r.get(yi),r.get(nt),r.get(Vo),r.get(au));async function o(s,a,c,u,l=i){if(!c){let f=await spe();if(f===q3)return;c=f}if(a){for(let[f,h]of n)if(h.folder===c&&h.cwd===u?.cwd&&!h.launcher.targetList().length){f.show(!0),f.sendText(a);return}}let p=new xa,d=l(p,new us(p,r.get(ve),Zw,{}));d.onTerminalCreated(f=>{n.set(f,{launcher:d,folder:c,cwd:u?.cwd})});try{await Rk(s,d,{command:a,...u,__workspaceFolder:c?.uri.fsPath},()=>{for(let[f,h]of n)if(h.launcher===d&&f.state.isInteractedWith)return!0;return!1})}catch(f){wt.window.showErrorMessage(f.message)}}t.subscriptions.push(wt.window.onDidCloseTerminal(s=>{n.delete(s)}),be(wt.commands,"extension.js-debug.createDebuggerTerminal",(s,a,c)=>o(e,s,a,c)),wt.window.registerTerminalProfileProvider("extension.js-debug.debugTerminal",{provideTerminalProfile:()=>new Promise(s=>o(e,void 0,void 0,void 0,(a,c)=>{let u=new kk(c,a,r.get(ve),r.get(yi),r.get(nt),r.get(Vo),r.get(au));return u.onOptionsReady(l=>s(new wt.TerminalProfile(l))),u}))}))}function G3(t,e,r){let n=new Map,i,o=s=>{let a=n.get(s);if(a)return a;let c=(async()=>{let u=new xa,l=Xe(or.workspace,"debug.javascript.terminalOptions");if(s){let d=s?.uri.fsPath;l={...l,cwd:d,__workspaceFolder:d}}let p=new bu(new us(u,r.get(ve),Zw,l||{}),u,t,r.get(ve),r.get(yi),r.get(nt));return await Rk(e,p,l),p.onTargetListChanged(()=>{p.targetList().length===0&&!i?i=setTimeout(()=>{n.delete(s),p.terminate()},300*1e3):i&&(clearTimeout(i),i=void 0)}),p})();return n.set(s,c),c};t.subscriptions.push(be(or.commands,"extension.js-debug.setAutoAttachVariables",async()=>{try{return{ipcAddress:(await o(or.workspace.workspaceFolders?.[0])).deferredSocketName}}catch(s){if(s instanceof Bm&&s.helpLink){let a=V3.t("Details");await or.window.showErrorMessage(s.message,a)===a&&or.env.openExternal(or.Uri.parse(s.helpLink))}else await or.window.showErrorMessage(s.message)}}),be(or.commands,"extension.js-debug.autoAttachToProcess",async s=>{try{let a=s.scriptName&&or.workspace.getWorkspaceFolder(or.Uri.file(s.scriptName));(await o(a||or.workspace.workspaceFolders?.[0])).spawnForChild(s)}catch(a){console.error(a),or.window.showErrorMessage(`Error activating auto attach: ${a.stack||a}`)}}),be(or.commands,"extension.js-debug.clearAutoAttachVariables",()=>{bu.clearVariables(t);for(let[s,a]of n.entries())n.delete(s),a.then(c=>c.terminate())}))}var z3=v(ge()),K3=require("url"),pr=v(require("vscode"));var j_=v(require("vscode"));var Yd=class{constructor(){this.tunnels=new Map;this.disposable=new Ce;this.disposable.push(j_.debug.onDidTerminateDebugSession(e=>this.destroySession(e.id)))}dispose(){return this.disposable.dispose()}destroySession(e){let r=this.tunnels.get(e);r&&(r.dispose(),this.tunnels.delete(e))}async request(e,r){let n=this.tunnels.get(e);n||(n=await j_.workspace.openTunnel({remoteAddress:{port:r.remotePort,host:"localhost"},localAddressPort:r.localPort??r.remotePort,label:r.label}),this.tunnels.set(e,n));let i;if(typeof n.localAddress=="string"){let[o,s]=n.localAddress.split(":");i={host:o,port:Number(s)}}else i=n.localAddress;return{remoteAddress:n.remoteAddress,localAddress:i}}};var ape=t=>e=>typeof e.localAddress=="string"?e.localAddress.endsWith(`:${t}`):e.localAddress.port===t,cpe=async t=>{let e=t.params.url;if(!e)return;let r;try{r=new K3.URL(e)}catch{return}if(!Xe(pr.workspace,"debug.javascript.automaticallyTunnelRemoteServer"))return;let n=Number(r.port)||80;if(!(await pr.workspace.tunnels).some(ape(n)))try{await pr.workspace.openTunnel({remoteAddress:{port:n,host:"localhost"},localAddressPort:n})}catch{}},upe=async(t,e,r)=>{if(pr.env.uiKind===pr.UIKind.Web)return pr.debug.stopDebugging(t),pr.window.showErrorMessage(z3.t("We can't launch a browser in debug mode from here. Open this workspace in VS Code on your desktop to enable debugging."));try{let[,n]=await Promise.all([cpe(r),e.request(t.id,{remotePort:r.serverPort,label:"Browser Debug Tunnel"}).catch(()=>{})]);await pr.commands.executeCommand("js-debug-companion.launchAndAttach",{proxyUri:n?`127.0.0.1:${n.localAddress.port}`:`127.0.0.1:${r.serverPort}`,wslInfo:process.env.WSL_DISTRO_NAME&&{execPath:process.execPath,distro:process.env.WSL_DISTRO_NAME,user:process.env.USER},...r})}catch(n){pr.window.showErrorMessage(`Error launching browser: ${n.message||n.stack}`)}},lpe=async(t,e,{launchId:r})=>{await pr.commands.executeCommand("js-debug-companion.kill",{launchId:r}),e.destroySession(t.id)};function J3(t){let e=new Yd;t.subscriptions.push(e,pr.debug.onDidReceiveDebugSessionCustomEvent(async r=>{switch(r.event){case"launchBrowserInCompanion":return upe(r.session,e,r.body);case"killCompanionBrowser":return lpe(r.session,e,r.body);default:}}))}var ye=v(require("vscode")),Qn=require("vscode");var W_=()=>Qn.l10n.t("XHR/Fetch URLs"),X3="jsDebug.focusEmulation.enabled",Qd=class extends ye.TreeItem{get checked(){return this.checkboxState===ye.TreeItemCheckboxState.Checked}constructor(e,r){super(e.match?Qn.l10n.t('URL contains "{0}"',e.match):Qn.l10n.t("Any XHR or fetch"),ye.TreeItemCollapsibleState.None),this.contextValue="xhrBreakpoint",this.id=e.match,this.match=e.match,this.checkboxState=r?ye.TreeItemCheckboxState.Checked:ye.TreeItemCheckboxState.Unchecked}static compare(e,r){return e.match.localeCompare(r.match)}},Fm=class extends ye.TreeItem{constructor(r,n){super(r.title,ye.TreeItemCollapsibleState.None);this.parent=n;this.checkboxState=ye.TreeItemCheckboxState.Unchecked,this.id=r.id,this.group=r.group}get checked(){return this.checkboxState===ye.TreeItemCheckboxState.Checked}static compare(r,n){return r.id.localeCompare(n.id)}},vu=class extends ye.TreeItem{constructor(r){super(r,ye.TreeItemCollapsibleState.Collapsed);this.label=r;this.children=[];this.checkboxState=ye.TreeItemCheckboxState.Unchecked}get checked(){return this.checkboxState===ye.TreeItemCheckboxState.Checked}},Um=class extends ye.TreeItem{get checked(){return this.checkboxState===ye.TreeItemCheckboxState.Checked}constructor(){super(Qn.l10n.t("Browser Breakpoints"),ye.TreeItemCollapsibleState.Collapsed),this.checkboxState=ye.TreeItemCheckboxState.Unchecked,this.id="browserBreakpoints"}},H_=class extends ye.TreeItem{constructor(e){super(Qn.l10n.t("Emulate a focused page"),ye.TreeItemCollapsibleState.None),this.checkboxState=e?ye.TreeItemCheckboxState.Checked:ye.TreeItemCheckboxState.Unchecked,this.tooltip=Qn.l10n.t("When enabled, the debugged page will behave as if it has focus"),this.id="focusEmulation"}},Ak=class{constructor(e,r){this._onDidChangeTreeData=new j;this.onDidChangeTreeData=this._onDidChangeTreeData.event;this._breakpointsRoot=new Um;this.categories=new Map;this.xhrBreakpoints=[];this._emulationSessions=new Set;this._focusEmulationEnabled=!1;this._focusEmulationEnabled=r;for(let i of[...Bl().values()]){let o=this.categories.get(i.group);o||(o=new vu(i.group),this.categories.set(i.group,o)),o.children.push(new Fm(i,o))}let n=new vu(W_());n.contextValue="xhrCategory",n.checkboxState=void 0,this.categories.set(W_(),n),this.xhrBreakpoints=[],this._debugSessionTracker=e,e.onSessionAdded(i=>{if(!$e.isConcreteSession(i))return;let o=this.allBreakpoints.filter(s=>s.checked).map(s=>s.id);o.length>0&&i.customRequest("setCustomBreakpoints",{xhr:this.xhrBreakpoints.filter(s=>s.checkboxState).map(s=>s.id),ids:o}),this._checkEmulationSupport(i)}),e.onSessionEnded(i=>{this._emulationSessions.delete(i.id)&&this._onDidChangeTreeData.fire(void 0)})}get allCategories(){return this.categories.values()}get allBreakpoints(){return[...this.allCategories].flatMap(e=>e.children)}getTreeItem(e){return e}getChildren(e){if(!e){let r=[this._breakpointsRoot];return this._emulationSessions.size>0&&r.unshift(new H_(this._focusEmulationEnabled)),r}if(e instanceof Um)return[...this.categories.values()].sort((r,n)=>r.label.localeCompare(n.label));if(e instanceof vu){if(e.contextValue==="xhrCategory"){let r=Qn.l10n.t("Add new URL..."),n=new ye.TreeItem(r);return n.command={title:r,command:"extension.js-debug.addXHRBreakpoints"},[...this.xhrBreakpoints,n]}return this.categories.get(e.label)?.children}return[]}getParent(e){if(e instanceof vu)return this._breakpointsRoot;if(e instanceof Fm)return this.categories.get(e.group);if(e instanceof Qd)return this.categories.get(W_())}setFocusEmulation(e){this._focusEmulationEnabled=e,this._onFocusEmulationChanged?.(e),this._applyFocusEmulationToAllSessions(),this._onDidChangeTreeData.fire(void 0)}setBreakpointsEnabled(e){for(let[r,n]of e){let i=n?ye.TreeItemCheckboxState.Checked:ye.TreeItemCheckboxState.Unchecked;if(r.checkboxState=i,r instanceof Um){for(let o of this.categories.values()){o.checkboxState=i;for(let s of o.children)s.checkboxState=i}for(let o of this.xhrBreakpoints)o.checkboxState=i;this.syncXHRCategoryState()}else if(r instanceof vu){for(let o of this.getChildren(r))o.checkboxState!==i&&(o.checkboxState=i);this._syncBreakpointsRootState()}else if(r instanceof Fm||r instanceof Qd){let o=this.getParent(r);(!n&&o.checked||n&&this.getChildren(o).every(s=>s.checked||s.checkboxState==null))&&(o.checkboxState=i),this._syncBreakpointsRootState()}}this.updateDebuggersState(),this._onDidChangeTreeData.fire(void 0)}updateDebuggersState(){let e=this.allBreakpoints.filter(n=>n.checked).map(n=>n.id),r=this.xhrBreakpoints.filter(n=>n.checked).map(n=>n.id);for(let n of this._debugSessionTracker.getConcreteSessions())n.customRequest("setCustomBreakpoints",{xhr:r,ids:e})}addXHRBreakpoints(e){this.xhrBreakpoints.some(r=>r.id===e.id)||(this.xhrBreakpoints.push(e),this.updateDebuggersState(),this.syncXHRCategoryState(),this._onDidChangeTreeData.fire(void 0))}removeXHRBreakpoint(e){this.xhrBreakpoints=this.xhrBreakpoints.filter(r=>r!==e),this.updateDebuggersState(),this.syncXHRCategoryState(),this._onDidChangeTreeData.fire(void 0)}syncXHRCategoryState(){let e=this.categories.get(W_());if(e){if(!this.xhrBreakpoints.length){e.checkboxState=void 0;return}e.checkboxState=this.xhrBreakpoints.every(r=>r.checkboxState===ye.TreeItemCheckboxState.Checked)?ye.TreeItemCheckboxState.Checked:ye.TreeItemCheckboxState.Unchecked}}_syncBreakpointsRootState(){let e=[...this.categories.values()].every(r=>r.checked);this._breakpointsRoot.checkboxState=e?ye.TreeItemCheckboxState.Checked:ye.TreeItemCheckboxState.Unchecked}async _checkEmulationSupport(e){try{(await e.customRequest("canEmulate",{})).supported&&(this._emulationSessions.add(e.id),this._onDidChangeTreeData.fire(void 0),this._focusEmulationEnabled&&e.customRequest("setFocusEmulation",{enabled:!0}))}catch{}}_applyFocusEmulationToAllSessions(){for(let e of this._emulationSessions){let r=this._debugSessionTracker.getById(e);r&&r.customRequest("setFocusEmulation",{enabled:this._focusEmulationEnabled})}}};function Y3(t,e){let r=t.workspaceState.get(X3,!1),n=new Ak(e,r);n._onFocusEmulationChanged=o=>t.workspaceState.update(X3,o);let i=ye.window.createTreeView("jsBrowserBreakpoints",{treeDataProvider:n,showCollapseAll:!0,manageCheckboxStateManually:!0});t.subscriptions.push(i.onDidChangeCheckboxState(async o=>{let s=[];for(let[a,c]of o.items){let u=c===ye.TreeItemCheckboxState.Checked;a instanceof H_?n.setFocusEmulation(u):s.push([a,u])}s.length&&n.setBreakpointsEnabled(s)})),t.subscriptions.push(i),t.subscriptions.push(ye.commands.registerCommand("extension.js-debug.addCustomBreakpoints",async()=>{let o=[...n.allCategories].flatMap(c=>[{kind:ye.QuickPickItemKind.Separator,id:"",label:c.label},...c.children.map(u=>({id:u.id,label:`${u.label}`,picked:u.checked}))]),s=await ye.window.showQuickPick(o,{canPickMany:!0,placeHolder:"Select breakpoints to enable"});if(!s)return;let a=new Set(s.map(c=>c.id));n.setBreakpointsEnabled(n.allBreakpoints.map(c=>[c,a.has(c.id)]))})),t.subscriptions.push(ye.commands.registerCommand("extension.js-debug.removeAllCustomBreakpoints",()=>{n.setBreakpointsEnabled([...n.allBreakpoints,...n.xhrBreakpoints].map(o=>[o,!1]))})),t.subscriptions.push(ye.commands.registerCommand("extension.js-debug.addXHRBreakpoints",()=>{let o=ye.window.createInputBox();o.title=Qn.l10n.t("Add XHR Breakpoint"),o.placeholder=Qn.l10n.t("Break when URL Contains"),o.onDidAccept(()=>{let s=o.value;n.addXHRBreakpoints(new Qd({match:s},!0)),o.dispose()}),o.show()})),t.subscriptions.push(ye.commands.registerCommand("extension.js-debug.editXHRBreakpoints",o=>{let s=ye.window.createInputBox();s.title=Qn.l10n.t("Edit XHR Breakpoint"),s.placeholder=Qn.l10n.t("Enter a URL or a pattern to match"),s.value=o.match,s.onDidAccept(()=>{let a=s.value;n.removeXHRBreakpoint(o),n.addXHRBreakpoints(new Qd({match:a},o.checkboxState==ye.TreeItemCheckboxState.Checked)),s.dispose()}),s.show()})),t.subscriptions.push(ye.commands.registerCommand("extension.js-debug.removeXHRBreakpoint",o=>{n.removeXHRBreakpoint(o)}))}var Dk=v(require("vscode"));var Q3=(t,e)=>{let r=e.get(Ua);t.subscriptions.push(be(Dk.commands,"extension.js-debug.startProfile",n=>r.start(typeof n=="string"?{sessionId:n}:n??{})),be(Dk.commands,"extension.js-debug.stopProfile",n=>r.stop(n)))};var q_=v(require("vscode"));var Z3=(t,e)=>{let r=new Yd;t.subscriptions.push(r,be(q_.commands,"extension.js-debug.requestCDPProxy",async(n,i)=>{let o=e.getById(n);if(!o)return;let s=await o.customRequest("requestCDPProxy");if(!i)return s;try{if(q_.env.remoteName!==void 0){let a=await r.request(n,{label:"Edge Devtools Tunnel",remotePort:s.port});return{host:a.localAddress.host,port:a.localAddress.port,path:s.path}}}catch{}return s}))};var eG=v(require("vscode"));var tG=(t,e)=>{t.subscriptions.push(be(eG.commands,"extension.js-debug.revealPage",async r=>{await e.getById(r)?.customRequest("revealPage")}))};var rG=require("url"),jm=v(require("vscode"));async function nG(t){if(!t){let e=jm.window.activeTextEditor;if(!e)return;t=e&&e.document.fileName}if(t&&jm.debug.activeDebugSession){let e;typeof t=="string"?Wr(t)?e={resource:(0,rG.fileURLToPath)(t)}:e={resource:t}:e={sourceReference:t},await jm.debug.activeDebugSession.customRequest("toggleSkipFileStatus",e)}}var Va=v(require("vscode"));var gG=require("fs"),yG=v(require("net"));var iG=`\r
\r
`,ppe=0,Wm=class{constructor(e,r,n){this.inputStream=e;this.outputStream=r;this._contentLength=-1;this._connectionId=ppe++;this.msgEmitter=new j;this.messageReceived=this.msgEmitter.event;this.endedEmitter=new j;this.closed=this.endedEmitter.event;this._handleData=e=>{let r=new Vr;for(this._rawData=Buffer.concat([this._rawData,e]);;){if(this._contentLength>=0){if(this._rawData.length>=this._contentLength){let n=this._rawData.toString("utf8",0,this._contentLength);if(this._rawData=this._rawData.slice(this._contentLength),this._contentLength=-1,n.length>0)try{let i=JSON.parse(n);this.logger?.verbose("dap.receive",void 0,{connectionId:this._connectionId,message:i}),this.msgEmitter.fire({message:i,receivedTime:r})}catch(i){console.error("Error handling data: "+(i&&i.message))}continue}}else{let n=this._rawData.indexOf(iG);if(n!==-1){let o=this._rawData.toString("utf8",0,n).split(`\r
`);for(let s=0;s<o.length;s++){let a=o[s].split(/: +/);a[0]==="Content-Length"&&(this._contentLength=+a[1])}this._rawData=this._rawData.slice(n+iG.length);continue}}break}};this.logger=n,this._rawData=Buffer.alloc(0),e.on("end",()=>this.endedEmitter.fire()),e.on("data",this._handleData)}send(e,r=!0,n){let i=JSON.stringify(e);if(r){let s=e;e.type==="response"&&e.command==="source"&&(s={...e,body:{...e.body,content:"<script source>"}}),this.logger?.verbose("dap.send",void 0,{connectionId:this._connectionId,message:s})}let o=`Content-Length: ${Buffer.byteLength(i,"utf8")}\r
\r
${i}`;if(this.outputStream.destroyed){this.logger?.warn("dap.send","Message not sent. Connection was closed."),n?.();return}this.outputStream.write(o,"utf8",s=>{n?.(),s&&(console.log(e),this.logger?.error("dap.send","Error while writing to output stream",s),this.close())})}close(){this.inputStream.destroy(),this.outputStream.destroy()}setLogger(e){return this.logger=e,this}};var hG=v(ge()),z_=v(require("os"));var dpe={connect:async()=>Us},sG=t=>({async connect(e){return await e.Debugger.setAsyncCallStackDepth({maxDepth:t}),Us}}),fpe=t=>{let e=new j,r=!1,n=()=>{r||(r=!0,e.fire())};return{async connect(i){if(r)return await i.Debugger.setAsyncCallStackDepth({maxDepth:t}),Us;let o=new Ce;return o.push(e.event(()=>{o.dispose(),i.Debugger.setAsyncCallStackDepth({maxDepth:t})}),i.Debugger.on("breakpointResolved",n),i.Debugger.on("paused",s=>{s.reason!=="instrumentation"&&n()})),o}}},oG=sG(32),aG=t=>t===!1?dpe:t===!0?oG:"onAttach"in t?sG(t.onAttach):"onceBreakpointResolved"in t?fpe(t.onceBreakpointResolved):oG;var Zn=v(ge());var Hm=class t{constructor(e,r,n,i){this.asyncStackPolicy=r;this.launchConfig=n;this._services=i;this._disposables=new Ce;this._customBreakpoints=[];this._xhrBreakpoints=[];this._threadDeferred=Ue();this.breakpointIdCounter=zm();this._cdpProxyProvider=this._services.get(qb);this._configurationDoneDeferred=Ue(),this.sourceContainer=i.get(Gt),this.breakpointManager=i.get(On);let o=i.get(Sv),s=i.get(At);s.onFlush(()=>{s.report("breakpointStats",this.breakpointManager.statisticsForTelemetry()),s.report("statistics",this.sourceContainer.statistics())}),this.dap=e,this.dap.on("initialize",a=>this.onInitialize(a)),this.dap.on("setBreakpoints",a=>this._onSetBreakpoints(a)),this.dap.on("setExceptionBreakpoints",a=>this.setExceptionBreakpoints(a)),this.dap.on("configurationDone",()=>this.configurationDone()),this.dap.on("loadedSources",()=>this._onLoadedSources()),this.dap.on("disableSourcemap",a=>this._onDisableSourcemap(a)),this.dap.on("source",a=>this._onSource(a)),this.dap.on("threads",()=>this._onThreads()),this.dap.on("stackTrace",a=>this._withThread(c=>c.stackTrace(a))),this.dap.on("variables",a=>this._onVariables(a)),this.dap.on("readMemory",a=>this._onReadMemory(a)),this.dap.on("writeMemory",a=>this._onWriteMemory(a)),this.dap.on("setVariable",a=>this._onSetVariable(a)),this.dap.on("setExpression",a=>this._onSetExpression(a)),this.dap.on("continue",()=>this._withThread(a=>a.resume())),this.dap.on("pause",()=>this._withThread(a=>a.pause())),this.dap.on("next",()=>this._withThread(a=>a.stepOver())),this.dap.on("stepIn",a=>this._withThread(c=>c.stepInto(a.targetId))),this.dap.on("stepOut",()=>this._withThread(a=>a.stepOut())),this.dap.on("restartFrame",a=>this._withThread(c=>c.restartFrame(a))),this.dap.on("scopes",a=>this._withThread(c=>c.scopes(a))),this.dap.on("evaluate",a=>this.onEvaluate(a)),this.dap.on("completions",a=>this._withThread(c=>c.completions(a))),this.dap.on("exceptionInfo",()=>this._withThread(a=>a.exceptionInfo())),this.dap.on("setCustomBreakpoints",a=>this.setCustomBreakpoints(a)),this.dap.on("toggleSkipFileStatus",a=>this._toggleSkipFileStatus(a)),this.dap.on("toggleSkipFileStatus",a=>this._toggleSkipFileStatus(a)),this.dap.on("prettyPrintSource",a=>this._prettyPrintSource(a)),this.dap.on("locations",a=>this._onLocations(a)),this.dap.on("revealPage",()=>this._withThread(a=>a.revealPage())),this.dap.on("getPerformance",()=>this._withThread(a=>o.retrieve(a.cdp()))),this.dap.on("breakpointLocations",a=>this._breakpointLocations(a)),this.dap.on("createDiagnostics",a=>this._dumpDiagnostics(a)),this.dap.on("requestCDPProxy",()=>this._requestCDPProxy()),this.dap.on("setExcludedCallers",a=>this._onSetExcludedCallers(a)),this.dap.on("saveDiagnosticLogs",({toFile:a})=>this._saveDiagnosticLogs(a)),this.dap.on("setSourceMapStepping",a=>this._setSourceMapStepping(a)),this.dap.on("stepInTargets",a=>this._stepInTargets(a)),this.dap.on("setDebuggerProperty",a=>this._setDebuggerProperty(a)),this.dap.on("setSymbolOptions",a=>this._setSymbolOptions(a)),this.dap.on("networkCall",a=>this._doNetworkCall(a)),this.dap.on("enableNetworking",a=>this._withThread(c=>c.enableNetworking(a))),this.dap.on("canEmulate",()=>this._canEmulate()),this.dap.on("setFocusEmulation",a=>this._setFocusEmulation(a)),this.dap.on("getPreferredUILocation",a=>this._getPreferredUILocation(a))}async _getPreferredUILocation(e){let r;if(e.originalUrl&&(r=this.sourceContainer.getSourceByOriginalUrl(e.originalUrl)),!r&&e.source&&(r=this.sourceContainer.source(e.source)),!r){if(e.source)return{column:e.column,line:e.line,source:e.source};throw new q(_O())}let n=await this.sourceContainer.preferredUiLocation({columnNumber:e.column+1,lineNumber:e.line+1,source:r});return{column:n.columnNumber-1,line:n.lineNumber-1,source:await n.source.toDap()}}async _doNetworkCall({method:e,params:r}){return this._thread?this._thread.cdp().Network[e](r):Promise.resolve({})}async _canEmulate(){let r=(await this._threadDeferred.promise).cdp();if(this._emulationSupported===void 0){let n=await r.Schema.getDomains({});this._emulationSupported=n?.domains.some(i=>i.name==="Emulation")??!1}return{supported:this._emulationSupported}}async _setFocusEmulation(e){return await(await this._threadDeferred.promise).cdp().Emulation.setFocusEmulationEnabled({enabled:e.enabled}),{}}_setDebuggerProperty(e){return this._thread?.cdp().DotnetDebugger.setDebuggerProperty(e),Promise.resolve({})}_setSymbolOptions(e){return this._thread?.cdp().DotnetDebugger.setSymbolOptions(e),Promise.resolve({})}_breakpointLocations(e){return this._withThread(async r=>{let n=this.sourceContainer.source(e.source);return n?{breakpoints:(await this.breakpointManager.getBreakpointLocations(r,n,new ct(e.line,e.column||1),new ct(e.endLine||e.line+1,e.endColumn||e.column||1))).map(o=>o.uiLocations.find(s=>s.source===n)).filter(at).map(o=>({line:o.lineNumber,column:o.columnNumber}))}:{breakpoints:[]}})}_stepInTargets(e){return this._withThread(async r=>({targets:await r.getStepInTargets(e.frameId)}))}_setSourceMapStepping({enabled:e}){return this.sourceContainer.doSourceMappedStepping=e,Promise.resolve({})}async _saveDiagnosticLogs(e){let r=this._services.get(Y).getRecentLogs();return await this._services.get(ve).writeFile(e,r.map(n=>JSON.stringify(n)).join(`
`)),{}}async launchBlocker(){await this._configurationDoneDeferred.promise,await this._thread?.debuggerReady.promise,await this._services.get(Vl).launchBlocker,await this.breakpointManager.launchBlocker()}async _onSetExcludedCallers({callers:e}){return(await this._threadDeferred.promise).setExcludedCallers(e),{}}async onInitialize(e){console.assert(e.linesStartAt1),console.assert(e.columnsStartAt1),this._services.get(rh).value=e;let r=t.capabilities(!0);return setTimeout(()=>this.dap.initialized({}),0),setTimeout(()=>this._thread?.dapInitialized(),0),r}static capabilities(e=!1){return{supportsConfigurationDoneRequest:!0,supportsFunctionBreakpoints:!1,supportsConditionalBreakpoints:!0,supportsHitConditionalBreakpoints:!0,supportsEvaluateForHovers:!0,supportsReadMemoryRequest:!0,supportsWriteMemoryRequest:!0,exceptionBreakpointFilters:[{filter:"all",label:Zn.t("Caught Exceptions"),default:!1,supportsCondition:!0,description:Zn.t("Breaks on all throw errors, even if they're caught later."),conditionDescription:'error.name == "MyError"'},{filter:"uncaught",label:Zn.t("Uncaught Exceptions"),default:!1,supportsCondition:!0,description:Zn.t("Breaks only on errors or promise rejections that are not handled."),conditionDescription:'error.name == "MyError"'}],supportsStepBack:!1,supportsSetVariable:!0,supportsRestartFrame:!0,supportsGotoTargetsRequest:!1,supportsStepInTargetsRequest:!0,supportsCompletionsRequest:!0,supportsModulesRequest:!1,additionalModuleColumns:[],supportedChecksumAlgorithms:[],supportsRestartRequest:!0,supportsExceptionOptions:!1,supportsValueFormattingOptions:!0,supportsExceptionInfoRequest:!0,supportTerminateDebuggee:!0,supportsDelayedStackTraceLoading:!0,supportsLoadedSourcesRequest:!0,supportsLogPoints:!0,supportsTerminateThreadsRequest:!1,supportsSetExpression:!0,supportsTerminateRequest:!1,completionTriggerCharacters:[".","[",'"',"'"],supportsBreakpointLocationsRequest:!0,supportsClipboardContext:!0,supportsExceptionFilterOptions:!0,supportsEvaluationOptions:!!e,supportsDebuggerProperties:!!e,supportsSetSymbolOptions:!!e,supportsANSIStyling:!0}}async _onSetBreakpoints(e){return this.breakpointManager.setBreakpoints(e,e.breakpoints?.map(()=>this.breakpointIdCounter())??[])}async setExceptionBreakpoints(e){return await this._services.get(Vl).setBreakpoints(e),{}}async configurationDone(){return this._configurationDoneDeferred.resolve(),{}}async _onLoadedSources(){return{sources:await this.sourceContainer.loadedSources()}}async _onDisableSourcemap(e){let r=this.sourceContainer.source(e.source);if(!r)return Ve(Zn.t("Source not found"));if(!(r instanceof Ct))return Ve(Zn.t("Source not a source map"));for(let n of r.compiledToSourceUrl.keys())this.sourceContainer.disableSourceMapForSource(n,!0);return await this._thread?.refreshStackTrace(),{}}async _onSource(e){e.source||(e.source={sourceReference:e.sourceReference}),e.source.path=jo(e.source.path);let r=this.sourceContainer.source(e.source);if(!r)return Ve(Zn.t("Source not found"));let n=await r.content();return n===void 0?(r instanceof Ct&&this.dap.suggestDisableSourcemap({source:e.source}),Ve(Zn.t("Unable to retrieve source content"))):{content:n,mimeType:r.getSuggestedMimeType}}async _onThreads(){let e=[];return this._thread&&e.push({id:this._thread.id,name:this._thread.name()}),{threads:e}}findVariableStore(e){if(!this._thread)return;let r=this._thread.pausedVariables();if(r&&e(r))return r;if(e(this._thread.replVariables))return this._thread.replVariables}async _onLocations(e){let r=this.findVariableStore(o=>o.hasVariable(e.locationReference));if(!r||!this._thread)throw Ef();let n=await r.getLocations(e.locationReference),i=await this._thread.rawLocationToUiLocationWithWaiting(this._thread.rawLocation(n));if(!i)throw Ef();return{source:await i.source.toDap(),line:i.lineNumber,column:i.columnNumber}}async _onVariables(e){return{variables:await this.findVariableStore(n=>n.hasVariable(e.variablesReference))?.getVariables(e)??[]}}async _onReadMemory(e){let r=e.memoryReference,n=await this.findVariableStore(i=>i.hasMemory(r))?.readMemory(r,e.offset??0,e.count);return n?{address:"0",data:n.toString("base64"),unreadableBytes:e.count-n.length}:{address:"0",unreadableBytes:e.count}}async _onWriteMemory(e){let r=e.memoryReference;return{bytesWritten:await this.findVariableStore(i=>i.hasMemory(r))?.writeMemory(r,e.offset??0,Buffer.from(e.data,"base64"))}}async _onSetExpression(e){if(!this._thread)throw new q(jI());let r=await this._thread.evaluate({expression:`${e.expression} = ${Rf(e.value)}`,context:"repl",frameId:e.frameId});return{value:r.result,variablesReference:r.variablesReference,indexedVariables:r.indexedVariables,namedVariables:r.namedVariables,presentationHint:r.presentationHint,type:r.type,memoryReference:r.memoryReference,valueLocationReference:r.valueLocationReference}}async _onSetVariable(e){let r=this.findVariableStore(n=>n.hasVariable(e.variablesReference));return r?(e.value=Rf(e.value.trim()),r.setVariable(e)):Ve(Zn.t("Variable not found"))}_withThread(e){if(!this._thread)throw new q(jI());return e(this._thread)}async _refreshStackTrace(){if(!this._thread)return;this._thread.pausedDetails()&&await this._thread.refreshStackTrace()}createThread(e,r){this._thread=new jl(this.sourceContainer,e,this.dap,r,this._services.get(Bs),this._services.get(Y),this._services.get(kn),this._services.get($b),this.launchConfig,this.breakpointManager,this._services.get(hv),this._services.get(Vl),this._services.get(zs),this._services.get(Qs),this._services.get(rh));let n=this._services.get(Pv);return n.connect(this.dap,this._thread),"profileStartup"in this.launchConfig&&this.launchConfig.profileStartup&&n.start(this.dap,this._thread,{type:Xt.type}),this._thread.updateCustomBreakpoints(this._xhrBreakpoints,this._customBreakpoints),this.asyncStackPolicy.connect(e).then(i=>this._disposables.push(i)).catch(i=>this._services.get(Y).error("internal","Error enabling async stacks",i)),this.breakpointManager.setThread(this._thread),this._services.get(pt).attach(e),this._threadDeferred.resolve(this._thread),this._thread}async setCustomBreakpoints({ids:e,xhr:r}){return await this._thread?.updateCustomBreakpoints(r,e),this._customBreakpoints=e,this._xhrBreakpoints=r,{}}async _toggleSkipFileStatus(e){return await this._services.get(js).toggleSkippingFile(e),await this._refreshStackTrace(),{}}async _prettyPrintSource(e){if(!e.source||!this._thread)return{};e.source.path=jo(e.source.path);let r=this.sourceContainer.source(e.source);if(!r)return Ve(Zn.t("Source not found"));let n=await r.prettyPrint();if(!n)return Ve(Zn.t("Unable to pretty print"));let{map:i,source:o}=n;await this.breakpointManager.moveBreakpoints(this._thread,r,i,o),this.sourceContainer.clearDisabledSourceMaps(r);let s=!!this._thread.pausedDetails();return await this._refreshStackTrace(),{source:await o.toDap(),didReveal:s}}onEvaluate(e){return e.expression===".scripts"?this._dumpDiagnostics({fromSuggestion:!1}).then(this.dap.openDiagnosticTool).then(()=>({result:"Opening diagnostic tool...",variablesReference:0})):this._withThread(r=>r.evaluate(e))}async _dumpDiagnostics(e){let r={file:await this._services.get(Zs).generateHtml()};return e.fromSuggestion&&this._services.get(At).report("diagnosticPrompt",{event:"opened"}),r}async _requestCDPProxy(){return await this._cdpProxyProvider.proxy()}dispose(){this._disposables.dispose(),vb(this._services)}};var cG=require("fs"),uG=require("inspector"),$_=class{constructor(e){this.file=e;this.session=new uG.Session;this.session.connect()}async start(){try{await this.post("Profiler.enable")}catch{}await this.post("Profiler.start")}async stop(){let{profile:e}=await this.post("Profiler.stop");await cG.promises.writeFile(this.file,JSON.stringify(e))}dispose(){this.session.disconnect()}post(e,r){return new Promise((n,i)=>this.session.post(e,r,(o,s)=>{o?i(o):n(s)}))}};var V_=v(require("path"));function pG(t,e,r){let n=lG(t,e,"uncaughtException",r),i=lG(t,e,"unhandledRejection",r);return process.addListener("uncaughtException",n),process.addListener("unhandledRejection",i),{dispose:()=>{process.removeListener("uncaughtException",n),process.removeListener("unhandledRejection",i)}}}var lG=(t,e,r,n=!0)=>i=>{gpe(i)&&(e.report("error",{"!error":i,error:n?void 0:i,exceptionType:r}),t.error("runtime.exception","Unhandled error in debug adapter",i))},hpe=t=>typeof t=="object"&&!!t&&"stack"in t,mpe=V_.dirname(V_.dirname(V_.dirname(__dirname)));function gpe(t){return!dG||hpe(t)&&!!t.stack?.includes(mpe)}var dG=!1;function fG(){dG=!0}var G_=class{constructor(e,r,n,i){this._delegate=e;this._rootServices=n;this._disposables=new Ce;this._serviceTree=new WeakMap;this._root=new wu(void 0);this.getLaunchers=me(()=>{let e=new Set(this._rootServices.getAll(jt));for(let r of e)this._disposables.push(r.onTargetListChanged(()=>{let n=this.targetList();this._attachToNewTargets(n,r),this._terminateOrphanThreads(n)}));return e});this._dap=r.dap(),this._targetOrigin=i,this._disposables.callback(()=>vb(n)),this._disposables.push(pG(n.get(Y),n.get(At),n.get(bc))),r.attachTelemetry(n.get(At));let o=this._dap,s=0,a;o.on("initialize",async c=>{this._rootServices.bind(qr).toConstantValue(c);let u=Hm.capabilities();return c.clientID==="vscode"&&fG(),setTimeout(()=>o.initialized({}),0),u}),o.on("setExceptionBreakpoints",async()=>({})),o.on("setBreakpoints",async c=>(c.breakpoints?.length&&n.get(pt).notifyHadBreakpoint(),{breakpoints:c.breakpoints?.map(()=>({id:++s,verified:!1,message:hG.t("Unbound breakpoint")}))??[]})),o.on("configurationDone",async()=>({})),o.on("threads",async()=>({threads:[]})),o.on("loadedSources",async()=>({sources:[]})),o.on("breakpointLocations",()=>Promise.resolve({breakpoints:[]})),o.on("attach",async c=>(await this.boot(c,o),{})),o.on("launch",async c=>(await this.boot(c,o),{})),o.on("pause",async()=>({})),o.on("terminate",()=>this._terminateRoot(!0)),o.on("disconnect",c=>this._disconnectRoot(c)),o.on("restart",async({arguments:c})=>(await this._restart(c),{})),o.on("startSelfProfile",async({file:c})=>(a?.dispose(),a=new $_(c),await a.start(),{})),o.on("stopSelfProfile",async()=>(a&&(await a.stop(),a.dispose(),a=void 0),{})),o.on("enableNetworking",()=>Promise.resolve({}))}async _terminateRoot(e){return this._root.state=1,await Promise.all([...this.getLaunchers()].map(r=>r.terminate(e))),await this._root.waitUntilChildrenAre(2),this._root.state=2,{}}async _disconnectRoot(e){return this._root.state<1&&await this._terminateRoot(e.terminateDebuggee),this._rootServices.get(At).flush(),await this._root.waitUntilChildrenAre(3),this._root.state=3,{}}async boot(e,r){return this._boot(Ss(e,this._rootServices.get(ui)),r)}async _boot(e,r){ype(r),this.reportBootTelemetry(e),B3(this._rootServices,e,r),this._rootServices.get(Y).setup(L1(r,e.trace));let n=e.timeout>0?Ft.withTimeout(e.timeout):new Ft;e.rootPath&&(e.rootPath=jo(e.rootPath)),this._launchParams=e;let i=await Promise.all([...this.getLaunchers()].map(o=>this._launch(o,e,n.token)));return Promise.all(i.map(o=>o.terminated)).then(o=>{let s=o.find(at);this._markTargetAsTerminated(this._root,{restart:!!s?.restart})}),{}}reportBootTelemetry(e){let r=Ss({type:e.type,request:e.request,name:"<string>",__workspaceFolder:"<workspace>"}),n=(i,o)=>typeof i=="string"?o&&r[o]===i?i:"<string>":i instanceof Array?i.map(s=>n(s)):i&&typeof i=="object"?ko(i,s=>n(s)):i;this._rootServices.get(At).report("launch",{type:e.type,request:e.request,os:`${z_.platform()} ${z_.arch()}`,nodeVersion:process.version,adapterVersion:za,parameters:ko(e,n)})}async _restart(e){let r;if(e){let n=this._rootServices.get(Oh);r=Ss({__workspaceFolder:n.__workspaceFolder,...e},this._rootServices.get(ui)),n.update(r)}await Promise.all([...this.getLaunchers()].map(n=>n.restart(r)))}async _launch(e,r,n){return(await this.captureLaunch(e,r,n)).blockSessionTermination?{terminated:new Promise(o=>{let s=this._disposables.push(e.onTerminated(a=>{s.dispose(),o(a)}))})}:{terminated:Promise.resolve(void 0)}}async captureLaunch(e,r,n){let i=e.constructor.name,o;try{o=await e.launch(r,{telemetryReporter:this._rootServices.get(At),cancellationToken:n,targetOrigin:this._targetOrigin,dap:this._dap})}catch(s){throw this._rootServices.get(Y).warn("runtime.launch","Launch returned error",{error:s,wasCancelled:n.isCancellationRequested,name:i}),s}return o.blockSessionTermination&&this._rootServices.get(Y).info("runtime.launch","Launched successfully",{name:i}),o}dispose(){this._disposables.dispose(),this._terminateOrphanThreads([])}targetList(){let e=[];for(let r of this.getLaunchers())e.push(...r.targetList());return e}async attach(e,r){if(!this._launchParams)throw new Error("Cannot launch before params have been set");let n=e.value;if(!n.canAttach())return;let i=await n.attach();if(!i)return;let o=await this._delegate.acquireDap(n),s=o.dap(),a=this._launchParams;this._asyncStackPolicy||(this._asyncStackPolicy=aG(a.showAsyncStacks));let c=n.parent(),u=c&&this._serviceTree.get(c)||this._rootServices,l=L3(u,n,s,i);o.attachTelemetry(l.get(At)),this._serviceTree.set(n,u);let p=new Hm(s,this._asyncStackPolicy,a,l),d=p.createThread(i,n);"inspectUri"in a&&a.inspectUri&&this.attachDotnetDebuggerEvent(i,this._rootServices.get(At),this._rootServices.get(bc));let h=async()=>(await p.launchBlocker(),n.runIfWaitingForDebugger(),e.threadData.resolve({thread:d,debugAdapter:p}),{});s.on("disconnect",m=>this._disconnectTarget(e,m)),s.on("terminate",()=>this._terminateTarget(e)),s.on("restart",async()=>(n.canRestart()?n.restart():await this._restart(),Promise.resolve({}))),await this._delegate.initAdapter(p,n,r)?h():(s.on("attach",h),s.on("launch",h)),await n.afterBind()}attachDotnetDebuggerEvent(e,r,n){e.DotnetDebugger.on("reportBlazorDebugException",i=>{r.report("blazorDebugException",{exceptionType:i.exceptionType,"!error":i.exception,error:n?void 0:i.exception})})}_attachToNewTargets(e,r){for(let n of e.values()){if(!n.waitingForDebugger()||wu.targetNodes.has(n))continue;let i=n.parent(),o=i?wu.targetNodes.get(i):this._root;if(!o)throw new Error(`Got target with unknown parent: ${n.name()}`);let s=new wu(n);o.add(s),this.attach(s,r)}}async _terminateOrphanThreads(e,r){let n=[...this._root.all()].filter(i=>!e.includes(i.value));return Promise.all(n.map(i=>this._markTargetAsTerminated(i,r)))}async _markTargetAsTerminated(e,r={}){if(e.state>=1)return await e.waitUntil(2),{};if(e.state=1,mG(e)){let n=await e.threadData.promise;await n.thread.dispose(),n.debugAdapter.dap.terminated(r),n.debugAdapter.dispose()}else this._dap.terminated(r);return await e.waitUntilChildrenAre(2),e.state=2,{}}async _terminateTarget(e){return e.state>=3?{}:(e.value.canStop()?e.value.stop():this._terminateRoot(!0),await e.waitUntil(2),{})}async _disconnectTarget(e,r){if(e.state>=3)return{};e.state<1&&(r.terminateDebuggee!==!0&&e.value.canDetach()?await e.value.detach():e.value.canStop()?e.value.stop():this._terminateRoot(r.terminateDebuggee)),await e.waitUntil(2),await e.waitUntilChildrenAre(3),e.state=3,queueMicrotask(()=>this._delegate.releaseDap(e.value));let n=e.value.parent();return(n?wu.targetNodes.get(n):this._root)?.remove(e),{}}};function ype(t){eg&&t.output({category:"console",output:`Note: Using the "preview" debug extension
`})}var mG=t=>!!t.value,wu=class t{constructor(e){this.value=e;this.threadData=Ue();this._state=0;this._children=new Set;this._stateChangeEmitter=new j;e&&t.targetNodes.set(e,this)}static{this.targetNodes=new WeakMap}get state(){return this._state}set state(e){e>this._state&&(this._state=e,this._stateChangeEmitter.fire(e))}add(e){this._children.add(e)}remove(e){this._children.delete(e)}async waitUntil(e){return this._state>=e?Promise.resolve():new Promise(r=>{let n=this._stateChangeEmitter.event(i=>{i>=e&&(n.dispose(),r())})})}async waitUntilChildrenAre(e){await Promise.all([...this._children].map(r=>r.waitUntil(e)))}*all(){mG(this)&&(yield this);for(let e of this._children)yield*e.all()}};var K_=class{constructor(e,r,n,i,o){this.debugSession=e;this.logger=n;this.sessionStates=i;this.parent=o;this.subscriptions=new Ce;r instanceof Hu?this.connection=r:(r.setLogger(n),this.connection=new Hu(r,this.logger))}listenToTarget(e){this.subscriptions.push(e.onNameChanged(()=>this.setName(e)),this.sessionStates.onAdd(([r])=>r===this.debugSession.id&&this.setName(e)),this.sessionStates.onRemove(([r])=>r===this.debugSession.id&&this.setName(e))),this.setName(e)}dispose(){this.subscriptions.dispose()}setName(e){let r=this.sessionStates.get(this.debugSession.id),n=e.name();this.parent instanceof Zd&&(n=`${n} \xAB ${this.parent.debugSession.name}`),this.debugSession.name=r?`${n} (${r})`:n}},Zd=class extends K_{constructor(r,n,i){super(r,n,i.get(Y),i.get(yl));this.debugSession=r;this.services=i;this.connection.attachTelemetry(i.get(At))}get binder(){return this._binder}createBinder(r){this._binder=new G_(r,this.connection,this.services,new Gw(this.debugSession.id))}dispose(){super.dispose(),this._binder?.dispose?.()}},J_=class{constructor(e,r){this.globalContainer=e;this.sessionLauncher=r;this._disposables=[];this._sessions=new Map;this._pendingTarget=new Map;this._sessionForTarget=new Map;this._sessionForTargetCallbacks=new Map}terminate(e){let r=this._sessions.get(e.id);this._sessions.delete(e.id),r&&r.dispose()}hasPendingTargetId(e){return this._pendingTarget.has(e)}createNewRootSession(e,r){let n=new Zd(e,r,N3(this.globalContainer));return n.createBinder(this),this._sessions.set(e.id,n),n}createNewChildSession(e,r,n){let i=this._pendingTarget.get(r);if(!i)throw new Error(`Cannot find target ${r}`);let{target:o,parent:s}=i,a=new K_(e,n,s.logger,s.sessionStates,s);this._pendingTarget.delete(r),a.debugSession.name=o.name(),a.listenToTarget(o);let c=this._sessionForTargetCallbacks.get(o);return this._sessionForTargetCallbacks.delete(o),c?.fulfill?.(a),this._sessions.set(e.id,a),a}async acquireDap(e){return(await this.getOrLaunchSession(e)).connection}getOrLaunchSession(e){let r=this._sessionForTarget.get(e);if(r)return r;let n=new Promise(async(i,o)=>{let s,a=e.parent();if(a?s=await this.getOrLaunchSession(a):s=this._sessions.get(e.targetOrigin().id),!s)throw new Error("Expected to get a parent debug session for target");this._pendingTarget.set(e.id(),{target:e,parent:s}),this._sessionForTargetCallbacks.set(e,{fulfill:i,reject:o});let c=s.debugSession.configuration,u={type:c.type==="pwa-extensionHost"?"pwa-chrome":c.type,name:e.name(),request:s.debugSession.configuration.request,__pendingTargetId:e.id(),internalConsoleOptions:c.internalConsoleOptions,preRestartTask:c.preRestartTask??c.postDebugTask,postRestartTask:c.postRestartTask??c.preLaunchTask};this.sessionLauncher.launch(s,e,u)});return this._sessionForTarget.set(e,n),n}initAdapter(e,r,n){return Promise.resolve(!1)}releaseDap(e){this._sessionForTarget.delete(e);let r=this._sessionForTargetCallbacks.get(e);r&&r.reject(new Error("Target gone")),this._sessionForTargetCallbacks.delete(e)}dispose(){for(let e of this._sessions.values())e.dispose();this._sessions.clear(),this._pendingTarget.clear(),this._sessionForTarget.clear(),this._sessionForTargetCallbacks.clear();for(let e of this._disposables)e.dispose();this._disposables=[]}};var X_=class{constructor(e,r,n="127.0.0.1"){this.host=n;this.disposables=[];this.servers=new Map;this.sessionManager=new J_(e,r),this.portLeaseTracker=e.get(nt),this.disposables.push(this.sessionManager)}createDebugServer(e,r){return e.configuration.__pendingTargetId?this.createChildDebugServer(e):this.createRootDebugServer(e,r)}createRootDebugServer(e,r){return this.innerCreateServer(e,n=>this.sessionManager.createNewRootSession(e,n),r)}createRootDebugSessionFromStreams(e,r,n){let i=new Wm(r,n);return this.sessionManager.createNewRootSession(e,i)}createChildDebugServer(e,r){return this.innerCreateServer(e,n=>this.sessionManager.createNewChildSession(e,e.configuration.__pendingTargetId,n),r)}async innerCreateServer(e,r,n){let i=Ue(),o=a=>{let c=new Wm(a,a),u=r(c);i.resolve(u.connection)},s=n===void 0?await new Promise((a,c)=>{let u=oy(),l=yG.createServer(o).on("error",c).on("close",()=>gG.promises.unlink(u).catch(()=>{})).listen(u,()=>a(l))}):await LB(this.portLeaseTracker,o,n,this.host);return this.servers.set(e.id,s),{server:s,connectionPromise:i.promise}}terminate(e){this.sessionManager.terminate(e),this.servers.get(e.id)?.close(),this.servers.delete(e.id)}dispose(){this.sessionManager.dispose()}};var Ok=class{launch(e,r,n){Va.debug.startDebugging(e.debugSession.workspaceFolder,{...n,...r.supplementalConfig,serverReadyAction:e.debugSession.configuration.serverReadyAction,__parentId:e.debugSession.id},{parentSession:e.debugSession,consoleMode:Va.DebugConsoleMode.MergeWithParent,noDebug:e.debugSession.configuration.noDebug,compact:e instanceof Zd,lifecycleManagedByParent:!r.independentLifeycle})}},Y_=class{constructor(e){this.sessionServerManager=new X_(e,new Ok)}async createDebugAdapterDescriptor(e){let r=process.env.JS_DEBUG_USE_LOCAL_DAP_PORT;if(r)return new Va.DebugAdapterServer(+r);let n=await this.sessionServerManager.createDebugServer(e);return new Va.DebugAdapterNamedPipeServer(n.server.address())}terminate(e){this.sessionServerManager.terminate(e)}dispose(){this.sessionServerManager.dispose()}};function bpe(t){St.l10n.bundle&&bG.config({contents:St.l10n.bundle});let e=M3({storagePath:process.platform==="win32"?(0,vG.tmpdir)():t.storagePath||t.extensionPath,isVsCode:!0,isRemote:!!process.env.JS_DEBUG_USE_COMPANION||St.extensions.getExtension(eR)?.extensionKind===St.ExtensionKind.Workspace,context:t});t.subscriptions.push(be(St.commands,"extension.js-debug.npmScript",x5),be(St.commands,"extension.js-debug.pickNodeProcess",async()=>{let s=await T0();if(!s)throw new St.CancellationError;return s}),be(St.commands,"extension.pwa-node-debug.attachNodeProcess",u5),be(St.commands,"extension.js-debug.toggleSkippingFile",nG));let r=e.getAll(kS);for(let s of r){let a=s;t.subscriptions.push(St.debug.registerDebugConfigurationProvider(s.type,a));let c=nf.get(s.type);c&&t.subscriptions.push(St.debug.registerDebugConfigurationProvider(c,a))}let n=e.getAll(RS);for(let s of n)St.debug.registerDebugConfigurationProvider(s.type,s,St.DebugConfigurationProviderTriggerKind!==void 0?s.triggerKind:void 0);let i=new Y_(e);t.subscriptions.push(...[...nx].map(s=>St.debug.registerDebugAdapterDescriptorFactory(s,i))),t.subscriptions.push(St.debug.onDidTerminateDebugSession(s=>i.terminate(s))),t.subscriptions.push(i);let o=e.get($e);return o.attach(),J3(t),Y3(t,o),$3(t,e.get(vo),e),Q3(t,e),G3(t,e.get(vo),e),tG(t,o),Z3(t,o),e.getAll(_r).forEach(s=>s.register(t)),e.get(Fa).create()}function vpe(){}0&&(module.exports={activate,deactivate});
/*! Bundled license information:

reflect-metadata/Reflect.js:
  (*! *****************************************************************************
  Copyright (C) Microsoft. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** *)

is-number/index.js:
  (*!
   * is-number <https://github.com/jonschlinkert/is-number>
   *
   * Copyright (c) 2014-present, Jon Schlinkert.
   * Released under the MIT License.
   *)

to-regex-range/index.js:
  (*!
   * to-regex-range <https://github.com/micromatch/to-regex-range>
   *
   * Copyright (c) 2015-present, Jon Schlinkert.
   * Released under the MIT License.
   *)

fill-range/index.js:
  (*!
   * fill-range <https://github.com/jonschlinkert/fill-range>
   *
   * Copyright (c) 2014-present, Jon Schlinkert.
   * Licensed under the MIT License.
   *)

normalize-path/index.js:
  (*!
   * normalize-path <https://github.com/jonschlinkert/normalize-path>
   *
   * Copyright (c) 2014-2018, Jon Schlinkert.
   * Released under the MIT License.
   *)

is-extglob/index.js:
  (*!
   * is-extglob <https://github.com/jonschlinkert/is-extglob>
   *
   * Copyright (c) 2014-2016, Jon Schlinkert.
   * Licensed under the MIT License.
   *)

is-glob/index.js:
  (*!
   * is-glob <https://github.com/jonschlinkert/is-glob>
   *
   * Copyright (c) 2014-2017, Jon Schlinkert.
   * Released under the MIT License.
   *)

is-windows/index.js:
  (*!
   * is-windows <https://github.com/jonschlinkert/is-windows>
   *
   * Copyright © 2015-2018, Jon Schlinkert.
   * Released under the MIT License.
   *)

keyv/dist/index.js:
  (* v8 ignore next -- @preserve *)

cacheable-request/dist/index.js:
  (* c8 ignore next -- @preserve *)
  (* v8 ignore next -- @preserve *)
*/
//# sourceMappingURL=extension.js.map