tshy 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/bin-min.mjs +13 -13
- package/dist/esm/bin-min.mjs.map +4 -4
- package/dist/esm/built-imports.d.ts +1 -1
- package/dist/esm/exports.d.ts +1 -1
- package/dist/esm/exports.d.ts.map +1 -1
- package/dist/esm/exports.js.map +1 -1
- package/dist/esm/unbuilt-imports.d.ts.map +1 -1
- package/dist/esm/unbuilt-imports.js +3 -1
- package/dist/esm/unbuilt-imports.js.map +1 -1
- package/dist/esm/valid-exports.d.ts +1 -1
- package/dist/esm/which-tsc.d.ts.map +1 -1
- package/dist/esm/which-tsc.js +6 -2
- package/dist/esm/which-tsc.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/bin-min.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var Fn=(e=0)=>t=>`\x1B[${t+e}m`,Dn=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Mn=(e=0)=>(t,s,i)=>`\x1B[${38+e};2;${t};${s};${i}m`,A={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},N0=Object.keys(A.modifier),jf=Object.keys(A.color),Nf=Object.keys(A.bgColor),F0=[...jf,...Nf];function Ff(){let e=new Map;for(let[t,s]of Object.entries(A)){for(let[i,r]of Object.entries(s))A[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=A[i],e.set(r[0],r[1]);Object.defineProperty(A,t,{value:s,enumerable:!1})}return Object.defineProperty(A,"codes",{value:e,enumerable:!1}),A.color.close="\x1B[39m",A.bgColor.close="\x1B[49m",A.color.ansi=Fn(),A.color.ansi256=Dn(),A.color.ansi16m=Mn(),A.bgColor.ansi=Fn(10),A.bgColor.ansi256=Dn(10),A.bgColor.ansi16m=Mn(10),Object.defineProperties(A,{rgbToAnsi256:{value(t,s,i){return t===s&&s===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[i]=s;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>A.rgbToAnsi256(...A.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,i,r;if(t>=232)s=((t-232)*10+8)/255,i=s,r=s;else{t-=16;let a=t%36;s=Math.floor(t/36)/5,i=Math.floor(a/6)/5,r=a%6/5}let o=Math.max(s,i,r)*2;if(o===0)return 30;let n=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(s));return o===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(t,s,i)=>A.ansi256ToAnsi(A.rgbToAnsi256(t,s,i)),enumerable:!1},hexToAnsi:{value:t=>A.ansi256ToAnsi(A.hexToAnsi256(t)),enumerable:!1}}),A}var Df=Ff(),Pt=Df;import Lr from"node:process";import Mf from"node:os";import Ln from"node:tty";function bt(e,t=globalThis.Deno?globalThis.Deno.args:Lr.argv){let s=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(s+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:C}=Lr,ni;bt("no-color")||bt("no-colors")||bt("color=false")||bt("color=never")?ni=0:(bt("color")||bt("colors")||bt("color=true")||bt("color=always"))&&(ni=1);function Lf(){if("FORCE_COLOR"in C)return C.FORCE_COLOR==="true"?1:C.FORCE_COLOR==="false"?0:C.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(C.FORCE_COLOR,10),3)}function $f(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function If(e,{streamIsTTY:t,sniffFlags:s=!0}={}){let i=Lf();i!==void 0&&(ni=i);let r=s?ni:i;if(r===0)return 0;if(s){if(bt("color=16m")||bt("color=full")||bt("color=truecolor"))return 3;if(bt("color=256"))return 2}if("TF_BUILD"in C&&"AGENT_NAME"in C)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(C.TERM==="dumb")return o;if(Lr.platform==="win32"){let n=Mf.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in C)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(n=>n in C)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(n=>n in C)||C.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in C)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(C.TEAMCITY_VERSION)?1:0;if(C.COLORTERM==="truecolor"||C.TERM==="xterm-kitty"||C.TERM==="xterm-ghostty"||C.TERM==="wezterm")return 3;if("TERM_PROGRAM"in C){let n=Number.parseInt((C.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(C.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(C.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(C.TERM)||"COLORTERM"in C?1:o}function $n(e,t={}){let s=If(e,{streamIsTTY:e&&e.isTTY,...t});return $f(s)}var Wf={stdout:$n({isTTY:Ln.isatty(1)}),stderr:$n({isTTY:Ln.isatty(2)})},In=Wf;function Wn(e,t,s){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,n="";do n+=e.slice(o,i)+t+s,o=i+r,i=e.indexOf(t,o);while(i!==-1);return n+=e.slice(o),n}function Un(e,t,s,i){let r=0,o="";do{let n=e[i-1]==="\r";o+=e.slice(r,n?i-1:i)+t+(n?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`)+s,r=i+1,i=e.indexOf(`
|
|
5
|
-
`,r)}while(i!==-1);return o+=e.slice(r),o}var{stdout:
|
|
6
|
-
`);return o!==-1&&(t=wn(t,r,i,o)),i+t+r};Object.defineProperties(is.prototype,ke);var vf=is(),Pb=is({level:Sn?Sn.level:0});var E=vf;var Rr=(e,t,s)=>{let i=e instanceof RegExp?En(e,s):e,r=t instanceof RegExp?En(t,s):t,o=i!==null&&r!=null&&Ef(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},En=(e,t)=>{let s=t.match(e);return s?s[0]:null},Ef=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a};var xn="\0SLASH"+Math.random()+"\0",Tn="\0OPEN"+Math.random()+"\0",Nr="\0CLOSE"+Math.random()+"\0",_n="\0COMMA"+Math.random()+"\0",On="\0PERIOD"+Math.random()+"\0",xf=new RegExp(xn,"g"),Tf=new RegExp(Tn,"g"),_f=new RegExp(Nr,"g"),Of=new RegExp(_n,"g"),Af=new RegExp(On,"g"),kf=/\\\\/g,Rf=/\\{/g,Cf=/\\}/g,Nf=/\\,/g,jf=/\\./g,Pf=1e5;function Cr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Ff(e){return e.replace(kf,xn).replace(Rf,Tn).replace(Cf,Nr).replace(Nf,_n).replace(jf,On)}function Df(e){return e.replace(xf,"\\").replace(Tf,"{").replace(_f,"}").replace(Of,",").replace(Af,".")}function An(e){if(!e)return[""];let t=[],s=Rr("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=An(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function kn(e,t={}){if(!e)return[];let{max:s=Pf}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),rs(Ff(e),s,!0).map(Df)}function Mf(e){return"{"+e+"}"}function $f(e){return/^-?0\d/.test(e)}function Lf(e,t){return e<=t}function If(e,t){return e>=t}function rs(e,t,s){let i=[],r=Rr("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?rs(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+Nr+r.post,rs(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=An(r.body),c.length===1&&c[0]!==void 0&&(c=rs(c[0],t,!1).map(Mf),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=Cr(c[0]),d=Cr(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.abs(Cr(c[2])):1,g=Lf;d<p&&(y*=-1,g=If);let v=c.some($f);u=[];for(let w=p;g(w,d);w+=y){let S;if(l)S=String.fromCharCode(w),S==="\\"&&(S="");else if(S=String(w),v){let k=m-S.length;if(k>0){let M=new Array(k+1).join("0");w<0?S="-"+M+S.slice(1):S=M+S}}u.push(S)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,rs(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var os=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Wf={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ns=e=>e.replace(/[[\]\\-]/g,"\\$&"),zf=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Rn=e=>e.join(""),Cn=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let m=e.charAt(o);if((m==="!"||m==="^")&&o===s+1){h=!0,o++;continue}if(m==="]"&&n&&!l){f=o+1;break}if(n=!0,m==="\\"&&!l){l=!0,o++;continue}if(m==="["&&!l){for(let[y,[g,b,v]]of Object.entries(Wf))if(e.startsWith(y,o)){if(c)return["$.",!1,e.length-s,!0];o+=y.length,v?r.push(g):i.push(g),a=a||b;continue t}}if(l=!1,c){m>c?i.push(ns(c)+"-"+ns(m)):m===c&&i.push(ns(m)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(ns(m+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=m,o+=2;continue}i.push(ns(m)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let m=i[0].length===2?i[0].slice(-1):i[0];return[zf(m),!1,f-s,!1]}let u="["+(h?"^":"")+Rn(i)+"]",p="["+(h?"":"^")+Rn(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]};var Qt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Uf=new Set(["!","?","+","*","@"]),Nn=e=>Uf.has(e),Bf="(?!(?:^|/)\\.\\.?(?:$|/))",Zs="(?!\\.)",Gf=new Set(["[","."]),Hf=new Set(["..","."]),Yf=new Set("().*{}+?[]^$\\!"),qf=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),jr="[^/]",jn=jr+"*?",Pn=jr+"+?",Re=class e{type;#t;#i;#n=!1;#r=[];#o;#T;#E;#f=!1;#a;#u;#c=!1;constructor(t,s,i={}){this.type=t,t&&(this.#i=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#E=this.#t===this?[]:this.#t.#E,t==="!"&&!this.#t.#f&&this.#E.push(this),this.#T=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#u=this.#r.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let t;for(;t=this.#E.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#T+1;!i.type&&r<i.#r.length;r++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#r[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof e&&s.#o===this))throw new Error("invalid part: "+s);this.#r.push(s)}}toJSON(){let t=this.type===null?this.#r.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#r.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#f&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#T===0)return!0;let t=this.#o;for(let s=0;s<this.#T;s++){let i=t.#r[s];if(!(i instanceof e&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#T===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new e(this.type,t);for(let i of this.#r)s.copyIn(i);return s}static#s(t,s,i,r){let o=!1,n=!1,a=-1,l=!1;if(s.type===null){let p=i,d="";for(;p<t.length;){let m=t.charAt(p++);if(o||m==="\\"){o=!o,d+=m;continue}if(n){p===a+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(p===a+2&&l)&&(n=!1),d+=m;continue}else if(m==="["){n=!0,a=p,l=!1,d+=m;continue}if(!r.noext&&Nn(m)&&t.charAt(p)==="("){s.push(d),d="";let y=new e(m,s);p=e.#s(t,y,p,r),s.push(y);continue}d+=m}return s.push(d),p}let h=i+1,f=new e(null,s),c=[],u="";for(;h<t.length;){let p=t.charAt(h++);if(o||p==="\\"){o=!o,u+=p;continue}if(n){h===a+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(h===a+2&&l)&&(n=!1),u+=p;continue}else if(p==="["){n=!0,a=h,l=!1,u+=p;continue}if(Nn(p)&&t.charAt(h)==="("){f.push(u),u="";let d=new e(p,f);f.push(d),h=e.#s(t,d,h,r);continue}if(p==="|"){f.push(u),u="",c.push(f),f=new e(null,s);continue}if(p===")")return u===""&&s.#r.length===0&&(s.#c=!0),f.push(u),u="",s.push(...c,f),h;u+=p}return s.type=null,s.#i=void 0,s.#r=[t.substring(i-1)],h}static fromGlob(t,s={}){let i=new e(null,void 0,s);return e.#s(t,i,0,s),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,a),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),h=this.#r.map(p=>{let[d,m,y,g]=typeof p=="string"?e.#b(p,this.#i,l):p.toRegExpSource(t);return this.#i=this.#i||y,this.#n=this.#n||g,d}).join(""),f="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&Hf.has(this.#r[0]))){let d=Gf,m=s&&d.has(h.charAt(0))||h.startsWith("\\.")&&d.has(h.charAt(2))||h.startsWith("\\.\\.")&&d.has(h.charAt(4)),y=!s&&!t&&d.has(h.charAt(0));f=m?Bf:y?Zs:""}let c="";return this.isEnd()&&this.#t.#f&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,Qt(h),this.#i=!!this.#i,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#p(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#r=[l],this.type=null,this.#i=void 0,[l,Qt(this.toString()),!1,!1]}let n=!i||t||s||!Zs?"":this.#p(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!s?Zs:"")+Pn;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?Zs:"")+jn+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,Qt(o),this.#i=!!this.#i,this.#n]}#p(t){return this.#r.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#b(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(Yf.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?Pn:jn,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=Cn(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=jr,s=!0;continue}o+=qf(h)}return[o,Qt(t),!!s,n]}};var Pr=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var it=(e,t,s={})=>(os(t),!s.nocomment&&t.charAt(0)==="#"?!1:new te(t,s).match(e)),Vf=/^\*+([^+@!?\*\[\(]*)$/,Jf=e=>t=>!t.startsWith(".")&&t.endsWith(e),Kf=e=>t=>t.endsWith(e),Xf=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Zf=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Qf=/^\*+\.\*+$/,tu=e=>!e.startsWith(".")&&e.includes("."),eu=e=>e!=="."&&e!==".."&&e.includes("."),su=/^\.\*+$/,iu=e=>e!=="."&&e!==".."&&e.startsWith("."),ru=/^\*+$/,ou=e=>e.length!==0&&!e.startsWith("."),nu=e=>e.length!==0&&e!=="."&&e!=="..",au=/^\?+([^+@!?\*\[\(]*)?$/,lu=([e,t=""])=>{let s=Mn([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},hu=([e,t=""])=>{let s=$n([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},cu=([e,t=""])=>{let s=$n([e]);return t?i=>s(i)&&i.endsWith(t):s},fu=([e,t=""])=>{let s=Mn([e]);return t?i=>s(i)&&i.endsWith(t):s},Mn=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},$n=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},Ln=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Fn={win32:{sep:"\\"},posix:{sep:"/"}},uu=Ln==="win32"?Fn.win32.sep:Fn.posix.sep;it.sep=uu;var bt=Symbol("globstar **");it.GLOBSTAR=bt;var pu="[^/]",du=pu+"*?",mu="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gu="(?:(?!(?:\\/|^)\\.).)*?",yu=(e,t={})=>s=>it(s,e,t);it.filter=yu;var wt=(e,t={})=>Object.assign({},e,t),wu=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return it;let t=it;return Object.assign((i,r,o={})=>t(i,r,wt(e,o)),{Minimatch:class extends t.Minimatch{constructor(r,o={}){super(r,wt(e,o))}static defaults(r){return t.defaults(wt(e,r)).Minimatch}},AST:class extends t.AST{constructor(r,o,n={}){super(r,o,wt(e,n))}static fromGlob(r,o={}){return t.AST.fromGlob(r,wt(e,o))}},unescape:(i,r={})=>t.unescape(i,wt(e,r)),escape:(i,r={})=>t.escape(i,wt(e,r)),filter:(i,r={})=>t.filter(i,wt(e,r)),defaults:i=>t.defaults(wt(e,i)),makeRe:(i,r={})=>t.makeRe(i,wt(e,r)),braceExpand:(i,r={})=>t.braceExpand(i,wt(e,r)),match:(i,r,o={})=>t.match(i,r,wt(e,o)),sep:t.sep,GLOBSTAR:bt})};it.defaults=wu;var In=(e,t={})=>(os(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:kn(e,{max:t.braceExpandMax}));it.braceExpand=In;var bu=(e,t={})=>new te(e,t).makeRe();it.makeRe=bu;var Su=(e,t,s={})=>{let i=new te(t,s);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e};it.match=Su;var Dn=/[?*]|[+@!]\(.*?\)|\[|\]/,vu=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),te=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,s={}){os(t),s=s||{},this.options=s,this.pattern=t,this.platform=s.platform||Ln,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!s.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!s.nonegate,this.comment=!1,this.empty=!1,this.partial=!!s.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=s.windowsNoMagicRoot!==void 0?s.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let s of t)if(typeof s!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,s=this.options;if(!s.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],s.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((o,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!Dn.test(o[2]))&&!Dn.test(o[3]),h=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(f=>this.parse(f))];if(h)return[o[0],...o.slice(1).map(f=>this.parse(f))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,r),this.set=r.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let n=this.set[o];n[0]===""&&n[1]===""&&this.globParts[o][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i=0;i<t.length;i++)for(let r=0;r<t[i].length;r++)t[i][r]==="**"&&(t[i][r]="*");let{optimizationLevel:s=1}=this.options;return s>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):s>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(s=>{let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let r=i;for(;s[r+1]==="**";)r++;r!==i&&s.splice(i,r-i)}return s})}levelOneOptimize(t){return t.map(s=>(s=s.reduce((i,r)=>{let o=i[i.length-1];return r==="**"&&o==="**"?i:r===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(i.pop(),i):(i.push(r),i)},[]),s.length===0?[""]:s))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let o=t[r];r===1&&o===""&&t[0]===""||(o==="."||o==="")&&(s=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(s=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&(s=!0,t.splice(i-1,2),i-=2)}}while(s);return t.length===0?[""]:t}firstPhasePreProcess(t){let s=!1;do{s=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let n=r;for(;i[n+1]==="**";)n++;n>r&&i.splice(r+1,n-r);let a=i[r+1],l=i[r+2],h=i[r+3];if(a!==".."||!l||l==="."||l===".."||!h||h==="."||h==="..")continue;s=!0,i.splice(r,1);let f=i.slice(0);f[r]="**",t.push(f),r--}if(!this.preserveMultipleSlashes){for(let n=1;n<i.length-1;n++){let a=i[n];n===1&&a===""&&i[0]===""||(a==="."||a==="")&&(s=!0,i.splice(n,1),n--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(s=!0,i.pop())}let o=0;for(;(o=i.indexOf("..",o+1))!==-1;){let n=i[o-1];if(n&&n!=="."&&n!==".."&&n!=="**"){s=!0;let l=o===1&&i[o+1]==="**"?["."]:[];i.splice(o-1,2,...l),i.length===0&&i.push(""),o-=2}}}}while(s);return t}secondPhasePreProcess(t){for(let s=0;s<t.length-1;s++)for(let i=s+1;i<t.length;i++){let r=this.partsMatch(t[s],t[i],!this.preserveMultipleSlashes);if(r){t[s]=[],t[i]=r;break}}return t.filter(s=>s.length)}partsMatch(t,s,i=!1){let r=0,o=0,n=[],a="";for(;r<t.length&&o<s.length;)if(t[r]===s[o])n.push(a==="b"?s[o]:t[r]),r++,o++;else if(i&&t[r]==="**"&&s[o]===t[r+1])n.push(t[r]),r++;else if(i&&s[o]==="**"&&t[r]===s[o+1])n.push(s[o]),o++;else if(t[r]==="*"&&s[o]&&(this.options.dot||!s[o].startsWith("."))&&s[o]!=="**"){if(a==="b")return!1;a="a",n.push(t[r]),r++,o++}else if(s[o]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",n.push(s[o]),r++,o++}else return!1;return t.length===s.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,s=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)s=!s,i++;i&&(this.pattern=t.slice(i)),this.negate=s}matchOne(t,s,i=!1){let r=this.options;if(this.isWindows){let m=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!m&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),g=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),b=!g&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),v=y?3:m?0:void 0,w=b?3:g?0:void 0;if(typeof v=="number"&&typeof w=="number"){let[S,k]=[t[v],s[w]];S.toLowerCase()===k.toLowerCase()&&(s[w]=S,w>v?s=s.slice(w):v>w&&(t=t.slice(v)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:s}),this.debug("matchOne",t.length,s.length);for(var n=0,a=0,l=t.length,h=s.length;n<l&&a<h;n++,a++){this.debug("matchOne loop");var f=s[a],c=t[n];if(this.debug(s,f,c),f===!1)return!1;if(f===bt){this.debug("GLOBSTAR",[s,f,c]);var u=n,p=a+1;if(p===h){for(this.debug("** at the end");n<l;n++)if(t[n]==="."||t[n]===".."||!r.dot&&t[n].charAt(0)===".")return!1;return!0}for(;u<l;){var d=t[u];if(this.debug(`
|
|
5
|
+
`,r)}while(i!==-1);return o+=e.slice(r),o}var{stdout:zn,stderr:Bn}=In,$r=Symbol("GENERATOR"),Ne=Symbol("STYLER"),fs=Symbol("IS_EMPTY"),Gn=["ansi","ansi","ansi256","ansi16m"],Fe=Object.create(null),Uf=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let s=zn?zn.level:0;e.level=t.level===void 0?s:t.level};var zf=e=>{let t=(...s)=>s.join(" ");return Uf(t,e),Object.setPrototypeOf(t,us.prototype),t};function us(e){return zf(e)}Object.setPrototypeOf(us.prototype,Function.prototype);for(let[e,t]of Object.entries(Pt))Fe[e]={get(){let s=ai(this,Wr(t.open,t.close,this[Ne]),this[fs]);return Object.defineProperty(this,e,{value:s}),s}};Fe.visible={get(){let e=ai(this,this[Ne],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Ir=(e,t,s,...i)=>e==="rgb"?t==="ansi16m"?Pt[s].ansi16m(...i):t==="ansi256"?Pt[s].ansi256(Pt.rgbToAnsi256(...i)):Pt[s].ansi(Pt.rgbToAnsi(...i)):e==="hex"?Ir("rgb",t,s,...Pt.hexToRgb(...i)):Pt[s][e](...i),Bf=["rgb","hex","ansi256"];for(let e of Bf){Fe[e]={get(){let{level:s}=this;return function(...i){let r=Wr(Ir(e,Gn[s],"color",...i),Pt.color.close,this[Ne]);return ai(this,r,this[fs])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Fe[t]={get(){let{level:s}=this;return function(...i){let r=Wr(Ir(e,Gn[s],"bgColor",...i),Pt.bgColor.close,this[Ne]);return ai(this,r,this[fs])}}}}var Gf=Object.defineProperties(()=>{},{...Fe,level:{enumerable:!0,get(){return this[$r].level},set(e){this[$r].level=e}}}),Wr=(e,t,s)=>{let i,r;return s===void 0?(i=e,r=t):(i=s.openAll+e,r=t+s.closeAll),{open:e,close:t,openAll:i,closeAll:r,parent:s}},ai=(e,t,s)=>{let i=(...r)=>Hf(i,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(i,Gf),i[$r]=e,i[Ne]=t,i[fs]=s,i},Hf=(e,t)=>{if(e.level<=0||!t)return e[fs]?"":t;let s=e[Ne];if(s===void 0)return t;let{openAll:i,closeAll:r}=s;if(t.includes("\x1B"))for(;s!==void 0;)t=Wn(t,s.close,s.open),s=s.parent;let o=t.indexOf(`
|
|
6
|
+
`);return o!==-1&&(t=Un(t,r,i,o)),i+t+r};Object.defineProperties(us.prototype,Fe);var Yf=us(),G0=us({level:Bn?Bn.level:0});var E=Yf;var Ur=(e,t,s)=>{let i=e instanceof RegExp?Hn(e,s):e,r=t instanceof RegExp?Hn(t,s):t,o=i!==null&&r!=null&&qf(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},Hn=(e,t)=>{let s=t.match(e);return s?s[0]:null},qf=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a};var Yn="\0SLASH"+Math.random()+"\0",qn="\0OPEN"+Math.random()+"\0",Br="\0CLOSE"+Math.random()+"\0",Vn="\0COMMA"+Math.random()+"\0",Jn="\0PERIOD"+Math.random()+"\0",Vf=new RegExp(Yn,"g"),Jf=new RegExp(qn,"g"),Kf=new RegExp(Br,"g"),Xf=new RegExp(Vn,"g"),Zf=new RegExp(Jn,"g"),Qf=/\\\\/g,tu=/\\{/g,eu=/\\}/g,su=/\\,/g,iu=/\\./g,ru=1e5;function zr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ou(e){return e.replace(Qf,Yn).replace(tu,qn).replace(eu,Br).replace(su,Vn).replace(iu,Jn)}function nu(e){return e.replace(Vf,"\\").replace(Jf,"{").replace(Kf,"}").replace(Xf,",").replace(Zf,".")}function Kn(e){if(!e)return[""];let t=[],s=Ur("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=Kn(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function Xn(e,t={}){if(!e)return[];let{max:s=ru}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),ps(ou(e),s,!0).map(nu)}function au(e){return"{"+e+"}"}function lu(e){return/^-?0\d/.test(e)}function hu(e,t){return e<=t}function cu(e,t){return e>=t}function ps(e,t,s){let i=[],r=Ur("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?ps(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+Br+r.post,ps(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=Kn(r.body),c.length===1&&c[0]!==void 0&&(c=ps(c[0],t,!1).map(au),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=zr(c[0]),d=zr(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.abs(zr(c[2])):1,g=hu;d<p&&(y*=-1,g=cu);let v=c.some(lu);u=[];for(let w=p;g(w,d);w+=y){let S;if(l)S=String.fromCharCode(w),S==="\\"&&(S="");else if(S=String(w),v){let R=m-S.length;if(R>0){let M=new Array(R+1).join("0");w<0?S="-"+M+S.slice(1):S=M+S}}u.push(S)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,ps(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var ds=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var fu={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ms=e=>e.replace(/[[\]\\-]/g,"\\$&"),uu=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Zn=e=>e.join(""),Qn=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let m=e.charAt(o);if((m==="!"||m==="^")&&o===s+1){h=!0,o++;continue}if(m==="]"&&n&&!l){f=o+1;break}if(n=!0,m==="\\"&&!l){l=!0,o++;continue}if(m==="["&&!l){for(let[y,[g,b,v]]of Object.entries(fu))if(e.startsWith(y,o)){if(c)return["$.",!1,e.length-s,!0];o+=y.length,v?r.push(g):i.push(g),a=a||b;continue t}}if(l=!1,c){m>c?i.push(ms(c)+"-"+ms(m)):m===c&&i.push(ms(m)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(ms(m+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=m,o+=2;continue}i.push(ms(m)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let m=i[0].length===2?i[0].slice(-1):i[0];return[uu(m),!1,f-s,!1]}let u="["+(h?"^":"")+Zn(i)+"]",p="["+(h?"":"^")+Zn(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]};var re=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var pu=new Set(["!","?","+","*","@"]),ta=e=>pu.has(e),du="(?!(?:^|/)\\.\\.?(?:$|/))",li="(?!\\.)",mu=new Set(["[","."]),gu=new Set(["..","."]),yu=new Set("().*{}+?[]^$\\!"),wu=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Gr="[^/]",ea=Gr+"*?",sa=Gr+"+?",De=class e{type;#t;#i;#n=!1;#r=[];#o;#T;#E;#f=!1;#a;#u;#c=!1;constructor(t,s,i={}){this.type=t,t&&(this.#i=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#E=this.#t===this?[]:this.#t.#E,t==="!"&&!this.#t.#f&&this.#E.push(this),this.#T=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#u=this.#r.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let t;for(;t=this.#E.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#T+1;!i.type&&r<i.#r.length;r++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#r[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof e&&s.#o===this))throw new Error("invalid part: "+s);this.#r.push(s)}}toJSON(){let t=this.type===null?this.#r.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#r.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#f&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#T===0)return!0;let t=this.#o;for(let s=0;s<this.#T;s++){let i=t.#r[s];if(!(i instanceof e&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#T===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new e(this.type,t);for(let i of this.#r)s.copyIn(i);return s}static#s(t,s,i,r){let o=!1,n=!1,a=-1,l=!1;if(s.type===null){let p=i,d="";for(;p<t.length;){let m=t.charAt(p++);if(o||m==="\\"){o=!o,d+=m;continue}if(n){p===a+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(p===a+2&&l)&&(n=!1),d+=m;continue}else if(m==="["){n=!0,a=p,l=!1,d+=m;continue}if(!r.noext&&ta(m)&&t.charAt(p)==="("){s.push(d),d="";let y=new e(m,s);p=e.#s(t,y,p,r),s.push(y);continue}d+=m}return s.push(d),p}let h=i+1,f=new e(null,s),c=[],u="";for(;h<t.length;){let p=t.charAt(h++);if(o||p==="\\"){o=!o,u+=p;continue}if(n){h===a+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(h===a+2&&l)&&(n=!1),u+=p;continue}else if(p==="["){n=!0,a=h,l=!1,u+=p;continue}if(ta(p)&&t.charAt(h)==="("){f.push(u),u="";let d=new e(p,f);f.push(d),h=e.#s(t,d,h,r);continue}if(p==="|"){f.push(u),u="",c.push(f),f=new e(null,s);continue}if(p===")")return u===""&&s.#r.length===0&&(s.#c=!0),f.push(u),u="",s.push(...c,f),h;u+=p}return s.type=null,s.#i=void 0,s.#r=[t.substring(i-1)],h}static fromGlob(t,s={}){let i=new e(null,void 0,s);return e.#s(t,i,0,s),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,a),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),h=this.#r.map(p=>{let[d,m,y,g]=typeof p=="string"?e.#b(p,this.#i,l):p.toRegExpSource(t);return this.#i=this.#i||y,this.#n=this.#n||g,d}).join(""),f="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&gu.has(this.#r[0]))){let d=mu,m=s&&d.has(h.charAt(0))||h.startsWith("\\.")&&d.has(h.charAt(2))||h.startsWith("\\.\\.")&&d.has(h.charAt(4)),y=!s&&!t&&d.has(h.charAt(0));f=m?du:y?li:""}let c="";return this.isEnd()&&this.#t.#f&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,re(h),this.#i=!!this.#i,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#p(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#r=[l],this.type=null,this.#i=void 0,[l,re(this.toString()),!1,!1]}let n=!i||t||s||!li?"":this.#p(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!s?li:"")+sa;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?li:"")+ea+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,re(o),this.#i=!!this.#i,this.#n]}#p(t){return this.#r.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#b(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(yu.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?sa:ea,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=Qn(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=Gr,s=!0;continue}o+=wu(h)}return[o,re(t),!!s,n]}};var Hr=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var st=(e,t,s={})=>(ds(t),!s.nocomment&&t.charAt(0)==="#"?!1:new oe(t,s).match(e)),bu=/^\*+([^+@!?\*\[\(]*)$/,Su=e=>t=>!t.startsWith(".")&&t.endsWith(e),vu=e=>t=>t.endsWith(e),Eu=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),xu=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Tu=/^\*+\.\*+$/,Ou=e=>!e.startsWith(".")&&e.includes("."),_u=e=>e!=="."&&e!==".."&&e.includes("."),ku=/^\.\*+$/,Ru=e=>e!=="."&&e!==".."&&e.startsWith("."),Au=/^\*+$/,Cu=e=>e.length!==0&&!e.startsWith("."),Pu=e=>e.length!==0&&e!=="."&&e!=="..",ju=/^\?+([^+@!?\*\[\(]*)?$/,Nu=([e,t=""])=>{let s=oa([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},Fu=([e,t=""])=>{let s=na([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},Du=([e,t=""])=>{let s=na([e]);return t?i=>s(i)&&i.endsWith(t):s},Mu=([e,t=""])=>{let s=oa([e]);return t?i=>s(i)&&i.endsWith(t):s},oa=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},na=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},aa=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ia={win32:{sep:"\\"},posix:{sep:"/"}},Lu=aa==="win32"?ia.win32.sep:ia.posix.sep;st.sep=Lu;var vt=Symbol("globstar **");st.GLOBSTAR=vt;var $u="[^/]",Iu=$u+"*?",Wu="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Uu="(?:(?!(?:\\/|^)\\.).)*?",zu=(e,t={})=>s=>st(s,e,t);st.filter=zu;var St=(e,t={})=>Object.assign({},e,t),Bu=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return st;let t=st;return Object.assign((i,r,o={})=>t(i,r,St(e,o)),{Minimatch:class extends t.Minimatch{constructor(r,o={}){super(r,St(e,o))}static defaults(r){return t.defaults(St(e,r)).Minimatch}},AST:class extends t.AST{constructor(r,o,n={}){super(r,o,St(e,n))}static fromGlob(r,o={}){return t.AST.fromGlob(r,St(e,o))}},unescape:(i,r={})=>t.unescape(i,St(e,r)),escape:(i,r={})=>t.escape(i,St(e,r)),filter:(i,r={})=>t.filter(i,St(e,r)),defaults:i=>t.defaults(St(e,i)),makeRe:(i,r={})=>t.makeRe(i,St(e,r)),braceExpand:(i,r={})=>t.braceExpand(i,St(e,r)),match:(i,r,o={})=>t.match(i,r,St(e,o)),sep:t.sep,GLOBSTAR:vt})};st.defaults=Bu;var la=(e,t={})=>(ds(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Xn(e,{max:t.braceExpandMax}));st.braceExpand=la;var Gu=(e,t={})=>new oe(e,t).makeRe();st.makeRe=Gu;var Hu=(e,t,s={})=>{let i=new oe(t,s);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e};st.match=Hu;var ra=/[?*]|[+@!]\(.*?\)|\[|\]/,Yu=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oe=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,s={}){ds(t),s=s||{},this.options=s,this.pattern=t,this.platform=s.platform||aa,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!s.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!s.nonegate,this.comment=!1,this.empty=!1,this.partial=!!s.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=s.windowsNoMagicRoot!==void 0?s.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let s of t)if(typeof s!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,s=this.options;if(!s.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],s.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((o,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!ra.test(o[2]))&&!ra.test(o[3]),h=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(f=>this.parse(f))];if(h)return[o[0],...o.slice(1).map(f=>this.parse(f))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,r),this.set=r.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let n=this.set[o];n[0]===""&&n[1]===""&&this.globParts[o][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i=0;i<t.length;i++)for(let r=0;r<t[i].length;r++)t[i][r]==="**"&&(t[i][r]="*");let{optimizationLevel:s=1}=this.options;return s>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):s>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(s=>{let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let r=i;for(;s[r+1]==="**";)r++;r!==i&&s.splice(i,r-i)}return s})}levelOneOptimize(t){return t.map(s=>(s=s.reduce((i,r)=>{let o=i[i.length-1];return r==="**"&&o==="**"?i:r===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(i.pop(),i):(i.push(r),i)},[]),s.length===0?[""]:s))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let o=t[r];r===1&&o===""&&t[0]===""||(o==="."||o==="")&&(s=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(s=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&(s=!0,t.splice(i-1,2),i-=2)}}while(s);return t.length===0?[""]:t}firstPhasePreProcess(t){let s=!1;do{s=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let n=r;for(;i[n+1]==="**";)n++;n>r&&i.splice(r+1,n-r);let a=i[r+1],l=i[r+2],h=i[r+3];if(a!==".."||!l||l==="."||l===".."||!h||h==="."||h==="..")continue;s=!0,i.splice(r,1);let f=i.slice(0);f[r]="**",t.push(f),r--}if(!this.preserveMultipleSlashes){for(let n=1;n<i.length-1;n++){let a=i[n];n===1&&a===""&&i[0]===""||(a==="."||a==="")&&(s=!0,i.splice(n,1),n--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(s=!0,i.pop())}let o=0;for(;(o=i.indexOf("..",o+1))!==-1;){let n=i[o-1];if(n&&n!=="."&&n!==".."&&n!=="**"){s=!0;let l=o===1&&i[o+1]==="**"?["."]:[];i.splice(o-1,2,...l),i.length===0&&i.push(""),o-=2}}}}while(s);return t}secondPhasePreProcess(t){for(let s=0;s<t.length-1;s++)for(let i=s+1;i<t.length;i++){let r=this.partsMatch(t[s],t[i],!this.preserveMultipleSlashes);if(r){t[s]=[],t[i]=r;break}}return t.filter(s=>s.length)}partsMatch(t,s,i=!1){let r=0,o=0,n=[],a="";for(;r<t.length&&o<s.length;)if(t[r]===s[o])n.push(a==="b"?s[o]:t[r]),r++,o++;else if(i&&t[r]==="**"&&s[o]===t[r+1])n.push(t[r]),r++;else if(i&&s[o]==="**"&&t[r]===s[o+1])n.push(s[o]),o++;else if(t[r]==="*"&&s[o]&&(this.options.dot||!s[o].startsWith("."))&&s[o]!=="**"){if(a==="b")return!1;a="a",n.push(t[r]),r++,o++}else if(s[o]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",n.push(s[o]),r++,o++}else return!1;return t.length===s.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,s=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)s=!s,i++;i&&(this.pattern=t.slice(i)),this.negate=s}matchOne(t,s,i=!1){let r=this.options;if(this.isWindows){let m=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!m&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),g=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),b=!g&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),v=y?3:m?0:void 0,w=b?3:g?0:void 0;if(typeof v=="number"&&typeof w=="number"){let[S,R]=[t[v],s[w]];S.toLowerCase()===R.toLowerCase()&&(s[w]=S,w>v?s=s.slice(w):v>w&&(t=t.slice(v)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:s}),this.debug("matchOne",t.length,s.length);for(var n=0,a=0,l=t.length,h=s.length;n<l&&a<h;n++,a++){this.debug("matchOne loop");var f=s[a],c=t[n];if(this.debug(s,f,c),f===!1)return!1;if(f===vt){this.debug("GLOBSTAR",[s,f,c]);var u=n,p=a+1;if(p===h){for(this.debug("** at the end");n<l;n++)if(t[n]==="."||t[n]===".."||!r.dot&&t[n].charAt(0)===".")return!1;return!0}for(;u<l;){var d=t[u];if(this.debug(`
|
|
7
7
|
globstar while`,t,u,s,p,d),this.matchOne(t.slice(u),s.slice(p),i))return this.debug("globstar found match!",u,l,d),!0;if(d==="."||d===".."||!r.dot&&d.charAt(0)==="."){this.debug("dot detected!",t,u,s,p);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(i&&(this.debug(`
|
|
8
|
-
>>> no match, partial?`,t,u,s,p),u===l))}let m;if(typeof f=="string"?(m=c===f,this.debug("string match",f,c,m)):(m=f.test(c),this.debug("pattern match",f,c,m)),!m)return!1}if(n===l&&a===h)return!0;if(n===l)return i;if(a===h)return n===l-1&&t[n]==="";throw new Error("wtf?")}braceExpand(){return
|
|
9
|
-
`,o=" "]=i.match(
|
|
8
|
+
>>> no match, partial?`,t,u,s,p),u===l))}let m;if(typeof f=="string"?(m=c===f,this.debug("string match",f,c,m)):(m=f.test(c),this.debug("pattern match",f,c,m)),!m)return!1}if(n===l&&a===h)return!0;if(n===l)return i;if(a===h)return n===l-1&&t[n]==="";throw new Error("wtf?")}braceExpand(){return la(this.pattern,this.options)}parse(t){ds(t);let s=this.options;if(t==="**")return vt;if(t==="")return"";let i,r=null;(i=t.match(Au))?r=s.dot?Pu:Cu:(i=t.match(bu))?r=(s.nocase?s.dot?xu:Eu:s.dot?vu:Su)(i[1]):(i=t.match(ju))?r=(s.nocase?s.dot?Fu:Nu:s.dot?Du:Mu)(i):(i=t.match(Tu))?r=s.dot?_u:Ou:(i=t.match(ku))&&(r=Ru);let o=De.fromGlob(t,this.options).toMMPattern();return r&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:r}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let s=this.options,i=s.noglobstar?Iu:s.dot?Wu:Uu,r=new Set(s.nocase?["i"]:[]),o=t.map(l=>{let h=l.map(c=>{if(c instanceof RegExp)for(let u of c.flags.split(""))r.add(u);return typeof c=="string"?Yu(c):c===vt?vt:c._src});h.forEach((c,u)=>{let p=h[u+1],d=h[u-1];c!==vt||d===vt||(d===void 0?p!==void 0&&p!==vt?h[u+1]="(?:\\/|"+i+"\\/)?"+p:h[u]=i:p===void 0?h[u-1]=d+"(?:\\/|\\/"+i+")?":p!==vt&&(h[u-1]=d+"(?:\\/|\\/"+i+"\\/)"+p,h[u+1]=vt))});let f=h.filter(c=>c!==vt);if(this.partial&&f.length>=1){let c=[];for(let u=1;u<=f.length;u++)c.push(f.slice(0,u).join("/"));return"(?:"+c.join("|")+")"}return f.join("/")}).join("|"),[n,a]=t.length>1?["(?:",")"]:["",""];o="^"+n+o+a+"$",this.partial&&(o="^(?:\\/|"+n+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,s=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&s)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let o=this.set;this.debug(this.pattern,"set",o);let n=r[r.length-1];if(!n)for(let a=r.length-2;!n&&a>=0;a--)n=r[a];for(let a=0;a<o.length;a++){let l=o[a],h=r;if(i.matchBase&&l.length===1&&(h=[n]),this.matchOne(h,l,s))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return st.defaults(t).Minimatch}};st.AST=De;st.Minimatch=oe;st.escape=Hr;st.unescape=re;var Yr=parseInt(process.env.TSHY_VERBOSE||"0"),hi=[],$=(...e)=>{Yr>=1?console.error(...e):hi.push(e)},T=(...e)=>{Yr>=2?console.error(...e):hi.push(e)},ha=(...e)=>{Yr>=1&&console.log(...e)},Me=()=>{for(let e of hi)console.error(...e);hi.length=0};var O=(e,t)=>{$(E.red.bold(e)),t&&$(t.message),Me()};import{readFileSync as Zu}from"fs";var qu=e=>Array.from(e).map(t=>"0x"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")).join(""),Vu=(e,t,s)=>{if(!t)return{message:e.message+" while parsing empty string",position:0};let i=e.message.match(/^Unexpected (?:token (.*?))?/i),r=e.message.match(/at positions? (\d+)/),o=/^Unexpected end of JSON|Unterminated string in JSON/i.test(e.message)?t.length-1:r&&r[1]?+r[1]:/is not valid JSON$/.test(e.message)?0:null,n=i&&i[1]?e.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(i[1])} (${qu(i[1])})`):e.message;if(o!=null){let a=o<=s?0:o-s,l=o+s>=t.length?t.length:o+s,h=(a===0?"":"...")+t.slice(a,l)+(l===t.length?"":"...");return{message:n+` while parsing ${t===h?"":"near "}${JSON.stringify(h)}`,position:o}}else return{message:n+` while parsing '${t.slice(0,s*2)}'`,position:0}},qr=class extends SyntaxError{code;cause;position;constructor(t,s,i=20,r){let{message:o,position:n}=Vu(t,s,i);super(o),this.cause=t,this.position=n,this.code="EJSONPARSE",Error.captureStackTrace(this,r||this.constructor)}get name(){return this.constructor.name}set name(t){}get[Symbol.toStringTag](){return this.constructor.name}},ca=Symbol.for("indent"),fa=Symbol.for("newline"),Ju=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,Ku=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,Vr=(e,t,s)=>{let i=Xu(String(e));t||(t=void 0),s=s||20;try{let[,r=`
|
|
9
|
+
`,o=" "]=i.match(Ku)||i.match(Ju)||[,"",""],n=JSON.parse(i,t);return n&&typeof n=="object"&&(n[fa]=r,n[ca]=o),n}catch(r){if(typeof e!="string"&&!Buffer.isBuffer(e)){let o=Array.isArray(e)&&e.length===0;throw Object.assign(new TypeError(`Cannot parse ${o?"an empty array":String(e)}`),{code:"EJSONPARSE",systemError:r})}throw new qr(r,i,s,Vr)}};var Xu=e=>String(e).replace(/^\uFEFF/,""),ci=(e,t,s)=>{let i=s===void 0?e[ca]:s,r=JSON.stringify(e,t,i),o=e[fa]||`
|
|
10
10
|
`;return i?(o===`
|
|
11
11
|
`?r:r.split(`
|
|
12
|
-
`).join(o))+o:r};var ku=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Ru=()=>{try{let e=Mr(Au("package.json","utf8"));if(ku(e))return Object.assign(e,{type:e.type==="commonjs"?"commonjs":"module"});throw new Error("Invalid package.json contents: "+ti(e))}catch(e){_("failed to read package.json",e),process.exit(1)}},O=Ru();import{readdirSync as Cu}from"fs";import{join as Nu}from"path/posix";var Bn=(e="src")=>{let t=[],s=Cu(e,{withFileTypes:!0});for(let i of s){let r=`./${Nu(e,i.name)}`;i.isFile()?t.push(r):i.isDirectory()&&t.push(...Bn(r))}return t},ju=new Set(Bn()),Ht=ju;var Pu=e=>e==="commonjs"||e==="esm",Gn=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>!Pu(t))?!0:(_(`tshy.dialects must be an array including "esm" and/or "commonjs", got: ${JSON.stringify(e)}`),process.exit(1));var Hn=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>typeof t!="string")?!0:(_(`tshy.exclude must be an array of string glob patterns if defined, got: ${JSON.stringify(e)}`),process.exit(1));import{join as Fu}from"node:path/posix";var Yn=e=>`./${Fu(e)}`;import{join as qn}from"path/posix";var $t=(e,t)=>{if(typeof e=="string")return e;if(typeof e!="object")return;if(e===null)return e;if(Array.isArray(e)){for(let i of e){let r=$t(i,t);if(r||r===null)return r}return}let s=[...t,"node","default"];for(let[i,r]of Object.entries(e))if(s.includes(i)){let o=$t(r,t);if(o||o===null)return o}};var ei=e=>{let t=$t(e,["import"]),s=$t(e,["require"]);return!(t&&qn(t).startsWith("src/")||s&&qn(s).startsWith("src/"))};var $r=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let[t,s]of Object.entries(e)){if(t!=="."&&!t.startsWith("./"))return _(`tshy.exports key must be "." or start with "./", got: ${t}`),process.exit(1);if(typeof s=="string"){e[t]=Yn(s);continue}if(typeof s!="object")return _(`tshy.exports ${t} value must be valid package.json exports value, got: ${JSON.stringify(s)}`),process.exit(1);if(!ei(s))return _(`tshy.exports ${t} unbuilt exports must not be in ./src, and exports in src must be string values. got: ${JSON.stringify(s)}`),process.exit(1);e[t]=s}return!0};var Du=(e,t)=>{if(!e||!t)return!1;for(let s of e)if(t.includes(s))return s;return!1},Lr=(e,t)=>{for(let s of e){if(typeof s!="string")return _(`${t} must be an array of strings, got: ${s}`),process.exit(1);if(s==="commonjs"||s==="cjs"||s==="esm"||s==="require"||s==="import"||s==="node"||s==="source"||s==="default")return _(`tshy.${t}Dialects must not contain ${JSON.stringify(s)}`),process.exit(1)}return!0},Vn=({commonjsDialects:e,esmDialects:t,sourceDialects:s})=>{if(e===void 0&&t===void 0&&s===void 0)return!0;if(e&&!Lr(e,"commonjs")||t&&!Lr(t,"esm")||s&&!Lr(s,"source"))return!1;for(let[i,r,o,n]of[["commonjsDialects","esmDialects",e,t],["commonjsDialects","sourceDialects",e,s],["esmDialects","sourceDialects",t,s]]){let a=Du(o,n);if(a)return _(`${i} and ${r} must be unique, found ${a} in both lists`),process.exit(1)}return!0};var Jn=e=>{let{imports:t}=e;if(t===void 0)return!0;if(Array.isArray(t)||typeof t!="object")return _(`invalid imports object, must be Record<string, Import>, got: ${JSON.stringify(t)}`),process.exit(1);for(let[s,i]of Object.entries(t)){if(!s.startsWith("#")||s==="#"||s.startsWith("#/"))return _("invalid imports module specifier: "+s),process.exit(1);if(typeof i!="string"&&!ei(i))return _(`unbuilt package.imports ${s} must not be in ./src, and imports in ./src must be string values. got: `+JSON.stringify(i)),process.exit(1)}return!0};import{resolve as Mu}from"path";import{readFileSync as $u}from"node:fs";var Kn=e=>{if(typeof e=="string")try{return $u(Mu(e),"utf8"),!0}catch{}return _(`tshy.project must point to a tsconfig file on disk, got: ${JSON.stringify(e)}`),process.exit(1)};var Xn=e=>e===void 0||e==="tsc"||e==="tsgo";var Ir=(e,t)=>{let s=e[t];return s===void 0||typeof s=="boolean"?!0:(_(`tshy.${t} must be a boolean value if specified, got: `+s),process.exit(1))},Lu=e=>!!e&&Array.isArray(e)&&!e.some(t=>typeof t!="string"),Iu=e=>!!e&&typeof e=="object"&&(e.exports===void 0||typeof e.exports=="string"||Lu(e.exports)||$r(e.exports))&&(e.dialects===void 0||Gn(e.dialects))&&(e.project===void 0||Kn(e.project))&&(e.exclude===void 0||Hn(e.exclude))&&Vn(e)&&Xn(e.compiler)&&Ir(e,"selfLink")&&Ir(e,"main")&&Ir(e,"liveDev"),Wu=(e,t)=>t.some(s=>s.match(e)),Zn=e=>Array.isArray(e)?e.map(t=>new te(t.replace(/^\.\//,""))):Zn([e]),zu=(e,t)=>{let s=Iu(e.tshy)?e.tshy:{},i=s.exports;if(typeof i=="string"||Array.isArray(i)){let n={},l=Zn(i);for(let h of t){if(!Wu(h.replace(/^\.\//,""),l))continue;let f=/^\.\/src\/index.([mc]?[jt]s|[jt]sx)$/.test(h)?".":"./"+h.replace(/^\.\/src\//,"").replace(/\.([mc]?[tj]s|[jt]sx)$/,"");n[f]=`./${h}`}$r(n)?(n["./package.json"]="./package.json",s.exports=n):(L("invalid exports pattern, using default exports"),delete s.exports,i=void 0)}let r={...s},o=r;if(o.imports&&(T(E.cyan.dim("imports")+" moving from tshy config to top level"),e.imports={...e.imports,...o.imports},delete o.imports),Jn(e),!i){let n={"./package.json":"./package.json"};for(let a of t)if(/^\.\/src\/index\.[^\.]+$/.test(a)){n["."]=a;break}r.exports=n,s.exports=n,i=n}return e.tshy={...s,exports:i},r},Uu=zu(O,Ht),A=Uu;import{fileURLToPath as Hp}from"node:url";import{posix as Jp,win32 as Jr}from"node:path";import{fileURLToPath as Kp}from"node:url";import{lstatSync as Xp,readdir as Zp,readdirSync as Qp,readlinkSync as td,realpathSync as ed}from"fs";import*as sd from"node:fs";import{lstat as id,readdir as rd,readlink as od,realpath as nd}from"node:fs/promises";import{EventEmitter as Zr}from"node:events";import Ma from"node:stream";import{StringDecoder as ad}from"node:string_decoder";var va=(e,t,s)=>{let i=e instanceof RegExp?Qn(e,s):e,r=t instanceof RegExp?Qn(t,s):t,o=i!==null&&r!=null&&Bu(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},Qn=(e,t)=>{let s=t.match(e);return s?s[0]:null},Bu=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a},Ea="\0SLASH"+Math.random()+"\0",xa="\0OPEN"+Math.random()+"\0",Kr="\0CLOSE"+Math.random()+"\0",Ta="\0COMMA"+Math.random()+"\0",_a="\0PERIOD"+Math.random()+"\0",Gu=new RegExp(Ea,"g"),Hu=new RegExp(xa,"g"),Yu=new RegExp(Kr,"g"),qu=new RegExp(Ta,"g"),Vu=new RegExp(_a,"g"),Ju=/\\\\/g,Ku=/\\{/g,Xu=/\\}/g,Zu=/\\,/g,Qu=/\\./g,tp=1e5;function Wr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ep(e){return e.replace(Ju,Ea).replace(Ku,xa).replace(Xu,Kr).replace(Zu,Ta).replace(Qu,_a)}function sp(e){return e.replace(Gu,"\\").replace(Hu,"{").replace(Yu,"}").replace(qu,",").replace(Vu,".")}function Oa(e){if(!e)return[""];let t=[],s=va("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=Oa(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function ip(e,t={}){if(!e)return[];let{max:s=tp}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),ps(ep(e),s,!0).map(sp)}function rp(e){return"{"+e+"}"}function op(e){return/^-?0\d/.test(e)}function np(e,t){return e<=t}function ap(e,t){return e>=t}function ps(e,t,s){let i=[],r=va("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?ps(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+Kr+r.post,ps(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=Oa(r.body),c.length===1&&c[0]!==void 0&&(c=ps(c[0],t,!1).map(rp),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=Wr(c[0]),d=Wr(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.abs(Wr(c[2])):1,g=np;d<p&&(y*=-1,g=ap);let b=c.some(op);u=[];for(let v=p;g(v,d);v+=y){let w;if(l)w=String.fromCharCode(v),w==="\\"&&(w="");else if(w=String(v),b){let S=m-w.length;if(S>0){let k=new Array(S+1).join("0");v<0?w="-"+k+w.slice(1):w=k+w}}u.push(w)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,ps(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var ui=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},lp={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},as=e=>e.replace(/[[\]\\-]/g,"\\$&"),hp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ta=e=>e.join(""),cp=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let d=e.charAt(o);if((d==="!"||d==="^")&&o===s+1){h=!0,o++;continue}if(d==="]"&&n&&!l){f=o+1;break}if(n=!0,d==="\\"&&!l){l=!0,o++;continue}if(d==="["&&!l){for(let[m,[y,g,b]]of Object.entries(lp))if(e.startsWith(m,o)){if(c)return["$.",!1,e.length-s,!0];o+=m.length,b?r.push(y):i.push(y),a=a||g;continue t}}if(l=!1,c){d>c?i.push(as(c)+"-"+as(d)):d===c&&i.push(as(d)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(as(d+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=d,o+=2;continue}i.push(as(d)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let d=i[0].length===2?i[0].slice(-1):i[0];return[hp(d),!1,f-s,!1]}let u="["+(h?"^":"")+ta(i)+"]",p="["+(h?"":"^")+ta(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]},Pe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),fp=new Set(["!","?","+","*","@"]),ea=e=>fp.has(e),up="(?!(?:^|/)\\.\\.?(?:$|/))",si="(?!\\.)",pp=new Set(["[","."]),dp=new Set(["..","."]),mp=new Set("().*{}+?[]^$\\!"),gp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Xr="[^/]",sa=Xr+"*?",ia=Xr+"+?",Aa=class dt{type;#t;#i;#n=!1;#r=[];#o;#T;#E;#f=!1;#a;#u;#c=!1;constructor(t,s,i={}){this.type=t,t&&(this.#i=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#E=this.#t===this?[]:this.#t.#E,t==="!"&&!this.#t.#f&&this.#E.push(this),this.#T=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#u=this.#r.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let t;for(;t=this.#E.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#T+1;!i.type&&r<i.#r.length;r++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#r[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof dt&&s.#o===this))throw new Error("invalid part: "+s);this.#r.push(s)}}toJSON(){let t=this.type===null?this.#r.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#r.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#f&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#T===0)return!0;let t=this.#o;for(let s=0;s<this.#T;s++){let i=t.#r[s];if(!(i instanceof dt&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#T===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new dt(this.type,t);for(let i of this.#r)s.copyIn(i);return s}static#s(t,s,i,r){let o=!1,n=!1,a=-1,l=!1;if(s.type===null){let p=i,d="";for(;p<t.length;){let m=t.charAt(p++);if(o||m==="\\"){o=!o,d+=m;continue}if(n){p===a+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(p===a+2&&l)&&(n=!1),d+=m;continue}else if(m==="["){n=!0,a=p,l=!1,d+=m;continue}if(!r.noext&&ea(m)&&t.charAt(p)==="("){s.push(d),d="";let y=new dt(m,s);p=dt.#s(t,y,p,r),s.push(y);continue}d+=m}return s.push(d),p}let h=i+1,f=new dt(null,s),c=[],u="";for(;h<t.length;){let p=t.charAt(h++);if(o||p==="\\"){o=!o,u+=p;continue}if(n){h===a+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(h===a+2&&l)&&(n=!1),u+=p;continue}else if(p==="["){n=!0,a=h,l=!1,u+=p;continue}if(ea(p)&&t.charAt(h)==="("){f.push(u),u="";let d=new dt(p,f);f.push(d),h=dt.#s(t,d,h,r);continue}if(p==="|"){f.push(u),u="",c.push(f),f=new dt(null,s);continue}if(p===")")return u===""&&s.#r.length===0&&(s.#c=!0),f.push(u),u="",s.push(...c,f),h;u+=p}return s.type=null,s.#i=void 0,s.#r=[t.substring(i-1)],h}static fromGlob(t,s={}){let i=new dt(null,void 0,s);return dt.#s(t,i,0,s),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let n=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,n),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#r.some(u=>typeof u!="string"),h=this.#r.map(u=>{let[p,d,m,y]=typeof u=="string"?dt.#b(u,this.#i,l):u.toRegExpSource(t);return this.#i=this.#i||m,this.#n=this.#n||y,p}).join(""),f="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&dp.has(this.#r[0]))){let u=pp,p=s&&u.has(h.charAt(0))||h.startsWith("\\.")&&u.has(h.charAt(2))||h.startsWith("\\.\\.")&&u.has(h.charAt(4)),d=!s&&!t&&u.has(h.charAt(0));f=p?up:d?si:""}let c="";return this.isEnd()&&this.#t.#f&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,Pe(h),this.#i=!!this.#i,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#p(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#r=[l],this.type=null,this.#i=void 0,[l,Pe(this.toString()),!1,!1]}let n=!i||t||s||!si?"":this.#p(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!s?si:"")+ia;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?si:"")+sa+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,Pe(o),this.#i=!!this.#i,this.#n]}#p(t){return this.#r.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#b(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(mp.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?ia:sa,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=cp(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=Xr,s=!0;continue}o+=gp(h)}return[o,Pe(t),!!s,n]}},ws=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),nt=(e,t,s={})=>(ui(t),!s.nocomment&&t.charAt(0)==="#"?!1:new ie(t,s).match(e)),yp=/^\*+([^+@!?\*\[\(]*)$/,wp=e=>t=>!t.startsWith(".")&&t.endsWith(e),bp=e=>t=>t.endsWith(e),Sp=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),vp=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ep=/^\*+\.\*+$/,xp=e=>!e.startsWith(".")&&e.includes("."),Tp=e=>e!=="."&&e!==".."&&e.includes("."),_p=/^\.\*+$/,Op=e=>e!=="."&&e!==".."&&e.startsWith("."),Ap=/^\*+$/,kp=e=>e.length!==0&&!e.startsWith("."),Rp=e=>e.length!==0&&e!=="."&&e!=="..",Cp=/^\?+([^+@!?\*\[\(]*)?$/,Np=([e,t=""])=>{let s=ka([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},jp=([e,t=""])=>{let s=Ra([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},Pp=([e,t=""])=>{let s=Ra([e]);return t?i=>s(i)&&i.endsWith(t):s},Fp=([e,t=""])=>{let s=ka([e]);return t?i=>s(i)&&i.endsWith(t):s},ka=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},Ra=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},Ca=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ra={win32:{sep:"\\"},posix:{sep:"/"}},Dp=Ca==="win32"?ra.win32.sep:ra.posix.sep;nt.sep=Dp;var ot=Symbol("globstar **");nt.GLOBSTAR=ot;var Mp="[^/]",$p=Mp+"*?",Lp="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ip="(?:(?!(?:\\/|^)\\.).)*?",Wp=(e,t={})=>s=>nt(s,e,t);nt.filter=Wp;var St=(e,t={})=>Object.assign({},e,t),zp=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return nt;let t=nt;return Object.assign((s,i,r={})=>t(s,i,St(e,r)),{Minimatch:class extends t.Minimatch{constructor(s,i={}){super(s,St(e,i))}static defaults(s){return t.defaults(St(e,s)).Minimatch}},AST:class extends t.AST{constructor(s,i,r={}){super(s,i,St(e,r))}static fromGlob(s,i={}){return t.AST.fromGlob(s,St(e,i))}},unescape:(s,i={})=>t.unescape(s,St(e,i)),escape:(s,i={})=>t.escape(s,St(e,i)),filter:(s,i={})=>t.filter(s,St(e,i)),defaults:s=>t.defaults(St(e,s)),makeRe:(s,i={})=>t.makeRe(s,St(e,i)),braceExpand:(s,i={})=>t.braceExpand(s,St(e,i)),match:(s,i,r={})=>t.match(s,i,St(e,r)),sep:t.sep,GLOBSTAR:ot})};nt.defaults=zp;var Na=(e,t={})=>(ui(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ip(e,{max:t.braceExpandMax}));nt.braceExpand=Na;var Up=(e,t={})=>new ie(e,t).makeRe();nt.makeRe=Up;var Bp=(e,t,s={})=>{let i=new ie(t,s);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e};nt.match=Bp;var oa=/[?*]|[+@!]\(.*?\)|\[|\]/,Gp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ie=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){ui(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Ca,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=r[0]===""&&r[1]===""&&(r[2]==="?"||!oa.test(r[2]))&&!oa.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(a)return[...r.slice(0,4),...r.slice(4).map(h=>this.parse(h))];if(l)return[r[0],...r.slice(1).map(h=>this.parse(h))]}return r.map(a=>this.parse(a))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let s=0;s<e.length;s++)for(let i=0;i<e[s].length;i++)e[s][i]==="**"&&(e[s][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let n=s[i+1],a=s[i+2],l=s[i+3];if(n!==".."||!a||a==="."||a===".."||!l||l==="."||l==="..")continue;t=!0,s.splice(i,1);let h=s.slice(0);h[i]="**",e.push(h),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let n=s[o];o===1&&n===""&&s[0]===""||(n==="."||n==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let n=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...n),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],n="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(n==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(n==="b")return!1;n="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(n==="a")return!1;n="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=this.options;if(this.isWindows){let d=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),m=!d&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),y=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),g=!y&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),b=m?3:d?0:void 0,v=g?3:y?0:void 0;if(typeof b=="number"&&typeof v=="number"){let[w,S]=[e[b],t[v]];w.toLowerCase()===S.toLowerCase()&&(t[v]=w,v>b?t=t.slice(v):b>v&&(e=e.slice(b)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var o=0,n=0,a=e.length,l=t.length;o<a&&n<l;o++,n++){this.debug("matchOne loop");var h=t[n],f=e[o];if(this.debug(t,h,f),h===!1)return!1;if(h===ot){this.debug("GLOBSTAR",[t,h,f]);var c=o,u=n+1;if(u===l){for(this.debug("** at the end");o<a;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;c<a;){var p=e[c];if(this.debug(`
|
|
12
|
+
`).join(o))+o:r};var Qu=e=>!!e&&typeof e=="object"&&!Array.isArray(e),tp=()=>{try{let e=Vr(Zu("package.json","utf8"));if(Qu(e))return Object.assign(e,{type:e.type==="commonjs"?"commonjs":"module"});throw new Error("Invalid package.json contents: "+ci(e))}catch(e){O("failed to read package.json",e),process.exit(1)}},_=tp();import{readdirSync as ep}from"fs";import{join as sp}from"path/posix";var ua=(e="src")=>{let t=[],s=ep(e,{withFileTypes:!0});for(let i of s){let r=`./${sp(e,i.name)}`;i.isFile()?t.push(r):i.isDirectory()&&t.push(...ua(r))}return t},ip=new Set(ua()),Vt=ip;var rp=e=>e==="commonjs"||e==="esm",pa=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>!rp(t))?!0:(O(`tshy.dialects must be an array including "esm" and/or "commonjs", got: ${JSON.stringify(e)}`),process.exit(1));var da=e=>e&&Array.isArray(e)&&e.length&&!e.some(t=>typeof t!="string")?!0:(O(`tshy.exclude must be an array of string glob patterns if defined, got: ${JSON.stringify(e)}`),process.exit(1));import{join as op}from"node:path/posix";var ma=e=>`./${op(e)}`;import{join as ga}from"path/posix";var Ut=(e,t)=>{if(typeof e=="string")return e;if(typeof e!="object")return;if(e===null)return e;if(Array.isArray(e)){for(let i of e){let r=Ut(i,t);if(r||r===null)return r}return}let s=[...t,"node","default"];for(let[i,r]of Object.entries(e))if(s.includes(i)){let o=Ut(r,t);if(o||o===null)return o}};var fi=e=>{let t=Ut(e,["import"]),s=Ut(e,["require"]);return!(t&&ga(t).startsWith("src/")||s&&ga(s).startsWith("src/"))};var Jr=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let[t,s]of Object.entries(e)){if(t!=="."&&!t.startsWith("./"))return O(`tshy.exports key must be "." or start with "./", got: ${t}`),process.exit(1);if(typeof s=="string"){e[t]=ma(s);continue}if(typeof s!="object")return O(`tshy.exports ${t} value must be valid package.json exports value, got: ${JSON.stringify(s)}`),process.exit(1);if(!fi(s))return O(`tshy.exports ${t} unbuilt exports must not be in ./src, and exports in src must be string values. got: ${JSON.stringify(s)}`),process.exit(1);e[t]=s}return!0};var np=(e,t)=>{if(!e||!t)return!1;for(let s of e)if(t.includes(s))return s;return!1},Kr=(e,t)=>{for(let s of e){if(typeof s!="string")return O(`${t} must be an array of strings, got: ${s}`),process.exit(1);if(s==="commonjs"||s==="cjs"||s==="esm"||s==="require"||s==="import"||s==="node"||s==="source"||s==="default")return O(`tshy.${t}Dialects must not contain ${JSON.stringify(s)}`),process.exit(1)}return!0},ya=({commonjsDialects:e,esmDialects:t,sourceDialects:s})=>{if(e===void 0&&t===void 0&&s===void 0)return!0;if(e&&!Kr(e,"commonjs")||t&&!Kr(t,"esm")||s&&!Kr(s,"source"))return!1;for(let[i,r,o,n]of[["commonjsDialects","esmDialects",e,t],["commonjsDialects","sourceDialects",e,s],["esmDialects","sourceDialects",t,s]]){let a=np(o,n);if(a)return O(`${i} and ${r} must be unique, found ${a} in both lists`),process.exit(1)}return!0};var wa=e=>{let{imports:t}=e;if(t===void 0)return!0;if(Array.isArray(t)||typeof t!="object")return O(`invalid imports object, must be Record<string, Import>, got: ${JSON.stringify(t)}`),process.exit(1);for(let[s,i]of Object.entries(t)){if(!s.startsWith("#")||s==="#"||s.startsWith("#/"))return O("invalid imports module specifier: "+s),process.exit(1);if(typeof i!="string"&&!fi(i))return O(`unbuilt package.imports ${s} must not be in ./src, and imports in ./src must be string values. got: `+JSON.stringify(i)),process.exit(1)}return!0};import{resolve as ap}from"path";import{readFileSync as lp}from"node:fs";var ba=e=>{if(typeof e=="string")try{return lp(ap(e),"utf8"),!0}catch{}return O(`tshy.project must point to a tsconfig file on disk, got: ${JSON.stringify(e)}`),process.exit(1)};var Sa=e=>e===void 0||e==="tsc"||e==="tsgo";var Xr=(e,t)=>{let s=e[t];return s===void 0||typeof s=="boolean"?!0:(O(`tshy.${t} must be a boolean value if specified, got: `+s),process.exit(1))},hp=e=>!!e&&Array.isArray(e)&&!e.some(t=>typeof t!="string"),cp=e=>!!e&&typeof e=="object"&&(e.exports===void 0||typeof e.exports=="string"||hp(e.exports)||Jr(e.exports))&&(e.dialects===void 0||pa(e.dialects))&&(e.project===void 0||ba(e.project))&&(e.exclude===void 0||da(e.exclude))&&ya(e)&&Sa(e.compiler)&&Xr(e,"selfLink")&&Xr(e,"main")&&Xr(e,"liveDev"),fp=(e,t)=>t.some(s=>s.match(e)),va=e=>Array.isArray(e)?e.map(t=>new oe(t.replace(/^\.\//,""))):va([e]),up=(e,t)=>{let s=cp(e.tshy)?e.tshy:{},i=s.exports;if(typeof i=="string"||Array.isArray(i)){let n={},l=va(i);for(let h of t){if(!fp(h.replace(/^\.\//,""),l))continue;let f=/^\.\/src\/index.([mc]?[jt]s|[jt]sx)$/.test(h)?".":"./"+h.replace(/^\.\/src\//,"").replace(/\.([mc]?[tj]s|[jt]sx)$/,"");n[f]=`./${h}`}Jr(n)?(n["./package.json"]="./package.json",s.exports=n):($("invalid exports pattern, using default exports"),delete s.exports,i=void 0)}let r={...s},o=r;if(o.imports&&(T(E.cyan.dim("imports")+" moving from tshy config to top level"),e.imports={...e.imports,...o.imports},delete o.imports),wa(e),!i){let n={"./package.json":"./package.json"};for(let a of t)if(/^\.\/src\/index\.[^\.]+$/.test(a)){n["."]=a;break}r.exports=n,s.exports=n,i=n}return e.tshy={...s,exports:i},r},pp=up(_,Vt),k=pp;import{fileURLToPath as gd}from"node:url";import{posix as Sd,win32 as ao}from"node:path";import{fileURLToPath as vd}from"node:url";import{lstatSync as Ed,readdir as xd,readdirSync as Td,readlinkSync as Od,realpathSync as _d}from"fs";import*as kd from"node:fs";import{lstat as Rd,readdir as Ad,readlink as Cd,realpath as Pd}from"node:fs/promises";import{EventEmitter as co}from"node:events";import ol from"node:stream";import{StringDecoder as jd}from"node:string_decoder";var Ga=(e,t,s)=>{let i=e instanceof RegExp?Ea(e,s):e,r=t instanceof RegExp?Ea(t,s):t,o=i!==null&&r!=null&&dp(i,r,s);return o&&{start:o[0],end:o[1],pre:s.slice(0,o[0]),body:s.slice(o[0]+i.length,o[1]),post:s.slice(o[1]+r.length)}},Ea=(e,t)=>{let s=t.match(e);return s?s[0]:null},dp=(e,t,s)=>{let i,r,o,n,a,l=s.indexOf(e),h=s.indexOf(t,l+1),f=l;if(l>=0&&h>0){if(e===t)return[l,h];for(i=[],o=s.length;f>=0&&!a;){if(f===l)i.push(f),l=s.indexOf(e,f+1);else if(i.length===1){let c=i.pop();c!==void 0&&(a=[c,h])}else r=i.pop(),r!==void 0&&r<o&&(o=r,n=h),h=s.indexOf(t,f+1);f=l<h&&l>=0?l:h}i.length&&n!==void 0&&(a=[o,n])}return a},Ha="\0SLASH"+Math.random()+"\0",Ya="\0OPEN"+Math.random()+"\0",lo="\0CLOSE"+Math.random()+"\0",qa="\0COMMA"+Math.random()+"\0",Va="\0PERIOD"+Math.random()+"\0",mp=new RegExp(Ha,"g"),gp=new RegExp(Ya,"g"),yp=new RegExp(lo,"g"),wp=new RegExp(qa,"g"),bp=new RegExp(Va,"g"),Sp=/\\\\/g,vp=/\\{/g,Ep=/\\}/g,xp=/\\,/g,Tp=/\\./g,Op=1e5;function Zr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function _p(e){return e.replace(Sp,Ha).replace(vp,Ya).replace(Ep,lo).replace(xp,qa).replace(Tp,Va)}function kp(e){return e.replace(mp,"\\").replace(gp,"{").replace(yp,"}").replace(wp,",").replace(bp,".")}function Ja(e){if(!e)return[""];let t=[],s=Ga("{","}",e);if(!s)return e.split(",");let{pre:i,body:r,post:o}=s,n=i.split(",");n[n.length-1]+="{"+r+"}";let a=Ja(o);return o.length&&(n[n.length-1]+=a.shift(),n.push.apply(n,a)),t.push.apply(t,n),t}function Rp(e,t={}){if(!e)return[];let{max:s=Op}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Es(_p(e),s,!0).map(kp)}function Ap(e){return"{"+e+"}"}function Cp(e){return/^-?0\d/.test(e)}function Pp(e,t){return e<=t}function jp(e,t){return e>=t}function Es(e,t,s){let i=[],r=Ga("{","}",e);if(!r)return[e];let o=r.pre,n=r.post.length?Es(r.post,t,!1):[""];if(/\$$/.test(r.pre))for(let a=0;a<n.length&&a<t;a++){let l=o+"{"+r.body+"}"+n[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),h=a||l,f=r.body.indexOf(",")>=0;if(!h&&!f)return r.post.match(/,(?!,).*\}/)?(e=r.pre+"{"+r.body+lo+r.post,Es(e,t,!0)):[e];let c;if(h)c=r.body.split(/\.\./);else if(c=Ja(r.body),c.length===1&&c[0]!==void 0&&(c=Es(c[0],t,!1).map(Ap),c.length===1))return n.map(p=>r.pre+c[0]+p);let u;if(h&&c[0]!==void 0&&c[1]!==void 0){let p=Zr(c[0]),d=Zr(c[1]),m=Math.max(c[0].length,c[1].length),y=c.length===3&&c[2]!==void 0?Math.abs(Zr(c[2])):1,g=Pp;d<p&&(y*=-1,g=jp);let b=c.some(Cp);u=[];for(let v=p;g(v,d);v+=y){let w;if(l)w=String.fromCharCode(v),w==="\\"&&(w="");else if(w=String(v),b){let S=m-w.length;if(S>0){let R=new Array(S+1).join("0");v<0?w="-"+R+w.slice(1):w=R+w}}u.push(w)}}else{u=[];for(let p=0;p<c.length;p++)u.push.apply(u,Es(c[p],t,!1))}for(let p=0;p<u.length;p++)for(let d=0;d<n.length&&i.length<t;d++){let m=o+u[p]+n[d];(!s||h||m)&&i.push(m)}}return i}var Ei=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},Np={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},gs=e=>e.replace(/[[\]\\-]/g,"\\$&"),Fp=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),xa=e=>e.join(""),Dp=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let i=[],r=[],o=s+1,n=!1,a=!1,l=!1,h=!1,f=s,c="";t:for(;o<e.length;){let d=e.charAt(o);if((d==="!"||d==="^")&&o===s+1){h=!0,o++;continue}if(d==="]"&&n&&!l){f=o+1;break}if(n=!0,d==="\\"&&!l){l=!0,o++;continue}if(d==="["&&!l){for(let[m,[y,g,b]]of Object.entries(Np))if(e.startsWith(m,o)){if(c)return["$.",!1,e.length-s,!0];o+=m.length,b?r.push(y):i.push(y),a=a||g;continue t}}if(l=!1,c){d>c?i.push(gs(c)+"-"+gs(d)):d===c&&i.push(gs(d)),c="",o++;continue}if(e.startsWith("-]",o+1)){i.push(gs(d+"-")),o+=2;continue}if(e.startsWith("-",o+1)){c=d,o+=2;continue}i.push(gs(d)),o++}if(f<o)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-s,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!h){let d=i[0].length===2?i[0].slice(-1):i[0];return[Fp(d),!1,f-s,!1]}let u="["+(h?"^":"")+xa(i)+"]",p="["+(h?"":"^")+xa(r)+"]";return[i.length&&r.length?"("+u+"|"+p+")":i.length?u:p,a,f-s,!0]},Ie=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),Mp=new Set(["!","?","+","*","@"]),Ta=e=>Mp.has(e),Lp="(?!(?:^|/)\\.\\.?(?:$|/))",ui="(?!\\.)",$p=new Set(["[","."]),Ip=new Set(["..","."]),Wp=new Set("().*{}+?[]^$\\!"),Up=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ho="[^/]",Oa=ho+"*?",_a=ho+"+?",Ka=class mt{type;#t;#i;#n=!1;#r=[];#o;#T;#E;#f=!1;#a;#u;#c=!1;constructor(t,s,i={}){this.type=t,t&&(this.#i=!0),this.#o=s,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#E=this.#t===this?[]:this.#t.#E,t==="!"&&!this.#t.#f&&this.#E.push(this),this.#T=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#u=this.#r.map(t=>String(t)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#f)return this;this.toString(),this.#f=!0;let t;for(;t=this.#E.pop();){if(t.type!=="!")continue;let s=t,i=s.#o;for(;i;){for(let r=s.#T+1;!i.type&&r<i.#r.length;r++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(i.#r[r])}s=i,i=s.#o}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof mt&&s.#o===this))throw new Error("invalid part: "+s);this.#r.push(s)}}toJSON(){let t=this.type===null?this.#r.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#r.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#f&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#T===0)return!0;let t=this.#o;for(let s=0;s<this.#T;s++){let i=t.#r[s];if(!(i instanceof mt&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#T===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new mt(this.type,t);for(let i of this.#r)s.copyIn(i);return s}static#s(t,s,i,r){let o=!1,n=!1,a=-1,l=!1;if(s.type===null){let p=i,d="";for(;p<t.length;){let m=t.charAt(p++);if(o||m==="\\"){o=!o,d+=m;continue}if(n){p===a+1?(m==="^"||m==="!")&&(l=!0):m==="]"&&!(p===a+2&&l)&&(n=!1),d+=m;continue}else if(m==="["){n=!0,a=p,l=!1,d+=m;continue}if(!r.noext&&Ta(m)&&t.charAt(p)==="("){s.push(d),d="";let y=new mt(m,s);p=mt.#s(t,y,p,r),s.push(y);continue}d+=m}return s.push(d),p}let h=i+1,f=new mt(null,s),c=[],u="";for(;h<t.length;){let p=t.charAt(h++);if(o||p==="\\"){o=!o,u+=p;continue}if(n){h===a+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(h===a+2&&l)&&(n=!1),u+=p;continue}else if(p==="["){n=!0,a=h,l=!1,u+=p;continue}if(Ta(p)&&t.charAt(h)==="("){f.push(u),u="";let d=new mt(p,f);f.push(d),h=mt.#s(t,d,h,r);continue}if(p==="|"){f.push(u),u="",c.push(f),f=new mt(null,s);continue}if(p===")")return u===""&&s.#r.length===0&&(s.#c=!0),f.push(u),u="",s.push(...c,f),h;u+=p}return s.type=null,s.#i=void 0,s.#r=[t.substring(i-1)],h}static fromGlob(t,s={}){let i=new mt(null,void 0,s);return mt.#s(t,i,0,s),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[s,i,r,o]=this.toRegExpSource();if(!(r||this.#i||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let n=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${s}$`,n),{_src:s,_glob:t})}get options(){return this.#a}toRegExpSource(t){let s=t??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#r.some(u=>typeof u!="string"),h=this.#r.map(u=>{let[p,d,m,y]=typeof u=="string"?mt.#b(u,this.#i,l):u.toRegExpSource(t);return this.#i=this.#i||m,this.#n=this.#n||y,p}).join(""),f="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&Ip.has(this.#r[0]))){let u=$p,p=s&&u.has(h.charAt(0))||h.startsWith("\\.")&&u.has(h.charAt(2))||h.startsWith("\\.\\.")&&u.has(h.charAt(4)),d=!s&&!t&&u.has(h.charAt(0));f=p?Lp:d?ui:""}let c="";return this.isEnd()&&this.#t.#f&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[f+h+c,Ie(h),this.#i=!!this.#i,this.#n]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#p(s);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#r=[l],this.type=null,this.#i=void 0,[l,Ie(this.toString()),!1,!1]}let n=!i||t||s||!ui?"":this.#p(!0);n===o&&(n=""),n&&(o=`(?:${o})(?:${n})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!s?ui:"")+_a;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?ui:"")+Oa+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=r+o+l}return[a,Ie(o),this.#i=!!this.#i,this.#n]}#p(t){return this.#r.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[i,r,o,n]=s.toRegExpSource(t);return this.#n=this.#n||n,i}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#b(t,s,i=!1){let r=!1,o="",n=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(r){r=!1,o+=(Wp.has(h)?"\\":"")+h;continue}if(h==="*"){if(a)continue;a=!0,o+=i&&/^[*]+$/.test(t)?_a:Oa,s=!0;continue}else a=!1;if(h==="\\"){l===t.length-1?o+="\\\\":r=!0;continue}if(h==="["){let[f,c,u,p]=Dp(t,l);if(u){o+=f,n=n||c,l+=u-1,s=s||p;continue}}if(h==="?"){o+=ho,s=!0;continue}o+=Up(h)}return[o,Ie(t),!!s,n]}},ks=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),ot=(e,t,s={})=>(Ei(t),!s.nocomment&&t.charAt(0)==="#"?!1:new le(t,s).match(e)),zp=/^\*+([^+@!?\*\[\(]*)$/,Bp=e=>t=>!t.startsWith(".")&&t.endsWith(e),Gp=e=>t=>t.endsWith(e),Hp=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Yp=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),qp=/^\*+\.\*+$/,Vp=e=>!e.startsWith(".")&&e.includes("."),Jp=e=>e!=="."&&e!==".."&&e.includes("."),Kp=/^\.\*+$/,Xp=e=>e!=="."&&e!==".."&&e.startsWith("."),Zp=/^\*+$/,Qp=e=>e.length!==0&&!e.startsWith("."),td=e=>e.length!==0&&e!=="."&&e!=="..",ed=/^\?+([^+@!?\*\[\(]*)?$/,sd=([e,t=""])=>{let s=Xa([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},id=([e,t=""])=>{let s=Za([e]);return t?(t=t.toLowerCase(),i=>s(i)&&i.toLowerCase().endsWith(t)):s},rd=([e,t=""])=>{let s=Za([e]);return t?i=>s(i)&&i.endsWith(t):s},od=([e,t=""])=>{let s=Xa([e]);return t?i=>s(i)&&i.endsWith(t):s},Xa=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},Za=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},Qa=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ka={win32:{sep:"\\"},posix:{sep:"/"}},nd=Qa==="win32"?ka.win32.sep:ka.posix.sep;ot.sep=nd;var rt=Symbol("globstar **");ot.GLOBSTAR=rt;var ad="[^/]",ld=ad+"*?",hd="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",cd="(?:(?!(?:\\/|^)\\.).)*?",fd=(e,t={})=>s=>ot(s,e,t);ot.filter=fd;var Et=(e,t={})=>Object.assign({},e,t),ud=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return ot;let t=ot;return Object.assign((s,i,r={})=>t(s,i,Et(e,r)),{Minimatch:class extends t.Minimatch{constructor(s,i={}){super(s,Et(e,i))}static defaults(s){return t.defaults(Et(e,s)).Minimatch}},AST:class extends t.AST{constructor(s,i,r={}){super(s,i,Et(e,r))}static fromGlob(s,i={}){return t.AST.fromGlob(s,Et(e,i))}},unescape:(s,i={})=>t.unescape(s,Et(e,i)),escape:(s,i={})=>t.escape(s,Et(e,i)),filter:(s,i={})=>t.filter(s,Et(e,i)),defaults:s=>t.defaults(Et(e,s)),makeRe:(s,i={})=>t.makeRe(s,Et(e,i)),braceExpand:(s,i={})=>t.braceExpand(s,Et(e,i)),match:(s,i,r={})=>t.match(s,i,Et(e,r)),sep:t.sep,GLOBSTAR:rt})};ot.defaults=ud;var tl=(e,t={})=>(Ei(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Rp(e,{max:t.braceExpandMax}));ot.braceExpand=tl;var pd=(e,t={})=>new le(e,t).makeRe();ot.makeRe=pd;var dd=(e,t,s={})=>{let i=new le(t,s);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e};ot.match=dd;var Ra=/[?*]|[+@!]\(.*?\)|\[|\]/,md=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),le=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){Ei(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Qa,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=r[0]===""&&r[1]===""&&(r[2]==="?"||!Ra.test(r[2]))&&!Ra.test(r[3]),l=/^[a-z]:/i.test(r[0]);if(a)return[...r.slice(0,4),...r.slice(4).map(h=>this.parse(h))];if(l)return[r[0],...r.slice(1).map(h=>this.parse(h))]}return r.map(a=>this.parse(a))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let s=0;s<e.length;s++)for(let i=0;i<e[s].length;i++)e[s][i]==="**"&&(e[s][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let n=s[i+1],a=s[i+2],l=s[i+3];if(n!==".."||!a||a==="."||a===".."||!l||l==="."||l==="..")continue;t=!0,s.splice(i,1);let h=s.slice(0);h[i]="**",e.push(h),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let n=s[o];o===1&&n===""&&s[0]===""||(n==="."||n==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let n=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...n),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],n="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(n==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(n==="b")return!1;n="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(n==="a")return!1;n="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=this.options;if(this.isWindows){let d=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),m=!d&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),y=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),g=!y&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),b=m?3:d?0:void 0,v=g?3:y?0:void 0;if(typeof b=="number"&&typeof v=="number"){let[w,S]=[e[b],t[v]];w.toLowerCase()===S.toLowerCase()&&(t[v]=w,v>b?t=t.slice(v):b>v&&(e=e.slice(b)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var o=0,n=0,a=e.length,l=t.length;o<a&&n<l;o++,n++){this.debug("matchOne loop");var h=t[n],f=e[o];if(this.debug(t,h,f),h===!1)return!1;if(h===rt){this.debug("GLOBSTAR",[t,h,f]);var c=o,u=n+1;if(u===l){for(this.debug("** at the end");o<a;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;c<a;){var p=e[c];if(this.debug(`
|
|
13
13
|
globstar while`,e,c,t,u,p),this.matchOne(e.slice(c),t.slice(u),s))return this.debug("globstar found match!",c,a,p),!0;if(p==="."||p===".."||!i.dot&&p.charAt(0)==="."){this.debug("dot detected!",e,c,t,u);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(s&&(this.debug(`
|
|
14
|
-
>>> no match, partial?`,e,c,t,u),c===a))}let d;if(typeof h=="string"?(d=f===h,this.debug("string match",h,f,d)):(d=h.test(f),this.debug("pattern match",h,f,d)),!d)return!1}if(o===a&&n===l)return!0;if(o===a)return s;if(n===l)return o===a-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Na(this.pattern,this.options)}parse(e){ui(e);let t=this.options;if(e==="**")return ot;if(e==="")return"";let s,i=null;(s=e.match(Ap))?i=t.dot?Rp:kp:(s=e.match(yp))?i=(t.nocase?t.dot?vp:Sp:t.dot?bp:wp)(s[1]):(s=e.match(Cp))?i=(t.nocase?t.dot?jp:Np:t.dot?Pp:Fp)(s):(s=e.match(Ep))?i=t.dot?Tp:xp:(s=e.match(_p))&&(i=Op);let r=Aa.fromGlob(e,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?$p:t.dot?Lp:Ip,i=new Set(t.nocase?["i"]:[]),r=e.map(a=>{let l=a.map(f=>{if(f instanceof RegExp)for(let c of f.flags.split(""))i.add(c);return typeof f=="string"?Gp(f):f===ot?ot:f._src});l.forEach((f,c)=>{let u=l[c+1],p=l[c-1];f!==ot||p===ot||(p===void 0?u!==void 0&&u!==ot?l[c+1]="(?:\\/|"+s+"\\/)?"+u:l[c]=s:u===void 0?l[c-1]=p+"(?:\\/|\\/"+s+")?":u!==ot&&(l[c-1]=p+"(?:\\/|\\/"+s+"\\/)"+u,l[c+1]=ot))});let h=l.filter(f=>f!==ot);if(this.partial&&h.length>=1){let f=[];for(let c=1;c<=h.length;c++)f.push(h.slice(0,c).join("/"));return"(?:"+f.join("|")+")"}return h.join("/")}).join("|"),[o,n]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+n+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+n+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let n=i.length-2;!o&&n>=0;n--)o=i[n];for(let n=0;n<r.length;n++){let a=r[n],l=i;if(s.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return nt.defaults(e).Minimatch}};nt.AST=Aa;nt.Minimatch=ie;nt.escape=ws;nt.unescape=Pe;var Yp=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ja=new Set,Vr=typeof process=="object"&&process?process:{},Pa=(e,t,s,i)=>{typeof Vr.emitWarning=="function"?Vr.emitWarning(e,t,s,i):console.error(`[${s}] ${t}: ${e}`)},pi=globalThis.AbortController,na=globalThis.AbortSignal;if(typeof pi>"u"){na=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},pi=class{constructor(){t()}signal=new na;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let e=Vr.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,Pa("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var qp=e=>!ja.has(e),se=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Fa=e=>se(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ci:null:null,ci=class extends Array{constructor(e){super(e),this.fill(0)}},Vp=class ds{heap;length;static#t=!1;static create(t){let s=Fa(t);if(!s)return[];ds.#t=!0;let i=new ds(t,s);return ds.#t=!1,i}constructor(t,s){if(!ds.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},mi=class Da{#t;#i;#n;#r;#o;#T;#E;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#u;#c;#l;#s;#p;#b;#w;#d;#k;#m;#x;#_;#g;#y;#S;#O;#e;#F;static unsafeExposeInternals(t){return{starts:t.#_,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#x,keyMap:t.#c,keyList:t.#l,valList:t.#s,next:t.#p,prev:t.#b,get head(){return t.#w},get tail(){return t.#d},free:t.#k,isBackgroundFetch:s=>t.#h(s),backgroundFetch:(s,i,r,o)=>t.#U(s,i,r,o),moveToTail:s=>t.#M(s),indexes:s=>t.#C(s),rindexes:s=>t.#N(s),isStale:s=>t.#v(s)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#u}get size(){return this.#a}get fetchMethod(){return this.#T}get memoMethod(){return this.#E}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:s=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:g,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:k,ignoreFetchAbort:M,perf:V}=t;if(V!==void 0&&typeof V?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=V??Yp,s!==0&&!se(s))throw new TypeError("max option must be a nonnegative integer");let st=s?Fa(s):Array;if(!st)throw new Error("invalid max value: "+s);if(this.#t=s,this.#i=d,this.maxEntrySize=m||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#E=b,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=g,this.#O=!!g,this.#c=new Map,this.#l=new Array(s).fill(void 0),this.#s=new Array(s).fill(void 0),this.#p=new st(s),this.#b=new st(s),this.#w=0,this.#d=0,this.#k=Vp.create(s),this.#a=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof f=="function"&&(this.#r=f),typeof c=="function"?(this.#o=c,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#S=!!this.#n,this.#F=!!this.#r,this.#e=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(this.#i!==0&&!se(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#G()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=se(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let Gt="LRU_CACHE_UNBOUNDED";qp(Gt)&&(ja.add(Gt),Pa("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Gt,Da))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#j(){let t=new ci(this.#t),s=new ci(this.#t);this.#g=t,this.#_=s;let i=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=i,this.#L=(n,a,l=this.#f.now())=>{if(s[n]=a!==0?l:0,t[n]=a,i?.[n]&&(clearTimeout(i[n]),i[n]=void 0),a!==0&&i){let h=setTimeout(()=>{this.#v(n)&&this.#R(this.#l[n],"expire")},a+1);h.unref&&h.unref(),i[n]=h}},this.#A=n=>{s[n]=t[n]!==0?this.#f.now():0},this.#P=(n,a)=>{if(t[a]){let l=t[a],h=s[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=r||o();let f=n.now-h;n.remainingTTL=l-f}};let r=0,o=()=>{let n=this.#f.now();if(this.ttlResolution>0){r=n;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=s[a];if(!l||!h)return 1/0;let f=(r||o())-h;return l-f},this.#v=n=>{let a=s[n],l=t[n];return!!l&&!!a&&(r||o())-a>l}}#A=()=>{};#P=()=>{};#L=()=>{};#v=()=>!1;#G(){let t=new ci(this.#t);this.#u=0,this.#x=t,this.#$=s=>{this.#u-=t[s],t[s]=0},this.#I=(s,i,r,o)=>{if(this.#h(i))return 0;if(!se(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(i,s),!se(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#D=(s,i,r)=>{if(t[s]=i,this.#i){let o=this.#i-t[s];for(;this.#u>o;)this.#z(!0)}this.#u+=t[s],r&&(r.entrySize=i,r.totalCalculatedSize=this.#u)}}#$=t=>{};#D=(t,s,i)=>{};#I=(t,s,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#d;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#w));)s=this.#b[s]}*#N({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#w;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#d));)s=this.#p[s]}#W(t){return t!==void 0&&this.#c.get(this.#l[t])===t}*entries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*rentries(){for(let t of this.#N())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*keys(){for(let t of this.#C()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*rkeys(){for(let t of this.#N()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*values(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#N())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,s={}){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#l[i],this))return this.get(this.#l[i],s)}}forEach(t,s=this){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}rforEach(t,s=this){for(let i of this.#N()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}purgeStale(){let t=!1;for(let s of this.#N({allowStale:!0}))this.#v(s)&&(this.#R(this.#l[s],"expire"),t=!0);return t}info(t){let s=this.#c.get(t);if(s===void 0)return;let i=this.#s[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#g&&this.#_){let n=this.#g[s],a=this.#_[s];if(n&&a){let l=n-(this.#f.now()-a);o.ttl=l,o.start=Date.now()}}return this.#x&&(o.size=this.#x[s]),o}dump(){let t=[];for(let s of this.#C({allowStale:!0})){let i=this.#l[s],r=this.#s[s],o=this.#h(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#g&&this.#_){n.ttl=this.#g[s];let a=this.#f.now()-this.#_[s];n.start=Math.floor(Date.now()-a)}this.#x&&(n.size=this.#x[s]),t.unshift([i,n])}return t}load(t){this.clear();for(let[s,i]of t){if(i.start){let r=Date.now()-i.start;i.start=this.#f.now()-r}this.set(s,i.value,i)}}set(t,s,i={}){if(s===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,f=this.#I(t,s,i.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(t,"set"),this;let c=this.#a===0?void 0:this.#c.get(t);if(c===void 0)c=this.#a===0?this.#d:this.#k.length!==0?this.#k.pop():this.#a===this.#t?this.#z(!1):this.#a,this.#l[c]=t,this.#s[c]=s,this.#c.set(t,c),this.#p[this.#d]=c,this.#b[c]=this.#d,this.#d=c,this.#a++,this.#D(c,f,l),l&&(l.set="add"),h=!1,this.#F&&this.#r?.(s,t,"add");else{this.#M(c);let u=this.#s[c];if(s!==u){if(this.#O&&this.#h(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=u;p!==void 0&&!n&&(this.#S&&this.#n?.(p,t,"set"),this.#e&&this.#m?.push([p,t,"set"]))}else n||(this.#S&&this.#n?.(u,t,"set"),this.#e&&this.#m?.push([u,t,"set"]));if(this.#$(c),this.#D(c,f,l),this.#s[c]=s,l){l.set="replace";let p=u&&this.#h(u)?u.__staleWhileFetching:u;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update");this.#F&&this.onInsert?.(s,t,s===u?"update":"replace")}if(r!==0&&!this.#g&&this.#j(),this.#g&&(h||this.#L(c,r,o),l&&this.#P(l,c)),!n&&this.#e&&this.#m){let u=this.#m,p;for(;p=u?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#w];if(this.#z(!0),this.#h(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}}#z(t){let s=this.#w,i=this.#l[s],r=this.#s[s];return this.#O&&this.#h(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(r,i,"evict"),this.#e&&this.#m?.push([r,i,"evict"])),this.#$(s),this.#y?.[s]&&(clearTimeout(this.#y[s]),this.#y[s]=void 0),t&&(this.#l[s]=void 0,this.#s[s]=void 0,this.#k.push(s)),this.#a===1?(this.#w=this.#d=0,this.#k.length=0):this.#w=this.#p[s],this.#c.delete(i),this.#a--,s}has(t,s={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=s,o=this.#c.get(t);if(o!==void 0){let n=this.#s[o];if(this.#h(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#v(o))r&&(r.has="stale",this.#P(r,o));else return i&&this.#A(o),r&&(r.has="hit",this.#P(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,s={}){let{allowStale:i=this.allowStale}=s,r=this.#c.get(t);if(r===void 0||!i&&this.#v(r))return;let o=this.#s[r];return this.#h(o)?o.__staleWhileFetching:o}#U(t,s,i,r){let o=s===void 0?void 0:this.#s[s];if(this.#h(o))return o;let n=new pi,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:i,context:r},h=(m,y=!1)=>{let{aborted:g}=n.signal,b=i.ignoreFetchAbort&&m!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(g&&!y?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!b&&!y)return c(n.signal.reason,v);let w=p,S=this.#s[s];return(S===p||b&&y&&S===void 0)&&(m===void 0?w.__staleWhileFetching!==void 0?this.#s[s]=w.__staleWhileFetching:this.#R(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,m,l.options))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),c(m,!1)),c=(m,y)=>{let{aborted:g}=n.signal,b=g&&i.allowStaleOnFetchAbort,v=b||i.allowStaleOnFetchRejection,w=v||i.noDeleteOnFetchRejection,S=p;if(this.#s[s]===p&&(!w||!y&&S.__staleWhileFetching===void 0?this.#R(t,"fetch"):b||(this.#s[s]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},u=(m,y)=>{let g=this.#T?.(t,o,l);g&&g instanceof Promise&&g.then(b=>m(b===void 0?void 0:b),y),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=b=>h(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(u).then(h,f),d=Object.assign(p,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return s===void 0?(this.set(t,d,{...l.options,status:void 0}),s=this.#c.get(t)):this.#s[s]=d,d}#h(t){if(!this.#O)return!1;let s=t;return!!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof pi}async fetch(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:m,forceRefresh:y=!1,status:g,signal:b}=s;if(!this.#O)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let v={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:b},w=this.#c.get(t);if(w===void 0){g&&(g.fetch="miss");let S=this.#U(t,w,v,m);return S.__returned=S}else{let S=this.#s[w];if(this.#h(S)){let st=i&&S.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",st&&(g.returnedStale=!0)),st?S.__staleWhileFetching:S.__returned=S}let k=this.#v(w);if(!y&&!k)return g&&(g.fetch="hit"),this.#M(w),r&&this.#A(w),g&&this.#P(g,w),S;let M=this.#U(t,w,v,m),V=M.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=k?"stale":"refresh",V&&k&&(g.returnedStale=!0)),V?M.__staleWhileFetching:M.__returned=M}}async forceFetch(t,s={}){let i=await this.fetch(t,s);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,s={}){let i=this.#E;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=s,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=i(t,a,{options:n,context:r});return this.set(t,l,n),l}get(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=s,a=this.#c.get(t);if(a!==void 0){let l=this.#s[a],h=this.#h(l);return n&&this.#P(n,a),this.#v(a)?(n&&(n.get="stale"),h?(n&&i&&l.__staleWhileFetching!==void 0&&(n.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.#R(t,"expire"),n&&i&&(n.returnedStale=!0),i?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(this.#M(a),r&&this.#A(a),l))}else n&&(n.get="miss")}#B(t,s){this.#b[s]=t,this.#p[t]=s}#M(t){t!==this.#d&&(t===this.#w?this.#w=this.#p[t]:this.#B(this.#b[t],this.#p[t]),this.#B(this.#d,t),this.#d=t)}delete(t){return this.#R(t,"delete")}#R(t,s){let i=!1;if(this.#a!==0){let r=this.#c.get(t);if(r!==void 0)if(this.#y?.[r]&&(clearTimeout(this.#y?.[r]),this.#y[r]=void 0),i=!0,this.#a===1)this.#H(s);else{this.#$(r);let o=this.#s[r];if(this.#h(o)?o.__abortController.abort(new Error("deleted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(o,t,s),this.#e&&this.#m?.push([o,t,s])),this.#c.delete(t),this.#l[r]=void 0,this.#s[r]=void 0,r===this.#d)this.#d=this.#b[r];else if(r===this.#w)this.#w=this.#p[r];else{let n=this.#b[r];this.#p[n]=this.#p[r];let a=this.#p[r];this.#b[a]=this.#b[r]}this.#a--,this.#k.push(r)}}if(this.#e&&this.#m?.length){let r=this.#m,o;for(;o=r?.shift();)this.#o?.(...o)}return i}clear(){return this.#H("delete")}#H(t){for(let s of this.#N({allowStale:!0})){let i=this.#s[s];if(this.#h(i))i.__abortController.abort(new Error("deleted"));else{let r=this.#l[s];this.#S&&this.#n?.(i,r,t),this.#e&&this.#m?.push([i,r,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#g&&this.#_){this.#g.fill(0),this.#_.fill(0);for(let s of this.#y??[])s!==void 0&&clearTimeout(s);this.#y?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#w=0,this.#d=0,this.#k.length=0,this.#u=0,this.#a=0,this.#e&&this.#m){let s=this.#m,i;for(;i=s?.shift();)this.#o?.(...i)}}},aa=typeof process=="object"&&process?process:{stdout:null,stderr:null},ld=e=>!!e&&typeof e=="object"&&(e instanceof di||e instanceof Ma||hd(e)||cd(e)),hd=e=>!!e&&typeof e=="object"&&e instanceof Zr&&typeof e.pipe=="function"&&e.pipe!==Ma.Writable.prototype.pipe,cd=e=>!!e&&typeof e=="object"&&e instanceof Zr&&typeof e.write=="function"&&typeof e.end=="function",Yt=Symbol("EOF"),qt=Symbol("maybeEmitEnd"),ee=Symbol("emittedEnd"),ii=Symbol("emittingEnd"),ls=Symbol("emittedError"),ri=Symbol("closed"),la=Symbol("read"),oi=Symbol("flush"),ha=Symbol("flushChunk"),Nt=Symbol("encoding"),Ne=Symbol("decoder"),I=Symbol("flowing"),hs=Symbol("paused"),je=Symbol("resume"),W=Symbol("buffer"),rt=Symbol("pipes"),z=Symbol("bufferLength"),zr=Symbol("bufferPush"),ni=Symbol("bufferShift"),K=Symbol("objectMode"),F=Symbol("destroyed"),Ur=Symbol("error"),Br=Symbol("emitData"),ca=Symbol("emitEnd"),Gr=Symbol("emitEnd2"),Lt=Symbol("async"),Hr=Symbol("abort"),ai=Symbol("aborted"),cs=Symbol("signal"),de=Symbol("dataListeners"),pt=Symbol("discarded"),fs=e=>Promise.resolve().then(e),fd=e=>e(),ud=e=>e==="end"||e==="finish"||e==="prefinish",pd=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,dd=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),$a=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[je](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},md=class extends $a{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},gd=e=>!!e.objectMode,yd=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",di=class extends Zr{[I]=!1;[hs]=!1;[rt]=[];[W]=[];[K];[Nt];[Lt];[Ne];[Yt]=!1;[ee]=!1;[ii]=!1;[ri]=!1;[ls]=null;[z]=0;[F]=!1;[cs];[ai]=!1;[de]=0;[pt]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");gd(t)?(this[K]=!0,this[Nt]=null):yd(t)?(this[Nt]=t.encoding,this[K]=!1):(this[K]=!1,this[Nt]=null),this[Lt]=!!t.async,this[Ne]=this[Nt]?new ad(this[Nt]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[W]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[rt]});let{signal:s}=t;s&&(this[cs]=s,s.aborted?this[Hr]():s.addEventListener("abort",()=>this[Hr]()))}get bufferLength(){return this[z]}get encoding(){return this[Nt]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[K]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Lt]}set async(e){this[Lt]=this[Lt]||!!e}[Hr](){this[ai]=!0,this.emit("abort",this[cs]?.reason),this.destroy(this[cs]?.reason)}get aborted(){return this[ai]}set aborted(e){}write(e,t,s){if(this[ai])return!1;if(this[Yt])throw new Error("write after end");if(this[F])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[Lt]?fs:fd;if(!this[K]&&!Buffer.isBuffer(e)){if(dd(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(pd(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[K]?(this[I]&&this[z]!==0&&this[oi](!0),this[I]?this.emit("data",e):this[zr](e),this[z]!==0&&this.emit("readable"),s&&i(s),this[I]):e.length?(typeof e=="string"&&!(t===this[Nt]&&!this[Ne]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Nt]&&(e=this[Ne].write(e)),this[I]&&this[z]!==0&&this[oi](!0),this[I]?this.emit("data",e):this[zr](e),this[z]!==0&&this.emit("readable"),s&&i(s),this[I]):(this[z]!==0&&this.emit("readable"),s&&i(s),this[I])}read(e){if(this[F])return null;if(this[pt]=!1,this[z]===0||e===0||e&&e>this[z])return this[qt](),null;this[K]&&(e=null),this[W].length>1&&!this[K]&&(this[W]=[this[Nt]?this[W].join(""):Buffer.concat(this[W],this[z])]);let t=this[la](e||null,this[W][0]);return this[qt](),t}[la](e,t){if(this[K])this[ni]();else{let s=t;e===s.length||e===null?this[ni]():typeof s=="string"?(this[W][0]=s.slice(e),t=s.slice(0,e),this[z]-=e):(this[W][0]=s.subarray(e),t=s.subarray(0,e),this[z]-=e)}return this.emit("data",t),!this[W].length&&!this[Yt]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[Yt]=!0,this.writable=!1,(this[I]||!this[hs])&&this[qt](),this}[je](){this[F]||(!this[de]&&!this[rt].length&&(this[pt]=!0),this[hs]=!1,this[I]=!0,this.emit("resume"),this[W].length?this[oi]():this[Yt]?this[qt]():this.emit("drain"))}resume(){return this[je]()}pause(){this[I]=!1,this[hs]=!0,this[pt]=!1}get destroyed(){return this[F]}get flowing(){return this[I]}get paused(){return this[hs]}[zr](e){this[K]?this[z]+=1:this[z]+=e.length,this[W].push(e)}[ni](){return this[K]?this[z]-=1:this[z]-=this[W][0].length,this[W].shift()}[oi](e=!1){do;while(this[ha](this[ni]())&&this[W].length);!e&&!this[W].length&&!this[Yt]&&this.emit("drain")}[ha](e){return this.emit("data",e),this[I]}pipe(e,t){if(this[F])return e;this[pt]=!1;let s=this[ee];return t=t||{},e===aa.stdout||e===aa.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[rt].push(t.proxyErrors?new md(this,e,t):new $a(this,e,t)),this[Lt]?fs(()=>this[je]()):this[je]()),e}unpipe(e){let t=this[rt].find(s=>s.dest===e);t&&(this[rt].length===1?(this[I]&&this[de]===0&&(this[I]=!1),this[rt]=[]):this[rt].splice(this[rt].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[pt]=!1,this[de]++,!this[rt].length&&!this[I]&&this[je]();else if(e==="readable"&&this[z]!==0)super.emit("readable");else if(ud(e)&&this[ee])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ls]){let i=t;this[Lt]?fs(()=>i.call(this,this[ls])):i.call(this,this[ls])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[de]=this.listeners("data").length,this[de]===0&&!this[pt]&&!this[rt].length&&(this[I]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[de]=0,!this[pt]&&!this[rt].length&&(this[I]=!1)),t}get emittedEnd(){return this[ee]}[qt](){!this[ii]&&!this[ee]&&!this[F]&&this[W].length===0&&this[Yt]&&(this[ii]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ri]&&this.emit("close"),this[ii]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==F&&this[F])return!1;if(e==="data")return!this[K]&&!s?!1:this[Lt]?(fs(()=>this[Br](s)),!0):this[Br](s);if(e==="end")return this[ca]();if(e==="close"){if(this[ri]=!0,!this[ee]&&!this[F])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[ls]=s,super.emit(Ur,s);let r=!this[cs]||this.listeners("error").length?super.emit("error",s):!1;return this[qt](),r}else if(e==="resume"){let r=super.emit("resume");return this[qt](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[qt](),i}[Br](e){for(let s of this[rt])s.dest.write(e)===!1&&this.pause();let t=this[pt]?!1:super.emit("data",e);return this[qt](),t}[ca](){return this[ee]?!1:(this[ee]=!0,this.readable=!1,this[Lt]?(fs(()=>this[Gr]()),!0):this[Gr]())}[Gr](){if(this[Ne]){let t=this[Ne].end();if(t){for(let s of this[rt])s.dest.write(t);this[pt]||super.emit("data",t)}}for(let t of this[rt])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[K]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[K]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[K])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Nt]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(F,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[pt]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[Yt])return t();let i,r,o=h=>{this.off("data",n),this.off("end",a),this.off(F,l),t(),r(h)},n=h=>{this.off("error",o),this.off("end",a),this.off(F,l),this.pause(),i({value:h,done:!!this[Yt]})},a=()=>{this.off("error",o),this.off("data",n),this.off(F,l),t(),i({done:!0,value:void 0})},l=()=>o(new Error("stream destroyed"));return new Promise((h,f)=>{r=f,i=h,this.once(F,l),this.once("error",o),this.once("end",a),this.once("data",n)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[pt]=!1;let e=!1,t=()=>(this.pause(),this.off(Ur,t),this.off(F,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(Ur,t),this.once(F,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[F])return e?this.emit("error",e):this.emit(F),this;this[F]=!0,this[pt]=!0,this[W].length=0,this[z]=0;let t=this;return typeof t.close=="function"&&!this[ri]&&t.close(),e?this.emit("error",e):this.emit(F),this}static get isStream(){return ld}},wd=ed.native,ms={lstatSync:Xp,readdir:Zp,readdirSync:Qp,readlinkSync:td,realpathSync:wd,promises:{lstat:id,readdir:rd,readlink:od,realpath:nd}},La=e=>!e||e===ms||e===sd?ms:{...ms,...e,promises:{...ms.promises,...e.promises||{}}},Ia=/^\\\\\?\\([a-z]:)\\?$/i,bd=e=>e.replace(/\//g,"\\").replace(Ia,"$1\\"),Sd=/[\\\/]/,Et=0,Wa=1,za=2,It=4,Ua=6,Ba=8,me=10,Ga=12,vt=15,us=~vt,Yr=16,fa=32,gs=64,jt=128,li=256,fi=512,ua=gs|jt|fi,vd=1023,qr=e=>e.isFile()?Ba:e.isDirectory()?It:e.isSymbolicLink()?me:e.isCharacterDevice()?za:e.isBlockDevice()?Ua:e.isSocket()?Ga:e.isFIFO()?Wa:Et,pa=new mi({max:2**12}),ys=e=>{let t=pa.get(e);if(t)return t;let s=e.normalize("NFKD");return pa.set(e,s),s},da=new mi({max:2**12}),hi=e=>{let t=da.get(e);if(t)return t;let s=ys(e.toLowerCase());return da.set(e,s),s},ma=class extends mi{constructor(){super({max:256})}},Ed=class extends mi{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Ha=Symbol("PathScurry setAsCwd"),ct=class{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#T;get gid(){return this.#T}#E;get rdev(){return this.#E}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#u;get size(){return this.#u}#c;get blocks(){return this.#c}#l;get atimeMs(){return this.#l}#s;get mtimeMs(){return this.#s}#p;get ctimeMs(){return this.#p}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#d;get mtime(){return this.#d}#k;get ctime(){return this.#k}#m;get birthtime(){return this.#m}#x;#_;#g;#y;#S;#O;#e;#F;#j;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Et,s,i,r,o,n){this.name=e,this.#x=r?hi(e):ys(e),this.#e=t&vd,this.nocase=r,this.roots=i,this.root=s||this,this.#F=o,this.#g=n.fullpath,this.#S=n.relative,this.#O=n.relativePosix,this.parent=n.parent,this.parent?this.#t=this.parent.#t:this.#t=La(n.fs)}depth(){return this.#_!==void 0?this.#_:this.parent?this.#_=this.parent.depth()+1:this.#_=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),s=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#P(s):this.#P(s)}#P(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#e&=~Yr,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?hi(e):ys(e);for(let a of s)if(a.#x===i)return a;let r=this.parent?this.sep:"",o=this.#g?this.#g+r+e:void 0,n=this.newChild(e,Et,{...t,parent:this,fullpath:o});return this.canReaddir()||(n.#e|=jt),s.push(n),n}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let e=this.name,t=this.parent;if(!t)return this.#O=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#g!==void 0)return this.#g;let e=this.name,t=this.parent;if(!t)return this.#g=this.name;let s=t.fullpath()+(t.parent?this.sep:"")+e;return this.#g=s}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#y=`//?/${i}`:this.#y=i}let e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#y=s}isUnknown(){return(this.#e&vt)===Et}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&vt)===Ba}isDirectory(){return(this.#e&vt)===It}isCharacterDevice(){return(this.#e&vt)===za}isBlockDevice(){return(this.#e&vt)===Ua}isFIFO(){return(this.#e&vt)===Wa}isSocket(){return(this.#e&vt)===Ga}isSymbolicLink(){return(this.#e&me)===me}lstatCached(){return this.#e&fa?this:void 0}readlinkCached(){return this.#j}realpathCached(){return this.#A}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#j)return!0;if(!this.parent)return!1;let e=this.#e&vt;return!(e!==Et&&e!==me||this.#e&li||this.#e&jt)}calledReaddir(){return!!(this.#e&Yr)}isENOENT(){return!!(this.#e&jt)}isNamed(e){return this.nocase?this.#x===hi(e):this.#x===ys(e)}async readlink(){let e=this.#j;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#j=s}catch(t){this.#N(t.code);return}}readlinkSync(){let e=this.#j;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#j=s}catch(t){this.#N(t.code);return}}#L(e){this.#e|=Yr;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#v()}}#v(){this.#e&jt||(this.#e=(this.#e|jt)&us,this.#G())}#G(){let e=this.children();e.provisional=0;for(let t of e)t.#v()}#$(){this.#e|=fi,this.#D()}#D(){if(this.#e&gs)return;let e=this.#e;(e&vt)===It&&(e&=us),this.#e=e|gs,this.#G()}#I(e=""){e==="ENOTDIR"||e==="EPERM"?this.#D():e==="ENOENT"?this.#v():this.children().provisional=0}#C(e=""){e==="ENOTDIR"?this.parent.#D():e==="ENOENT"&&this.#v()}#N(e=""){let t=this.#e;t|=li,e==="ENOENT"&&(t|=jt),(e==="EINVAL"||e==="UNKNOWN")&&(t&=us),this.#e=t,e==="ENOTDIR"&&this.parent&&this.parent.#D()}#W(e,t){return this.#U(e,t)||this.#z(e,t)}#z(e,t){let s=qr(e),i=this.newChild(e.name,s,{parent:this}),r=i.#e&vt;return r!==It&&r!==me&&r!==Et&&(i.#e|=gs),t.unshift(i),t.provisional++,i}#U(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?hi(e.name):ys(e.name))===i.#x)return this.#h(e,i,s,t)}}#h(e,t,s,i){let r=t.name;return t.#e=t.#e&us|qr(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#e&jt)===0)try{return this.#B(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#C(e.code)}}lstatSync(){if((this.#e&jt)===0)try{return this.#B(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#C(e.code)}}#B(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:n,ctime:a,ctimeMs:l,dev:h,gid:f,ino:c,mode:u,mtime:p,mtimeMs:d,nlink:m,rdev:y,size:g,uid:b}=e;this.#w=t,this.#l=s,this.#m=i,this.#b=r,this.#f=o,this.#c=n,this.#k=a,this.#p=l,this.#i=h,this.#T=f,this.#a=c,this.#n=u,this.#d=p,this.#s=d,this.#r=m,this.#E=y,this.#u=g,this.#o=b;let v=qr(e);this.#e=this.#e&us|v|fa,v!==Et&&v!==It&&v!==me&&(this.#e|=gs)}#M=[];#R=!1;#H(e){this.#R=!1;let t=this.#M.slice();this.#M.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#M.push(e),this.#R)return;this.#R=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#I(r.code),s.provisional=0;else{for(let n of o)this.#W(n,s);this.#L(s)}this.#H(s.slice(0,s.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#Y)await this.#Y;else{let s=()=>{};this.#Y=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(t,{withFileTypes:!0}))this.#W(i,e);this.#L(e)}catch(i){this.#I(i.code),e.provisional=0}this.#Y=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#t.readdirSync(t,{withFileTypes:!0}))this.#W(s,e);this.#L(e)}catch(s){this.#I(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#e&ua)return!1;let e=vt&this.#e;return e===Et||e===It||e===me}shouldWalk(e,t){return(this.#e&It)===It&&!(this.#e&ua)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#A)return this.#A;if(!((fi|li|jt)&this.#e))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#A=this.resolve(e)}catch{this.#$()}}realpathSync(){if(this.#A)return this.#A;if(!((fi|li|jt)&this.#e))try{let e=this.#t.realpathSync(this.fullpath());return this.#A=this.resolve(e)}catch{this.#$()}}[Ha](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#S=s.join(this.sep),i.#O=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#S=void 0,i.#O=void 0,i=i.parent}},Ya=class qa extends ct{sep="\\";splitSep=Sd;constructor(t,s=Et,i,r,o,n,a){super(t,s,i,r,o,n,a)}newChild(t,s=Et,i={}){return new qa(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return Jr.parse(t).root}getRoot(t){if(t=bd(t.toUpperCase()),t===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(t,s))return this.roots[t]=i;return this.roots[t]=new Qr(t,this).root}sameRoot(t,s=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Ia,"$1\\"),t===s}},Va=class Ja extends ct{splitSep="/";sep="/";constructor(t,s=Et,i,r,o,n,a){super(t,s,i,r,o,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,s=Et,i={}){return new Ja(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Ka=class{root;rootPath;roots;cwd;#t;#i;#n;nocase;#r;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=ms}={}){this.#r=La(o),(e instanceof URL||e.startsWith("file://"))&&(e=Kp(e));let n=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(n),this.#t=new ma,this.#i=new ma,this.#n=new Ed(r);let a=n.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,h=a.length-1,f=t.sep,c=this.rootPath,u=!1;for(let p of a){let d=h--;l=l.child(p,{relative:new Array(d).fill("..").join(f),relativePosix:new Array(d).fill("..").join("/"),fullpath:c+=(u?"":f)+p}),u=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#t.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#t.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#i.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#i.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=[];(!r||r(e))&&n.push(s?e:e.fullpath());let a=new Set,l=(f,c)=>{a.add(f),f.readdirCB((u,p)=>{if(u)return c(u);let d=p.length;if(!d)return c();let m=()=>{--d===0&&c()};for(let y of p)(!r||r(y))&&n.push(s?y:y.fullpath()),i&&y.isSymbolicLink()?y.realpath().then(g=>g?.isUnknown()?g.lstat():g).then(g=>g?.shouldWalk(a,o)?l(g,m):m()):y.shouldWalk(a,o)?l(y,m):m()},!0)},h=e;return new Promise((f,c)=>{l(h,u=>{if(u)return c(u);f(n)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=[];(!r||r(e))&&n.push(s?e:e.fullpath());let a=new Set([e]);for(let l of a){let h=l.readdirSync();for(let f of h){(!r||r(f))&&n.push(s?f:f.fullpath());let c=f;if(f.isSymbolicLink()){if(!(i&&(c=f.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(a,o)&&a.add(c)}}return n}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let n=new Set([e]);for(let a of n){let l=a.readdirSync();for(let h of l){(!r||r(h))&&(yield s?h:h.fullpath());let f=h;if(h.isSymbolicLink()){if(!(i&&(f=h.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(n,o)&&n.add(f)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=new di({objectMode:!0});(!r||r(e))&&n.write(s?e:e.fullpath());let a=new Set,l=[e],h=0,f=()=>{let c=!1;for(;!c;){let u=l.shift();if(!u){h===0&&n.end();return}h++,a.add(u);let p=(m,y,g=!1)=>{if(m)return n.emit("error",m);if(i&&!g){let b=[];for(let v of y)v.isSymbolicLink()&&b.push(v.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(b.length){Promise.all(b).then(()=>p(null,y,!0));return}}for(let b of y)b&&(!r||r(b))&&(n.write(s?b:b.fullpath())||(c=!0));h--;for(let b of y){let v=b.realpathCached()||b;v.shouldWalk(a,o)&&l.push(v)}c&&!n.flowing?n.once("drain",f):d||f()},d=!0;u.readdirCB(p,!0),d=!1}};return f(),n}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ct||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=new di({objectMode:!0}),a=new Set;(!r||r(e))&&n.write(s?e:e.fullpath());let l=[e],h=0,f=()=>{let c=!1;for(;!c;){let u=l.shift();if(!u){h===0&&n.end();return}h++,a.add(u);let p=u.readdirSync();for(let d of p)(!r||r(d))&&(n.write(s?d:d.fullpath())||(c=!0));h--;for(let d of p){let m=d;if(d.isSymbolicLink()){if(!(i&&(m=d.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(a,o)&&l.push(m)}}c&&!n.flowing&&n.once("drain",f)};return f(),n}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Ha](t)}},Qr=class extends Ka{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,Jr,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Jr.parse(e).root.toUpperCase()}newRoot(e){return new Ya(this.rootPath,It,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},to=class extends Ka{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,Jp,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new Va(this.rootPath,It,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Xa=class extends to{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},iS=process.platform==="win32"?Ya:Va,xd=process.platform==="win32"?Qr:process.platform==="darwin"?Xa:to,Td=e=>e.length>=1,_d=e=>e.length>=1,Od=Symbol.for("nodejs.util.inspect.custom"),Za=class Qa{#t;#i;#n;length;#r;#o;#T;#E;#f;#a;#u=!0;constructor(t,s,i,r){if(!Td(t))throw new TypeError("empty pattern list");if(!_d(s))throw new TypeError("empty glob list");if(s.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#i=s,this.#n=i,this.#r=r,this.#n===0){if(this.isUNC()){let[o,n,a,l,...h]=this.#t,[f,c,u,p,...d]=this.#i;h[0]===""&&(h.shift(),d.shift());let m=[o,n,a,l,""].join("/"),y=[f,c,u,p,""].join("/");this.#t=[m,...h],this.#i=[y,...d],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...n]=this.#t,[a,...l]=this.#i;n[0]===""&&(n.shift(),l.shift());let h=o+"/",f=a+"/";this.#t=[h,...n],this.#i=[f,...l],this.length=this.#t.length}}}[Od](){return"Pattern <"+this.#i.slice(this.#n).join("/")+">"}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===ot}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#T=this.#T||(this.#n===0?this.isAbsolute()?this.#i[0]+this.#i.slice(1).join("/"):this.#i.join("/"):this.#i.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new Qa(this.#t,this.#i,this.#n+1,this.#r),this.#o.#a=this.#a,this.#o.#f=this.#f,this.#o.#E=this.#E,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#E!==void 0?this.#E:this.#E=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#u?!1:(this.#u=!1,!0)}},Ad=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ga=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=Ad}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let n of e)this.add(n)}add(e){let t=new ie(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new Za(i,r,0,this.platform),n=new ie(o.globString(),this.mmopts),a=r[r.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(n):this.relative.push(n),a&&(l?this.absoluteChildren.push(n):this.relativeChildren.push(n))}}ignored(e){let t=e.fullpath(),s=`${t}/`,i=e.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}},kd=class tl{store;constructor(t=new Map){this.store=t}copy(){return new tl(new Map(this.store))}hasWalked(t,s){return this.store.get(t.fullpath())?.has(s.globString())}storeWalked(t,s){let i=t.fullpath(),r=this.store.get(i);r?r.add(s.globString()):this.store.set(i,new Set([s.globString()]))}},Rd=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Cd=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},ya=class el{hasWalkedCache;matches=new Rd;subwalks=new Cd;patterns;follow;dot;opts;constructor(t,s){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=s?s.copy():new kd}processPatterns(t,s){this.patterns=s;let i=s.map(r=>[t,r]);for(let[r,o]of i){this.hasWalkedCache.storeWalked(r,o);let n=o.root(),a=o.isAbsolute()&&this.opts.absolute!==!1;if(n){r=r.resolve(n==="/"&&this.opts.root!==void 0?this.opts.root:n);let c=o.rest();if(c)o=c;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let l,h,f=!1;for(;typeof(l=o.pattern())=="string"&&(h=o.rest());)r=r.resolve(l),o=h,f=!0;if(l=o.pattern(),h=o.rest(),f){if(this.hasWalkedCache.hasWalked(r,o))continue;this.hasWalkedCache.storeWalked(r,o)}if(typeof l=="string"){let c=l===".."||l===""||l===".";this.matches.add(r.resolve(l),a,c);continue}else if(l===ot){(!r.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(r,o);let c=h?.pattern(),u=h?.rest();if(!h||(c===""||c===".")&&!u)this.matches.add(r,a,c===""||c===".");else if(c===".."){let p=r.parent||r;u?this.hasWalkedCache.hasWalked(p,u)||this.subwalks.add(p,u):this.matches.add(p,a,!0)}}else l instanceof RegExp&&this.subwalks.add(r,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new el(this.opts,this.hasWalkedCache)}filterEntries(t,s){let i=this.subwalks.get(t),r=this.child();for(let o of s)for(let n of i){let a=n.isAbsolute(),l=n.pattern(),h=n.rest();l===ot?r.testGlobstar(o,n,h,a):l instanceof RegExp?r.testRegExp(o,l,h,a):r.testString(o,l,h,a)}return r}testGlobstar(t,s,i,r){if((this.dot||!t.name.startsWith("."))&&(s.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,s):t.isSymbolicLink()&&(i&&s.checkFollowGlobstar()?this.subwalks.add(t,i):s.markFollowGlobstar()&&this.subwalks.add(t,s)))),i){let o=i.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,i.rest(),r);else if(o===".."){let n=t.parent||t;this.subwalks.add(n,i)}else o instanceof RegExp&&this.testRegExp(t,o,i.rest(),r)}}testRegExp(t,s,i,r){s.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,r,!1))}testString(t,s,i,r){t.isNamed(s)&&(i?this.subwalks.add(t,i):this.matches.add(t,r,!1))}},Nd=(e,t)=>typeof e=="string"?new ga([e],t):Array.isArray(e)?new ga(e,t):e,sl=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#i;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#i=Nd(s.ignore??[],s),!this.includeChildMatches&&typeof this.#i.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(e){return this.seen.has(e)||!!this.#i?.ignored?.(e)}#o(e){return!!this.#i?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#t.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#t.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let i=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let r=await i.realpath();r&&(r.isUnknown()||this.opts.stat)&&await r.lstat()}return this.matchCheckTest(i,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let i=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let r=i.realpathSync();r&&(r?.isUnknown()||this.opts.stat)&&r.lstatSync()}return this.matchCheckTest(i,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#i?.add){let r=`${e.relativePosix()}/**`;this.#i.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new ya(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||(r++,this.match(n,a,l).then(()=>o()));for(let n of s.subwalkTargets()){if(this.maxDepth!==1/0&&n.depth()>=this.maxDepth)continue;r++;let a=n.readdirCached();n.calledReaddir()?this.walkCB3(n,a,s,o):n.readdirCB((l,h)=>this.walkCB3(n,h,s,o),!0)}o()}walkCB3(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||(r++,this.match(n,a,l).then(()=>o()));for(let[n,a]of s.subwalks.entries())r++,this.walkCB2(n,a,s.child(),o);o()}walkCBSync(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new ya(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||this.matchSync(n,a,l);for(let n of s.subwalkTargets()){if(this.maxDepth!==1/0&&n.depth()>=this.maxDepth)continue;r++;let a=n.readdirSync();this.walkCB3Sync(n,a,s,o)}o()}walkCB3Sync(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||this.matchSync(n,a,l);for(let[n,a]of s.subwalks.entries())r++,this.walkCB2Sync(n,a,s.child(),o);o()}},wa=class extends sl{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},ba=class extends sl{results;constructor(e,t,s){super(e,t,s),this.results=new di({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},jd=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ye=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=Hp(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=e,this.platform=t.platform||jd,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=t.platform==="win32"?Qr:t.platform==="darwin"?Xa:t.platform?to:xd;this.scurry=new a(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(a=>new ie(a,i)),[o,n]=r.reduce((a,l)=>(a[0].push(...l.set),a[1].push(...l.globParts),a),[[],[]]);this.patterns=o.map((a,l)=>{let h=n[l];if(!h)throw new Error("invalid pattern object");return new Za(a,h,0,this.platform)})}async walk(){return[...await new wa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new wa(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new ba(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new ba(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},Pd=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let s of e)if(new ie(s,t).hasMagic())return!0;return!1};function gi(e,t={}){return new ye(e,t).streamSync()}function il(e,t={}){return new ye(e,t).stream()}function we(e,t={}){return new ye(e,t).walkSync()}async function Sa(e,t={}){return new ye(e,t).walk()}function yi(e,t={}){return new ye(e,t).iterateSync()}function rl(e,t={}){return new ye(e,t).iterate()}var Fd=gi,Dd=Object.assign(il,{sync:gi}),Md=yi,$d=Object.assign(rl,{sync:yi}),Ld=Object.assign(we,{stream:gi,iterate:yi}),ge=Object.assign(Sa,{glob:Sa,globSync:we,sync:Ld,globStream:il,stream:Dd,globStreamSync:gi,streamSync:Fd,globIterate:rl,iterate:$d,globIterateSync:yi,iterateSync:Md,Glob:ye,hasMagic:Pd,escape:ws,unescape:Pe});ge.glob=ge;import{dirname as ol}from"path";import{mkdir as Id,mkdirSync as Wd,stat as zd,statSync as Ud}from"fs";var xt=e=>{if(!e)e={mode:511};else if(typeof e=="object")e={mode:511,...e};else if(typeof e=="number")e={mode:e};else if(typeof e=="string")e={mode:parseInt(e,8)};else throw new TypeError("invalid options argument");let t=e,s=e.fs||{};return e.mkdir=e.mkdir||s.mkdir||Id,e.mkdirAsync=e.mkdirAsync?e.mkdirAsync:async(i,r)=>new Promise((o,n)=>t.mkdir(i,r,(a,l)=>a?n(a):o(l))),e.stat=e.stat||s.stat||zd,e.statAsync=e.statAsync?e.statAsync:async i=>new Promise((r,o)=>t.stat(i,(n,a)=>n?o(n):r(a))),e.statSync=e.statSync||s.statSync||Ud,e.mkdirSync=e.mkdirSync||s.mkdirSync||Wd,t};var Wt=(e,t,s)=>{let i=ol(e),r={...xt(t),recursive:!1};if(i===e)try{return r.mkdirSync(e,r)}catch(o){let n=o;if(n&&n.code!=="EISDIR")throw o;return}try{return r.mkdirSync(e,r),s||e}catch(o){let n=o;if(n&&n.code==="ENOENT")return Wt(e,r,Wt(i,r,s));if(n&&n.code!=="EEXIST"&&n&&n.code!=="EROFS")throw o;try{if(!r.statSync(e).isDirectory())throw o}catch{throw o}}},Vt=Object.assign(async(e,t,s)=>{let i=xt(t);i.recursive=!1;let r=ol(e);return r===e?i.mkdirAsync(e,i).catch(o=>{let n=o;if(n&&n.code!=="EISDIR")throw o}):i.mkdirAsync(e,i).then(()=>s||e,async o=>{let n=o;if(n&&n.code==="ENOENT")return Vt(r,i).then(a=>Vt(e,i,a));if(n&&n.code!=="EEXIST"&&n.code!=="EROFS")throw o;return i.statAsync(e).then(a=>{if(a.isDirectory())return s;throw o},()=>{throw o})})},{sync:Wt});import{dirname as al}from"path";import{dirname as nl}from"path";var eo=async(e,t,s)=>{if(s!==t)return e.statAsync(t).then(i=>i.isDirectory()?s:void 0,i=>{let r=i;return r&&r.code==="ENOENT"?eo(e,nl(t),t):void 0})},so=(e,t,s)=>{if(s!==t)try{return e.statSync(t).isDirectory()?s:void 0}catch(i){let r=i;return r&&r.code==="ENOENT"?so(e,nl(t),t):void 0}};var Fe=(e,t)=>{let s=xt(t);if(s.recursive=!0,al(e)===e)return s.mkdirSync(e,s);let r=so(s,e);try{return s.mkdirSync(e,s),r}catch(o){let n=o;if(n&&n.code==="ENOENT")return Wt(e,s);throw o}},bs=Object.assign(async(e,t)=>{let s={...xt(t),recursive:!0};return al(e)===e?await s.mkdirAsync(e,s):eo(s,e).then(r=>s.mkdirAsync(e,s).then(o=>r||o).catch(o=>{let n=o;if(n&&n.code==="ENOENT")return Vt(e,s);throw o}))},{sync:Fe});import{parse as Gd,resolve as Hd}from"path";var Bd=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,io=e=>{if(/\0/.test(e))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:e,code:"ERR_INVALID_ARG_VALUE"});if(e=Hd(e),Bd==="win32"){let t=/[*|"<>?:]/,{root:s}=Gd(e);if(t.test(e.substring(s.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e};import{mkdir as Yd,mkdirSync as qd}from"fs";var Vd=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,ro=Vd.replace(/^v/,"").split("."),ll=+ro[0]>10||+ro[0]==10&&+ro[1]>=12,Ss=ll?e=>xt(e).mkdirSync===qd:()=>!1,wi=Object.assign(ll?e=>xt(e).mkdir===Yd:()=>!1,{sync:Ss});var Jt=(e,t)=>{e=io(e);let s=xt(t);return Ss(s)?Fe(e,s):Wt(e,s)};var oo=Object.assign(async(e,t)=>{e=io(e);let s=xt(t);return wi(s)?bs(e,s):Vt(e,s)},{mkdirpSync:Jt,mkdirpNative:bs,mkdirpNativeSync:Fe,mkdirpManual:Vt,mkdirpManualSync:Wt,sync:Jt,native:bs,nativeSync:Fe,manual:Vt,manualSync:Wt,useNative:wi,useNativeSync:Ss});import ug from"node:constants";import{createHash as mh}from"node:crypto";import{chmodSync as gh,copyFileSync as pg,linkSync as dg,readFileSync as yh,readlinkSync as wh,symlinkSync as mg,unlinkSync as gg}from"node:fs";import{dirname as Ds,relative as bh,resolve as qi,sep as yg}from"node:path";var Jd=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,cl=new Set,no=typeof process=="object"&&process?process:{},fl=(e,t,s,i)=>{typeof no.emitWarning=="function"?no.emitWarning(e,t,s,i):console.error(`[${s}] ${t}: ${e}`)},Si=globalThis.AbortController,hl=globalThis.AbortSignal;if(typeof Si>"u"){hl=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},Si=class{constructor(){t()}signal=new hl;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let e=no.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,fl("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Kd=e=>!cl.has(e);var re=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),ul=e=>re(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?bi:null:null,bi=class extends Array{constructor(e){super(e),this.fill(0)}},Xd=class vs{heap;length;static#t=!1;static create(t){let s=ul(t);if(!s)return[];vs.#t=!0;let i=new vs(t,s);return vs.#t=!1,i}constructor(t,s){if(!vs.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Es=class pl{#t;#i;#n;#r;#o;#T;#E;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#u;#c;#l;#s;#p;#b;#w;#d;#k;#m;#x;#_;#g;#y;#S;#O;#e;#F;static unsafeExposeInternals(t){return{starts:t.#_,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#x,keyMap:t.#c,keyList:t.#l,valList:t.#s,next:t.#p,prev:t.#b,get head(){return t.#w},get tail(){return t.#d},free:t.#k,isBackgroundFetch:s=>t.#h(s),backgroundFetch:(s,i,r,o)=>t.#U(s,i,r,o),moveToTail:s=>t.#M(s),indexes:s=>t.#C(s),rindexes:s=>t.#N(s),isStale:s=>t.#v(s)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#u}get size(){return this.#a}get fetchMethod(){return this.#T}get memoMethod(){return this.#E}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:s=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:g,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:k,ignoreFetchAbort:M,perf:V}=t;if(V!==void 0&&typeof V?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=V??Jd,s!==0&&!re(s))throw new TypeError("max option must be a nonnegative integer");let st=s?ul(s):Array;if(!st)throw new Error("invalid max value: "+s);if(this.#t=s,this.#i=d,this.maxEntrySize=m||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#E=b,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=g,this.#O=!!g,this.#c=new Map,this.#l=new Array(s).fill(void 0),this.#s=new Array(s).fill(void 0),this.#p=new st(s),this.#b=new st(s),this.#w=0,this.#d=0,this.#k=Xd.create(s),this.#a=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof f=="function"&&(this.#r=f),typeof c=="function"?(this.#o=c,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#S=!!this.#n,this.#F=!!this.#r,this.#e=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(this.#i!==0&&!re(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!re(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#G()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=re(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!re(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let Gt="LRU_CACHE_UNBOUNDED";Kd(Gt)&&(cl.add(Gt),fl("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Gt,pl))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#j(){let t=new bi(this.#t),s=new bi(this.#t);this.#g=t,this.#_=s;let i=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=i,this.#L=(n,a,l=this.#f.now())=>{if(s[n]=a!==0?l:0,t[n]=a,i?.[n]&&(clearTimeout(i[n]),i[n]=void 0),a!==0&&i){let h=setTimeout(()=>{this.#v(n)&&this.#R(this.#l[n],"expire")},a+1);h.unref&&h.unref(),i[n]=h}},this.#A=n=>{s[n]=t[n]!==0?this.#f.now():0},this.#P=(n,a)=>{if(t[a]){let l=t[a],h=s[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=r||o();let f=n.now-h;n.remainingTTL=l-f}};let r=0,o=()=>{let n=this.#f.now();if(this.ttlResolution>0){r=n;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=s[a];if(!l||!h)return 1/0;let f=(r||o())-h;return l-f},this.#v=n=>{let a=s[n],l=t[n];return!!l&&!!a&&(r||o())-a>l}}#A=()=>{};#P=()=>{};#L=()=>{};#v=()=>!1;#G(){let t=new bi(this.#t);this.#u=0,this.#x=t,this.#$=s=>{this.#u-=t[s],t[s]=0},this.#I=(s,i,r,o)=>{if(this.#h(i))return 0;if(!re(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(i,s),!re(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#D=(s,i,r)=>{if(t[s]=i,this.#i){let o=this.#i-t[s];for(;this.#u>o;)this.#z(!0)}this.#u+=t[s],r&&(r.entrySize=i,r.totalCalculatedSize=this.#u)}}#$=t=>{};#D=(t,s,i)=>{};#I=(t,s,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#d;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#w));)s=this.#b[s]}*#N({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#w;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#d));)s=this.#p[s]}#W(t){return t!==void 0&&this.#c.get(this.#l[t])===t}*entries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*rentries(){for(let t of this.#N())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*keys(){for(let t of this.#C()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*rkeys(){for(let t of this.#N()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*values(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#N())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,s={}){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#l[i],this))return this.get(this.#l[i],s)}}forEach(t,s=this){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}rforEach(t,s=this){for(let i of this.#N()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}purgeStale(){let t=!1;for(let s of this.#N({allowStale:!0}))this.#v(s)&&(this.#R(this.#l[s],"expire"),t=!0);return t}info(t){let s=this.#c.get(t);if(s===void 0)return;let i=this.#s[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#g&&this.#_){let n=this.#g[s],a=this.#_[s];if(n&&a){let l=n-(this.#f.now()-a);o.ttl=l,o.start=Date.now()}}return this.#x&&(o.size=this.#x[s]),o}dump(){let t=[];for(let s of this.#C({allowStale:!0})){let i=this.#l[s],r=this.#s[s],o=this.#h(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#g&&this.#_){n.ttl=this.#g[s];let a=this.#f.now()-this.#_[s];n.start=Math.floor(Date.now()-a)}this.#x&&(n.size=this.#x[s]),t.unshift([i,n])}return t}load(t){this.clear();for(let[s,i]of t){if(i.start){let r=Date.now()-i.start;i.start=this.#f.now()-r}this.set(s,i.value,i)}}set(t,s,i={}){if(s===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,f=this.#I(t,s,i.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(t,"set"),this;let c=this.#a===0?void 0:this.#c.get(t);if(c===void 0)c=this.#a===0?this.#d:this.#k.length!==0?this.#k.pop():this.#a===this.#t?this.#z(!1):this.#a,this.#l[c]=t,this.#s[c]=s,this.#c.set(t,c),this.#p[this.#d]=c,this.#b[c]=this.#d,this.#d=c,this.#a++,this.#D(c,f,l),l&&(l.set="add"),h=!1,this.#F&&this.#r?.(s,t,"add");else{this.#M(c);let u=this.#s[c];if(s!==u){if(this.#O&&this.#h(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=u;p!==void 0&&!n&&(this.#S&&this.#n?.(p,t,"set"),this.#e&&this.#m?.push([p,t,"set"]))}else n||(this.#S&&this.#n?.(u,t,"set"),this.#e&&this.#m?.push([u,t,"set"]));if(this.#$(c),this.#D(c,f,l),this.#s[c]=s,l){l.set="replace";let p=u&&this.#h(u)?u.__staleWhileFetching:u;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update");this.#F&&this.onInsert?.(s,t,s===u?"update":"replace")}if(r!==0&&!this.#g&&this.#j(),this.#g&&(h||this.#L(c,r,o),l&&this.#P(l,c)),!n&&this.#e&&this.#m){let u=this.#m,p;for(;p=u?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#w];if(this.#z(!0),this.#h(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}}#z(t){let s=this.#w,i=this.#l[s],r=this.#s[s];return this.#O&&this.#h(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(r,i,"evict"),this.#e&&this.#m?.push([r,i,"evict"])),this.#$(s),this.#y?.[s]&&(clearTimeout(this.#y[s]),this.#y[s]=void 0),t&&(this.#l[s]=void 0,this.#s[s]=void 0,this.#k.push(s)),this.#a===1?(this.#w=this.#d=0,this.#k.length=0):this.#w=this.#p[s],this.#c.delete(i),this.#a--,s}has(t,s={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=s,o=this.#c.get(t);if(o!==void 0){let n=this.#s[o];if(this.#h(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#v(o))r&&(r.has="stale",this.#P(r,o));else return i&&this.#A(o),r&&(r.has="hit",this.#P(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,s={}){let{allowStale:i=this.allowStale}=s,r=this.#c.get(t);if(r===void 0||!i&&this.#v(r))return;let o=this.#s[r];return this.#h(o)?o.__staleWhileFetching:o}#U(t,s,i,r){let o=s===void 0?void 0:this.#s[s];if(this.#h(o))return o;let n=new Si,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:i,context:r},h=(m,y=!1)=>{let{aborted:g}=n.signal,b=i.ignoreFetchAbort&&m!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(g&&!y?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!b&&!y)return c(n.signal.reason,v);let w=p,S=this.#s[s];return(S===p||b&&y&&S===void 0)&&(m===void 0?w.__staleWhileFetching!==void 0?this.#s[s]=w.__staleWhileFetching:this.#R(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,m,l.options))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),c(m,!1)),c=(m,y)=>{let{aborted:g}=n.signal,b=g&&i.allowStaleOnFetchAbort,v=b||i.allowStaleOnFetchRejection,w=v||i.noDeleteOnFetchRejection,S=p;if(this.#s[s]===p&&(!w||!y&&S.__staleWhileFetching===void 0?this.#R(t,"fetch"):b||(this.#s[s]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},u=(m,y)=>{let g=this.#T?.(t,o,l);g&&g instanceof Promise&&g.then(b=>m(b===void 0?void 0:b),y),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=b=>h(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(u).then(h,f),d=Object.assign(p,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return s===void 0?(this.set(t,d,{...l.options,status:void 0}),s=this.#c.get(t)):this.#s[s]=d,d}#h(t){if(!this.#O)return!1;let s=t;return!!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof Si}async fetch(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:m,forceRefresh:y=!1,status:g,signal:b}=s;if(!this.#O)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let v={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:b},w=this.#c.get(t);if(w===void 0){g&&(g.fetch="miss");let S=this.#U(t,w,v,m);return S.__returned=S}else{let S=this.#s[w];if(this.#h(S)){let st=i&&S.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",st&&(g.returnedStale=!0)),st?S.__staleWhileFetching:S.__returned=S}let k=this.#v(w);if(!y&&!k)return g&&(g.fetch="hit"),this.#M(w),r&&this.#A(w),g&&this.#P(g,w),S;let M=this.#U(t,w,v,m),V=M.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=k?"stale":"refresh",V&&k&&(g.returnedStale=!0)),V?M.__staleWhileFetching:M.__returned=M}}async forceFetch(t,s={}){let i=await this.fetch(t,s);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,s={}){let i=this.#E;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=s,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=i(t,a,{options:n,context:r});return this.set(t,l,n),l}get(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=s,a=this.#c.get(t);if(a!==void 0){let l=this.#s[a],h=this.#h(l);return n&&this.#P(n,a),this.#v(a)?(n&&(n.get="stale"),h?(n&&i&&l.__staleWhileFetching!==void 0&&(n.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.#R(t,"expire"),n&&i&&(n.returnedStale=!0),i?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(this.#M(a),r&&this.#A(a),l))}else n&&(n.get="miss")}#B(t,s){this.#b[s]=t,this.#p[t]=s}#M(t){t!==this.#d&&(t===this.#w?this.#w=this.#p[t]:this.#B(this.#b[t],this.#p[t]),this.#B(this.#d,t),this.#d=t)}delete(t){return this.#R(t,"delete")}#R(t,s){let i=!1;if(this.#a!==0){let r=this.#c.get(t);if(r!==void 0)if(this.#y?.[r]&&(clearTimeout(this.#y?.[r]),this.#y[r]=void 0),i=!0,this.#a===1)this.#H(s);else{this.#$(r);let o=this.#s[r];if(this.#h(o)?o.__abortController.abort(new Error("deleted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(o,t,s),this.#e&&this.#m?.push([o,t,s])),this.#c.delete(t),this.#l[r]=void 0,this.#s[r]=void 0,r===this.#d)this.#d=this.#b[r];else if(r===this.#w)this.#w=this.#p[r];else{let n=this.#b[r];this.#p[n]=this.#p[r];let a=this.#p[r];this.#b[a]=this.#b[r]}this.#a--,this.#k.push(r)}}if(this.#e&&this.#m?.length){let r=this.#m,o;for(;o=r?.shift();)this.#o?.(...o)}return i}clear(){return this.#H("delete")}#H(t){for(let s of this.#N({allowStale:!0})){let i=this.#s[s];if(this.#h(i))i.__abortController.abort(new Error("deleted"));else{let r=this.#l[s];this.#S&&this.#n?.(i,r,t),this.#e&&this.#m?.push([i,r,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#g&&this.#_){this.#g.fill(0),this.#_.fill(0);for(let s of this.#y??[])s!==void 0&&clearTimeout(s);this.#y?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#w=0,this.#d=0,this.#k.length=0,this.#u=0,this.#a=0,this.#e&&this.#m){let s=this.#m,i;for(;i=s?.shift();)this.#o?.(...i)}}};import{posix as lm,win32 as yo}from"node:path";import{fileURLToPath as hm}from"node:url";import{lstatSync as cm,readdir as fm,readdirSync as um,readlinkSync as pm,realpathSync as dm}from"fs";import*as mm from"node:fs";import{lstat as ym,readdir as wm,readlink as bm,realpath as Sm}from"node:fs/promises";import{EventEmitter as po}from"node:events";import wl from"node:stream";import{StringDecoder as Zd}from"node:string_decoder";var dl=typeof process=="object"&&process?process:{stdout:null,stderr:null},Qd=e=>!!e&&typeof e=="object"&&(e instanceof $e||e instanceof wl||tm(e)||em(e)),tm=e=>!!e&&typeof e=="object"&&e instanceof po&&typeof e.pipe=="function"&&e.pipe!==wl.Writable.prototype.pipe,em=e=>!!e&&typeof e=="object"&&e instanceof po&&typeof e.write=="function"&&typeof e.end=="function",Kt=Symbol("EOF"),Xt=Symbol("maybeEmitEnd"),oe=Symbol("emittedEnd"),vi=Symbol("emittingEnd"),xs=Symbol("emittedError"),Ei=Symbol("closed"),ml=Symbol("read"),xi=Symbol("flush"),gl=Symbol("flushChunk"),Pt=Symbol("encoding"),De=Symbol("decoder"),U=Symbol("flowing"),Ts=Symbol("paused"),Me=Symbol("resume"),B=Symbol("buffer"),at=Symbol("pipes"),G=Symbol("bufferLength"),ao=Symbol("bufferPush"),Ti=Symbol("bufferShift"),X=Symbol("objectMode"),D=Symbol("destroyed"),lo=Symbol("error"),ho=Symbol("emitData"),yl=Symbol("emitEnd"),co=Symbol("emitEnd2"),zt=Symbol("async"),fo=Symbol("abort"),_i=Symbol("aborted"),_s=Symbol("signal"),be=Symbol("dataListeners"),mt=Symbol("discarded"),Os=e=>Promise.resolve().then(e),sm=e=>e(),im=e=>e==="end"||e==="finish"||e==="prefinish",rm=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,om=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Oi=class{src;dest;opts;ondrain;constructor(t,s,i){this.src=t,this.dest=s,this.opts=i,this.ondrain=()=>t[Me](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},uo=class extends Oi{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,s,i){super(t,s,i),this.proxyErrors=r=>s.emit("error",r),t.on("error",this.proxyErrors)}},nm=e=>!!e.objectMode,am=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",$e=class extends po{[U]=!1;[Ts]=!1;[at]=[];[B]=[];[X];[Pt];[zt];[De];[Kt]=!1;[oe]=!1;[vi]=!1;[Ei]=!1;[xs]=null;[G]=0;[D]=!1;[_s];[_i]=!1;[be]=0;[mt]=!1;writable=!0;readable=!0;constructor(...t){let s=t[0]||{};if(super(),s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");nm(s)?(this[X]=!0,this[Pt]=null):am(s)?(this[Pt]=s.encoding,this[X]=!1):(this[X]=!1,this[Pt]=null),this[zt]=!!s.async,this[De]=this[Pt]?new Zd(this[Pt]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[at]});let{signal:i}=s;i&&(this[_s]=i,i.aborted?this[fo]():i.addEventListener("abort",()=>this[fo]()))}get bufferLength(){return this[G]}get encoding(){return this[Pt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[X]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[zt]}set async(t){this[zt]=this[zt]||!!t}[fo](){this[_i]=!0,this.emit("abort",this[_s]?.reason),this.destroy(this[_s]?.reason)}get aborted(){return this[_i]}set aborted(t){}write(t,s,i){if(this[_i])return!1;if(this[Kt])throw new Error("write after end");if(this[D])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let r=this[zt]?Os:sm;if(!this[X]&&!Buffer.isBuffer(t)){if(om(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(rm(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[X]?(this[U]&&this[G]!==0&&this[xi](!0),this[U]?this.emit("data",t):this[ao](t),this[G]!==0&&this.emit("readable"),i&&r(i),this[U]):t.length?(typeof t=="string"&&!(s===this[Pt]&&!this[De]?.lastNeed)&&(t=Buffer.from(t,s)),Buffer.isBuffer(t)&&this[Pt]&&(t=this[De].write(t)),this[U]&&this[G]!==0&&this[xi](!0),this[U]?this.emit("data",t):this[ao](t),this[G]!==0&&this.emit("readable"),i&&r(i),this[U]):(this[G]!==0&&this.emit("readable"),i&&r(i),this[U])}read(t){if(this[D])return null;if(this[mt]=!1,this[G]===0||t===0||t&&t>this[G])return this[Xt](),null;this[X]&&(t=null),this[B].length>1&&!this[X]&&(this[B]=[this[Pt]?this[B].join(""):Buffer.concat(this[B],this[G])]);let s=this[ml](t||null,this[B][0]);return this[Xt](),s}[ml](t,s){if(this[X])this[Ti]();else{let i=s;t===i.length||t===null?this[Ti]():typeof i=="string"?(this[B][0]=i.slice(t),s=i.slice(0,t),this[G]-=t):(this[B][0]=i.subarray(t),s=i.subarray(0,t),this[G]-=t)}return this.emit("data",s),!this[B].length&&!this[Kt]&&this.emit("drain"),s}end(t,s,i){return typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s="utf8"),t!==void 0&&this.write(t,s),i&&this.once("end",i),this[Kt]=!0,this.writable=!1,(this[U]||!this[Ts])&&this[Xt](),this}[Me](){this[D]||(!this[be]&&!this[at].length&&(this[mt]=!0),this[Ts]=!1,this[U]=!0,this.emit("resume"),this[B].length?this[xi]():this[Kt]?this[Xt]():this.emit("drain"))}resume(){return this[Me]()}pause(){this[U]=!1,this[Ts]=!0,this[mt]=!1}get destroyed(){return this[D]}get flowing(){return this[U]}get paused(){return this[Ts]}[ao](t){this[X]?this[G]+=1:this[G]+=t.length,this[B].push(t)}[Ti](){return this[X]?this[G]-=1:this[G]-=this[B][0].length,this[B].shift()}[xi](t=!1){do;while(this[gl](this[Ti]())&&this[B].length);!t&&!this[B].length&&!this[Kt]&&this.emit("drain")}[gl](t){return this.emit("data",t),this[U]}pipe(t,s){if(this[D])return t;this[mt]=!1;let i=this[oe];return s=s||{},t===dl.stdout||t===dl.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&t.end():(this[at].push(s.proxyErrors?new uo(this,t,s):new Oi(this,t,s)),this[zt]?Os(()=>this[Me]()):this[Me]()),t}unpipe(t){let s=this[at].find(i=>i.dest===t);s&&(this[at].length===1?(this[U]&&this[be]===0&&(this[U]=!1),this[at]=[]):this[at].splice(this[at].indexOf(s),1),s.unpipe())}addListener(t,s){return this.on(t,s)}on(t,s){let i=super.on(t,s);if(t==="data")this[mt]=!1,this[be]++,!this[at].length&&!this[U]&&this[Me]();else if(t==="readable"&&this[G]!==0)super.emit("readable");else if(im(t)&&this[oe])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[xs]){let r=s;this[zt]?Os(()=>r.call(this,this[xs])):r.call(this,this[xs])}return i}removeListener(t,s){return this.off(t,s)}off(t,s){let i=super.off(t,s);return t==="data"&&(this[be]=this.listeners("data").length,this[be]===0&&!this[mt]&&!this[at].length&&(this[U]=!1)),i}removeAllListeners(t){let s=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[be]=0,!this[mt]&&!this[at].length&&(this[U]=!1)),s}get emittedEnd(){return this[oe]}[Xt](){!this[vi]&&!this[oe]&&!this[D]&&this[B].length===0&&this[Kt]&&(this[vi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ei]&&this.emit("close"),this[vi]=!1)}emit(t,...s){let i=s[0];if(t!=="error"&&t!=="close"&&t!==D&&this[D])return!1;if(t==="data")return!this[X]&&!i?!1:this[zt]?(Os(()=>this[ho](i)),!0):this[ho](i);if(t==="end")return this[yl]();if(t==="close"){if(this[Ei]=!0,!this[oe]&&!this[D])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[xs]=i,super.emit(lo,i);let o=!this[_s]||this.listeners("error").length?super.emit("error",i):!1;return this[Xt](),o}else if(t==="resume"){let o=super.emit("resume");return this[Xt](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let r=super.emit(t,...s);return this[Xt](),r}[ho](t){for(let i of this[at])i.dest.write(t)===!1&&this.pause();let s=this[mt]?!1:super.emit("data",t);return this[Xt](),s}[yl](){return this[oe]?!1:(this[oe]=!0,this.readable=!1,this[zt]?(Os(()=>this[co]()),!0):this[co]())}[co](){if(this[De]){let s=this[De].end();if(s){for(let i of this[at])i.dest.write(s);this[mt]||super.emit("data",s)}}for(let s of this[at])s.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[X]||(t.dataLength=0);let s=this.promise();return this.on("data",i=>{t.push(i),this[X]||(t.dataLength+=i.length)}),await s,t}async concat(){if(this[X])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Pt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,s)=>{this.on(D,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[mt]=!1;let t=!1,s=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return s();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Kt])return s();let o,n,a=c=>{this.off("data",l),this.off("end",h),this.off(D,f),s(),n(c)},l=c=>{this.off("error",a),this.off("end",h),this.off(D,f),this.pause(),o({value:c,done:!!this[Kt]})},h=()=>{this.off("error",a),this.off("data",l),this.off(D,f),s(),o({done:!0,value:void 0})},f=()=>a(new Error("stream destroyed"));return new Promise((c,u)=>{n=u,o=c,this.once(D,f),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[mt]=!1;let t=!1,s=()=>(this.pause(),this.off(lo,s),this.off(D,s),this.off("end",s),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return s();let r=this.read();return r===null?s():{done:!1,value:r}};return this.once("end",s),this.once(lo,s),this.once(D,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(t){if(this[D])return t?this.emit("error",t):this.emit(D),this;this[D]=!0,this[mt]=!0,this[B].length=0,this[G]=0;let s=this;return typeof s.close=="function"&&!this[Ei]&&s.close(),t?this.emit("error",t):this.emit(D),this}static get isStream(){return Qd}};var gm=dm.native,ks={lstatSync:cm,readdir:fm,readdirSync:um,readlinkSync:pm,realpathSync:gm,promises:{lstat:ym,readdir:wm,readlink:bm,realpath:Sm}},xl=e=>!e||e===ks||e===mm?ks:{...ks,...e,promises:{...ks.promises,...e.promises||{}}},Tl=/^\\\\\?\\([a-z]:)\\?$/i,vm=e=>e.replace(/\//g,"\\").replace(Tl,"$1\\"),Em=/[\\\/]/,_t=0,_l=1,Ol=2,Ut=4,Al=6,kl=8,Se=10,Rl=12,Tt=15,As=~Tt,mo=16,bl=32,Rs=64,Ft=128,Ai=256,Ri=512,Sl=Rs|Ft|Ri,xm=1023,go=e=>e.isFile()?kl:e.isDirectory()?Ut:e.isSymbolicLink()?Se:e.isCharacterDevice()?Ol:e.isBlockDevice()?Al:e.isSocket()?Rl:e.isFIFO()?_l:_t,vl=new Es({max:2**12}),Cs=e=>{let t=vl.get(e);if(t)return t;let s=e.normalize("NFKD");return vl.set(e,s),s},El=new Es({max:2**12}),ki=e=>{let t=El.get(e);if(t)return t;let s=Cs(e.toLowerCase());return El.set(e,s),s},Ci=class extends Es{constructor(){super({max:256})}},wo=class extends Es{constructor(t=16*1024){super({maxSize:t,sizeCalculation:s=>s.length+1})}},Cl=Symbol("PathScurry setAsCwd"),Z=class{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#T;get gid(){return this.#T}#E;get rdev(){return this.#E}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#u;get size(){return this.#u}#c;get blocks(){return this.#c}#l;get atimeMs(){return this.#l}#s;get mtimeMs(){return this.#s}#p;get ctimeMs(){return this.#p}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#d;get mtime(){return this.#d}#k;get ctime(){return this.#k}#m;get birthtime(){return this.#m}#x;#_;#g;#y;#S;#O;#e;#F;#j;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,s=_t,i,r,o,n,a){this.name=t,this.#x=o?ki(t):Cs(t),this.#e=s&xm,this.nocase=o,this.roots=r,this.root=i||this,this.#F=n,this.#g=a.fullpath,this.#S=a.relative,this.#O=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=xl(a.fs)}depth(){return this.#_!==void 0?this.#_:this.parent?this.#_=this.parent.depth()+1:this.#_=0}childrenCache(){return this.#F}resolve(t){if(!t)return this;let s=this.getRootString(t),r=t.substring(s.length).split(this.splitSep);return s?this.getRoot(s).#P(r):this.#P(r)}#P(t){let s=this;for(let i of t)s=s.child(i);return s}children(){let t=this.#F.get(this);if(t)return t;let s=Object.assign([],{provisional:0});return this.#F.set(this,s),this.#e&=~mo,s}child(t,s){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let i=this.children(),r=this.nocase?ki(t):Cs(t);for(let l of i)if(l.#x===r)return l;let o=this.parent?this.sep:"",n=this.#g?this.#g+o+t:void 0,a=this.newChild(t,_t,{...s,parent:this,fullpath:n});return this.canReaddir()||(a.#e|=Ft),i.push(a),a}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let t=this.name,s=this.parent;if(!s)return this.#S=this.name;let i=s.relative();return i+(!i||!s.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let t=this.name,s=this.parent;if(!s)return this.#O=this.fullpathPosix();let i=s.relativePosix();return i+(!i||!s.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,s=this.parent;if(!s)return this.#g=this.name;let r=s.fullpath()+(s.parent?this.sep:"")+t;return this.#g=r}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#y=`//?/${r}`:this.#y=r}let t=this.parent,s=t.fullpathPosix(),i=s+(!s||!t.parent?"":"/")+this.name;return this.#y=i}isUnknown(){return(this.#e&Tt)===_t}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&Tt)===kl}isDirectory(){return(this.#e&Tt)===Ut}isCharacterDevice(){return(this.#e&Tt)===Ol}isBlockDevice(){return(this.#e&Tt)===Al}isFIFO(){return(this.#e&Tt)===_l}isSocket(){return(this.#e&Tt)===Rl}isSymbolicLink(){return(this.#e&Se)===Se}lstatCached(){return this.#e&bl?this:void 0}readlinkCached(){return this.#j}realpathCached(){return this.#A}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#j)return!0;if(!this.parent)return!1;let t=this.#e&Tt;return!(t!==_t&&t!==Se||this.#e&Ai||this.#e&Ft)}calledReaddir(){return!!(this.#e&mo)}isENOENT(){return!!(this.#e&Ft)}isNamed(t){return this.nocase?this.#x===ki(t):this.#x===Cs(t)}async readlink(){let t=this.#j;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(s);if(i)return this.#j=i}catch(s){this.#N(s.code);return}}readlinkSync(){let t=this.#j;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(s);if(i)return this.#j=i}catch(s){this.#N(s.code);return}}#L(t){this.#e|=mo;for(let s=t.provisional;s<t.length;s++){let i=t[s];i&&i.#v()}}#v(){this.#e&Ft||(this.#e=(this.#e|Ft)&As,this.#G())}#G(){let t=this.children();t.provisional=0;for(let s of t)s.#v()}#$(){this.#e|=Ri,this.#D()}#D(){if(this.#e&Rs)return;let t=this.#e;(t&Tt)===Ut&&(t&=As),this.#e=t|Rs,this.#G()}#I(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#v():this.children().provisional=0}#C(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#v()}#N(t=""){let s=this.#e;s|=Ai,t==="ENOENT"&&(s|=Ft),(t==="EINVAL"||t==="UNKNOWN")&&(s&=As),this.#e=s,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#W(t,s){return this.#U(t,s)||this.#z(t,s)}#z(t,s){let i=go(t),r=this.newChild(t.name,i,{parent:this}),o=r.#e&Tt;return o!==Ut&&o!==Se&&o!==_t&&(r.#e|=Rs),s.unshift(r),s.provisional++,r}#U(t,s){for(let i=s.provisional;i<s.length;i++){let r=s[i];if((this.nocase?ki(t.name):Cs(t.name))===r.#x)return this.#h(t,r,i,s)}}#h(t,s,i,r){let o=s.name;return s.#e=s.#e&As|go(t),o!==t.name&&(s.name=t.name),i!==r.provisional&&(i===r.length-1?r.pop():r.splice(i,1),r.unshift(s)),r.provisional++,s}async lstat(){if((this.#e&Ft)===0)try{return this.#B(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#C(t.code)}}lstatSync(){if((this.#e&Ft)===0)try{return this.#B(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#C(t.code)}}#B(t){let{atime:s,atimeMs:i,birthtime:r,birthtimeMs:o,blksize:n,blocks:a,ctime:l,ctimeMs:h,dev:f,gid:c,ino:u,mode:p,mtime:d,mtimeMs:m,nlink:y,rdev:g,size:b,uid:v}=t;this.#w=s,this.#l=i,this.#m=r,this.#b=o,this.#f=n,this.#c=a,this.#k=l,this.#p=h,this.#i=f,this.#T=c,this.#a=u,this.#n=p,this.#d=d,this.#s=m,this.#r=y,this.#E=g,this.#u=b,this.#o=v;let w=go(t);this.#e=this.#e&As|w|bl,w!==_t&&w!==Ut&&w!==Se&&(this.#e|=Rs)}#M=[];#R=!1;#H(t){this.#R=!1;let s=this.#M.slice();this.#M.length=0,s.forEach(i=>i(null,t))}readdirCB(t,s=!1){if(!this.canReaddir()){s?t(null,[]):queueMicrotask(()=>t(null,[]));return}let i=this.children();if(this.calledReaddir()){let o=i.slice(0,i.provisional);s?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#M.push(t),this.#R)return;this.#R=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(o,n)=>{if(o)this.#I(o.code),i.provisional=0;else{for(let a of n)this.#W(a,i);this.#L(i)}this.#H(i.slice(0,i.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let s=this.fullpath();if(this.#Y)await this.#Y;else{let i=()=>{};this.#Y=new Promise(r=>i=r);try{for(let r of await this.#t.promises.readdir(s,{withFileTypes:!0}))this.#W(r,t);this.#L(t)}catch(r){this.#I(r.code),t.provisional=0}this.#Y=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let s=this.fullpath();try{for(let i of this.#t.readdirSync(s,{withFileTypes:!0}))this.#W(i,t);this.#L(t)}catch(i){this.#I(i.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#e&Sl)return!1;let t=Tt&this.#e;return t===_t||t===Ut||t===Se}shouldWalk(t,s){return(this.#e&Ut)===Ut&&!(this.#e&Sl)&&!t.has(this)&&(!s||s(this))}async realpath(){if(this.#A)return this.#A;if(!((Ri|Ai|Ft)&this.#e))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#A=this.resolve(t)}catch{this.#$()}}realpathSync(){if(this.#A)return this.#A;if(!((Ri|Ai|Ft)&this.#e))try{let t=this.#t.realpathSync(this.fullpath());return this.#A=this.resolve(t)}catch{this.#$()}}[Cl](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let s=new Set([]),i=[],r=this;for(;r&&r.parent;)s.add(r),r.#S=i.join(this.sep),r.#O=i.join("/"),r=r.parent,i.push("..");for(r=t;r&&r.parent&&!s.has(r);)r.#S=void 0,r.#O=void 0,r=r.parent}},Ni=class e extends Z{sep="\\";splitSep=Em;constructor(t,s=_t,i,r,o,n,a){super(t,s,i,r,o,n,a)}newChild(t,s=_t,i={}){return new e(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return yo.parse(t).root}getRoot(t){if(t=vm(t.toUpperCase()),t===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(t,s))return this.roots[t]=i;return this.roots[t]=new Fi(t,this).root}sameRoot(t,s=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Tl,"$1\\"),t===s}},ji=class e extends Z{splitSep="/";sep="/";constructor(t,s=_t,i,r,o,n,a){super(t,s,i,r,o,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,s=_t,i={}){return new e(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Pi=class{root;rootPath;roots;cwd;#t;#i;#n;nocase;#r;constructor(t=process.cwd(),s,i,{nocase:r,childrenCacheSize:o=16*1024,fs:n=ks}={}){this.#r=xl(n),(t instanceof URL||t.startsWith("file://"))&&(t=hm(t));let a=s.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Ci,this.#i=new Ci,this.#n=new wo(o);let l=a.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let h=this.root,f=l.length-1,c=s.sep,u=this.rootPath,p=!1;for(let d of l){let m=f--;h=h.child(d,{relative:new Array(m).fill("..").join(c),relativePosix:new Array(m).fill("..").join("/"),fullpath:u+=(p?"":c)+d}),p=!0}this.cwd=h}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let s="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(s=s?`${n}/${s}`:n,this.isAbsolute(n)))break}let i=this.#t.get(s);if(i!==void 0)return i;let r=this.cwd.resolve(s).fullpath();return this.#t.set(s,r),r}resolvePosix(...t){let s="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(s=s?`${n}/${s}`:n,this.isAbsolute(n)))break}let i=this.#i.get(s);if(i!==void 0)return i;let r=this.cwd.resolve(s).fullpathPosix();return this.#i.set(s,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,s={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i}=s;if(t.canReaddir()){let r=await t.readdir();return i?r:r.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,s={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0}=s;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t.withFileTypes,t=this.cwd);let i=await t.readlink();return s?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return s?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t.withFileTypes,t=this.cwd);let i=await t.realpath();return s?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return s?i:i?.fullpath()}async walk(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=[];(!o||o(t))&&a.push(i?t:t.fullpath());let l=new Set,h=(c,u)=>{l.add(c),c.readdirCB((p,d)=>{if(p)return u(p);let m=d.length;if(!m)return u();let y=()=>{--m===0&&u()};for(let g of d)(!o||o(g))&&a.push(i?g:g.fullpath()),r&&g.isSymbolicLink()?g.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(l,n)?h(b,y):y()):g.shouldWalk(l,n)?h(g,y):y()},!0)},f=t;return new Promise((c,u)=>{h(f,p=>{if(p)return u(p);c(a)})})}walkSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=[];(!o||o(t))&&a.push(i?t:t.fullpath());let l=new Set([t]);for(let h of l){let f=h.readdirSync();for(let c of f){(!o||o(c))&&a.push(i?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(r&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(l,n)&&l.add(u)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,s={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd),this.stream(t,s)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s;(!o||o(t))&&(yield i?t:t.fullpath());let a=new Set([t]);for(let l of a){let h=l.readdirSync();for(let f of h){(!o||o(f))&&(yield i?f:f.fullpath());let c=f;if(f.isSymbolicLink()){if(!(r&&(c=f.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(a,n)&&a.add(c)}}}stream(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=new $e({objectMode:!0});(!o||o(t))&&a.write(i?t:t.fullpath());let l=new Set,h=[t],f=0,c=()=>{let u=!1;for(;!u;){let p=h.shift();if(!p){f===0&&a.end();return}f++,l.add(p);let d=(y,g,b=!1)=>{if(y)return a.emit("error",y);if(r&&!b){let v=[];for(let w of g)w.isSymbolicLink()&&v.push(w.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(v.length){Promise.all(v).then(()=>d(null,g,!0));return}}for(let v of g)v&&(!o||o(v))&&(a.write(i?v:v.fullpath())||(u=!0));f--;for(let v of g){let w=v.realpathCached()||v;w.shouldWalk(l,n)&&h.push(w)}u&&!a.flowing?a.once("drain",c):m||c()},m=!0;p.readdirCB(d,!0),m=!1}};return c(),a}streamSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Z||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=new $e({objectMode:!0}),l=new Set;(!o||o(t))&&a.write(i?t:t.fullpath());let h=[t],f=0,c=()=>{let u=!1;for(;!u;){let p=h.shift();if(!p){f===0&&a.end();return}f++,l.add(p);let d=p.readdirSync();for(let m of d)(!o||o(m))&&(a.write(i?m:m.fullpath())||(u=!0));f--;for(let m of d){let y=m;if(m.isSymbolicLink()){if(!(r&&(y=m.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,n)&&h.push(y)}}u&&!a.flowing&&a.once("drain",c)};return c(),a}chdir(t=this.cwd){let s=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[Cl](s)}},Fi=class extends Pi{sep="\\";constructor(t=process.cwd(),s={}){let{nocase:i=!0}=s;super(t,yo,"\\",{...s,nocase:i}),this.nocase=i;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return yo.parse(t).root.toUpperCase()}newRoot(t){return new Ni(this.rootPath,Ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Di=class extends Pi{sep="/";constructor(t=process.cwd(),s={}){let{nocase:i=!1}=s;super(t,lm,"/",{...s,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new ji(this.rootPath,Ut,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},bo=class extends Di{constructor(t=process.cwd(),s={}){let{nocase:i=!0}=s;super(t,{...s,nocase:i})}},dv=process.platform==="win32"?Ni:ji,Nl=process.platform==="win32"?Fi:process.platform==="darwin"?bo:Di;var ne=(e,t)=>typeof e>"u"||typeof e===t,jl=e=>!!e&&typeof e=="object"&&ne(e.preserveRoot,"boolean")&&ne(e.tmp,"string")&&ne(e.maxRetries,"number")&&ne(e.retryDelay,"number")&&ne(e.backoff,"number")&&ne(e.maxBackoff,"number")&&(ne(e.glob,"boolean")||e.glob&&typeof e.glob=="object")&&ne(e.filter,"function"),Pl=e=>{if(!jl(e))throw new Error("invalid rimraf options")},Fl=e=>{Pl(e);let{glob:t,...s}=e;if(!t)return s;let i=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...s,glob:{...i,absolute:!0,withFileTypes:!1}}},Dl=(e={})=>Fl(e),Ml=(e={})=>Fl(e);import{parse as $l,resolve as Tm}from"path";import{inspect as _m}from"util";var Om=(e,t={})=>{let s=typeof e;if(s!=="string"){let r=e&&s==="object"&&e.constructor,n=`The "path" argument must be of type string. Received ${r&&r.name?`an instance of ${r.name}`:s==="object"?_m(e):`type ${s} ${e}`}`;throw Object.assign(new TypeError(n),{path:e,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(e)){let r="path must be a string without null bytes";throw Object.assign(new TypeError(r),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=Tm(e);let{root:i}=$l(e);if(e===i&&t.preserveRoot!==!1){let r="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(r),{path:e,code:"ERR_PRESERVE_ROOT"})}if(process.platform==="win32"){let r=/[*|"<>?:]/,{root:o}=$l(e);if(r.test(e.substring(o.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e},Ns=Om;import{readdirSync as Am}from"fs";import Zt from"fs/promises";import{chmodSync as Il,mkdirSync as Tv,renameSync as Wl,rmdirSync as Le,rmSync as zl,statSync as Ul,lstatSync as Ie,unlinkSync as We}from"fs";var Ll=e=>Am(e,{withFileTypes:!0}),ft={chmod:Zt.chmod,mkdir:Zt.mkdir,readdir:e=>Zt.readdir(e,{withFileTypes:!0}),rename:Zt.rename,rm:Zt.rm,rmdir:Zt.rmdir,stat:Zt.stat,lstat:Zt.lstat,unlink:Zt.unlink};import{parse as Gl,resolve as Hl}from"path";var{readdir:km}=ft,ze=e=>km(e).catch(t=>t),Ue=e=>{try{return Ll(e)}catch(t){return t}};var Bl=e=>!!e&&typeof e=="object",So=(e,t)=>t in e&&typeof e[t]=="string",vo=e=>Bl(e)&&So(e,"code")&&So(e,"path"),j=e=>Bl(e)&&So(e,"code")?e.code:null;var lt=async(e,t)=>e.catch(s=>{if(j(s)!=="ENOENT")throw t??s}),ht=(e,t)=>{try{return e()}catch(s){if(j(s)==="ENOENT")return;throw t??s}};var{lstat:Rm,rmdir:Cm,unlink:Nm}=ft,Mi=async(e,t)=>(t?.signal?.throwIfAborted(),await lt(Rm(e).then(s=>Yl(e,t,s)))??!0),$i=(e,t)=>(t?.signal?.throwIfAborted(),ht(()=>ql(e,t,Ie(e)))??!0),Yl=async(e,t,s)=>{t?.signal?.throwIfAborted();let i=s.isDirectory()?await ze(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!await t.filter(e,s)?!1:(await lt(Nm(e)),!0)}return!(await Promise.all(i.map(o=>Yl(Hl(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===Gl(e).root||t.filter&&!await t.filter(e,s)?!1:(await lt(Cm(e)),!0)},ql=(e,t,s)=>{t?.signal?.throwIfAborted();let i=s.isDirectory()?Ue(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!t.filter(e,s)?!1:(ht(()=>We(e)),!0)}let r=!0;for(let o of i){let n=Hl(e,o.name);r=ql(n,t,o)&&r}return t.preserveRoot===!1&&e===Gl(e).root||!r||t.filter&&!t.filter(e,s)?!1:(ht(()=>Le(e)),!0)};import{parse as sh,resolve as ih}from"path";var{chmod:jm}=ft,js=e=>async t=>{try{return void await lt(e(t))}catch(s){if(j(s)==="EPERM")return await lt(jm(t,438).then(()=>!0),s)?void await e(t):void 0;throw s}},Ps=e=>t=>{try{return void ht(()=>e(t))}catch(s){if(j(s)==="EPERM")return ht(()=>(Il(t,438),!0),s)?void e(t):void 0;throw s}};import{setTimeout as Pm}from"timers/promises";var Fm=200,Dm=1.2,Vl=10,Jl=new Set(["EMFILE","ENFILE","EBUSY"]),Eo=e=>{let t=async(s,i,r=1,o=0)=>{let n=i.maxBackoff||Fm,a=i.backoff||Dm,l=i.maxRetries||Vl,h=0;for(;;)try{return await e(s)}catch(f){if(vo(f)&&f.path===s&&Jl.has(f.code)){if(r=Math.ceil(r*a),o=r+o,o<n)return await Pm(r),t(s,i,r,o);if(h<l){h++;continue}}throw f}};return t},xo=e=>(s,i)=>{let r=i.maxRetries||Vl,o=0;for(;;)try{return e(s)}catch(n){if(vo(n)&&n.path===s&&Jl.has(n.code)&&o<r){o++;continue}throw n}};import{basename as Bm,parse as Wi,resolve as zi}from"path";import{tmpdir as Ii}from"os";import{parse as Li,resolve as Kl}from"path";var{stat:Mm}=ft,$m=e=>{try{return Ul(e).isDirectory()}catch{return!1}},Lm=e=>Mm(e).then(t=>t.isDirectory(),()=>!1),Im=async e=>{let{root:t}=Li(e),s=Ii(),{root:i}=Li(s);if(t.toLowerCase()===i.toLowerCase())return s;let r=Kl(t,"/temp");return await Lm(r)?r:t},Wm=e=>{let{root:t}=Li(e),s=Ii(),{root:i}=Li(s);if(t.toLowerCase()===i.toLowerCase())return s;let r=Kl(t,"/temp");return $m(r)?r:t},zm=async()=>Ii(),Um=()=>Ii(),Xl=process.platform==="win32"?Im:zm,Zl=process.platform==="win32"?Wm:Um;var{lstat:Gm,rename:Hm,unlink:Ym,rmdir:qm}=ft,eh=e=>`.${Bm(e)}.${Math.random()}`,Vm=js(Ym),Jm=Ps(We),Ui=async(e,t)=>(t?.signal?.throwIfAborted(),await lt(Gm(e).then(s=>To(e,t,s)))??!0),To=async(e,t,s)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return To(e,{...t,tmp:await Xl(e)},s);if(e===t.tmp&&Wi(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let i=s.isDirectory()?await ze(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!await t.filter(e,s)?!1:(await lt(Ql(e,t.tmp,Vm)),!0)}return!(await Promise.all(i.map(o=>To(zi(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===Wi(e).root||t.filter&&!await t.filter(e,s)?!1:(await lt(Ql(e,t.tmp,qm)),!0)},Ql=async(e,t,s)=>{let i=zi(t,eh(e));return await Hm(e,i),await s(i)},Bi=(e,t)=>(t?.signal?.throwIfAborted(),ht(()=>_o(e,t,Ie(e)))??!0),_o=(e,t,s)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return _o(e,{...t,tmp:Zl(e)},s);let i=t.tmp;if(e===t.tmp&&Wi(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let r=s.isDirectory()?Ue(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!t.filter(e,s)?!1:(ht(()=>th(e,i,Jm)),!0)}let o=!0;for(let n of r){let a=zi(e,n.name);o=_o(a,t,n)&&o}return!o||t.preserveRoot===!1&&e===Wi(e).root||t.filter&&!t.filter(e,s)?!1:(ht(()=>th(e,i,Le)),!0)},th=(e,t,s)=>{let i=zi(t,eh(e));return Wl(e,i),s(i)};var{unlink:Km,rmdir:Xm,lstat:Zm}=ft,Qm=Eo(js(Km)),tg=xo(Ps(We)),eg=Eo(js(Xm)),sg=xo(Ps(Le)),ig=async(e,{filter:t,...s})=>{s?.signal?.throwIfAborted();try{return await eg(e,s),!0}catch(i){if(j(i)==="ENOTEMPTY")return Ui(e,s);throw i}},rg=(e,{filter:t,...s})=>{s?.signal?.throwIfAborted();try{return sg(e,s),!0}catch(i){if(j(i)==="ENOTEMPTY")return Bi(e,s);throw i}},ae=Symbol("start"),rh=Symbol("child"),Gi=Symbol("finish"),Hi=async(e,t)=>(t?.signal?.throwIfAborted(),await lt(Zm(e).then(s=>Oo(e,t,s,ae)))??!0),Yi=(e,t)=>(t?.signal?.throwIfAborted(),ht(()=>Ao(e,t,Ie(e),ae))??!0),Oo=async(e,t,s,i=ae)=>{t?.signal?.throwIfAborted();let r=s.isDirectory()?await ze(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!await t.filter(e,s)?!1:(await lt(Qm(e,t)),!0)}let o=i===ae?rh:i,n=(await Promise.all(r.map(a=>Oo(ih(e,a.name),t,a,o)))).every(a=>a===!0);if(i===ae)return Oo(e,t,s,Gi);if(i===Gi){if(t.preserveRoot===!1&&e===sh(e).root||!n||t.filter&&!await t.filter(e,s))return!1;await lt(ig(e,t))}return!0},Ao=(e,t,s,i=ae)=>{let r=s.isDirectory()?Ue(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!t.filter(e,s)?!1:(ht(()=>tg(e,t)),!0)}let o=!0;for(let n of r){let a=i===ae?rh:i,l=ih(e,n.name);o=Ao(l,t,n,a)&&o}if(i===ae)return Ao(e,t,s,Gi);if(i===Gi){if(t.preserveRoot===!1&&e===sh(e).root||!o||t.filter&&!t.filter(e,s))return!1;ht(()=>rg(e,t))}return!0};var ko=process.platform==="win32"?Hi:Mi,Ro=process.platform==="win32"?Yi:$i;var{rm:og}=ft,Co=async(e,t)=>(await og(e,{...t,force:!0,recursive:!0}),!0),No=(e,t)=>(zl(e,{...t,force:!0,recursive:!0}),!0);var[oh=0,ng=0]=process.version.replace(/^v/,"").split(".").map(e=>parseInt(e,10)),nh=oh>14||oh===14&&ng>=14,ah=!nh||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter,lh=!nh||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter;var Be=e=>async(t,s)=>{let i=Dl(s);return i.glob&&(t=await ge(t,i.glob)),Array.isArray(t)?!!(await Promise.all(t.map(r=>e(Ns(r,i),i)))).reduce((r,o)=>r&&o,!0):!!await e(Ns(t,i),i)},Ge=e=>(t,s)=>{let i=Ml(s);return i.glob&&(t=we(t,i.glob)),Array.isArray(t)?!!t.map(r=>e(Ns(r,i),i)).reduce((r,o)=>r&&o,!0):!!e(Ns(t,i),i)},ch=Ge(No),ag=Object.assign(Be(Co),{sync:ch}),fh=Ge(Ro),lg=Object.assign(Be(ko),{sync:fh}),uh=Ge(Yi),hg=Object.assign(Be(Hi),{sync:uh}),ph=Ge($i),cg=Object.assign(Be(Mi),{sync:ph}),dh=Ge(Bi),fg=Object.assign(Be(Ui),{sync:dh}),ut=Ge((e,t)=>lh(t)?No(e,t):Ro(e,t));var hh=Be((e,t)=>ah(t)?Co(e,t):ko(e,t)),Ot=Object.assign(hh,{rimraf:hh,sync:ut,rimrafSync:ut,manual:lg,manualSync:fh,native:ag,nativeSync:ch,posix:cg,posixSync:ph,windows:hg,windowsSync:uh,moveRemove:fg,moveRemoveSync:dh});Ot.rimraf=Ot;var Fs=e=>{try{return Jt(e)}catch{return Fs(Ds(e)),ut(e),Jt(e)}};var wg=(e,t)=>{if(!(e.isSymbolicLink()||e.isDirectory()||e.isFile())){t.isENOENT()||ut(t.fullpath());return}if(e.isSymbolicLink()){let i=wh(e.fullpath());if(!t.isENOENT()){if((t.isSymbolicLink()&&wh(t.fullpath()))===i)return;ut(t.fullpath())}if(Fs(Ds(t.fullpath())),mg(i,t.fullpath()),ug.O_SYMLINK&&e.mode)try{gh(t.fullpath(),e.mode)}catch{}return}if(e.isDirectory())t.isDirectory()||Fs(t.fullpath());else{let i=!0;if(!t.isENOENT()&&!t.isFile()?ut(t.fullpath()):bg(e,t)&&(i=!1),i){Fs(Ds(t.fullpath()));try{dg(e.fullpath(),t.fullpath())}catch{pg(e.fullpath(),t.fullpath())}}}let s=e.mode;s&&gh(t.fullpath(),s)};var bg=(e,t)=>{try{return mh("sha512").update(yh(e.fullpath())).digest("hex")===mh("sha512").update(yh(t.fullpath())).digest("hex")}catch{return!1}},Sh=`..${yg}`,Sg=(e,t)=>{if(e===t)return!0;let s=bh(e,t),i=bh(e,t);return!s.startsWith(Sh)||!i.startsWith(Sh)};var vh=(e,t)=>{let s=new Nl(e),i=qi(e),r=qi(t);if(Ds(i)===i||Ds(r)===r)throw new Error("cannot sync root directory");if(Sg(r,i))throw new Error("cannot copy directory into itself or its parent");let[o,n]=[we("**",{scurry:s,withFileTypes:!0}),we("**",{cwd:r,withFileTypes:!0})];for(let a of o){if(!a.parent)throw new Error("cannot sync root directory");let l=a.resolve(qi(r,a.relative())),h=l.parent;if(!h)throw new Error("cannot sync root directory");l.lstatSync(),Fs(h.fullpath()),wg(a,l)}for(let a of n){let l=s.cwd.resolve(qi(i,a.relative()));if(l.lstatSync(),l.isENOENT())try{ut(a.fullpath()),gg(a.fullpath())}catch{}}};import{chmodSync as Eh}from"fs";import{resolve as xh}from"path";var Th=()=>{let{bin:e}=O;if(e)if(typeof e=="string")Eh(xh(e),493);else for(let t of Object.values(e))Eh(xh(t),493)};import{spawnSync as Ky}from"node:child_process";import{relative as wc,resolve as Ze}from"node:path/posix";import{writeFileSync as vg}from"fs";var _h=e=>{let{imports:t}=e;if(t)return Object.fromEntries(Object.entries(t).map(([s,i])=>[s,typeof i=="string"&&i.startsWith("./src/")?"./"+i.substring(6).replace(/\.([cm]?)ts$/,".$1js").replace(/\.tsx$/,".js"):i]))};var Eg=(e,t)=>{if(!t)return ut(`${e}/package.json`);let s={type:t==="commonjs"?"commonjs":"module",imports:_h(O)};vg(`${e}/package.json`,JSON.stringify(s,null,2)+`
|
|
15
|
-
`)},
|
|
16
|
-
`&&(d==="|"&&h.length?h=h.alternation=[]:d===")"&&h.length?(a=null,(h=n.pop())||
|
|
14
|
+
>>> no match, partial?`,e,c,t,u),c===a))}let d;if(typeof h=="string"?(d=f===h,this.debug("string match",h,f,d)):(d=h.test(f),this.debug("pattern match",h,f,d)),!d)return!1}if(o===a&&n===l)return!0;if(o===a)return s;if(n===l)return o===a-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return tl(this.pattern,this.options)}parse(e){Ei(e);let t=this.options;if(e==="**")return rt;if(e==="")return"";let s,i=null;(s=e.match(Zp))?i=t.dot?td:Qp:(s=e.match(zp))?i=(t.nocase?t.dot?Yp:Hp:t.dot?Gp:Bp)(s[1]):(s=e.match(ed))?i=(t.nocase?t.dot?id:sd:t.dot?rd:od)(s):(s=e.match(qp))?i=t.dot?Jp:Vp:(s=e.match(Kp))&&(i=Xp);let r=Ka.fromGlob(e,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?ld:t.dot?hd:cd,i=new Set(t.nocase?["i"]:[]),r=e.map(a=>{let l=a.map(f=>{if(f instanceof RegExp)for(let c of f.flags.split(""))i.add(c);return typeof f=="string"?md(f):f===rt?rt:f._src});l.forEach((f,c)=>{let u=l[c+1],p=l[c-1];f!==rt||p===rt||(p===void 0?u!==void 0&&u!==rt?l[c+1]="(?:\\/|"+s+"\\/)?"+u:l[c]=s:u===void 0?l[c-1]=p+"(?:\\/|\\/"+s+")?":u!==rt&&(l[c-1]=p+"(?:\\/|\\/"+s+"\\/)"+u,l[c+1]=rt))});let h=l.filter(f=>f!==rt);if(this.partial&&h.length>=1){let f=[];for(let c=1;c<=h.length;c++)f.push(h.slice(0,c).join("/"));return"(?:"+f.join("|")+")"}return h.join("/")}).join("|"),[o,n]=e.length>1?["(?:",")"]:["",""];r="^"+o+r+n+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+n+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let n=i.length-2;!o&&n>=0;n--)o=i[n];for(let n=0;n<r.length;n++){let a=r[n],l=i;if(s.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return ot.defaults(e).Minimatch}};ot.AST=Ka;ot.Minimatch=le;ot.escape=ks;ot.unescape=Ie;var yd=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,el=new Set,no=typeof process=="object"&&process?process:{},sl=(e,t,s,i)=>{typeof no.emitWarning=="function"?no.emitWarning(e,t,s,i):console.error(`[${s}] ${t}: ${e}`)},xi=globalThis.AbortController,Aa=globalThis.AbortSignal;if(typeof xi>"u"){Aa=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},xi=class{constructor(){t()}signal=new Aa;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let e=no.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,sl("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var wd=e=>!el.has(e),ae=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),il=e=>ae(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Si:null:null,Si=class extends Array{constructor(e){super(e),this.fill(0)}},bd=class xs{heap;length;static#t=!1;static create(t){let s=il(t);if(!s)return[];xs.#t=!0;let i=new xs(t,s);return xs.#t=!1,i}constructor(t,s){if(!xs.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Oi=class rl{#t;#i;#n;#r;#o;#T;#E;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#u;#c;#l;#s;#p;#b;#w;#d;#R;#m;#x;#O;#g;#y;#S;#_;#e;#F;static unsafeExposeInternals(t){return{starts:t.#O,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#x,keyMap:t.#c,keyList:t.#l,valList:t.#s,next:t.#p,prev:t.#b,get head(){return t.#w},get tail(){return t.#d},free:t.#R,isBackgroundFetch:s=>t.#h(s),backgroundFetch:(s,i,r,o)=>t.#z(s,i,r,o),moveToTail:s=>t.#M(s),indexes:s=>t.#C(s),rindexes:s=>t.#P(s),isStale:s=>t.#v(s)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#u}get size(){return this.#a}get fetchMethod(){return this.#T}get memoMethod(){return this.#E}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:s=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:g,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:R,ignoreFetchAbort:M,perf:q}=t;if(q!==void 0&&typeof q?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=q??yd,s!==0&&!ae(s))throw new TypeError("max option must be a nonnegative integer");let et=s?il(s):Array;if(!et)throw new Error("invalid max value: "+s);if(this.#t=s,this.#i=d,this.maxEntrySize=m||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#E=b,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=g,this.#_=!!g,this.#c=new Map,this.#l=new Array(s).fill(void 0),this.#s=new Array(s).fill(void 0),this.#p=new et(s),this.#b=new et(s),this.#w=0,this.#d=0,this.#R=bd.create(s),this.#a=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof f=="function"&&(this.#r=f),typeof c=="function"?(this.#o=c,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#S=!!this.#n,this.#F=!!this.#r,this.#e=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(this.#i!==0&&!ae(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!ae(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#G()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ae(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!ae(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let qt="LRU_CACHE_UNBOUNDED";wd(qt)&&(el.add(qt),sl("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",qt,rl))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#j(){let t=new Si(this.#t),s=new Si(this.#t);this.#g=t,this.#O=s;let i=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=i,this.#$=(n,a,l=this.#f.now())=>{if(s[n]=a!==0?l:0,t[n]=a,i?.[n]&&(clearTimeout(i[n]),i[n]=void 0),a!==0&&i){let h=setTimeout(()=>{this.#v(n)&&this.#A(this.#l[n],"expire")},a+1);h.unref&&h.unref(),i[n]=h}},this.#k=n=>{s[n]=t[n]!==0?this.#f.now():0},this.#N=(n,a)=>{if(t[a]){let l=t[a],h=s[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=r||o();let f=n.now-h;n.remainingTTL=l-f}};let r=0,o=()=>{let n=this.#f.now();if(this.ttlResolution>0){r=n;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=s[a];if(!l||!h)return 1/0;let f=(r||o())-h;return l-f},this.#v=n=>{let a=s[n],l=t[n];return!!l&&!!a&&(r||o())-a>l}}#k=()=>{};#N=()=>{};#$=()=>{};#v=()=>!1;#G(){let t=new Si(this.#t);this.#u=0,this.#x=t,this.#L=s=>{this.#u-=t[s],t[s]=0},this.#I=(s,i,r,o)=>{if(this.#h(i))return 0;if(!ae(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(i,s),!ae(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#D=(s,i,r)=>{if(t[s]=i,this.#i){let o=this.#i-t[s];for(;this.#u>o;)this.#U(!0)}this.#u+=t[s],r&&(r.entrySize=i,r.totalCalculatedSize=this.#u)}}#L=t=>{};#D=(t,s,i)=>{};#I=(t,s,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#d;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#w));)s=this.#b[s]}*#P({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#w;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#d));)s=this.#p[s]}#W(t){return t!==void 0&&this.#c.get(this.#l[t])===t}*entries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*rentries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*keys(){for(let t of this.#C()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*rkeys(){for(let t of this.#P()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*values(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,s={}){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#l[i],this))return this.get(this.#l[i],s)}}forEach(t,s=this){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}rforEach(t,s=this){for(let i of this.#P()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}purgeStale(){let t=!1;for(let s of this.#P({allowStale:!0}))this.#v(s)&&(this.#A(this.#l[s],"expire"),t=!0);return t}info(t){let s=this.#c.get(t);if(s===void 0)return;let i=this.#s[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#g&&this.#O){let n=this.#g[s],a=this.#O[s];if(n&&a){let l=n-(this.#f.now()-a);o.ttl=l,o.start=Date.now()}}return this.#x&&(o.size=this.#x[s]),o}dump(){let t=[];for(let s of this.#C({allowStale:!0})){let i=this.#l[s],r=this.#s[s],o=this.#h(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#g&&this.#O){n.ttl=this.#g[s];let a=this.#f.now()-this.#O[s];n.start=Math.floor(Date.now()-a)}this.#x&&(n.size=this.#x[s]),t.unshift([i,n])}return t}load(t){this.clear();for(let[s,i]of t){if(i.start){let r=Date.now()-i.start;i.start=this.#f.now()-r}this.set(s,i.value,i)}}set(t,s,i={}){if(s===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,f=this.#I(t,s,i.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#A(t,"set"),this;let c=this.#a===0?void 0:this.#c.get(t);if(c===void 0)c=this.#a===0?this.#d:this.#R.length!==0?this.#R.pop():this.#a===this.#t?this.#U(!1):this.#a,this.#l[c]=t,this.#s[c]=s,this.#c.set(t,c),this.#p[this.#d]=c,this.#b[c]=this.#d,this.#d=c,this.#a++,this.#D(c,f,l),l&&(l.set="add"),h=!1,this.#F&&this.#r?.(s,t,"add");else{this.#M(c);let u=this.#s[c];if(s!==u){if(this.#_&&this.#h(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=u;p!==void 0&&!n&&(this.#S&&this.#n?.(p,t,"set"),this.#e&&this.#m?.push([p,t,"set"]))}else n||(this.#S&&this.#n?.(u,t,"set"),this.#e&&this.#m?.push([u,t,"set"]));if(this.#L(c),this.#D(c,f,l),this.#s[c]=s,l){l.set="replace";let p=u&&this.#h(u)?u.__staleWhileFetching:u;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update");this.#F&&this.onInsert?.(s,t,s===u?"update":"replace")}if(r!==0&&!this.#g&&this.#j(),this.#g&&(h||this.#$(c,r,o),l&&this.#N(l,c)),!n&&this.#e&&this.#m){let u=this.#m,p;for(;p=u?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#w];if(this.#U(!0),this.#h(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}}#U(t){let s=this.#w,i=this.#l[s],r=this.#s[s];return this.#_&&this.#h(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(r,i,"evict"),this.#e&&this.#m?.push([r,i,"evict"])),this.#L(s),this.#y?.[s]&&(clearTimeout(this.#y[s]),this.#y[s]=void 0),t&&(this.#l[s]=void 0,this.#s[s]=void 0,this.#R.push(s)),this.#a===1?(this.#w=this.#d=0,this.#R.length=0):this.#w=this.#p[s],this.#c.delete(i),this.#a--,s}has(t,s={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=s,o=this.#c.get(t);if(o!==void 0){let n=this.#s[o];if(this.#h(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#v(o))r&&(r.has="stale",this.#N(r,o));else return i&&this.#k(o),r&&(r.has="hit",this.#N(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,s={}){let{allowStale:i=this.allowStale}=s,r=this.#c.get(t);if(r===void 0||!i&&this.#v(r))return;let o=this.#s[r];return this.#h(o)?o.__staleWhileFetching:o}#z(t,s,i,r){let o=s===void 0?void 0:this.#s[s];if(this.#h(o))return o;let n=new xi,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:i,context:r},h=(m,y=!1)=>{let{aborted:g}=n.signal,b=i.ignoreFetchAbort&&m!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(g&&!y?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!b&&!y)return c(n.signal.reason,v);let w=p,S=this.#s[s];return(S===p||b&&y&&S===void 0)&&(m===void 0?w.__staleWhileFetching!==void 0?this.#s[s]=w.__staleWhileFetching:this.#A(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,m,l.options))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),c(m,!1)),c=(m,y)=>{let{aborted:g}=n.signal,b=g&&i.allowStaleOnFetchAbort,v=b||i.allowStaleOnFetchRejection,w=v||i.noDeleteOnFetchRejection,S=p;if(this.#s[s]===p&&(!w||!y&&S.__staleWhileFetching===void 0?this.#A(t,"fetch"):b||(this.#s[s]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},u=(m,y)=>{let g=this.#T?.(t,o,l);g&&g instanceof Promise&&g.then(b=>m(b===void 0?void 0:b),y),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=b=>h(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(u).then(h,f),d=Object.assign(p,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return s===void 0?(this.set(t,d,{...l.options,status:void 0}),s=this.#c.get(t)):this.#s[s]=d,d}#h(t){if(!this.#_)return!1;let s=t;return!!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof xi}async fetch(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:m,forceRefresh:y=!1,status:g,signal:b}=s;if(!this.#_)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let v={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:b},w=this.#c.get(t);if(w===void 0){g&&(g.fetch="miss");let S=this.#z(t,w,v,m);return S.__returned=S}else{let S=this.#s[w];if(this.#h(S)){let et=i&&S.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",et&&(g.returnedStale=!0)),et?S.__staleWhileFetching:S.__returned=S}let R=this.#v(w);if(!y&&!R)return g&&(g.fetch="hit"),this.#M(w),r&&this.#k(w),g&&this.#N(g,w),S;let M=this.#z(t,w,v,m),q=M.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=R?"stale":"refresh",q&&R&&(g.returnedStale=!0)),q?M.__staleWhileFetching:M.__returned=M}}async forceFetch(t,s={}){let i=await this.fetch(t,s);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,s={}){let i=this.#E;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=s,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=i(t,a,{options:n,context:r});return this.set(t,l,n),l}get(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=s,a=this.#c.get(t);if(a!==void 0){let l=this.#s[a],h=this.#h(l);return n&&this.#N(n,a),this.#v(a)?(n&&(n.get="stale"),h?(n&&i&&l.__staleWhileFetching!==void 0&&(n.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.#A(t,"expire"),n&&i&&(n.returnedStale=!0),i?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(this.#M(a),r&&this.#k(a),l))}else n&&(n.get="miss")}#B(t,s){this.#b[s]=t,this.#p[t]=s}#M(t){t!==this.#d&&(t===this.#w?this.#w=this.#p[t]:this.#B(this.#b[t],this.#p[t]),this.#B(this.#d,t),this.#d=t)}delete(t){return this.#A(t,"delete")}#A(t,s){let i=!1;if(this.#a!==0){let r=this.#c.get(t);if(r!==void 0)if(this.#y?.[r]&&(clearTimeout(this.#y?.[r]),this.#y[r]=void 0),i=!0,this.#a===1)this.#H(s);else{this.#L(r);let o=this.#s[r];if(this.#h(o)?o.__abortController.abort(new Error("deleted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(o,t,s),this.#e&&this.#m?.push([o,t,s])),this.#c.delete(t),this.#l[r]=void 0,this.#s[r]=void 0,r===this.#d)this.#d=this.#b[r];else if(r===this.#w)this.#w=this.#p[r];else{let n=this.#b[r];this.#p[n]=this.#p[r];let a=this.#p[r];this.#b[a]=this.#b[r]}this.#a--,this.#R.push(r)}}if(this.#e&&this.#m?.length){let r=this.#m,o;for(;o=r?.shift();)this.#o?.(...o)}return i}clear(){return this.#H("delete")}#H(t){for(let s of this.#P({allowStale:!0})){let i=this.#s[s];if(this.#h(i))i.__abortController.abort(new Error("deleted"));else{let r=this.#l[s];this.#S&&this.#n?.(i,r,t),this.#e&&this.#m?.push([i,r,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#g&&this.#O){this.#g.fill(0),this.#O.fill(0);for(let s of this.#y??[])s!==void 0&&clearTimeout(s);this.#y?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#w=0,this.#d=0,this.#R.length=0,this.#u=0,this.#a=0,this.#e&&this.#m){let s=this.#m,i;for(;i=s?.shift();)this.#o?.(...i)}}},Ca=typeof process=="object"&&process?process:{stdout:null,stderr:null},Nd=e=>!!e&&typeof e=="object"&&(e instanceof Ti||e instanceof ol||Fd(e)||Dd(e)),Fd=e=>!!e&&typeof e=="object"&&e instanceof co&&typeof e.pipe=="function"&&e.pipe!==ol.Writable.prototype.pipe,Dd=e=>!!e&&typeof e=="object"&&e instanceof co&&typeof e.write=="function"&&typeof e.end=="function",Jt=Symbol("EOF"),Kt=Symbol("maybeEmitEnd"),ne=Symbol("emittedEnd"),pi=Symbol("emittingEnd"),ys=Symbol("emittedError"),di=Symbol("closed"),Pa=Symbol("read"),mi=Symbol("flush"),ja=Symbol("flushChunk"),jt=Symbol("encoding"),Le=Symbol("decoder"),I=Symbol("flowing"),ws=Symbol("paused"),$e=Symbol("resume"),W=Symbol("buffer"),it=Symbol("pipes"),U=Symbol("bufferLength"),Qr=Symbol("bufferPush"),gi=Symbol("bufferShift"),J=Symbol("objectMode"),F=Symbol("destroyed"),to=Symbol("error"),eo=Symbol("emitData"),Na=Symbol("emitEnd"),so=Symbol("emitEnd2"),zt=Symbol("async"),io=Symbol("abort"),yi=Symbol("aborted"),bs=Symbol("signal"),be=Symbol("dataListeners"),dt=Symbol("discarded"),Ss=e=>Promise.resolve().then(e),Md=e=>e(),Ld=e=>e==="end"||e==="finish"||e==="prefinish",$d=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Id=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),nl=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[$e](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Wd=class extends nl{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},Ud=e=>!!e.objectMode,zd=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Ti=class extends co{[I]=!1;[ws]=!1;[it]=[];[W]=[];[J];[jt];[zt];[Le];[Jt]=!1;[ne]=!1;[pi]=!1;[di]=!1;[ys]=null;[U]=0;[F]=!1;[bs];[yi]=!1;[be]=0;[dt]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ud(t)?(this[J]=!0,this[jt]=null):zd(t)?(this[jt]=t.encoding,this[J]=!1):(this[J]=!1,this[jt]=null),this[zt]=!!t.async,this[Le]=this[jt]?new jd(this[jt]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[W]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[it]});let{signal:s}=t;s&&(this[bs]=s,s.aborted?this[io]():s.addEventListener("abort",()=>this[io]()))}get bufferLength(){return this[U]}get encoding(){return this[jt]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[J]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[zt]}set async(e){this[zt]=this[zt]||!!e}[io](){this[yi]=!0,this.emit("abort",this[bs]?.reason),this.destroy(this[bs]?.reason)}get aborted(){return this[yi]}set aborted(e){}write(e,t,s){if(this[yi])return!1;if(this[Jt])throw new Error("write after end");if(this[F])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[zt]?Ss:Md;if(!this[J]&&!Buffer.isBuffer(e)){if(Id(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if($d(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[J]?(this[I]&&this[U]!==0&&this[mi](!0),this[I]?this.emit("data",e):this[Qr](e),this[U]!==0&&this.emit("readable"),s&&i(s),this[I]):e.length?(typeof e=="string"&&!(t===this[jt]&&!this[Le]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[jt]&&(e=this[Le].write(e)),this[I]&&this[U]!==0&&this[mi](!0),this[I]?this.emit("data",e):this[Qr](e),this[U]!==0&&this.emit("readable"),s&&i(s),this[I]):(this[U]!==0&&this.emit("readable"),s&&i(s),this[I])}read(e){if(this[F])return null;if(this[dt]=!1,this[U]===0||e===0||e&&e>this[U])return this[Kt](),null;this[J]&&(e=null),this[W].length>1&&!this[J]&&(this[W]=[this[jt]?this[W].join(""):Buffer.concat(this[W],this[U])]);let t=this[Pa](e||null,this[W][0]);return this[Kt](),t}[Pa](e,t){if(this[J])this[gi]();else{let s=t;e===s.length||e===null?this[gi]():typeof s=="string"?(this[W][0]=s.slice(e),t=s.slice(0,e),this[U]-=e):(this[W][0]=s.subarray(e),t=s.subarray(0,e),this[U]-=e)}return this.emit("data",t),!this[W].length&&!this[Jt]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[Jt]=!0,this.writable=!1,(this[I]||!this[ws])&&this[Kt](),this}[$e](){this[F]||(!this[be]&&!this[it].length&&(this[dt]=!0),this[ws]=!1,this[I]=!0,this.emit("resume"),this[W].length?this[mi]():this[Jt]?this[Kt]():this.emit("drain"))}resume(){return this[$e]()}pause(){this[I]=!1,this[ws]=!0,this[dt]=!1}get destroyed(){return this[F]}get flowing(){return this[I]}get paused(){return this[ws]}[Qr](e){this[J]?this[U]+=1:this[U]+=e.length,this[W].push(e)}[gi](){return this[J]?this[U]-=1:this[U]-=this[W][0].length,this[W].shift()}[mi](e=!1){do;while(this[ja](this[gi]())&&this[W].length);!e&&!this[W].length&&!this[Jt]&&this.emit("drain")}[ja](e){return this.emit("data",e),this[I]}pipe(e,t){if(this[F])return e;this[dt]=!1;let s=this[ne];return t=t||{},e===Ca.stdout||e===Ca.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[it].push(t.proxyErrors?new Wd(this,e,t):new nl(this,e,t)),this[zt]?Ss(()=>this[$e]()):this[$e]()),e}unpipe(e){let t=this[it].find(s=>s.dest===e);t&&(this[it].length===1?(this[I]&&this[be]===0&&(this[I]=!1),this[it]=[]):this[it].splice(this[it].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[dt]=!1,this[be]++,!this[it].length&&!this[I]&&this[$e]();else if(e==="readable"&&this[U]!==0)super.emit("readable");else if(Ld(e)&&this[ne])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ys]){let i=t;this[zt]?Ss(()=>i.call(this,this[ys])):i.call(this,this[ys])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[be]=this.listeners("data").length,this[be]===0&&!this[dt]&&!this[it].length&&(this[I]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[be]=0,!this[dt]&&!this[it].length&&(this[I]=!1)),t}get emittedEnd(){return this[ne]}[Kt](){!this[pi]&&!this[ne]&&!this[F]&&this[W].length===0&&this[Jt]&&(this[pi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[di]&&this.emit("close"),this[pi]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==F&&this[F])return!1;if(e==="data")return!this[J]&&!s?!1:this[zt]?(Ss(()=>this[eo](s)),!0):this[eo](s);if(e==="end")return this[Na]();if(e==="close"){if(this[di]=!0,!this[ne]&&!this[F])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[ys]=s,super.emit(to,s);let r=!this[bs]||this.listeners("error").length?super.emit("error",s):!1;return this[Kt](),r}else if(e==="resume"){let r=super.emit("resume");return this[Kt](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[Kt](),i}[eo](e){for(let s of this[it])s.dest.write(e)===!1&&this.pause();let t=this[dt]?!1:super.emit("data",e);return this[Kt](),t}[Na](){return this[ne]?!1:(this[ne]=!0,this.readable=!1,this[zt]?(Ss(()=>this[so]()),!0):this[so]())}[so](){if(this[Le]){let t=this[Le].end();if(t){for(let s of this[it])s.dest.write(t);this[dt]||super.emit("data",t)}}for(let t of this[it])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[J]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[J]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[J])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[jt]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(F,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[dt]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[Jt])return t();let i,r,o=h=>{this.off("data",n),this.off("end",a),this.off(F,l),t(),r(h)},n=h=>{this.off("error",o),this.off("end",a),this.off(F,l),this.pause(),i({value:h,done:!!this[Jt]})},a=()=>{this.off("error",o),this.off("data",n),this.off(F,l),t(),i({done:!0,value:void 0})},l=()=>o(new Error("stream destroyed"));return new Promise((h,f)=>{r=f,i=h,this.once(F,l),this.once("error",o),this.once("end",a),this.once("data",n)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[dt]=!1;let e=!1,t=()=>(this.pause(),this.off(to,t),this.off(F,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(to,t),this.once(F,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[F])return e?this.emit("error",e):this.emit(F),this;this[F]=!0,this[dt]=!0,this[W].length=0,this[U]=0;let t=this;return typeof t.close=="function"&&!this[di]&&t.close(),e?this.emit("error",e):this.emit(F),this}static get isStream(){return Nd}},Bd=_d.native,Ts={lstatSync:Ed,readdir:xd,readdirSync:Td,readlinkSync:Od,realpathSync:Bd,promises:{lstat:Rd,readdir:Ad,readlink:Cd,realpath:Pd}},al=e=>!e||e===Ts||e===kd?Ts:{...Ts,...e,promises:{...Ts.promises,...e.promises||{}}},ll=/^\\\\\?\\([a-z]:)\\?$/i,Gd=e=>e.replace(/\//g,"\\").replace(ll,"$1\\"),Hd=/[\\\/]/,Tt=0,hl=1,cl=2,Bt=4,fl=6,ul=8,Se=10,pl=12,xt=15,vs=~xt,ro=16,Fa=32,Os=64,Nt=128,wi=256,vi=512,Da=Os|Nt|vi,Yd=1023,oo=e=>e.isFile()?ul:e.isDirectory()?Bt:e.isSymbolicLink()?Se:e.isCharacterDevice()?cl:e.isBlockDevice()?fl:e.isSocket()?pl:e.isFIFO()?hl:Tt,Ma=new Oi({max:2**12}),_s=e=>{let t=Ma.get(e);if(t)return t;let s=e.normalize("NFKD");return Ma.set(e,s),s},La=new Oi({max:2**12}),bi=e=>{let t=La.get(e);if(t)return t;let s=_s(e.toLowerCase());return La.set(e,s),s},$a=class extends Oi{constructor(){super({max:256})}},qd=class extends Oi{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},dl=Symbol("PathScurry setAsCwd"),ht=class{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#T;get gid(){return this.#T}#E;get rdev(){return this.#E}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#u;get size(){return this.#u}#c;get blocks(){return this.#c}#l;get atimeMs(){return this.#l}#s;get mtimeMs(){return this.#s}#p;get ctimeMs(){return this.#p}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#d;get mtime(){return this.#d}#R;get ctime(){return this.#R}#m;get birthtime(){return this.#m}#x;#O;#g;#y;#S;#_;#e;#F;#j;#k;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Tt,s,i,r,o,n){this.name=e,this.#x=r?bi(e):_s(e),this.#e=t&Yd,this.nocase=r,this.roots=i,this.root=s||this,this.#F=o,this.#g=n.fullpath,this.#S=n.relative,this.#_=n.relativePosix,this.parent=n.parent,this.parent?this.#t=this.parent.#t:this.#t=al(n.fs)}depth(){return this.#O!==void 0?this.#O:this.parent?this.#O=this.parent.depth()+1:this.#O=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),s=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#N(s):this.#N(s)}#N(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#e&=~ro,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?bi(e):_s(e);for(let a of s)if(a.#x===i)return a;let r=this.parent?this.sep:"",o=this.#g?this.#g+r+e:void 0,n=this.newChild(e,Tt,{...t,parent:this,fullpath:o});return this.canReaddir()||(n.#e|=Nt),s.push(n),n}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#_!==void 0)return this.#_;let e=this.name,t=this.parent;if(!t)return this.#_=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#g!==void 0)return this.#g;let e=this.name,t=this.parent;if(!t)return this.#g=this.name;let s=t.fullpath()+(t.parent?this.sep:"")+e;return this.#g=s}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#y=`//?/${i}`:this.#y=i}let e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#y=s}isUnknown(){return(this.#e&xt)===Tt}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&xt)===ul}isDirectory(){return(this.#e&xt)===Bt}isCharacterDevice(){return(this.#e&xt)===cl}isBlockDevice(){return(this.#e&xt)===fl}isFIFO(){return(this.#e&xt)===hl}isSocket(){return(this.#e&xt)===pl}isSymbolicLink(){return(this.#e&Se)===Se}lstatCached(){return this.#e&Fa?this:void 0}readlinkCached(){return this.#j}realpathCached(){return this.#k}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#j)return!0;if(!this.parent)return!1;let e=this.#e&xt;return!(e!==Tt&&e!==Se||this.#e&wi||this.#e&Nt)}calledReaddir(){return!!(this.#e&ro)}isENOENT(){return!!(this.#e&Nt)}isNamed(e){return this.nocase?this.#x===bi(e):this.#x===_s(e)}async readlink(){let e=this.#j;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#j=s}catch(t){this.#P(t.code);return}}readlinkSync(){let e=this.#j;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#j=s}catch(t){this.#P(t.code);return}}#$(e){this.#e|=ro;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#v()}}#v(){this.#e&Nt||(this.#e=(this.#e|Nt)&vs,this.#G())}#G(){let e=this.children();e.provisional=0;for(let t of e)t.#v()}#L(){this.#e|=vi,this.#D()}#D(){if(this.#e&Os)return;let e=this.#e;(e&xt)===Bt&&(e&=vs),this.#e=e|Os,this.#G()}#I(e=""){e==="ENOTDIR"||e==="EPERM"?this.#D():e==="ENOENT"?this.#v():this.children().provisional=0}#C(e=""){e==="ENOTDIR"?this.parent.#D():e==="ENOENT"&&this.#v()}#P(e=""){let t=this.#e;t|=wi,e==="ENOENT"&&(t|=Nt),(e==="EINVAL"||e==="UNKNOWN")&&(t&=vs),this.#e=t,e==="ENOTDIR"&&this.parent&&this.parent.#D()}#W(e,t){return this.#z(e,t)||this.#U(e,t)}#U(e,t){let s=oo(e),i=this.newChild(e.name,s,{parent:this}),r=i.#e&xt;return r!==Bt&&r!==Se&&r!==Tt&&(i.#e|=Os),t.unshift(i),t.provisional++,i}#z(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?bi(e.name):_s(e.name))===i.#x)return this.#h(e,i,s,t)}}#h(e,t,s,i){let r=t.name;return t.#e=t.#e&vs|oo(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#e&Nt)===0)try{return this.#B(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#C(e.code)}}lstatSync(){if((this.#e&Nt)===0)try{return this.#B(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#C(e.code)}}#B(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:n,ctime:a,ctimeMs:l,dev:h,gid:f,ino:c,mode:u,mtime:p,mtimeMs:d,nlink:m,rdev:y,size:g,uid:b}=e;this.#w=t,this.#l=s,this.#m=i,this.#b=r,this.#f=o,this.#c=n,this.#R=a,this.#p=l,this.#i=h,this.#T=f,this.#a=c,this.#n=u,this.#d=p,this.#s=d,this.#r=m,this.#E=y,this.#u=g,this.#o=b;let v=oo(e);this.#e=this.#e&vs|v|Fa,v!==Tt&&v!==Bt&&v!==Se&&(this.#e|=Os)}#M=[];#A=!1;#H(e){this.#A=!1;let t=this.#M.slice();this.#M.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#M.push(e),this.#A)return;this.#A=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#I(r.code),s.provisional=0;else{for(let n of o)this.#W(n,s);this.#$(s)}this.#H(s.slice(0,s.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#Y)await this.#Y;else{let s=()=>{};this.#Y=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(t,{withFileTypes:!0}))this.#W(i,e);this.#$(e)}catch(i){this.#I(i.code),e.provisional=0}this.#Y=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#t.readdirSync(t,{withFileTypes:!0}))this.#W(s,e);this.#$(e)}catch(s){this.#I(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#e&Da)return!1;let e=xt&this.#e;return e===Tt||e===Bt||e===Se}shouldWalk(e,t){return(this.#e&Bt)===Bt&&!(this.#e&Da)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#k)return this.#k;if(!((vi|wi|Nt)&this.#e))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#k=this.resolve(e)}catch{this.#L()}}realpathSync(){if(this.#k)return this.#k;if(!((vi|wi|Nt)&this.#e))try{let e=this.#t.realpathSync(this.fullpath());return this.#k=this.resolve(e)}catch{this.#L()}}[dl](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#S=s.join(this.sep),i.#_=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#S=void 0,i.#_=void 0,i=i.parent}},ml=class gl extends ht{sep="\\";splitSep=Hd;constructor(t,s=Tt,i,r,o,n,a){super(t,s,i,r,o,n,a)}newChild(t,s=Tt,i={}){return new gl(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return ao.parse(t).root}getRoot(t){if(t=Gd(t.toUpperCase()),t===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(t,s))return this.roots[t]=i;return this.roots[t]=new fo(t,this).root}sameRoot(t,s=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(ll,"$1\\"),t===s}},yl=class wl extends ht{splitSep="/";sep="/";constructor(t,s=Tt,i,r,o,n,a){super(t,s,i,r,o,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,s=Tt,i={}){return new wl(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},bl=class{root;rootPath;roots;cwd;#t;#i;#n;nocase;#r;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=Ts}={}){this.#r=al(o),(e instanceof URL||e.startsWith("file://"))&&(e=vd(e));let n=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(n),this.#t=new $a,this.#i=new $a,this.#n=new qd(r);let a=n.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,h=a.length-1,f=t.sep,c=this.rootPath,u=!1;for(let p of a){let d=h--;l=l.child(p,{relative:new Array(d).fill("..").join(f),relativePosix:new Array(d).fill("..").join("/"),fullpath:c+=(u?"":f)+p}),u=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#t.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#t.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#i.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#i.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=[];(!r||r(e))&&n.push(s?e:e.fullpath());let a=new Set,l=(f,c)=>{a.add(f),f.readdirCB((u,p)=>{if(u)return c(u);let d=p.length;if(!d)return c();let m=()=>{--d===0&&c()};for(let y of p)(!r||r(y))&&n.push(s?y:y.fullpath()),i&&y.isSymbolicLink()?y.realpath().then(g=>g?.isUnknown()?g.lstat():g).then(g=>g?.shouldWalk(a,o)?l(g,m):m()):y.shouldWalk(a,o)?l(y,m):m()},!0)},h=e;return new Promise((f,c)=>{l(h,u=>{if(u)return c(u);f(n)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=[];(!r||r(e))&&n.push(s?e:e.fullpath());let a=new Set([e]);for(let l of a){let h=l.readdirSync();for(let f of h){(!r||r(f))&&n.push(s?f:f.fullpath());let c=f;if(f.isSymbolicLink()){if(!(i&&(c=f.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(a,o)&&a.add(c)}}return n}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let n=new Set([e]);for(let a of n){let l=a.readdirSync();for(let h of l){(!r||r(h))&&(yield s?h:h.fullpath());let f=h;if(h.isSymbolicLink()){if(!(i&&(f=h.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(n,o)&&n.add(f)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=new Ti({objectMode:!0});(!r||r(e))&&n.write(s?e:e.fullpath());let a=new Set,l=[e],h=0,f=()=>{let c=!1;for(;!c;){let u=l.shift();if(!u){h===0&&n.end();return}h++,a.add(u);let p=(m,y,g=!1)=>{if(m)return n.emit("error",m);if(i&&!g){let b=[];for(let v of y)v.isSymbolicLink()&&b.push(v.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(b.length){Promise.all(b).then(()=>p(null,y,!0));return}}for(let b of y)b&&(!r||r(b))&&(n.write(s?b:b.fullpath())||(c=!0));h--;for(let b of y){let v=b.realpathCached()||b;v.shouldWalk(a,o)&&l.push(v)}c&&!n.flowing?n.once("drain",f):d||f()},d=!0;u.readdirCB(p,!0),d=!1}};return f(),n}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof ht||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,n=new Ti({objectMode:!0}),a=new Set;(!r||r(e))&&n.write(s?e:e.fullpath());let l=[e],h=0,f=()=>{let c=!1;for(;!c;){let u=l.shift();if(!u){h===0&&n.end();return}h++,a.add(u);let p=u.readdirSync();for(let d of p)(!r||r(d))&&(n.write(s?d:d.fullpath())||(c=!0));h--;for(let d of p){let m=d;if(d.isSymbolicLink()){if(!(i&&(m=d.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(a,o)&&l.push(m)}}c&&!n.flowing&&n.once("drain",f)};return f(),n}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[dl](t)}},fo=class extends bl{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,ao,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return ao.parse(e).root.toUpperCase()}newRoot(e){return new ml(this.rootPath,Bt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},uo=class extends bl{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,Sd,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new yl(this.rootPath,Bt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Sl=class extends uo{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},dv=process.platform==="win32"?ml:yl,Vd=process.platform==="win32"?fo:process.platform==="darwin"?Sl:uo,Jd=e=>e.length>=1,Kd=e=>e.length>=1,Xd=Symbol.for("nodejs.util.inspect.custom"),vl=class El{#t;#i;#n;length;#r;#o;#T;#E;#f;#a;#u=!0;constructor(t,s,i,r){if(!Jd(t))throw new TypeError("empty pattern list");if(!Kd(s))throw new TypeError("empty glob list");if(s.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#i=s,this.#n=i,this.#r=r,this.#n===0){if(this.isUNC()){let[o,n,a,l,...h]=this.#t,[f,c,u,p,...d]=this.#i;h[0]===""&&(h.shift(),d.shift());let m=[o,n,a,l,""].join("/"),y=[f,c,u,p,""].join("/");this.#t=[m,...h],this.#i=[y,...d],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...n]=this.#t,[a,...l]=this.#i;n[0]===""&&(n.shift(),l.shift());let h=o+"/",f=a+"/";this.#t=[h,...n],this.#i=[f,...l],this.length=this.#t.length}}}[Xd](){return"Pattern <"+this.#i.slice(this.#n).join("/")+">"}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===rt}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#T=this.#T||(this.#n===0?this.isAbsolute()?this.#i[0]+this.#i.slice(1).join("/"):this.#i.join("/"):this.#i.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new El(this.#t,this.#i,this.#n+1,this.#r),this.#o.#a=this.#a,this.#o.#f=this.#f,this.#o.#E=this.#E,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#E!==void 0?this.#E:this.#E=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#u?!1:(this.#u=!1,!0)}},Zd=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ia=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=Zd}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let n of e)this.add(n)}add(e){let t=new le(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new vl(i,r,0,this.platform),n=new le(o.globString(),this.mmopts),a=r[r.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(n):this.relative.push(n),a&&(l?this.absoluteChildren.push(n):this.relativeChildren.push(n))}}ignored(e){let t=e.fullpath(),s=`${t}/`,i=e.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}},Qd=class xl{store;constructor(t=new Map){this.store=t}copy(){return new xl(new Map(this.store))}hasWalked(t,s){return this.store.get(t.fullpath())?.has(s.globString())}storeWalked(t,s){let i=t.fullpath(),r=this.store.get(i);r?r.add(s.globString()):this.store.set(i,new Set([s.globString()]))}},tm=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},em=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Wa=class Tl{hasWalkedCache;matches=new tm;subwalks=new em;patterns;follow;dot;opts;constructor(t,s){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=s?s.copy():new Qd}processPatterns(t,s){this.patterns=s;let i=s.map(r=>[t,r]);for(let[r,o]of i){this.hasWalkedCache.storeWalked(r,o);let n=o.root(),a=o.isAbsolute()&&this.opts.absolute!==!1;if(n){r=r.resolve(n==="/"&&this.opts.root!==void 0?this.opts.root:n);let c=o.rest();if(c)o=c;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let l,h,f=!1;for(;typeof(l=o.pattern())=="string"&&(h=o.rest());)r=r.resolve(l),o=h,f=!0;if(l=o.pattern(),h=o.rest(),f){if(this.hasWalkedCache.hasWalked(r,o))continue;this.hasWalkedCache.storeWalked(r,o)}if(typeof l=="string"){let c=l===".."||l===""||l===".";this.matches.add(r.resolve(l),a,c);continue}else if(l===rt){(!r.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(r,o);let c=h?.pattern(),u=h?.rest();if(!h||(c===""||c===".")&&!u)this.matches.add(r,a,c===""||c===".");else if(c===".."){let p=r.parent||r;u?this.hasWalkedCache.hasWalked(p,u)||this.subwalks.add(p,u):this.matches.add(p,a,!0)}}else l instanceof RegExp&&this.subwalks.add(r,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Tl(this.opts,this.hasWalkedCache)}filterEntries(t,s){let i=this.subwalks.get(t),r=this.child();for(let o of s)for(let n of i){let a=n.isAbsolute(),l=n.pattern(),h=n.rest();l===rt?r.testGlobstar(o,n,h,a):l instanceof RegExp?r.testRegExp(o,l,h,a):r.testString(o,l,h,a)}return r}testGlobstar(t,s,i,r){if((this.dot||!t.name.startsWith("."))&&(s.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,s):t.isSymbolicLink()&&(i&&s.checkFollowGlobstar()?this.subwalks.add(t,i):s.markFollowGlobstar()&&this.subwalks.add(t,s)))),i){let o=i.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,i.rest(),r);else if(o===".."){let n=t.parent||t;this.subwalks.add(n,i)}else o instanceof RegExp&&this.testRegExp(t,o,i.rest(),r)}}testRegExp(t,s,i,r){s.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,r,!1))}testString(t,s,i,r){t.isNamed(s)&&(i?this.subwalks.add(t,i):this.matches.add(t,r,!1))}},sm=(e,t)=>typeof e=="string"?new Ia([e],t):Array.isArray(e)?new Ia(e,t):e,Ol=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#i;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#i=sm(s.ignore??[],s),!this.includeChildMatches&&typeof this.#i.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(e){return this.seen.has(e)||!!this.#i?.ignored?.(e)}#o(e){return!!this.#i?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#t.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#t.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let i=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let r=await i.realpath();r&&(r.isUnknown()||this.opts.stat)&&await r.lstat()}return this.matchCheckTest(i,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let i=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let r=i.realpathSync();r&&(r?.isUnknown()||this.opts.stat)&&r.lstatSync()}return this.matchCheckTest(i,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#i?.add){let r=`${e.relativePosix()}/**`;this.#i.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new Wa(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||(r++,this.match(n,a,l).then(()=>o()));for(let n of s.subwalkTargets()){if(this.maxDepth!==1/0&&n.depth()>=this.maxDepth)continue;r++;let a=n.readdirCached();n.calledReaddir()?this.walkCB3(n,a,s,o):n.readdirCB((l,h)=>this.walkCB3(n,h,s,o),!0)}o()}walkCB3(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||(r++,this.match(n,a,l).then(()=>o()));for(let[n,a]of s.subwalks.entries())r++,this.walkCB2(n,a,s.child(),o);o()}walkCBSync(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new Wa(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||this.matchSync(n,a,l);for(let n of s.subwalkTargets()){if(this.maxDepth!==1/0&&n.depth()>=this.maxDepth)continue;r++;let a=n.readdirSync();this.walkCB3Sync(n,a,s,o)}o()}walkCB3Sync(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[n,a,l]of s.matches.entries())this.#r(n)||this.matchSync(n,a,l);for(let[n,a]of s.subwalks.entries())r++,this.walkCB2Sync(n,a,s.child(),o);o()}},Ua=class extends Ol{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},za=class extends Ol{results;constructor(e,t,s){super(e,t,s),this.results=new Ti({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},im=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ee=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=gd(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=e,this.platform=t.platform||im,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=t.platform==="win32"?fo:t.platform==="darwin"?Sl:t.platform?uo:Vd;this.scurry=new a(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(a=>new le(a,i)),[o,n]=r.reduce((a,l)=>(a[0].push(...l.set),a[1].push(...l.globParts),a),[[],[]]);this.patterns=o.map((a,l)=>{let h=n[l];if(!h)throw new Error("invalid pattern object");return new vl(a,h,0,this.platform)})}async walk(){return[...await new Ua(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Ua(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new za(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new za(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},rm=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let s of e)if(new le(s,t).hasMagic())return!0;return!1};function _i(e,t={}){return new Ee(e,t).streamSync()}function _l(e,t={}){return new Ee(e,t).stream()}function he(e,t={}){return new Ee(e,t).walkSync()}async function Ba(e,t={}){return new Ee(e,t).walk()}function ki(e,t={}){return new Ee(e,t).iterateSync()}function kl(e,t={}){return new Ee(e,t).iterate()}var om=_i,nm=Object.assign(_l,{sync:_i}),am=ki,lm=Object.assign(kl,{sync:ki}),hm=Object.assign(he,{stream:_i,iterate:ki}),ve=Object.assign(Ba,{glob:Ba,globSync:he,sync:hm,globStream:_l,stream:nm,globStreamSync:_i,streamSync:om,globIterate:kl,iterate:lm,globIterateSync:ki,iterateSync:am,Glob:Ee,hasMagic:rm,escape:ks,unescape:Ie});ve.glob=ve;import{dirname as Rl}from"path";import{mkdir as cm,mkdirSync as fm,stat as um,statSync as pm}from"fs";var Ot=e=>{if(!e)e={mode:511};else if(typeof e=="object")e={mode:511,...e};else if(typeof e=="number")e={mode:e};else if(typeof e=="string")e={mode:parseInt(e,8)};else throw new TypeError("invalid options argument");let t=e,s=e.fs||{};return e.mkdir=e.mkdir||s.mkdir||cm,e.mkdirAsync=e.mkdirAsync?e.mkdirAsync:async(i,r)=>new Promise((o,n)=>t.mkdir(i,r,(a,l)=>a?n(a):o(l))),e.stat=e.stat||s.stat||um,e.statAsync=e.statAsync?e.statAsync:async i=>new Promise((r,o)=>t.stat(i,(n,a)=>n?o(n):r(a))),e.statSync=e.statSync||s.statSync||pm,e.mkdirSync=e.mkdirSync||s.mkdirSync||fm,t};var Gt=(e,t,s)=>{let i=Rl(e),r={...Ot(t),recursive:!1};if(i===e)try{return r.mkdirSync(e,r)}catch(o){let n=o;if(n&&n.code!=="EISDIR")throw o;return}try{return r.mkdirSync(e,r),s||e}catch(o){let n=o;if(n&&n.code==="ENOENT")return Gt(e,r,Gt(i,r,s));if(n&&n.code!=="EEXIST"&&n&&n.code!=="EROFS")throw o;try{if(!r.statSync(e).isDirectory())throw o}catch{throw o}}},Xt=Object.assign(async(e,t,s)=>{let i=Ot(t);i.recursive=!1;let r=Rl(e);return r===e?i.mkdirAsync(e,i).catch(o=>{let n=o;if(n&&n.code!=="EISDIR")throw o}):i.mkdirAsync(e,i).then(()=>s||e,async o=>{let n=o;if(n&&n.code==="ENOENT")return Xt(r,i).then(a=>Xt(e,i,a));if(n&&n.code!=="EEXIST"&&n.code!=="EROFS")throw o;return i.statAsync(e).then(a=>{if(a.isDirectory())return s;throw o},()=>{throw o})})},{sync:Gt});import{dirname as Cl}from"path";import{dirname as Al}from"path";var po=async(e,t,s)=>{if(s!==t)return e.statAsync(t).then(i=>i.isDirectory()?s:void 0,i=>{let r=i;return r&&r.code==="ENOENT"?po(e,Al(t),t):void 0})},mo=(e,t,s)=>{if(s!==t)try{return e.statSync(t).isDirectory()?s:void 0}catch(i){let r=i;return r&&r.code==="ENOENT"?mo(e,Al(t),t):void 0}};var We=(e,t)=>{let s=Ot(t);if(s.recursive=!0,Cl(e)===e)return s.mkdirSync(e,s);let r=mo(s,e);try{return s.mkdirSync(e,s),r}catch(o){let n=o;if(n&&n.code==="ENOENT")return Gt(e,s);throw o}},Rs=Object.assign(async(e,t)=>{let s={...Ot(t),recursive:!0};return Cl(e)===e?await s.mkdirAsync(e,s):po(s,e).then(r=>s.mkdirAsync(e,s).then(o=>r||o).catch(o=>{let n=o;if(n&&n.code==="ENOENT")return Xt(e,s);throw o}))},{sync:We});import{parse as mm,resolve as gm}from"path";var dm=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,go=e=>{if(/\0/.test(e))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:e,code:"ERR_INVALID_ARG_VALUE"});if(e=gm(e),dm==="win32"){let t=/[*|"<>?:]/,{root:s}=mm(e);if(t.test(e.substring(s.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e};import{mkdir as ym,mkdirSync as wm}from"fs";var bm=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,yo=bm.replace(/^v/,"").split("."),Pl=+yo[0]>10||+yo[0]==10&&+yo[1]>=12,As=Pl?e=>Ot(e).mkdirSync===wm:()=>!1,Ri=Object.assign(Pl?e=>Ot(e).mkdir===ym:()=>!1,{sync:As});var Zt=(e,t)=>{e=go(e);let s=Ot(t);return As(s)?We(e,s):Gt(e,s)};var wo=Object.assign(async(e,t)=>{e=go(e);let s=Ot(t);return Ri(s)?Rs(e,s):Xt(e,s)},{mkdirpSync:Zt,mkdirpNative:Rs,mkdirpNativeSync:We,mkdirpManual:Xt,mkdirpManualSync:Gt,sync:Zt,native:Rs,nativeSync:We,manual:Xt,manualSync:Gt,useNative:Ri,useNativeSync:As});import Lg from"node:constants";import{createHash as $h}from"node:crypto";import{chmodSync as Ih,copyFileSync as $g,linkSync as Ig,readFileSync as Wh,readlinkSync as Uh,symlinkSync as Wg,unlinkSync as Ug}from"node:fs";import{dirname as Gs,relative as zh,resolve as ir,sep as zg}from"node:path";var Sm=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Nl=new Set,bo=typeof process=="object"&&process?process:{},Fl=(e,t,s,i)=>{typeof bo.emitWarning=="function"?bo.emitWarning(e,t,s,i):console.error(`[${s}] ${t}: ${e}`)},Ci=globalThis.AbortController,jl=globalThis.AbortSignal;if(typeof Ci>"u"){jl=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},Ci=class{constructor(){t()}signal=new jl;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let e=bo.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,Fl("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var vm=e=>!Nl.has(e);var ce=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Dl=e=>ce(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ai:null:null,Ai=class extends Array{constructor(e){super(e),this.fill(0)}},Em=class Cs{heap;length;static#t=!1;static create(t){let s=Dl(t);if(!s)return[];Cs.#t=!0;let i=new Cs(t,s);return Cs.#t=!1,i}constructor(t,s){if(!Cs.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Ps=class Ml{#t;#i;#n;#r;#o;#T;#E;#f;get perf(){return this.#f}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#u;#c;#l;#s;#p;#b;#w;#d;#R;#m;#x;#O;#g;#y;#S;#_;#e;#F;static unsafeExposeInternals(t){return{starts:t.#O,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#x,keyMap:t.#c,keyList:t.#l,valList:t.#s,next:t.#p,prev:t.#b,get head(){return t.#w},get tail(){return t.#d},free:t.#R,isBackgroundFetch:s=>t.#h(s),backgroundFetch:(s,i,r,o)=>t.#z(s,i,r,o),moveToTail:s=>t.#M(s),indexes:s=>t.#C(s),rindexes:s=>t.#P(s),isStale:s=>t.#v(s)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#u}get size(){return this.#a}get fetchMethod(){return this.#T}get memoMethod(){return this.#E}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:s=0,ttl:i,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:g,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:R,ignoreFetchAbort:M,perf:q}=t;if(q!==void 0&&typeof q?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#f=q??Sm,s!==0&&!ce(s))throw new TypeError("max option must be a nonnegative integer");let et=s?Dl(s):Array;if(!et)throw new Error("invalid max value: "+s);if(this.#t=s,this.#i=d,this.maxEntrySize=m||this.#i,this.sizeCalculation=y,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#E=b,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=g,this.#_=!!g,this.#c=new Map,this.#l=new Array(s).fill(void 0),this.#s=new Array(s).fill(void 0),this.#p=new et(s),this.#b=new et(s),this.#w=0,this.#d=0,this.#R=Em.create(s),this.#a=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof f=="function"&&(this.#r=f),typeof c=="function"?(this.#o=c,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#S=!!this.#n,this.#F=!!this.#r,this.#e=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!M,this.maxEntrySize!==0){if(this.#i!==0&&!ce(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!ce(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#G()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ce(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!ce(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#j()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let qt="LRU_CACHE_UNBOUNDED";vm(qt)&&(Nl.add(qt),Fl("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",qt,Ml))}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#j(){let t=new Ai(this.#t),s=new Ai(this.#t);this.#g=t,this.#O=s;let i=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=i,this.#$=(n,a,l=this.#f.now())=>{if(s[n]=a!==0?l:0,t[n]=a,i?.[n]&&(clearTimeout(i[n]),i[n]=void 0),a!==0&&i){let h=setTimeout(()=>{this.#v(n)&&this.#A(this.#l[n],"expire")},a+1);h.unref&&h.unref(),i[n]=h}},this.#k=n=>{s[n]=t[n]!==0?this.#f.now():0},this.#N=(n,a)=>{if(t[a]){let l=t[a],h=s[a];if(!l||!h)return;n.ttl=l,n.start=h,n.now=r||o();let f=n.now-h;n.remainingTTL=l-f}};let r=0,o=()=>{let n=this.#f.now();if(this.ttlResolution>0){r=n;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#c.get(n);if(a===void 0)return 0;let l=t[a],h=s[a];if(!l||!h)return 1/0;let f=(r||o())-h;return l-f},this.#v=n=>{let a=s[n],l=t[n];return!!l&&!!a&&(r||o())-a>l}}#k=()=>{};#N=()=>{};#$=()=>{};#v=()=>!1;#G(){let t=new Ai(this.#t);this.#u=0,this.#x=t,this.#L=s=>{this.#u-=t[s],t[s]=0},this.#I=(s,i,r,o)=>{if(this.#h(i))return 0;if(!ce(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(i,s),!ce(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#D=(s,i,r)=>{if(t[s]=i,this.#i){let o=this.#i-t[s];for(;this.#u>o;)this.#U(!0)}this.#u+=t[s],r&&(r.entrySize=i,r.totalCalculatedSize=this.#u)}}#L=t=>{};#D=(t,s,i)=>{};#I=(t,s,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#d;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#w));)s=this.#b[s]}*#P({allowStale:t=this.allowStale}={}){if(this.#a)for(let s=this.#w;!(!this.#W(s)||((t||!this.#v(s))&&(yield s),s===this.#d));)s=this.#p[s]}#W(t){return t!==void 0&&this.#c.get(this.#l[t])===t}*entries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*rentries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#h(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*keys(){for(let t of this.#C()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*rkeys(){for(let t of this.#P()){let s=this.#l[t];s!==void 0&&!this.#h(this.#s[t])&&(yield s)}}*values(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#h(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,s={}){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,this.#l[i],this))return this.get(this.#l[i],s)}}forEach(t,s=this){for(let i of this.#C()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}rforEach(t,s=this){for(let i of this.#P()){let r=this.#s[i],o=this.#h(r)?r.__staleWhileFetching:r;o!==void 0&&t.call(s,o,this.#l[i],this)}}purgeStale(){let t=!1;for(let s of this.#P({allowStale:!0}))this.#v(s)&&(this.#A(this.#l[s],"expire"),t=!0);return t}info(t){let s=this.#c.get(t);if(s===void 0)return;let i=this.#s[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0)return;let o={value:r};if(this.#g&&this.#O){let n=this.#g[s],a=this.#O[s];if(n&&a){let l=n-(this.#f.now()-a);o.ttl=l,o.start=Date.now()}}return this.#x&&(o.size=this.#x[s]),o}dump(){let t=[];for(let s of this.#C({allowStale:!0})){let i=this.#l[s],r=this.#s[s],o=this.#h(r)?r.__staleWhileFetching:r;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#g&&this.#O){n.ttl=this.#g[s];let a=this.#f.now()-this.#O[s];n.start=Math.floor(Date.now()-a)}this.#x&&(n.size=this.#x[s]),t.unshift([i,n])}return t}load(t){this.clear();for(let[s,i]of t){if(i.start){let r=Date.now()-i.start;i.start=this.#f.now()-r}this.set(s,i.value,i)}}set(t,s,i={}){if(s===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,f=this.#I(t,s,i.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#A(t,"set"),this;let c=this.#a===0?void 0:this.#c.get(t);if(c===void 0)c=this.#a===0?this.#d:this.#R.length!==0?this.#R.pop():this.#a===this.#t?this.#U(!1):this.#a,this.#l[c]=t,this.#s[c]=s,this.#c.set(t,c),this.#p[this.#d]=c,this.#b[c]=this.#d,this.#d=c,this.#a++,this.#D(c,f,l),l&&(l.set="add"),h=!1,this.#F&&this.#r?.(s,t,"add");else{this.#M(c);let u=this.#s[c];if(s!==u){if(this.#_&&this.#h(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=u;p!==void 0&&!n&&(this.#S&&this.#n?.(p,t,"set"),this.#e&&this.#m?.push([p,t,"set"]))}else n||(this.#S&&this.#n?.(u,t,"set"),this.#e&&this.#m?.push([u,t,"set"]));if(this.#L(c),this.#D(c,f,l),this.#s[c]=s,l){l.set="replace";let p=u&&this.#h(u)?u.__staleWhileFetching:u;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update");this.#F&&this.onInsert?.(s,t,s===u?"update":"replace")}if(r!==0&&!this.#g&&this.#j(),this.#g&&(h||this.#$(c,r,o),l&&this.#N(l,c)),!n&&this.#e&&this.#m){let u=this.#m,p;for(;p=u?.shift();)this.#o?.(...p)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#w];if(this.#U(!0),this.#h(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,s;for(;s=t?.shift();)this.#o?.(...s)}}}#U(t){let s=this.#w,i=this.#l[s],r=this.#s[s];return this.#_&&this.#h(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(r,i,"evict"),this.#e&&this.#m?.push([r,i,"evict"])),this.#L(s),this.#y?.[s]&&(clearTimeout(this.#y[s]),this.#y[s]=void 0),t&&(this.#l[s]=void 0,this.#s[s]=void 0,this.#R.push(s)),this.#a===1?(this.#w=this.#d=0,this.#R.length=0):this.#w=this.#p[s],this.#c.delete(i),this.#a--,s}has(t,s={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=s,o=this.#c.get(t);if(o!==void 0){let n=this.#s[o];if(this.#h(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#v(o))r&&(r.has="stale",this.#N(r,o));else return i&&this.#k(o),r&&(r.has="hit",this.#N(r,o)),!0}else r&&(r.has="miss");return!1}peek(t,s={}){let{allowStale:i=this.allowStale}=s,r=this.#c.get(t);if(r===void 0||!i&&this.#v(r))return;let o=this.#s[r];return this.#h(o)?o.__staleWhileFetching:o}#z(t,s,i,r){let o=s===void 0?void 0:this.#s[s];if(this.#h(o))return o;let n=new Ci,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:i,context:r},h=(m,y=!1)=>{let{aborted:g}=n.signal,b=i.ignoreFetchAbort&&m!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(g&&!y?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!b&&!y)return c(n.signal.reason,v);let w=p,S=this.#s[s];return(S===p||b&&y&&S===void 0)&&(m===void 0?w.__staleWhileFetching!==void 0?this.#s[s]=w.__staleWhileFetching:this.#A(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,m,l.options))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),c(m,!1)),c=(m,y)=>{let{aborted:g}=n.signal,b=g&&i.allowStaleOnFetchAbort,v=b||i.allowStaleOnFetchRejection,w=v||i.noDeleteOnFetchRejection,S=p;if(this.#s[s]===p&&(!w||!y&&S.__staleWhileFetching===void 0?this.#A(t,"fetch"):b||(this.#s[s]=S.__staleWhileFetching)),v)return i.status&&S.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},u=(m,y)=>{let g=this.#T?.(t,o,l);g&&g instanceof Promise&&g.then(b=>m(b===void 0?void 0:b),y),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=b=>h(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(u).then(h,f),d=Object.assign(p,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return s===void 0?(this.set(t,d,{...l.options,status:void 0}),s=this.#c.get(t)):this.#s[s]=d,d}#h(t){if(!this.#_)return!1;let s=t;return!!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof Ci}async fetch(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:m,forceRefresh:y=!1,status:g,signal:b}=s;if(!this.#_)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let v={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:b},w=this.#c.get(t);if(w===void 0){g&&(g.fetch="miss");let S=this.#z(t,w,v,m);return S.__returned=S}else{let S=this.#s[w];if(this.#h(S)){let et=i&&S.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",et&&(g.returnedStale=!0)),et?S.__staleWhileFetching:S.__returned=S}let R=this.#v(w);if(!y&&!R)return g&&(g.fetch="hit"),this.#M(w),r&&this.#k(w),g&&this.#N(g,w),S;let M=this.#z(t,w,v,m),q=M.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=R?"stale":"refresh",q&&R&&(g.returnedStale=!0)),q?M.__staleWhileFetching:M.__returned=M}}async forceFetch(t,s={}){let i=await this.fetch(t,s);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,s={}){let i=this.#E;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=s,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=i(t,a,{options:n,context:r});return this.set(t,l,n),l}get(t,s={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=s,a=this.#c.get(t);if(a!==void 0){let l=this.#s[a],h=this.#h(l);return n&&this.#N(n,a),this.#v(a)?(n&&(n.get="stale"),h?(n&&i&&l.__staleWhileFetching!==void 0&&(n.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.#A(t,"expire"),n&&i&&(n.returnedStale=!0),i?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(this.#M(a),r&&this.#k(a),l))}else n&&(n.get="miss")}#B(t,s){this.#b[s]=t,this.#p[t]=s}#M(t){t!==this.#d&&(t===this.#w?this.#w=this.#p[t]:this.#B(this.#b[t],this.#p[t]),this.#B(this.#d,t),this.#d=t)}delete(t){return this.#A(t,"delete")}#A(t,s){let i=!1;if(this.#a!==0){let r=this.#c.get(t);if(r!==void 0)if(this.#y?.[r]&&(clearTimeout(this.#y?.[r]),this.#y[r]=void 0),i=!0,this.#a===1)this.#H(s);else{this.#L(r);let o=this.#s[r];if(this.#h(o)?o.__abortController.abort(new Error("deleted")):(this.#S||this.#e)&&(this.#S&&this.#n?.(o,t,s),this.#e&&this.#m?.push([o,t,s])),this.#c.delete(t),this.#l[r]=void 0,this.#s[r]=void 0,r===this.#d)this.#d=this.#b[r];else if(r===this.#w)this.#w=this.#p[r];else{let n=this.#b[r];this.#p[n]=this.#p[r];let a=this.#p[r];this.#b[a]=this.#b[r]}this.#a--,this.#R.push(r)}}if(this.#e&&this.#m?.length){let r=this.#m,o;for(;o=r?.shift();)this.#o?.(...o)}return i}clear(){return this.#H("delete")}#H(t){for(let s of this.#P({allowStale:!0})){let i=this.#s[s];if(this.#h(i))i.__abortController.abort(new Error("deleted"));else{let r=this.#l[s];this.#S&&this.#n?.(i,r,t),this.#e&&this.#m?.push([i,r,t])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#g&&this.#O){this.#g.fill(0),this.#O.fill(0);for(let s of this.#y??[])s!==void 0&&clearTimeout(s);this.#y?.fill(void 0)}if(this.#x&&this.#x.fill(0),this.#w=0,this.#d=0,this.#R.length=0,this.#u=0,this.#a=0,this.#e&&this.#m){let s=this.#m,i;for(;i=s?.shift();)this.#o?.(...i)}}};import{posix as Nm,win32 as Ao}from"node:path";import{fileURLToPath as Fm}from"node:url";import{lstatSync as Dm,readdir as Mm,readdirSync as Lm,readlinkSync as $m,realpathSync as Im}from"fs";import*as Wm from"node:fs";import{lstat as zm,readdir as Bm,readlink as Gm,realpath as Hm}from"node:fs/promises";import{EventEmitter as _o}from"node:events";import Ul from"node:stream";import{StringDecoder as xm}from"node:string_decoder";var Ll=typeof process=="object"&&process?process:{stdout:null,stderr:null},Tm=e=>!!e&&typeof e=="object"&&(e instanceof Be||e instanceof Ul||Om(e)||_m(e)),Om=e=>!!e&&typeof e=="object"&&e instanceof _o&&typeof e.pipe=="function"&&e.pipe!==Ul.Writable.prototype.pipe,_m=e=>!!e&&typeof e=="object"&&e instanceof _o&&typeof e.write=="function"&&typeof e.end=="function",Qt=Symbol("EOF"),te=Symbol("maybeEmitEnd"),fe=Symbol("emittedEnd"),Pi=Symbol("emittingEnd"),js=Symbol("emittedError"),ji=Symbol("closed"),$l=Symbol("read"),Ni=Symbol("flush"),Il=Symbol("flushChunk"),Ft=Symbol("encoding"),Ue=Symbol("decoder"),z=Symbol("flowing"),Ns=Symbol("paused"),ze=Symbol("resume"),B=Symbol("buffer"),nt=Symbol("pipes"),G=Symbol("bufferLength"),So=Symbol("bufferPush"),Fi=Symbol("bufferShift"),K=Symbol("objectMode"),D=Symbol("destroyed"),vo=Symbol("error"),Eo=Symbol("emitData"),Wl=Symbol("emitEnd"),xo=Symbol("emitEnd2"),Ht=Symbol("async"),To=Symbol("abort"),Di=Symbol("aborted"),Fs=Symbol("signal"),xe=Symbol("dataListeners"),gt=Symbol("discarded"),Ds=e=>Promise.resolve().then(e),km=e=>e(),Rm=e=>e==="end"||e==="finish"||e==="prefinish",Am=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Cm=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Mi=class{src;dest;opts;ondrain;constructor(t,s,i){this.src=t,this.dest=s,this.opts=i,this.ondrain=()=>t[ze](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Oo=class extends Mi{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,s,i){super(t,s,i),this.proxyErrors=r=>s.emit("error",r),t.on("error",this.proxyErrors)}},Pm=e=>!!e.objectMode,jm=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Be=class extends _o{[z]=!1;[Ns]=!1;[nt]=[];[B]=[];[K];[Ft];[Ht];[Ue];[Qt]=!1;[fe]=!1;[Pi]=!1;[ji]=!1;[js]=null;[G]=0;[D]=!1;[Fs];[Di]=!1;[xe]=0;[gt]=!1;writable=!0;readable=!0;constructor(...t){let s=t[0]||{};if(super(),s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Pm(s)?(this[K]=!0,this[Ft]=null):jm(s)?(this[Ft]=s.encoding,this[K]=!1):(this[K]=!1,this[Ft]=null),this[Ht]=!!s.async,this[Ue]=this[Ft]?new xm(this[Ft]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[nt]});let{signal:i}=s;i&&(this[Fs]=i,i.aborted?this[To]():i.addEventListener("abort",()=>this[To]()))}get bufferLength(){return this[G]}get encoding(){return this[Ft]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[K]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ht]}set async(t){this[Ht]=this[Ht]||!!t}[To](){this[Di]=!0,this.emit("abort",this[Fs]?.reason),this.destroy(this[Fs]?.reason)}get aborted(){return this[Di]}set aborted(t){}write(t,s,i){if(this[Di])return!1;if(this[Qt])throw new Error("write after end");if(this[D])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let r=this[Ht]?Ds:km;if(!this[K]&&!Buffer.isBuffer(t)){if(Cm(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Am(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[K]?(this[z]&&this[G]!==0&&this[Ni](!0),this[z]?this.emit("data",t):this[So](t),this[G]!==0&&this.emit("readable"),i&&r(i),this[z]):t.length?(typeof t=="string"&&!(s===this[Ft]&&!this[Ue]?.lastNeed)&&(t=Buffer.from(t,s)),Buffer.isBuffer(t)&&this[Ft]&&(t=this[Ue].write(t)),this[z]&&this[G]!==0&&this[Ni](!0),this[z]?this.emit("data",t):this[So](t),this[G]!==0&&this.emit("readable"),i&&r(i),this[z]):(this[G]!==0&&this.emit("readable"),i&&r(i),this[z])}read(t){if(this[D])return null;if(this[gt]=!1,this[G]===0||t===0||t&&t>this[G])return this[te](),null;this[K]&&(t=null),this[B].length>1&&!this[K]&&(this[B]=[this[Ft]?this[B].join(""):Buffer.concat(this[B],this[G])]);let s=this[$l](t||null,this[B][0]);return this[te](),s}[$l](t,s){if(this[K])this[Fi]();else{let i=s;t===i.length||t===null?this[Fi]():typeof i=="string"?(this[B][0]=i.slice(t),s=i.slice(0,t),this[G]-=t):(this[B][0]=i.subarray(t),s=i.subarray(0,t),this[G]-=t)}return this.emit("data",s),!this[B].length&&!this[Qt]&&this.emit("drain"),s}end(t,s,i){return typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s="utf8"),t!==void 0&&this.write(t,s),i&&this.once("end",i),this[Qt]=!0,this.writable=!1,(this[z]||!this[Ns])&&this[te](),this}[ze](){this[D]||(!this[xe]&&!this[nt].length&&(this[gt]=!0),this[Ns]=!1,this[z]=!0,this.emit("resume"),this[B].length?this[Ni]():this[Qt]?this[te]():this.emit("drain"))}resume(){return this[ze]()}pause(){this[z]=!1,this[Ns]=!0,this[gt]=!1}get destroyed(){return this[D]}get flowing(){return this[z]}get paused(){return this[Ns]}[So](t){this[K]?this[G]+=1:this[G]+=t.length,this[B].push(t)}[Fi](){return this[K]?this[G]-=1:this[G]-=this[B][0].length,this[B].shift()}[Ni](t=!1){do;while(this[Il](this[Fi]())&&this[B].length);!t&&!this[B].length&&!this[Qt]&&this.emit("drain")}[Il](t){return this.emit("data",t),this[z]}pipe(t,s){if(this[D])return t;this[gt]=!1;let i=this[fe];return s=s||{},t===Ll.stdout||t===Ll.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&t.end():(this[nt].push(s.proxyErrors?new Oo(this,t,s):new Mi(this,t,s)),this[Ht]?Ds(()=>this[ze]()):this[ze]()),t}unpipe(t){let s=this[nt].find(i=>i.dest===t);s&&(this[nt].length===1?(this[z]&&this[xe]===0&&(this[z]=!1),this[nt]=[]):this[nt].splice(this[nt].indexOf(s),1),s.unpipe())}addListener(t,s){return this.on(t,s)}on(t,s){let i=super.on(t,s);if(t==="data")this[gt]=!1,this[xe]++,!this[nt].length&&!this[z]&&this[ze]();else if(t==="readable"&&this[G]!==0)super.emit("readable");else if(Rm(t)&&this[fe])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[js]){let r=s;this[Ht]?Ds(()=>r.call(this,this[js])):r.call(this,this[js])}return i}removeListener(t,s){return this.off(t,s)}off(t,s){let i=super.off(t,s);return t==="data"&&(this[xe]=this.listeners("data").length,this[xe]===0&&!this[gt]&&!this[nt].length&&(this[z]=!1)),i}removeAllListeners(t){let s=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[xe]=0,!this[gt]&&!this[nt].length&&(this[z]=!1)),s}get emittedEnd(){return this[fe]}[te](){!this[Pi]&&!this[fe]&&!this[D]&&this[B].length===0&&this[Qt]&&(this[Pi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ji]&&this.emit("close"),this[Pi]=!1)}emit(t,...s){let i=s[0];if(t!=="error"&&t!=="close"&&t!==D&&this[D])return!1;if(t==="data")return!this[K]&&!i?!1:this[Ht]?(Ds(()=>this[Eo](i)),!0):this[Eo](i);if(t==="end")return this[Wl]();if(t==="close"){if(this[ji]=!0,!this[fe]&&!this[D])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[js]=i,super.emit(vo,i);let o=!this[Fs]||this.listeners("error").length?super.emit("error",i):!1;return this[te](),o}else if(t==="resume"){let o=super.emit("resume");return this[te](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let r=super.emit(t,...s);return this[te](),r}[Eo](t){for(let i of this[nt])i.dest.write(t)===!1&&this.pause();let s=this[gt]?!1:super.emit("data",t);return this[te](),s}[Wl](){return this[fe]?!1:(this[fe]=!0,this.readable=!1,this[Ht]?(Ds(()=>this[xo]()),!0):this[xo]())}[xo](){if(this[Ue]){let s=this[Ue].end();if(s){for(let i of this[nt])i.dest.write(s);this[gt]||super.emit("data",s)}}for(let s of this[nt])s.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[K]||(t.dataLength=0);let s=this.promise();return this.on("data",i=>{t.push(i),this[K]||(t.dataLength+=i.length)}),await s,t}async concat(){if(this[K])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ft]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,s)=>{this.on(D,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[gt]=!1;let t=!1,s=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return s();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Qt])return s();let o,n,a=c=>{this.off("data",l),this.off("end",h),this.off(D,f),s(),n(c)},l=c=>{this.off("error",a),this.off("end",h),this.off(D,f),this.pause(),o({value:c,done:!!this[Qt]})},h=()=>{this.off("error",a),this.off("data",l),this.off(D,f),s(),o({done:!0,value:void 0})},f=()=>a(new Error("stream destroyed"));return new Promise((c,u)=>{n=u,o=c,this.once(D,f),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[gt]=!1;let t=!1,s=()=>(this.pause(),this.off(vo,s),this.off(D,s),this.off("end",s),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return s();let r=this.read();return r===null?s():{done:!1,value:r}};return this.once("end",s),this.once(vo,s),this.once(D,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(t){if(this[D])return t?this.emit("error",t):this.emit(D),this;this[D]=!0,this[gt]=!0,this[B].length=0,this[G]=0;let s=this;return typeof s.close=="function"&&!this[ji]&&s.close(),t?this.emit("error",t):this.emit(D),this}static get isStream(){return Tm}};var Um=Im.native,Ls={lstatSync:Dm,readdir:Mm,readdirSync:Lm,readlinkSync:$m,realpathSync:Um,promises:{lstat:zm,readdir:Bm,readlink:Gm,realpath:Hm}},Yl=e=>!e||e===Ls||e===Wm?Ls:{...Ls,...e,promises:{...Ls.promises,...e.promises||{}}},ql=/^\\\\\?\\([a-z]:)\\?$/i,Ym=e=>e.replace(/\//g,"\\").replace(ql,"$1\\"),qm=/[\\\/]/,kt=0,Vl=1,Jl=2,Yt=4,Kl=6,Xl=8,Te=10,Zl=12,_t=15,Ms=~_t,ko=16,zl=32,$s=64,Dt=128,Li=256,Ii=512,Bl=$s|Dt|Ii,Vm=1023,Ro=e=>e.isFile()?Xl:e.isDirectory()?Yt:e.isSymbolicLink()?Te:e.isCharacterDevice()?Jl:e.isBlockDevice()?Kl:e.isSocket()?Zl:e.isFIFO()?Vl:kt,Gl=new Ps({max:2**12}),Is=e=>{let t=Gl.get(e);if(t)return t;let s=e.normalize("NFKD");return Gl.set(e,s),s},Hl=new Ps({max:2**12}),$i=e=>{let t=Hl.get(e);if(t)return t;let s=Is(e.toLowerCase());return Hl.set(e,s),s},Wi=class extends Ps{constructor(){super({max:256})}},Co=class extends Ps{constructor(t=16*1024){super({maxSize:t,sizeCalculation:s=>s.length+1})}},Ql=Symbol("PathScurry setAsCwd"),X=class{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#T;get gid(){return this.#T}#E;get rdev(){return this.#E}#f;get blksize(){return this.#f}#a;get ino(){return this.#a}#u;get size(){return this.#u}#c;get blocks(){return this.#c}#l;get atimeMs(){return this.#l}#s;get mtimeMs(){return this.#s}#p;get ctimeMs(){return this.#p}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#d;get mtime(){return this.#d}#R;get ctime(){return this.#R}#m;get birthtime(){return this.#m}#x;#O;#g;#y;#S;#_;#e;#F;#j;#k;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,s=kt,i,r,o,n,a){this.name=t,this.#x=o?$i(t):Is(t),this.#e=s&Vm,this.nocase=o,this.roots=r,this.root=i||this,this.#F=n,this.#g=a.fullpath,this.#S=a.relative,this.#_=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=Yl(a.fs)}depth(){return this.#O!==void 0?this.#O:this.parent?this.#O=this.parent.depth()+1:this.#O=0}childrenCache(){return this.#F}resolve(t){if(!t)return this;let s=this.getRootString(t),r=t.substring(s.length).split(this.splitSep);return s?this.getRoot(s).#N(r):this.#N(r)}#N(t){let s=this;for(let i of t)s=s.child(i);return s}children(){let t=this.#F.get(this);if(t)return t;let s=Object.assign([],{provisional:0});return this.#F.set(this,s),this.#e&=~ko,s}child(t,s){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let i=this.children(),r=this.nocase?$i(t):Is(t);for(let l of i)if(l.#x===r)return l;let o=this.parent?this.sep:"",n=this.#g?this.#g+o+t:void 0,a=this.newChild(t,kt,{...s,parent:this,fullpath:n});return this.canReaddir()||(a.#e|=Dt),i.push(a),a}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let t=this.name,s=this.parent;if(!s)return this.#S=this.name;let i=s.relative();return i+(!i||!s.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#_!==void 0)return this.#_;let t=this.name,s=this.parent;if(!s)return this.#_=this.fullpathPosix();let i=s.relativePosix();return i+(!i||!s.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,s=this.parent;if(!s)return this.#g=this.name;let r=s.fullpath()+(s.parent?this.sep:"")+t;return this.#g=r}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#y=`//?/${r}`:this.#y=r}let t=this.parent,s=t.fullpathPosix(),i=s+(!s||!t.parent?"":"/")+this.name;return this.#y=i}isUnknown(){return(this.#e&_t)===kt}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&_t)===Xl}isDirectory(){return(this.#e&_t)===Yt}isCharacterDevice(){return(this.#e&_t)===Jl}isBlockDevice(){return(this.#e&_t)===Kl}isFIFO(){return(this.#e&_t)===Vl}isSocket(){return(this.#e&_t)===Zl}isSymbolicLink(){return(this.#e&Te)===Te}lstatCached(){return this.#e&zl?this:void 0}readlinkCached(){return this.#j}realpathCached(){return this.#k}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#j)return!0;if(!this.parent)return!1;let t=this.#e&_t;return!(t!==kt&&t!==Te||this.#e&Li||this.#e&Dt)}calledReaddir(){return!!(this.#e&ko)}isENOENT(){return!!(this.#e&Dt)}isNamed(t){return this.nocase?this.#x===$i(t):this.#x===Is(t)}async readlink(){let t=this.#j;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(s);if(i)return this.#j=i}catch(s){this.#P(s.code);return}}readlinkSync(){let t=this.#j;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(s);if(i)return this.#j=i}catch(s){this.#P(s.code);return}}#$(t){this.#e|=ko;for(let s=t.provisional;s<t.length;s++){let i=t[s];i&&i.#v()}}#v(){this.#e&Dt||(this.#e=(this.#e|Dt)&Ms,this.#G())}#G(){let t=this.children();t.provisional=0;for(let s of t)s.#v()}#L(){this.#e|=Ii,this.#D()}#D(){if(this.#e&$s)return;let t=this.#e;(t&_t)===Yt&&(t&=Ms),this.#e=t|$s,this.#G()}#I(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#v():this.children().provisional=0}#C(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#v()}#P(t=""){let s=this.#e;s|=Li,t==="ENOENT"&&(s|=Dt),(t==="EINVAL"||t==="UNKNOWN")&&(s&=Ms),this.#e=s,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#W(t,s){return this.#z(t,s)||this.#U(t,s)}#U(t,s){let i=Ro(t),r=this.newChild(t.name,i,{parent:this}),o=r.#e&_t;return o!==Yt&&o!==Te&&o!==kt&&(r.#e|=$s),s.unshift(r),s.provisional++,r}#z(t,s){for(let i=s.provisional;i<s.length;i++){let r=s[i];if((this.nocase?$i(t.name):Is(t.name))===r.#x)return this.#h(t,r,i,s)}}#h(t,s,i,r){let o=s.name;return s.#e=s.#e&Ms|Ro(t),o!==t.name&&(s.name=t.name),i!==r.provisional&&(i===r.length-1?r.pop():r.splice(i,1),r.unshift(s)),r.provisional++,s}async lstat(){if((this.#e&Dt)===0)try{return this.#B(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#C(t.code)}}lstatSync(){if((this.#e&Dt)===0)try{return this.#B(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#C(t.code)}}#B(t){let{atime:s,atimeMs:i,birthtime:r,birthtimeMs:o,blksize:n,blocks:a,ctime:l,ctimeMs:h,dev:f,gid:c,ino:u,mode:p,mtime:d,mtimeMs:m,nlink:y,rdev:g,size:b,uid:v}=t;this.#w=s,this.#l=i,this.#m=r,this.#b=o,this.#f=n,this.#c=a,this.#R=l,this.#p=h,this.#i=f,this.#T=c,this.#a=u,this.#n=p,this.#d=d,this.#s=m,this.#r=y,this.#E=g,this.#u=b,this.#o=v;let w=Ro(t);this.#e=this.#e&Ms|w|zl,w!==kt&&w!==Yt&&w!==Te&&(this.#e|=$s)}#M=[];#A=!1;#H(t){this.#A=!1;let s=this.#M.slice();this.#M.length=0,s.forEach(i=>i(null,t))}readdirCB(t,s=!1){if(!this.canReaddir()){s?t(null,[]):queueMicrotask(()=>t(null,[]));return}let i=this.children();if(this.calledReaddir()){let o=i.slice(0,i.provisional);s?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#M.push(t),this.#A)return;this.#A=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(o,n)=>{if(o)this.#I(o.code),i.provisional=0;else{for(let a of n)this.#W(a,i);this.#$(i)}this.#H(i.slice(0,i.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let s=this.fullpath();if(this.#Y)await this.#Y;else{let i=()=>{};this.#Y=new Promise(r=>i=r);try{for(let r of await this.#t.promises.readdir(s,{withFileTypes:!0}))this.#W(r,t);this.#$(t)}catch(r){this.#I(r.code),t.provisional=0}this.#Y=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let s=this.fullpath();try{for(let i of this.#t.readdirSync(s,{withFileTypes:!0}))this.#W(i,t);this.#$(t)}catch(i){this.#I(i.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#e&Bl)return!1;let t=_t&this.#e;return t===kt||t===Yt||t===Te}shouldWalk(t,s){return(this.#e&Yt)===Yt&&!(this.#e&Bl)&&!t.has(this)&&(!s||s(this))}async realpath(){if(this.#k)return this.#k;if(!((Ii|Li|Dt)&this.#e))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#k=this.resolve(t)}catch{this.#L()}}realpathSync(){if(this.#k)return this.#k;if(!((Ii|Li|Dt)&this.#e))try{let t=this.#t.realpathSync(this.fullpath());return this.#k=this.resolve(t)}catch{this.#L()}}[Ql](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let s=new Set([]),i=[],r=this;for(;r&&r.parent;)s.add(r),r.#S=i.join(this.sep),r.#_=i.join("/"),r=r.parent,i.push("..");for(r=t;r&&r.parent&&!s.has(r);)r.#S=void 0,r.#_=void 0,r=r.parent}},Ui=class e extends X{sep="\\";splitSep=qm;constructor(t,s=kt,i,r,o,n,a){super(t,s,i,r,o,n,a)}newChild(t,s=kt,i={}){return new e(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(t){return Ao.parse(t).root}getRoot(t){if(t=Ym(t.toUpperCase()),t===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(t,s))return this.roots[t]=i;return this.roots[t]=new Gi(t,this).root}sameRoot(t,s=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(ql,"$1\\"),t===s}},zi=class e extends X{splitSep="/";sep="/";constructor(t,s=kt,i,r,o,n,a){super(t,s,i,r,o,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,s=kt,i={}){return new e(t,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Bi=class{root;rootPath;roots;cwd;#t;#i;#n;nocase;#r;constructor(t=process.cwd(),s,i,{nocase:r,childrenCacheSize:o=16*1024,fs:n=Ls}={}){this.#r=Yl(n),(t instanceof URL||t.startsWith("file://"))&&(t=Fm(t));let a=s.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Wi,this.#i=new Wi,this.#n=new Co(o);let l=a.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let h=this.root,f=l.length-1,c=s.sep,u=this.rootPath,p=!1;for(let d of l){let m=f--;h=h.child(d,{relative:new Array(m).fill("..").join(c),relativePosix:new Array(m).fill("..").join("/"),fullpath:u+=(p?"":c)+d}),p=!0}this.cwd=h}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let s="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(s=s?`${n}/${s}`:n,this.isAbsolute(n)))break}let i=this.#t.get(s);if(i!==void 0)return i;let r=this.cwd.resolve(s).fullpath();return this.#t.set(s,r),r}resolvePosix(...t){let s="";for(let o=t.length-1;o>=0;o--){let n=t[o];if(!(!n||n===".")&&(s=s?`${n}/${s}`:n,this.isAbsolute(n)))break}let i=this.#i.get(s);if(i!==void 0)return i;let r=this.cwd.resolve(s).fullpathPosix();return this.#i.set(s,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,s={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i}=s;if(t.canReaddir()){let r=await t.readdir();return i?r:r.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,s={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0}=s;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t.withFileTypes,t=this.cwd);let i=await t.readlink();return s?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return s?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t.withFileTypes,t=this.cwd);let i=await t.realpath();return s?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:s}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return s?i:i?.fullpath()}async walk(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=[];(!o||o(t))&&a.push(i?t:t.fullpath());let l=new Set,h=(c,u)=>{l.add(c),c.readdirCB((p,d)=>{if(p)return u(p);let m=d.length;if(!m)return u();let y=()=>{--m===0&&u()};for(let g of d)(!o||o(g))&&a.push(i?g:g.fullpath()),r&&g.isSymbolicLink()?g.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(l,n)?h(b,y):y()):g.shouldWalk(l,n)?h(g,y):y()},!0)},f=t;return new Promise((c,u)=>{h(f,p=>{if(p)return u(p);c(a)})})}walkSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=[];(!o||o(t))&&a.push(i?t:t.fullpath());let l=new Set([t]);for(let h of l){let f=h.readdirSync();for(let c of f){(!o||o(c))&&a.push(i?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(r&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(l,n)&&l.add(u)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,s={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd),this.stream(t,s)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s;(!o||o(t))&&(yield i?t:t.fullpath());let a=new Set([t]);for(let l of a){let h=l.readdirSync();for(let f of h){(!o||o(f))&&(yield i?f:f.fullpath());let c=f;if(f.isSymbolicLink()){if(!(r&&(c=f.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(a,n)&&a.add(c)}}}stream(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=new Be({objectMode:!0});(!o||o(t))&&a.write(i?t:t.fullpath());let l=new Set,h=[t],f=0,c=()=>{let u=!1;for(;!u;){let p=h.shift();if(!p){f===0&&a.end();return}f++,l.add(p);let d=(y,g,b=!1)=>{if(y)return a.emit("error",y);if(r&&!b){let v=[];for(let w of g)w.isSymbolicLink()&&v.push(w.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(v.length){Promise.all(v).then(()=>d(null,g,!0));return}}for(let v of g)v&&(!o||o(v))&&(a.write(i?v:v.fullpath())||(u=!0));f--;for(let v of g){let w=v.realpathCached()||v;w.shouldWalk(l,n)&&h.push(w)}u&&!a.flowing?a.once("drain",c):m||c()},m=!0;p.readdirCB(d,!0),m=!1}};return c(),a}streamSync(t=this.cwd,s={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof X||(s=t,t=this.cwd);let{withFileTypes:i=!0,follow:r=!1,filter:o,walkFilter:n}=s,a=new Be({objectMode:!0}),l=new Set;(!o||o(t))&&a.write(i?t:t.fullpath());let h=[t],f=0,c=()=>{let u=!1;for(;!u;){let p=h.shift();if(!p){f===0&&a.end();return}f++,l.add(p);let d=p.readdirSync();for(let m of d)(!o||o(m))&&(a.write(i?m:m.fullpath())||(u=!0));f--;for(let m of d){let y=m;if(m.isSymbolicLink()){if(!(r&&(y=m.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,n)&&h.push(y)}}u&&!a.flowing&&a.once("drain",c)};return c(),a}chdir(t=this.cwd){let s=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[Ql](s)}},Gi=class extends Bi{sep="\\";constructor(t=process.cwd(),s={}){let{nocase:i=!0}=s;super(t,Ao,"\\",{...s,nocase:i}),this.nocase=i;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return Ao.parse(t).root.toUpperCase()}newRoot(t){return new Ui(this.rootPath,Yt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Hi=class extends Bi{sep="/";constructor(t=process.cwd(),s={}){let{nocase:i=!1}=s;super(t,Nm,"/",{...s,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new zi(this.rootPath,Yt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},Po=class extends Hi{constructor(t=process.cwd(),s={}){let{nocase:i=!0}=s;super(t,{...s,nocase:i})}},OE=process.platform==="win32"?Ui:zi,th=process.platform==="win32"?Gi:process.platform==="darwin"?Po:Hi;var ue=(e,t)=>typeof e>"u"||typeof e===t,eh=e=>!!e&&typeof e=="object"&&ue(e.preserveRoot,"boolean")&&ue(e.tmp,"string")&&ue(e.maxRetries,"number")&&ue(e.retryDelay,"number")&&ue(e.backoff,"number")&&ue(e.maxBackoff,"number")&&(ue(e.glob,"boolean")||e.glob&&typeof e.glob=="object")&&ue(e.filter,"function"),sh=e=>{if(!eh(e))throw new Error("invalid rimraf options")},ih=e=>{sh(e);let{glob:t,...s}=e;if(!t)return s;let i=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...s,glob:{...i,absolute:!0,withFileTypes:!1}}},rh=(e={})=>ih(e),oh=(e={})=>ih(e);import{parse as nh,resolve as Jm}from"path";import{inspect as Km}from"util";var Xm=(e,t={})=>{let s=typeof e;if(s!=="string"){let r=e&&s==="object"&&e.constructor,n=`The "path" argument must be of type string. Received ${r&&r.name?`an instance of ${r.name}`:s==="object"?Km(e):`type ${s} ${e}`}`;throw Object.assign(new TypeError(n),{path:e,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(e)){let r="path must be a string without null bytes";throw Object.assign(new TypeError(r),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=Jm(e);let{root:i}=nh(e);if(e===i&&t.preserveRoot!==!1){let r="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(r),{path:e,code:"ERR_PRESERVE_ROOT"})}if(process.platform==="win32"){let r=/[*|"<>?:]/,{root:o}=nh(e);if(r.test(e.substring(o.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e},Ws=Xm;import{readdirSync as Zm}from"fs";import ee from"fs/promises";import{chmodSync as lh,mkdirSync as DE,renameSync as hh,rmdirSync as Ge,rmSync as ch,statSync as fh,lstatSync as He,unlinkSync as Ye}from"fs";var ah=e=>Zm(e,{withFileTypes:!0}),ct={chmod:ee.chmod,mkdir:ee.mkdir,readdir:e=>ee.readdir(e,{withFileTypes:!0}),rename:ee.rename,rm:ee.rm,rmdir:ee.rmdir,stat:ee.stat,lstat:ee.lstat,unlink:ee.unlink};import{parse as ph,resolve as dh}from"path";var{readdir:Qm}=ct,qe=e=>Qm(e).catch(t=>t),Ve=e=>{try{return ah(e)}catch(t){return t}};var uh=e=>!!e&&typeof e=="object",jo=(e,t)=>t in e&&typeof e[t]=="string",No=e=>uh(e)&&jo(e,"code")&&jo(e,"path"),j=e=>uh(e)&&jo(e,"code")?e.code:null;var at=async(e,t)=>e.catch(s=>{if(j(s)!=="ENOENT")throw t??s}),lt=(e,t)=>{try{return e()}catch(s){if(j(s)==="ENOENT")return;throw t??s}};var{lstat:tg,rmdir:eg,unlink:sg}=ct,Yi=async(e,t)=>(t?.signal?.throwIfAborted(),await at(tg(e).then(s=>mh(e,t,s)))??!0),qi=(e,t)=>(t?.signal?.throwIfAborted(),lt(()=>gh(e,t,He(e)))??!0),mh=async(e,t,s)=>{t?.signal?.throwIfAborted();let i=s.isDirectory()?await qe(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!await t.filter(e,s)?!1:(await at(sg(e)),!0)}return!(await Promise.all(i.map(o=>mh(dh(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===ph(e).root||t.filter&&!await t.filter(e,s)?!1:(await at(eg(e)),!0)},gh=(e,t,s)=>{t?.signal?.throwIfAborted();let i=s.isDirectory()?Ve(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!t.filter(e,s)?!1:(lt(()=>Ye(e)),!0)}let r=!0;for(let o of i){let n=dh(e,o.name);r=gh(n,t,o)&&r}return t.preserveRoot===!1&&e===ph(e).root||!r||t.filter&&!t.filter(e,s)?!1:(lt(()=>Ge(e)),!0)};import{parse as Oh,resolve as _h}from"path";var{chmod:ig}=ct,Us=e=>async t=>{try{return void await at(e(t))}catch(s){if(j(s)==="EPERM")return await at(ig(t,438).then(()=>!0),s)?void await e(t):void 0;throw s}},zs=e=>t=>{try{return void lt(()=>e(t))}catch(s){if(j(s)==="EPERM")return lt(()=>(lh(t,438),!0),s)?void e(t):void 0;throw s}};import{setTimeout as rg}from"timers/promises";var og=200,ng=1.2,yh=10,wh=new Set(["EMFILE","ENFILE","EBUSY"]),Fo=e=>{let t=async(s,i,r=1,o=0)=>{let n=i.maxBackoff||og,a=i.backoff||ng,l=i.maxRetries||yh,h=0;for(;;)try{return await e(s)}catch(f){if(No(f)&&f.path===s&&wh.has(f.code)){if(r=Math.ceil(r*a),o=r+o,o<n)return await rg(r),t(s,i,r,o);if(h<l){h++;continue}}throw f}};return t},Do=e=>(s,i)=>{let r=i.maxRetries||yh,o=0;for(;;)try{return e(s)}catch(n){if(No(n)&&n.path===s&&wh.has(n.code)&&o<r){o++;continue}throw n}};import{basename as dg,parse as Ki,resolve as Xi}from"path";import{tmpdir as Ji}from"os";import{parse as Vi,resolve as bh}from"path";var{stat:ag}=ct,lg=e=>{try{return fh(e).isDirectory()}catch{return!1}},hg=e=>ag(e).then(t=>t.isDirectory(),()=>!1),cg=async e=>{let{root:t}=Vi(e),s=Ji(),{root:i}=Vi(s);if(t.toLowerCase()===i.toLowerCase())return s;let r=bh(t,"/temp");return await hg(r)?r:t},fg=e=>{let{root:t}=Vi(e),s=Ji(),{root:i}=Vi(s);if(t.toLowerCase()===i.toLowerCase())return s;let r=bh(t,"/temp");return lg(r)?r:t},ug=async()=>Ji(),pg=()=>Ji(),Sh=process.platform==="win32"?cg:ug,vh=process.platform==="win32"?fg:pg;var{lstat:mg,rename:gg,unlink:yg,rmdir:wg}=ct,Th=e=>`.${dg(e)}.${Math.random()}`,bg=Us(yg),Sg=zs(Ye),Zi=async(e,t)=>(t?.signal?.throwIfAborted(),await at(mg(e).then(s=>Mo(e,t,s)))??!0),Mo=async(e,t,s)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return Mo(e,{...t,tmp:await Sh(e)},s);if(e===t.tmp&&Ki(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let i=s.isDirectory()?await qe(e):null;if(!Array.isArray(i)){if(i){if(j(i)==="ENOENT")return!0;if(j(i)!=="ENOTDIR")throw i}return t.filter&&!await t.filter(e,s)?!1:(await at(Eh(e,t.tmp,bg)),!0)}return!(await Promise.all(i.map(o=>Mo(Xi(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===Ki(e).root||t.filter&&!await t.filter(e,s)?!1:(await at(Eh(e,t.tmp,wg)),!0)},Eh=async(e,t,s)=>{let i=Xi(t,Th(e));return await gg(e,i),await s(i)},Qi=(e,t)=>(t?.signal?.throwIfAborted(),lt(()=>Lo(e,t,He(e)))??!0),Lo=(e,t,s)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return Lo(e,{...t,tmp:vh(e)},s);let i=t.tmp;if(e===t.tmp&&Ki(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let r=s.isDirectory()?Ve(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!t.filter(e,s)?!1:(lt(()=>xh(e,i,Sg)),!0)}let o=!0;for(let n of r){let a=Xi(e,n.name);o=Lo(a,t,n)&&o}return!o||t.preserveRoot===!1&&e===Ki(e).root||t.filter&&!t.filter(e,s)?!1:(lt(()=>xh(e,i,Ge)),!0)},xh=(e,t,s)=>{let i=Xi(t,Th(e));return hh(e,i),s(i)};var{unlink:vg,rmdir:Eg,lstat:xg}=ct,Tg=Fo(Us(vg)),Og=Do(zs(Ye)),_g=Fo(Us(Eg)),kg=Do(zs(Ge)),Rg=async(e,{filter:t,...s})=>{s?.signal?.throwIfAborted();try{return await _g(e,s),!0}catch(i){if(j(i)==="ENOTEMPTY")return Zi(e,s);throw i}},Ag=(e,{filter:t,...s})=>{s?.signal?.throwIfAborted();try{return kg(e,s),!0}catch(i){if(j(i)==="ENOTEMPTY")return Qi(e,s);throw i}},pe=Symbol("start"),kh=Symbol("child"),tr=Symbol("finish"),er=async(e,t)=>(t?.signal?.throwIfAborted(),await at(xg(e).then(s=>$o(e,t,s,pe)))??!0),sr=(e,t)=>(t?.signal?.throwIfAborted(),lt(()=>Io(e,t,He(e),pe))??!0),$o=async(e,t,s,i=pe)=>{t?.signal?.throwIfAborted();let r=s.isDirectory()?await qe(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!await t.filter(e,s)?!1:(await at(Tg(e,t)),!0)}let o=i===pe?kh:i,n=(await Promise.all(r.map(a=>$o(_h(e,a.name),t,a,o)))).every(a=>a===!0);if(i===pe)return $o(e,t,s,tr);if(i===tr){if(t.preserveRoot===!1&&e===Oh(e).root||!n||t.filter&&!await t.filter(e,s))return!1;await at(Rg(e,t))}return!0},Io=(e,t,s,i=pe)=>{let r=s.isDirectory()?Ve(e):null;if(!Array.isArray(r)){if(r){if(j(r)==="ENOENT")return!0;if(j(r)!=="ENOTDIR")throw r}return t.filter&&!t.filter(e,s)?!1:(lt(()=>Og(e,t)),!0)}let o=!0;for(let n of r){let a=i===pe?kh:i,l=_h(e,n.name);o=Io(l,t,n,a)&&o}if(i===pe)return Io(e,t,s,tr);if(i===tr){if(t.preserveRoot===!1&&e===Oh(e).root||!o||t.filter&&!t.filter(e,s))return!1;lt(()=>Ag(e,t))}return!0};var Wo=process.platform==="win32"?er:Yi,Uo=process.platform==="win32"?sr:qi;var{rm:Cg}=ct,zo=async(e,t)=>(await Cg(e,{...t,force:!0,recursive:!0}),!0),Bo=(e,t)=>(ch(e,{...t,force:!0,recursive:!0}),!0);var[Rh=0,Pg=0]=process.version.replace(/^v/,"").split(".").map(e=>parseInt(e,10)),Ah=Rh>14||Rh===14&&Pg>=14,Ch=!Ah||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter,Ph=!Ah||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter;var Je=e=>async(t,s)=>{let i=rh(s);return i.glob&&(t=await ve(t,i.glob)),Array.isArray(t)?!!(await Promise.all(t.map(r=>e(Ws(r,i),i)))).reduce((r,o)=>r&&o,!0):!!await e(Ws(t,i),i)},Ke=e=>(t,s)=>{let i=oh(s);return i.glob&&(t=he(t,i.glob)),Array.isArray(t)?!!t.map(r=>e(Ws(r,i),i)).reduce((r,o)=>r&&o,!0):!!e(Ws(t,i),i)},Nh=Ke(Bo),jg=Object.assign(Je(zo),{sync:Nh}),Fh=Ke(Uo),Ng=Object.assign(Je(Wo),{sync:Fh}),Dh=Ke(sr),Fg=Object.assign(Je(er),{sync:Dh}),Mh=Ke(qi),Dg=Object.assign(Je(Yi),{sync:Mh}),Lh=Ke(Qi),Mg=Object.assign(Je(Zi),{sync:Lh}),ft=Ke((e,t)=>Ph(t)?Bo(e,t):Uo(e,t));var jh=Je((e,t)=>Ch(t)?zo(e,t):Wo(e,t)),Rt=Object.assign(jh,{rimraf:jh,sync:ft,rimrafSync:ft,manual:Ng,manualSync:Fh,native:jg,nativeSync:Nh,posix:Dg,posixSync:Mh,windows:Fg,windowsSync:Dh,moveRemove:Mg,moveRemoveSync:Lh});Rt.rimraf=Rt;var Bs=e=>{try{return Zt(e)}catch{return Bs(Gs(e)),ft(e),Zt(e)}};var Bg=(e,t)=>{if(!(e.isSymbolicLink()||e.isDirectory()||e.isFile())){t.isENOENT()||ft(t.fullpath());return}if(e.isSymbolicLink()){let i=Uh(e.fullpath());if(!t.isENOENT()){if((t.isSymbolicLink()&&Uh(t.fullpath()))===i)return;ft(t.fullpath())}if(Bs(Gs(t.fullpath())),Wg(i,t.fullpath()),Lg.O_SYMLINK&&e.mode)try{Ih(t.fullpath(),e.mode)}catch{}return}if(e.isDirectory())t.isDirectory()||Bs(t.fullpath());else{let i=!0;if(!t.isENOENT()&&!t.isFile()?ft(t.fullpath()):Gg(e,t)&&(i=!1),i){Bs(Gs(t.fullpath()));try{Ig(e.fullpath(),t.fullpath())}catch{$g(e.fullpath(),t.fullpath())}}}let s=e.mode;s&&Ih(t.fullpath(),s)};var Gg=(e,t)=>{try{return $h("sha512").update(Wh(e.fullpath())).digest("hex")===$h("sha512").update(Wh(t.fullpath())).digest("hex")}catch{return!1}},Bh=`..${zg}`,Hg=(e,t)=>{if(e===t)return!0;let s=zh(e,t),i=zh(e,t);return!s.startsWith(Bh)||!i.startsWith(Bh)};var Gh=(e,t)=>{let s=new th(e),i=ir(e),r=ir(t);if(Gs(i)===i||Gs(r)===r)throw new Error("cannot sync root directory");if(Hg(r,i))throw new Error("cannot copy directory into itself or its parent");let[o,n]=[he("**",{scurry:s,withFileTypes:!0}),he("**",{cwd:r,withFileTypes:!0})];for(let a of o){if(!a.parent)throw new Error("cannot sync root directory");let l=a.resolve(ir(r,a.relative())),h=l.parent;if(!h)throw new Error("cannot sync root directory");l.lstatSync(),Bs(h.fullpath()),Bg(a,l)}for(let a of n){let l=s.cwd.resolve(ir(i,a.relative()));if(l.lstatSync(),l.isENOENT())try{ft(a.fullpath()),Ug(a.fullpath())}catch{}}};import{chmodSync as Hh}from"fs";import{resolve as Yh}from"path";var qh=()=>{let{bin:e}=_;if(e)if(typeof e=="string")Hh(Yh(e),493);else for(let t of Object.values(e))Hh(Yh(t),493)};import{spawnSync as ab}from"node:child_process";import{relative as Bc,resolve as as}from"node:path/posix";import{writeFileSync as Yg}from"fs";var Vh=e=>{let{imports:t}=e;if(t)return Object.fromEntries(Object.entries(t).map(([s,i])=>[s,typeof i=="string"&&i.startsWith("./src/")?"./"+i.substring(6).replace(/\.([cm]?)ts$/,".$1js").replace(/\.tsx$/,".js"):i]))};var qg=(e,t)=>{if(!t)return ft(`${e}/package.json`);let s={type:t==="commonjs"?"commonjs":"module",imports:Vh(_)};Yg(`${e}/package.json`,JSON.stringify(s,null,2)+`
|
|
15
|
+
`)},Z=(e,t)=>{t&&T(E.cyan.dim("set dialect"),{where:e,mode:t}),qg(e,t)};import{existsSync as Oy,readdirSync as _y,unlinkSync as ky,writeFileSync as Ry}from"node:fs";import{resolve as Ay}from"node:path";import{join as uc}from"node:path/posix";var{esmDialects:Vg=[],commonjsDialects:Jg=[]}=k,Hs=class{type;name;map=new Map;constructor(t,s){this.type=t,this.name=s}addFile(t,s){let i=this.type==="commonjs"?"cts":"mts",r=`-${this.name}.${i}`;if(!t.endsWith(r))return;let o=t.substring(0,t.length-r.length)+".ts",n=o+"x";s.has(o)?this.map.set(t,o):s.has(n)&&this.map.set(t,n)}[Symbol.for("nodejs.util.inspect.custom")](){return[this.name,this.map]}},de=new Map([["cjs",new Hs("commonjs","cjs")]]);for(let e of Jg)de.set(e,new Hs("commonjs",e));for(let e of Vg)de.set(e,new Hs("esm",e));for(let e of Vt)for(let t of de.values())t.addFile(e,Vt);for(let[e,t]of de.entries())t.map.size===0&&de.delete(e);de.size&&T(E.cyan.dim("polyfills detected"),de);var H=de;import{dirname as Sy,isAbsolute as vy,resolve as fr}from"node:path";import{readFileSync as Ey,statSync as xy}from"node:fs";import{dirname as Kg,resolve as Xg}from"path";var se=function*(e){for(e=Xg(e);e;){yield e;let t=Kg(e);if(t===e)break;e=t}};var Jh=e=>"source"in e?e.source:e.children.map(Jh).join(""),Xe=Jh;var Go={offset:0,offsetMax:1/0,init:(e=1/0)=>{Go.offset=0,Go.offsetMax=e}},At=Go;function or(e){var t={},s;for(s in e)t[s]=e[s];return t}function Oe(e){return" var y"+(e+("=state.y,x"+(e+"=state.x;")))}function Ho(e){return"state.y=y"+(e+(";state.x=x"+(e+";")))}function Ys(e,t,s){if(e.expression){t=!!s.capture&&!e.capture;var i=s.length&&s.abort&&"node.length=ln"+(s.length+";")||"";e=" if((x = "+(e.expression.id+"(state)) "+(t?"!=":"==")+" null)"+((t?"{node.push(x);}else ":"")+("{"+(Ho(s.index)+(i+(s.abort+"}"))))))}else i=!!s.capture&&!e.capture,s=or(s),s.capture=i,!s.length&&i?(s.length=t,e="var ln"+(t+"=node.length;")+(Yo(e.sequence,t+1,s)+"")):e=Yo(e.sequence,t+1,s);return e}function Xh(e,t,s){var i=s.index,r=s.abort,o="inv_"+t,n="group_"+t;return s=or(s),e.capture==="!"&&(s.index=t,s.abort="break "+(o+"")),e.quantifier==="+"?(n=or(e),n.quantifier="*",s=Ys(e,t,s)+(Xh(n,t,s)+"")):e.quantifier==="*"?(s.length=0,s.index=t,s.abort="break "+(n+";"),s=n+(":for(;;){"+(Oe(t)+(Ys(e,t,s)+"}")))):e.quantifier==="?"&&e.expression?(s.index=t,s.abort="",s=Oe(t)+(Ys(e,t,s)+"")):e.quantifier==="?"?(s.index=t,s.abort="break "+(n+""),s=n+(":{"+(Oe(t)+(Ys(e,t,s)+"}")))):s=Ys(e,t,s),e.capture==="!"?o+(":{"+(Oe(t)+(s+(Ho(i)+(r+"}"))))):e.capture==="="?Oe(t)+(s+(Ho(t)+"")):s}function Yo(e,t,s){for(var i=e.alternation?"alt_"+t:"",r="";e;e=e.alternation){var o="block_"+t,n=s;e.alternation&&(n=or(s),n.index=t,n.abort="break "+(o+";"));for(var a="",l=0;l<e.length;l++)a+=Xh(e[l],t,n);r=e.alternation?r+(o+(":{"+(Oe(t)+(a+(" break "+(i+";}")))))):r+a}return i?i+(":{"+(r+"}")):r}function rr(e){throw new SyntaxError('Unexpected token "'+e+'"')}var Kh=typeof/./g.sticky=="boolean";function Zg(e){return e.length?e:function(t){return e()(t)}}function Qg(e){return function(t){if(t.x<t.quasis.length){for(var s=t.quasis[t.x],i=0,r=e.length;i<r;i++)if(s.charCodeAt(t.y+i)!==e.charCodeAt(i))return null;return t.y+=e.length,e}}}function ty(e){return e=Kh?new RegExp(e.source,"y"):new RegExp(e.source+"|()","g"),function(t){if(t.x<t.quasis.length){var s=t.quasis[t.x];e.lastIndex=t.y;var i;return Kh?e.test(s)&&(i=s.slice(t.y,e.lastIndex)):(s=e.exec(s),s[1]==null&&(i=s[0])),t.y=e.lastIndex,i}}}function ey(e){return typeof e=="function"?Zg(e):typeof e=="string"?Qg(e):ty(e)}function sy(e,t){return{id:"_"+t}}function iy(e,t){return"_"+t}function Zh(e,t){return function(s){for(var i=[],r=arguments.length-1;0<r--;)i[r]=arguments[r+1];var o=i.map(sy),n=[];r=[];for(var a=null,l,h=r,f,c,u=0;u<s.length+o.length;u++){u%2!==0&&(c=o[u++>>1],h.push({expression:c,capture:f}),f=void 0);var p=s[u>>1];for(c=0;c<p.length;){var d=p[c++];d!==" "&&d!==" "&&d!=="\r"&&d!==`
|
|
16
|
+
`&&(d==="|"&&h.length?h=h.alternation=[]:d===")"&&h.length?(a=null,(h=n.pop())||rr(d)):d==="("?(n.push(h),h.push(a={sequence:[],capture:f}),h=a.sequence,f=void 0):d===":"||d==="="||d==="!"?(f=d,p[c]&&p[c]!=="("&&rr(d)):d==="?"&&!h.length&&a?(f=p[c++],f===":"||f==="="||f==="!"?(a.capture=f,f=void 0):rr(d)):d!=="?"&&d!=="+"&&d!=="*"||!(l=h[h.length-1])?rr(d):l.quantifier=d)}}return l=[e,t].concat(i.map(ey)),f=Function,i="_n,_t,"+i.map(iy).join(","),o=t?"_t":null,r="(function(state){"+(Oe(1)+(" var node=[];var x;"+(Yo(r,2,{index:1,length:0,abort:"return;",capture:!0})+(" if(_n)node.tag=_n;return "+((o?"("+(o+")(node)"):"node")+";})"))))),new f(i,"return "+r).apply(void 0,l)}}function nr(e){return function(t){for(var s=[],i=arguments.length-1;0<i--;)s[i]=arguments[i+1];return typeof t=="string"&&(t=[t]),e({quasis:t,expressions:s,x:0,y:0})}}var Ze={tokenDelimiterTypes:new Set(["ArrayOpen","ArrayClose","ObjectOpen","ObjectClose"]),tokenIgnoredTypes:new Set(["Newline","Whitespace","CommentLine","CommentBlock","Comma","CommaTrailing","Colon"]),tokenLiteralTypes:new Set(["Null","True","False","Number","String","Array","Object"]),isEven:e=>!(e%2),isOdd:e=>!Ze.isEven(e),isString:e=>typeof e=="string",isToken:e=>!Ze.isString(e),isTokenDelimiter:e=>Ze.tokenDelimiterTypes.has(e.type),isTokenIgnored:e=>Ze.tokenIgnoredTypes.has(e.type),isTokenLiteral:e=>Ze.tokenLiteralTypes.has(e.type),tokens2matchers:e=>{let t=new Map;return Object.keys(e).reduce((s,i)=>{let r=e[i],o=r.unwrapped?r:t.get(r)||Zh(i,r);return t.set(r,o),s[i]=o,s},{})}},Y=Ze;var ry=e=>{let t=Y.tokens2matchers(e),s=t.EarlyReturn`${""}`,i=t.Insufficient`${/[^]?/}`,r=t.Invalid`${/[^]/}`,o=t.Newline`${/\r?\n|\r/}`,n=t.Whitespace`${/[ \t]+/}`,a=t.CommentLine`${/\/\/.*/}`,l=t.CommentBlock`${/\/\*[^]*?\*\//}`,h=t.Passthrough`${o} | ${n} | ${a} | ${l}`,f=t.Passthrough`${h}*`,c=t.Whitespace`${/(?:[ \t\r\n]|\/\/.*|\/\*[^]*?\*\/)*/}`,u=t.Newline===t.Whitespace&&t.Whitespace===t.CommentLine&&t.CommentLine===t.CommentBlock?c:f,p=t.Comma`${","}`,d=t.CommaTrailing`${","}`,m=t.Colon`${":"}`,y=t.Null`${"null"}`,g=t.True`${"true"}`,b=t.False`${"false"}`,v=t.Passthrough`${g} | ${b}`,w=t.Number`${/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?/}`,S=t.String`${/"(?:[^\u0000-\u001F\\"]|\\["bfnrt\\/]|\\u[0-9a-fA-F]{4})*"/}`,R=t.ArrayOpen`${"["}`,M=t.ArrayClose`${"]"}`,q=t.Passthrough`${u} ${()=>Mr} ${u}`,et=t.Passthrough`${q} (!${s} ${p} ${q})* ${d}?`,qt=t.Array`${R} ${u} ${et}? ${u} (${s} | ${M})`,Rf=t.ObjectOpen`${"{"}`,Af=t.ObjectClose`${"}"}`,Nn=t.Passthrough`${u} ${S} (${s} | ${u} ${m} ${u} ${()=>Mr} ${u})`,Cf=t.Passthrough`${Nn} (!${s} ${p} ${Nn})* ${d}?`,Pf=t.Object`${Rf} ${u} ${Cf}? ${u} (${s} | ${Af})`,Mr=t.Passthrough`${y} | ${v} | ${w} | ${S} | ${Pf} | ${qt}`;return t.Root`${u} (${Mr} | ${i}) (${s} | ${u} ${r}?)`},ar=ry;var Q=e=>t=>{let s=t[0];return At.offset+=s.length,{type:e,source:s}},qo=e=>t=>{let s=t.flat();return{type:e,children:s}},Qh={EarlyReturn:()=>{if(At.offset>At.offsetMax)return[]},Insufficient:e=>{throw e[0].length&&Qh.Invalid(e),new SyntaxError("Unexpected end of JSONC input")},Invalid:e=>{throw new SyntaxError(`Unexpected token ${e[0]} in JSONC at position ${At.offset}`)},Passthrough:e=>e.flat().filter(Y.isToken),Newline:Q("Newline"),Whitespace:Q("Whitespace"),CommentLine:Q("CommentLine"),CommentBlock:Q("CommentBlock"),Comma:Q("Comma"),CommaTrailing:Q("CommaTrailing"),Colon:Q("Colon"),Null:Q("Null"),True:Q("True"),False:Q("False"),Number:Q("Number"),String:Q("String"),ArrayOpen:Q("ArrayOpen"),ArrayClose:Q("ArrayClose"),Array:qo("Array"),ObjectOpen:Q("ObjectOpen"),ObjectClose:Q("ObjectClose"),Object:qo("Object"),Root:qo("Root")},lr=Qh;var qs=e=>(At.offset+=e[0].length,""),hr=e=>{let t=e.join("");return At.offset+=t.length,t},Ct=(e,t)=>t;Ct.unwrapped=!0;var oy={...lr,Passthrough:hr,Newline:qs,Whitespace:qs,CommentLine:qs,CommentBlock:qs,Comma:Ct,CommaTrailing:qs,Colon:Ct,Null:Ct,True:Ct,False:Ct,Number:Ct,String:Ct,ArrayOpen:Ct,ArrayClose:Ct,Array:hr,ObjectOpen:Ct,ObjectClose:Ct,Object:hr,Root:hr},tc=oy;var ny=nr(ar(tc)),ec=ny;var ay=e=>(At.init(),ec(e)),Vs=ay;var Vo=JSON.parse,ly=(e,t)=>{if(e=`${e}`,t)return Vo(Vs(e),t);try{return Vo(e)}catch(s){let i=Vs(e);if(e===i)throw s;return Vo(i)}},me=ly;var hy=nr(ar(lr)),sc=hy;var cy=(e,t)=>(At.init(t),sc(e)),cr=cy;var fy=(e,t)=>{let s=null,i=0,r=l=>{l.start>t||l.end<=t-1||s&&Y.isTokenLiteral(s)||s&&Y.isTokenIgnored(l)||(s=l)},o=(l,h,f,c)=>{let{type:u,source:p}=l,d=i,m=i+=p.length,y={type:u,source:p,token:l,parent:h,depth:f,index:c,start:d,end:m};return r(y),y},n=(l,h,f,c)=>{let{type:u}=l,p={type:u,children:[],token:l,parent:h,depth:f,index:c};return p.children=l.children.map((d,m)=>a(d,p,f+1,m)).filter(Y.isTokenLiteral),p.children.forEach((d,m)=>d.index=m),p},a=(l,h,f,c)=>"children"in l?n(l,h,f,c):o(l,h,f,c);return a(e,null,-1,-1),s},uy=e=>{if(!e)return[];let t=[];for(;e;){let s=e.parent;if(!s)break;Y.isTokenLiteral(e)&&(s.type==="Object"?Y.isEven(e.index)?t.unshift(JSON.parse(e.source)):t.unshift(JSON.parse(s.children[e.index-1].source)):s.type==="Array"&&t.unshift(e.index)),e=s}return t},py=e=>{if(!e)return!1;let t=e.parent?.type;return t==="Object"?Y.isTokenLiteral(e)?Y.isEven(e.index):e.parent?.parent?.type==="Array":t==="Array"?Y.isTokenLiteral(e)||e.parent?.parent?.type==="Array":!1},dy=e=>{if(!e)return!1;let t=!e.parent?.children.length,s=e.parent?.type;return s==="Object"?t||Y.isTokenDelimiter(e)||Y.isTokenLiteral(e)&&Y.isOdd(e.index):s==="Array"?e.depth>1:!1},my=(e,t)=>{if(!t||!e)return;let s=e.parent?.type;if(Y.isTokenLiteral(e))return s==="Array"?e.index:me(Xe(e));if(s==="Array")return e.parent?.index},gy=(e,t,s)=>{if(!t||!e)return;if(Y.isTokenLiteral(e))return me(Xe(e));if(s)return;let{parent:i}=e;if(!(!i||!i.token)&&!(i.type!=="Array"&&i.type!=="Object"))return me(Xe(i.token))},yy=(e,t,s=!0)=>{let r=cr(e,s?t:1/0),o=fy(r,t),n=uy(o),a=py(o),l=dy(o),h=my(o,a),f=gy(o,l,s),c=o?{type:o.type,start:o.start,end:o.end,source:o.source}:void 0;return{path:n,property:h,value:f,token:c,isInsideProperty:a,isInsideValue:l}},ic=yy;var rc=JSON.stringify;var wy=e=>{try{return me(e),!0}catch{return!1}},oc=wy;var by={ast:{parse:cr,stringify:Xe},lookup:ic,parse:me,stringify:rc,strip:Vs,validate:oc},nc=by;var Qe=e=>{try{return xy(e).isFile()}catch{return!1}},Ty,ts=()=>{let e=k.project??"tsconfig.json";return Ty??=lc(Jo(e))},Jo=(e,t=process.cwd())=>{if(vy(e))return e;let s=fr(t,e);if(!Qe(s)&&Qe(s+".json")&&(s+=".json"),Qe(s)||e.startsWith(".\\")||e.startsWith("./"))return s;for(let i of se(t)){let r=fr(i,"node_modules",e);if(Qe(r))return r;let o=fr(i,"node_modules",e),n=fr(o,"tsconfig.json");if(Qe(n))return n;if(Qe(o+".json"))return o+".json"}throw new Error("Could not resolve tsconfig file location",{cause:{target:e,from:t}})},ac=(e,t)=>{for(let[s,i]of Object.entries(t))typeof i!="object"||Array.isArray(i)?e[s]??=i:s in e?typeof e[s]=="object"&&!Array.isArray(e[s])&&(e[s]=ac(e[s],i)):e[s]=i;return e},lc=(e,t=new Set)=>{try{let s=nc.parse(Ey(Jo(e),"utf8"));if(!s||typeof s!="object"||Array.isArray(s))throw new Error("invalid data, expected object",{cause:s});if(s.compilerOptions||(s.compilerOptions={}),typeof s.extends=="string"){let i=Jo(s.extends,Sy(e));t.has(i)||(t.add(i),ac(s,lc(i,t)))}return s}catch(s){throw new Error("Invalid tsconfig file",{cause:s})}};var hc=()=>{ts().compilerOptions.verbatimModuleSyntax&&(O("verbatimModuleSyntax detected"),$(`verbatimModuleSyntax is incompatible with multi-dialect builds. Either remove
|
|
17
17
|
this field from tsconfig.json, or set a single dialect in the "dialects"
|
|
18
18
|
field in package.json, for example:
|
|
19
19
|
|
|
@@ -30,8 +30,8 @@ or
|
|
|
30
30
|
"dialects": ["commonjs"]
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`),
|
|
34
|
-
`);T(E.cyan.dim("writing tsconfig files..."));A.project===void 0&&!ty("tsconfig.json")?(T("using recommended tsconfig.json"),Je("../tsconfig",ly)):(Lo.length>1&&Wh(),T("using existing tsconfig.json"));for(let e of ey(".tshy"))sy(ry(".tshy",e));Je("build",hy());if(Lo.includes("commonjs")){Je("commonjs",zh("cjs"));for(let e of ny)Je(e,zh(e))}if(Lo.includes("esm")){Je("esm",Uh("esm"));for(let e of oy)Je(e,Uh(e))}import{writeFileSync as Ly}from"fs";import{symlink as Iy}from"fs/promises";import{dirname as Go,relative as rc,resolve as Ho,sep as Bo}from"path";var sr=e=>{if(e&&typeof e=="object"&&!Array.isArray(e)){let t,s=[];for(let[i,r]of Object.entries(e))if(i){if(t===void 0){if(!i.startsWith("#")&&i!=="."&&!i.startsWith("./"))return Ws(e).map(o=>[".",...o]);t=i.charAt(0)}if(t==="#"&&(i==="#"||!i.startsWith("#"))||t==="."&&i!=="."&&!i.startsWith("./"))throw new Error(`invalid ${t==="."?"exports":"imports"} object, all keys must start with ${t}. Found ${i}.`);s.push(...Ws(r).map(o=>[i,...o]))}return s}return Ws(e).map(t=>[".",...t])},cy=(e,t)=>{if(e.size>t.size)return!1;for(let s of e)if(!t.has(s))return!1;return!0},Ws=(e,t=[],s=[])=>{if(e===void 0)return s;if(e===null||typeof e=="string")return s.push([new Set(t),e]),s;if(Array.isArray(e)){for(let i of e)if(Ws(i,t,s),!i||typeof i=="string")break;return s}for(let[i,r]of Object.entries(e)){if(i.startsWith("#")||i==="."||i.startsWith("./"))throw new Error(`Expected valid import condition, got: ${i}`);let o=i==="default"?t:t.concat(i),n=new Set(o);if(s.some(([l])=>cy(l,n))||Ws(r,o,s),i==="default")break}return s};var Hh=e=>[...new Set(sr(e).map(([t,s,i])=>i).filter(t=>!!t))];var Yh=e=>{let t=sr(e),s=[];for(let[i,r]of t)s.some(o=>fy(o,r))||s.push([...r]);return s},fy=(e,t)=>{if(e.length!==t.size)return!1;for(let s of e)if(!t.has(s))return!1;return!0};var qh=typeof process=="object"&&process&&process.platform==="win32";var Vh=e=>/^\.\.?\//.test(e)||qh&&/^\.\.?\\/.test(e);import{dirname as jy,resolve as Py}from"path";import{pathToFileURL as ic}from"url";import{realpath as Hs}from"fs/promises";import nr from"module";import{basename as _y,dirname as Oy,isAbsolute as Ay,resolve as tc}from"path";import{fileURLToPath as ky,pathToFileURL as Wo}from"url";import{stat as uy}from"fs/promises";var et=async e=>uy(e).then(t=>t.isFile(),()=>!1);import{resolve as Us}from"path";import{pathToFileURL as Ee}from"url";import{realpath as py,stat as dy}from"fs/promises";import{dirname as my,resolve as Jh,sep as Io}from"path";var gy=async e=>dy(e).then(t=>t.isDirectory(),()=>!1),ir=async(e,t)=>{for(let s of he(my(t))){let i=Jh(s,"node_modules")+Io,r=e===null?i:(e?Jh(i,e):i)+Io;if(await gy(r))try{return await py(r)+Io}catch{}}};import{readFile as yy}from"node:fs/promises";var Kh=async e=>yy(e,"utf8").then(t=>JSON.parse(t)).catch(()=>null);var wy=e=>!!e&&(typeof e=="object"||typeof e=="string"),by=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let t in e)if(!t.startsWith("#"))return!1;return!0},Sy=e=>!!e&&typeof e=="object"&&(typeof e.name=="string"||typeof e.name>"u")&&(typeof e.main=="string"||typeof e.main>"u")&&(typeof e.module=="string"||typeof e.module>"u")&&(typeof e.exports>"u"||wy(e.exports))&&(typeof e.imports>"u"||by(e.imports)),fe=async e=>{let t=await Kh(e);return Sy(t)?t:null};var rr=(e,t)=>{let s=Object.keys(t).filter(i=>i.length<=e.length).sort((i,r)=>r.length-i.length).map(i=>[i,i.split("*")]).filter(([,i])=>i.length===2);for(let[i,[r,o]]of s)if(e.startsWith(r)&&e.endsWith(o)){let n=e.substring(r.length,e.length-o.length);return[i,n]}return null};var Rt=(e,t)=>{if(e===null||typeof e=="string")return e;if(Array.isArray(e)){for(let i of e){let r=Rt(i,t);if(r)return r}return null}let s=new Set(["default"]);for(let i of t.conditions??["import","node"])i.startsWith("!")?s.delete(i.slice(1)):s.add(i);for(let[i,r]of Object.entries(e))if(s.has(i))return Rt(r,t);return null};var Ke=(e,t,s,i,r)=>{let o=e?e==="."||e.startsWith("./")?e:`./${e}`:".";if(typeof t=="string"||Array.isArray(t)){let h=o==="."&&Rt(t,r);if(!h)throw zs(o,s,i);return h}if(o==="."){let h=Rt(t,r);if(h)return h}let n=t,a=n[o];if(a!==void 0){let h=Rt(a,r);if(!h)throw zs(o,s,i);return h}let l=rr(o,n);if(l){let[h,f]=l,c=Rt(n[h],r);if(!c)throw zs(o,s,i);return c.replace(/\*/g,f)}throw zs(o,s,i)};var Xe=async(e,t,s)=>{let{originalParent:i}=s,r=e?.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/),[,o,n]=e===null?[,null,""]:r||["","",""],a=await ir(o,t);if(!a)throw Bs(o,i);let l=Us(a,"index.js"),h=Us(a,"package.json"),f=await fe(h),c=n?Us(a,n):!1;if(!f)if(c){if(await et(c))return Ee(c);throw Bt(c,i)}else{if(await et(l))return Ee(l);throw Bs(a,i)}if(f.exports){let u=Ke(n,f.exports,h,i,s),p=Us(a,u);if(await et(p))return Ee(p);throw Bt(p,i)}else if(c){if(await et(c))return Ee(c);throw Bt(c,i)}else if(f.main){let u=Us(a,f.main);if(await et(u))return Ee(u);if(await et(l))return Ee(l);throw Bs(a,i)}else{if(await et(l))return Ee(l);throw Bs(a,i)}};import{dirname as vy,resolve as Xh}from"path";import{pathToFileURL as Ey}from"url";var Zh=async(e,t,s)=>{let{originalParent:i}=s,r=e.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/);if(!r)throw Qh(e);for(let o of he(vy(t))){let n=Xh(o,"package.json"),a=await fe(n);if(a){if(a.name&&a.exports){let[,l,h]=r;if(l===a.name){let f=Ke(h,a.exports,n,i,s),c=Xh(o,f);if(await et(c))return Ey(c);throw Bt(c,i)}}if(e.startsWith("#")){if(!a.imports)throw Gs(e,n,i);let l=a.imports[e];if(l!==void 0){let m=Rt(l,s);if(!m)throw Gs(e,n,i);return m.startsWith("#")?Xe(null,t,s):q(m,n,s)}let h=rr(e,a.imports);if(!h)throw Gs(e,n,i);let[f,c]=h,u=a.imports[f],p=Rt(u,s);if(!p)throw Gs(e,n,i);if(p.startsWith("#"))return Xe(null,t,s);let d=p.replace(/\*/g,c);return q(d,n,s)}break}}return Xe(e,t,s)};import{pathToFileURL as xy}from"url";var or=e=>typeof e=="object"?e:e.startsWith("file://")?new URL(e):xy(e);import{fileURLToPath as Ty}from"url";var ue=e=>typeof e=="object"||e.startsWith("file://")?Ty(e):e;typeof nr.isBuiltin!="function"&&(nr.isBuiltin=e=>(e.startsWith("node:")&&(e=e.substring(5)),nr.builtinModules.includes(e)));var Ry=async e=>(e=ue(e),tc(await Hs(Oy(e)),_y(e))),q=async(e,t=void 0,s={})=>{if(typeof e=="string"&&e.startsWith("file://")&&(e=new URL(e)),typeof e=="object"){if(!await et(e))throw Bt(String(e),String(t));let n=await Hs(ue(e));return n!==ky(e)?Wo(n):e}let i=t?or(await Ry(t)):void 0;if(Vh(e)){if(!i)throw ec(e,t);let n=new URL(e,i);if(!await et(n))throw Bt(e,String(t));return Wo(await Hs(new URL(e,i)))}if(Ay(e)){if(!await et(e))throw Bt(e,String(t));return Wo(await Hs(e))}if(nr.isBuiltin(String(e)))return String(e);let r=ue(t||tc(await Hs(process.cwd()),"x")),o={...s,originalParent:String(s.originalParent||r)};return e?Zh(e,r,o):Xe(e,r,o)};var Qh=(e,t=q)=>{let s=new Error("invalid import() specifier: "+e);return Error.captureStackTrace(s,t),s},ar=(e,t=q)=>{let s=new Error(`Not a valid package: ${e}`);return Error.captureStackTrace(s,t),s},ec=(e,t,s=q)=>{let i=Object.assign(new Error("relative import without parentURL"),{url:e,parentURL:t});return Error.captureStackTrace(i,s),i},zs=(e,t,s,i=q)=>{let r=e==="."?'No "exports" main defined':`Package subpath '${e}' is not defined by "exports"`,o=Object.assign(new Error(`${r} in ${t} imported from ${s}`),{code:"ERR_PACKAGE_PATH_NOT_EXPORTED"});return Error.captureStackTrace(o,i),o},Bs=(e,t,s=q)=>{let i=Object.assign(new Error(`Cannot find package '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},Bt=(e,t,s=q)=>{let i=Object.assign(new Error(`Cannot find module '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},Gs=(e,t,s,i=q)=>{let r=Object.assign(new Error(`Package import specifier "${e}" is not defined in package ${t} imported from ${s}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});return Error.captureStackTrace(r,i),r};var sc=e=>e?Cy(e)?Object.keys(e).filter(t=>t==="."||t.startsWith("./")):["."]:[],Cy=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let t in e)if(t!=="."&&!t.startsWith("./"))return!1;return!0};import{resolve as Ny}from"path";var lr=async(e,t)=>{let s=ws(e[0])+(e[0].endsWith("/")?"":"*/")+"**"+(e[1].startsWith("/")?"":"/*")+ws(e[1]);return(await ge(s,{posix:!0,absolute:!1,nodir:!0,cwd:t,dotRelative:!0})).map(r=>[r.substring(e[0].length,r.length-e[1].length),Ny(t,r)])};var zo=async(e,t={})=>{let s=ue(e),i=jy(s),r=await fe(s);if(!r)throw ar(e,zo);let o={},{exports:n}=r;for(let a of sc(n)){let l;try{l=Ke(a,n,s,s,t)}catch{}if(!l)continue;let h=l.split("*"),f=a.split("*");if(h.length===2&&f.length===2)for(let[c,u]of await lr(h,i))o[f[0]+c+f[1]]=ic(u);else o[a]=ic(Py(i,l))}return o};import{dirname as Fy,resolve as Dy}from"path";import{pathToFileURL as My}from"url";var Uo=async(e,t={})=>{let s=ue(e),i=Fy(s),r=or(e),o=await fe(s);if(!o)throw ar(e,Uo);let n={};for(let[a,l]of $y(o,t)){let h=l.match(/^(@[^\/]+\/[^\/]+|[^\/]+)/),f=o.name;if(!h)continue;let c=a.split("*"),u=l.split("*");if(!(c.length===2&&u.length===2)){try{n[a]=await q(l,r)}catch{}continue}let d=h[1]===".";if(d){for(let[w,S]of await lr(u,i))n[c[0]+w+c[1]]=My(S);continue}let m=h[1]===f,y=!d&&!m?h[1]:null,g=y?await ir(y,i):i;if(!g)continue;let b=Dy(g,"package.json");if(!await et(b))continue;let v=await zo(b);for(let[w,S]of Object.entries(v)){if(w==="."||w==="./")continue;let k=y+w.substring(1);if(k.startsWith(u[0])&&k.endsWith(u[1])){let M=c[0]+k.substring(u[0].length,k.length-u[1].length)+c[1];try{n[M]=await q(S,r)}catch{}}}}return n},$y=(e,t)=>{let s=[],{imports:i}=e;if(!i||typeof i!="object")return s;for(let[r,o]of Object.entries(i)){let n=Rt(o,t);n&&!n.startsWith("#")&&s.push([r,n])}return s};import{fileURLToPath as Wy}from"url";var oc=new Set,nc=e=>{let t=[...lc.entries()];if(!t.length)return!1;let s=new Set(t.map(([i])=>Go(i)));return T("save import linker",e),Ly(e,`import { mkdirSync } from 'node:fs'
|
|
33
|
+
`),Me(),process.exit(1))};var{dialects:Ko=["esm","commonjs"],esmDialects:Cy=[],commonjsDialects:Py=[],exclude:jy=[]}=k,pc=jy.map(e=>`../${e.replace(/^\.\//,"")}`),Ny={compilerOptions:{declaration:!0,declarationMap:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,inlineSources:!0,jsx:"react",module:"nodenext",moduleResolution:"nodenext",noUncheckedIndexedAccess:!0,resolveJsonModule:!0,skipLibCheck:!0,sourceMap:!0,strict:!0,target:"es2022"}},Fy=()=>({extends:k.project===void 0?"../tsconfig.json":uc("..",k.project),compilerOptions:{target:ts().compilerOptions.target===void 0?"es2022":void 0,rootDir:"../src",module:"nodenext",moduleResolution:"nodenext"}}),cc=e=>{let t=[...pc,"../src/**/*.mts","../src/package.json"];for(let[s,i]of H)if(s!==e)for(let r of i.map.keys())t.push(`../${uc(r)}`);return{extends:"./build.json",include:["../src/**/*.ts","../src/**/*.cts","../src/**/*.tsx","../src/**/*.json"],exclude:t,compilerOptions:{outDir:"../.tshy-build/"+(e==="cjs"?"commonjs":e)}}},fc=e=>{let t=[...pc,"../src/package.json"];for(let[s,i]of H)if(s!==e)for(let r of i.map.keys())t.push(`../${r.replace(/^\.\//,"")}`);return{extends:"./build.json",include:["../src/**/*.ts","../src/**/*.mts","../src/**/*.tsx","../src/**/*.json"],exclude:t,compilerOptions:{outDir:"../.tshy-build/"+e}}};Zt(".tshy");var es=(e,t)=>Ry(`.tshy/${e}.json`,JSON.stringify(t,null,2)+`
|
|
34
|
+
`);T(E.cyan.dim("writing tsconfig files..."));k.project===void 0&&!Oy("tsconfig.json")?(T("using recommended tsconfig.json"),es("../tsconfig",Ny)):(Ko.length>1&&hc(),T("using existing tsconfig.json"));for(let e of _y(".tshy"))ky(Ay(".tshy",e));es("build",Fy());if(Ko.includes("commonjs")){es("commonjs",cc("cjs"));for(let e of Py)es(e,cc(e))}if(Ko.includes("esm")){es("esm",fc("esm"));for(let e of Cy)es(e,fc(e))}import{writeFileSync as gw}from"fs";import{symlink as yw}from"fs/promises";import{dirname as cn,relative as xc,resolve as fn,sep as hn}from"path";var ur=e=>{if(e&&typeof e=="object"&&!Array.isArray(e)){let t,s=[];for(let[i,r]of Object.entries(e))if(i){if(t===void 0){if(!i.startsWith("#")&&i!=="."&&!i.startsWith("./"))return Js(e).map(o=>[".",...o]);t=i.charAt(0)}if(t==="#"&&(i==="#"||!i.startsWith("#"))||t==="."&&i!=="."&&!i.startsWith("./"))throw new Error(`invalid ${t==="."?"exports":"imports"} object, all keys must start with ${t}. Found ${i}.`);s.push(...Js(r).map(o=>[i,...o]))}return s}return Js(e).map(t=>[".",...t])},Dy=(e,t)=>{if(e.size>t.size)return!1;for(let s of e)if(!t.has(s))return!1;return!0},Js=(e,t=[],s=[])=>{if(e===void 0)return s;if(e===null||typeof e=="string")return s.push([new Set(t),e]),s;if(Array.isArray(e)){for(let i of e)if(Js(i,t,s),!i||typeof i=="string")break;return s}for(let[i,r]of Object.entries(e)){if(i.startsWith("#")||i==="."||i.startsWith("./"))throw new Error(`Expected valid import condition, got: ${i}`);let o=i==="default"?t:t.concat(i),n=new Set(o);if(s.some(([l])=>Dy(l,n))||Js(r,o,s),i==="default")break}return s};var dc=e=>[...new Set(ur(e).map(([t,s,i])=>i).filter(t=>!!t))];var mc=e=>{let t=ur(e),s=[];for(let[i,r]of t)s.some(o=>My(o,r))||s.push([...r]);return s},My=(e,t)=>{if(e.length!==t.size)return!1;for(let s of e)if(!t.has(s))return!1;return!0};import{dirname as uw,resolve as pw}from"path";import{pathToFileURL as dw}from"url";import sn from"node:module";import{stat as Ly}from"node:fs/promises";import{fileURLToPath as $y}from"node:url";var Iy=e=>typeof e=="object"||e.startsWith("file://")?$y(e):e,tt=async e=>{try{return(await Ly(Iy(e))).isFile()}catch{return!1}};var gc=typeof process=="object"&&process&&process.platform==="win32";var Xo=e=>/^\.\.?\//.test(e)||gc&&/^\.\.?\\/.test(e);import{realpath as Wy,stat as Uy}from"node:fs/promises";import{dirname as zy,resolve as yc,sep as Zo}from"node:path";var By=async e=>{try{return(await Uy(e)).isDirectory()}catch{return!1}};var pr=async(e,t)=>{for(let s of se(zy(t))){let i=yc(s,"node_modules")+Zo,r=e===null?i:(e?yc(i,e):i)+Zo;if(await By(r))try{return await Wy(r)+Zo}catch{}}};import{readFile as Gy}from"node:fs/promises";var wc=async e=>{try{return JSON.parse(await Gy(e,"utf8"))}catch{return null}};var Hy=e=>!!e&&(typeof e=="object"||typeof e=="string"),Yy=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let t in e)if(!t.startsWith("#"))return!1;return!0},qy=e=>!!e&&typeof e=="object"&&(typeof e.name=="string"||typeof e.name>"u")&&(typeof e.main=="string"||typeof e.main>"u")&&(typeof e.module=="string"||typeof e.module>"u")&&(typeof e.exports>"u"||Hy(e.exports))&&(typeof e.imports>"u"||Yy(e.imports)),Vy=e=>qy(e)?e:null,ge=async e=>Vy(await wc(e));var Ks=(e,t)=>{let s=Object.keys(t).filter(i=>i.length<=e.length).sort((i,r)=>r.length-i.length).map(i=>[i,i.split("*")]).filter(([,i])=>i.length===2);for(let[i,[r,o]]of s)if(e.startsWith(r)&&e.endsWith(o)){let n=e.substring(r.length,e.length-o.length);return[i,n]}return null};var ut=(e,t)=>{if(e===null||typeof e=="string")return e;if(Array.isArray(e)){for(let i of e){let r=ut(i,t);if(r)return r}return null}let s=new Set(["default"]);for(let i of t.conditions??["import","node"])i.startsWith("!")?s.delete(i.slice(1)):s.add(i);for(let[i,r]of Object.entries(e))if(s.has(i))return ut(r,t);return null};var ie=(e,t,s,i,r)=>{let o=e?e==="."||e.startsWith("./")?e:`./${e}`:".";if(typeof t=="string"||Array.isArray(t)){let h=o==="."&&ut(t,r);if(!h)throw Xs(o,s,i);return h}if(o==="."){let h=ut(t,r);if(h)return h}let n=t,a=n[o];if(a!==void 0){let h=ut(a,r);if(!h)throw Xs(o,s,i);return h}let l=Ks(o,n);if(l){let[h,f]=l,c=ut(n[h],r);if(!c)throw Xs(o,s,i);return c.replace(/\*/g,f)}throw Xs(o,s,i)};import{pathToFileURL as Zy}from"url";var rs=e=>typeof e=="object"?e:e.startsWith("file://")?new URL(e):Zy(e);import{fileURLToPath as Qy}from"url";var Mt=e=>typeof e=="object"||e.startsWith("file://")?Qy(e):e;typeof sn.isBuiltin!="function"&&(sn.isBuiltin=e=>(e.startsWith("node:")&&(e=e.substring(5)),sn.builtinModules.includes(e)));import{realpath as Qs}from"fs/promises";import dr from"module";import{basename as sw,dirname as iw,isAbsolute as rw,resolve as vc}from"path";import{fileURLToPath as ow,pathToFileURL as on}from"url";import{resolve as Zs}from"path";import{pathToFileURL as _e}from"url";var os=async(e,t,s)=>{let{originalParent:i}=s,r=e?.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/),[,o,n]=e===null?[,null,""]:r||["","",""],a=await pr(o,t);if(!a)throw ss(o,i);let l=Zs(a,"index.js"),h=Zs(a,"package.json"),f=await ge(h),c=n?Zs(a,n):!1;if(!f)if(c){if(await tt(c))return _e(c);throw yt(c,i)}else{if(await tt(l))return _e(l);throw ss(a,i)}if(f.exports){let u=ie(n,f.exports,h,i,s),p=Zs(a,u);if(await tt(p))return _e(p);throw yt(p,i)}else if(c){if(await tt(c))return _e(c);throw yt(c,i)}else if(f.main){let u=Zs(a,f.main);if(await tt(u))return _e(u);if(await tt(l))return _e(l);throw ss(a,i)}else{if(await tt(l))return _e(l);throw ss(a,i)}};import{dirname as tw,resolve as bc}from"path";import{pathToFileURL as ew}from"url";var Sc=async(e,t,s)=>{let{originalParent:i}=s,r=e.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/);if(!r)throw en(e);for(let o of se(tw(t))){let n=bc(o,"package.json"),a=await ge(n);if(a){if(a.name&&a.exports){let[,l,h]=r;if(l===a.name){let f=ie(h,a.exports,n,i,s),c=bc(o,f);if(await tt(c))return ew(c);throw yt(c,i)}}if(e.startsWith("#")){if(!a.imports)throw is(e,n,i);let l=a.imports[e];if(l!==void 0){let m=ut(l,s);if(!m)throw is(e,n,i);return m.startsWith("#")?os(null,t,s):pt(m,n,s)}let h=Ks(e,a.imports);if(!h)throw is(e,n,i);let[f,c]=h,u=a.imports[f],p=ut(u,s);if(!p)throw is(e,n,i);if(p.startsWith("#"))return os(null,t,s);let d=p.replace(/\*/g,c);return pt(d,n,s)}break}}return os(e,t,s)};typeof dr.isBuiltin!="function"&&(dr.isBuiltin=e=>(e.startsWith("node:")&&(e=e.substring(5)),dr.builtinModules.includes(e)));var nw=async e=>(e=Mt(e),vc(await Qs(iw(e)),sw(e))),pt=async(e,t=void 0,s={})=>{if(typeof e=="string"&&e.startsWith("file://")&&(e=new URL(e)),typeof e=="object"){if(!await tt(e))throw yt(String(e),String(t));let n=await Qs(Mt(e));return n!==ow(e)?on(n):e}let i=t?rs(await nw(t)):void 0;if(Xo(e)){if(!i)throw rn(e,t);let n=new URL(e,i);if(!await tt(n))throw yt(e,String(t));return on(await Qs(new URL(e,i)))}if(rw(e)){if(!await tt(e))throw yt(e,String(t));return on(await Qs(e))}if(dr.isBuiltin(String(e)))return String(e);let r=Mt(t||vc(await Qs(process.cwd()),"x")),o={...s,originalParent:String(s.originalParent||r)};return e?Sc(e,r,o):os(e,r,o)};var en=(e,t=pt)=>{let s=new Error("invalid import() specifier: "+e);return Error.captureStackTrace(s,t),s},ns=(e,t=pt)=>{let s=new Error(`Not a valid package: ${e}`);return Error.captureStackTrace(s,t),s},rn=(e,t,s=pt)=>{let i=Object.assign(new Error("relative import without parentURL"),{url:e,parentURL:t});return Error.captureStackTrace(i,s),i},Xs=(e,t,s,i=pt)=>{let r=e==="."?'No "exports" main defined':`Package subpath '${e}' is not defined by "exports"`,o=Object.assign(new Error(`${r} in ${t} imported from ${s}`),{code:"ERR_PACKAGE_PATH_NOT_EXPORTED"});return Error.captureStackTrace(o,i),o},ss=(e,t,s=pt)=>{let i=Object.assign(new Error(`Cannot find package '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},yt=(e,t,s=pt)=>{let i=Object.assign(new Error(`Cannot find module '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},is=(e,t,s,i=pt)=>{let r=Object.assign(new Error(`Package import specifier "${e}" is not defined in package ${t} imported from ${s}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});return Error.captureStackTrace(r,i),r};import{dirname as cw,resolve as fw}from"path";import{pathToFileURL as Ec}from"url";var nn=e=>e?aw(e)?Object.keys(e).filter(t=>t==="."||t.startsWith("./")):["."]:[],aw=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let t in e)if(t!=="."&&!t.startsWith("./"))return!1;return!0};import{resolve as lw}from"node:path";var mr=async(e,t)=>{let s=ks(e[0])+(e[0].endsWith("/")?"":"*/")+"**"+(e[1].startsWith("/")?"":"/*")+ks(e[1]);return(await ve(s,{posix:!0,absolute:!1,nodir:!0,cwd:t,dotRelative:!0})).map(r=>[r.substring(e[0].length,r.length-e[1].length),lw(t,r)])};var an=async(e,t={})=>{let s=Mt(e),i=cw(s),r=await ge(s);if(!r)throw ns(e,an);let o={},{exports:n}=r;for(let a of nn(n)){let l;try{l=ie(a,n,s,s,t)}catch{}if(!l)continue;let h=l.split("*"),f=a.split("*");if(h.length===2&&f.length===2)for(let[c,u]of await mr(h,i))o[f[0]+c+f[1]]=Ec(u);else o[a]=Ec(fw(i,l))}return o};var ln=async(e,t={})=>{let s=Mt(e),i=uw(s),r=rs(e),o=await ge(s);if(!o)throw ns(e,ln);let n={};for(let[a,l]of mw(o,t)){let h=l.match(/^(@[^\/]+\/[^\/]+|[^\/]+)/),f=o.name;if(!h)continue;let c=a.split("*"),u=l.split("*");if(!(c.length===2&&u.length===2)){try{n[a]=await pt(l,r)}catch{}continue}let d=h[1]===".";if(d){for(let[w,S]of await mr(u,i))n[c[0]+w+c[1]]=dw(S);continue}let m=h[1]===f,y=!d&&!m?h[1]:null,g=y?await pr(y,i):i;if(!g)continue;let b=pw(g,"package.json");if(!await tt(b))continue;let v=await an(b);for(let[w,S]of Object.entries(v)){if(w==="."||w==="./")continue;let R=y+w.substring(1);if(R.startsWith(u[0])&&R.endsWith(u[1])){let M=c[0]+R.substring(u[0].length,R.length-u[1].length)+c[1];try{n[M]=await pt(S,r)}catch{}}}}return n},mw=(e,t)=>{let s=[],{imports:i}=e;if(!i||typeof i!="object")return s;for(let[r,o]of Object.entries(i)){let n=ut(o,t);n&&!n.startsWith("#")&&s.push([r,n])}return s};import{fileURLToPath as ww}from"url";var Tc=new Set,Oc=e=>{let t=[...kc.entries()];if(!t.length)return!1;let s=new Set(t.map(([i])=>cn(i)));return T("save import linker",e),gw(e,`import { mkdirSync } from 'node:fs'
|
|
35
35
|
import { symlink } from 'node:fs/promises'
|
|
36
36
|
const dirs = ${JSON.stringify([...s])}
|
|
37
37
|
const links = [
|
|
@@ -40,13 +40,13 @@ ${t.map(i=>` ${JSON.stringify(i)},
|
|
|
40
40
|
const e = (er) => { if (er.code !== 'EEXIST') throw er }
|
|
41
41
|
for (const d of dirs) mkdirSync(d, { recursive: true })
|
|
42
42
|
Promise.all(links.map(([dest, src]) => symlink(src, dest).catch(e)))
|
|
43
|
-
`),!0},Dt,ac=async e=>{let t=Hh(e).filter(o=>!o.startsWith("./src/"));if(!t.some(o=>o.includes("*")))return Dt=t.filter(o=>o.startsWith("./"));let s=Yh(e),i=new Set,r=Ho("package.json");for(let o of s){let n=await Uo(r,{conditions:o});for(let a of Object.values(n)){if(typeof a=="string")continue;let l=Wy(a),h=rc(process.cwd(),l);!h||h.startsWith(".."+Bo)||h.startsWith("src"+Bo)||h.startsWith("node_modules"+Bo)||i.add("./"+h.replace(/\\/g,"/"))}}return Dt=[...i]},lc=new Map,hr=async(e,t,s=!1)=>{let{imports:i}=e;if(!i||(Dt||(Dt=await ac(i)),!Dt.length))return;T(`link import targets in ${t}`,Dt);let r=rc(Ho(t),process.cwd()),o=[];for(let n of Dt){let a=n.replace(/^\.\//,""),l=Go(a),h=l==="."?"":l.split("/").map(()=>"../").join(""),f=t+"/"+a,c=r+"/"+h+a;s&&lc.set(f,c),o.push(oo(Go(f)).then(u=>(!s&&u&&oc.add(u),Ot(f))).then(()=>Iy(c,f)))}await Promise.all(o)},cr=async(e,t)=>{let{imports:s}=e;if(!s)return;Dt||(Dt=await ac(s)),T(`unlink import targets in ${t}`,Dt);let i=[];for(let r of Dt){let o=Ho(t,r);i.push(Ot(o))}for(let r of oc)i.push(Ot(r));await Promise.all(i)};import{readlinkSync as zy,symlinkSync as hc}from"fs";import{dirname as fc,relative as uc,resolve as fr,sep as cc}from"path";var pc=new Map,Ys,dc=e=>{if(Ys!==void 0)return Ys;let t=process.cwd(),s=`${cc}node_modules${cc}${e.name}`.toLowerCase();if(t.toLowerCase().endsWith(s))return Ys=!0;for(let i of he(t)){let r=fr(i,"node_modules",e.name);try{let o=fr(fc(r),zy(r));if(uc(o,t)==="")return Ys=!0}catch{}}return Ys=!1},Yo=(e,t)=>{let s=e?.tshy?.selfLink;if(!e.name||s===!1||dc(e))return;let i=fr(t,"node_modules",e.name),r=fc(i),o=uc(r,process.cwd()),n=Jt(r);n&&pc.set(i,n);try{hc(o,i)}catch{ut(i);let a=!0;try{hc(o,i),a=!1}finally{if(a&&s===void 0)return}}},ur=(e,t)=>{if(!e.name||e?.tshy?.selfLink===!1||dc(e))return;let s=fr(t,"node_modules",e.name);ut(s);let i=pc.get(s);i&&ut(i)};var pr=e=>{Q("src"),cr(O,"src"),ur(O,"src"),_("build failed"),L(e),process.exit(1)};import{existsSync as mc,renameSync as Uy,unlinkSync as By}from"fs";var Gy=e=>mc(e)&&By(e),Hy=(e,t)=>mc(e)&&Uy(e,t),$={unlink:Gy,rename:Hy};import{fileURLToPath as Yy}from"url";var qy={tsgo:"@typescript/native-preview",tsc:"typescript"},Vy=async e=>await q(e+"/package.json",process.cwd()+"/x").catch(()=>q(e+"/package.json",import.meta.url)),{compiler:gc="tsc"}=A,yc=qy[gc],Jy=e=>e.slice(0,-1*(yc+"/package.json").length)+`.bin/${gc}`,dr=Jy(Yy(await Vy(yc)));var Xy=process.execPath,{commonjsDialects:Zy=[]}=A,bc=()=>{Q("src","commonjs");for(let e of["commonjs",...Zy]){let t=H.get(e==="commonjs"?"cjs":e);T(E.cyan.dim("building "+e));let s=Ky(Xy,[dr,"-p",`.tshy/${e}.json`],{stdio:"inherit"});if(s.status||s.signal)return Q("src"),pr(s);Q(".tshy-build/"+e,"commonjs");for(let[i,r]of t?.map.entries()??[]){let o=Ze(`.tshy-build/${e}`,wc(Ze("src"),Ze(i))).replace(/\.cts$/,""),n=Ze(`.tshy-build/${e}`,wc(Ze("src"),Ze(r))).replace(/\.tsx?$/,""),a=`${n}.js.map`,l=`${n}.d.ts.map`;$.unlink(a),$.unlink(l),$.rename(`${o}.cjs`,`${n}.js`),$.rename(`${o}.d.cts`,`${n}.d.ts`)}L(E.cyan.bold("built commonjs"))}Q("src")};import{spawnSync as Qy}from"node:child_process";import{relative as Sc,resolve as Qe}from"node:path";var tw=process.execPath,{esmDialects:ew=[]}=A,vc=()=>{Q("src","esm");for(let e of["esm",...ew]){let t=H.get(e);T(E.cyan.dim("building "+e));let s=Qy(tw,[dr,"-p",`.tshy/${e}.json`],{stdio:"inherit"});if(s.status||s.signal)return Q("src"),pr(s);Q(".tshy-build/"+e,"esm");for(let[i,r]of t?.map.entries()??[]){let o=Qe(`.tshy-build/${e}`,Sc(Qe("src"),Qe(i))).replace(/\.mts$/,""),n=Qe(`.tshy-build/${e}`,Sc(Qe("src"),Qe(r))).replace(/\.tsx?$/,"");$.unlink(`${n}.js.map`),$.unlink(`${n}.d.ts.map`),$.rename(`${o}.mjs`,`${n}.js`),$.rename(`${o}.d.mts`,`${n}.d.ts`)}L(E.cyan.bold("built "+e))}Q("src")};import{readdirSync as mr}from"fs";import{parse as sw}from"path";var Ec=async(e,t)=>{let s=mr(`${t}/${e}`,{withFileTypes:!0}),i;try{i=new Set(mr(`src/${e}`))}catch{}if(!i)return await Ot(`${t}/${e}`);for(let r of s){let o=`${e}/${r.name}`;if(r.isDirectory()){await Ec(o,t);continue}let{ext:n,name:a}=sw(o);if(n===".map")continue;a.endsWith(".d")&&n.endsWith("ts")&&(n=".d"+n,a=a.substring(0,a.length-2));let l=n===".js"||n===".d.ts"?[".tsx",".ts"]:n===".mjs"||n===".d.mts"?[".mts"]:n===".cjs"||n===".d.cts"?[".cts"]:[];l.push(n);let h=!0;for(let f of l)if(i.has(`${a}${f}`)){h=!1;break}h&&(T("removing output file",o),await Ot([`${t}/${o}`,`${t}/${o}.map`]))}},qo=async()=>{let e=Ve();if(e.compilerOptions.incremental!==!0&&e.compilerOptions.composite!==!0)return await Ot(".tshy-build");let t;try{t=mr(".tshy-build/.tshy")}catch{}if(!t?.length)return await Ot(".tshy-build");for(let s of mr(".tshy-build"))s!==".tshy"&&await Ec(".",`.tshy-build/${s}`)};var xe=A.dialects||["esm","commonjs"];import{writeFileSync as iw}from"fs";var xc=()=>iw("package.json",ti(O));import{linkSync as rw,mkdirSync as ow}from"node:fs";import{dirname as nw,relative as Tc,resolve as Te}from"node:path";var{esmDialects:aw=[]}=A,_c=()=>{for(let e of["esm",...aw]){let t=H.get(e);T(E.cyan.dim("linking "+e));for(let s of Ht){let i=s.substring(6),r=Te(`.tshy-build/${e}/${i}`);ow(nw(r),{recursive:!0}),rw(s,r)}Q(".tshy-build/"+e,"esm");for(let[s,i]of t?.map.entries()??[]){let r=Te(`.tshy-build/${e}`,Tc(Te("src"),Te(s))).replace(/\.mts$/,""),o=Te(`.tshy-build/${e}`,Tc(Te("src"),Te(i))).replace(/\.tsx?$/,"");$.unlink(`${o}.js.map`),$.unlink(`${o}.d.ts.map`),$.rename(`${r}.mjs`,`${o}.js`),$.rename(`${r}.d.mts`,`${o}.d.ts`)}L(E.cyan.bold("linked "+e))}};import{linkSync as lw,mkdirSync as hw}from"node:fs";import{dirname as cw}from"node:path";import{relative as Oc,resolve as _e}from"node:path/posix";var{commonjsDialects:fw=[]}=A,Ac=()=>{for(let e of["commonjs",...fw]){let t=H.get(e==="commonjs"?"cjs":e);T(E.cyan.dim("linking "+e));for(let s of Ht){let i=s.substring(6),r=_e(`.tshy-build/${e}/${i}`);hw(cw(r),{recursive:!0}),lw(s,r)}Q(".tshy-build/"+e,"commonjs");for(let[s,i]of t?.map.entries()??[]){let r=_e(`.tshy-build/${e}`,Oc(_e("src"),_e(s))).replace(/\.cts$/,""),o=_e(`.tshy-build/${e}`,Oc(_e("src"),_e(i))).replace(/\.tsx?$/,"");$.unlink(`${o}.js.map`),$.unlink(`${o}.d.ts.map`),$.rename(`${r}.cjs`,`${o}.js`),$.rename(`${r}.d.cts`,`${o}.d.ts`)}L(E.cyan.bold("linked commonjs"))}};var kc=async()=>{await qo(),Yo(O,"src"),await hr(O,"src");let e=A.liveDev&&process.env.npm_command!=="publish"&&process.env.npm_command!=="pack",t=e?_c:vc,s=e?Ac:bc;xe.includes("esm")&&t(),xe.includes("commonjs")&&s(),await cr(O,"src"),ur(O,"src"),T(E.cyan.dim("moving to ./dist")),vh(".tshy-build","dist"),T(E.cyan.dim("cleaning build temp dir")),await qo(),Yo(O,"dist"),O.imports&&(T("linking package imports",O.imports),xe.includes("commonjs")&&await hr(O,"dist/commonjs",!0),xe.includes("esm")&&await hr(O,"dist/esm",!0),nc("dist/.tshy-link-imports.mjs")&&(O.scripts=O.scripts||{},O.scripts.preinstall='node -e "import(process.argv[1]).catch(()=>{})" dist/.tshy-link-imports.mjs')),T(E.cyan.dim("chmod bins")),Th(),T(E.cyan.dim("write package.json")),xc()};import{relative as uw,resolve as Rc}from"node:path/posix";var{esmDialects:pw=[],commonjsDialects:dw=[]}=A,qs=A.liveDev&&process.env.npm_command!=="publish"&&process.env.npm_command!=="pack",gr=(e,t,s,i,r=new Map)=>{if(e!==void 0){if(typeof e=="string"){let o=i==="commonjs"?".mts":".cts";if(e.endsWith(o))return;let n=t==="commonjs"?"cjs":t,a=uw(Rc("./src"),Rc(r.get(n)?.map.get(e)??e)),l=qs?a:a.replace(/\.([mc]?)tsx?$/,".$1js");return!e||!e.startsWith("./src/")?e:xe.includes(i)?`./dist/${t}/${l}`:void 0}return $t(e,[s])}},mw=(e,t=new Map)=>gr(e,"esm","import","esm",t),gw=(e,t=new Map)=>gr(e,"commonjs","require","commonjs",t),yw=(e,t)=>{if(!e.exports)return _("no exports on tshy config (is there code in ./src?)"),process.exit(1);let s={};for(let[i,r]of Object.entries(e.exports)){if(r!==null&&(typeof r!="string"||!r.startsWith("./src/"))){s[i]=r;continue}if(r===null)continue;let o=mw(r,H),n=gw(r,H);if(!o&&!n)continue;let a=s[i]={};if(o)for(let l of pw){let h=r&&(H.get(l)?.map.get(r)??r),f=gr(r,l,l,"esm",H);f&&(a[l]=qs?{...t==="commonjs"?pe(h,e):{},default:f}:{...t==="commonjs"?pe(h,e):{},types:f.replace(/\.js$/,".d.ts"),default:f})}if(n)for(let l of dw){let h=r&&(H.get(l)?.map.get(r)??r),f=gr(r,l,l,"commonjs",H);f&&(a[l]=qs?{...t==="module"?pe(h,e):{},default:f}:{...t==="module"?pe(h,e):{},types:f.replace(/\.js$/,".d.ts"),default:f})}o&&(a.import=qs?{...t==="module"?pe(r,e):{},default:o}:{...t==="module"?pe(r,e):{},types:o.replace(/\.(m?)js$/,".d.$1ts"),default:o}),n&&(a.require=qs?{...t==="commonjs"?pe(r,e):{},default:n}:{...t==="commonjs"?pe(r,e):{},types:n.replace(/\.(c?)js$/,".d.$1ts"),default:n})}return s},pe=(e,t)=>{let{sourceDialects:s}=t;return s?Object.fromEntries(s.map(i=>[i,e])):{}},ww=(e,t)=>{t.type=t.type==="commonjs"?"commonjs":"module";let s=$t(t.exports["."],["require"]);if(e?.main??!!s){if(!s)return _("could not resolve exports['.'] for tshy.main 'require'"),process.exit(1);let n=$t(t.exports["."],["require","types"]);t.main=s,n&&n!==s?t.types=n:delete t.types}else e&&e.main!==!1&&delete e.main,delete t.main,delete t.types;let r=$t(t.exports["."],["import"]);if(e?.module??!!r){if(!r)return _("could not resolve exports['.'] for tshy.module 'import'"),process.exit(1);t.module=r}else e&&e.module!==!1&&delete e.module,delete t.module};O.exports=yw(A,O.type);ww(A,O);var VO=O.exports;var Vo=e=>{let t="https://github.com/isaacs/tshy",s=E.level>0?`\x1B]8;;${t}\x1B\\${t}\x1B]8;;\x1B\\`:t;console[e?"error":"log"](`Usage: tshy [--help]
|
|
43
|
+
`),!0},Lt,_c=async e=>{let t=dc(e).filter(o=>!o.startsWith("./src/"));if(!t.some(o=>o.includes("*")))return Lt=t.filter(o=>o.startsWith("./"));let s=mc(e),i=new Set,r=fn("package.json");for(let o of s){let n=await ln(r,{conditions:o});for(let a of Object.values(n)){if(typeof a=="string")continue;let l=ww(a),h=xc(process.cwd(),l);!h||h.startsWith(".."+hn)||h.startsWith("src"+hn)||h.startsWith("node_modules"+hn)||i.add("./"+h.replace(/\\/g,"/"))}}return Lt=[...i]},kc=new Map,gr=async(e,t,s=!1)=>{let{imports:i}=e;if(!i||(Lt||(Lt=await _c(i)),!Lt.length))return;T(`link import targets in ${t}`,Lt);let r=xc(fn(t),process.cwd()),o=[];for(let n of Lt){let a=n.replace(/^\.\//,""),l=cn(a),h=l==="."?"":l.split("/").map(()=>"../").join(""),f=t+"/"+a,c=r+"/"+h+a;s&&kc.set(f,c),o.push(wo(cn(f)).then(u=>(!s&&u&&Tc.add(u),Rt(f))).then(()=>yw(c,f)))}await Promise.all(o)},yr=async(e,t)=>{let{imports:s}=e;if(!s)return;Lt||(Lt=await _c(s)),T(`unlink import targets in ${t}`,Lt);let i=[];for(let r of Lt){let o=fn(t,r);i.push(Rt(o))}for(let r of Tc)i.push(Rt(r));await Promise.all(i)};import{readlinkSync as bw,symlinkSync as Rc}from"fs";import{dirname as Cc,relative as Pc,resolve as wr,sep as Ac}from"path";var jc=new Map,ti,Nc=e=>{if(ti!==void 0)return ti;let t=process.cwd(),s=`${Ac}node_modules${Ac}${e.name}`.toLowerCase();if(t.toLowerCase().endsWith(s))return ti=!0;for(let i of se(t)){let r=wr(i,"node_modules",e.name);try{let o=wr(Cc(r),bw(r));if(Pc(o,t)==="")return ti=!0}catch{}}return ti=!1},un=(e,t)=>{let s=e?.tshy?.selfLink;if(!e.name||s===!1||Nc(e))return;let i=wr(t,"node_modules",e.name),r=Cc(i),o=Pc(r,process.cwd()),n=Zt(r);n&&jc.set(i,n);try{Rc(o,i)}catch{ft(i);let a=!0;try{Rc(o,i),a=!1}finally{if(a&&s===void 0)return}}},br=(e,t)=>{if(!e.name||e?.tshy?.selfLink===!1||Nc(e))return;let s=wr(t,"node_modules",e.name);ft(s);let i=jc.get(s);i&&ft(i)};var Sr=e=>{Z("src"),yr(_,"src"),br(_,"src"),O("build failed"),$(e),process.exit(1)};import{existsSync as Fc,renameSync as Sw,unlinkSync as vw}from"fs";var Ew=e=>Fc(e)&&vw(e),xw=(e,t)=>Fc(e)&&Sw(e,t),L={unlink:Ew,rename:xw};import{realpath as si}from"fs/promises";import Tr from"module";import{basename as Tw,dirname as Ow,isAbsolute as _w,resolve as Lc}from"path";import{fileURLToPath as kw,pathToFileURL as pn}from"url";import dn from"node:module";import{stat as Rw}from"node:fs/promises";import{fileURLToPath as Aw}from"node:url";import{realpath as Nw,stat as Fw}from"node:fs/promises";import{dirname as Dw,resolve as Dc,sep as mn}from"node:path";import{dirname as Mw,resolve as Lw}from"path";import{readFile as Ww}from"node:fs/promises";import{pathToFileURL as Yw}from"url";import{fileURLToPath as Vw}from"url";import{resolve as ei}from"path";import{pathToFileURL as ke}from"url";import{dirname as Xw,resolve as Mc}from"path";import{pathToFileURL as Zw}from"url";var Cw=e=>typeof e=="object"||e.startsWith("file://")?Aw(e):e,$t=async e=>{try{return(await Rw(Cw(e))).isFile()}catch{return!1}};var Pw=typeof process=="object"&&process&&process.platform==="win32",jw=e=>/^\.\.?\//.test(e)||Pw&&/^\.\.?\\/.test(e),$c=function*(e){for(e=Lw(e);e;){yield e;let t=Mw(e);if(t===e)break;e=t}},$w=async e=>{try{return(await Fw(e)).isDirectory()}catch{return!1}};var Iw=async(e,t)=>{for(let s of $c(Dw(t))){let i=Dc(s,"node_modules")+mn,r=e===null?i:(e?Dc(i,e):i)+mn;if(await $w(r))try{return await Nw(r)+mn}catch{}}};var Uw=async e=>{try{return JSON.parse(await Ww(e,"utf8"))}catch{return null}};var zw=e=>!!e&&(typeof e=="object"||typeof e=="string"),Bw=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let t in e)if(!t.startsWith("#"))return!1;return!0},Gw=e=>!!e&&typeof e=="object"&&(typeof e.name=="string"||typeof e.name>"u")&&(typeof e.main=="string"||typeof e.main>"u")&&(typeof e.module=="string"||typeof e.module>"u")&&(typeof e.exports>"u"||zw(e.exports))&&(typeof e.imports>"u"||Bw(e.imports)),Hw=e=>Gw(e)?e:null,Ic=async e=>Hw(await Uw(e));var Wc=(e,t)=>{let s=Object.keys(t).filter(i=>i.length<=e.length).sort((i,r)=>r.length-i.length).map(i=>[i,i.split("*")]).filter(([,i])=>i.length===2);for(let[i,[r,o]]of s)if(e.startsWith(r)&&e.endsWith(o)){let n=e.substring(r.length,e.length-o.length);return[i,n]}return null},ye=(e,t)=>{if(e===null||typeof e=="string")return e;if(Array.isArray(e)){for(let i of e){let r=ye(i,t);if(r)return r}return null}let s=new Set(["default"]);for(let i of t.conditions??["import","node"])i.startsWith("!")?s.delete(i.slice(1)):s.add(i);for(let[i,r]of Object.entries(e))if(s.has(i))return ye(r,t);return null},Uc=(e,t,s,i,r)=>{let o=e?e==="."||e.startsWith("./")?e:`./${e}`:".";if(typeof t=="string"||Array.isArray(t)){let h=o==="."&&ye(t,r);if(!h)throw vr(o,s,i);return h}if(o==="."){let h=ye(t,r);if(h)return h}let n=t,a=n[o];if(a!==void 0){let h=ye(a,r);if(!h)throw vr(o,s,i);return h}let l=Wc(o,n);if(l){let[h,f]=l,c=ye(n[h],r);if(!c)throw vr(o,s,i);return c.replace(/\*/g,f)}throw vr(o,s,i)};var qw=e=>typeof e=="object"?e:e.startsWith("file://")?new URL(e):Yw(e),gn=e=>typeof e=="object"||e.startsWith("file://")?Vw(e):e;typeof dn.isBuiltin!="function"&&(dn.isBuiltin=e=>(e.startsWith("node:")&&(e=e.substring(5)),dn.builtinModules.includes(e)));var Jw=(e,t=It)=>{let s=new Error("invalid import() specifier: "+e);return Error.captureStackTrace(s,t),s},Kw=(e,t,s=It)=>{let i=Object.assign(new Error("relative import without parentURL"),{url:e,parentURL:t});return Error.captureStackTrace(i,s),i},vr=(e,t,s,i=It)=>{let r=e==="."?'No "exports" main defined':`Package subpath '${e}' is not defined by "exports"`,o=Object.assign(new Error(`${r} in ${t} imported from ${s}`),{code:"ERR_PACKAGE_PATH_NOT_EXPORTED"});return Error.captureStackTrace(o,i),o},Er=(e,t,s=It)=>{let i=Object.assign(new Error(`Cannot find package '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},Re=(e,t,s=It)=>{let i=Object.assign(new Error(`Cannot find module '${e}' imported from ${t}`),{code:"ERR_MODULE_NOT_FOUND"});return Error.captureStackTrace(i,s),i},xr=(e,t,s,i=It)=>{let r=Object.assign(new Error(`Package import specifier "${e}" is not defined in package ${t} imported from ${s}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});return Error.captureStackTrace(r,i),r},Or=async(e,t,s)=>{let{originalParent:i}=s,r=e?.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/),[,o,n]=e===null?[,null,""]:r||["","",""],a=await Iw(o,t);if(!a)throw Er(o,i);let l=ei(a,"index.js"),h=ei(a,"package.json"),f=await Ic(h),c=n?ei(a,n):!1;if(!f)if(c){if(await $t(c))return ke(c);throw Re(c,i)}else{if(await $t(l))return ke(l);throw Er(a,i)}if(f.exports){let u=Uc(n,f.exports,h,i,s),p=ei(a,u);if(await $t(p))return ke(p);throw Re(p,i)}else if(c){if(await $t(c))return ke(c);throw Re(c,i)}else if(f.main){let u=ei(a,f.main);if(await $t(u))return ke(u);if(await $t(l))return ke(l);throw Er(a,i)}else{if(await $t(l))return ke(l);throw Er(a,i)}},Qw=async(e,t,s)=>{let{originalParent:i}=s,r=e.match(/^(@[^\/]+\/[^\/]+|[^\/]+)(?:\/(.*))?$/);if(!r)throw Jw(e);for(let o of $c(Xw(t))){let n=Mc(o,"package.json"),a=await Ic(n);if(a){if(a.name&&a.exports){let[,l,h]=r;if(l===a.name){let f=Uc(h,a.exports,n,i,s),c=Mc(o,f);if(await $t(c))return Zw(c);throw Re(c,i)}}if(e.startsWith("#")){if(!a.imports)throw xr(e,n,i);let l=a.imports[e];if(l!==void 0){let m=ye(l,s);if(!m)throw xr(e,n,i);return m.startsWith("#")?Or(null,t,s):It(m,n,s)}let h=Wc(e,a.imports);if(!h)throw xr(e,n,i);let[f,c]=h,u=a.imports[f],p=ye(u,s);if(!p)throw xr(e,n,i);if(p.startsWith("#"))return Or(null,t,s);let d=p.replace(/\*/g,c);return It(d,n,s)}break}}return Or(e,t,s)};typeof Tr.isBuiltin!="function"&&(Tr.isBuiltin=e=>(e.startsWith("node:")&&(e=e.substring(5)),Tr.builtinModules.includes(e)));var tb=async e=>(e=gn(e),Lc(await si(Ow(e)),Tw(e))),It=async(e,t=void 0,s={})=>{if(typeof e=="string"&&e.startsWith("file://")&&(e=new URL(e)),typeof e=="object"){if(!await $t(e))throw Re(String(e),String(t));let n=await si(gn(e));return n!==kw(e)?pn(n):e}let i=t?qw(await tb(t)):void 0;if(jw(e)){if(!i)throw Kw(e,t);let n=new URL(e,i);if(!await $t(n))throw Re(e,String(t));return pn(await si(new URL(e,i)))}if(_w(e)){if(!await $t(e))throw Re(e,String(t));return pn(await si(e))}if(Tr.isBuiltin(String(e)))return String(e);let r=gn(t||Lc(await si(process.cwd()),"x")),o={...s,originalParent:String(s.originalParent||r)};return e?Qw(e,r,o):Or(e,r,o)};import{fileURLToPath as eb}from"url";var sb={tsgo:"@typescript/native-preview",tsc:"typescript"},ib={tsgo:"bin/tsgo.js",tsc:"bin/tsc"},rb=async e=>await It(e+"/package.json",process.cwd()+"/x").catch(()=>It(e+"/package.json",import.meta.url)),{compiler:zc="tsc"}=k,ob=sb[zc],nb=e=>e.slice(0,-12)+ib[zc],_r=nb(eb(await rb(ob)));var lb=process.execPath,{commonjsDialects:hb=[]}=k,Gc=()=>{Z("src","commonjs");for(let e of["commonjs",...hb]){let t=H.get(e==="commonjs"?"cjs":e);T(E.cyan.dim("building "+e));let s=ab(lb,[_r,"-p",`.tshy/${e}.json`],{stdio:"inherit"});if(s.status||s.signal)return Z("src"),Sr(s);Z(".tshy-build/"+e,"commonjs");for(let[i,r]of t?.map.entries()??[]){let o=as(`.tshy-build/${e}`,Bc(as("src"),as(i))).replace(/\.cts$/,""),n=as(`.tshy-build/${e}`,Bc(as("src"),as(r))).replace(/\.tsx?$/,""),a=`${n}.js.map`,l=`${n}.d.ts.map`;L.unlink(a),L.unlink(l),L.rename(`${o}.cjs`,`${n}.js`),L.rename(`${o}.d.cts`,`${n}.d.ts`)}$(E.cyan.bold("built commonjs"))}Z("src")};import{spawnSync as cb}from"node:child_process";import{relative as Hc,resolve as ls}from"node:path";var fb=process.execPath,{esmDialects:ub=[]}=k,Yc=()=>{Z("src","esm");for(let e of["esm",...ub]){let t=H.get(e);T(E.cyan.dim("building "+e));let s=cb(fb,[_r,"-p",`.tshy/${e}.json`],{stdio:"inherit"});if(s.status||s.signal)return Z("src"),Sr(s);Z(".tshy-build/"+e,"esm");for(let[i,r]of t?.map.entries()??[]){let o=ls(`.tshy-build/${e}`,Hc(ls("src"),ls(i))).replace(/\.mts$/,""),n=ls(`.tshy-build/${e}`,Hc(ls("src"),ls(r))).replace(/\.tsx?$/,"");L.unlink(`${n}.js.map`),L.unlink(`${n}.d.ts.map`),L.rename(`${o}.mjs`,`${n}.js`),L.rename(`${o}.d.mts`,`${n}.d.ts`)}$(E.cyan.bold("built "+e))}Z("src")};import{readdirSync as kr}from"fs";import{parse as pb}from"path";var qc=async(e,t)=>{let s=kr(`${t}/${e}`,{withFileTypes:!0}),i;try{i=new Set(kr(`src/${e}`))}catch{}if(!i)return await Rt(`${t}/${e}`);for(let r of s){let o=`${e}/${r.name}`;if(r.isDirectory()){await qc(o,t);continue}let{ext:n,name:a}=pb(o);if(n===".map")continue;a.endsWith(".d")&&n.endsWith("ts")&&(n=".d"+n,a=a.substring(0,a.length-2));let l=n===".js"||n===".d.ts"?[".tsx",".ts"]:n===".mjs"||n===".d.mts"?[".mts"]:n===".cjs"||n===".d.cts"?[".cts"]:[];l.push(n);let h=!0;for(let f of l)if(i.has(`${a}${f}`)){h=!1;break}h&&(T("removing output file",o),await Rt([`${t}/${o}`,`${t}/${o}.map`]))}},yn=async()=>{let e=ts();if(e.compilerOptions.incremental!==!0&&e.compilerOptions.composite!==!0)return await Rt(".tshy-build");let t;try{t=kr(".tshy-build/.tshy")}catch{}if(!t?.length)return await Rt(".tshy-build");for(let s of kr(".tshy-build"))s!==".tshy"&&await qc(".",`.tshy-build/${s}`)};var Ae=k.dialects||["esm","commonjs"];import{writeFileSync as db}from"fs";var Vc=()=>db("package.json",ci(_));import{linkSync as mb,mkdirSync as gb}from"node:fs";import{dirname as yb,relative as Jc,resolve as Ce}from"node:path";var{esmDialects:wb=[]}=k,Kc=()=>{for(let e of["esm",...wb]){let t=H.get(e);T(E.cyan.dim("linking "+e));for(let s of Vt){let i=s.substring(6),r=Ce(`.tshy-build/${e}/${i}`);gb(yb(r),{recursive:!0}),mb(s,r)}Z(".tshy-build/"+e,"esm");for(let[s,i]of t?.map.entries()??[]){let r=Ce(`.tshy-build/${e}`,Jc(Ce("src"),Ce(s))).replace(/\.mts$/,""),o=Ce(`.tshy-build/${e}`,Jc(Ce("src"),Ce(i))).replace(/\.tsx?$/,"");L.unlink(`${o}.js.map`),L.unlink(`${o}.d.ts.map`),L.rename(`${r}.mjs`,`${o}.js`),L.rename(`${r}.d.mts`,`${o}.d.ts`)}$(E.cyan.bold("linked "+e))}};import{linkSync as bb,mkdirSync as Sb}from"node:fs";import{dirname as vb}from"node:path";import{relative as Xc,resolve as Pe}from"node:path/posix";var{commonjsDialects:Eb=[]}=k,Zc=()=>{for(let e of["commonjs",...Eb]){let t=H.get(e==="commonjs"?"cjs":e);T(E.cyan.dim("linking "+e));for(let s of Vt){let i=s.substring(6),r=Pe(`.tshy-build/${e}/${i}`);Sb(vb(r),{recursive:!0}),bb(s,r)}Z(".tshy-build/"+e,"commonjs");for(let[s,i]of t?.map.entries()??[]){let r=Pe(`.tshy-build/${e}`,Xc(Pe("src"),Pe(s))).replace(/\.cts$/,""),o=Pe(`.tshy-build/${e}`,Xc(Pe("src"),Pe(i))).replace(/\.tsx?$/,"");L.unlink(`${o}.js.map`),L.unlink(`${o}.d.ts.map`),L.rename(`${r}.cjs`,`${o}.js`),L.rename(`${r}.d.cts`,`${o}.d.ts`)}$(E.cyan.bold("linked commonjs"))}};var Qc=async()=>{await yn(),un(_,"src"),await gr(_,"src");let e=k.liveDev&&process.env.npm_command!=="publish"&&process.env.npm_command!=="pack",t=e?Kc:Yc,s=e?Zc:Gc;Ae.includes("esm")&&t(),Ae.includes("commonjs")&&s(),await yr(_,"src"),br(_,"src"),T(E.cyan.dim("moving to ./dist")),Gh(".tshy-build","dist"),T(E.cyan.dim("cleaning build temp dir")),await yn(),un(_,"dist"),_.imports&&(T("linking package imports",_.imports),Ae.includes("commonjs")&&await gr(_,"dist/commonjs",!0),Ae.includes("esm")&&await gr(_,"dist/esm",!0),Oc("dist/.tshy-link-imports.mjs")&&(_.scripts=_.scripts||{},_.scripts.preinstall='node -e "import(process.argv[1]).catch(()=>{})" dist/.tshy-link-imports.mjs')),T(E.cyan.dim("chmod bins")),qh(),T(E.cyan.dim("write package.json")),Vc()};import{relative as xb,resolve as tf}from"node:path/posix";var{esmDialects:Tb=[],commonjsDialects:Ob=[]}=k,ii=k.liveDev&&process.env.npm_command!=="publish"&&process.env.npm_command!=="pack",Rr=(e,t,s,i,r=new Map)=>{if(e!==void 0){if(typeof e=="string"){let o=i==="commonjs"?".mts":".cts";if(e.endsWith(o))return;let n=t==="commonjs"?"cjs":t,a=xb(tf("./src"),tf(r.get(n)?.map.get(e)??e)),l=ii?a:a.replace(/\.([mc]?)tsx?$/,".$1js");return!e||!e.startsWith("./src/")?e:Ae.includes(i)?`./dist/${t}/${l}`:void 0}return Ut(e,[s])}},_b=(e,t=new Map)=>Rr(e,"esm","import","esm",t),kb=(e,t=new Map)=>Rr(e,"commonjs","require","commonjs",t),Rb=(e,t)=>{if(!e.exports)return O("no exports on tshy config (is there code in ./src?)"),process.exit(1);let s={};for(let[i,r]of Object.entries(e.exports)){if(r!==null&&(typeof r!="string"||!r.startsWith("./src/"))){s[i]=r;continue}if(r===null)continue;let o=_b(r,H),n=kb(r,H);if(!o&&!n)continue;let a=s[i]={};if(o)for(let l of Tb){let h=r&&(H.get(l)?.map.get(r)??r),f=Rr(r,l,l,"esm",H);f&&(a[l]=ii?{...t==="commonjs"?we(h,e):{},default:f}:{...t==="commonjs"?we(h,e):{},types:f.replace(/\.js$/,".d.ts"),default:f})}if(n)for(let l of Ob){let h=r&&(H.get(l)?.map.get(r)??r),f=Rr(r,l,l,"commonjs",H);f&&(a[l]=ii?{...t==="module"?we(h,e):{},default:f}:{...t==="module"?we(h,e):{},types:f.replace(/\.js$/,".d.ts"),default:f})}o&&(a.import=ii?{...t==="module"?we(r,e):{},default:o}:{...t==="module"?we(r,e):{},types:o.replace(/\.(m?)js$/,".d.$1ts"),default:o}),n&&(a.require=ii?{...t==="commonjs"?we(r,e):{},default:n}:{...t==="commonjs"?we(r,e):{},types:n.replace(/\.(c?)js$/,".d.$1ts"),default:n})}return s},we=(e,t)=>{let{sourceDialects:s}=t;return s?Object.fromEntries(s.map(i=>[i,e])):{}},Ab=(e,t)=>{t.type=t.type==="commonjs"?"commonjs":"module";let s=Ut(t.exports["."],["require"]);if(e?.main??!!s){if(!s)return O("could not resolve exports['.'] for tshy.main 'require'"),process.exit(1);let n=Ut(t.exports["."],["require","types"]);t.main=s,n&&n!==s?t.types=n:delete t.types}else e&&e.main!==!1&&delete e.main,delete t.main,delete t.types;let r=Ut(t.exports["."],["import"]);if(e?.module??!!r){if(!r)return O("could not resolve exports['.'] for tshy.module 'import'"),process.exit(1);t.module=r}else e&&e.module!==!1&&delete e.module,delete t.module};_.exports=Rb(k,_.type);Ab(k,_);var gA=_.exports;var wn=e=>{let t="https://github.com/isaacs/tshy",s=E.level>0?`\x1B]8;;${t}\x1B\\${t}\x1B]8;;\x1B\\`:t;console[e?"error":"log"](`Usage: tshy [--help]
|
|
44
44
|
--help -h Print this message and exit.
|
|
45
45
|
--watch -w Watch files in ./src and build when they change.
|
|
46
46
|
|
|
47
47
|
Default behavior: build project according to tshy config in package.json
|
|
48
48
|
|
|
49
|
-
See the docs for more information: ${s}`),e&&_(e),process.exit(e?1:0)};import{spawn as fb}from"child_process";import{stat as Vw}from"fs";import{stat as Jw,readdir as Kw}from"fs/promises";import{EventEmitter as Xw}from"events";import*as x from"path";import{stat as bw,lstat as Cc,readdir as Sw,realpath as vw}from"node:fs/promises";import{Readable as Ew}from"node:stream";import{resolve as Nc,relative as xw,join as Tw,sep as _w}from"node:path";var gt={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Jo={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:gt.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Jo);var Dc="READDIRP_RECURSIVE_ERROR",Ow=new Set(["ENOENT","EPERM","EACCES","ELOOP",Dc]),jc=[gt.DIR_TYPE,gt.EVERYTHING_TYPE,gt.FILE_DIR_TYPE,gt.FILE_TYPE],Aw=new Set([gt.DIR_TYPE,gt.EVERYTHING_TYPE,gt.FILE_DIR_TYPE]),kw=new Set([gt.EVERYTHING_TYPE,gt.FILE_DIR_TYPE,gt.FILE_TYPE]),Rw=e=>Ow.has(e.code),Cw=process.platform==="win32",Pc=e=>!0,Fc=e=>{if(e===void 0)return Pc;if(typeof e=="function")return e;if(typeof e=="string"){let t=e.trim();return s=>s.basename===t}if(Array.isArray(e)){let t=e.map(s=>s.trim());return s=>t.some(i=>s.basename===i)}return Pc},Ko=class extends Ew{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let s={...Jo,...t},{root:i,type:r}=s;this._fileFilter=Fc(s.fileFilter),this._directoryFilter=Fc(s.directoryFilter);let o=s.lstat?Cc:bw;Cw?this._stat=n=>o(n,{bigint:!0}):this._stat=o,this._maxDepth=s.depth??Jo.depth,this._wantsDir=r?Aw.has(r):!1,this._wantsFile=r?kw.has(r):!1,this._wantsEverything=r===gt.EVERYTHING_TYPE,this._root=Nc(i),this._isDirent=!s.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let s=this.parent,i=s&&s.files;if(i&&i.length>0){let{path:r,depth:o}=s,n=i.splice(0,t).map(l=>this._formatEntry(l,r)),a=await Promise.all(n);for(let l of a){if(!l)continue;if(this.destroyed)return;let h=await this._getEntryType(l);h==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),t--)):(h==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(s){this.destroy(s)}finally{this.reading=!1}}}async _exploreDir(t,s){let i;try{i=await Sw(t,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:s,path:t}}async _formatEntry(t,s){let i,r=this._isDirent?t.name:t;try{let o=Nc(Tw(s,r));i={path:xw(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(t){Rw(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let s=t[this._statsProp];if(s.isFile())return"file";if(s.isDirectory())return"directory";if(s&&s.isSymbolicLink()){let i=t.fullPath;try{let r=await vw(i),o=await Cc(r);if(o.isFile())return"file";if(o.isDirectory()){let n=r.length;if(i.startsWith(r)&&i.substr(n,1)===_w){let a=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return a.code=Dc,this._onError(a)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let s=t&&t[this._statsProp];return s&&this._wantsEverything&&!s.isDirectory()}};function Mc(e,t={}){let s=t.entryType||t.type;if(s==="both"&&(s=gt.FILE_DIR_TYPE),s&&(t.type=s),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(s&&!jc.includes(s))throw new Error(`readdirp: Invalid type passed. Use one of ${jc.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=e,new Ko(t)}import{watchFile as Nw,unwatchFile as $c,watch as jw}from"fs";import{open as Pw,stat as Ic,lstat as Fw,realpath as Xo}from"fs/promises";import*as N from"path";import{type as Dw}from"os";var Mw="data",tn="end",Wc="close",vr=()=>{};var Er=process.platform,en=Er==="win32",$w=Er==="darwin",Lw=Er==="linux",Iw=Er==="freebsd",zc=Dw()==="OS400",P={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},Mt=P,Ww="watch",zw={lstat:Fw,stat:Ic},Oe="listeners",yr="errHandlers",ts="rawEmitters",Uw=[Oe,yr,ts],Bw=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Gw=e=>Bw.has(N.extname(e).slice(1).toLowerCase()),Qo=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},Vs=(e,t,s)=>{let i=e[t];i instanceof Set||(e[t]=i=new Set([i])),i.add(s)},Hw=e=>t=>{let s=e[t];s instanceof Set?s.clear():delete e[t]},Js=(e,t,s)=>{let i=e[t];i instanceof Set?i.delete(s):i===s&&delete e[t]},Uc=e=>e instanceof Set?e.size===0:!e,wr=new Map;function Lc(e,t,s,i,r){let o=(n,a)=>{s(e),r(n,a,{watchedPath:e}),a&&e!==a&&br(N.resolve(e,a),Oe,N.join(e,a))};try{return jw(e,{persistent:t.persistent},o)}catch(n){i(n);return}}var br=(e,t,s,i,r)=>{let o=wr.get(e);o&&Qo(o[t],n=>{n(s,i,r)})},Yw=(e,t,s,i)=>{let{listener:r,errHandler:o,rawEmitter:n}=i,a=wr.get(t),l;if(!s.persistent)return l=Lc(e,s,r,o,n),l?l.close.bind(l):void 0;if(a)Vs(a,Oe,r),Vs(a,yr,o),Vs(a,ts,n);else{if(l=Lc(e,s,br.bind(null,t,Oe),o,br.bind(null,t,ts)),!l)return;l.on(Mt.ERROR,async h=>{let f=br.bind(null,t,yr);if(a&&(a.watcherUnusable=!0),en&&h.code==="EPERM")try{await(await Pw(e,"r")).close(),f(h)}catch{}else f(h)}),a={listeners:r,errHandlers:o,rawEmitters:n,watcher:l},wr.set(t,a)}return()=>{Js(a,Oe,r),Js(a,yr,o),Js(a,ts,n),Uc(a.listeners)&&(a.watcher.close(),wr.delete(t),Uw.forEach(Hw(a)),a.watcher=void 0,Object.freeze(a))}},Zo=new Map,qw=(e,t,s,i)=>{let{listener:r,rawEmitter:o}=i,n=Zo.get(t),a=n&&n.options;return a&&(a.persistent<s.persistent||a.interval>s.interval)&&($c(t),n=void 0),n?(Vs(n,Oe,r),Vs(n,ts,o)):(n={listeners:r,rawEmitters:o,options:s,watcher:Nw(t,s,(l,h)=>{Qo(n.rawEmitters,c=>{c(Mt.CHANGE,t,{curr:l,prev:h})});let f=l.mtimeMs;(l.size!==h.size||f>h.mtimeMs||f===0)&&Qo(n.listeners,c=>c(e,l))})},Zo.set(t,n)),()=>{Js(n,Oe,r),Js(n,ts,o),Uc(n.listeners)&&(Zo.delete(t),$c(t),n.options=n.watcher=void 0,Object.freeze(n))}},Sr=class{constructor(t){this.fsw=t,this._boundHandleError=s=>t._handleError(s)}_watchWithNodeFs(t,s){let i=this.fsw.options,r=N.dirname(t),o=N.basename(t);this.fsw._getWatchedDir(r).add(o);let a=N.resolve(t),l={persistent:i.persistent};s||(s=vr);let h;if(i.usePolling){let f=i.interval!==i.binaryInterval;l.interval=f&&Gw(o)?i.binaryInterval:i.interval,h=qw(t,a,l,{listener:s,rawEmitter:this.fsw._emitRaw})}else h=Yw(t,a,l,{listener:s,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return h}_handleFile(t,s,i){if(this.fsw.closed)return;let r=N.dirname(t),o=N.basename(t),n=this.fsw._getWatchedDir(r),a=s;if(n.has(o))return;let l=async(f,c)=>{if(this.fsw._throttle(Ww,t,5)){if(!c||c.mtimeMs===0)try{let u=await Ic(t);if(this.fsw.closed)return;let p=u.atimeMs,d=u.mtimeMs;if((!p||p<=d||d!==a.mtimeMs)&&this.fsw._emit(Mt.CHANGE,t,u),($w||Lw||Iw)&&a.ino!==u.ino){this.fsw._closeFile(f),a=u;let m=this._watchWithNodeFs(t,l);m&&this.fsw._addPathCloser(f,m)}else a=u}catch{this.fsw._remove(r,o)}else if(n.has(o)){let u=c.atimeMs,p=c.mtimeMs;(!u||u<=p||p!==a.mtimeMs)&&this.fsw._emit(Mt.CHANGE,t,c),a=c}}},h=this._watchWithNodeFs(t,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(Mt.ADD,t,0))return;this.fsw._emit(Mt.ADD,t,s)}return h}async _handleSymlink(t,s,i,r){if(this.fsw.closed)return;let o=t.fullPath,n=this.fsw._getWatchedDir(s);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await Xo(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(n.has(r)?this.fsw._symlinkPaths.get(o)!==a&&(this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Mt.CHANGE,i,t.stats)):(n.add(r),this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Mt.ADD,i,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(t,s,i,r,o,n,a){if(t=N.join(t,""),a=this.fsw._throttle("readdir",t,1e3),!a)return;let l=this.fsw._getWatchedDir(i.path),h=new Set,f=this.fsw._readdirp(t,{fileFilter:c=>i.filterPath(c),directoryFilter:c=>i.filterDir(c)});if(f)return f.on(Mw,async c=>{if(this.fsw.closed){f=void 0;return}let u=c.path,p=N.join(t,u);if(h.add(u),!(c.stats.isSymbolicLink()&&await this._handleSymlink(c,t,p,u))){if(this.fsw.closed){f=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),p=N.join(o,N.relative(o,p)),this._addToNodeFs(p,s,i,n+1))}}).on(Mt.ERROR,this._boundHandleError),new Promise((c,u)=>{if(!f)return u();f.once(tn,()=>{if(this.fsw.closed){f=void 0;return}let p=a?a.clear():!1;c(void 0),l.getChildren().filter(d=>d!==t&&!h.has(d)).forEach(d=>{this.fsw._remove(t,d)}),f=void 0,p&&this._handleRead(t,!1,i,r,o,n,a)})})}async _handleDir(t,s,i,r,o,n,a){let l=this.fsw._getWatchedDir(N.dirname(t)),h=l.has(N.basename(t));!(i&&this.fsw.options.ignoreInitial)&&!o&&!h&&this.fsw._emit(Mt.ADD_DIR,t,s),l.add(N.basename(t)),this.fsw._getWatchedDir(t);let f,c,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(a)){if(!o&&(await this._handleRead(t,i,n,o,t,r,f),this.fsw.closed))return;c=this._watchWithNodeFs(t,(p,d)=>{d&&d.mtimeMs===0||this._handleRead(p,!1,n,o,t,r,f)})}return c}async _addToNodeFs(t,s,i,r,o){let n=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return n(),!1;let a=this.fsw._getWatchHelpers(t);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await zw[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return n(),!1;let h=this.fsw.options.followSymlinks,f;if(l.isDirectory()){let c=N.resolve(t),u=h?await Xo(t):t;if(this.fsw.closed||(f=await this._handleDir(a.watchPath,l,s,r,o,a,u),this.fsw.closed))return;c!==u&&u!==void 0&&this.fsw._symlinkPaths.set(c,u)}else if(l.isSymbolicLink()){let c=h?await Xo(t):t;if(this.fsw.closed)return;let u=N.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(Mt.ADD,a.watchPath,l),f=await this._handleDir(u,l,s,r,t,a,c),this.fsw.closed)return;c!==void 0&&this.fsw._symlinkPaths.set(N.resolve(t),c)}else f=this._handleFile(a.watchPath,l,s);return n(),f&&this.fsw._addPathCloser(t,f),!1}catch(l){if(this.fsw._handleError(l))return n(),t}}};var sn="/",Zw="//",Vc=".",Qw="..",tb="string",eb=/\\/g,Bc=/\/\//,sb=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ib=/^\.[/\\]/;function xr(e){return Array.isArray(e)?e:[e]}var rn=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);function rb(e){return typeof e=="function"?e:typeof e=="string"?t=>e===t:e instanceof RegExp?t=>e.test(t):typeof e=="object"&&e!==null?t=>{if(e.path===t)return!0;if(e.recursive){let s=x.relative(e.path,t);return s?!s.startsWith("..")&&!x.isAbsolute(s):!1}return!1}:()=>!1}function ob(e){if(typeof e!="string")throw new Error("string expected");e=x.normalize(e),e=e.replace(/\\/g,"/");let t=!1;e.startsWith("//")&&(t=!0);let s=/\/\//;for(;e.match(s);)e=e.replace(s,"/");return t&&(e="/"+e),e}function Gc(e,t,s){let i=ob(t);for(let r=0;r<e.length;r++){let o=e[r];if(o(i,s))return!0}return!1}function nb(e,t){if(e==null)throw new TypeError("anymatch: specify first argument");let i=xr(e).map(r=>rb(r));return t==null?(r,o)=>Gc(i,r,o):Gc(i,t)}var Hc=e=>{let t=xr(e).flat();if(!t.every(s=>typeof s===tb))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(Jc)},Yc=e=>{let t=e.replace(eb,sn),s=!1;for(t.startsWith(Zw)&&(s=!0);t.match(Bc);)t=t.replace(Bc,sn);return s&&(t=sn+t),t},Jc=e=>Yc(x.normalize(Yc(e))),qc=(e="")=>t=>typeof t=="string"?Jc(x.isAbsolute(t)?t:x.join(e,t)):t,ab=(e,t)=>x.isAbsolute(e)?e:x.join(t,e),lb=Object.freeze(new Set),on=class{constructor(t,s){this.path=t,this._removeWatcher=s,this.items=new Set}add(t){let{items:s}=this;s&&t!==Vc&&t!==Qw&&s.add(t)}async remove(t){let{items:s}=this;if(!s||(s.delete(t),s.size>0))return;let i=this.path;try{await Kw(i)}catch{this._removeWatcher&&this._removeWatcher(x.dirname(i),x.basename(i))}}has(t){let{items:s}=this;if(s)return s.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=vr,this.items=lb,Object.freeze(this)}},hb="stat",cb="lstat",nn=class{constructor(t,s,i){this.fsw=i;let r=t;this.path=t=t.replace(ib,""),this.watchPath=r,this.fullWatchPath=x.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=s,this.statMethod=s?hb:cb}entryPath(t){return x.join(this.watchPath,x.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:s}=t;if(s&&s.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,s)&&this.fsw._hasReadPermissions(s)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},an=class extends Xw{constructor(t={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let s=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?xr(t.ignored):xr([]),awaitWriteFinish:s===!0?i:typeof s=="object"?{...i,...s}:!1};zc&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let n=process.env.CHOKIDAR_INTERVAL;n&&(r.interval=Number.parseInt(n,10));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=vr,this._readyEmitted=!0,process.nextTick(()=>this.emit(P.READY)))},this._emitRaw=(...l)=>this.emit(P.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new Sr(this),Object.freeze(r)}_addIgnoredPath(t){if(rn(t)){for(let s of this._ignoredPaths)if(rn(s)&&s.path===t.path&&s.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let s of this._ignoredPaths)rn(s)&&s.path===t&&this._ignoredPaths.delete(s)}add(t,s,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Hc(t);return r&&(o=o.map(n=>ab(n,r))),o.forEach(n=>{this._removeIgnoredPath(n)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async n=>{let a=await this._nodeFsHandler._addToNodeFs(n,!i,void 0,0,s);return a&&this._emitReady(),a})).then(n=>{this.closed||n.forEach(a=>{a&&this.add(x.dirname(a),x.basename(s||a))})}),this}unwatch(t){if(this.closed)return this;let s=Hc(t),{cwd:i}=this.options;return s.forEach(r=>{!x.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=x.join(i,r)),r=x.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(s=>s.forEach(i=>{let r=i();r instanceof Promise&&t.push(r)})),this._streams.forEach(s=>s.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(s=>s.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((s,i)=>{let o=(this.options.cwd?x.relative(this.options.cwd,i):i)||Vc;t[o]=s.getChildren().sort()}),t}emitWithAll(t,s){this.emit(t,...s),t!==P.ERROR&&this.emit(P.ALL,t,...s)}async _emit(t,s,i){if(this.closed)return;let r=this.options;en&&(s=x.normalize(s)),r.cwd&&(s=x.relative(r.cwd,s));let o=[s];i!=null&&o.push(i);let n=r.awaitWriteFinish,a;if(n&&(a=this._pendingWrites.get(s)))return a.lastChange=new Date,this;if(r.atomic){if(t===P.UNLINK)return this._pendingUnlinks.set(s,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,h)=>{this.emit(...l),this.emit(P.ALL,...l),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===P.ADD&&this._pendingUnlinks.has(s)&&(t=P.CHANGE,this._pendingUnlinks.delete(s))}if(n&&(t===P.ADD||t===P.CHANGE)&&this._readyEmitted){let l=(h,f)=>{h?(t=P.ERROR,o[0]=h,this.emitWithAll(t,o)):f&&(o.length>1?o[1]=f:o.push(f),this.emitWithAll(t,o))};return this._awaitWriteFinish(s,n.stabilityThreshold,t,l),this}if(t===P.CHANGE&&!this._throttle(P.CHANGE,s,50))return this;if(r.alwaysStat&&i===void 0&&(t===P.ADD||t===P.ADD_DIR||t===P.CHANGE)){let l=r.cwd?x.join(r.cwd,s):s,h;try{h=await Jw(l)}catch{}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let s=t&&t.code;return t&&s!=="ENOENT"&&s!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||s!=="EPERM"&&s!=="EACCES")&&this.emit(P.ERROR,t),t||this.closed}_throttle(t,s,i){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(s);if(o)return o.count++,!1;let n,a=()=>{let h=r.get(s),f=h?h.count:0;return r.delete(s),clearTimeout(n),h&&clearTimeout(h.timeoutObject),f};n=setTimeout(a,i);let l={timeoutObject:n,clear:a,count:0};return r.set(s,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,s,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let n=o.pollInterval,a,l=t;this.options.cwd&&!x.isAbsolute(t)&&(l=x.join(this.options.cwd,t));let h=new Date,f=this._pendingWrites;function c(u){Vw(l,(p,d)=>{if(p||!f.has(t)){p&&p.code!=="ENOENT"&&r(p);return}let m=Number(new Date);u&&d.size!==u.size&&(f.get(t).lastChange=m);let y=f.get(t);m-y.lastChange>=s?(f.delete(t),r(void 0,d)):a=setTimeout(c,n,d)})}f.has(t)||(f.set(t,{lastChange:h,cancelWait:()=>(f.delete(t),clearTimeout(a),i)}),a=setTimeout(c,n))}_isIgnored(t,s){if(this.options.atomic&&sb.test(t))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(qc(i)),a=[...[...this._ignoredPaths].map(qc(i)),...o];this._userIgnored=nb(a,void 0)}return this._userIgnored(t,s)}_isntIgnored(t,s){return!this._isIgnored(t,s)}_getWatchHelpers(t){return new nn(t,this.options.followSymlinks,this)}_getWatchedDir(t){let s=x.resolve(t);return this._watched.has(s)||this._watched.set(s,new on(s,this._boundRemove)),this._watched.get(s)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,s,i){let r=x.join(t,s),o=x.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(t,s,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(t),h=l.has(s);l.remove(s),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let f=r;if(this.options.cwd&&(f=x.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(f)&&this._pendingWrites.get(f).cancelWait()===P.ADD)return;this._watched.delete(r),this._watched.delete(o);let c=i?P.UNLINK_DIR:P.UNLINK;h&&!this._isIgnored(r)&&this._emit(c,r),this._closePath(r)}_closePath(t){this._closeFile(t);let s=x.dirname(t);this._getWatchedDir(s).remove(x.basename(t))}_closeFile(t){let s=this._closers.get(t);s&&(s.forEach(i=>i()),this._closers.delete(t))}_addPathCloser(t,s){if(!s)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(s)}_readdirp(t,s){if(this.closed)return;let i={type:P.ALL,alwaysStat:!0,lstat:!0,...s,depth:0},r=Mc(t,i);return this._streams.add(r),r.once(Wc,()=>{r=void 0}),r.once(tn,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};function Kc(e,t={}){let s=new an(t);return s.add(e),s}import{readFileSync as ub}from"fs";import{resolve as es,sep as pb}from"path";import{fileURLToPath as db}from"url";var Xc=()=>{try{return JSON.stringify(JSON.parse(ub("./package.json","utf8")))}catch{return"null"}},ln="null",mb={persistent:!0,ignoreInitial:!0,ignorePermissionErrors:!0,ignored:e=>{let t=es(e);return!!(t===Qc||t===Zc||t.startsWith(Zc+pb))}},Qc=es("./src/package.json"),Zc=es("./src/node_modules"),tf=es("./src"),hn=es("./package.json"),gb=[tf,hn],yb=db(new URL("./index.js",import.meta.url)),ef=()=>{let e=!1,t=!1,s=Kc(gb,mb),i=()=>{e=!0,t=!1,fb(process.execPath,[yb],{stdio:"inherit"}).on("close",(o,n)=>{o||n?(L(E.red("build failure"),{code:o,signal:n}),Ce()):console.log(E.green("build success"),{code:o,signal:n}),t?i():e=!1})};s.on("all",(r,o)=>{if(r==="addDir"&&o===tf)return;let n=es(o);if(n!==Qc){if(n===hn){let a=Xc();if(a===ln)return;ln=a}if(e){n!==hn&&(t=!0);return}T(E.cyan.dim(r),o),i()}}),ln=Xc(),i()};var{exports:wb,tshy:bb}=O,Sb=async()=>{for(let e of process.argv.slice(2))switch(e){case"--help":case"-h":return Vo();case"--watch":case"-w":return ef();default:return Vo(`Unknown argument: ${e}`)}T(E.yellow.bold("building"),process.cwd()),T(E.cyan.dim("tshy config"),bb),T(E.cyan.dim("exports"),wb),await kc(),Wn(E.bold.green("success!"))};await Sb();
|
|
49
|
+
See the docs for more information: ${s}`),e&&O(e),process.exit(e?1:0)};import{spawn as E0}from"child_process";import{stat as o0}from"fs";import{stat as n0,readdir as a0}from"fs/promises";import{EventEmitter as l0}from"events";import*as x from"path";import{stat as Cb,lstat as ef,readdir as Pb,realpath as jb}from"node:fs/promises";import{Readable as Nb}from"node:stream";import{resolve as sf,relative as Fb,join as Db,sep as Mb}from"node:path";var wt={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},bn={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:wt.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(bn);var af="READDIRP_RECURSIVE_ERROR",Lb=new Set(["ENOENT","EPERM","EACCES","ELOOP",af]),rf=[wt.DIR_TYPE,wt.EVERYTHING_TYPE,wt.FILE_DIR_TYPE,wt.FILE_TYPE],$b=new Set([wt.DIR_TYPE,wt.EVERYTHING_TYPE,wt.FILE_DIR_TYPE]),Ib=new Set([wt.EVERYTHING_TYPE,wt.FILE_DIR_TYPE,wt.FILE_TYPE]),Wb=e=>Lb.has(e.code),Ub=process.platform==="win32",of=e=>!0,nf=e=>{if(e===void 0)return of;if(typeof e=="function")return e;if(typeof e=="string"){let t=e.trim();return s=>s.basename===t}if(Array.isArray(e)){let t=e.map(s=>s.trim());return s=>t.some(i=>s.basename===i)}return of},Sn=class extends Nb{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});let s={...bn,...t},{root:i,type:r}=s;this._fileFilter=nf(s.fileFilter),this._directoryFilter=nf(s.directoryFilter);let o=s.lstat?ef:Cb;Ub?this._stat=n=>o(n,{bigint:!0}):this._stat=o,this._maxDepth=s.depth??bn.depth,this._wantsDir=r?$b.has(r):!1,this._wantsFile=r?Ib.has(r):!1,this._wantsEverything=r===wt.EVERYTHING_TYPE,this._root=sf(i),this._isDirent=!s.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let s=this.parent,i=s&&s.files;if(i&&i.length>0){let{path:r,depth:o}=s,n=i.splice(0,t).map(l=>this._formatEntry(l,r)),a=await Promise.all(n);for(let l of a){if(!l)continue;if(this.destroyed)return;let h=await this._getEntryType(l);h==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),t--)):(h==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(s){this.destroy(s)}finally{this.reading=!1}}}async _exploreDir(t,s){let i;try{i=await Pb(t,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:s,path:t}}async _formatEntry(t,s){let i,r=this._isDirent?t.name:t;try{let o=sf(Db(s,r));i={path:Fb(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(t){Wb(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let s=t[this._statsProp];if(s.isFile())return"file";if(s.isDirectory())return"directory";if(s&&s.isSymbolicLink()){let i=t.fullPath;try{let r=await jb(i),o=await ef(r);if(o.isFile())return"file";if(o.isDirectory()){let n=r.length;if(i.startsWith(r)&&i.substr(n,1)===Mb){let a=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return a.code=af,this._onError(a)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let s=t&&t[this._statsProp];return s&&this._wantsEverything&&!s.isDirectory()}};function lf(e,t={}){let s=t.entryType||t.type;if(s==="both"&&(s=wt.FILE_DIR_TYPE),s&&(t.type=s),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(s&&!rf.includes(s))throw new Error(`readdirp: Invalid type passed. Use one of ${rf.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return t.root=e,new Sn(t)}import{watchFile as zb,unwatchFile as hf,watch as Bb}from"fs";import{open as Gb,stat as ff,lstat as Hb,realpath as vn}from"fs/promises";import*as P from"path";import{type as Yb}from"os";var qb="data",Tn="end",uf="close",Nr=()=>{};var Fr=process.platform,On=Fr==="win32",Vb=Fr==="darwin",Jb=Fr==="linux",Kb=Fr==="freebsd",pf=Yb()==="OS400",N={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},Wt=N,Xb="watch",Zb={lstat:Hb,stat:ff},je="listeners",Ar="errHandlers",hs="rawEmitters",Qb=[je,Ar,hs],t0=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),e0=e=>t0.has(P.extname(e).slice(1).toLowerCase()),xn=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},ri=(e,t,s)=>{let i=e[t];i instanceof Set||(e[t]=i=new Set([i])),i.add(s)},s0=e=>t=>{let s=e[t];s instanceof Set?s.clear():delete e[t]},oi=(e,t,s)=>{let i=e[t];i instanceof Set?i.delete(s):i===s&&delete e[t]},df=e=>e instanceof Set?e.size===0:!e,Cr=new Map;function cf(e,t,s,i,r){let o=(n,a)=>{s(e),r(n,a,{watchedPath:e}),a&&e!==a&&Pr(P.resolve(e,a),je,P.join(e,a))};try{return Bb(e,{persistent:t.persistent},o)}catch(n){i(n);return}}var Pr=(e,t,s,i,r)=>{let o=Cr.get(e);o&&xn(o[t],n=>{n(s,i,r)})},i0=(e,t,s,i)=>{let{listener:r,errHandler:o,rawEmitter:n}=i,a=Cr.get(t),l;if(!s.persistent)return l=cf(e,s,r,o,n),l?l.close.bind(l):void 0;if(a)ri(a,je,r),ri(a,Ar,o),ri(a,hs,n);else{if(l=cf(e,s,Pr.bind(null,t,je),o,Pr.bind(null,t,hs)),!l)return;l.on(Wt.ERROR,async h=>{let f=Pr.bind(null,t,Ar);if(a&&(a.watcherUnusable=!0),On&&h.code==="EPERM")try{await(await Gb(e,"r")).close(),f(h)}catch{}else f(h)}),a={listeners:r,errHandlers:o,rawEmitters:n,watcher:l},Cr.set(t,a)}return()=>{oi(a,je,r),oi(a,Ar,o),oi(a,hs,n),df(a.listeners)&&(a.watcher.close(),Cr.delete(t),Qb.forEach(s0(a)),a.watcher=void 0,Object.freeze(a))}},En=new Map,r0=(e,t,s,i)=>{let{listener:r,rawEmitter:o}=i,n=En.get(t),a=n&&n.options;return a&&(a.persistent<s.persistent||a.interval>s.interval)&&(hf(t),n=void 0),n?(ri(n,je,r),ri(n,hs,o)):(n={listeners:r,rawEmitters:o,options:s,watcher:zb(t,s,(l,h)=>{xn(n.rawEmitters,c=>{c(Wt.CHANGE,t,{curr:l,prev:h})});let f=l.mtimeMs;(l.size!==h.size||f>h.mtimeMs||f===0)&&xn(n.listeners,c=>c(e,l))})},En.set(t,n)),()=>{oi(n,je,r),oi(n,hs,o),df(n.listeners)&&(En.delete(t),hf(t),n.options=n.watcher=void 0,Object.freeze(n))}},jr=class{constructor(t){this.fsw=t,this._boundHandleError=s=>t._handleError(s)}_watchWithNodeFs(t,s){let i=this.fsw.options,r=P.dirname(t),o=P.basename(t);this.fsw._getWatchedDir(r).add(o);let a=P.resolve(t),l={persistent:i.persistent};s||(s=Nr);let h;if(i.usePolling){let f=i.interval!==i.binaryInterval;l.interval=f&&e0(o)?i.binaryInterval:i.interval,h=r0(t,a,l,{listener:s,rawEmitter:this.fsw._emitRaw})}else h=i0(t,a,l,{listener:s,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return h}_handleFile(t,s,i){if(this.fsw.closed)return;let r=P.dirname(t),o=P.basename(t),n=this.fsw._getWatchedDir(r),a=s;if(n.has(o))return;let l=async(f,c)=>{if(this.fsw._throttle(Xb,t,5)){if(!c||c.mtimeMs===0)try{let u=await ff(t);if(this.fsw.closed)return;let p=u.atimeMs,d=u.mtimeMs;if((!p||p<=d||d!==a.mtimeMs)&&this.fsw._emit(Wt.CHANGE,t,u),(Vb||Jb||Kb)&&a.ino!==u.ino){this.fsw._closeFile(f),a=u;let m=this._watchWithNodeFs(t,l);m&&this.fsw._addPathCloser(f,m)}else a=u}catch{this.fsw._remove(r,o)}else if(n.has(o)){let u=c.atimeMs,p=c.mtimeMs;(!u||u<=p||p!==a.mtimeMs)&&this.fsw._emit(Wt.CHANGE,t,c),a=c}}},h=this._watchWithNodeFs(t,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(Wt.ADD,t,0))return;this.fsw._emit(Wt.ADD,t,s)}return h}async _handleSymlink(t,s,i,r){if(this.fsw.closed)return;let o=t.fullPath,n=this.fsw._getWatchedDir(s);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await vn(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(n.has(r)?this.fsw._symlinkPaths.get(o)!==a&&(this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Wt.CHANGE,i,t.stats)):(n.add(r),this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Wt.ADD,i,t.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(t,s,i,r,o,n,a){if(t=P.join(t,""),a=this.fsw._throttle("readdir",t,1e3),!a)return;let l=this.fsw._getWatchedDir(i.path),h=new Set,f=this.fsw._readdirp(t,{fileFilter:c=>i.filterPath(c),directoryFilter:c=>i.filterDir(c)});if(f)return f.on(qb,async c=>{if(this.fsw.closed){f=void 0;return}let u=c.path,p=P.join(t,u);if(h.add(u),!(c.stats.isSymbolicLink()&&await this._handleSymlink(c,t,p,u))){if(this.fsw.closed){f=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),p=P.join(o,P.relative(o,p)),this._addToNodeFs(p,s,i,n+1))}}).on(Wt.ERROR,this._boundHandleError),new Promise((c,u)=>{if(!f)return u();f.once(Tn,()=>{if(this.fsw.closed){f=void 0;return}let p=a?a.clear():!1;c(void 0),l.getChildren().filter(d=>d!==t&&!h.has(d)).forEach(d=>{this.fsw._remove(t,d)}),f=void 0,p&&this._handleRead(t,!1,i,r,o,n,a)})})}async _handleDir(t,s,i,r,o,n,a){let l=this.fsw._getWatchedDir(P.dirname(t)),h=l.has(P.basename(t));!(i&&this.fsw.options.ignoreInitial)&&!o&&!h&&this.fsw._emit(Wt.ADD_DIR,t,s),l.add(P.basename(t)),this.fsw._getWatchedDir(t);let f,c,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(a)){if(!o&&(await this._handleRead(t,i,n,o,t,r,f),this.fsw.closed))return;c=this._watchWithNodeFs(t,(p,d)=>{d&&d.mtimeMs===0||this._handleRead(p,!1,n,o,t,r,f)})}return c}async _addToNodeFs(t,s,i,r,o){let n=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return n(),!1;let a=this.fsw._getWatchHelpers(t);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await Zb[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return n(),!1;let h=this.fsw.options.followSymlinks,f;if(l.isDirectory()){let c=P.resolve(t),u=h?await vn(t):t;if(this.fsw.closed||(f=await this._handleDir(a.watchPath,l,s,r,o,a,u),this.fsw.closed))return;c!==u&&u!==void 0&&this.fsw._symlinkPaths.set(c,u)}else if(l.isSymbolicLink()){let c=h?await vn(t):t;if(this.fsw.closed)return;let u=P.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(Wt.ADD,a.watchPath,l),f=await this._handleDir(u,l,s,r,t,a,c),this.fsw.closed)return;c!==void 0&&this.fsw._symlinkPaths.set(P.resolve(t),c)}else f=this._handleFile(a.watchPath,l,s);return n(),f&&this.fsw._addPathCloser(t,f),!1}catch(l){if(this.fsw._handleError(l))return n(),t}}};var _n="/",h0="//",Sf=".",c0="..",f0="string",u0=/\\/g,mf=/\/\//,p0=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,d0=/^\.[/\\]/;function Dr(e){return Array.isArray(e)?e:[e]}var kn=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);function m0(e){return typeof e=="function"?e:typeof e=="string"?t=>e===t:e instanceof RegExp?t=>e.test(t):typeof e=="object"&&e!==null?t=>{if(e.path===t)return!0;if(e.recursive){let s=x.relative(e.path,t);return s?!s.startsWith("..")&&!x.isAbsolute(s):!1}return!1}:()=>!1}function g0(e){if(typeof e!="string")throw new Error("string expected");e=x.normalize(e),e=e.replace(/\\/g,"/");let t=!1;e.startsWith("//")&&(t=!0);let s=/\/\//;for(;e.match(s);)e=e.replace(s,"/");return t&&(e="/"+e),e}function gf(e,t,s){let i=g0(t);for(let r=0;r<e.length;r++){let o=e[r];if(o(i,s))return!0}return!1}function y0(e,t){if(e==null)throw new TypeError("anymatch: specify first argument");let i=Dr(e).map(r=>m0(r));return t==null?(r,o)=>gf(i,r,o):gf(i,t)}var yf=e=>{let t=Dr(e).flat();if(!t.every(s=>typeof s===f0))throw new TypeError(`Non-string provided as watch path: ${t}`);return t.map(vf)},wf=e=>{let t=e.replace(u0,_n),s=!1;for(t.startsWith(h0)&&(s=!0);t.match(mf);)t=t.replace(mf,_n);return s&&(t=_n+t),t},vf=e=>wf(x.normalize(wf(e))),bf=(e="")=>t=>typeof t=="string"?vf(x.isAbsolute(t)?t:x.join(e,t)):t,w0=(e,t)=>x.isAbsolute(e)?e:x.join(t,e),b0=Object.freeze(new Set),Rn=class{constructor(t,s){this.path=t,this._removeWatcher=s,this.items=new Set}add(t){let{items:s}=this;s&&t!==Sf&&t!==c0&&s.add(t)}async remove(t){let{items:s}=this;if(!s||(s.delete(t),s.size>0))return;let i=this.path;try{await a0(i)}catch{this._removeWatcher&&this._removeWatcher(x.dirname(i),x.basename(i))}}has(t){let{items:s}=this;if(s)return s.has(t)}getChildren(){let{items:t}=this;return t?[...t.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=Nr,this.items=b0,Object.freeze(this)}},S0="stat",v0="lstat",An=class{constructor(t,s,i){this.fsw=i;let r=t;this.path=t=t.replace(d0,""),this.watchPath=r,this.fullWatchPath=x.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=s,this.statMethod=s?S0:v0}entryPath(t){return x.join(this.watchPath,x.relative(this.watchPath,t.fullPath))}filterPath(t){let{stats:s}=t;if(s&&s.isSymbolicLink())return this.filterDir(t);let i=this.entryPath(t);return this.fsw._isntIgnored(i,s)&&this.fsw._hasReadPermissions(s)}filterDir(t){return this.fsw._isntIgnored(this.entryPath(t),t.stats)}},Cn=class extends l0{constructor(t={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let s=t.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...t,ignored:t.ignored?Dr(t.ignored):Dr([]),awaitWriteFinish:s===!0?i:typeof s=="object"?{...i,...s}:!1};pf&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let n=process.env.CHOKIDAR_INTERVAL;n&&(r.interval=Number.parseInt(n,10));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=Nr,this._readyEmitted=!0,process.nextTick(()=>this.emit(N.READY)))},this._emitRaw=(...l)=>this.emit(N.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new jr(this),Object.freeze(r)}_addIgnoredPath(t){if(kn(t)){for(let s of this._ignoredPaths)if(kn(s)&&s.path===t.path&&s.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let s of this._ignoredPaths)kn(s)&&s.path===t&&this._ignoredPaths.delete(s)}add(t,s,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=yf(t);return r&&(o=o.map(n=>w0(n,r))),o.forEach(n=>{this._removeIgnoredPath(n)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async n=>{let a=await this._nodeFsHandler._addToNodeFs(n,!i,void 0,0,s);return a&&this._emitReady(),a})).then(n=>{this.closed||n.forEach(a=>{a&&this.add(x.dirname(a),x.basename(s||a))})}),this}unwatch(t){if(this.closed)return this;let s=yf(t),{cwd:i}=this.options;return s.forEach(r=>{!x.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=x.join(i,r)),r=x.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(s=>s.forEach(i=>{let r=i();r instanceof Promise&&t.push(r)})),this._streams.forEach(s=>s.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(s=>s.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((s,i)=>{let o=(this.options.cwd?x.relative(this.options.cwd,i):i)||Sf;t[o]=s.getChildren().sort()}),t}emitWithAll(t,s){this.emit(t,...s),t!==N.ERROR&&this.emit(N.ALL,t,...s)}async _emit(t,s,i){if(this.closed)return;let r=this.options;On&&(s=x.normalize(s)),r.cwd&&(s=x.relative(r.cwd,s));let o=[s];i!=null&&o.push(i);let n=r.awaitWriteFinish,a;if(n&&(a=this._pendingWrites.get(s)))return a.lastChange=new Date,this;if(r.atomic){if(t===N.UNLINK)return this._pendingUnlinks.set(s,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,h)=>{this.emit(...l),this.emit(N.ALL,...l),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===N.ADD&&this._pendingUnlinks.has(s)&&(t=N.CHANGE,this._pendingUnlinks.delete(s))}if(n&&(t===N.ADD||t===N.CHANGE)&&this._readyEmitted){let l=(h,f)=>{h?(t=N.ERROR,o[0]=h,this.emitWithAll(t,o)):f&&(o.length>1?o[1]=f:o.push(f),this.emitWithAll(t,o))};return this._awaitWriteFinish(s,n.stabilityThreshold,t,l),this}if(t===N.CHANGE&&!this._throttle(N.CHANGE,s,50))return this;if(r.alwaysStat&&i===void 0&&(t===N.ADD||t===N.ADD_DIR||t===N.CHANGE)){let l=r.cwd?x.join(r.cwd,s):s,h;try{h=await n0(l)}catch{}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let s=t&&t.code;return t&&s!=="ENOENT"&&s!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||s!=="EPERM"&&s!=="EACCES")&&this.emit(N.ERROR,t),t||this.closed}_throttle(t,s,i){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(s);if(o)return o.count++,!1;let n,a=()=>{let h=r.get(s),f=h?h.count:0;return r.delete(s),clearTimeout(n),h&&clearTimeout(h.timeoutObject),f};n=setTimeout(a,i);let l={timeoutObject:n,clear:a,count:0};return r.set(s,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,s,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let n=o.pollInterval,a,l=t;this.options.cwd&&!x.isAbsolute(t)&&(l=x.join(this.options.cwd,t));let h=new Date,f=this._pendingWrites;function c(u){o0(l,(p,d)=>{if(p||!f.has(t)){p&&p.code!=="ENOENT"&&r(p);return}let m=Number(new Date);u&&d.size!==u.size&&(f.get(t).lastChange=m);let y=f.get(t);m-y.lastChange>=s?(f.delete(t),r(void 0,d)):a=setTimeout(c,n,d)})}f.has(t)||(f.set(t,{lastChange:h,cancelWait:()=>(f.delete(t),clearTimeout(a),i)}),a=setTimeout(c,n))}_isIgnored(t,s){if(this.options.atomic&&p0.test(t))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(bf(i)),a=[...[...this._ignoredPaths].map(bf(i)),...o];this._userIgnored=y0(a,void 0)}return this._userIgnored(t,s)}_isntIgnored(t,s){return!this._isIgnored(t,s)}_getWatchHelpers(t){return new An(t,this.options.followSymlinks,this)}_getWatchedDir(t){let s=x.resolve(t);return this._watched.has(s)||this._watched.set(s,new Rn(s,this._boundRemove)),this._watched.get(s)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,s,i){let r=x.join(t,s),o=x.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(t,s,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(t),h=l.has(s);l.remove(s),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let f=r;if(this.options.cwd&&(f=x.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(f)&&this._pendingWrites.get(f).cancelWait()===N.ADD)return;this._watched.delete(r),this._watched.delete(o);let c=i?N.UNLINK_DIR:N.UNLINK;h&&!this._isIgnored(r)&&this._emit(c,r),this._closePath(r)}_closePath(t){this._closeFile(t);let s=x.dirname(t);this._getWatchedDir(s).remove(x.basename(t))}_closeFile(t){let s=this._closers.get(t);s&&(s.forEach(i=>i()),this._closers.delete(t))}_addPathCloser(t,s){if(!s)return;let i=this._closers.get(t);i||(i=[],this._closers.set(t,i)),i.push(s)}_readdirp(t,s){if(this.closed)return;let i={type:N.ALL,alwaysStat:!0,lstat:!0,...s,depth:0},r=lf(t,i);return this._streams.add(r),r.once(uf,()=>{r=void 0}),r.once(Tn,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};function Ef(e,t={}){let s=new Cn(t);return s.add(e),s}import{readFileSync as x0}from"fs";import{resolve as cs,sep as T0}from"path";import{fileURLToPath as O0}from"url";var xf=()=>{try{return JSON.stringify(JSON.parse(x0("./package.json","utf8")))}catch{return"null"}},Pn="null",_0={persistent:!0,ignoreInitial:!0,ignorePermissionErrors:!0,ignored:e=>{let t=cs(e);return!!(t===Of||t===Tf||t.startsWith(Tf+T0))}},Of=cs("./src/package.json"),Tf=cs("./src/node_modules"),_f=cs("./src"),jn=cs("./package.json"),k0=[_f,jn],R0=O0(new URL("./index.js",import.meta.url)),kf=()=>{let e=!1,t=!1,s=Ef(k0,_0),i=()=>{e=!0,t=!1,E0(process.execPath,[R0],{stdio:"inherit"}).on("close",(o,n)=>{o||n?($(E.red("build failure"),{code:o,signal:n}),Me()):console.log(E.green("build success"),{code:o,signal:n}),t?i():e=!1})};s.on("all",(r,o)=>{if(r==="addDir"&&o===_f)return;let n=cs(o);if(n!==Of){if(n===jn){let a=xf();if(a===Pn)return;Pn=a}if(e){n!==jn&&(t=!0);return}T(E.cyan.dim(r),o),i()}}),Pn=xf(),i()};var{exports:A0,tshy:C0}=_,P0=async()=>{for(let e of process.argv.slice(2))switch(e){case"--help":case"-h":return wn();case"--watch":case"-w":return kf();default:return wn(`Unknown argument: ${e}`)}T(E.yellow.bold("building"),process.cwd()),T(E.cyan.dim("tshy config"),C0),T(E.cyan.dim("exports"),A0),await Qc(),ha(E.bold.green("success!"))};await P0();
|
|
50
50
|
/*! Bundled license information:
|
|
51
51
|
|
|
52
52
|
chokidar/esm/index.js:
|