artifact-contracts 0.34.3 → 0.34.5

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.
@@ -228,7 +228,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
228
228
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
229
229
  `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){lg(n,r.start),n.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",a=[];if(n&&r.sep&&!r.value){let o=[];for(let s=0;s<r.sep.length;++s){let l=r.sep[s];switch(l.type){case"newline":o.push(s);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ds(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(GT(r.key)&&!Ds(r.sep,"newline")){let o=sc(r.start),s=r.key,l=r.sep;l.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:l}]})}else a.length>0?r.sep=r.sep.concat(a,this.sourceToken):r.sep.push(this.sourceToken);else if(Ds(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=sc(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?e.items.push({start:a,key:null,sep:[this.sourceToken]}):Ds(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||r.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Ds(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){lg(n,r.start),n.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Ds(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=ug(i),a=sc(n);ZT(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:a,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
230
230
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
231
- `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ug(e),i=sc(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ug(e),i=sc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};WT.Parser=w7});var XT=He(jp=>{"use strict";var KT=u7(),Efe=$p(),Ip=Ap(),Sfe=o8(),$fe=gr(),kfe=b7(),HT=E7();function JT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new kfe.LineCounter||null,prettyErrors:e}}function xfe(t,e={}){let{lineCounter:r,prettyErrors:i}=JT(e),n=new HT.Parser(r?.addNewLine),a=new KT.Composer(e),o=Array.from(a.compose(n.parse(t)));if(i&&r)for(let s of o)s.errors.forEach(Ip.prettifyError(t,r)),s.warnings.forEach(Ip.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function YT(t,e={}){let{lineCounter:r,prettyErrors:i}=JT(e),n=new HT.Parser(r?.addNewLine),a=new KT.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Ip.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(Ip.prettifyError(t,r)),o.warnings.forEach(Ip.prettifyError(t,r))),o}function Afe(t,e,r){let i;typeof e=="function"?i=e:r===void 0&&e&&typeof e=="object"&&(r=e);let n=YT(t,r);if(!n)return null;if(n.warnings.forEach(a=>Sfe.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function Dfe(t,e,r){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=r??e??{};if(!n)return}return $fe.isDocument(t)&&!i?t.toString(r):new Efe.Document(t,i,r).toString(r)}jp.parse=Afe;jp.parseAllDocuments=xfe;jp.parseDocument=YT;jp.stringify=Dfe});var Ia=He($r=>{"use strict";var Cfe=u7(),Ofe=$p(),Pfe=U8(),S7=Ap(),Ife=up(),Cs=gr(),jfe=$s(),Nfe=an(),Tfe=xs(),Bfe=As(),Rfe=og(),Ffe=y7(),Lfe=b7(),Mfe=E7(),cg=XT(),QT=ip();$r.Composer=Cfe.Composer;$r.Document=Ofe.Document;$r.Schema=Pfe.Schema;$r.YAMLError=S7.YAMLError;$r.YAMLParseError=S7.YAMLParseError;$r.YAMLWarning=S7.YAMLWarning;$r.Alias=Ife.Alias;$r.isAlias=Cs.isAlias;$r.isCollection=Cs.isCollection;$r.isDocument=Cs.isDocument;$r.isMap=Cs.isMap;$r.isNode=Cs.isNode;$r.isPair=Cs.isPair;$r.isScalar=Cs.isScalar;$r.isSeq=Cs.isSeq;$r.Pair=jfe.Pair;$r.Scalar=Nfe.Scalar;$r.YAMLMap=Tfe.YAMLMap;$r.YAMLSeq=Bfe.YAMLSeq;$r.CST=Rfe;$r.Lexer=Ffe.Lexer;$r.LineCounter=Lfe.LineCounter;$r.Parser=Mfe.Parser;$r.parse=cg.parse;$r.parseAllDocuments=cg.parseAllDocuments;$r.parseDocument=cg.parseDocument;$r.stringify=cg.stringify;$r.visit=QT.visit;$r.visitAsync=QT.visitAsync});var A7,rB,Ufe,nB=et(()=>{A7=(t,e,r)=>{let i=t instanceof RegExp?rB(t,r):t,n=e instanceof RegExp?rB(e,r):e,a=i!==null&&n!=null&&Ufe(i,n,r);return a&&{start:a[0],end:a[1],pre:r.slice(0,a[0]),body:r.slice(a[0]+i.length,a[1]),post:r.slice(a[1]+n.length)}},rB=(t,e)=>{let r=e.match(t);return r?r[0]:null},Ufe=(t,e,r)=>{let i,n,a,o,s,l=r.indexOf(t),u=r.indexOf(e,l+1),d=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],a=r.length;d>=0&&!s;){if(d===l)i.push(d),l=r.indexOf(t,d+1);else if(i.length===1){let c=i.pop();c!==void 0&&(s=[c,u])}else n=i.pop(),n!==void 0&&n<a&&(a=n,o=u),u=r.indexOf(e,d+1);d=l<u&&l>=0?l:u}i.length&&o!==void 0&&(s=[a,o])}return s}});function D7(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function tme(t){return t.replace(Kfe,iB).replace(Hfe,aB).replace(Jfe,O7).replace(Yfe,oB).replace(Xfe,sB)}function rme(t){return t.replace(qfe,"\\").replace(Vfe,"{").replace(Zfe,"}").replace(Gfe,",").replace(Wfe,".")}function uB(t){if(!t)return[""];let e=[],r=A7("{","}",t);if(!r)return t.split(",");let{pre:i,body:n,post:a}=r,o=i.split(",");o[o.length-1]+="{"+n+"}";let s=uB(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),e.push.apply(e,o),e}function lB(t,e={}){if(!t)return[];let{max:r=Qfe,maxLength:i=eme}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),C7(tme(t),r,i,!0).map(rme)}function nme(t){return"{"+t+"}"}function ime(t){return/^-?0\d/.test(t)}function ame(t,e){return t<=e}function ome(t,e){return t>=e}function Np(t,e,r,i,n,a){let o=[],s=0;for(let l=0;l<t.length;l++)for(let u=0;u<r.length;u++){if(o.length>=i)return o;let d=t[l]+e+r[u];if(!(a&&!d)){if(s+d.length>n)return o;o.push(d),s+=d.length}}return o}function sme(t,e,r){let i=t.split(/\.\./),n=[];if(i[0]===void 0||i[1]===void 0)return n;let a=D7(i[0]),o=D7(i[1]),s=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(D7(i[2])),1):1,u=ame;o<a&&(l*=-1,u=ome);let c=i.some(ime);for(let p=a;u(p,o)&&n.length<r;p+=l){let f;if(e)f=String.fromCharCode(p),f==="\\"&&(f="");else if(f=String(p),c){let m=s-f.length;if(m>0){let h=new Array(m+1).join("0");p<0?f="-"+h+f.slice(1):f=h+f}}n.push(f)}return n}function C7(t,e,r,i){let n=[""],a=!1,o=!0;for(;;){let s=A7("{","}",t);if(!s)return Np(n,t,[""],e,r,a);let l=s.pre;if(/\$$/.test(l)){if(n=Np(n,l+"{"+s.body+"}",[""],e,r,a&&!s.post.length),o=!1,!s.post.length)break;t=s.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),c=u||d,p=s.body.indexOf(",")>=0;if(!c&&!p){if(s.post.match(/,(?!,).*\}/)){t=s.pre+"{"+s.body+O7+s.post,i=!0;continue}return Np(n,l+"{"+s.body+"}"+s.post,[""],e,r,a)}o&&(a=i&&!c,o=!1);let f;if(c)f=sme(s.body,d,e);else{let m=uB(s.body);if(m.length===1&&m[0]!==void 0&&(m=C7(m[0],e,r,!1).map(nme),m.length===1)){if(n=Np(n,l+m[0],[""],e,r,a&&!s.post.length),!s.post.length)break;t=s.post;continue}f=[];for(let h=0;h<m.length;h++)f.push.apply(f,C7(m[h],e,r,!1))}if(n=Np(n,l,f,e,r,a&&!s.post.length),!s.post.length)break;t=s.post}return n}var iB,aB,O7,oB,sB,qfe,Vfe,Zfe,Gfe,Wfe,Kfe,Hfe,Jfe,Yfe,Xfe,Qfe,eme,cB=et(()=>{nB();iB="\0SLASH"+Math.random()+"\0",aB="\0OPEN"+Math.random()+"\0",O7="\0CLOSE"+Math.random()+"\0",oB="\0COMMA"+Math.random()+"\0",sB="\0PERIOD"+Math.random()+"\0",qfe=new RegExp(iB,"g"),Vfe=new RegExp(aB,"g"),Zfe=new RegExp(O7,"g"),Gfe=new RegExp(oB,"g"),Wfe=new RegExp(sB,"g"),Kfe=/\\\\/g,Hfe=/\\{/g,Jfe=/\\}/g,Yfe=/\\,/g,Xfe=/\\\./g,Qfe=1e5,eme=4e6});var Tp,dB=et(()=>{Tp=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var ume,Bp,lme,pB,fB,mB=et(()=>{ume={"[: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]},Bp=t=>t.replace(/[[\]\\-]/g,"\\$&"),lme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),pB=t=>t.join(""),fB=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let i=[],n=[],a=r+1,o=!1,s=!1,l=!1,u=!1,d=r,c="";e:for(;a<t.length;){let h=t.charAt(a);if((h==="!"||h==="^")&&a===r+1){u=!0,a++;continue}if(h==="]"&&o&&!l){d=a+1;break}if(o=!0,h==="\\"&&!l){l=!0,a++;continue}if(h==="["&&!l){for(let[g,[y,_,w]]of Object.entries(ume))if(t.startsWith(g,a)){if(c)return["$.",!1,t.length-r,!0];a+=g.length,w?n.push(y):i.push(y),s=s||_;continue e}}if(l=!1,c){h>c?i.push(Bp(c)+"-"+Bp(h)):h===c&&i.push(Bp(h)),c="",a++;continue}if(t.startsWith("-]",a+1)){i.push(Bp(h+"-")),a+=2;continue}if(t.startsWith("-",a+1)){c=h,a+=2;continue}i.push(Bp(h)),a++}if(d<a)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,t.length-r,!0];if(n.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let h=i[0].length===2?i[0].slice(-1):i[0];return[lme(h),!1,d-r,!1]}let p="["+(u?"^":"")+pB(i)+"]",f="["+(u?"":"^")+pB(n)+"]";return[i.length&&n.length?"("+p+"|"+f+")":i.length?p:f,s,d-r,!0]}});var aa,pg=et(()=>{aa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1")});var yi,cme,P7,hB,dme,pme,fme,gB,mme,fg,hme,gme,vme,yme,I7,vB,yB,_me,Su,j7=et(()=>{mB();pg();cme=new Set(["!","?","+","*","@"]),P7=t=>cme.has(t),hB=t=>P7(t.type),dme=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),pme=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fme=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),gB=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mme="(?!(?:^|/)\\.\\.?(?:$|/))",fg="(?!\\.)",hme=new Set(["[","."]),gme=new Set(["..","."]),vme=new Set("().*{}+?[]^$\\!"),yme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),I7="[^/]",vB=I7+"*?",yB=I7+"+?",_me=0,Su=class{type;#t;#r;#i=!1;#e=[];#n;#_;#g;#l=!1;#s;#u;#p=!1;id=++_me;get depth(){return(this.#n?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#n?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,r,i={}){this.type=e,e&&(this.#r=!0),this.#n=r,this.#t=this.#n?this.#n.#t:this,this.#s=this.#t===this?i:this.#t.#s,this.#g=this.#t===this?[]:this.#t.#g,e==="!"&&!this.#t.#l&&this.#g.push(this),this.#_=this.#n?this.#n.#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.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#u=this.#e.map(e=>String(e)).join("")}#c(){if(this!==this.#t)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let e;for(;e=this.#g.pop();){if(e.type!=="!")continue;let r=e,i=r.#n;for(;i;){for(let n=r.#_+1;!i.type&&n<i.#e.length;n++)for(let a of e.#e){if(typeof a=="string")throw new Error("string part in extglob AST??");a.copyIn(i.#e[n])}r=i,i=r.#n}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof yi&&r.#n===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let e=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#l&&this.#n?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#n?.isStart())return!1;if(this.#_===0)return!0;let e=this.#n;for(let r=0;r<this.#_;r++){let i=e.#e[r];if(!(i instanceof yi&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#n?.type==="!")return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();let e=this.#n?this.#n.#e.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new yi(this.type,e);for(let i of this.#e)r.copyIn(i);return r}static#o(e,r,i,n,a){let o=n.maxExtglobRecursion??2,s=!1,l=!1,u=-1,d=!1;if(r.type===null){let h=i,g="";for(;h<e.length;){let y=e.charAt(h++);if(s||y==="\\"){s=!s,g+=y;continue}if(l){h===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(h===u+2&&d)&&(l=!1),g+=y;continue}else if(y==="["){l=!0,u=h,d=!1,g+=y;continue}if(!n.noext&&P7(y)&&e.charAt(h)==="("&&a<=o){r.push(g),g="";let w=new yi(y,r);h=yi.#o(e,w,h,n,a+1),r.push(w);continue}g+=y}return r.push(g),h}let c=i+1,p=new yi(null,r),f=[],m="";for(;c<e.length;){let h=e.charAt(c++);if(s||h==="\\"){s=!s,m+=h;continue}if(l){c===u+1?(h==="^"||h==="!")&&(d=!0):h==="]"&&!(c===u+2&&d)&&(l=!1),m+=h;continue}else if(h==="["){l=!0,u=c,d=!1,m+=h;continue}if(!n.noext&&P7(h)&&e.charAt(c)==="("&&(a<=o||r&&r.#m(h))){let y=r&&r.#m(h)?0:1;p.push(m),m="";let _=new yi(h,p);p.push(_),c=yi.#o(e,_,c,n,a+y);continue}if(h==="|"){p.push(m),m="",f.push(p),p=new yi(null,r);continue}if(h===")")return m===""&&r.#e.length===0&&(r.#p=!0),p.push(m),m="",r.push(...f,p),c;m+=h}return r.type=null,r.#r=void 0,r.#e=[e.substring(i-1)],c}#b(e){return this.#w(e,pme)}#w(e,r=dme){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let i=e.#e[0];return!i||typeof i!="object"||i.type===null?!1:this.#m(i.type,r)}#m(e,r=fme){return!!r.get(this.type)?.includes(e)}#v(e,r){let i=e.#e[0],n=new yi(null,i,this.options);n.#e.push(""),i.push(n),this.#$(e,r)}#$(e,r){let i=e.#e[0];this.#e.splice(r,1,...i.#e);for(let n of i.#e)typeof n=="object"&&(n.#n=this);this.#u=void 0}#y(e){return!!gB.get(this.type)?.has(e)}#S(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type)}#k(e){let r=gB.get(this.type),i=e.#e[0],n=r?.get(i.type);if(!n)return!1;this.#e=i.#e;for(let a of this.#e)typeof a=="object"&&(a.#n=this);this.type=n,this.#u=void 0,this.#p=!1}static fromGlob(e,r={}){let i=new yi(null,void 0,r);return yi.#o(e,i,0,r,0),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[r,i,n,a]=this.toRegExpSource();if(!(n||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let s=(this.#s.nocase?"i":"")+(a?"u":"");return Object.assign(new RegExp(`^${r}$`,s),{_src:r,_glob:e})}get options(){return this.#s}toRegExpSource(e){let r=e??!!this.#s.dot;if(this.#t===this&&(this.#f(),this.#c()),!hB(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),u=this.#e.map(f=>{let[m,h,g,y]=typeof f=="string"?yi.#E(f,this.#r,l):f.toRegExpSource(e);return this.#r=this.#r||g,this.#i=this.#i||y,m}).join(""),d="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&gme.has(this.#e[0]))){let m=hme,h=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),g=!r&&!e&&m.has(u.charAt(0));d=h?mme:g?fg:""}let c="";return this.isEnd()&&this.#t.#l&&this.#n?.type==="!"&&(c="(?:$|\\/)"),[d+u+c,aa(u),this.#r=!!this.#r,this.#i]}let i=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",a=this.#h(r);if(this.isStart()&&this.isEnd()&&!a&&this.type!=="!"){let l=this.toString(),u=this;return u.#e=[l],u.type=null,u.#r=void 0,[l,aa(this.toString()),!1,!1]}let o=!i||e||r||!fg?"":this.#h(!0);o===a&&(o=""),o&&(a=`(?:${a})(?:${o})*?`);let s="";if(this.type==="!"&&this.#p)s=(this.isStart()&&!r?fg:"")+yB;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?fg:"")+vB+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;s=n+a+l}return[s,aa(a),this.#r=!!this.#r,this.#i]}#f(){if(hB(this)){let e=0,r=!1;do{r=!0;for(let i=0;i<this.#e.length;i++){let n=this.#e[i];typeof n=="object"&&(n.#f(),this.#w(n)?(r=!1,this.#$(n,i)):this.#b(n)?(r=!1,this.#v(n,i)):this.#S(n)&&(r=!1,this.#k(n)))}}while(!r&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#f();this.#u=void 0}#h(e){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[i,n,a,o]=r.toRegExpSource(e);return this.#i=this.#i||o,i}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#E(e,r,i=!1){let n=!1,a="",o=!1,s=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(n){n=!1,a+=(vme.has(u)?"\\":"")+u;continue}if(u==="*"){if(s)continue;s=!0,a+=i&&/^[*]+$/.test(e)?yB:vB,r=!0;continue}else s=!1;if(u==="\\"){l===e.length-1?a+="\\\\":n=!0;continue}if(u==="["){let[d,c,p,f]=fB(e,l);if(p){a+=d,o=o||c,l+=p-1,r=r||f;continue}}if(u==="?"){a+=I7,r=!0;continue}a+=yme(u)}return[a,aa(e),!!r,o]}};yi=Su});var $u,N7=et(()=>{$u=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var yn,bme,wme,Eme,Sme,$me,kme,xme,Ame,Dme,Cme,Ome,Pme,Ime,jme,Nme,Tme,Bme,Rme,wB,EB,SB,_B,Fme,tn,Lme,Mme,zme,Ume,qme,oa,Vme,$B,Zme,Gme,bB,Wme,Bi,Co=et(()=>{cB();dB();j7();N7();pg();j7();N7();pg();yn=(t,e,r={})=>(Tp(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Bi(e,r).match(t)),bme=/^\*+([^+@!?*[(]*)$/,wme=t=>e=>!e.startsWith(".")&&e.endsWith(t),Eme=t=>e=>e.endsWith(t),Sme=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),$me=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),kme=/^\*+\.\*+$/,xme=t=>!t.startsWith(".")&&t.includes("."),Ame=t=>t!=="."&&t!==".."&&t.includes("."),Dme=/^\.\*+$/,Cme=t=>t!=="."&&t!==".."&&t.startsWith("."),Ome=/^\*+$/,Pme=t=>t.length!==0&&!t.startsWith("."),Ime=t=>t.length!==0&&t!=="."&&t!=="..",jme=/^\?+([^+@!?*[(]*)?$/,Nme=([t,e=""])=>{let r=wB([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Tme=([t,e=""])=>{let r=EB([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Bme=([t,e=""])=>{let r=EB([t]);return e?i=>r(i)&&i.endsWith(e):r},Rme=([t,e=""])=>{let r=wB([t]);return e?i=>r(i)&&i.endsWith(e):r},wB=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},EB=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},SB=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",_B={win32:{sep:"\\"},posix:{sep:"/"}},Fme=SB==="win32"?_B.win32.sep:_B.posix.sep;yn.sep=Fme;tn=Symbol("globstar **");yn.GLOBSTAR=tn;Lme="[^/]",Mme=Lme+"*?",zme="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ume="(?:(?!(?:\\/|^)\\.).)*?",qme=(t,e={})=>r=>yn(r,t,e);yn.filter=qme;oa=(t,e={})=>Object.assign({},t,e),Vme=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return yn;let e=yn;return Object.assign((i,n,a={})=>e(i,n,oa(t,a)),{Minimatch:class extends e.Minimatch{constructor(n,a={}){super(n,oa(t,a))}static defaults(n){return e.defaults(oa(t,n)).Minimatch}},AST:class extends e.AST{constructor(n,a,o={}){super(n,a,oa(t,o))}static fromGlob(n,a={}){return e.AST.fromGlob(n,oa(t,a))}},unescape:(i,n={})=>e.unescape(i,oa(t,n)),escape:(i,n={})=>e.escape(i,oa(t,n)),filter:(i,n={})=>e.filter(i,oa(t,n)),defaults:i=>e.defaults(oa(t,i)),makeRe:(i,n={})=>e.makeRe(i,oa(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,oa(t,n)),match:(i,n,a={})=>e.match(i,n,oa(t,a)),sep:e.sep,GLOBSTAR:tn})};yn.defaults=Vme;$B=(t,e={})=>(Tp(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:lB(t,{max:e.braceExpandMax}));yn.braceExpand=$B;Zme=(t,e={})=>new Bi(t,e).makeRe();yn.makeRe=Zme;Gme=(t,e,r={})=>{let i=new Bi(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};yn.match=Gme;bB=/[?*]|[+@!]\(.*?\)|\[|\]/,Wme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Bi=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){Tp(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||SB,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...a)=>console.error(...a)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(a=>this.slashSplit(a));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((a,o,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=a[0]===""&&a[1]===""&&(a[2]==="?"||!bB.test(a[2]))&&!bB.test(a[3]),u=/^[a-z]:/i.test(a[0]);if(l)return[...a.slice(0,4),...a.slice(4).map(d=>this.parse(d))];if(u)return[a[0],...a.slice(1).map(d=>this.parse(d))]}return a.map(l=>this.parse(l))});if(this.debug(this.pattern,n),this.set=n.filter(a=>a.indexOf(!1)===-1),this.isWindows)for(let a=0;a<this.set.length;a++){let o=this.set[a];o[0]===""&&o[1]===""&&this.globParts[a][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 i of e)for(let n=0;n<i.length;n++)i[n]==="**"&&(i[n]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let n=i;for(;r[n+1]==="**";)n++;n!==i&&r.splice(i,n-i)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((i,n)=>{let a=i[i.length-1];return n==="**"&&a==="**"?i:n===".."&&a&&a!==".."&&a!=="."&&a!=="**"?(i.pop(),i):(i.push(n),i)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let a=e[n];n===1&&a===""&&e[0]===""||(a==="."||a==="")&&(r=!0,e.splice(n,1),n--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let n=e[i-1];n&&n!=="."&&n!==".."&&n!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(n))&&(r=!0,e.splice(i-1,2),i-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let i of e){let n=-1;for(;(n=i.indexOf("**",n+1))!==-1;){let o=n;for(;i[o+1]==="**";)o++;o>n&&i.splice(n+1,o-n);let s=i[n+1],l=i[n+2],u=i[n+3];if(s!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,i.splice(n,1);let d=i.slice(0);d[n]="**",e.push(d),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let s=i[o];o===1&&s===""&&i[0]===""||(s==="."||s==="")&&(r=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(r=!0,i.pop())}let a=0;for(;(a=i.indexOf("..",a+1))!==-1;){let o=i[a-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let l=a===1&&i[a+1]==="**"?["."]:[];i.splice(a-1,2,...l),i.length===0&&i.push(""),a-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let i=r+1;i<e.length;i++){let n=this.partsMatch(e[r],e[i],!this.preserveMultipleSlashes);if(n){e[r]=[],e[i]=n;break}}return e.filter(r=>r.length)}partsMatch(e,r,i=!1){let n=0,a=0,o=[],s="";for(;n<e.length&&a<r.length;)if(e[n]===r[a])o.push(s==="b"?r[a]:e[n]),n++,a++;else if(i&&e[n]==="**"&&r[a]===e[n+1])o.push(e[n]),n++;else if(i&&r[a]==="**"&&e[n]===r[a+1])o.push(r[a]),a++;else if(e[n]==="*"&&r[a]&&(this.options.dot||!r[a].startsWith("."))&&r[a]!=="**"){if(s==="b")return!1;s="a",o.push(e[n]),n++,a++}else if(r[a]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(s==="a")return!1;s="b",o.push(r[a]),n++,a++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i=!1){let n=0,a=0;if(this.isWindows){let s=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!s&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),c=l?3:s?0:void 0,p=d?3:u?0:void 0;if(typeof c=="number"&&typeof p=="number"){let[f,m]=[e[c],r[p]];f.toLowerCase()===m.toLowerCase()&&(r[p]=f,a=p,n=c)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(tn)?this.#t(e,r,i,n,a):this.#i(e,r,i,n,a)}#t(e,r,i,n,a){let o=r.indexOf(tn,a),s=r.lastIndexOf(tn),[l,u,d]=i?[r.slice(a,o),r.slice(o+1),[]]:[r.slice(a,o),r.slice(o+1,s),r.slice(s+1)];if(l.length){let _=e.slice(n,n+l.length);if(!this.#i(_,l,i,0,0))return!1;n+=l.length,a+=l.length}let c=0;if(d.length){if(d.length+n>e.length)return!1;let _=e.length-d.length;if(this.#i(e,d,i,_,0))c=d.length;else{if(e[e.length-1]!==""||n+d.length===e.length||(_--,!this.#i(e,d,i,_,0)))return!1;c=d.length+1}}if(!u.length){let _=!!c;for(let w=n;w<e.length-c;w++){let E=String(e[w]);if(_=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return i||_}let p=[[[],0]],f=p[0],m=0,h=[0];for(let _ of u)_===tn?(h.push(m),f=[[],0],p.push(f)):(f[0].push(_),m++);let g=p.length-1,y=e.length-c;for(let _ of p)_[1]=y-(h[g--]+_[0].length);return!!this.#r(e,p,n,0,i,0,!!c)}#r(e,r,i,n,a,o,s){let l=r[n];if(!l){for(let c=i;c<e.length;c++){s=!0;let p=e[c];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return s}let[u,d]=l;for(;i<=d;){if(this.#i(e.slice(0,i+u.length),u,a,i,0)&&o<this.maxGlobstarRecursion){let f=this.#r(e,r,i+u.length,n+1,a,o+1,s);if(f!==!1)return f}let p=e[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return a||null}#i(e,r,i,n,a){let o,s,l,u;for(o=n,s=a,u=e.length,l=r.length;o<u&&s<l;o++,s++){this.debug("matchOne loop");let d=r[s],c=e[o];if(this.debug(r,d,c),d===!1||d===tn)return!1;let p;if(typeof d=="string"?(p=c===d,this.debug("string match",d,c,p)):(p=d.test(c),this.debug("pattern match",d,c,p)),!p)return!1}if(o===u&&s===l)return!0;if(o===u)return i;if(s===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return $B(this.pattern,this.options)}parse(e){Tp(e);let r=this.options;if(e==="**")return tn;if(e==="")return"";let i,n=null;(i=e.match(Ome))?n=r.dot?Ime:Pme:(i=e.match(bme))?n=(r.nocase?r.dot?$me:Sme:r.dot?Eme:wme)(i[1]):(i=e.match(jme))?n=(r.nocase?r.dot?Tme:Nme:r.dot?Bme:Rme)(i):(i=e.match(kme))?n=r.dot?Ame:xme:(i=e.match(Dme))&&(n=Cme);let a=Su.fromGlob(e,this.options).toMMPattern();return n&&typeof a=="object"&&Reflect.defineProperty(a,"test",{value:n}),a}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?Mme:r.dot?zme:Ume,n=new Set(r.nocase?["i"]:[]),a=e.map(l=>{let u=l.map(c=>{if(c instanceof RegExp)for(let p of c.flags.split(""))n.add(p);return typeof c=="string"?Wme(c):c===tn?tn:c._src});u.forEach((c,p)=>{let f=u[p+1],m=u[p-1];c!==tn||m===tn||(m===void 0?f!==void 0&&f!==tn?u[p+1]="(?:\\/|"+i+"\\/)?"+f:u[p]=i:f===void 0?u[p-1]=m+"(?:\\/|\\/"+i+")?":f!==tn&&(u[p-1]=m+"(?:\\/|\\/"+i+"\\/)"+f,u[p+1]=tn))});let d=u.filter(c=>c!==tn);if(this.partial&&d.length>=1){let c=[];for(let p=1;p<=d.length;p++)c.push(d.slice(0,p).join("/"));return"(?:"+c.join("|")+")"}return d.join("/")}).join("|"),[o,s]=e.length>1?["(?:",")"]:["",""];a="^"+o+a+s+"$",this.partial&&(a="^(?:\\/|"+o+a.slice(1,-1)+s+")$"),this.negate&&(a="^(?!"+a+").+$");try{this.regexp=new RegExp(a,[...n].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,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let a=this.set;this.debug(this.pattern,"set",a);let o=n[n.length-1];if(!o)for(let s=n.length-2;!o&&s>=0;s--)o=n[s];for(let s of a){let l=n;if(i.matchBase&&s.length===1&&(l=[o]),this.matchOne(l,s,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return yn.defaults(e).Minimatch}};yn.AST=Su;yn.Minimatch=Bi;yn.escape=$u;yn.unescape=aa});import{tracingChannel as Kme,channel as Hme}from"node:diagnostics_channel";var In,Rp,Jme,R7,xB,kB,Yme,Xme,Os,AB,mg,Qme,Lp,CB=et(()=>{In=Hme("lru-cache:metrics"),Rp=Kme("lru-cache"),Jme=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,R7=()=>In.hasSubscribers||Rp.hasSubscribers,xB=new Set,kB=typeof process=="object"&&process?process:{},Yme=(t,e,r,i)=>{typeof kB.emitWarning=="function"?kB.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},Xme=t=>!xB.has(t),Os=t=>!!t&&t===Math.floor(t)&&t>0&&isFinite(t),AB=t=>Os(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?mg:null:null,mg=class extends Array{constructor(t){super(t),this.fill(0)}},Qme=class Fp{heap;length;static#t=!1;static create(e){let r=AB(e);if(!r)return[];Fp.#t=!0;let i=new Fp(e,r);return Fp.#t=!1,i}constructor(e,r){if(!Fp.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Lp=class DB{#t;#r;#i;#e;#n;#_;#g;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#s;#u;#p;#c;#o;#b;#w;#m;#v;#$;#y;#S;#k;#f;#h;#E;#D;#a;#P;static unsafeExposeInternals(e){return{starts:e.#k,ttls:e.#f,autopurgeTimers:e.#h,sizes:e.#S,keyMap:e.#p,keyList:e.#c,valList:e.#o,next:e.#b,prev:e.#w,get head(){return e.#m},get tail(){return e.#v},free:e.#$,isBackgroundFetch:r=>e.#d(r),backgroundFetch:(r,i,n,a)=>e.#R(r,i,n,a),moveToTail:r=>e.#K(r),indexes:r=>e.#C(r),rindexes:r=>e.#O(r),isStale:r=>e.#x(r)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#s}get fetchMethod(){return this.#_}get memoMethod(){return this.#g}get dispose(){return this.#i}get onInsert(){return this.#e}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:l,dispose:u,onInsert:d,disposeAfter:c,noDisposeOnSet:p,noUpdateTTL:f,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:y,memoMethod:_,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:C,ignoreFetchAbort:S,backgroundFetchSize:A=1,perf:I}=e;if(this.backgroundFetchSize=A,I!==void 0&&typeof I?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#l=I??Jme,r!==0&&!Os(r))throw new TypeError("max option must be a nonnegative integer");let O=r?AB(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=g,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#g=_,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=y,this.#D=!!y,this.#p=new Map,this.#c=Array.from({length:r}).fill(void 0),this.#o=Array.from({length:r}).fill(void 0),this.#b=new O(r),this.#w=new O(r),this.#m=0,this.#v=0,this.#$=Qme.create(r),this.#s=0,this.#u=0,typeof u=="function"&&(this.#i=u),typeof d=="function"&&(this.#e=d),typeof c=="function"?(this.#n=c,this.#y=[]):(this.#n=void 0,this.#y=void 0),this.#E=!!this.#i,this.#P=!!this.#e,this.#a=!!this.#n,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#r!==0&&!Os(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Os(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=Os(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=i||0,this.ttl){if(!Os(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 k="LRU_CACHE_UNBOUNDED";Xme(k)&&(xB.add(k),Yme("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,DB))}}getRemainingTTL(e){return this.#p.has(e)?1/0:0}#I(){let e=new mg(this.#t),r=new mg(this.#t);this.#f=e,this.#k=r;let i=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#h=i,this.#L=(s,l,u=this.#l.now())=>{r[s]=l!==0?u:0,e[s]=l,n(s,l)},this.#A=s=>{r[s]=e[s]!==0?this.#l.now():0,n(s,e[s])};let n=this.ttlAutopurge?(s,l)=>{if(i?.[s]&&(clearTimeout(i[s]),i[s]=void 0),l&&l!==0&&i){let u=setTimeout(()=>{this.#x(s)&&this.#F(this.#c[s],"expire")},l+1);u.unref&&u.unref(),i[s]=u}}:()=>{};this.#j=(s,l)=>{if(e[l]){let u=e[l],d=r[l];if(!u||!d)return;s.ttl=u,s.start=d,s.now=a||o();let c=s.now-d;s.remainingTTL=u-c}};let a=0,o=()=>{let s=this.#l.now();if(this.ttlResolution>0){a=s;let l=setTimeout(()=>a=0,this.ttlResolution);l.unref&&l.unref()}return s};this.getRemainingTTL=s=>{let l=this.#p.get(s);if(l===void 0)return 0;let u=e[l],d=r[l];if(!u||!d)return 1/0;let c=(a||o())-d;return u-c},this.#x=s=>{let l=r[s],u=e[s];return!!u&&!!l&&(a||o())-l>u}}#A=()=>{};#j=()=>{};#L=()=>{};#x=()=>!1;#V(){let e=new mg(this.#t);this.#u=0,this.#S=e,this.#T=r=>{this.#u-=e[r],e[r]=0},this.#M=(r,i,n,a)=>{if(!Os(n)){if(this.#d(i))return this.backgroundFetchSize;if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(i,r),!Os(n))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 n},this.#N=(r,i,n)=>{if(e[r]=i,this.#r){let a=this.#r-e[r];for(;this.#u>a;)this.#q(!0)}this.#u+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#u)}}#T=e=>{};#N=(e,r,i)=>{};#M=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#v;this.#z(r)&&((e||!this.#x(r))&&(yield r),r!==this.#m);)r=this.#w[r]}*#O({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#m;this.#z(r)&&((e||!this.#x(r))&&(yield r),r!==this.#v);)r=this.#b[r]}#z(e){return e!==void 0&&this.#p.get(this.#c[e])===e}*entries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#c[e]!==void 0&&!this.#d(this.#o[e])&&(yield[this.#c[e],this.#o[e]])}*rentries(){for(let e of this.#O())this.#o[e]!==void 0&&this.#c[e]!==void 0&&!this.#d(this.#o[e])&&(yield[this.#c[e],this.#o[e]])}*keys(){for(let e of this.#C()){let r=this.#c[e];r!==void 0&&!this.#d(this.#o[e])&&(yield r)}}*rkeys(){for(let e of this.#O()){let r=this.#c[e];r!==void 0&&!this.#d(this.#o[e])&&(yield r)}}*values(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#d(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#O())this.#o[e]!==void 0&&!this.#d(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#C()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;if(a!==void 0&&e(a,this.#c[i],this))return this.#W(this.#c[i],r)}}forEach(e,r=this){for(let i of this.#C()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;a!==void 0&&e.call(r,a,this.#c[i],this)}}rforEach(e,r=this){for(let i of this.#O()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;a!==void 0&&e.call(r,a,this.#c[i],this)}}purgeStale(){let e=!1;for(let r of this.#O({allowStale:!0}))this.#x(r)&&(this.#F(this.#c[r],"expire"),e=!0);return e}info(e){let r=this.#p.get(e);if(r===void 0)return;let i=this.#o[r],n=this.#d(i)?i.__staleWhileFetching:i;if(n===void 0)return;let a={value:n};if(this.#f&&this.#k){let o=this.#f[r],s=this.#k[r];if(o&&s){let l=o-(this.#l.now()-s);a.ttl=l,a.start=Date.now()}}return this.#S&&(a.size=this.#S[r]),a}dump(){let e=[];for(let r of this.#C({allowStale:!0})){let i=this.#c[r],n=this.#o[r],a=this.#d(n)?n.__staleWhileFetching:n;if(a===void 0||i===void 0)continue;let o={value:a};if(this.#f&&this.#k){o.ttl=this.#f[r];let s=this.#l.now()-this.#k[r];o.start=Math.floor(Date.now()-s)}this.#S&&(o.size=this.#S[r]),e.unshift([i,o])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=this.#l.now()-n}this.#B(r,i.value,i)}}set(e,r,i={}){let{status:n=In.hasSubscribers?{}:void 0}=i;i.status=n,n&&(n.op="set",n.key=e,r!==void 0&&(n.value=r),n.cache=this);let a=this.#B(e,r,i);return n&&In.hasSubscribers&&In.publish(n),a}#B(e,r,i,n){let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=i,d=this.#d(r);if(r===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:c=this.noUpdateTTL}=i;u&&!d&&(u.value=r);let p=this.#M(e,r,i.size||0,l,u);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#F(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let f=this.#s===0?void 0:this.#p.get(e);if(f===void 0)f=this.#s===0?this.#v:this.#$.length!==0?this.#$.pop():this.#s===this.#t?this.#q(!1):this.#s,this.#c[f]=e,this.#o[f]=r,this.#p.set(e,f),this.#b[this.#v]=f,this.#w[f]=this.#v,this.#v=f,this.#s++,this.#N(f,p,u),u&&(u.set="add"),c=!1,this.#P&&!d&&this.#e?.(r,e,"add");else{this.#K(f);let m=this.#o[f];if(r!==m){if(!s)if(this.#d(m)){m!==n&&m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=m;h!==void 0&&h!==r&&(this.#E&&this.#i?.(h,e,"set"),this.#a&&this.#y?.push([h,e,"set"]))}else this.#E&&this.#i?.(m,e,"set"),this.#a&&this.#y?.push([m,e,"set"]);if(this.#T(f),this.#N(f,p,u),this.#o[f]=r,!d){let h=m&&this.#d(m)?m.__staleWhileFetching:m,g=h===void 0?"add":r!==h?"replace":"update";u&&(u.set=g,h!==void 0&&(u.oldValue=h)),this.#P&&this.onInsert?.(r,e,g)}}else d||(u&&(u.set="update"),this.#P&&this.onInsert?.(r,e,"update"))}if(a!==0&&!this.#f&&this.#I(),this.#f&&(c||this.#L(f,a,o),u&&this.#j(u,f)),!s&&this.#a&&this.#y){let m=this.#y,h;for(;h=m?.shift();)this.#n?.(...h)}return this}pop(){try{for(;this.#s;){let e=this.#o[this.#m];if(this.#q(!0),this.#d(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#a&&this.#y){let e=this.#y,r;for(;r=e?.shift();)this.#n?.(...r)}}}#q(e){let r=this.#m,i=this.#c[r],n=this.#o[r],a=this.#d(n);a&&n.__abortController.abort(new Error("evicted"));let o=a?n.__staleWhileFetching:n;return(this.#E||this.#a)&&o!==void 0&&(this.#E&&this.#i?.(o,i,"evict"),this.#a&&this.#y?.push([o,i,"evict"])),this.#T(r),this.#h?.[r]&&(clearTimeout(this.#h[r]),this.#h[r]=void 0),e&&(this.#c[r]=void 0,this.#o[r]=void 0,this.#$.push(r)),this.#s===1?(this.#m=this.#v=0,this.#$.length=0):this.#m=this.#b[r],this.#p.delete(i),this.#s--,r}has(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="has",i.key=e,i.cache=this);let n=this.#H(e,r);return In.hasSubscribers&&In.publish(i),n}#H(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,a=this.#p.get(e);if(a!==void 0){let o=this.#o[a];if(this.#d(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#x(a))n&&(n.has="stale",this.#j(n,a));else return i&&this.#A(a),n&&(n.has="hit",this.#j(n,a)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{status:i=R7()?{}:void 0}=r;i&&(i.op="peek",i.key=e,i.cache=this),r.status=i;let n=this.#Z(e,r);return In.hasSubscribers&&In.publish(i),n}#Z(e,r){let{status:i,allowStale:n=this.allowStale}=r,a=this.#p.get(e);if(a===void 0||!n&&this.#x(a)){i&&(i.peek=a===void 0?"miss":"stale");return}let o=this.#o[a],s=this.#d(o)?o.__staleWhileFetching:o;return i&&(s!==void 0?(i.peek="hit",i.value=s):i.peek="miss"),s}#R(e,r,i,n){let a=r===void 0?void 0:this.#o[r];if(this.#d(a))return a;let o=new AbortController,{signal:s}=i;s?.addEventListener("abort",()=>o.abort(s.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:n},u=(h,g=!1)=>{let{aborted:y}=o.signal,_=i.ignoreFetchAbort&&h!==void 0,w=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&h!==void 0);if(i.status&&(y&&!g?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,_&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),y&&!_&&!g)return c(o.signal.reason,w);let E=f,D=this.#o[r];return(D===f||D===void 0&&_&&g)&&(h===void 0?E.__staleWhileFetching!==void 0?this.#o[r]=E.__staleWhileFetching:this.#F(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#B(e,h,l.options,E))),h},d=h=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=h),c(h,!1)),c=(h,g)=>{let{aborted:y}=o.signal,_=y&&i.allowStaleOnFetchAbort,w=_||i.allowStaleOnFetchRejection,E=w||i.noDeleteOnFetchRejection,D=f;if(this.#o[r]===f&&(!E||!g&&D.__staleWhileFetching===void 0?this.#F(e,"fetch"):_||(this.#o[r]=D.__staleWhileFetching)),w)return i.status&&D.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),D.__staleWhileFetching;if(D.__returned===D)throw h},p=(h,g)=>{let y=this.#_?.(e,a,l);o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(h(void 0),i.allowStaleOnFetchAbort&&(h=_=>u(_,!0)))}),y&&y instanceof Promise?y.then(_=>h(_===void 0?void 0:_),g):y!==void 0&&h(y)};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(p).then(u,d),m=Object.assign(f,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.#B(e,m,{...l.options,status:void 0}),r=this.#p.get(e)):this.#o[r]=m,m}#d(e){if(!this.#D)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(e,r={}){let i=Rp.hasSubscribers,{status:n=R7()?{}:void 0}=r;r.status=n,n&&r.context&&(n.context=r.context);let a=this.#G(e,r);return n&&i&&(n.trace=!0,Rp.tracePromise(()=>a,n).catch(()=>{})),a}async#G(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:g=!1,status:y,signal:_}=r;if(y&&(y.op="fetch",y.key=e,g&&(y.forceRefresh=!0),y.cache=this),!this.#D)return y&&(y.fetch="get"),this.#W(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:y});let w={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:_},E=this.#p.get(e);if(E===void 0){y&&(y.fetch="miss");let D=this.#R(e,E,w,h);return D.__returned=D}else{let D=this.#o[E];if(this.#d(D)){let I=i&&D.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",I&&(y.returnedStale=!0)),I?D.__staleWhileFetching:D.__returned=D}let C=this.#x(E);if(!g&&!C)return y&&(y.fetch="hit"),this.#K(E),n&&this.#A(E),y&&this.#j(y,E),D;let S=this.#R(e,E,w,h),A=S.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=C?"stale":"refresh",A&&C&&(y.returnedStale=!0)),A?S.__staleWhileFetching:S.__returned=S}}forceFetch(e,r={}){let i=Rp.hasSubscribers,{status:n=R7()?{}:void 0}=r;r.status=n,n&&r.context&&(n.context=r.context);let a=this.#U(e,r);return n&&i&&(n.trace=!0,Rp.tracePromise(()=>a,n).catch(()=>{})),a}async#U(e,r={}){let i=await this.#G(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="memo",i.key=e,r.context&&(i.context=r.context),i.cache=this);let n=this.#X(e,r);return i&&(i.value=n),In.hasSubscribers&&In.publish(i),n}#X(e,r={}){let i=this.#g;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,status:a,forceRefresh:o,...s}=r;a&&o&&(a.forceRefresh=!0);let l=this.#W(e,s),u=o||l===void 0;if(a&&(a.memo=u?"miss":"hit",u||(a.value=l)),!u)return l;let d=i(e,l,{options:s,context:n});return a&&(a.value=d),this.#B(e,d,s),d}get(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="get",i.key=e,i.cache=this);let n=this.#W(e,r);return i&&(n!==void 0&&(i.value=n),In.hasSubscribers&&In.publish(i)),n}#W(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=r,s=this.#p.get(e);if(s===void 0){o&&(o.get="miss");return}let l=this.#o[s],u=this.#d(l);return o&&this.#j(o,s),this.#x(s)?u?(o&&(o.get="stale-fetching"),i&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(a||this.#F(e,"expire"),o&&(o.get="stale"),i?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?"fetching":"hit"),this.#K(s),n&&this.#A(s),u?l.__staleWhileFetching:l)}#J(e,r){this.#w[r]=e,this.#b[e]=r}#K(e){e!==this.#v&&(e===this.#m?this.#m=this.#b[e]:this.#J(this.#w[e],this.#b[e]),this.#J(this.#v,e),this.#v=e)}delete(e){return this.#F(e,"delete")}#F(e,r){In.hasSubscribers&&In.publish({op:"delete",delete:r,key:e,cache:this});let i=!1;if(this.#s!==0){let n=this.#p.get(e);if(n!==void 0)if(this.#h?.[n]&&(clearTimeout(this.#h?.[n]),this.#h[n]=void 0),i=!0,this.#s===1)this.#Y(r);else{this.#T(n);let a=this.#o[n];if(this.#d(a)?a.__abortController.abort(new Error("deleted")):(this.#E||this.#a)&&(this.#E&&this.#i?.(a,e,r),this.#a&&this.#y?.push([a,e,r])),this.#p.delete(e),this.#c[n]=void 0,this.#o[n]=void 0,n===this.#v)this.#v=this.#w[n];else if(n===this.#m)this.#m=this.#b[n];else{let o=this.#w[n];this.#b[o]=this.#b[n];let s=this.#b[n];this.#w[s]=this.#w[n]}this.#s--,this.#$.push(n)}}if(this.#a&&this.#y?.length){let n=this.#y,a;for(;a=n?.shift();)this.#n?.(...a)}return i}clear(){return this.#Y("delete")}#Y(e){for(let r of this.#O({allowStale:!0})){let i=this.#o[r];if(this.#d(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#c[r];this.#E&&this.#i?.(i,n,e),this.#a&&this.#y?.push([i,n,e])}}if(this.#p.clear(),this.#o.fill(void 0),this.#c.fill(void 0),this.#f&&this.#k){this.#f.fill(0),this.#k.fill(0);for(let r of this.#h??[])r!==void 0&&clearTimeout(r);this.#h?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#m=0,this.#v=0,this.#$.length=0,this.#u=0,this.#s=0,this.#a&&this.#y){let r=this.#y,i;for(;i=r?.shift();)this.#n?.(...i)}}}});import{EventEmitter as V7}from"node:events";import NB from"node:stream";import{StringDecoder as ehe}from"node:string_decoder";var OB,the,rhe,nhe,Oo,Po,Ps,hg,Mp,gg,PB,vg,IB,Ta,lc,_n,zp,cc,bn,ni,wn,F7,yg,Un,rn,L7,M7,jB,z7,to,U7,_g,Up,ku,Ri,qp,ihe,ahe,ohe,she,bg,q7,uhe,lhe,Is,Z7=et(()=>{OB=typeof process=="object"&&process?process:{stdout:null,stderr:null},the=t=>!!t&&typeof t=="object"&&(t instanceof Is||t instanceof NB||rhe(t)||nhe(t)),rhe=t=>!!t&&typeof t=="object"&&t instanceof V7&&typeof t.pipe=="function"&&t.pipe!==NB.Writable.prototype.pipe,nhe=t=>!!t&&typeof t=="object"&&t instanceof V7&&typeof t.write=="function"&&typeof t.end=="function",Oo=Symbol("EOF"),Po=Symbol("maybeEmitEnd"),Ps=Symbol("emittedEnd"),hg=Symbol("emittingEnd"),Mp=Symbol("emittedError"),gg=Symbol("closed"),PB=Symbol("read"),vg=Symbol("flush"),IB=Symbol("flushChunk"),Ta=Symbol("encoding"),lc=Symbol("decoder"),_n=Symbol("flowing"),zp=Symbol("paused"),cc=Symbol("resume"),bn=Symbol("buffer"),ni=Symbol("pipes"),wn=Symbol("bufferLength"),F7=Symbol("bufferPush"),yg=Symbol("bufferShift"),Un=Symbol("objectMode"),rn=Symbol("destroyed"),L7=Symbol("error"),M7=Symbol("emitData"),jB=Symbol("emitEnd"),z7=Symbol("emitEnd2"),to=Symbol("async"),U7=Symbol("abort"),_g=Symbol("aborted"),Up=Symbol("signal"),ku=Symbol("dataListeners"),Ri=Symbol("discarded"),qp=t=>Promise.resolve().then(t),ihe=t=>t(),ahe=t=>t==="end"||t==="finish"||t==="prefinish",ohe=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,she=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),bg=class{src;dest;opts;ondrain;constructor(e,r,i){this.src=e,this.dest=r,this.opts=i,this.ondrain=()=>e[cc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},q7=class extends bg{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,i){super(e,r,i),this.proxyErrors=n=>this.dest.emit("error",n),e.on("error",this.proxyErrors)}},uhe=t=>!!t.objectMode,lhe=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Is=class extends V7{[_n]=!1;[zp]=!1;[ni]=[];[bn]=[];[Un];[Ta];[to];[lc];[Oo]=!1;[Ps]=!1;[hg]=!1;[gg]=!1;[Mp]=null;[wn]=0;[rn]=!1;[Up];[_g]=!1;[ku]=0;[Ri]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");uhe(r)?(this[Un]=!0,this[Ta]=null):lhe(r)?(this[Ta]=r.encoding,this[Un]=!1):(this[Un]=!1,this[Ta]=null),this[to]=!!r.async,this[lc]=this[Ta]?new ehe(this[Ta]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[bn]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ni]});let{signal:i}=r;i&&(this[Up]=i,i.aborted?this[U7]():i.addEventListener("abort",()=>this[U7]()))}get bufferLength(){return this[wn]}get encoding(){return this[Ta]}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[Un]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[to]}set async(e){this[to]=this[to]||!!e}[U7](){this[_g]=!0,this.emit("abort",this[Up]?.reason),this.destroy(this[Up]?.reason)}get aborted(){return this[_g]}set aborted(e){}write(e,r,i){if(this[_g])return!1;if(this[Oo])throw new Error("write after end");if(this[rn])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(i=r,r="utf8"),r||(r="utf8");let n=this[to]?qp:ihe;if(!this[Un]&&!Buffer.isBuffer(e)){if(she(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ohe(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Un]?(this[_n]&&this[wn]!==0&&this[vg](!0),this[_n]?this.emit("data",e):this[F7](e),this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n]):e.length?(typeof e=="string"&&!(r===this[Ta]&&!this[lc]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Ta]&&(e=this[lc].write(e)),this[_n]&&this[wn]!==0&&this[vg](!0),this[_n]?this.emit("data",e):this[F7](e),this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n]):(this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n])}read(e){if(this[rn])return null;if(this[Ri]=!1,this[wn]===0||e===0||e&&e>this[wn])return this[Po](),null;this[Un]&&(e=null),this[bn].length>1&&!this[Un]&&(this[bn]=[this[Ta]?this[bn].join(""):Buffer.concat(this[bn],this[wn])]);let r=this[PB](e||null,this[bn][0]);return this[Po](),r}[PB](e,r){if(this[Un])this[yg]();else{let i=r;e===i.length||e===null?this[yg]():typeof i=="string"?(this[bn][0]=i.slice(e),r=i.slice(0,e),this[wn]-=e):(this[bn][0]=i.subarray(e),r=i.subarray(0,e),this[wn]-=e)}return this.emit("data",r),!this[bn].length&&!this[Oo]&&this.emit("drain"),r}end(e,r,i){return typeof e=="function"&&(i=e,e=void 0),typeof r=="function"&&(i=r,r="utf8"),e!==void 0&&this.write(e,r),i&&this.once("end",i),this[Oo]=!0,this.writable=!1,(this[_n]||!this[zp])&&this[Po](),this}[cc](){this[rn]||(!this[ku]&&!this[ni].length&&(this[Ri]=!0),this[zp]=!1,this[_n]=!0,this.emit("resume"),this[bn].length?this[vg]():this[Oo]?this[Po]():this.emit("drain"))}resume(){return this[cc]()}pause(){this[_n]=!1,this[zp]=!0,this[Ri]=!1}get destroyed(){return this[rn]}get flowing(){return this[_n]}get paused(){return this[zp]}[F7](e){this[Un]?this[wn]+=1:this[wn]+=e.length,this[bn].push(e)}[yg](){return this[Un]?this[wn]-=1:this[wn]-=this[bn][0].length,this[bn].shift()}[vg](e=!1){do;while(this[IB](this[yg]())&&this[bn].length);!e&&!this[bn].length&&!this[Oo]&&this.emit("drain")}[IB](e){return this.emit("data",e),this[_n]}pipe(e,r){if(this[rn])return e;this[Ri]=!1;let i=this[Ps];return r=r||{},e===OB.stdout||e===OB.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,i?r.end&&e.end():(this[ni].push(r.proxyErrors?new q7(this,e,r):new bg(this,e,r)),this[to]?qp(()=>this[cc]()):this[cc]()),e}unpipe(e){let r=this[ni].find(i=>i.dest===e);r&&(this[ni].length===1?(this[_n]&&this[ku]===0&&(this[_n]=!1),this[ni]=[]):this[ni].splice(this[ni].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let i=super.on(e,r);if(e==="data")this[Ri]=!1,this[ku]++,!this[ni].length&&!this[_n]&&this[cc]();else if(e==="readable"&&this[wn]!==0)super.emit("readable");else if(ahe(e)&&this[Ps])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Mp]){let n=r;this[to]?qp(()=>n.call(this,this[Mp])):n.call(this,this[Mp])}return i}removeListener(e,r){return this.off(e,r)}off(e,r){let i=super.off(e,r);return e==="data"&&(this[ku]=this.listeners("data").length,this[ku]===0&&!this[Ri]&&!this[ni].length&&(this[_n]=!1)),i}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ku]=0,!this[Ri]&&!this[ni].length&&(this[_n]=!1)),r}get emittedEnd(){return this[Ps]}[Po](){!this[hg]&&!this[Ps]&&!this[rn]&&this[bn].length===0&&this[Oo]&&(this[hg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[gg]&&this.emit("close"),this[hg]=!1)}emit(e,...r){let i=r[0];if(e!=="error"&&e!=="close"&&e!==rn&&this[rn])return!1;if(e==="data")return!this[Un]&&!i?!1:this[to]?(qp(()=>this[M7](i)),!0):this[M7](i);if(e==="end")return this[jB]();if(e==="close"){if(this[gg]=!0,!this[Ps]&&!this[rn])return!1;let a=super.emit("close");return this.removeAllListeners("close"),a}else if(e==="error"){this[Mp]=i,super.emit(L7,i);let a=!this[Up]||this.listeners("error").length?super.emit("error",i):!1;return this[Po](),a}else if(e==="resume"){let a=super.emit("resume");return this[Po](),a}else if(e==="finish"||e==="prefinish"){let a=super.emit(e);return this.removeAllListeners(e),a}let n=super.emit(e,...r);return this[Po](),n}[M7](e){for(let i of this[ni])i.dest.write(e)===!1&&this.pause();let r=this[Ri]?!1:super.emit("data",e);return this[Po](),r}[jB](){return this[Ps]?!1:(this[Ps]=!0,this.readable=!1,this[to]?(qp(()=>this[z7]()),!0):this[z7]())}[z7](){if(this[lc]){let r=this[lc].end();if(r){for(let i of this[ni])i.dest.write(r);this[Ri]||super.emit("data",r)}}for(let r of this[ni])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Un]||(e.dataLength=0);let r=this.promise();return this.on("data",i=>{e.push(i),this[Un]||(e.dataLength+=i.length)}),await r,e}async concat(){if(this[Un])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ta]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(rn,()=>r(new Error("stream destroyed"))),this.on("error",i=>r(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Ri]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[Oo])return r();let a,o,s=c=>{this.off("data",l),this.off("end",u),this.off(rn,d),r(),o(c)},l=c=>{this.off("error",s),this.off("end",u),this.off(rn,d),this.pause(),a({value:c,done:!!this[Oo]})},u=()=>{this.off("error",s),this.off("data",l),this.off(rn,d),r(),a({done:!0,value:void 0})},d=()=>s(new Error("stream destroyed"));return new Promise((c,p)=>{o=p,a=c,this.once(rn,d),this.once("error",s),this.once("end",u),this.once("data",l)})},throw:r,return:r,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[Ri]=!1;let e=!1,r=()=>(this.pause(),this.off(L7,r),this.off(rn,r),this.off("end",r),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return r();let n=this.read();return n===null?r():{done:!1,value:n}};return this.once("end",r),this.once(L7,r),this.once(rn,r),{next:i,throw:r,return:r,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[rn])return e?this.emit("error",e):this.emit(rn),this;this[rn]=!0,this[Ri]=!0,this[bn].length=0,this[wn]=0;let r=this;return typeof r.close=="function"&&!this[gg]&&r.close(),e?this.emit("error",e):this.emit(rn),this}static get isStream(){return the}}});import{posix as che,win32 as K7}from"node:path";import{fileURLToPath as dhe}from"node:url";import{lstatSync as phe,readdir as fhe,readdirSync as mhe,readlinkSync as hhe,realpathSync as ghe}from"fs";import*as vhe from"node:fs";import{lstat as _he,readdir as bhe,readlink as whe,realpath as Ehe}from"node:fs/promises";var yhe,Zp,LB,MB,She,$he,ua,zB,UB,ro,qB,VB,xu,ZB,sa,Vp,G7,TB,Gp,Ba,wg,Sg,BB,khe,W7,RB,Wp,FB,Eg,$g,H7,GB,qn,kg,xg,Ag,dc,pc,Kp,RIe,WB,KB=et(()=>{CB();Z7();yhe=ghe.native,Zp={lstatSync:phe,readdir:fhe,readdirSync:mhe,readlinkSync:hhe,realpathSync:yhe,promises:{lstat:_he,readdir:bhe,readlink:whe,realpath:Ehe}},LB=t=>!t||t===Zp||t===vhe?Zp:{...Zp,...t,promises:{...Zp.promises,...t.promises||{}}},MB=/^\\\\\?\\([a-z]:)\\?$/i,She=t=>t.replace(/\//g,"\\").replace(MB,"$1\\"),$he=/[\\\/]/,ua=0,zB=1,UB=2,ro=4,qB=6,VB=8,xu=10,ZB=12,sa=15,Vp=~sa,G7=16,TB=32,Gp=64,Ba=128,wg=256,Sg=512,BB=Gp|Ba|Sg,khe=1023,W7=t=>t.isFile()?VB:t.isDirectory()?ro:t.isSymbolicLink()?xu:t.isCharacterDevice()?UB:t.isBlockDevice()?qB:t.isSocket()?ZB:t.isFIFO()?zB:ua,RB=new Lp({max:2**12}),Wp=t=>{let e=RB.get(t);if(e)return e;let r=t.normalize("NFKD");return RB.set(t,r),r},FB=new Lp({max:2**12}),Eg=t=>{let e=FB.get(t);if(e)return e;let r=Wp(t.toLowerCase());return FB.set(t,r),r},$g=class extends Lp{constructor(){super({max:256})}},H7=class extends Lp{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},GB=Symbol("PathScurry setAsCwd"),qn=class{name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#i;get mode(){return this.#i}#e;get nlink(){return this.#e}#n;get uid(){return this.#n}#_;get gid(){return this.#_}#g;get rdev(){return this.#g}#l;get blksize(){return this.#l}#s;get ino(){return this.#s}#u;get size(){return this.#u}#p;get blocks(){return this.#p}#c;get atimeMs(){return this.#c}#o;get mtimeMs(){return this.#o}#b;get ctimeMs(){return this.#b}#w;get birthtimeMs(){return this.#w}#m;get atime(){return this.#m}#v;get mtime(){return this.#v}#$;get ctime(){return this.#$}#y;get birthtime(){return this.#y}#S;#k;#f;#h;#E;#D;#a;#P;#I;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=ua,i,n,a,o,s){this.name=e,this.#S=a?Eg(e):Wp(e),this.#a=r&khe,this.nocase=a,this.roots=n,this.root=i||this,this.#P=o,this.#f=s.fullpath,this.#E=s.relative,this.#D=s.relativePosix,this.parent=s.parent,this.parent?this.#t=this.parent.#t:this.#t=LB(s.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#P}resolve(e){if(!e)return this;let r=this.getRootString(e),n=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#j(n):this.#j(n)}#j(e){let r=this;for(let i of e)r=r.child(i);return r}children(){let e=this.#P.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#P.set(this,r),this.#a&=~G7,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),n=this.nocase?Eg(e):Wp(e);for(let l of i)if(l.#S===n)return l;let a=this.parent?this.sep:"",o=this.#f?this.#f+a+e:void 0,s=this.newChild(e,ua,{...r,parent:this,fullpath:o});return this.canReaddir()||(s.#a|=Ba),i.push(s),s}relative(){if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let e=this.name,r=this.parent;if(!r)return this.#E=this.name;let i=r.relative();return i+(!i||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let e=this.name,r=this.parent;if(!r)return this.#D=this.fullpathPosix();let i=r.relativePosix();return i+(!i||!r.parent?"":"/")+e}fullpath(){if(this.#f!==void 0)return this.#f;let e=this.name,r=this.parent;if(!r)return this.#f=this.name;let n=r.fullpath()+(r.parent?this.sep:"")+e;return this.#f=n}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let n=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(n)?this.#h=`//?/${n}`:this.#h=n}let e=this.parent,r=e.fullpathPosix(),i=r+(!r||!e.parent?"":"/")+this.name;return this.#h=i}isUnknown(){return(this.#a&sa)===ua}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.#a&sa)===VB}isDirectory(){return(this.#a&sa)===ro}isCharacterDevice(){return(this.#a&sa)===UB}isBlockDevice(){return(this.#a&sa)===qB}isFIFO(){return(this.#a&sa)===zB}isSocket(){return(this.#a&sa)===ZB}isSymbolicLink(){return(this.#a&xu)===xu}lstatCached(){return this.#a&TB?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#A}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let e=this.#a&sa;return!(e!==ua&&e!==xu||this.#a&wg||this.#a&Ba)}calledReaddir(){return!!(this.#a&G7)}isENOENT(){return!!(this.#a&Ba)}isNamed(e){return this.nocase?this.#S===Eg(e):this.#S===Wp(e)}async readlink(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(r);if(i)return this.#I=i}catch(r){this.#O(r.code);return}}readlinkSync(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(r);if(i)return this.#I=i}catch(r){this.#O(r.code);return}}#L(e){this.#a|=G7;for(let r=e.provisional;r<e.length;r++){let i=e[r];i&&i.#x()}}#x(){this.#a&Ba||(this.#a=(this.#a|Ba)&Vp,this.#V())}#V(){let e=this.children();e.provisional=0;for(let r of e)r.#x()}#T(){this.#a|=Sg,this.#N()}#N(){if(this.#a&Gp)return;let e=this.#a;(e&sa)===ro&&(e&=Vp),this.#a=e|Gp,this.#V()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#N():e==="ENOENT"?this.#x():this.children().provisional=0}#C(e=""){e==="ENOTDIR"?this.parent.#N():e==="ENOENT"&&this.#x()}#O(e=""){let r=this.#a;r|=wg,e==="ENOENT"&&(r|=Ba),(e==="EINVAL"||e==="UNKNOWN")&&(r&=Vp),this.#a=r,e==="ENOTDIR"&&this.parent&&this.parent.#N()}#z(e,r){return this.#q(e,r)||this.#B(e,r)}#B(e,r){let i=W7(e),n=this.newChild(e.name,i,{parent:this}),a=n.#a&sa;return a!==ro&&a!==xu&&a!==ua&&(n.#a|=Gp),r.unshift(n),r.provisional++,n}#q(e,r){for(let i=r.provisional;i<r.length;i++){let n=r[i];if((this.nocase?Eg(e.name):Wp(e.name))===n.#S)return this.#H(e,n,i,r)}}#H(e,r,i,n){let a=r.name;return r.#a=r.#a&Vp|W7(e),a!==e.name&&(r.name=e.name),i!==n.provisional&&(i===n.length-1?n.pop():n.splice(i,1),n.unshift(r)),n.provisional++,r}async lstat(){if((this.#a&Ba)===0)try{return this.#Z(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#C(e.code)}}lstatSync(){if((this.#a&Ba)===0)try{return this.#Z(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#C(e.code)}}#Z(e){let{atime:r,atimeMs:i,birthtime:n,birthtimeMs:a,blksize:o,blocks:s,ctime:l,ctimeMs:u,dev:d,gid:c,ino:p,mode:f,mtime:m,mtimeMs:h,nlink:g,rdev:y,size:_,uid:w}=e;this.#m=r,this.#c=i,this.#y=n,this.#w=a,this.#l=o,this.#p=s,this.#$=l,this.#b=u,this.#r=d,this.#_=c,this.#s=p,this.#i=f,this.#v=m,this.#o=h,this.#e=g,this.#g=y,this.#u=_,this.#n=w;let E=W7(e);this.#a=this.#a&Vp|E|TB,E!==ua&&E!==ro&&E!==xu&&(this.#a|=Gp)}#R=[];#d=!1;#G(e){this.#d=!1;let r=this.#R.slice();this.#R.length=0,r.forEach(i=>i(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let a=i.slice(0,i.provisional);r?e(null,a):queueMicrotask(()=>e(null,a));return}if(this.#R.push(e),this.#d)return;this.#d=!0;let n=this.fullpath();this.#t.readdir(n,{withFileTypes:!0},(a,o)=>{if(a)this.#M(a.code),i.provisional=0;else{for(let s of o)this.#z(s,i);this.#L(i)}this.#G(i.slice(0,i.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let i=()=>{};this.#U=new Promise(n=>i=n);try{for(let n of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#z(n,e);this.#L(e)}catch(n){this.#M(n.code),e.provisional=0}this.#U=void 0,i()}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 r=this.fullpath();try{for(let i of this.#t.readdirSync(r,{withFileTypes:!0}))this.#z(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&BB)return!1;let e=sa&this.#a;return e===ua||e===ro||e===xu}shouldWalk(e,r){return(this.#a&ro)===ro&&!(this.#a&BB)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#A)return this.#A;if(!((Sg|wg|Ba)&this.#a))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#A=this.resolve(e)}catch{this.#T()}}realpathSync(){if(this.#A)return this.#A;if(!((Sg|wg|Ba)&this.#a))try{let e=this.#t.realpathSync(this.fullpath());return this.#A=this.resolve(e)}catch{this.#T()}}[GB](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),i=[],n=this;for(;n&&n.parent;)r.add(n),n.#E=i.join(this.sep),n.#D=i.join("/"),n=n.parent,i.push("..");for(n=e;n&&n.parent&&!r.has(n);)n.#E=void 0,n.#D=void 0,n=n.parent}},kg=class t extends qn{sep="\\";splitSep=$he;constructor(e,r=ua,i,n,a,o,s){super(e,r,i,n,a,o,s)}newChild(e,r=ua,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return K7.parse(e).root}getRoot(e){if(e=She(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=i;return this.roots[e]=new dc(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(MB,"$1\\"),e===r}},xg=class t extends qn{splitSep="/";sep="/";constructor(e,r=ua,i,n,a,o,s){super(e,r,i,n,a,o,s)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=ua,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Ag=class{root;rootPath;roots;cwd;#t;#r;#i;nocase;#e;constructor(e=process.cwd(),r,i,{nocase:n,childrenCacheSize:a=16*1024,fs:o=Zp}={}){this.#e=LB(o),(e instanceof URL||e.startsWith("file://"))&&(e=dhe(e));let s=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(s),this.#t=new $g,this.#r=new $g,this.#i=new H7(a);let l=s.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),n===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=n,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,d=l.length-1,c=r.sep,p=this.rootPath,f=!1;for(let m of l){let h=d--;u=u.child(m,{relative:new Array(h).fill("..").join(c),relativePosix:new Array(h).fill("..").join("/"),fullpath:p+=(f?"":c)+m}),f=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#i}resolve(...e){let r="";for(let a=e.length-1;a>=0;a--){let o=e[a];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let i=this.#t.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpath();return this.#t.set(r,n),n}resolvePosix(...e){let r="";for(let a=e.length-1;a>=0;a--){let o=e[a];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let i=this.#r.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,n),n}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,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i}=r;if(e.canReaddir()){let n=await e.readdir();return i?n:n.map(a=>a.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0}=r;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(n=>n.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:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=await e.readlink();return r?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return r?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=await e.realpath();return r?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return r?i:i?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=[];(!a||a(e))&&s.push(i?e:e.fullpath());let l=new Set,u=(c,p)=>{l.add(c),c.readdirCB((f,m)=>{if(f)return p(f);let h=m.length;if(!h)return p();let g=()=>{--h===0&&p()};for(let y of m)(!a||a(y))&&s.push(i?y:y.fullpath()),n&&y.isSymbolicLink()?y.realpath().then(_=>_?.isUnknown()?_.lstat():_).then(_=>_?.shouldWalk(l,o)?u(_,g):g()):y.shouldWalk(l,o)?u(y,g):g()},!0)},d=e;return new Promise((c,p)=>{u(d,f=>{if(f)return p(f);c(s)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=[];(!a||a(e))&&s.push(i?e:e.fullpath());let l=new Set([e]);for(let u of l){let d=u.readdirSync();for(let c of d){(!a||a(c))&&s.push(i?c:c.fullpath());let p=c;if(c.isSymbolicLink()){if(!(n&&(p=c.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return s}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r;(!a||a(e))&&(yield i?e:e.fullpath());let s=new Set([e]);for(let l of s){let u=l.readdirSync();for(let d of u){(!a||a(d))&&(yield i?d:d.fullpath());let c=d;if(d.isSymbolicLink()){if(!(n&&(c=d.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(s,o)&&s.add(c)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=new Is({objectMode:!0});(!a||a(e))&&s.write(i?e:e.fullpath());let l=new Set,u=[e],d=0,c=()=>{let p=!1;for(;!p;){let f=u.shift();if(!f){d===0&&s.end();return}d++,l.add(f);let m=(g,y,_=!1)=>{if(g)return s.emit("error",g);if(n&&!_){let w=[];for(let E of y)E.isSymbolicLink()&&w.push(E.realpath().then(D=>D?.isUnknown()?D.lstat():D));if(w.length){Promise.all(w).then(()=>m(null,y,!0));return}}for(let w of y)w&&(!a||a(w))&&(s.write(i?w:w.fullpath())||(p=!0));d--;for(let w of y){let E=w.realpathCached()||w;E.shouldWalk(l,o)&&u.push(E)}p&&!s.flowing?s.once("drain",c):h||c()},h=!0;f.readdirCB(m,!0),h=!1}};return c(),s}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=new Is({objectMode:!0}),l=new Set;(!a||a(e))&&s.write(i?e:e.fullpath());let u=[e],d=0,c=()=>{let p=!1;for(;!p;){let f=u.shift();if(!f){d===0&&s.end();return}d++,l.add(f);let m=f.readdirSync();for(let h of m)(!a||a(h))&&(s.write(i?h:h.fullpath())||(p=!0));d--;for(let h of m){let g=h;if(h.isSymbolicLink()){if(!(n&&(g=h.realpathSync())))continue;g.isUnknown()&&g.lstatSync()}g.shouldWalk(l,o)&&u.push(g)}}p&&!s.flowing&&s.once("drain",c)};return c(),s}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[GB](r)}},dc=class extends Ag{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,K7,"\\",{...r,nocase:i}),this.nocase=i;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return K7.parse(e).root.toUpperCase()}newRoot(e){return new kg(this.rootPath,ro,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},pc=class extends Ag{sep="/";constructor(e=process.cwd(),r={}){let{nocase:i=!1}=r;super(e,che,"/",{...r,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new xg(this.rootPath,ro,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Kp=class extends pc{constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,{...r,nocase:i})}},RIe=process.platform==="win32"?kg:xg,WB=process.platform==="win32"?dc:process.platform==="darwin"?Kp:pc});var xhe,Ahe,fc,J7=et(()=>{Co();xhe=t=>t.length>=1,Ahe=t=>t.length>=1,fc=class t{#t;#r;#i;length;#e;#n;#_;#g;#l;#s;#u=!0;constructor(e,r,i,n){if(!xhe(e))throw new TypeError("empty pattern list");if(!Ahe(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#r=r,this.#i=i,this.#e=n,this.#i===0){if(this.isUNC()){let[a,o,s,l,...u]=this.#t,[d,c,p,f,...m]=this.#r;u[0]===""&&(u.shift(),m.shift());let h=[a,o,s,l,""].join("/"),g=[d,c,p,f,""].join("/");this.#t=[h,...u],this.#r=[g,...m],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[a,...o]=this.#t,[s,...l]=this.#r;o[0]===""&&(o.shift(),l.shift());let u=a+"/",d=s+"/";this.#t=[u,...o],this.#r=[d,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#i]}isString(){return typeof this.#t[this.#i]=="string"}isGlobstar(){return this.#t[this.#i]===tn}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#_=this.#_||(this.#i===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new t(this.#t,this.#r,this.#i+1,this.#e),this.#n.#s=this.#s,this.#n.#l=this.#l,this.#n.#g=this.#g,this.#n):this.#n=null}isUNC(){let e=this.#t;return this.#l!==void 0?this.#l:this.#l=this.#e==="win32"&&this.#i===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#g!==void 0?this.#g:this.#g=this.#e==="win32"&&this.#i===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#i===0?e:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#u?!1:(this.#u=!1,!0)}}});var Dhe,Au,Y7=et(()=>{Co();J7();Dhe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Au=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:i,noext:n,noglobstar:a,platform:o=Dhe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:i,noext:n,noglobstar:a,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let s of e)this.add(s)}add(e){let r=new Bi(e,this.mmopts);for(let i=0;i<r.set.length;i++){let n=r.set[i],a=r.globParts[i];if(!n||!a)throw new Error("invalid pattern object");for(;n[0]==="."&&a[0]===".";)n.shift(),a.shift();let o=new fc(n,a,0,this.platform),s=new Bi(o.globString(),this.mmopts),l=a[a.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(s):this.relative.push(s),l&&(u?this.absoluteChildren.push(s):this.relativeChildren.push(s))}}ignored(e){let r=e.fullpath(),i=`${r}/`,n=e.relative()||".",a=`${n}/`;for(let o of this.relative)if(o.match(n)||o.match(a))return!0;for(let o of this.absolute)if(o.match(r)||o.match(i))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let n of this.relativeChildren)if(n.match(i))return!0;for(let n of this.absoluteChildren)if(n.match(r))return!0;return!1}}});var X7,Q7,ew,Hp,HB=et(()=>{Co();X7=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let i=e.fullpath(),n=this.store.get(i);n?n.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Q7=class{store=new Map;add(e,r,i){let n=(r?2:0)|(i?1:0),a=this.store.get(e);this.store.set(e,a===void 0?n:n&a)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},ew=class{store=new Map;add(e,r){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(n=>n.globString()===r.globString())||i.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Hp=class t{hasWalkedCache;matches=new Q7;subwalks=new ew;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new X7}processPatterns(e,r){this.patterns=r;let i=r.map(n=>[e,n]);for(let[n,a]of i){this.hasWalkedCache.storeWalked(n,a);let o=a.root(),s=a.isAbsolute()&&this.opts.absolute!==!1;if(o){n=n.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let c=a.rest();if(c)a=c;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let l,u,d=!1;for(;typeof(l=a.pattern())=="string"&&(u=a.rest());)n=n.resolve(l),a=u,d=!0;if(l=a.pattern(),u=a.rest(),d){if(this.hasWalkedCache.hasWalked(n,a))continue;this.hasWalkedCache.storeWalked(n,a)}if(typeof l=="string"){let c=l===".."||l===""||l===".";this.matches.add(n.resolve(l),s,c);continue}else if(l===tn){(!n.isSymbolicLink()||this.follow||a.checkFollowGlobstar())&&this.subwalks.add(n,a);let c=u?.pattern(),p=u?.rest();if(!u||(c===""||c===".")&&!p)this.matches.add(n,s,c===""||c===".");else if(c===".."){let f=n.parent||n;p?this.hasWalkedCache.hasWalked(f,p)||this.subwalks.add(f,p):this.matches.add(f,s,!0)}}else l instanceof RegExp&&this.subwalks.add(n,a)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let i=this.subwalks.get(e),n=this.child();for(let a of r)for(let o of i){let s=o.isAbsolute(),l=o.pattern(),u=o.rest();l===tn?n.testGlobstar(a,o,u,s):l instanceof RegExp?n.testRegExp(a,l,u,s):n.testString(a,l,u,s)}return n}testGlobstar(e,r,i,n){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,n,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(e,i):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),i){let a=i.pattern();if(typeof a=="string"&&a!==".."&&a!==""&&a!==".")this.testString(e,a,i.rest(),n);else if(a===".."){let o=e.parent||e;this.subwalks.add(o,i)}else a instanceof RegExp&&this.testRegExp(e,a,i.rest(),n)}}testRegExp(e,r,i,n){r.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}testString(e,r,i,n){e.isNamed(r)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}}});var Che,Dg,Jp,Yp,JB=et(()=>{Z7();Y7();HB();Che=(t,e)=>typeof t=="string"?new Au([t],e):Array.isArray(t)?new Au(t,e):t,Dg=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#i;signal;maxDepth;includeChildMatches;constructor(e,r,i){if(this.patterns=e,this.path=r,this.opts=i,this.#i=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#r=Che(i.ignore??[],i),!this.includeChildMatches&&typeof this.#r.add!="function")){let n="cannot ignore child matches, ignore lacks add() method.";throw new Error(n)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#n(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,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}let a=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let o=await a.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(a,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||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,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}let a=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let o=a.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(a,r)}matchFinish(e,r){if(this.#e(e))return;if(!this.includeChildMatches&&this.#r?.add){let a=`${e.relativePosix()}/**`;this.#r.add(a)}let i=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let n=this.opts.mark&&e.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let a=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(a+n)}else{let a=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!a.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(a?o+a+n:"."+n)}}async match(e,r,i){let n=await this.matchCheck(e,i);n&&this.matchFinish(n,r)}matchSync(e,r,i){let n=this.matchCheckSync(e,i);n&&this.matchFinish(n,r)}walkCB(e,r,i){this.signal?.aborted&&i(),this.walkCB2(e,r,new Hp(this.opts),i)}walkCB2(e,r,i,n){if(this.#n(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2(e,r,i,n));return}i.processPatterns(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||(a++,this.match(s,l,u).then(()=>o()));for(let s of i.subwalkTargets()){if(this.maxDepth!==1/0&&s.depth()>=this.maxDepth)continue;a++;let l=s.readdirCached();s.calledReaddir()?this.walkCB3(s,l,i,o):s.readdirCB((u,d)=>this.walkCB3(s,d,i,o),!0)}o()}walkCB3(e,r,i,n){i=i.filterEntries(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||(a++,this.match(s,l,u).then(()=>o()));for(let[s,l]of i.subwalks.entries())a++,this.walkCB2(s,l,i.child(),o);o()}walkCBSync(e,r,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,r,new Hp(this.opts),i)}walkCB2Sync(e,r,i,n){if(this.#n(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,i,n));return}i.processPatterns(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||this.matchSync(s,l,u);for(let s of i.subwalkTargets()){if(this.maxDepth!==1/0&&s.depth()>=this.maxDepth)continue;a++;let l=s.readdirSync();this.walkCB3Sync(s,l,i,o)}o()}walkCB3Sync(e,r,i,n){i=i.filterEntries(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||this.matchSync(s,l,u);for(let[s,l]of i.subwalks.entries())a++,this.walkCB2Sync(s,l,i.child(),o);o()}},Jp=class extends Dg{matches=new Set;constructor(e,r,i){super(e,r,i)}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,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(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}},Yp=class extends Dg{results;constructor(e,r,i){super(e,r,i),this.results=new Is({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}}});import{fileURLToPath as Ohe}from"node:url";var Phe,la,tw=et(()=>{Co();KB();J7();JB();Phe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",la=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=Ohe(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=r.platform||Phe,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?dc:r.platform==="darwin"?Kp:r.platform?pc:WB;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",n={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},a=this.pattern.map(l=>new Bi(l,n)),[o,s]=a.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let d=s[u];if(!d)throw new Error("invalid pattern object");return new fc(l,d,0,this.platform)})}async walk(){return[...await new Jp(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 Jp(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 Yp(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 Yp(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 Cg,rw=et(()=>{Co();Cg=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new Bi(r,e).hasMagic())return!0;return!1}});var sw={};Cn(sw,{Glob:()=>la,Ignore:()=>Au,escape:()=>$u,glob:()=>nw,globIterate:()=>ow,globIterateSync:()=>Qp,globStream:()=>iw,globStreamSync:()=>Xp,globSync:()=>aw,hasMagic:()=>Cg,iterate:()=>tR,iterateSync:()=>eR,stream:()=>QB,streamSync:()=>XB,sync:()=>rR,unescape:()=>aa});function Xp(t,e={}){return new la(t,e).streamSync()}function iw(t,e={}){return new la(t,e).stream()}function aw(t,e={}){return new la(t,e).walkSync()}async function YB(t,e={}){return new la(t,e).walk()}function Qp(t,e={}){return new la(t,e).iterateSync()}function ow(t,e={}){return new la(t,e).iterate()}var XB,QB,eR,tR,rR,nw,uw=et(()=>{Co();tw();rw();Co();tw();rw();Y7();XB=Xp,QB=Object.assign(iw,{sync:Xp}),eR=Qp,tR=Object.assign(ow,{sync:Qp}),rR=Object.assign(aw,{stream:Xp,iterate:Qp}),nw=Object.assign(YB,{glob:YB,globSync:aw,sync:rR,globStream:iw,stream:QB,globStreamSync:Xp,streamSync:XB,globIterate:ow,iterate:tR,globIterateSync:Qp,iterateSync:eR,Glob:la,hasMagic:Cg,escape:$u,unescape:aa});nw.glob=nw});var mc,cw=et(()=>{"use strict";mc={version:1,system:{id:"artifact-contracts",name:"Artifact Contracts Agent System",default_workflow_order:["artifact-audit","discover"]},agents:{"artifact-discovery-agent":{role_name:"Artifact Discovery Agent",purpose:"Analyzes project file structure to generate or update artifact-contracts.yaml definitions. Identifies logical artifact groups, assigns appropriate types and authorities, designs path patterns, and detects trace link relationships between artifacts.",mode:"read-only",can_read_artifacts:["repository-files","artifact-definitions"],can_write_artifacts:[],can_execute_tools:["artifact-contracts-cli"],can_return_handoffs:["artifact-discovery-result"],can_invoke_agents:[],can_perform_validations:[],responsibilities:["Analyze project file structure and group files into logical artifacts","Assign appropriate type and authority to each artifact","Design path_patterns and exclude_patterns for each artifact","Detect trace link relationships between artifacts","Generate valid artifact-contracts.yaml content"],constraints:["Generated YAML must conform to artifact-contracts schema","Must use kebab-case for artifact IDs","Must not create overly broad path_patterns","In update mode, must preserve existing artifact definitions"],anti_patterns:["Creating one artifact per file instead of logical groupings",'Using overly broad patterns like "**/*"',"Ignoring existing project conventions"]},"artifact-quality-reviewer":{role_name:"Artifact Quality Reviewer",purpose:"Performs semantic quality review of artifact-contracts definitions. Analyzes naming consistency, authority appropriateness, path_patterns coverage, and manual_edit/change_control correctness. Reports structured findings for human or agent consumption.",mode:"read-only",can_read_artifacts:["artifact-definitions","artifact-config"],can_write_artifacts:[],can_execute_tools:["artifact-contracts-cli"],can_return_handoffs:["artifact-audit-result"],can_invoke_agents:[],can_perform_validations:["artifact-audit-validation"],responsibilities:["Analyze artifact definitions for naming consistency and conventions","Check authority assignments against artifact types","Identify common file types missing from the registry","Detect potential path_patterns gaps or issues","Recommend appropriate manual_edit and change_control settings"],constraints:["Never modify artifact definitions or config directly","Base analysis on resolved definitions and loaded config context only","Report findings in the artifact-audit-result handoff schema"],anti_patterns:["Generating overly broad path_patterns","Suggesting authority changes without clear justification"]}},tasks:{"discover-artifact-definitions":{description:"Analyze project file structure and generate artifact-contracts.yaml definitions. In init mode, create new definitions from scratch. In update mode, propose additions for uncovered files while preserving existing definitions.",target_agent:"artifact-discovery-agent",model_class:"standard",invocation_handoff:"artifact-discovery-request",result_handoff:"artifact-discovery-result",input_artifacts:["repository-files","artifact-definitions"],workflow:"discover",execution_steps:[{id:"gather-file-tree",action:"Gather repository file tree and project metadata",reads_artifact:"repository-files",required:!0},{id:"load-existing",action:"Load existing artifact-contracts.yaml if present",reads_artifact:"artifact-definitions",required:!1},{id:"classify-artifacts",action:"Group files into logical artifacts with type and authority",required:!0},{id:"detect-trace-links",action:"Identify trace link relationships between artifacts",required:!0},{id:"generate-yaml",action:"Produce artifact-contracts.yaml content",required:!0}]},"audit-artifact-definitions":{description:"Perform a semantic audit of artifact-contracts definitions. Analyze naming conventions, authority assignments, path coverage, and structural quality. Report findings in the artifact-audit-result handoff schema.",target_agent:"artifact-quality-reviewer",model_class:"standard",invocation_handoff:"artifact-audit-request",result_handoff:"artifact-audit-result",input_artifacts:["artifact-definitions","artifact-config"],workflow:"artifact-audit",validations:["artifact-audit-validation"],execution_steps:[{id:"load-definitions",action:"Load and resolve artifact-contracts definitions",reads_artifact:"artifact-definitions",uses_tool:"artifact-contracts-cli",required:!0},{id:"load-config",action:"Load artifact-config for authority and change_control context",reads_artifact:"artifact-config",uses_tool:"artifact-contracts-cli",required:!1},{id:"analyze-quality",action:"Analyze definitions for quality issues",required:!0},{id:"produce-report",action:"Produce audit findings in artifact-audit-result format",required:!0}]}},artifacts:{"cli-contract-definition":{type:"config",description:"CLI Contracts DSL definition",authority:"canonical",change_control:"approval-required",path_patterns:["cli-contract.yaml"]},"generated-cli":{type:"generated-code",description:"Auto-generated CLI scaffolding from cli-contracts",authority:"generated",path_patterns:["src/generated/**/*.ts"],exclude_patterns:["src/generated/dsl/**"]},"generated-dsl":{type:"generated-code",description:"Auto-generated DSL registries from agent-contracts-runtime",authority:"generated",path_patterns:["src/generated/dsl/**/*.ts"]},"core-library":{type:"source",description:"Core schema, resolver, matcher, lookup implementation",authority:"canonical",path_patterns:["src/core/**/*.ts"],exclude_patterns:["src/core/__tests__/**"]},"cli-handlers":{type:"source",description:"CLI command handler implementations",authority:"canonical",path_patterns:["src/cli/**/*.ts"],exclude_patterns:["src/cli/index.ts","src/cli/__tests__/**"]},"cli-entry":{type:"source",description:"CLI entry point and handler wiring",authority:"canonical",path_patterns:["src/cli/index.ts"]},"agent-integration":{type:"source",description:"LLM agent orchestration and adapter integration",authority:"canonical",path_patterns:["src/agents/**/*.ts"],exclude_patterns:["src/agents/__tests__/**"]},"agent-dsl":{type:"config",description:"Agent-contracts DSL definitions",authority:"canonical",change_control:"approval-required",path_patterns:["dsl/**/*.yaml"]},"generated-documentation":{type:"generated-doc",description:"Generated documentation",authority:"derived",path_patterns:["docs/**/*.md"]},"test-suite":{type:"source",description:"Unit and integration test files",authority:"canonical",path_patterns:["src/**/__tests__/**/*.ts","src/**/*.test.ts","src/**/*.spec.ts"]},"artifact-definitions":{type:"config",description:"artifact-contracts.yaml definitions (audit target, path supplied at runtime)",states:["valid","invalid"]},"artifact-config":{type:"config",description:"artifact-contracts.config.yaml processing settings (optional audit target)",states:["present","absent"]}},tools:{"artifact-contracts-cli":{kind:"cli",description:"artifact-contracts CLI \u2014 validate, resolve, list, and explain artifact definitions.",input_artifacts:["artifact-definitions","artifact-config"],output_artifacts:[],invokable_by:["artifact-quality-reviewer"],side_effects:[],commands:[{command:"npx artifact-contracts validate",category:"verification",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Schema validation and overlap detection"},{command:"npx artifact-contracts resolve",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Output resolved definitions with defaults applied"},{command:"npx artifact-contracts list",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"List registered artifacts"},{command:"npx artifact-contracts explain",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Explain artifact properties for a file path"}]}},validations:{"artifact-audit-validation":{target_artifact:"artifact-definitions",kind:"semantic",executor_type:"agent",executor:"artifact-quality-reviewer",blocking:!1,description:"Semantic validation of artifact definitions quality, naming consistency, and coverage completeness.","x-scope":{agents:["artifact-quality-reviewer"],tasks:["audit-artifact-definitions"]},"x-rules":[{id:"schema-conformance",check:"output matches artifact-audit-result JSON Schema (version 1)",severity:"critical"},{id:"findings-non-empty-on-risk",check:'findings[] is non-empty when risk_level is not "none"',severity:"error"},{id:"recommended-actions-present",check:'recommended_actions[] contains at least one entry when risk_level >= "medium"',severity:"warning"},{id:"finding-ids-unique",check:"all finding id values within findings[] are unique",severity:"error"}]}},handoff_types:{"artifact-discovery-request":{version:1,schema:{type:"object",properties:{mode:{type:"string",enum:["init","update"],description:"Whether creating new or updating existing definitions"},file_tree:{type:"string",description:"Repository file listing"},existing_definitions:{type:"string",description:"Current artifact-contracts.yaml content (update mode)"},project_metadata:{type:"string",description:"Package.json and other project metadata"}},required:["mode","file_tree"]}},"artifact-discovery-result":{version:1,schema:{type:"object",properties:{artifact_contracts_yaml:{type:"string",description:"Generated YAML content for artifact-contracts.yaml"},decisions:{type:"array",items:{type:"object",properties:{artifact_id:{type:"string"},reasoning:{type:"string"}},required:["artifact_id","reasoning"]}},trace_decisions:{type:"array",items:{type:"object",properties:{link_id:{type:"string"},reasoning:{type:"string"}},required:["link_id","reasoning"]}},uncategorized_files:{type:"array",items:{type:"string"}},suggestions:{type:"array",items:{type:"string"}}},required:["artifact_contracts_yaml"]}},"artifact-audit-request":{version:1,schema:{type:"object",properties:{system_id:{type:"string",description:"System ID from artifact-contracts"},artifact_count:{type:"integer",description:"Total number of artifacts"},definitions_context:{type:"string",description:"Resolved artifact definitions as context"}},required:["system_id","artifact_count","definitions_context"]}},"artifact-audit-result":{version:1,schema:{type:"object",properties:{summary:{type:"string"},risk_level:{type:"string",enum:["none","low","medium","high","critical"]},findings:{type:"array",items:{type:"object",properties:{id:{type:"string"},severity:{type:"string",enum:["critical","error","warning","info"]},category:{type:"string"},title:{type:"string"},description:{type:"string"},target:{type:"string"},recommendation:{type:"string"},evidence:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:["schema","code","config","runtime","doc"]},target:{type:"string"},location:{type:"string"},excerpt:{type:"string"},reasoning:{type:"string"}},required:["kind"]}}},required:["id","severity","category","title","description"]}},recommended_actions:{type:"array",items:{type:"object",properties:{action:{type:"string"},priority:{type:"string",enum:["high","medium","low"]},description:{type:"string"}},required:["action","priority"]}},metadata:{type:"object",properties:{total_artifacts:{type:"integer"},analyzed_artifacts:{type:"integer"},analysis_scope:{type:"string"}}}},required:["summary","risk_level","findings","recommended_actions"]}}},guardrails:{"output-schema-conformance":{description:"LLM output must conform to the declared handoff schema. Non-conforming output triggers a structured correction re-prompt up to max_attempts before falling back to rejection.",scope:{agents:["artifact-quality-reviewer"],tasks:["audit-artifact-definitions"]},"x-on-violation":{action:"retry_with_correction_prompt",max_attempts:2,fallback:"reject"}}},guardrail_policies:{"audit-quality-policy":{description:"Enforce output conformance for audit commands",rules:[{guardrail:"output-schema-conformance",severity:"mandatory",action:"block",allow_override:!1}]}},workflow:{discover:{description:"Discover artifacts from project file structure",entry_conditions:["repository file tree must be accessible"],steps:[{type:"delegate",description:"Analyze file structure and generate definitions",task:"discover-artifact-definitions",from_agent:"artifact-discovery-agent",max_retries:1,"x-on-exhausted":"escalate"}]},"artifact-audit":{description:"Run semantic audit of artifact definitions",entry_conditions:["artifact-definitions must resolve without validation errors"],steps:[{type:"delegate",description:"Execute the semantic audit task",task:"audit-artifact-definitions",from_agent:"artifact-quality-reviewer",max_retries:1,"x-on-exhausted":"escalate"},{type:"gate",description:"Block progression if audit findings reach a critical or high risk level",gate_kind:"artifact-audit-result","x-condition":{field:"risk_level",operator:"in",values:["critical","high"]},"x-on-block":"halt","x-on-pass":"continue"}]}}}});var ii=He(Fi=>{"use strict";Fi.__esModule=!0;Fi.extend=cR;Fi.indexOf=Fhe;Fi.escapeExpression=Lhe;Fi.isEmpty=Mhe;Fi.createFrame=zhe;Fi.blockParams=Uhe;Fi.appendContextPath=qhe;var Nhe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},The=/[&<>"'`=]/g,Bhe=/[&<>"'`=]/;function Rhe(t){return Nhe[t]}function cR(t){for(var e=1;e<arguments.length;e++)for(var r in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],r)&&(t[r]=arguments[e][r]);return t}var pw=Object.prototype.toString;Fi.toString=pw;var dw=function(e){return typeof e=="function"};dw(/x/)&&(Fi.isFunction=dw=function(t){return typeof t=="function"&&pw.call(t)==="[object Function]"});Fi.isFunction=dw;var dR=Array.isArray||function(t){return t&&typeof t=="object"?pw.call(t)==="[object Array]":!1};Fi.isArray=dR;function Fhe(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function Lhe(t){if(typeof t!="string"){if(t&&t.toHTML)return t.toHTML();if(t==null)return"";if(!t)return t+"";t=""+t}return Bhe.test(t)?t.replace(The,Rhe):t}function Mhe(t){return!t&&t!==0?!0:!!(dR(t)&&t.length===0)}function zhe(t){var e=cR({},t);return e._parent=t,e}function Uhe(t,e){return t.path=e,t}function qhe(t,e){return(t?t+".":"")+e}});var Li=He((Og,pR)=>{"use strict";Og.__esModule=!0;var fw=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function mw(t,e){var r=e&&e.loc,i=void 0,n=void 0,a=void 0,o=void 0;r&&(i=r.start.line,n=r.end.line,a=r.start.column,o=r.end.column,t+=" - "+i+":"+a);for(var s=Error.prototype.constructor.call(this,t),l=0;l<fw.length;l++)this[fw[l]]=s[fw[l]];Error.captureStackTrace&&Error.captureStackTrace(this,mw);try{r&&(this.lineNumber=i,this.endLineNumber=n,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:o,enumerable:!0})):(this.column=a,this.endColumn=o))}catch{}}mw.prototype=new Error;Og.default=mw;pR.exports=Og.default});var mR=He((Pg,fR)=>{"use strict";Pg.__esModule=!0;var hw=ii();Pg.default=function(t){t.registerHelper("blockHelperMissing",function(e,r){var i=r.inverse,n=r.fn;if(e===!0)return n(this);if(e===!1||e==null)return i(this);if(hw.isArray(e))return e.length>0?(r.ids&&(r.ids=[r.name]),t.helpers.each(e,r)):i(this);if(r.data&&r.ids){var a=hw.createFrame(r.data);a.contextPath=hw.appendContextPath(r.data.contextPath,r.name),r={data:a}}return n(e,r)})};fR.exports=Pg.default});var gR=He((Ig,hR)=>{"use strict";Ig.__esModule=!0;function Vhe(t){return t&&t.__esModule?t:{default:t}}var ef=ii(),Zhe=Li(),Ghe=Vhe(Zhe);Ig.default=function(t){t.registerHelper("each",function(e,r){if(!r)throw new Ghe.default("Must pass iterator to #each");var i=r.fn,n=r.inverse,a=0,o="",s=void 0,l=void 0;r.data&&r.ids&&(l=ef.appendContextPath(r.data.contextPath,r.ids[0])+"."),ef.isFunction(e)&&(e=e.call(this)),r.data&&(s=ef.createFrame(r.data));function u(m,h,g){s&&(s.key=m,s.index=h,s.first=h===0,s.last=!!g,l&&(s.contextPath=l+m)),o=o+i(e[m],{data:s,blockParams:ef.blockParams([e[m],m],[l+m,null])})}if(e&&typeof e=="object")if(ef.isArray(e))for(var d=e.length;a<d;a++)a in e&&u(a,a,a===e.length-1);else if(typeof Symbol=="function"&&e[Symbol.iterator]){for(var c=[],p=e[Symbol.iterator](),f=p.next();!f.done;f=p.next())c.push(f.value);e=c;for(var d=e.length;a<d;a++)u(a,a,a===e.length-1)}else(function(){var m=void 0;Object.keys(e).forEach(function(h){m!==void 0&&u(m,a-1),m=h,a++}),m!==void 0&&u(m,a-1,!0)})();return a===0&&(o=n(this)),o})};hR.exports=Ig.default});var yR=He((jg,vR)=>{"use strict";jg.__esModule=!0;function Whe(t){return t&&t.__esModule?t:{default:t}}var Khe=Li(),Hhe=Whe(Khe);jg.default=function(t){t.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new Hhe.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};vR.exports=jg.default});var ER=He((Ng,wR)=>{"use strict";Ng.__esModule=!0;function Jhe(t){return t&&t.__esModule?t:{default:t}}var _R=ii(),Yhe=Li(),bR=Jhe(Yhe);Ng.default=function(t){t.registerHelper("if",function(e,r){if(arguments.length!=2)throw new bR.default("#if requires exactly one argument");return _R.isFunction(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||_R.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,r){if(arguments.length!=2)throw new bR.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:r.inverse,inverse:r.fn,hash:r.hash})})};wR.exports=Ng.default});var $R=He((Tg,SR)=>{"use strict";Tg.__esModule=!0;Tg.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],r=arguments[arguments.length-1],i=0;i<arguments.length-1;i++)e.push(arguments[i]);var n=1;r.hash.level!=null?n=r.hash.level:r.data&&r.data.level!=null&&(n=r.data.level),e[0]=n,t.log.apply(t,e)})};SR.exports=Tg.default});var xR=He((Bg,kR)=>{"use strict";Bg.__esModule=!0;Bg.default=function(t){t.registerHelper("lookup",function(e,r,i){return e&&i.lookupProperty(e,r)})};kR.exports=Bg.default});var DR=He((Rg,AR)=>{"use strict";Rg.__esModule=!0;function Xhe(t){return t&&t.__esModule?t:{default:t}}var tf=ii(),Qhe=Li(),e0e=Xhe(Qhe);Rg.default=function(t){t.registerHelper("with",function(e,r){if(arguments.length!=2)throw new e0e.default("#with requires exactly one argument");tf.isFunction(e)&&(e=e.call(this));var i=r.fn;if(tf.isEmpty(e))return r.inverse(this);var n=r.data;return r.data&&r.ids&&(n=tf.createFrame(r.data),n.contextPath=tf.appendContextPath(r.data.contextPath,r.ids[0])),i(e,{data:n,blockParams:tf.blockParams([e],[n&&n.contextPath])})})};AR.exports=Rg.default});var gw=He(Fg=>{"use strict";Fg.__esModule=!0;Fg.registerDefaultHelpers=h0e;Fg.moveHelperToHooks=g0e;function Du(t){return t&&t.__esModule?t:{default:t}}var t0e=mR(),r0e=Du(t0e),n0e=gR(),i0e=Du(n0e),a0e=yR(),o0e=Du(a0e),s0e=ER(),u0e=Du(s0e),l0e=$R(),c0e=Du(l0e),d0e=xR(),p0e=Du(d0e),f0e=DR(),m0e=Du(f0e);function h0e(t){r0e.default(t),i0e.default(t),o0e.default(t),u0e.default(t),c0e.default(t),p0e.default(t),m0e.default(t)}function g0e(t,e,r){t.helpers[e]&&(t.hooks[e]=t.helpers[e],r||(t.helpers[e]=void 0))}});var OR=He((Lg,CR)=>{"use strict";Lg.__esModule=!0;var v0e=ii();Lg.default=function(t){t.registerDecorator("inline",function(e,r,i,n){var a=e;return r.partials||(r.partials={},a=function(o,s){var l=i.partials;i.partials=v0e.extend({},l,r.partials);var u=e(o,s);return i.partials=l,u}),r.partials[n.args[0]]=n.fn,a})};CR.exports=Lg.default});var PR=He(vw=>{"use strict";vw.__esModule=!0;vw.registerDefaultDecorators=w0e;function y0e(t){return t&&t.__esModule?t:{default:t}}var _0e=OR(),b0e=y0e(_0e);function w0e(t){b0e.default(t)}});var yw=He((Mg,IR)=>{"use strict";Mg.__esModule=!0;var E0e=ii(),hc={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var r=E0e.indexOf(hc.methodMap,e.toLowerCase());r>=0?e=r:e=parseInt(e,10)}return e},log:function(e){if(e=hc.lookupLevel(e),typeof console<"u"&&hc.lookupLevel(hc.level)<=e){var r=hc.methodMap[e];console[r]||(r="log");for(var i=arguments.length,n=Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];console[r].apply(console,n)}}};Mg.default=hc;IR.exports=Mg.default});var _w=He(rf=>{"use strict";rf.__esModule=!0;rf.createProtoAccessControl=x0e;rf.resultIsAllowed=A0e;rf.resetLoggedProperties=C0e;function S0e(t){return t&&t.__esModule?t:{default:t}}var jR=ii(),$0e=yw(),k0e=S0e($0e),zg=Object.create(null);function x0e(t){var e=Object.create(null);e.__proto__=!1,jR.extend(e,t.allowedProtoProperties);var r=Object.create(null);return r.constructor=!1,r.__defineGetter__=!1,r.__defineSetter__=!1,r.__lookupGetter__=!1,r.__lookupSetter__=!1,jR.extend(r,t.allowedProtoMethods),{properties:{whitelist:e,defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:r,defaultValue:t.allowProtoMethodsByDefault}}}function A0e(t,e,r){return NR(typeof t=="function"?e.methods:e.properties,r)}function NR(t,e){return t.whitelist[e]!==void 0?t.whitelist[e]===!0:t.defaultValue!==void 0?t.defaultValue:(D0e(e),!1)}function D0e(t){zg[t]!==!0&&(zg[t]=!0,k0e.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+`" because it is not an "own property" of its parent.
231
+ `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ug(e),i=sc(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ug(e),i=sc(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};WT.Parser=w7});var XT=He(jp=>{"use strict";var KT=u7(),Efe=$p(),Ip=Ap(),Sfe=o8(),$fe=gr(),kfe=b7(),HT=E7();function JT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new kfe.LineCounter||null,prettyErrors:e}}function xfe(t,e={}){let{lineCounter:r,prettyErrors:i}=JT(e),n=new HT.Parser(r?.addNewLine),a=new KT.Composer(e),o=Array.from(a.compose(n.parse(t)));if(i&&r)for(let s of o)s.errors.forEach(Ip.prettifyError(t,r)),s.warnings.forEach(Ip.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function YT(t,e={}){let{lineCounter:r,prettyErrors:i}=JT(e),n=new HT.Parser(r?.addNewLine),a=new KT.Composer(e),o=null;for(let s of a.compose(n.parse(t),!0,t.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new Ip.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(o.errors.forEach(Ip.prettifyError(t,r)),o.warnings.forEach(Ip.prettifyError(t,r))),o}function Afe(t,e,r){let i;typeof e=="function"?i=e:r===void 0&&e&&typeof e=="object"&&(r=e);let n=YT(t,r);if(!n)return null;if(n.warnings.forEach(a=>Sfe.warn(n.options.logLevel,a)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function Dfe(t,e,r){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(t===void 0){let{keepUndefined:n}=r??e??{};if(!n)return}return $fe.isDocument(t)&&!i?t.toString(r):new Efe.Document(t,i,r).toString(r)}jp.parse=Afe;jp.parseAllDocuments=xfe;jp.parseDocument=YT;jp.stringify=Dfe});var Ia=He($r=>{"use strict";var Cfe=u7(),Ofe=$p(),Pfe=U8(),S7=Ap(),Ife=up(),Cs=gr(),jfe=$s(),Nfe=an(),Tfe=xs(),Bfe=As(),Rfe=og(),Ffe=y7(),Lfe=b7(),Mfe=E7(),cg=XT(),QT=ip();$r.Composer=Cfe.Composer;$r.Document=Ofe.Document;$r.Schema=Pfe.Schema;$r.YAMLError=S7.YAMLError;$r.YAMLParseError=S7.YAMLParseError;$r.YAMLWarning=S7.YAMLWarning;$r.Alias=Ife.Alias;$r.isAlias=Cs.isAlias;$r.isCollection=Cs.isCollection;$r.isDocument=Cs.isDocument;$r.isMap=Cs.isMap;$r.isNode=Cs.isNode;$r.isPair=Cs.isPair;$r.isScalar=Cs.isScalar;$r.isSeq=Cs.isSeq;$r.Pair=jfe.Pair;$r.Scalar=Nfe.Scalar;$r.YAMLMap=Tfe.YAMLMap;$r.YAMLSeq=Bfe.YAMLSeq;$r.CST=Rfe;$r.Lexer=Ffe.Lexer;$r.LineCounter=Lfe.LineCounter;$r.Parser=Mfe.Parser;$r.parse=cg.parse;$r.parseAllDocuments=cg.parseAllDocuments;$r.parseDocument=cg.parseDocument;$r.stringify=cg.stringify;$r.visit=QT.visit;$r.visitAsync=QT.visitAsync});var A7,rB,Ufe,nB=et(()=>{A7=(t,e,r)=>{let i=t instanceof RegExp?rB(t,r):t,n=e instanceof RegExp?rB(e,r):e,a=i!==null&&n!=null&&Ufe(i,n,r);return a&&{start:a[0],end:a[1],pre:r.slice(0,a[0]),body:r.slice(a[0]+i.length,a[1]),post:r.slice(a[1]+n.length)}},rB=(t,e)=>{let r=e.match(t);return r?r[0]:null},Ufe=(t,e,r)=>{let i,n,a,o,s,l=r.indexOf(t),u=r.indexOf(e,l+1),d=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],a=r.length;d>=0&&!s;){if(d===l)i.push(d),l=r.indexOf(t,d+1);else if(i.length===1){let c=i.pop();c!==void 0&&(s=[c,u])}else n=i.pop(),n!==void 0&&n<a&&(a=n,o=u),u=r.indexOf(e,d+1);d=l<u&&l>=0?l:u}i.length&&o!==void 0&&(s=[a,o])}return s}});function D7(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function tme(t){return t.replace(Kfe,iB).replace(Hfe,aB).replace(Jfe,O7).replace(Yfe,oB).replace(Xfe,sB)}function rme(t){return t.replace(qfe,"\\").replace(Vfe,"{").replace(Zfe,"}").replace(Gfe,",").replace(Wfe,".")}function uB(t){if(!t)return[""];let e=[],r=A7("{","}",t);if(!r)return t.split(",");let{pre:i,body:n,post:a}=r,o=i.split(",");o[o.length-1]+="{"+n+"}";let s=uB(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),e.push.apply(e,o),e}function lB(t,e={}){if(!t)return[];let{max:r=Qfe,maxLength:i=eme}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),C7(tme(t),r,i,!0).map(rme)}function nme(t){return"{"+t+"}"}function ime(t){return/^-?0\d/.test(t)}function ame(t,e){return t<=e}function ome(t,e){return t>=e}function Np(t,e,r,i,n,a){let o=[],s=0;for(let l=0;l<t.length;l++)for(let u=0;u<r.length;u++){if(o.length>=i)return o;let d=t[l]+e+r[u];if(!(a&&!d)){if(s+d.length>n)return o;o.push(d),s+=d.length}}return o}function sme(t,e,r,i){let n=t.split(/\.\./),a=[];if(n[0]===void 0||n[1]===void 0)return a;let o=D7(n[0]),s=D7(n[1]),l=Math.max(n[0].length,n[1].length),u=n.length===3&&n[2]!==void 0?Math.max(Math.abs(D7(n[2])),1):1,d=ame;s<o&&(u*=-1,d=ome);let p=n.some(ime),f=0;for(let m=o;d(m,s)&&a.length<r;m+=u){let h;if(e)h=String.fromCharCode(m),h==="\\"&&(h="");else if(h=String(m),p){let g=l-h.length;if(g>0){let y=new Array(g+1).join("0");m<0?h="-"+y+h.slice(1):h=y+h}}if(f+h.length>i)break;a.push(h),f+=h.length}return a}function C7(t,e,r,i){let n=[""],a=!1,o=!0;for(;;){let s=A7("{","}",t);if(!s)return Np(n,t,[""],e,r,a);let l=s.pre;if(/\$$/.test(l)){if(n=Np(n,l+"{"+s.body+"}",[""],e,r,a&&!s.post.length),o=!1,!s.post.length)break;t=s.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),c=u||d,p=s.body.indexOf(",")>=0;if(!c&&!p){if(s.post.match(/,(?!,).*\}/)){t=s.pre+"{"+s.body+O7+s.post,i=!0;continue}return Np(n,l+"{"+s.body+"}"+s.post,[""],e,r,a)}o&&(a=i&&!c,o=!1);let f;if(c)f=sme(s.body,d,e,r);else{let m=uB(s.body);if(m.length===1&&m[0]!==void 0&&(m=C7(m[0],e,r,!1).map(nme),m.length===1)){if(n=Np(n,l+m[0],[""],e,r,a&&!s.post.length),!s.post.length)break;t=s.post;continue}let h=a&&!s.post.length&&!l;for(let y=0;h&&y<n.length;y++)n[y]&&(h=!1);f=[];let g=0;e:for(let y=0;y<m.length;y++){let _=C7(m[y],e,r,!1);for(let w=0;w<_.length;w++){let E=_[w];if(!(h&&!E)){if(f.length>=e||g+E.length>r)break e;f.push(E),g+=E.length}}}}if(n=Np(n,l,f,e,r,a&&!s.post.length),!s.post.length)break;t=s.post}return n}var iB,aB,O7,oB,sB,qfe,Vfe,Zfe,Gfe,Wfe,Kfe,Hfe,Jfe,Yfe,Xfe,Qfe,eme,cB=et(()=>{nB();iB="\0SLASH"+Math.random()+"\0",aB="\0OPEN"+Math.random()+"\0",O7="\0CLOSE"+Math.random()+"\0",oB="\0COMMA"+Math.random()+"\0",sB="\0PERIOD"+Math.random()+"\0",qfe=new RegExp(iB,"g"),Vfe=new RegExp(aB,"g"),Zfe=new RegExp(O7,"g"),Gfe=new RegExp(oB,"g"),Wfe=new RegExp(sB,"g"),Kfe=/\\\\/g,Hfe=/\\{/g,Jfe=/\\}/g,Yfe=/\\,/g,Xfe=/\\\./g,Qfe=1e5,eme=4e6});var Tp,dB=et(()=>{Tp=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var ume,Bp,lme,pB,fB,mB=et(()=>{ume={"[: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]},Bp=t=>t.replace(/[[\]\\-]/g,"\\$&"),lme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),pB=t=>t.join(""),fB=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let i=[],n=[],a=r+1,o=!1,s=!1,l=!1,u=!1,d=r,c="";e:for(;a<t.length;){let h=t.charAt(a);if((h==="!"||h==="^")&&a===r+1){u=!0,a++;continue}if(h==="]"&&o&&!l){d=a+1;break}if(o=!0,h==="\\"&&!l){l=!0,a++;continue}if(h==="["&&!l){for(let[g,[y,_,w]]of Object.entries(ume))if(t.startsWith(g,a)){if(c)return["$.",!1,t.length-r,!0];a+=g.length,w?n.push(y):i.push(y),s=s||_;continue e}}if(l=!1,c){h>c?i.push(Bp(c)+"-"+Bp(h)):h===c&&i.push(Bp(h)),c="",a++;continue}if(t.startsWith("-]",a+1)){i.push(Bp(h+"-")),a+=2;continue}if(t.startsWith("-",a+1)){c=h,a+=2;continue}i.push(Bp(h)),a++}if(d<a)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,t.length-r,!0];if(n.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let h=i[0].length===2?i[0].slice(-1):i[0];return[lme(h),!1,d-r,!1]}let p="["+(u?"^":"")+pB(i)+"]",f="["+(u?"":"^")+pB(n)+"]";return[i.length&&n.length?"("+p+"|"+f+")":i.length?p:f,s,d-r,!0]}});var aa,pg=et(()=>{aa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1")});var yi,cme,P7,hB,dme,pme,fme,gB,mme,fg,hme,gme,vme,yme,I7,vB,yB,_me,Su,j7=et(()=>{mB();pg();cme=new Set(["!","?","+","*","@"]),P7=t=>cme.has(t),hB=t=>P7(t.type),dme=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),pme=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fme=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),gB=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),mme="(?!(?:^|/)\\.\\.?(?:$|/))",fg="(?!\\.)",hme=new Set(["[","."]),gme=new Set(["..","."]),vme=new Set("().*{}+?[]^$\\!"),yme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),I7="[^/]",vB=I7+"*?",yB=I7+"+?",_me=0,Su=class{type;#t;#r;#i=!1;#e=[];#n;#_;#g;#l=!1;#s;#u;#p=!1;id=++_me;get depth(){return(this.#n?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#t.id,parent:this.#n?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,r,i={}){this.type=e,e&&(this.#r=!0),this.#n=r,this.#t=this.#n?this.#n.#t:this,this.#s=this.#t===this?i:this.#t.#s,this.#g=this.#t===this?[]:this.#t.#g,e==="!"&&!this.#t.#l&&this.#g.push(this),this.#_=this.#n?this.#n.#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.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#u=this.#e.map(e=>String(e)).join("")}#c(){if(this!==this.#t)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let e;for(;e=this.#g.pop();){if(e.type!=="!")continue;let r=e,i=r.#n;for(;i;){for(let n=r.#_+1;!i.type&&n<i.#e.length;n++)for(let a of e.#e){if(typeof a=="string")throw new Error("string part in extglob AST??");a.copyIn(i.#e[n])}r=i,i=r.#n}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof yi&&r.#n===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let e=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#l&&this.#n?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#n?.isStart())return!1;if(this.#_===0)return!0;let e=this.#n;for(let r=0;r<this.#_;r++){let i=e.#e[r];if(!(i instanceof yi&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#n?.type==="!")return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();let e=this.#n?this.#n.#e.length:0;return this.#_===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new yi(this.type,e);for(let i of this.#e)r.copyIn(i);return r}static#o(e,r,i,n,a){let o=n.maxExtglobRecursion??2,s=!1,l=!1,u=-1,d=!1;if(r.type===null){let h=i,g="";for(;h<e.length;){let y=e.charAt(h++);if(s||y==="\\"){s=!s,g+=y;continue}if(l){h===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(h===u+2&&d)&&(l=!1),g+=y;continue}else if(y==="["){l=!0,u=h,d=!1,g+=y;continue}if(!n.noext&&P7(y)&&e.charAt(h)==="("&&a<=o){r.push(g),g="";let w=new yi(y,r);h=yi.#o(e,w,h,n,a+1),r.push(w);continue}g+=y}return r.push(g),h}let c=i+1,p=new yi(null,r),f=[],m="";for(;c<e.length;){let h=e.charAt(c++);if(s||h==="\\"){s=!s,m+=h;continue}if(l){c===u+1?(h==="^"||h==="!")&&(d=!0):h==="]"&&!(c===u+2&&d)&&(l=!1),m+=h;continue}else if(h==="["){l=!0,u=c,d=!1,m+=h;continue}if(!n.noext&&P7(h)&&e.charAt(c)==="("&&(a<=o||r&&r.#m(h))){let y=r&&r.#m(h)?0:1;p.push(m),m="";let _=new yi(h,p);p.push(_),c=yi.#o(e,_,c,n,a+y);continue}if(h==="|"){p.push(m),m="",f.push(p),p=new yi(null,r);continue}if(h===")")return m===""&&r.#e.length===0&&(r.#p=!0),p.push(m),m="",r.push(...f,p),c;m+=h}return r.type=null,r.#r=void 0,r.#e=[e.substring(i-1)],c}#b(e){return this.#w(e,pme)}#w(e,r=dme){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let i=e.#e[0];return!i||typeof i!="object"||i.type===null?!1:this.#m(i.type,r)}#m(e,r=fme){return!!r.get(this.type)?.includes(e)}#v(e,r){let i=e.#e[0],n=new yi(null,i,this.options);n.#e.push(""),i.push(n),this.#$(e,r)}#$(e,r){let i=e.#e[0];this.#e.splice(r,1,...i.#e);for(let n of i.#e)typeof n=="object"&&(n.#n=this);this.#u=void 0}#y(e){return!!gB.get(this.type)?.has(e)}#S(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type)}#k(e){let r=gB.get(this.type),i=e.#e[0],n=r?.get(i.type);if(!n)return!1;this.#e=i.#e;for(let a of this.#e)typeof a=="object"&&(a.#n=this);this.type=n,this.#u=void 0,this.#p=!1}static fromGlob(e,r={}){let i=new yi(null,void 0,r);return yi.#o(e,i,0,r,0),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[r,i,n,a]=this.toRegExpSource();if(!(n||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let s=(this.#s.nocase?"i":"")+(a?"u":"");return Object.assign(new RegExp(`^${r}$`,s),{_src:r,_glob:e})}get options(){return this.#s}toRegExpSource(e){let r=e??!!this.#s.dot;if(this.#t===this&&(this.#f(),this.#c()),!hB(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),u=this.#e.map(f=>{let[m,h,g,y]=typeof f=="string"?yi.#E(f,this.#r,l):f.toRegExpSource(e);return this.#r=this.#r||g,this.#i=this.#i||y,m}).join(""),d="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&gme.has(this.#e[0]))){let m=hme,h=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),g=!r&&!e&&m.has(u.charAt(0));d=h?mme:g?fg:""}let c="";return this.isEnd()&&this.#t.#l&&this.#n?.type==="!"&&(c="(?:$|\\/)"),[d+u+c,aa(u),this.#r=!!this.#r,this.#i]}let i=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",a=this.#h(r);if(this.isStart()&&this.isEnd()&&!a&&this.type!=="!"){let l=this.toString(),u=this;return u.#e=[l],u.type=null,u.#r=void 0,[l,aa(this.toString()),!1,!1]}let o=!i||e||r||!fg?"":this.#h(!0);o===a&&(o=""),o&&(a=`(?:${a})(?:${o})*?`);let s="";if(this.type==="!"&&this.#p)s=(this.isStart()&&!r?fg:"")+yB;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?fg:"")+vB+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;s=n+a+l}return[s,aa(a),this.#r=!!this.#r,this.#i]}#f(){if(hB(this)){let e=0,r=!1;do{r=!0;for(let i=0;i<this.#e.length;i++){let n=this.#e[i];typeof n=="object"&&(n.#f(),this.#w(n)?(r=!1,this.#$(n,i)):this.#b(n)?(r=!1,this.#v(n,i)):this.#S(n)&&(r=!1,this.#k(n)))}}while(!r&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#f();this.#u=void 0}#h(e){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[i,n,a,o]=r.toRegExpSource(e);return this.#i=this.#i||o,i}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#E(e,r,i=!1){let n=!1,a="",o=!1,s=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(n){n=!1,a+=(vme.has(u)?"\\":"")+u;continue}if(u==="*"){if(s)continue;s=!0,a+=i&&/^[*]+$/.test(e)?yB:vB,r=!0;continue}else s=!1;if(u==="\\"){l===e.length-1?a+="\\\\":n=!0;continue}if(u==="["){let[d,c,p,f]=fB(e,l);if(p){a+=d,o=o||c,l+=p-1,r=r||f;continue}}if(u==="?"){a+=I7,r=!0;continue}a+=yme(u)}return[a,aa(e),!!r,o]}};yi=Su});var $u,N7=et(()=>{$u=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var yn,bme,wme,Eme,Sme,$me,kme,xme,Ame,Dme,Cme,Ome,Pme,Ime,jme,Nme,Tme,Bme,Rme,wB,EB,SB,_B,Fme,tn,Lme,Mme,zme,Ume,qme,oa,Vme,$B,Zme,Gme,bB,Wme,Bi,Co=et(()=>{cB();dB();j7();N7();pg();j7();N7();pg();yn=(t,e,r={})=>(Tp(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Bi(e,r).match(t)),bme=/^\*+([^+@!?*[(]*)$/,wme=t=>e=>!e.startsWith(".")&&e.endsWith(t),Eme=t=>e=>e.endsWith(t),Sme=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),$me=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),kme=/^\*+\.\*+$/,xme=t=>!t.startsWith(".")&&t.includes("."),Ame=t=>t!=="."&&t!==".."&&t.includes("."),Dme=/^\.\*+$/,Cme=t=>t!=="."&&t!==".."&&t.startsWith("."),Ome=/^\*+$/,Pme=t=>t.length!==0&&!t.startsWith("."),Ime=t=>t.length!==0&&t!=="."&&t!=="..",jme=/^\?+([^+@!?*[(]*)?$/,Nme=([t,e=""])=>{let r=wB([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Tme=([t,e=""])=>{let r=EB([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Bme=([t,e=""])=>{let r=EB([t]);return e?i=>r(i)&&i.endsWith(e):r},Rme=([t,e=""])=>{let r=wB([t]);return e?i=>r(i)&&i.endsWith(e):r},wB=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},EB=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},SB=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",_B={win32:{sep:"\\"},posix:{sep:"/"}},Fme=SB==="win32"?_B.win32.sep:_B.posix.sep;yn.sep=Fme;tn=Symbol("globstar **");yn.GLOBSTAR=tn;Lme="[^/]",Mme=Lme+"*?",zme="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ume="(?:(?!(?:\\/|^)\\.).)*?",qme=(t,e={})=>r=>yn(r,t,e);yn.filter=qme;oa=(t,e={})=>Object.assign({},t,e),Vme=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return yn;let e=yn;return Object.assign((i,n,a={})=>e(i,n,oa(t,a)),{Minimatch:class extends e.Minimatch{constructor(n,a={}){super(n,oa(t,a))}static defaults(n){return e.defaults(oa(t,n)).Minimatch}},AST:class extends e.AST{constructor(n,a,o={}){super(n,a,oa(t,o))}static fromGlob(n,a={}){return e.AST.fromGlob(n,oa(t,a))}},unescape:(i,n={})=>e.unescape(i,oa(t,n)),escape:(i,n={})=>e.escape(i,oa(t,n)),filter:(i,n={})=>e.filter(i,oa(t,n)),defaults:i=>e.defaults(oa(t,i)),makeRe:(i,n={})=>e.makeRe(i,oa(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,oa(t,n)),match:(i,n,a={})=>e.match(i,n,oa(t,a)),sep:e.sep,GLOBSTAR:tn})};yn.defaults=Vme;$B=(t,e={})=>(Tp(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:lB(t,{max:e.braceExpandMax}));yn.braceExpand=$B;Zme=(t,e={})=>new Bi(t,e).makeRe();yn.makeRe=Zme;Gme=(t,e,r={})=>{let i=new Bi(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};yn.match=Gme;bB=/[?*]|[+@!]\(.*?\)|\[|\]/,Wme=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Bi=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){Tp(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||SB,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...a)=>console.error(...a)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(a=>this.slashSplit(a));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((a,o,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=a[0]===""&&a[1]===""&&(a[2]==="?"||!bB.test(a[2]))&&!bB.test(a[3]),u=/^[a-z]:/i.test(a[0]);if(l)return[...a.slice(0,4),...a.slice(4).map(d=>this.parse(d))];if(u)return[a[0],...a.slice(1).map(d=>this.parse(d))]}return a.map(l=>this.parse(l))});if(this.debug(this.pattern,n),this.set=n.filter(a=>a.indexOf(!1)===-1),this.isWindows)for(let a=0;a<this.set.length;a++){let o=this.set[a];o[0]===""&&o[1]===""&&this.globParts[a][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 i of e)for(let n=0;n<i.length;n++)i[n]==="**"&&(i[n]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let n=i;for(;r[n+1]==="**";)n++;n!==i&&r.splice(i,n-i)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((i,n)=>{let a=i[i.length-1];return n==="**"&&a==="**"?i:n===".."&&a&&a!==".."&&a!=="."&&a!=="**"?(i.pop(),i):(i.push(n),i)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let a=e[n];n===1&&a===""&&e[0]===""||(a==="."||a==="")&&(r=!0,e.splice(n,1),n--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let n=e[i-1];n&&n!=="."&&n!==".."&&n!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(n))&&(r=!0,e.splice(i-1,2),i-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let i of e){let n=-1;for(;(n=i.indexOf("**",n+1))!==-1;){let o=n;for(;i[o+1]==="**";)o++;o>n&&i.splice(n+1,o-n);let s=i[n+1],l=i[n+2],u=i[n+3];if(s!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,i.splice(n,1);let d=i.slice(0);d[n]="**",e.push(d),n--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let s=i[o];o===1&&s===""&&i[0]===""||(s==="."||s==="")&&(r=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(r=!0,i.pop())}let a=0;for(;(a=i.indexOf("..",a+1))!==-1;){let o=i[a-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let l=a===1&&i[a+1]==="**"?["."]:[];i.splice(a-1,2,...l),i.length===0&&i.push(""),a-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let i=r+1;i<e.length;i++){let n=this.partsMatch(e[r],e[i],!this.preserveMultipleSlashes);if(n){e[r]=[],e[i]=n;break}}return e.filter(r=>r.length)}partsMatch(e,r,i=!1){let n=0,a=0,o=[],s="";for(;n<e.length&&a<r.length;)if(e[n]===r[a])o.push(s==="b"?r[a]:e[n]),n++,a++;else if(i&&e[n]==="**"&&r[a]===e[n+1])o.push(e[n]),n++;else if(i&&r[a]==="**"&&e[n]===r[a+1])o.push(r[a]),a++;else if(e[n]==="*"&&r[a]&&(this.options.dot||!r[a].startsWith("."))&&r[a]!=="**"){if(s==="b")return!1;s="a",o.push(e[n]),n++,a++}else if(r[a]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(s==="a")return!1;s="b",o.push(r[a]),n++,a++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i=!1){let n=0,a=0;if(this.isWindows){let s=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!s&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),c=l?3:s?0:void 0,p=d?3:u?0:void 0;if(typeof c=="number"&&typeof p=="number"){let[f,m]=[e[c],r[p]];f.toLowerCase()===m.toLowerCase()&&(r[p]=f,a=p,n=c)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(tn)?this.#t(e,r,i,n,a):this.#i(e,r,i,n,a)}#t(e,r,i,n,a){let o=r.indexOf(tn,a),s=r.lastIndexOf(tn),[l,u,d]=i?[r.slice(a,o),r.slice(o+1),[]]:[r.slice(a,o),r.slice(o+1,s),r.slice(s+1)];if(l.length){let _=e.slice(n,n+l.length);if(!this.#i(_,l,i,0,0))return!1;n+=l.length,a+=l.length}let c=0;if(d.length){if(d.length+n>e.length)return!1;let _=e.length-d.length;if(this.#i(e,d,i,_,0))c=d.length;else{if(e[e.length-1]!==""||n+d.length===e.length||(_--,!this.#i(e,d,i,_,0)))return!1;c=d.length+1}}if(!u.length){let _=!!c;for(let w=n;w<e.length-c;w++){let E=String(e[w]);if(_=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return i||_}let p=[[[],0]],f=p[0],m=0,h=[0];for(let _ of u)_===tn?(h.push(m),f=[[],0],p.push(f)):(f[0].push(_),m++);let g=p.length-1,y=e.length-c;for(let _ of p)_[1]=y-(h[g--]+_[0].length);return!!this.#r(e,p,n,0,i,0,!!c)}#r(e,r,i,n,a,o,s){let l=r[n];if(!l){for(let c=i;c<e.length;c++){s=!0;let p=e[c];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return s}let[u,d]=l;for(;i<=d;){if(this.#i(e.slice(0,i+u.length),u,a,i,0)&&o<this.maxGlobstarRecursion){let f=this.#r(e,r,i+u.length,n+1,a,o+1,s);if(f!==!1)return f}let p=e[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return a||null}#i(e,r,i,n,a){let o,s,l,u;for(o=n,s=a,u=e.length,l=r.length;o<u&&s<l;o++,s++){this.debug("matchOne loop");let d=r[s],c=e[o];if(this.debug(r,d,c),d===!1||d===tn)return!1;let p;if(typeof d=="string"?(p=c===d,this.debug("string match",d,c,p)):(p=d.test(c),this.debug("pattern match",d,c,p)),!p)return!1}if(o===u&&s===l)return!0;if(o===u)return i;if(s===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return $B(this.pattern,this.options)}parse(e){Tp(e);let r=this.options;if(e==="**")return tn;if(e==="")return"";let i,n=null;(i=e.match(Ome))?n=r.dot?Ime:Pme:(i=e.match(bme))?n=(r.nocase?r.dot?$me:Sme:r.dot?Eme:wme)(i[1]):(i=e.match(jme))?n=(r.nocase?r.dot?Tme:Nme:r.dot?Bme:Rme)(i):(i=e.match(kme))?n=r.dot?Ame:xme:(i=e.match(Dme))&&(n=Cme);let a=Su.fromGlob(e,this.options).toMMPattern();return n&&typeof a=="object"&&Reflect.defineProperty(a,"test",{value:n}),a}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?Mme:r.dot?zme:Ume,n=new Set(r.nocase?["i"]:[]),a=e.map(l=>{let u=l.map(c=>{if(c instanceof RegExp)for(let p of c.flags.split(""))n.add(p);return typeof c=="string"?Wme(c):c===tn?tn:c._src});u.forEach((c,p)=>{let f=u[p+1],m=u[p-1];c!==tn||m===tn||(m===void 0?f!==void 0&&f!==tn?u[p+1]="(?:\\/|"+i+"\\/)?"+f:u[p]=i:f===void 0?u[p-1]=m+"(?:\\/|\\/"+i+")?":f!==tn&&(u[p-1]=m+"(?:\\/|\\/"+i+"\\/)"+f,u[p+1]=tn))});let d=u.filter(c=>c!==tn);if(this.partial&&d.length>=1){let c=[];for(let p=1;p<=d.length;p++)c.push(d.slice(0,p).join("/"));return"(?:"+c.join("|")+")"}return d.join("/")}).join("|"),[o,s]=e.length>1?["(?:",")"]:["",""];a="^"+o+a+s+"$",this.partial&&(a="^(?:\\/|"+o+a.slice(1,-1)+s+")$"),this.negate&&(a="^(?!"+a+").+$");try{this.regexp=new RegExp(a,[...n].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,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let a=this.set;this.debug(this.pattern,"set",a);let o=n[n.length-1];if(!o)for(let s=n.length-2;!o&&s>=0;s--)o=n[s];for(let s of a){let l=n;if(i.matchBase&&s.length===1&&(l=[o]),this.matchOne(l,s,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return yn.defaults(e).Minimatch}};yn.AST=Su;yn.Minimatch=Bi;yn.escape=$u;yn.unescape=aa});import{tracingChannel as Kme,channel as Hme}from"node:diagnostics_channel";var In,Rp,Jme,R7,xB,kB,Yme,Xme,Os,AB,mg,Qme,Lp,CB=et(()=>{In=Hme("lru-cache:metrics"),Rp=Kme("lru-cache"),Jme=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,R7=()=>In.hasSubscribers||Rp.hasSubscribers,xB=new Set,kB=typeof process=="object"&&process?process:{},Yme=(t,e,r,i)=>{typeof kB.emitWarning=="function"?kB.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},Xme=t=>!xB.has(t),Os=t=>!!t&&t===Math.floor(t)&&t>0&&isFinite(t),AB=t=>Os(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?mg:null:null,mg=class extends Array{constructor(t){super(t),this.fill(0)}},Qme=class Fp{heap;length;static#t=!1;static create(e){let r=AB(e);if(!r)return[];Fp.#t=!0;let i=new Fp(e,r);return Fp.#t=!1,i}constructor(e,r){if(!Fp.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Lp=class DB{#t;#r;#i;#e;#n;#_;#g;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#s;#u;#p;#c;#o;#b;#w;#m;#v;#$;#y;#S;#k;#f;#h;#E;#D;#a;#P;static unsafeExposeInternals(e){return{starts:e.#k,ttls:e.#f,autopurgeTimers:e.#h,sizes:e.#S,keyMap:e.#p,keyList:e.#c,valList:e.#o,next:e.#b,prev:e.#w,get head(){return e.#m},get tail(){return e.#v},free:e.#$,isBackgroundFetch:r=>e.#d(r),backgroundFetch:(r,i,n,a)=>e.#R(r,i,n,a),moveToTail:r=>e.#K(r),indexes:r=>e.#C(r),rindexes:r=>e.#O(r),isStale:r=>e.#x(r)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#s}get fetchMethod(){return this.#_}get memoMethod(){return this.#g}get dispose(){return this.#i}get onInsert(){return this.#e}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:l,dispose:u,onInsert:d,disposeAfter:c,noDisposeOnSet:p,noUpdateTTL:f,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:y,memoMethod:_,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:C,ignoreFetchAbort:S,backgroundFetchSize:A=1,perf:I}=e;if(this.backgroundFetchSize=A,I!==void 0&&typeof I?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#l=I??Jme,r!==0&&!Os(r))throw new TypeError("max option must be a nonnegative integer");let O=r?AB(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=g,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#g=_,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#_=y,this.#D=!!y,this.#p=new Map,this.#c=Array.from({length:r}).fill(void 0),this.#o=Array.from({length:r}).fill(void 0),this.#b=new O(r),this.#w=new O(r),this.#m=0,this.#v=0,this.#$=Qme.create(r),this.#s=0,this.#u=0,typeof u=="function"&&(this.#i=u),typeof d=="function"&&(this.#e=d),typeof c=="function"?(this.#n=c,this.#y=[]):(this.#n=void 0,this.#y=void 0),this.#E=!!this.#i,this.#P=!!this.#e,this.#a=!!this.#n,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#r!==0&&!Os(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Os(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=Os(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=i||0,this.ttl){if(!Os(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 k="LRU_CACHE_UNBOUNDED";Xme(k)&&(xB.add(k),Yme("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,DB))}}getRemainingTTL(e){return this.#p.has(e)?1/0:0}#I(){let e=new mg(this.#t),r=new mg(this.#t);this.#f=e,this.#k=r;let i=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#h=i,this.#L=(s,l,u=this.#l.now())=>{r[s]=l!==0?u:0,e[s]=l,n(s,l)},this.#A=s=>{r[s]=e[s]!==0?this.#l.now():0,n(s,e[s])};let n=this.ttlAutopurge?(s,l)=>{if(i?.[s]&&(clearTimeout(i[s]),i[s]=void 0),l&&l!==0&&i){let u=setTimeout(()=>{this.#x(s)&&this.#F(this.#c[s],"expire")},l+1);u.unref&&u.unref(),i[s]=u}}:()=>{};this.#j=(s,l)=>{if(e[l]){let u=e[l],d=r[l];if(!u||!d)return;s.ttl=u,s.start=d,s.now=a||o();let c=s.now-d;s.remainingTTL=u-c}};let a=0,o=()=>{let s=this.#l.now();if(this.ttlResolution>0){a=s;let l=setTimeout(()=>a=0,this.ttlResolution);l.unref&&l.unref()}return s};this.getRemainingTTL=s=>{let l=this.#p.get(s);if(l===void 0)return 0;let u=e[l],d=r[l];if(!u||!d)return 1/0;let c=(a||o())-d;return u-c},this.#x=s=>{let l=r[s],u=e[s];return!!u&&!!l&&(a||o())-l>u}}#A=()=>{};#j=()=>{};#L=()=>{};#x=()=>!1;#V(){let e=new mg(this.#t);this.#u=0,this.#S=e,this.#T=r=>{this.#u-=e[r],e[r]=0},this.#M=(r,i,n,a)=>{if(!Os(n)){if(this.#d(i))return this.backgroundFetchSize;if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(i,r),!Os(n))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 n},this.#N=(r,i,n)=>{if(e[r]=i,this.#r){let a=this.#r-e[r];for(;this.#u>a;)this.#q(!0)}this.#u+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#u)}}#T=e=>{};#N=(e,r,i)=>{};#M=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#v;this.#z(r)&&((e||!this.#x(r))&&(yield r),r!==this.#m);)r=this.#w[r]}*#O({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#m;this.#z(r)&&((e||!this.#x(r))&&(yield r),r!==this.#v);)r=this.#b[r]}#z(e){return e!==void 0&&this.#p.get(this.#c[e])===e}*entries(){for(let e of this.#C())this.#o[e]!==void 0&&this.#c[e]!==void 0&&!this.#d(this.#o[e])&&(yield[this.#c[e],this.#o[e]])}*rentries(){for(let e of this.#O())this.#o[e]!==void 0&&this.#c[e]!==void 0&&!this.#d(this.#o[e])&&(yield[this.#c[e],this.#o[e]])}*keys(){for(let e of this.#C()){let r=this.#c[e];r!==void 0&&!this.#d(this.#o[e])&&(yield r)}}*rkeys(){for(let e of this.#O()){let r=this.#c[e];r!==void 0&&!this.#d(this.#o[e])&&(yield r)}}*values(){for(let e of this.#C())this.#o[e]!==void 0&&!this.#d(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#O())this.#o[e]!==void 0&&!this.#d(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#C()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;if(a!==void 0&&e(a,this.#c[i],this))return this.#W(this.#c[i],r)}}forEach(e,r=this){for(let i of this.#C()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;a!==void 0&&e.call(r,a,this.#c[i],this)}}rforEach(e,r=this){for(let i of this.#O()){let n=this.#o[i],a=this.#d(n)?n.__staleWhileFetching:n;a!==void 0&&e.call(r,a,this.#c[i],this)}}purgeStale(){let e=!1;for(let r of this.#O({allowStale:!0}))this.#x(r)&&(this.#F(this.#c[r],"expire"),e=!0);return e}info(e){let r=this.#p.get(e);if(r===void 0)return;let i=this.#o[r],n=this.#d(i)?i.__staleWhileFetching:i;if(n===void 0)return;let a={value:n};if(this.#f&&this.#k){let o=this.#f[r],s=this.#k[r];if(o&&s){let l=o-(this.#l.now()-s);a.ttl=l,a.start=Date.now()}}return this.#S&&(a.size=this.#S[r]),a}dump(){let e=[];for(let r of this.#C({allowStale:!0})){let i=this.#c[r],n=this.#o[r],a=this.#d(n)?n.__staleWhileFetching:n;if(a===void 0||i===void 0)continue;let o={value:a};if(this.#f&&this.#k){o.ttl=this.#f[r];let s=this.#l.now()-this.#k[r];o.start=Math.floor(Date.now()-s)}this.#S&&(o.size=this.#S[r]),e.unshift([i,o])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=this.#l.now()-n}this.#B(r,i.value,i)}}set(e,r,i={}){let{status:n=In.hasSubscribers?{}:void 0}=i;i.status=n,n&&(n.op="set",n.key=e,r!==void 0&&(n.value=r),n.cache=this);let a=this.#B(e,r,i);return n&&In.hasSubscribers&&In.publish(n),a}#B(e,r,i,n){let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=i,d=this.#d(r);if(r===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:c=this.noUpdateTTL}=i;u&&!d&&(u.value=r);let p=this.#M(e,r,i.size||0,l,u);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#F(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let f=this.#s===0?void 0:this.#p.get(e);if(f===void 0)f=this.#s===0?this.#v:this.#$.length!==0?this.#$.pop():this.#s===this.#t?this.#q(!1):this.#s,this.#c[f]=e,this.#o[f]=r,this.#p.set(e,f),this.#b[this.#v]=f,this.#w[f]=this.#v,this.#v=f,this.#s++,this.#N(f,p,u),u&&(u.set="add"),c=!1,this.#P&&!d&&this.#e?.(r,e,"add");else{this.#K(f);let m=this.#o[f];if(r!==m){if(!s)if(this.#d(m)){m!==n&&m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=m;h!==void 0&&h!==r&&(this.#E&&this.#i?.(h,e,"set"),this.#a&&this.#y?.push([h,e,"set"]))}else this.#E&&this.#i?.(m,e,"set"),this.#a&&this.#y?.push([m,e,"set"]);if(this.#T(f),this.#N(f,p,u),this.#o[f]=r,!d){let h=m&&this.#d(m)?m.__staleWhileFetching:m,g=h===void 0?"add":r!==h?"replace":"update";u&&(u.set=g,h!==void 0&&(u.oldValue=h)),this.#P&&this.onInsert?.(r,e,g)}}else d||(u&&(u.set="update"),this.#P&&this.onInsert?.(r,e,"update"))}if(a!==0&&!this.#f&&this.#I(),this.#f&&(c||this.#L(f,a,o),u&&this.#j(u,f)),!s&&this.#a&&this.#y){let m=this.#y,h;for(;h=m?.shift();)this.#n?.(...h)}return this}pop(){try{for(;this.#s;){let e=this.#o[this.#m];if(this.#q(!0),this.#d(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#a&&this.#y){let e=this.#y,r;for(;r=e?.shift();)this.#n?.(...r)}}}#q(e){let r=this.#m,i=this.#c[r],n=this.#o[r],a=this.#d(n);a&&n.__abortController.abort(new Error("evicted"));let o=a?n.__staleWhileFetching:n;return(this.#E||this.#a)&&o!==void 0&&(this.#E&&this.#i?.(o,i,"evict"),this.#a&&this.#y?.push([o,i,"evict"])),this.#T(r),this.#h?.[r]&&(clearTimeout(this.#h[r]),this.#h[r]=void 0),e&&(this.#c[r]=void 0,this.#o[r]=void 0,this.#$.push(r)),this.#s===1?(this.#m=this.#v=0,this.#$.length=0):this.#m=this.#b[r],this.#p.delete(i),this.#s--,r}has(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="has",i.key=e,i.cache=this);let n=this.#H(e,r);return In.hasSubscribers&&In.publish(i),n}#H(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,a=this.#p.get(e);if(a!==void 0){let o=this.#o[a];if(this.#d(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#x(a))n&&(n.has="stale",this.#j(n,a));else return i&&this.#A(a),n&&(n.has="hit",this.#j(n,a)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{status:i=R7()?{}:void 0}=r;i&&(i.op="peek",i.key=e,i.cache=this),r.status=i;let n=this.#Z(e,r);return In.hasSubscribers&&In.publish(i),n}#Z(e,r){let{status:i,allowStale:n=this.allowStale}=r,a=this.#p.get(e);if(a===void 0||!n&&this.#x(a)){i&&(i.peek=a===void 0?"miss":"stale");return}let o=this.#o[a],s=this.#d(o)?o.__staleWhileFetching:o;return i&&(s!==void 0?(i.peek="hit",i.value=s):i.peek="miss"),s}#R(e,r,i,n){let a=r===void 0?void 0:this.#o[r];if(this.#d(a))return a;let o=new AbortController,{signal:s}=i;s?.addEventListener("abort",()=>o.abort(s.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:n},u=(h,g=!1)=>{let{aborted:y}=o.signal,_=i.ignoreFetchAbort&&h!==void 0,w=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&h!==void 0);if(i.status&&(y&&!g?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,_&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),y&&!_&&!g)return c(o.signal.reason,w);let E=f,D=this.#o[r];return(D===f||D===void 0&&_&&g)&&(h===void 0?E.__staleWhileFetching!==void 0?this.#o[r]=E.__staleWhileFetching:this.#F(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#B(e,h,l.options,E))),h},d=h=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=h),c(h,!1)),c=(h,g)=>{let{aborted:y}=o.signal,_=y&&i.allowStaleOnFetchAbort,w=_||i.allowStaleOnFetchRejection,E=w||i.noDeleteOnFetchRejection,D=f;if(this.#o[r]===f&&(!E||!g&&D.__staleWhileFetching===void 0?this.#F(e,"fetch"):_||(this.#o[r]=D.__staleWhileFetching)),w)return i.status&&D.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),D.__staleWhileFetching;if(D.__returned===D)throw h},p=(h,g)=>{let y=this.#_?.(e,a,l);o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(h(void 0),i.allowStaleOnFetchAbort&&(h=_=>u(_,!0)))}),y&&y instanceof Promise?y.then(_=>h(_===void 0?void 0:_),g):y!==void 0&&h(y)};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(p).then(u,d),m=Object.assign(f,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.#B(e,m,{...l.options,status:void 0}),r=this.#p.get(e)):this.#o[r]=m,m}#d(e){if(!this.#D)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AbortController}fetch(e,r={}){let i=Rp.hasSubscribers,{status:n=R7()?{}:void 0}=r;r.status=n,n&&r.context&&(n.context=r.context);let a=this.#G(e,r);return n&&i&&(n.trace=!0,Rp.tracePromise(()=>a,n).catch(()=>{})),a}async#G(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:g=!1,status:y,signal:_}=r;if(y&&(y.op="fetch",y.key=e,g&&(y.forceRefresh=!0),y.cache=this),!this.#D)return y&&(y.fetch="get"),this.#W(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:y});let w={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:y,signal:_},E=this.#p.get(e);if(E===void 0){y&&(y.fetch="miss");let D=this.#R(e,E,w,h);return D.__returned=D}else{let D=this.#o[E];if(this.#d(D)){let I=i&&D.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",I&&(y.returnedStale=!0)),I?D.__staleWhileFetching:D.__returned=D}let C=this.#x(E);if(!g&&!C)return y&&(y.fetch="hit"),this.#K(E),n&&this.#A(E),y&&this.#j(y,E),D;let S=this.#R(e,E,w,h),A=S.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=C?"stale":"refresh",A&&C&&(y.returnedStale=!0)),A?S.__staleWhileFetching:S.__returned=S}}forceFetch(e,r={}){let i=Rp.hasSubscribers,{status:n=R7()?{}:void 0}=r;r.status=n,n&&r.context&&(n.context=r.context);let a=this.#U(e,r);return n&&i&&(n.trace=!0,Rp.tracePromise(()=>a,n).catch(()=>{})),a}async#U(e,r={}){let i=await this.#G(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="memo",i.key=e,r.context&&(i.context=r.context),i.cache=this);let n=this.#X(e,r);return i&&(i.value=n),In.hasSubscribers&&In.publish(i),n}#X(e,r={}){let i=this.#g;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,status:a,forceRefresh:o,...s}=r;a&&o&&(a.forceRefresh=!0);let l=this.#W(e,s),u=o||l===void 0;if(a&&(a.memo=u?"miss":"hit",u||(a.value=l)),!u)return l;let d=i(e,l,{options:s,context:n});return a&&(a.value=d),this.#B(e,d,s),d}get(e,r={}){let{status:i=In.hasSubscribers?{}:void 0}=r;r.status=i,i&&(i.op="get",i.key=e,i.cache=this);let n=this.#W(e,r);return i&&(n!==void 0&&(i.value=n),In.hasSubscribers&&In.publish(i)),n}#W(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=r,s=this.#p.get(e);if(s===void 0){o&&(o.get="miss");return}let l=this.#o[s],u=this.#d(l);return o&&this.#j(o,s),this.#x(s)?u?(o&&(o.get="stale-fetching"),i&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(a||this.#F(e,"expire"),o&&(o.get="stale"),i?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?"fetching":"hit"),this.#K(s),n&&this.#A(s),u?l.__staleWhileFetching:l)}#J(e,r){this.#w[r]=e,this.#b[e]=r}#K(e){e!==this.#v&&(e===this.#m?this.#m=this.#b[e]:this.#J(this.#w[e],this.#b[e]),this.#J(this.#v,e),this.#v=e)}delete(e){return this.#F(e,"delete")}#F(e,r){In.hasSubscribers&&In.publish({op:"delete",delete:r,key:e,cache:this});let i=!1;if(this.#s!==0){let n=this.#p.get(e);if(n!==void 0)if(this.#h?.[n]&&(clearTimeout(this.#h?.[n]),this.#h[n]=void 0),i=!0,this.#s===1)this.#Y(r);else{this.#T(n);let a=this.#o[n];if(this.#d(a)?a.__abortController.abort(new Error("deleted")):(this.#E||this.#a)&&(this.#E&&this.#i?.(a,e,r),this.#a&&this.#y?.push([a,e,r])),this.#p.delete(e),this.#c[n]=void 0,this.#o[n]=void 0,n===this.#v)this.#v=this.#w[n];else if(n===this.#m)this.#m=this.#b[n];else{let o=this.#w[n];this.#b[o]=this.#b[n];let s=this.#b[n];this.#w[s]=this.#w[n]}this.#s--,this.#$.push(n)}}if(this.#a&&this.#y?.length){let n=this.#y,a;for(;a=n?.shift();)this.#n?.(...a)}return i}clear(){return this.#Y("delete")}#Y(e){for(let r of this.#O({allowStale:!0})){let i=this.#o[r];if(this.#d(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#c[r];this.#E&&this.#i?.(i,n,e),this.#a&&this.#y?.push([i,n,e])}}if(this.#p.clear(),this.#o.fill(void 0),this.#c.fill(void 0),this.#f&&this.#k){this.#f.fill(0),this.#k.fill(0);for(let r of this.#h??[])r!==void 0&&clearTimeout(r);this.#h?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#m=0,this.#v=0,this.#$.length=0,this.#u=0,this.#s=0,this.#a&&this.#y){let r=this.#y,i;for(;i=r?.shift();)this.#n?.(...i)}}}});import{EventEmitter as V7}from"node:events";import NB from"node:stream";import{StringDecoder as ehe}from"node:string_decoder";var OB,the,rhe,nhe,Oo,Po,Ps,hg,Mp,gg,PB,vg,IB,Ta,lc,_n,zp,cc,bn,ni,wn,F7,yg,Un,rn,L7,M7,jB,z7,to,U7,_g,Up,ku,Ri,qp,ihe,ahe,ohe,she,bg,q7,uhe,lhe,Is,Z7=et(()=>{OB=typeof process=="object"&&process?process:{stdout:null,stderr:null},the=t=>!!t&&typeof t=="object"&&(t instanceof Is||t instanceof NB||rhe(t)||nhe(t)),rhe=t=>!!t&&typeof t=="object"&&t instanceof V7&&typeof t.pipe=="function"&&t.pipe!==NB.Writable.prototype.pipe,nhe=t=>!!t&&typeof t=="object"&&t instanceof V7&&typeof t.write=="function"&&typeof t.end=="function",Oo=Symbol("EOF"),Po=Symbol("maybeEmitEnd"),Ps=Symbol("emittedEnd"),hg=Symbol("emittingEnd"),Mp=Symbol("emittedError"),gg=Symbol("closed"),PB=Symbol("read"),vg=Symbol("flush"),IB=Symbol("flushChunk"),Ta=Symbol("encoding"),lc=Symbol("decoder"),_n=Symbol("flowing"),zp=Symbol("paused"),cc=Symbol("resume"),bn=Symbol("buffer"),ni=Symbol("pipes"),wn=Symbol("bufferLength"),F7=Symbol("bufferPush"),yg=Symbol("bufferShift"),Un=Symbol("objectMode"),rn=Symbol("destroyed"),L7=Symbol("error"),M7=Symbol("emitData"),jB=Symbol("emitEnd"),z7=Symbol("emitEnd2"),to=Symbol("async"),U7=Symbol("abort"),_g=Symbol("aborted"),Up=Symbol("signal"),ku=Symbol("dataListeners"),Ri=Symbol("discarded"),qp=t=>Promise.resolve().then(t),ihe=t=>t(),ahe=t=>t==="end"||t==="finish"||t==="prefinish",ohe=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,she=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),bg=class{src;dest;opts;ondrain;constructor(e,r,i){this.src=e,this.dest=r,this.opts=i,this.ondrain=()=>e[cc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},q7=class extends bg{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,i){super(e,r,i),this.proxyErrors=n=>this.dest.emit("error",n),e.on("error",this.proxyErrors)}},uhe=t=>!!t.objectMode,lhe=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Is=class extends V7{[_n]=!1;[zp]=!1;[ni]=[];[bn]=[];[Un];[Ta];[to];[lc];[Oo]=!1;[Ps]=!1;[hg]=!1;[gg]=!1;[Mp]=null;[wn]=0;[rn]=!1;[Up];[_g]=!1;[ku]=0;[Ri]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");uhe(r)?(this[Un]=!0,this[Ta]=null):lhe(r)?(this[Ta]=r.encoding,this[Un]=!1):(this[Un]=!1,this[Ta]=null),this[to]=!!r.async,this[lc]=this[Ta]?new ehe(this[Ta]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[bn]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ni]});let{signal:i}=r;i&&(this[Up]=i,i.aborted?this[U7]():i.addEventListener("abort",()=>this[U7]()))}get bufferLength(){return this[wn]}get encoding(){return this[Ta]}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[Un]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[to]}set async(e){this[to]=this[to]||!!e}[U7](){this[_g]=!0,this.emit("abort",this[Up]?.reason),this.destroy(this[Up]?.reason)}get aborted(){return this[_g]}set aborted(e){}write(e,r,i){if(this[_g])return!1;if(this[Oo])throw new Error("write after end");if(this[rn])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(i=r,r="utf8"),r||(r="utf8");let n=this[to]?qp:ihe;if(!this[Un]&&!Buffer.isBuffer(e)){if(she(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ohe(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Un]?(this[_n]&&this[wn]!==0&&this[vg](!0),this[_n]?this.emit("data",e):this[F7](e),this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n]):e.length?(typeof e=="string"&&!(r===this[Ta]&&!this[lc]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Ta]&&(e=this[lc].write(e)),this[_n]&&this[wn]!==0&&this[vg](!0),this[_n]?this.emit("data",e):this[F7](e),this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n]):(this[wn]!==0&&this.emit("readable"),i&&n(i),this[_n])}read(e){if(this[rn])return null;if(this[Ri]=!1,this[wn]===0||e===0||e&&e>this[wn])return this[Po](),null;this[Un]&&(e=null),this[bn].length>1&&!this[Un]&&(this[bn]=[this[Ta]?this[bn].join(""):Buffer.concat(this[bn],this[wn])]);let r=this[PB](e||null,this[bn][0]);return this[Po](),r}[PB](e,r){if(this[Un])this[yg]();else{let i=r;e===i.length||e===null?this[yg]():typeof i=="string"?(this[bn][0]=i.slice(e),r=i.slice(0,e),this[wn]-=e):(this[bn][0]=i.subarray(e),r=i.subarray(0,e),this[wn]-=e)}return this.emit("data",r),!this[bn].length&&!this[Oo]&&this.emit("drain"),r}end(e,r,i){return typeof e=="function"&&(i=e,e=void 0),typeof r=="function"&&(i=r,r="utf8"),e!==void 0&&this.write(e,r),i&&this.once("end",i),this[Oo]=!0,this.writable=!1,(this[_n]||!this[zp])&&this[Po](),this}[cc](){this[rn]||(!this[ku]&&!this[ni].length&&(this[Ri]=!0),this[zp]=!1,this[_n]=!0,this.emit("resume"),this[bn].length?this[vg]():this[Oo]?this[Po]():this.emit("drain"))}resume(){return this[cc]()}pause(){this[_n]=!1,this[zp]=!0,this[Ri]=!1}get destroyed(){return this[rn]}get flowing(){return this[_n]}get paused(){return this[zp]}[F7](e){this[Un]?this[wn]+=1:this[wn]+=e.length,this[bn].push(e)}[yg](){return this[Un]?this[wn]-=1:this[wn]-=this[bn][0].length,this[bn].shift()}[vg](e=!1){do;while(this[IB](this[yg]())&&this[bn].length);!e&&!this[bn].length&&!this[Oo]&&this.emit("drain")}[IB](e){return this.emit("data",e),this[_n]}pipe(e,r){if(this[rn])return e;this[Ri]=!1;let i=this[Ps];return r=r||{},e===OB.stdout||e===OB.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,i?r.end&&e.end():(this[ni].push(r.proxyErrors?new q7(this,e,r):new bg(this,e,r)),this[to]?qp(()=>this[cc]()):this[cc]()),e}unpipe(e){let r=this[ni].find(i=>i.dest===e);r&&(this[ni].length===1?(this[_n]&&this[ku]===0&&(this[_n]=!1),this[ni]=[]):this[ni].splice(this[ni].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let i=super.on(e,r);if(e==="data")this[Ri]=!1,this[ku]++,!this[ni].length&&!this[_n]&&this[cc]();else if(e==="readable"&&this[wn]!==0)super.emit("readable");else if(ahe(e)&&this[Ps])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Mp]){let n=r;this[to]?qp(()=>n.call(this,this[Mp])):n.call(this,this[Mp])}return i}removeListener(e,r){return this.off(e,r)}off(e,r){let i=super.off(e,r);return e==="data"&&(this[ku]=this.listeners("data").length,this[ku]===0&&!this[Ri]&&!this[ni].length&&(this[_n]=!1)),i}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ku]=0,!this[Ri]&&!this[ni].length&&(this[_n]=!1)),r}get emittedEnd(){return this[Ps]}[Po](){!this[hg]&&!this[Ps]&&!this[rn]&&this[bn].length===0&&this[Oo]&&(this[hg]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[gg]&&this.emit("close"),this[hg]=!1)}emit(e,...r){let i=r[0];if(e!=="error"&&e!=="close"&&e!==rn&&this[rn])return!1;if(e==="data")return!this[Un]&&!i?!1:this[to]?(qp(()=>this[M7](i)),!0):this[M7](i);if(e==="end")return this[jB]();if(e==="close"){if(this[gg]=!0,!this[Ps]&&!this[rn])return!1;let a=super.emit("close");return this.removeAllListeners("close"),a}else if(e==="error"){this[Mp]=i,super.emit(L7,i);let a=!this[Up]||this.listeners("error").length?super.emit("error",i):!1;return this[Po](),a}else if(e==="resume"){let a=super.emit("resume");return this[Po](),a}else if(e==="finish"||e==="prefinish"){let a=super.emit(e);return this.removeAllListeners(e),a}let n=super.emit(e,...r);return this[Po](),n}[M7](e){for(let i of this[ni])i.dest.write(e)===!1&&this.pause();let r=this[Ri]?!1:super.emit("data",e);return this[Po](),r}[jB](){return this[Ps]?!1:(this[Ps]=!0,this.readable=!1,this[to]?(qp(()=>this[z7]()),!0):this[z7]())}[z7](){if(this[lc]){let r=this[lc].end();if(r){for(let i of this[ni])i.dest.write(r);this[Ri]||super.emit("data",r)}}for(let r of this[ni])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Un]||(e.dataLength=0);let r=this.promise();return this.on("data",i=>{e.push(i),this[Un]||(e.dataLength+=i.length)}),await r,e}async concat(){if(this[Un])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ta]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(rn,()=>r(new Error("stream destroyed"))),this.on("error",i=>r(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Ri]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[Oo])return r();let a,o,s=c=>{this.off("data",l),this.off("end",u),this.off(rn,d),r(),o(c)},l=c=>{this.off("error",s),this.off("end",u),this.off(rn,d),this.pause(),a({value:c,done:!!this[Oo]})},u=()=>{this.off("error",s),this.off("data",l),this.off(rn,d),r(),a({done:!0,value:void 0})},d=()=>s(new Error("stream destroyed"));return new Promise((c,p)=>{o=p,a=c,this.once(rn,d),this.once("error",s),this.once("end",u),this.once("data",l)})},throw:r,return:r,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[Ri]=!1;let e=!1,r=()=>(this.pause(),this.off(L7,r),this.off(rn,r),this.off("end",r),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return r();let n=this.read();return n===null?r():{done:!1,value:n}};return this.once("end",r),this.once(L7,r),this.once(rn,r),{next:i,throw:r,return:r,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[rn])return e?this.emit("error",e):this.emit(rn),this;this[rn]=!0,this[Ri]=!0,this[bn].length=0,this[wn]=0;let r=this;return typeof r.close=="function"&&!this[gg]&&r.close(),e?this.emit("error",e):this.emit(rn),this}static get isStream(){return the}}});import{posix as che,win32 as K7}from"node:path";import{fileURLToPath as dhe}from"node:url";import{lstatSync as phe,readdir as fhe,readdirSync as mhe,readlinkSync as hhe,realpathSync as ghe}from"fs";import*as vhe from"node:fs";import{lstat as _he,readdir as bhe,readlink as whe,realpath as Ehe}from"node:fs/promises";var yhe,Zp,LB,MB,She,$he,ua,zB,UB,ro,qB,VB,xu,ZB,sa,Vp,G7,TB,Gp,Ba,wg,Sg,BB,khe,W7,RB,Wp,FB,Eg,$g,H7,GB,qn,kg,xg,Ag,dc,pc,Kp,RIe,WB,KB=et(()=>{CB();Z7();yhe=ghe.native,Zp={lstatSync:phe,readdir:fhe,readdirSync:mhe,readlinkSync:hhe,realpathSync:yhe,promises:{lstat:_he,readdir:bhe,readlink:whe,realpath:Ehe}},LB=t=>!t||t===Zp||t===vhe?Zp:{...Zp,...t,promises:{...Zp.promises,...t.promises||{}}},MB=/^\\\\\?\\([a-z]:)\\?$/i,She=t=>t.replace(/\//g,"\\").replace(MB,"$1\\"),$he=/[\\\/]/,ua=0,zB=1,UB=2,ro=4,qB=6,VB=8,xu=10,ZB=12,sa=15,Vp=~sa,G7=16,TB=32,Gp=64,Ba=128,wg=256,Sg=512,BB=Gp|Ba|Sg,khe=1023,W7=t=>t.isFile()?VB:t.isDirectory()?ro:t.isSymbolicLink()?xu:t.isCharacterDevice()?UB:t.isBlockDevice()?qB:t.isSocket()?ZB:t.isFIFO()?zB:ua,RB=new Lp({max:2**12}),Wp=t=>{let e=RB.get(t);if(e)return e;let r=t.normalize("NFKD");return RB.set(t,r),r},FB=new Lp({max:2**12}),Eg=t=>{let e=FB.get(t);if(e)return e;let r=Wp(t.toLowerCase());return FB.set(t,r),r},$g=class extends Lp{constructor(){super({max:256})}},H7=class extends Lp{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},GB=Symbol("PathScurry setAsCwd"),qn=class{name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#i;get mode(){return this.#i}#e;get nlink(){return this.#e}#n;get uid(){return this.#n}#_;get gid(){return this.#_}#g;get rdev(){return this.#g}#l;get blksize(){return this.#l}#s;get ino(){return this.#s}#u;get size(){return this.#u}#p;get blocks(){return this.#p}#c;get atimeMs(){return this.#c}#o;get mtimeMs(){return this.#o}#b;get ctimeMs(){return this.#b}#w;get birthtimeMs(){return this.#w}#m;get atime(){return this.#m}#v;get mtime(){return this.#v}#$;get ctime(){return this.#$}#y;get birthtime(){return this.#y}#S;#k;#f;#h;#E;#D;#a;#P;#I;#A;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=ua,i,n,a,o,s){this.name=e,this.#S=a?Eg(e):Wp(e),this.#a=r&khe,this.nocase=a,this.roots=n,this.root=i||this,this.#P=o,this.#f=s.fullpath,this.#E=s.relative,this.#D=s.relativePosix,this.parent=s.parent,this.parent?this.#t=this.parent.#t:this.#t=LB(s.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#P}resolve(e){if(!e)return this;let r=this.getRootString(e),n=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#j(n):this.#j(n)}#j(e){let r=this;for(let i of e)r=r.child(i);return r}children(){let e=this.#P.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#P.set(this,r),this.#a&=~G7,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),n=this.nocase?Eg(e):Wp(e);for(let l of i)if(l.#S===n)return l;let a=this.parent?this.sep:"",o=this.#f?this.#f+a+e:void 0,s=this.newChild(e,ua,{...r,parent:this,fullpath:o});return this.canReaddir()||(s.#a|=Ba),i.push(s),s}relative(){if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let e=this.name,r=this.parent;if(!r)return this.#E=this.name;let i=r.relative();return i+(!i||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let e=this.name,r=this.parent;if(!r)return this.#D=this.fullpathPosix();let i=r.relativePosix();return i+(!i||!r.parent?"":"/")+e}fullpath(){if(this.#f!==void 0)return this.#f;let e=this.name,r=this.parent;if(!r)return this.#f=this.name;let n=r.fullpath()+(r.parent?this.sep:"")+e;return this.#f=n}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let n=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(n)?this.#h=`//?/${n}`:this.#h=n}let e=this.parent,r=e.fullpathPosix(),i=r+(!r||!e.parent?"":"/")+this.name;return this.#h=i}isUnknown(){return(this.#a&sa)===ua}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.#a&sa)===VB}isDirectory(){return(this.#a&sa)===ro}isCharacterDevice(){return(this.#a&sa)===UB}isBlockDevice(){return(this.#a&sa)===qB}isFIFO(){return(this.#a&sa)===zB}isSocket(){return(this.#a&sa)===ZB}isSymbolicLink(){return(this.#a&xu)===xu}lstatCached(){return this.#a&TB?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#A}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let e=this.#a&sa;return!(e!==ua&&e!==xu||this.#a&wg||this.#a&Ba)}calledReaddir(){return!!(this.#a&G7)}isENOENT(){return!!(this.#a&Ba)}isNamed(e){return this.nocase?this.#S===Eg(e):this.#S===Wp(e)}async readlink(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(r);if(i)return this.#I=i}catch(r){this.#O(r.code);return}}readlinkSync(){let e=this.#I;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(r);if(i)return this.#I=i}catch(r){this.#O(r.code);return}}#L(e){this.#a|=G7;for(let r=e.provisional;r<e.length;r++){let i=e[r];i&&i.#x()}}#x(){this.#a&Ba||(this.#a=(this.#a|Ba)&Vp,this.#V())}#V(){let e=this.children();e.provisional=0;for(let r of e)r.#x()}#T(){this.#a|=Sg,this.#N()}#N(){if(this.#a&Gp)return;let e=this.#a;(e&sa)===ro&&(e&=Vp),this.#a=e|Gp,this.#V()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#N():e==="ENOENT"?this.#x():this.children().provisional=0}#C(e=""){e==="ENOTDIR"?this.parent.#N():e==="ENOENT"&&this.#x()}#O(e=""){let r=this.#a;r|=wg,e==="ENOENT"&&(r|=Ba),(e==="EINVAL"||e==="UNKNOWN")&&(r&=Vp),this.#a=r,e==="ENOTDIR"&&this.parent&&this.parent.#N()}#z(e,r){return this.#q(e,r)||this.#B(e,r)}#B(e,r){let i=W7(e),n=this.newChild(e.name,i,{parent:this}),a=n.#a&sa;return a!==ro&&a!==xu&&a!==ua&&(n.#a|=Gp),r.unshift(n),r.provisional++,n}#q(e,r){for(let i=r.provisional;i<r.length;i++){let n=r[i];if((this.nocase?Eg(e.name):Wp(e.name))===n.#S)return this.#H(e,n,i,r)}}#H(e,r,i,n){let a=r.name;return r.#a=r.#a&Vp|W7(e),a!==e.name&&(r.name=e.name),i!==n.provisional&&(i===n.length-1?n.pop():n.splice(i,1),n.unshift(r)),n.provisional++,r}async lstat(){if((this.#a&Ba)===0)try{return this.#Z(await this.#t.promises.lstat(this.fullpath())),this}catch(e){this.#C(e.code)}}lstatSync(){if((this.#a&Ba)===0)try{return this.#Z(this.#t.lstatSync(this.fullpath())),this}catch(e){this.#C(e.code)}}#Z(e){let{atime:r,atimeMs:i,birthtime:n,birthtimeMs:a,blksize:o,blocks:s,ctime:l,ctimeMs:u,dev:d,gid:c,ino:p,mode:f,mtime:m,mtimeMs:h,nlink:g,rdev:y,size:_,uid:w}=e;this.#m=r,this.#c=i,this.#y=n,this.#w=a,this.#l=o,this.#p=s,this.#$=l,this.#b=u,this.#r=d,this.#_=c,this.#s=p,this.#i=f,this.#v=m,this.#o=h,this.#e=g,this.#g=y,this.#u=_,this.#n=w;let E=W7(e);this.#a=this.#a&Vp|E|TB,E!==ua&&E!==ro&&E!==xu&&(this.#a|=Gp)}#R=[];#d=!1;#G(e){this.#d=!1;let r=this.#R.slice();this.#R.length=0,r.forEach(i=>i(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let a=i.slice(0,i.provisional);r?e(null,a):queueMicrotask(()=>e(null,a));return}if(this.#R.push(e),this.#d)return;this.#d=!0;let n=this.fullpath();this.#t.readdir(n,{withFileTypes:!0},(a,o)=>{if(a)this.#M(a.code),i.provisional=0;else{for(let s of o)this.#z(s,i);this.#L(i)}this.#G(i.slice(0,i.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let i=()=>{};this.#U=new Promise(n=>i=n);try{for(let n of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#z(n,e);this.#L(e)}catch(n){this.#M(n.code),e.provisional=0}this.#U=void 0,i()}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 r=this.fullpath();try{for(let i of this.#t.readdirSync(r,{withFileTypes:!0}))this.#z(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&BB)return!1;let e=sa&this.#a;return e===ua||e===ro||e===xu}shouldWalk(e,r){return(this.#a&ro)===ro&&!(this.#a&BB)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#A)return this.#A;if(!((Sg|wg|Ba)&this.#a))try{let e=await this.#t.promises.realpath(this.fullpath());return this.#A=this.resolve(e)}catch{this.#T()}}realpathSync(){if(this.#A)return this.#A;if(!((Sg|wg|Ba)&this.#a))try{let e=this.#t.realpathSync(this.fullpath());return this.#A=this.resolve(e)}catch{this.#T()}}[GB](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),i=[],n=this;for(;n&&n.parent;)r.add(n),n.#E=i.join(this.sep),n.#D=i.join("/"),n=n.parent,i.push("..");for(n=e;n&&n.parent&&!r.has(n);)n.#E=void 0,n.#D=void 0,n=n.parent}},kg=class t extends qn{sep="\\";splitSep=$he;constructor(e,r=ua,i,n,a,o,s){super(e,r,i,n,a,o,s)}newChild(e,r=ua,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return K7.parse(e).root}getRoot(e){if(e=She(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=i;return this.roots[e]=new dc(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(MB,"$1\\"),e===r}},xg=class t extends qn{splitSep="/";sep="/";constructor(e,r=ua,i,n,a,o,s){super(e,r,i,n,a,o,s)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=ua,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Ag=class{root;rootPath;roots;cwd;#t;#r;#i;nocase;#e;constructor(e=process.cwd(),r,i,{nocase:n,childrenCacheSize:a=16*1024,fs:o=Zp}={}){this.#e=LB(o),(e instanceof URL||e.startsWith("file://"))&&(e=dhe(e));let s=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(s),this.#t=new $g,this.#r=new $g,this.#i=new H7(a);let l=s.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),n===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=n,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,d=l.length-1,c=r.sep,p=this.rootPath,f=!1;for(let m of l){let h=d--;u=u.child(m,{relative:new Array(h).fill("..").join(c),relativePosix:new Array(h).fill("..").join("/"),fullpath:p+=(f?"":c)+m}),f=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#i}resolve(...e){let r="";for(let a=e.length-1;a>=0;a--){let o=e[a];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let i=this.#t.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpath();return this.#t.set(r,n),n}resolvePosix(...e){let r="";for(let a=e.length-1;a>=0;a--){let o=e[a];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let i=this.#r.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,n),n}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,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i}=r;if(e.canReaddir()){let n=await e.readdir();return i?n:n.map(a=>a.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0}=r;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(n=>n.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:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=await e.readlink();return r?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return r?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=await e.realpath();return r?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return r?i:i?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=[];(!a||a(e))&&s.push(i?e:e.fullpath());let l=new Set,u=(c,p)=>{l.add(c),c.readdirCB((f,m)=>{if(f)return p(f);let h=m.length;if(!h)return p();let g=()=>{--h===0&&p()};for(let y of m)(!a||a(y))&&s.push(i?y:y.fullpath()),n&&y.isSymbolicLink()?y.realpath().then(_=>_?.isUnknown()?_.lstat():_).then(_=>_?.shouldWalk(l,o)?u(_,g):g()):y.shouldWalk(l,o)?u(y,g):g()},!0)},d=e;return new Promise((c,p)=>{u(d,f=>{if(f)return p(f);c(s)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=[];(!a||a(e))&&s.push(i?e:e.fullpath());let l=new Set([e]);for(let u of l){let d=u.readdirSync();for(let c of d){(!a||a(c))&&s.push(i?c:c.fullpath());let p=c;if(c.isSymbolicLink()){if(!(n&&(p=c.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return s}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r;(!a||a(e))&&(yield i?e:e.fullpath());let s=new Set([e]);for(let l of s){let u=l.readdirSync();for(let d of u){(!a||a(d))&&(yield i?d:d.fullpath());let c=d;if(d.isSymbolicLink()){if(!(n&&(c=d.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(s,o)&&s.add(c)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=new Is({objectMode:!0});(!a||a(e))&&s.write(i?e:e.fullpath());let l=new Set,u=[e],d=0,c=()=>{let p=!1;for(;!p;){let f=u.shift();if(!f){d===0&&s.end();return}d++,l.add(f);let m=(g,y,_=!1)=>{if(g)return s.emit("error",g);if(n&&!_){let w=[];for(let E of y)E.isSymbolicLink()&&w.push(E.realpath().then(D=>D?.isUnknown()?D.lstat():D));if(w.length){Promise.all(w).then(()=>m(null,y,!0));return}}for(let w of y)w&&(!a||a(w))&&(s.write(i?w:w.fullpath())||(p=!0));d--;for(let w of y){let E=w.realpathCached()||w;E.shouldWalk(l,o)&&u.push(E)}p&&!s.flowing?s.once("drain",c):h||c()},h=!0;f.readdirCB(m,!0),h=!1}};return c(),s}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof qn||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:a,walkFilter:o}=r,s=new Is({objectMode:!0}),l=new Set;(!a||a(e))&&s.write(i?e:e.fullpath());let u=[e],d=0,c=()=>{let p=!1;for(;!p;){let f=u.shift();if(!f){d===0&&s.end();return}d++,l.add(f);let m=f.readdirSync();for(let h of m)(!a||a(h))&&(s.write(i?h:h.fullpath())||(p=!0));d--;for(let h of m){let g=h;if(h.isSymbolicLink()){if(!(n&&(g=h.realpathSync())))continue;g.isUnknown()&&g.lstatSync()}g.shouldWalk(l,o)&&u.push(g)}}p&&!s.flowing&&s.once("drain",c)};return c(),s}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[GB](r)}},dc=class extends Ag{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,K7,"\\",{...r,nocase:i}),this.nocase=i;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return K7.parse(e).root.toUpperCase()}newRoot(e){return new kg(this.rootPath,ro,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},pc=class extends Ag{sep="/";constructor(e=process.cwd(),r={}){let{nocase:i=!1}=r;super(e,che,"/",{...r,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new xg(this.rootPath,ro,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Kp=class extends pc{constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,{...r,nocase:i})}},RIe=process.platform==="win32"?kg:xg,WB=process.platform==="win32"?dc:process.platform==="darwin"?Kp:pc});var xhe,Ahe,fc,J7=et(()=>{Co();xhe=t=>t.length>=1,Ahe=t=>t.length>=1,fc=class t{#t;#r;#i;length;#e;#n;#_;#g;#l;#s;#u=!0;constructor(e,r,i,n){if(!xhe(e))throw new TypeError("empty pattern list");if(!Ahe(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#r=r,this.#i=i,this.#e=n,this.#i===0){if(this.isUNC()){let[a,o,s,l,...u]=this.#t,[d,c,p,f,...m]=this.#r;u[0]===""&&(u.shift(),m.shift());let h=[a,o,s,l,""].join("/"),g=[d,c,p,f,""].join("/");this.#t=[h,...u],this.#r=[g,...m],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[a,...o]=this.#t,[s,...l]=this.#r;o[0]===""&&(o.shift(),l.shift());let u=a+"/",d=s+"/";this.#t=[u,...o],this.#r=[d,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#i]}isString(){return typeof this.#t[this.#i]=="string"}isGlobstar(){return this.#t[this.#i]===tn}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#_=this.#_||(this.#i===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new t(this.#t,this.#r,this.#i+1,this.#e),this.#n.#s=this.#s,this.#n.#l=this.#l,this.#n.#g=this.#g,this.#n):this.#n=null}isUNC(){let e=this.#t;return this.#l!==void 0?this.#l:this.#l=this.#e==="win32"&&this.#i===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#g!==void 0?this.#g:this.#g=this.#e==="win32"&&this.#i===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#i===0?e:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#u?!1:(this.#u=!1,!0)}}});var Dhe,Au,Y7=et(()=>{Co();J7();Dhe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Au=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:i,noext:n,noglobstar:a,platform:o=Dhe}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:i,noext:n,noglobstar:a,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let s of e)this.add(s)}add(e){let r=new Bi(e,this.mmopts);for(let i=0;i<r.set.length;i++){let n=r.set[i],a=r.globParts[i];if(!n||!a)throw new Error("invalid pattern object");for(;n[0]==="."&&a[0]===".";)n.shift(),a.shift();let o=new fc(n,a,0,this.platform),s=new Bi(o.globString(),this.mmopts),l=a[a.length-1]==="**",u=o.isAbsolute();u?this.absolute.push(s):this.relative.push(s),l&&(u?this.absoluteChildren.push(s):this.relativeChildren.push(s))}}ignored(e){let r=e.fullpath(),i=`${r}/`,n=e.relative()||".",a=`${n}/`;for(let o of this.relative)if(o.match(n)||o.match(a))return!0;for(let o of this.absolute)if(o.match(r)||o.match(i))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let n of this.relativeChildren)if(n.match(i))return!0;for(let n of this.absoluteChildren)if(n.match(r))return!0;return!1}}});var X7,Q7,ew,Hp,HB=et(()=>{Co();X7=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let i=e.fullpath(),n=this.store.get(i);n?n.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Q7=class{store=new Map;add(e,r,i){let n=(r?2:0)|(i?1:0),a=this.store.get(e);this.store.set(e,a===void 0?n:n&a)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},ew=class{store=new Map;add(e,r){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(n=>n.globString()===r.globString())||i.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Hp=class t{hasWalkedCache;matches=new Q7;subwalks=new ew;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new X7}processPatterns(e,r){this.patterns=r;let i=r.map(n=>[e,n]);for(let[n,a]of i){this.hasWalkedCache.storeWalked(n,a);let o=a.root(),s=a.isAbsolute()&&this.opts.absolute!==!1;if(o){n=n.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let c=a.rest();if(c)a=c;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let l,u,d=!1;for(;typeof(l=a.pattern())=="string"&&(u=a.rest());)n=n.resolve(l),a=u,d=!0;if(l=a.pattern(),u=a.rest(),d){if(this.hasWalkedCache.hasWalked(n,a))continue;this.hasWalkedCache.storeWalked(n,a)}if(typeof l=="string"){let c=l===".."||l===""||l===".";this.matches.add(n.resolve(l),s,c);continue}else if(l===tn){(!n.isSymbolicLink()||this.follow||a.checkFollowGlobstar())&&this.subwalks.add(n,a);let c=u?.pattern(),p=u?.rest();if(!u||(c===""||c===".")&&!p)this.matches.add(n,s,c===""||c===".");else if(c===".."){let f=n.parent||n;p?this.hasWalkedCache.hasWalked(f,p)||this.subwalks.add(f,p):this.matches.add(f,s,!0)}}else l instanceof RegExp&&this.subwalks.add(n,a)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let i=this.subwalks.get(e),n=this.child();for(let a of r)for(let o of i){let s=o.isAbsolute(),l=o.pattern(),u=o.rest();l===tn?n.testGlobstar(a,o,u,s):l instanceof RegExp?n.testRegExp(a,l,u,s):n.testString(a,l,u,s)}return n}testGlobstar(e,r,i,n){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,n,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(e,i):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),i){let a=i.pattern();if(typeof a=="string"&&a!==".."&&a!==""&&a!==".")this.testString(e,a,i.rest(),n);else if(a===".."){let o=e.parent||e;this.subwalks.add(o,i)}else a instanceof RegExp&&this.testRegExp(e,a,i.rest(),n)}}testRegExp(e,r,i,n){r.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}testString(e,r,i,n){e.isNamed(r)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}}});var Che,Dg,Jp,Yp,JB=et(()=>{Z7();Y7();HB();Che=(t,e)=>typeof t=="string"?new Au([t],e):Array.isArray(t)?new Au(t,e):t,Dg=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#i;signal;maxDepth;includeChildMatches;constructor(e,r,i){if(this.patterns=e,this.path=r,this.opts=i,this.#i=!i.posix&&i.platform==="win32"?"\\":"/",this.includeChildMatches=i.includeChildMatches!==!1,(i.ignore||!this.includeChildMatches)&&(this.#r=Che(i.ignore??[],i),!this.includeChildMatches&&typeof this.#r.add!="function")){let n="cannot ignore child matches, ignore lacks add() method.";throw new Error(n)}this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#n(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,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}let a=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let o=await a.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(a,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||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,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}let a=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let o=a.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(a,r)}matchFinish(e,r){if(this.#e(e))return;if(!this.includeChildMatches&&this.#r?.add){let a=`${e.relativePosix()}/**`;this.#r.add(a)}let i=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let n=this.opts.mark&&e.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let a=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(a+n)}else{let a=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!a.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(a?o+a+n:"."+n)}}async match(e,r,i){let n=await this.matchCheck(e,i);n&&this.matchFinish(n,r)}matchSync(e,r,i){let n=this.matchCheckSync(e,i);n&&this.matchFinish(n,r)}walkCB(e,r,i){this.signal?.aborted&&i(),this.walkCB2(e,r,new Hp(this.opts),i)}walkCB2(e,r,i,n){if(this.#n(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2(e,r,i,n));return}i.processPatterns(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||(a++,this.match(s,l,u).then(()=>o()));for(let s of i.subwalkTargets()){if(this.maxDepth!==1/0&&s.depth()>=this.maxDepth)continue;a++;let l=s.readdirCached();s.calledReaddir()?this.walkCB3(s,l,i,o):s.readdirCB((u,d)=>this.walkCB3(s,d,i,o),!0)}o()}walkCB3(e,r,i,n){i=i.filterEntries(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||(a++,this.match(s,l,u).then(()=>o()));for(let[s,l]of i.subwalks.entries())a++,this.walkCB2(s,l,i.child(),o);o()}walkCBSync(e,r,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,r,new Hp(this.opts),i)}walkCB2Sync(e,r,i,n){if(this.#n(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,i,n));return}i.processPatterns(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||this.matchSync(s,l,u);for(let s of i.subwalkTargets()){if(this.maxDepth!==1/0&&s.depth()>=this.maxDepth)continue;a++;let l=s.readdirSync();this.walkCB3Sync(s,l,i,o)}o()}walkCB3Sync(e,r,i,n){i=i.filterEntries(e,r);let a=1,o=()=>{--a===0&&n()};for(let[s,l,u]of i.matches.entries())this.#e(s)||this.matchSync(s,l,u);for(let[s,l]of i.subwalks.entries())a++,this.walkCB2Sync(s,l,i.child(),o);o()}},Jp=class extends Dg{matches=new Set;constructor(e,r,i){super(e,r,i)}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,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(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}},Yp=class extends Dg{results;constructor(e,r,i){super(e,r,i),this.results=new Is({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}}});import{fileURLToPath as Ohe}from"node:url";var Phe,la,tw=et(()=>{Co();KB();J7();JB();Phe=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",la=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=Ohe(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=r.platform||Phe,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?dc:r.platform==="darwin"?Kp:r.platform?pc:WB;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",n={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},a=this.pattern.map(l=>new Bi(l,n)),[o,s]=a.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let d=s[u];if(!d)throw new Error("invalid pattern object");return new fc(l,d,0,this.platform)})}async walk(){return[...await new Jp(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 Jp(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 Yp(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 Yp(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 Cg,rw=et(()=>{Co();Cg=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new Bi(r,e).hasMagic())return!0;return!1}});var sw={};Cn(sw,{Glob:()=>la,Ignore:()=>Au,escape:()=>$u,glob:()=>nw,globIterate:()=>ow,globIterateSync:()=>Qp,globStream:()=>iw,globStreamSync:()=>Xp,globSync:()=>aw,hasMagic:()=>Cg,iterate:()=>tR,iterateSync:()=>eR,stream:()=>QB,streamSync:()=>XB,sync:()=>rR,unescape:()=>aa});function Xp(t,e={}){return new la(t,e).streamSync()}function iw(t,e={}){return new la(t,e).stream()}function aw(t,e={}){return new la(t,e).walkSync()}async function YB(t,e={}){return new la(t,e).walk()}function Qp(t,e={}){return new la(t,e).iterateSync()}function ow(t,e={}){return new la(t,e).iterate()}var XB,QB,eR,tR,rR,nw,uw=et(()=>{Co();tw();rw();Co();tw();rw();Y7();XB=Xp,QB=Object.assign(iw,{sync:Xp}),eR=Qp,tR=Object.assign(ow,{sync:Qp}),rR=Object.assign(aw,{stream:Xp,iterate:Qp}),nw=Object.assign(YB,{glob:YB,globSync:aw,sync:rR,globStream:iw,stream:QB,globStreamSync:Xp,streamSync:XB,globIterate:ow,iterate:tR,globIterateSync:Qp,iterateSync:eR,Glob:la,hasMagic:Cg,escape:$u,unescape:aa});nw.glob=nw});var mc,cw=et(()=>{"use strict";mc={version:1,system:{id:"artifact-contracts",name:"Artifact Contracts Agent System",default_workflow_order:["artifact-audit","discover"]},agents:{"artifact-discovery-agent":{role_name:"Artifact Discovery Agent",purpose:"Analyzes project file structure to generate or update artifact-contracts.yaml definitions. Identifies logical artifact groups, assigns appropriate types and authorities, designs path patterns, and detects trace link relationships between artifacts.",mode:"read-only",can_read_artifacts:["repository-files","artifact-definitions"],can_write_artifacts:[],can_execute_tools:["artifact-contracts-cli"],can_return_handoffs:["artifact-discovery-result"],can_invoke_agents:[],can_perform_validations:[],responsibilities:["Analyze project file structure and group files into logical artifacts","Assign appropriate type and authority to each artifact","Design path_patterns and exclude_patterns for each artifact","Detect trace link relationships between artifacts","Generate valid artifact-contracts.yaml content"],constraints:["Generated YAML must conform to artifact-contracts schema","Must use kebab-case for artifact IDs","Must not create overly broad path_patterns","In update mode, must preserve existing artifact definitions"],anti_patterns:["Creating one artifact per file instead of logical groupings",'Using overly broad patterns like "**/*"',"Ignoring existing project conventions"]},"artifact-quality-reviewer":{role_name:"Artifact Quality Reviewer",purpose:"Performs semantic quality review of artifact-contracts definitions. Analyzes naming consistency, authority appropriateness, path_patterns coverage, and manual_edit/change_control correctness. Reports structured findings for human or agent consumption.",mode:"read-only",can_read_artifacts:["artifact-definitions","artifact-config"],can_write_artifacts:[],can_execute_tools:["artifact-contracts-cli"],can_return_handoffs:["artifact-audit-result"],can_invoke_agents:[],can_perform_validations:["artifact-audit-validation"],responsibilities:["Analyze artifact definitions for naming consistency and conventions","Check authority assignments against artifact types","Identify common file types missing from the registry","Detect potential path_patterns gaps or issues","Recommend appropriate manual_edit and change_control settings"],constraints:["Never modify artifact definitions or config directly","Base analysis on resolved definitions and loaded config context only","Report findings in the artifact-audit-result handoff schema"],anti_patterns:["Generating overly broad path_patterns","Suggesting authority changes without clear justification"]}},tasks:{"discover-artifact-definitions":{description:"Analyze project file structure and generate artifact-contracts.yaml definitions. In init mode, create new definitions from scratch. In update mode, propose additions for uncovered files while preserving existing definitions.",target_agent:"artifact-discovery-agent",model_class:"standard",invocation_handoff:"artifact-discovery-request",result_handoff:"artifact-discovery-result",input_artifacts:["repository-files","artifact-definitions"],workflow:"discover",execution_steps:[{id:"gather-file-tree",action:"Gather repository file tree and project metadata",reads_artifact:"repository-files",required:!0},{id:"load-existing",action:"Load existing artifact-contracts.yaml if present",reads_artifact:"artifact-definitions",required:!1},{id:"classify-artifacts",action:"Group files into logical artifacts with type and authority",required:!0},{id:"detect-trace-links",action:"Identify trace link relationships between artifacts",required:!0},{id:"generate-yaml",action:"Produce artifact-contracts.yaml content",required:!0}]},"audit-artifact-definitions":{description:"Perform a semantic audit of artifact-contracts definitions. Analyze naming conventions, authority assignments, path coverage, and structural quality. Report findings in the artifact-audit-result handoff schema.",target_agent:"artifact-quality-reviewer",model_class:"standard",invocation_handoff:"artifact-audit-request",result_handoff:"artifact-audit-result",input_artifacts:["artifact-definitions","artifact-config"],workflow:"artifact-audit",validations:["artifact-audit-validation"],execution_steps:[{id:"load-definitions",action:"Load and resolve artifact-contracts definitions",reads_artifact:"artifact-definitions",uses_tool:"artifact-contracts-cli",required:!0},{id:"load-config",action:"Load artifact-config for authority and change_control context",reads_artifact:"artifact-config",uses_tool:"artifact-contracts-cli",required:!1},{id:"analyze-quality",action:"Analyze definitions for quality issues",required:!0},{id:"produce-report",action:"Produce audit findings in artifact-audit-result format",required:!0}]}},artifacts:{"cli-contract-definition":{type:"config",description:"CLI Contracts DSL definition",authority:"canonical",change_control:"approval-required",path_patterns:["cli-contract.yaml"]},"generated-cli":{type:"generated-code",description:"Auto-generated CLI scaffolding from cli-contracts",authority:"generated",path_patterns:["src/generated/**/*.ts"],exclude_patterns:["src/generated/dsl/**"]},"generated-dsl":{type:"generated-code",description:"Auto-generated DSL registries from agent-contracts-runtime",authority:"generated",path_patterns:["src/generated/dsl/**/*.ts"]},"core-library":{type:"source",description:"Core schema, resolver, matcher, lookup implementation",authority:"canonical",path_patterns:["src/core/**/*.ts"],exclude_patterns:["src/core/__tests__/**"]},"cli-handlers":{type:"source",description:"CLI command handler implementations",authority:"canonical",path_patterns:["src/cli/**/*.ts"],exclude_patterns:["src/cli/index.ts","src/cli/__tests__/**"]},"cli-entry":{type:"source",description:"CLI entry point and handler wiring",authority:"canonical",path_patterns:["src/cli/index.ts"]},"agent-integration":{type:"source",description:"LLM agent orchestration and adapter integration",authority:"canonical",path_patterns:["src/agents/**/*.ts"],exclude_patterns:["src/agents/__tests__/**"]},"agent-dsl":{type:"config",description:"Agent-contracts DSL definitions",authority:"canonical",change_control:"approval-required",path_patterns:["dsl/**/*.yaml"]},"generated-documentation":{type:"generated-doc",description:"Generated documentation",authority:"derived",path_patterns:["docs/**/*.md"]},"test-suite":{type:"source",description:"Unit and integration test files",authority:"canonical",path_patterns:["src/**/__tests__/**/*.ts","src/**/*.test.ts","src/**/*.spec.ts"]},"artifact-definitions":{type:"config",description:"artifact-contracts.yaml definitions (audit target, path supplied at runtime)",states:["valid","invalid"]},"artifact-config":{type:"config",description:"artifact-contracts.config.yaml processing settings (optional audit target)",states:["present","absent"]}},tools:{"artifact-contracts-cli":{kind:"cli",description:"artifact-contracts CLI \u2014 validate, resolve, list, and explain artifact definitions.",input_artifacts:["artifact-definitions","artifact-config"],output_artifacts:[],invokable_by:["artifact-quality-reviewer"],side_effects:[],commands:[{command:"npx artifact-contracts validate",category:"verification",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Schema validation and overlap detection"},{command:"npx artifact-contracts resolve",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Output resolved definitions with defaults applied"},{command:"npx artifact-contracts list",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"List registered artifacts"},{command:"npx artifact-contracts explain",category:"query",reads:["artifact-definitions","artifact-config"],writes:[],purpose:"Explain artifact properties for a file path"}]}},validations:{"artifact-audit-validation":{target_artifact:"artifact-definitions",kind:"semantic",executor_type:"agent",executor:"artifact-quality-reviewer",blocking:!1,description:"Semantic validation of artifact definitions quality, naming consistency, and coverage completeness.","x-scope":{agents:["artifact-quality-reviewer"],tasks:["audit-artifact-definitions"]},"x-rules":[{id:"schema-conformance",check:"output matches artifact-audit-result JSON Schema (version 1)",severity:"critical"},{id:"findings-non-empty-on-risk",check:'findings[] is non-empty when risk_level is not "none"',severity:"error"},{id:"recommended-actions-present",check:'recommended_actions[] contains at least one entry when risk_level >= "medium"',severity:"warning"},{id:"finding-ids-unique",check:"all finding id values within findings[] are unique",severity:"error"}]}},handoff_types:{"artifact-discovery-request":{version:1,schema:{type:"object",properties:{mode:{type:"string",enum:["init","update"],description:"Whether creating new or updating existing definitions"},file_tree:{type:"string",description:"Repository file listing"},existing_definitions:{type:"string",description:"Current artifact-contracts.yaml content (update mode)"},project_metadata:{type:"string",description:"Package.json and other project metadata"}},required:["mode","file_tree"]}},"artifact-discovery-result":{version:1,schema:{type:"object",properties:{artifact_contracts_yaml:{type:"string",description:"Generated YAML content for artifact-contracts.yaml"},decisions:{type:"array",items:{type:"object",properties:{artifact_id:{type:"string"},reasoning:{type:"string"}},required:["artifact_id","reasoning"]}},trace_decisions:{type:"array",items:{type:"object",properties:{link_id:{type:"string"},reasoning:{type:"string"}},required:["link_id","reasoning"]}},uncategorized_files:{type:"array",items:{type:"string"}},suggestions:{type:"array",items:{type:"string"}}},required:["artifact_contracts_yaml"]}},"artifact-audit-request":{version:1,schema:{type:"object",properties:{system_id:{type:"string",description:"System ID from artifact-contracts"},artifact_count:{type:"integer",description:"Total number of artifacts"},definitions_context:{type:"string",description:"Resolved artifact definitions as context"}},required:["system_id","artifact_count","definitions_context"]}},"artifact-audit-result":{version:1,schema:{type:"object",properties:{summary:{type:"string"},risk_level:{type:"string",enum:["none","low","medium","high","critical"]},findings:{type:"array",items:{type:"object",properties:{id:{type:"string"},severity:{type:"string",enum:["critical","error","warning","info"]},category:{type:"string"},title:{type:"string"},description:{type:"string"},target:{type:"string"},recommendation:{type:"string"},evidence:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:["schema","code","config","runtime","doc"]},target:{type:"string"},location:{type:"string"},excerpt:{type:"string"},reasoning:{type:"string"}},required:["kind"]}}},required:["id","severity","category","title","description"]}},recommended_actions:{type:"array",items:{type:"object",properties:{action:{type:"string"},priority:{type:"string",enum:["high","medium","low"]},description:{type:"string"}},required:["action","priority"]}},metadata:{type:"object",properties:{total_artifacts:{type:"integer"},analyzed_artifacts:{type:"integer"},analysis_scope:{type:"string"}}}},required:["summary","risk_level","findings","recommended_actions"]}}},guardrails:{"output-schema-conformance":{description:"LLM output must conform to the declared handoff schema. Non-conforming output triggers a structured correction re-prompt up to max_attempts before falling back to rejection.",scope:{agents:["artifact-quality-reviewer"],tasks:["audit-artifact-definitions"]},"x-on-violation":{action:"retry_with_correction_prompt",max_attempts:2,fallback:"reject"}}},guardrail_policies:{"audit-quality-policy":{description:"Enforce output conformance for audit commands",rules:[{guardrail:"output-schema-conformance",severity:"mandatory",action:"block",allow_override:!1}]}},workflow:{discover:{description:"Discover artifacts from project file structure",entry_conditions:["repository file tree must be accessible"],steps:[{type:"delegate",description:"Analyze file structure and generate definitions",task:"discover-artifact-definitions",from_agent:"artifact-discovery-agent",max_retries:1,"x-on-exhausted":"escalate"}]},"artifact-audit":{description:"Run semantic audit of artifact definitions",entry_conditions:["artifact-definitions must resolve without validation errors"],steps:[{type:"delegate",description:"Execute the semantic audit task",task:"audit-artifact-definitions",from_agent:"artifact-quality-reviewer",max_retries:1,"x-on-exhausted":"escalate"},{type:"gate",description:"Block progression if audit findings reach a critical or high risk level",gate_kind:"artifact-audit-result","x-condition":{field:"risk_level",operator:"in",values:["critical","high"]},"x-on-block":"halt","x-on-pass":"continue"}]}}}});var ii=He(Fi=>{"use strict";Fi.__esModule=!0;Fi.extend=cR;Fi.indexOf=Fhe;Fi.escapeExpression=Lhe;Fi.isEmpty=Mhe;Fi.createFrame=zhe;Fi.blockParams=Uhe;Fi.appendContextPath=qhe;var Nhe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},The=/[&<>"'`=]/g,Bhe=/[&<>"'`=]/;function Rhe(t){return Nhe[t]}function cR(t){for(var e=1;e<arguments.length;e++)for(var r in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],r)&&(t[r]=arguments[e][r]);return t}var pw=Object.prototype.toString;Fi.toString=pw;var dw=function(e){return typeof e=="function"};dw(/x/)&&(Fi.isFunction=dw=function(t){return typeof t=="function"&&pw.call(t)==="[object Function]"});Fi.isFunction=dw;var dR=Array.isArray||function(t){return t&&typeof t=="object"?pw.call(t)==="[object Array]":!1};Fi.isArray=dR;function Fhe(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function Lhe(t){if(typeof t!="string"){if(t&&t.toHTML)return t.toHTML();if(t==null)return"";if(!t)return t+"";t=""+t}return Bhe.test(t)?t.replace(The,Rhe):t}function Mhe(t){return!t&&t!==0?!0:!!(dR(t)&&t.length===0)}function zhe(t){var e=cR({},t);return e._parent=t,e}function Uhe(t,e){return t.path=e,t}function qhe(t,e){return(t?t+".":"")+e}});var Li=He((Og,pR)=>{"use strict";Og.__esModule=!0;var fw=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function mw(t,e){var r=e&&e.loc,i=void 0,n=void 0,a=void 0,o=void 0;r&&(i=r.start.line,n=r.end.line,a=r.start.column,o=r.end.column,t+=" - "+i+":"+a);for(var s=Error.prototype.constructor.call(this,t),l=0;l<fw.length;l++)this[fw[l]]=s[fw[l]];Error.captureStackTrace&&Error.captureStackTrace(this,mw);try{r&&(this.lineNumber=i,this.endLineNumber=n,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:o,enumerable:!0})):(this.column=a,this.endColumn=o))}catch{}}mw.prototype=new Error;Og.default=mw;pR.exports=Og.default});var mR=He((Pg,fR)=>{"use strict";Pg.__esModule=!0;var hw=ii();Pg.default=function(t){t.registerHelper("blockHelperMissing",function(e,r){var i=r.inverse,n=r.fn;if(e===!0)return n(this);if(e===!1||e==null)return i(this);if(hw.isArray(e))return e.length>0?(r.ids&&(r.ids=[r.name]),t.helpers.each(e,r)):i(this);if(r.data&&r.ids){var a=hw.createFrame(r.data);a.contextPath=hw.appendContextPath(r.data.contextPath,r.name),r={data:a}}return n(e,r)})};fR.exports=Pg.default});var gR=He((Ig,hR)=>{"use strict";Ig.__esModule=!0;function Vhe(t){return t&&t.__esModule?t:{default:t}}var ef=ii(),Zhe=Li(),Ghe=Vhe(Zhe);Ig.default=function(t){t.registerHelper("each",function(e,r){if(!r)throw new Ghe.default("Must pass iterator to #each");var i=r.fn,n=r.inverse,a=0,o="",s=void 0,l=void 0;r.data&&r.ids&&(l=ef.appendContextPath(r.data.contextPath,r.ids[0])+"."),ef.isFunction(e)&&(e=e.call(this)),r.data&&(s=ef.createFrame(r.data));function u(m,h,g){s&&(s.key=m,s.index=h,s.first=h===0,s.last=!!g,l&&(s.contextPath=l+m)),o=o+i(e[m],{data:s,blockParams:ef.blockParams([e[m],m],[l+m,null])})}if(e&&typeof e=="object")if(ef.isArray(e))for(var d=e.length;a<d;a++)a in e&&u(a,a,a===e.length-1);else if(typeof Symbol=="function"&&e[Symbol.iterator]){for(var c=[],p=e[Symbol.iterator](),f=p.next();!f.done;f=p.next())c.push(f.value);e=c;for(var d=e.length;a<d;a++)u(a,a,a===e.length-1)}else(function(){var m=void 0;Object.keys(e).forEach(function(h){m!==void 0&&u(m,a-1),m=h,a++}),m!==void 0&&u(m,a-1,!0)})();return a===0&&(o=n(this)),o})};hR.exports=Ig.default});var yR=He((jg,vR)=>{"use strict";jg.__esModule=!0;function Whe(t){return t&&t.__esModule?t:{default:t}}var Khe=Li(),Hhe=Whe(Khe);jg.default=function(t){t.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new Hhe.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};vR.exports=jg.default});var ER=He((Ng,wR)=>{"use strict";Ng.__esModule=!0;function Jhe(t){return t&&t.__esModule?t:{default:t}}var _R=ii(),Yhe=Li(),bR=Jhe(Yhe);Ng.default=function(t){t.registerHelper("if",function(e,r){if(arguments.length!=2)throw new bR.default("#if requires exactly one argument");return _R.isFunction(e)&&(e=e.call(this)),!r.hash.includeZero&&!e||_R.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,r){if(arguments.length!=2)throw new bR.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:r.inverse,inverse:r.fn,hash:r.hash})})};wR.exports=Ng.default});var $R=He((Tg,SR)=>{"use strict";Tg.__esModule=!0;Tg.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],r=arguments[arguments.length-1],i=0;i<arguments.length-1;i++)e.push(arguments[i]);var n=1;r.hash.level!=null?n=r.hash.level:r.data&&r.data.level!=null&&(n=r.data.level),e[0]=n,t.log.apply(t,e)})};SR.exports=Tg.default});var xR=He((Bg,kR)=>{"use strict";Bg.__esModule=!0;Bg.default=function(t){t.registerHelper("lookup",function(e,r,i){return e&&i.lookupProperty(e,r)})};kR.exports=Bg.default});var DR=He((Rg,AR)=>{"use strict";Rg.__esModule=!0;function Xhe(t){return t&&t.__esModule?t:{default:t}}var tf=ii(),Qhe=Li(),e0e=Xhe(Qhe);Rg.default=function(t){t.registerHelper("with",function(e,r){if(arguments.length!=2)throw new e0e.default("#with requires exactly one argument");tf.isFunction(e)&&(e=e.call(this));var i=r.fn;if(tf.isEmpty(e))return r.inverse(this);var n=r.data;return r.data&&r.ids&&(n=tf.createFrame(r.data),n.contextPath=tf.appendContextPath(r.data.contextPath,r.ids[0])),i(e,{data:n,blockParams:tf.blockParams([e],[n&&n.contextPath])})})};AR.exports=Rg.default});var gw=He(Fg=>{"use strict";Fg.__esModule=!0;Fg.registerDefaultHelpers=h0e;Fg.moveHelperToHooks=g0e;function Du(t){return t&&t.__esModule?t:{default:t}}var t0e=mR(),r0e=Du(t0e),n0e=gR(),i0e=Du(n0e),a0e=yR(),o0e=Du(a0e),s0e=ER(),u0e=Du(s0e),l0e=$R(),c0e=Du(l0e),d0e=xR(),p0e=Du(d0e),f0e=DR(),m0e=Du(f0e);function h0e(t){r0e.default(t),i0e.default(t),o0e.default(t),u0e.default(t),c0e.default(t),p0e.default(t),m0e.default(t)}function g0e(t,e,r){t.helpers[e]&&(t.hooks[e]=t.helpers[e],r||(t.helpers[e]=void 0))}});var OR=He((Lg,CR)=>{"use strict";Lg.__esModule=!0;var v0e=ii();Lg.default=function(t){t.registerDecorator("inline",function(e,r,i,n){var a=e;return r.partials||(r.partials={},a=function(o,s){var l=i.partials;i.partials=v0e.extend({},l,r.partials);var u=e(o,s);return i.partials=l,u}),r.partials[n.args[0]]=n.fn,a})};CR.exports=Lg.default});var PR=He(vw=>{"use strict";vw.__esModule=!0;vw.registerDefaultDecorators=w0e;function y0e(t){return t&&t.__esModule?t:{default:t}}var _0e=OR(),b0e=y0e(_0e);function w0e(t){b0e.default(t)}});var yw=He((Mg,IR)=>{"use strict";Mg.__esModule=!0;var E0e=ii(),hc={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var r=E0e.indexOf(hc.methodMap,e.toLowerCase());r>=0?e=r:e=parseInt(e,10)}return e},log:function(e){if(e=hc.lookupLevel(e),typeof console<"u"&&hc.lookupLevel(hc.level)<=e){var r=hc.methodMap[e];console[r]||(r="log");for(var i=arguments.length,n=Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];console[r].apply(console,n)}}};Mg.default=hc;IR.exports=Mg.default});var _w=He(rf=>{"use strict";rf.__esModule=!0;rf.createProtoAccessControl=x0e;rf.resultIsAllowed=A0e;rf.resetLoggedProperties=C0e;function S0e(t){return t&&t.__esModule?t:{default:t}}var jR=ii(),$0e=yw(),k0e=S0e($0e),zg=Object.create(null);function x0e(t){var e=Object.create(null);e.__proto__=!1,jR.extend(e,t.allowedProtoProperties);var r=Object.create(null);return r.constructor=!1,r.__defineGetter__=!1,r.__defineSetter__=!1,r.__lookupGetter__=!1,r.__lookupSetter__=!1,jR.extend(r,t.allowedProtoMethods),{properties:{whitelist:e,defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:r,defaultValue:t.allowProtoMethodsByDefault}}}function A0e(t,e,r){return NR(typeof t=="function"?e.methods:e.properties,r)}function NR(t,e){return t.whitelist[e]!==void 0?t.whitelist[e]===!0:t.defaultValue!==void 0?t.defaultValue:(D0e(e),!1)}function D0e(t){zg[t]!==!0&&(zg[t]=!0,k0e.default.log("error",'Handlebars: Access has been denied to resolve the property "'+t+`" because it is not an "own property" of its parent.
232
232
  You can add a runtime option to disable the check or this warning:
233
233
  See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function C0e(){Object.keys(zg).forEach(function(t){delete zg[t]})}});var qg=He(no=>{"use strict";no.__esModule=!0;no.HandlebarsEnvironment=Ew;function TR(t){return t&&t.__esModule?t:{default:t}}var Cu=ii(),O0e=Li(),bw=TR(O0e),P0e=gw(),I0e=PR(),j0e=yw(),Ug=TR(j0e),N0e=_w(),T0e="4.7.9";no.VERSION=T0e;var B0e=8;no.COMPILER_REVISION=B0e;var R0e=7;no.LAST_COMPATIBLE_COMPILER_REVISION=R0e;var F0e={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};no.REVISION_CHANGES=F0e;var ww="[object Object]";function Ew(t,e,r){this.helpers=t||{},this.partials=e||{},this.decorators=r||{},P0e.registerDefaultHelpers(this),I0e.registerDefaultDecorators(this)}Ew.prototype={constructor:Ew,logger:Ug.default,log:Ug.default.log,registerHelper:function(e,r){if(Cu.toString.call(e)===ww){if(r)throw new bw.default("Arg not supported with multiple helpers");Cu.extend(this.helpers,e)}else this.helpers[e]=r},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,r){if(Cu.toString.call(e)===ww)Cu.extend(this.partials,e);else{if(typeof r>"u")throw new bw.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=r}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,r){if(Cu.toString.call(e)===ww){if(r)throw new bw.default("Arg not supported with multiple decorators");Cu.extend(this.decorators,e)}else this.decorators[e]=r},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){N0e.resetLoggedProperties()}};var L0e=Ug.default.log;no.log=L0e;no.createFrame=Cu.createFrame;no.logger=Ug.default});var RR=He((Vg,BR)=>{"use strict";Vg.__esModule=!0;function Sw(t){this.string=t}Sw.prototype.toString=Sw.prototype.toHTML=function(){return""+this.string};Vg.default=Sw;BR.exports=Vg.default});var FR=He($w=>{"use strict";$w.__esModule=!0;$w.wrapHelper=M0e;function M0e(t,e){if(typeof t!="function")return t;var r=function(){var n=arguments[arguments.length-1];return arguments[arguments.length-1]=e(n),t.apply(this,arguments)};return r}});var VR=He(js=>{"use strict";js.__esModule=!0;js.checkRevision=G0e;js.template=W0e;js.wrapProgram=Zg;js.resolvePartial=K0e;js.invokePartial=H0e;js.noop=UR;function z0e(t){return t&&t.__esModule?t:{default:t}}function U0e(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}var q0e=ii(),gc=U0e(q0e),V0e=Li(),Io=z0e(V0e),jo=qg(),LR=gw(),Z0e=FR(),MR=_w();function G0e(t){var e=t&&t[0]||1,r=jo.COMPILER_REVISION;if(!(e>=jo.LAST_COMPATIBLE_COMPILER_REVISION&&e<=jo.COMPILER_REVISION))if(e<jo.LAST_COMPATIBLE_COMPILER_REVISION){var i=jo.REVISION_CHANGES[r],n=jo.REVISION_CHANGES[e];throw new Io.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+n+").")}else throw new Io.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}function W0e(t,e){if(!e)throw new Io.default("No environment passed to template");if(!t||!t.main)throw new Io.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var r=t.compiler&&t.compiler[0]===7;function i(o,s,l){l.hash&&(s=gc.extend({},s,l.hash),l.ids&&(l.ids[0]=!0)),o=e.VM.resolvePartial.call(this,o,s,l),l.hooks=this.hooks,l.protoAccessControl=this.protoAccessControl;var u=e.VM.invokePartial.call(this,o,s,l);if(u==null&&e.compile&&(l.partials[l.name]=e.compile(o,t.compilerOptions,e),u=l.partials[l.name](s,l)),u!=null){if(l.indent){for(var d=u.split(`
234
234
  `),c=0,p=d.length;c<p&&!(!d[c]&&c+1===p);c++)d[c]=l.indent+d[c];u=d.join(`
@@ -1222,7 +1222,7 @@ cli_contracts: 0.1.0
1222
1222
 
1223
1223
  info:
1224
1224
  title: artifact-contracts CLI
1225
- version: 0.1.1
1225
+ version: 0.34.4
1226
1226
  description: >-
1227
1227
  Declarative artifact registry \u2014 define file properties, resolve
1228
1228
  paths to artifact IDs, and detect definition overlaps.
@@ -1920,7 +1920,7 @@ components:
1920
1920
  "cli_contracts": "0.1.0",
1921
1921
  "info": {
1922
1922
  "title": "artifact-contracts CLI",
1923
- "version": "0.1.1",
1923
+ "version": "0.34.4",
1924
1924
  "description": "Declarative artifact registry \u2014 define file properties, resolve paths to artifact IDs, and detect definition overlaps. stdout is reserved for primary output (JSON/YAML/text result); all diagnostics and progress messages go to stderr.",
1925
1925
  "license": {
1926
1926
  "name": "MIT"
@@ -2993,11 +2993,11 @@ components:
2993
2993
  }
2994
2994
  }`;function nC(t,e){let r=new XD;return r.name("artifact-contracts").version(e,"-V, --version").description("Artifact registry CLI \u2014 validate definitions, resolve artifacts, list registered entries, and explain file properties."),r.option("--introspect","Output derived policy as JSON without executing the command"),r.command("validate").description("Validate artifact-contracts definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--check-files","Scan repository files to detect path_patterns overlaps that static glob analysis cannot fully determine. When enabled, reads all files from git ls-files or glob.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("validate",i);console.log(JSON.stringify(o,null,2));return}await t.validate(i,a)}),r.command("resolve").description("Output fully-resolved artifact definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--format <value>","Output format (default: yaml)").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("resolve",i);console.log(JSON.stringify(o,null,2));return}await t.resolve(i,a)}),r.command("list").description("List registered artifacts").option("--config <path>","Path to artifact-contracts.config.yaml").option("--authority <value>","Filter by authority type").option("--path <file>","Reverse-lookup \u2014 show artifact IDs matching this file path. For full governance details, use the explain command.").option("--format <value>","Output format (default: text)").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("list",i);console.log(JSON.stringify(o,null,2));return}await t.list(i,a)}),r.command("explain").description("Explain artifact properties for a file path").argument("<path>","File path to explain").option("--config <path>","Path to artifact-contracts.config.yaml").option("--format <value>","Output format (default: text)").action(async(i,n,a)=>{let o=a.optsWithGlobals();if(o.introspect){let s=ls("explain",n);console.log(JSON.stringify(s,null,2));return}await t.explain(i,n,o)}),r.command("audit").description("LLM-based semantic audit of artifact definitions").option("--config <path>","Path to artifact-contracts.config.yaml").option("--adapter <value>","LLM adapter to use").option("--model <value>","Model name to pass to the adapter").option("--show-prompt","Output the constructed prompt without calling the LLM API").option("-n, --dry-run","Alias for --show-prompt (output prompt without LLM call)").option("--fail-on <value>","Minimum severity that causes exit 10. Ordering: critical > error > warning > info. For example, --fail-on warning exits 10 on warning, error, or critical.").option("-o, --output <file>","Write result to a file instead of stdout").option("--report-format <value>","Output format for the report (default: text). LLM commands use --report-format; deterministic commands use --format.").option("-l, --log-file <value>","Write agent progress log to this file path.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("audit",i);console.log(JSON.stringify(o,null,2));return}if(i.showPrompt){let o=await t.audit(i,a);typeof o=="string"&&process.stdout.write(o+`
2995
2995
  `);return}await t.audit(i,a)}),r.command("discover").description("LLM-based artifact discovery from project file structure").option("--adapter <value>","LLM adapter to use").option("--model <value>","Model name to pass to the adapter").option("--show-prompt","Output the constructed prompt without calling the LLM API").option("-n, --dry-run","Alias for --show-prompt (output prompt without LLM call)").option("-w, --write","Write the generated YAML directly to artifact-contracts.yaml").option("-o, --output <file>","Write result to a specific file path instead of stdout").option("--report-format <value>","Output format (default: yaml)").option("-l, --log-file <value>","Write agent progress log to this file path.").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("discover",i);console.log(JSON.stringify(o,null,2));return}if(i.showPrompt){let o=await t.discover(i,a);typeof o=="string"&&process.stdout.write(o+`
2996
- `);return}await t.discover(i,a)}),r.command("agents").description("Output the full resolved agent DSL as structured data.").option("-F, --format <value>","Output format.","yaml").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("agents",i);console.log(JSON.stringify(o,null,2));return}await t.agents(i,a)}),r.command("extract").description("Extract contract specification for this CLI tool.").argument("[commands...]","Command IDs to extract. Use dot notation.").option("-a, --all","Extract all commands.",!1).option("--include-meta","Include extraction metadata.",!0).option("-F, --format <format>","Output format (yaml or json).","yaml").action(async(i,n,a)=>{i.length===0&&!n.all&&(process.stderr.write(JSON.stringify({code:"INVALID_ARGS",message:"Specify command IDs or use --all"})+`
2997
- `),process.exit(2));let o=n.format||"yaml",s=JSON.parse(rC),l=n.all?[]:i;if(l.length===0)if(o==="json"){let u={};n.includeMeta&&(u._meta={source:"embedded",type:"cli-contracts/extract",extractedAt:new Date().toISOString(),specVersion:s.cli_contracts??"0.1.0",commands:["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"]}),Object.assign(u,s),process.stdout.write(JSON.stringify(u,null,2)+`
2998
- `)}else{let u=[];if(u.push("# artifact-contracts extract"),u.push("# source: embedded"),u.push("# type: cli-contracts/command-extract"),n.includeMeta){u.push("---"),u.push("source: embedded"),u.push("type: cli-contracts/command-extract"),u.push("extractedAt: "+new Date().toISOString()),u.push("spec_version: "+(s.cli_contracts??"0.1.0")),u.push("commands:");for(let d of["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"])u.push(" - "+d)}u.push("---"),u.push(tC),process.stdout.write(u.join(`
2996
+ `);return}await t.discover(i,a)}),r.command("agents").description("Output the full resolved agent DSL as structured data.").option("-F, --format <value>","Output format.","yaml").action(async(i,n)=>{let a=n.optsWithGlobals();if(a.introspect){let o=ls("agents",i);console.log(JSON.stringify(o,null,2));return}await t.agents(i,a)}),r.command("extract").description("Extract contract specification for this CLI tool.").argument("[commands...]","Command IDs to extract. Use dot notation.").option("-a, --all","Extract all commands.",!1).option("--include-meta","Include extraction metadata.",!0).option("-F, --format <format>","Output format (yaml or json).","yaml").action(async(i,n)=>{i.length===0&&!n.all&&(process.stderr.write(JSON.stringify({code:"INVALID_ARGS",message:"Specify command IDs or use --all"})+`
2997
+ `),process.exit(2));let a=n.format||"yaml",o=JSON.parse(rC),s=n.all?[]:i;if(s.length===0)if(a==="json"){let l={};n.includeMeta&&(l._meta={source:"embedded",type:"cli-contracts/extract",extractedAt:new Date().toISOString(),specVersion:o.cli_contracts??"0.1.0",commands:["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"]}),Object.assign(l,o),process.stdout.write(JSON.stringify(l,null,2)+`
2998
+ `)}else{let l=[];if(l.push("# artifact-contracts extract"),l.push("# source: embedded"),l.push("# type: cli-contracts/command-extract"),n.includeMeta){l.push("---"),l.push("source: embedded"),l.push("type: cli-contracts/command-extract"),l.push("extractedAt: "+new Date().toISOString()),l.push("spec_version: "+(o.cli_contracts??"0.1.0")),l.push("commands:");for(let u of["artifact-contracts.validate","artifact-contracts.resolve","artifact-contracts.list","artifact-contracts.explain","artifact-contracts.audit","artifact-contracts.discover","artifact-contracts.agents"])l.push(" - "+u)}l.push("---"),l.push(tC),process.stdout.write(l.join(`
2999
2999
  `)+`
3000
- `)}else{let u={cli_contracts:s.cli_contracts,info:s.info,command_sets:{}},d=u.command_sets;for(let[c,p]of Object.entries(s.command_sets??{})){let f=p.commands;if(!f)continue;let m={};for(let[h,g]of Object.entries(f)){let y=c+"."+h;l.some(_=>_===h||_===y||h.startsWith(_+"."))&&(m[h]=g)}if(Object.keys(m).length>0){let h={...p};h.commands=m,d[c]=h}}s.components&&(u.components=s.components),process.stdout.write(JSON.stringify(u,null,2)+`
3000
+ `)}else{let l={cli_contracts:o.cli_contracts,info:o.info,command_sets:{}},u=l.command_sets;for(let[d,c]of Object.entries(o.command_sets??{})){let p=c.commands;if(!p)continue;let f={};for(let[m,h]of Object.entries(p)){let g=d+"."+m;s.some(y=>y===m||y===g||m.startsWith(y+"."))&&(f[m]=h)}if(Object.keys(f).length>0){let m={...c};m.commands=f,u[d]=m}}o.components&&(l.components=o.components),process.stdout.write(JSON.stringify(l,null,2)+`
3001
3001
  `)}process.exit(0)}),r}rp();var p1=/^[a-z0-9]+(-[a-z0-9]+)*$/,nj=Ve.enum(["canonical","derived","generated","control"]),ij=Ve.enum(["allowed","discouraged","forbidden"]),aj=Ve.enum(["none","approval-required","regeneration-required"]),oj=Ve.enum(["public","internal","private"]),sj=Ve.object({type:Ve.string().min(1),description:Ve.string().optional(),authority:nj,path_patterns:Ve.array(Ve.string().min(1)).min(1),exclude_patterns:Ve.array(Ve.string().min(1)).optional(),manual_edit:ij.optional(),change_control:aj.optional(),visibility:oj.optional(),states:Ve.array(Ve.string()).optional()}).passthrough(),uj=Ve.object({id:Ve.string().min(1),name:Ve.string().optional()}),lj=Ve.enum(["operationId","ast","naming","codegen"]),cj=Ve.object({id:Ve.string().min(1),from:Ve.string().min(1),to:Ve.string().min(1),resolver:lj,description:Ve.string().optional()}).passthrough(),dj=Ve.object({links:Ve.array(cj).min(1)}),np=Ve.object({artifact_contracts:Ve.string().min(1),system:uj,artifacts:Ve.record(Ve.string(),sj),trace:dj.optional()}),ple=Ve.record(Ve.string(),Ve.union([Ve.string(),Ve.array(Ve.string())])),U9=Ve.object({input:Ve.object({files:Ve.array(Ve.string()).default(["artifact-contracts.yaml"])}).optional(),variables:ple.optional()}),fle={canonical:{manual_edit:"allowed",change_control:"none"},derived:{manual_edit:"forbidden",change_control:"regeneration-required"},generated:{manual_edit:"forbidden",change_control:"regeneration-required"},control:{manual_edit:"allowed",change_control:"approval-required"}};function q9(t){let e=fle[t.authority];return{...t,manual_edit:t.manual_edit??e.manual_edit,change_control:t.change_control??e.change_control,visibility:t.visibility??"internal"}}var dg=ta(Ia(),1);import{readFileSync as x7}from"node:fs";import{resolve as $7,dirname as eB}from"node:path";function tB(t){let e=t?[t]:["artifact-contracts.config.yaml","artifact-contracts.config.yml"];for(let r of e)try{let i=x7(r,"utf-8"),n=(0,dg.parse)(i);return U9.parse(n)}catch{if(t)throw new Error(`Config file not found: ${t}`)}return null}function ja(t){let e=tB(t),r=t?eB($7(t)):process.cwd(),i=e?.input?.files??["artifact-contracts.yaml"],n=$7(r,i[0]),a;try{a=x7(n,"utf-8")}catch{throw new Error(`Artifact contracts file not found: ${n}`)}let o=(0,dg.parse)(a),s=k7(o,e?.variables??{}),l=zfe(s,eB(n));return{document:np.parse(l),config:e,configDir:r}}function zfe(t,e){if(t===null||typeof t!="object"||Array.isArray(t))return t;let r=t,i=r.artifacts;if(i===null||typeof i!="object"||Array.isArray(i))return t;let n=i;if(!("$refs"in n))return t;let a=n.$refs;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))throw new Error("artifacts.$refs must be an array of strings");let o={};for(let l of a){let u=$7(e,l),d;try{d=x7(u,"utf-8")}catch{throw new Error(`Referenced artifacts file not found: ${u}`)}let c=(0,dg.parse)(d);if(c===null||typeof c!="object"||Array.isArray(c))throw new Error(`Referenced artifacts file must be a plain object: ${u}`);let p=c;if("$refs"in p)throw new Error(`Nested $refs are not supported: ${u}`);for(let[f,m]of Object.entries(p)){if(f in o)throw new Error(`Duplicate artifact ID "${f}": found in ${o[f].source} and ${u}`);o[f]={def:m,source:u}}}for(let[l,u]of Object.entries(n))if(l!=="$refs"){if(l in o)throw new Error(`Duplicate artifact ID "${l}": found in inline artifacts and ${o[l].source}`);o[l]={def:u,source:"inline"}}let s={};for(let[l,{def:u}]of Object.entries(o))s[l]=u;return{...r,artifacts:s}}function k7(t,e){if(typeof t=="string"){let r=t.match(/^\$\{vars\.(\w+)\}$/);if(r){let i=r[1],n=e[i];if(n===void 0)throw new Error(`Undefined variable: vars.${i}`);return n}return t.replace(/\$\{vars\.(\w+)\}/g,(i,n)=>{let a=e[n];if(a===void 0)throw new Error(`Undefined variable: vars.${n}`);if(Array.isArray(a))throw new Error(`Array variable vars.${n} cannot be used in string interpolation`);return a})}if(Array.isArray(t)){let r=[];for(let i of t){let n=k7(i,e);Array.isArray(n)?r.push(...n):r.push(n)}return r}if(t!==null&&typeof t=="object"){let r={};for(let[i,n]of Object.entries(t))r[i]=k7(n,e);return r}return t}function Na(t){let{document:e}=t,r={};for(let[n,a]of Object.entries(e.artifacts))r[n]=q9(a);let i={artifact_contracts:e.artifact_contracts,system:e.system,artifacts:r};return e.trace&&(i.trace=e.trace),i}Co();function T7(t,e){let r=t.replace(/\\/g,"/");return!(!e.path_patterns.some(n=>yn(r,n,{dot:!0}))||e.exclude_patterns&&e.exclude_patterns.some(a=>yn(r,a,{dot:!0})))}function uc(t,e){let r=[];for(let[i,n]of Object.entries(e))T7(t,n)&&r.push({id:i,artifact:n});return r}function B7(t,e){let r=[];for(let i of t){let n=uc(i,e);n.length>1&&r.push({path:i,matching_artifacts:n.map(a=>a.id)})}return r}import{execSync as Ihe}from"node:child_process";async function lw(t,e={}){let r=[],{document:i}=t,n=np.safeParse(i);if(!n.success){for(let o of n.error.issues)r.push({path:o.path.join("."),message:o.message,severity:"error"});return{valid:!1,diagnostics:r,overlaps:[]}}for(let o of Object.keys(i.artifacts))p1.test(o)||r.push({path:`artifacts.${o}`,message:`Artifact ID "${o}" does not match naming convention: [a-z0-9-]+ (kebab-case)`,severity:"error"}),o.includes(".")&&r.push({path:`artifacts.${o}`,message:`Artifact ID "${o}" contains dots \u2014 reserved for future namespace extension`,severity:"error"});for(let[o,s]of Object.entries(i.artifacts))(!s.path_patterns||s.path_patterns.length===0)&&r.push({path:`artifacts.${o}.path_patterns`,message:`Artifact "${o}" has empty path_patterns`,severity:"error"});if(i.trace){let o=new Set;for(let s=0;s<i.trace.links.length;s++){let l=i.trace.links[s],u=`trace.links[${s}]`;p1.test(l.id)||r.push({path:`${u}.id`,message:`Trace link ID "${l.id}" does not match naming convention: [a-z0-9-]+ (kebab-case)`,severity:"error"}),o.has(l.id)&&r.push({path:`${u}.id`,message:`Duplicate trace link ID "${l.id}"`,severity:"error"}),o.add(l.id),i.artifacts[l.from]||r.push({path:`${u}.from`,message:`Trace link "${l.id}" references unknown artifact "from": ${l.from}`,severity:"error"}),i.artifacts[l.to]||r.push({path:`${u}.to`,message:`Trace link "${l.id}" references unknown artifact "to": ${l.to}`,severity:"error"}),l.from===l.to&&r.push({path:u,message:`Trace link "${l.id}" cannot link an artifact to itself`,severity:"error"})}}let a=[];if(e.checkFiles){a=await jhe(t);for(let o of a)r.push({path:o.path,message:`File "${o.path}" matches multiple artifacts: ${o.matching_artifacts.join(", ")}`,severity:"error"})}return{valid:r.filter(o=>o.severity==="error").length===0,diagnostics:r,overlaps:a}}async function jhe(t){let e=Na(t),r;try{r=Ihe("git ls-files",{encoding:"utf-8",cwd:t.configDir}).trim().split(`
3002
3002
  `).filter(Boolean)}catch{try{let{globSync:i}=await Promise.resolve().then(()=>(uw(),sw));r=i("**/*",{cwd:t.configDir,dot:!0,nodir:!0})}catch{return[]}}return B7(r,e.artifacts)}async function nR(t){let e;try{e=ja(t.config)}catch(i){process.stderr.write(`Error: ${i.message}
3003
3003
  `),process.exit(3)}let r=await lw(e,{checkFiles:t.checkFiles});if(r.valid)process.stderr.write(`\u2713 Validation passed
@@ -3028,7 +3028,7 @@ components:
3028
3028
  `).filter(Boolean)}catch{try{let{globSync:r}=await Promise.resolve().then(()=>(uw(),sw));e=r("**/*",{cwd:t,dot:!0,nodir:!0,ignore:["node_modules/**",".git/**"]})}catch(r){throw new Error(`Failed to enumerate repository files: ${r.message}`)}}return eAe(e)}function eAe(t){let e={};for(let i of t.sort()){let n=i.split("/"),a=n.length>1?n.slice(0,-1).join("/"):".";e[a]||(e[a]=[]),e[a].push(i)}let r=[];for(let i of Object.keys(e).sort()){r.push(`${i}/`);for(let n of e[i])r.push(` ${n}`);r.push("")}return r.join(`
3029
3029
  `)}function tAe(){let t=Dx("package.json");if(!tQ(t))return"No package.json found.";try{let e=JSON.parse(rQ(t,"utf-8"));return[`name: ${e.name??"unknown"}`,e.description?`description: ${e.description}`:"",e.version?`version: ${e.version}`:"",e.keywords?.length?`keywords: ${e.keywords.join(", ")}`:"",e.repository?.url?`repository: ${e.repository.url}`:""].filter(Boolean).join(`
3030
3030
  `)}catch{return"package.json exists but could not be parsed."}}function rAe(t){let{mode:e,fileTree:r,existingContent:i,metadata:n}=t,a=["# Artifact Discovery","",`## Mode: ${e}`,e==="init"?"Create a new artifact-contracts.yaml from scratch based on the project file structure.":"Update the existing artifact-contracts.yaml by adding definitions for uncovered files. Preserve all existing artifact definitions.","","## Project Metadata","",n,"","## Repository File Tree","",r];return e==="update"&&i&&a.push("## Existing artifact-contracts.yaml","","```yaml",i,"```",""),a.push("## artifact-contracts.yaml Schema Reference","","The generated YAML must conform to this schema:","","```yaml",'artifact_contracts: "2026A" # or latest schema version',"","system:"," id: <kebab-case-system-id>"," name: <human-readable name>","","artifacts:"," <artifact-id>: # kebab-case IDs"," type: <artifact-type> # e.g. source, config, generated-code, generated-doc"," description: <optional description>"," authority: canonical | derived | generated | control"," manual_edit: allowed | discouraged | forbidden # optional, defaults by authority"," change_control: none | approval-required | regeneration-required # optional"," visibility: public | internal | private # optional"," path_patterns: # required, at least one pattern",' - "glob/pattern/**"'," exclude_patterns: # optional",' - "glob/pattern/to/exclude/**"',"","trace:"," links:"," - id: <kebab-case-link-id>"," from: <source-artifact-id>"," to: <target-artifact-id>"," resolver: operationId | ast | naming | codegen"," description: <optional description>","```","","### Authority Guidelines","","- canonical: hand-written source of truth (source code, configs)","- derived: generated from canonical sources but may need review (docs)","- generated: auto-generated, should not be manually edited","- control: governance/control files (CI, hooks)","","### Type Guidelines","","- source: application/library source code","- config: configuration files (YAML, JSON configs)","- generated-code: auto-generated code","- generated-doc: auto-generated documentation","","### Path Pattern Rules","",'- Use specific glob patterns, not overly broad ones like "**/*"',"- Group logically related files into single artifacts","- Use exclude_patterns to omit test files, generated subdirs, etc.","- Artifact IDs must be kebab-case","","### Trace Link Guidelines","","- Detect relationships between config/DSL artifacts and their generated outputs","- Use resolver: codegen for build-time generation relationships","- Use resolver: naming for convention-based relationships","- Use resolver: ast for code-level references","- Use resolver: operationId for API operation references","","## Instructions","","1. Analyze the file tree and group files into logical artifacts","2. Assign appropriate type, authority, and path_patterns to each artifact","3. Detect trace link relationships (especially config/DSL \u2192 generated code)","4. In update mode, preserve ALL existing artifact definitions unchanged","5. Add new artifacts only for files not covered by existing patterns","6. Generate complete, valid artifact-contracts.yaml content","","## Output Format","","Respond with a JSON object matching the artifact-discovery-result handoff schema:","","```json","{",' "artifact_contracts_yaml": "<complete YAML string for artifact-contracts.yaml>",',' "decisions": [',' { "artifact_id": "<id>", "reasoning": "<why this grouping>" }'," ],",' "trace_decisions": [',' { "link_id": "<id>", "reasoning": "<why this trace link>" }'," ],",' "uncategorized_files": ["<files that could not be categorized>"],',' "suggestions": ["<improvement suggestions>"]',"}","```","","The artifact_contracts_yaml field must contain the complete, valid YAML document.",""),a.join(`
3031
- `)}function nAe(t,e,r){if(t.status==="error"){let a=t.errorMessage??"Unknown error";return r==="json"?JSON.stringify({error:a},null,2):r==="yaml"?(0,nQ.stringify)({error:a}):`Error: ${a}`}let i=t.data;if(r==="json"){let a={mode:e,artifact_contracts_yaml:i?.artifact_contracts_yaml??eQ(t.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let n=i?.artifact_contracts_yaml??eQ(t.raw);return n}function eQ(t){if(!t)return"";try{let r=JSON.parse(t);if(r.artifact_contracts_yaml)return r.artifact_contracts_yaml}catch{}let e=t.match(/```ya?ml\n([\s\S]*?)```/);return e?e[1].trim():t.includes("artifact_contracts:")?t.trim():t}rp();var ORe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),PRe=Ve.object({artifact_contracts_yaml:Ve.string(),decisions:Ve.array(Ve.object({artifact_id:Ve.string(),reasoning:Ve.string()})).optional(),trace_decisions:Ve.array(Ve.object({link_id:Ve.string(),reasoning:Ve.string()})).optional(),uncategorized_files:Ve.array(Ve.string()).optional(),suggestions:Ve.array(Ve.string()).optional()}),IRe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),jRe=Ve.object({summary:Ve.string(),risk_level:Ve.enum(["none","low","medium","high","critical"]),findings:Ve.array(Ve.object({id:Ve.string(),severity:Ve.enum(["critical","error","warning","info"]),category:Ve.string(),title:Ve.string(),description:Ve.string(),target:Ve.string().optional(),recommendation:Ve.string().optional(),evidence:Ve.array(Ve.object({kind:Ve.enum(["schema","code","config","runtime","doc"]),target:Ve.string().optional(),location:Ve.string().optional(),excerpt:Ve.string().optional(),reasoning:Ve.string().optional()})).optional()})),recommended_actions:Ve.array(Ve.object({action:Ve.string(),priority:Ve.enum(["high","medium","low"]),description:Ve.string().optional()})),metadata:Ve.object({total_artifacts:Ve.number().int().optional(),analyzed_artifacts:Ve.number().int().optional(),analysis_scope:Ve.string().optional()}).optional()});cw();var iAe={version:"0.34.3"},aAe={validate:async t=>{await nR(t)},resolve:async t=>{await aR(t)},list:async t=>{await sR(t)},explain:async(t,e)=>{t||(console.error("Error: <path> argument is required"),process.exit(1)),await lR(t,e)},audit:async t=>{await JX(t)},discover:async t=>{await iQ(t)},agents:async t=>{let e=await Promise.resolve().then(()=>ta(Ia(),1)),r=t.format??"yaml";try{console.log(r==="json"?JSON.stringify(mc,null,2):e.stringify(mc,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};nC(aAe,iAe.version).parse();
3031
+ `)}function nAe(t,e,r){if(t.status==="error"){let a=t.errorMessage??"Unknown error";return r==="json"?JSON.stringify({error:a},null,2):r==="yaml"?(0,nQ.stringify)({error:a}):`Error: ${a}`}let i=t.data;if(r==="json"){let a={mode:e,artifact_contracts_yaml:i?.artifact_contracts_yaml??eQ(t.raw),decisions:i?.decisions??[],trace_decisions:i?.trace_decisions??[],uncategorized_files:i?.uncategorized_files??[],suggestions:i?.suggestions??[]};return JSON.stringify(a,null,2)}let n=i?.artifact_contracts_yaml??eQ(t.raw);return n}function eQ(t){if(!t)return"";try{let r=JSON.parse(t);if(r.artifact_contracts_yaml)return r.artifact_contracts_yaml}catch{}let e=t.match(/```ya?ml\n([\s\S]*?)```/);return e?e[1].trim():t.includes("artifact_contracts:")?t.trim():t}rp();var ORe=Ve.object({mode:Ve.enum(["init","update"]),file_tree:Ve.string(),existing_definitions:Ve.string().optional(),project_metadata:Ve.string().optional()}),PRe=Ve.object({artifact_contracts_yaml:Ve.string(),decisions:Ve.array(Ve.object({artifact_id:Ve.string(),reasoning:Ve.string()})).optional(),trace_decisions:Ve.array(Ve.object({link_id:Ve.string(),reasoning:Ve.string()})).optional(),uncategorized_files:Ve.array(Ve.string()).optional(),suggestions:Ve.array(Ve.string()).optional()}),IRe=Ve.object({system_id:Ve.string(),artifact_count:Ve.number().int(),definitions_context:Ve.string()}),jRe=Ve.object({summary:Ve.string(),risk_level:Ve.enum(["none","low","medium","high","critical"]),findings:Ve.array(Ve.object({id:Ve.string(),severity:Ve.enum(["critical","error","warning","info"]),category:Ve.string(),title:Ve.string(),description:Ve.string(),target:Ve.string().optional(),recommendation:Ve.string().optional(),evidence:Ve.array(Ve.object({kind:Ve.enum(["schema","code","config","runtime","doc"]),target:Ve.string().optional(),location:Ve.string().optional(),excerpt:Ve.string().optional(),reasoning:Ve.string().optional()})).optional()})),recommended_actions:Ve.array(Ve.object({action:Ve.string(),priority:Ve.enum(["high","medium","low"]),description:Ve.string().optional()})),metadata:Ve.object({total_artifacts:Ve.number().int().optional(),analyzed_artifacts:Ve.number().int().optional(),analysis_scope:Ve.string().optional()}).optional()});cw();var iAe={version:"0.34.5"},aAe={validate:async t=>{await nR(t)},resolve:async t=>{await aR(t)},list:async t=>{await sR(t)},explain:async(t,e)=>{t||(console.error("Error: <path> argument is required"),process.exit(1)),await lR(t,e)},audit:async t=>{await JX(t)},discover:async t=>{await iQ(t)},agents:async t=>{let e=await Promise.resolve().then(()=>ta(Ia(),1)),r=t.format??"yaml";try{console.log(r==="json"?JSON.stringify(mc,null,2):e.stringify(mc,{lineWidth:120}))}catch(i){console.error(`Failed to output DSL: ${i.message}`),process.exit(1)}}};nC(aAe,iAe.version).parse();
3032
3032
  /*! Bundled license information:
3033
3033
 
3034
3034
  agent-contracts/dist/index.js: