@kitelev/exocortex-cli 15.55.17 → 15.55.19

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v15.55.17
2
+ // @kitelev/exocortex-cli v15.55.19
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -535,7 +535,7 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
535
535
  `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new kt.SPARQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new kt.AlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new kt.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new kt.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Z.success({valid:!0,queryType:nO(i),message:"Query syntax is valid"});console.log(JSON.stringify(s,null,2))}else console.log("\u2705 Query syntax is valid"),console.log(` Query type: ${nO(i)}`)}catch(i){sO(i,n,t)}}o(Hq,"executeDryRun");function nO(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(nO,"getQueryType");function zq(n,e){switch(e){case"json":let t=new Kc;console.log(t.format(n));break;case"csv":let r=new em;console.log(r.format(n));break;case"table":default:let i=new Yc;console.log(i.format(n));break}}o(zq,"formatSelectResults");function Qq(n,e){let t=new Xc;switch(e){case"json":console.log(t.formatJson(n));break;case"ntriples":console.log(t.formatNTriples(n));break;case"table":default:console.log(t.formatTable(n));break}}o(Qq,"formatConstructResults");function Yq(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"csv":if(n.length===0){console.log("");return}let t=Object.keys(n[0]);console.log(t.join(","));for(let i of n){let s=t.map(a=>{let c=i[a];return c==null?"":String(c).includes(",")?`"${c}"`:String(c)});console.log(s.join(","))}break;case"table":default:if(n.length===0){console.log("No results.");return}let r=Object.keys(n[0]);console.log(r.join(" ")),console.log(r.map(()=>"---").join(" "));for(let i of n){let s=r.map(a=>String(i[a]??""));console.log(s.join(" "))}break}}o(Yq,"formatCachedSelectResults");function Kq(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"ntriples":for(let t of n)console.log(`<${t.subject}> <${t.predicate}> ${Xq(t.object)} .`);break;case"table":default:console.log("Subject Predicate Object"),console.log("--- --- ---");for(let t of n)console.log(`${t.subject} ${t.predicate} ${t.object}`);break}}o(Kq,"formatCachedConstructResults");function Xq(n){return hm.formatObject(n)}o(Xq,"formatNTriplesObject");function Jq(n,e){for(let t of n){let r=[`${t.type.toUpperCase()}`];switch(t.inserted!==void 0&&r.push(`inserted: ${t.inserted}`),t.deleted!==void 0&&r.push(`deleted: ${t.deleted}`),r.push(t.success?"OK":"FAILED"),e){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":n.indexOf(t)===0&&console.log("type,inserted,deleted,success"),console.log(`${t.type},${t.inserted??""},${t.deleted??""},${t.success}`);break;case"table":default:console.log(`\u2705 ${r.join(" | ")}`);break}}}o(Jq,"formatUpdateResults");var aO=require("fs"),oO=require("path"),gm=X(er());function cO(){return new qe("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--stats","Show cache statistics after building").option("--force","Force rebuild even if cache is valid").option("--strict","Fail on first invalid IRI instead of skipping").option("--no-inference","Disable RDFS subClassOf inference materialization").action(async n=>{let e=n.output||"text";k.setFormat(e);try{let t=(0,oO.resolve)(n.vault);if(!(0,aO.existsSync)(t))throw new Oe(t);let r=new ns(t),i=r.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await r.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let s=Date.now(),a=await r.buildCacheWithValidation({strict:n.strict??!1}),c=0;if(n.inference!==!1){let{triples:u}=await r.loadOrBuild(),f=new gm.InMemoryTripleStore;if(await f.addAll(u),c=await new gm.RDFSInferenceEngine().materialize(f),c>0){let h=await f.match();await r.saveTriples(h),a.tripleCount+=c}e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred Instance_class triples`)}let l=Date.now()-s;if(e==="json"){let u={action:"build",cachePath:i,tripleCount:a.tripleCount,durationMs:a.durationMs},f={summary:a.summary,skippedFiles:a.skippedFiles};if(n.stats){let d=await r.getCacheStats();if(d){let h={tripleCount:d.tripleCount,createdAt:d.createdAt.toISOString(),isValid:d.isValid,sizeBytes:d.sizeBytes,cachePath:i},p=Z.success({cache:u,stats:h,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let d=Z.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(d,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
536
536
  \u26A0\uFE0F Files skipped due to IRI issues:`);for(let u of a.skippedFiles)console.log(` - ${u.path}`),console.log(` ${u.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${a.summary.indexed} files, skipped ${a.summary.skipped} (total: ${a.summary.total})`),console.log(`\u{1F4CA} Created cache with ${a.tripleCount.toLocaleString()} triples at ${i}`),console.log(`\u23F1\uFE0F Build time: ${a.durationMs}ms`),n.stats){let u=await r.getCacheStats();u&&(console.log(`
537
537
  \u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${Zq(u.sizeBytes)}`))}}}catch(t){k.handle(t)}})}o(cO,"sparqlIndexCommand");function Zq(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o(Zq,"formatBytes");function lO(){return new qe("templates").description("List available SPARQL query templates").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";k.setFormat(e);try{let t=new rl,r=t.listTemplates();if(e==="json"){let i=Z.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){k.handle(t)}})}o(lO,"sparqlTemplatesCommand");var gR=require("path");var ir=X(ya()),Ta=X(require("path"));var IO=X(wO(),1);var Qu=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var oW={"[: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]},Yu=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),cW=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),EO=o(n=>n.join(""),"rangesToString"),TO=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 b=n.charAt(s);if((b==="!"||b==="^")&&s===t+1){u=!0,s++;continue}if(b==="]"&&a&&!l){f=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[E,[w,A,I]]of Object.entries(oW))if(n.startsWith(E,s)){if(d)return["$.",!1,n.length-t,!0];s+=E.length,I?i.push(w):r.push(w),c=c||A;continue e}}if(l=!1,d){b>d?r.push(Yu(d)+"-"+Yu(b)):b===d&&r.push(Yu(b)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Yu(b+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=b,s+=2;continue}r.push(Yu(b)),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 b=r[0].length===2?r[0].slice(-1):r[0];return[cW(b),!1,f-t,!1]}let h="["+(u?"^":"")+EO(r)+"]",p="["+(u?"":"^")+EO(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var Ai=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Sn,lW=new Set(["!","?","+","*","@"]),eb=o(n=>lW.has(n),"isExtglobType"),AO=o(n=>eb(n.type),"isExtglobAST"),uW=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),fW=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),dW=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),xO=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hW="(?!(?:^|/)\\.\\.?(?:$|/))",ym="(?!\\.)",pW=new Set(["[","."]),mW=new Set(["..","."]),gW=new Set("().*{}+?[]^$\\!"),yW=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),tb="[^/]",CO=tb+"*?",PO=tb+"+?",bo=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 Sn&&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 Sn&&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 Sn(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 b=r,E="";for(;b<e.length;){let w=e.charAt(b++);if(c||w==="\\"){c=!c,E+=w;continue}if(l){b===u+1?(w==="^"||w==="!")&&(f=!0):w==="]"&&!(b===u+2&&f)&&(l=!1),E+=w;continue}else if(w==="["){l=!0,u=b,f=!1,E+=w;continue}if(!i.noext&&eb(w)&&e.charAt(b)==="("&&s<=a){t.push(E),E="";let I=new Sn(w,t);b=Sn.#g(e,I,b,i,s+1),t.push(I);continue}E+=w}return t.push(E),b}let d=r+1,h=new Sn(null,t),p=[],_="";for(;d<e.length;){let b=e.charAt(d++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){d===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(d===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=d,f=!1,_+=b;continue}if(eb(b)&&e.charAt(d)==="("&&(s<=a||t&&t.#y(b))){let w=t&&t.#y(b)?0:1;h.push(_),_="";let A=new Sn(b,h);h.push(A),d=Sn.#g(e,A,d,i,s+w);continue}if(b==="|"){h.push(_),_="",p.push(h),h=new Sn(null,t);continue}if(b===")")return _===""&&t.#t.length===0&&(t.#a=!0),h.push(_),_="",t.push(...p,h),d;_+=b}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,fW)}#m(e,t=uW){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=dW){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Sn(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!!xO.get(this.type)?.has(e)}#v(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)}#w(e){let t=xO.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}#b(){if(AO(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.#b(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#v(i)&&(t=!1,this.#w(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#l=void 0}static fromGlob(e,t={}){let r=new Sn(null,void 0,t);return Sn.#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.#b(),this.#p()),!AO(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[_,b,E,w]=typeof p=="string"?Sn.#x(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||w,_}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mW.has(this.#t[0]))){let _=pW,b=t&&_.has(u.charAt(0))||u.startsWith("\\.")&&_.has(u.charAt(2))||u.startsWith("\\.\\.")&&_.has(u.charAt(4)),E=!t&&!e&&_.has(u.charAt(0));f=b?hW:E?ym:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,Ai(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#S(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,Ai(this.toString()),!1,!1]}let a=!r||e||t||!ym?"":this.#S(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?ym:"")+PO;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?ym:"")+CO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,Ai(s),this.#n=!!this.#n,this.#r]}#S(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+=(gW.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=TO(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)?PO:CO,t=!0;continue}else c=!1;if(u==="?"){s+=tb,t=!0;continue}s+=yW(u)}return[s,Ai(e),!!t,a]}};Sn=bo;var il=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Or=o((n,e,t={})=>(Qu(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Rn(e,t).match(n)),"minimatch"),_W=/^\*+([^+@!?\*\[\(]*)$/,vW=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),bW=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),SW=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),wW=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),EW=/^\*+\.\*+$/,TW=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),AW=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),xW=/^\.\*+$/,CW=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),PW=/^\*+$/,OW=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),RW=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),IW=/^\?+([^+@!?\*\[\(]*)?$/,DW=o(([n,e=""])=>{let t=DO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),FW=o(([n,e=""])=>{let t=FO([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),NW=o(([n,e=""])=>{let t=FO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),kW=o(([n,e=""])=>{let t=DO([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),DO=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),FO=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),NO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",OO={win32:{sep:"\\"},posix:{sep:"/"}},LW=NO==="win32"?OO.win32.sep:OO.posix.sep;Or.sep=LW;var Vt=Symbol("globstar **");Or.GLOBSTAR=Vt;var MW="[^/]",jW=MW+"*?",$W="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",VW="(?:(?!(?:\\/|^)\\.).)*?",UW=o((n,e={})=>t=>Or(t,n,e),"filter");Or.filter=UW;var Gn=o((n,e={})=>Object.assign({},n,e),"ext"),BW=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Or;let e=Or;return Object.assign(o((r,i,s={})=>e(r,i,Gn(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,Gn(n,s))}static defaults(i){return e.defaults(Gn(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,Gn(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Gn(n,s))}},unescape:o((r,i={})=>e.unescape(r,Gn(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,Gn(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,Gn(n,i)),"filter"),defaults:o(r=>e.defaults(Gn(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,Gn(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,Gn(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,Gn(n,s)),"match"),sep:e.sep,GLOBSTAR:Vt})},"defaults");Or.defaults=BW;var kO=o((n,e={})=>(Qu(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,IO.default)(n)),"braceExpand");Or.braceExpand=kO;var qW=o((n,e={})=>new Rn(n,e).makeRe(),"makeRe");Or.makeRe=qW;var WW=o((n,e,t={})=>{let r=new Rn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Or.match=WW;var RO=/[?*]|[+@!]\(.*?\)|\[|\]/,GW=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Rn=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={}){Qu(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||NO,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]==="?"||!RO.test(s[2]))&&!RO.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,_]=[e[d],t[h]];p.toLowerCase()===_.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Vt)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(Vt,s),c=t.lastIndexOf(Vt),[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 A=e.slice(i,i+l.length);if(!this.#r(A,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let A=e.length-f.length;if(this.#r(e,f,r,A,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(A--,!this.#r(e,f,r,A,0)))return!1;d=f.length+1}}if(!u.length){let A=!!d;for(let I=i;I<e.length-d;I++){let Q=String(e[I]);if(A=!0,Q==="."||Q===".."||!this.options.dot&&Q.startsWith("."))return!1}return r||A}let h=[[[],0]],p=h[0],_=0,b=[0];for(let A of u)A===Vt?(b.push(_),p=[[],0],h.push(p)):(p[0].push(A),_++);let E=h.length-1,w=e.length-d;for(let A of h)A[1]=w-(b[E--]+A[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===Vt)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 kO(this.pattern,this.options)}parse(e){Qu(e);let t=this.options;if(e==="**")return Vt;if(e==="")return"";let r,i=null;(r=e.match(PW))?i=t.dot?RW:OW:(r=e.match(_W))?i=(t.nocase?t.dot?wW:SW:t.dot?bW:vW)(r[1]):(r=e.match(IW))?i=(t.nocase?t.dot?FW:DW:t.dot?NW:kW)(r):(r=e.match(EW))?i=t.dot?AW:TW:(r=e.match(xW))&&(i=CW);let s=bo.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?jW:t.dot?$W:VW,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"?GW(f):f===Vt?Vt:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==Vt||p===Vt||(p===void 0?h!==void 0&&h!==Vt?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==Vt&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=Vt))}),u.filter(f=>f!==Vt).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 Or.defaults(e).Minimatch}};Or.AST=bo;Or.Minimatch=Rn;Or.escape=il;Or.unescape=Ai;var sR=require("node:url");var sl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,MO=new Set,rb=typeof process=="object"&&process?process:{},jO=o((n,e,t,r)=>{typeof rb.emitWarning=="function"?rb.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),_m=globalThis.AbortController,LO=globalThis.AbortSignal;if(typeof _m>"u"){LO=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},_m=class{static{o(this,"AbortController")}constructor(){e()}signal=new LO;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=rb.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,jO("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 HW=o(n=>!MO.has(n),"shouldWarn");var ba=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),$O=o(n=>ba(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)}},nb=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=$O(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]}},Ku=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;#v;#w;#b;#S;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#v,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.#j(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#P(t),"indexes"),rindexes:o(t=>e.#O(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:_=0,sizeCalculation:b,fetchMethod:E,memoMethod:w,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:K,ignoreFetchAbort:Te}=e;if(t!==0&&!ba(t))throw new TypeError("max option must be a nonnegative integer");let G=t?$O(t):Array;if(!G)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=_||this.#n,this.sizeCalculation=b,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,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#b=!!E,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new G(t),this.#g=new G(t),this.#d=0,this.#m=0,this.#y=nb.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.#w=!!this.#r,this.#S=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!Q,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(this.#n!==0&&!ba(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!ba(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=ba(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!ba(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 J="LRU_CACHE_UNBOUNDED";HW(J)&&(MO.add(J),jO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#x(){let e=new al(this.#e),t=new al(this.#e);this.#v=e,this.#T=t,this.#D=(s,a,c=sl.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#I(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?sl.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=sl.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}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#D=o(()=>{},"#setItemTTL");#A=o(()=>!1,"#isStale");#R(){let e=new al(this.#e);this.#u=0,this.#E=e,this.#F=t=>{this.#u-=e[t],e[t]=0},this.#k=(t,r,i,s)=>{if(this.#h(r))return 0;if(!ba(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!ba(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.#M(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#F=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#k=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#L(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#L(t)||((e||!this.#A(t))&&(yield t),t===this.#m));)t=this.#p[t]}#L(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#P())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.#O())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.#P()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#h(this.#a[e])&&(yield t)}}*values(){for(let e of this.#P())this.#a[e]!==void 0&&!this.#h(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#O())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.#P()){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.#P()){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.#O()){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.#O({allowStale:!0}))this.#A(t)&&(this.#I(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.#v&&this.#T){let a=this.#v[t],c=this.#T[t];if(a&&c){let l=a-(sl.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.#P({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.#v&&this.#T){a.ttl=this.#v[t];let c=sl.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=sl.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.#k(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#I(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.#M(!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.#b&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!a&&(this.#w&&this.#r?.(p,e,"set"),this.#S&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(h,e,"set"),this.#S&&this.#f?.push([h,e,"set"]));if(this.#F(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.#v&&this.#x(),this.#v&&(u||this.#D(d,i,s),l&&this.#o(l,d)),!a&&this.#S&&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.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#S&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#a[t];return this.#b&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(i,r,"evict"),this.#S&&this.#f?.push([i,r,"evict"])),this.#F(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.#C(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}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#h(s))return s;let a=new _m,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((b,E=!1)=>{let{aborted:w}=a.signal,A=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(w&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!A&&!E)return d(a.signal.reason);let I=p;return this.#a[t]===p&&(b===void 0?I.__staleWhileFetching?this.#a[t]=I.__staleWhileFetching:this.#I(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,b,l.options))),b},"cb"),f=o(b=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=b),d(b)),"eb"),d=o(b=>{let{aborted:E}=a.signal,w=E&&r.allowStaleOnFetchAbort,A=w||r.allowStaleOnFetchRejection,I=A||r.noDeleteOnFetchRejection,Q=p;if(this.#a[t]===p&&(!I||Q.__staleWhileFetching===void 0?this.#I(e,"fetch"):w||(this.#a[t]=Q.__staleWhileFetching)),A)return r.status&&Q.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),Q.__staleWhileFetching;if(Q.__returned===Q)throw b},"fetchFail"),h=o((b,E)=>{let w=this.#c?.(e,s,l);w&&w instanceof Promise&&w.then(A=>b(A===void 0?void 0:A),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=o(A=>u(A,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),_=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,_,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=_,_}#h(e){if(!this.#b)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof _m}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:_=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:w,signal:A}=t;if(!this.#b)return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:w});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:w,signal:A},Q=this.#s.get(e);if(Q===void 0){w&&(w.fetch="miss");let K=this.#j(e,Q,I,b);return K.__returned=K}else{let K=this.#a[Q];if(this.#h(K)){let $=r&&K.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",$&&(w.returnedStale=!0)),$?K.__staleWhileFetching:K.__returned=K}let Te=this.#A(Q);if(!E&&!Te)return w&&(w.fetch="hit"),this.#V(Q),i&&this.#C(Q),w&&this.#o(w,Q),K;let G=this.#j(e,Q,I,b),L=G.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=Te?"stale":"refresh",L&&Te&&(w.returnedStale=!0)),L?G.__staleWhileFetching:G.__returned=G}}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.#I(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#C(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.#I(e,"delete")}#I(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.#U(t);else{this.#F(i);let s=this.#a[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(s,e,t),this.#S&&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.#S&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#U("delete")}#U(e){for(let t of this.#O({allowStale:!0})){let r=this.#a[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#w&&this.#r?.(r,i,e),this.#S&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#v&&this.#T&&(this.#v.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.#S&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var ll=require("node:path"),YO=require("node:url"),os=require("fs"),rG=X(require("node:fs"),1),Ea=require("node:fs/promises");var Am=require("node:events"),ub=X(require("node:stream"),1),WO=require("node:string_decoder");var VO=typeof process=="object"&&process?process:{stdout:null,stderr:null},zW=o(n=>!!n&&typeof n=="object"&&(n instanceof wa||n instanceof ub.default||QW(n)||YW(n)),"isStream"),QW=o(n=>!!n&&typeof n=="object"&&n instanceof Am.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==ub.default.Writable.prototype.pipe,"isReadable"),YW=o(n=>!!n&&typeof n=="object"&&n instanceof Am.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),$s=Symbol("EOF"),Vs=Symbol("maybeEmitEnd"),Sa=Symbol("emittedEnd"),vm=Symbol("emittingEnd"),Xu=Symbol("emittedError"),bm=Symbol("closed"),UO=Symbol("read"),Sm=Symbol("flush"),BO=Symbol("flushChunk"),xi=Symbol("encoding"),ol=Symbol("decoder"),ur=Symbol("flowing"),Ju=Symbol("paused"),cl=Symbol("resume"),fr=Symbol("buffer"),fn=Symbol("pipes"),dr=Symbol("bufferLength"),ib=Symbol("bufferPush"),wm=Symbol("bufferShift"),Hr=Symbol("objectMode"),Ut=Symbol("destroyed"),sb=Symbol("error"),ab=Symbol("emitData"),qO=Symbol("emitEnd"),ob=Symbol("emitEnd2"),ss=Symbol("async"),cb=Symbol("abort"),Em=Symbol("aborted"),Zu=Symbol("signal"),So=Symbol("dataListeners"),In=Symbol("discarded"),ef=o(n=>Promise.resolve().then(n),"defer"),KW=o(n=>n(),"nodefer"),XW=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),JW=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),ZW=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Tm=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[cl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},lb=class extends Tm{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)}},eG=o(n=>!!n.objectMode,"isObjectModeOptions"),tG=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),wa=class extends Am.EventEmitter{static{o(this,"Minipass")}[ur]=!1;[Ju]=!1;[fn]=[];[fr]=[];[Hr];[xi];[ss];[ol];[$s]=!1;[Sa]=!1;[vm]=!1;[bm]=!1;[Xu]=null;[dr]=0;[Ut]=!1;[Zu];[Em]=!1;[So]=0;[In]=!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");eG(t)?(this[Hr]=!0,this[xi]=null):tG(t)?(this[xi]=t.encoding,this[Hr]=!1):(this[Hr]=!1,this[xi]=null),this[ss]=!!t.async,this[ol]=this[xi]?new WO.StringDecoder(this[xi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[fr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[fn],"get")});let{signal:r}=t;r&&(this[Zu]=r,r.aborted?this[cb]():r.addEventListener("abort",()=>this[cb]()))}get bufferLength(){return this[dr]}get encoding(){return this[xi]}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[Hr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ss]}set async(e){this[ss]=this[ss]||!!e}[cb](){this[Em]=!0,this.emit("abort",this[Zu]?.reason),this.destroy(this[Zu]?.reason)}get aborted(){return this[Em]}set aborted(e){}write(e,t,r){if(this[Em])return!1;if(this[$s])throw new Error("write after end");if(this[Ut])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[ss]?ef:KW;if(!this[Hr]&&!Buffer.isBuffer(e)){if(ZW(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(JW(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Hr]?(this[ur]&&this[dr]!==0&&this[Sm](!0),this[ur]?this.emit("data",e):this[ib](e),this[dr]!==0&&this.emit("readable"),r&&i(r),this[ur]):e.length?(typeof e=="string"&&!(t===this[xi]&&!this[ol]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[xi]&&(e=this[ol].write(e)),this[ur]&&this[dr]!==0&&this[Sm](!0),this[ur]?this.emit("data",e):this[ib](e),this[dr]!==0&&this.emit("readable"),r&&i(r),this[ur]):(this[dr]!==0&&this.emit("readable"),r&&i(r),this[ur])}read(e){if(this[Ut])return null;if(this[In]=!1,this[dr]===0||e===0||e&&e>this[dr])return this[Vs](),null;this[Hr]&&(e=null),this[fr].length>1&&!this[Hr]&&(this[fr]=[this[xi]?this[fr].join(""):Buffer.concat(this[fr],this[dr])]);let t=this[UO](e||null,this[fr][0]);return this[Vs](),t}[UO](e,t){if(this[Hr])this[wm]();else{let r=t;e===r.length||e===null?this[wm]():typeof r=="string"?(this[fr][0]=r.slice(e),t=r.slice(0,e),this[dr]-=e):(this[fr][0]=r.subarray(e),t=r.subarray(0,e),this[dr]-=e)}return this.emit("data",t),!this[fr].length&&!this[$s]&&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[$s]=!0,this.writable=!1,(this[ur]||!this[Ju])&&this[Vs](),this}[cl](){this[Ut]||(!this[So]&&!this[fn].length&&(this[In]=!0),this[Ju]=!1,this[ur]=!0,this.emit("resume"),this[fr].length?this[Sm]():this[$s]?this[Vs]():this.emit("drain"))}resume(){return this[cl]()}pause(){this[ur]=!1,this[Ju]=!0,this[In]=!1}get destroyed(){return this[Ut]}get flowing(){return this[ur]}get paused(){return this[Ju]}[ib](e){this[Hr]?this[dr]+=1:this[dr]+=e.length,this[fr].push(e)}[wm](){return this[Hr]?this[dr]-=1:this[dr]-=this[fr][0].length,this[fr].shift()}[Sm](e=!1){do;while(this[BO](this[wm]())&&this[fr].length);!e&&!this[fr].length&&!this[$s]&&this.emit("drain")}[BO](e){return this.emit("data",e),this[ur]}pipe(e,t){if(this[Ut])return e;this[In]=!1;let r=this[Sa];return t=t||{},e===VO.stdout||e===VO.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[fn].push(t.proxyErrors?new lb(this,e,t):new Tm(this,e,t)),this[ss]?ef(()=>this[cl]()):this[cl]()),e}unpipe(e){let t=this[fn].find(r=>r.dest===e);t&&(this[fn].length===1?(this[ur]&&this[So]===0&&(this[ur]=!1),this[fn]=[]):this[fn].splice(this[fn].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[In]=!1,this[So]++,!this[fn].length&&!this[ur]&&this[cl]();else if(e==="readable"&&this[dr]!==0)super.emit("readable");else if(XW(e)&&this[Sa])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Xu]){let i=t;this[ss]?ef(()=>i.call(this,this[Xu])):i.call(this,this[Xu])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[So]=this.listeners("data").length,this[So]===0&&!this[In]&&!this[fn].length&&(this[ur]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[So]=0,!this[In]&&!this[fn].length&&(this[ur]=!1)),t}get emittedEnd(){return this[Sa]}[Vs](){!this[vm]&&!this[Sa]&&!this[Ut]&&this[fr].length===0&&this[$s]&&(this[vm]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[bm]&&this.emit("close"),this[vm]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Ut&&this[Ut])return!1;if(e==="data")return!this[Hr]&&!r?!1:this[ss]?(ef(()=>this[ab](r)),!0):this[ab](r);if(e==="end")return this[qO]();if(e==="close"){if(this[bm]=!0,!this[Sa]&&!this[Ut])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Xu]=r,super.emit(sb,r);let s=!this[Zu]||this.listeners("error").length?super.emit("error",r):!1;return this[Vs](),s}else if(e==="resume"){let s=super.emit("resume");return this[Vs](),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[Vs](),i}[ab](e){for(let r of this[fn])r.dest.write(e)===!1&&this.pause();let t=this[In]?!1:super.emit("data",e);return this[Vs](),t}[qO](){return this[Sa]?!1:(this[Sa]=!0,this.readable=!1,this[ss]?(ef(()=>this[ob]()),!0):this[ob]())}[ob](){if(this[ol]){let t=this[ol].end();if(t){for(let r of this[fn])r.dest.write(t);this[In]||super.emit("data",t)}}for(let t of this[fn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Hr]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Hr]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Hr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[xi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Ut,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[In]=!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[$s])return t();let s,a,c=o(d=>{this.off("data",l),this.off("end",u),this.off(Ut,f),t(),a(d)},"onerr"),l=o(d=>{this.off("error",c),this.off("end",u),this.off(Ut,f),this.pause(),s({value:d,done:!!this[$s]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Ut,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(Ut,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[In]=!1;let e=!1,t=o(()=>(this.pause(),this.off(sb,t),this.off(Ut,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(sb,t),this.once(Ut,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Ut])return e?this.emit("error",e):this.emit(Ut),this;this[Ut]=!0,this[In]=!0,this[fr].length=0,this[dr]=0;let t=this;return typeof t.close=="function"&&!this[bm]&&t.close(),e?this.emit("error",e):this.emit(Ut),this}static get isStream(){return zW}};var nG=os.realpathSync.native,rf={lstatSync:os.lstatSync,readdir:os.readdir,readdirSync:os.readdirSync,readlinkSync:os.readlinkSync,realpathSync:nG,promises:{lstat:Ea.lstat,readdir:Ea.readdir,readlink:Ea.readlink,realpath:Ea.realpath}},KO=o(n=>!n||n===rf||n===rG?rf:{...rf,...n,promises:{...rf.promises,...n.promises||{}}},"fsFromOption"),XO=/^\\\\\?\\([a-z]:)\\?$/i,iG=o(n=>n.replace(/\//g,"\\").replace(XO,"$1\\"),"uncToDrive"),sG=/[\\\/]/,zn=0,JO=1,ZO=2,as=4,eR=6,tR=8,wo=10,rR=12,Hn=15,tf=~Hn,fb=16,GO=32,nf=64,Ci=128,xm=256,Pm=512,HO=nf|Ci|Pm,aG=1023,db=o(n=>n.isFile()?tR:n.isDirectory()?as:n.isSymbolicLink()?wo:n.isCharacterDevice()?ZO:n.isBlockDevice()?eR:n.isSocket()?rR:n.isFIFO()?JO:zn,"entToType"),zO=new Map,sf=o(n=>{let e=zO.get(n);if(e)return e;let t=n.normalize("NFKD");return zO.set(n,t),t},"normalize"),QO=new Map,Cm=o(n=>{let e=QO.get(n);if(e)return e;let t=sf(n.toLowerCase());return QO.set(n,t),t},"normalizeNocase"),Om=class extends Ku{static{o(this,"ResolveCache")}constructor(){super({max:256})}},hb=class extends Ku{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},nR=Symbol("PathScurry setAsCwd"),zr=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}#v;#w;#b;#S;#x;#C;#o;#D;#A;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=zn,r,i,s,a,c){this.name=e,this.#v=s?Cm(e):sf(e),this.#o=t&aG,this.nocase=s,this.roots=i,this.root=r||this,this.#D=a,this.#b=c.fullpath,this.#x=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=KO(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=0}childrenCache(){return this.#D}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#F(i):this.#F(i)}#F(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#D.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#D.set(this,t),this.#o&=~fb,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Cm(e):sf(e);for(let l of r)if(l.#v===i)return l;let s=this.parent?this.sep:"",a=this.#b?this.#b+s+e:void 0,c=this.newChild(e,zn,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=Ci),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.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,t=this.parent;if(!t)return this.#b=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#S=`//?/${i}`:this.#S=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#S=r}isUnknown(){return(this.#o&Hn)===zn}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&Hn)===tR}isDirectory(){return(this.#o&Hn)===as}isCharacterDevice(){return(this.#o&Hn)===ZO}isBlockDevice(){return(this.#o&Hn)===eR}isFIFO(){return(this.#o&Hn)===JO}isSocket(){return(this.#o&Hn)===rR}isSymbolicLink(){return(this.#o&wo)===wo}lstatCached(){return this.#o&GO?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#R}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&Hn;return!(e!==zn&&e!==wo||this.#o&xm||this.#o&Ci)}calledReaddir(){return!!(this.#o&fb)}isENOENT(){return!!(this.#o&Ci)}isNamed(e){return this.nocase?this.#v===Cm(e):this.#v===sf(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|=fb;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#k()}}#k(){this.#o&Ci||(this.#o=(this.#o|Ci)&tf,this.#P())}#P(){let e=this.children();e.provisional=0;for(let t of e)t.#k()}#O(){this.#o|=Pm,this.#L()}#L(){if(this.#o&nf)return;let e=this.#o;(e&Hn)===as&&(e&=tf),this.#o=e|nf,this.#P()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#k():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#k()}#h(e=""){let t=this.#o;t|=xm,e==="ENOENT"&&(t|=Ci),(e==="EINVAL"||e==="UNKNOWN")&&(t&=tf),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#$(e,t){return this.#I(e,t)||this.#V(e,t)}#V(e,t){let r=db(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&Hn;return s!==as&&s!==wo&&s!==zn&&(i.#o|=nf),t.unshift(i),t.provisional++,i}#I(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Cm(e.name):sf(e.name))===i.#v)return this.#U(e,i,r,t)}}#U(e,t,r,i){let s=t.name;return t.#o=t.#o&tf|db(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&Ci)===0)try{return this.#G(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&Ci)===0)try{return this.#G(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(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:_,mtimeMs:b,nlink:E,rdev:w,size:A,uid:I}=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=_,this.#g=b,this.#t=E,this.#i=w,this.#l=A,this.#c=I;let Q=db(e);this.#o=this.#o&tf|Q|GO,Q!==zn&&Q!==as&&Q!==wo&&(this.#o|=nf)}#q=[];#W=!1;#H(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.#M(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#H(r.slice(0,r.provisional))})}#B;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.#B)await this.#B;else{let r=o(()=>{},"resolve");this.#B=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.#M(i.code),e.provisional=0}this.#B=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.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&HO)return!1;let e=Hn&this.#o;return e===zn||e===as||e===wo}shouldWalk(e,t){return(this.#o&as)===as&&!(this.#o&HO)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#R)return this.#R;if(!((Pm|xm|Ci)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}realpathSync(){if(this.#R)return this.#R;if(!((Pm|xm|Ci)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#R=this.resolve(e)}catch{this.#O()}}[nR](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.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#x=void 0,i.#C=void 0,i=i.parent}},Rm=class n extends zr{static{o(this,"PathWin32")}sep="\\";splitSep=sG;constructor(e,t=zn,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=zn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return ll.win32.parse(e).root}getRoot(e){if(e=iG(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 ul(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(XO,"$1\\"),e===t}},Im=class n extends zr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=zn,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=zn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Dm=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=rf}={}){this.#t=KO(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,YO.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Om,this.#n=new Om,this.#r=new hb(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 _ of l){let b=f--;u=u.child(_,{relative:new Array(b).fill("..").join(d),relativePosix:new Array(b).fill("..").join("/"),fullpath:h+=(p?"":d)+_}),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 zr||(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 zr||(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 zr||(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 zr||(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 zr||(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 zr||(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 zr||(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,_)=>{if(p)return h(p);let b=_.length;if(!b)return h();let E=o(()=>{--b===0&&h()},"next");for(let w of _)(!s||s(w))&&c.push(r?w:w.fullpath()),i&&w.isSymbolicLink()?w.realpath().then(A=>A?.isUnknown()?A.lstat():A).then(A=>A?.shouldWalk(l,a)?u(A,E):E()):w.shouldWalk(l,a)?u(w,E):E()},!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 zr||(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 zr||(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 zr||(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 zr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new wa({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 _=o((E,w,A=!1)=>{if(E)return c.emit("error",E);if(i&&!A){let I=[];for(let Q of w)Q.isSymbolicLink()&&I.push(Q.realpath().then(K=>K?.isUnknown()?K.lstat():K));if(I.length){Promise.all(I).then(()=>_(null,w,!0));return}}for(let I of w)I&&(!s||s(I))&&(c.write(r?I:I.fullpath())||(h=!0));f--;for(let I of w){let Q=I.realpathCached()||I;Q.shouldWalk(l,a)&&u.push(Q)}h&&!c.flowing?c.once("drain",d):b||d()},"onReaddir"),b=!0;p.readdirCB(_,!0),b=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new wa({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 _=p.readdirSync();for(let b of _)(!s||s(b))&&(c.write(r?b:b.fullpath())||(h=!0));f--;for(let b of _){let E=b;if(b.isSymbolicLink()){if(!(i&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(l,a)&&u.push(E)}}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[nR](t)}},ul=class extends Dm{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,ll.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return ll.win32.parse(e).root.toUpperCase()}newRoot(e){return new Rm(this.rootPath,as,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},fl=class extends Dm{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,ll.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Im(this.rootPath,as,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},af=class extends fl{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},oce=process.platform==="win32"?Rm:Im,iR=process.platform==="win32"?ul:process.platform==="darwin"?af:fl;var oG=o(n=>n.length>=1,"isPatternList"),cG=o(n=>n.length>=1,"isGlobList"),dl=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#_;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!oG(e))throw new TypeError("empty pattern list");if(!cG(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,..._]=this.#n;u[0]===""&&(u.shift(),_.shift());let b=[s,a,c,l,""].join("/"),E=[f,d,h,p,""].join("/");this.#e=[b,...u],this.#n=[E,..._],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]===Vt}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 lG=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",hl=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=lG}){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 Rn(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 dl(i,s,0,this.platform),c=new Rn(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 pb=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()]))}},mb=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)])}},gb=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())}},of=class n{static{o(this,"Processor")}hasWalkedCache;matches=new mb;subwalks=new gb;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new pb}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===Vt){(!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===Vt?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 uG=o((n,e)=>typeof n=="string"?new hl([n],e):Array.isArray(n)?new hl(n,e):n,"makeIgnore"),Fm=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=uG(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 of(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 of(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()}},cf=class extends Fm{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}},lf=class extends Fm{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new wa({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 fG=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Pi=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,sR.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||fG,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"?ul:t.platform==="darwin"?af:t.platform?fl:iR;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 Rn(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 dl(l,f,0,this.platform)})}async walk(){return[...await new cf(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 cf(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 lf(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 lf(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 yb=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Rn(t,e).hasMagic())return!0;return!1},"hasMagic");function km(n,e={}){return new Pi(n,e).streamSync()}o(km,"globStreamSync");function oR(n,e={}){return new Pi(n,e).stream()}o(oR,"globStream");function cR(n,e={}){return new Pi(n,e).walkSync()}o(cR,"globSync");async function aR(n,e={}){return new Pi(n,e).walk()}o(aR,"glob_");function Lm(n,e={}){return new Pi(n,e).iterateSync()}o(Lm,"globIterateSync");function lR(n,e={}){return new Pi(n,e).iterate()}o(lR,"globIterate");var dG=km,hG=Object.assign(oR,{sync:km}),pG=Lm,mG=Object.assign(lR,{sync:Lm}),gG=Object.assign(cR,{stream:km,iterate:Lm}),Nm=Object.assign(aR,{glob:aR,globSync:cR,sync:gG,globStream:oR,stream:hG,globStreamSync:km,streamSync:dG,globIterate:lR,iterate:mG,globIterateSync:Lm,iterateSync:pG,Glob:Pi,hasMagic:yb,escape:il,unescape:Ai});Nm.glob=Nm;var Eo=X(er());var Dt=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await ir.default.pathExists(t))throw new Eo.FileNotFoundError(e);return ir.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return ir.default.pathExists(t)}async getFileMetadata(e){let t=await this.readFile(e);return this.extractFrontmatter(t)}async createFile(e,t){let r=this.resolvePath(e);if(await ir.default.pathExists(r))throw new Eo.FileAlreadyExistsError(e);return await ir.default.ensureDir(Ta.default.dirname(r)),await ir.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await ir.default.pathExists(r))throw new Eo.FileNotFoundError(e);await ir.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await ir.default.ensureDir(Ta.default.dirname(r)),await ir.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await ir.default.pathExists(t))throw new Eo.FileNotFoundError(e);await ir.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await ir.default.pathExists(r))throw new Eo.FileNotFoundError(e);await ir.default.ensureDir(Ta.default.dirname(i)),await ir.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await ir.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await ir.default.pathExists(t)?(await ir.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=Ta.default.join(t,"**/*.md");return(await Nm(r,{nodir:!0})).map(a=>Ta.default.relative(this.rootPath,a))}async findFilesByMetadata(e){let t=await this.getMarkdownFiles(),r=[];for(let i of t)try{let s=await this.getFileMetadata(i);this.matchesQuery(s,e)&&r.push(i)}catch{continue}return r}async findFileByUID(e){let t=await this.findFilesByMetadata({exo__Asset_uid:e});return t.length>0?t[0]:null}resolvePath(e){return Ta.default.isAbsolute(e)?e:Ta.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=Cr.load(r[1]);return typeof i=="object"&&i!==null?i:{}}catch{return{}}}matchesQuery(e,t){for(let[r,i]of Object.entries(t)){let s=e[r];if(Array.isArray(s)){if(!s.some(a=>this.normalizeValue(a)===this.normalizeValue(i)))return!1}else if(this.normalizeValue(s)!==this.normalizeValue(i))return!1}return!0}normalizeValue(e){return e==null?"":String(e).replace(/["'[\]]/g,"").trim()}};var uf=X(require("path")),_b=X(ya());var pl=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!uf.default.isAbsolute(e))return uf.default.resolve(this.vaultRoot,e);let t=uf.default.resolve(e),r=uf.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new ze(`File path ${e} is outside vault root ${this.vaultRoot}`,"Provide a file path within the vault directory.",{filepath:e,vaultRoot:this.vaultRoot});return t}validate(e){if(!_b.default.existsSync(e))throw new Fu(e);if(!_b.default.statSync(e).isFile())throw new ze(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new ze(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var mR=X(er());var uR=X(er());var Oi=class{static{o(this,"BaseCommandExecutor")}constructor(e){this.pathResolver=e.pathResolver,this.fsAdapter=e.fsAdapter,this.frontmatterService=e.frontmatterService,this.dryRun=e.dryRun}resolveAndValidate(e){let t=this.pathResolver.resolve(e);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");return{resolvedPath:t,relativePath:r}}getCurrentTimestamp(){return uR.DateFormatter.toLocalTimestamp(new Date)}isAssetArchived(e){if(e?.exo__Asset_isArchived===!0)return!0;let t=e?.archived;if(t==null)return!1;if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let r=t.toLowerCase().trim();return r==="true"||r==="yes"||r==="1"}return!1}extractAliasesFromFrontmatter(e){let t=e.match(/aliases:\s*\n((?: - .*\n?)*)/);return t?t[1].split(`
538
- `).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var ff=class extends Oi{static{o(this,"StatusCommandExecutor")}constructor(e){super(e)}async executeStart(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Started: ${e}`),console.log(" Status: Doing"),console.log(` Start time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeComplete(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Completed: ${e}`),console.log(" Status: Done"),console.log(` Completion time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeTrash(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Trashed: ${e}`),console.log(" Status: Trashed"),console.log(` Resolution time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeArchive(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.frontmatterService.updateProperty(r,"archived","true");i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(t,i),console.log(`\u2705 Archived: ${e}`),console.log(" Archived: true"),console.log(" Aliases removed"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){k.handle(t)}}async updateStatus(e,t,r){let{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${t}]]"`);await this.fsAdapter.updateFile(i,a),console.log(`\u2705 Moved to ${r}: ${e}`),console.log(` Status: ${r}`)}};var Rr=[];for(let n=0;n<256;++n)Rr.push((n+256).toString(16).slice(1));function fR(n,e=0){return(Rr[n[e+0]]+Rr[n[e+1]]+Rr[n[e+2]]+Rr[n[e+3]]+"-"+Rr[n[e+4]]+Rr[n[e+5]]+"-"+Rr[n[e+6]]+Rr[n[e+7]]+"-"+Rr[n[e+8]]+Rr[n[e+9]]+"-"+Rr[n[e+10]]+Rr[n[e+11]]+Rr[n[e+12]]+Rr[n[e+13]]+Rr[n[e+14]]+Rr[n[e+15]]).toLowerCase()}o(fR,"unsafeStringify");var dR=require("node:crypto");var jm=new Uint8Array(256),Mm=jm.length;function vb(){return Mm>jm.length-16&&((0,dR.randomFillSync)(jm),Mm=0),jm.slice(Mm,Mm+=16)}o(vb,"rng");var hR=require("node:crypto"),bb={randomUUID:hR.randomUUID};function _G(n,e,t){n=n||{};let r=n.random??n.rng?.()??vb();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return fR(r)}o(_G,"_v4");function vG(n,e,t){return bb.randomUUID&&!e&&!n?bb.randomUUID():_G(n,e,t)}o(vG,"v4");var df=vG;var ml=X(er());var hf=class extends Oi{static{o(this,"AssetCreationExecutor")}constructor(e){super(e)}async executeCreateTask(e,t,r={}){try{await this.createAsset(e,t,"ems__Task",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateMeeting(e,t,r={}){try{await this.createAsset(e,t,"ems__Meeting",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateProject(e,t,r={}){try{await this.createAsset(e,t,"ems__Project",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateArea(e,t,r={}){try{await this.createAsset(e,t,"ems__Area",r),process.exit(0)}catch(i){k.handle(i)}}async createAsset(e,t,r,i={}){if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let s=t.trim(),{relativePath:a}=this.resolveAndValidate(e);if(await this.fsAdapter.fileExists(a))throw new ml.FileAlreadyExistsError(e);let l=df(),u=this.buildAssetFrontmatter(r,l,s,i),f=ml.MetadataHelpers.buildFileContent(u);await this.fsAdapter.createFile(a,f),console.log(`\u2705 Created ${this.getAssetTypeName(r)}: ${e}`),console.log(` UID: ${l}`),console.log(` Label: ${s}`),console.log(` Class: ${r}`)}buildAssetFrontmatter(e,t,r,i={}){let s=ml.DateFormatter.toLocalTimestamp(new Date),a={exo__Asset_isDefinedBy:'"[[Ontology/EMS]]"',exo__Asset_uid:t,exo__Asset_label:r,exo__Asset_createdAt:s,exo__Instance_class:[`"[[${e}]]"`],aliases:[r]};return(e==="ems__Task"||e==="ems__Project"||e==="ems__Meeting")&&(a.ems__Effort_status='"[[ems__EffortStatusDraft]]"'),i.prototype&&(a.ems__Effort_prototype=`"[[${i.prototype}]]"`),i.area&&(a.ems__Effort_area=`"[[${i.area}]]"`),i.parent&&(a.ems__Effort_parent=`"[[${i.parent}]]"`),a}getAssetTypeName(e){return{ems__Task:"task",ems__Meeting:"meeting",ems__Project:"project",ems__Area:"area"}[e]||"asset"}};var Sb=X(require("path"));var pR=X(er());var pf=class extends Oi{static{o(this,"PropertyCommandExecutor")}constructor(e){super(e)}async executeRenameToUid(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.getFileMetadata(t);if(!r.exo__Asset_uid)throw new Error("Asset missing exo__Asset_uid property");let i=Sb.default.basename(t,".md"),s=r.exo__Asset_uid;if(i===s&&(console.log(`\u2705 Already renamed: ${e}`),console.log(` Current filename matches UID: ${s}.md`),process.exit(0)),!r.exo__Asset_label||r.exo__Asset_label.trim()===""){let l=await this.fsAdapter.readFile(t),u=this.frontmatterService.updateProperty(l,"exo__Asset_label",i),f=this.isAssetArchived(r),d=u;f||(d=this.frontmatterService.updateProperty(u,"aliases",`
538
+ `).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var ff=class extends Oi{static{o(this,"StatusCommandExecutor")}constructor(e){super(e)}async executeStart(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Started: ${e}`),console.log(" Status: Doing"),console.log(` Start time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeComplete(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Completed: ${e}`),console.log(" Status: Done"),console.log(` Completion time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeTrash(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Trashed: ${e}`),console.log(" Status: Trashed"),console.log(` Resolution time: ${i}`),process.exit(0)}catch(t){k.handle(t)}}async executeArchive(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.frontmatterService.updateProperty(r,"archived","true");i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(t,i),console.log(`\u2705 Archived: ${e}`),console.log(" Archived: true"),console.log(" Aliases removed"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){k.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){k.handle(t)}}async updateStatus(e,t,r){let{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${t}]]"`);await this.fsAdapter.updateFile(i,a),console.log(`\u2705 Moved to ${r}: ${e}`),console.log(` Status: ${r}`)}};var Rr=[];for(let n=0;n<256;++n)Rr.push((n+256).toString(16).slice(1));function fR(n,e=0){return(Rr[n[e+0]]+Rr[n[e+1]]+Rr[n[e+2]]+Rr[n[e+3]]+"-"+Rr[n[e+4]]+Rr[n[e+5]]+"-"+Rr[n[e+6]]+Rr[n[e+7]]+"-"+Rr[n[e+8]]+Rr[n[e+9]]+"-"+Rr[n[e+10]]+Rr[n[e+11]]+Rr[n[e+12]]+Rr[n[e+13]]+Rr[n[e+14]]+Rr[n[e+15]]).toLowerCase()}o(fR,"unsafeStringify");var dR=require("node:crypto");var jm=new Uint8Array(256),Mm=jm.length;function vb(){return Mm>jm.length-16&&((0,dR.randomFillSync)(jm),Mm=0),jm.slice(Mm,Mm+=16)}o(vb,"rng");var hR=require("node:crypto"),bb={randomUUID:hR.randomUUID};function _G(n,e,t){n=n||{};let r=n.random??n.rng?.()??vb();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return fR(r)}o(_G,"_v4");function vG(n,e,t){return bb.randomUUID&&!e&&!n?bb.randomUUID():_G(n,e,t)}o(vG,"v4");var df=vG;var ml=X(er());var hf=class extends Oi{static{o(this,"AssetCreationExecutor")}constructor(e){super(e)}async executeCreateTask(e,t,r={}){try{await this.createAsset(e,t,"ems__Task",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateMeeting(e,t,r={}){try{await this.createAsset(e,t,"ems__Meeting",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateProject(e,t,r={}){try{await this.createAsset(e,t,"ems__Project",r),process.exit(0)}catch(i){k.handle(i)}}async executeCreateArea(e,t,r={}){try{await this.createAsset(e,t,"ems__Area",r),process.exit(0)}catch(i){k.handle(i)}}async createAsset(e,t,r,i={}){if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let s=t.trim(),{relativePath:a}=this.resolveAndValidate(e);if(await this.fsAdapter.fileExists(a))throw new ml.FileAlreadyExistsError(e);let l=df(),u=this.buildAssetFrontmatter(r,l,s,i),f=ml.MetadataHelpers.buildFileContent(u);await this.fsAdapter.createFile(a,f),console.log(`\u2705 Created ${this.getAssetTypeName(r)}: ${e}`),console.log(` UID: ${l}`),console.log(` Label: ${s}`),console.log(` Class: ${r}`)}buildAssetFrontmatter(e,t,r,i={}){let s=ml.DateFormatter.toLocalTimestamp(new Date),a={exo__Asset_isDefinedBy:'"[[Ontology/EMS]]"',exo__Asset_uid:t,exo__Asset_label:r,exo__Asset_createdAt:s,exo__Instance_class:[`"[[${e}]]"`],aliases:[r]};return(e==="ems__Task"||e==="ems__Project"||e==="ems__Meeting")&&(a.ems__Effort_status='"[[ems__EffortStatusDraft]]"'),i.prototype&&(a.exo__Asset_prototype=`"[[${i.prototype}]]"`),i.area&&(a.ems__Effort_area=`"[[${i.area}]]"`),i.parent&&(a.ems__Effort_parent=`"[[${i.parent}]]"`),a}getAssetTypeName(e){return{ems__Task:"task",ems__Meeting:"meeting",ems__Project:"project",ems__Area:"area"}[e]||"asset"}};var Sb=X(require("path"));var pR=X(er());var pf=class extends Oi{static{o(this,"PropertyCommandExecutor")}constructor(e){super(e)}async executeRenameToUid(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.getFileMetadata(t);if(!r.exo__Asset_uid)throw new Error("Asset missing exo__Asset_uid property");let i=Sb.default.basename(t,".md"),s=r.exo__Asset_uid;if(i===s&&(console.log(`\u2705 Already renamed: ${e}`),console.log(` Current filename matches UID: ${s}.md`),process.exit(0)),!r.exo__Asset_label||r.exo__Asset_label.trim()===""){let l=await this.fsAdapter.readFile(t),u=this.frontmatterService.updateProperty(l,"exo__Asset_label",i),f=this.isAssetArchived(r),d=u;f||(d=this.frontmatterService.updateProperty(u,"aliases",`
539
539
  - ${i}`)),await this.fsAdapter.updateFile(t,d),console.log(` Updated label: "${i}"`)}let a=Sb.default.dirname(t),c=a!=="."?`${a}/${s}.md`:`${s}.md`;await this.fsAdapter.renameFile(t,c),console.log("\u2705 Renamed to UID format"),console.log(` Old: ${t}`),console.log(` New: ${c}`),process.exit(0)}catch(t){k.handle(t)}}async executeUpdateLabel(e,t){try{if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let r=t.trim(),{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"exo__Asset_label",r),c=this.frontmatterService.parse(a),l=this.extractAliasesFromFrontmatter(c.content);if(l.includes(r)||(l.length===0?a=this.frontmatterService.updateProperty(a,"aliases",`
540
540
  - ${r}`):a=this.frontmatterService.updateProperty(a,"aliases",`${l.map(u=>`
541
541
  - ${u}`).join("")}
@@ -648,7 +648,7 @@ ${Cr.dump(i,{lineWidth:-1})}---
648
648
  \u{1F50D} Dry-run: command "${l.name}" on "${t.target}"
649
649
  `),console.log(" Precondition: passed \u2705"),console.log(" Grounding (would execute):"),$b(l.grounding," ");return}let h=new Bt.ServiceRegistry,p=new Dt(i),b=await new Bt.GroundingExecutor(p,p,h).execute(l.grounding,u,t.target);if(r==="json"){let E=Z.success({command:l.name,target:t.target,preconditionPassed:!0,executed:!0,success:b.success,...b.error&&{error:b.error},...l.successMessage&&b.success&&{message:l.successMessage}});console.log(JSON.stringify(E,null,2))}else if(b.success){let E=l.successMessage??`Command "${l.name}" executed successfully.`;console.log(`\u2705 ${E}`)}else console.log(`\u274C Command "${l.name}" failed: ${b.error}`),process.exitCode=5}catch(i){k.handle(i)}}),n.command("validate").description("Validate all dynamic command definitions in vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async e=>{let t=e.output||"text";k.setFormat(t);try{let r=(0,ls.resolve)(e.vault);if(!(0,cs.existsSync)(r))throw new Oe(r);let i=qG(r);if(t==="json"){let s=Z.success({totalCommands:Mb(r).length,totalIssues:i.reduce((a,c)=>a+c.issues.length,0),commandsWithIssues:i.length,issues:i});console.log(JSON.stringify(s,null,2))}else{let s=Mb(r);if(i.length===0)console.log(`\u2705 All ${s.length} dynamic command(s) are valid.`);else{let a=i.reduce((c,l)=>c+l.issues.length,0);console.log(`\u274C Found ${a} issue(s) in ${i.length} command(s) out of ${s.length} total:
650
650
  `);for(let c of i){console.log(` \u{1F4C4} ${c.label} (${c.uid}):`);for(let l of c.issues)console.log(` \u2022 ${l}`);console.log()}process.exitCode=5}}}catch(r){k.handle(r)}}),n}o(tI,"dynamicCommandCommand");function Mb(n){let e=[],t=[];Vb(n,t);for(let{filePath:r,fm:i}of t){if(!El(i,"exocmd__Command"))continue;let s=i.exo__Asset_uid??"",a=i.exo__Asset_label??rI(r),c=i.exocmd__Command_category,l=i.exocmd__Command_icon,u=!!i.exocmd__Command_precondition,f=i.exocmd__Command_grounding,d;if(f){let h=rg(String(f)),p=t.find(_=>_.fm.exo__Asset_uid===h&&El(_.fm,"exocmd__Grounding"));p&&(d=p.fm.exocmd__Grounding_type)}e.push({filePath:r,uid:s,label:a,category:c,icon:l,hasPrecondition:u,groundingType:d})}return e}o(Mb,"scanCommands");async function BG(n,e){let{tripleStore:t}=await jb(n),r=new Bt.CommandResolver(t),i=await r.findBindings(),s=new Set;for(let c of i)s.add(c.commandRef);let a=[];for(let c of s){let l=await r.loadCommand(c);l&&a.push({filePath:"",uid:l.id,label:l.name,category:l.category,icon:l.icon,hasPrecondition:!!l.precondition,groundingType:l.grounding.type})}return a}o(BG,"listCommandsForTarget");function qG(n){let e=[],t=[];Vb(n,t);let r=new Map;for(let i of t){let s=i.fm.exo__Asset_uid;s&&r.set(s,i)}for(let{filePath:i,fm:s}of t){if(!El(s,"exocmd__Command"))continue;let a=s.exo__Asset_uid??"",c=s.exo__Asset_label??rI(i),l=[];a||l.push("Missing exo__Asset_uid"),s.exo__Asset_label||l.push("Missing exo__Asset_label");let u=s.exocmd__Command_grounding;if(!u)l.push("Missing exocmd__Command_grounding (required)");else{let h=rg(String(u)),p=r.get(h);if(!p)l.push(`Grounding reference "${h}" not found in vault`);else if(!El(p.fm,"exocmd__Grounding"))l.push(`Grounding reference "${h}" is not an exocmd__Grounding asset`);else{let _=p.fm,b=_.exocmd__Grounding_type;b?(Object.values(Bt.GroundingType).includes(b)||l.push(`Grounding "${h}" has invalid type "${b}"`),(b===Bt.GroundingType.PROPERTY_SET||b===Bt.GroundingType.PROPERTY_DELETE)&&!_.exocmd__Grounding_targetProperty&&l.push(`Grounding "${h}" (${b}) missing targetProperty`),b===Bt.GroundingType.PROPERTY_SET&&!_.exocmd__Grounding_targetValue&&l.push(`Grounding "${h}" (property_set) missing targetValue`)):l.push(`Grounding "${h}" missing exocmd__Grounding_type`)}}let f=s.exocmd__Command_precondition;if(f){let h=rg(String(f)),p=r.get(h);p?El(p.fm,"exocmd__Precondition")?p.fm.exocmd__Precondition_sparqlAsk||l.push(`Precondition "${h}" missing sparqlAsk`):l.push(`Precondition reference "${h}" is not an exocmd__Precondition asset`):l.push(`Precondition reference "${h}" not found in vault`)}t.some(h=>El(h.fm,"exocmd__CommandBinding")?rg(String(h.fm.exocmd__CommandBinding_command??""))===a:!1)||l.push("No CommandBinding references this command (command will be unused)"),l.length>0&&e.push({uid:a,label:c,filePath:i,issues:l})}return e}o(qG,"validateCommands");async function jb(n){let e=new Wr(n),r=await new Bt.NoteToRDFConverter(e).convertVault(),i=new Bt.InMemoryTripleStore;return await i.addAll(r),{tripleStore:i}}o(jb,"buildTripleStore");function $b(n,e){if(console.log(`${e}ID: ${n.id}`),console.log(`${e}Label: ${n.label}`),console.log(`${e}Type: ${n.type}`),n.targetProperty&&console.log(`${e}Target property: ${n.targetProperty}`),n.targetValue!==void 0&&console.log(`${e}Target value: ${n.targetValue}`),n.sparqlUpdate&&console.log(`${e}SPARQL UPDATE: ${n.sparqlUpdate}`),n.steps&&n.steps.length>0){console.log(`${e}Steps (${n.steps.length}):`);for(let t=0;t<n.steps.length;t++)console.log(`${e} Step ${t+1}:`),$b(n.steps[t],e+" ")}}o($b,"printGrounding");function Vb(n,e){let t;try{t=(0,cs.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,ls.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;Vb(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,cs.readFileSync)(i,"utf-8"),a=UG.parse(s);a.exists&&e.push({filePath:i,fm:WG(a.content)})}catch{}}}o(Vb,"collectParsedFiles");function WG(n){let e={},t=n.split(`
651
- `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let c=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(c),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let c=a[2].trim();if((c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),c===""){e[r]=[],i=e[r];continue}e[r]=c}}return e}o(WG,"parseYamlFrontmatter");function El(n,e){let t=n.exo__Instance_class;if(!t)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(El,"hasClass");function rg(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(rg,"normalizeWikilink");function rI(n){return(0,ls.basename)(n,".md")}o(rI,"extractLabelFromFilename");var Dr=new qe;Dr.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.55.17");var Ub=Dr.command("sparql").description("SPARQL query execution and cache management");Ub.addCommand(iO());Ub.addCommand(cO());Ub.addCommand(lO());Dr.addCommand(yR());Dr.addCommand(bR());Dr.addCommand(SR());Dr.addCommand(ER());Dr.addCommand(TR());Dr.addCommand(OR());Dr.addCommand(FR());Dr.addCommand(LR());Dr.addCommand($R());Dr.addCommand(WR());Dr.addCommand(zR());Dr.addCommand(QR());Dr.addCommand(KR());Dr.addCommand(tI());Dr.parse();
651
+ `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let c=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(c),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let c=a[2].trim();if((c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),c===""){e[r]=[],i=e[r];continue}e[r]=c}}return e}o(WG,"parseYamlFrontmatter");function El(n,e){let t=n.exo__Instance_class;if(!t)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}o(El,"hasClass");function rg(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(rg,"normalizeWikilink");function rI(n){return(0,ls.basename)(n,".md")}o(rI,"extractLabelFromFilename");var Dr=new qe;Dr.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.55.19");var Ub=Dr.command("sparql").description("SPARQL query execution and cache management");Ub.addCommand(iO());Ub.addCommand(cO());Ub.addCommand(lO());Dr.addCommand(yR());Dr.addCommand(bR());Dr.addCommand(SR());Dr.addCommand(ER());Dr.addCommand(TR());Dr.addCommand(OR());Dr.addCommand(FR());Dr.addCommand(LR());Dr.addCommand($R());Dr.addCommand(WR());Dr.addCommand(zR());Dr.addCommand(QR());Dr.addCommand(KR());Dr.addCommand(tI());Dr.parse();
652
652
  /*! Bundled license information:
653
653
 
654
654
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "15.55.17",
3
+ "version": "15.55.19",
4
4
  "description": "CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more",
5
5
  "main": "dist/index.js",
6
6
  "bin": {