@kitelev/exocortex-cli 16.248.0 → 16.248.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v16.248.
|
|
2
|
+
// @kitelev/exocortex-cli v16.248.1
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -425,7 +425,7 @@ ${r.slice(o+1)}`:l+=r.slice(i),l.slice(1)}function zpe(r){let e="",t=0;for(let n
|
|
|
425
425
|
`)}return n}function Ud(r,e={}){let t={...ehe,...e},n=Spe(r,t.schema,{noRefs:t.noRefs,skipInvalid:t.skipInvalid});return t.flowLevel>=0&&Epe(n,(i,s)=>{if(!(s.depth<t.flowLevel))return i.style.flow=!0,BU}),t.transform(n),Zpe(n,{...cx(t,Object.keys(Ox)),schema:t.schema})}var bt,Ife,Rfe,Cfe,xfe,Ofe,Pfe,Ffe,Dfe,Lfe,Nfe,kfe,Mfe,jfe,$fe,Ufe,Bfe,Vfe,AU,Wfe,zfe,Yfe,Xfe,ox,Zfe,ede,IU,nde,ide,ade,cde,lde,ax,dde,pde,gde,yde,bde,Sde,wde,Ede,vde,Tde,Ade,WS,vx,KDe,mu,Tx,xde,YDe,XDe,Ode,Vc,yr,Rn,Gc,Ki,Fde,xU,OU,Ude,Fd,Bde,Ix,wt,NU,kd,lx,kU,BS,Hde,Kde,MU,ux,jU,Yde,Xde,Qde,Rx,gpe,MS,lu,wpe,BU,Cx,vpe,hu,VU,Tpe,Ape,GU,px,Ipe,Rpe,qU,Cpe,hx,xx,Lm,xpe,Ope,WU,Ppe,mx,gx,Fpe,yx,Dpe,bx,zn,Ox,km,Dm,Px,Fx,Bc,ehe,QDe,JDe,ZDe,e3e,t3e,r3e,n3e,i3e,s3e,o3e,a3e,c3e,l3e,u3e,f3e,d3e,jm=Ve(()=>{bt=Symbol("NOT_RESOLVED");a(Wn,"defineScalarTag");a(Ex,"defineSequenceTag");a(GS,"defineMappingTag");Ife=Wn("tag:yaml.org,2002:str",{resolve:a(r=>r,"resolve"),identify:a(r=>typeof r=="string","identify")}),Rfe=["","~","null","Null","NULL"],Cfe=Wn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>Rfe.indexOf(r)!==-1?null:bt,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),xfe=Wn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:a((r,e)=>r==="null"||e&&r===""?null:bt,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),Ofe=["","~","null","Null","NULL"],Pfe=Wn("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:a(r=>Ofe.indexOf(r)!==-1?null:bt,"resolve"),identify:a(r=>r===null,"identify"),represent:a(()=>"null","represent")}),Ffe=["true","True","TRUE"],Dfe=["false","False","FALSE"],Lfe=Wn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:a(r=>Ffe.indexOf(r)!==-1?!0:Dfe.indexOf(r)!==-1?!1:bt,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),Nfe=["true"],kfe=["false"],Mfe=Wn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:a(r=>Nfe.indexOf(r)!==-1?!0:kfe.indexOf(r)!==-1?!1:bt,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),jfe=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],$fe=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],Ufe=Wn("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:a(r=>jfe.indexOf(r)!==-1?!0:$fe.indexOf(r)!==-1?!1:bt,"resolve"),identify:a(r=>Object.prototype.toString.call(r)==="[object Boolean]","identify"),represent:a(r=>r?"true":"false","represent")}),Bfe=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),Vfe=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(Gfe,"parseYamlInteger$2");a(qfe,"resolveYamlInteger$2");AU=Wn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:qfe,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),Wfe=new RegExp("^-?(?:0|[1-9][0-9]*)$"),zfe=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");a(Hfe,"parseYamlInteger$1");a(Kfe,"resolveYamlInteger$1");Yfe=Wn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Kfe,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),Xfe=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");a(Qfe,"parseYamlInteger");a(Jfe,"resolveYamlInteger");ox=Wn("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:Jfe,identify:a(r=>Number.isInteger(r)&&!Object.is(r,-0)&&r.toString(10).indexOf("e")<0,"identify"),represent:a(r=>r.toString(10),"represent")}),Zfe=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),ede=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(tde,"resolveYamlFloat$2");a(rde,"representYamlFloat$2");IU=Wn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:tde,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:rde}),nde=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),ide=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(sde,"resolveYamlFloat$1");a(ode,"representYamlFloat$1");ade=Wn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:sde,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:ode}),cde=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),lde=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");a(ude,"resolveYamlFloat");a(fde,"representYamlFloat");ax=Wn("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:ude,identify:a(r=>typeof r=="number"&&(!Number.isInteger(r)||Object.is(r,-0)||r.toString(10).indexOf("e")>=0),"identify"),represent:fde}),dde=Wn("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:a((r,e)=>r==="<<"||e&&r===""?"<<":bt,"resolve"),identify:a(()=>!1,"identify")}),pde=/^[A-Za-z0-9+/]*={0,2}$/;a(hde,"resolveYamlBinary");a(mde,"representYamlBinary");gde=Wn("tag:yaml.org,2002:binary",{resolve:hde,identify:a(r=>Object.prototype.toString.call(r)==="[object Uint8Array]","identify"),represent:mde}),yde=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),bde=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");a(aU,"makeUtcDate");a(_de,"resolveYamlTimestamp");Sde=Wn("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:_de,identify:a(r=>r instanceof Date,"identify"),represent:a(r=>r.toISOString(),"represent")}),wde=Ex("tag:yaml.org,2002:seq",{create:a(()=>[],"create"),addItem:a((r,e)=>{r.push(e)},"addItem"),identify:Array.isArray});a(qS,"isPlainObject");a(cx,"pick");Ede=Ex("tag:yaml.org,2002:omap",{create:a(()=>({list:[],seen:new Set}),"create"),addItem:a((r,e)=>{let t;if(e instanceof Map){if(e.size!==1)return"cannot resolve an ordered map item";t=e.keys().next().value}else if(qS(e)){let n=Object.keys(e);if(n.length!==1)return"cannot resolve an ordered map item";t=n[0]}else return"cannot resolve an ordered map item";return r.seen.has(t)?"duplicate key in ordered map":(r.seen.add(t),r.list.push(e),"")},"addItem"),finalize:a(r=>r.list,"finalize"),identify:a(()=>!1,"identify")}),vde=Ex("tag:yaml.org,2002:pairs",{create:a(()=>[],"create"),addItem:a((r,e)=>{if(e instanceof Map)return e.size!==1?"cannot resolve a pairs item":(r.push(e.entries().next().value),"");if(Object.prototype.toString.call(e)!=="[object Object]")return"cannot resolve a pairs item";let t=e,n=Object.keys(t);return n.length!==1?"cannot resolve a pairs item":(r.push([n[0],t[n[0]]]),"")},"addItem"),identify:a(()=>!1,"identify")}),Tde=GS("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:qS,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{if(e!==null&&typeof e=="object")return"object-based map does not support complex keys";let n=String(e);return n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,""},"addPair"),has:a((r,e)=>e!==null&&typeof e=="object"?!1:Object.prototype.hasOwnProperty.call(r,String(e)),"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),Ade=GS("tag:yaml.org,2002:set",{create:a(()=>new Set,"create"),identify:a(r=>r instanceof Set,"identify"),represent:a(r=>{let e=new Map;for(let t of r)e.set(t,null);return e},"represent"),addPair:a((r,e,t)=>t!==null?"cannot resolve a set item":(r.add(e),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a(()=>null,"get")});a(Ide,"createTagDefinitionMap");a(Rde,"createTagDefinitionListMap");a(Cde,"compileTags");WS=class RU{static{a(this,"Schema")}tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(e){let t=Cde(e),n=[],i=Ide(),s=Rde();for(let f of t){if(f.nodeKind==="scalar"&&f.implicit){if(f.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");n.push(f)}switch(f.nodeKind){case"scalar":f.matchByTagPrefix?s.scalar.push(f):i.scalar[f.tagName]=f;break;case"sequence":f.matchByTagPrefix?s.sequence.push(f):i.sequence[f.tagName]=f;break;case"mapping":f.matchByTagPrefix?s.mapping.push(f):i.mapping[f.tagName]=f;break}}let o=n.filter(f=>f.implicitFirstChars===null),c=new Set;for(let f of n)if(f.implicitFirstChars!==null)for(let d of f.implicitFirstChars)c.add(d);let l=new Map;for(let f of c)l.set(f,n.filter(d=>d.implicitFirstChars===null||d.implicitFirstChars.indexOf(f)!==-1));let u=i.scalar["tag:yaml.org,2002:str"];if(!u)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t,this.implicitScalarTags=n,this.implicitScalarByFirstChar=l,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=u,this.defaultSequenceTag=i.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=i.mapping["tag:yaml.org,2002:map"],this.exact=i,this.prefix=s}lookupScalarTag(e){let t=this.exact.scalar[e];if(t)return t;for(let n of this.prefix.scalar)if(e.startsWith(n.tagName))return n}lookupSequenceTag(e){let t=this.exact.sequence[e];if(t)return t;for(let n of this.prefix.sequence)if(e.startsWith(n.tagName))return n}lookupMappingTag(e){let t=this.exact.mapping[e];if(t)return t;for(let n of this.prefix.mapping)if(e.startsWith(n.tagName))return n}resolveImplicitScalarTag(e){let t=this.implicitScalarByFirstChar.get(e.charAt(0))??this.implicitScalarAnyFirstChar;for(let i of t){let s=i.resolve(e,!1,i.tagName);if(s!==bt)return{value:s,tag:i}}let n=this.defaultScalarTag;return{value:n.resolve(e,!1,n.tagName),tag:n}}withTags(...e){let t=[];for(let n of e)t=t.concat(n);return new RU([...this.tags,...t])}},vx=new WS([Ife,wde,Tde]),KDe=new WS([...vx.tags,xfe,Mfe,Yfe,ade]),mu=new WS([...vx.tags,Cfe,Lfe,AU,IU]),Tx=new WS([...vx.tags,Pfe,Ufe,ox,ax,Sde,dde,gde,Ede,vde,Ade]),xde=Tx.withTags({...ox,resolve:a((r,e,t)=>{let n=ox.resolve(r,e,t);return n===bt?AU.resolve(r,e,t):n},"resolve")},{...ax,resolve:a((r,e,t)=>{let n=ax.resolve(r,e,t);return n===bt?IU.resolve(r,e,t):n},"resolve")}),YDe=GS("tag:yaml.org,2002:map",{create:a(()=>new Map,"create"),addPair:a((r,e,t)=>(r.set(e,t),""),"addPair"),has:a((r,e)=>r.has(e),"has"),keys:a(r=>r.keys(),"keys"),get:a((r,e)=>r.get(e),"get"),identify:a(r=>r instanceof Map||qS(r),"identify"),represent:a(r=>{if(r instanceof Map)return r;let e=new Map,t=r;for(let n of Object.keys(t))e.set(n,t[n]);return e},"represent")});a(cU,"normalizeKey");XDe=GS("tag:yaml.org,2002:map",{create:a(()=>({}),"create"),identify:qS,represent:a(r=>{let e=new Map;for(let t of Object.keys(r))e.set(t,r[t]);return e},"represent"),addPair:a((r,e,t)=>{let n=cU(e);return n===null?"nested arrays are not supported inside keys":(n==="__proto__"?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,"")},"addPair"),has:a((r,e)=>{let t=cU(e);return t!==null&&Object.prototype.hasOwnProperty.call(r,t)},"has"),keys:a(r=>Object.keys(r),"keys"),get:a((r,e)=>{let t=String(e);return Object.prototype.hasOwnProperty.call(r,t)?r[t]:null},"get")}),Ode={maxLength:79,indent:1,linesBefore:3,linesAfter:2};a(ex,"getLine");a(tx,"padStart");a(Pde,"makeSnippet");a(lU,"formatError");Vc=class CU extends Error{static{a(this,"YAMLException")}reason;mark;constructor(e,t){super(),this.name="YAMLException",this.reason=e,this.mark=t,this.message=lU(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${lU(this,e)}`}static throwAt(e,t,n,i=""){let s=0,o=0;for(let l=0;l<t;l++){let u=e.charCodeAt(l);u===10?(s++,o=l+1):u===13&&(s++,e.charCodeAt(l+1)===10&&l++,o=l+1)}let c={name:i,buffer:e,position:t,line:s,column:t-o};throw c.snippet=Pde(c),new CU(n,c)}},yr={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},Rn={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Gc={BLOCK:1,FLOW:2},Ki={CLIP:1,STRIP:2,KEEP:3},Fde=-1;a(uU,"simpleEscapeSequence");xU=new Array(256),OU=new Array(256);for(let r=0;r<256;r++)xU[r]=uU(r)?1:0,OU[r]=uU(r);a(Dde,"charFromCodepoint");a(Lde,"fromHexCode$1");a(Nde,"escapedHexLen$1");a(US,"skipFoldedBreaks");a(Ax,"foldedBreaks");a(kde,"getPlainValue");a(Mde,"getSingleQuotedValue");a(jde,"getDoubleQuotedValue");a(fU,"getBlockValue");a($de,"getScalarValue");Ude=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});a(rx,"tagPercentEncode");a(PU,"tagNameFull");a(FU,"tagNameShort");Fd=-1,Bde="tag:yaml.org,2002:merge",Ix={filename:"",schema:mu,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};a(Vde,"eventPosition$1");a(qn,"throwError$1");a(DU,"finalizeCollection");a(Gde,"constructScalar");a(dU,"collectionTagName");a(LU,"isMappingTag");a(pU,"mergeKeys");a(qde,"mergeSource");a(Wde,"addMappingValue");a(nx,"addValue");a(ix,"storeAnchor");a(zde,"constructFromEvents");wt=-1,NU=Object.prototype.hasOwnProperty,kd=1,lx=2,kU=3,BS=4,Hde=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Kde=/[,\[\]{}]/,MU=/^(?:!|!!|![0-9A-Za-z-]+!)$/,ux=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,jU=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,Yde=new RegExp(`^(?:${ux})*$`),Xde=new RegExp(`^(?:${jU})+$`),Qde=new RegExp(`^(?:!(?:${ux})*|${jU}(?:${ux})*)$`),Rx={filename:"",maxDepth:100};a(Jde,"addDocumentEvent");a($U,"addSequenceEvent");a(fx,"addMappingEvent");a(hU,"insertFlowPairMappingEvent");a(jd,"addScalarEvent");a(Zde,"addAliasEvent");a(Dd,"addPopEvent");a(fi,"addEmptyScalarEvent");a(mU,"emptyProperties");a(Fm,"snapshotState");a(Ld,"restoreState");a($e,"throwError");a(sn,"isEol");a(du,"isWhiteSpace");a(Ws,"isWsOrEol");a(Va,"isWsOrEolOrEnd");a(pu,"isFlowIndicator");a(epe,"fromDecimalCode");a(tpe,"fromHexCode");a(rpe,"escapedHexLen");a(npe,"isSimpleEscape");a(VS,"consumeLineBreak");a(di,"skipSeparationSpace");a(uu,"testDocumentSeparator");a(gU,"skipUntilLineEnd");a(UU,"checkPrintable");a(ipe,"readTagProperty");a(spe,"readAnchorProperty");a(ope,"readAlias");a(dx,"readFlowScalarBreak");a(ape,"readSingleQuotedScalar");a(cpe,"readDoubleQuotedScalar");a(lpe,"readBlockScalar");a(upe,"canStartPlainScalar");a(fpe,"readPlainScalar");a(Om,"skipFlowSeparationSpace");a(dpe,"readFlowCollection");a(yU,"readBlockSequence");a(sx,"readBlockMapping");a(fu,"parseNode");a(ppe,"readDirective");a(hpe,"readDocument");a(mpe,"parseEvents");gpe={...Rx,...Ix};a(ype,"loadDocuments");a($d,"load");MS=class{static{a(this,"Style")}tagged=!1;flow=!1;singleQuoted=!1;doubleQuoted=!1;literal=!1;folded=!1},lu=Symbol("INVALID");a(bpe,"buildRepresentTypes");a(_pe,"matchTag");a(Pm,"build");a(Spe,"jsToAst");wpe=Symbol("visit:break"),BU=Symbol("visit:skip");a($S,"visitNode");a(Epe,"visit");Cx=65279,vpe=9,hu=10,VU=13,Tpe=32,Ape=33,GU=34,px=35,Ipe=37,Rpe=38,qU=39,Cpe=42,hx=44,xx=45,Lm=58,xpe=61,Ope=62,WU=63,Ppe=64,mx=91,gx=93,Fpe=96,yx=123,Dpe=124,bx=125,zn={};zn[0]="\\0";zn[7]="\\a";zn[8]="\\b";zn[9]="\\t";zn[10]="\\n";zn[11]="\\v";zn[12]="\\f";zn[13]="\\r";zn[27]="\\e";zn[34]='\\"';zn[92]="\\\\";zn[133]="\\N";zn[160]="\\_";zn[8232]="\\L";zn[8233]="\\P";Ox={indent:2,seqNoIndent:!1,seqInlineFirst:!0,sortKeys:!1,lineWidth:80,flowBracketPadding:!1,flowSkipCommaSpace:!1,flowSkipColonSpace:!1,quoteFlowKeys:!1,quoteStyle:"single",forceQuotes:!1,tagBeforeAnchor:!1};a(Lpe,"nodeTagShort");a(Npe,"createPresenterState");a(kpe,"encodeNonPrintable");a(bU,"indentString");a(_x,"generateNextLine");a(Mpe,"scalarLayout");a(Md,"isWhitespace");a(jpe,"startsWithDocumentSeparator");a(Nm,"isPrintable");a(_U,"isNsCharOrWhitespace");a(Sx,"isPlainSafe");a($pe,"isPlainSafeFirst");a(Upe,"isPlainSafeAtStart");a(Bpe,"isPlainSafeLast");a(Nd,"codePointAt");a(zU,"needIndentIndicator");km=1,Dm=2,Px=3,Fx=4,Bc=5;a(Vpe,"chooseScalarStyle");a(Gpe,"renderScalarStyle");a(qpe,"resolveScalarStyle");a(SU,"blockHeader");a(wU,"encodeFlowBreaks");a(EU,"dropEndingNewline");a(Mm,"isMoreIndented");a(Wpe,"foldBlockScalar");a(vU,"foldLine");a(zpe,"escapeString");a(Hpe,"writeFlowSequence");a(TU,"writeBlockSequence");a(Kpe,"writeFlowMapping");a(jS,"sortKeyValue");a(HU,"sortMappingItems");a(Ype,"writeBlockMapping");a(wx,"cannotBeCompact");a(Ga,"writeNode");a(Xpe,"rootStartsOwnLine");a(Qpe,"isOpenEnded");a(Jpe,"writeDocumentDirectives");a(Zpe,"present");ehe={...Ox,schema:xde,skipInvalid:!1,noRefs:!1,flowLevel:-1,transform:a(()=>{},"transform")};a(Ud,"dump");QDe=yr.DOCUMENT,JDe=yr.SEQUENCE,ZDe=yr.MAPPING,e3e=yr.SCALAR,t3e=yr.ALIAS,r3e=yr.POP,n3e=Rn.PLAIN,i3e=Rn.SINGLE_QUOTED,s3e=Rn.DOUBLE_QUOTED,o3e=Rn.LITERAL_BLOCK,a3e=Rn.FOLDED_BLOCK,c3e=Gc.BLOCK,l3e=Gc.FLOW,u3e=Ki.CLIP,f3e=Ki.STRIP,d3e=Ki.KEEP});var Dx,KU,the,YU=Ve(()=>{Dx=a((r,e,t)=>{let n=r instanceof RegExp?KU(r,t):r,i=e instanceof RegExp?KU(e,t):e,s=n!==null&&i!=null&&the(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}},"balanced"),KU=a((r,e)=>{let t=e.match(r);return t?t[0]:null},"maybeMatch"),the=a((r,e,t)=>{let n,i,s,o,c,l=t.indexOf(r),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(r===e)return[l,u];for(n=[],s=t.length;f>=0&&!c;){if(f===l)n.push(f),l=t.indexOf(r,f+1);else if(n.length===1){let d=n.pop();d!==void 0&&(c=[d,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=t.indexOf(e,f+1);f=l<u&&l>=0?l:u}n.length&&o!==void 0&&(c=[s,o])}return c},"range")});function Lx(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function hhe(r){return r.replace(ahe,XU).replace(che,QU).replace(lhe,kx).replace(uhe,JU).replace(fhe,ZU)}function mhe(r){return r.replace(rhe,"\\").replace(nhe,"{").replace(ihe,"}").replace(she,",").replace(ohe,".")}function eB(r){if(!r)return[""];let e=[],t=Dx("{","}",r);if(!t)return r.split(",");let{pre:n,body:i,post:s}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let c=eB(s);return s.length&&(o[o.length-1]+=c.shift(),o.push.apply(o,c)),e.push.apply(e,o),e}function tB(r,e={}){if(!r)return[];let{max:t=dhe,maxLength:n=phe}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),Nx(hhe(r),t,n,!0).map(mhe)}function ghe(r){return"{"+r+"}"}function yhe(r){return/^-?0\d/.test(r)}function bhe(r,e){return r<=e}function _he(r,e){return r>=e}function $m(r,e,t,n,i,s){let o=[],c=0;for(let l=0;l<r.length;l++)for(let u=0;u<t.length;u++){if(o.length>=n)return o;let f=r[l]+e+t[u];if(!(s&&!f)){if(c+f.length>i)return o;o.push(f),c+=f.length}}return o}function She(r,e,t,n){let i=r.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=Lx(i[0]),c=Lx(i[1]),l=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(Lx(i[2])),1):1,f=bhe;c<o&&(u*=-1,f=_he);let p=i.some(yhe),h=0;for(let g=o;f(g,c)&&s.length<t;g+=u){let m;if(e)m=String.fromCharCode(g),m==="\\"&&(m="");else if(m=String(g),p){let b=l-m.length;if(b>0){let _=new Array(b+1).join("0");g<0?m="-"+_+m.slice(1):m=_+m}}if(h+m.length>n)break;s.push(m),h+=m.length}return s}function Nx(r,e,t,n){let i=[""],s=!1,o=!0;for(;;){let c=Dx("{","}",r);if(!c)return $m(i,r,[""],e,t,s);let l=c.pre;if(/\$$/.test(l)){if(i=$m(i,l+"{"+c.body+"}",[""],e,t,s&&!c.post.length),o=!1,!c.post.length)break;r=c.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(c.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(c.body),d=u||f,p=c.body.indexOf(",")>=0;if(!d&&!p){if(c.post.match(/,(?!,).*\}/)){r=c.pre+"{"+c.body+kx+c.post,n=!0;continue}return $m(i,l+"{"+c.body+"}"+c.post,[""],e,t,s)}o&&(s=n&&!d,o=!1);let h;if(d)h=She(c.body,f,e,t);else{let g=eB(c.body);if(g.length===1&&g[0]!==void 0&&(g=Nx(g[0],e,t,!1).map(ghe),g.length===1)){if(i=$m(i,l+g[0],[""],e,t,s&&!c.post.length),!c.post.length)break;r=c.post;continue}let m=s&&!c.post.length&&!l;for(let _=0;m&&_<i.length;_++)i[_]&&(m=!1);h=[];let b=0;e:for(let _=0;_<g.length;_++){let w=Nx(g[_],e,t,!1);for(let I=0;I<w.length;I++){let E=w[I];if(!(m&&!E)){if(h.length>=e||b+E.length>t)break e;h.push(E),b+=E.length}}}}if(i=$m(i,l,h,e,t,s&&!c.post.length),!c.post.length)break;r=c.post}return i}var XU,QU,kx,JU,ZU,rhe,nhe,ihe,she,ohe,ahe,che,lhe,uhe,fhe,dhe,phe,rB=Ve(()=>{YU();XU="\0SLASH"+Math.random()+"\0",QU="\0OPEN"+Math.random()+"\0",kx="\0CLOSE"+Math.random()+"\0",JU="\0COMMA"+Math.random()+"\0",ZU="\0PERIOD"+Math.random()+"\0",rhe=new RegExp(XU,"g"),nhe=new RegExp(QU,"g"),ihe=new RegExp(kx,"g"),she=new RegExp(JU,"g"),ohe=new RegExp(ZU,"g"),ahe=/\\\\/g,che=/\\{/g,lhe=/\\}/g,uhe=/\\,/g,fhe=/\\\./g,dhe=1e5,phe=4e6;a(Lx,"numeric");a(hhe,"escapeBraces");a(mhe,"unescapeBraces");a(eB,"parseCommaParts");a(tB,"expand");a(ghe,"embrace");a(yhe,"isPadded");a(bhe,"lte");a(_he,"gte");a($m,"combine");a(She,"expandSequence");a(Nx,"expand_")});var Um,nB=Ve(()=>{Um=a(r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern")});var whe,Bm,Ehe,iB,sB,oB=Ve(()=>{whe={"[: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]},Bm=a(r=>r.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Ehe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),iB=a(r=>r.join(""),"rangesToString"),sB=a((r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<r.length;){let m=r.charAt(s);if((m==="!"||m==="^")&&s===t+1){u=!0,s++;continue}if(m==="]"&&o&&!l){f=s+1;break}if(o=!0,m==="\\"&&!l){l=!0,s++;continue}if(m==="["&&!l){for(let[b,[_,w,I]]of Object.entries(whe))if(r.startsWith(b,s)){if(d)return["$.",!1,r.length-t,!0];s+=b.length,I?i.push(_):n.push(_),c=c||w;continue e}}if(l=!1,d){m>d?n.push(Bm(d)+"-"+Bm(m)):m===d&&n.push(Bm(m)),d="",s++;continue}if(r.startsWith("-]",s+1)){n.push(Bm(m+"-")),s+=2;continue}if(r.startsWith("-",s+1)){d=m,s+=2;continue}n.push(Bm(m)),s++}if(f<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let m=n[0].length===2?n[0].slice(-1):n[0];return[Ehe(m),!1,f-t,!1]}let p="["+(u?"^":"")+iB(n)+"]",h="["+(u?"":"^")+iB(i)+"]";return[n.length&&i.length?"("+p+"|"+h+")":n.length?p:h,c,f-t,!0]},"parseClass")});var zs,HS=Ve(()=>{zs=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape")});var Mi,vhe,Mx,aB,The,Ahe,Ihe,cB,Rhe,KS,Che,xhe,Ohe,Phe,jx,lB,uB,Fhe,gu,$x=Ve(()=>{oB();HS();vhe=new Set(["!","?","+","*","@"]),Mx=a(r=>vhe.has(r),"isExtglobType"),aB=a(r=>Mx(r.type),"isExtglobAST"),The=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Ahe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ihe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),cB=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Rhe="(?!(?:^|/)\\.\\.?(?:$|/))",KS="(?!\\.)",Che=new Set(["[","."]),xhe=new Set(["..","."]),Ohe=new Set("().*{}+?[]^$\\!"),Phe=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),jx="[^/]",lB=jx+"*?",uB=jx+"+?",Fhe=0,gu=class{static{a(this,"AST")}type;#t;#r;#n=!1;#e=[];#i;#a;#p;#u=!1;#c;#f;#l=!1;id=++Fhe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#r=!0),this.#i=t,this.#t=this.#i?this.#i.#t:this,this.#c=this.#t===this?n:this.#t.#c,this.#p=this.#t===this?[]:this.#t.#p,e==="!"&&!this.#t.#u&&this.#p.push(this),this.#a=this.#i?this.#i.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#f=this.#e.map(e=>String(e)).join("")}#d(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#p.pop();){if(e.type!=="!")continue;let t=e,n=t.#i;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Mi&&t.#i===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#i?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof Mi&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Mi(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#o(e,t,n,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let m=n,b="";for(;m<e.length;){let _=e.charAt(m++);if(c||_==="\\"){c=!c,b+=_;continue}if(l){m===u+1?(_==="^"||_==="!")&&(f=!0):_==="]"&&!(m===u+2&&f)&&(l=!1),b+=_;continue}else if(_==="["){l=!0,u=m,f=!1,b+=_;continue}if(!i.noext&&Mx(_)&&e.charAt(m)==="("&&s<=o){t.push(b),b="";let I=new Mi(_,t);m=Mi.#o(e,I,m,i,s+1),t.push(I);continue}b+=_}return t.push(b),m}let d=n+1,p=new Mi(null,t),h=[],g="";for(;d<e.length;){let m=e.charAt(d++);if(c||m==="\\"){c=!c,g+=m;continue}if(l){d===u+1?(m==="^"||m==="!")&&(f=!0):m==="]"&&!(d===u+2&&f)&&(l=!1),g+=m;continue}else if(m==="["){l=!0,u=d,f=!1,g+=m;continue}if(!i.noext&&Mx(m)&&e.charAt(d)==="("&&(s<=o||t&&t.#_(m))){let _=t&&t.#_(m)?0:1;p.push(g),g="";let w=new Mi(m,p);p.push(w),d=Mi.#o(e,w,d,i,s+_);continue}if(m==="|"){p.push(g),g="",h.push(p),p=new Mi(null,t);continue}if(m===")")return g===""&&t.#e.length===0&&(t.#l=!0),p.push(g),g="",t.push(...h,p),d;g+=m}return t.type=null,t.#r=void 0,t.#e=[e.substring(n-1)],d}#g(e){return this.#E(e,Ahe)}#E(e,t=The){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#_(n.type,t)}#_(e,t=Ihe){return!!t.get(this.type)?.includes(e)}#S(e,t){let n=e.#e[0],i=new Mi(null,n,this.options);i.#e.push(""),n.push(i),this.#A(e,t)}#A(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#i=this);this.#f=void 0}#y(e){return!!cB.get(this.type)?.has(e)}#v(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#y(t.type)}#T(e){let t=cB.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#i=this);this.type=i,this.#f=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Mi(null,void 0,t);return Mi.#o(e,n,0,t,0),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let c=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#t===this&&(this.#m(),this.#d()),!aB(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(h=>typeof h!="string"),u=this.#e.map(h=>{let[g,m,b,_]=typeof h=="string"?Mi.#w(h,this.#r,l):h.toRegExpSource(e);return this.#r=this.#r||b,this.#n=this.#n||_,g}).join(""),f="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&xhe.has(this.#e[0]))){let g=Che,m=t&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),b=!t&&!e&&g.has(u.charAt(0));f=m?Rhe:b?KS:""}let d="";return this.isEnd()&&this.#t.#u&&this.#i?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,zs(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#b(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#e=[l],u.type=null,u.#r=void 0,[l,zs(this.toString()),!1,!1]}let o=!n||e||t||!KS?"":this.#b(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#l)c=(this.isStart()&&!t?KS:"")+uB;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?KS:"")+lB+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,zs(s),this.#r=!!this.#r,this.#n]}#m(){if(aB(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#m(),this.#E(i)?(t=!1,this.#A(i,n)):this.#g(i)?(t=!1,this.#S(i,n)):this.#v(i)&&(t=!1,this.#T(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#m();this.#f=void 0}#b(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#w(e,t,n=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(Ohe.has(u)?"\\":"")+u;continue}if(u==="*"){if(c)continue;c=!0,s+=n&&/^[*]+$/.test(e)?uB:lB,t=!0;continue}else c=!1;if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,p,h]=sB(e,l);if(p){s+=f,o=o||d,l+=p-1,t=t||h;continue}}if(u==="?"){s+=jx,t=!0;continue}s+=Phe(u)}return[s,zs(e),!!t,o]}};Mi=gu});var Bd,Ux=Ve(()=>{Bd=a((r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&"),"escape")});var pi,Dhe,Lhe,Nhe,khe,Mhe,jhe,$he,Uhe,Bhe,Vhe,Ghe,qhe,Whe,zhe,Hhe,Khe,Yhe,Xhe,pB,hB,mB,fB,Qhe,vr,Jhe,Zhe,eme,tme,rme,us,nme,gB,ime,sme,dB,ome,Yi,qc=Ve(()=>{rB();nB();$x();Ux();HS();$x();Ux();HS();pi=a((r,e,t={})=>(Um(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Yi(e,t).match(r)),"minimatch"),Dhe=/^\*+([^+@!?*[(]*)$/,Lhe=a(r=>e=>!e.startsWith(".")&&e.endsWith(r),"starDotExtTest"),Nhe=a(r=>e=>e.endsWith(r),"starDotExtTestDot"),khe=a(r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),"starDotExtTestNocase"),Mhe=a(r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),"starDotExtTestNocaseDot"),jhe=/^\*+\.\*+$/,$he=a(r=>!r.startsWith(".")&&r.includes("."),"starDotStarTest"),Uhe=a(r=>r!=="."&&r!==".."&&r.includes("."),"starDotStarTestDot"),Bhe=/^\.\*+$/,Vhe=a(r=>r!=="."&&r!==".."&&r.startsWith("."),"dotStarTest"),Ghe=/^\*+$/,qhe=a(r=>r.length!==0&&!r.startsWith("."),"starTest"),Whe=a(r=>r.length!==0&&r!=="."&&r!=="..","starTestDot"),zhe=/^\?+([^+@!?*[(]*)?$/,Hhe=a(([r,e=""])=>{let t=pB([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),Khe=a(([r,e=""])=>{let t=hB([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),Yhe=a(([r,e=""])=>{let t=hB([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTestDot"),Xhe=a(([r,e=""])=>{let t=pB([r]);return e?n=>t(n)&&n.endsWith(e):t},"qmarksTest"),pB=a(([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),hB=a(([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),mB=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",fB={win32:{sep:"\\"},posix:{sep:"/"}},Qhe=mB==="win32"?fB.win32.sep:fB.posix.sep;pi.sep=Qhe;vr=Symbol("globstar **");pi.GLOBSTAR=vr;Jhe="[^/]",Zhe=Jhe+"*?",eme="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",tme="(?:(?!(?:\\/|^)\\.).)*?",rme=a((r,e={})=>t=>pi(t,r,e),"filter");pi.filter=rme;us=a((r,e={})=>Object.assign({},r,e),"ext"),nme=a(r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return pi;let e=pi;return Object.assign(a((n,i,s={})=>e(n,i,us(r,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,us(r,s))}static defaults(i){return e.defaults(us(r,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,us(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,us(r,s))}},unescape:a((n,i={})=>e.unescape(n,us(r,i)),"unescape"),escape:a((n,i={})=>e.escape(n,us(r,i)),"escape"),filter:a((n,i={})=>e.filter(n,us(r,i)),"filter"),defaults:a(n=>e.defaults(us(r,n)),"defaults"),makeRe:a((n,i={})=>e.makeRe(n,us(r,i)),"makeRe"),braceExpand:a((n,i={})=>e.braceExpand(n,us(r,i)),"braceExpand"),match:a((n,i,s={})=>e.match(n,i,us(r,s)),"match"),sep:e.sep,GLOBSTAR:vr})},"defaults");pi.defaults=nme;gB=a((r,e={})=>(Um(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:tB(r,{max:e.braceExpandMax})),"braceExpand");pi.braceExpand=gB;ime=a((r,e={})=>new Yi(r,e).makeRe(),"makeRe");pi.makeRe=ime;sme=a((r,e,t={})=>{let n=new Yi(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r},"match");pi.match=sme;dB=/[?*]|[+@!]\(.*?\)|\[|\]/,ome=a(r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Yi=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){Um(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||mB,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!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 n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!dB.test(s[2]))&&!dB.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 o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[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 n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),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 n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let c=n[i+1],l=n[i+2],u=n[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,n.splice(i,1);let f=n.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let c=n[o];o===1&&c===""&&n[0]===""||(c==="."||c==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...l),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.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",o.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",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!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,p=f?3:u?0:void 0;if(typeof d=="number"&&typeof p=="number"){let[h,g]=[e[d],t[p]];h.toLowerCase()===g.toLowerCase()&&(t[p]=h,s=p,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(vr)?this.#t(e,t,n,i,s):this.#n(e,t,n,i,s)}#t(e,t,n,i,s){let o=t.indexOf(vr,s),c=t.lastIndexOf(vr),[l,u,f]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let w=e.slice(i,i+l.length);if(!this.#n(w,l,n,0,0))return!1;i+=l.length,s+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let w=e.length-f.length;if(this.#n(e,f,n,w,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(w--,!this.#n(e,f,n,w,0)))return!1;d=f.length+1}}if(!u.length){let w=!!d;for(let I=i;I<e.length-d;I++){let E=String(e[I]);if(w=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||w}let p=[[[],0]],h=p[0],g=0,m=[0];for(let w of u)w===vr?(m.push(g),h=[[],0],p.push(h)):(h[0].push(w),g++);let b=p.length-1,_=e.length-d;for(let w of p)w[1]=_-(m[b--]+w[0].length);return!!this.#r(e,p,i,0,n,0,!!d)}#r(e,t,n,i,s,o,c){let l=t[i];if(!l){for(let d=n;d<e.length;d++){c=!0;let p=e[d];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return c}let[u,f]=l;for(;n<=f;){if(this.#n(e.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(e,t,n+u.length,i+1,s,o+1,c);if(h!==!1)return h}let p=e[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return s||null}#n(e,t,n,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===vr)return!1;let p;if(typeof f=="string"?(p=d===f,this.debug("string match",f,d,p)):(p=f.test(d),this.debug("pattern match",f,d,p)),!p)return!1}if(o===u&&c===l)return!0;if(o===u)return n;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return gB(this.pattern,this.options)}parse(e){Um(e);let t=this.options;if(e==="**")return vr;if(e==="")return"";let n,i=null;(n=e.match(Ghe))?i=t.dot?Whe:qhe:(n=e.match(Dhe))?i=(t.nocase?t.dot?Mhe:khe:t.dot?Nhe:Lhe)(n[1]):(n=e.match(zhe))?i=(t.nocase?t.dot?Khe:Hhe:t.dot?Yhe:Xhe)(n):(n=e.match(jhe))?i=t.dot?Uhe:$he:(n=e.match(Bhe))&&(i=Vhe);let s=gu.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,n=t.noglobstar?Zhe:t.dot?eme:tme,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(d=>{if(d instanceof RegExp)for(let p of d.flags.split(""))i.add(p);return typeof d=="string"?ome(d):d===vr?vr:d._src});u.forEach((d,p)=>{let h=u[p+1],g=u[p-1];d!==vr||g===vr||(g===void 0?h!==void 0&&h!==vr?u[p+1]="(?:\\/|"+n+"\\/)?"+h:u[p]=n:h===void 0?u[p-1]=g+"(?:\\/|\\/"+n+")?":h!==vr&&(u[p-1]=g+"(?:\\/|\\/"+n+"\\/)"+h,u[p+1]=vr))});let f=u.filter(d=>d!==vr);if(this.partial&&f.length>=1){let d=[];for(let p=1;p<=f.length;p++)d.push(f.slice(0,p).join("/"));return"(?:"+d.join("|")+")"}return f.join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+c+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+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 n=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 o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c of s){let l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return pi.defaults(e).Minimatch}};pi.AST=gu;pi.Minimatch=Yi;pi.escape=Bd;pi.unescape=zs});var XS,Cn,Vm,ame,Bx,bB,yB,cme,lme,Wc,_B,YS,ume,qm,wB=Ve(()=>{XS=require("node:diagnostics_channel"),Cn=(0,XS.channel)("lru-cache:metrics"),Vm=(0,XS.tracingChannel)("lru-cache"),ame=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Bx=a(()=>Cn.hasSubscribers||Vm.hasSubscribers,"R"),bB=new Set,yB=typeof process=="object"&&process?process:{},cme=a((r,e,t,n)=>{typeof yB.emitWarning=="function"?yB.emitWarning(r,e,t,n):console.error(`[${t}] ${e}: ${r}`)},"k"),lme=a(r=>!bB.has(r),"H"),Wc=a(r=>!!r&&r===Math.floor(r)&&r>0&&isFinite(r),"T"),_B=a(r=>Wc(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?YS:null:null,"j"),YS=class extends Array{static{a(this,"O")}constructor(r){super(r),this.fill(0)}},ume=class Gm{static{a(this,"d")}heap;length;static#t=!1;static create(e){let t=_B(e);if(!t)return[];Gm.#t=!0;let n=new Gm(e,t);return Gm.#t=!1,n}constructor(e,t){if(!Gm.#t)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]}},qm=class SB{static{a(this,"d")}#t;#r;#n;#e;#i;#a;#p;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#f;#l;#d;#o;#g;#E;#_;#S;#A;#y;#v;#T;#m;#b;#w;#R;#s;#x;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#m,autopurgeTimers:e.#b,sizes:e.#v,keyMap:e.#l,keyList:e.#d,valList:e.#o,next:e.#g,prev:e.#E,get head(){return e.#_},get tail(){return e.#S},free:e.#A,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,n,i,s)=>e.#M(t,n,i,s),"backgroundFetch"),moveToTail:a(t=>e.#K(t),"moveToTail"),indexes:a(t=>e.#P(t),"indexes"),rindexes:a(t=>e.#F(t),"rindexes"),isStale:a(t=>e.#I(t),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#p}get dispose(){return this.#n}get onInsert(){return this.#e}get disposeAfter(){return this.#i}constructor(e){let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,onInsert:f,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:g=0,maxEntrySize:m=0,sizeCalculation:b,fetchMethod:_,memoMethod:w,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:R,ignoreFetchAbort:O,backgroundFetchSize:x=1,perf:k}=e;if(this.backgroundFetchSize=x,k!==void 0&&typeof k?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=k??ame,t!==0&&!Wc(t))throw new TypeError("max option must be a nonnegative integer");let M=t?_B(t):Array;if(!M)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=g,this.maxEntrySize=m||this.#r,this.sizeCalculation=b,this.sizeCalculation){if(!this.#r&&!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.#p=w,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=_,this.#R=!!_,this.#l=new Map,this.#d=Array.from({length:t}).fill(void 0),this.#o=Array.from({length:t}).fill(void 0),this.#g=new M(t),this.#E=new M(t),this.#_=0,this.#S=0,this.#A=ume.create(t),this.#c=0,this.#f=0,typeof u=="function"&&(this.#n=u),typeof f=="function"&&(this.#e=f),typeof d=="function"?(this.#i=d,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#w=!!this.#n,this.#x=!!this.#e,this.#s=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!O,this.maxEntrySize!==0){if(this.#r!==0&&!Wc(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Wc(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=Wc(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Wc(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let D="LRU_CACHE_UNBOUNDED";lme(D)&&(bB.add(D),cme("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",D,SB))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#O(){let e=new YS(this.#t),t=new YS(this.#t);this.#m=e,this.#T=t;let n=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#b=n,this.#$=(l,u,f=this.#u.now())=>{t[l]=u!==0?f:0,e[l]=u,i(l,u)},this.#C=l=>{t[l]=e[l]!==0?this.#u.now():0,i(l,e[l])};let i=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let f=setTimeout(()=>{this.#I(l)?(this.#j(this.#d[l],"expire"),n[l]=void 0):i(l,c(l))},u+1);f.unref&&f.unref(),n[l]=f}}:()=>{};this.#D=(l,u)=>{if(e[u]){let f=e[u],d=t[u];if(!f||!d)return;l.ttl=f,l.start=d,l.now=s||o();let p=l.now-d;l.remainingTTL=f-p}};let s=0,o=a(()=>{let l=this.#u.now();if(this.ttlResolution>0){s=l;let u=setTimeout(()=>s=0,this.ttlResolution);u.unref&&u.unref()}return l},"o");this.getRemainingTTL=l=>{let u=this.#l.get(l);return u===void 0?0:c(u)};let c=a(l=>{let u=e[l],f=t[l];if(!u||!f)return 1/0;let d=(s||o())-f;return u-d},"l");this.#I=l=>{let u=t[l],f=e[l];return!!f&&!!u&&(s||o())-u>f}}#C=a(()=>{},"#R");#D=a(()=>{},"#v");#$=a(()=>{},"#H");#I=a(()=>!1,"#p");#q(){let e=new YS(this.#t);this.#f=0,this.#v=e,this.#N=t=>{this.#f-=e[t],e[t]=0},this.#U=(t,n,i,s)=>{if(!Wc(i)){if(this.#h(n))return this.backgroundFetchSize;if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!Wc(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.#L=(t,n,i)=>{if(e[t]=n,this.#r){let s=this.#r-e[t];for(;this.#f>s;)this.#G(!0)}this.#f+=e[t],i&&(i.entrySize=n,i.totalCalculatedSize=this.#f)}}#N=a(e=>{},"#x");#L=a((e,t,n)=>{},"#j");#U=a((e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#N");*#P({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#S;this.#B(t)&&((e||!this.#I(t))&&(yield t),t!==this.#_);)t=this.#E[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#_;this.#B(t)&&((e||!this.#I(t))&&(yield t),t!==this.#S);)t=this.#g[t]}#B(e){return e!==void 0&&this.#l.get(this.#d[e])===e}*entries(){for(let e of this.#P())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*rentries(){for(let e of this.#F())this.#o[e]!==void 0&&this.#d[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#d[e],this.#o[e]])}*keys(){for(let e of this.#P()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#P())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#F())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#d[n],this))return this.#H(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#P()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let i=this.#o[n],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#I(t)&&(this.#j(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let n=this.#o[t],i=this.#h(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#m&&this.#T){let o=this.#m[t],c=this.#T[t];if(o&&c){let l=o-(this.#u.now()-c);s.ttl=l,s.start=Date.now()}}return this.#v&&(s.size=this.#v[t]),s}dump(){let e=[];for(let t of this.#P({allowStale:!0})){let n=this.#d[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#m&&this.#T){o.ttl=this.#m[t];let c=this.#u.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#v&&(o.size=this.#v[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=this.#u.now()-i}this.#k(t,n.value,n)}}set(e,t,n={}){let{status:i=Cn.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op="set",i.key=e,t!==void 0&&(i.value=t),i.cache=this);let s=this.#k(e,t,n);return i&&Cn.hasSubscribers&&Cn.publish(i),s}#k(e,t,n,i){let{ttl:s=this.ttl,start:o,noDisposeOnSet:c=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,f=this.#h(t);if(t===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:d=this.noUpdateTTL}=n;u&&!f&&(u.value=t);let p=this.#U(e,t,n.size||0,l,u);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#j(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let h=this.#c===0?void 0:this.#l.get(e);if(h===void 0)h=this.#c===0?this.#S:this.#A.length!==0?this.#A.pop():this.#c===this.#t?this.#G(!1):this.#c,this.#d[h]=e,this.#o[h]=t,this.#l.set(e,h),this.#g[this.#S]=h,this.#E[h]=this.#S,this.#S=h,this.#c++,this.#L(h,p,u),u&&(u.set="add"),d=!1,this.#x&&!f&&this.#e?.(t,e,"add");else{this.#K(h);let g=this.#o[h];if(t!==g){if(!c)if(this.#h(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=g;m!==void 0&&m!==t&&(this.#w&&this.#n?.(m,e,"set"),this.#s&&this.#y?.push([m,e,"set"]))}else this.#w&&this.#n?.(g,e,"set"),this.#s&&this.#y?.push([g,e,"set"]);if(this.#N(h),this.#L(h,p,u),this.#o[h]=t,!f){let m=g&&this.#h(g)?g.__staleWhileFetching:g,b=m===void 0?"add":t!==m?"replace":"update";u&&(u.set=b,m!==void 0&&(u.oldValue=m)),this.#x&&this.onInsert?.(t,e,b)}}else f||(u&&(u.set="update"),this.#x&&this.onInsert?.(t,e,"update"))}if(s!==0&&!this.#m&&this.#O(),this.#m&&(d||this.#$(h,s,o),u&&this.#D(u,h)),!c&&this.#s&&this.#y){let g=this.#y,m;for(;m=g?.shift();)this.#i?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#o[this.#_];if(this.#G(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#s&&this.#y){let e=this.#y,t;for(;t=e?.shift();)this.#i?.(...t)}}}#G(e){let t=this.#_,n=this.#d[t],i=this.#o[t],s=this.#h(i);s&&i.__abortController.abort(new Error("evicted"));let o=s?i.__staleWhileFetching:i;return(this.#w||this.#s)&&o!==void 0&&(this.#w&&this.#n?.(o,n,"evict"),this.#s&&this.#y?.push([o,n,"evict"])),this.#N(t),this.#b?.[t]&&(clearTimeout(this.#b[t]),this.#b[t]=void 0),e&&(this.#d[t]=void 0,this.#o[t]=void 0,this.#A.push(t)),this.#c===1?(this.#_=this.#S=0,this.#A.length=0):this.#_=this.#g[t],this.#l.delete(n),this.#c--,t}has(e,t={}){let{status:n=Cn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#Y(e,t);return Cn.hasSubscribers&&Cn.publish(n),i}#Y(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=this.#l.get(e);if(s!==void 0){let o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#I(s))i&&(i.has="stale",this.#D(i,s));else return n&&this.#C(s),i&&(i.has="hit",this.#D(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{status:n=Bx()?{}:void 0}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let i=this.#W(e,t);return Cn.hasSubscribers&&Cn.publish(n),i}#W(e,t){let{status:n,allowStale:i=this.allowStale}=t,s=this.#l.get(e);if(s===void 0||!i&&this.#I(s)){n&&(n.peek=s===void 0?"miss":"stale");return}let o=this.#o[s],c=this.#h(o)?o.__staleWhileFetching:o;return n&&(c!==void 0?(n.peek="hit",n.value=c):n.peek="miss"),c}#M(e,t,n,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new AbortController,{signal:c}=n;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=a((m,b=!1)=>{let{aborted:_}=o.signal,w=n.ignoreFetchAbort&&m!==void 0,I=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&m!==void 0);if(n.status&&(_&&!b?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,w&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),_&&!w&&!b)return d(o.signal.reason,I);let E=h,S=this.#o[t];return(S===h||S===void 0&&w&&b)&&(m===void 0?E.__staleWhileFetching!==void 0?this.#o[t]=E.__staleWhileFetching:this.#j(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#k(e,m,l.options,E))),m},"r"),f=a(m=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=m),d(m,!1)),"c"),d=a((m,b)=>{let{aborted:_}=o.signal,w=_&&n.allowStaleOnFetchAbort,I=w||n.allowStaleOnFetchRejection,E=I||n.noDeleteOnFetchRejection,S=h;if(this.#o[t]===h&&(!E||!b&&S.__staleWhileFetching===void 0?this.#j(e,"fetch"):w||(this.#o[t]=S.__staleWhileFetching)),I)return n.status&&S.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw m},"m"),p=a((m,b)=>{let _=this.#a?.(e,s,l);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(m(void 0),n.allowStaleOnFetchAbort&&(m=a(w=>u(w,!0),"f")))}),_&&_ instanceof Promise?_.then(w=>m(w===void 0?void 0:w),b):_!==void 0&&m(_)},"_");n.status&&(n.status.fetchDispatched=!0);let h=new Promise(p).then(u,f),g=Object.assign(h,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.#k(e,g,{...l.options,status:void 0}),t=this.#l.get(e)):this.#o[t]=g,g}#h(e){if(!this.#R)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Vm.hasSubscribers,{status:i=Bx()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#z(e,t);return i&&n&&(i.trace=!0,Vm.tracePromise(()=>s,i).catch(()=>{})),s}async#z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:m,forceRefresh:b=!1,status:_,signal:w}=t;if(_&&(_.op="fetch",_.key=e,b&&(_.forceRefresh=!0),_.cache=this),!this.#R)return _&&(_.fetch="get"),this.#H(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:_});let I={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:h,status:_,signal:w},E=this.#l.get(e);if(E===void 0){_&&(_.fetch="miss");let S=this.#M(e,E,I,m);return S.__returned=S}else{let S=this.#o[E];if(this.#h(S)){let k=n&&S.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",k&&(_.returnedStale=!0)),k?S.__staleWhileFetching:S.__returned=S}let R=this.#I(E);if(!b&&!R)return _&&(_.fetch="hit"),this.#K(E),i&&this.#C(E),_&&this.#D(_,E),S;let O=this.#M(e,E,I,m),x=O.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=R?"stale":"refresh",x&&R&&(_.returnedStale=!0)),x?O.__staleWhileFetching:O.__returned=O}}forceFetch(e,t={}){let n=Vm.hasSubscribers,{status:i=Bx()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#V(e,t);return i&&n&&(i.trace=!0,Vm.tracePromise(()=>s,i).catch(()=>{})),s}async#V(e,t={}){let n=await this.#z(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=Cn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=this.#J(e,t);return n&&(n.value=i),Cn.hasSubscribers&&Cn.publish(n),i}#J(e,t={}){let n=this.#p;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,status:s,forceRefresh:o,...c}=t;s&&o&&(s.forceRefresh=!0);let l=this.#H(e,c),u=o||l===void 0;if(s&&(s.memo=u?"miss":"hit",u||(s.value=l)),!u)return l;let f=n(e,l,{options:c,context:i});return s&&(s.value=f),this.#k(e,f,c),f}get(e,t={}){let{status:n=Cn.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#H(e,t);return n&&(i!==void 0&&(n.value=i),Cn.hasSubscribers&&Cn.publish(n)),i}#H(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#l.get(e);if(c===void 0){o&&(o.get="miss");return}let l=this.#o[c],u=this.#h(l);return o&&this.#D(o,c),this.#I(c)?u?(o&&(o.get="stale-fetching"),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(s||this.#j(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?"fetching":"hit"),this.#K(c),i&&this.#C(c),u?l.__staleWhileFetching:l)}#X(e,t){this.#E[t]=e,this.#g[e]=t}#K(e){e!==this.#S&&(e===this.#_?this.#_=this.#g[e]:this.#X(this.#E[e],this.#g[e]),this.#X(this.#S,e),this.#S=e)}delete(e){return this.#j(e,"delete")}#j(e,t){Cn.hasSubscribers&&Cn.publish({op:"delete",delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(this.#b?.[i]&&(clearTimeout(this.#b[i]),this.#b[i]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#s)&&(this.#w&&this.#n?.(s,e,t),this.#s&&this.#y?.push([s,e,t])),this.#l.delete(e),this.#d[i]=void 0,this.#o[i]=void 0,i===this.#S)this.#S=this.#E[i];else if(i===this.#_)this.#_=this.#g[i];else{let o=this.#E[i];this.#g[o]=this.#g[i];let c=this.#g[i];this.#E[c]=this.#E[i]}this.#c--,this.#A.push(i)}}if(this.#s&&this.#y?.length){let i=this.#y,s;for(;s=i?.shift();)this.#i?.(...s)}return n}clear(){return this.#Q("delete")}#Q(e){for(let t of this.#F({allowStale:!0})){let n=this.#o[t];if(this.#h(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#d[t];this.#w&&this.#n?.(n,i,e),this.#s&&this.#y?.push([n,i,e])}}if(this.#l.clear(),this.#o.fill(void 0),this.#d.fill(void 0),this.#m&&this.#T){this.#m.fill(0),this.#T.fill(0);for(let t of this.#b??[])t!==void 0&&clearTimeout(t);this.#b?.fill(void 0)}if(this.#v&&this.#v.fill(0),this.#_=0,this.#S=0,this.#A.length=0,this.#f=0,this.#c=0,this.#s&&this.#y){let t=this.#y,n;for(;n=t?.shift();)this.#i?.(...n)}}}});var nw,Kx,IB,EB,fme,dme,pme,qa,Wa,zc,QS,Wm,JS,vB,ZS,TB,Hs,Vd,on,zm,Gd,an,hi,cn,Vx,ew,Hn,Tr,Gx,qx,AB,Wx,Lo,zx,tw,Hm,yu,Xi,Km,hme,mme,gme,yme,rw,Hx,bme,_me,Hc,Yx=Ve(()=>{nw=require("node:events"),Kx=te(require("node:stream"),1),IB=require("node:string_decoder"),EB=typeof process=="object"&&process?process:{stdout:null,stderr:null},fme=a(r=>!!r&&typeof r=="object"&&(r instanceof Hc||r instanceof Kx.default||dme(r)||pme(r)),"isStream"),dme=a(r=>!!r&&typeof r=="object"&&r instanceof nw.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==Kx.default.Writable.prototype.pipe,"isReadable"),pme=a(r=>!!r&&typeof r=="object"&&r instanceof nw.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function","isWritable"),qa=Symbol("EOF"),Wa=Symbol("maybeEmitEnd"),zc=Symbol("emittedEnd"),QS=Symbol("emittingEnd"),Wm=Symbol("emittedError"),JS=Symbol("closed"),vB=Symbol("read"),ZS=Symbol("flush"),TB=Symbol("flushChunk"),Hs=Symbol("encoding"),Vd=Symbol("decoder"),on=Symbol("flowing"),zm=Symbol("paused"),Gd=Symbol("resume"),an=Symbol("buffer"),hi=Symbol("pipes"),cn=Symbol("bufferLength"),Vx=Symbol("bufferPush"),ew=Symbol("bufferShift"),Hn=Symbol("objectMode"),Tr=Symbol("destroyed"),Gx=Symbol("error"),qx=Symbol("emitData"),AB=Symbol("emitEnd"),Wx=Symbol("emitEnd2"),Lo=Symbol("async"),zx=Symbol("abort"),tw=Symbol("aborted"),Hm=Symbol("signal"),yu=Symbol("dataListeners"),Xi=Symbol("discarded"),Km=a(r=>Promise.resolve().then(r),"defer"),hme=a(r=>r(),"nodefer"),mme=a(r=>r==="end"||r==="finish"||r==="prefinish","isEndish"),gme=a(r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,"isArrayBufferLike"),yme=a(r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),"isArrayBufferView"),rw=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[Gd](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Hx=class extends rw{static{a(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},bme=a(r=>!!r.objectMode,"isObjectModeOptions"),_me=a(r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer","isEncodingOptions"),Hc=class extends nw.EventEmitter{static{a(this,"Minipass")}[on]=!1;[zm]=!1;[hi]=[];[an]=[];[Hn];[Hs];[Lo];[Vd];[qa]=!1;[zc]=!1;[QS]=!1;[JS]=!1;[Wm]=null;[cn]=0;[Tr]=!1;[Hm];[tw]=!1;[yu]=0;[Xi]=!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");bme(t)?(this[Hn]=!0,this[Hs]=null):_me(t)?(this[Hs]=t.encoding,this[Hn]=!1):(this[Hn]=!1,this[Hs]=null),this[Lo]=!!t.async,this[Vd]=this[Hs]?new IB.StringDecoder(this[Hs]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[an],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[hi],"get")});let{signal:n}=t;n&&(this[Hm]=n,n.aborted?this[zx]():n.addEventListener("abort",()=>this[zx]()))}get bufferLength(){return this[cn]}get encoding(){return this[Hs]}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[Hn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Lo]}set async(e){this[Lo]=this[Lo]||!!e}[zx](){this[tw]=!0,this.emit("abort",this[Hm]?.reason),this.destroy(this[Hm]?.reason)}get aborted(){return this[tw]}set aborted(e){}write(e,t,n){if(this[tw])return!1;if(this[qa])throw new Error("write after end");if(this[Tr])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(n=t,t="utf8"),t||(t="utf8");let i=this[Lo]?Km:hme;if(!this[Hn]&&!Buffer.isBuffer(e)){if(yme(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(gme(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Hn]?(this[on]&&this[cn]!==0&&this[ZS](!0),this[on]?this.emit("data",e):this[Vx](e),this[cn]!==0&&this.emit("readable"),n&&i(n),this[on]):e.length?(typeof e=="string"&&!(t===this[Hs]&&!this[Vd]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Hs]&&(e=this[Vd].write(e)),this[on]&&this[cn]!==0&&this[ZS](!0),this[on]?this.emit("data",e):this[Vx](e),this[cn]!==0&&this.emit("readable"),n&&i(n),this[on]):(this[cn]!==0&&this.emit("readable"),n&&i(n),this[on])}read(e){if(this[Tr])return null;if(this[Xi]=!1,this[cn]===0||e===0||e&&e>this[cn])return this[Wa](),null;this[Hn]&&(e=null),this[an].length>1&&!this[Hn]&&(this[an]=[this[Hs]?this[an].join(""):Buffer.concat(this[an],this[cn])]);let t=this[vB](e||null,this[an][0]);return this[Wa](),t}[vB](e,t){if(this[Hn])this[ew]();else{let n=t;e===n.length||e===null?this[ew]():typeof n=="string"?(this[an][0]=n.slice(e),t=n.slice(0,e),this[cn]-=e):(this[an][0]=n.subarray(e),t=n.subarray(0,e),this[cn]-=e)}return this.emit("data",t),!this[an].length&&!this[qa]&&this.emit("drain"),t}end(e,t,n){return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t="utf8"),e!==void 0&&this.write(e,t),n&&this.once("end",n),this[qa]=!0,this.writable=!1,(this[on]||!this[zm])&&this[Wa](),this}[Gd](){this[Tr]||(!this[yu]&&!this[hi].length&&(this[Xi]=!0),this[zm]=!1,this[on]=!0,this.emit("resume"),this[an].length?this[ZS]():this[qa]?this[Wa]():this.emit("drain"))}resume(){return this[Gd]()}pause(){this[on]=!1,this[zm]=!0,this[Xi]=!1}get destroyed(){return this[Tr]}get flowing(){return this[on]}get paused(){return this[zm]}[Vx](e){this[Hn]?this[cn]+=1:this[cn]+=e.length,this[an].push(e)}[ew](){return this[Hn]?this[cn]-=1:this[cn]-=this[an][0].length,this[an].shift()}[ZS](e=!1){do;while(this[TB](this[ew]())&&this[an].length);!e&&!this[an].length&&!this[qa]&&this.emit("drain")}[TB](e){return this.emit("data",e),this[on]}pipe(e,t){if(this[Tr])return e;this[Xi]=!1;let n=this[zc];return t=t||{},e===EB.stdout||e===EB.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[hi].push(t.proxyErrors?new Hx(this,e,t):new rw(this,e,t)),this[Lo]?Km(()=>this[Gd]()):this[Gd]()),e}unpipe(e){let t=this[hi].find(n=>n.dest===e);t&&(this[hi].length===1?(this[on]&&this[yu]===0&&(this[on]=!1),this[hi]=[]):this[hi].splice(this[hi].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e==="data")this[Xi]=!1,this[yu]++,!this[hi].length&&!this[on]&&this[Gd]();else if(e==="readable"&&this[cn]!==0)super.emit("readable");else if(mme(e)&&this[zc])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Wm]){let i=t;this[Lo]?Km(()=>i.call(this,this[Wm])):i.call(this,this[Wm])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e==="data"&&(this[yu]=this.listeners("data").length,this[yu]===0&&!this[Xi]&&!this[hi].length&&(this[on]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[yu]=0,!this[Xi]&&!this[hi].length&&(this[on]=!1)),t}get emittedEnd(){return this[zc]}[Wa](){!this[QS]&&!this[zc]&&!this[Tr]&&this[an].length===0&&this[qa]&&(this[QS]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[JS]&&this.emit("close"),this[QS]=!1)}emit(e,...t){let n=t[0];if(e!=="error"&&e!=="close"&&e!==Tr&&this[Tr])return!1;if(e==="data")return!this[Hn]&&!n?!1:this[Lo]?(Km(()=>this[qx](n)),!0):this[qx](n);if(e==="end")return this[AB]();if(e==="close"){if(this[JS]=!0,!this[zc]&&!this[Tr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Wm]=n,super.emit(Gx,n);let s=!this[Hm]||this.listeners("error").length?super.emit("error",n):!1;return this[Wa](),s}else if(e==="resume"){let s=super.emit("resume");return this[Wa](),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[Wa](),i}[qx](e){for(let n of this[hi])n.dest.write(e)===!1&&this.pause();let t=this[Xi]?!1:super.emit("data",e);return this[Wa](),t}[AB](){return this[zc]?!1:(this[zc]=!0,this.readable=!1,this[Lo]?(Km(()=>this[Wx]()),!0):this[Wx]())}[Wx](){if(this[Vd]){let t=this[Vd].end();if(t){for(let n of this[hi])n.dest.write(t);this[Xi]||super.emit("data",t)}}for(let t of this[hi])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Hn]||(e.dataLength=0);let t=this.promise();return this.on("data",n=>{e.push(n),this[Hn]||(e.dataLength+=n.length)}),await t,e}async concat(){if(this[Hn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Hs]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Tr,()=>t(new Error("stream destroyed"))),this.on("error",n=>t(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Xi]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[qa])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(Tr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(Tr,f),this.pause(),s({value:d,done:!!this[qa]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(Tr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,p)=>{o=p,s=d,this.once(Tr,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[Xi]=!1;let e=!1,t=a(()=>(this.pause(),this.off(Gx,t),this.off(Tr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),n=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(Gx,t),this.once(Tr,t),{next:n,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Tr])return e?this.emit("error",e):this.emit(Tr),this;this[Tr]=!0,this[Xi]=!0,this[an].length=0,this[cn]=0;let t=this;return typeof t.close=="function"&&!this[JS]&&t.close(),e?this.emit("error",e):this.emit(Tr),this}static get isStream(){return fme}}});var qd,PB,ko,Sme,Kc,wme,Xm,FB,DB,Eme,vme,ds,LB,NB,No,kB,MB,bu,jB,fs,Ym,Xx,RB,Qm,Ks,iw,ow,CB,Tme,Qx,xB,Jm,OB,sw,aw,Jx,$B,Kn,cw,lw,uw,Wd,zd,Zm,Q3e,UB,BB=Ve(()=>{wB();qd=require("node:path"),PB=require("node:url"),ko=require("fs"),Sme=te(require("node:fs"),1),Kc=require("node:fs/promises");Yx();wme=ko.realpathSync.native,Xm={lstatSync:ko.lstatSync,readdir:ko.readdir,readdirSync:ko.readdirSync,readlinkSync:ko.readlinkSync,realpathSync:wme,promises:{lstat:Kc.lstat,readdir:Kc.readdir,readlink:Kc.readlink,realpath:Kc.realpath}},FB=a(r=>!r||r===Xm||r===Sme?Xm:{...Xm,...r,promises:{...Xm.promises,...r.promises||{}}},"fsFromOption"),DB=/^\\\\\?\\([a-z]:)\\?$/i,Eme=a(r=>r.replace(/\//g,"\\").replace(DB,"$1\\"),"uncToDrive"),vme=/[\\\/]/,ds=0,LB=1,NB=2,No=4,kB=6,MB=8,bu=10,jB=12,fs=15,Ym=~fs,Xx=16,RB=32,Qm=64,Ks=128,iw=256,ow=512,CB=Qm|Ks|ow,Tme=1023,Qx=a(r=>r.isFile()?MB:r.isDirectory()?No:r.isSymbolicLink()?bu:r.isCharacterDevice()?NB:r.isBlockDevice()?kB:r.isSocket()?jB:r.isFIFO()?LB:ds,"entToType"),xB=new qm({max:2**12}),Jm=a(r=>{let e=xB.get(r);if(e)return e;let t=r.normalize("NFKD");return xB.set(r,t),t},"normalize"),OB=new qm({max:2**12}),sw=a(r=>{let e=OB.get(r);if(e)return e;let t=Jm(r.toLowerCase());return OB.set(r,t),t},"normalizeNocase"),aw=class extends qm{static{a(this,"ResolveCache")}constructor(){super({max:256})}},Jx=class extends qm{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},$B=Symbol("PathScurry setAsCwd"),Kn=class{static{a(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#p;get rdev(){return this.#p}#u;get blksize(){return this.#u}#c;get ino(){return this.#c}#f;get size(){return this.#f}#l;get blocks(){return this.#l}#d;get atimeMs(){return this.#d}#o;get mtimeMs(){return this.#o}#g;get ctimeMs(){return this.#g}#E;get birthtimeMs(){return this.#E}#_;get atime(){return this.#_}#S;get mtime(){return this.#S}#A;get ctime(){return this.#A}#y;get birthtime(){return this.#y}#v;#T;#m;#b;#w;#R;#s;#x;#O;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=ds,n,i,s,o,c){this.name=e,this.#v=s?sw(e):Jm(e),this.#s=t&Tme,this.nocase=s,this.roots=i,this.root=n||this,this.#x=o,this.#m=c.fullpath,this.#w=c.relative,this.#R=c.relativePosix,this.parent=c.parent,this.parent?this.#t=this.parent.#t:this.#t=FB(c.fs)}depth(){return this.#T!==void 0?this.#T:this.parent?this.#T=this.parent.depth()+1:this.#T=0}childrenCache(){return this.#x}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#x.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#x.set(this,t),this.#s&=~Xx,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?sw(e):Jm(e);for(let l of n)if(l.#v===i)return l;let s=this.parent?this.sep:"",o=this.#m?this.#m+s+e:void 0,c=this.newChild(e,ds,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#s|=Ks),n.push(c),c}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let n=t.relative();return n+(!n||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let e=this.name,t=this.parent;if(!t)return this.#R=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?"":"/")+e}fullpath(){if(this.#m!==void 0)return this.#m;let e=this.name,t=this.parent;if(!t)return this.#m=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#m=i}fullpathPosix(){if(this.#b!==void 0)return this.#b;if(this.sep==="/")return this.#b=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#b=`//?/${i}`:this.#b=i}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?"":"/")+this.name;return this.#b=n}isUnknown(){return(this.#s&fs)===ds}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.#s&fs)===MB}isDirectory(){return(this.#s&fs)===No}isCharacterDevice(){return(this.#s&fs)===NB}isBlockDevice(){return(this.#s&fs)===kB}isFIFO(){return(this.#s&fs)===LB}isSocket(){return(this.#s&fs)===jB}isSymbolicLink(){return(this.#s&bu)===bu}lstatCached(){return this.#s&RB?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let e=this.#s&fs;return!(e!==ds&&e!==bu||this.#s&iw||this.#s&Ks)}calledReaddir(){return!!(this.#s&Xx)}isENOENT(){return!!(this.#s&Ks)}isNamed(e){return this.nocase?this.#v===sw(e):this.#v===Jm(e)}async readlink(){let e=this.#O;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(t);if(n)return this.#O=n}catch(t){this.#F(t.code);return}}readlinkSync(){let e=this.#O;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(t);if(n)return this.#O=n}catch(t){this.#F(t.code);return}}#$(e){this.#s|=Xx;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#I()}}#I(){this.#s&Ks||(this.#s=(this.#s|Ks)&Ym,this.#q())}#q(){let e=this.children();e.provisional=0;for(let t of e)t.#I()}#N(){this.#s|=ow,this.#L()}#L(){if(this.#s&Qm)return;let e=this.#s;(e&fs)===No&&(e&=Ym),this.#s=e|Qm,this.#q()}#U(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#I():this.children().provisional=0}#P(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#I()}#F(e=""){let t=this.#s;t|=iw,e==="ENOENT"&&(t|=Ks),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Ym),this.#s=t,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#B(e,t){return this.#G(e,t)||this.#k(e,t)}#k(e,t){let n=Qx(e),i=this.newChild(e.name,n,{parent:this}),s=i.#s&fs;return s!==No&&s!==bu&&s!==ds&&(i.#s|=Qm),t.unshift(i),t.provisional++,i}#G(e,t){for(let n=t.provisional;n<t.length;n++){let i=t[n];if((this.nocase?sw(e.name):Jm(e.name))===i.#v)return this.#Y(e,i,n,t)}}#Y(e,t,n,i){let s=t.name;return t.#s=t.#s&Ym|Qx(e),s!==e.name&&(t.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#s&Ks)===0)try{return this.#W(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#P(e.code)}}lstatSync(){if((this.#s&Ks)===0)try{return this.#W(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#P(e.code)}}#W(e){let{atime:t,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:p,mode:h,mtime:g,mtimeMs:m,nlink:b,rdev:_,size:w,uid:I}=e;this.#_=t,this.#d=n,this.#y=i,this.#E=s,this.#u=o,this.#l=c,this.#A=l,this.#g=u,this.#r=f,this.#a=d,this.#c=p,this.#n=h,this.#S=g,this.#o=m,this.#e=b,this.#p=_,this.#f=w,this.#i=I;let E=Qx(e);this.#s=this.#s&Ym|E|RB,E!==ds&&E!==No&&E!==bu&&(this.#s|=Qm)}#M=[];#h=!1;#z(e){this.#h=!1;let t=this.#M.slice();this.#M.length=0,t.forEach(n=>n(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#M.push(e),this.#h)return;this.#h=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#U(s.code),n.provisional=0;else{for(let c of o)this.#B(c,n);this.#$(n)}this.#z(n.slice(0,n.provisional))})}#V;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.#V)await this.#V;else{let n=a(()=>{},"resolve");this.#V=new Promise(i=>n=i);try{for(let i of await this.#t.promises.readdir(t,{withFileTypes:!0}))this.#B(i,e);this.#$(e)}catch(i){this.#U(i.code),e.provisional=0}this.#V=void 0,n()}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 n of this.#t.readdirSync(t,{withFileTypes:!0}))this.#B(n,e);this.#$(e)}catch(n){this.#U(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#s&CB)return!1;let e=fs&this.#s;return e===ds||e===No||e===bu}shouldWalk(e,t){return(this.#s&No)===No&&!(this.#s&CB)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#C)return this.#C;if(!((ow|iw|Ks)&this.#s))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#C)return this.#C;if(!((ow|iw|Ks)&this.#s))try{let e=this.#t.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch{this.#N()}}[$B](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],i=this;for(;i&&i.parent;)t.add(i),i.#w=n.join(this.sep),i.#R=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#w=void 0,i.#R=void 0,i=i.parent}},cw=class r extends Kn{static{a(this,"PathWin32")}sep="\\";splitSep=vme;constructor(e,t=ds,n,i,s,o,c){super(e,t,n,i,s,o,c)}newChild(e,t=ds,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return qd.win32.parse(e).root}getRoot(e){if(e=Eme(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new Wd(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(DB,"$1\\"),e===t}},lw=class r extends Kn{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=ds,n,i,s,o,c){super(e,t,n,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=ds,n={}){return new r(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}},uw=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#n;nocase;#e;constructor(e=process.cwd(),t,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=Xm}={}){this.#e=FB(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,PB.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#t=new aw,this.#r=new aw,this.#n=new Jx(s);let l=c.substring(this.rootPath.length).split(n);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.#e),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,d=t.sep,p=this.rootPath,h=!1;for(let g of l){let m=f--;u=u.child(g,{relative:new Array(m).fill("..").join(d),relativePosix:new Array(m).fill("..").join("/"),fullpath:p+=(h?"":d)+g}),h=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#t.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpath();return this.#t.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let n=this.#r.get(t);if(n!==void 0)return n;let i=this.cwd.resolve(t).fullpathPosix();return this.#r.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 Kn||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let i=await e.readdir();return n?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 Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?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 Kn||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?e:e.fullpath());let l=new Set,u=a((d,p)=>{l.add(d),d.readdirCB((h,g)=>{if(h)return p(h);let m=g.length;if(!m)return p();let b=a(()=>{--m===0&&p()},"next");for(let _ of g)(!s||s(_))&&c.push(n?_:_.fullpath()),i&&_.isSymbolicLink()?_.realpath().then(w=>w?.isUnknown()?w.lstat():w).then(w=>w?.shouldWalk(l,o)?u(w,b):b()):_.shouldWalk(l,o)?u(_,b):b()},!0)},"walk"),f=e;return new Promise((d,p)=>{u(f,h=>{if(h)return p(h);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(n?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(n?d:d.fullpath());let p=d;if(d.isSymbolicLink()){if(!(i&&(p=d.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(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 Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t;(!s||s(e))&&(yield n?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 n?f:f.fullpath());let d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Hc({objectMode:!0});(!s||s(e))&&c.write(n?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=a((b,_,w=!1)=>{if(b)return c.emit("error",b);if(i&&!w){let I=[];for(let E of _)E.isSymbolicLink()&&I.push(E.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(I.length){Promise.all(I).then(()=>g(null,_,!0));return}}for(let I of _)I&&(!s||s(I))&&(c.write(n?I:I.fullpath())||(p=!0));f--;for(let I of _){let E=I.realpathCached()||I;E.shouldWalk(l,o)&&u.push(E)}p&&!c.flowing?c.once("drain",d):m||d()},"onReaddir"),m=!0;h.readdirCB(g,!0),m=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Kn||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Hc({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(n?e:e.fullpath());let u=[e],f=0,d=a(()=>{let p=!1;for(;!p;){let h=u.shift();if(!h){f===0&&c.end();return}f++,l.add(h);let g=h.readdirSync();for(let m of g)(!s||s(m))&&(c.write(n?m:m.fullpath())||(p=!0));f--;for(let m of g){let b=m;if(m.isSymbolicLink()){if(!(i&&(b=m.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,o)&&u.push(b)}}p&&!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[$B](t)}},Wd=class extends uw{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,qd.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return qd.win32.parse(e).root.toUpperCase()}newRoot(e){return new cw(this.rootPath,No,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},zd=class extends uw{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,qd.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new lw(this.rootPath,No,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Zm=class extends zd{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}},Q3e=process.platform==="win32"?cw:lw,UB=process.platform==="win32"?Wd:process.platform==="darwin"?Zm:zd});var Ame,Ime,Hd,Zx=Ve(()=>{qc();Ame=a(r=>r.length>=1,"isPatternList"),Ime=a(r=>r.length>=1,"isGlobList"),Hd=class r{static{a(this,"Pattern")}#t;#r;#n;length;#e;#i;#a;#p;#u;#c;#f=!0;constructor(e,t,n,i){if(!Ame(e))throw new TypeError("empty pattern list");if(!Ime(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,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#r=t,this.#n=n,this.#e=i,this.#n===0){if(this.isUNC()){let[s,o,c,l,...u]=this.#t,[f,d,p,h,...g]=this.#r;u[0]===""&&(u.shift(),g.shift());let m=[s,o,c,l,""].join("/"),b=[f,d,p,h,""].join("/");this.#t=[m,...u],this.#r=[b,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#t,[c,...l]=this.#r;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#t=[u,...o],this.#r=[f,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===vr}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#i!==void 0?this.#i:this.hasMore()?(this.#i=new r(this.#t,this.#r,this.#n+1,this.#e),this.#i.#c=this.#c,this.#i.#u=this.#u,this.#i.#p=this.#p,this.#i):this.#i=null}isUNC(){let e=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#e==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#p!==void 0?this.#p:this.#p=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}}});var Rme,Kd,eO=Ve(()=>{qc();Zx();Rme=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Kd=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:i,noglobstar:s,platform:o=Rme}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Yi(e,this.mmopts);for(let n=0;n<t.set.length;n++){let i=t.set[n],s=t.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new Hd(i,s,0,this.platform),c=new Yi(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.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(),n=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}}});var tO,rO,nO,eg,VB=Ve(()=>{qc();tO=class r{static{a(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new r(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),i=this.store.get(n);i?i.add(t.globString()):this.store.set(n,new Set([t.globString()]))}},rO=class{static{a(this,"MatchRecord")}store=new Map;add(e,t,n){let i=(t?2:0)|(n?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)])}},nO=class{static{a(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===t.globString())||n.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())}},eg=class r{static{a(this,"Processor")}hasWalkedCache;matches=new rO;subwalks=new nO;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new tO}processPatterns(e,t){this.patterns=t;let n=t.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);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===vr){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),p=u?.rest();if(!u||(d===""||d===".")&&!p)this.matches.add(i,c,d===""||d===".");else if(d===".."){let h=i.parent||i;p?this.hasWalkedCache.hasWalked(h,p)||this.subwalks.add(h,p):this.matches.add(h,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),i=this.child();for(let s of t)for(let o of n){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===vr?i.testGlobstar(s,o,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,n,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()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,t,n,i){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,t,n,i){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}}});var Cme,fw,tg,rg,GB=Ve(()=>{Yx();eO();VB();Cme=a((r,e)=>typeof r=="string"?new Kd([r],e):Array.isArray(r)?new Kd(r,e):r,"makeIgnore"),fw=class{static{a(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=Cme(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#i(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#t.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#t.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.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.#e(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#e(e))return;if(!this.includeChildMatches&&this.#r?.add){let s=`${e.relativePosix()}/**`;this.#r.add(s)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,t,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,t)}matchSync(e,t,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new eg(this.opts),n)}walkCB2(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,n,o):c.readdirCB((u,f)=>this.walkCB3(c,f,n,o),!0)}o()}walkCB3(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of n.subwalks.entries())s++,this.walkCB2(c,l,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new eg(this.opts),n)}walkCB2Sync(e,t,n,i){if(this.#i(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,i));return}n.processPatterns(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,n,o)}o()}walkCB3Sync(e,t,n,i){n=n.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let[c,l]of n.subwalks.entries())s++,this.walkCB2Sync(c,l,n.child(),o);o()}},tg=class extends fw{static{a(this,"GlobWalker")}matches=new Set;constructor(e,t,n){super(e,t,n)}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}},rg=class extends fw{static{a(this,"GlobStream")}results;constructor(e,t,n){super(e,t,n),this.results=new Hc({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 qB,xme,Ys,iO=Ve(()=>{qc();qB=require("node:url");BB();Zx();GB();xme=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ys=class{static{a(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,qB.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||xme,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"?Wd:t.platform==="darwin"?Zm:t.platform?zd:UB;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,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 Yi(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Hd(l,f,0,this.platform)})}async walk(){return[...await new tg(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 tg(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 rg(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 rg(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 sO,oO=Ve(()=>{qc();sO=a((r,e={})=>{Array.isArray(r)||(r=[r]);for(let t of r)if(new Yi(t,e).hasMagic())return!0;return!1},"hasMagic")});function dw(r,e={}){return new Ys(r,e).streamSync()}function zB(r,e={}){return new Ys(r,e).stream()}function HB(r,e={}){return new Ys(r,e).walkSync()}async function WB(r,e={}){return new Ys(r,e).walk()}function pw(r,e={}){return new Ys(r,e).iterateSync()}function KB(r,e={}){return new Ys(r,e).iterate()}var Ome,Pme,Fme,Dme,Lme,Yd,aO=Ve(()=>{qc();iO();oO();qc();iO();oO();eO();a(dw,"globStreamSync");a(zB,"globStream");a(HB,"globSync");a(WB,"glob_");a(pw,"globIterateSync");a(KB,"globIterate");Ome=dw,Pme=Object.assign(zB,{sync:dw}),Fme=pw,Dme=Object.assign(KB,{sync:pw}),Lme=Object.assign(HB,{stream:dw,iterate:pw}),Yd=Object.assign(WB,{glob:WB,globSync:HB,sync:Lme,globStream:zB,stream:Pme,globStreamSync:dw,streamSync:Ome,globIterate:KB,iterate:Dme,globIterateSync:pw,iterateSync:Fme,Glob:Ys,hasMagic:sO,escape:Bd,unescape:zs});Yd.glob=Yd});async function XB(r,e,t,n={}){let{dryRun:i=!1,excludeRelPath:s}=n,o=_u.default.join(r,"**/*.md"),c=await Yd(o,{nodir:!0,ignore:[_u.default.join(r,".obsidian/**"),_u.default.join(r,".trash/**"),_u.default.join(r,"**/.obsidian/**"),_u.default.join(r,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=_u.default.relative(r,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await cO.default.readFile(u,"utf-8")}catch{continue}let{updated:p,replacements:h}=Nme(d,e,t);h>0&&(l.filesModified+=1,l.replacements+=h,l.modifiedFiles.push(f),i||await cO.default.writeFile(u,p,"utf-8"))}return l}function Nme(r,e,t){let n=r.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=n[s],c=kme(o,e,t);i+=c.replacements,n[s]=c.updated}return{updated:n.join(""),replacements:i}}function kme(r,e,t){let n=r.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<n.length;s++){if(s%2===1)continue;let o=Mme(n[s],e,t);i+=o.replacements,n[s]=o.updated}return{updated:n.join(""),replacements:i}}function Mme(r,e,t){let n=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:r.replace(n,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}var cO,_u,QB=Ve(()=>{"use strict";cO=te(Ba()),_u=te(require("path"));aO();a(XB,"rewriteInboundWikilinks");a(Nme,"rewriteContent");a(kme,"rewriteProseSegment");a(Mme,"replaceWikilinks")});var Nr,fr,hw,jme,er,Mo=Ve(()=>{"use strict";Nr=te(Ba()),fr=te(require("path"));jm();hw=te(Me());QB();jme=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,er=class r{constructor(e){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null}static{a(this,"FileSystemVaultAdapter")}async read(e){let t=this.resolvePath(e.path);if(!await Nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return Nr.default.readFile(t,"utf-8")}async create(e,t){let n=this.resolvePath(e);if(await Nr.default.pathExists(n))throw new Error(`File already exists: ${e}`);return await Nr.default.ensureDir(fr.default.dirname(n)),await Nr.default.writeFile(n,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let n=this.resolvePath(e.path);if(!await Nr.default.pathExists(n))throw new Error(`File not found: ${e.path}`);await Nr.default.writeFile(n,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await Nr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await Nr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return Nr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let n=Nr.default.statSync(t);if(n.isFile())return this.createFileObject(e);if(n.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let n=fr.default.relative(this.rootPath,t);e.push(this.createFileObject(n))}}),e}getFrontmatter(e){try{let t=Nr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let n=await this.read(e),i=this.extractFrontmatter(n),s=r.FRONTMATTER_BLOCK.exec(n)?.[1];if(i===null&&s!==void 0&&s.trim()!=="")throw new Error(`updateFrontmatter: frontmatter of ${e.path} is not parseable \u2014 refusing to patch (would drop keys)`);let o=i??{},c=t({...o});hw.FrontmatterService.applyPatch(o,c);let l=this.replaceFrontmatter(n,o);await this.modify(e,l)}async rename(e,t){let n=this.resolvePath(e.path),i=this.resolvePath(t);if(!await Nr.default.pathExists(n))throw new Error(`File not found: ${e.path}`);await Nr.default.ensureDir(fr.default.dirname(i)),await Nr.default.move(n,i)}async createFolder(e){let t=this.resolvePath(e);await Nr.default.ensureDir(t)}getFirstLinkpathDest(e,t,n){let i=e.split("|")[0].trim();if(!i)return null;if(jme.test(i)){this.uuidIndex===null&&this.buildUuidIndex();let u=i.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let s=fr.default.dirname(this.resolvePath(t)),o;if(fr.default.isAbsolute(i)?o=this.resolvePath(i):o=fr.default.resolve(s,i),i.endsWith(".md")||(o+=".md"),Nr.default.existsSync(o)){let u=fr.default.relative(this.rootPath,o);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let c=i.toLowerCase(),l=this.basenameIndex.get(c);if(l)return this.createFileObject(l);if(n?.allowAliasFallback!==!1){let u=this.aliasIndex.get(c);if(u)return this.createFileObject(u)}return null}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=fr.default.relative(this.rootPath,e),n=fr.default.basename(e,".md").toLowerCase();this.basenameIndex.has(n)||this.basenameIndex.set(n,t);let i;try{i=Nr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let n=fr.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(n){let i=n[1].toLowerCase(),s=fr.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let n=await this.read(e),i=t(n);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,n){let i=fr.default.basename(t,".md");await XB(this.rootPath,n,i,{excludeRelPath:e})}resolvePath(e){if(fr.default.isAbsolute(e))return e;let t=this.rootPath.replace(/[/\\]+$/,""),n=fr.default.sep+e;return n===t||n.startsWith(t+fr.default.sep)?n:fr.default.join(this.rootPath,e)}createFileObject(e){let t=fr.default.basename(e),n=fr.default.basename(e,fr.default.extname(e)),i=fr.default.dirname(e);return{path:e,basename:n,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:fr.default.basename(e)}}static{this.FRONTMATTER_BLOCK=/^---\n([\s\S]*?)\n---/}extractFrontmatter(e){let t=e.match(r.FRONTMATTER_BLOCK);return t?(0,hw.parseYamlFrontmatterTolerant)(t[1]):null}replaceFrontmatter(e,t){let i=`---
|
|
426
426
|
${Ud(t,{lineWidth:-1,noRefs:!0,quoteStyle:"double"}).trim()}
|
|
427
427
|
---`,s=r.FRONTMATTER_BLOCK;return e.match(s)?e.replace(s,()=>i):`${i}
|
|
428
|
-
${e}`}shouldSkipDirectory(e){return e.startsWith(".")}walkDirectory(e,t){let n;try{n=Nr.default.readdirSync(e,{withFileTypes:!0})}catch(i){let s=i;if(s.code==="EPERM"||s.code==="EACCES")return;throw i}for(let i of n){let s=fr.default.join(e,i.name);if(i.isDirectory()){if(this.shouldSkipDirectory(i.name))continue;this.walkDirectory(s,t)}else i.isFile()&&t(s)}}}});function za(r){if(r instanceof Qi.IRI)return{type:"IRI",value:r.value};if(r instanceof Qi.Literal){let e={type:"Literal",value:r.value};return r.datatype&&(e.datatype=r.datatype.value),r.language&&(e.language=r.language),e}return r instanceof Qi.BlankNode?{type:"BlankNode",value:r.id}:{type:"IRI",value:String(r)}}function ng(r){switch(r.type){case"IRI":return new Qi.IRI(r.value);case"Literal":return r.datatype?new Qi.Literal(r.value,new Qi.IRI(r.datatype)):r.language?new Qi.Literal(r.value,void 0,r.language):new Qi.Literal(r.value);case"BlankNode":return new Qi.BlankNode(r.value);default:return new Qi.IRI(r.value)}}var Qi,lO=Ve(()=>{"use strict";Qi=te(Me());a(za,"serializeNode");a(ng,"deserializeNode")});function JB(r){let e=za(r.subject),t=za(r.predicate),n=za(r.object);return`${e.type}:${e.value}|${t.type}:${t.value}|${n.type}:${n.value}|${n.datatype??""}|${n.language??""}`}async function ig(r){let e=new jo.InMemoryTripleStore;await e.addAll(r);let n=await new jo.RDFSInferenceEngine().materialize(e),i=new jo.NonInheritablePropertyRegistry;await i.initialize(e);let s=new jo.PropertyCardinalityRegistry;await s.initialize(e);let o=new jo.PrototypeChainMaterializer(i,s);if(n+=await o.materialize(e),n<=0)return{inferred:[],inferredCount:0};let c=new Set;for(let f of r)c.add(JB(f));let l=await e.match(),u=[];for(let f of l)c.has(JB(f))||u.push(f);return{inferred:u,inferredCount:n}}var jo,uO=Ve(()=>{"use strict";jo=te(Me());lO();a(JB,"tripleKey");a(ig,"materializeInferredTriples")});var f6={};Vu(f6,{CACHE_FORMAT_VERSION:()=>mO,CacheManager:()=>Su,DELTA_REBUILD_RATIO:()=>gO,STALE_TMP_MAX_AGE_MS:()=>s6,deserializeNode:()=>ng,diffManifest:()=>mw,inferenceInputsChanged:()=>u6,isSafeRelativePath:()=>l6,serializeNode:()=>za});function fO(r){return r.added.length===0&&r.modified.length===0&&r.removed.length===0}function mw(r,e){let t=[],n=[],i=[],s=new Map;for(let o of r)s.set(o.path,{mtimeMs:o.mtimeMs,size:o.size});for(let[o,c]of e){let l=s.get(o);l===void 0?t.push(o):(l.mtimeMs!==c.mtimeMs||l.size!==c.size)&&n.push(o)}for(let o of s.keys())e.has(o)||i.push(o);return{added:t,modified:n,removed:i}}function dO(r){return typeof r.basename=="string"}function ZB(r){return Xd.test(mi.default.basename(r,mi.default.extname(r)))}function pO(r){if(r.tboxLabel)return!0;let e=(0,ln.vaultPathToIRI)(r.path);for(let t of r.triples)if(t.subject.type==="IRI"&&t.subject.value===e&&t.predicate.type==="IRI"&&t.predicate.value.endsWith(o6)&&(t.object.type==="IRI"||t.object.type==="Literal"&&Xd.test(t.object.value)))return!0;return!1}function Ume(r,e,t){for(let n of r.triples)if(n.object.type==="IRI"){if(e.has(n.object.value))return!0}else if(n.object.type==="Literal"&&t.size>0&&t.has(Bme(n.object.value)))return!0;return!1}function Bme(r){let e=r.trim();e.startsWith("[[")&&e.endsWith("]]")&&(e=e.slice(2,-2));let t=e.indexOf("|");return t>=0&&(e=e.slice(0,t)),e=e.trim().toLowerCase(),e.endsWith(".md")?e.slice(0,-3):e}function e6(r){let e=(0,ln.vaultPathToIRI)(r.path),t=new Set;for(let n of r.triples)n.subject.type==="IRI"&&n.subject.value===e&&n.predicate.type==="IRI"&&n.predicate.value.endsWith(bO)&&n.object.type==="Literal"&&t.add(n.object.value.trim().toLowerCase());return t}function Vme(r){let e=new Set;for(let t of c6(r))e.add(t.toLowerCase());return e}function c6(r){let e=r?.aliases,t=Array.isArray(e)?e:e==null?[]:[e],n=[];for(let i of t)typeof i=="string"&&i.trim()!==""&&n.push(i.trim());return n}function Gme(r){return c6(r).some(e=>Xd.test(e))}function qme(r){let e=(0,ln.vaultPathToIRI)(r.path);for(let t of r.triples)if(t.subject.type==="IRI"&&t.subject.value===e&&t.predicate.type==="IRI"&&t.predicate.value.endsWith(bO)&&(t.object.type==="IRI"||t.object.type==="Literal"&&Xd.test(t.object.value.trim())))return!0;return!1}function Wme(r,e){if(r.size!==e.size)return!1;for(let t of r)if(!e.has(t))return!1;return!0}function hO(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function yO(r,e){return r.newLabel?`TBox-form asset changed: ${e}`:r.hadLabel?`asset lost its TBox-form label: ${e}`:`TBox-form alias: ${e}`}function t6(r,e){let t=(0,ln.vaultPathToIRI)(r),n=[],i=[],s=[];for(let o of e){if(o.subject.type!=="IRI"||o.subject.value!==t||o.predicate.type!=="IRI")continue;let c=o.predicate.value;c.endsWith(o6)?o.object.type==="IRI"&&n.push(o.object.value):c.endsWith(bO)?o.object.type==="IRI"&&i.push(o.object.value):c.endsWith(a6)&&s.push(`${o.object.type}:${o.object.value}|${o.object.datatype??""}|${o.object.language??""}`)}return i.sort(),{label:n,tboxAliases:i,instanceClass:s}}function zme(r,e,t,n){let i=t6(r,e),s=t6(r,t);return hO(i.label,s.label)?hO(i.tboxAliases,s.tboxAliases)?hO(i.instanceClass,s.instanceClass)?null:`TBox-form asset class changed: ${r}`:`TBox-form alias: ${r}`:yO(n,r)}function Hme(r){if((0,ln.frontmatterDeclaresFileSpace)(r))return!0;let e=r.exo__Instance_class;return(Array.isArray(e)?e:[e]).some(n=>typeof n=="string"&&/\bexo__FileSpace\b/.test(n))}function l6(r){return r.length===0||mi.default.isAbsolute(r)||/^[a-zA-Z]:/.test(r)||/^[\\/]/.test(r)?!1:!r.split(/[\\/]/).some(e=>e==="..")}function r6(r){return r.predicate.type==="IRI"&&$me.some(e=>r.predicate.value.endsWith(e))}function n6(r){return!!r&&r.triples.some(e=>e.predicate.type==="IRI"&&e.predicate.value.endsWith(_O))}function u6(r,e,t){let n=new Map;for(let s of r.files)n.set(s.path,s);let i=new Set;for(let s of r.files)for(let o of s.triples)o.object.type==="IRI"&&o.predicate.type==="IRI"&&o.predicate.value.endsWith(_O)&&i.add(o.object.value);for(let s of t){let o=n.get(s),c=e.get(s);if(n6(o)||n6(c)||i.has((0,ln.vaultPathToIRI)(s)))return!0;let l=a(d=>`${d.subject.type}:${d.subject.value}|${d.predicate.value}|${d.object.type}:${d.object.value}`,"key"),u=(o?.triples??[]).filter(r6).map(l).sort(),f=(c?.triples??[]).filter(r6).map(l).sort();if(u.length!==f.length)return!0;for(let d=0;d<u.length;d++)if(u[d]!==f[d])return!0}return!1}var mi,i6,Wr,ln,mO,gO,s6,Xd,o6,bO,_O,a6,$me,Su,gw=Ve(()=>{"use strict";mi=te(require("path")),i6=te(require("crypto")),Wr=te(Ba()),ln=te(Me());Mo();lO();uO();mO=3,gO=.5,s6=600*1e3,Xd=/^[a-z][a-zA-Z0-9]*__\S+$/,o6="#Asset_label",bO="#Asset_aliases",_O="#Asset_prototype",a6="#Instance_class",$me=[a6,"#Class_superClass","#type",_O],Su=class r{constructor(e){this.cliVersion="1.0.0";this.loaded=null;this.loadedStamp=null;this.vaultPath=mi.default.resolve(e),this.cachePath=mi.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{a(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){let e=await this.computeManifestDiff();return e!==null&&fO(e)}async computeManifestDiff(){let e=await this.readCacheData();if(!e)return null;let t=this.computeFileManifest();return t?mw(e.files,t):null}async loadOrBuild(){let e=Date.now(),t=await this.readCacheData();if(!t)return this.rebuild(e,"cache absent, corrupt or legacy format",null);let n=this.computeFileManifest();if(!n)return this.rebuild(e,"vault could not be walked",t);let i=mw(t.files,n);if(fO(i))return{triples:this.materializeTriples(t),explicitCount:r.explicitCountOf(t),zeroTriplePaths:r.zeroTriplePathsOf(t),cacheHit:!0,durationMs:Date.now()-e,mode:"hit",reparsedFiles:0};let s=new er(this.vaultPath),o=await this.planDelta(t,n,i,s);if(o.rebuildReason)return this.rebuild(e,o.rebuildReason,t);let c=await this.applyDelta(t,n,i,o.reparse,s);return{triples:c.triples,explicitCount:r.explicitCountOf(c.data),zeroTriplePaths:r.zeroTriplePathsOf(c.data),cacheHit:!0,durationMs:Date.now()-e,mode:"delta",reparsedFiles:o.reparse.length,inferredRecomputed:c.inferredRecomputed}}static explicitCountOf(e){let t=0;for(let n of e.files)t+=n.triples.length;return t}static zeroTriplePathsOf(e){let t=[];for(let n of e.files)n.triples.length===0&&t.push(n.path);return t}async refreshAfterWrite(){let e=await this.loadedIsCurrent()?this.loaded:await this.readCacheData();if(!e)return{mode:"skipped",reparsedFiles:0,reason:"no cache to refresh"};let t=new er(this.vaultPath),n=this.computeFileManifest(t);if(!n)return{mode:"skipped",reparsedFiles:0,reason:"vault could not be walked"};let i=mw(e.files,n);if(fO(i))return{mode:"noop",reparsedFiles:0};let s=await this.planDelta(e,n,i,t);return s.rebuildReason?{mode:"skipped",reparsedFiles:0,reason:`rebuild needed (${s.rebuildReason}) \u2014 left to the next reader`}:(await this.applyDelta(e,n,i,s.reparse,t,{needTriples:!1}),{mode:"delta",reparsedFiles:s.reparse.length})}async rebuild(e,t,n){let i=await this.buildInternal({strict:!1,materializeInference:n?.metadata.inferenceEnabled===!0});return{triples:i.triples.concat(i.inferred),explicitCount:i.triples.length,zeroTriplePaths:r.zeroTriplePathsOf(i.data),cacheHit:!1,durationMs:Date.now()-e,mode:"rebuild",reparsedFiles:i.data.files.length,rebuildReason:t}}materializeTriples(e){let t=[];for(let n of e.files)for(let i of n.triples)t.push(this.deserializeTriple(i));for(let n of e.inferred)t.push(this.deserializeTriple(n));return t}async readCacheData(){try{if(!await Wr.default.pathExists(this.cachePath))return null;let e=await this.statCache(),t=await Wr.default.readJson(this.cachePath);if(!t.metadata||t.metadata.formatVersion!==mO||typeof t.metadata.tripleCount!="number"||!Array.isArray(t.files)||!Array.isArray(t.inferred))return null;for(let i of t.files)if(typeof i?.path!="string"||!l6(i.path)||typeof i.mtimeMs!="number"||typeof i.size!="number"||!Array.isArray(i.triples))return null;let n={metadata:{...t.metadata,fileSpacePrefixes:Array.isArray(t.metadata.fileSpacePrefixes)?t.metadata.fileSpacePrefixes:[],fileSpaceDeclarations:Array.isArray(t.metadata.fileSpaceDeclarations)?t.metadata.fileSpaceDeclarations:[],inferenceEnabled:typeof t.metadata.inferenceEnabled=="boolean"?t.metadata.inferenceEnabled:t.inferred.length>0},files:t.files,inferred:t.inferred};return this.loaded=n,this.loadedStamp=e,n}catch{return null}}async statCache(){try{let e=await Wr.default.stat(this.cachePath);return{mtimeMs:e.mtimeMs,size:e.size}}catch{return null}}async loadedIsCurrent(){if(!this.loaded||!this.loadedStamp)return!1;let e=await this.statCache();return e!==null&&e.mtimeMs===this.loadedStamp.mtimeMs&&e.size===this.loadedStamp.size}computeFileManifest(e){try{let t=e??new er(this.vaultPath),n=new Map;for(let i of t.getAllFiles())try{let s=Wr.default.statSync(mi.default.join(this.vaultPath,i.path));n.set(i.path,{mtimeMs:s.mtimeMs,size:s.size})}catch{}return n}catch{return null}}async planDelta(e,t,n,i){let s=n.added.length+n.modified.length+n.removed.length,o=Math.max(e.files.length,t.size,1);if(s>o*gO)return{reparse:[],rebuildReason:`${s} of ${o} files changed (> ${gO*100}%)`};let c=new Map;for(let m of e.files)c.set(m.path,m);let l=new Set(e.metadata.fileSpaceDeclarations),u=new Set,f=new Set;for(let m of n.removed){if(l.has(m))return{reparse:[],rebuildReason:`FileSpace declaration removed: ${m}`};if(ZB(m))return{reparse:[],rebuildReason:`TBox-form file removed: ${m}`};let b=c.get(m);if(b&&pO(b))return{reparse:[],rebuildReason:`TBox-form asset removed: ${m}`};u.add((0,ln.vaultPathToIRI)(m))}let d=new Map;for(let m of[...n.added,...n.modified]){if(l.has(m))return{reparse:[],rebuildReason:`FileSpace declaration changed: ${m}`};if(ZB(m))return{reparse:[],rebuildReason:`TBox-form file changed: ${m}`};let b=i.getAbstractFileByPath(m),_=b&&dO(b)?b:null,w=_?i.getFrontmatter(_):null;if(w&&Hme(w))return{reparse:[],rebuildReason:`FileSpace declaration changed: ${m}`};d.set(m,{file:_,frontmatter:w})}let p=null;for(let[m,{file:b,frontmatter:_}]of d){let w=c.get(m),I=_?.exo__Asset_label,E={newLabel:typeof I=="string"&&Xd.test(I),hadLabel:w!==void 0&&pO(w),newAlias:Gme(_),hadAlias:w!==void 0&&qme(w)},S;if(E.newLabel||E.hadLabel||E.newAlias||E.hadAlias){if(!w||w.triples.length===0||!b)return{reparse:[],rebuildReason:yO(E,m)};p??=new ln.NoteToRDFConverter(i);let O;try{O=(await p.convertNote(b)).map(this.serializeTriple)}catch{return{reparse:[],rebuildReason:yO(E,m)}}let x=zme(m,w.triples,O,E);if(x)return{reparse:[],rebuildReason:x};S=e6({path:m,mtimeMs:0,size:0,triples:O})}else S=Vme(_);let R=w?e6(w):new Set;if(w&&!Wme(R,S)){let O=!1;for(let x of R)S.has(x)||(f.add(x),O=!0);for(let x of S)R.has(x)||f.add(x);O&&u.add((0,ln.vaultPathToIRI)(m))}if(!w)for(let O of S)f.add(O)}for(let m of n.added){let b=mi.default.basename(m);u.add((0,ln.vaultPathToIRI)(b)),f.add(mi.default.basename(m,mi.default.extname(m)).toLowerCase())}let h=new Set([...n.added,...n.modified]),g=new Set(n.removed);if(u.size>0||f.size>0)for(let m of e.files)h.has(m.path)||g.has(m.path)||Ume(m,u,f)&&h.add(m.path);return{reparse:[...h]}}async applyDelta(e,t,n,i,s,o={needTriples:!0}){let c=[];for(let R of i){let O=s.getAbstractFileByPath(R);O&&dO(O)&&c.push(O)}let l=new Map;await new ln.NoteToRDFConverter(s).convertVaultWithValidation({strict:!1,files:c,fileSpacePrefixes:e.metadata.fileSpacePrefixes,onFileTriples:a((R,O)=>{l.set(R.path,O)},"onFileTriples")});let f=new Set(i),d=new Set(n.removed),p=a(R=>this.makeEntry(R,t,l.get(R)??[],s),"makeEntry"),h=[];for(let R of e.files)d.has(R.path)||h.push(f.has(R.path)?p(R.path):R);let g=new Set(h.map(R=>R.path));for(let R of t.keys())g.has(R)||h.push(p(R));let m=null,b=a(()=>{if(m===null){m=[];for(let R of h)for(let O of R.triples)m.push(this.deserializeTriple(O))}return m},"explicitTriples"),_=[],w=[],I=!1;if(e.metadata.inferenceEnabled){let R=new Map;for(let O of h)R.set(O.path,O);u6(e,R,[...f,...d])?(w=(await ig(b())).inferred,_=w.map(this.serializeTriple),I=!0):(_=e.inferred,o.needTriples&&(w=e.inferred.map(this.deserializeTriple)))}let E=this.assembleCacheData(h,_,{fileSpacePrefixes:e.metadata.fileSpacePrefixes,fileSpaceDeclarations:e.metadata.fileSpaceDeclarations,inferenceEnabled:e.metadata.inferenceEnabled});await this.writeCacheData(E);let S=o.needTriples?b().concat(w):[];return{data:E,triples:S,inferredRecomputed:I}}makeEntry(e,t,n,i){let s=t.get(e),o={path:e,mtimeMs:s?.mtimeMs??0,size:s?.size??0,triples:n.map(this.serializeTriple)},c=pO(o);if(!c&&n.length===0){let l=i.getAbstractFileByPath(e),f=(l&&dO(l)?i.getFrontmatter(l):null)?.exo__Asset_label;c=typeof f=="string"&&Xd.test(f)}return c&&(o.tboxLabel=!0),o}async buildCache(){let e=await this.buildCacheWithValidation({strict:!1});return{tripleCount:e.tripleCount,durationMs:e.durationMs}}async buildCacheWithValidation(e={}){return(await this.buildInternal(e)).result}async buildInternal(e){let t=Date.now(),n=new er(this.vaultPath),i=n.getAllFiles(),s=new Map;for(let h of i)try{let g=Wr.default.statSync(mi.default.join(this.vaultPath,h.path));s.set(h.path,{mtimeMs:g.mtimeMs,size:g.size})}catch{}let o=new Map,l=await new ln.NoteToRDFConverter(n).convertVaultWithValidation({strict:e.strict??!1,files:i,onFileTriples:a((h,g)=>{o.set(h.path,g)},"onFileTriples")}),u=[];for(let h of i)s.has(h.path)&&u.push(this.makeEntry(h.path,s,o.get(h.path)??[],n));let f=[];for(let h of i){if(!s.has(h.path))continue;let g=o.get(h.path);g&&f.push(...g)}let d=[];e.materializeInference&&(d=(await ig(f)).inferred);let p=this.assembleCacheData(u,d.map(this.serializeTriple),{fileSpacePrefixes:l.fileSpaces?.prefixes??[],fileSpaceDeclarations:l.fileSpaces?.declarationPaths??[],inferenceEnabled:e.materializeInference===!0});return await this.writeCacheData(p),{result:{tripleCount:l.triples.length,durationMs:Date.now()-t,skippedFiles:l.skippedFiles,summary:l.summary},data:p,triples:f,inferred:d}}async validateVault(){let e=new er(this.vaultPath);return new ln.NoteToRDFConverter(e).validateVault()}async invalidate(){await Wr.default.pathExists(this.cachePath)&&await Wr.default.remove(this.cachePath),await this.removeStaleTempFiles()}async removeStaleTempFiles(){let e=mi.default.dirname(this.cachePath),t=`${mi.default.basename(this.cachePath)}.`,n;try{n=await Wr.default.readdir(e)}catch{return}let i=Date.now()-s6;for(let s of n){if(!s.startsWith(t)||!s.endsWith(".tmp"))continue;let o=mi.default.join(e,s);try{(await Wr.default.stat(o)).mtimeMs<i&&await Wr.default.remove(o)}catch{}}}async getCacheStats(){try{if(!await Wr.default.pathExists(this.cachePath))return null;let e=await this.readCacheData();if(!e){let i=await Wr.default.stat(this.cachePath);return{tripleCount:0,createdAt:new Date(i.mtimeMs),isValid:!1,sizeBytes:i.size}}let t=await Wr.default.stat(this.cachePath),n=await this.isCacheValid();return{tripleCount:e.metadata.tripleCount,createdAt:new Date(e.metadata.timestamp),isValid:n,sizeBytes:t.size}}catch{return null}}async saveInferredTriples(e){let t=await this.readCacheData();if(!t)throw new Error(`Cannot save inferred triples: no valid cache at ${this.cachePath} (build the cache first)`);let n=this.assembleCacheData(t.files,e.map(this.serializeTriple),{fileSpacePrefixes:t.metadata.fileSpacePrefixes,fileSpaceDeclarations:t.metadata.fileSpaceDeclarations,inferenceEnabled:!0});await this.writeCacheData(n)}assembleCacheData(e,t,n){let i=0;for(let s of e)i+=s.triples.length;return{metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:i+t.length,formatVersion:mO,fileCount:e.length,inferredCount:t.length,fileSpacePrefixes:n.fileSpacePrefixes,fileSpaceDeclarations:n.fileSpaceDeclarations,inferenceEnabled:n.inferenceEnabled},files:e,inferred:t}}async writeCacheData(e){await Wr.default.ensureDir(mi.default.dirname(this.cachePath)),await this.removeStaleTempFiles();let t=`${this.cachePath}.${process.pid}.${i6.default.randomBytes(6).toString("hex")}.tmp`;try{await Wr.default.writeJson(t,e,{spaces:0});let n=await Wr.default.stat(t);await Wr.default.rename(t,this.cachePath),this.loaded=e,this.loadedStamp={mtimeMs:n.mtimeMs,size:n.size}}catch(n){throw await Wr.default.remove(t).catch(()=>{}),n}}serializeTriple(e){return{subject:za(e.subject),predicate:za(e.predicate),object:za(e.object)}}deserializeTriple(e){return new ln.Triple(ng(e.subject),ng(e.predicate),ng(e.object))}};a(fO,"isEmptyDiff");a(mw,"diffManifest");a(dO,"isFile");a(ZB,"isTBoxBasename");a(pO,"entryHasTBoxLabel");a(Ume,"entryRefersTo");a(Bme,"linkpathOf");a(e6,"entryAliases");a(Vme,"frontmatterAliases");a(c6,"rawFrontmatterAliases");a(Gme,"frontmatterHasTBoxFormAlias");a(qme,"entryHasTBoxFormAlias");a(Wme,"sameSet");a(hO,"sameList");a(yO,"tboxRebuildReason");a(t6,"tboxProjection");a(zme,"tboxProjectionChanged");a(Hme,"frontmatterDeclaresFileSpaceAnyForm");a(l6,"isSafeRelativePath");a(r6,"isInferenceRelevant");a(n6,"hasPrototype");a(u6,"inferenceInputsChanged")});var p6={};Vu(p6,{cacheLoadNotice:()=>wu,loadVaultTriples:()=>gi,writeThroughCache:()=>wO,writeThroughNotice:()=>EO});async function gi(r,e){if(e.useCache){let l=e.cacheManager??new Su(r),u=SO.default.join(SO.default.resolve(r),".exocortex","cache","triples.json");if(l.getCachePath()!==u)throw new Error(`loadVaultTriples: the given CacheManager belongs to ${l.getCachePath()}, not to vault ${r}`);let f=await l.loadOrBuild();return{triples:f.triples,cacheHit:f.cacheHit,mode:f.mode,reparsedFiles:f.reparsedFiles,cacheManager:l,explicitCount:f.explicitCount,zeroTriplePaths:f.zeroTriplePaths}}let t=e.vaultAdapter??new er(r),n=new d6.NoteToRDFConverter(t),i=t.getAllFiles(),s=new Map,o=await n.convertVault({onFileTriples:a((l,u)=>{s.set(l.path,u.length)},"onFileTriples")}),c=i.filter(l=>(s.get(l.path)??0)===0).map(l=>l.path);return{triples:o,cacheHit:!1,mode:"full-parse",explicitCount:o.length,zeroTriplePaths:c}}function wu(r){switch(r.mode){case"hit":return"\u26A1 triple cache: hit";case"delta":return`\u267B\uFE0F triple cache: delta (${r.reparsedFiles??0} file(s) re-parsed)`;case"rebuild":{let e=r.triples.length-r.explicitCount,t=e>0?` + inferred layer (${e})`:"";return`\u{1F528} triple cache: rebuild (${r.reparsedFiles??0} file(s) parsed, cache written${t})`}default:return"triple cache: not used (full parse)"}}async function wO(r){try{return await r.refreshAfterWrite()}catch(e){return{mode:"failed",reparsedFiles:0,reason:e instanceof Error?e.message:String(e)}}}function EO(r){switch(r.mode){case"delta":return`\u{1F4BE} triple cache: write-through persisted (${r.reparsedFiles} file(s) re-parsed)`;case"noop":return"\u{1F4BE} triple cache: write-through \u2014 nothing changed";case"skipped":return`\u{1F4BE} triple cache: write-through skipped (${r.reason??"unknown"})`;default:return`\u26A0 triple cache: write-through failed (${r.reason}) \u2014 command result unaffected; the next --use-cache run refreshes the cache itself`}}var SO,d6,Ha=Ve(()=>{"use strict";SO=te(require("path")),d6=te(Me());Mo();gw();a(gi,"loadVaultTriples");a(wu,"cacheLoadNotice");a(wO,"writeThroughCache");a(EO,"writeThroughNotice")});function tp(r){let e=new Set,t=/PREFIX\s+(\w+)\s*:/gi,n;for(;(n=t.exec(r))!==null;)e.add(n[1].toLowerCase());let i=q6.SPARQL_PREFIXES.split(`
|
|
428
|
+
${e}`}shouldSkipDirectory(e){return e.startsWith(".")}walkDirectory(e,t){let n;try{n=Nr.default.readdirSync(e,{withFileTypes:!0})}catch(i){let s=i;if(s.code==="EPERM"||s.code==="EACCES")return;throw i}n.sort((i,s)=>i.name<s.name?-1:i.name>s.name?1:0);for(let i of n){let s=fr.default.join(e,i.name);if(i.isDirectory()){if(this.shouldSkipDirectory(i.name))continue;this.walkDirectory(s,t)}else i.isFile()&&t(s)}}}});function za(r){if(r instanceof Qi.IRI)return{type:"IRI",value:r.value};if(r instanceof Qi.Literal){let e={type:"Literal",value:r.value};return r.datatype&&(e.datatype=r.datatype.value),r.language&&(e.language=r.language),e}return r instanceof Qi.BlankNode?{type:"BlankNode",value:r.id}:{type:"IRI",value:String(r)}}function ng(r){switch(r.type){case"IRI":return new Qi.IRI(r.value);case"Literal":return r.datatype?new Qi.Literal(r.value,new Qi.IRI(r.datatype)):r.language?new Qi.Literal(r.value,void 0,r.language):new Qi.Literal(r.value);case"BlankNode":return new Qi.BlankNode(r.value);default:return new Qi.IRI(r.value)}}var Qi,lO=Ve(()=>{"use strict";Qi=te(Me());a(za,"serializeNode");a(ng,"deserializeNode")});function JB(r){let e=za(r.subject),t=za(r.predicate),n=za(r.object);return`${e.type}:${e.value}|${t.type}:${t.value}|${n.type}:${n.value}|${n.datatype??""}|${n.language??""}`}async function ig(r){let e=new jo.InMemoryTripleStore;await e.addAll(r);let n=await new jo.RDFSInferenceEngine().materialize(e),i=new jo.NonInheritablePropertyRegistry;await i.initialize(e);let s=new jo.PropertyCardinalityRegistry;await s.initialize(e);let o=new jo.PrototypeChainMaterializer(i,s);if(n+=await o.materialize(e),n<=0)return{inferred:[],inferredCount:0};let c=new Set;for(let f of r)c.add(JB(f));let l=await e.match(),u=[];for(let f of l)c.has(JB(f))||u.push(f);return{inferred:u,inferredCount:n}}var jo,uO=Ve(()=>{"use strict";jo=te(Me());lO();a(JB,"tripleKey");a(ig,"materializeInferredTriples")});var f6={};Vu(f6,{CACHE_FORMAT_VERSION:()=>mO,CacheManager:()=>Su,DELTA_REBUILD_RATIO:()=>gO,STALE_TMP_MAX_AGE_MS:()=>s6,deserializeNode:()=>ng,diffManifest:()=>mw,inferenceInputsChanged:()=>u6,isSafeRelativePath:()=>l6,serializeNode:()=>za});function fO(r){return r.added.length===0&&r.modified.length===0&&r.removed.length===0}function mw(r,e){let t=[],n=[],i=[],s=new Map;for(let o of r)s.set(o.path,{mtimeMs:o.mtimeMs,size:o.size});for(let[o,c]of e){let l=s.get(o);l===void 0?t.push(o):(l.mtimeMs!==c.mtimeMs||l.size!==c.size)&&n.push(o)}for(let o of s.keys())e.has(o)||i.push(o);return{added:t,modified:n,removed:i}}function dO(r){return typeof r.basename=="string"}function ZB(r){return Xd.test(mi.default.basename(r,mi.default.extname(r)))}function pO(r){if(r.tboxLabel)return!0;let e=(0,ln.vaultPathToIRI)(r.path);for(let t of r.triples)if(t.subject.type==="IRI"&&t.subject.value===e&&t.predicate.type==="IRI"&&t.predicate.value.endsWith(o6)&&(t.object.type==="IRI"||t.object.type==="Literal"&&Xd.test(t.object.value)))return!0;return!1}function Ume(r,e,t){for(let n of r.triples)if(n.object.type==="IRI"){if(e.has(n.object.value))return!0}else if(n.object.type==="Literal"&&t.size>0&&t.has(Bme(n.object.value)))return!0;return!1}function Bme(r){let e=r.trim();e.startsWith("[[")&&e.endsWith("]]")&&(e=e.slice(2,-2));let t=e.indexOf("|");return t>=0&&(e=e.slice(0,t)),e=e.trim().toLowerCase(),e.endsWith(".md")?e.slice(0,-3):e}function e6(r){let e=(0,ln.vaultPathToIRI)(r.path),t=new Set;for(let n of r.triples)n.subject.type==="IRI"&&n.subject.value===e&&n.predicate.type==="IRI"&&n.predicate.value.endsWith(bO)&&n.object.type==="Literal"&&t.add(n.object.value.trim().toLowerCase());return t}function Vme(r){let e=new Set;for(let t of c6(r))e.add(t.toLowerCase());return e}function c6(r){let e=r?.aliases,t=Array.isArray(e)?e:e==null?[]:[e],n=[];for(let i of t)typeof i=="string"&&i.trim()!==""&&n.push(i.trim());return n}function Gme(r){return c6(r).some(e=>Xd.test(e))}function qme(r){let e=(0,ln.vaultPathToIRI)(r.path);for(let t of r.triples)if(t.subject.type==="IRI"&&t.subject.value===e&&t.predicate.type==="IRI"&&t.predicate.value.endsWith(bO)&&(t.object.type==="IRI"||t.object.type==="Literal"&&Xd.test(t.object.value.trim())))return!0;return!1}function Wme(r,e){if(r.size!==e.size)return!1;for(let t of r)if(!e.has(t))return!1;return!0}function hO(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function yO(r,e){return r.newLabel?`TBox-form asset changed: ${e}`:r.hadLabel?`asset lost its TBox-form label: ${e}`:`TBox-form alias: ${e}`}function t6(r,e){let t=(0,ln.vaultPathToIRI)(r),n=[],i=[],s=[];for(let o of e){if(o.subject.type!=="IRI"||o.subject.value!==t||o.predicate.type!=="IRI")continue;let c=o.predicate.value;c.endsWith(o6)?o.object.type==="IRI"&&n.push(o.object.value):c.endsWith(bO)?o.object.type==="IRI"&&i.push(o.object.value):c.endsWith(a6)&&s.push(`${o.object.type}:${o.object.value}|${o.object.datatype??""}|${o.object.language??""}`)}return i.sort(),{label:n,tboxAliases:i,instanceClass:s}}function zme(r,e,t,n){let i=t6(r,e),s=t6(r,t);return hO(i.label,s.label)?hO(i.tboxAliases,s.tboxAliases)?hO(i.instanceClass,s.instanceClass)?null:`TBox-form asset class changed: ${r}`:`TBox-form alias: ${r}`:yO(n,r)}function Hme(r){if((0,ln.frontmatterDeclaresFileSpace)(r))return!0;let e=r.exo__Instance_class;return(Array.isArray(e)?e:[e]).some(n=>typeof n=="string"&&/\bexo__FileSpace\b/.test(n))}function l6(r){return r.length===0||mi.default.isAbsolute(r)||/^[a-zA-Z]:/.test(r)||/^[\\/]/.test(r)?!1:!r.split(/[\\/]/).some(e=>e==="..")}function r6(r){return r.predicate.type==="IRI"&&$me.some(e=>r.predicate.value.endsWith(e))}function n6(r){return!!r&&r.triples.some(e=>e.predicate.type==="IRI"&&e.predicate.value.endsWith(_O))}function u6(r,e,t){let n=new Map;for(let s of r.files)n.set(s.path,s);let i=new Set;for(let s of r.files)for(let o of s.triples)o.object.type==="IRI"&&o.predicate.type==="IRI"&&o.predicate.value.endsWith(_O)&&i.add(o.object.value);for(let s of t){let o=n.get(s),c=e.get(s);if(n6(o)||n6(c)||i.has((0,ln.vaultPathToIRI)(s)))return!0;let l=a(d=>`${d.subject.type}:${d.subject.value}|${d.predicate.value}|${d.object.type}:${d.object.value}`,"key"),u=(o?.triples??[]).filter(r6).map(l).sort(),f=(c?.triples??[]).filter(r6).map(l).sort();if(u.length!==f.length)return!0;for(let d=0;d<u.length;d++)if(u[d]!==f[d])return!0}return!1}var mi,i6,Wr,ln,mO,gO,s6,Xd,o6,bO,_O,a6,$me,Su,gw=Ve(()=>{"use strict";mi=te(require("path")),i6=te(require("crypto")),Wr=te(Ba()),ln=te(Me());Mo();lO();uO();mO=3,gO=.5,s6=600*1e3,Xd=/^[a-z][a-zA-Z0-9]*__\S+$/,o6="#Asset_label",bO="#Asset_aliases",_O="#Asset_prototype",a6="#Instance_class",$me=[a6,"#Class_superClass","#type",_O],Su=class r{constructor(e){this.cliVersion="1.0.0";this.loaded=null;this.loadedStamp=null;this.vaultPath=mi.default.resolve(e),this.cachePath=mi.default.join(this.vaultPath,".exocortex","cache","triples.json")}static{a(this,"CacheManager")}getCachePath(){return this.cachePath}async isCacheValid(){let e=await this.computeManifestDiff();return e!==null&&fO(e)}async computeManifestDiff(){let e=await this.readCacheData();if(!e)return null;let t=this.computeFileManifest();return t?mw(e.files,t):null}async loadOrBuild(){let e=Date.now(),t=await this.readCacheData();if(!t)return this.rebuild(e,"cache absent, corrupt or legacy format",null);let n=this.computeFileManifest();if(!n)return this.rebuild(e,"vault could not be walked",t);let i=mw(t.files,n);if(fO(i))return{triples:this.materializeTriples(t),explicitCount:r.explicitCountOf(t),zeroTriplePaths:r.zeroTriplePathsOf(t),cacheHit:!0,durationMs:Date.now()-e,mode:"hit",reparsedFiles:0};let s=new er(this.vaultPath),o=await this.planDelta(t,n,i,s);if(o.rebuildReason)return this.rebuild(e,o.rebuildReason,t);let c=await this.applyDelta(t,n,i,o.reparse,s);return{triples:c.triples,explicitCount:r.explicitCountOf(c.data),zeroTriplePaths:r.zeroTriplePathsOf(c.data),cacheHit:!0,durationMs:Date.now()-e,mode:"delta",reparsedFiles:o.reparse.length,inferredRecomputed:c.inferredRecomputed}}static explicitCountOf(e){let t=0;for(let n of e.files)t+=n.triples.length;return t}static zeroTriplePathsOf(e){let t=[];for(let n of e.files)n.triples.length===0&&t.push(n.path);return t}async refreshAfterWrite(){let e=await this.loadedIsCurrent()?this.loaded:await this.readCacheData();if(!e)return{mode:"skipped",reparsedFiles:0,reason:"no cache to refresh"};let t=new er(this.vaultPath),n=this.computeFileManifest(t);if(!n)return{mode:"skipped",reparsedFiles:0,reason:"vault could not be walked"};let i=mw(e.files,n);if(fO(i))return{mode:"noop",reparsedFiles:0};let s=await this.planDelta(e,n,i,t);return s.rebuildReason?{mode:"skipped",reparsedFiles:0,reason:`rebuild needed (${s.rebuildReason}) \u2014 left to the next reader`}:(await this.applyDelta(e,n,i,s.reparse,t,{needTriples:!1}),{mode:"delta",reparsedFiles:s.reparse.length})}async rebuild(e,t,n){let i=await this.buildInternal({strict:!1,materializeInference:n?.metadata.inferenceEnabled===!0});return{triples:i.triples.concat(i.inferred),explicitCount:i.triples.length,zeroTriplePaths:r.zeroTriplePathsOf(i.data),cacheHit:!1,durationMs:Date.now()-e,mode:"rebuild",reparsedFiles:i.data.files.length,rebuildReason:t}}materializeTriples(e){let t=[];for(let n of e.files)for(let i of n.triples)t.push(this.deserializeTriple(i));for(let n of e.inferred)t.push(this.deserializeTriple(n));return t}async readCacheData(){try{if(!await Wr.default.pathExists(this.cachePath))return null;let e=await this.statCache(),t=await Wr.default.readJson(this.cachePath);if(!t.metadata||t.metadata.formatVersion!==mO||typeof t.metadata.tripleCount!="number"||!Array.isArray(t.files)||!Array.isArray(t.inferred))return null;for(let i of t.files)if(typeof i?.path!="string"||!l6(i.path)||typeof i.mtimeMs!="number"||typeof i.size!="number"||!Array.isArray(i.triples))return null;let n={metadata:{...t.metadata,fileSpacePrefixes:Array.isArray(t.metadata.fileSpacePrefixes)?t.metadata.fileSpacePrefixes:[],fileSpaceDeclarations:Array.isArray(t.metadata.fileSpaceDeclarations)?t.metadata.fileSpaceDeclarations:[],inferenceEnabled:typeof t.metadata.inferenceEnabled=="boolean"?t.metadata.inferenceEnabled:t.inferred.length>0},files:t.files,inferred:t.inferred};return this.loaded=n,this.loadedStamp=e,n}catch{return null}}async statCache(){try{let e=await Wr.default.stat(this.cachePath);return{mtimeMs:e.mtimeMs,size:e.size}}catch{return null}}async loadedIsCurrent(){if(!this.loaded||!this.loadedStamp)return!1;let e=await this.statCache();return e!==null&&e.mtimeMs===this.loadedStamp.mtimeMs&&e.size===this.loadedStamp.size}computeFileManifest(e){try{let t=e??new er(this.vaultPath),n=new Map;for(let i of t.getAllFiles())try{let s=Wr.default.statSync(mi.default.join(this.vaultPath,i.path));n.set(i.path,{mtimeMs:s.mtimeMs,size:s.size})}catch{}return n}catch{return null}}async planDelta(e,t,n,i){let s=n.added.length+n.modified.length+n.removed.length,o=Math.max(e.files.length,t.size,1);if(s>o*gO)return{reparse:[],rebuildReason:`${s} of ${o} files changed (> ${gO*100}%)`};let c=new Map;for(let m of e.files)c.set(m.path,m);let l=new Set(e.metadata.fileSpaceDeclarations),u=new Set,f=new Set;for(let m of n.removed){if(l.has(m))return{reparse:[],rebuildReason:`FileSpace declaration removed: ${m}`};if(ZB(m))return{reparse:[],rebuildReason:`TBox-form file removed: ${m}`};let b=c.get(m);if(b&&pO(b))return{reparse:[],rebuildReason:`TBox-form asset removed: ${m}`};u.add((0,ln.vaultPathToIRI)(m))}let d=new Map;for(let m of[...n.added,...n.modified]){if(l.has(m))return{reparse:[],rebuildReason:`FileSpace declaration changed: ${m}`};if(ZB(m))return{reparse:[],rebuildReason:`TBox-form file changed: ${m}`};let b=i.getAbstractFileByPath(m),_=b&&dO(b)?b:null,w=_?i.getFrontmatter(_):null;if(w&&Hme(w))return{reparse:[],rebuildReason:`FileSpace declaration changed: ${m}`};d.set(m,{file:_,frontmatter:w})}let p=null;for(let[m,{file:b,frontmatter:_}]of d){let w=c.get(m),I=_?.exo__Asset_label,E={newLabel:typeof I=="string"&&Xd.test(I),hadLabel:w!==void 0&&pO(w),newAlias:Gme(_),hadAlias:w!==void 0&&qme(w)},S;if(E.newLabel||E.hadLabel||E.newAlias||E.hadAlias){if(!w||w.triples.length===0||!b)return{reparse:[],rebuildReason:yO(E,m)};p??=new ln.NoteToRDFConverter(i);let O;try{O=(await p.convertNote(b)).map(this.serializeTriple)}catch{return{reparse:[],rebuildReason:yO(E,m)}}let x=zme(m,w.triples,O,E);if(x)return{reparse:[],rebuildReason:x};S=e6({path:m,mtimeMs:0,size:0,triples:O})}else S=Vme(_);let R=w?e6(w):new Set;if(w&&!Wme(R,S)){let O=!1;for(let x of R)S.has(x)||(f.add(x),O=!0);for(let x of S)R.has(x)||f.add(x);O&&u.add((0,ln.vaultPathToIRI)(m))}if(!w)for(let O of S)f.add(O)}for(let m of n.added){let b=mi.default.basename(m);u.add((0,ln.vaultPathToIRI)(b)),f.add(mi.default.basename(m,mi.default.extname(m)).toLowerCase())}let h=new Set([...n.added,...n.modified]),g=new Set(n.removed);if(u.size>0||f.size>0)for(let m of e.files)h.has(m.path)||g.has(m.path)||Ume(m,u,f)&&h.add(m.path);return{reparse:[...h]}}async applyDelta(e,t,n,i,s,o={needTriples:!0}){let c=[];for(let R of i){let O=s.getAbstractFileByPath(R);O&&dO(O)&&c.push(O)}let l=new Map;await new ln.NoteToRDFConverter(s).convertVaultWithValidation({strict:!1,files:c,fileSpacePrefixes:e.metadata.fileSpacePrefixes,onFileTriples:a((R,O)=>{l.set(R.path,O)},"onFileTriples")});let f=new Set(i),d=new Set(n.removed),p=a(R=>this.makeEntry(R,t,l.get(R)??[],s),"makeEntry"),h=[];for(let R of e.files)d.has(R.path)||h.push(f.has(R.path)?p(R.path):R);let g=new Set(h.map(R=>R.path));for(let R of t.keys())g.has(R)||h.push(p(R));let m=null,b=a(()=>{if(m===null){m=[];for(let R of h)for(let O of R.triples)m.push(this.deserializeTriple(O))}return m},"explicitTriples"),_=[],w=[],I=!1;if(e.metadata.inferenceEnabled){let R=new Map;for(let O of h)R.set(O.path,O);u6(e,R,[...f,...d])?(w=(await ig(b())).inferred,_=w.map(this.serializeTriple),I=!0):(_=e.inferred,o.needTriples&&(w=e.inferred.map(this.deserializeTriple)))}let E=this.assembleCacheData(h,_,{fileSpacePrefixes:e.metadata.fileSpacePrefixes,fileSpaceDeclarations:e.metadata.fileSpaceDeclarations,inferenceEnabled:e.metadata.inferenceEnabled});await this.writeCacheData(E);let S=o.needTriples?b().concat(w):[];return{data:E,triples:S,inferredRecomputed:I}}makeEntry(e,t,n,i){let s=t.get(e),o={path:e,mtimeMs:s?.mtimeMs??0,size:s?.size??0,triples:n.map(this.serializeTriple)},c=pO(o);if(!c&&n.length===0){let l=i.getAbstractFileByPath(e),f=(l&&dO(l)?i.getFrontmatter(l):null)?.exo__Asset_label;c=typeof f=="string"&&Xd.test(f)}return c&&(o.tboxLabel=!0),o}async buildCache(){let e=await this.buildCacheWithValidation({strict:!1});return{tripleCount:e.tripleCount,durationMs:e.durationMs}}async buildCacheWithValidation(e={}){return(await this.buildInternal(e)).result}async buildInternal(e){let t=Date.now(),n=new er(this.vaultPath),i=n.getAllFiles(),s=new Map;for(let h of i)try{let g=Wr.default.statSync(mi.default.join(this.vaultPath,h.path));s.set(h.path,{mtimeMs:g.mtimeMs,size:g.size})}catch{}let o=new Map,l=await new ln.NoteToRDFConverter(n).convertVaultWithValidation({strict:e.strict??!1,files:i,onFileTriples:a((h,g)=>{o.set(h.path,g)},"onFileTriples")}),u=[];for(let h of i)s.has(h.path)&&u.push(this.makeEntry(h.path,s,o.get(h.path)??[],n));let f=[];for(let h of i){if(!s.has(h.path))continue;let g=o.get(h.path);g&&f.push(...g)}let d=[];e.materializeInference&&(d=(await ig(f)).inferred);let p=this.assembleCacheData(u,d.map(this.serializeTriple),{fileSpacePrefixes:l.fileSpaces?.prefixes??[],fileSpaceDeclarations:l.fileSpaces?.declarationPaths??[],inferenceEnabled:e.materializeInference===!0});return await this.writeCacheData(p),{result:{tripleCount:l.triples.length,durationMs:Date.now()-t,skippedFiles:l.skippedFiles,summary:l.summary},data:p,triples:f,inferred:d}}async validateVault(){let e=new er(this.vaultPath);return new ln.NoteToRDFConverter(e).validateVault()}async invalidate(){await Wr.default.pathExists(this.cachePath)&&await Wr.default.remove(this.cachePath),await this.removeStaleTempFiles()}async removeStaleTempFiles(){let e=mi.default.dirname(this.cachePath),t=`${mi.default.basename(this.cachePath)}.`,n;try{n=await Wr.default.readdir(e)}catch{return}let i=Date.now()-s6;for(let s of n){if(!s.startsWith(t)||!s.endsWith(".tmp"))continue;let o=mi.default.join(e,s);try{(await Wr.default.stat(o)).mtimeMs<i&&await Wr.default.remove(o)}catch{}}}async getCacheStats(){try{if(!await Wr.default.pathExists(this.cachePath))return null;let e=await this.readCacheData();if(!e){let i=await Wr.default.stat(this.cachePath);return{tripleCount:0,createdAt:new Date(i.mtimeMs),isValid:!1,sizeBytes:i.size}}let t=await Wr.default.stat(this.cachePath),n=await this.isCacheValid();return{tripleCount:e.metadata.tripleCount,createdAt:new Date(e.metadata.timestamp),isValid:n,sizeBytes:t.size}}catch{return null}}async saveInferredTriples(e){let t=await this.readCacheData();if(!t)throw new Error(`Cannot save inferred triples: no valid cache at ${this.cachePath} (build the cache first)`);let n=this.assembleCacheData(t.files,e.map(this.serializeTriple),{fileSpacePrefixes:t.metadata.fileSpacePrefixes,fileSpaceDeclarations:t.metadata.fileSpaceDeclarations,inferenceEnabled:!0});await this.writeCacheData(n)}assembleCacheData(e,t,n){let i=0;for(let s of e)i+=s.triples.length;return{metadata:{version:this.cliVersion,timestamp:Date.now(),vaultPath:this.vaultPath,tripleCount:i+t.length,formatVersion:mO,fileCount:e.length,inferredCount:t.length,fileSpacePrefixes:n.fileSpacePrefixes,fileSpaceDeclarations:n.fileSpaceDeclarations,inferenceEnabled:n.inferenceEnabled},files:e,inferred:t}}async writeCacheData(e){await Wr.default.ensureDir(mi.default.dirname(this.cachePath)),await this.removeStaleTempFiles();let t=`${this.cachePath}.${process.pid}.${i6.default.randomBytes(6).toString("hex")}.tmp`;try{await Wr.default.writeJson(t,e,{spaces:0});let n=await Wr.default.stat(t);await Wr.default.rename(t,this.cachePath),this.loaded=e,this.loadedStamp={mtimeMs:n.mtimeMs,size:n.size}}catch(n){throw await Wr.default.remove(t).catch(()=>{}),n}}serializeTriple(e){return{subject:za(e.subject),predicate:za(e.predicate),object:za(e.object)}}deserializeTriple(e){return new ln.Triple(ng(e.subject),ng(e.predicate),ng(e.object))}};a(fO,"isEmptyDiff");a(mw,"diffManifest");a(dO,"isFile");a(ZB,"isTBoxBasename");a(pO,"entryHasTBoxLabel");a(Ume,"entryRefersTo");a(Bme,"linkpathOf");a(e6,"entryAliases");a(Vme,"frontmatterAliases");a(c6,"rawFrontmatterAliases");a(Gme,"frontmatterHasTBoxFormAlias");a(qme,"entryHasTBoxFormAlias");a(Wme,"sameSet");a(hO,"sameList");a(yO,"tboxRebuildReason");a(t6,"tboxProjection");a(zme,"tboxProjectionChanged");a(Hme,"frontmatterDeclaresFileSpaceAnyForm");a(l6,"isSafeRelativePath");a(r6,"isInferenceRelevant");a(n6,"hasPrototype");a(u6,"inferenceInputsChanged")});var p6={};Vu(p6,{cacheLoadNotice:()=>wu,loadVaultTriples:()=>gi,writeThroughCache:()=>wO,writeThroughNotice:()=>EO});async function gi(r,e){if(e.useCache){let l=e.cacheManager??new Su(r),u=SO.default.join(SO.default.resolve(r),".exocortex","cache","triples.json");if(l.getCachePath()!==u)throw new Error(`loadVaultTriples: the given CacheManager belongs to ${l.getCachePath()}, not to vault ${r}`);let f=await l.loadOrBuild();return{triples:f.triples,cacheHit:f.cacheHit,mode:f.mode,reparsedFiles:f.reparsedFiles,cacheManager:l,explicitCount:f.explicitCount,zeroTriplePaths:f.zeroTriplePaths}}let t=e.vaultAdapter??new er(r),n=new d6.NoteToRDFConverter(t),i=t.getAllFiles(),s=new Map,o=await n.convertVault({onFileTriples:a((l,u)=>{s.set(l.path,u.length)},"onFileTriples")}),c=i.filter(l=>(s.get(l.path)??0)===0).map(l=>l.path);return{triples:o,cacheHit:!1,mode:"full-parse",explicitCount:o.length,zeroTriplePaths:c}}function wu(r){switch(r.mode){case"hit":return"\u26A1 triple cache: hit";case"delta":return`\u267B\uFE0F triple cache: delta (${r.reparsedFiles??0} file(s) re-parsed)`;case"rebuild":{let e=r.triples.length-r.explicitCount,t=e>0?` + inferred layer (${e})`:"";return`\u{1F528} triple cache: rebuild (${r.reparsedFiles??0} file(s) parsed, cache written${t})`}default:return"triple cache: not used (full parse)"}}async function wO(r){try{return await r.refreshAfterWrite()}catch(e){return{mode:"failed",reparsedFiles:0,reason:e instanceof Error?e.message:String(e)}}}function EO(r){switch(r.mode){case"delta":return`\u{1F4BE} triple cache: write-through persisted (${r.reparsedFiles} file(s) re-parsed)`;case"noop":return"\u{1F4BE} triple cache: write-through \u2014 nothing changed";case"skipped":return`\u{1F4BE} triple cache: write-through skipped (${r.reason??"unknown"})`;default:return`\u26A0 triple cache: write-through failed (${r.reason}) \u2014 command result unaffected; the next --use-cache run refreshes the cache itself`}}var SO,d6,Ha=Ve(()=>{"use strict";SO=te(require("path")),d6=te(Me());Mo();gw();a(gi,"loadVaultTriples");a(wu,"cacheLoadNotice");a(wO,"writeThroughCache");a(EO,"writeThroughNotice")});function tp(r){let e=new Set,t=/PREFIX\s+(\w+)\s*:/gi,n;for(;(n=t.exec(r))!==null;)e.add(n[1].toLowerCase());let i=q6.SPARQL_PREFIXES.split(`
|
|
429
429
|
`).filter(f=>f.trim().length>0),s=[];for(let f of i){let d=/PREFIX\s+(\w+)\s*:/i.exec(f);d&&!e.has(d[1].toLowerCase())&&s.push(f)}let o=/(?<![:\w])([a-z][a-zA-Z0-9]*):[a-zA-Z_]/g,c=new Set,l;for(;(l=o.exec(r))!==null;)c.add(l[1]);let u=new Set(e);for(let f of s){let d=/PREFIX\s+(\w+)\s*:/i.exec(f);d&&u.add(d[1].toLowerCase())}for(let f of c)u.has(f.toLowerCase())||Xge.test(f)&&(s.push(`PREFIX ${f}: <${Yge}${f}#>`),u.add(f.toLowerCase()));return s.length===0?r:s.join(`
|
|
430
430
|
`)+`
|
|
431
431
|
`+r}function Dw(r){return r.replace(Qge,(e,t,n,i,s)=>W6.has(n.toLowerCase())?`${n}:${i}`:e)}function Lw(r){let e=new Map(r);for(let t of W6)e.delete(t);return e}var q6,Yge,Xge,W6,Qge,Nw=Ve(()=>{"use strict";q6=te(Me()),Yge="https://exocortex.my/ontology/",Xge=/^[a-z][a-zA-Z0-9]*$/,W6=new Set(["exo","ems","ims","gtd","period","lit","inbox","rdf","rdfs","owl","xsd"]),Qge=/(<)([a-zA-Z][a-zA-Z0-9]*)__([a-zA-Z][a-zA-Z0-9_]*)(>)/g;a(tp,"injectExocortexPrefixes");a(Dw,"transformShorthandNotation");a(Lw,"filterOntologyPrefixes")});function a8(r){let e=rp.Namespace.EXO.term("Asset_label").value,t=new Map;for(let i of r){if(i.predicate.value!==e||!(i.object instanceof rp.DomainIRI)||rp.Namespace.fromTermIRI(i.object.value)===null)continue;let s=i.object.value,o=t.get(s);o||(o=new Set,t.set(s,o));let c=i.subject;o.add(c instanceof rp.DomainIRI?c.value:String(c))}let n=[];for(let[i,s]of t){if(s.size<2)continue;let o=[...s].sort();for(let c of o){if(c.startsWith("_:")||c.startsWith("<<"))continue;let l=o.filter(u=>u!==c);n.push({focusNode:c,propertyPath:e,severity:"sh:Warning",message:`term-IRI collision: <${i}> is emitted by ${o.length} assets \u2014 a join from a predicate to its definition resolves to all of them. Also emitted by: ${l.join(", ")}`,constraint:"term-iri-collision",actualValue:i})}}return n}var rp,c8=Ve(()=>{"use strict";rp=te(Me());a(a8,"detectTermIriCollisions")});function Rye(r,e){if(!r)return!1;let t=r.exo__Instance_class;if(t==null)return!1;let n=Array.isArray(t)?t:[t];for(let i of n){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/),o=s?s[1]:i;if(o===e||o.includes(e))return!0}return!1}async function u8(r,e){let t=await gi(r,{useCache:e});return{triples:t.triples,cacheHit:t.cacheHit}}function f8(r){let e=r.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return r.match(/^---\r?\n---/)?{}:null;let t=e[1].split(`
|
|
@@ -685,7 +685,7 @@ Next steps:
|
|
|
685
685
|
`).map(n=>n.trim()).filter(n=>n.length>0),t=e[e.length-1];if(t!==void 0)try{return JSON.parse(t)}catch{return}}a(H_e,"parseLastJsonLine");function yV(r,e){return e.filter(t=>{let n=r[t];return typeof n!="string"||n.trim().length===0})}a(yV,"missingStringFields");var IE=class{constructor(e){this.deps=e}static{a(this,"McpServer")}async handle(e){if(typeof e!="object"||e===null||Array.isArray(e))return{jsonrpc:"2.0",id:null,error:{code:gV,message:"Invalid request: expected a JSON-RPC object"}};let t=e.id,n=t===void 0;if(typeof e.method!="string")return n?null:{jsonrpc:"2.0",id:t??null,error:{code:gV,message:"Invalid request: missing method"}};if(n)return null;let i=t??null;switch(e.method){case"initialize":return{jsonrpc:"2.0",id:i,result:{protocolVersion:W_e,capabilities:{tools:{}},serverInfo:{name:"exocortex",version:this.deps.version}}};case"ping":return{jsonrpc:"2.0",id:i,result:{}};case"tools/list":return{jsonrpc:"2.0",id:i,result:{tools:mV}};case"tools/call":return{jsonrpc:"2.0",id:i,result:await this.callTool(e.params??{})};default:return{jsonrpc:"2.0",id:i,error:{code:z_e,message:`Method not found: ${e.method}`}}}}async callTool(e){let t=e.name,n=e.arguments??{},i;if(t==="create_asset"){let c=yV(n,["vault","class","label"]);if(c.length>0)return bp(`create_asset: missing required argument(s): ${c.join(", ")}`,!0);let l=dV(n);if(l!==null)return bp(`create_asset: ${l}`,!0);i=pV(n)}else if(t==="create_effort"){let c=yV(n,["vault","command","target"]);if(c.length>0)return bp(`create_effort: missing required argument(s): ${c.join(", ")}`,!0);i=hV(n)}else return bp(`Unknown tool: ${String(t)}`,!0);let s=await this.deps.runCli(i);if(s.exitCode!==0){let c=s.stderr.trim()||s.stdout.trim()||"(no diagnostic output)";return bp(`exocortex-cli exited ${s.exitCode}
|
|
686
686
|
${c}`,!0)}let o=H_e(s.stdout);return bp(o===void 0?s.stdout.trim():JSON.stringify(o))}};var SV=require("child_process");var K_e=32*1024*1024;function wV(r){return e=>new Promise(t=>{(0,SV.execFile)(process.execPath,[r,...e],{maxBuffer:K_e},(n,i,s)=>{let o=0;if(n){let c=n.code;o=typeof c=="number"?c:1}t({stdout:i,stderr:s,exitCode:o})})})}a(wV,"createSelfCliRunner");async function Y_e(r,e,t){let n=(0,EV.createInterface)({input:e,crlfDelay:1/0});for await(let i of n){let s=i.trim();if(s.length===0)continue;let o;try{o=JSON.parse(s)}catch{t(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:bV,message:"Parse error: invalid JSON"}})+`
|
|
687
687
|
`);continue}let c;try{c=await r.handle(o)}catch(l){c={jsonrpc:"2.0",id:typeof o?.id=="string"||typeof o?.id=="number"?o.id:null,error:{code:_V,message:`Internal error: ${l instanceof Error?l.message:String(l)}`}}}c!==null&&t(JSON.stringify(c)+`
|
|
688
|
-
`)}}a(Y_e,"runStdioServer");function vV(r){return new he("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new IE({runCli:wV(t),version:r??"unknown"});await Y_e(n,process.stdin,i=>process.stdout.write(i))})}a(vV,"mcpCommand");function RE(r){let e=new he;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"16.248.
|
|
688
|
+
`)}}a(Y_e,"runStdioServer");function vV(r){return new he("mcp").description("Run an MCP (Model Context Protocol) stdio server exposing create_asset / create_effort tools backed by this CLI").option("--entry <path>","Path to the CLI entry script the tools invoke (defaults to this process's script)").action(async e=>{let t=e.entry??process.argv[1],n=new IE({runCli:wV(t),version:r??"unknown"});await Y_e(n,process.stdin,i=>process.stdout.write(i))})}a(vV,"mcpCommand");function RE(r){let e=new he;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more").version(r??"16.248.1"),e.addCommand(r7()),e.addCommand(f7()),e.addCommand(K6()),e.addCommand(J6()),e.addCommand(S8()),e.addCommand(Z6()),e.addCommand(s8()),e.addCommand(o8()),e.addCommand(C8()),e.addCommand(D8()),e.addCommand(z8()),e.addCommand(Y8()),e.addCommand(X8()),e.addCommand(J8()),e.addCommand(Z8()),e.addCommand(k7()),e.addCommand($7()),e.addCommand(eV()),e.addCommand(rV()),e.addCommand(sV()),e.addCommand(oV()),e.addCommand(lV()),e.addCommand(W7()),e.addCommand(Q7()),e.addCommand(uV()),e.addCommand(vV(r??"16.248.1")),e}a(RE,"createProgram");RE().parse();0&&(module.exports={createProgram});
|
|
689
689
|
/*! Bundled license information:
|
|
690
690
|
|
|
691
691
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED