@zuplo/core 6.51.72 → 6.51.75

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.
@@ -575,7 +575,7 @@ globstar while`,s,Q,l,Me,Ne),this.matchOne(s.slice(Q),l.slice(Me),_))return this
575
575
  >>> no match, partial?`,s,Q,l,Me),Q===M))}let we;if(typeof ne=="string"?(we=ie===ne,this.debug("string match",ne,ie,we)):(we=ne.test(ie),this.debug("pattern match",ne,ie,we)),!we)return!1}if(D===M&&N===z)return!0;if(D===M)return _;if(N===z)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return Not(this.pattern,this.options)}parse(s){RH(s);let l=this.options;if(s==="**")return I0;if(s==="")return"";let _,h=null;(_=s.match(OZt))?h=l.dot?RZt:LZt:(_=s.match(CZt))?h=(l.nocase?l.dot?wZt:kZt:l.dot?DZt:EZt)(_[1]):(_=s.match(MZt))?h=(l.nocase?l.dot?BZt:jZt:l.dot?UZt:$Zt)(_):(_=s.match(PZt))?h=l.dot?NZt:AZt:(_=s.match(IZt))&&(h=FZt);let b=NM.fromGlob(s,this.options).toMMPattern();return h&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:h}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?qZt:l.dot?VZt:WZt,h=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let z=M.map(ne=>{if(ne instanceof RegExp)for(let ie of ne.flags.split(""))h.add(ie);return typeof ne=="string"?XZt(ne):ne===I0?I0:ne._src});return z.forEach((ne,ie)=>{let Q=z[ie+1],Me=z[ie-1];ne!==I0||Me===I0||(Me===void 0?Q!==void 0&&Q!==I0?z[ie+1]="(?:\\/|"+_+"\\/)?"+Q:z[ie]=_:Q===void 0?z[ie-1]=Me+"(?:\\/|"+_+")?":Q!==I0&&(z[ie-1]=Me+"(?:\\/|\\/"+_+"\\/)"+Q,z[ie+1]=I0))}),z.filter(ne=>ne!==I0).join("/")}).join("|"),[D,N]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+N+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...h].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let h=this.slashSplit(s);this.debug(this.pattern,"split",h);let b=this.set;this.debug(this.pattern,"set",b);let D=h[h.length-1];if(!D)for(let N=h.length-2;!D&&N>=0;N--)D=h[N];for(let N=0;N<b.length;N++){let M=b[N],z=h;if(_.matchBase&&M.length===1&&(z=[D]),this.matchOne(z,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return J1.defaults(s).Minimatch}};J1.AST=NM;J1.Minimatch=q2;J1.escape=IM;J1.unescape=zC;import{fileURLToPath as Per}from"node:url";var FM=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Fot=new Set,Q6e=typeof process=="object"&&process?process:{},Oot=t((a,s,l,_)=>{typeof Q6e.emitWarning=="function"?Q6e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),fle=globalThis.AbortController,Iot=globalThis.AbortSignal;if(typeof fle>"u"){Iot=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,h){this._onabort.push(h)}},fle=class{static{t(this,"AbortController")}constructor(){s()}signal=new Iot;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let h of this.signal._onabort)h(_);this.signal.onabort?.(_)}}};let a=Q6e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,Oot("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",s))},"warnACPolyfill")}var QZt=t(a=>!Fot.has(a),"shouldWarn"),e3r=Symbol("type"),w3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),Lot=t(a=>w3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?OM:null:null,"getUintArray"),OM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},Z6e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=Lot(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},jH=class a{static{t(this,"LRUCache")}#r;#n;#e;#t;#s;#p;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#_;#c;#l;#i;#f;#v;#d;#u;#m;#g;#E;#x;#b;#k;#C;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#E,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,h,b)=>s.#j(l,_,h,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:h=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:N,allowStale:M,dispose:z,disposeAfter:ne,noDisposeOnSet:ie,noUpdateTTL:Q,maxSize:Me=0,maxEntrySize:Ne=0,sizeCalculation:we,fetchMethod:Pt,memoMethod:xt,noDeleteOnFetchRejection:Tr,noDeleteOnStaleGet:fn,allowStaleOnFetchRejection:tn,allowStaleOnFetchAbort:cn,ignoreFetchAbort:Cr}=s;if(l!==0&&!w3(l))throw new TypeError("max option must be a nonnegative integer");let vr=l?Lot(l):Array;if(!vr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Me,this.maxEntrySize=Ne||this.#n,this.sizeCalculation=we,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(xt!==void 0&&typeof xt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=xt,Pt!==void 0&&typeof Pt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Pt,this.#C=!!Pt,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new vr(l),this.#v=new vr(l),this.#d=0,this.#u=0,this.#m=Z6e.create(l),this.#a=0,this.#_=0,typeof z=="function"&&(this.#e=z),typeof ne=="function"?(this.#t=ne,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!ie,this.noUpdateTTL=!!Q,this.noDeleteOnFetchRejection=!!Tr,this.allowStaleOnFetchRejection=!!tn,this.allowStaleOnFetchAbort=!!cn,this.ignoreFetchAbort=!!Cr,this.maxEntrySize!==0){if(this.#n!==0&&!w3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!w3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!fn,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!N,this.ttlResolution=w3(h)||h===0?h:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!w3(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#r===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r&&!this.#n){let fs="LRU_CACHE_UNBOUNDED";QZt(fs)&&(Fot.add(fs),Oot("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",fs,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new OM(this.#r),l=new OM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,N=FM.now())=>{if(l[b]=D!==0?N:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#F(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?FM.now():0},this.#o=(b,D)=>{if(s[D]){let N=s[D],M=l[D];if(!N||!M)return;b.ttl=N,b.start=M,b.now=_||h();let z=b.now-M;b.remainingTTL=N-z}};let _=0,h=t(()=>{let b=FM.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let N=s[D],M=l[D];if(!N||!M)return 1/0;let z=(_||h())-M;return N-z},this.#S=b=>{let D=l[b],N=s[b];return!!N&&!!D&&(_||h())-D>N}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new OM(this.#r);this.#_=0,this.#E=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,h,b)=>{if(this.#h(_))return 0;if(!w3(h))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(h=b(_,l),!w3(h))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 h},this.#O=(l,_,h)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],h&&(h.entrySize=_,h.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#O=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,h)=>{if(_||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#F(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],h=this.#h(_)?_.__staleWhileFetching:_;if(h===void 0)return;let b={value:h};if(this.#b&&this.#x){let D=this.#b[l],N=this.#x[l];if(D&&N){let M=D-(FM.now()-N);b.ttl=M,b.start=Date.now()}}return this.#E&&(b.size=this.#E[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],h=this.#i[l],b=this.#h(h)?h.__staleWhileFetching:h;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let N=FM.now()-this.#x[l];D.start=Math.floor(Date.now()-N)}this.#E&&(D.size=this.#E[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let h=Date.now()-_.start;_.start=FM.now()-h}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:h=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:N=this.sizeCalculation,status:M}=_,{noUpdateTTL:z=this.noUpdateTTL}=_,ne=this.#L(s,l,_.size||0,N);if(this.maxEntrySize&&ne>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#F(s,"set"),this;let ie=this.#a===0?void 0:this.#c.get(s);if(ie===void 0)ie=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[ie]=s,this.#i[ie]=l,this.#c.set(s,ie),this.#f[this.#u]=ie,this.#v[ie]=this.#u,this.#u=ie,this.#a++,this.#O(ie,ne,M),M&&(M.set="add"),z=!1;else{this.#U(ie);let Q=this.#i[ie];if(l!==Q){if(this.#C&&this.#h(Q)){Q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Me}=Q;Me!==void 0&&!D&&(this.#k&&this.#e?.(Me,s,"set"),this.#y&&this.#g?.push([Me,s,"set"]))}else D||(this.#k&&this.#e?.(Q,s,"set"),this.#y&&this.#g?.push([Q,s,"set"]));if(this.#I(ie),this.#O(ie,ne,M),this.#i[ie]=l,M){M.set="replace";let Me=Q&&this.#h(Q)?Q.__staleWhileFetching:Q;Me!==void 0&&(M.oldValue=Me)}}else M&&(M.set="update")}if(h!==0&&!this.#b&&this.#D(),this.#b&&(z||this.#N(ie,h,b),M&&this.#o(M,ie)),!D&&this.#y&&this.#g){let Q=this.#g,Me;for(;Me=Q?.shift();)this.#t?.(...Me)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],h=this.#i[l];return this.#C&&this.#h(h)?h.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(h,_,"evict"),this.#y&&this.#g?.push([h,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:h}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))h&&(h.has="stale",this.#o(h,b));else return _&&this.#w(b),h&&(h.has="hit",this.#o(h,b)),!0}else h&&(h.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,h=this.#c.get(s);if(h===void 0||!_&&this.#S(h))return;let b=this.#i[h];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,h){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new fle,{signal:N}=_;N?.addEventListener("abort",()=>D.abort(N.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:h},z=t((we,Pt=!1)=>{let{aborted:xt}=D.signal,Tr=_.ignoreFetchAbort&&we!==void 0;if(_.status&&(xt&&!Pt?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,Tr&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),xt&&!Tr&&!Pt)return ie(D.signal.reason);let fn=Me;return this.#i[l]===Me&&(we===void 0?fn.__staleWhileFetching?this.#i[l]=fn.__staleWhileFetching:this.#F(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,we,M.options))),we},"cb"),ne=t(we=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=we),ie(we)),"eb"),ie=t(we=>{let{aborted:Pt}=D.signal,xt=Pt&&_.allowStaleOnFetchAbort,Tr=xt||_.allowStaleOnFetchRejection,fn=Tr||_.noDeleteOnFetchRejection,tn=Me;if(this.#i[l]===Me&&(!fn||tn.__staleWhileFetching===void 0?this.#F(s,"fetch"):xt||(this.#i[l]=tn.__staleWhileFetching)),Tr)return _.status&&tn.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),tn.__staleWhileFetching;if(tn.__returned===tn)throw we},"fetchFail"),Q=t((we,Pt)=>{let xt=this.#s?.(s,b,M);xt&&xt instanceof Promise&&xt.then(Tr=>we(Tr===void 0?void 0:Tr),Pt),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(we(void 0),_.allowStaleOnFetchAbort&&(we=t(Tr=>z(Tr,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Me=new Promise(Q).then(z,ne),Ne=Object.assign(Me,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Ne,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Ne,Ne}#h(s){if(!this.#C)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof fle}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:N=this.noDisposeOnSet,size:M=0,sizeCalculation:z=this.sizeCalculation,noUpdateTTL:ne=this.noUpdateTTL,noDeleteOnFetchRejection:ie=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Q=this.allowStaleOnFetchRejection,ignoreFetchAbort:Me=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ne=this.allowStaleOnFetchAbort,context:we,forceRefresh:Pt=!1,status:xt,signal:Tr}=l;if(!this.#C)return xt&&(xt.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:h,noDeleteOnStaleGet:b,status:xt});let fn={allowStale:_,updateAgeOnGet:h,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:N,size:M,sizeCalculation:z,noUpdateTTL:ne,noDeleteOnFetchRejection:ie,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:Ne,ignoreFetchAbort:Me,status:xt,signal:Tr},tn=this.#c.get(s);if(tn===void 0){xt&&(xt.fetch="miss");let cn=this.#j(s,tn,fn,we);return cn.__returned=cn}else{let cn=this.#i[tn];if(this.#h(cn)){let Ho=_&&cn.__staleWhileFetching!==void 0;return xt&&(xt.fetch="inflight",Ho&&(xt.returnedStale=!0)),Ho?cn.__staleWhileFetching:cn.__returned=cn}let Cr=this.#S(tn);if(!Pt&&!Cr)return xt&&(xt.fetch="hit"),this.#U(tn),h&&this.#w(tn),xt&&this.#o(xt,tn),cn;let vr=this.#j(s,tn,fn,we),Fi=vr.__staleWhileFetching!==void 0&&_;return xt&&(xt.fetch=Cr?"stale":"refresh",Fi&&Cr&&(xt.returnedStale=!0)),Fi?vr.__staleWhileFetching:vr.__returned=vr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:b,...D}=l,N=this.get(s,D);if(!b&&N!==void 0)return N;let M=_(s,N,{options:D,context:h});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,N=this.#c.get(s);if(N!==void 0){let M=this.#i[N],z=this.#h(M);return D&&this.#o(D,N),this.#S(N)?(D&&(D.get="stale"),z?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#F(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),z?M.__staleWhileFetching:(this.#U(N),h&&this.#w(N),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#F(s,"delete")}#F(s,l){let _=!1;if(this.#a!==0){let h=this.#c.get(s);if(h!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(h);let b=this.#i[h];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[h]=void 0,this.#i[h]=void 0,h===this.#u)this.#u=this.#v[h];else if(h===this.#d)this.#d=this.#f[h];else{let D=this.#v[h];this.#f[D]=this.#f[h];let N=this.#f[h];this.#v[N]=this.#v[h]}this.#a--,this.#m.push(h)}}if(this.#y&&this.#g?.length){let h=this.#g,b;for(;b=h?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let h=this.#l[l];this.#k&&this.#e?.(_,h,s),this.#y&&this.#g?.push([_,h,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as ler,win32 as l4e}from"node:path";import{fileURLToPath as uer}from"node:url";import{lstatSync as fer,readdir as _er,readdirSync as per,readlinkSync as der,realpathSync as mer}from"fs";import*as her from"node:fs";import{lstat as yer,readdir as ver,readlink as ber,realpath as Ser}from"node:fs/promises";import{EventEmitter as a4e}from"node:events";import Uot from"node:stream";import{StringDecoder as ZZt}from"node:string_decoder";var Rot=typeof process=="object"&&process?process:{stdout:null,stderr:null},eer=t(a=>!!a&&typeof a=="object"&&(a instanceof A3||a instanceof Uot||ter(a)||rer(a)),"isStream"),ter=t(a=>!!a&&typeof a=="object"&&a instanceof a4e&&typeof a.pipe=="function"&&a.pipe!==Uot.Writable.prototype.pipe,"isReadable"),rer=t(a=>!!a&&typeof a=="object"&&a instanceof a4e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),gA=Symbol("EOF"),yA=Symbol("maybeEmitEnd"),P3=Symbol("emittedEnd"),_le=Symbol("emittingEnd"),BH=Symbol("emittedError"),ple=Symbol("closed"),Mot=Symbol("read"),dle=Symbol("flush"),jot=Symbol("flushChunk"),JC=Symbol("encoding"),LM=Symbol("decoder"),zg=Symbol("flowing"),UH=Symbol("paused"),RM=Symbol("resume"),Jg=Symbol("buffer"),q1=Symbol("pipes"),qg=Symbol("bufferLength"),e4e=Symbol("bufferPush"),mle=Symbol("bufferShift"),Ry=Symbol("objectMode"),Im=Symbol("destroyed"),t4e=Symbol("error"),r4e=Symbol("emitData"),Bot=Symbol("emitEnd"),n4e=Symbol("emitEnd2"),ok=Symbol("async"),i4e=Symbol("abort"),hle=Symbol("aborted"),$H=Symbol("signal"),GF=Symbol("dataListeners"),V2=Symbol("discarded"),zH=t(a=>Promise.resolve().then(a),"defer"),ner=t(a=>a(),"nodefer"),ier=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),ser=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),aer=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),gle=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[RM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},s4e=class extends gle{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=h=>l.emit("error",h),s.on("error",this.proxyErrors)}},oer=t(a=>!!a.objectMode,"isObjectModeOptions"),cer=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),A3=class extends a4e{static{t(this,"Minipass")}[zg]=!1;[UH]=!1;[q1]=[];[Jg]=[];[Ry];[JC];[ok];[LM];[gA]=!1;[P3]=!1;[_le]=!1;[ple]=!1;[BH]=null;[qg]=0;[Im]=!1;[$H];[hle]=!1;[GF]=0;[V2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");oer(l)?(this[Ry]=!0,this[JC]=null):cer(l)?(this[JC]=l.encoding,this[Ry]=!1):(this[Ry]=!1,this[JC]=null),this[ok]=!!l.async,this[LM]=this[JC]?new ZZt(this[JC]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Jg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[q1],"get")});let{signal:_}=l;_&&(this[$H]=_,_.aborted?this[i4e]():_.addEventListener("abort",()=>this[i4e]()))}get bufferLength(){return this[qg]}get encoding(){return this[JC]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ry]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ok]}set async(s){this[ok]=this[ok]||!!s}[i4e](){this[hle]=!0,this.emit("abort",this[$H]?.reason),this.destroy(this[$H]?.reason)}get aborted(){return this[hle]}set aborted(s){}write(s,l,_){if(this[hle])return!1;if(this[gA])throw new Error("write after end");if(this[Im])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let h=this[ok]?zH:ner;if(!this[Ry]&&!Buffer.isBuffer(s)){if(aer(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(ser(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ry]?(this[zg]&&this[qg]!==0&&this[dle](!0),this[zg]?this.emit("data",s):this[e4e](s),this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg]):s.length?(typeof s=="string"&&!(l===this[JC]&&!this[LM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[JC]&&(s=this[LM].write(s)),this[zg]&&this[qg]!==0&&this[dle](!0),this[zg]?this.emit("data",s):this[e4e](s),this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg]):(this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg])}read(s){if(this[Im])return null;if(this[V2]=!1,this[qg]===0||s===0||s&&s>this[qg])return this[yA](),null;this[Ry]&&(s=null),this[Jg].length>1&&!this[Ry]&&(this[Jg]=[this[JC]?this[Jg].join(""):Buffer.concat(this[Jg],this[qg])]);let l=this[Mot](s||null,this[Jg][0]);return this[yA](),l}[Mot](s,l){if(this[Ry])this[mle]();else{let _=l;s===_.length||s===null?this[mle]():typeof _=="string"?(this[Jg][0]=_.slice(s),l=_.slice(0,s),this[qg]-=s):(this[Jg][0]=_.subarray(s),l=_.subarray(0,s),this[qg]-=s)}return this.emit("data",l),!this[Jg].length&&!this[gA]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[gA]=!0,this.writable=!1,(this[zg]||!this[UH])&&this[yA](),this}[RM](){this[Im]||(!this[GF]&&!this[q1].length&&(this[V2]=!0),this[UH]=!1,this[zg]=!0,this.emit("resume"),this[Jg].length?this[dle]():this[gA]?this[yA]():this.emit("drain"))}resume(){return this[RM]()}pause(){this[zg]=!1,this[UH]=!0,this[V2]=!1}get destroyed(){return this[Im]}get flowing(){return this[zg]}get paused(){return this[UH]}[e4e](s){this[Ry]?this[qg]+=1:this[qg]+=s.length,this[Jg].push(s)}[mle](){return this[Ry]?this[qg]-=1:this[qg]-=this[Jg][0].length,this[Jg].shift()}[dle](s=!1){do;while(this[jot](this[mle]())&&this[Jg].length);!s&&!this[Jg].length&&!this[gA]&&this.emit("drain")}[jot](s){return this.emit("data",s),this[zg]}pipe(s,l){if(this[Im])return s;this[V2]=!1;let _=this[P3];return l=l||{},s===Rot.stdout||s===Rot.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[q1].push(l.proxyErrors?new s4e(this,s,l):new gle(this,s,l)),this[ok]?zH(()=>this[RM]()):this[RM]()),s}unpipe(s){let l=this[q1].find(_=>_.dest===s);l&&(this[q1].length===1?(this[zg]&&this[GF]===0&&(this[zg]=!1),this[q1]=[]):this[q1].splice(this[q1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[V2]=!1,this[GF]++,!this[q1].length&&!this[zg]&&this[RM]();else if(s==="readable"&&this[qg]!==0)super.emit("readable");else if(ier(s)&&this[P3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[BH]){let h=l;this[ok]?zH(()=>h.call(this,this[BH])):h.call(this,this[BH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[GF]=this.listeners("data").length,this[GF]===0&&!this[V2]&&!this[q1].length&&(this[zg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[GF]=0,!this[V2]&&!this[q1].length&&(this[zg]=!1)),l}get emittedEnd(){return this[P3]}[yA](){!this[_le]&&!this[P3]&&!this[Im]&&this[Jg].length===0&&this[gA]&&(this[_le]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ple]&&this.emit("close"),this[_le]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Im&&this[Im])return!1;if(s==="data")return!this[Ry]&&!_?!1:this[ok]?(zH(()=>this[r4e](_)),!0):this[r4e](_);if(s==="end")return this[Bot]();if(s==="close"){if(this[ple]=!0,!this[P3]&&!this[Im])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[BH]=_,super.emit(t4e,_);let b=!this[$H]||this.listeners("error").length?super.emit("error",_):!1;return this[yA](),b}else if(s==="resume"){let b=super.emit("resume");return this[yA](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let h=super.emit(s,...l);return this[yA](),h}[r4e](s){for(let _ of this[q1])_.dest.write(s)===!1&&this.pause();let l=this[V2]?!1:super.emit("data",s);return this[yA](),l}[Bot](){return this[P3]?!1:(this[P3]=!0,this.readable=!1,this[ok]?(zH(()=>this[n4e]()),!0):this[n4e]())}[n4e](){if(this[LM]){let l=this[LM].end();if(l){for(let _ of this[q1])_.dest.write(l);this[V2]||super.emit("data",l)}}for(let l of this[q1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Ry]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Ry]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Ry])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[JC]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Im,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[V2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let h=this.read();if(h!==null)return Promise.resolve({done:!1,value:h});if(this[gA])return l();let b,D,N=t(ie=>{this.off("data",M),this.off("end",z),this.off(Im,ne),l(),D(ie)},"onerr"),M=t(ie=>{this.off("error",N),this.off("end",z),this.off(Im,ne),this.pause(),b({value:ie,done:!!this[gA]})},"ondata"),z=t(()=>{this.off("error",N),this.off("data",M),this.off(Im,ne),l(),b({done:!0,value:void 0})},"onend"),ne=t(()=>N(new Error("stream destroyed")),"ondestroy");return new Promise((ie,Q)=>{D=Q,b=ie,this.once(Im,ne),this.once("error",N),this.once("end",z),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[V2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(t4e,l),this.off(Im,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let h=this.read();return h===null?l():{done:!1,value:h}},"next");return this.once("end",l),this.once(t4e,l),this.once(Im,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Im])return s?this.emit("error",s):this.emit(Im),this;this[Im]=!0,this[V2]=!0,this[Jg].length=0,this[qg]=0;let l=this;return typeof l.close=="function"&&!this[ple]&&l.close(),s?this.emit("error",s):this.emit(Im),this}static get isStream(){return eer}};var ger=mer.native,qH={lstatSync:fer,readdir:_er,readdirSync:per,readlinkSync:der,realpathSync:ger,promises:{lstat:yer,readdir:ver,readlink:ber,realpath:Ser}},Vot=t(a=>!a||a===qH||a===her?qH:{...qH,...a,promises:{...qH.promises,...a.promises||{}}},"fsFromOption"),Wot=/^\\\\\?\\([a-z]:)\\?$/i,Ter=t(a=>a.replace(/\//g,"\\").replace(Wot,"$1\\"),"uncToDrive"),xer=/[\\\/]/,kT=0,Hot=1,Got=2,ck=4,Kot=6,Yot=8,KF=10,Xot=12,DT=15,JH=~DT,o4e=16,$ot=32,VH=64,qC=128,yle=256,ble=512,zot=VH|qC|ble,Cer=1023,c4e=t(a=>a.isFile()?Yot:a.isDirectory()?ck:a.isSymbolicLink()?KF:a.isCharacterDevice()?Got:a.isBlockDevice()?Kot:a.isSocket()?Xot:a.isFIFO()?Hot:kT,"entToType"),Jot=new Map,WH=t(a=>{let s=Jot.get(a);if(s)return s;let l=a.normalize("NFKD");return Jot.set(a,l),l},"normalize"),qot=new Map,vle=t(a=>{let s=qot.get(a);if(s)return s;let l=WH(a.toLowerCase());return qot.set(a,l),l},"normalizeNocase"),Sle=class extends jH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},u4e=class extends jH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},Qot=Symbol("PathScurry setAsCwd"),My=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#x;get birthtime(){return this.#x}#b;#k;#C;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=kT,_,h,b,D,N){this.name=s,this.#b=b?vle(s):WH(s),this.#o=l&Cer,this.nocase=b,this.roots=h,this.root=_||this,this.#N=D,this.#C=N.fullpath,this.#D=N.relative,this.#w=N.relativePosix,this.parent=N.parent,this.parent?this.#r=this.parent.#r:this.#r=Vot(N.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),h=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(h):this.#I(h)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~o4e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),h=this.nocase?vle(s):WH(s);for(let M of _)if(M.#b===h)return M;let b=this.parent?this.sep:"",D=this.#C?this.#C+b+s:void 0,N=this.newChild(s,kT,{...l,parent:this,fullpath:D});return this.canReaddir()||(N.#o|=qC),_.push(N),N}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#C!==void 0)return this.#C;let s=this.name,l=this.parent;if(!l)return this.#C=this.name;let h=l.fullpath()+(l.parent?this.sep:"")+s;return this.#C=h}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let h=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(h)?this.#y=`//?/${h}`:this.#y=h}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&DT)===kT}isType(s){return this[`is${s}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#o&DT)===Yot}isDirectory(){return(this.#o&DT)===ck}isCharacterDevice(){return(this.#o&DT)===Got}isBlockDevice(){return(this.#o&DT)===Kot}isFIFO(){return(this.#o&DT)===Hot}isSocket(){return(this.#o&DT)===Xot}isSymbolicLink(){return(this.#o&KF)===KF}lstatCached(){return this.#o&$ot?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#T}readdirCached(){let s=this.children();return s.slice(0,s.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let s=this.#o&DT;return!(s!==kT&&s!==KF||this.#o&yle||this.#o&qC)}calledReaddir(){return!!(this.#o&o4e)}isENOENT(){return!!(this.#o&qC)}isNamed(s){return this.nocase?this.#b===vle(s):this.#b===WH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#O(s){this.#o|=o4e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&qC||(this.#o=(this.#o|qC)&JH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=ble,this.#R()}#R(){if(this.#o&VH)return;let s=this.#o;(s&DT)===ck&&(s&=JH),this.#o=s|VH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=yle,s==="ENOENT"&&(l|=qC),(s==="EINVAL"||s==="UNKNOWN")&&(l&=JH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#F(s,l)||this.#U(s,l)}#U(s,l){let _=c4e(s),h=this.newChild(s.name,_,{parent:this}),b=h.#o&DT;return b!==ck&&b!==KF&&b!==kT&&(h.#o|=VH),l.unshift(h),l.provisional++,h}#F(s,l){for(let _=l.provisional;_<l.length;_++){let h=l[_];if((this.nocase?vle(s.name):WH(s.name))===h.#b)return this.#$(s,h,_,l)}}#$(s,l,_,h){let b=l.name;return l.#o=l.#o&JH|c4e(s),b!==s.name&&(l.name=s.name),_!==h.provisional&&(_===h.length-1?h.pop():h.splice(_,1),h.unshift(l)),h.provisional++,l}async lstat(){if((this.#o&qC)===0)try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if((this.#o&qC)===0)try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:h,birthtimeMs:b,blksize:D,blocks:N,ctime:M,ctimeMs:z,dev:ne,gid:ie,ino:Q,mode:Me,mtime:Ne,mtimeMs:we,nlink:Pt,rdev:xt,size:Tr,uid:fn}=s;this.#m=l,this.#f=_,this.#x=h,this.#u=b,this.#_=D,this.#i=N,this.#E=M,this.#d=z,this.#n=ne,this.#p=ie,this.#c=Q,this.#e=Me,this.#g=Ne,this.#v=we,this.#t=Pt,this.#a=xt,this.#l=Tr,this.#s=fn;let tn=c4e(s);this.#o=this.#o&JH|tn|$ot,tn!==kT&&tn!==ck&&tn!==KF&&(this.#o|=VH)}#J=[];#q=!1;#W(s){this.#q=!1;let l=this.#J.slice();this.#J.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#J.push(s),this.#q)return;this.#q=!0;let h=this.fullpath();this.#r.readdir(h,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let N of D)this.#B(N,_);this.#O(_)}this.#W(_.slice(0,_.provisional))})}#z;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#z)await this.#z;else{let _=t(()=>{},"resolve");this.#z=new Promise(h=>_=h);try{for(let h of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(h,s);this.#O(s)}catch(h){this.#M(h.code),s.provisional=0}this.#z=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#O(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&zot)return!1;let s=DT&this.#o;return s===kT||s===ck||s===KF}shouldWalk(s,l){return(this.#o&ck)===ck&&!(this.#o&zot)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((ble|yle|qC)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((ble|yle|qC)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[Qot](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],h=this;for(;h&&h.parent;)l.add(h),h.#D=_.join(this.sep),h.#w=_.join("/"),h=h.parent,_.push("..");for(h=s;h&&h.parent&&!l.has(h);)h.#D=void 0,h.#w=void 0,h=h.parent}},Tle=class a extends My{static{t(this,"PathWin32")}sep="\\";splitSep=xer;constructor(s,l=kT,_,h,b,D,N){super(s,l,_,h,b,D,N)}newChild(s,l=kT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return l4e.parse(s).root}getRoot(s){if(s=Ter(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new MM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(Wot,"$1\\"),s===l}},xle=class a extends My{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=kT,_,h,b,D,N){super(s,l,_,h,b,D,N)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=kT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},Cle=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:h,childrenCacheSize:b=16*1024,fs:D=qH}={}){this.#t=Vot(D),(s instanceof URL||s.startsWith("file://"))&&(s=uer(s));let N=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(N),this.#r=new Sle,this.#n=new Sle,this.#e=new u4e(b);let M=N.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),h===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=h,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let z=this.root,ne=M.length-1,ie=l.sep,Q=this.rootPath,Me=!1;for(let Ne of M){let we=ne--;z=z.child(Ne,{relative:new Array(we).fill("..").join(ie),relativePosix:new Array(we).fill("..").join("/"),fullpath:Q+=(Me?"":ie)+Ne}),Me=!0}this.cwd=z}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let h=this.cwd.resolve(l).fullpath();return this.#r.set(l,h),h}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let h=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,h),h}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let h=await s.readdir();return _?h:h.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(h=>h.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=[];(!b||b(s))&&N.push(_?s:s.fullpath());let M=new Set,z=t((ie,Q)=>{M.add(ie),ie.readdirCB((Me,Ne)=>{if(Me)return Q(Me);let we=Ne.length;if(!we)return Q();let Pt=t(()=>{--we===0&&Q()},"next");for(let xt of Ne)(!b||b(xt))&&N.push(_?xt:xt.fullpath()),h&&xt.isSymbolicLink()?xt.realpath().then(Tr=>Tr?.isUnknown()?Tr.lstat():Tr).then(Tr=>Tr?.shouldWalk(M,D)?z(Tr,Pt):Pt()):xt.shouldWalk(M,D)?z(xt,Pt):Pt()},!0)},"walk"),ne=s;return new Promise((ie,Q)=>{z(ne,Me=>{if(Me)return Q(Me);ie(N)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=[];(!b||b(s))&&N.push(_?s:s.fullpath());let M=new Set([s]);for(let z of M){let ne=z.readdirSync();for(let ie of ne){(!b||b(ie))&&N.push(_?ie:ie.fullpath());let Q=ie;if(ie.isSymbolicLink()){if(!(h&&(Q=ie.realpathSync())))continue;Q.isUnknown()&&Q.lstatSync()}Q.shouldWalk(M,D)&&M.add(Q)}}return N}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let N=new Set([s]);for(let M of N){let z=M.readdirSync();for(let ne of z){(!b||b(ne))&&(yield _?ne:ne.fullpath());let ie=ne;if(ne.isSymbolicLink()){if(!(h&&(ie=ne.realpathSync())))continue;ie.isUnknown()&&ie.lstatSync()}ie.shouldWalk(N,D)&&N.add(ie)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=new A3({objectMode:!0});(!b||b(s))&&N.write(_?s:s.fullpath());let M=new Set,z=[s],ne=0,ie=t(()=>{let Q=!1;for(;!Q;){let Me=z.shift();if(!Me){ne===0&&N.end();return}ne++,M.add(Me);let Ne=t((Pt,xt,Tr=!1)=>{if(Pt)return N.emit("error",Pt);if(h&&!Tr){let fn=[];for(let tn of xt)tn.isSymbolicLink()&&fn.push(tn.realpath().then(cn=>cn?.isUnknown()?cn.lstat():cn));if(fn.length){Promise.all(fn).then(()=>Ne(null,xt,!0));return}}for(let fn of xt)fn&&(!b||b(fn))&&(N.write(_?fn:fn.fullpath())||(Q=!0));ne--;for(let fn of xt){let tn=fn.realpathCached()||fn;tn.shouldWalk(M,D)&&z.push(tn)}Q&&!N.flowing?N.once("drain",ie):we||ie()},"onReaddir"),we=!0;Me.readdirCB(Ne,!0),we=!1}},"process");return ie(),N}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=new A3({objectMode:!0}),M=new Set;(!b||b(s))&&N.write(_?s:s.fullpath());let z=[s],ne=0,ie=t(()=>{let Q=!1;for(;!Q;){let Me=z.shift();if(!Me){ne===0&&N.end();return}ne++,M.add(Me);let Ne=Me.readdirSync();for(let we of Ne)(!b||b(we))&&(N.write(_?we:we.fullpath())||(Q=!0));ne--;for(let we of Ne){let Pt=we;if(we.isSymbolicLink()){if(!(h&&(Pt=we.realpathSync())))continue;Pt.isUnknown()&&Pt.lstatSync()}Pt.shouldWalk(M,D)&&z.push(Pt)}}Q&&!N.flowing&&N.once("drain",ie)},"process");return ie(),N}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[Qot](l)}},MM=class extends Cle{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,l4e,"\\",{...l,nocase:_}),this.nocase=_;for(let h=this.cwd;h;h=h.parent)h.nocase=this.nocase}parseRootPath(s){return l4e.parse(s).root.toUpperCase()}newRoot(s){return new Tle(this.rootPath,ck,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},jM=class extends Cle{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,ler,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new xle(this.rootPath,ck,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},HH=class extends jM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},d3r=process.platform==="win32"?Tle:xle,Zot=process.platform==="win32"?MM:process.platform==="darwin"?HH:jM;var Eer=t(a=>a.length>=1,"isPatternList"),Der=t(a=>a.length>=1,"isGlobList"),BM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,h){if(!Eer(s))throw new TypeError("empty pattern list");if(!Der(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=h,this.#e===0){if(this.isUNC()){let[b,D,N,M,...z]=this.#r,[ne,ie,Q,Me,...Ne]=this.#n;z[0]===""&&(z.shift(),Ne.shift());let we=[b,D,N,M,""].join("/"),Pt=[ne,ie,Q,Me,""].join("/");this.#r=[we,...z],this.#n=[Pt,...Ne],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[N,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let z=b+"/",ne=N+"/";this.#r=[z,...D],this.#n=[ne,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===I0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var ker=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",UM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:h,noglobstar:b,platform:D=ker}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:h,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let N of s)this.add(N)}add(s){let l=new q2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let h=l.set[_],b=l.globParts[_];if(!h||!b)throw new Error("invalid pattern object");for(;h[0]==="."&&b[0]===".";)h.shift(),b.shift();let D=new BM(h,b,0,this.platform),N=new q2(D.globString(),this.mmopts),M=b[b.length-1]==="**",z=D.isAbsolute();z?this.absolute.push(N):this.relative.push(N),M&&(z?this.absoluteChildren.push(N):this.relativeChildren.push(N))}}ignored(s){let l=s.fullpath(),_=`${l}/`,h=s.relative()||".",b=`${h}/`;for(let D of this.relative)if(D.match(h)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let h of this.relativeChildren)if(h.match(_))return!0;for(let h of this.absoluteChildren)if(h.match(l))return!0;return!1}};var f4e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),h=this.store.get(_);h?h.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},_4e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let h=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?h:h&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},p4e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(h=>h.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},GH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new _4e;subwalks=new p4e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new f4e}processPatterns(s,l){this.patterns=l;let _=l.map(h=>[s,h]);for(let[h,b]of _){this.hasWalkedCache.storeWalked(h,b);let D=b.root(),N=b.isAbsolute()&&this.opts.absolute!==!1;if(D){h=h.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let ie=b.rest();if(ie)b=ie;else{this.matches.add(h,!0,!1);continue}}if(h.isENOENT())continue;let M,z,ne=!1;for(;typeof(M=b.pattern())=="string"&&(z=b.rest());)h=h.resolve(M),b=z,ne=!0;if(M=b.pattern(),z=b.rest(),ne){if(this.hasWalkedCache.hasWalked(h,b))continue;this.hasWalkedCache.storeWalked(h,b)}if(typeof M=="string"){let ie=M===".."||M===""||M===".";this.matches.add(h.resolve(M),N,ie);continue}else if(M===I0){(!h.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(h,b);let ie=z?.pattern(),Q=z?.rest();if(!z||(ie===""||ie===".")&&!Q)this.matches.add(h,N,ie===""||ie===".");else if(ie===".."){let Me=h.parent||h;Q?this.hasWalkedCache.hasWalked(Me,Q)||this.subwalks.add(Me,Q):this.matches.add(Me,N,!0)}}else M instanceof RegExp&&this.subwalks.add(h,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),h=this.child();for(let b of l)for(let D of _){let N=D.isAbsolute(),M=D.pattern(),z=D.rest();M===I0?h.testGlobstar(b,D,z,N):M instanceof RegExp?h.testRegExp(b,M,z,N):h.testString(b,M,z,N)}return h}testGlobstar(s,l,_,h){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,h,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),h);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),h)}}testRegExp(s,l,_,h){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,h,!1))}testString(s,l,_,h){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,h,!1))}};var wer=t((a,s)=>typeof a=="string"?new UM([a],s):Array.isArray(a)?new UM(a,s):a,"makeIgnore"),Ele=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=wer(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let h="cannot ignore child matches, ignore lacks add() method.";throw new Error(h)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let h=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+h)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+h:"."+h)}}async match(s,l,_){let h=await this.matchCheck(s,_);h&&this.matchFinish(h,l)}matchSync(s,l,_){let h=this.matchCheckSync(s,_);h&&this.matchFinish(h,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new GH(this.opts),_)}walkCB2(s,l,_,h){if(this.#s(s))return h();if(this.signal?.aborted&&h(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,h));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||(b++,this.match(N,M,z).then(()=>D()));for(let N of _.subwalkTargets()){if(this.maxDepth!==1/0&&N.depth()>=this.maxDepth)continue;b++;let M=N.readdirCached();N.calledReaddir()?this.walkCB3(N,M,_,D):N.readdirCB((z,ne)=>this.walkCB3(N,ne,_,D),!0)}D()}walkCB3(s,l,_,h){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||(b++,this.match(N,M,z).then(()=>D()));for(let[N,M]of _.subwalks.entries())b++,this.walkCB2(N,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new GH(this.opts),_)}walkCB2Sync(s,l,_,h){if(this.#s(s))return h();if(this.signal?.aborted&&h(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,h));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||this.matchSync(N,M,z);for(let N of _.subwalkTargets()){if(this.maxDepth!==1/0&&N.depth()>=this.maxDepth)continue;b++;let M=N.readdirSync();this.walkCB3Sync(N,M,_,D)}D()}walkCB3Sync(s,l,_,h){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||this.matchSync(N,M,z);for(let[N,M]of _.subwalks.entries())b++,this.walkCB2Sync(N,M,_.child(),D);D()}},KH=class extends Ele{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(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}},YH=class extends Ele{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new A3({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(s){this.results.write(s),this.results.flowing||this.pause()}stream(){let s=this.path;return s.isUnknown()?s.lstat().then(()=>{this.walkCB(s,this.patterns,()=>this.results.end())}):this.walkCB(s,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var Aer=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",VC=class{static{t(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=Per(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||Aer,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?MM:l.platform==="darwin"?HH:l.platform?jM:Zot;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",h={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new q2(M,h)),[D,N]=b.reduce((M,z)=>(M[0].push(...z.set),M[1].push(...z.globParts),M),[[],[]]);this.patterns=D.map((M,z)=>{let ne=N[z];if(!ne)throw new Error("invalid pattern object");return new BM(M,ne,0,this.platform)})}async walk(){return[...await new KH(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 KH(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 YH(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 YH(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 d4e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new q2(l,s).hasMagic())return!0;return!1},"hasMagic");function Dle(a,s={}){return new VC(a,s).streamSync()}t(Dle,"globStreamSync");function tct(a,s={}){return new VC(a,s).stream()}t(tct,"globStream");function rct(a,s={}){return new VC(a,s).walkSync()}t(rct,"globSync");async function ect(a,s={}){return new VC(a,s).walk()}t(ect,"glob_");function kle(a,s={}){return new VC(a,s).iterateSync()}t(kle,"globIterateSync");function nct(a,s={}){return new VC(a,s).iterate()}t(nct,"globIterate");var Ner=Dle,Ier=Object.assign(tct,{sync:Dle}),Fer=kle,Oer=Object.assign(nct,{sync:kle}),Ler=Object.assign(rct,{stream:Dle,iterate:kle}),XH=Object.assign(ect,{glob:ect,globSync:rct,sync:Ler,globStream:tct,stream:Ier,globStreamSync:Dle,streamSync:Ner,globIterate:nct,iterate:Oer,globIterateSync:kle,iterateSync:Fer,Glob:VC,hasMagic:d4e,escape:IM,unescape:zC});XH.glob=XH;var V1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var Rer="[",Mer="]",jer="{",Ber="}",Uer=":",$er=",",zer="true",Jer="false",qer="null",Ver="NaN",Wer="Infinity",h4e='"',QH=new Map([[34,h4e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
576
576
  `],[102,"\f"],[114,"\r"],[116," "]]),Ale=new Map([...QH,[118,"\v"],[48,"\0"]]),Her=new Map([[h4e,h4e],["\\","\\"],["/","/"],["\b","b"],[`
577
577
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),Z3r=new Map([...Her,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Ple=new Map([[Rer,"LBracket"],[Mer,"RBracket"],[jer,"LBrace"],[Ber,"RBrace"],[Uer,"Colon"],[$er,"Comma"],[zer,"Boolean"],[Jer,"Boolean"],[qer,"Null"]]),wle=new Map([...Ple,[Ver,"Number"],[Wer,"Number"]]),g4e=new Set([10,13,8232,8233]),bA=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:h}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=h}},y4e=class extends bA{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},v4e=class extends bA{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},YF=class extends bA{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Nle=class extends bA{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},Ger=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Ker=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Yer=13,ict=10,b4e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===Yer?(this.#s=!0,this.peek()===ict&&this.#t++):s===ict&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},Xer="Infinity",Qer="NaN",Zer=new Set([116,102,110]),S4e=new Set([32,9,10,13]),sct=new Set([...S4e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),etr={mode:"json",ranges:!1},ttr=new Set(["true","false","null"]),x_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function vA(a){return a>=48&&a<=57}t(vA,"isDigit");function m4e(a){return vA(a)||a>=65&&a<=70||a>=97&&a<=102}t(m4e,"isHexDigit");function rtr(a){return a>=49&&a<=57}t(rtr,"isPositiveDigit");function ntr(a){return Zer.has(a)}t(ntr,"isKeywordStart");function oct(a){return vA(a)||a===46||a===45}t(oct,"isNumberStart");function itr(a){return oct(a)||a===43}t(itr,"isJSON5NumberStart");function act(a,s){return a===34||s&&a===39}t(act,"isStringStart");function cct(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return Ger.test(s)}t(cct,"isJSON5IdentifierStart");function str(a){if(cct(a)||vA(a))return!0;let s=String.fromCharCode(a);return Ker.test(s)}t(str,"isJSON5IdentifierPart");var T4e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...etr,...l},this.#e=new b4e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Ale.has.bind(Ale):QH.has.bind(QH),this.#c=this.#t?g4e.has.bind(g4e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?sct.has.bind(sct):S4e.has.bind(S4e)}#f(s,l=this.#e.locate()){throw new y4e(s,l)}#v(s,l=this.#e.locate()){throw new v4e(s,l)}#d(){throw new Nle(this.#e.locate())}#u(s,l,_,h){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:h||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let h=0;h<s;h++){if(_=this.#e.peek(),m4e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!str(s))break;this.#e.next()}while(!0);return l}#E(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let h=this.#m(4);_+=h.length}else if(this.#l(s)){this.#e.next(),_++;let h=this.#m(2);_+=h.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==Xer&&_!==Qer&&this.#f(s),l+_.length}vA(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),m4e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(m4e(s))}else vA(s)&&this.#f(s);else if(!this.#t||s!==46)for(rtr(s)||this.#f(s),s=this.#e.peek();vA(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();vA(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),vA(s)||(this.#e.next(),this.#f(s));vA(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return x_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(wle.has(_))this.#a=this.#u(wle.get(_),1,l);else if(cct(s)){let h=this.#g(s);wle.has(h)?this.#a=this.#u(wle.get(h),h.length,l):this.#a=this.#u("Identifier",h.length,l)}else if(itr(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(act(s,this.#t)){let h=this.#E(s),b=this.#e.locate();this.#a=this.#u("String",h,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let h=this.#b(s),b=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(Ple.has(_))this.#a=this.#u(Ple.get(_),1,l);else if(ntr(s)){let h=this.#g(s);ttr.has(h)||this.#v(h,l),this.#a=this.#u(Ple.get(h),h.length,l)}else if(oct(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(act(s,this.#t)){let h=this.#E(s);this.#a=this.#u("String",h,l)}else if(s===47&&this.#s){let h=this.#b(s),b=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return x_[this.#a.type]}get token(){return this.#a}};var wT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},atr={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function otr(a,s,l=!1){let _="",h=a.indexOf("\\"),b=0;for(;h>=0;){_+=a.slice(b,h);let D=a.charAt(h+1),N=D.charCodeAt(0);if(l&&Ale.has(N))_+=Ale.get(N),b=h+2;else if(QH.has(N))_+=QH.get(N),b=h+2;else if(D==="u"){let M=a.slice(h+2,h+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new bA(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(M,16)),b=h+6}else if(l&&D==="x"){let M=a.slice(h+2,h+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new bA(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(M,16)),b=h+4}else if(l&&g4e.has(N))b=h+2,D==="\r"&&a.charAt(b)===`
578
- `&&b++;else if(l)_+=D,b=h+2;else throw new bA(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",b)}return _+=a.slice(b),_}t(otr,"getStringValue");function ctr(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return otr(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(ctr,"getLiteralValue");function lct(a,s){s=Object.freeze({...atr,...s});let l=[],_=new T4e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",b=s.allowTrailingCommas||h;function D(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr}t(D,"nextNoComments");function N(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr>=x_.LineComment?N():Cr}t(N,"nextSkipComments");let M=s.mode==="json"?D:N;function z(Cr,vr){if(Cr!==vr)throw new YF(_.token)}t(z,"assertTokenType");function ne(Cr,vr){if(!vr.includes(Cr))throw new YF(_.token)}t(ne,"assertTokenTypes");function ie(Cr,vr){return s.ranges?{range:[Cr.offset,vr.offset]}:void 0}t(ie,"createRange");function Q(Cr){let vr=_.token,fs=ie(vr.loc.start,vr.loc.end),Fi=ctr(a.slice(vr.loc.start.offset,vr.loc.end.offset),vr,h),di={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...fs};switch(Cr){case x_.String:return wT.string(Fi,di);case x_.Number:return wT.number(Fi,di);case x_.Boolean:return wT.boolean(Fi,di);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(Q,"createLiteralNode");function Me(Cr){let vr=ie(Cr.loc.start,Cr.loc.end),fs=a.slice(Cr.loc.start.offset,Cr.loc.end.offset),Ho={loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr};if(Cr.type!=="Identifier"){let di="";return(fs[0]==="+"||fs[0]==="-")&&(di=fs[0]),wT[fs.includes("NaN")?"nan":"infinity"](di,Ho)}return wT.identifier(fs,Ho)}t(Me,"createJSON5IdentifierNode");function Ne(Cr){let vr=ie(Cr.loc.start,Cr.loc.end);return wT.null({loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr})}t(Ne,"createNullNode");function we(Cr){h?ne(Cr,[x_.String,x_.Identifier,x_.Number]):z(Cr,x_.String);let vr=_.token,fs=Cr===x_.String?Q(Cr):Me(vr);if(h&&(fs.type==="NaN"||fs.type==="Infinity")){if(fs.sign!=="")throw new YF(_.token);fs=wT.identifier(fs.type,{loc:fs.loc,...ie(fs.loc.start,fs.loc.end)})}Cr=M(),z(Cr,x_.Colon);let Fi=Tr(),Ho=ie(fs.loc.start,Fi.loc.end);return wT.member(fs,Fi,{loc:{start:{...fs.loc.start},end:{...Fi.loc.end}},...Ho})}t(we,"parseProperty");function Pt(Cr){z(Cr,x_.LBrace);let vr=_.token,fs=[],Fi=M();if(Fi!==x_.RBrace)do{if(fs.push(we(Fi)),Fi=M(),!Fi)throw new Nle(fs[fs.length-1].loc.end);if(Fi===x_.Comma){if(Fi=M(),b&&Fi===x_.RBrace)break}else break}while(Fi);z(Fi,x_.RBrace);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.object(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(Pt,"parseObject");function xt(Cr){z(Cr,x_.LBracket);let vr=_.token,fs=[],Fi=M();if(Fi!==x_.RBracket)do{let mf=Tr(Fi);if(fs.push(wT.element(mf,{loc:mf.loc})),Fi=M(),Fi===x_.Comma){if(Fi=M(),b&&Fi===x_.RBracket)break}else break}while(Fi);z(Fi,x_.RBracket);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.array(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(xt,"parseArray");function Tr(Cr){Cr=Cr??M();let vr=_.token;switch(Cr){case x_.String:case x_.Boolean:return Q(Cr);case x_.Number:if(h){let fs=a.slice(vr.loc.start.offset,vr.loc.end.offset);if((fs[0]==="+"||fs[0]==="-")&&(fs=fs.slice(1)),fs==="NaN"||fs==="Infinity")return Me(vr)}return Q(Cr);case x_.Null:return Ne(vr);case x_.LBrace:return Pt(Cr);case x_.LBracket:return xt(Cr);default:throw new YF(vr)}}t(Tr,"parseValue");let fn=Tr();if(M())throw new YF(_.token);let cn={loc:{start:{line:1,column:1,offset:0},end:{...fn.loc.end}}};return s.tokens&&(cn.tokens=l),s.ranges&&(cn.range=[cn.loc.start.offset,cn.loc.end.offset]),wT.document(fn,cn)}t(lct,"parse");var ltr=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function uct(a){return a&&typeof a=="object"}t(uct,"isObject");function utr(a){return uct(a)&&typeof a.type=="string"}t(utr,"isNode");function ftr(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let b of ltr.get(_.type)){let D=_[b];uct(D)&&(Array.isArray(D)?D.forEach(N=>l(N,_)):utr(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(ftr,"traverse");function fct(a,s=()=>!0){let l=[];return ftr(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(fct,"iterator");import _tr from"node:fs/promises";var ZH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Ile=t(async a=>{try{return await _tr.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),eG=t(async a=>{try{return lct(a)}catch(s){if(s.column&&s.line&&s.message){let l=ZH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var _ct=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await Ile(_),b=await ptr(h,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),ptr=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,b=await eG(a);if(b){for(let{node:D}of fct(b))if(D.value&&D.value===l){h=D.loc;break}if(h!==null){let D=ZH(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import pct from"node:fs/promises";import WC from"node:path";var x4e="schemas",C4e=".oas.json";var XF=t(async a=>(await pct.readdir(a)).map(l=>WC.join(a,l)).filter(l=>l.endsWith(C4e)).sort(),"getOpenApiFilesByAlphabetical"),$M=t(async a=>{let s=WC.resolve(a,"config");return(await pct.readdir(s)).filter(_=>_.endsWith(C4e)).length>=1},"oasFileInProject");function tG(a,s,l,_,h,b,D){if(b.has(l))return;let N;try{N=_.get(l)}catch(Ne){throw new z1({text:`Failed to resolve reference: ${l}`,detail:Ne.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}let M=Ole(l),z=WC.basename(M,WC.extname(M)),ne=l.indexOf("#"),ie=ne>=0?l.substring(0,ne):l,Q=ne>=0?l.substring(ne+1):"",Me=_.get(ie);if(Q){let Ne=Q.split("/").filter(Boolean);for(let we of Ne)if(Me=Me[we],Me===void 0)throw new Error(`Cannot resolve JSON pointer: ${Q}`)}if(Me&&typeof Me=="object"&&"$ref"in Me&&typeof Me.$ref=="string"&&!Me.$ref.startsWith("#")){let Ne=WC.resolve(WC.dirname(ie),Me.$ref);M=Ne,z=WC.basename(M,WC.extname(M)),ie=Ne,b.set(ie,h.length),h.push(ie),Fle(M,z,N,_,h,b,D)}else b.set(l,h.length),h.push(l),Fle(Ole(l),s,N,_,h,b,D)}t(tG,"chaseRefs");function Fle(a,s,l,_,h,b,D){if(Array.isArray(l))for(let N of l)Fle(a,s,N,_,h,b,D);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let M=l[N];D&&(l[N]=D(s,M)),tG(a,s,N3(a,M),_,h,b,D)}Fle(a,s,l[N],_,h,b,D)}}t(Fle,"lookForRefs");function N3(a,s){let l=s.indexOf("#");return l>=0?`${WC.resolve(a,s.substring(0,l))}${s.substring(l)}`:WC.resolve(WC.dirname(a),s)}t(N3,"getFullyQualifiedRefName");function Ole(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Ole,"getFilePathNameFromRefName");var yG=ap(B3e(),1);import{readFile as far}from"node:fs/promises";var $3e={};hat($3e,{UnsafePathError:()=>oue,deleteFolder:()=>uar,dirExists:()=>U3e,fileExists:()=>ear,getParentDirFilename:()=>oar,isNotFileOrDirectory:()=>rar,listFolderContents:()=>$ut,listFolders:()=>iar,mkDirTemp:()=>tar,mkdirForFilePathIfNotExits:()=>sar,mkdirIfNotExists:()=>zut,safePath:()=>aar,tarFolder:()=>car,untarFile:()=>lar});import{spawn as But}from"node:child_process";import{randomUUID as Xsr}from"node:crypto";import j3 from"node:fs/promises";import{platform as Qsr,tmpdir as Zsr}from"node:os";import H1 from"node:path";var Uut=[".git","node_modules",".yarn",".DS_Store"];async function ear(a){try{return(await j3.stat(a)).isFile()}catch{return!1}}t(ear,"fileExists");async function tar(){let a=process.env.BUILD_FILE_PATH??Zsr(),s=Xsr().replaceAll("-",""),l=H1.join(a,s);return await j3.mkdir(l,{recursive:!0}),l}t(tar,"mkDirTemp");async function U3e(a){try{return(await j3.stat(a)).isDirectory()}catch{return!1}}t(U3e,"dirExists");async function rar(a){try{return await j3.stat(a),!1}catch{return!0}}t(rar,"isNotFileOrDirectory");function nar(a,s){let l=H1.sep==="\\"?"\\\\":H1.sep,_=new RegExp(`(.*)(${l}${s})$|(.*)(${s}${l})`),h=a.match(_);if(!h)return"";let b=a.split(h[0]);return b[1]===""?"":H1.join(H1.sep,b[1])}t(nar,"getParentDirectory");async function iar(a){if(!await U3e(a))return[];let s=await j3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Uut.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(iar,"listFolders");async function $ut(a,s,l=!0){let _=nar(a,s),h=await j3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of h)if(!Uut.includes(D.name)||!l)if(D.isDirectory()){let N=await $ut(H1.join(a,D.name),s,l);b.push(...N)}else b.push(H1.join(_,D.name));return b}t($ut,"listFolderContents");var zut=t(async a=>{await j3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),sar=t(async a=>{let s=H1.dirname(a);return zut(s)},"mkdirForFilePathIfNotExits"),oue=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function aar(a){let s=H1.normalize(a),l=t(_=>{let h=H1.normalize(_),b=process.platform==="win32",D=!1;if(b?D=h.toLowerCase().startsWith(s.toLowerCase()):D=h.startsWith(s),!D)throw new oue("Resolved path is not part of the project.");return h},"ensureSafePath");return{resolve:t((..._)=>l(H1.resolve(..._)),"resolve")}}t(aar,"safePath");function oar(a){return H1.join(H1.basename(H1.dirname(a)),H1.basename(a))}t(oar,"getParentDirFilename");async function car({folderPath:a,outputTarPath:s,exclude:l=["node_modules",".git","dist"],logger:_}){let h=[],b=[],D;try{await new Promise((N,M)=>{let z=But("tar",[...l.map(ne=>["--exclude",ne]).flat(),...Qsr()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",a,"."]);z.stdout.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&h.push(ie.trim())}),z.stderr.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&b.push(ie.trim())}),z.on("close",ne=>{D=ne,ne===0?N():M(new Error(`tar process exited with code ${ne}`))}),z.on("error",ne=>{M(ne)})})}catch(N){throw new Error("Failed to tar folder",{cause:N})}finally{_.info({stdout:h.join(`
578
+ `&&b++;else if(l)_+=D,b=h+2;else throw new bA(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",b)}return _+=a.slice(b),_}t(otr,"getStringValue");function ctr(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return otr(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(ctr,"getLiteralValue");function lct(a,s){s=Object.freeze({...atr,...s});let l=[],_=new T4e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",b=s.allowTrailingCommas||h;function D(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr}t(D,"nextNoComments");function N(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr>=x_.LineComment?N():Cr}t(N,"nextSkipComments");let M=s.mode==="json"?D:N;function z(Cr,vr){if(Cr!==vr)throw new YF(_.token)}t(z,"assertTokenType");function ne(Cr,vr){if(!vr.includes(Cr))throw new YF(_.token)}t(ne,"assertTokenTypes");function ie(Cr,vr){return s.ranges?{range:[Cr.offset,vr.offset]}:void 0}t(ie,"createRange");function Q(Cr){let vr=_.token,fs=ie(vr.loc.start,vr.loc.end),Fi=ctr(a.slice(vr.loc.start.offset,vr.loc.end.offset),vr,h),di={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...fs};switch(Cr){case x_.String:return wT.string(Fi,di);case x_.Number:return wT.number(Fi,di);case x_.Boolean:return wT.boolean(Fi,di);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(Q,"createLiteralNode");function Me(Cr){let vr=ie(Cr.loc.start,Cr.loc.end),fs=a.slice(Cr.loc.start.offset,Cr.loc.end.offset),Ho={loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr};if(Cr.type!=="Identifier"){let di="";return(fs[0]==="+"||fs[0]==="-")&&(di=fs[0]),wT[fs.includes("NaN")?"nan":"infinity"](di,Ho)}return wT.identifier(fs,Ho)}t(Me,"createJSON5IdentifierNode");function Ne(Cr){let vr=ie(Cr.loc.start,Cr.loc.end);return wT.null({loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr})}t(Ne,"createNullNode");function we(Cr){h?ne(Cr,[x_.String,x_.Identifier,x_.Number]):z(Cr,x_.String);let vr=_.token,fs=Cr===x_.String?Q(Cr):Me(vr);if(h&&(fs.type==="NaN"||fs.type==="Infinity")){if(fs.sign!=="")throw new YF(_.token);fs=wT.identifier(fs.type,{loc:fs.loc,...ie(fs.loc.start,fs.loc.end)})}Cr=M(),z(Cr,x_.Colon);let Fi=Tr(),Ho=ie(fs.loc.start,Fi.loc.end);return wT.member(fs,Fi,{loc:{start:{...fs.loc.start},end:{...Fi.loc.end}},...Ho})}t(we,"parseProperty");function Pt(Cr){z(Cr,x_.LBrace);let vr=_.token,fs=[],Fi=M();if(Fi!==x_.RBrace)do{if(fs.push(we(Fi)),Fi=M(),!Fi)throw new Nle(fs[fs.length-1].loc.end);if(Fi===x_.Comma){if(Fi=M(),b&&Fi===x_.RBrace)break}else break}while(Fi);z(Fi,x_.RBrace);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.object(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(Pt,"parseObject");function xt(Cr){z(Cr,x_.LBracket);let vr=_.token,fs=[],Fi=M();if(Fi!==x_.RBracket)do{let mf=Tr(Fi);if(fs.push(wT.element(mf,{loc:mf.loc})),Fi=M(),Fi===x_.Comma){if(Fi=M(),b&&Fi===x_.RBracket)break}else break}while(Fi);z(Fi,x_.RBracket);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.array(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(xt,"parseArray");function Tr(Cr){Cr=Cr??M();let vr=_.token;switch(Cr){case x_.String:case x_.Boolean:return Q(Cr);case x_.Number:if(h){let fs=a.slice(vr.loc.start.offset,vr.loc.end.offset);if((fs[0]==="+"||fs[0]==="-")&&(fs=fs.slice(1)),fs==="NaN"||fs==="Infinity")return Me(vr)}return Q(Cr);case x_.Null:return Ne(vr);case x_.LBrace:return Pt(Cr);case x_.LBracket:return xt(Cr);default:throw new YF(vr)}}t(Tr,"parseValue");let fn=Tr();if(M())throw new YF(_.token);let cn={loc:{start:{line:1,column:1,offset:0},end:{...fn.loc.end}}};return s.tokens&&(cn.tokens=l),s.ranges&&(cn.range=[cn.loc.start.offset,cn.loc.end.offset]),wT.document(fn,cn)}t(lct,"parse");var ltr=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function uct(a){return a&&typeof a=="object"}t(uct,"isObject");function utr(a){return uct(a)&&typeof a.type=="string"}t(utr,"isNode");function ftr(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let b of ltr.get(_.type)){let D=_[b];uct(D)&&(Array.isArray(D)?D.forEach(N=>l(N,_)):utr(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(ftr,"traverse");function fct(a,s=()=>!0){let l=[];return ftr(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(fct,"iterator");import _tr from"node:fs/promises";var ZH=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Ile=t(async a=>{try{return await _tr.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),eG=t(async a=>{try{return lct(a)}catch(s){if(s.column&&s.line&&s.message){let l=ZH(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var _ct=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await Ile(_),b=await ptr(h,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),ptr=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,b=await eG(a);if(b){for(let{node:D}of fct(b))if(D.value&&D.value===l){h=D.loc;break}if(h!==null){let D=ZH(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import pct from"node:fs/promises";import WC from"node:path";var x4e="schemas",C4e=".oas.json";var XF=t(async a=>(await pct.readdir(a)).map(l=>WC.join(a,l)).filter(l=>l.endsWith(C4e)).sort(),"getOpenApiFilesByAlphabetical"),$M=t(async a=>{let s=WC.resolve(a,"config");return(await pct.readdir(s)).filter(_=>_.endsWith(C4e)).length>=1},"oasFileInProject");function tG(a,s,l,_,h,b,D){if(b.has(l))return;let N;try{N=_.get(l)}catch(Ne){throw new z1({text:`Failed to resolve reference: ${l}`,detail:Ne.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}let M=Ole(l),z=WC.basename(M,WC.extname(M)),ne=l.indexOf("#"),ie=ne>=0?l.substring(0,ne):l,Q=ne>=0?l.substring(ne+1):"",Me=_.get(ie);if(Q){let Ne=Q.split("/").filter(Boolean);for(let we of Ne)if(Me=Me[we],Me===void 0)throw new Error(`Cannot resolve JSON pointer: ${Q}`)}if(Me&&typeof Me=="object"&&"$ref"in Me&&typeof Me.$ref=="string"&&!Me.$ref.startsWith("#")){let Ne=WC.resolve(WC.dirname(ie),Me.$ref);M=Ne,z=WC.basename(M,WC.extname(M)),ie=Ne,b.set(ie,h.length),h.push(ie),Fle(M,z,N,_,h,b,D)}else b.set(l,h.length),h.push(l),Fle(Ole(l),s,N,_,h,b,D)}t(tG,"chaseRefs");function Fle(a,s,l,_,h,b,D){if(Array.isArray(l))for(let N of l)Fle(a,s,N,_,h,b,D);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let M=l[N];D&&(l[N]=D(s,M,a)),tG(a,s,N3(a,M),_,h,b,D)}Fle(a,s,l[N],_,h,b,D)}}t(Fle,"lookForRefs");function N3(a,s){let l=s.indexOf("#");return l>=0?`${WC.resolve(a,s.substring(0,l))}${s.substring(l)}`:WC.resolve(WC.dirname(a),s)}t(N3,"getFullyQualifiedRefName");function Ole(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Ole,"getFilePathNameFromRefName");var yG=ap(B3e(),1);import{readFile as far}from"node:fs/promises";var $3e={};hat($3e,{UnsafePathError:()=>oue,deleteFolder:()=>uar,dirExists:()=>U3e,fileExists:()=>ear,getParentDirFilename:()=>oar,isNotFileOrDirectory:()=>rar,listFolderContents:()=>$ut,listFolders:()=>iar,mkDirTemp:()=>tar,mkdirForFilePathIfNotExits:()=>sar,mkdirIfNotExists:()=>zut,safePath:()=>aar,tarFolder:()=>car,untarFile:()=>lar});import{spawn as But}from"node:child_process";import{randomUUID as Xsr}from"node:crypto";import j3 from"node:fs/promises";import{platform as Qsr,tmpdir as Zsr}from"node:os";import H1 from"node:path";var Uut=[".git","node_modules",".yarn",".DS_Store"];async function ear(a){try{return(await j3.stat(a)).isFile()}catch{return!1}}t(ear,"fileExists");async function tar(){let a=process.env.BUILD_FILE_PATH??Zsr(),s=Xsr().replaceAll("-",""),l=H1.join(a,s);return await j3.mkdir(l,{recursive:!0}),l}t(tar,"mkDirTemp");async function U3e(a){try{return(await j3.stat(a)).isDirectory()}catch{return!1}}t(U3e,"dirExists");async function rar(a){try{return await j3.stat(a),!1}catch{return!0}}t(rar,"isNotFileOrDirectory");function nar(a,s){let l=H1.sep==="\\"?"\\\\":H1.sep,_=new RegExp(`(.*)(${l}${s})$|(.*)(${s}${l})`),h=a.match(_);if(!h)return"";let b=a.split(h[0]);return b[1]===""?"":H1.join(H1.sep,b[1])}t(nar,"getParentDirectory");async function iar(a){if(!await U3e(a))return[];let s=await j3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Uut.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(iar,"listFolders");async function $ut(a,s,l=!0){let _=nar(a,s),h=await j3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of h)if(!Uut.includes(D.name)||!l)if(D.isDirectory()){let N=await $ut(H1.join(a,D.name),s,l);b.push(...N)}else b.push(H1.join(_,D.name));return b}t($ut,"listFolderContents");var zut=t(async a=>{await j3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),sar=t(async a=>{let s=H1.dirname(a);return zut(s)},"mkdirForFilePathIfNotExits"),oue=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function aar(a){let s=H1.normalize(a),l=t(_=>{let h=H1.normalize(_),b=process.platform==="win32",D=!1;if(b?D=h.toLowerCase().startsWith(s.toLowerCase()):D=h.startsWith(s),!D)throw new oue("Resolved path is not part of the project.");return h},"ensureSafePath");return{resolve:t((..._)=>l(H1.resolve(..._)),"resolve")}}t(aar,"safePath");function oar(a){return H1.join(H1.basename(H1.dirname(a)),H1.basename(a))}t(oar,"getParentDirFilename");async function car({folderPath:a,outputTarPath:s,exclude:l=["node_modules",".git","dist"],logger:_}){let h=[],b=[],D;try{await new Promise((N,M)=>{let z=But("tar",[...l.map(ne=>["--exclude",ne]).flat(),...Qsr()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",a,"."]);z.stdout.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&h.push(ie.trim())}),z.stderr.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&b.push(ie.trim())}),z.on("close",ne=>{D=ne,ne===0?N():M(new Error(`tar process exited with code ${ne}`))}),z.on("error",ne=>{M(ne)})})}catch(N){throw new Error("Failed to tar folder",{cause:N})}finally{_.info({stdout:h.join(`
579
579
  `),stderr:b.join(`
580
580
  `),exitCode:D},"Tar process logs")}}t(car,"tarFolder");async function lar({tarFilePath:a,outputDir:s,logger:l}){let _=[],h=[],b;try{await new Promise((D,N)=>{let M=But("sh",["-c",`tar -xvf ${a} -C ${s};`]);M.stdout.on("data",z=>{let ne=z.toString().trim();ne.length>0&&_.push(ne.trim())}),M.stderr.on("data",z=>{let ne=z.toString().trim();ne.length>0&&h.push(ne.trim())}),M.on("close",z=>{b=z,z===0?D():N(new Error(`tar process exited with code ${z}`))}),M.on("error",z=>{N(z)})})}catch(D){throw new Error("Failed to untar file",{cause:D})}finally{l.info({stdout:_.join(`
581
581
  `),stderr:h.join(`
@@ -608,10 +608,10 @@ globstar while`,s,Q,l,Me,Ne),this.matchOne(s.slice(Q),l.slice(Me),_))return this
608
608
  `,D):(a.write("/*"),Pgr(a,D.value,l,_),a.write("*/"+_))}}t(X1,"formatComments");function Agr(a){let s=a;for(;s!=null;){let{type:l}=s;if(l[0]==="C"&&l[1]==="a")return!0;if(l[0]==="M"&&l[1]==="e"&&l[2]==="m")s=s.object;else return!1}}t(Agr,"hasCallExpression");function lFe(a,s){let{generator:l}=a,{declarations:_}=s;a.write(s.kind+" ");let{length:h}=_;if(h>0){l.VariableDeclarator(_[0],a);for(let b=1;b<h;b++)a.write(", "),l.VariableDeclarator(_[b],a)}}t(lFe,"formatVariableDeclaration");var Iht,Fht,Oht,Lht,Rht,Mht,Ngr={Program(a,s){let l=s.indent.repeat(s.indentLevel),{lineEnd:_,writeComments:h}=s;h&&a.comments!=null&&X1(s,a.comments,l,_);let b=a.body,{length:D}=b;for(let N=0;N<D;N++){let M=b[N];h&&M.comments!=null&&X1(s,M.comments,l,_),s.write(l),this[M.type](M,s),s.write(_)}h&&a.trailingComments!=null&&X1(s,a.trailingComments,l,_)},BlockStatement:Mht=t(function(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s,b=l+s.indent;s.write("{");let D=a.body;if(D!=null&&D.length>0){s.write(_),h&&a.comments!=null&&X1(s,a.comments,b,_);let{length:N}=D;for(let M=0;M<N;M++){let z=D[M];h&&z.comments!=null&&X1(s,z.comments,b,_),s.write(b),this[z.type](z,s),s.write(_)}s.write(l)}else h&&a.comments!=null&&(s.write(_),X1(s,a.comments,b,_),s.write(l));h&&a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write("}"),s.indentLevel--},"BlockStatement"),ClassBody:Mht,StaticBlock(a,s){s.write("static "),this.BlockStatement(a,s)},EmptyStatement(a,s){s.write(";")},ExpressionStatement(a,s){let l=s.expressionsPrecedence[a.expression.type];l===cE||l===3&&a.expression.left.type[0]==="O"?(s.write("("),this[a.expression.type](a.expression,s),s.write(")")):this[a.expression.type](a.expression,s),s.write(";")},IfStatement(a,s){s.write("if ("),this[a.test.type](a.test,s),s.write(") "),this[a.consequent.type](a.consequent,s),a.alternate!=null&&(s.write(" else "),this[a.alternate.type](a.alternate,s))},LabeledStatement(a,s){this[a.label.type](a.label,s),s.write(": "),this[a.body.type](a.body,s)},BreakStatement(a,s){s.write("break"),a.label!=null&&(s.write(" "),this[a.label.type](a.label,s)),s.write(";")},ContinueStatement(a,s){s.write("continue"),a.label!=null&&(s.write(" "),this[a.label.type](a.label,s)),s.write(";")},WithStatement(a,s){s.write("with ("),this[a.object.type](a.object,s),s.write(") "),this[a.body.type](a.body,s)},SwitchStatement(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s;s.indentLevel++;let b=l+s.indent,D=b+s.indent;s.write("switch ("),this[a.discriminant.type](a.discriminant,s),s.write(") {"+_);let{cases:N}=a,{length:M}=N;for(let z=0;z<M;z++){let ne=N[z];h&&ne.comments!=null&&X1(s,ne.comments,b,_),ne.test?(s.write(b+"case "),this[ne.test.type](ne.test,s),s.write(":"+_)):s.write(b+"default:"+_);let{consequent:ie}=ne,{length:Q}=ie;for(let Me=0;Me<Q;Me++){let Ne=ie[Me];h&&Ne.comments!=null&&X1(s,Ne.comments,D,_),s.write(D),this[Ne.type](Ne,s),s.write(_)}}s.indentLevel-=2,s.write(l+"}")},ReturnStatement(a,s){s.write("return"),a.argument&&(s.write(" "),this[a.argument.type](a.argument,s)),s.write(";")},ThrowStatement(a,s){s.write("throw "),this[a.argument.type](a.argument,s),s.write(";")},TryStatement(a,s){if(s.write("try "),this[a.block.type](a.block,s),a.handler){let{handler:l}=a;l.param==null?s.write(" catch "):(s.write(" catch ("),this[l.param.type](l.param,s),s.write(") ")),this[l.body.type](l.body,s)}a.finalizer&&(s.write(" finally "),this[a.finalizer.type](a.finalizer,s))},WhileStatement(a,s){s.write("while ("),this[a.test.type](a.test,s),s.write(") "),this[a.body.type](a.body,s)},DoWhileStatement(a,s){s.write("do "),this[a.body.type](a.body,s),s.write(" while ("),this[a.test.type](a.test,s),s.write(");")},ForStatement(a,s){if(s.write("for ("),a.init!=null){let{init:l}=a;l.type[0]==="V"?lFe(s,l):this[l.type](l,s)}s.write("; "),a.test&&this[a.test.type](a.test,s),s.write("; "),a.update&&this[a.update.type](a.update,s),s.write(") "),this[a.body.type](a.body,s)},ForInStatement:Iht=t(function(a,s){s.write(`for ${a.await?"await ":""}(`);let{left:l}=a;l.type[0]==="V"?lFe(s,l):this[l.type](l,s),s.write(a.type[3]==="I"?" in ":" of "),this[a.right.type](a.right,s),s.write(") "),this[a.body.type](a.body,s)},"ForInStatement"),ForOfStatement:Iht,DebuggerStatement(a,s){s.write("debugger;",a)},FunctionDeclaration:Fht=t(function(a,s){s.write((a.async?"async ":"")+(a.generator?"function* ":"function ")+(a.id?a.id.name:""),a),Lj(s,a.params),s.write(" "),this[a.body.type](a.body,s)},"FunctionDeclaration"),FunctionExpression:Fht,VariableDeclaration(a,s){lFe(s,a),s.write(";")},VariableDeclarator(a,s){this[a.id.type](a.id,s),a.init!=null&&(s.write(" = "),this[a.init.type](a.init,s))},ClassDeclaration(a,s){if(s.write("class "+(a.id?`${a.id.name} `:""),a),a.superClass){s.write("extends ");let{superClass:l}=a,{type:_}=l,h=s.expressionsPrecedence[_];(_[0]!=="C"||_[1]!=="l"||_[5]!=="E")&&(h===cE||h<s.expressionsPrecedence.ClassExpression)?(s.write("("),this[a.superClass.type](l,s),s.write(")")):this[l.type](l,s),s.write(" ")}this.ClassBody(a.body,s)},ImportDeclaration(a,s){s.write("import ");let{specifiers:l,attributes:_}=a,{length:h}=l,b=0;if(h>0){for(;b<h;){b>0&&s.write(", ");let D=l[b],N=D.type[6];if(N==="D")s.write(D.local.name,D),b++;else if(N==="N")s.write("* as "+D.local.name,D),b++;else break}if(b<h){for(s.write("{");;){let D=l[b],{name:N}=D.imported;if(s.write(N,D),N!==D.local.name&&s.write(" as "+D.local.name),++b<h)s.write(", ");else break}s.write("}")}s.write(" from ")}if(this.Literal(a.source,s),_&&_.length>0){s.write(" with { ");for(let D=0;D<_.length;D++)this.ImportAttribute(_[D],s),D<_.length-1&&s.write(", ");s.write(" }")}s.write(";")},ImportAttribute(a,s){this.Identifier(a.key,s),s.write(": "),this.Literal(a.value,s)},ImportExpression(a,s){s.write("import("),this[a.source.type](a.source,s),s.write(")")},ExportDefaultDeclaration(a,s){s.write("export default "),this[a.declaration.type](a.declaration,s),s.expressionsPrecedence[a.declaration.type]!=null&&a.declaration.type[0]!=="F"&&s.write(";")},ExportNamedDeclaration(a,s){if(s.write("export "),a.declaration)this[a.declaration.type](a.declaration,s);else{s.write("{");let{specifiers:l}=a,{length:_}=l;if(_>0)for(let h=0;;){let b=l[h],{name:D}=b.local;if(s.write(D,b),D!==b.exported.name&&s.write(" as "+b.exported.name),++h<_)s.write(", ");else break}if(s.write("}"),a.source&&(s.write(" from "),this.Literal(a.source,s)),a.attributes&&a.attributes.length>0){s.write(" with { ");for(let h=0;h<a.attributes.length;h++)this.ImportAttribute(a.attributes[h],s),h<a.attributes.length-1&&s.write(", ");s.write(" }")}s.write(";")}},ExportAllDeclaration(a,s){if(a.exported!=null?s.write("export * as "+a.exported.name+" from "):s.write("export * from "),this.Literal(a.source,s),a.attributes&&a.attributes.length>0){s.write(" with { ");for(let l=0;l<a.attributes.length;l++)this.ImportAttribute(a.attributes[l],s),l<a.attributes.length-1&&s.write(", ");s.write(" }")}s.write(";")},MethodDefinition(a,s){a.static&&s.write("static ");let l=a.kind[0];(l==="g"||l==="s")&&s.write(a.kind+" "),a.value.async&&s.write("async "),a.value.generator&&s.write("*"),a.computed?(s.write("["),this[a.key.type](a.key,s),s.write("]")):this[a.key.type](a.key,s),Lj(s,a.value.params),s.write(" "),this[a.value.body.type](a.value.body,s)},ClassExpression(a,s){this.ClassDeclaration(a,s)},ArrowFunctionExpression(a,s){s.write(a.async?"async ":"",a);let{params:l}=a;l!=null&&(l.length===1&&l[0].type[0]==="I"?s.write(l[0].name,l[0]):Lj(s,a.params)),s.write(" => "),a.body.type[0]==="O"?(s.write("("),this.ObjectExpression(a.body,s),s.write(")")):this[a.body.type](a.body,s)},ThisExpression(a,s){s.write("this",a)},Super(a,s){s.write("super",a)},RestElement:Oht=t(function(a,s){s.write("..."),this[a.argument.type](a.argument,s)},"RestElement"),SpreadElement:Oht,YieldExpression(a,s){s.write(a.delegate?"yield*":"yield"),a.argument&&(s.write(" "),this[a.argument.type](a.argument,s))},AwaitExpression(a,s){s.write("await ",a),Rfe(s,a.argument,a)},TemplateLiteral(a,s){let{quasis:l,expressions:_}=a;s.write("`");let{length:h}=_;for(let D=0;D<h;D++){let N=_[D],M=l[D];s.write(M.value.raw,M),s.write("${"),this[N.type](N,s),s.write("}")}let b=l[l.length-1];s.write(b.value.raw,b),s.write("`")},TemplateElement(a,s){s.write(a.value.raw,a)},TaggedTemplateExpression(a,s){Rfe(s,a.tag,a),this[a.quasi.type](a.quasi,s)},ArrayExpression:Rht=t(function(a,s){if(s.write("["),a.elements.length>0){let{elements:l}=a,{length:_}=l;for(let h=0;;){let b=l[h];if(b!=null&&this[b.type](b,s),++h<_)s.write(", ");else{b==null&&s.write(", ");break}}}s.write("]")},"ArrayExpression"),ArrayPattern:Rht,ObjectExpression(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s,b=l+s.indent;if(s.write("{"),a.properties.length>0){s.write(_),h&&a.comments!=null&&X1(s,a.comments,b,_);let D=","+_,{properties:N}=a,{length:M}=N;for(let z=0;;){let ne=N[z];if(h&&ne.comments!=null&&X1(s,ne.comments,b,_),s.write(b),this[ne.type](ne,s),++z<M)s.write(D);else break}s.write(_),h&&a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write(l+"}")}else h?a.comments!=null?(s.write(_),X1(s,a.comments,b,_),a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write(l+"}")):a.trailingComments!=null?(s.write(_),X1(s,a.trailingComments,b,_),s.write(l+"}")):s.write("}"):s.write("}");s.indentLevel--},Property(a,s){a.method||a.kind[0]!=="i"?this.MethodDefinition(a,s):(a.shorthand||(a.computed?(s.write("["),this[a.key.type](a.key,s),s.write("]")):this[a.key.type](a.key,s),s.write(": ")),this[a.value.type](a.value,s))},PropertyDefinition(a,s){if(a.static&&s.write("static "),a.computed&&s.write("["),this[a.key.type](a.key,s),a.computed&&s.write("]"),a.value==null){a.key.type[0]!=="F"&&s.write(";");return}s.write(" = "),this[a.value.type](a.value,s),s.write(";")},ObjectPattern(a,s){if(s.write("{"),a.properties.length>0){let{properties:l}=a,{length:_}=l;for(let h=0;this[l[h].type](l[h],s),++h<_;)s.write(", ")}s.write("}")},SequenceExpression(a,s){Lj(s,a.expressions)},UnaryExpression(a,s){if(a.prefix){let{operator:l,argument:_,argument:{type:h}}=a;s.write(l);let b=jht(s,_,a);!b&&(l.length>1||h[0]==="U"&&(h[1]==="n"||h[1]==="p")&&_.prefix&&_.operator[0]===l&&(l==="+"||l==="-"))&&s.write(" "),b?(s.write(l.length>1?" (":"("),this[h](_,s),s.write(")")):this[h](_,s)}else this[a.argument.type](a.argument,s),s.write(a.operator)},UpdateExpression(a,s){a.prefix?(s.write(a.operator),this[a.argument.type](a.argument,s)):(this[a.argument.type](a.argument,s),s.write(a.operator))},AssignmentExpression(a,s){this[a.left.type](a.left,s),s.write(" "+a.operator+" "),this[a.right.type](a.right,s)},AssignmentPattern(a,s){this[a.left.type](a.left,s),s.write(" = "),this[a.right.type](a.right,s)},BinaryExpression:Lht=t(function(a,s){let l=a.operator==="in";l&&s.write("("),Rfe(s,a.left,a,!1),s.write(" "+a.operator+" "),Rfe(s,a.right,a,!0),l&&s.write(")")},"BinaryExpression"),LogicalExpression:Lht,ConditionalExpression(a,s){let{test:l}=a,_=s.expressionsPrecedence[l.type];_===cE||_<=s.expressionsPrecedence.ConditionalExpression?(s.write("("),this[l.type](l,s),s.write(")")):this[l.type](l,s),s.write(" ? "),this[a.consequent.type](a.consequent,s),s.write(" : "),this[a.alternate.type](a.alternate,s)},NewExpression(a,s){s.write("new ");let l=s.expressionsPrecedence[a.callee.type];l===cE||l<s.expressionsPrecedence.CallExpression||Agr(a.callee)?(s.write("("),this[a.callee.type](a.callee,s),s.write(")")):this[a.callee.type](a.callee,s),Lj(s,a.arguments)},CallExpression(a,s){let l=s.expressionsPrecedence[a.callee.type];l===cE||l<s.expressionsPrecedence.CallExpression?(s.write("("),this[a.callee.type](a.callee,s),s.write(")")):this[a.callee.type](a.callee,s),a.optional&&s.write("?."),Lj(s,a.arguments)},ChainExpression(a,s){this[a.expression.type](a.expression,s)},MemberExpression(a,s){let l=s.expressionsPrecedence[a.object.type];l===cE||l<s.expressionsPrecedence.MemberExpression?(s.write("("),this[a.object.type](a.object,s),s.write(")")):this[a.object.type](a.object,s),a.computed?(a.optional&&s.write("?."),s.write("["),this[a.property.type](a.property,s),s.write("]")):(a.optional?s.write("?."):s.write("."),this[a.property.type](a.property,s))},MetaProperty(a,s){s.write(a.meta.name+"."+a.property.name,a)},Identifier(a,s){s.write(a.name,a)},PrivateIdentifier(a,s){s.write(`#${a.name}`,a)},Literal(a,s){a.raw!=null?s.write(a.raw,a):a.regex!=null?this.RegExpLiteral(a,s):a.bigint!=null?s.write(a.bigint+"n",a):s.write(kgr(a.value),a)},RegExpLiteral(a,s){let{regex:l}=a;s.write(`/${l.pattern}/${l.flags}`,a)}},Igr={};var uFe=class{static{t(this,"State")}constructor(s){let l=s??Igr;this.output="",l.output!=null?(this.output=l.output,this.write=this.writeToStream):this.output="",this.generator=l.generator!=null?l.generator:Ngr,this.expressionsPrecedence=l.expressionsPrecedence!=null?l.expressionsPrecedence:wgr,this.indent=l.indent!=null?l.indent:" ",this.lineEnd=l.lineEnd!=null?l.lineEnd:`
609
609
  `,this.indentLevel=l.startingIndentLevel!=null?l.startingIndentLevel:0,this.writeComments=l.comments?l.comments:!1,l.sourceMap!=null&&(this.write=l.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=l.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
610
610
  `).length-1,this.mapping={original:null,generated:this,name:void 0,source:l.sourceMap.file||l.sourceMap._file})}write(s){this.output+=s}writeToStream(s){this.output.write(s)}writeAndMap(s,l){this.output+=s,this.map(s,l)}writeToStreamAndMap(s,l){this.output.write(s),this.map(s,l)}map(s,l){if(l!=null){let{type:b}=l;if(b[0]==="L"&&b[2]==="n"){this.column=0,this.line++;return}if(l.loc!=null){let{mapping:D}=this;D.original=l.loc.start,D.name=l.name,this.sourceMap.addMapping(D)}if(b[0]==="T"&&b[8]==="E"||b[0]==="L"&&b[1]==="i"&&typeof l.value=="string"){let{length:D}=s,{column:N,line:M}=this;for(let z=0;z<D;z++)s[z]===`
611
- `?(N=0,M++):N++;this.column=N,this.line=M;return}}let{length:_}=s,{lineEnd:h}=this;_>0&&(this.lineEndSize>0&&(h.length===1?s[_-1]===h:s.endsWith(h))?(this.line+=this.lineEndSize,this.column=0):this.column+=_)}toString(){return this.output}};function Bht(a,s){let l=new uFe(s);return l.generator[a.type](a,l),l.output}t(Bht,"generate");async function fFe({oasFiles:a,sourceDirectory:s,logger:l}){let _=await Lgr({oasFiles:a,sourceDirectory:s,logger:l});return Bht(_)}t(fFe,"generateRawRouteSource");async function Lgr({oasFiles:a,sourceDirectory:s,logger:l}){let _=new B3(s,l),h=[];for(let D of a){let N=Ogr.basename(D,".oas.json"),M=await _.resolve(D),z=[],ne=new Map,ie=await Fgr.readFile(D,"utf-8"),Q=JSON.parse(ie);for(let Me in Q.paths){let Ne=Q.paths[Me];for(let we in Ne){if(we.startsWith("x-"))continue;let Pt={...Ne[we],...Ne[we].description&&{description:Ne[we].description.length>350?Ne[we].description.substring(0,350).trim()+"...":Ne[we].description}},xt=vG(N,Me,we),Tr=Mfe(D,N,Pt,M,z,ne);h.unshift($ht(xt,Tr))}}h.unshift(...Rgr(N,M,z,ne).reverse())}return{type:"Program",body:h,sourceType:"module"}}t(Lgr,"generateAst");function Mfe(a,s,l,_,h,b){let D=[];for(let N in l){let M=l[N];if(N==="$ref")return tG(a,s,N3(a,M),_,h,b),{type:"Identifier",name:zht(s,b.get(N3(a,M)))};let z;switch(typeof M){case"string":case"number":case"boolean":z={type:"Literal",value:M};break;default:Array.isArray(M)?z=Uht(M,a,s,_,h,b):typeof M=="object"&&M!==null&&(z={type:"ObjectExpression",properties:Mfe(a,s,M,_,h,b).properties||[]});break}if(z){let ne=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(N),ie=ne?{type:"Identifier",name:N}:{type:"Literal",value:N};D.push({type:"Property",key:ie,value:z,kind:"init",method:!1,shorthand:!1,computed:!ne})}}return{type:"ObjectExpression",properties:D}}t(Mfe,"processNode");function Uht(a,s,l,_,h,b){return{type:"ArrayExpression",elements:a.map(D=>{if(Array.isArray(D))return Uht(D,s,l,_,h,b);if(typeof D=="object"&&D!==null){let N=Mfe(s,l,D,_,h,b);return N.type==="Identifier"?N:{type:"ObjectExpression",properties:N.properties||[]}}else return{type:"Literal",value:D}})}}t(Uht,"processArray");function $ht(a,s){return{type:"ExportNamedDeclaration",declaration:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:s}],kind:"var"},specifiers:[],source:null}}t($ht,"createExportedConstAssignment");function Rgr(a,s,l,_){let h=[];for(let b=0;b<l.length;b++){let D=zht(a,b),N=s.get(l[b]),M=Mfe(Ole(l[b]),a,N,s,l,_);h.push($ht(D,M))}return h}t(Rgr,"generateRefs");function zht(a,s){return`${EA(a)}__ref__${s}`}t(zht,"getRefIdentifierName");import Jht from"node:path";var qht=t(a=>{let s=null;if(a.value.type==="Object"&&a.value.members.length>0)for(let l of a.value.members){let _=qht(l);if(_!==null&&(s=_),l.name.value==="enum"&&l.value.type==="Array"&&l.value.elements.length===0){let h=l.value,b=h.loc.start.line,D=h.loc.start.column,N=h.loc.end.column;s={line:b,column:D,length:N-D,lineText:""}}}return s},"findEmptyEnums"),Mgr=t(a=>{if(a.startsWith("schema with key or id")&&a.endsWith("already exists"))return"Update your schema's '$id' to be unique across your project.";if(a.includes("All JSON schemas must use version 2020-12"))return"All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html";if(a==='"nullable" cannot be used without "type"')return'Property "nullable" can only be used when property "type" value is "object".';if(a==='NOT SUPPORTED: keyword "id", use "$id" for schema ID')return'Replace keyword "id" with "$id" when defining a schema Id.';if(a.startsWith("can't resolve reference http"))return"Cannot resolve remote references, try adding them directly to the schema file or as a schema file in the project.";if(a.startsWith("can't resolve reference"))return"Make sure all references are defined in the schema.";if(a.includes("oneOf must NOT have fewer than 1 items"))return'Property "oneOf" must have at least 1 item configured.';if(a.includes("enum must have non-empty array"))return'Property "enum" must be configured with at least one value.';if(a.includes("Unexpected")&&a.includes("in JSON at position"))return"Update your schema to only use valid properties."},"getSuggestions"),_Fe=t(async(a,s,l)=>{if(!a)return null;let _={file:Jht.join(x4e,a),suggestion:Mgr(l)},h=Jht.join(s,x4e),b=ou.safePath(s).resolve(h,a),D=await Ile(b);if(l.includes("enum must have non-empty array")){if(D){let N=await eG(D);if(N&&N.body.members!==null)for(let M of N.body.members){let z=qht(M);z&&z!==null&&(_=Object.assign(_??{},z))}if(_){let M=_.line?_.line:0;_.lineText=ZH(D,M)}}}else if(l.includes("Unexpected")&&l.includes("in JSON at position")&&D){let N=await eG(D);N&&"lineText"in N&&(_=Object.assign(_??{},N))}return _},"getLocation");import*as L1t from"esbuild";import M7e,{dirname as I1t}from"node:path";import{fileURLToPath as F1t}from"node:url";var jgr=!1;function Rj(a,s){return{open:`\x1B[${a.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Rj,"code");function Mj(a,s){return jgr?`${s.open}${a.replace(s.regexp,s.open)}${s.close}`:a}t(Mj,"run");function Bgr(a){return Mj(a,Rj([31],39))}t(Bgr,"red");function Ugr(a){return Mj(a,Rj([32],39))}t(Ugr,"green");function $gr(a){return Mj(a,Rj([33],39))}t($gr,"yellow");function zgr(a){return Mj(a,Rj([34],39))}t(zgr,"blue");function Jgr(a){return Mj(a,Rj([35],39))}t(Jgr,"magenta");function qgr(a){return Mj(a,Rj([36],39))}t(qgr,"cyan");var nRr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Vht=[Bgr,Ugr,$gr,zgr,Jgr,qgr];function Vgr(a){let s=0,l=a.length,_=0;if(l>0)for(;_<l;)s=(s<<5)-s+a.charCodeAt(_++)|0;return s}t(Vgr,"hashCode");function Wht(a){let s=Math.abs(Vgr(a));return Vht[s%Vht.length]}t(Wht,"generateColor");import{inspect as Wgr}from"node:util";function Hht(a,s,...l){let _=0,h=l.length,b=String(s).replace(/%[sdjoO%]/g,D=>{if(D==="%%")return"%";if(_>=h)return D;switch(D){case"%s":return String(l[_++]);case"%d":return Number(l[_++]).toString();case"%o":return a(l[_++]).split(`
611
+ `?(N=0,M++):N++;this.column=N,this.line=M;return}}let{length:_}=s,{lineEnd:h}=this;_>0&&(this.lineEndSize>0&&(h.length===1?s[_-1]===h:s.endsWith(h))?(this.line+=this.lineEndSize,this.column=0):this.column+=_)}toString(){return this.output}};function Bht(a,s){let l=new uFe(s);return l.generator[a.type](a,l),l.output}t(Bht,"generate");async function fFe({oasFiles:a,sourceDirectory:s,logger:l}){let _=await Lgr({oasFiles:a,sourceDirectory:s,logger:l});return Bht(_)}t(fFe,"generateRawRouteSource");async function Lgr({oasFiles:a,sourceDirectory:s,logger:l}){let _=new B3(s,l),h=[];for(let D of a){let N=Ogr.basename(D,".oas.json"),M=await _.resolve(D),z=[],ne=new Map,ie=await Fgr.readFile(D,"utf-8"),Q=JSON.parse(ie);for(let Me in Q.paths){let Ne=Q.paths[Me];for(let we in Ne){if(we.startsWith("x-"))continue;let Pt={...Ne[we],...Ne[we].description&&{description:Ne[we].description.length>350?Ne[we].description.substring(0,350).trim()+"...":Ne[we].description}},xt=vG(N,Me,we),Tr=Mfe(D,N,Pt,M,z,ne);h.unshift($ht(xt,Tr))}}h.unshift(...Rgr(N,M,z,ne).reverse())}return{type:"Program",body:h,sourceType:"module"}}t(Lgr,"generateAst");function Mfe(a,s,l,_,h,b){let D=[];for(let N in l){let M=l[N];if(N==="$ref")return tG(a,s,N3(a,M),_,h,b),{type:"Identifier",name:zht(s,b.get(N3(a,M)))};let z;switch(typeof M){case"string":case"number":case"boolean":z={type:"Literal",value:M};break;default:Array.isArray(M)?z=Uht(M,a,s,_,h,b):typeof M=="object"&&M!==null&&(z=Mfe(a,s,M,_,h,b));break}if(z){let ne=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(N),ie=ne?{type:"Identifier",name:N}:{type:"Literal",value:N};D.push({type:"Property",key:ie,value:z,kind:"init",method:!1,shorthand:!1,computed:!ne})}}return{type:"ObjectExpression",properties:D}}t(Mfe,"processNode");function Uht(a,s,l,_,h,b){return{type:"ArrayExpression",elements:a.map(D=>{if(Array.isArray(D))return Uht(D,s,l,_,h,b);if(typeof D=="object"&&D!==null){let N=Mfe(s,l,D,_,h,b);return N.type==="Identifier"?N:{type:"ObjectExpression",properties:N.properties||[]}}else return{type:"Literal",value:D}})}}t(Uht,"processArray");function $ht(a,s){return{type:"ExportNamedDeclaration",declaration:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:s}],kind:"var"},specifiers:[],source:null}}t($ht,"createExportedConstAssignment");function Rgr(a,s,l,_){let h=[];for(let b=0;b<l.length;b++){let D=zht(a,b),N=s.get(l[b]),M=Mfe(Ole(l[b]),a,N,s,l,_);h.push($ht(D,M))}return h}t(Rgr,"generateRefs");function zht(a,s){return`${EA(a)}__ref__${s}`}t(zht,"getRefIdentifierName");import Jht from"node:path";var qht=t(a=>{let s=null;if(a.value.type==="Object"&&a.value.members.length>0)for(let l of a.value.members){let _=qht(l);if(_!==null&&(s=_),l.name.value==="enum"&&l.value.type==="Array"&&l.value.elements.length===0){let h=l.value,b=h.loc.start.line,D=h.loc.start.column,N=h.loc.end.column;s={line:b,column:D,length:N-D,lineText:""}}}return s},"findEmptyEnums"),Mgr=t(a=>{if(a.startsWith("schema with key or id")&&a.endsWith("already exists"))return"Update your schema's '$id' to be unique across your project.";if(a.includes("All JSON schemas must use version 2020-12"))return"All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html";if(a==='"nullable" cannot be used without "type"')return'Property "nullable" can only be used when property "type" value is "object".';if(a==='NOT SUPPORTED: keyword "id", use "$id" for schema ID')return'Replace keyword "id" with "$id" when defining a schema Id.';if(a.startsWith("can't resolve reference http"))return"Cannot resolve remote references, try adding them directly to the schema file or as a schema file in the project.";if(a.startsWith("can't resolve reference"))return"Make sure all references are defined in the schema.";if(a.includes("oneOf must NOT have fewer than 1 items"))return'Property "oneOf" must have at least 1 item configured.';if(a.includes("enum must have non-empty array"))return'Property "enum" must be configured with at least one value.';if(a.includes("Unexpected")&&a.includes("in JSON at position"))return"Update your schema to only use valid properties."},"getSuggestions"),_Fe=t(async(a,s,l)=>{if(!a)return null;let _={file:Jht.join(x4e,a),suggestion:Mgr(l)},h=Jht.join(s,x4e),b=ou.safePath(s).resolve(h,a),D=await Ile(b);if(l.includes("enum must have non-empty array")){if(D){let N=await eG(D);if(N&&N.body.members!==null)for(let M of N.body.members){let z=qht(M);z&&z!==null&&(_=Object.assign(_??{},z))}if(_){let M=_.line?_.line:0;_.lineText=ZH(D,M)}}}else if(l.includes("Unexpected")&&l.includes("in JSON at position")&&D){let N=await eG(D);N&&"lineText"in N&&(_=Object.assign(_??{},N))}return _},"getLocation");import*as L1t from"esbuild";import M7e,{dirname as I1t}from"node:path";import{fileURLToPath as F1t}from"node:url";var jgr=!1;function Rj(a,s){return{open:`\x1B[${a.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Rj,"code");function Mj(a,s){return jgr?`${s.open}${a.replace(s.regexp,s.open)}${s.close}`:a}t(Mj,"run");function Bgr(a){return Mj(a,Rj([31],39))}t(Bgr,"red");function Ugr(a){return Mj(a,Rj([32],39))}t(Ugr,"green");function $gr(a){return Mj(a,Rj([33],39))}t($gr,"yellow");function zgr(a){return Mj(a,Rj([34],39))}t(zgr,"blue");function Jgr(a){return Mj(a,Rj([35],39))}t(Jgr,"magenta");function qgr(a){return Mj(a,Rj([36],39))}t(qgr,"cyan");var nRr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Vht=[Bgr,Ugr,$gr,zgr,Jgr,qgr];function Vgr(a){let s=0,l=a.length,_=0;if(l>0)for(;_<l;)s=(s<<5)-s+a.charCodeAt(_++)|0;return s}t(Vgr,"hashCode");function Wht(a){let s=Math.abs(Vgr(a));return Vht[s%Vht.length]}t(Wht,"generateColor");import{inspect as Wgr}from"node:util";function Hht(a,s,...l){let _=0,h=l.length,b=String(s).replace(/%[sdjoO%]/g,D=>{if(D==="%%")return"%";if(_>=h)return D;switch(D){case"%s":return String(l[_++]);case"%d":return Number(l[_++]).toString();case"%o":return a(l[_++]).split(`
612
612
  `).map(N=>N.trim()).join(" ");case"%O":return a(l[_++]);case"%j":try{return JSON.stringify(l[_++])}catch{return"[Circular]"}default:return D}});for(let D of l.splice(_))D===null||!(typeof D=="object"&&D!==null)?b+=" "+D:b+=" "+a(D);return b}t(Hht,"format");var Ght=t((a,...s)=>Hht(Wgr,a,s),"format");var pFe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,l){this.manager=s,this.ns=l,this.color=Wht(l),this.last=0,this.enabled=s.enabled.some(_=>_.test(l))}log(...s){if(!this.enabled)return;let l,_=s[0];typeof _=="function"?l=_():l=String(_);let h=Date.now()-(this.last||Date.now());l=Ght(l,...s);let b=`${this.color(this.ns)} ${l} ${this.color(`+${h}ms`)}`;console.log(b),this.last=Date.now()}},dFe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function Hgr(a){return!a||a.length===0?[]:(a=a.replace(/\s/g,"").replace(/\*/g,".+"),a.split(",").map(s=>new RegExp(`^${s}$`)))}t(Hgr,"extract");var jfe;function Kht(a){jfe||(jfe=new dFe(Hgr(process.env.DEBUG)));let s=new pFe(jfe,a);return jfe.debuggers.set(a,s),Object.assign(s.log.bind(s),{self:s})}t(Kht,"debug");var mFe=class{static{t(this,"Environment")}get DEV_SERVER_PORT(){return process.env.DEV_SERVER_PORT?parseInt(process.env.DEV_SERVER_PORT):3e3}get DEBUG_BUILD_MODE(){return!!process.env.DEBUG_BUILD_MODE}get USE_MONOREPO_PACKAGES(){return process.env.USE_MONOREPO_PACKAGES==="true"}get EXPERIMENTAL_CODEGEN(){return!!process.env.EXPERIMENTAL_CODEGEN}get NODE_ENV(){return process.env.NODE_ENV}isProduction(){return this.NODE_ENV==="production"}isLocalDevelopment(){return process.env.ZUPLO_IS_LOCAL_DEVELOPMENT==="true"}},Ggr=new mFe,ih=Ggr;var hFe="no-remote-module";function Yht({logger:a}){return{name:hFe,async setup(s){s.onResolve({filter:/^https?:\/\//},l=>(a.error(l,"User attempted to load a remote module"),{errors:[{text:`Remote modules are not supported. Attempted to load module ${l.path}`,detail:"InvalidRemoteModule",pluginName:hFe,location:{line:0,column:0,file:""}}],pluginName:hFe}))}}}t(Yht,"blockRemoteModulePlugin");import Zgr from"node:fs/promises";import Bfe from"node:path";import{performance as lE}from"node:perf_hooks";var SK=[];async function Kgr(a,s){let l=lE.now();try{return await s()}finally{let _=lE.now()-l;SK.push({name:a,duration:_})}}t(Kgr,"timeFn");var Ygr={mark:t(a=>{lE.mark(a)},"mark"),measure:t((a,s,l)=>{try{lE.measure(a,s,l)}finally{lE.clearMarks(s),lE.clearMarks(l),lE.clearMeasures(a)}},"measure"),timeFn:Kgr,report:t(()=>{if(SK.length>0){let a=SK.reduce((s,{name:l,duration:_})=>(s[l]=`${_.toFixed(0)}ms`,s),{});console.table(a),SK.length=0}},"report"),getDuration:t(a=>{let s=lE.getEntriesByName(a);if(s.length===0)return 0;let l=s[0].duration;return lE.clearMeasures(a),l},"getDuration"),clear:t(()=>{SK.length=0,lE.clearMarks(),lE.clearMeasures()},"clear")},Bu=Ygr;import{writeFile as Xgr}from"node:fs/promises";async function bk(a,s){await ou.mkdirForFilePathIfNotExits(a);let l=await import("prettier"),_=s;try{_=await l.format(s,{parser:"babel"})}catch{}await Xgr(a,_,"utf-8")}t(bk,"writeDebugSourceFile");import{readFile as Qgr}from"node:fs/promises";import TK from"node:path";async function Xht(a){let s=`${a}/config/dev-portal.json`,l=!0,_;if(await ou.fileExists(s)){try{let b=await Qgr(s,"utf-8"),D=JSON.parse(b);D.enabled===!1&&(l=!1),_=D.sitePathname}catch{}return{enabled:l,type:"dev-portal",basePath:_}}let h=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"];for(;h.length;){let b=h.pop();if(b){let D=TK.join(a,"docs",b);if(await ou.fileExists(D))return{enabled:!0,type:"zudoku"}}}return{enabled:!1,type:void 0}}t(Xht,"getDevPortalConfig");function jj(a,s){let l=TK.resolve(a,AM);return Object.keys(s?.outputs??{}).map(b=>{let D=TK.normalize(b);return`./${TK.relative(l,D).split(TK.sep).join("/")}`})}t(jj,"getBuildModules");var Qht="/docs",e0r="/__zuplo/dev-portal";function t0r(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(t0r,"normalizePathname");function r0r(a){let s={sitePathname:a?.sitePathname===e0r?Qht:a?.sitePathname?t0r(a.sitePathname):Qht,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
613
613
  export default devPortal;`}t(r0r,"generateSource");function Zht(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},l=>({namespace:"dev-portal-json",path:Bfe.isAbsolute(l.path)?l.path:Bfe.join(l.resolveDir,l.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async l=>Bu.timeFn("Generating dev-portal.json data",async()=>{let _,h,b=[],D=await Xht(a.sourceDirectory);if(D.type==="zudoku")_={version:"zudoku",enabled:!1,sitePathname:void 0};else if(D.type==="dev-portal"){h=await Zgr.readFile(l.path,"utf-8");try{_=JSON.parse(h)}catch(M){b.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:M.message,location:null}]})}}let N;try{if(N=r0r(_),ih.DEBUG_BUILD_MODE&&N){let M=Bfe.join(a.sourceDirectory,".zuplo","dev-portal.js");await bk(M,N)}}catch(M){b.push({id:"dev-portal-build-error",text:M.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:M.message,location:null}]})}return{contents:N,errors:b,pluginName:"dev-portal",loader:"js",resolveDir:Bfe.dirname(l.path),watchFiles:[l.path]}}))}}}t(Zht,"devPortalConfigPlugin");import egt from"node:path";var tgt="legacy-environment",rgt="legacy-environment",n0r=`import { environment } from "@zuplo/runtime";
614
- export default environment;`;function ngt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:rgt,pluginName:tgt,path:egt.join(a.sourceDirectory,k3,"environment.js")})),s.onLoad({filter:/.*/,namespace:rgt},async l=>({contents:n0r,loader:"ts",resolveDir:egt.dirname(l.path),pluginName:tgt}))}}}t(ngt,"environmentPlugin");import nTr from"node:fs/promises";import GT from"node:path";var d1t=ap(s7e(),1),m1t=ap(Ryt(),1),h1t=ap(A7e(),1),g1t=ap(N7e(),1);var kk="schemas",S_e="json-schema";function y1t(a){return{name:kk,async setup(s){let l=new h1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),_=GT.join(a.sourceDirectory,NH),h=[],b=[],D;await Bu.timeFn("Initializing schema validation",async()=>{if((0,m1t.default)(l,{mode:"fast"}),l.opts.code.formats=d1t._`require("ajv-formats/dist/formats").fastFormats`,await ou.dirExists(_)&&(l.addKeyword("faker"),D=(await ou.listFolderContents(_,NH)).sort(),await Promise.all(D.map(async N=>{try{let M=ou.safePath(a.sourceDirectory).resolve(_,N);if(!M.startsWith(_))throw new Error("All schemas must be in the schemas directory");let z=await nTr.readFile(M,"utf-8");if(z===""||z===void 0)throw new Error(`Schema 'schemas/${N}' is empty and will be ignored.`);let ne=JSON.parse(z);if(ne.$schema&&ne.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${N}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(l.addSchema(ne,N),l.errors?.length){let ie=l.errors[0];h.push({id:"json-schema-validation-error",pluginName:kk,text:`Error: ${ie.message}`,location:{file:GT.join(NH,N)},detail:{params:ie.params,propertyName:ie.propertyName,schemaPath:ie.schemaPath,data:ie.data}})}}catch(M){if(M.message.endsWith("is empty and will be ignored.")){b.push({id:"empty-json-schema-file",pluginName:kk,text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let z=await _Fe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-add-error",pluginName:kk,text:`Error: ${M.message}`,location:z,detail:"InvalidAddSchemaError",notes:[{text:M.message}]})}})),await Promise.all(D.map(async N=>{try{let M=l.getSchema(N);M&&l.compile(M.schema).errors?.forEach(ne=>{h.push({text:`Failed to compile ${N}: ${ne.message}`})})}catch(M){let z=await _Fe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-compile-error",pluginName:kk,text:`The schema file '${N}' is not valid. Error: ${M.message}`,location:z,detail:"InvalidSchemaError",notes:[{text:M.message}]})}})),ih.DEBUG_BUILD_MODE)){let N=GT.resolve(a.outputDirectory,NH);await ou.mkdirIfNotExists(N)}}),s.onStart(async()=>{if(D)return{errors:h,warnings:b}}),s.onResolve({filter:/schemas\/.*\.json$/},async N=>Bu.timeFn("Generating JSON schemas...",async()=>{let M=GT.isAbsolute(N.path)?N.path:GT.join(N.resolveDir,N.path);if(N.importer&&N.namespace!=="open-api-routes-json")return{path:M};if(!await ou.fileExists(M)){let z="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${N.path}' from ${z}`,location:{file:GT.join(N.resolveDir,z),namespace:S_e,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${z}`,suggestion:""},detail:"RouteReferenceError",pluginName:kk,notes:[{text:`Unable to resolve reference to '${N.path}' from ${z}`,location:null}]}],namespace:S_e,path:M,pluginName:kk}}return{path:M,namespace:S_e,pluginName:kk}})),s.onLoad({filter:/.*/,namespace:S_e},async N=>Bu.timeFn(`Generating json schema data: ${GT.basename(N.path)}`,async()=>{let M=[],z;try{let ne=GT.relative(_,N.path),ie=l.getSchema(ne);if(!ie)throw new Error(`Could not load schema at ${N.path}`);z=ie.source?.validateCode;let Q=l.compile(ie.schema);z=(0,g1t.default)(l,Q)}catch(ne){M.push({pluginName:kk,text:`Cannot parse project's schemas/${GT.basename(N.path)} file. Error: ${ne.message}`,location:null,notes:[{text:ne.message,location:null}],detail:ne})}if(ih.DEBUG_BUILD_MODE&&z){let ne=GT.relative(_,N.path),ie=GT.join(a.sourceDirectory,".zuplo",`${ne}.js`);await bk(ie,z)}return{contents:z,errors:M,pluginName:kk,resolveDir:GT.dirname(N.path),watchFiles:[N.path]}}))}}}t(y1t,"jsonSchemaPlugin");import{relative as iTr}from"node:path";var v1t=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],sTr="nodejs-compat-plugin";function b1t({sourceDirectory:a}){return{name:sTr,setup(s){let l=new Set;s.onStart(()=>{l.clear()}),s.onResolve({filter:/node:.*/},async({path:_,kind:h,resolveDir:b,...D})=>{let N=`${_}:${h}:${b}:${D.importer}`;if(l.has(N))return;l.add(N);let M=await s.resolve(_,{kind:h,resolveDir:b,importer:D.importer});return M.errors.length>0?v1t.includes(_)||_.includes("/")&&v1t.includes(_.split("/")[0])?{external:!0}:{external:!0,warnings:M.errors.map(ne=>({...ne,location:{file:iTr(a,D.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${_}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:M})}}}t(b1t,"nodejsCompatPlugin");import S1t from"node:fs/promises";import hE from"node:path";var uN="open-api-routes-plugin",tY="open-api-routes-json";function T1t(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/zuplo:routes$/},l=>({watchFiles:[...I7e(hE.join(a.sourceDirectory,J2),[".oas.json"],!0),hE.join(a.sourceDirectory,J2,ile)],namespace:tY,path:hE.isAbsolute(l.path)?l.path:hE.join(l.resolveDir,l.path),pluginName:uN})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:tY},async l=>Bu.timeFn("Generating route data...",async()=>{async function _(){let b=hE.resolve(a.sourceDirectory,"config"),D=await XF(b),N=`$import(.${l.path.replace(/^../,"")})`;return{location:await _ct(D,N,"Update your route configuration to use code from the 'modules' folder"),originalImportValue:N}}t(_,"getLocation");let h=hE.join(l.resolveDir,`${l.path}.ts`);if(l.path.endsWith(".ts")){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference '${D}' in ${b?.file??"OpenAPI file"}. Imports must NOT include the '.ts' file extension.`,location:b,detail:"RouteReferenceError",pluginName:uN}],namespace:tY,path:l.path,pluginName:uN}}else if(!await ou.fileExists(h)){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference in route. Unable to resolve reference to '${D}' in ${b?.file??"OpenAPI file"}`,location:b,detail:"RouteReferenceError",pluginName:uN}],namespace:tY,path:l.path,pluginName:uN}}})),s.onLoad({filter:/.*/,namespace:tY},async l=>Bu.timeFn("Generating route.json data",async()=>{let _=hE.resolve(a.sourceDirectory,"config"),h=await XF(_),b=await Promise.all(h.map(async z=>({content:await S1t.readFile(z,"utf-8"),fileName:z}))),D=hE.resolve(_,"policies.json");if(!await ou.fileExists(D))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:uN,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:uN};let N={content:await S1t.readFile(D,"utf-8"),fileName:D},M;try{M=await cFe({sourceDirectory:a.sourceDirectory,oasContent:b,policiesContent:N,compatibilityDate:a.compatibilityDate,checkForDuplicateRoutes:a.flags?.checkForDuplicateRoutes??!0})}catch(z){throw new Error("Error compiling routes: "+z.message)}if(ih.DEBUG_BUILD_MODE&&M.content){let z=hE.join(a.sourceDirectory,".zuplo"),ne=hE.resolve(z,"routes.js");await bk(ne,M.content)}return{contents:M.content,errors:M.errors,pluginName:uN,resolveDir:hE.dirname(l.path),watchFiles:[l.path]}}))}}}t(T1t,"openApiRoutesPlugin");import T_e from"node:path";var rY="raw-route-plugin",x1t="raw-route";function C1t(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/zuplo:raw-routes$/},l=>({namespace:x1t,path:l.path,pluginName:rY})),s.onLoad({filter:/.*/,namespace:x1t},async l=>Bu.timeFn("Building route data",async()=>{let _=T_e.resolve(a.sourceDirectory,J2);if(!await ou.dirExists(_))return{loader:"js",resolveDir:T_e.dirname(l.path),pluginName:rY};let h=await XF(_);try{let b=await fFe({oasFiles:h,sourceDirectory:a.sourceDirectory,logger:a.logger});if(ih.DEBUG_BUILD_MODE&&b){let D=T_e.join(a.sourceDirectory,".zuplo","raw-routes.js");await bk(D,b)}return{contents:b,loader:"js",resolveDir:T_e.dirname(l.path),pluginName:rY}}catch(b){if(b instanceof z1)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:b.issue.text,location:b.issue.location,detail:b.issue.detail,pluginName:rY}],pluginName:rY};throw b}}))}}}t(C1t,"rawRoutePlugin");import aTr from"node:fs/promises";import F7e from"node:path";var x_e="runtime-config",E1t="runtime-config-plugin";function D1t(){return{name:x_e,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:E1t,path:F7e.isAbsolute(s.path)?s.path:F7e.join(s.resolveDir,s.path),pluginName:x_e})),a.onLoad({filter:/.*/,namespace:E1t},async s=>Bu.timeFn("Generating zuplo.runtime.ts data",async()=>{let l="export const runtimeInit = undefined;",_=[];return await ou.fileExists(s.path)?(l=await aTr.readFile(s.path,"utf-8"),{contents:l,loader:"ts",resolveDir:F7e.dirname(s.path),errors:_,pluginName:x_e,watchFiles:[s.path]}):{contents:l,loader:"ts",errors:_,pluginName:x_e}}))}}}t(D1t,"runtimeConfigPlugin");import R7e from"node:fs/promises";import LO from"node:path";var w1t=ap(A7e(),1),P1t=ap(N7e(),1);var O7e="schema-validation-plugin",k1t="schema-validation",oTr="module.exports = {}";function A1t(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/zuplo:schema-validations$/},l=>({namespace:k1t,path:l.path,pluginName:O7e})),s.onLoad({filter:/.*/,namespace:k1t},async l=>Bu.timeFn("Validating schemas",async()=>{let _=LO.resolve(a.sourceDirectory,J2,"policies.json");if(!await ou.fileExists(_))return{contents:oTr,loader:"js",resolveDir:LO.dirname(l.path),pluginName:O7e};let h=await lTr(a.sourceDirectory),b=LO.resolve(a.sourceDirectory,J2),D=await XF(b),N=await pTr(D,h),M=await cTr({oasFiles:D,routesWithSchemaValidation:N,sourceDirectory:a.sourceDirectory,logger:a.logger});if(ih.DEBUG_BUILD_MODE&&M){let z=LO.join(a.sourceDirectory,".zuplo","schema-validation.js");await bk(z,M)}return{contents:M,loader:"js",resolveDir:LO.dirname(l.path),pluginName:O7e}}))}}}t(A1t,"schemaValidationPlugin");async function cTr({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:l,logger:_}){let h="",b=new B3(l,_);if(s.length===0)return h;let D=new w1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let N of a){let M=await R7e.readFile(N,"utf-8"),z=LO.basename(N,".oas.json"),ne=s.filter(we=>we.fileName===z),ie=await b.resolve(N),Q=JSON.parse(M),Me=[],Ne=new Map;ne.forEach(we=>{let Pt=Q.paths[we.path][we.method];if(Pt.requestBody){let xt;if(Pt.requestBody.$ref){let Tr=Pt.requestBody.$ref;xt=ie.get(Tr)?.content}else Pt.requestBody.content&&(xt=Pt.requestBody.content);if(xt)for(let Tr in xt){let fn=xt[Tr].schema,tn=V3e(we.path,we.method,Tr);fn.$id=tn,D.addSchema(fn),L7e(fn,N,z,D,ie,Me,Ne)}}if(Pt.parameters)for(let xt of Pt.parameters){let Tr=xt.$ref?ie.get(xt.$ref):xt,fn=Tr.schema.$ref?ie.get(Tr.schema.$ref):Tr.schema,tn=q3e(we.path,we.method,Tr.in,Tr.name);fn.$id=tn,D.addSchema(fn),L7e(Tr,N,z,D,ie,Me,Ne)}});for(let we of Me){let Pt=ie.get(we),xt=bG(z,we);D.addSchema(Pt,xt)}}return h=(0,P1t.default)(D),h}t(cTr,"schemaValidationSource");function L7e(a,s,l,_,h,b,D){for(let N in a){let M=a[N];if(N==="$ref"){let z=bG(l,N3(s,M));a[N]=z,tG(s,l,N3(s,M),h,b,D,(ne,ie)=>bG(ne,N3(s,ie)))}else typeof M=="object"&&L7e(M,s,l,_,h,b,D)}}t(L7e,"addRefsToSchema");async function lTr(a){let s=new Set(["RequestValidationInboundPolicy"]),l=await R7e.readFile(`${a}/config/policies.json`,"utf-8"),_=JSON.parse(l);return uTr(_,s)}t(lTr,"getPolicyNamesUsingSchemaValidationPolicies");function uTr(a,s){let l=new Set;a.policies?.forEach(h=>{h.handler?.export&&s.has(h.handler.export)&&h.handler.module==="$import(@zuplo/runtime)"&&l.add(h.name)});let _=fTr(a,l);return new Set([...l,..._])}t(uTr,"getPolicyNamesReferencingPolicyHandlers");function fTr(a,s){let l=new Set;return a.policies?.forEach(_=>{_.handler?.export==="CompositeInboundPolicy"&&_.handler?.options?.policies?.forEach(h=>{s.has(h)&&l.add(_.name)})}),l}t(fTr,"getCompositePoliciesContainingPolicy");function _Tr(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let l=a["x-zuplo-route"].policies.inbound;if(l){for(let h of l)if(s.has(h))return!0}let _=a["x-zuplo-route"].policies.outbound;if(_){for(let h of _)if(s.has(h))return!0}return!1}t(_Tr,"isPolicyPresentInOperation");async function pTr(a,s){let l=[];for(let _ of a){let h=await R7e.readFile(_,"utf-8"),D=JSON.parse(h).paths;for(let N in D){let M=D[N];for(let z in M){let ne=M[z];_Tr(ne,s)&&l.push({fileName:LO.basename(_,".oas.json"),path:N,method:z})}}}return l}t(pTr,"getRoutesContainingPolicies");import{mkdirSync as dTr,writeFileSync as mTr}from"node:fs";import hTr from"node:path";function N1t(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async l=>{if(l){let _=jj(a.sourceDirectory,l.metafile);dTr(a.outputDirectory,{recursive:!0}),mTr(hTr.join(a.outputDirectory,"modules.json"),JSON.stringify(_,null,2))}})}}}t(N1t,"writeModulesPlugin");var gTr=Kht("zuplo:core:build"),yTr=["workerd","worker","browser"],O1t=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],M7e.resolve(I1t(F1t(import.meta.url)),"..","..","..","node_modules"),M7e.resolve(I1t(F1t(import.meta.url)),"..","..","..","..","..","node_modules")];async function nY({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,compatibilityDate:h,logger:b,minify:D=!0,command:N,flags:M}){let z=M7e.join(a,ale);gTr(`Building with node paths: ${O1t.join(", ")}`);let ne=D&&N!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},ie=Object.freeze({sourceDirectory:l,outputDirectory:s,cacheDirectory:_,logger:b,debugMode:ih.DEBUG_BUILD_MODE,flags:M,compatibilityDate:h});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:O1t,entryPoints:[z],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...ne,external:[],logLevel:"silent",conditions:yTr,plugins:[ngt(ie),Yht(ie),T1t(ie),C1t(ie),A1t(ie),D1t(),Zht(ie),y1t(ie),b1t(ie),N1t(ie)]}}t(nY,"getBaseESBuildConfig");var RO="run-esbuild",R1t=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,buildId:h,logger:b,config:D,command:N,minify:M},{data:z}){b.debug("Running esbuild");let ne=await nY({command:N,minify:M,systemDirectory:a,outputDirectory:s,cacheDirectory:_,sourceDirectory:l,logger:b,flags:D.flags,compatibilityDate:D.compatibilityDate}),ie;try{if(!await $M(l))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");ie=await L1t.build(ne),z.set("metafile",ie.metafile)}catch(Ne){if(b.error(Ne),Ne.errors||Ne.warnings)ie=Ne;else if(Ne.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))ie={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:RO,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw Ne}ie.errors.length>0&&ie.errors.length>1&&(ie.errors.length=1);let{errors:Q,warnings:Me}=j7e({buildId:h,result:ie});return{errors:Q,warnings:Me}},"runEsbuild");function j7e({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(_=>_.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Zce,pluginName:_.pluginName||RO}:{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:Zce,pluginName:_.pluginName||RO}),errors:s.errors.map(_=>({location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:M6e,pluginName:_.pluginName||RO})),metafile:s.metafile}}t(j7e,"esbuildResultToBuildResult");var vTr=t((a,s)=>{let l=s;if(s.includes(a)){let _=new RegExp(`.*(${a})`,"g");l=s.replace(_,"")}return l.match(/^(\/)?(\.\.(\/)?)+/)&&(l=l.replace(/^(\/)?(\.\.(\/)?)+/,"/")),l},"removePrefixFromString"),bTr=t((a,s)=>{let l=s;if(l.includes(a)){let _=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");l=l.replace(_,"")}return l},"cleanFilePathsInMessage"),M1t=t((a,s,l)=>{if(!a||a.length<=0)return a;let _=a.filter(h=>h.message!=='Could not resolve "@zuplo/runtime"');return _&&_.length>0&&_.forEach(h=>{try{h.location&&h.location.file&&(h.location.file=vTr(s,h.location.file)),h.location&&h.location.lineText&&h.location.lineText.includes("@zuplo/core/index.minified.js")&&(h.location.lineText=h.location.lineText.substring(0,200)+"...<Truncated>"),h.message=bTr(s,h.message),h.notes&&h.notes.length>0&&delete h.notes,h.text&&delete h.text,h.pluginName===""&&(h.pluginName=l)}catch{}}),_},"cleanDataOnBuildIssue");function j1t(a,s){let l=B7e.basename(s);a.errors&&(a.errors=M1t(a.errors,l,RO)),a.warnings&&(a.warnings=M1t(a.warnings,l,RO))}t(j1t,"formatBuildResult");var STr=t(a=>B7e.basename(a).startsWith("."),"isHiddenOnUnix"),TTr=t((a,s=[])=>s.map(l=>l.startsWith(".")?l:`.${l}`).some(l=>a.endsWith(l)),"hasMatchingExtname");function I7e(a,s=[],l=!1){let _=[],h;if(!C_e.existsSync(a)){let b;if(XH.hasMagic(a))b=a;else{let D=s.map(N=>N.startsWith(".")?N:`.${N}`).join("|");b=`${a}+(${D})`}if(_.push(...XH.sync(b,{nodir:!0})),!_.length)throw Error(`Cannot find any files matching pattern "${a}"`);return _}try{if(h=C_e.statSync(a),h.isFile())return[a]}catch{return[]}return C_e.readdirSync(a).forEach(b=>{let D=B7e.join(a,b),N;try{if(N=C_e.statSync(D),N.isDirectory()){l&&_.push(...I7e(D,s,l));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!N.isFile()||!TTr(D,s)||STr(D)||_.push(D)}),_}t(I7e,"lookupFiles");var MO=new rle,fN=` ${MO.gray("|")} `;function U7e({output:a,buildId:s,runtimeVersion:l,compatibilityDate:_}){let h=["Building Zuplo API...",`${fN}Build ID: ${s}`,`${fN}Runtime Version: ${l}`];_&&h.push(`${fN}Compatibility Date: ${_}`),a.info(h.join(`
614
+ export default environment;`;function ngt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:rgt,pluginName:tgt,path:egt.join(a.sourceDirectory,k3,"environment.js")})),s.onLoad({filter:/.*/,namespace:rgt},async l=>({contents:n0r,loader:"ts",resolveDir:egt.dirname(l.path),pluginName:tgt}))}}}t(ngt,"environmentPlugin");import nTr from"node:fs/promises";import GT from"node:path";var d1t=ap(s7e(),1),m1t=ap(Ryt(),1),h1t=ap(A7e(),1),g1t=ap(N7e(),1);var kk="schemas",S_e="json-schema";function y1t(a){return{name:kk,async setup(s){let l=new h1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),_=GT.join(a.sourceDirectory,NH),h=[],b=[],D;await Bu.timeFn("Initializing schema validation",async()=>{if((0,m1t.default)(l,{mode:"fast"}),l.opts.code.formats=d1t._`require("ajv-formats/dist/formats").fastFormats`,await ou.dirExists(_)&&(l.addKeyword("faker"),D=(await ou.listFolderContents(_,NH)).sort(),await Promise.all(D.map(async N=>{try{let M=ou.safePath(a.sourceDirectory).resolve(_,N);if(!M.startsWith(_))throw new Error("All schemas must be in the schemas directory");let z=await nTr.readFile(M,"utf-8");if(z===""||z===void 0)throw new Error(`Schema 'schemas/${N}' is empty and will be ignored.`);let ne=JSON.parse(z);if(ne.$schema&&ne.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${N}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(l.addSchema(ne,N),l.errors?.length){let ie=l.errors[0];h.push({id:"json-schema-validation-error",pluginName:kk,text:`Error: ${ie.message}`,location:{file:GT.join(NH,N)},detail:{params:ie.params,propertyName:ie.propertyName,schemaPath:ie.schemaPath,data:ie.data}})}}catch(M){if(M.message.endsWith("is empty and will be ignored.")){b.push({id:"empty-json-schema-file",pluginName:kk,text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let z=await _Fe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-add-error",pluginName:kk,text:`Error: ${M.message}`,location:z,detail:"InvalidAddSchemaError",notes:[{text:M.message}]})}})),await Promise.all(D.map(async N=>{try{let M=l.getSchema(N);M&&l.compile(M.schema).errors?.forEach(ne=>{h.push({text:`Failed to compile ${N}: ${ne.message}`})})}catch(M){let z=await _Fe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-compile-error",pluginName:kk,text:`The schema file '${N}' is not valid. Error: ${M.message}`,location:z,detail:"InvalidSchemaError",notes:[{text:M.message}]})}})),ih.DEBUG_BUILD_MODE)){let N=GT.resolve(a.outputDirectory,NH);await ou.mkdirIfNotExists(N)}}),s.onStart(async()=>{if(D)return{errors:h,warnings:b}}),s.onResolve({filter:/schemas\/.*\.json$/},async N=>Bu.timeFn("Generating JSON schemas...",async()=>{let M=GT.isAbsolute(N.path)?N.path:GT.join(N.resolveDir,N.path);if(N.importer&&N.namespace!=="open-api-routes-json")return{path:M};if(!await ou.fileExists(M)){let z="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${N.path}' from ${z}`,location:{file:GT.join(N.resolveDir,z),namespace:S_e,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${z}`,suggestion:""},detail:"RouteReferenceError",pluginName:kk,notes:[{text:`Unable to resolve reference to '${N.path}' from ${z}`,location:null}]}],namespace:S_e,path:M,pluginName:kk}}return{path:M,namespace:S_e,pluginName:kk}})),s.onLoad({filter:/.*/,namespace:S_e},async N=>Bu.timeFn(`Generating json schema data: ${GT.basename(N.path)}`,async()=>{let M=[],z;try{let ne=GT.relative(_,N.path),ie=l.getSchema(ne);if(!ie)throw new Error(`Could not load schema at ${N.path}`);z=ie.source?.validateCode;let Q=l.compile(ie.schema);z=(0,g1t.default)(l,Q)}catch(ne){M.push({pluginName:kk,text:`Cannot parse project's schemas/${GT.basename(N.path)} file. Error: ${ne.message}`,location:null,notes:[{text:ne.message,location:null}],detail:ne})}if(ih.DEBUG_BUILD_MODE&&z){let ne=GT.relative(_,N.path),ie=GT.join(a.sourceDirectory,".zuplo",`${ne}.js`);await bk(ie,z)}return{contents:z,errors:M,pluginName:kk,resolveDir:GT.dirname(N.path),watchFiles:[N.path]}}))}}}t(y1t,"jsonSchemaPlugin");import{relative as iTr}from"node:path";var v1t=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],sTr="nodejs-compat-plugin";function b1t({sourceDirectory:a}){return{name:sTr,setup(s){let l=new Set;s.onStart(()=>{l.clear()}),s.onResolve({filter:/node:.*/},async({path:_,kind:h,resolveDir:b,...D})=>{let N=`${_}:${h}:${b}:${D.importer}`;if(l.has(N))return;l.add(N);let M=await s.resolve(_,{kind:h,resolveDir:b,importer:D.importer});return M.errors.length>0?v1t.includes(_)||_.includes("/")&&v1t.includes(_.split("/")[0])?{external:!0}:{external:!0,warnings:M.errors.map(ne=>({...ne,location:{file:iTr(a,D.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${_}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:M})}}}t(b1t,"nodejsCompatPlugin");import S1t from"node:fs/promises";import hE from"node:path";var uN="open-api-routes-plugin",tY="open-api-routes-json";function T1t(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/zuplo:routes$/},l=>({watchFiles:[...I7e(hE.join(a.sourceDirectory,J2),[".oas.json"],!0),hE.join(a.sourceDirectory,J2,ile)],namespace:tY,path:hE.isAbsolute(l.path)?l.path:hE.join(l.resolveDir,l.path),pluginName:uN})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:tY},async l=>Bu.timeFn("Generating route data...",async()=>{async function _(){let b=hE.resolve(a.sourceDirectory,"config"),D=await XF(b),N=`$import(.${l.path.replace(/^../,"")})`;return{location:await _ct(D,N,"Update your route configuration to use code from the 'modules' folder"),originalImportValue:N}}t(_,"getLocation");let h=hE.join(l.resolveDir,`${l.path}.ts`);if(l.path.endsWith(".ts")){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference '${D}' in ${b?.file??"OpenAPI file"}. Imports must NOT include the '.ts' file extension.`,location:b,detail:"RouteReferenceError",pluginName:uN}],namespace:tY,path:l.path,pluginName:uN}}else if(!await ou.fileExists(h)){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference in route. Unable to resolve reference to '${D}' in ${b?.file??"OpenAPI file"}`,location:b,detail:"RouteReferenceError",pluginName:uN}],namespace:tY,path:l.path,pluginName:uN}}})),s.onLoad({filter:/.*/,namespace:tY},async l=>Bu.timeFn("Generating route.json data",async()=>{let _=hE.resolve(a.sourceDirectory,"config"),h=await XF(_),b=await Promise.all(h.map(async z=>({content:await S1t.readFile(z,"utf-8"),fileName:z}))),D=hE.resolve(_,"policies.json");if(!await ou.fileExists(D))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:uN,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:uN};let N={content:await S1t.readFile(D,"utf-8"),fileName:D},M;try{M=await cFe({sourceDirectory:a.sourceDirectory,oasContent:b,policiesContent:N,compatibilityDate:a.compatibilityDate,checkForDuplicateRoutes:a.flags?.checkForDuplicateRoutes??!0})}catch(z){throw new Error("Error compiling routes: "+z.message)}if(ih.DEBUG_BUILD_MODE&&M.content){let z=hE.join(a.sourceDirectory,".zuplo"),ne=hE.resolve(z,"routes.js");await bk(ne,M.content)}return{contents:M.content,errors:M.errors,pluginName:uN,resolveDir:hE.dirname(l.path),watchFiles:[l.path]}}))}}}t(T1t,"openApiRoutesPlugin");import T_e from"node:path";var rY="raw-route-plugin",x1t="raw-route";function C1t(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/zuplo:raw-routes$/},l=>({namespace:x1t,path:l.path,pluginName:rY})),s.onLoad({filter:/.*/,namespace:x1t},async l=>Bu.timeFn("Building route data",async()=>{let _=T_e.resolve(a.sourceDirectory,J2);if(!await ou.dirExists(_))return{loader:"js",resolveDir:T_e.dirname(l.path),pluginName:rY};let h=await XF(_);try{let b=await fFe({oasFiles:h,sourceDirectory:a.sourceDirectory,logger:a.logger});if(ih.DEBUG_BUILD_MODE&&b){let D=T_e.join(a.sourceDirectory,".zuplo","raw-routes.js");await bk(D,b)}return{contents:b,loader:"js",resolveDir:T_e.dirname(l.path),pluginName:rY}}catch(b){if(b instanceof z1)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:b.issue.text,location:b.issue.location,detail:b.issue.detail,pluginName:rY}],pluginName:rY};throw b}}))}}}t(C1t,"rawRoutePlugin");import aTr from"node:fs/promises";import F7e from"node:path";var x_e="runtime-config",E1t="runtime-config-plugin";function D1t(){return{name:x_e,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:E1t,path:F7e.isAbsolute(s.path)?s.path:F7e.join(s.resolveDir,s.path),pluginName:x_e})),a.onLoad({filter:/.*/,namespace:E1t},async s=>Bu.timeFn("Generating zuplo.runtime.ts data",async()=>{let l="export const runtimeInit = undefined;",_=[];return await ou.fileExists(s.path)?(l=await aTr.readFile(s.path,"utf-8"),{contents:l,loader:"ts",resolveDir:F7e.dirname(s.path),errors:_,pluginName:x_e,watchFiles:[s.path]}):{contents:l,loader:"ts",errors:_,pluginName:x_e}}))}}}t(D1t,"runtimeConfigPlugin");import R7e from"node:fs/promises";import LO from"node:path";var w1t=ap(A7e(),1),P1t=ap(N7e(),1);var O7e="schema-validation-plugin",k1t="schema-validation",oTr="module.exports = {}";function A1t(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/zuplo:schema-validations$/},l=>({namespace:k1t,path:l.path,pluginName:O7e})),s.onLoad({filter:/.*/,namespace:k1t},async l=>Bu.timeFn("Validating schemas",async()=>{let _=LO.resolve(a.sourceDirectory,J2,"policies.json");if(!await ou.fileExists(_))return{contents:oTr,loader:"js",resolveDir:LO.dirname(l.path),pluginName:O7e};let h=await lTr(a.sourceDirectory),b=LO.resolve(a.sourceDirectory,J2),D=await XF(b),N=await pTr(D,h),M=await cTr({oasFiles:D,routesWithSchemaValidation:N,sourceDirectory:a.sourceDirectory,logger:a.logger});if(ih.DEBUG_BUILD_MODE&&M){let z=LO.join(a.sourceDirectory,".zuplo","schema-validation.js");await bk(z,M)}return{contents:M,loader:"js",resolveDir:LO.dirname(l.path),pluginName:O7e}}))}}}t(A1t,"schemaValidationPlugin");async function cTr({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:l,logger:_}){let h="",b=new B3(l,_);if(s.length===0)return h;let D=new w1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let N of a){let M=await R7e.readFile(N,"utf-8"),z=LO.basename(N,".oas.json"),ne=s.filter(we=>we.fileName===z),ie=await b.resolve(N),Q=JSON.parse(M),Me=[],Ne=new Map;ne.forEach(we=>{let Pt=Q.paths[we.path][we.method];if(Pt.requestBody){let xt;if(Pt.requestBody.$ref){let Tr=Pt.requestBody.$ref;xt=ie.get(Tr)?.content}else Pt.requestBody.content&&(xt=Pt.requestBody.content);if(xt)for(let Tr in xt){let fn=xt[Tr].schema,tn=V3e(we.path,we.method,Tr);fn.$id=tn,D.addSchema(fn),L7e(fn,N,z,D,ie,Me,Ne)}}if(Pt.parameters)for(let xt of Pt.parameters){let Tr=xt.$ref?ie.get(xt.$ref):xt,fn=Tr.schema.$ref?ie.get(Tr.schema.$ref):Tr.schema,tn=q3e(we.path,we.method,Tr.in,Tr.name);fn.$id=tn,D.addSchema(fn),L7e(Tr,N,z,D,ie,Me,Ne)}});for(let we of Me){let Pt=ie.get(we),xt=bG(z,we);D.addSchema(Pt,xt)}}return h=(0,P1t.default)(D),h}t(cTr,"schemaValidationSource");function L7e(a,s,l,_,h,b,D){for(let N in a){let M=a[N];if(N==="$ref"){let z=bG(l,N3(s,M));a[N]=z,tG(s,l,N3(s,M),h,b,D,(ne,ie,Q)=>bG(ne,N3(Q,ie)))}else typeof M=="object"&&L7e(M,s,l,_,h,b,D)}}t(L7e,"addRefsToSchema");async function lTr(a){let s=new Set(["RequestValidationInboundPolicy"]),l=await R7e.readFile(`${a}/config/policies.json`,"utf-8"),_=JSON.parse(l);return uTr(_,s)}t(lTr,"getPolicyNamesUsingSchemaValidationPolicies");function uTr(a,s){let l=new Set;a.policies?.forEach(h=>{h.handler?.export&&s.has(h.handler.export)&&h.handler.module==="$import(@zuplo/runtime)"&&l.add(h.name)});let _=fTr(a,l);return new Set([...l,..._])}t(uTr,"getPolicyNamesReferencingPolicyHandlers");function fTr(a,s){let l=new Set;return a.policies?.forEach(_=>{_.handler?.export==="CompositeInboundPolicy"&&_.handler?.options?.policies?.forEach(h=>{s.has(h)&&l.add(_.name)})}),l}t(fTr,"getCompositePoliciesContainingPolicy");function _Tr(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let l=a["x-zuplo-route"].policies.inbound;if(l){for(let h of l)if(s.has(h))return!0}let _=a["x-zuplo-route"].policies.outbound;if(_){for(let h of _)if(s.has(h))return!0}return!1}t(_Tr,"isPolicyPresentInOperation");async function pTr(a,s){let l=[];for(let _ of a){let h=await R7e.readFile(_,"utf-8"),D=JSON.parse(h).paths;for(let N in D){let M=D[N];for(let z in M){let ne=M[z];_Tr(ne,s)&&l.push({fileName:LO.basename(_,".oas.json"),path:N,method:z})}}}return l}t(pTr,"getRoutesContainingPolicies");import{mkdirSync as dTr,writeFileSync as mTr}from"node:fs";import hTr from"node:path";function N1t(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async l=>{if(l){let _=jj(a.sourceDirectory,l.metafile);dTr(a.outputDirectory,{recursive:!0}),mTr(hTr.join(a.outputDirectory,"modules.json"),JSON.stringify(_,null,2))}})}}}t(N1t,"writeModulesPlugin");var gTr=Kht("zuplo:core:build"),yTr=["workerd","worker","browser"],O1t=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],M7e.resolve(I1t(F1t(import.meta.url)),"..","..","..","node_modules"),M7e.resolve(I1t(F1t(import.meta.url)),"..","..","..","..","..","node_modules")];async function nY({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,compatibilityDate:h,logger:b,minify:D=!0,command:N,flags:M}){let z=M7e.join(a,ale);gTr(`Building with node paths: ${O1t.join(", ")}`);let ne=D&&N!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},ie=Object.freeze({sourceDirectory:l,outputDirectory:s,cacheDirectory:_,logger:b,debugMode:ih.DEBUG_BUILD_MODE,flags:M,compatibilityDate:h});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:O1t,entryPoints:[z],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...ne,external:[],logLevel:"silent",conditions:yTr,plugins:[ngt(ie),Yht(ie),T1t(ie),C1t(ie),A1t(ie),D1t(),Zht(ie),y1t(ie),b1t(ie),N1t(ie)]}}t(nY,"getBaseESBuildConfig");var RO="run-esbuild",R1t=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,buildId:h,logger:b,config:D,command:N,minify:M},{data:z}){b.debug("Running esbuild");let ne=await nY({command:N,minify:M,systemDirectory:a,outputDirectory:s,cacheDirectory:_,sourceDirectory:l,logger:b,flags:D.flags,compatibilityDate:D.compatibilityDate}),ie;try{if(!await $M(l))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");ie=await L1t.build(ne),z.set("metafile",ie.metafile)}catch(Ne){if(b.error(Ne),Ne.errors||Ne.warnings)ie=Ne;else if(Ne.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))ie={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:RO,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw Ne}ie.errors.length>0&&ie.errors.length>1&&(ie.errors.length=1);let{errors:Q,warnings:Me}=j7e({buildId:h,result:ie});return{errors:Q,warnings:Me}},"runEsbuild");function j7e({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(_=>_.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Zce,pluginName:_.pluginName||RO}:{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:Zce,pluginName:_.pluginName||RO}),errors:s.errors.map(_=>({location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:M6e,pluginName:_.pluginName||RO})),metafile:s.metafile}}t(j7e,"esbuildResultToBuildResult");var vTr=t((a,s)=>{let l=s;if(s.includes(a)){let _=new RegExp(`.*(${a})`,"g");l=s.replace(_,"")}return l.match(/^(\/)?(\.\.(\/)?)+/)&&(l=l.replace(/^(\/)?(\.\.(\/)?)+/,"/")),l},"removePrefixFromString"),bTr=t((a,s)=>{let l=s;if(l.includes(a)){let _=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");l=l.replace(_,"")}return l},"cleanFilePathsInMessage"),M1t=t((a,s,l)=>{if(!a||a.length<=0)return a;let _=a.filter(h=>h.message!=='Could not resolve "@zuplo/runtime"');return _&&_.length>0&&_.forEach(h=>{try{h.location&&h.location.file&&(h.location.file=vTr(s,h.location.file)),h.location&&h.location.lineText&&h.location.lineText.includes("@zuplo/core/index.minified.js")&&(h.location.lineText=h.location.lineText.substring(0,200)+"...<Truncated>"),h.message=bTr(s,h.message),h.notes&&h.notes.length>0&&delete h.notes,h.text&&delete h.text,h.pluginName===""&&(h.pluginName=l)}catch{}}),_},"cleanDataOnBuildIssue");function j1t(a,s){let l=B7e.basename(s);a.errors&&(a.errors=M1t(a.errors,l,RO)),a.warnings&&(a.warnings=M1t(a.warnings,l,RO))}t(j1t,"formatBuildResult");var STr=t(a=>B7e.basename(a).startsWith("."),"isHiddenOnUnix"),TTr=t((a,s=[])=>s.map(l=>l.startsWith(".")?l:`.${l}`).some(l=>a.endsWith(l)),"hasMatchingExtname");function I7e(a,s=[],l=!1){let _=[],h;if(!C_e.existsSync(a)){let b;if(XH.hasMagic(a))b=a;else{let D=s.map(N=>N.startsWith(".")?N:`.${N}`).join("|");b=`${a}+(${D})`}if(_.push(...XH.sync(b,{nodir:!0})),!_.length)throw Error(`Cannot find any files matching pattern "${a}"`);return _}try{if(h=C_e.statSync(a),h.isFile())return[a]}catch{return[]}return C_e.readdirSync(a).forEach(b=>{let D=B7e.join(a,b),N;try{if(N=C_e.statSync(D),N.isDirectory()){l&&_.push(...I7e(D,s,l));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!N.isFile()||!TTr(D,s)||STr(D)||_.push(D)}),_}t(I7e,"lookupFiles");var MO=new rle,fN=` ${MO.gray("|")} `;function U7e({output:a,buildId:s,runtimeVersion:l,compatibilityDate:_}){let h=["Building Zuplo API...",`${fN}Build ID: ${s}`,`${fN}Runtime Version: ${l}`];_&&h.push(`${fN}Compatibility Date: ${_}`),a.info(h.join(`
615
615
  `))}t(U7e,"outputApiBuildStart");async function E_e(a,s,l){j1t(l,a),await Promise.all(l.warnings.map(async h=>B1t(a,s,h))),await Promise.all(l.errors.map(async h=>B1t(a,s,h)));let _=process.env.CODEBUILD_BUILD_ID?new Date(new Date().getTime()+1):new Date;l.status==="Good"?s.info(MO.green("Build succeeded"),{timestamp:_}):l.status==="Warnings"?s.warn(MO.yellow("Build succeeded with warnings"),{timestamp:_}):l.status==="Failed"&&s.error(MO.red("Build failed."),{timestamp:_})}t(E_e,"outputBuildResult");async function B1t(a,s,l){let _=[],h=l.severity??"error",b=h==="error"?MO.red:MO.yellow,D=b(`${h.toUpperCase()}: ${l.message}${l.detail?`
616
616
  ${fN}${l.detail.toString().split(`
617
617
  `).join(`
package/index.minified.js CHANGED
@@ -575,7 +575,7 @@ globstar while`,s,Q,l,Me,Ne),this.matchOne(s.slice(Q),l.slice(Me),_))return this
575
575
  >>> no match, partial?`,s,Q,l,Me),Q===M))}let we;if(typeof ne=="string"?(we=ie===ne,this.debug("string match",ne,ie,we)):(we=ne.test(ie),this.debug("pattern match",ne,ie,we)),!we)return!1}if(D===M&&N===z)return!0;if(D===M)return _;if(N===z)return D===M-1&&s[D]==="";throw new Error("wtf?")}braceExpand(){return jot(this.pattern,this.options)}parse(s){MH(s);let l=this.options;if(s==="**")return I0;if(s==="")return"";let _,h=null;(_=s.match(ier))?h=l.dot?aer:ser:(_=s.match(GZt))?h=(l.nocase?l.dot?QZt:XZt:l.dot?YZt:KZt)(_[1]):(_=s.match(oer))?h=(l.nocase?l.dot?ler:cer:l.dot?uer:fer)(_):(_=s.match(ZZt))?h=l.dot?ter:eer:(_=s.match(rer))&&(h=ner);let b=NM.fromGlob(s,this.options).toMMPattern();return h&&typeof b=="object"&&Reflect.defineProperty(b,"test",{value:h}),b}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let l=this.options,_=l.noglobstar?der:l.dot?mer:her,h=new Set(l.nocase?["i"]:[]),b=s.map(M=>{let z=M.map(ne=>{if(ne instanceof RegExp)for(let ie of ne.flags.split(""))h.add(ie);return typeof ne=="string"?Ser(ne):ne===I0?I0:ne._src});return z.forEach((ne,ie)=>{let Q=z[ie+1],Me=z[ie-1];ne!==I0||Me===I0||(Me===void 0?Q!==void 0&&Q!==I0?z[ie+1]="(?:\\/|"+_+"\\/)?"+Q:z[ie]=_:Q===void 0?z[ie-1]=Me+"(?:\\/|"+_+")?":Q!==I0&&(z[ie-1]=Me+"(?:\\/|\\/"+_+"\\/)"+Q,z[ie+1]=I0))}),z.filter(ne=>ne!==I0).join("/")}).join("|"),[D,N]=s.length>1?["(?:",")"]:["",""];b="^"+D+b+N+"$",this.negate&&(b="^(?!"+b+").+$");try{this.regexp=new RegExp(b,[...h].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(s){return this.preserveMultipleSlashes?s.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(s)?["",...s.split(/\/+/)]:s.split(/\/+/)}match(s,l=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&l)return!0;let _=this.options;this.isWindows&&(s=s.split("\\").join("/"));let h=this.slashSplit(s);this.debug(this.pattern,"split",h);let b=this.set;this.debug(this.pattern,"set",b);let D=h[h.length-1];if(!D)for(let N=h.length-2;!D&&N>=0;N--)D=h[N];for(let N=0;N<b.length;N++){let M=b[N],z=h;if(_.matchBase&&M.length===1&&(z=[D]),this.matchOne(z,M,l))return _.flipNegate?!0:!this.negate}return _.flipNegate?!1:this.negate}static defaults(s){return J1.defaults(s).Minimatch}};J1.AST=NM;J1.Minimatch=q2;J1.escape=IM;J1.unescape=JC;import{fileURLToPath as Zer}from"node:url";var FM=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Uot=new Set,n4e=typeof process=="object"&&process?process:{},$ot=t((a,s,l,_)=>{typeof n4e.emitWarning=="function"?n4e.emitWarning(a,s,l,_):console.error(`[${l}] ${s}: ${a}`)},"emitWarning"),fle=globalThis.AbortController,Bot=globalThis.AbortSignal;if(typeof fle>"u"){Bot=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(_,h){this._onabort.push(h)}},fle=class{static{t(this,"AbortController")}constructor(){s()}signal=new Bot;abort(_){if(!this.signal.aborted){this.signal.reason=_,this.signal.aborted=!0;for(let h of this.signal._onabort)h(_);this.signal.onabort?.(_)}}};let a=n4e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,$ot("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",s))},"warnACPolyfill")}var Ter=t(a=>!Uot.has(a),"shouldWarn"),x3r=Symbol("type"),N3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),zot=t(a=>N3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?OM:null:null,"getUintArray"),OM=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},i4e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let l=zot(s);if(!l)return[];a.#r=!0;let _=new a(s,l);return a.#r=!1,_}constructor(s,l){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new l(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},BH=class a{static{t(this,"LRUCache")}#r;#n;#e;#t;#s;#p;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#_;#c;#l;#i;#f;#v;#d;#u;#m;#g;#E;#x;#b;#k;#C;#y;static unsafeExposeInternals(s){return{starts:s.#x,ttls:s.#b,sizes:s.#E,keyMap:s.#c,keyList:s.#l,valList:s.#i,next:s.#f,prev:s.#v,get head(){return s.#d},get tail(){return s.#u},free:s.#m,isBackgroundFetch:t(l=>s.#h(l),"isBackgroundFetch"),backgroundFetch:t((l,_,h,b)=>s.#j(l,_,h,b),"backgroundFetch"),moveToTail:t(l=>s.#U(l),"moveToTail"),indexes:t(l=>s.#P(l),"indexes"),rindexes:t(l=>s.#A(l),"rindexes"),isStale:t(l=>s.#S(l),"isStale")}}get max(){return this.#r}get maxSize(){return this.#n}get calculatedSize(){return this.#_}get size(){return this.#a}get fetchMethod(){return this.#s}get memoMethod(){return this.#p}get dispose(){return this.#e}get disposeAfter(){return this.#t}constructor(s){let{max:l=0,ttl:_,ttlResolution:h=1,ttlAutopurge:b,updateAgeOnGet:D,updateAgeOnHas:N,allowStale:M,dispose:z,disposeAfter:ne,noDisposeOnSet:ie,noUpdateTTL:Q,maxSize:Me=0,maxEntrySize:Ne=0,sizeCalculation:we,fetchMethod:Pt,memoMethod:xt,noDeleteOnFetchRejection:Tr,noDeleteOnStaleGet:fn,allowStaleOnFetchRejection:tn,allowStaleOnFetchAbort:cn,ignoreFetchAbort:Cr}=s;if(l!==0&&!N3(l))throw new TypeError("max option must be a nonnegative integer");let vr=l?zot(l):Array;if(!vr)throw new Error("invalid max value: "+l);if(this.#r=l,this.#n=Me,this.maxEntrySize=Ne||this.#n,this.sizeCalculation=we,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(xt!==void 0&&typeof xt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=xt,Pt!==void 0&&typeof Pt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Pt,this.#C=!!Pt,this.#c=new Map,this.#l=new Array(l).fill(void 0),this.#i=new Array(l).fill(void 0),this.#f=new vr(l),this.#v=new vr(l),this.#d=0,this.#u=0,this.#m=i4e.create(l),this.#a=0,this.#_=0,typeof z=="function"&&(this.#e=z),typeof ne=="function"?(this.#t=ne,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#k=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!ie,this.noUpdateTTL=!!Q,this.noDeleteOnFetchRejection=!!Tr,this.allowStaleOnFetchRejection=!!tn,this.allowStaleOnFetchAbort=!!cn,this.ignoreFetchAbort=!!Cr,this.maxEntrySize!==0){if(this.#n!==0&&!N3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!N3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!M,this.noDeleteOnStaleGet=!!fn,this.updateAgeOnGet=!!D,this.updateAgeOnHas=!!N,this.ttlResolution=N3(h)||h===0?h:1,this.ttlAutopurge=!!b,this.ttl=_||0,this.ttl){if(!N3(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#r===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r&&!this.#n){let fs="LRU_CACHE_UNBOUNDED";Ter(fs)&&(Uot.add(fs),$ot("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",fs,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new OM(this.#r),l=new OM(this.#r);this.#b=s,this.#x=l,this.#N=(b,D,N=FM.now())=>{if(l[b]=D!==0?N:0,s[b]=D,D!==0&&this.ttlAutopurge){let M=setTimeout(()=>{this.#S(b)&&this.#F(this.#l[b],"expire")},D+1);M.unref&&M.unref()}},this.#w=b=>{l[b]=s[b]!==0?FM.now():0},this.#o=(b,D)=>{if(s[D]){let N=s[D],M=l[D];if(!N||!M)return;b.ttl=N,b.start=M,b.now=_||h();let z=b.now-M;b.remainingTTL=N-z}};let _=0,h=t(()=>{let b=FM.now();if(this.ttlResolution>0){_=b;let D=setTimeout(()=>_=0,this.ttlResolution);D.unref&&D.unref()}return b},"getNow");this.getRemainingTTL=b=>{let D=this.#c.get(b);if(D===void 0)return 0;let N=s[D],M=l[D];if(!N||!M)return 1/0;let z=(_||h())-M;return N-z},this.#S=b=>{let D=l[b],N=s[b];return!!N&&!!D&&(_||h())-D>N}}#w=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new OM(this.#r);this.#_=0,this.#E=s,this.#I=l=>{this.#_-=s[l],s[l]=0},this.#L=(l,_,h,b)=>{if(this.#h(_))return 0;if(!N3(h))if(b){if(typeof b!="function")throw new TypeError("sizeCalculation must be a function");if(h=b(_,l),!N3(h))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 h},this.#O=(l,_,h)=>{if(s[l]=_,this.#n){let b=this.#n-s[l];for(;this.#_>b;)this.#M(!0)}this.#_+=s[l],h&&(h.entrySize=_,h.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#O=t((s,l,_)=>{},"#addItemSize");#L=t((s,l,_,h)=>{if(_||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#u;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#d));)l=this.#v[l]}*#A({allowStale:s=this.allowStale}={}){if(this.#a)for(let l=this.#d;!(!this.#R(l)||((s||!this.#S(l))&&(yield l),l===this.#u));)l=this.#f[l]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#P())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*rentries(){for(let s of this.#A())this.#i[s]!==void 0&&this.#l[s]!==void 0&&!this.#h(this.#i[s])&&(yield[this.#l[s],this.#i[s]])}*keys(){for(let s of this.#P()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*rkeys(){for(let s of this.#A()){let l=this.#l[s];l!==void 0&&!this.#h(this.#i[s])&&(yield l)}}*values(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#A())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,l={}){for(let _ of this.#P()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;if(b!==void 0&&s(b,this.#l[_],this))return this.get(this.#l[_],l)}}forEach(s,l=this){for(let _ of this.#P()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;b!==void 0&&s.call(l,b,this.#l[_],this)}}rforEach(s,l=this){for(let _ of this.#A()){let h=this.#i[_],b=this.#h(h)?h.__staleWhileFetching:h;b!==void 0&&s.call(l,b,this.#l[_],this)}}purgeStale(){let s=!1;for(let l of this.#A({allowStale:!0}))this.#S(l)&&(this.#F(this.#l[l],"expire"),s=!0);return s}info(s){let l=this.#c.get(s);if(l===void 0)return;let _=this.#i[l],h=this.#h(_)?_.__staleWhileFetching:_;if(h===void 0)return;let b={value:h};if(this.#b&&this.#x){let D=this.#b[l],N=this.#x[l];if(D&&N){let M=D-(FM.now()-N);b.ttl=M,b.start=Date.now()}}return this.#E&&(b.size=this.#E[l]),b}dump(){let s=[];for(let l of this.#P({allowStale:!0})){let _=this.#l[l],h=this.#i[l],b=this.#h(h)?h.__staleWhileFetching:h;if(b===void 0||_===void 0)continue;let D={value:b};if(this.#b&&this.#x){D.ttl=this.#b[l];let N=FM.now()-this.#x[l];D.start=Math.floor(Date.now()-N)}this.#E&&(D.size=this.#E[l]),s.unshift([_,D])}return s}load(s){this.clear();for(let[l,_]of s){if(_.start){let h=Date.now()-_.start;_.start=FM.now()-h}this.set(l,_.value,_)}}set(s,l,_={}){if(l===void 0)return this.delete(s),this;let{ttl:h=this.ttl,start:b,noDisposeOnSet:D=this.noDisposeOnSet,sizeCalculation:N=this.sizeCalculation,status:M}=_,{noUpdateTTL:z=this.noUpdateTTL}=_,ne=this.#L(s,l,_.size||0,N);if(this.maxEntrySize&&ne>this.maxEntrySize)return M&&(M.set="miss",M.maxEntrySizeExceeded=!0),this.#F(s,"set"),this;let ie=this.#a===0?void 0:this.#c.get(s);if(ie===void 0)ie=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[ie]=s,this.#i[ie]=l,this.#c.set(s,ie),this.#f[this.#u]=ie,this.#v[ie]=this.#u,this.#u=ie,this.#a++,this.#O(ie,ne,M),M&&(M.set="add"),z=!1;else{this.#U(ie);let Q=this.#i[ie];if(l!==Q){if(this.#C&&this.#h(Q)){Q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Me}=Q;Me!==void 0&&!D&&(this.#k&&this.#e?.(Me,s,"set"),this.#y&&this.#g?.push([Me,s,"set"]))}else D||(this.#k&&this.#e?.(Q,s,"set"),this.#y&&this.#g?.push([Q,s,"set"]));if(this.#I(ie),this.#O(ie,ne,M),this.#i[ie]=l,M){M.set="replace";let Me=Q&&this.#h(Q)?Q.__staleWhileFetching:Q;Me!==void 0&&(M.oldValue=Me)}}else M&&(M.set="update")}if(h!==0&&!this.#b&&this.#D(),this.#b&&(z||this.#N(ie,h,b),M&&this.#o(M,ie)),!D&&this.#y&&this.#g){let Q=this.#g,Me;for(;Me=Q?.shift();)this.#t?.(...Me)}return this}pop(){try{for(;this.#a;){let s=this.#i[this.#d];if(this.#M(!0),this.#h(s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(this.#y&&this.#g){let s=this.#g,l;for(;l=s?.shift();)this.#t?.(...l)}}}#M(s){let l=this.#d,_=this.#l[l],h=this.#i[l];return this.#C&&this.#h(h)?h.__abortController.abort(new Error("evicted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(h,_,"evict"),this.#y&&this.#g?.push([h,_,"evict"])),this.#I(l),s&&(this.#l[l]=void 0,this.#i[l]=void 0,this.#m.push(l)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[l],this.#c.delete(_),this.#a--,l}has(s,l={}){let{updateAgeOnHas:_=this.updateAgeOnHas,status:h}=l,b=this.#c.get(s);if(b!==void 0){let D=this.#i[b];if(this.#h(D)&&D.__staleWhileFetching===void 0)return!1;if(this.#S(b))h&&(h.has="stale",this.#o(h,b));else return _&&this.#w(b),h&&(h.has="hit",this.#o(h,b)),!0}else h&&(h.has="miss");return!1}peek(s,l={}){let{allowStale:_=this.allowStale}=l,h=this.#c.get(s);if(h===void 0||!_&&this.#S(h))return;let b=this.#i[h];return this.#h(b)?b.__staleWhileFetching:b}#j(s,l,_,h){let b=l===void 0?void 0:this.#i[l];if(this.#h(b))return b;let D=new fle,{signal:N}=_;N?.addEventListener("abort",()=>D.abort(N.reason),{signal:D.signal});let M={signal:D.signal,options:_,context:h},z=t((we,Pt=!1)=>{let{aborted:xt}=D.signal,Tr=_.ignoreFetchAbort&&we!==void 0;if(_.status&&(xt&&!Pt?(_.status.fetchAborted=!0,_.status.fetchError=D.signal.reason,Tr&&(_.status.fetchAbortIgnored=!0)):_.status.fetchResolved=!0),xt&&!Tr&&!Pt)return ie(D.signal.reason);let fn=Me;return this.#i[l]===Me&&(we===void 0?fn.__staleWhileFetching?this.#i[l]=fn.__staleWhileFetching:this.#F(s,"fetch"):(_.status&&(_.status.fetchUpdated=!0),this.set(s,we,M.options))),we},"cb"),ne=t(we=>(_.status&&(_.status.fetchRejected=!0,_.status.fetchError=we),ie(we)),"eb"),ie=t(we=>{let{aborted:Pt}=D.signal,xt=Pt&&_.allowStaleOnFetchAbort,Tr=xt||_.allowStaleOnFetchRejection,fn=Tr||_.noDeleteOnFetchRejection,tn=Me;if(this.#i[l]===Me&&(!fn||tn.__staleWhileFetching===void 0?this.#F(s,"fetch"):xt||(this.#i[l]=tn.__staleWhileFetching)),Tr)return _.status&&tn.__staleWhileFetching!==void 0&&(_.status.returnedStale=!0),tn.__staleWhileFetching;if(tn.__returned===tn)throw we},"fetchFail"),Q=t((we,Pt)=>{let xt=this.#s?.(s,b,M);xt&&xt instanceof Promise&&xt.then(Tr=>we(Tr===void 0?void 0:Tr),Pt),D.signal.addEventListener("abort",()=>{(!_.ignoreFetchAbort||_.allowStaleOnFetchAbort)&&(we(void 0),_.allowStaleOnFetchAbort&&(we=t(Tr=>z(Tr,!0),"res")))})},"pcall");_.status&&(_.status.fetchDispatched=!0);let Me=new Promise(Q).then(z,ne),Ne=Object.assign(Me,{__abortController:D,__staleWhileFetching:b,__returned:void 0});return l===void 0?(this.set(s,Ne,{...M.options,status:void 0}),l=this.#c.get(s)):this.#i[l]=Ne,Ne}#h(s){if(!this.#C)return!1;let l=s;return!!l&&l instanceof Promise&&l.hasOwnProperty("__staleWhileFetching")&&l.__abortController instanceof fle}async fetch(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,ttl:D=this.ttl,noDisposeOnSet:N=this.noDisposeOnSet,size:M=0,sizeCalculation:z=this.sizeCalculation,noUpdateTTL:ne=this.noUpdateTTL,noDeleteOnFetchRejection:ie=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Q=this.allowStaleOnFetchRejection,ignoreFetchAbort:Me=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ne=this.allowStaleOnFetchAbort,context:we,forceRefresh:Pt=!1,status:xt,signal:Tr}=l;if(!this.#C)return xt&&(xt.fetch="get"),this.get(s,{allowStale:_,updateAgeOnGet:h,noDeleteOnStaleGet:b,status:xt});let fn={allowStale:_,updateAgeOnGet:h,noDeleteOnStaleGet:b,ttl:D,noDisposeOnSet:N,size:M,sizeCalculation:z,noUpdateTTL:ne,noDeleteOnFetchRejection:ie,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:Ne,ignoreFetchAbort:Me,status:xt,signal:Tr},tn=this.#c.get(s);if(tn===void 0){xt&&(xt.fetch="miss");let cn=this.#j(s,tn,fn,we);return cn.__returned=cn}else{let cn=this.#i[tn];if(this.#h(cn)){let Ho=_&&cn.__staleWhileFetching!==void 0;return xt&&(xt.fetch="inflight",Ho&&(xt.returnedStale=!0)),Ho?cn.__staleWhileFetching:cn.__returned=cn}let Cr=this.#S(tn);if(!Pt&&!Cr)return xt&&(xt.fetch="hit"),this.#U(tn),h&&this.#w(tn),xt&&this.#o(xt,tn),cn;let vr=this.#j(s,tn,fn,we),Fi=vr.__staleWhileFetching!==void 0&&_;return xt&&(xt.fetch=Cr?"stale":"refresh",Fi&&Cr&&(xt.returnedStale=!0)),Fi?vr.__staleWhileFetching:vr.__returned=vr}}async forceFetch(s,l={}){let _=await this.fetch(s,l);if(_===void 0)throw new Error("fetch() returned undefined");return _}memo(s,l={}){let _=this.#p;if(!_)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:b,...D}=l,N=this.get(s,D);if(!b&&N!==void 0)return N;let M=_(s,N,{options:D,context:h});return this.set(s,M,D),M}get(s,l={}){let{allowStale:_=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:b=this.noDeleteOnStaleGet,status:D}=l,N=this.#c.get(s);if(N!==void 0){let M=this.#i[N],z=this.#h(M);return D&&this.#o(D,N),this.#S(N)?(D&&(D.get="stale"),z?(D&&_&&M.__staleWhileFetching!==void 0&&(D.returnedStale=!0),_?M.__staleWhileFetching:void 0):(b||this.#F(s,"expire"),D&&_&&(D.returnedStale=!0),_?M:void 0)):(D&&(D.get="hit"),z?M.__staleWhileFetching:(this.#U(N),h&&this.#w(N),M))}else D&&(D.get="miss")}#B(s,l){this.#v[l]=s,this.#f[s]=l}#U(s){s!==this.#u&&(s===this.#d?this.#d=this.#f[s]:this.#B(this.#v[s],this.#f[s]),this.#B(this.#u,s),this.#u=s)}delete(s){return this.#F(s,"delete")}#F(s,l){let _=!1;if(this.#a!==0){let h=this.#c.get(s);if(h!==void 0)if(_=!0,this.#a===1)this.#$(l);else{this.#I(h);let b=this.#i[h];if(this.#h(b)?b.__abortController.abort(new Error("deleted")):(this.#k||this.#y)&&(this.#k&&this.#e?.(b,s,l),this.#y&&this.#g?.push([b,s,l])),this.#c.delete(s),this.#l[h]=void 0,this.#i[h]=void 0,h===this.#u)this.#u=this.#v[h];else if(h===this.#d)this.#d=this.#f[h];else{let D=this.#v[h];this.#f[D]=this.#f[h];let N=this.#f[h];this.#v[N]=this.#v[h]}this.#a--,this.#m.push(h)}}if(this.#y&&this.#g?.length){let h=this.#g,b;for(;b=h?.shift();)this.#t?.(...b)}return _}clear(){return this.#$("delete")}#$(s){for(let l of this.#A({allowStale:!0})){let _=this.#i[l];if(this.#h(_))_.__abortController.abort(new Error("deleted"));else{let h=this.#l[l];this.#k&&this.#e?.(_,h,s),this.#y&&this.#g?.push([_,h,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#x&&(this.#b.fill(0),this.#x.fill(0)),this.#E&&this.#E.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let l=this.#g,_;for(;_=l?.shift();)this.#t?.(..._)}}};import{posix as Fer,win32 as d4e}from"node:path";import{fileURLToPath as Oer}from"node:url";import{lstatSync as Ler,readdir as Rer,readdirSync as Mer,readlinkSync as jer,realpathSync as Ber}from"fs";import*as Uer from"node:fs";import{lstat as zer,readdir as Jer,readlink as qer,realpath as Ver}from"node:fs/promises";import{EventEmitter as f4e}from"node:events";import Hot from"node:stream";import{StringDecoder as xer}from"node:string_decoder";var Jot=typeof process=="object"&&process?process:{stdout:null,stderr:null},Cer=t(a=>!!a&&typeof a=="object"&&(a instanceof F3||a instanceof Hot||Eer(a)||Der(a)),"isStream"),Eer=t(a=>!!a&&typeof a=="object"&&a instanceof f4e&&typeof a.pipe=="function"&&a.pipe!==Hot.Writable.prototype.pipe,"isReadable"),Der=t(a=>!!a&&typeof a=="object"&&a instanceof f4e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),bA=Symbol("EOF"),SA=Symbol("maybeEmitEnd"),I3=Symbol("emittedEnd"),_le=Symbol("emittingEnd"),UH=Symbol("emittedError"),ple=Symbol("closed"),qot=Symbol("read"),dle=Symbol("flush"),Vot=Symbol("flushChunk"),qC=Symbol("encoding"),LM=Symbol("decoder"),zg=Symbol("flowing"),$H=Symbol("paused"),RM=Symbol("resume"),Jg=Symbol("buffer"),q1=Symbol("pipes"),qg=Symbol("bufferLength"),s4e=Symbol("bufferPush"),mle=Symbol("bufferShift"),Ry=Symbol("objectMode"),Im=Symbol("destroyed"),a4e=Symbol("error"),o4e=Symbol("emitData"),Wot=Symbol("emitEnd"),c4e=Symbol("emitEnd2"),ck=Symbol("async"),l4e=Symbol("abort"),hle=Symbol("aborted"),zH=Symbol("signal"),YF=Symbol("dataListeners"),V2=Symbol("discarded"),JH=t(a=>Promise.resolve().then(a),"defer"),ker=t(a=>a(),"nodefer"),wer=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),Per=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),Aer=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),gle=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,l,_){this.src=s,this.dest=l,this.opts=_,this.ondrain=()=>s[RM](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},u4e=class extends gle{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,l,_){super(s,l,_),this.proxyErrors=h=>l.emit("error",h),s.on("error",this.proxyErrors)}},Ner=t(a=>!!a.objectMode,"isObjectModeOptions"),Ier=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),F3=class extends f4e{static{t(this,"Minipass")}[zg]=!1;[$H]=!1;[q1]=[];[Jg]=[];[Ry];[qC];[ck];[LM];[bA]=!1;[I3]=!1;[_le]=!1;[ple]=!1;[UH]=null;[qg]=0;[Im]=!1;[zH];[hle]=!1;[YF]=0;[V2]=!1;writable=!0;readable=!0;constructor(...s){let l=s[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ner(l)?(this[Ry]=!0,this[qC]=null):Ier(l)?(this[qC]=l.encoding,this[Ry]=!1):(this[Ry]=!1,this[qC]=null),this[ck]=!!l.async,this[LM]=this[qC]?new xer(this[qC]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[Jg],"get")}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[q1],"get")});let{signal:_}=l;_&&(this[zH]=_,_.aborted?this[l4e]():_.addEventListener("abort",()=>this[l4e]()))}get bufferLength(){return this[qg]}get encoding(){return this[qC]}set encoding(s){throw new Error("Encoding must be set at instantiation time")}setEncoding(s){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ry]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ck]}set async(s){this[ck]=this[ck]||!!s}[l4e](){this[hle]=!0,this.emit("abort",this[zH]?.reason),this.destroy(this[zH]?.reason)}get aborted(){return this[hle]}set aborted(s){}write(s,l,_){if(this[hle])return!1;if(this[bA])throw new Error("write after end");if(this[Im])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(_=l,l="utf8"),l||(l="utf8");let h=this[ck]?JH:ker;if(!this[Ry]&&!Buffer.isBuffer(s)){if(Aer(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(Per(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ry]?(this[zg]&&this[qg]!==0&&this[dle](!0),this[zg]?this.emit("data",s):this[s4e](s),this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg]):s.length?(typeof s=="string"&&!(l===this[qC]&&!this[LM]?.lastNeed)&&(s=Buffer.from(s,l)),Buffer.isBuffer(s)&&this[qC]&&(s=this[LM].write(s)),this[zg]&&this[qg]!==0&&this[dle](!0),this[zg]?this.emit("data",s):this[s4e](s),this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg]):(this[qg]!==0&&this.emit("readable"),_&&h(_),this[zg])}read(s){if(this[Im])return null;if(this[V2]=!1,this[qg]===0||s===0||s&&s>this[qg])return this[SA](),null;this[Ry]&&(s=null),this[Jg].length>1&&!this[Ry]&&(this[Jg]=[this[qC]?this[Jg].join(""):Buffer.concat(this[Jg],this[qg])]);let l=this[qot](s||null,this[Jg][0]);return this[SA](),l}[qot](s,l){if(this[Ry])this[mle]();else{let _=l;s===_.length||s===null?this[mle]():typeof _=="string"?(this[Jg][0]=_.slice(s),l=_.slice(0,s),this[qg]-=s):(this[Jg][0]=_.subarray(s),l=_.subarray(0,s),this[qg]-=s)}return this.emit("data",l),!this[Jg].length&&!this[bA]&&this.emit("drain"),l}end(s,l,_){return typeof s=="function"&&(_=s,s=void 0),typeof l=="function"&&(_=l,l="utf8"),s!==void 0&&this.write(s,l),_&&this.once("end",_),this[bA]=!0,this.writable=!1,(this[zg]||!this[$H])&&this[SA](),this}[RM](){this[Im]||(!this[YF]&&!this[q1].length&&(this[V2]=!0),this[$H]=!1,this[zg]=!0,this.emit("resume"),this[Jg].length?this[dle]():this[bA]?this[SA]():this.emit("drain"))}resume(){return this[RM]()}pause(){this[zg]=!1,this[$H]=!0,this[V2]=!1}get destroyed(){return this[Im]}get flowing(){return this[zg]}get paused(){return this[$H]}[s4e](s){this[Ry]?this[qg]+=1:this[qg]+=s.length,this[Jg].push(s)}[mle](){return this[Ry]?this[qg]-=1:this[qg]-=this[Jg][0].length,this[Jg].shift()}[dle](s=!1){do;while(this[Vot](this[mle]())&&this[Jg].length);!s&&!this[Jg].length&&!this[bA]&&this.emit("drain")}[Vot](s){return this.emit("data",s),this[zg]}pipe(s,l){if(this[Im])return s;this[V2]=!1;let _=this[I3];return l=l||{},s===Jot.stdout||s===Jot.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,_?l.end&&s.end():(this[q1].push(l.proxyErrors?new u4e(this,s,l):new gle(this,s,l)),this[ck]?JH(()=>this[RM]()):this[RM]()),s}unpipe(s){let l=this[q1].find(_=>_.dest===s);l&&(this[q1].length===1?(this[zg]&&this[YF]===0&&(this[zg]=!1),this[q1]=[]):this[q1].splice(this[q1].indexOf(l),1),l.unpipe())}addListener(s,l){return this.on(s,l)}on(s,l){let _=super.on(s,l);if(s==="data")this[V2]=!1,this[YF]++,!this[q1].length&&!this[zg]&&this[RM]();else if(s==="readable"&&this[qg]!==0)super.emit("readable");else if(wer(s)&&this[I3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[UH]){let h=l;this[ck]?JH(()=>h.call(this,this[UH])):h.call(this,this[UH])}return _}removeListener(s,l){return this.off(s,l)}off(s,l){let _=super.off(s,l);return s==="data"&&(this[YF]=this.listeners("data").length,this[YF]===0&&!this[V2]&&!this[q1].length&&(this[zg]=!1)),_}removeAllListeners(s){let l=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[YF]=0,!this[V2]&&!this[q1].length&&(this[zg]=!1)),l}get emittedEnd(){return this[I3]}[SA](){!this[_le]&&!this[I3]&&!this[Im]&&this[Jg].length===0&&this[bA]&&(this[_le]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ple]&&this.emit("close"),this[_le]=!1)}emit(s,...l){let _=l[0];if(s!=="error"&&s!=="close"&&s!==Im&&this[Im])return!1;if(s==="data")return!this[Ry]&&!_?!1:this[ck]?(JH(()=>this[o4e](_)),!0):this[o4e](_);if(s==="end")return this[Wot]();if(s==="close"){if(this[ple]=!0,!this[I3]&&!this[Im])return!1;let b=super.emit("close");return this.removeAllListeners("close"),b}else if(s==="error"){this[UH]=_,super.emit(a4e,_);let b=!this[zH]||this.listeners("error").length?super.emit("error",_):!1;return this[SA](),b}else if(s==="resume"){let b=super.emit("resume");return this[SA](),b}else if(s==="finish"||s==="prefinish"){let b=super.emit(s);return this.removeAllListeners(s),b}let h=super.emit(s,...l);return this[SA](),h}[o4e](s){for(let _ of this[q1])_.dest.write(s)===!1&&this.pause();let l=this[V2]?!1:super.emit("data",s);return this[SA](),l}[Wot](){return this[I3]?!1:(this[I3]=!0,this.readable=!1,this[ck]?(JH(()=>this[c4e]()),!0):this[c4e]())}[c4e](){if(this[LM]){let l=this[LM].end();if(l){for(let _ of this[q1])_.dest.write(l);this[V2]||super.emit("data",l)}}for(let l of this[q1])l.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[Ry]||(s.dataLength=0);let l=this.promise();return this.on("data",_=>{s.push(_),this[Ry]||(s.dataLength+=_.length)}),await l,s}async concat(){if(this[Ry])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[qC]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,l)=>{this.on(Im,()=>l(new Error("stream destroyed"))),this.on("error",_=>l(_)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[V2]=!1;let s=!1,l=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return l();let h=this.read();if(h!==null)return Promise.resolve({done:!1,value:h});if(this[bA])return l();let b,D,N=t(ie=>{this.off("data",M),this.off("end",z),this.off(Im,ne),l(),D(ie)},"onerr"),M=t(ie=>{this.off("error",N),this.off("end",z),this.off(Im,ne),this.pause(),b({value:ie,done:!!this[bA]})},"ondata"),z=t(()=>{this.off("error",N),this.off("data",M),this.off(Im,ne),l(),b({done:!0,value:void 0})},"onend"),ne=t(()=>N(new Error("stream destroyed")),"ondestroy");return new Promise((ie,Q)=>{D=Q,b=ie,this.once(Im,ne),this.once("error",N),this.once("end",z),this.once("data",M)})},"next"),throw:l,return:l,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[V2]=!1;let s=!1,l=t(()=>(this.pause(),this.off(a4e,l),this.off(Im,l),this.off("end",l),s=!0,{done:!0,value:void 0}),"stop"),_=t(()=>{if(s)return l();let h=this.read();return h===null?l():{done:!1,value:h}},"next");return this.once("end",l),this.once(a4e,l),this.once(Im,l),{next:_,throw:l,return:l,[Symbol.iterator](){return this}}}destroy(s){if(this[Im])return s?this.emit("error",s):this.emit(Im),this;this[Im]=!0,this[V2]=!0,this[Jg].length=0,this[qg]=0;let l=this;return typeof l.close=="function"&&!this[ple]&&l.close(),s?this.emit("error",s):this.emit(Im),this}static get isStream(){return Cer}};var $er=Ber.native,VH={lstatSync:Ler,readdir:Rer,readdirSync:Mer,readlinkSync:jer,realpathSync:$er,promises:{lstat:zer,readdir:Jer,readlink:qer,realpath:Ver}},Qot=t(a=>!a||a===VH||a===Uer?VH:{...VH,...a,promises:{...VH.promises,...a.promises||{}}},"fsFromOption"),Zot=/^\\\\\?\\([a-z]:)\\?$/i,Wer=t(a=>a.replace(/\//g,"\\").replace(Zot,"$1\\"),"uncToDrive"),Her=/[\\\/]/,kT=0,ect=1,tct=2,lk=4,rct=6,nct=8,XF=10,ict=12,DT=15,qH=~DT,_4e=16,Got=32,WH=64,VC=128,yle=256,ble=512,Kot=WH|VC|ble,Ger=1023,p4e=t(a=>a.isFile()?nct:a.isDirectory()?lk:a.isSymbolicLink()?XF:a.isCharacterDevice()?tct:a.isBlockDevice()?rct:a.isSocket()?ict:a.isFIFO()?ect:kT,"entToType"),Yot=new Map,HH=t(a=>{let s=Yot.get(a);if(s)return s;let l=a.normalize("NFKD");return Yot.set(a,l),l},"normalize"),Xot=new Map,vle=t(a=>{let s=Xot.get(a);if(s)return s;let l=HH(a.toLowerCase());return Xot.set(a,l),l},"normalizeNocase"),Sle=class extends BH{static{t(this,"ResolveCache")}constructor(){super({max:256})}},m4e=class extends BH{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(l=>l.length+1,"sizeCalculation")})}},sct=Symbol("PathScurry setAsCwd"),My=class{static{t(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#r;#n;get dev(){return this.#n}#e;get mode(){return this.#e}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#p;get gid(){return this.#p}#a;get rdev(){return this.#a}#_;get blksize(){return this.#_}#c;get ino(){return this.#c}#l;get size(){return this.#l}#i;get blocks(){return this.#i}#f;get atimeMs(){return this.#f}#v;get mtimeMs(){return this.#v}#d;get ctimeMs(){return this.#d}#u;get birthtimeMs(){return this.#u}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#E;get ctime(){return this.#E}#x;get birthtime(){return this.#x}#b;#k;#C;#y;#D;#w;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,l=kT,_,h,b,D,N){this.name=s,this.#b=b?vle(s):HH(s),this.#o=l&Ger,this.nocase=b,this.roots=h,this.root=_||this,this.#N=D,this.#C=N.fullpath,this.#D=N.relative,this.#w=N.relativePosix,this.parent=N.parent,this.parent?this.#r=this.parent.#r:this.#r=Qot(N.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let l=this.getRootString(s),h=s.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#I(h):this.#I(h)}#I(s){let l=this;for(let _ of s)l=l.child(_);return l}children(){let s=this.#N.get(this);if(s)return s;let l=Object.assign([],{provisional:0});return this.#N.set(this,l),this.#o&=~_4e,l}child(s,l){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let _=this.children(),h=this.nocase?vle(s):HH(s);for(let M of _)if(M.#b===h)return M;let b=this.parent?this.sep:"",D=this.#C?this.#C+b+s:void 0,N=this.newChild(s,kT,{...l,parent:this,fullpath:D});return this.canReaddir()||(N.#o|=VC),_.push(N),N}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,l=this.parent;if(!l)return this.#D=this.name;let _=l.relative();return _+(!_||!l.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let s=this.name,l=this.parent;if(!l)return this.#w=this.fullpathPosix();let _=l.relativePosix();return _+(!_||!l.parent?"":"/")+s}fullpath(){if(this.#C!==void 0)return this.#C;let s=this.name,l=this.parent;if(!l)return this.#C=this.name;let h=l.fullpath()+(l.parent?this.sep:"")+s;return this.#C=h}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let h=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(h)?this.#y=`//?/${h}`:this.#y=h}let s=this.parent,l=s.fullpathPosix(),_=l+(!l||!s.parent?"":"/")+this.name;return this.#y=_}isUnknown(){return(this.#o&DT)===kT}isType(s){return this[`is${s}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#o&DT)===nct}isDirectory(){return(this.#o&DT)===lk}isCharacterDevice(){return(this.#o&DT)===tct}isBlockDevice(){return(this.#o&DT)===rct}isFIFO(){return(this.#o&DT)===ect}isSocket(){return(this.#o&DT)===ict}isSymbolicLink(){return(this.#o&XF)===XF}lstatCached(){return this.#o&Got?this:void 0}readlinkCached(){return this.#S}realpathCached(){return this.#T}readdirCached(){let s=this.children();return s.slice(0,s.provisional)}canReadlink(){if(this.#S)return!0;if(!this.parent)return!1;let s=this.#o&DT;return!(s!==kT&&s!==XF||this.#o&yle||this.#o&VC)}calledReaddir(){return!!(this.#o&_4e)}isENOENT(){return!!(this.#o&VC)}isNamed(s){return this.nocase?this.#b===vle(s):this.#b===HH(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=await this.#r.promises.readlink(this.fullpath()),_=(await this.parent.realpath())?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let l=this.#r.readlinkSync(this.fullpath()),_=this.parent.realpathSync()?.resolve(l);if(_)return this.#S=_}catch(l){this.#h(l.code);return}}#O(s){this.#o|=_4e;for(let l=s.provisional;l<s.length;l++){let _=s[l];_&&_.#L()}}#L(){this.#o&VC||(this.#o=(this.#o|VC)&qH,this.#P())}#P(){let s=this.children();s.provisional=0;for(let l of s)l.#L()}#A(){this.#o|=ble,this.#R()}#R(){if(this.#o&WH)return;let s=this.#o;(s&DT)===lk&&(s&=qH),this.#o=s|WH,this.#P()}#M(s=""){s==="ENOTDIR"||s==="EPERM"?this.#R():s==="ENOENT"?this.#L():this.children().provisional=0}#j(s=""){s==="ENOTDIR"?this.parent.#R():s==="ENOENT"&&this.#L()}#h(s=""){let l=this.#o;l|=yle,s==="ENOENT"&&(l|=VC),(s==="EINVAL"||s==="UNKNOWN")&&(l&=qH),this.#o=l,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,l){return this.#F(s,l)||this.#U(s,l)}#U(s,l){let _=p4e(s),h=this.newChild(s.name,_,{parent:this}),b=h.#o&DT;return b!==lk&&b!==XF&&b!==kT&&(h.#o|=WH),l.unshift(h),l.provisional++,h}#F(s,l){for(let _=l.provisional;_<l.length;_++){let h=l[_];if((this.nocase?vle(s.name):HH(s.name))===h.#b)return this.#$(s,h,_,l)}}#$(s,l,_,h){let b=l.name;return l.#o=l.#o&qH|p4e(s),b!==s.name&&(l.name=s.name),_!==h.provisional&&(_===h.length-1?h.pop():h.splice(_,1),h.unshift(l)),h.provisional++,l}async lstat(){if((this.#o&VC)===0)try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if((this.#o&VC)===0)try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:l,atimeMs:_,birthtime:h,birthtimeMs:b,blksize:D,blocks:N,ctime:M,ctimeMs:z,dev:ne,gid:ie,ino:Q,mode:Me,mtime:Ne,mtimeMs:we,nlink:Pt,rdev:xt,size:Tr,uid:fn}=s;this.#m=l,this.#f=_,this.#x=h,this.#u=b,this.#_=D,this.#i=N,this.#E=M,this.#d=z,this.#n=ne,this.#p=ie,this.#c=Q,this.#e=Me,this.#g=Ne,this.#v=we,this.#t=Pt,this.#a=xt,this.#l=Tr,this.#s=fn;let tn=p4e(s);this.#o=this.#o&qH|tn|Got,tn!==kT&&tn!==lk&&tn!==XF&&(this.#o|=WH)}#J=[];#q=!1;#W(s){this.#q=!1;let l=this.#J.slice();this.#J.length=0,l.forEach(_=>_(null,s))}readdirCB(s,l=!1){if(!this.canReaddir()){l?s(null,[]):queueMicrotask(()=>s(null,[]));return}let _=this.children();if(this.calledReaddir()){let b=_.slice(0,_.provisional);l?s(null,b):queueMicrotask(()=>s(null,b));return}if(this.#J.push(s),this.#q)return;this.#q=!0;let h=this.fullpath();this.#r.readdir(h,{withFileTypes:!0},(b,D)=>{if(b)this.#M(b.code),_.provisional=0;else{for(let N of D)this.#B(N,_);this.#O(_)}this.#W(_.slice(0,_.provisional))})}#z;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();if(this.#z)await this.#z;else{let _=t(()=>{},"resolve");this.#z=new Promise(h=>_=h);try{for(let h of await this.#r.promises.readdir(l,{withFileTypes:!0}))this.#B(h,s);this.#O(s)}catch(h){this.#M(h.code),s.provisional=0}this.#z=void 0,_()}return s.slice(0,s.provisional)}readdirSync(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let l=this.fullpath();try{for(let _ of this.#r.readdirSync(l,{withFileTypes:!0}))this.#B(_,s);this.#O(s)}catch(_){this.#M(_.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Kot)return!1;let s=DT&this.#o;return s===kT||s===lk||s===XF}shouldWalk(s,l){return(this.#o&lk)===lk&&!(this.#o&Kot)&&!s.has(this)&&(!l||l(this))}async realpath(){if(this.#T)return this.#T;if(!((ble|yle|VC)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}realpathSync(){if(this.#T)return this.#T;if(!((ble|yle|VC)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#A()}}[sct](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let l=new Set([]),_=[],h=this;for(;h&&h.parent;)l.add(h),h.#D=_.join(this.sep),h.#w=_.join("/"),h=h.parent,_.push("..");for(h=s;h&&h.parent&&!l.has(h);)h.#D=void 0,h.#w=void 0,h=h.parent}},Tle=class a extends My{static{t(this,"PathWin32")}sep="\\";splitSep=Her;constructor(s,l=kT,_,h,b,D,N){super(s,l,_,h,b,D,N)}newChild(s,l=kT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}getRootString(s){return d4e.parse(s).root}getRoot(s){if(s=Wer(s.toUpperCase()),s===this.root.name)return this.root;for(let[l,_]of Object.entries(this.roots))if(this.sameRoot(s,l))return this.roots[s]=_;return this.roots[s]=new MM(s,this).root}sameRoot(s,l=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(Zot,"$1\\"),s===l}},xle=class a extends My{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,l=kT,_,h,b,D,N){super(s,l,_,h,b,D,N)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,l=kT,_={}){return new a(s,l,this.root,this.roots,this.nocase,this.childrenCache(),_)}},Cle=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),l,_,{nocase:h,childrenCacheSize:b=16*1024,fs:D=VH}={}){this.#t=Qot(D),(s instanceof URL||s.startsWith("file://"))&&(s=Oer(s));let N=l.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(N),this.#r=new Sle,this.#n=new Sle,this.#e=new m4e(b);let M=N.substring(this.rootPath.length).split(_);if(M.length===1&&!M[0]&&M.pop(),h===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=h,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let z=this.root,ne=M.length-1,ie=l.sep,Q=this.rootPath,Me=!1;for(let Ne of M){let we=ne--;z=z.child(Ne,{relative:new Array(we).fill("..").join(ie),relativePosix:new Array(we).fill("..").join("/"),fullpath:Q+=(Me?"":ie)+Ne}),Me=!0}this.cwd=z}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#r.get(l);if(_!==void 0)return _;let h=this.cwd.resolve(l).fullpath();return this.#r.set(l,h),h}resolvePosix(...s){let l="";for(let b=s.length-1;b>=0;b--){let D=s[b];if(!(!D||D===".")&&(l=l?`${D}/${l}`:D,this.isAbsolute(D)))break}let _=this.#n.get(l);if(_!==void 0)return _;let h=this.cwd.resolve(l).fullpathPosix();return this.#n.set(l,h),h}relative(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relative()}relativePosix(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.relativePosix()}basename(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.name}dirname(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),(s.parent||s).fullpath()}async readdir(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_}=l;if(s.canReaddir()){let h=await s.readdir();return _?h:h.map(b=>b.name)}else return[]}readdirSync(s=this.cwd,l={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0}=l;return s.canReaddir()?_?s.readdirSync():s.readdirSync().map(h=>h.name):[]}async lstat(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstat()}lstatSync(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.lstatSync()}async readlink(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=await s.readlink();return l?_:_?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=s.readlinkSync();return l?_:_?.fullpath()}async realpath(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=await s.realpath();return l?_:_?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s.withFileTypes,s=this.cwd);let _=s.realpathSync();return l?_:_?.fullpath()}async walk(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=[];(!b||b(s))&&N.push(_?s:s.fullpath());let M=new Set,z=t((ie,Q)=>{M.add(ie),ie.readdirCB((Me,Ne)=>{if(Me)return Q(Me);let we=Ne.length;if(!we)return Q();let Pt=t(()=>{--we===0&&Q()},"next");for(let xt of Ne)(!b||b(xt))&&N.push(_?xt:xt.fullpath()),h&&xt.isSymbolicLink()?xt.realpath().then(Tr=>Tr?.isUnknown()?Tr.lstat():Tr).then(Tr=>Tr?.shouldWalk(M,D)?z(Tr,Pt):Pt()):xt.shouldWalk(M,D)?z(xt,Pt):Pt()},!0)},"walk"),ne=s;return new Promise((ie,Q)=>{z(ne,Me=>{if(Me)return Q(Me);ie(N)})})}walkSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=[];(!b||b(s))&&N.push(_?s:s.fullpath());let M=new Set([s]);for(let z of M){let ne=z.readdirSync();for(let ie of ne){(!b||b(ie))&&N.push(_?ie:ie.fullpath());let Q=ie;if(ie.isSymbolicLink()){if(!(h&&(Q=ie.realpathSync())))continue;Q.isUnknown()&&Q.lstatSync()}Q.shouldWalk(M,D)&&M.add(Q)}}return N}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,l={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd),this.stream(s,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l;(!b||b(s))&&(yield _?s:s.fullpath());let N=new Set([s]);for(let M of N){let z=M.readdirSync();for(let ne of z){(!b||b(ne))&&(yield _?ne:ne.fullpath());let ie=ne;if(ne.isSymbolicLink()){if(!(h&&(ie=ne.realpathSync())))continue;ie.isUnknown()&&ie.lstatSync()}ie.shouldWalk(N,D)&&N.add(ie)}}}stream(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=new F3({objectMode:!0});(!b||b(s))&&N.write(_?s:s.fullpath());let M=new Set,z=[s],ne=0,ie=t(()=>{let Q=!1;for(;!Q;){let Me=z.shift();if(!Me){ne===0&&N.end();return}ne++,M.add(Me);let Ne=t((Pt,xt,Tr=!1)=>{if(Pt)return N.emit("error",Pt);if(h&&!Tr){let fn=[];for(let tn of xt)tn.isSymbolicLink()&&fn.push(tn.realpath().then(cn=>cn?.isUnknown()?cn.lstat():cn));if(fn.length){Promise.all(fn).then(()=>Ne(null,xt,!0));return}}for(let fn of xt)fn&&(!b||b(fn))&&(N.write(_?fn:fn.fullpath())||(Q=!0));ne--;for(let fn of xt){let tn=fn.realpathCached()||fn;tn.shouldWalk(M,D)&&z.push(tn)}Q&&!N.flowing?N.once("drain",ie):we||ie()},"onReaddir"),we=!0;Me.readdirCB(Ne,!0),we=!1}},"process");return ie(),N}streamSync(s=this.cwd,l={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof My||(l=s,s=this.cwd);let{withFileTypes:_=!0,follow:h=!1,filter:b,walkFilter:D}=l,N=new F3({objectMode:!0}),M=new Set;(!b||b(s))&&N.write(_?s:s.fullpath());let z=[s],ne=0,ie=t(()=>{let Q=!1;for(;!Q;){let Me=z.shift();if(!Me){ne===0&&N.end();return}ne++,M.add(Me);let Ne=Me.readdirSync();for(let we of Ne)(!b||b(we))&&(N.write(_?we:we.fullpath())||(Q=!0));ne--;for(let we of Ne){let Pt=we;if(we.isSymbolicLink()){if(!(h&&(Pt=we.realpathSync())))continue;Pt.isUnknown()&&Pt.lstatSync()}Pt.shouldWalk(M,D)&&z.push(Pt)}}Q&&!N.flowing&&N.once("drain",ie)},"process");return ie(),N}chdir(s=this.cwd){let l=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[sct](l)}},MM=class extends Cle{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,d4e,"\\",{...l,nocase:_}),this.nocase=_;for(let h=this.cwd;h;h=h.parent)h.nocase=this.nocase}parseRootPath(s){return d4e.parse(s).root.toUpperCase()}newRoot(s){return new Tle(this.rootPath,lk,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},jM=class extends Cle{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),l={}){let{nocase:_=!1}=l;super(s,Fer,"/",{...l,nocase:_}),this.nocase=_}parseRootPath(s){return"/"}newRoot(s){return new xle(this.rootPath,lk,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},GH=class extends jM{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),l={}){let{nocase:_=!0}=l;super(s,{...l,nocase:_})}},M3r=process.platform==="win32"?Tle:xle,act=process.platform==="win32"?MM:process.platform==="darwin"?GH:jM;var Ker=t(a=>a.length>=1,"isPatternList"),Yer=t(a=>a.length>=1,"isGlobList"),BM=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,l,_,h){if(!Ker(s))throw new TypeError("empty pattern list");if(!Yer(l))throw new TypeError("empty glob list");if(l.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,_<0||_>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=l,this.#e=_,this.#t=h,this.#e===0){if(this.isUNC()){let[b,D,N,M,...z]=this.#r,[ne,ie,Q,Me,...Ne]=this.#n;z[0]===""&&(z.shift(),Ne.shift());let we=[b,D,N,M,""].join("/"),Pt=[ne,ie,Q,Me,""].join("/");this.#r=[we,...z],this.#n=[Pt,...Ne],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[b,...D]=this.#r,[N,...M]=this.#n;D[0]===""&&(D.shift(),M.shift());let z=b+"/",ne=N+"/";this.#r=[z,...D],this.#n=[ne,...M],this.length=this.#r.length}}}pattern(){return this.#r[this.#e]}isString(){return typeof this.#r[this.#e]=="string"}isGlobstar(){return this.#r[this.#e]===I0}isRegExp(){return this.#r[this.#e]instanceof RegExp}globString(){return this.#p=this.#p||(this.#e===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new a(this.#r,this.#n,this.#e+1,this.#t),this.#s.#c=this.#c,this.#s.#_=this.#_,this.#s.#a=this.#a,this.#s):this.#s=null}isUNC(){let s=this.#r;return this.#_!==void 0?this.#_:this.#_=this.#t==="win32"&&this.#e===0&&s[0]===""&&s[1]===""&&typeof s[2]=="string"&&!!s[2]&&typeof s[3]=="string"&&!!s[3]}isDrive(){let s=this.#r;return this.#a!==void 0?this.#a:this.#a=this.#t==="win32"&&this.#e===0&&this.length>1&&typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0])}isAbsolute(){let s=this.#r;return this.#c!==void 0?this.#c:this.#c=s[0]===""&&s.length>1||this.isDrive()||this.isUNC()}root(){let s=this.#r[0];return typeof s=="string"&&this.isAbsolute()&&this.#e===0?s:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var Xer=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",UM=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:l,nocase:_,noext:h,noglobstar:b,platform:D=Xer}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=D,this.mmopts={dot:!0,nobrace:l,nocase:_,noext:h,noglobstar:b,optimizationLevel:2,platform:D,nocomment:!0,nonegate:!0};for(let N of s)this.add(N)}add(s){let l=new q2(s,this.mmopts);for(let _=0;_<l.set.length;_++){let h=l.set[_],b=l.globParts[_];if(!h||!b)throw new Error("invalid pattern object");for(;h[0]==="."&&b[0]===".";)h.shift(),b.shift();let D=new BM(h,b,0,this.platform),N=new q2(D.globString(),this.mmopts),M=b[b.length-1]==="**",z=D.isAbsolute();z?this.absolute.push(N):this.relative.push(N),M&&(z?this.absoluteChildren.push(N):this.relativeChildren.push(N))}}ignored(s){let l=s.fullpath(),_=`${l}/`,h=s.relative()||".",b=`${h}/`;for(let D of this.relative)if(D.match(h)||D.match(b))return!0;for(let D of this.absolute)if(D.match(l)||D.match(_))return!0;return!1}childrenIgnored(s){let l=s.fullpath()+"/",_=(s.relative()||".")+"/";for(let h of this.relativeChildren)if(h.match(_))return!0;for(let h of this.absoluteChildren)if(h.match(l))return!0;return!1}};var h4e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,l){return this.store.get(s.fullpath())?.has(l.globString())}storeWalked(s,l){let _=s.fullpath(),h=this.store.get(_);h?h.add(l.globString()):this.store.set(_,new Set([l.globString()]))}},g4e=class{static{t(this,"MatchRecord")}store=new Map;add(s,l,_){let h=(l?2:0)|(_?1:0),b=this.store.get(s);this.store.set(s,b===void 0?h:h&b)}entries(){return[...this.store.entries()].map(([s,l])=>[s,!!(l&2),!!(l&1)])}},y4e=class{static{t(this,"SubWalks")}store=new Map;add(s,l){if(!s.canReaddir())return;let _=this.store.get(s);_?_.find(h=>h.globString()===l.globString())||_.push(l):this.store.set(s,[l])}get(s){let l=this.store.get(s);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},KH=class a{static{t(this,"Processor")}hasWalkedCache;matches=new g4e;subwalks=new y4e;patterns;follow;dot;opts;constructor(s,l){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=l?l.copy():new h4e}processPatterns(s,l){this.patterns=l;let _=l.map(h=>[s,h]);for(let[h,b]of _){this.hasWalkedCache.storeWalked(h,b);let D=b.root(),N=b.isAbsolute()&&this.opts.absolute!==!1;if(D){h=h.resolve(D==="/"&&this.opts.root!==void 0?this.opts.root:D);let ie=b.rest();if(ie)b=ie;else{this.matches.add(h,!0,!1);continue}}if(h.isENOENT())continue;let M,z,ne=!1;for(;typeof(M=b.pattern())=="string"&&(z=b.rest());)h=h.resolve(M),b=z,ne=!0;if(M=b.pattern(),z=b.rest(),ne){if(this.hasWalkedCache.hasWalked(h,b))continue;this.hasWalkedCache.storeWalked(h,b)}if(typeof M=="string"){let ie=M===".."||M===""||M===".";this.matches.add(h.resolve(M),N,ie);continue}else if(M===I0){(!h.isSymbolicLink()||this.follow||b.checkFollowGlobstar())&&this.subwalks.add(h,b);let ie=z?.pattern(),Q=z?.rest();if(!z||(ie===""||ie===".")&&!Q)this.matches.add(h,N,ie===""||ie===".");else if(ie===".."){let Me=h.parent||h;Q?this.hasWalkedCache.hasWalked(Me,Q)||this.subwalks.add(Me,Q):this.matches.add(Me,N,!0)}}else M instanceof RegExp&&this.subwalks.add(h,b)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,l){let _=this.subwalks.get(s),h=this.child();for(let b of l)for(let D of _){let N=D.isAbsolute(),M=D.pattern(),z=D.rest();M===I0?h.testGlobstar(b,D,z,N):M instanceof RegExp?h.testRegExp(b,M,z,N):h.testString(b,M,z,N)}return h}testGlobstar(s,l,_,h){if((this.dot||!s.name.startsWith("."))&&(l.hasMore()||this.matches.add(s,h,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,l):s.isSymbolicLink()&&(_&&l.checkFollowGlobstar()?this.subwalks.add(s,_):l.markFollowGlobstar()&&this.subwalks.add(s,l)))),_){let b=_.pattern();if(typeof b=="string"&&b!==".."&&b!==""&&b!==".")this.testString(s,b,_.rest(),h);else if(b===".."){let D=s.parent||s;this.subwalks.add(D,_)}else b instanceof RegExp&&this.testRegExp(s,b,_.rest(),h)}}testRegExp(s,l,_,h){l.test(s.name)&&(_?this.subwalks.add(s,_):this.matches.add(s,h,!1))}testString(s,l,_,h){s.isNamed(l)&&(_?this.subwalks.add(s,_):this.matches.add(s,h,!1))}};var Qer=t((a,s)=>typeof a=="string"?new UM([a],s):Array.isArray(a)?new UM(a,s):a,"makeIgnore"),Ele=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,l,_){if(this.patterns=s,this.path=l,this.opts=_,this.#e=!_.posix&&_.platform==="win32"?"\\":"/",this.includeChildMatches=_.includeChildMatches!==!1,(_.ignore||!this.includeChildMatches)&&(this.#n=Qer(_.ignore??[],_),!this.includeChildMatches&&typeof this.#n.add!="function")){let h="cannot ignore child matches, ignore lacks add() method.";throw new Error(h)}this.maxDepth=_.maxDepth||1/0,_.signal&&(this.signal=_.signal,this.signal.addEventListener("abort",()=>{this.#r.length=0}))}#t(s){return this.seen.has(s)||!!this.#n?.ignored?.(s)}#s(s){return!!this.#n?.childrenIgnored?.(s)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let s;for(;!this.paused&&(s=this.#r.shift());)s()}onResume(s){this.signal?.aborted||(this.paused?this.#r.push(s):s())}async matchCheck(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||await s.realpath(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=await b.realpath();D&&(D.isUnknown()||this.opts.stat)&&await D.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(s,l){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!l||s.canReaddir())&&(!this.opts.nodir||!s.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!s.isSymbolicLink()||!s.realpathCached()?.isDirectory())&&!this.#t(s)?s:void 0}matchCheckSync(s,l){if(l&&this.opts.nodir)return;let _;if(this.opts.realpath){if(_=s.realpathCached()||s.realpathSync(),!_)return;s=_}let b=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&b?.isSymbolicLink()){let D=b.realpathSync();D&&(D?.isUnknown()||this.opts.stat)&&D.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(s,l){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let b=`${s.relativePosix()}/**`;this.#n.add(b)}let _=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(s);let h=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(_){let b=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(b+h)}else{let b=this.opts.posix?s.relativePosix():s.relative(),D=this.opts.dotRelative&&!b.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(b?D+b+h:"."+h)}}async match(s,l,_){let h=await this.matchCheck(s,_);h&&this.matchFinish(h,l)}matchSync(s,l,_){let h=this.matchCheckSync(s,_);h&&this.matchFinish(h,l)}walkCB(s,l,_){this.signal?.aborted&&_(),this.walkCB2(s,l,new KH(this.opts),_)}walkCB2(s,l,_,h){if(this.#s(s))return h();if(this.signal?.aborted&&h(),this.paused){this.onResume(()=>this.walkCB2(s,l,_,h));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||(b++,this.match(N,M,z).then(()=>D()));for(let N of _.subwalkTargets()){if(this.maxDepth!==1/0&&N.depth()>=this.maxDepth)continue;b++;let M=N.readdirCached();N.calledReaddir()?this.walkCB3(N,M,_,D):N.readdirCB((z,ne)=>this.walkCB3(N,ne,_,D),!0)}D()}walkCB3(s,l,_,h){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||(b++,this.match(N,M,z).then(()=>D()));for(let[N,M]of _.subwalks.entries())b++,this.walkCB2(N,M,_.child(),D);D()}walkCBSync(s,l,_){this.signal?.aborted&&_(),this.walkCB2Sync(s,l,new KH(this.opts),_)}walkCB2Sync(s,l,_,h){if(this.#s(s))return h();if(this.signal?.aborted&&h(),this.paused){this.onResume(()=>this.walkCB2Sync(s,l,_,h));return}_.processPatterns(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||this.matchSync(N,M,z);for(let N of _.subwalkTargets()){if(this.maxDepth!==1/0&&N.depth()>=this.maxDepth)continue;b++;let M=N.readdirSync();this.walkCB3Sync(N,M,_,D)}D()}walkCB3Sync(s,l,_,h){_=_.filterEntries(s,l);let b=1,D=t(()=>{--b===0&&h()},"next");for(let[N,M,z]of _.matches.entries())this.#t(N)||this.matchSync(N,M,z);for(let[N,M]of _.subwalks.entries())b++,this.walkCB2Sync(N,M,_.child(),D);D()}},YH=class extends Ele{static{t(this,"GlobWalker")}matches=new Set;constructor(s,l,_){super(s,l,_)}matchEmit(s){this.matches.add(s)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,l)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?l(this.signal.reason):s(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}},XH=class extends Ele{static{t(this,"GlobStream")}results;constructor(s,l,_){super(s,l,_),this.results=new F3({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(s){this.results.write(s),this.results.flowing||this.pause()}stream(){let s=this.path;return s.isUnknown()?s.lstat().then(()=>{this.walkCB(s,this.patterns,()=>this.results.end())}):this.walkCB(s,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var etr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",WC=class{static{t(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(s,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=Zer(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(M=>M.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(M=>M.includes("/")?M:`./**/${M}`)}if(this.pattern=s,this.platform=l.platform||etr,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let M=l.platform==="win32"?MM:l.platform==="darwin"?GH:l.platform?jM:act;this.scurry=new M(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let _=this.platform==="darwin"||this.platform==="win32",h={...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:_,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},b=this.pattern.map(M=>new q2(M,h)),[D,N]=b.reduce((M,z)=>(M[0].push(...z.set),M[1].push(...z.globParts),M),[[],[]]);this.patterns=D.map((M,z)=>{let ne=N[z];if(!ne)throw new Error("invalid pattern object");return new BM(M,ne,0,this.platform)})}async walk(){return[...await new YH(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 YH(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 XH(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 XH(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 v4e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let l of a)if(new q2(l,s).hasMagic())return!0;return!1},"hasMagic");function Dle(a,s={}){return new WC(a,s).streamSync()}t(Dle,"globStreamSync");function cct(a,s={}){return new WC(a,s).stream()}t(cct,"globStream");function lct(a,s={}){return new WC(a,s).walkSync()}t(lct,"globSync");async function oct(a,s={}){return new WC(a,s).walk()}t(oct,"glob_");function kle(a,s={}){return new WC(a,s).iterateSync()}t(kle,"globIterateSync");function uct(a,s={}){return new WC(a,s).iterate()}t(uct,"globIterate");var ttr=Dle,rtr=Object.assign(cct,{sync:Dle}),ntr=kle,itr=Object.assign(uct,{sync:kle}),str=Object.assign(lct,{stream:Dle,iterate:kle}),QH=Object.assign(oct,{glob:oct,globSync:lct,sync:str,globStream:cct,stream:rtr,globStreamSync:Dle,streamSync:ttr,globIterate:uct,iterate:itr,globIterateSync:kle,iterateSync:ntr,Glob:WC,hasMagic:v4e,escape:IM,unescape:JC});QH.glob=QH;var V1=class extends Error{static{t(this,"CompilationError")}buildMessages;constructor(s){super("An error occurred during compilation."),this.buildMessages=Array.isArray(s)?s:[s]}toBuildResult(){return{content:"",errors:this.buildMessages}}};var atr="[",otr="]",ctr="{",ltr="}",utr=":",ftr=",",_tr="true",ptr="false",dtr="null",mtr="NaN",htr="Infinity",S4e='"',ZH=new Map([[34,S4e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
576
576
  `],[102,"\f"],[114,"\r"],[116," "]]),Ale=new Map([...ZH,[118,"\v"],[48,"\0"]]),gtr=new Map([[S4e,S4e],["\\","\\"],["/","/"],["\b","b"],[`
577
577
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),TNr=new Map([...gtr,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Ple=new Map([[atr,"LBracket"],[otr,"RBracket"],[ctr,"LBrace"],[ltr,"RBrace"],[utr,"Colon"],[ftr,"Comma"],[_tr,"Boolean"],[ptr,"Boolean"],[dtr,"Null"]]),wle=new Map([...Ple,[mtr,"Number"],[htr,"Number"]]),T4e=new Set([10,13,8232,8233]),xA=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:l,column:_,offset:h}){super(`${s} (${l}:${_})`),this.line=l,this.column=_,this.offset=h}},x4e=class extends xA{static{t(this,"UnexpectedChar")}constructor(s,l){super(`Unexpected character '${String.fromCharCode(s)}' found.`,l)}},C4e=class extends xA{static{t(this,"UnexpectedIdentifier")}constructor(s,l){super(`Unexpected identifier '${s}' found.`,l)}},QF=class extends xA{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Nle=class extends xA{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},ytr=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,vtr=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,btr=13,fct=10,E4e=class{static{t(this,"CharCodeReader")}#r="";#n=1;#e=0;#t=-1;#s=!1;#p=-1;#a=!1;constructor(s){this.#r=s}#_(){this.#a||(this.#e++,this.#t++,this.#p=-1,this.#a=!0)}locate(){return{line:this.#n,column:this.#e,offset:this.#t}}next(){if(this.#t>=this.#r.length-1)return this.#_(),-1;this.#t++;let s=this.#r.charCodeAt(this.#t);return this.#s?(this.#n++,this.#e=1,this.#s=!1):this.#e++,s===btr?(this.#s=!0,this.peek()===fct&&this.#t++):s===fct&&(this.#s=!0),this.#p=s,s}peek(){return this.#t===this.#r.length-1?-1:this.#r.charCodeAt(this.#t+1)}match(s){return s(this.peek())?(this.next(),!0):!1}current(){return this.#p}},Str="Infinity",Ttr="NaN",xtr=new Set([116,102,110]),D4e=new Set([32,9,10,13]),_ct=new Set([...D4e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),Ctr={mode:"json",ranges:!1},Etr=new Set(["true","false","null"]),C_={EOF:0,Number:1,String:2,Boolean:3,Null:4,NaN:5,Infinity:6,Identifier:7,Colon:20,LBrace:21,RBrace:22,LBracket:23,RBracket:24,Comma:25,LineComment:40,BlockComment:41};function TA(a){return a>=48&&a<=57}t(TA,"isDigit");function b4e(a){return TA(a)||a>=65&&a<=70||a>=97&&a<=102}t(b4e,"isHexDigit");function Dtr(a){return a>=49&&a<=57}t(Dtr,"isPositiveDigit");function ktr(a){return xtr.has(a)}t(ktr,"isKeywordStart");function dct(a){return TA(a)||a===46||a===45}t(dct,"isNumberStart");function wtr(a){return dct(a)||a===43}t(wtr,"isJSON5NumberStart");function pct(a,s){return a===34||s&&a===39}t(pct,"isStringStart");function mct(a){if(a===36||a===95||a===92||a>=97&&a<=122||a>=65&&a<=90||a===8204||a===8205)return!0;let s=String.fromCharCode(a);return ytr.test(s)}t(mct,"isJSON5IdentifierStart");function Ptr(a){if(mct(a)||TA(a))return!0;let s=String.fromCharCode(a);return vtr.test(s)}t(Ptr,"isJSON5IdentifierPart");var k4e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,l){this.#n=s,this.#r={...Ctr,...l},this.#e=new E4e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Ale.has.bind(Ale):ZH.has.bind(ZH),this.#c=this.#t?T4e.has.bind(T4e):()=>!1,this.#l=this.#t?_=>_===120:()=>!1,this.#i=this.#t?_ct.has.bind(_ct):D4e.has.bind(D4e)}#f(s,l=this.#e.locate()){throw new x4e(s,l)}#v(s,l=this.#e.locate()){throw new C4e(s,l)}#d(){throw new Nle(this.#e.locate())}#u(s,l,_,h){let b=_.offset+l,D=this.#r.ranges?{range:[_.offset,b]}:void 0;return{type:s,loc:{start:_,end:h||{line:_.line,column:_.column+l,offset:b}},...D}}#m(s){let l="",_;for(let h=0;h<s;h++){if(_=this.#e.peek(),b4e(_)){this.#e.next(),l+=String.fromCharCode(_);continue}this.#f(_)}return l}#g(s){let l="";do{if(l+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),l+=String.fromCharCode(s),l+=this.#m(4)),s=this.#e.peek(),!Ptr(s))break;this.#e.next()}while(!0);return l}#E(s){let l=s,_=1;for(s=this.#e.peek();s!==-1&&s!==l;){if(this.#e.next(),_++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),_++;else if(s===117){this.#e.next(),_++;let h=this.#m(4);_+=h.length}else if(this.#l(s)){this.#e.next(),_++;let h=this.#m(2);_+=h.length}else this.#t?(this.#e.next(),_++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),_++,_}#x(s){let l=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let _=this.#g(s);return _!==Str&&_!==Ttr&&this.#f(s),l+_.length}TA(s)||this.#f(s),this.#e.next(),l++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),l++,s=this.#e.peek(),b4e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),l++,s=this.#e.peek();while(b4e(s))}else TA(s)&&this.#f(s);else if(!this.#t||s!==46)for(Dtr(s)||this.#f(s),s=this.#e.peek();TA(s);)this.#e.next(),l++,s=this.#e.peek();if(s===46){let _=-1;for(this.#e.next(),l++,_++,s=this.#e.peek();TA(s);)this.#e.next(),l++,_++,s=this.#e.peek();!this.#t&&_===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),l++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),l++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),TA(s)||(this.#e.next(),this.#f(s));TA(s);)this.#e.next(),l++,s=this.#e.peek();return l}#b(s){let l=1;if(s=this.#e.peek(),s===47){do this.#e.next(),l+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:l,multiline:!1}}if(s===42){for(this.#e.next(),l+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),l+=1,s=this.#e.peek(),s===47)return this.#e.next(),l+=1,{length:l,multiline:!0}}else this.#e.next(),l+=1;this.#e.next(),this.#d()}this.#e.next(),this.#f(s)}next(){let s=this.#e.next();for(;this.#i(s);)s=this.#e.next();if(s===-1)return C_.EOF;let l=this.#e.locate(),_=String.fromCharCode(s);if(this.#t)if(wle.has(_))this.#a=this.#u(wle.get(_),1,l);else if(mct(s)){let h=this.#g(s);wle.has(h)?this.#a=this.#u(wle.get(h),h.length,l):this.#a=this.#u("Identifier",h.length,l)}else if(wtr(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(pct(s,this.#t)){let h=this.#E(s),b=this.#e.locate();this.#a=this.#u("String",h,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else if(s===47&&this.#s){let h=this.#b(s),b=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);else if(Ple.has(_))this.#a=this.#u(Ple.get(_),1,l);else if(ktr(s)){let h=this.#g(s);Etr.has(h)||this.#v(h,l),this.#a=this.#u(Ple.get(h),h.length,l)}else if(dct(s)){let h=this.#x(s);this.#a=this.#u("Number",h,l)}else if(pct(s,this.#t)){let h=this.#E(s);this.#a=this.#u("String",h,l)}else if(s===47&&this.#s){let h=this.#b(s),b=this.#e.locate();this.#a=this.#u(h.multiline?"BlockComment":"LineComment",h.length,l,{line:b.line,column:b.column+1,offset:b.offset+1})}else this.#f(s);return C_[this.#a.type]}get token(){return this.#a}};var wT={document(a,s={}){return{type:"Document",body:a,loc:s.loc,...s}},string(a,s={}){return{type:"String",value:a,loc:s.loc,...s}},number(a,s={}){return{type:"Number",value:a,loc:s.loc,...s}},boolean(a,s={}){return{type:"Boolean",value:a,loc:s.loc,...s}},null(a={}){return{type:"Null",loc:a.loc,...a}},array(a,s={}){return{type:"Array",elements:a,loc:s.loc,...s}},element(a,s={}){return{type:"Element",value:a,loc:s.loc,...s}},object(a,s={}){return{type:"Object",members:a,loc:s.loc,...s}},member(a,s,l={}){return{type:"Member",name:a,value:s,loc:l.loc,...l}},identifier(a,s={}){return{type:"Identifier",name:a,loc:s.loc,...s}},nan(a="",s={}){return{type:"NaN",sign:a,loc:s.loc,...s}},infinity(a="",s={}){return{type:"Infinity",sign:a,loc:s.loc,...s}}},Atr={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Ntr(a,s,l=!1){let _="",h=a.indexOf("\\"),b=0;for(;h>=0;){_+=a.slice(b,h);let D=a.charAt(h+1),N=D.charCodeAt(0);if(l&&Ale.has(N))_+=Ale.get(N),b=h+2;else if(ZH.has(N))_+=ZH.get(N),b=h+2;else if(D==="u"){let M=a.slice(h+2,h+6);if(M.length<4||/[^0-9a-f]/i.test(M))throw new xA(`Invalid unicode escape \\u${M}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(M,16)),b=h+6}else if(l&&D==="x"){let M=a.slice(h+2,h+4);if(M.length<2||/[^0-9a-f]/i.test(M))throw new xA(`Invalid hex escape \\x${M}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});_+=String.fromCharCode(parseInt(M,16)),b=h+4}else if(l&&T4e.has(N))b=h+2,D==="\r"&&a.charAt(b)===`
578
- `&&b++;else if(l)_+=D,b=h+2;else throw new xA(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Ntr,"getStringValue");function Itr(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Ntr(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Itr,"getLiteralValue");function hct(a,s){s=Object.freeze({...Atr,...s});let l=[],_=new k4e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",b=s.allowTrailingCommas||h;function D(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr}t(D,"nextNoComments");function N(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr>=C_.LineComment?N():Cr}t(N,"nextSkipComments");let M=s.mode==="json"?D:N;function z(Cr,vr){if(Cr!==vr)throw new QF(_.token)}t(z,"assertTokenType");function ne(Cr,vr){if(!vr.includes(Cr))throw new QF(_.token)}t(ne,"assertTokenTypes");function ie(Cr,vr){return s.ranges?{range:[Cr.offset,vr.offset]}:void 0}t(ie,"createRange");function Q(Cr){let vr=_.token,fs=ie(vr.loc.start,vr.loc.end),Fi=Itr(a.slice(vr.loc.start.offset,vr.loc.end.offset),vr,h),di={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...fs};switch(Cr){case C_.String:return wT.string(Fi,di);case C_.Number:return wT.number(Fi,di);case C_.Boolean:return wT.boolean(Fi,di);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(Q,"createLiteralNode");function Me(Cr){let vr=ie(Cr.loc.start,Cr.loc.end),fs=a.slice(Cr.loc.start.offset,Cr.loc.end.offset),Ho={loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr};if(Cr.type!=="Identifier"){let di="";return(fs[0]==="+"||fs[0]==="-")&&(di=fs[0]),wT[fs.includes("NaN")?"nan":"infinity"](di,Ho)}return wT.identifier(fs,Ho)}t(Me,"createJSON5IdentifierNode");function Ne(Cr){let vr=ie(Cr.loc.start,Cr.loc.end);return wT.null({loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr})}t(Ne,"createNullNode");function we(Cr){h?ne(Cr,[C_.String,C_.Identifier,C_.Number]):z(Cr,C_.String);let vr=_.token,fs=Cr===C_.String?Q(Cr):Me(vr);if(h&&(fs.type==="NaN"||fs.type==="Infinity")){if(fs.sign!=="")throw new QF(_.token);fs=wT.identifier(fs.type,{loc:fs.loc,...ie(fs.loc.start,fs.loc.end)})}Cr=M(),z(Cr,C_.Colon);let Fi=Tr(),Ho=ie(fs.loc.start,Fi.loc.end);return wT.member(fs,Fi,{loc:{start:{...fs.loc.start},end:{...Fi.loc.end}},...Ho})}t(we,"parseProperty");function Pt(Cr){z(Cr,C_.LBrace);let vr=_.token,fs=[],Fi=M();if(Fi!==C_.RBrace)do{if(fs.push(we(Fi)),Fi=M(),!Fi)throw new Nle(fs[fs.length-1].loc.end);if(Fi===C_.Comma){if(Fi=M(),b&&Fi===C_.RBrace)break}else break}while(Fi);z(Fi,C_.RBrace);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.object(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(Pt,"parseObject");function xt(Cr){z(Cr,C_.LBracket);let vr=_.token,fs=[],Fi=M();if(Fi!==C_.RBracket)do{let mf=Tr(Fi);if(fs.push(wT.element(mf,{loc:mf.loc})),Fi=M(),Fi===C_.Comma){if(Fi=M(),b&&Fi===C_.RBracket)break}else break}while(Fi);z(Fi,C_.RBracket);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.array(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(xt,"parseArray");function Tr(Cr){Cr=Cr??M();let vr=_.token;switch(Cr){case C_.String:case C_.Boolean:return Q(Cr);case C_.Number:if(h){let fs=a.slice(vr.loc.start.offset,vr.loc.end.offset);if((fs[0]==="+"||fs[0]==="-")&&(fs=fs.slice(1)),fs==="NaN"||fs==="Infinity")return Me(vr)}return Q(Cr);case C_.Null:return Ne(vr);case C_.LBrace:return Pt(Cr);case C_.LBracket:return xt(Cr);default:throw new QF(vr)}}t(Tr,"parseValue");let fn=Tr();if(M())throw new QF(_.token);let cn={loc:{start:{line:1,column:1,offset:0},end:{...fn.loc.end}}};return s.tokens&&(cn.tokens=l),s.ranges&&(cn.range=[cn.loc.start.offset,cn.loc.end.offset]),wT.document(fn,cn)}t(hct,"parse");var Ftr=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function gct(a){return a&&typeof a=="object"}t(gct,"isObject");function Otr(a){return gct(a)&&typeof a.type=="string"}t(Otr,"isNode");function Ltr(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let b of Ftr.get(_.type)){let D=_[b];gct(D)&&(Array.isArray(D)?D.forEach(N=>l(N,_)):Otr(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(Ltr,"traverse");function yct(a,s=()=>!0){let l=[];return Ltr(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(yct,"iterator");import Rtr from"node:fs/promises";var eG=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Ile=t(async a=>{try{return await Rtr.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),tG=t(async a=>{try{return hct(a)}catch(s){if(s.column&&s.line&&s.message){let l=eG(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var vct=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await Ile(_),b=await Mtr(h,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Mtr=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,b=await tG(a);if(b){for(let{node:D}of yct(b))if(D.value&&D.value===l){h=D.loc;break}if(h!==null){let D=eG(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import bct from"node:fs/promises";import HC from"node:path";var w4e="schemas",P4e=".oas.json";var ZF=t(async a=>(await bct.readdir(a)).map(l=>HC.join(a,l)).filter(l=>l.endsWith(P4e)).sort(),"getOpenApiFilesByAlphabetical"),$M=t(async a=>{let s=HC.resolve(a,"config");return(await bct.readdir(s)).filter(_=>_.endsWith(P4e)).length>=1},"oasFileInProject");function rG(a,s,l,_,h,b,D){if(b.has(l))return;let N;try{N=_.get(l)}catch(Ne){throw new z1({text:`Failed to resolve reference: ${l}`,detail:Ne.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}let M=Ole(l),z=HC.basename(M,HC.extname(M)),ne=l.indexOf("#"),ie=ne>=0?l.substring(0,ne):l,Q=ne>=0?l.substring(ne+1):"",Me=_.get(ie);if(Q){let Ne=Q.split("/").filter(Boolean);for(let we of Ne)if(Me=Me[we],Me===void 0)throw new Error(`Cannot resolve JSON pointer: ${Q}`)}if(Me&&typeof Me=="object"&&"$ref"in Me&&typeof Me.$ref=="string"&&!Me.$ref.startsWith("#")){let Ne=HC.resolve(HC.dirname(ie),Me.$ref);M=Ne,z=HC.basename(M,HC.extname(M)),ie=Ne,b.set(ie,h.length),h.push(ie),Fle(M,z,N,_,h,b,D)}else b.set(l,h.length),h.push(l),Fle(Ole(l),s,N,_,h,b,D)}t(rG,"chaseRefs");function Fle(a,s,l,_,h,b,D){if(Array.isArray(l))for(let N of l)Fle(a,s,N,_,h,b,D);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let M=l[N];D&&(l[N]=D(s,M)),rG(a,s,O3(a,M),_,h,b,D)}Fle(a,s,l[N],_,h,b,D)}}t(Fle,"lookForRefs");function O3(a,s){let l=s.indexOf("#");return l>=0?`${HC.resolve(a,s.substring(0,l))}${s.substring(l)}`:HC.resolve(HC.dirname(a),s)}t(O3,"getFullyQualifiedRefName");function Ole(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Ole,"getFilePathNameFromRefName");var vG=x_(q3e(),1);import{readFile as Rar}from"node:fs/promises";var W3e={};bat(W3e,{UnsafePathError:()=>oue,deleteFolder:()=>Lar,dirExists:()=>V3e,fileExists:()=>Ear,getParentDirFilename:()=>Iar,isNotFileOrDirectory:()=>kar,listFolderContents:()=>Gut,listFolders:()=>Par,mkDirTemp:()=>Dar,mkdirForFilePathIfNotExits:()=>Aar,mkdirIfNotExists:()=>Kut,safePath:()=>Nar,tarFolder:()=>Far,untarFile:()=>Oar});import{spawn as Wut}from"node:child_process";import{randomUUID as Tar}from"node:crypto";import $3 from"node:fs/promises";import{platform as xar,tmpdir as Car}from"node:os";import H1 from"node:path";var Hut=[".git","node_modules",".yarn",".DS_Store"];async function Ear(a){try{return(await $3.stat(a)).isFile()}catch{return!1}}t(Ear,"fileExists");async function Dar(){let a=process.env.BUILD_FILE_PATH??Car(),s=Tar().replaceAll("-",""),l=H1.join(a,s);return await $3.mkdir(l,{recursive:!0}),l}t(Dar,"mkDirTemp");async function V3e(a){try{return(await $3.stat(a)).isDirectory()}catch{return!1}}t(V3e,"dirExists");async function kar(a){try{return await $3.stat(a),!1}catch{return!0}}t(kar,"isNotFileOrDirectory");function war(a,s){let l=H1.sep==="\\"?"\\\\":H1.sep,_=new RegExp(`(.*)(${l}${s})$|(.*)(${s}${l})`),h=a.match(_);if(!h)return"";let b=a.split(h[0]);return b[1]===""?"":H1.join(H1.sep,b[1])}t(war,"getParentDirectory");async function Par(a){if(!await V3e(a))return[];let s=await $3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Hut.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Par,"listFolders");async function Gut(a,s,l=!0){let _=war(a,s),h=await $3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of h)if(!Hut.includes(D.name)||!l)if(D.isDirectory()){let N=await Gut(H1.join(a,D.name),s,l);b.push(...N)}else b.push(H1.join(_,D.name));return b}t(Gut,"listFolderContents");var Kut=t(async a=>{await $3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Aar=t(async a=>{let s=H1.dirname(a);return Kut(s)},"mkdirForFilePathIfNotExits"),oue=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Nar(a){let s=H1.normalize(a),l=t(_=>{let h=H1.normalize(_),b=process.platform==="win32",D=!1;if(b?D=h.toLowerCase().startsWith(s.toLowerCase()):D=h.startsWith(s),!D)throw new oue("Resolved path is not part of the project.");return h},"ensureSafePath");return{resolve:t((..._)=>l(H1.resolve(..._)),"resolve")}}t(Nar,"safePath");function Iar(a){return H1.join(H1.basename(H1.dirname(a)),H1.basename(a))}t(Iar,"getParentDirFilename");async function Far({folderPath:a,outputTarPath:s,exclude:l=["node_modules",".git","dist"],logger:_}){let h=[],b=[],D;try{await new Promise((N,M)=>{let z=Wut("tar",[...l.map(ne=>["--exclude",ne]).flat(),...xar()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",a,"."]);z.stdout.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&h.push(ie.trim())}),z.stderr.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&b.push(ie.trim())}),z.on("close",ne=>{D=ne,ne===0?N():M(new Error(`tar process exited with code ${ne}`))}),z.on("error",ne=>{M(ne)})})}catch(N){throw new Error("Failed to tar folder",{cause:N})}finally{_.info({stdout:h.join(`
578
+ `&&b++;else if(l)_+=D,b=h+2;else throw new xA(`Invalid escape \\${D}.`,{line:s.loc.start.line,column:s.loc.start.column+h,offset:s.loc.start.offset+h});h=a.indexOf("\\",b)}return _+=a.slice(b),_}t(Ntr,"getStringValue");function Itr(a,s,l=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Ntr(a.slice(1,-1),s,l);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Itr,"getLiteralValue");function hct(a,s){s=Object.freeze({...Atr,...s});let l=[],_=new k4e(a,{mode:s.mode,ranges:s.ranges}),h=s.mode==="json5",b=s.allowTrailingCommas||h;function D(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr}t(D,"nextNoComments");function N(){let Cr=_.next();return Cr&&s.tokens&&l.push(_.token),Cr>=C_.LineComment?N():Cr}t(N,"nextSkipComments");let M=s.mode==="json"?D:N;function z(Cr,vr){if(Cr!==vr)throw new QF(_.token)}t(z,"assertTokenType");function ne(Cr,vr){if(!vr.includes(Cr))throw new QF(_.token)}t(ne,"assertTokenTypes");function ie(Cr,vr){return s.ranges?{range:[Cr.offset,vr.offset]}:void 0}t(ie,"createRange");function Q(Cr){let vr=_.token,fs=ie(vr.loc.start,vr.loc.end),Fi=Itr(a.slice(vr.loc.start.offset,vr.loc.end.offset),vr,h),di={loc:{start:{...vr.loc.start},end:{...vr.loc.end}},...fs};switch(Cr){case C_.String:return wT.string(Fi,di);case C_.Number:return wT.number(Fi,di);case C_.Boolean:return wT.boolean(Fi,di);default:throw new TypeError(`Unknown token type ${vr.type}.`)}}t(Q,"createLiteralNode");function Me(Cr){let vr=ie(Cr.loc.start,Cr.loc.end),fs=a.slice(Cr.loc.start.offset,Cr.loc.end.offset),Ho={loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr};if(Cr.type!=="Identifier"){let di="";return(fs[0]==="+"||fs[0]==="-")&&(di=fs[0]),wT[fs.includes("NaN")?"nan":"infinity"](di,Ho)}return wT.identifier(fs,Ho)}t(Me,"createJSON5IdentifierNode");function Ne(Cr){let vr=ie(Cr.loc.start,Cr.loc.end);return wT.null({loc:{start:{...Cr.loc.start},end:{...Cr.loc.end}},...vr})}t(Ne,"createNullNode");function we(Cr){h?ne(Cr,[C_.String,C_.Identifier,C_.Number]):z(Cr,C_.String);let vr=_.token,fs=Cr===C_.String?Q(Cr):Me(vr);if(h&&(fs.type==="NaN"||fs.type==="Infinity")){if(fs.sign!=="")throw new QF(_.token);fs=wT.identifier(fs.type,{loc:fs.loc,...ie(fs.loc.start,fs.loc.end)})}Cr=M(),z(Cr,C_.Colon);let Fi=Tr(),Ho=ie(fs.loc.start,Fi.loc.end);return wT.member(fs,Fi,{loc:{start:{...fs.loc.start},end:{...Fi.loc.end}},...Ho})}t(we,"parseProperty");function Pt(Cr){z(Cr,C_.LBrace);let vr=_.token,fs=[],Fi=M();if(Fi!==C_.RBrace)do{if(fs.push(we(Fi)),Fi=M(),!Fi)throw new Nle(fs[fs.length-1].loc.end);if(Fi===C_.Comma){if(Fi=M(),b&&Fi===C_.RBrace)break}else break}while(Fi);z(Fi,C_.RBrace);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.object(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(Pt,"parseObject");function xt(Cr){z(Cr,C_.LBracket);let vr=_.token,fs=[],Fi=M();if(Fi!==C_.RBracket)do{let mf=Tr(Fi);if(fs.push(wT.element(mf,{loc:mf.loc})),Fi=M(),Fi===C_.Comma){if(Fi=M(),b&&Fi===C_.RBracket)break}else break}while(Fi);z(Fi,C_.RBracket);let Ho=_.token,di=ie(vr.loc.start,Ho.loc.end);return wT.array(fs,{loc:{start:{...vr.loc.start},end:{...Ho.loc.end}},...di})}t(xt,"parseArray");function Tr(Cr){Cr=Cr??M();let vr=_.token;switch(Cr){case C_.String:case C_.Boolean:return Q(Cr);case C_.Number:if(h){let fs=a.slice(vr.loc.start.offset,vr.loc.end.offset);if((fs[0]==="+"||fs[0]==="-")&&(fs=fs.slice(1)),fs==="NaN"||fs==="Infinity")return Me(vr)}return Q(Cr);case C_.Null:return Ne(vr);case C_.LBrace:return Pt(Cr);case C_.LBracket:return xt(Cr);default:throw new QF(vr)}}t(Tr,"parseValue");let fn=Tr();if(M())throw new QF(_.token);let cn={loc:{start:{line:1,column:1,offset:0},end:{...fn.loc.end}}};return s.tokens&&(cn.tokens=l),s.ranges&&(cn.range=[cn.loc.start.offset,cn.loc.end.offset]),wT.document(fn,cn)}t(hct,"parse");var Ftr=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function gct(a){return a&&typeof a=="object"}t(gct,"isObject");function Otr(a){return gct(a)&&typeof a.type=="string"}t(Otr,"isNode");function Ltr(a,s){function l(_,h){typeof s.enter=="function"&&s.enter(_,h);for(let b of Ftr.get(_.type)){let D=_[b];gct(D)&&(Array.isArray(D)?D.forEach(N=>l(N,_)):Otr(D)&&l(D,_))}typeof s.exit=="function"&&s.exit(_,h)}t(l,"visitNode"),l(a)}t(Ltr,"traverse");function yct(a,s=()=>!0){let l=[];return Ltr(a,{enter(_,h){l.push({node:_,parent:h,phase:"enter"})},exit(_,h){l.push({node:_,parent:h,phase:"exit"})}}),l.filter(s).values()}t(yct,"iterator");import Rtr from"node:fs/promises";var eG=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Ile=t(async a=>{try{return await Rtr.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),tG=t(async a=>{try{return hct(a)}catch(s){if(s.column&&s.line&&s.message){let l=eG(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:l}}return}},"getSchemaAST");var vct=t(async(a,s,l)=>{try{if(a.length===0)return;for(let _ of a){let h=await Ile(_),b=await Mtr(h,_,s,l);if(b)return b}}catch{}},"getRouteLocationByValue"),Mtr=t(async(a,s,l,_)=>{try{if(!a)return;let h=null,b=await tG(a);if(b){for(let{node:D}of yct(b))if(D.value&&D.value===l){h=D.loc;break}if(h!==null){let D=eG(a,h.start.line);return{file:s,line:h.start.line,column:h.start.column,length:h.end.column-h.start.column,lineText:D,suggestion:_}}}}catch{}},"getRouteLocationByValueFromSchema");import bct from"node:fs/promises";import HC from"node:path";var w4e="schemas",P4e=".oas.json";var ZF=t(async a=>(await bct.readdir(a)).map(l=>HC.join(a,l)).filter(l=>l.endsWith(P4e)).sort(),"getOpenApiFilesByAlphabetical"),$M=t(async a=>{let s=HC.resolve(a,"config");return(await bct.readdir(s)).filter(_=>_.endsWith(P4e)).length>=1},"oasFileInProject");function rG(a,s,l,_,h,b,D){if(b.has(l))return;let N;try{N=_.get(l)}catch(Ne){throw new z1({text:`Failed to resolve reference: ${l}`,detail:Ne.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:l,namespace:s,suggestion:"Check the reference and try again."}})}let M=Ole(l),z=HC.basename(M,HC.extname(M)),ne=l.indexOf("#"),ie=ne>=0?l.substring(0,ne):l,Q=ne>=0?l.substring(ne+1):"",Me=_.get(ie);if(Q){let Ne=Q.split("/").filter(Boolean);for(let we of Ne)if(Me=Me[we],Me===void 0)throw new Error(`Cannot resolve JSON pointer: ${Q}`)}if(Me&&typeof Me=="object"&&"$ref"in Me&&typeof Me.$ref=="string"&&!Me.$ref.startsWith("#")){let Ne=HC.resolve(HC.dirname(ie),Me.$ref);M=Ne,z=HC.basename(M,HC.extname(M)),ie=Ne,b.set(ie,h.length),h.push(ie),Fle(M,z,N,_,h,b,D)}else b.set(l,h.length),h.push(l),Fle(Ole(l),s,N,_,h,b,D)}t(rG,"chaseRefs");function Fle(a,s,l,_,h,b,D){if(Array.isArray(l))for(let N of l)Fle(a,s,N,_,h,b,D);else if(typeof l=="object")for(let N in l){if(N==="$ref"){let M=l[N];D&&(l[N]=D(s,M,a)),rG(a,s,O3(a,M),_,h,b,D)}Fle(a,s,l[N],_,h,b,D)}}t(Fle,"lookForRefs");function O3(a,s){let l=s.indexOf("#");return l>=0?`${HC.resolve(a,s.substring(0,l))}${s.substring(l)}`:HC.resolve(HC.dirname(a),s)}t(O3,"getFullyQualifiedRefName");function Ole(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Ole,"getFilePathNameFromRefName");var vG=x_(q3e(),1);import{readFile as Rar}from"node:fs/promises";var W3e={};bat(W3e,{UnsafePathError:()=>oue,deleteFolder:()=>Lar,dirExists:()=>V3e,fileExists:()=>Ear,getParentDirFilename:()=>Iar,isNotFileOrDirectory:()=>kar,listFolderContents:()=>Gut,listFolders:()=>Par,mkDirTemp:()=>Dar,mkdirForFilePathIfNotExits:()=>Aar,mkdirIfNotExists:()=>Kut,safePath:()=>Nar,tarFolder:()=>Far,untarFile:()=>Oar});import{spawn as Wut}from"node:child_process";import{randomUUID as Tar}from"node:crypto";import $3 from"node:fs/promises";import{platform as xar,tmpdir as Car}from"node:os";import H1 from"node:path";var Hut=[".git","node_modules",".yarn",".DS_Store"];async function Ear(a){try{return(await $3.stat(a)).isFile()}catch{return!1}}t(Ear,"fileExists");async function Dar(){let a=process.env.BUILD_FILE_PATH??Car(),s=Tar().replaceAll("-",""),l=H1.join(a,s);return await $3.mkdir(l,{recursive:!0}),l}t(Dar,"mkDirTemp");async function V3e(a){try{return(await $3.stat(a)).isDirectory()}catch{return!1}}t(V3e,"dirExists");async function kar(a){try{return await $3.stat(a),!1}catch{return!0}}t(kar,"isNotFileOrDirectory");function war(a,s){let l=H1.sep==="\\"?"\\\\":H1.sep,_=new RegExp(`(.*)(${l}${s})$|(.*)(${s}${l})`),h=a.match(_);if(!h)return"";let b=a.split(h[0]);return b[1]===""?"":H1.join(H1.sep,b[1])}t(war,"getParentDirectory");async function Par(a){if(!await V3e(a))return[];let s=await $3.readdir(a,{withFileTypes:!0}),l=[];for await(let _ of s)Hut.includes(_.name)||_.isDirectory()&&l.push(_.name);return l}t(Par,"listFolders");async function Gut(a,s,l=!0){let _=war(a,s),h=await $3.readdir(a,{withFileTypes:!0}),b=[];for await(let D of h)if(!Hut.includes(D.name)||!l)if(D.isDirectory()){let N=await Gut(H1.join(a,D.name),s,l);b.push(...N)}else b.push(H1.join(_,D.name));return b}t(Gut,"listFolderContents");var Kut=t(async a=>{await $3.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Aar=t(async a=>{let s=H1.dirname(a);return Kut(s)},"mkdirForFilePathIfNotExits"),oue=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function Nar(a){let s=H1.normalize(a),l=t(_=>{let h=H1.normalize(_),b=process.platform==="win32",D=!1;if(b?D=h.toLowerCase().startsWith(s.toLowerCase()):D=h.startsWith(s),!D)throw new oue("Resolved path is not part of the project.");return h},"ensureSafePath");return{resolve:t((..._)=>l(H1.resolve(..._)),"resolve")}}t(Nar,"safePath");function Iar(a){return H1.join(H1.basename(H1.dirname(a)),H1.basename(a))}t(Iar,"getParentDirFilename");async function Far({folderPath:a,outputTarPath:s,exclude:l=["node_modules",".git","dist"],logger:_}){let h=[],b=[],D;try{await new Promise((N,M)=>{let z=Wut("tar",[...l.map(ne=>["--exclude",ne]).flat(),...xar()!=="darwin"?["--warning=no-file-changed"]:[],"-cvf",s,"-C",a,"."]);z.stdout.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&h.push(ie.trim())}),z.stderr.on("data",ne=>{let ie=ne.toString().trim();ie.length>0&&b.push(ie.trim())}),z.on("close",ne=>{D=ne,ne===0?N():M(new Error(`tar process exited with code ${ne}`))}),z.on("error",ne=>{M(ne)})})}catch(N){throw new Error("Failed to tar folder",{cause:N})}finally{_.info({stdout:h.join(`
579
579
  `),stderr:b.join(`
580
580
  `),exitCode:D},"Tar process logs")}}t(Far,"tarFolder");async function Oar({tarFilePath:a,outputDir:s,logger:l}){let _=[],h=[],b;try{await new Promise((D,N)=>{let M=Wut("sh",["-c",`tar -xvf ${a} -C ${s};`]);M.stdout.on("data",z=>{let ne=z.toString().trim();ne.length>0&&_.push(ne.trim())}),M.stderr.on("data",z=>{let ne=z.toString().trim();ne.length>0&&h.push(ne.trim())}),M.on("close",z=>{b=z,z===0?D():N(new Error(`tar process exited with code ${z}`))}),M.on("error",z=>{N(z)})})}catch(D){throw new Error("Failed to untar file",{cause:D})}finally{l.info({stdout:_.join(`
581
581
  `),stderr:h.join(`
@@ -608,10 +608,10 @@ globstar while`,s,Q,l,Me,Ne),this.matchOne(s.slice(Q),l.slice(Me),_))return this
608
608
  `,D):(a.write("/*"),Zgr(a,D.value,l,_),a.write("*/"+_))}}t(X1,"formatComments");function e0r(a){let s=a;for(;s!=null;){let{type:l}=s;if(l[0]==="C"&&l[1]==="a")return!0;if(l[0]==="M"&&l[1]==="e"&&l[2]==="m")s=s.object;else return!1}}t(e0r,"hasCallExpression");function dFe(a,s){let{generator:l}=a,{declarations:_}=s;a.write(s.kind+" ");let{length:h}=_;if(h>0){l.VariableDeclarator(_[0],a);for(let b=1;b<h;b++)a.write(", "),l.VariableDeclarator(_[b],a)}}t(dFe,"formatVariableDeclaration");var Bht,Uht,$ht,zht,Jht,qht,t0r={Program(a,s){let l=s.indent.repeat(s.indentLevel),{lineEnd:_,writeComments:h}=s;h&&a.comments!=null&&X1(s,a.comments,l,_);let b=a.body,{length:D}=b;for(let N=0;N<D;N++){let M=b[N];h&&M.comments!=null&&X1(s,M.comments,l,_),s.write(l),this[M.type](M,s),s.write(_)}h&&a.trailingComments!=null&&X1(s,a.trailingComments,l,_)},BlockStatement:qht=t(function(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s,b=l+s.indent;s.write("{");let D=a.body;if(D!=null&&D.length>0){s.write(_),h&&a.comments!=null&&X1(s,a.comments,b,_);let{length:N}=D;for(let M=0;M<N;M++){let z=D[M];h&&z.comments!=null&&X1(s,z.comments,b,_),s.write(b),this[z.type](z,s),s.write(_)}s.write(l)}else h&&a.comments!=null&&(s.write(_),X1(s,a.comments,b,_),s.write(l));h&&a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write("}"),s.indentLevel--},"BlockStatement"),ClassBody:qht,StaticBlock(a,s){s.write("static "),this.BlockStatement(a,s)},EmptyStatement(a,s){s.write(";")},ExpressionStatement(a,s){let l=s.expressionsPrecedence[a.expression.type];l===lE||l===3&&a.expression.left.type[0]==="O"?(s.write("("),this[a.expression.type](a.expression,s),s.write(")")):this[a.expression.type](a.expression,s),s.write(";")},IfStatement(a,s){s.write("if ("),this[a.test.type](a.test,s),s.write(") "),this[a.consequent.type](a.consequent,s),a.alternate!=null&&(s.write(" else "),this[a.alternate.type](a.alternate,s))},LabeledStatement(a,s){this[a.label.type](a.label,s),s.write(": "),this[a.body.type](a.body,s)},BreakStatement(a,s){s.write("break"),a.label!=null&&(s.write(" "),this[a.label.type](a.label,s)),s.write(";")},ContinueStatement(a,s){s.write("continue"),a.label!=null&&(s.write(" "),this[a.label.type](a.label,s)),s.write(";")},WithStatement(a,s){s.write("with ("),this[a.object.type](a.object,s),s.write(") "),this[a.body.type](a.body,s)},SwitchStatement(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s;s.indentLevel++;let b=l+s.indent,D=b+s.indent;s.write("switch ("),this[a.discriminant.type](a.discriminant,s),s.write(") {"+_);let{cases:N}=a,{length:M}=N;for(let z=0;z<M;z++){let ne=N[z];h&&ne.comments!=null&&X1(s,ne.comments,b,_),ne.test?(s.write(b+"case "),this[ne.test.type](ne.test,s),s.write(":"+_)):s.write(b+"default:"+_);let{consequent:ie}=ne,{length:Q}=ie;for(let Me=0;Me<Q;Me++){let Ne=ie[Me];h&&Ne.comments!=null&&X1(s,Ne.comments,D,_),s.write(D),this[Ne.type](Ne,s),s.write(_)}}s.indentLevel-=2,s.write(l+"}")},ReturnStatement(a,s){s.write("return"),a.argument&&(s.write(" "),this[a.argument.type](a.argument,s)),s.write(";")},ThrowStatement(a,s){s.write("throw "),this[a.argument.type](a.argument,s),s.write(";")},TryStatement(a,s){if(s.write("try "),this[a.block.type](a.block,s),a.handler){let{handler:l}=a;l.param==null?s.write(" catch "):(s.write(" catch ("),this[l.param.type](l.param,s),s.write(") ")),this[l.body.type](l.body,s)}a.finalizer&&(s.write(" finally "),this[a.finalizer.type](a.finalizer,s))},WhileStatement(a,s){s.write("while ("),this[a.test.type](a.test,s),s.write(") "),this[a.body.type](a.body,s)},DoWhileStatement(a,s){s.write("do "),this[a.body.type](a.body,s),s.write(" while ("),this[a.test.type](a.test,s),s.write(");")},ForStatement(a,s){if(s.write("for ("),a.init!=null){let{init:l}=a;l.type[0]==="V"?dFe(s,l):this[l.type](l,s)}s.write("; "),a.test&&this[a.test.type](a.test,s),s.write("; "),a.update&&this[a.update.type](a.update,s),s.write(") "),this[a.body.type](a.body,s)},ForInStatement:Bht=t(function(a,s){s.write(`for ${a.await?"await ":""}(`);let{left:l}=a;l.type[0]==="V"?dFe(s,l):this[l.type](l,s),s.write(a.type[3]==="I"?" in ":" of "),this[a.right.type](a.right,s),s.write(") "),this[a.body.type](a.body,s)},"ForInStatement"),ForOfStatement:Bht,DebuggerStatement(a,s){s.write("debugger;",a)},FunctionDeclaration:Uht=t(function(a,s){s.write((a.async?"async ":"")+(a.generator?"function* ":"function ")+(a.id?a.id.name:""),a),Lj(s,a.params),s.write(" "),this[a.body.type](a.body,s)},"FunctionDeclaration"),FunctionExpression:Uht,VariableDeclaration(a,s){dFe(s,a),s.write(";")},VariableDeclarator(a,s){this[a.id.type](a.id,s),a.init!=null&&(s.write(" = "),this[a.init.type](a.init,s))},ClassDeclaration(a,s){if(s.write("class "+(a.id?`${a.id.name} `:""),a),a.superClass){s.write("extends ");let{superClass:l}=a,{type:_}=l,h=s.expressionsPrecedence[_];(_[0]!=="C"||_[1]!=="l"||_[5]!=="E")&&(h===lE||h<s.expressionsPrecedence.ClassExpression)?(s.write("("),this[a.superClass.type](l,s),s.write(")")):this[l.type](l,s),s.write(" ")}this.ClassBody(a.body,s)},ImportDeclaration(a,s){s.write("import ");let{specifiers:l,attributes:_}=a,{length:h}=l,b=0;if(h>0){for(;b<h;){b>0&&s.write(", ");let D=l[b],N=D.type[6];if(N==="D")s.write(D.local.name,D),b++;else if(N==="N")s.write("* as "+D.local.name,D),b++;else break}if(b<h){for(s.write("{");;){let D=l[b],{name:N}=D.imported;if(s.write(N,D),N!==D.local.name&&s.write(" as "+D.local.name),++b<h)s.write(", ");else break}s.write("}")}s.write(" from ")}if(this.Literal(a.source,s),_&&_.length>0){s.write(" with { ");for(let D=0;D<_.length;D++)this.ImportAttribute(_[D],s),D<_.length-1&&s.write(", ");s.write(" }")}s.write(";")},ImportAttribute(a,s){this.Identifier(a.key,s),s.write(": "),this.Literal(a.value,s)},ImportExpression(a,s){s.write("import("),this[a.source.type](a.source,s),s.write(")")},ExportDefaultDeclaration(a,s){s.write("export default "),this[a.declaration.type](a.declaration,s),s.expressionsPrecedence[a.declaration.type]!=null&&a.declaration.type[0]!=="F"&&s.write(";")},ExportNamedDeclaration(a,s){if(s.write("export "),a.declaration)this[a.declaration.type](a.declaration,s);else{s.write("{");let{specifiers:l}=a,{length:_}=l;if(_>0)for(let h=0;;){let b=l[h],{name:D}=b.local;if(s.write(D,b),D!==b.exported.name&&s.write(" as "+b.exported.name),++h<_)s.write(", ");else break}if(s.write("}"),a.source&&(s.write(" from "),this.Literal(a.source,s)),a.attributes&&a.attributes.length>0){s.write(" with { ");for(let h=0;h<a.attributes.length;h++)this.ImportAttribute(a.attributes[h],s),h<a.attributes.length-1&&s.write(", ");s.write(" }")}s.write(";")}},ExportAllDeclaration(a,s){if(a.exported!=null?s.write("export * as "+a.exported.name+" from "):s.write("export * from "),this.Literal(a.source,s),a.attributes&&a.attributes.length>0){s.write(" with { ");for(let l=0;l<a.attributes.length;l++)this.ImportAttribute(a.attributes[l],s),l<a.attributes.length-1&&s.write(", ");s.write(" }")}s.write(";")},MethodDefinition(a,s){a.static&&s.write("static ");let l=a.kind[0];(l==="g"||l==="s")&&s.write(a.kind+" "),a.value.async&&s.write("async "),a.value.generator&&s.write("*"),a.computed?(s.write("["),this[a.key.type](a.key,s),s.write("]")):this[a.key.type](a.key,s),Lj(s,a.value.params),s.write(" "),this[a.value.body.type](a.value.body,s)},ClassExpression(a,s){this.ClassDeclaration(a,s)},ArrowFunctionExpression(a,s){s.write(a.async?"async ":"",a);let{params:l}=a;l!=null&&(l.length===1&&l[0].type[0]==="I"?s.write(l[0].name,l[0]):Lj(s,a.params)),s.write(" => "),a.body.type[0]==="O"?(s.write("("),this.ObjectExpression(a.body,s),s.write(")")):this[a.body.type](a.body,s)},ThisExpression(a,s){s.write("this",a)},Super(a,s){s.write("super",a)},RestElement:$ht=t(function(a,s){s.write("..."),this[a.argument.type](a.argument,s)},"RestElement"),SpreadElement:$ht,YieldExpression(a,s){s.write(a.delegate?"yield*":"yield"),a.argument&&(s.write(" "),this[a.argument.type](a.argument,s))},AwaitExpression(a,s){s.write("await ",a),Rfe(s,a.argument,a)},TemplateLiteral(a,s){let{quasis:l,expressions:_}=a;s.write("`");let{length:h}=_;for(let D=0;D<h;D++){let N=_[D],M=l[D];s.write(M.value.raw,M),s.write("${"),this[N.type](N,s),s.write("}")}let b=l[l.length-1];s.write(b.value.raw,b),s.write("`")},TemplateElement(a,s){s.write(a.value.raw,a)},TaggedTemplateExpression(a,s){Rfe(s,a.tag,a),this[a.quasi.type](a.quasi,s)},ArrayExpression:Jht=t(function(a,s){if(s.write("["),a.elements.length>0){let{elements:l}=a,{length:_}=l;for(let h=0;;){let b=l[h];if(b!=null&&this[b.type](b,s),++h<_)s.write(", ");else{b==null&&s.write(", ");break}}}s.write("]")},"ArrayExpression"),ArrayPattern:Jht,ObjectExpression(a,s){let l=s.indent.repeat(s.indentLevel++),{lineEnd:_,writeComments:h}=s,b=l+s.indent;if(s.write("{"),a.properties.length>0){s.write(_),h&&a.comments!=null&&X1(s,a.comments,b,_);let D=","+_,{properties:N}=a,{length:M}=N;for(let z=0;;){let ne=N[z];if(h&&ne.comments!=null&&X1(s,ne.comments,b,_),s.write(b),this[ne.type](ne,s),++z<M)s.write(D);else break}s.write(_),h&&a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write(l+"}")}else h?a.comments!=null?(s.write(_),X1(s,a.comments,b,_),a.trailingComments!=null&&X1(s,a.trailingComments,b,_),s.write(l+"}")):a.trailingComments!=null?(s.write(_),X1(s,a.trailingComments,b,_),s.write(l+"}")):s.write("}"):s.write("}");s.indentLevel--},Property(a,s){a.method||a.kind[0]!=="i"?this.MethodDefinition(a,s):(a.shorthand||(a.computed?(s.write("["),this[a.key.type](a.key,s),s.write("]")):this[a.key.type](a.key,s),s.write(": ")),this[a.value.type](a.value,s))},PropertyDefinition(a,s){if(a.static&&s.write("static "),a.computed&&s.write("["),this[a.key.type](a.key,s),a.computed&&s.write("]"),a.value==null){a.key.type[0]!=="F"&&s.write(";");return}s.write(" = "),this[a.value.type](a.value,s),s.write(";")},ObjectPattern(a,s){if(s.write("{"),a.properties.length>0){let{properties:l}=a,{length:_}=l;for(let h=0;this[l[h].type](l[h],s),++h<_;)s.write(", ")}s.write("}")},SequenceExpression(a,s){Lj(s,a.expressions)},UnaryExpression(a,s){if(a.prefix){let{operator:l,argument:_,argument:{type:h}}=a;s.write(l);let b=Vht(s,_,a);!b&&(l.length>1||h[0]==="U"&&(h[1]==="n"||h[1]==="p")&&_.prefix&&_.operator[0]===l&&(l==="+"||l==="-"))&&s.write(" "),b?(s.write(l.length>1?" (":"("),this[h](_,s),s.write(")")):this[h](_,s)}else this[a.argument.type](a.argument,s),s.write(a.operator)},UpdateExpression(a,s){a.prefix?(s.write(a.operator),this[a.argument.type](a.argument,s)):(this[a.argument.type](a.argument,s),s.write(a.operator))},AssignmentExpression(a,s){this[a.left.type](a.left,s),s.write(" "+a.operator+" "),this[a.right.type](a.right,s)},AssignmentPattern(a,s){this[a.left.type](a.left,s),s.write(" = "),this[a.right.type](a.right,s)},BinaryExpression:zht=t(function(a,s){let l=a.operator==="in";l&&s.write("("),Rfe(s,a.left,a,!1),s.write(" "+a.operator+" "),Rfe(s,a.right,a,!0),l&&s.write(")")},"BinaryExpression"),LogicalExpression:zht,ConditionalExpression(a,s){let{test:l}=a,_=s.expressionsPrecedence[l.type];_===lE||_<=s.expressionsPrecedence.ConditionalExpression?(s.write("("),this[l.type](l,s),s.write(")")):this[l.type](l,s),s.write(" ? "),this[a.consequent.type](a.consequent,s),s.write(" : "),this[a.alternate.type](a.alternate,s)},NewExpression(a,s){s.write("new ");let l=s.expressionsPrecedence[a.callee.type];l===lE||l<s.expressionsPrecedence.CallExpression||e0r(a.callee)?(s.write("("),this[a.callee.type](a.callee,s),s.write(")")):this[a.callee.type](a.callee,s),Lj(s,a.arguments)},CallExpression(a,s){let l=s.expressionsPrecedence[a.callee.type];l===lE||l<s.expressionsPrecedence.CallExpression?(s.write("("),this[a.callee.type](a.callee,s),s.write(")")):this[a.callee.type](a.callee,s),a.optional&&s.write("?."),Lj(s,a.arguments)},ChainExpression(a,s){this[a.expression.type](a.expression,s)},MemberExpression(a,s){let l=s.expressionsPrecedence[a.object.type];l===lE||l<s.expressionsPrecedence.MemberExpression?(s.write("("),this[a.object.type](a.object,s),s.write(")")):this[a.object.type](a.object,s),a.computed?(a.optional&&s.write("?."),s.write("["),this[a.property.type](a.property,s),s.write("]")):(a.optional?s.write("?."):s.write("."),this[a.property.type](a.property,s))},MetaProperty(a,s){s.write(a.meta.name+"."+a.property.name,a)},Identifier(a,s){s.write(a.name,a)},PrivateIdentifier(a,s){s.write(`#${a.name}`,a)},Literal(a,s){a.raw!=null?s.write(a.raw,a):a.regex!=null?this.RegExpLiteral(a,s):a.bigint!=null?s.write(a.bigint+"n",a):s.write(Xgr(a.value),a)},RegExpLiteral(a,s){let{regex:l}=a;s.write(`/${l.pattern}/${l.flags}`,a)}},r0r={};var mFe=class{static{t(this,"State")}constructor(s){let l=s??r0r;this.output="",l.output!=null?(this.output=l.output,this.write=this.writeToStream):this.output="",this.generator=l.generator!=null?l.generator:t0r,this.expressionsPrecedence=l.expressionsPrecedence!=null?l.expressionsPrecedence:Qgr,this.indent=l.indent!=null?l.indent:" ",this.lineEnd=l.lineEnd!=null?l.lineEnd:`
609
609
  `,this.indentLevel=l.startingIndentLevel!=null?l.startingIndentLevel:0,this.writeComments=l.comments?l.comments:!1,l.sourceMap!=null&&(this.write=l.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=l.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
610
610
  `).length-1,this.mapping={original:null,generated:this,name:void 0,source:l.sourceMap.file||l.sourceMap._file})}write(s){this.output+=s}writeToStream(s){this.output.write(s)}writeAndMap(s,l){this.output+=s,this.map(s,l)}writeToStreamAndMap(s,l){this.output.write(s),this.map(s,l)}map(s,l){if(l!=null){let{type:b}=l;if(b[0]==="L"&&b[2]==="n"){this.column=0,this.line++;return}if(l.loc!=null){let{mapping:D}=this;D.original=l.loc.start,D.name=l.name,this.sourceMap.addMapping(D)}if(b[0]==="T"&&b[8]==="E"||b[0]==="L"&&b[1]==="i"&&typeof l.value=="string"){let{length:D}=s,{column:N,line:M}=this;for(let z=0;z<D;z++)s[z]===`
611
- `?(N=0,M++):N++;this.column=N,this.line=M;return}}let{length:_}=s,{lineEnd:h}=this;_>0&&(this.lineEndSize>0&&(h.length===1?s[_-1]===h:s.endsWith(h))?(this.line+=this.lineEndSize,this.column=0):this.column+=_)}toString(){return this.output}};function Wht(a,s){let l=new mFe(s);return l.generator[a.type](a,l),l.output}t(Wht,"generate");async function hFe({oasFiles:a,sourceDirectory:s,logger:l}){let _=await s0r({oasFiles:a,sourceDirectory:s,logger:l});return Wht(_)}t(hFe,"generateRawRouteSource");async function s0r({oasFiles:a,sourceDirectory:s,logger:l}){let _=new z3(s,l),h=[];for(let D of a){let N=i0r.basename(D,".oas.json"),M=await _.resolve(D),z=[],ne=new Map,ie=await n0r.readFile(D,"utf-8"),Q=JSON.parse(ie);for(let Me in Q.paths){let Ne=Q.paths[Me];for(let we in Ne){if(we.startsWith("x-"))continue;let Pt={...Ne[we],...Ne[we].description&&{description:Ne[we].description.length>350?Ne[we].description.substring(0,350).trim()+"...":Ne[we].description}},xt=bG(N,Me,we),Tr=Mfe(D,N,Pt,M,z,ne);h.unshift(Ght(xt,Tr))}}h.unshift(...a0r(N,M,z,ne).reverse())}return{type:"Program",body:h,sourceType:"module"}}t(s0r,"generateAst");function Mfe(a,s,l,_,h,b){let D=[];for(let N in l){let M=l[N];if(N==="$ref")return rG(a,s,O3(a,M),_,h,b),{type:"Identifier",name:Kht(s,b.get(O3(a,M)))};let z;switch(typeof M){case"string":case"number":case"boolean":z={type:"Literal",value:M};break;default:Array.isArray(M)?z=Hht(M,a,s,_,h,b):typeof M=="object"&&M!==null&&(z={type:"ObjectExpression",properties:Mfe(a,s,M,_,h,b).properties||[]});break}if(z){let ne=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(N),ie=ne?{type:"Identifier",name:N}:{type:"Literal",value:N};D.push({type:"Property",key:ie,value:z,kind:"init",method:!1,shorthand:!1,computed:!ne})}}return{type:"ObjectExpression",properties:D}}t(Mfe,"processNode");function Hht(a,s,l,_,h,b){return{type:"ArrayExpression",elements:a.map(D=>{if(Array.isArray(D))return Hht(D,s,l,_,h,b);if(typeof D=="object"&&D!==null){let N=Mfe(s,l,D,_,h,b);return N.type==="Identifier"?N:{type:"ObjectExpression",properties:N.properties||[]}}else return{type:"Literal",value:D}})}}t(Hht,"processArray");function Ght(a,s){return{type:"ExportNamedDeclaration",declaration:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:s}],kind:"var"},specifiers:[],source:null}}t(Ght,"createExportedConstAssignment");function a0r(a,s,l,_){let h=[];for(let b=0;b<l.length;b++){let D=Kht(a,b),N=s.get(l[b]),M=Mfe(Ole(l[b]),a,N,s,l,_);h.push(Ght(D,M))}return h}t(a0r,"generateRefs");function Kht(a,s){return`${wA(a)}__ref__${s}`}t(Kht,"getRefIdentifierName");import Yht from"node:path";var Xht=t(a=>{let s=null;if(a.value.type==="Object"&&a.value.members.length>0)for(let l of a.value.members){let _=Xht(l);if(_!==null&&(s=_),l.name.value==="enum"&&l.value.type==="Array"&&l.value.elements.length===0){let h=l.value,b=h.loc.start.line,D=h.loc.start.column,N=h.loc.end.column;s={line:b,column:D,length:N-D,lineText:""}}}return s},"findEmptyEnums"),o0r=t(a=>{if(a.startsWith("schema with key or id")&&a.endsWith("already exists"))return"Update your schema's '$id' to be unique across your project.";if(a.includes("All JSON schemas must use version 2020-12"))return"All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html";if(a==='"nullable" cannot be used without "type"')return'Property "nullable" can only be used when property "type" value is "object".';if(a==='NOT SUPPORTED: keyword "id", use "$id" for schema ID')return'Replace keyword "id" with "$id" when defining a schema Id.';if(a.startsWith("can't resolve reference http"))return"Cannot resolve remote references, try adding them directly to the schema file or as a schema file in the project.";if(a.startsWith("can't resolve reference"))return"Make sure all references are defined in the schema.";if(a.includes("oneOf must NOT have fewer than 1 items"))return'Property "oneOf" must have at least 1 item configured.';if(a.includes("enum must have non-empty array"))return'Property "enum" must be configured with at least one value.';if(a.includes("Unexpected")&&a.includes("in JSON at position"))return"Update your schema to only use valid properties."},"getSuggestions"),gFe=t(async(a,s,l)=>{if(!a)return null;let _={file:Yht.join(w4e,a),suggestion:o0r(l)},h=Yht.join(s,w4e),b=ou.safePath(s).resolve(h,a),D=await Ile(b);if(l.includes("enum must have non-empty array")){if(D){let N=await tG(D);if(N&&N.body.members!==null)for(let M of N.body.members){let z=Xht(M);z&&z!==null&&(_=Object.assign(_??{},z))}if(_){let M=_.line?_.line:0;_.lineText=eG(D,M)}}}else if(l.includes("Unexpected")&&l.includes("in JSON at position")&&D){let N=await tG(D);N&&"lineText"in N&&(_=Object.assign(_??{},N))}return _},"getLocation");import*as $1t from"esbuild";import J7e,{dirname as j1t}from"node:path";import{fileURLToPath as B1t}from"node:url";var c0r=!1;function Rj(a,s){return{open:`\x1B[${a.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Rj,"code");function Mj(a,s){return c0r?`${s.open}${a.replace(s.regexp,s.open)}${s.close}`:a}t(Mj,"run");function l0r(a){return Mj(a,Rj([31],39))}t(l0r,"red");function u0r(a){return Mj(a,Rj([32],39))}t(u0r,"green");function f0r(a){return Mj(a,Rj([33],39))}t(f0r,"yellow");function _0r(a){return Mj(a,Rj([34],39))}t(_0r,"blue");function p0r(a){return Mj(a,Rj([35],39))}t(p0r,"magenta");function d0r(a){return Mj(a,Rj([36],39))}t(d0r,"cyan");var DRr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Qht=[l0r,u0r,f0r,_0r,p0r,d0r];function m0r(a){let s=0,l=a.length,_=0;if(l>0)for(;_<l;)s=(s<<5)-s+a.charCodeAt(_++)|0;return s}t(m0r,"hashCode");function Zht(a){let s=Math.abs(m0r(a));return Qht[s%Qht.length]}t(Zht,"generateColor");import{inspect as h0r}from"node:util";function egt(a,s,...l){let _=0,h=l.length,b=String(s).replace(/%[sdjoO%]/g,D=>{if(D==="%%")return"%";if(_>=h)return D;switch(D){case"%s":return String(l[_++]);case"%d":return Number(l[_++]).toString();case"%o":return a(l[_++]).split(`
611
+ `?(N=0,M++):N++;this.column=N,this.line=M;return}}let{length:_}=s,{lineEnd:h}=this;_>0&&(this.lineEndSize>0&&(h.length===1?s[_-1]===h:s.endsWith(h))?(this.line+=this.lineEndSize,this.column=0):this.column+=_)}toString(){return this.output}};function Wht(a,s){let l=new mFe(s);return l.generator[a.type](a,l),l.output}t(Wht,"generate");async function hFe({oasFiles:a,sourceDirectory:s,logger:l}){let _=await s0r({oasFiles:a,sourceDirectory:s,logger:l});return Wht(_)}t(hFe,"generateRawRouteSource");async function s0r({oasFiles:a,sourceDirectory:s,logger:l}){let _=new z3(s,l),h=[];for(let D of a){let N=i0r.basename(D,".oas.json"),M=await _.resolve(D),z=[],ne=new Map,ie=await n0r.readFile(D,"utf-8"),Q=JSON.parse(ie);for(let Me in Q.paths){let Ne=Q.paths[Me];for(let we in Ne){if(we.startsWith("x-"))continue;let Pt={...Ne[we],...Ne[we].description&&{description:Ne[we].description.length>350?Ne[we].description.substring(0,350).trim()+"...":Ne[we].description}},xt=bG(N,Me,we),Tr=Mfe(D,N,Pt,M,z,ne);h.unshift(Ght(xt,Tr))}}h.unshift(...a0r(N,M,z,ne).reverse())}return{type:"Program",body:h,sourceType:"module"}}t(s0r,"generateAst");function Mfe(a,s,l,_,h,b){let D=[];for(let N in l){let M=l[N];if(N==="$ref")return rG(a,s,O3(a,M),_,h,b),{type:"Identifier",name:Kht(s,b.get(O3(a,M)))};let z;switch(typeof M){case"string":case"number":case"boolean":z={type:"Literal",value:M};break;default:Array.isArray(M)?z=Hht(M,a,s,_,h,b):typeof M=="object"&&M!==null&&(z=Mfe(a,s,M,_,h,b));break}if(z){let ne=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(N),ie=ne?{type:"Identifier",name:N}:{type:"Literal",value:N};D.push({type:"Property",key:ie,value:z,kind:"init",method:!1,shorthand:!1,computed:!ne})}}return{type:"ObjectExpression",properties:D}}t(Mfe,"processNode");function Hht(a,s,l,_,h,b){return{type:"ArrayExpression",elements:a.map(D=>{if(Array.isArray(D))return Hht(D,s,l,_,h,b);if(typeof D=="object"&&D!==null){let N=Mfe(s,l,D,_,h,b);return N.type==="Identifier"?N:{type:"ObjectExpression",properties:N.properties||[]}}else return{type:"Literal",value:D}})}}t(Hht,"processArray");function Ght(a,s){return{type:"ExportNamedDeclaration",declaration:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:a},init:s}],kind:"var"},specifiers:[],source:null}}t(Ght,"createExportedConstAssignment");function a0r(a,s,l,_){let h=[];for(let b=0;b<l.length;b++){let D=Kht(a,b),N=s.get(l[b]),M=Mfe(Ole(l[b]),a,N,s,l,_);h.push(Ght(D,M))}return h}t(a0r,"generateRefs");function Kht(a,s){return`${wA(a)}__ref__${s}`}t(Kht,"getRefIdentifierName");import Yht from"node:path";var Xht=t(a=>{let s=null;if(a.value.type==="Object"&&a.value.members.length>0)for(let l of a.value.members){let _=Xht(l);if(_!==null&&(s=_),l.name.value==="enum"&&l.value.type==="Array"&&l.value.elements.length===0){let h=l.value,b=h.loc.start.line,D=h.loc.start.column,N=h.loc.end.column;s={line:b,column:D,length:N-D,lineText:""}}}return s},"findEmptyEnums"),o0r=t(a=>{if(a.startsWith("schema with key or id")&&a.endsWith("already exists"))return"Update your schema's '$id' to be unique across your project.";if(a.includes("All JSON schemas must use version 2020-12"))return"All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html";if(a==='"nullable" cannot be used without "type"')return'Property "nullable" can only be used when property "type" value is "object".';if(a==='NOT SUPPORTED: keyword "id", use "$id" for schema ID')return'Replace keyword "id" with "$id" when defining a schema Id.';if(a.startsWith("can't resolve reference http"))return"Cannot resolve remote references, try adding them directly to the schema file or as a schema file in the project.";if(a.startsWith("can't resolve reference"))return"Make sure all references are defined in the schema.";if(a.includes("oneOf must NOT have fewer than 1 items"))return'Property "oneOf" must have at least 1 item configured.';if(a.includes("enum must have non-empty array"))return'Property "enum" must be configured with at least one value.';if(a.includes("Unexpected")&&a.includes("in JSON at position"))return"Update your schema to only use valid properties."},"getSuggestions"),gFe=t(async(a,s,l)=>{if(!a)return null;let _={file:Yht.join(w4e,a),suggestion:o0r(l)},h=Yht.join(s,w4e),b=ou.safePath(s).resolve(h,a),D=await Ile(b);if(l.includes("enum must have non-empty array")){if(D){let N=await tG(D);if(N&&N.body.members!==null)for(let M of N.body.members){let z=Xht(M);z&&z!==null&&(_=Object.assign(_??{},z))}if(_){let M=_.line?_.line:0;_.lineText=eG(D,M)}}}else if(l.includes("Unexpected")&&l.includes("in JSON at position")&&D){let N=await tG(D);N&&"lineText"in N&&(_=Object.assign(_??{},N))}return _},"getLocation");import*as $1t from"esbuild";import J7e,{dirname as j1t}from"node:path";import{fileURLToPath as B1t}from"node:url";var c0r=!1;function Rj(a,s){return{open:`\x1B[${a.join(";")}m`,close:`\x1B[${s}m`,regexp:new RegExp(`\\x1b\\[${s}m`,"g")}}t(Rj,"code");function Mj(a,s){return c0r?`${s.open}${a.replace(s.regexp,s.open)}${s.close}`:a}t(Mj,"run");function l0r(a){return Mj(a,Rj([31],39))}t(l0r,"red");function u0r(a){return Mj(a,Rj([32],39))}t(u0r,"green");function f0r(a){return Mj(a,Rj([33],39))}t(f0r,"yellow");function _0r(a){return Mj(a,Rj([34],39))}t(_0r,"blue");function p0r(a){return Mj(a,Rj([35],39))}t(p0r,"magenta");function d0r(a){return Mj(a,Rj([36],39))}t(d0r,"cyan");var DRr=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var Qht=[l0r,u0r,f0r,_0r,p0r,d0r];function m0r(a){let s=0,l=a.length,_=0;if(l>0)for(;_<l;)s=(s<<5)-s+a.charCodeAt(_++)|0;return s}t(m0r,"hashCode");function Zht(a){let s=Math.abs(m0r(a));return Qht[s%Qht.length]}t(Zht,"generateColor");import{inspect as h0r}from"node:util";function egt(a,s,...l){let _=0,h=l.length,b=String(s).replace(/%[sdjoO%]/g,D=>{if(D==="%%")return"%";if(_>=h)return D;switch(D){case"%s":return String(l[_++]);case"%d":return Number(l[_++]).toString();case"%o":return a(l[_++]).split(`
612
612
  `).map(N=>N.trim()).join(" ");case"%O":return a(l[_++]);case"%j":try{return JSON.stringify(l[_++])}catch{return"[Circular]"}default:return D}});for(let D of l.splice(_))D===null||!(typeof D=="object"&&D!==null)?b+=" "+D:b+=" "+a(D);return b}t(egt,"format");var tgt=t((a,...s)=>egt(h0r,a,s),"format");var yFe=class{static{t(this,"Debugger")}manager;ns;color;last;enabled;constructor(s,l){this.manager=s,this.ns=l,this.color=Zht(l),this.last=0,this.enabled=s.enabled.some(_=>_.test(l))}log(...s){if(!this.enabled)return;let l,_=s[0];typeof _=="function"?l=_():l=String(_);let h=Date.now()-(this.last||Date.now());l=tgt(l,...s);let b=`${this.color(this.ns)} ${l} ${this.color(`+${h}ms`)}`;console.log(b),this.last=Date.now()}},vFe=class{static{t(this,"DebugManager")}debuggers;enabled;constructor(s){this.debuggers=new Map,this.enabled=s??[]}};function g0r(a){return!a||a.length===0?[]:(a=a.replace(/\s/g,"").replace(/\*/g,".+"),a.split(",").map(s=>new RegExp(`^${s}$`)))}t(g0r,"extract");var jfe;function rgt(a){jfe||(jfe=new vFe(g0r(process.env.DEBUG)));let s=new yFe(jfe,a);return jfe.debuggers.set(a,s),Object.assign(s.log.bind(s),{self:s})}t(rgt,"debug");var bFe=class{static{t(this,"Environment")}get DEV_SERVER_PORT(){return process.env.DEV_SERVER_PORT?parseInt(process.env.DEV_SERVER_PORT):3e3}get DEBUG_BUILD_MODE(){return!!process.env.DEBUG_BUILD_MODE}get USE_MONOREPO_PACKAGES(){return process.env.USE_MONOREPO_PACKAGES==="true"}get EXPERIMENTAL_CODEGEN(){return!!process.env.EXPERIMENTAL_CODEGEN}get NODE_ENV(){return process.env.NODE_ENV}isProduction(){return this.NODE_ENV==="production"}isLocalDevelopment(){return process.env.ZUPLO_IS_LOCAL_DEVELOPMENT==="true"}},y0r=new bFe,Om=y0r;var SFe="no-remote-module";function ngt({logger:a}){return{name:SFe,async setup(s){s.onResolve({filter:/^https?:\/\//},l=>(a.error(l,"User attempted to load a remote module"),{errors:[{text:`Remote modules are not supported. Attempted to load module ${l.path}`,detail:"InvalidRemoteModule",pluginName:SFe,location:{line:0,column:0,file:""}}],pluginName:SFe}))}}}t(ngt,"blockRemoteModulePlugin");import x0r from"node:fs/promises";import Bfe from"node:path";import{performance as uE}from"node:perf_hooks";var TK=[];async function v0r(a,s){let l=uE.now();try{return await s()}finally{let _=uE.now()-l;TK.push({name:a,duration:_})}}t(v0r,"timeFn");var b0r={mark:t(a=>{uE.mark(a)},"mark"),measure:t((a,s,l)=>{try{uE.measure(a,s,l)}finally{uE.clearMarks(s),uE.clearMarks(l),uE.clearMeasures(a)}},"measure"),timeFn:v0r,report:t(()=>{if(TK.length>0){let a=TK.reduce((s,{name:l,duration:_})=>(s[l]=`${_.toFixed(0)}ms`,s),{});console.table(a),TK.length=0}},"report"),getDuration:t(a=>{let s=uE.getEntriesByName(a);if(s.length===0)return 0;let l=s[0].duration;return uE.clearMeasures(a),l},"getDuration"),clear:t(()=>{TK.length=0,uE.clearMarks(),uE.clearMeasures()},"clear")},Bu=b0r;import{writeFile as S0r}from"node:fs/promises";async function Sk(a,s){await ou.mkdirForFilePathIfNotExits(a);let l=await import("prettier"),_=s;try{_=await l.format(s,{parser:"babel"})}catch{}await S0r(a,_,"utf-8")}t(Sk,"writeDebugSourceFile");import{readFile as T0r}from"node:fs/promises";import xK from"node:path";async function TFe(a){let s=`${a}/config/dev-portal.json`,l=!0,_;if(await ou.fileExists(s)){try{let b=await T0r(s,"utf-8"),D=JSON.parse(b);D.enabled===!1&&(l=!1),_=D.sitePathname}catch{}return{enabled:l,type:"dev-portal",basePath:_}}let h=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"];for(;h.length;){let b=h.pop();if(b){let D=xK.join(a,"docs",b);if(await ou.fileExists(D))return{enabled:!0,type:"zudoku"}}}return{enabled:!1,type:void 0}}t(TFe,"getDevPortalConfig");function jj(a,s){let l=xK.resolve(a,GF);return Object.keys(s?.outputs??{}).map(b=>{let D=xK.normalize(b);return`./${xK.relative(l,D).split(xK.sep).join("/")}`})}t(jj,"getBuildModules");var igt="/docs",C0r="/__zuplo/dev-portal";function E0r(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(E0r,"normalizePathname");function D0r(a){let s={sitePathname:a?.sitePathname===C0r?igt:a?.sitePathname?E0r(a.sitePathname):igt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
613
613
  export default devPortal;`}t(D0r,"generateSource");function sgt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},l=>({namespace:"dev-portal-json",path:Bfe.isAbsolute(l.path)?l.path:Bfe.join(l.resolveDir,l.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async l=>Bu.timeFn("Generating dev-portal.json data",async()=>{let _,h,b=[],D=await TFe(a.sourceDirectory);if(D.type==="zudoku")_={version:"zudoku",enabled:!1,sitePathname:void 0};else if(D.type==="dev-portal"){h=await x0r.readFile(l.path,"utf-8");try{_=JSON.parse(h)}catch(M){b.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:M.message,location:null}]})}}let N;try{if(N=D0r(_),Om.DEBUG_BUILD_MODE&&N){let M=Bfe.join(a.sourceDirectory,".zuplo","dev-portal.js");await Sk(M,N)}}catch(M){b.push({id:"dev-portal-build-error",text:M.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:M.message,location:null}]})}return{contents:N,errors:b,pluginName:"dev-portal",loader:"js",resolveDir:Bfe.dirname(l.path),watchFiles:[l.path]}}))}}}t(sgt,"devPortalConfigPlugin");import agt from"node:path";var ogt="legacy-environment",cgt="legacy-environment",k0r=`import { environment } from "@zuplo/runtime";
614
- export default environment;`;function lgt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:cgt,pluginName:ogt,path:agt.join(a.sourceDirectory,A3,"environment.js")})),s.onLoad({filter:/.*/,namespace:cgt},async l=>({contents:k0r,loader:"ts",resolveDir:agt.dirname(l.path),pluginName:ogt}))}}}t(lgt,"environmentPlugin");import kTr from"node:fs/promises";import GT from"node:path";var b1t=x_(f7e(),1),S1t=x_(zyt(),1),T1t=x_(R7e(),1),x1t=x_(M7e(),1);var wk="schemas",S_e="json-schema";function C1t(a){return{name:wk,async setup(s){let l=new T1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),_=GT.join(a.sourceDirectory,IH),h=[],b=[],D;await Bu.timeFn("Initializing schema validation",async()=>{if((0,S1t.default)(l,{mode:"fast"}),l.opts.code.formats=b1t._`require("ajv-formats/dist/formats").fastFormats`,await ou.dirExists(_)&&(l.addKeyword("faker"),D=(await ou.listFolderContents(_,IH)).sort(),await Promise.all(D.map(async N=>{try{let M=ou.safePath(a.sourceDirectory).resolve(_,N);if(!M.startsWith(_))throw new Error("All schemas must be in the schemas directory");let z=await kTr.readFile(M,"utf-8");if(z===""||z===void 0)throw new Error(`Schema 'schemas/${N}' is empty and will be ignored.`);let ne=JSON.parse(z);if(ne.$schema&&ne.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${N}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(l.addSchema(ne,N),l.errors?.length){let ie=l.errors[0];h.push({id:"json-schema-validation-error",pluginName:wk,text:`Error: ${ie.message}`,location:{file:GT.join(IH,N)},detail:{params:ie.params,propertyName:ie.propertyName,schemaPath:ie.schemaPath,data:ie.data}})}}catch(M){if(M.message.endsWith("is empty and will be ignored.")){b.push({id:"empty-json-schema-file",pluginName:wk,text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let z=await gFe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-add-error",pluginName:wk,text:`Error: ${M.message}`,location:z,detail:"InvalidAddSchemaError",notes:[{text:M.message}]})}})),await Promise.all(D.map(async N=>{try{let M=l.getSchema(N);M&&l.compile(M.schema).errors?.forEach(ne=>{h.push({text:`Failed to compile ${N}: ${ne.message}`})})}catch(M){let z=await gFe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-compile-error",pluginName:wk,text:`The schema file '${N}' is not valid. Error: ${M.message}`,location:z,detail:"InvalidSchemaError",notes:[{text:M.message}]})}})),Om.DEBUG_BUILD_MODE)){let N=GT.resolve(a.outputDirectory,IH);await ou.mkdirIfNotExists(N)}}),s.onStart(async()=>{if(D)return{errors:h,warnings:b}}),s.onResolve({filter:/schemas\/.*\.json$/},async N=>Bu.timeFn("Generating JSON schemas...",async()=>{let M=GT.isAbsolute(N.path)?N.path:GT.join(N.resolveDir,N.path);if(N.importer&&N.namespace!=="open-api-routes-json")return{path:M};if(!await ou.fileExists(M)){let z="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${N.path}' from ${z}`,location:{file:GT.join(N.resolveDir,z),namespace:S_e,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${z}`,suggestion:""},detail:"RouteReferenceError",pluginName:wk,notes:[{text:`Unable to resolve reference to '${N.path}' from ${z}`,location:null}]}],namespace:S_e,path:M,pluginName:wk}}return{path:M,namespace:S_e,pluginName:wk}})),s.onLoad({filter:/.*/,namespace:S_e},async N=>Bu.timeFn(`Generating json schema data: ${GT.basename(N.path)}`,async()=>{let M=[],z;try{let ne=GT.relative(_,N.path),ie=l.getSchema(ne);if(!ie)throw new Error(`Could not load schema at ${N.path}`);z=ie.source?.validateCode;let Q=l.compile(ie.schema);z=(0,x1t.default)(l,Q)}catch(ne){M.push({pluginName:wk,text:`Cannot parse project's schemas/${GT.basename(N.path)} file. Error: ${ne.message}`,location:null,notes:[{text:ne.message,location:null}],detail:ne})}if(Om.DEBUG_BUILD_MODE&&z){let ne=GT.relative(_,N.path),ie=GT.join(a.sourceDirectory,".zuplo",`${ne}.js`);await Sk(ie,z)}return{contents:z,errors:M,pluginName:wk,resolveDir:GT.dirname(N.path),watchFiles:[N.path]}}))}}}t(C1t,"jsonSchemaPlugin");import{relative as wTr}from"node:path";var E1t=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],PTr="nodejs-compat-plugin";function D1t({sourceDirectory:a}){return{name:PTr,setup(s){let l=new Set;s.onStart(()=>{l.clear()}),s.onResolve({filter:/node:.*/},async({path:_,kind:h,resolveDir:b,...D})=>{let N=`${_}:${h}:${b}:${D.importer}`;if(l.has(N))return;l.add(N);let M=await s.resolve(_,{kind:h,resolveDir:b,importer:D.importer});return M.errors.length>0?E1t.includes(_)||_.includes("/")&&E1t.includes(_.split("/")[0])?{external:!0}:{external:!0,warnings:M.errors.map(ne=>({...ne,location:{file:wTr(a,D.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${_}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:M})}}}t(D1t,"nodejsCompatPlugin");import k1t from"node:fs/promises";import gE from"node:path";var pN="open-api-routes-plugin",rY="open-api-routes-json";function w1t(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/zuplo:routes$/},l=>({watchFiles:[...j7e(gE.join(a.sourceDirectory,lb),[".oas.json"],!0),gE.join(a.sourceDirectory,lb,ile)],namespace:rY,path:gE.isAbsolute(l.path)?l.path:gE.join(l.resolveDir,l.path),pluginName:pN})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:rY},async l=>Bu.timeFn("Generating route data...",async()=>{async function _(){let b=gE.resolve(a.sourceDirectory,"config"),D=await ZF(b),N=`$import(.${l.path.replace(/^../,"")})`;return{location:await vct(D,N,"Update your route configuration to use code from the 'modules' folder"),originalImportValue:N}}t(_,"getLocation");let h=gE.join(l.resolveDir,`${l.path}.ts`);if(l.path.endsWith(".ts")){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference '${D}' in ${b?.file??"OpenAPI file"}. Imports must NOT include the '.ts' file extension.`,location:b,detail:"RouteReferenceError",pluginName:pN}],namespace:rY,path:l.path,pluginName:pN}}else if(!await ou.fileExists(h)){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference in route. Unable to resolve reference to '${D}' in ${b?.file??"OpenAPI file"}`,location:b,detail:"RouteReferenceError",pluginName:pN}],namespace:rY,path:l.path,pluginName:pN}}})),s.onLoad({filter:/.*/,namespace:rY},async l=>Bu.timeFn("Generating route.json data",async()=>{let _=gE.resolve(a.sourceDirectory,"config"),h=await ZF(_),b=await Promise.all(h.map(async z=>({content:await k1t.readFile(z,"utf-8"),fileName:z}))),D=gE.resolve(_,"policies.json");if(!await ou.fileExists(D))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:pN,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:pN};let N={content:await k1t.readFile(D,"utf-8"),fileName:D},M;try{M=await pFe({sourceDirectory:a.sourceDirectory,oasContent:b,policiesContent:N,compatibilityDate:a.compatibilityDate,checkForDuplicateRoutes:a.flags?.checkForDuplicateRoutes??!0})}catch(z){throw new Error("Error compiling routes: "+z.message)}if(Om.DEBUG_BUILD_MODE&&M.content){let z=gE.join(a.sourceDirectory,".zuplo"),ne=gE.resolve(z,"routes.js");await Sk(ne,M.content)}return{contents:M.content,errors:M.errors,pluginName:pN,resolveDir:gE.dirname(l.path),watchFiles:[l.path]}}))}}}t(w1t,"openApiRoutesPlugin");import T_e from"node:path";var nY="raw-route-plugin",P1t="raw-route";function A1t(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/zuplo:raw-routes$/},l=>({namespace:P1t,path:l.path,pluginName:nY})),s.onLoad({filter:/.*/,namespace:P1t},async l=>Bu.timeFn("Building route data",async()=>{let _=T_e.resolve(a.sourceDirectory,lb);if(!await ou.dirExists(_))return{loader:"js",resolveDir:T_e.dirname(l.path),pluginName:nY};let h=await ZF(_);try{let b=await hFe({oasFiles:h,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Om.DEBUG_BUILD_MODE&&b){let D=T_e.join(a.sourceDirectory,".zuplo","raw-routes.js");await Sk(D,b)}return{contents:b,loader:"js",resolveDir:T_e.dirname(l.path),pluginName:nY}}catch(b){if(b instanceof z1)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:b.issue.text,location:b.issue.location,detail:b.issue.detail,pluginName:nY}],pluginName:nY};throw b}}))}}}t(A1t,"rawRoutePlugin");import ATr from"node:fs/promises";import B7e from"node:path";var x_e="runtime-config",N1t="runtime-config-plugin";function I1t(){return{name:x_e,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:N1t,path:B7e.isAbsolute(s.path)?s.path:B7e.join(s.resolveDir,s.path),pluginName:x_e})),a.onLoad({filter:/.*/,namespace:N1t},async s=>Bu.timeFn("Generating zuplo.runtime.ts data",async()=>{let l="export const runtimeInit = undefined;",_=[];return await ou.fileExists(s.path)?(l=await ATr.readFile(s.path,"utf-8"),{contents:l,loader:"ts",resolveDir:B7e.dirname(s.path),errors:_,pluginName:x_e,watchFiles:[s.path]}):{contents:l,loader:"ts",errors:_,pluginName:x_e}}))}}}t(I1t,"runtimeConfigPlugin");import z7e from"node:fs/promises";import MO from"node:path";var O1t=x_(R7e(),1),L1t=x_(M7e(),1);var U7e="schema-validation-plugin",F1t="schema-validation",NTr="module.exports = {}";function R1t(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/zuplo:schema-validations$/},l=>({namespace:F1t,path:l.path,pluginName:U7e})),s.onLoad({filter:/.*/,namespace:F1t},async l=>Bu.timeFn("Validating schemas",async()=>{let _=MO.resolve(a.sourceDirectory,lb,"policies.json");if(!await ou.fileExists(_))return{contents:NTr,loader:"js",resolveDir:MO.dirname(l.path),pluginName:U7e};let h=await FTr(a.sourceDirectory),b=MO.resolve(a.sourceDirectory,lb),D=await ZF(b),N=await MTr(D,h),M=await ITr({oasFiles:D,routesWithSchemaValidation:N,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Om.DEBUG_BUILD_MODE&&M){let z=MO.join(a.sourceDirectory,".zuplo","schema-validation.js");await Sk(z,M)}return{contents:M,loader:"js",resolveDir:MO.dirname(l.path),pluginName:U7e}}))}}}t(R1t,"schemaValidationPlugin");async function ITr({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:l,logger:_}){let h="",b=new z3(l,_);if(s.length===0)return h;let D=new O1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let N of a){let M=await z7e.readFile(N,"utf-8"),z=MO.basename(N,".oas.json"),ne=s.filter(we=>we.fileName===z),ie=await b.resolve(N),Q=JSON.parse(M),Me=[],Ne=new Map;ne.forEach(we=>{let Pt=Q.paths[we.path][we.method];if(Pt.requestBody){let xt;if(Pt.requestBody.$ref){let Tr=Pt.requestBody.$ref;xt=ie.get(Tr)?.content}else Pt.requestBody.content&&(xt=Pt.requestBody.content);if(xt)for(let Tr in xt){let fn=xt[Tr].schema,tn=Y3e(we.path,we.method,Tr);fn.$id=tn,D.addSchema(fn),$7e(fn,N,z,D,ie,Me,Ne)}}if(Pt.parameters)for(let xt of Pt.parameters){let Tr=xt.$ref?ie.get(xt.$ref):xt,fn=Tr.schema.$ref?ie.get(Tr.schema.$ref):Tr.schema,tn=K3e(we.path,we.method,Tr.in,Tr.name);fn.$id=tn,D.addSchema(fn),$7e(Tr,N,z,D,ie,Me,Ne)}});for(let we of Me){let Pt=ie.get(we),xt=SG(z,we);D.addSchema(Pt,xt)}}return h=(0,L1t.default)(D),h}t(ITr,"schemaValidationSource");function $7e(a,s,l,_,h,b,D){for(let N in a){let M=a[N];if(N==="$ref"){let z=SG(l,O3(s,M));a[N]=z,rG(s,l,O3(s,M),h,b,D,(ne,ie)=>SG(ne,O3(s,ie)))}else typeof M=="object"&&$7e(M,s,l,_,h,b,D)}}t($7e,"addRefsToSchema");async function FTr(a){let s=new Set(["RequestValidationInboundPolicy"]),l=await z7e.readFile(`${a}/config/policies.json`,"utf-8"),_=JSON.parse(l);return OTr(_,s)}t(FTr,"getPolicyNamesUsingSchemaValidationPolicies");function OTr(a,s){let l=new Set;a.policies?.forEach(h=>{h.handler?.export&&s.has(h.handler.export)&&h.handler.module==="$import(@zuplo/runtime)"&&l.add(h.name)});let _=LTr(a,l);return new Set([...l,..._])}t(OTr,"getPolicyNamesReferencingPolicyHandlers");function LTr(a,s){let l=new Set;return a.policies?.forEach(_=>{_.handler?.export==="CompositeInboundPolicy"&&_.handler?.options?.policies?.forEach(h=>{s.has(h)&&l.add(_.name)})}),l}t(LTr,"getCompositePoliciesContainingPolicy");function RTr(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let l=a["x-zuplo-route"].policies.inbound;if(l){for(let h of l)if(s.has(h))return!0}let _=a["x-zuplo-route"].policies.outbound;if(_){for(let h of _)if(s.has(h))return!0}return!1}t(RTr,"isPolicyPresentInOperation");async function MTr(a,s){let l=[];for(let _ of a){let h=await z7e.readFile(_,"utf-8"),D=JSON.parse(h).paths;for(let N in D){let M=D[N];for(let z in M){let ne=M[z];RTr(ne,s)&&l.push({fileName:MO.basename(_,".oas.json"),path:N,method:z})}}}return l}t(MTr,"getRoutesContainingPolicies");import{mkdirSync as jTr,writeFileSync as BTr}from"node:fs";import UTr from"node:path";function M1t(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async l=>{if(l){let _=jj(a.sourceDirectory,l.metafile);jTr(a.outputDirectory,{recursive:!0}),BTr(UTr.join(a.outputDirectory,"modules.json"),JSON.stringify(_,null,2))}})}}}t(M1t,"writeModulesPlugin");var $Tr=rgt("zuplo:core:build"),zTr=["workerd","worker","browser"],U1t=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],J7e.resolve(j1t(B1t(import.meta.url)),"..","..","..","node_modules"),J7e.resolve(j1t(B1t(import.meta.url)),"..","..","..","..","..","node_modules")];async function iY({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,compatibilityDate:h,logger:b,minify:D=!0,command:N,flags:M}){let z=J7e.join(a,ale);$Tr(`Building with node paths: ${U1t.join(", ")}`);let ne=D&&N!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},ie=Object.freeze({sourceDirectory:l,outputDirectory:s,cacheDirectory:_,logger:b,debugMode:Om.DEBUG_BUILD_MODE,flags:M,compatibilityDate:h});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:U1t,entryPoints:[z],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...ne,external:[],logLevel:"silent",conditions:zTr,plugins:[lgt(ie),ngt(ie),w1t(ie),A1t(ie),R1t(ie),I1t(),sgt(ie),C1t(ie),D1t(ie),M1t(ie)]}}t(iY,"getBaseESBuildConfig");var jO="run-esbuild",z1t=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,buildId:h,logger:b,config:D,command:N,minify:M},{data:z}){b.debug("Running esbuild");let ne=await iY({command:N,minify:M,systemDirectory:a,outputDirectory:s,cacheDirectory:_,sourceDirectory:l,logger:b,flags:D.flags,compatibilityDate:D.compatibilityDate}),ie;try{if(!await $M(l))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");ie=await $1t.build(ne),z.set("metafile",ie.metafile)}catch(Ne){if(b.error(Ne),Ne.errors||Ne.warnings)ie=Ne;else if(Ne.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))ie={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:jO,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw Ne}ie.errors.length>0&&ie.errors.length>1&&(ie.errors.length=1);let{errors:Q,warnings:Me}=q7e({buildId:h,result:ie});return{errors:Q,warnings:Me}},"runEsbuild");function q7e({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(_=>_.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Zce,pluginName:_.pluginName||jO}:{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:Zce,pluginName:_.pluginName||jO}),errors:s.errors.map(_=>({location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:U6e,pluginName:_.pluginName||jO})),metafile:s.metafile}}t(q7e,"esbuildResultToBuildResult");var JTr=t((a,s)=>{let l=s;if(s.includes(a)){let _=new RegExp(`.*(${a})`,"g");l=s.replace(_,"")}return l.match(/^(\/)?(\.\.(\/)?)+/)&&(l=l.replace(/^(\/)?(\.\.(\/)?)+/,"/")),l},"removePrefixFromString"),qTr=t((a,s)=>{let l=s;if(l.includes(a)){let _=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");l=l.replace(_,"")}return l},"cleanFilePathsInMessage"),J1t=t((a,s,l)=>{if(!a||a.length<=0)return a;let _=a.filter(h=>h.message!=='Could not resolve "@zuplo/runtime"');return _&&_.length>0&&_.forEach(h=>{try{h.location&&h.location.file&&(h.location.file=JTr(s,h.location.file)),h.location&&h.location.lineText&&h.location.lineText.includes("@zuplo/core/index.minified.js")&&(h.location.lineText=h.location.lineText.substring(0,200)+"...<Truncated>"),h.message=qTr(s,h.message),h.notes&&h.notes.length>0&&delete h.notes,h.text&&delete h.text,h.pluginName===""&&(h.pluginName=l)}catch{}}),_},"cleanDataOnBuildIssue");function q1t(a,s){let l=V7e.basename(s);a.errors&&(a.errors=J1t(a.errors,l,jO)),a.warnings&&(a.warnings=J1t(a.warnings,l,jO))}t(q1t,"formatBuildResult");var VTr=t(a=>V7e.basename(a).startsWith("."),"isHiddenOnUnix"),WTr=t((a,s=[])=>s.map(l=>l.startsWith(".")?l:`.${l}`).some(l=>a.endsWith(l)),"hasMatchingExtname");function j7e(a,s=[],l=!1){let _=[],h;if(!C_e.existsSync(a)){let b;if(QH.hasMagic(a))b=a;else{let D=s.map(N=>N.startsWith(".")?N:`.${N}`).join("|");b=`${a}+(${D})`}if(_.push(...QH.sync(b,{nodir:!0})),!_.length)throw Error(`Cannot find any files matching pattern "${a}"`);return _}try{if(h=C_e.statSync(a),h.isFile())return[a]}catch{return[]}return C_e.readdirSync(a).forEach(b=>{let D=V7e.join(a,b),N;try{if(N=C_e.statSync(D),N.isDirectory()){l&&_.push(...j7e(D,s,l));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!N.isFile()||!WTr(D,s)||VTr(D)||_.push(D)}),_}t(j7e,"lookupFiles");var KT=new rle,Pk=` ${KT.gray("|")} `;function U$r(a,s){a.info(KT.green(s))}t(U$r,"outputSuccess");function $$r(a,s){a.warn(KT.yellow(s))}t($$r,"outputWarning");function z$r(a,s){a.error(`
614
+ export default environment;`;function lgt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:cgt,pluginName:ogt,path:agt.join(a.sourceDirectory,A3,"environment.js")})),s.onLoad({filter:/.*/,namespace:cgt},async l=>({contents:k0r,loader:"ts",resolveDir:agt.dirname(l.path),pluginName:ogt}))}}}t(lgt,"environmentPlugin");import kTr from"node:fs/promises";import GT from"node:path";var b1t=x_(f7e(),1),S1t=x_(zyt(),1),T1t=x_(R7e(),1),x1t=x_(M7e(),1);var wk="schemas",S_e="json-schema";function C1t(a){return{name:wk,async setup(s){let l=new T1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),_=GT.join(a.sourceDirectory,IH),h=[],b=[],D;await Bu.timeFn("Initializing schema validation",async()=>{if((0,S1t.default)(l,{mode:"fast"}),l.opts.code.formats=b1t._`require("ajv-formats/dist/formats").fastFormats`,await ou.dirExists(_)&&(l.addKeyword("faker"),D=(await ou.listFolderContents(_,IH)).sort(),await Promise.all(D.map(async N=>{try{let M=ou.safePath(a.sourceDirectory).resolve(_,N);if(!M.startsWith(_))throw new Error("All schemas must be in the schemas directory");let z=await kTr.readFile(M,"utf-8");if(z===""||z===void 0)throw new Error(`Schema 'schemas/${N}' is empty and will be ignored.`);let ne=JSON.parse(z);if(ne.$schema&&ne.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${N}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(l.addSchema(ne,N),l.errors?.length){let ie=l.errors[0];h.push({id:"json-schema-validation-error",pluginName:wk,text:`Error: ${ie.message}`,location:{file:GT.join(IH,N)},detail:{params:ie.params,propertyName:ie.propertyName,schemaPath:ie.schemaPath,data:ie.data}})}}catch(M){if(M.message.endsWith("is empty and will be ignored.")){b.push({id:"empty-json-schema-file",pluginName:wk,text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${N}' is empty and will be ignored.`,location:{file:`schemas/${N}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let z=await gFe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-add-error",pluginName:wk,text:`Error: ${M.message}`,location:z,detail:"InvalidAddSchemaError",notes:[{text:M.message}]})}})),await Promise.all(D.map(async N=>{try{let M=l.getSchema(N);M&&l.compile(M.schema).errors?.forEach(ne=>{h.push({text:`Failed to compile ${N}: ${ne.message}`})})}catch(M){let z=await gFe(N,a.sourceDirectory,M.message);h.push({id:"json-schema-compile-error",pluginName:wk,text:`The schema file '${N}' is not valid. Error: ${M.message}`,location:z,detail:"InvalidSchemaError",notes:[{text:M.message}]})}})),Om.DEBUG_BUILD_MODE)){let N=GT.resolve(a.outputDirectory,IH);await ou.mkdirIfNotExists(N)}}),s.onStart(async()=>{if(D)return{errors:h,warnings:b}}),s.onResolve({filter:/schemas\/.*\.json$/},async N=>Bu.timeFn("Generating JSON schemas...",async()=>{let M=GT.isAbsolute(N.path)?N.path:GT.join(N.resolveDir,N.path);if(N.importer&&N.namespace!=="open-api-routes-json")return{path:M};if(!await ou.fileExists(M)){let z="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${N.path}' from ${z}`,location:{file:GT.join(N.resolveDir,z),namespace:S_e,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${z}`,suggestion:""},detail:"RouteReferenceError",pluginName:wk,notes:[{text:`Unable to resolve reference to '${N.path}' from ${z}`,location:null}]}],namespace:S_e,path:M,pluginName:wk}}return{path:M,namespace:S_e,pluginName:wk}})),s.onLoad({filter:/.*/,namespace:S_e},async N=>Bu.timeFn(`Generating json schema data: ${GT.basename(N.path)}`,async()=>{let M=[],z;try{let ne=GT.relative(_,N.path),ie=l.getSchema(ne);if(!ie)throw new Error(`Could not load schema at ${N.path}`);z=ie.source?.validateCode;let Q=l.compile(ie.schema);z=(0,x1t.default)(l,Q)}catch(ne){M.push({pluginName:wk,text:`Cannot parse project's schemas/${GT.basename(N.path)} file. Error: ${ne.message}`,location:null,notes:[{text:ne.message,location:null}],detail:ne})}if(Om.DEBUG_BUILD_MODE&&z){let ne=GT.relative(_,N.path),ie=GT.join(a.sourceDirectory,".zuplo",`${ne}.js`);await Sk(ie,z)}return{contents:z,errors:M,pluginName:wk,resolveDir:GT.dirname(N.path),watchFiles:[N.path]}}))}}}t(C1t,"jsonSchemaPlugin");import{relative as wTr}from"node:path";var E1t=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],PTr="nodejs-compat-plugin";function D1t({sourceDirectory:a}){return{name:PTr,setup(s){let l=new Set;s.onStart(()=>{l.clear()}),s.onResolve({filter:/node:.*/},async({path:_,kind:h,resolveDir:b,...D})=>{let N=`${_}:${h}:${b}:${D.importer}`;if(l.has(N))return;l.add(N);let M=await s.resolve(_,{kind:h,resolveDir:b,importer:D.importer});return M.errors.length>0?E1t.includes(_)||_.includes("/")&&E1t.includes(_.split("/")[0])?{external:!0}:{external:!0,warnings:M.errors.map(ne=>({...ne,location:{file:wTr(a,D.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${_}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:M})}}}t(D1t,"nodejsCompatPlugin");import k1t from"node:fs/promises";import gE from"node:path";var pN="open-api-routes-plugin",rY="open-api-routes-json";function w1t(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/zuplo:routes$/},l=>({watchFiles:[...j7e(gE.join(a.sourceDirectory,lb),[".oas.json"],!0),gE.join(a.sourceDirectory,lb,ile)],namespace:rY,path:gE.isAbsolute(l.path)?l.path:gE.join(l.resolveDir,l.path),pluginName:pN})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:rY},async l=>Bu.timeFn("Generating route data...",async()=>{async function _(){let b=gE.resolve(a.sourceDirectory,"config"),D=await ZF(b),N=`$import(.${l.path.replace(/^../,"")})`;return{location:await vct(D,N,"Update your route configuration to use code from the 'modules' folder"),originalImportValue:N}}t(_,"getLocation");let h=gE.join(l.resolveDir,`${l.path}.ts`);if(l.path.endsWith(".ts")){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference '${D}' in ${b?.file??"OpenAPI file"}. Imports must NOT include the '.ts' file extension.`,location:b,detail:"RouteReferenceError",pluginName:pN}],namespace:rY,path:l.path,pluginName:pN}}else if(!await ou.fileExists(h)){let{location:b,originalImportValue:D}=await _();return{errors:[{id:"route-build-error",text:`Invalid handler reference in route. Unable to resolve reference to '${D}' in ${b?.file??"OpenAPI file"}`,location:b,detail:"RouteReferenceError",pluginName:pN}],namespace:rY,path:l.path,pluginName:pN}}})),s.onLoad({filter:/.*/,namespace:rY},async l=>Bu.timeFn("Generating route.json data",async()=>{let _=gE.resolve(a.sourceDirectory,"config"),h=await ZF(_),b=await Promise.all(h.map(async z=>({content:await k1t.readFile(z,"utf-8"),fileName:z}))),D=gE.resolve(_,"policies.json");if(!await ou.fileExists(D))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:pN,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:pN};let N={content:await k1t.readFile(D,"utf-8"),fileName:D},M;try{M=await pFe({sourceDirectory:a.sourceDirectory,oasContent:b,policiesContent:N,compatibilityDate:a.compatibilityDate,checkForDuplicateRoutes:a.flags?.checkForDuplicateRoutes??!0})}catch(z){throw new Error("Error compiling routes: "+z.message)}if(Om.DEBUG_BUILD_MODE&&M.content){let z=gE.join(a.sourceDirectory,".zuplo"),ne=gE.resolve(z,"routes.js");await Sk(ne,M.content)}return{contents:M.content,errors:M.errors,pluginName:pN,resolveDir:gE.dirname(l.path),watchFiles:[l.path]}}))}}}t(w1t,"openApiRoutesPlugin");import T_e from"node:path";var nY="raw-route-plugin",P1t="raw-route";function A1t(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/zuplo:raw-routes$/},l=>({namespace:P1t,path:l.path,pluginName:nY})),s.onLoad({filter:/.*/,namespace:P1t},async l=>Bu.timeFn("Building route data",async()=>{let _=T_e.resolve(a.sourceDirectory,lb);if(!await ou.dirExists(_))return{loader:"js",resolveDir:T_e.dirname(l.path),pluginName:nY};let h=await ZF(_);try{let b=await hFe({oasFiles:h,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Om.DEBUG_BUILD_MODE&&b){let D=T_e.join(a.sourceDirectory,".zuplo","raw-routes.js");await Sk(D,b)}return{contents:b,loader:"js",resolveDir:T_e.dirname(l.path),pluginName:nY}}catch(b){if(b instanceof z1)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:b.issue.text,location:b.issue.location,detail:b.issue.detail,pluginName:nY}],pluginName:nY};throw b}}))}}}t(A1t,"rawRoutePlugin");import ATr from"node:fs/promises";import B7e from"node:path";var x_e="runtime-config",N1t="runtime-config-plugin";function I1t(){return{name:x_e,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:N1t,path:B7e.isAbsolute(s.path)?s.path:B7e.join(s.resolveDir,s.path),pluginName:x_e})),a.onLoad({filter:/.*/,namespace:N1t},async s=>Bu.timeFn("Generating zuplo.runtime.ts data",async()=>{let l="export const runtimeInit = undefined;",_=[];return await ou.fileExists(s.path)?(l=await ATr.readFile(s.path,"utf-8"),{contents:l,loader:"ts",resolveDir:B7e.dirname(s.path),errors:_,pluginName:x_e,watchFiles:[s.path]}):{contents:l,loader:"ts",errors:_,pluginName:x_e}}))}}}t(I1t,"runtimeConfigPlugin");import z7e from"node:fs/promises";import MO from"node:path";var O1t=x_(R7e(),1),L1t=x_(M7e(),1);var U7e="schema-validation-plugin",F1t="schema-validation",NTr="module.exports = {}";function R1t(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/zuplo:schema-validations$/},l=>({namespace:F1t,path:l.path,pluginName:U7e})),s.onLoad({filter:/.*/,namespace:F1t},async l=>Bu.timeFn("Validating schemas",async()=>{let _=MO.resolve(a.sourceDirectory,lb,"policies.json");if(!await ou.fileExists(_))return{contents:NTr,loader:"js",resolveDir:MO.dirname(l.path),pluginName:U7e};let h=await FTr(a.sourceDirectory),b=MO.resolve(a.sourceDirectory,lb),D=await ZF(b),N=await MTr(D,h),M=await ITr({oasFiles:D,routesWithSchemaValidation:N,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Om.DEBUG_BUILD_MODE&&M){let z=MO.join(a.sourceDirectory,".zuplo","schema-validation.js");await Sk(z,M)}return{contents:M,loader:"js",resolveDir:MO.dirname(l.path),pluginName:U7e}}))}}}t(R1t,"schemaValidationPlugin");async function ITr({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:l,logger:_}){let h="",b=new z3(l,_);if(s.length===0)return h;let D=new O1t.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let N of a){let M=await z7e.readFile(N,"utf-8"),z=MO.basename(N,".oas.json"),ne=s.filter(we=>we.fileName===z),ie=await b.resolve(N),Q=JSON.parse(M),Me=[],Ne=new Map;ne.forEach(we=>{let Pt=Q.paths[we.path][we.method];if(Pt.requestBody){let xt;if(Pt.requestBody.$ref){let Tr=Pt.requestBody.$ref;xt=ie.get(Tr)?.content}else Pt.requestBody.content&&(xt=Pt.requestBody.content);if(xt)for(let Tr in xt){let fn=xt[Tr].schema,tn=Y3e(we.path,we.method,Tr);fn.$id=tn,D.addSchema(fn),$7e(fn,N,z,D,ie,Me,Ne)}}if(Pt.parameters)for(let xt of Pt.parameters){let Tr=xt.$ref?ie.get(xt.$ref):xt,fn=Tr.schema.$ref?ie.get(Tr.schema.$ref):Tr.schema,tn=K3e(we.path,we.method,Tr.in,Tr.name);fn.$id=tn,D.addSchema(fn),$7e(Tr,N,z,D,ie,Me,Ne)}});for(let we of Me){let Pt=ie.get(we),xt=SG(z,we);D.addSchema(Pt,xt)}}return h=(0,L1t.default)(D),h}t(ITr,"schemaValidationSource");function $7e(a,s,l,_,h,b,D){for(let N in a){let M=a[N];if(N==="$ref"){let z=SG(l,O3(s,M));a[N]=z,rG(s,l,O3(s,M),h,b,D,(ne,ie,Q)=>SG(ne,O3(Q,ie)))}else typeof M=="object"&&$7e(M,s,l,_,h,b,D)}}t($7e,"addRefsToSchema");async function FTr(a){let s=new Set(["RequestValidationInboundPolicy"]),l=await z7e.readFile(`${a}/config/policies.json`,"utf-8"),_=JSON.parse(l);return OTr(_,s)}t(FTr,"getPolicyNamesUsingSchemaValidationPolicies");function OTr(a,s){let l=new Set;a.policies?.forEach(h=>{h.handler?.export&&s.has(h.handler.export)&&h.handler.module==="$import(@zuplo/runtime)"&&l.add(h.name)});let _=LTr(a,l);return new Set([...l,..._])}t(OTr,"getPolicyNamesReferencingPolicyHandlers");function LTr(a,s){let l=new Set;return a.policies?.forEach(_=>{_.handler?.export==="CompositeInboundPolicy"&&_.handler?.options?.policies?.forEach(h=>{s.has(h)&&l.add(_.name)})}),l}t(LTr,"getCompositePoliciesContainingPolicy");function RTr(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let l=a["x-zuplo-route"].policies.inbound;if(l){for(let h of l)if(s.has(h))return!0}let _=a["x-zuplo-route"].policies.outbound;if(_){for(let h of _)if(s.has(h))return!0}return!1}t(RTr,"isPolicyPresentInOperation");async function MTr(a,s){let l=[];for(let _ of a){let h=await z7e.readFile(_,"utf-8"),D=JSON.parse(h).paths;for(let N in D){let M=D[N];for(let z in M){let ne=M[z];RTr(ne,s)&&l.push({fileName:MO.basename(_,".oas.json"),path:N,method:z})}}}return l}t(MTr,"getRoutesContainingPolicies");import{mkdirSync as jTr,writeFileSync as BTr}from"node:fs";import UTr from"node:path";function M1t(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async l=>{if(l){let _=jj(a.sourceDirectory,l.metafile);jTr(a.outputDirectory,{recursive:!0}),BTr(UTr.join(a.outputDirectory,"modules.json"),JSON.stringify(_,null,2))}})}}}t(M1t,"writeModulesPlugin");var $Tr=rgt("zuplo:core:build"),zTr=["workerd","worker","browser"],U1t=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],J7e.resolve(j1t(B1t(import.meta.url)),"..","..","..","node_modules"),J7e.resolve(j1t(B1t(import.meta.url)),"..","..","..","..","..","node_modules")];async function iY({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,compatibilityDate:h,logger:b,minify:D=!0,command:N,flags:M}){let z=J7e.join(a,ale);$Tr(`Building with node paths: ${U1t.join(", ")}`);let ne=D&&N!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},ie=Object.freeze({sourceDirectory:l,outputDirectory:s,cacheDirectory:_,logger:b,debugMode:Om.DEBUG_BUILD_MODE,flags:M,compatibilityDate:h});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:U1t,entryPoints:[z],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...ne,external:[],logLevel:"silent",conditions:zTr,plugins:[lgt(ie),ngt(ie),w1t(ie),A1t(ie),R1t(ie),I1t(),sgt(ie),C1t(ie),D1t(ie),M1t(ie)]}}t(iY,"getBaseESBuildConfig");var jO="run-esbuild",z1t=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:l,cacheDirectory:_,buildId:h,logger:b,config:D,command:N,minify:M},{data:z}){b.debug("Running esbuild");let ne=await iY({command:N,minify:M,systemDirectory:a,outputDirectory:s,cacheDirectory:_,sourceDirectory:l,logger:b,flags:D.flags,compatibilityDate:D.compatibilityDate}),ie;try{if(!await $M(l))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");ie=await $1t.build(ne),z.set("metafile",ie.metafile)}catch(Ne){if(b.error(Ne),Ne.errors||Ne.warnings)ie=Ne;else if(Ne.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))ie={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:jO,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw Ne}ie.errors.length>0&&ie.errors.length>1&&(ie.errors.length=1);let{errors:Q,warnings:Me}=q7e({buildId:h,result:ie});return{errors:Q,warnings:Me}},"runEsbuild");function q7e({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(_=>_.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Zce,pluginName:_.pluginName||jO}:{location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:Zce,pluginName:_.pluginName||jO}),errors:s.errors.map(_=>({location:_.location,detail:_.detail,id:_.id,notes:_.notes,message:_.text,severity:U6e,pluginName:_.pluginName||jO})),metafile:s.metafile}}t(q7e,"esbuildResultToBuildResult");var JTr=t((a,s)=>{let l=s;if(s.includes(a)){let _=new RegExp(`.*(${a})`,"g");l=s.replace(_,"")}return l.match(/^(\/)?(\.\.(\/)?)+/)&&(l=l.replace(/^(\/)?(\.\.(\/)?)+/,"/")),l},"removePrefixFromString"),qTr=t((a,s)=>{let l=s;if(l.includes(a)){let _=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");l=l.replace(_,"")}return l},"cleanFilePathsInMessage"),J1t=t((a,s,l)=>{if(!a||a.length<=0)return a;let _=a.filter(h=>h.message!=='Could not resolve "@zuplo/runtime"');return _&&_.length>0&&_.forEach(h=>{try{h.location&&h.location.file&&(h.location.file=JTr(s,h.location.file)),h.location&&h.location.lineText&&h.location.lineText.includes("@zuplo/core/index.minified.js")&&(h.location.lineText=h.location.lineText.substring(0,200)+"...<Truncated>"),h.message=qTr(s,h.message),h.notes&&h.notes.length>0&&delete h.notes,h.text&&delete h.text,h.pluginName===""&&(h.pluginName=l)}catch{}}),_},"cleanDataOnBuildIssue");function q1t(a,s){let l=V7e.basename(s);a.errors&&(a.errors=J1t(a.errors,l,jO)),a.warnings&&(a.warnings=J1t(a.warnings,l,jO))}t(q1t,"formatBuildResult");var VTr=t(a=>V7e.basename(a).startsWith("."),"isHiddenOnUnix"),WTr=t((a,s=[])=>s.map(l=>l.startsWith(".")?l:`.${l}`).some(l=>a.endsWith(l)),"hasMatchingExtname");function j7e(a,s=[],l=!1){let _=[],h;if(!C_e.existsSync(a)){let b;if(QH.hasMagic(a))b=a;else{let D=s.map(N=>N.startsWith(".")?N:`.${N}`).join("|");b=`${a}+(${D})`}if(_.push(...QH.sync(b,{nodir:!0})),!_.length)throw Error(`Cannot find any files matching pattern "${a}"`);return _}try{if(h=C_e.statSync(a),h.isFile())return[a]}catch{return[]}return C_e.readdirSync(a).forEach(b=>{let D=V7e.join(a,b),N;try{if(N=C_e.statSync(D),N.isDirectory()){l&&_.push(...j7e(D,s,l));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!N.isFile()||!WTr(D,s)||VTr(D)||_.push(D)}),_}t(j7e,"lookupFiles");var KT=new rle,Pk=` ${KT.gray("|")} `;function U$r(a,s){a.info(KT.green(s))}t(U$r,"outputSuccess");function $$r(a,s){a.warn(KT.yellow(s))}t($$r,"outputWarning");function z$r(a,s){a.error(`
615
615
  ${KT.red(s)}`)}t(z$r,"outputCritical");function J$r(a,s,l){let _=l.sort((D,N)=>{let M=D.path.split("/").length,z=N.path.split("/").length;return M!==z?M-z:D.path.localeCompare(N.path)}),h=Math.max(..._.map(D=>D.path.length)),b=`${s}
616
616
  `;_.forEach(D=>{let N=" ".repeat(h-D.path.length),M=D.bytes/1024,z=` ${D.path}${N} ${M.toFixed(2)} KB
617
617
  `;b+=M>1024?KT.red(z):M>300?KT.yellow(z):z}),a.info(b)}t(J$r,"outputFileTree");function q$r(a,s){if(s.length===0)return"";let l=Object.keys(s[0]).length,_=Array.from({length:l},(D,N)=>Math.max(...s.map(M=>String(Object.values(M)[N]).length))),b=s.map(D=>Object.values(D).map((N,M)=>String(N).padEnd(_[M])).join(" ")).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.51.72",
3
+ "version": "6.51.75",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -41,9 +41,9 @@
41
41
  "prettier": "^3.5.3"
42
42
  },
43
43
  "peerDependencies": {
44
- "@zuplo/graphql": "^6.51.72",
45
- "@zuplo/otel": "^6.51.72",
46
- "@zuplo/runtime": "^6.51.72",
44
+ "@zuplo/graphql": "^6.51.75",
45
+ "@zuplo/otel": "^6.51.75",
46
+ "@zuplo/runtime": "^6.51.75",
47
47
  "deno": "2.3.1"
48
48
  }
49
49
  }