@kitelev/exocortex-cli 16.12.6 → 16.13.1
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/index.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v16.
|
|
2
|
+
// @kitelev/exocortex-cli v16.13.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -108,8 +108,8 @@ ${s}`}};yp.MetadataHelpers=C_});var eA=b(Ro=>{"use strict";Object.defineProperty
|
|
|
108
108
|
`),a=[],c=0;for(;c<s.length;){let u=s[c],f=u.trim();if(f===""){a.push(u),c++;continue}let d=f.match(/^([^:]+):\s*(.*)$/);if(d){let h=d[2];if(h===""&&c+1<s.length&&s[c+1].match(/^\s+- /)){let y=[],S=c+1;for(;S<s.length&&s[S].match(/^\s+- /);)y.push(s[S]),S++;if(y.every(w=>{let T=w.replace(/^\s+- /,"").trim();return this.isEmptyValue(T)})){c=S;continue}else{a.push(u);for(let w=c+1;w<S;w++)a.push(s[w]);c=S;continue}}if(this.isEmptyValue(h)){c++;continue}a.push(u),c++}else f.match(/^\s*- /)||a.push(u),c++}let l=a.join(`
|
|
109
109
|
`);return e.replace(t,`---
|
|
110
110
|
${l}
|
|
111
|
-
---`)}isEmptyValue(e){let t=e.trim();return t===""||t==="null"||t==="undefined"||t==="[]"||t==="{}"||t==='""'||t==="''"}};xi.PropertyCleanupService=db;xi.PropertyCleanupService=db=l6([(0,fb.injectable)(),yA(0,(0,fb.inject)(_A.DI_TOKENS.IVaultAdapter)),yA(1,(0,fb.inject)(_A.DI_TOKENS.ILogger)),u6("design:paramtypes",[Object,Object])],db)});var mb=b(Ii=>{"use strict";var d6=Ii&&Ii.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},h6=Ii&&Ii.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},p6=Ii&&Ii.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RenameToUidService=void 0;var bA=Ce(),m6=Ct(),pb=class{static{o(this,"RenameToUidService")}constructor(e){this.vault=e}async renameToUid(e,t){let r=t.exo__Asset_uid;if(!r)throw new Error("Asset has no exo__Asset_uid property");let i=e.basename,s=r;if(i===s)throw new Error("File is already named according to UID");let a=t.exo__Asset_label
|
|
112
|
-
exo__Asset_label: ${t}
|
|
111
|
+
---`)}isEmptyValue(e){let t=e.trim();return t===""||t==="null"||t==="undefined"||t==="[]"||t==="{}"||t==='""'||t==="''"}};xi.PropertyCleanupService=db;xi.PropertyCleanupService=db=l6([(0,fb.injectable)(),yA(0,(0,fb.inject)(_A.DI_TOKENS.IVaultAdapter)),yA(1,(0,fb.inject)(_A.DI_TOKENS.ILogger)),u6("design:paramtypes",[Object,Object])],db)});var mb=b(Ii=>{"use strict";var d6=Ii&&Ii.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},h6=Ii&&Ii.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},p6=Ii&&Ii.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RenameToUidService=void 0;var bA=Ce(),m6=Ct(),pb=class{static{o(this,"RenameToUidService")}constructor(e){this.vault=e}async renameToUid(e,t){let r=t.exo__Asset_uid;if(!r||typeof r!="string")throw new Error("Asset has no exo__Asset_uid property");let i=e.basename,s=r;if(i===s)throw new Error("File is already named according to UID");let a=t.exo__Asset_label,c=!a||a.trim()==="",l=!this.isAssetArchived(t);(c||l)&&await this.updateFrontmatter(e,i,{setLabel:c,appendAlias:l});let u=e.parent?.path||"",f=u?`${u}/${s}.md`:`${s}.md`;await this.vault.updateLinks(e.path,f,i),await this.vault.rename(e,f)}async updateFrontmatter(e,t,r){await this.vault.process(e,i=>{let s=/^---\n([\s\S]*?)\n---/,a=i.match(s);if(!a)return i;let c=a[1];return r.setLabel&&(c=`${c}
|
|
112
|
+
exo__Asset_label: ${t}`),r.appendAlias&&(c=this.updateAliases(c,t)),i.replace(s,`---
|
|
113
113
|
${c}
|
|
114
114
|
---`)})}updateAliases(e,t){if(!/^aliases\s*:/m.test(e))return`${e}
|
|
115
115
|
aliases:
|
|
@@ -485,7 +485,7 @@ GFS4: `),console.error(n)},"debug"));Nt[Lr]||(CI=global[Lr]||[],OI(Nt,CI),Nt.clo
|
|
|
485
485
|
`+n.slice(i,s),i=s+1),a=c;return l+=`
|
|
486
486
|
`,n.length-i>e&&a>i?l+=n.slice(i,a)+`
|
|
487
487
|
`+n.slice(a+1):l+=n.slice(i),l.slice(1)}o(CR,"foldLine");function lz(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=hf(n,i),r=Qr[t],!r&&yf(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||ez(t);return e}o(lz,"escapeString");function uz(n,e,t){var r="",i=n.tag,s,a,c;for(s=0,a=t.length;s<a;s+=1)c=t[s],n.replacer&&(c=n.replacer.call(t,String(s),c)),(ca(n,e,c,!1,!1)||typeof c>"u"&&ca(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}o(uz,"writeFlowSequence");function RR(n,e,t,r){var i="",s=n.tag,a,c,l;for(a=0,c=t.length;a<c;a+=1)l=t[a],n.replacer&&(l=n.replacer.call(t,String(a),l)),(ca(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&ca(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=$w(n,e)),n.dump&&mf===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}o(RR,"writeBlockSequence");function fz(n,e,t){var r="",i=n.tag,s=Object.keys(t),a,c,l,u,f;for(a=0,c=s.length;a<c;a+=1)f="",r!==""&&(f+=", "),n.condenseFlow&&(f+='"'),l=s[a],u=t[l],n.replacer&&(u=n.replacer.call(t,l,u)),ca(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),ca(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}o(fz,"writeFlowMapping");function dz(n,e,t,r){var i="",s=n.tag,a=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)a.sort();else if(typeof n.sortKeys=="function")a.sort(n.sortKeys);else if(n.sortKeys)throw new yn("sortKeys must be a boolean or a function");for(c=0,l=a.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=$w(n,e)),u=a[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),ca(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&mf===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=$w(n,e)),ca(n,e+1,f,!0,d)&&(n.dump&&mf===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}o(dz,"writeBlockMapping");function OR(n,e,t){var r,i,s,a,c,l;for(i=t?n.explicitTypes:n.implicitTypes,s=0,a=i.length;s<a;s+=1)if(c=i[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(t?c.multi&&c.representName?n.tag=c.representName(e):n.tag=c.tag:n.tag="?",c.represent){if(l=n.styleMap[c.tag]||c.defaultStyle,cO.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(lO.call(c.represent,l))r=c.represent[l](e,l);else throw new yn("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}o(OR,"detectType");function ca(n,e,t,r,i,s,a){n.tag=null,n.dump=t,OR(n,t,!1)||OR(n,t,!0);var c=cO.call(n.dump),l=r,u;r&&(r=n.flowLevel<0||n.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",d,h;if(f&&(d=n.duplicates.indexOf(t),h=d!==-1),(n.tag!==null&&n.tag!=="?"||h||n.indent!==2&&e>0)&&(i=!1),h&&n.usedDuplicates[d])n.dump="*ref_"+d;else{if(f&&h&&!n.usedDuplicates[d]&&(n.usedDuplicates[d]=!0),c==="[object Object]")r&&Object.keys(n.dump).length!==0?(dz(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(fz(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object Array]")r&&n.dump.length!==0?(n.noArrayIndent&&!a&&e>0?RR(n,e-1,n.dump,i):RR(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(uz(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&oz(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new yn("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}o(ca,"writeNode");function hz(n,e){var t=[],r=[],i,s;for(Bw(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}o(hz,"getDuplicateReferences");function Bw(n,e,t){var r,i,s;if(n!==null&&typeof n=="object")if(i=e.indexOf(n),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(n),Array.isArray(n))for(i=0,s=n.length;i<s;i+=1)Bw(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)Bw(n[r[i]],e,t)}o(Bw,"inspectNode");function pz(n,e){e=e||{};var t=new rz(e);t.noRefs||hz(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),ca(t,0,r,!0,!0)?t.dump+`
|
|
488
|
-
`:""}o(pz,"dump$1");var mz=pz,gz={dump:mz};function Hw(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}o(Hw,"renamed");var yz=kr,_z=DR,bz=jR,Sz=UR,wz=qR,vz=qw,Ez=oO.load,Tz=oO.loadAll,Az=gz.dump,xz=yn,Iz={binary:QR,float:BR,map:kR,null:MR,pairs:YR,set:XR,timestamp:zR,bool:$R,int:VR,merge:HR,omap:KR,seq:LR,str:NR},Cz=Hw("safeLoad","load"),Rz=Hw("safeLoadAll","loadAll"),Oz=Hw("safeDump","dump"),rr={Type:yz,Schema:_z,FAILSAFE_SCHEMA:bz,JSON_SCHEMA:Sz,CORE_SCHEMA:wz,DEFAULT_SCHEMA:vz,load:Ez,loadAll:Tz,dump:Az,YAMLException:xz,types:Iz,safeLoad:Cz,safeLoadAll:Rz,safeDump:Oz};var pv=le(_l()),zo=le(require("path"));var VO=le(PO(),1);var bf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Mz={"[: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]},Sf=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),$z=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),FO=o(n=>n.join(""),"rangesToString"),DO=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let S=n.charAt(s);if((S==="!"||S==="^")&&s===t+1){u=!0,s++;continue}if(S==="]"&&a&&!l){f=s+1;break}if(a=!0,S==="\\"&&!l){l=!0,s++;continue}if(S==="["&&!l){for(let[v,[w,T,C]]of Object.entries(Mz))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,C?i.push(w):r.push(w),c=c||T;continue e}}if(l=!1,d){S>d?r.push(Sf(d)+"-"+Sf(S)):S===d&&r.push(Sf(S)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Sf(S+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=S,s+=2;continue}r.push(Sf(S)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let S=r[0].length===2?r[0].slice(-1):r[0];return[$z(S),!1,f-t,!1]}let h="["+(u?"^":"")+FO(r)+"]",p="["+(u?"":"^")+FO(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var $i=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Pn,Vz=new Set(["!","?","+","*","@"]),Yw=o(n=>Vz.has(n),"isExtglobType"),NO=o(n=>Yw(n.type),"isExtglobAST"),Bz=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Uz=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),qz=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),LO=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Wz="(?!(?:^|/)\\.\\.?(?:$|/))",Bm="(?!\\.)",Gz=new Set(["[","."]),zz=new Set(["..","."]),Hz=new Set("().*{}+?[]^$\\!"),Qz=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Xw="[^/]",kO=Xw+"*?",jO=Xw+"+?",qo=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#_;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#_=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#_+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Pn&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#_===0)return!0;let e=this.#c;for(let t=0;t<this.#_;t++){let r=e.#t[t];if(!(r instanceof Pn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Pn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let S=r,v="";for(;S<e.length;){let w=e.charAt(S++);if(c||w==="\\"){c=!c,v+=w;continue}if(l){S===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(S===u+2&&f)&&(l=!1),v+=w;continue}else if(w==="["){l=!0,u=S,f=!1,v+=w;continue}if(!i.noext&&Yw(w)&&e.charAt(S)==="("&&s<=a){t.push(v),v="";let C=new Pn(w,t);S=Pn.#g(e,C,S,i,s+1),t.push(C);continue}v+=w}return t.push(v),S}let d=r+1,h=new Pn(null,t),p=[],y="";for(;d<e.length;){let S=e.charAt(d++);if(c||S==="\\"){c=!c,y+=S;continue}if(l){d===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(d===u+2&&f)&&(l=!1),y+=S;continue}else if(S==="["){l=!0,u=d,f=!1,y+=S;continue}if(Yw(S)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(S))){let w=t&&t.#y(S)?0:1;h.push(y),y="";let T=new Pn(S,h);h.push(T),d=Pn.#g(e,T,d,i,s+w);continue}if(S==="|"){h.push(y),y="",p.push(h),h=new Pn(null,t);continue}if(S===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=S}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,Uz)}#m(e,t=Bz){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=qz){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Pn(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!LO.get(this.type)?.has(e)}#b(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#v(e){let t=LO.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#S(){if(NO(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#b(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Pn(null,void 0,t);return Pn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!NO(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,S,v,w]=typeof p=="string"?Pn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||w,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&zz.has(this.#t[0]))){let y=Gz,S=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=S?Wz:v?Bm:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,$i(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,$i(this.toString()),!1,!1]}let a=!r||e||t||!Bm?"":this.#w(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Bm:"")+jO;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Bm:"")+kO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,$i(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#x(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(Hz.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=DO(e,l);if(h){s+=f,a=a||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?jO:kO,t=!0;continue}else c=!1;if(u==="?"){s+=Xw,t=!0;continue}s+=Qz(u)}return[s,$i(e),!!t,a]}};Pn=qo;var El=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var jr=o((n,e,t={})=>(bf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Vn(e,t).match(n)),"minimatch"),Kz=/^\*+([^+@!?\*\[\(]*)$/,Yz=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),Xz=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),Jz=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),Zz=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),eH=/^\*+\.\*+$/,tH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),rH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),nH=/^\.\*+$/,iH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),sH=/^\*+$/,aH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),oH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),cH=/^\?+([^+@!?\*\[\(]*)?$/,lH=o(([n,e=""])=>{let t=BO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),uH=o(([n,e=""])=>{let t=UO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),fH=o(([n,e=""])=>{let t=UO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),dH=o(([n,e=""])=>{let t=BO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),BO=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),UO=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),qO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",MO={win32:{sep:"\\"},posix:{sep:"/"}},hH=qO==="win32"?MO.win32.sep:MO.posix.sep;jr.sep=hH;var Gt=Symbol("globstar **");jr.GLOBSTAR=Gt;var pH="[^/]",mH=pH+"*?",gH="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",yH="(?:(?!(?:\\/|^)\\.).)*?",_H=o((n,e={})=>t=>jr(t,n,e),"filter");jr.filter=_H;var ii=o((n,e={})=>Object.assign({},n,e),"ext"),bH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return jr;let e=jr;return Object.assign(o((r,i,s={})=>e(r,i,ii(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,ii(n,s))}static defaults(i){return e.defaults(ii(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,ii(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,ii(n,s))}},unescape:o((r,i={})=>e.unescape(r,ii(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,ii(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,ii(n,i)),"filter"),defaults:o(r=>e.defaults(ii(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,ii(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,ii(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,ii(n,s)),"match"),sep:e.sep,GLOBSTAR:Gt})},"defaults");jr.defaults=bH;var WO=o((n,e={})=>(bf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,VO.default)(n)),"braceExpand");jr.braceExpand=WO;var SH=o((n,e={})=>new Vn(n,e).makeRe(),"makeRe");jr.makeRe=SH;var wH=o((n,e,t={})=>{let r=new Vn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");jr.match=wH;var $O=/[?*]|[+@!]\(.*?\)|\[|\]/,vH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Vn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){bf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||qO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!$O.test(s[2]))&&!$O.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][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 r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),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 s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Gt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Gt,s),c=t.lastIndexOf(Gt),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let T=e.slice(i,i+l.length);if(!this.#r(T,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let T=e.length-f.length;if(this.#r(e,f,r,T,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(T--,!this.#r(e,f,r,T,0)))return!1;d=f.length+1}}if(!u.length){let T=!!d;for(let C=i;C<e.length-d;C++){let M=String(e[C]);if(T=!0,M==="."||M===".."||!this.options.dot&&M.startsWith("."))return!1}return r||T}let h=[[[],0]],p=h[0],y=0,S=[0];for(let T of u)T===Gt?(S.push(y),p=[[],0],h.push(p)):(p[0].push(T),y++);let v=h.length-1,w=e.length-d;for(let T of h)T[1]=w-(S[v--]+T[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],d=e[a];if(this.debug(t,f,d),f===!1||f===Gt)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return WO(this.pattern,this.options)}parse(e){bf(e);let t=this.options;if(e==="**")return Gt;if(e==="")return"";let r,i=null;(r=e.match(sH))?i=t.dot?oH:aH:(r=e.match(Kz))?i=(t.nocase?t.dot?Zz:Jz:t.dot?Xz:Yz)(r[1]):(r=e.match(cH))?i=(t.nocase?t.dot?uH:lH:t.dot?fH:dH)(r):(r=e.match(eH))?i=t.dot?rH:tH:(r=e.match(nH))&&(i=iH);let s=qo.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}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,r=t.noglobstar?mH:t.dot?gH:yH,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?vH(f):f===Gt?Gt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Gt||p===Gt||(p===void 0?h!==void 0&&h!==Gt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Gt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Gt))}),u.filter(f=>f!==Gt).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+c+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...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 r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return jr.defaults(e).Minimatch}};jr.AST=qo;jr.Minimatch=Vn;jr.escape=El;jr.unescape=$i;var pP=require("node:url");var Tl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,zO=new Set,Jw=typeof process=="object"&&process?process:{},HO=o((n,e,t,r)=>{typeof Jw.emitWarning=="function"?Jw.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Um=globalThis.AbortController,GO=globalThis.AbortSignal;if(typeof Um>"u"){GO=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Um=class{static{o(this,"AbortController")}constructor(){e()}signal=new GO;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=Jw.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,HO("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",e))},"warnACPolyfill")}var EH=o(n=>!zO.has(n),"shouldWarn");var Ga=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),QO=o(n=>Ga(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Al:null:null,"getUintArray"),Al=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},Zw=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=QO(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},wf=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#_;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#d;#m;#y;#f;#E;#T;#b;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#b,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#M(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#C(t),"indexes"),rindexes:o(t=>e.#R(t),"rindexes"),isStale:o(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#_}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:v,memoMethod:w,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:$,ignoreFetchAbort:ee}=e;if(t!==0&&!Ga(t))throw new TypeError("max option must be a nonnegative integer");let B=t?QO(t):Array;if(!B)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=S,this.sizeCalculation){if(!this.#n&&!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(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=w,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new B(t),this.#g=new B(t),this.#d=0,this.#m=0,this.#y=Zw.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#n!==0&&!Ga(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ga(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ga(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ga(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let z="LRU_CACHE_UNBOUNDED";EH(z)&&(zO.add(z),HO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",z,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#x(){let e=new Al(this.#e),t=new Al(this.#e);this.#b=e,this.#T=t,this.#F=(s,a,c=Tl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#I=s=>{t[s]=e[s]!==0?Tl.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=Tl.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#I=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Al(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Ga(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ga(i))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 i},this.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#j(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#C())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#R())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*values(){for(let e of this.#C())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#R())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#R()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#b&&this.#T){let a=this.#b[t],c=this.#T[t];if(a&&c){let l=a-(Tl.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#b&&this.#T){a.ttl=this.#b[t];let c=Tl.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Tl.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#j(!1):this.#i,this.#l[d]=e,this.#a[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#N(d,f,l),l&&(l.set="add"),u=!1;else{this.#V(d);let h=this.#a[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else a||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#N(d,f,l),this.#a[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#b&&this.#x(),this.#b&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#d];if(this.#j(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#j(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#h(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#I(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#a[i];return this.#h(s)?s.__staleWhileFetching:s}#M(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new Um,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((S,v=!1)=>{let{aborted:w}=a.signal,T=r.ignoreFetchAbort&&S!==void 0;if(r.status&&(w&&!v?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,T&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!T&&!v)return d(a.signal.reason);let C=p;return this.#a[t]===p&&(S===void 0?C.__staleWhileFetching?this.#a[t]=C.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,S,l.options))),S},"cb"),f=o(S=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=S),d(S)),"eb"),d=o(S=>{let{aborted:v}=a.signal,w=v&&r.allowStaleOnFetchAbort,T=w||r.allowStaleOnFetchRejection,C=T||r.noDeleteOnFetchRejection,M=p;if(this.#a[t]===p&&(!C||M.__staleWhileFetching===void 0?this.#P(e,"fetch"):w||(this.#a[t]=M.__staleWhileFetching)),T)return r.status&&M.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),M.__staleWhileFetching;if(M.__returned===M)throw S},"fetchFail"),h=o((S,v)=>{let w=this.#c?.(e,s,l);w&&w instanceof Promise&&w.then(T=>S(T===void 0?void 0:T),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(S(void 0),r.allowStaleOnFetchAbort&&(S=o(T=>u(T,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Um}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:S,forceRefresh:v=!1,status:w,signal:T}=t;if(!this.#S)return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:w});let C={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:w,signal:T},M=this.#s.get(e);if(M===void 0){w&&(w.fetch="miss");let $=this.#M(e,M,C,S);return $.__returned=$}else{let $=this.#a[M];if(this.#h($)){let D=r&&$.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?$.__staleWhileFetching:$.__returned=$}let ee=this.#A(M);if(!v&&!ee)return w&&(w.fetch="hit"),this.#V(M),i&&this.#I(M),w&&this.#o(w,M),$;let B=this.#M(e,M,C,S),P=B.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=ee?"stale":"refresh",P&&ee&&(w.returnedStale=!0)),P?B.__staleWhileFetching:B.__returned=B}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#_;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#h(l);return a&&this.#o(a,c),this.#A(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#I(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#b&&this.#T&&(this.#b.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Cl=require("node:path"),iP=require("node:url"),Es=require("fs"),DH=le(require("node:fs"),1),Qa=require("node:fs/promises");var Km=require("node:events"),av=le(require("node:stream"),1),ZO=require("node:string_decoder");var KO=typeof process=="object"&&process?process:{stdout:null,stderr:null},TH=o(n=>!!n&&typeof n=="object"&&(n instanceof Ha||n instanceof av.default||AH(n)||xH(n)),"isStream"),AH=o(n=>!!n&&typeof n=="object"&&n instanceof Km.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==av.default.Writable.prototype.pipe,"isReadable"),xH=o(n=>!!n&&typeof n=="object"&&n instanceof Km.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),la=Symbol("EOF"),ua=Symbol("maybeEmitEnd"),za=Symbol("emittedEnd"),qm=Symbol("emittingEnd"),vf=Symbol("emittedError"),Wm=Symbol("closed"),YO=Symbol("read"),Gm=Symbol("flush"),XO=Symbol("flushChunk"),Vi=Symbol("encoding"),xl=Symbol("decoder"),vr=Symbol("flowing"),Ef=Symbol("paused"),Il=Symbol("resume"),Er=Symbol("buffer"),_n=Symbol("pipes"),Tr=Symbol("bufferLength"),ev=Symbol("bufferPush"),zm=Symbol("bufferShift"),Kr=Symbol("objectMode"),zt=Symbol("destroyed"),tv=Symbol("error"),rv=Symbol("emitData"),JO=Symbol("emitEnd"),nv=Symbol("emitEnd2"),ws=Symbol("async"),iv=Symbol("abort"),Hm=Symbol("aborted"),Tf=Symbol("signal"),Wo=Symbol("dataListeners"),Bn=Symbol("discarded"),Af=o(n=>Promise.resolve().then(n),"defer"),IH=o(n=>n(),"nodefer"),CH=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),RH=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),OH=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Qm=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Il](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},sv=class extends Qm{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},PH=o(n=>!!n.objectMode,"isObjectModeOptions"),FH=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ha=class extends Km.EventEmitter{static{o(this,"Minipass")}[vr]=!1;[Ef]=!1;[_n]=[];[Er]=[];[Kr];[Vi];[ws];[xl];[la]=!1;[za]=!1;[qm]=!1;[Wm]=!1;[vf]=null;[Tr]=0;[zt]=!1;[Tf];[Hm]=!1;[Wo]=0;[Bn]=!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");PH(t)?(this[Kr]=!0,this[Vi]=null):FH(t)?(this[Vi]=t.encoding,this[Kr]=!1):(this[Kr]=!1,this[Vi]=null),this[ws]=!!t.async,this[xl]=this[Vi]?new ZO.StringDecoder(this[Vi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Er],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[_n],"get")});let{signal:r}=t;r&&(this[Tf]=r,r.aborted?this[iv]():r.addEventListener("abort",()=>this[iv]()))}get bufferLength(){return this[Tr]}get encoding(){return this[Vi]}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[Kr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ws]}set async(e){this[ws]=this[ws]||!!e}[iv](){this[Hm]=!0,this.emit("abort",this[Tf]?.reason),this.destroy(this[Tf]?.reason)}get aborted(){return this[Hm]}set aborted(e){}write(e,t,r){if(this[Hm])return!1;if(this[la])throw new Error("write after end");if(this[zt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[ws]?Af:IH;if(!this[Kr]&&!Buffer.isBuffer(e)){if(OH(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(RH(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Kr]?(this[vr]&&this[Tr]!==0&&this[Gm](!0),this[vr]?this.emit("data",e):this[ev](e),this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr]):e.length?(typeof e=="string"&&!(t===this[Vi]&&!this[xl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Vi]&&(e=this[xl].write(e)),this[vr]&&this[Tr]!==0&&this[Gm](!0),this[vr]?this.emit("data",e):this[ev](e),this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr]):(this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr])}read(e){if(this[zt])return null;if(this[Bn]=!1,this[Tr]===0||e===0||e&&e>this[Tr])return this[ua](),null;this[Kr]&&(e=null),this[Er].length>1&&!this[Kr]&&(this[Er]=[this[Vi]?this[Er].join(""):Buffer.concat(this[Er],this[Tr])]);let t=this[YO](e||null,this[Er][0]);return this[ua](),t}[YO](e,t){if(this[Kr])this[zm]();else{let r=t;e===r.length||e===null?this[zm]():typeof r=="string"?(this[Er][0]=r.slice(e),t=r.slice(0,e),this[Tr]-=e):(this[Er][0]=r.subarray(e),t=r.subarray(0,e),this[Tr]-=e)}return this.emit("data",t),!this[Er].length&&!this[la]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[la]=!0,this.writable=!1,(this[vr]||!this[Ef])&&this[ua](),this}[Il](){this[zt]||(!this[Wo]&&!this[_n].length&&(this[Bn]=!0),this[Ef]=!1,this[vr]=!0,this.emit("resume"),this[Er].length?this[Gm]():this[la]?this[ua]():this.emit("drain"))}resume(){return this[Il]()}pause(){this[vr]=!1,this[Ef]=!0,this[Bn]=!1}get destroyed(){return this[zt]}get flowing(){return this[vr]}get paused(){return this[Ef]}[ev](e){this[Kr]?this[Tr]+=1:this[Tr]+=e.length,this[Er].push(e)}[zm](){return this[Kr]?this[Tr]-=1:this[Tr]-=this[Er][0].length,this[Er].shift()}[Gm](e=!1){do;while(this[XO](this[zm]())&&this[Er].length);!e&&!this[Er].length&&!this[la]&&this.emit("drain")}[XO](e){return this.emit("data",e),this[vr]}pipe(e,t){if(this[zt])return e;this[Bn]=!1;let r=this[za];return t=t||{},e===KO.stdout||e===KO.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[_n].push(t.proxyErrors?new sv(this,e,t):new Qm(this,e,t)),this[ws]?Af(()=>this[Il]()):this[Il]()),e}unpipe(e){let t=this[_n].find(r=>r.dest===e);t&&(this[_n].length===1?(this[vr]&&this[Wo]===0&&(this[vr]=!1),this[_n]=[]):this[_n].splice(this[_n].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[Bn]=!1,this[Wo]++,!this[_n].length&&!this[vr]&&this[Il]();else if(e==="readable"&&this[Tr]!==0)super.emit("readable");else if(CH(e)&&this[za])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[vf]){let i=t;this[ws]?Af(()=>i.call(this,this[vf])):i.call(this,this[vf])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Wo]=this.listeners("data").length,this[Wo]===0&&!this[Bn]&&!this[_n].length&&(this[vr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Wo]=0,!this[Bn]&&!this[_n].length&&(this[vr]=!1)),t}get emittedEnd(){return this[za]}[ua](){!this[qm]&&!this[za]&&!this[zt]&&this[Er].length===0&&this[la]&&(this[qm]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wm]&&this.emit("close"),this[qm]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==zt&&this[zt])return!1;if(e==="data")return!this[Kr]&&!r?!1:this[ws]?(Af(()=>this[rv](r)),!0):this[rv](r);if(e==="end")return this[JO]();if(e==="close"){if(this[Wm]=!0,!this[za]&&!this[zt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[vf]=r,super.emit(tv,r);let s=!this[Tf]||this.listeners("error").length?super.emit("error",r):!1;return this[ua](),s}else if(e==="resume"){let s=super.emit("resume");return this[ua](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[ua](),i}[rv](e){for(let r of this[_n])r.dest.write(e)===!1&&this.pause();let t=this[Bn]?!1:super.emit("data",e);return this[ua](),t}[JO](){return this[za]?!1:(this[za]=!0,this.readable=!1,this[ws]?(Af(()=>this[nv]()),!0):this[nv]())}[nv](){if(this[xl]){let t=this[xl].end();if(t){for(let r of this[_n])r.dest.write(t);this[Bn]||super.emit("data",t)}}for(let t of this[_n])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Kr]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Kr]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Kr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Vi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(zt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Bn]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[la])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(zt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(zt,f),this.pause(),s({value:d,done:!!this[la]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(zt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{a=h,s=d,this.once(zt,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Bn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(tv,t),this.off(zt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(tv,t),this.once(zt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[zt])return e?this.emit("error",e):this.emit(zt),this;this[zt]=!0,this[Bn]=!0,this[Er].length=0,this[Tr]=0;let t=this;return typeof t.close=="function"&&!this[Wm]&&t.close(),e?this.emit("error",e):this.emit(zt),this}static get isStream(){return TH}};var NH=Es.realpathSync.native,If={lstatSync:Es.lstatSync,readdir:Es.readdir,readdirSync:Es.readdirSync,readlinkSync:Es.readlinkSync,realpathSync:NH,promises:{lstat:Qa.lstat,readdir:Qa.readdir,readlink:Qa.readlink,realpath:Qa.realpath}},sP=o(n=>!n||n===If||n===DH?If:{...If,...n,promises:{...If.promises,...n.promises||{}}},"fsFromOption"),aP=/^\\\\\?\\([a-z]:)\\?$/i,LH=o(n=>n.replace(/\//g,"\\").replace(aP,"$1\\"),"uncToDrive"),kH=/[\\\/]/,ai=0,oP=1,cP=2,vs=4,lP=6,uP=8,Go=10,fP=12,si=15,xf=~si,ov=16,eP=32,Cf=64,Bi=128,Ym=256,Jm=512,tP=Cf|Bi|Jm,jH=1023,cv=o(n=>n.isFile()?uP:n.isDirectory()?vs:n.isSymbolicLink()?Go:n.isCharacterDevice()?cP:n.isBlockDevice()?lP:n.isSocket()?fP:n.isFIFO()?oP:ai,"entToType"),rP=new Map,Rf=o(n=>{let e=rP.get(n);if(e)return e;let t=n.normalize("NFKD");return rP.set(n,t),t},"normalize"),nP=new Map,Xm=o(n=>{let e=nP.get(n);if(e)return e;let t=Rf(n.toLowerCase());return nP.set(n,t),t},"normalizeNocase"),Zm=class extends wf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},lv=class extends wf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},dP=Symbol("PathScurry setAsCwd"),Yr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#_;get gid(){return this.#_}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#b;#v;#S;#w;#x;#I;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ai,r,i,s,a,c){this.name=e,this.#b=s?Xm(e):Rf(e),this.#o=t&jH,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#S=c.fullpath,this.#x=c.relative,this.#I=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=sP(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);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.#o&=~ov,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Xm(e):Rf(e);for(let l of r)if(l.#b===i)return l;let s=this.parent?this.sep:"",a=this.#S?this.#S+s+e:void 0,c=this.newChild(e,ai,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=Bi),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#o&si)===ai}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.#o&si)===uP}isDirectory(){return(this.#o&si)===vs}isCharacterDevice(){return(this.#o&si)===cP}isBlockDevice(){return(this.#o&si)===lP}isFIFO(){return(this.#o&si)===oP}isSocket(){return(this.#o&si)===fP}isSymbolicLink(){return(this.#o&Go)===Go}lstatCached(){return this.#o&eP?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#o&si;return!(e!==ai&&e!==Go||this.#o&Ym||this.#o&Bi)}calledReaddir(){return!!(this.#o&ov)}isENOENT(){return!!(this.#o&Bi)}isNamed(e){return this.nocase?this.#b===Xm(e):this.#b===Rf(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#N(e){this.#o|=ov;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&Bi||(this.#o=(this.#o|Bi)&xf,this.#C())}#C(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=Jm,this.#k()}#k(){if(this.#o&Cf)return;let e=this.#o;(e&si)===vs&&(e&=xf),this.#o=e|Cf,this.#C()}#j(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#M(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=Ym,e==="ENOENT"&&(t|=Bi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=xf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=cv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&si;return s!==vs&&s!==Go&&s!==ai&&(i.#o|=Cf),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Xm(e.name):Rf(e.name))===i.#b)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&xf|cv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&Bi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#M(e.code)}}lstatSync(){if((this.#o&Bi)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#M(e.code)}}#G(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:S,nlink:v,rdev:w,size:T,uid:C}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=S,this.#t=v,this.#i=w,this.#l=T,this.#c=C;let M=cv(e);this.#o=this.#o&xf|M|eP,M!==ai&&M!==vs&&M!==Go&&(this.#o|=Cf)}#q=[];#W=!1;#z(e){this.#W=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#W)return;this.#W=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#j(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#z(r.slice(0,r.provisional))})}#U;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.#U)await this.#U;else{let r=o(()=>{},"resolve");this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#j(i.code),e.provisional=0}this.#U=void 0,r()}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 r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#j(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&tP)return!1;let e=si&this.#o;return e===ai||e===vs||e===Go}shouldWalk(e,t){return(this.#o&vs)===vs&&!(this.#o&tP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((Jm|Ym|Bi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#O)return this.#O;if(!((Jm|Ym|Bi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[dP](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#x=r.join(this.sep),i.#I=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#I=void 0,i=i.parent}},eg=class n extends Yr{static{o(this,"PathWin32")}sep="\\";splitSep=kH;constructor(e,t=ai,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=ai,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Cl.win32.parse(e).root}getRoot(e){if(e=LH(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new Rl(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(aP,"$1\\"),e===t}},tg=class n extends Yr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=ai,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=ai,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},rg=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=If}={}){this.#t=sP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,iP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Zm,this.#n=new Zm,this.#r=new lv(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let S=f--;u=u.child(y,{relative:new Array(S).fill("..").join(d),relativePosix:new Array(S).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.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 Yr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?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 Yr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let S=y.length;if(!S)return h();let v=o(()=>{--S===0&&h()},"next");for(let w of y)(!s||s(w))&&c.push(r?w:w.fullpath()),i&&w.isSymbolicLink()?w.realpath().then(T=>T?.isUnknown()?T.lstat():T).then(T=>T?.shouldWalk(l,a)?u(T,v):v()):w.shouldWalk(l,a)?u(w,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,a)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(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 Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,a)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ha({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((v,w,T=!1)=>{if(v)return c.emit("error",v);if(i&&!T){let C=[];for(let M of w)M.isSymbolicLink()&&C.push(M.realpath().then($=>$?.isUnknown()?$.lstat():$));if(C.length){Promise.all(C).then(()=>y(null,w,!0));return}}for(let C of w)C&&(!s||s(C))&&(c.write(r?C:C.fullpath())||(h=!0));f--;for(let C of w){let M=C.realpathCached()||C;M.shouldWalk(l,a)&&u.push(M)}h&&!c.flowing?c.once("drain",d):S||d()},"onReaddir"),S=!0;p.readdirCB(y,!0),S=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ha({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let S of y)(!s||s(S))&&(c.write(r?S:S.fullpath())||(h=!0));f--;for(let S of y){let v=S;if(S.isSymbolicLink()){if(!(i&&(v=S.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,a)&&u.push(v)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[dP](t)}},Rl=class extends rg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Cl.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Cl.win32.parse(e).root.toUpperCase()}newRoot(e){return new eg(this.rootPath,vs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ol=class extends rg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Cl.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new tg(this.rootPath,vs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Of=class extends Ol{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Ule=process.platform==="win32"?eg:tg,hP=process.platform==="win32"?Rl:process.platform==="darwin"?Of:Ol;var MH=o(n=>n.length>=1,"isPatternList"),$H=o(n=>n.length>=1,"isGlobList"),Pl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!MH(e))throw new TypeError("empty pattern list");if(!$H(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let S=[s,a,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[S,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Gt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#_=this.#_||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var VH=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Fl=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=VH}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Vn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new Pl(i,s,0,this.platform),c=new Vn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var uv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},fv=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},dv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.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())}},Pf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new fv;subwalks=new dv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new uv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===Gt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gt?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var BH=o((n,e)=>typeof n=="string"?new Fl([n],e):Array.isArray(n)?new Fl(n,e):n,"makeIgnore"),ng=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=BH(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(s,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.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Pf(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Pf(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Ff=class extends ng{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}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}},Df=class extends ng{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ha({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}};var UH=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ui=class{static{o(this,"Glob")}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=(0,pP.fileURLToPath)(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(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||UH,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 l=t.platform==="win32"?Rl:t.platform==="darwin"?Of:t.platform?Ol:hP;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new Vn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Pl(l,f,0,this.platform)})}async walk(){return[...await new Ff(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 Ff(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 Df(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 Df(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()}};var hv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Vn(t,e).hasMagic())return!0;return!1},"hasMagic");function ig(n,e={}){return new Ui(n,e).streamSync()}o(ig,"globStreamSync");function gP(n,e={}){return new Ui(n,e).stream()}o(gP,"globStream");function yP(n,e={}){return new Ui(n,e).walkSync()}o(yP,"globSync");async function mP(n,e={}){return new Ui(n,e).walk()}o(mP,"glob_");function sg(n,e={}){return new Ui(n,e).iterateSync()}o(sg,"globIterateSync");function _P(n,e={}){return new Ui(n,e).iterate()}o(_P,"globIterate");var qH=ig,WH=Object.assign(gP,{sync:ig}),GH=sg,zH=Object.assign(_P,{sync:sg}),HH=Object.assign(yP,{stream:ig,iterate:sg}),Dl=Object.assign(mP,{glob:mP,globSync:yP,sync:HH,globStream:gP,stream:WH,globStreamSync:ig,streamSync:qH,globIterate:_P,iterate:zH,globIterateSync:sg,iterateSync:GH,Glob:Ui,hasMagic:hv,escape:El,unescape:$i});Dl.glob=Dl;async function SP(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,a=zo.default.join(n,"**/*.md"),c=await Dl(a,{nodir:!0,ignore:[zo.default.join(n,".obsidian/**"),zo.default.join(n,".trash/**"),zo.default.join(n,"**/.obsidian/**"),zo.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=zo.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await pv.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=QH(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await pv.default.writeFile(u,h,"utf-8"))}return l}o(SP,"rewriteInboundWikilinks");function QH(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=r[s],c=KH(a,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}o(QH,"rewriteContent");function KH(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=YH(r[s],e,t);i+=a.replacements,r[s]=a.updated}return{updated:r.join(""),replacements:i}}o(KH,"rewriteProseSegment");function YH(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#]+)(#[^\[\]\n|]*)?(\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(a,c,l,u)=>{if(c.trim()!==e)return a;i+=1;let d=l??"",h;return u?h=u:d?h=`|${e}`:h=`|${e}`,`[[${t}${d}${h}]]`}),replacements:i}}o(YH,"replaceWikilinks");var XH=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Lt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return nr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await nr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await nr.default.ensureDir(Ht.default.dirname(r)),await nr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await nr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return nr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=nr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Ht.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=nr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),a=this.replaceFrontmatter(r,s);await this.modify(e,a)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.ensureDir(Ht.default.dirname(i)),await nr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await nr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(XH.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Ht.default.dirname(this.resolvePath(t)),s;if(Ht.default.isAbsolute(r)?s=this.resolvePath(r):s=Ht.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),nr.default.existsSync(s)){let u=Ht.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let a=r.toLowerCase(),c=this.basenameIndex.get(a);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(a);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Ht.default.relative(this.rootPath,e),r=Ht.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=nr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let a=s.aliases,c=Array.isArray(a)?a:typeof a=="string"?[a]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=Ht.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=Ht.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Ht.default.basename(t,".md");await SP(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Ht.default.isAbsolute(e)?e:Ht.default.join(this.rootPath,e)}createFileObject(e){let t=Ht.default.basename(e),r=Ht.default.basename(e,Ht.default.extname(e)),i=Ht.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Ht.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=rr.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=rr.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
488
|
+
`:""}o(pz,"dump$1");var mz=pz,gz={dump:mz};function Hw(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}o(Hw,"renamed");var yz=kr,_z=DR,bz=jR,Sz=UR,wz=qR,vz=qw,Ez=oO.load,Tz=oO.loadAll,Az=gz.dump,xz=yn,Iz={binary:QR,float:BR,map:kR,null:MR,pairs:YR,set:XR,timestamp:zR,bool:$R,int:VR,merge:HR,omap:KR,seq:LR,str:NR},Cz=Hw("safeLoad","load"),Rz=Hw("safeLoadAll","loadAll"),Oz=Hw("safeDump","dump"),rr={Type:yz,Schema:_z,FAILSAFE_SCHEMA:bz,JSON_SCHEMA:Sz,CORE_SCHEMA:wz,DEFAULT_SCHEMA:vz,load:Ez,loadAll:Tz,dump:Az,YAMLException:xz,types:Iz,safeLoad:Cz,safeLoadAll:Rz,safeDump:Oz};var pv=le(_l()),zo=le(require("path"));var VO=le(PO(),1);var bf=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Mz={"[: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]},Sf=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),$z=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),FO=o(n=>n.join(""),"rangesToString"),DO=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let S=n.charAt(s);if((S==="!"||S==="^")&&s===t+1){u=!0,s++;continue}if(S==="]"&&a&&!l){f=s+1;break}if(a=!0,S==="\\"&&!l){l=!0,s++;continue}if(S==="["&&!l){for(let[v,[w,T,C]]of Object.entries(Mz))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,C?i.push(w):r.push(w),c=c||T;continue e}}if(l=!1,d){S>d?r.push(Sf(d)+"-"+Sf(S)):S===d&&r.push(Sf(S)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Sf(S+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=S,s+=2;continue}r.push(Sf(S)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let S=r[0].length===2?r[0].slice(-1):r[0];return[$z(S),!1,f-t,!1]}let h="["+(u?"^":"")+FO(r)+"]",p="["+(u?"":"^")+FO(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var $i=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Pn,Vz=new Set(["!","?","+","*","@"]),Yw=o(n=>Vz.has(n),"isExtglobType"),NO=o(n=>Yw(n.type),"isExtglobAST"),Bz=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Uz=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),qz=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),LO=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Wz="(?!(?:^|/)\\.\\.?(?:$|/))",Bm="(?!\\.)",Gz=new Set(["[","."]),zz=new Set(["..","."]),Hz=new Set("().*{}+?[]^$\\!"),Qz=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Xw="[^/]",kO=Xw+"*?",jO=Xw+"+?",qo=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#_;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#_=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#_+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Pn&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#_===0)return!0;let e=this.#c;for(let t=0;t<this.#_;t++){let r=e.#t[t];if(!(r instanceof Pn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Pn(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let S=r,v="";for(;S<e.length;){let w=e.charAt(S++);if(c||w==="\\"){c=!c,v+=w;continue}if(l){S===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(S===u+2&&f)&&(l=!1),v+=w;continue}else if(w==="["){l=!0,u=S,f=!1,v+=w;continue}if(!i.noext&&Yw(w)&&e.charAt(S)==="("&&s<=a){t.push(v),v="";let C=new Pn(w,t);S=Pn.#g(e,C,S,i,s+1),t.push(C);continue}v+=w}return t.push(v),S}let d=r+1,h=new Pn(null,t),p=[],y="";for(;d<e.length;){let S=e.charAt(d++);if(c||S==="\\"){c=!c,y+=S;continue}if(l){d===u+1?(S==="^"||S==="!")&&(f=!0):S==="]"&&!(d===u+2&&f)&&(l=!1),y+=S;continue}else if(S==="["){l=!0,u=d,f=!1,y+=S;continue}if(Yw(S)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(S))){let w=t&&t.#y(S)?0:1;h.push(y),y="";let T=new Pn(S,h);h.push(T),d=Pn.#g(e,T,d,i,s+w);continue}if(S==="|"){h.push(y),y="",p.push(h),h=new Pn(null,t);continue}if(S===")")return y===""&&t.#t.length===0&&(t.#a=!0),h.push(y),y="",t.push(...p,h),d;y+=S}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,Uz)}#m(e,t=Bz){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=qz){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Pn(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!LO.get(this.type)?.has(e)}#b(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#v(e){let t=LO.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#S(){if(NO(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#b(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Pn(null,void 0,t);return Pn.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#S(),this.#p()),!NO(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,S,v,w]=typeof p=="string"?Pn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||w,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&zz.has(this.#t[0]))){let y=Gz,S=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=S?Wz:v?Bm:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,$i(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,$i(this.toString()),!1,!1]}let a=!r||e||t||!Bm?"":this.#w(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Bm:"")+jO;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Bm:"")+kO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,$i(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#x(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(Hz.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=DO(e,l);if(h){s+=f,a=a||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?jO:kO,t=!0;continue}else c=!1;if(u==="?"){s+=Xw,t=!0;continue}s+=Qz(u)}return[s,$i(e),!!t,a]}};Pn=qo;var El=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var jr=o((n,e,t={})=>(bf(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Vn(e,t).match(n)),"minimatch"),Kz=/^\*+([^+@!?\*\[\(]*)$/,Yz=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),Xz=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),Jz=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),Zz=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),eH=/^\*+\.\*+$/,tH=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),rH=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),nH=/^\.\*+$/,iH=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),sH=/^\*+$/,aH=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),oH=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),cH=/^\?+([^+@!?\*\[\(]*)?$/,lH=o(([n,e=""])=>{let t=BO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),uH=o(([n,e=""])=>{let t=UO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),fH=o(([n,e=""])=>{let t=UO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),dH=o(([n,e=""])=>{let t=BO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),BO=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),UO=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),qO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",MO={win32:{sep:"\\"},posix:{sep:"/"}},hH=qO==="win32"?MO.win32.sep:MO.posix.sep;jr.sep=hH;var Gt=Symbol("globstar **");jr.GLOBSTAR=Gt;var pH="[^/]",mH=pH+"*?",gH="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",yH="(?:(?!(?:\\/|^)\\.).)*?",_H=o((n,e={})=>t=>jr(t,n,e),"filter");jr.filter=_H;var ii=o((n,e={})=>Object.assign({},n,e),"ext"),bH=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return jr;let e=jr;return Object.assign(o((r,i,s={})=>e(r,i,ii(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,ii(n,s))}static defaults(i){return e.defaults(ii(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,ii(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,ii(n,s))}},unescape:o((r,i={})=>e.unescape(r,ii(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,ii(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,ii(n,i)),"filter"),defaults:o(r=>e.defaults(ii(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,ii(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,ii(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,ii(n,s)),"match"),sep:e.sep,GLOBSTAR:Gt})},"defaults");jr.defaults=bH;var WO=o((n,e={})=>(bf(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,VO.default)(n)),"braceExpand");jr.braceExpand=WO;var SH=o((n,e={})=>new Vn(n,e).makeRe(),"makeRe");jr.makeRe=SH;var wH=o((n,e,t={})=>{let r=new Vn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");jr.match=wH;var $O=/[?*]|[+@!]\(.*?\)|\[|\]/,vH=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Vn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){bf(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||qO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!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=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!$O.test(s[2]))&&!$O.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][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 r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),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 s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Gt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Gt,s),c=t.lastIndexOf(Gt),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let T=e.slice(i,i+l.length);if(!this.#r(T,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let T=e.length-f.length;if(this.#r(e,f,r,T,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(T--,!this.#r(e,f,r,T,0)))return!1;d=f.length+1}}if(!u.length){let T=!!d;for(let C=i;C<e.length-d;C++){let M=String(e[C]);if(T=!0,M==="."||M===".."||!this.options.dot&&M.startsWith("."))return!1}return r||T}let h=[[[],0]],p=h[0],y=0,S=[0];for(let T of u)T===Gt?(S.push(y),p=[[],0],h.push(p)):(p[0].push(T),y++);let v=h.length-1,w=e.length-d;for(let T of h)T[1]=w-(S[v--]+T[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],d=e[a];if(this.debug(t,f,d),f===!1||f===Gt)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return WO(this.pattern,this.options)}parse(e){bf(e);let t=this.options;if(e==="**")return Gt;if(e==="")return"";let r,i=null;(r=e.match(sH))?i=t.dot?oH:aH:(r=e.match(Kz))?i=(t.nocase?t.dot?Zz:Jz:t.dot?Xz:Yz)(r[1]):(r=e.match(cH))?i=(t.nocase?t.dot?uH:lH:t.dot?fH:dH)(r):(r=e.match(eH))?i=t.dot?rH:tH:(r=e.match(nH))&&(i=iH);let s=qo.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}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,r=t.noglobstar?mH:t.dot?gH:yH,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?vH(f):f===Gt?Gt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Gt||p===Gt||(p===void 0?h!==void 0&&h!==Gt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Gt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Gt))}),u.filter(f=>f!==Gt).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+c+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...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 r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return jr.defaults(e).Minimatch}};jr.AST=qo;jr.Minimatch=Vn;jr.escape=El;jr.unescape=$i;var pP=require("node:url");var Tl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,zO=new Set,Jw=typeof process=="object"&&process?process:{},HO=o((n,e,t,r)=>{typeof Jw.emitWarning=="function"?Jw.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Um=globalThis.AbortController,GO=globalThis.AbortSignal;if(typeof Um>"u"){GO=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Um=class{static{o(this,"AbortController")}constructor(){e()}signal=new GO;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=Jw.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,HO("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",e))},"warnACPolyfill")}var EH=o(n=>!zO.has(n),"shouldWarn");var Ga=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),QO=o(n=>Ga(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Al:null:null,"getUintArray"),Al=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},Zw=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=QO(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},wf=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#_;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#d;#m;#y;#f;#E;#T;#b;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#b,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#M(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#C(t),"indexes"),rindexes:o(t=>e.#R(t),"rindexes"),isStale:o(t=>e.#A(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#_}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:v,memoMethod:w,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:$,ignoreFetchAbort:ee}=e;if(t!==0&&!Ga(t))throw new TypeError("max option must be a nonnegative integer");let B=t?QO(t):Array;if(!B)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=S,this.sizeCalculation){if(!this.#n&&!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(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#_=w,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new B(t),this.#g=new B(t),this.#d=0,this.#m=0,this.#y=Zw.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#n!==0&&!Ga(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ga(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ga(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ga(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let z="LRU_CACHE_UNBOUNDED";EH(z)&&(zO.add(z),HO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",z,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#x(){let e=new Al(this.#e),t=new Al(this.#e);this.#b=e,this.#T=t,this.#F=(s,a,c=Tl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#P(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#I=s=>{t[s]=e[s]!==0?Tl.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=Tl.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#I=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#O(){let e=new Al(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Ga(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ga(i))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 i},this.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#j(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#C({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#C())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#R())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#C()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*values(){for(let e of this.#C())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#R())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#C()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#R()){let i=this.#a[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#R({allowStale:!0}))this.#A(t)&&(this.#P(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#b&&this.#T){let a=this.#b[t],c=this.#T[t];if(a&&c){let l=a-(Tl.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#b&&this.#T){a.ttl=this.#b[t];let c=Tl.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Tl.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#P(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#j(!1):this.#i,this.#l[d]=e,this.#a[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#N(d,f,l),l&&(l.set="add"),u=!1;else{this.#V(d);let h=this.#a[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else a||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#D(d),this.#N(d,f,l),this.#a[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#b&&this.#x(),this.#b&&(u||this.#F(d,i,s),l&&this.#o(l,d)),!a&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#d];if(this.#j(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#j(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#h(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#I(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#A(i))return;let s=this.#a[i];return this.#h(s)?s.__staleWhileFetching:s}#M(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new Um,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((S,v=!1)=>{let{aborted:w}=a.signal,T=r.ignoreFetchAbort&&S!==void 0;if(r.status&&(w&&!v?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,T&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!T&&!v)return d(a.signal.reason);let C=p;return this.#a[t]===p&&(S===void 0?C.__staleWhileFetching?this.#a[t]=C.__staleWhileFetching:this.#P(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,S,l.options))),S},"cb"),f=o(S=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=S),d(S)),"eb"),d=o(S=>{let{aborted:v}=a.signal,w=v&&r.allowStaleOnFetchAbort,T=w||r.allowStaleOnFetchRejection,C=T||r.noDeleteOnFetchRejection,M=p;if(this.#a[t]===p&&(!C||M.__staleWhileFetching===void 0?this.#P(e,"fetch"):w||(this.#a[t]=M.__staleWhileFetching)),T)return r.status&&M.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),M.__staleWhileFetching;if(M.__returned===M)throw S},"fetchFail"),h=o((S,v)=>{let w=this.#c?.(e,s,l);w&&w instanceof Promise&&w.then(T=>S(T===void 0?void 0:T),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(S(void 0),r.allowStaleOnFetchAbort&&(S=o(T=>u(T,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Um}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:S,forceRefresh:v=!1,status:w,signal:T}=t;if(!this.#S)return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:w});let C={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:w,signal:T},M=this.#s.get(e);if(M===void 0){w&&(w.fetch="miss");let $=this.#M(e,M,C,S);return $.__returned=$}else{let $=this.#a[M];if(this.#h($)){let D=r&&$.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?$.__staleWhileFetching:$.__returned=$}let ee=this.#A(M);if(!v&&!ee)return w&&(w.fetch="hit"),this.#V(M),i&&this.#I(M),w&&this.#o(w,M),$;let B=this.#M(e,M,C,S),P=B.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=ee?"stale":"refresh",P&&ee&&(w.returnedStale=!0)),P?B.__staleWhileFetching:B.__returned=B}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#_;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#h(l);return a&&this.#o(a,c),this.#A(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#P(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#I(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#P(e,"delete")}#P(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#B(t);else{this.#D(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#R({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#b&&this.#T&&(this.#b.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var Cl=require("node:path"),iP=require("node:url"),Es=require("fs"),DH=le(require("node:fs"),1),Qa=require("node:fs/promises");var Km=require("node:events"),av=le(require("node:stream"),1),ZO=require("node:string_decoder");var KO=typeof process=="object"&&process?process:{stdout:null,stderr:null},TH=o(n=>!!n&&typeof n=="object"&&(n instanceof Ha||n instanceof av.default||AH(n)||xH(n)),"isStream"),AH=o(n=>!!n&&typeof n=="object"&&n instanceof Km.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==av.default.Writable.prototype.pipe,"isReadable"),xH=o(n=>!!n&&typeof n=="object"&&n instanceof Km.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),la=Symbol("EOF"),ua=Symbol("maybeEmitEnd"),za=Symbol("emittedEnd"),qm=Symbol("emittingEnd"),vf=Symbol("emittedError"),Wm=Symbol("closed"),YO=Symbol("read"),Gm=Symbol("flush"),XO=Symbol("flushChunk"),Vi=Symbol("encoding"),xl=Symbol("decoder"),vr=Symbol("flowing"),Ef=Symbol("paused"),Il=Symbol("resume"),Er=Symbol("buffer"),_n=Symbol("pipes"),Tr=Symbol("bufferLength"),ev=Symbol("bufferPush"),zm=Symbol("bufferShift"),Kr=Symbol("objectMode"),zt=Symbol("destroyed"),tv=Symbol("error"),rv=Symbol("emitData"),JO=Symbol("emitEnd"),nv=Symbol("emitEnd2"),ws=Symbol("async"),iv=Symbol("abort"),Hm=Symbol("aborted"),Tf=Symbol("signal"),Wo=Symbol("dataListeners"),Bn=Symbol("discarded"),Af=o(n=>Promise.resolve().then(n),"defer"),IH=o(n=>n(),"nodefer"),CH=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),RH=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),OH=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Qm=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Il](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},sv=class extends Qm{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},PH=o(n=>!!n.objectMode,"isObjectModeOptions"),FH=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ha=class extends Km.EventEmitter{static{o(this,"Minipass")}[vr]=!1;[Ef]=!1;[_n]=[];[Er]=[];[Kr];[Vi];[ws];[xl];[la]=!1;[za]=!1;[qm]=!1;[Wm]=!1;[vf]=null;[Tr]=0;[zt]=!1;[Tf];[Hm]=!1;[Wo]=0;[Bn]=!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");PH(t)?(this[Kr]=!0,this[Vi]=null):FH(t)?(this[Vi]=t.encoding,this[Kr]=!1):(this[Kr]=!1,this[Vi]=null),this[ws]=!!t.async,this[xl]=this[Vi]?new ZO.StringDecoder(this[Vi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Er],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[_n],"get")});let{signal:r}=t;r&&(this[Tf]=r,r.aborted?this[iv]():r.addEventListener("abort",()=>this[iv]()))}get bufferLength(){return this[Tr]}get encoding(){return this[Vi]}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[Kr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ws]}set async(e){this[ws]=this[ws]||!!e}[iv](){this[Hm]=!0,this.emit("abort",this[Tf]?.reason),this.destroy(this[Tf]?.reason)}get aborted(){return this[Hm]}set aborted(e){}write(e,t,r){if(this[Hm])return!1;if(this[la])throw new Error("write after end");if(this[zt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[ws]?Af:IH;if(!this[Kr]&&!Buffer.isBuffer(e)){if(OH(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(RH(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Kr]?(this[vr]&&this[Tr]!==0&&this[Gm](!0),this[vr]?this.emit("data",e):this[ev](e),this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr]):e.length?(typeof e=="string"&&!(t===this[Vi]&&!this[xl]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Vi]&&(e=this[xl].write(e)),this[vr]&&this[Tr]!==0&&this[Gm](!0),this[vr]?this.emit("data",e):this[ev](e),this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr]):(this[Tr]!==0&&this.emit("readable"),r&&i(r),this[vr])}read(e){if(this[zt])return null;if(this[Bn]=!1,this[Tr]===0||e===0||e&&e>this[Tr])return this[ua](),null;this[Kr]&&(e=null),this[Er].length>1&&!this[Kr]&&(this[Er]=[this[Vi]?this[Er].join(""):Buffer.concat(this[Er],this[Tr])]);let t=this[YO](e||null,this[Er][0]);return this[ua](),t}[YO](e,t){if(this[Kr])this[zm]();else{let r=t;e===r.length||e===null?this[zm]():typeof r=="string"?(this[Er][0]=r.slice(e),t=r.slice(0,e),this[Tr]-=e):(this[Er][0]=r.subarray(e),t=r.subarray(0,e),this[Tr]-=e)}return this.emit("data",t),!this[Er].length&&!this[la]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[la]=!0,this.writable=!1,(this[vr]||!this[Ef])&&this[ua](),this}[Il](){this[zt]||(!this[Wo]&&!this[_n].length&&(this[Bn]=!0),this[Ef]=!1,this[vr]=!0,this.emit("resume"),this[Er].length?this[Gm]():this[la]?this[ua]():this.emit("drain"))}resume(){return this[Il]()}pause(){this[vr]=!1,this[Ef]=!0,this[Bn]=!1}get destroyed(){return this[zt]}get flowing(){return this[vr]}get paused(){return this[Ef]}[ev](e){this[Kr]?this[Tr]+=1:this[Tr]+=e.length,this[Er].push(e)}[zm](){return this[Kr]?this[Tr]-=1:this[Tr]-=this[Er][0].length,this[Er].shift()}[Gm](e=!1){do;while(this[XO](this[zm]())&&this[Er].length);!e&&!this[Er].length&&!this[la]&&this.emit("drain")}[XO](e){return this.emit("data",e),this[vr]}pipe(e,t){if(this[zt])return e;this[Bn]=!1;let r=this[za];return t=t||{},e===KO.stdout||e===KO.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[_n].push(t.proxyErrors?new sv(this,e,t):new Qm(this,e,t)),this[ws]?Af(()=>this[Il]()):this[Il]()),e}unpipe(e){let t=this[_n].find(r=>r.dest===e);t&&(this[_n].length===1?(this[vr]&&this[Wo]===0&&(this[vr]=!1),this[_n]=[]):this[_n].splice(this[_n].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[Bn]=!1,this[Wo]++,!this[_n].length&&!this[vr]&&this[Il]();else if(e==="readable"&&this[Tr]!==0)super.emit("readable");else if(CH(e)&&this[za])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[vf]){let i=t;this[ws]?Af(()=>i.call(this,this[vf])):i.call(this,this[vf])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Wo]=this.listeners("data").length,this[Wo]===0&&!this[Bn]&&!this[_n].length&&(this[vr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Wo]=0,!this[Bn]&&!this[_n].length&&(this[vr]=!1)),t}get emittedEnd(){return this[za]}[ua](){!this[qm]&&!this[za]&&!this[zt]&&this[Er].length===0&&this[la]&&(this[qm]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wm]&&this.emit("close"),this[qm]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==zt&&this[zt])return!1;if(e==="data")return!this[Kr]&&!r?!1:this[ws]?(Af(()=>this[rv](r)),!0):this[rv](r);if(e==="end")return this[JO]();if(e==="close"){if(this[Wm]=!0,!this[za]&&!this[zt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[vf]=r,super.emit(tv,r);let s=!this[Tf]||this.listeners("error").length?super.emit("error",r):!1;return this[ua](),s}else if(e==="resume"){let s=super.emit("resume");return this[ua](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[ua](),i}[rv](e){for(let r of this[_n])r.dest.write(e)===!1&&this.pause();let t=this[Bn]?!1:super.emit("data",e);return this[ua](),t}[JO](){return this[za]?!1:(this[za]=!0,this.readable=!1,this[ws]?(Af(()=>this[nv]()),!0):this[nv]())}[nv](){if(this[xl]){let t=this[xl].end();if(t){for(let r of this[_n])r.dest.write(t);this[Bn]||super.emit("data",t)}}for(let t of this[_n])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Kr]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Kr]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Kr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Vi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(zt,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Bn]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[la])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(zt,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(zt,f),this.pause(),s({value:d,done:!!this[la]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(zt,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{a=h,s=d,this.once(zt,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Bn]=!1;let e=!1,t=o(()=>(this.pause(),this.off(tv,t),this.off(zt,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(tv,t),this.once(zt,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[zt])return e?this.emit("error",e):this.emit(zt),this;this[zt]=!0,this[Bn]=!0,this[Er].length=0,this[Tr]=0;let t=this;return typeof t.close=="function"&&!this[Wm]&&t.close(),e?this.emit("error",e):this.emit(zt),this}static get isStream(){return TH}};var NH=Es.realpathSync.native,If={lstatSync:Es.lstatSync,readdir:Es.readdir,readdirSync:Es.readdirSync,readlinkSync:Es.readlinkSync,realpathSync:NH,promises:{lstat:Qa.lstat,readdir:Qa.readdir,readlink:Qa.readlink,realpath:Qa.realpath}},sP=o(n=>!n||n===If||n===DH?If:{...If,...n,promises:{...If.promises,...n.promises||{}}},"fsFromOption"),aP=/^\\\\\?\\([a-z]:)\\?$/i,LH=o(n=>n.replace(/\//g,"\\").replace(aP,"$1\\"),"uncToDrive"),kH=/[\\\/]/,ai=0,oP=1,cP=2,vs=4,lP=6,uP=8,Go=10,fP=12,si=15,xf=~si,ov=16,eP=32,Cf=64,Bi=128,Ym=256,Jm=512,tP=Cf|Bi|Jm,jH=1023,cv=o(n=>n.isFile()?uP:n.isDirectory()?vs:n.isSymbolicLink()?Go:n.isCharacterDevice()?cP:n.isBlockDevice()?lP:n.isSocket()?fP:n.isFIFO()?oP:ai,"entToType"),rP=new Map,Rf=o(n=>{let e=rP.get(n);if(e)return e;let t=n.normalize("NFKD");return rP.set(n,t),t},"normalize"),nP=new Map,Xm=o(n=>{let e=nP.get(n);if(e)return e;let t=Rf(n.toLowerCase());return nP.set(n,t),t},"normalizeNocase"),Zm=class extends wf{static{o(this,"ResolveCache")}constructor(){super({max:256})}},lv=class extends wf{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},dP=Symbol("PathScurry setAsCwd"),Yr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#_;get gid(){return this.#_}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#b;#v;#S;#w;#x;#I;#o;#F;#A;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ai,r,i,s,a,c){this.name=e,this.#b=s?Xm(e):Rf(e),this.#o=t&jH,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#S=c.fullpath,this.#x=c.relative,this.#I=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=sP(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);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.#o&=~ov,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Xm(e):Rf(e);for(let l of r)if(l.#b===i)return l;let s=this.parent?this.sep:"",a=this.#S?this.#S+s+e:void 0,c=this.newChild(e,ai,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=Bi),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#o&si)===ai}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.#o&si)===uP}isDirectory(){return(this.#o&si)===vs}isCharacterDevice(){return(this.#o&si)===cP}isBlockDevice(){return(this.#o&si)===lP}isFIFO(){return(this.#o&si)===oP}isSocket(){return(this.#o&si)===fP}isSymbolicLink(){return(this.#o&Go)===Go}lstatCached(){return this.#o&eP?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#o&si;return!(e!==ai&&e!==Go||this.#o&Ym||this.#o&Bi)}calledReaddir(){return!!(this.#o&ov)}isENOENT(){return!!(this.#o&Bi)}isNamed(e){return this.nocase?this.#b===Xm(e):this.#b===Rf(e)}async readlink(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#A=r}catch(t){this.#h(t.code);return}}#N(e){this.#o|=ov;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&Bi||(this.#o=(this.#o|Bi)&xf,this.#C())}#C(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#R(){this.#o|=Jm,this.#k()}#k(){if(this.#o&Cf)return;let e=this.#o;(e&si)===vs&&(e&=xf),this.#o=e|Cf,this.#C()}#j(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#M(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#h(e=""){let t=this.#o;t|=Ym,e==="ENOENT"&&(t|=Bi),(e==="EINVAL"||e==="UNKNOWN")&&(t&=xf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#P(e,t)||this.#V(e,t)}#V(e,t){let r=cv(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&si;return s!==vs&&s!==Go&&s!==ai&&(i.#o|=Cf),t.unshift(i),t.provisional++,i}#P(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Xm(e.name):Rf(e.name))===i.#b)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#o=t.#o&xf|cv(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&Bi)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#M(e.code)}}lstatSync(){if((this.#o&Bi)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#M(e.code)}}#G(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:S,nlink:v,rdev:w,size:T,uid:C}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#d=u,this.#n=f,this.#_=d,this.#s=h,this.#r=p,this.#f=y,this.#g=S,this.#t=v,this.#i=w,this.#l=T,this.#c=C;let M=cv(e);this.#o=this.#o&xf|M|eP,M!==ai&&M!==vs&&M!==Go&&(this.#o|=Cf)}#q=[];#W=!1;#z(e){this.#W=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#W)return;this.#W=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#j(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#z(r.slice(0,r.provisional))})}#U;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.#U)await this.#U;else{let r=o(()=>{},"resolve");this.#U=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#j(i.code),e.provisional=0}this.#U=void 0,r()}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 r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#j(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&tP)return!1;let e=si&this.#o;return e===ai||e===vs||e===Go}shouldWalk(e,t){return(this.#o&vs)===vs&&!(this.#o&tP)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((Jm|Ym|Bi)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}realpathSync(){if(this.#O)return this.#O;if(!((Jm|Ym|Bi)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#R()}}[dP](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#x=r.join(this.sep),i.#I=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#I=void 0,i=i.parent}},eg=class n extends Yr{static{o(this,"PathWin32")}sep="\\";splitSep=kH;constructor(e,t=ai,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=ai,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return Cl.win32.parse(e).root}getRoot(e){if(e=LH(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new Rl(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(aP,"$1\\"),e===t}},tg=class n extends Yr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=ai,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=ai,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},rg=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=If}={}){this.#t=sP(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,iP.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Zm,this.#n=new Zm,this.#r=new lv(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let S=f--;u=u.child(y,{relative:new Array(S).fill("..").join(d),relativePosix:new Array(S).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.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 Yr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?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 Yr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let S=y.length;if(!S)return h();let v=o(()=>{--S===0&&h()},"next");for(let w of y)(!s||s(w))&&c.push(r?w:w.fullpath()),i&&w.isSymbolicLink()?w.realpath().then(T=>T?.isUnknown()?T.lstat():T).then(T=>T?.shouldWalk(l,a)?u(T,v):v()):w.shouldWalk(l,a)?u(w,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,a)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(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 Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,a)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ha({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=o((v,w,T=!1)=>{if(v)return c.emit("error",v);if(i&&!T){let C=[];for(let M of w)M.isSymbolicLink()&&C.push(M.realpath().then($=>$?.isUnknown()?$.lstat():$));if(C.length){Promise.all(C).then(()=>y(null,w,!0));return}}for(let C of w)C&&(!s||s(C))&&(c.write(r?C:C.fullpath())||(h=!0));f--;for(let C of w){let M=C.realpathCached()||C;M.shouldWalk(l,a)&&u.push(M)}h&&!c.flowing?c.once("drain",d):S||d()},"onReaddir"),S=!0;p.readdirCB(y,!0),S=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Yr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ha({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=o(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let S of y)(!s||s(S))&&(c.write(r?S:S.fullpath())||(h=!0));f--;for(let S of y){let v=S;if(S.isSymbolicLink()){if(!(i&&(v=S.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,a)&&u.push(v)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[dP](t)}},Rl=class extends rg{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,Cl.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return Cl.win32.parse(e).root.toUpperCase()}newRoot(e){return new eg(this.rootPath,vs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Ol=class extends rg{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,Cl.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new tg(this.rootPath,vs,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Of=class extends Ol{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Ule=process.platform==="win32"?eg:tg,hP=process.platform==="win32"?Rl:process.platform==="darwin"?Of:Ol;var MH=o(n=>n.length>=1,"isPatternList"),$H=o(n=>n.length>=1,"isGlobList"),Pl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!MH(e))throw new TypeError("empty pattern list");if(!$H(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let S=[s,a,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[S,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===Gt}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#_=this.#_||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var VH=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Fl=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=VH}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Vn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new Pl(i,s,0,this.platform),c=new Vn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var uv=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},fv=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},dv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.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())}},Pf=class n{static{o(this,"Processor")}hasWalkedCache;matches=new fv;subwalks=new dv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new uv}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===Gt){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gt?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var BH=o((n,e)=>typeof n=="string"?new Fl([n],e):Array.isArray(n)?new Fl(n,e):n,"makeIgnore"),ng=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=BH(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(s,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.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Pf(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Pf(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Ff=class extends ng{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}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}},Df=class extends ng{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ha({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}};var UH=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ui=class{static{o(this,"Glob")}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=(0,pP.fileURLToPath)(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(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||UH,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 l=t.platform==="win32"?Rl:t.platform==="darwin"?Of:t.platform?Ol:hP;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new Vn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Pl(l,f,0,this.platform)})}async walk(){return[...await new Ff(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 Ff(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 Df(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 Df(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()}};var hv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Vn(t,e).hasMagic())return!0;return!1},"hasMagic");function ig(n,e={}){return new Ui(n,e).streamSync()}o(ig,"globStreamSync");function gP(n,e={}){return new Ui(n,e).stream()}o(gP,"globStream");function yP(n,e={}){return new Ui(n,e).walkSync()}o(yP,"globSync");async function mP(n,e={}){return new Ui(n,e).walk()}o(mP,"glob_");function sg(n,e={}){return new Ui(n,e).iterateSync()}o(sg,"globIterateSync");function _P(n,e={}){return new Ui(n,e).iterate()}o(_P,"globIterate");var qH=ig,WH=Object.assign(gP,{sync:ig}),GH=sg,zH=Object.assign(_P,{sync:sg}),HH=Object.assign(yP,{stream:ig,iterate:sg}),Dl=Object.assign(mP,{glob:mP,globSync:yP,sync:HH,globStream:gP,stream:WH,globStreamSync:ig,streamSync:qH,globIterate:_P,iterate:zH,globIterateSync:sg,iterateSync:GH,Glob:Ui,hasMagic:hv,escape:El,unescape:$i});Dl.glob=Dl;async function SP(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,a=zo.default.join(n,"**/*.md"),c=await Dl(a,{nodir:!0,ignore:[zo.default.join(n,".obsidian/**"),zo.default.join(n,".trash/**"),zo.default.join(n,"**/.obsidian/**"),zo.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=zo.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await pv.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=QH(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await pv.default.writeFile(u,h,"utf-8"))}return l}o(SP,"rewriteInboundWikilinks");function QH(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=r[s],c=KH(a,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}o(QH,"rewriteContent");function KH(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let a=YH(r[s],e,t);i+=a.replacements,r[s]=a.updated}return{updated:r.join(""),replacements:i}}o(KH,"rewriteProseSegment");function YH(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)(?:[#^][^\[\]\n|]*)?(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(a,c)=>c.trim()!==e?a:(i+=1,`[[${t}]]`)),replacements:i}}o(YH,"replaceWikilinks");var XH=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Lt=class{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{o(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return nr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await nr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await nr.default.ensureDir(Ht.default.dirname(r)),await nr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await nr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return nr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=nr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Ht.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=nr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),a=this.replaceFrontmatter(r,s);await this.modify(e,a)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await nr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await nr.default.ensureDir(Ht.default.dirname(i)),await nr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await nr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(XH.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Ht.default.dirname(this.resolvePath(t)),s;if(Ht.default.isAbsolute(r)?s=this.resolvePath(r):s=Ht.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),nr.default.existsSync(s)){let u=Ht.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let a=r.toLowerCase(),c=this.basenameIndex.get(a);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(a);return l?this.createFileObject(l):null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Ht.default.relative(this.rootPath,e),r=Ht.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=nr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let a=s.aliases,c=Array.isArray(a)?a:typeof a=="string"?[a]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=Ht.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=Ht.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Ht.default.basename(t,".md");await SP(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Ht.default.isAbsolute(e)?e:Ht.default.join(this.rootPath,e)}createFileObject(e){let t=Ht.default.basename(e),r=Ht.default.basename(e,Ht.default.extname(e)),i=Ht.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Ht.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=rr.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=rr.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
|
|
489
489
|
${r.trim()}
|
|
490
490
|
---`):`---
|
|
491
491
|
${r.trim()}
|
|
@@ -760,7 +760,7 @@ ${r}`}o(RY,"serializeFile");function hD(n,e,t={}){let r=jg.default.dirname(n),i=
|
|
|
760
760
|
`).map(s=>s.trim()).filter(Boolean)){let s=OY.exec(i);if(s){r.push({sessionName:i,uuid:s[1],type:"full"});continue}let a=PY.exec(i);a&&r.push({sessionName:i,uuid:a[1],type:"short"})}return r}o(DY,"listClaudeChildSessions");function NY(n,e,t){let r=null,i=e.toLowerCase();function s(a){if(r)return;let c;try{c=(0,$g.readdirSync)(a,{withFileTypes:!0})}catch{return}for(let l of c){if(r)return;if(l.name.startsWith(".")||l.name==="node_modules")continue;let u=(0,pD.join)(a,l.name);if(l.isDirectory())s(u);else if(l.name.endsWith(".md")){let f=l.name.slice(0,-3).toLowerCase();(t==="full"&&f===i||t==="short"&&f.startsWith(i))&&(r=u)}}}return o(s,"walk"),s(n),r}o(NY,"findVaultFile");function LY(n,e){try{let i=(e??(s=>(0,$g.readFileSync)(s,"utf8")))(n).match(/ems__Effort_status\s*:.*\[\[([^\]]+)\]\]/);return i?i[1].includes(FY):!1}catch{return!1}}o(LY,"isTaskDoing");async function gD(n,e=Mg.exec,t){let r=await DY(e),i=[];for(let s of r){let a=NY(n,s.uuid,s.type);if(!a){i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:null,reason:"vault task not found"});continue}LY(a,t)||i.push({sessionName:s.sessionName,taskUuid:s.uuid,taskFilePath:a,reason:"vault task status != Doing"})}return i}o(gD,"detectOrphans");async function yD(n,e,t=Mg.exec,r=hD){let i=mD(t);if(e)return{ok:!0};let s=new Date().toISOString();if(n.taskFilePath)try{r(n.taskFilePath,{ems__Effort_status:"[[ems__EffortStatusFailed]]",aiTask__Task_lastError:`orphan recovery: ${n.reason}`,exo__Asset_updatedAt:s})}catch(a){return{ok:!1,error:`vault update failed: ${a.message}`}}try{await i(`tmux kill-session -t ${JSON.stringify(n.sessionName)}`)}catch{}return{ok:!0}}o(yD,"recoverOrphan");function kY(){return process.env.EXOCORTEX_VAULT??(0,Vg.join)((0,bD.homedir)(),"vault-2025")}o(kY,"defaultVault");function SD(){return new Ie("recover").description("Detect and recover orphaned claude-child tmux sessions. A session is orphaned when the corresponding vault task is not in Doing status. Default mode: dry-run (no changes). Use --apply to perform recovery.").option("--vault <path>","Path to Obsidian vault",kY()).option("--dry-run","List orphans without applying changes (default)",!1).option("--apply","Apply orphan recovery: set Failed + kill tmux session",!1).action(async n=>{let e=(0,Vg.resolve)(n.vault);if(!(0,_D.existsSync)(e)){console.error(`[recover] vault not found: ${e}`),process.exitCode=1;return}let t=!n.apply;console.log(`[recover] vault=${e} mode=${t?"dry-run":"apply"}`);let r=await gD(e);if(r.length===0){console.log("[recover] No orphaned claude-child sessions found.");return}console.log(`[recover] Found ${r.length} orphan(s):`);for(let a of r){let c=a.taskFilePath??"(not found in vault)";console.log(` session=${a.sessionName} uuid=${a.taskUuid} reason=${a.reason}`),console.log(` file=${c}`)}if(t){console.log("[recover] Dry-run mode: no changes applied. Use --apply to recover.");return}let i=0,s=0;for(let a of r){let c=await yD(a,!1);c.ok?(i++,console.log(`[recover] RECOVERED: ${a.sessionName}`)):(s++,console.error(`[recover] ERROR recovering ${a.sessionName}: ${c.error}`))}console.log(`[recover] Done: recovered=${i} errors=${s}`),s>0&&(process.exitCode=1)})}o(SD,"recoverCommand");var f2=require("fs"),Bg=require("path"),Wn=le(br());function jY(n,e){return e.concat([n])}o(jY,"collectAlso");var MY="https://exocortex.my/ontology/find#Alias_sparql",$Y="https://exocortex.my/ontology/exo#Asset_label";function Ql(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Ql,"nodeValue");async function VY(n,e){let t=await n.match(void 0,void 0,void 0),r=[];for(let s of t)Ql(s.predicate)!==$Y||Ql(s.object)!==e||r.push(Ql(s.subject));if(r.length===0)return null;let i=[];for(let s of r)for(let a of t)Ql(a.predicate)===MY&&Ql(a.subject)===s&&i.push(Ql(a.object));if(i.length===0)return null;if(i.length>1)throw new Vt(`Ambiguous find__Alias "${e}" \u2014 ${i.length} instances define a sparql fragment`,`Ensure exactly one find__Alias asset has exo:Asset_label "${e}"`);return i[0]}o(VY,"resolveAliasFragment");var BY=/^([a-z][a-zA-Z0-9]*)__([A-Za-z0-9_]+)$/,UY="https://exocortex.my/ontology/";function qY(n,e){let t=BY.exec(e);if(t){let i=`<${UY}${t[1]}#${t[2]}>`;return n.replace(/\?value\b/g,i)}let r=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return n.replace(/\?value\b/g,`"${r}"`)}o(qY,"bindValueLiteral");function wD(){return new Ie("find").description("Find vault assets via SPARQL \u2014 outputs file paths one per line (RFC 8e83442b T1.1)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include (repeatable)",jY,[]).option("--sparql <query>","SPARQL SELECT query (must bind ?path)").option("--class <value>","Filter by class label via find__Alias 'class' (e.g. ems__Task)").action(async n=>{pe.setFormat("text");try{if(n.sparql&&n.class)throw new Vt("--sparql and --class are mutually exclusive","Pass either a raw --sparql query or a find__Alias-backed flag like --class");if(!n.sparql&&!n.class)throw new Vt("one of --sparql <query> or --class <value> is required",'exocortex find --class ems__Task OR exocortex find --sparql "SELECT ?path WHERE { ... }"');let e=(0,Bg.resolve)(n.vault);if(!(0,f2.existsSync)(e))throw new Fe(e);let t=new Lt(e),i=await new Wn.NoteToRDFConverter(t).convertVault(),s=n.also||[];for(let w of s){let T=(0,Bg.resolve)(w);if(!(0,f2.existsSync)(T))throw new Fe(T);let C=new Lt(T),$=await new Wn.NoteToRDFConverter(C).convertVault();i=i.concat($)}let a=new Wn.InMemoryTripleStore;await a.addAll(i);let c;if(n.class){let w=await VY(a,"class");if(w===null)throw new Vt('No find__Alias with exo:Asset_label "class" was found in the vault',"Seed a find__Alias asset (label=class) or fall back to exocortex find --sparql");c=`SELECT ?path WHERE { ${qY(w,n.class)} }`}else c=n.sparql;let l=Bl(c);l=Ya(l);let u=new Wn.ExoQLParser,f=Xa(Ka(e));for(let w of s){let T=Xa(Ka((0,Bg.resolve)(w)));for(let[C,M]of T)f.has(C)||f.set(C,M)}f.size>0&&u.setVaultPrefixes(f);let d=u.parse(l),p=new Wn.ExoQLAlgebraTranslator().translate(d);p.type!=="construct"&&(p=new Wn.AlgebraOptimizer().optimize(p));let S=await new Wn.ExoQLQueryExecutor(a).executeAll(p),v="obsidian://vault/";for(let w of S){let C=w.toJSON().path;if(typeof C!="string"||!C.startsWith(v))continue;let M=C.slice(v.length),$;try{$=decodeURIComponent(M)}catch{$=M}process.stdout.write($+`
|
|
761
761
|
`)}}catch(e){pe.handle(e),process.exit(5)}})}o(wD,"findCommand");var h2=require("fs"),p2=require("path"),tt=le(br());var xD=le(br()),Ut=le(ED());var TD="obsidian://vault/";function tX(n){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return{async resolveTargetPath(t){if(!t)throw new Error("Cannot resolve empty targetIRI to a vault path");let r=t;if(r.startsWith(TD))r=decodeURI(r.slice(TD.length));else if(e.test(r)){let i=await n.findFileByUID(r);if(!i)throw new Error(`No vault file found for UID: ${r}`);r=i}if(r.endsWith(".md")||(r=`${r}.md`),!await n.fileExists(r))throw new Error(`Cannot resolve target file for IRI "${t}" (tried "${r}")`);return r}}}o(tX,"createCliPathResolver");var rX=["createAsset","openFile","sparqlSelect","getActiveFileIRI","getActiveFilePath","trashFile","duplicateFile"],d2=class extends Error{constructor(t){super(`Service "${t}" is not implemented in the CLI (no-op stub). dyncommand exec on this service_call grounding cannot change vault state. See CLI parity issues #2865-#2868 for port status.`);this.serviceId=t;this.name="CliServiceNotImplementedError"}static{o(this,"CliServiceNotImplementedError")}};function AD(n){return{async execute(){throw new d2(n)}}}o(AD,"notImplementedService");function ID(n,e){for(let t of rX)n.register(t,AD(t));for(let t of["updateProperty","removeProperty","setStatus"])n.register(t,AD(t));if(e){if(e.fsAdapter){let t=new xD.FrontmatterService,r=tX(e.fsAdapter);n.register("updateProperty",(0,Ut.createUpdatePropertyService)(e.fsAdapter,t,r)),n.register("removeProperty",(0,Ut.createRemovePropertyService)(e.fsAdapter,t,r)),n.register("setStatus",(0,Ut.createSetStatusService)(e.fsAdapter,t,r))}n.register("createRelatedTask",(0,Ut.createCreateRelatedTaskService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("createRelatedProject",(0,Ut.createCreateRelatedProjectService)(e.vaultAdapter,e.genericAssetCreationService)),n.register("archiveAsset",(0,Ut.createArchiveAssetService)(e.vaultAdapter,e.archiveAssetService)),n.register("planForEvening",(0,Ut.createPlanForEveningService)(e.vaultAdapter,e.taskStatusService)),n.register("cleanProperties",(0,Ut.createCleanPropertiesService)(e.vaultAdapter,e.propertyCleanupService)),n.register("renameToUid",(0,Ut.createRenameToUidService)(e.vaultAdapter,e.renameToUidService)),n.register("repairFolder",(0,Ut.createRepairFolderService)(e.vaultAdapter,e.folderRepairService)),n.register("fixMissingLabel",(0,Ut.createFixMissingLabelService)(e.vaultAdapter,e.fixMissingLabelService))}}o(ID,"populateCliServiceRegistry");var nX=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function iX(){if(process.stdin.isTTY)return[];let n=[];for await(let t of process.stdin)n.push(t);return Buffer.concat(n).toString("utf-8").split(`
|
|
762
762
|
`).map(t=>t.trim()).filter(t=>t.length>0)}o(iX,"readStdinLines");function Ug(n){if(n&&typeof n=="object"&&"value"in n){let e=n.value;return typeof e=="string"?e:String(e)}return String(n)}o(Ug,"nodeValue");async function sX(n,e){let t=new tt.IRI("https://exocortex.my/ontology/exocmd#Command_cliName"),r=await n.match(void 0,t,void 0),i=[];for(let s of r)if(Ug(s.object)===e){let l=Ug(s.subject).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i);l&&i.push(l[1])}if(i.length===0)return null;if(i.length>1)throw new Vt(`Ambiguous cliName "${e}" \u2014 resolves to ${i.length} commands: ${i.join(", ")}`,"Use the UUID directly: exocortex apply <uuid> <path>");return i[0]}o(sX,"resolveSlugToUuid");async function aX(n,e){let t=new tt.IRI("https://exocortex.my/ontology/exocmd#Command_destructive"),r=await n.match(void 0,t,void 0);for(let i of r)if(Ug(i.subject).includes(e)){let a=Ug(i.object);if(a==="true"||a==="True")return!0}return!1}o(aX,"isDestructive");async function oX(n,e,t,r,i){let s=(0,p2.resolve)(n,r);if(!(0,h2.existsSync)(s))return console.error(`\u274C Target file not found: ${r}`),!1;let c=await new tt.CommandResolver(e).loadCommand(t);if(!c)return console.error(`\u274C Command with UID "${t}" not found.`),!1;if(await aX(e,t)&&!i.dryRun&&!i.yes)return console.error(`\u274C Command "${c.name}" is marked destructive. Add --dry-run to preview, or --yes to apply.`),!1;let u=(0,tt.vaultPathToIRI)(r);if(!await new tt.PreconditionEvaluator(e).evaluate(c.precondition,u))return console.error(`\u274C Precondition not satisfied for "${c.name}" on "${r}".`),!1;if(i.dryRun)return console.log(`\u{1F50D} Dry-run: would apply "${c.name}" to "${r}" (precondition passed).`),!0;let h=new tt.ServiceRegistry,p=new Lt(n),y=new tt.GenericAssetCreationService(p),S=new tt.ArchiveAssetService(p),v=new tt.PropertyCleanupService(p),w=new tt.FixMissingLabelService(p),T=new tt.RenameToUidService(p),C=new tt.FolderRepairService(p),M=new tt.TaskStatusService(p,new tt.EffortStatusWorkflow,new tt.StatusTimestampService(p)),$=new hr(n);ID(h,{vaultAdapter:p,fsAdapter:$,genericAssetCreationService:y,archiveAssetService:S,taskStatusService:M,propertyCleanupService:v,fixMissingLabelService:w,renameToUidService:T,folderRepairService:C});let ee=new tt.GroundingExecutor($,$,h),B;if(i.input)try{let P=JSON.parse(i.input);if(typeof P!="object"||P===null||Array.isArray(P))throw new Error("must be a JSON object");B=P}catch(P){let D=P instanceof Error?P.message:String(P);return console.error(`\u274C --input: invalid JSON object (${D})`),!1}let z=await ee.execute(c.grounding,u,r,B);if(z.success){let P=c.successMessage??`Applied "${c.name}" to "${r}".`;return console.log(`\u2705 ${P}`),!0}else return console.error(`\u274C "${c.name}" failed on "${r}": ${z.error}`),!1}o(oX,"executeOnTarget");function CD(){return new Ie("apply").description("Apply an exocmd__Command to one or more vault assets (RFC 8e83442b T1.2). Pass a path arg or pipe paths via stdin.").argument("<cmd>","Command UUID or cliName slug").argument("[path]","Vault-relative path to target asset (omit to read paths from stdin)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--dry-run","Preview without writing").option("--yes","Skip destructive-command confirmation").option("--input <json>","JSON userInput for service_call groundings").action(async(n,e,t)=>{pe.setFormat("text");try{let r=(0,p2.resolve)(t.vault);if(!(0,h2.existsSync)(r))throw new Fe(r);let i=new Lt(r),a=await new tt.NoteToRDFConverter(i).convertVault(),c=new tt.InMemoryTripleStore;await c.addAll(a);let l;if(nX.test(n))l=n;else{let h=await sX(c,n);h||(console.error(`\u274C No command found with UUID or cliName "${n}".`),process.exit(3)),l=h}let u;if(e)u=[e];else if(u=await iX(),u.length===0)throw new Vt("No target path provided and stdin is empty.","exocortex apply <uuid> <path> OR exocortex find ... | exocortex apply <uuid>");let f=0,d=0;for(let h of u)await oX(r,c,l,h,t)?f++:d++;u.length>1&&console.log(`
|
|
763
|
-
\u{1F4CA} Applied to ${f}/${u.length} target(s) (${d} failed).`),d>0&&process.exit(5)}catch(r){pe.handle(r),process.exit(5)}})}o(CD,"applyCommand");function RD(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.
|
|
763
|
+
\u{1F4CA} Applied to ${f}/${u.length} target(s) (${d} failed).`),d>0&&process.exit(5)}catch(r){pe.handle(r),process.exit(5)}})}o(CD,"applyCommand");function RD(n){let e=new Ie;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.13.1"),e.addCommand(wD()),e.addCommand(CD()),e.addCommand(ZP()),e.addCommand(nF()),e.addCommand(CF()),e.addCommand(aF()),e.addCommand(oF()),e.addCommand(dF()),e.addCommand(PF()),e.addCommand($F()),e.addCommand(UF()),e.addCommand(qF()),e.addCommand(GF()),e.addCommand(rD()),e.addCommand(nD()),e.addCommand(uD()),e.addCommand(SD()),e}o(RD,"createProgram");RD().parse();0&&(module.exports={createProgram});
|
|
764
764
|
/*! Bundled license information:
|
|
765
765
|
|
|
766
766
|
reflect-metadata/Reflect.js:
|