@zuplo/core 6.29.11 → 6.29.13

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.
@@ -557,7 +557,7 @@ globstar while`,s,Q,c,Pe,De),this.matchOne(s.slice(Q),c.slice(Pe),f))return this
557
557
  >>> no match, partial?`,s,Q,c,Pe),Q===O))}let Se;if(typeof W=="string"?(Se=$===W,this.debug("string match",W,$,Se)):(Se=W.test($),this.debug("pattern match",W,$,Se)),!Se)return!1}if(E===O&&A===M)return!0;if(E===O)return f;if(A===M)return E===O-1&&s[E]==="";throw new Error("wtf?")}braceExpand(){return iut(this.pattern,this.options)}parse(s){eQ(s);let c=this.options;if(s==="**")return cy;if(s==="")return"";let f,d=null;(f=s.match(Nir))?d=c.dot?Oir:Iir:(f=s.match(Sir))?d=(c.nocase?c.dot?xir:Eir:c.dot?Cir:Tir)(f[1]):(f=s.match(Fir))?d=(c.nocase?c.dot?Rir:Lir:c.dot?Mir:jir)(f):(f=s.match(Dir))?d=c.dot?kir:Air:(f=s.match(wir))&&(d=Pir);let v=bj.fromGlob(s,this.options).toMMPattern();return d&&typeof v=="object"&&Reflect.defineProperty(v,"test",{value:d}),v}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let c=this.options,f=c.noglobstar?$ir:c.dot?Jir:qir,d=new Set(c.nocase?["i"]:[]),v=s.map(O=>{let M=O.map(W=>{if(W instanceof RegExp)for(let $ of W.flags.split(""))d.add($);return typeof W=="string"?Gir(W):W===cy?cy:W._src});return M.forEach((W,$)=>{let Q=M[$+1],Pe=M[$-1];W!==cy||Pe===cy||(Pe===void 0?Q!==void 0&&Q!==cy?M[$+1]="(?:\\/|"+f+"\\/)?"+Q:M[$]=f:Q===void 0?M[$-1]=Pe+"(?:\\/|"+f+")?":Q!==cy&&(M[$-1]=Pe+"(?:\\/|\\/"+f+"\\/)"+Q,M[$+1]=cy))}),M.filter(W=>W!==cy).join("/")}).join("|"),[E,A]=s.length>1?["(?:",")"]:["",""];v="^"+E+v+A+"$",this.negate&&(v="^(?!"+v+").+$");try{this.regexp=new RegExp(v,[...d].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,c=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&c)return!0;let f=this.options;this.isWindows&&(s=s.split("\\").join("/"));let d=this.slashSplit(s);this.debug(this.pattern,"split",d);let v=this.set;this.debug(this.pattern,"set",v);let E=d[d.length-1];if(!E)for(let A=d.length-2;!E&&A>=0;A--)E=d[A];for(let A=0;A<v.length;A++){let O=v[A],M=d;if(f.matchBase&&O.length===1&&(M=[E]),this.matchOne(M,O,c))return f.flipNegate?!0:!this.negate}return f.flipNegate?!1:this.negate}static defaults(s){return dv.defaults(s).Minimatch}};dv.AST=bj;dv.Minimatch=hS;dv.escape=Sj;dv.unescape=ux;import{fileURLToPath as Dsr}from"url";var Tj=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,aut=new Set,S3e=typeof process=="object"&&process?process:{},out=t((a,s,c,f)=>{typeof S3e.emitWarning=="function"?S3e.emitWarning(a,s,c,f):console.error(`[${c}] ${s}: ${a}`)},"emitWarning"),vue=globalThis.AbortController,sut=globalThis.AbortSignal;if(typeof vue>"u"){sut=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(f,d){this._onabort.push(d)}},vue=class{static{t(this,"AbortController")}constructor(){s()}signal=new sut;abort(f){if(!this.signal.aborted){this.signal.reason=f,this.signal.aborted=!0;for(let d of this.signal._onabort)d(f);this.signal.onabort?.(f)}}};let a=S3e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,out("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 Qir=t(a=>!aut.has(a),"shouldWarn"),j9r=Symbol("type"),K3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),cut=t(a=>K3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?Cj:null:null,"getUintArray"),Cj=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},T3e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let c=cut(s);if(!c)return[];a.#r=!0;let f=new a(s,c);return a.#r=!1,f}constructor(s,c){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new c(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},rQ=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;#x;#C;#b;#A;#E;#y;static unsafeExposeInternals(s){return{starts:s.#C,ttls:s.#b,sizes:s.#x,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(c=>s.#h(c),"isBackgroundFetch"),backgroundFetch:t((c,f,d,v)=>s.#j(c,f,d,v),"backgroundFetch"),moveToTail:t(c=>s.#U(c),"moveToTail"),indexes:t(c=>s.#w(c),"indexes"),rindexes:t(c=>s.#P(c),"rindexes"),isStale:t(c=>s.#S(c),"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:c=0,ttl:f,ttlResolution:d=1,ttlAutopurge:v,updateAgeOnGet:E,updateAgeOnHas:A,allowStale:O,dispose:M,disposeAfter:W,noDisposeOnSet:$,noUpdateTTL:Q,maxSize:Pe=0,maxEntrySize:De=0,sizeCalculation:Se,fetchMethod:Tt,memoMethod:wt,noDeleteOnFetchRejection:_r,noDeleteOnStaleGet:lr,allowStaleOnFetchRejection:Or,allowStaleOnFetchAbort:hr,ignoreFetchAbort:ur}=s;if(c!==0&&!K3(c))throw new TypeError("max option must be a nonnegative integer");let er=c?cut(c):Array;if(!er)throw new Error("invalid max value: "+c);if(this.#r=c,this.#n=Pe,this.maxEntrySize=De||this.#n,this.sizeCalculation=Se,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(wt!==void 0&&typeof wt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=wt,Tt!==void 0&&typeof Tt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Tt,this.#E=!!Tt,this.#c=new Map,this.#l=new Array(c).fill(void 0),this.#i=new Array(c).fill(void 0),this.#f=new er(c),this.#v=new er(c),this.#d=0,this.#u=0,this.#m=T3e.create(c),this.#a=0,this.#_=0,typeof M=="function"&&(this.#e=M),typeof W=="function"?(this.#t=W,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#A=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!$,this.noUpdateTTL=!!Q,this.noDeleteOnFetchRejection=!!_r,this.allowStaleOnFetchRejection=!!Or,this.allowStaleOnFetchAbort=!!hr,this.ignoreFetchAbort=!!ur,this.maxEntrySize!==0){if(this.#n!==0&&!K3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!K3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!O,this.noDeleteOnStaleGet=!!lr,this.updateAgeOnGet=!!E,this.updateAgeOnHas=!!A,this.ttlResolution=K3(d)||d===0?d:1,this.ttlAutopurge=!!v,this.ttl=f||0,this.ttl){if(!K3(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 Es="LRU_CACHE_UNBOUNDED";Qir(Es)&&(aut.add(Es),out("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Es,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new Cj(this.#r),c=new Cj(this.#r);this.#b=s,this.#C=c,this.#N=(v,E,A=Tj.now())=>{if(c[v]=E!==0?A:0,s[v]=E,E!==0&&this.ttlAutopurge){let O=setTimeout(()=>{this.#S(v)&&this.#O(this.#l[v],"expire")},E+1);O.unref&&O.unref()}},this.#k=v=>{c[v]=s[v]!==0?Tj.now():0},this.#o=(v,E)=>{if(s[E]){let A=s[E],O=c[E];if(!A||!O)return;v.ttl=A,v.start=O,v.now=f||d();let M=v.now-O;v.remainingTTL=A-M}};let f=0,d=t(()=>{let v=Tj.now();if(this.ttlResolution>0){f=v;let E=setTimeout(()=>f=0,this.ttlResolution);E.unref&&E.unref()}return v},"getNow");this.getRemainingTTL=v=>{let E=this.#c.get(v);if(E===void 0)return 0;let A=s[E],O=c[E];if(!A||!O)return 1/0;let M=(f||d())-O;return A-M},this.#S=v=>{let E=c[v],A=s[v];return!!A&&!!E&&(f||d())-E>A}}#k=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new Cj(this.#r);this.#_=0,this.#x=s,this.#I=c=>{this.#_-=s[c],s[c]=0},this.#L=(c,f,d,v)=>{if(this.#h(f))return 0;if(!K3(d))if(v){if(typeof v!="function")throw new TypeError("sizeCalculation must be a function");if(d=v(f,c),!K3(d))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 d},this.#F=(c,f,d)=>{if(s[c]=f,this.#n){let v=this.#n-s[c];for(;this.#_>v;)this.#M(!0)}this.#_+=s[c],d&&(d.entrySize=f,d.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,c,f)=>{},"#addItemSize");#L=t((s,c,f,d)=>{if(f||d)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#w({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#u;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#d));)c=this.#v[c]}*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#d;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#u));)c=this.#f[c]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#w())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.#P())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.#w()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*rkeys(){for(let s of this.#P()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*values(){for(let s of this.#w())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,c={}){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;if(v!==void 0&&s(v,this.#l[f],this))return this.get(this.#l[f],c)}}forEach(s,c=this){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}rforEach(s,c=this){for(let f of this.#P()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}purgeStale(){let s=!1;for(let c of this.#P({allowStale:!0}))this.#S(c)&&(this.#O(this.#l[c],"expire"),s=!0);return s}info(s){let c=this.#c.get(s);if(c===void 0)return;let f=this.#i[c],d=this.#h(f)?f.__staleWhileFetching:f;if(d===void 0)return;let v={value:d};if(this.#b&&this.#C){let E=this.#b[c],A=this.#C[c];if(E&&A){let O=E-(Tj.now()-A);v.ttl=O,v.start=Date.now()}}return this.#x&&(v.size=this.#x[c]),v}dump(){let s=[];for(let c of this.#w({allowStale:!0})){let f=this.#l[c],d=this.#i[c],v=this.#h(d)?d.__staleWhileFetching:d;if(v===void 0||f===void 0)continue;let E={value:v};if(this.#b&&this.#C){E.ttl=this.#b[c];let A=Tj.now()-this.#C[c];E.start=Math.floor(Date.now()-A)}this.#x&&(E.size=this.#x[c]),s.unshift([f,E])}return s}load(s){this.clear();for(let[c,f]of s){if(f.start){let d=Date.now()-f.start;f.start=Tj.now()-d}this.set(c,f.value,f)}}set(s,c,f={}){if(c===void 0)return this.delete(s),this;let{ttl:d=this.ttl,start:v,noDisposeOnSet:E=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:O}=f,{noUpdateTTL:M=this.noUpdateTTL}=f,W=this.#L(s,c,f.size||0,A);if(this.maxEntrySize&&W>this.maxEntrySize)return O&&(O.set="miss",O.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let $=this.#a===0?void 0:this.#c.get(s);if($===void 0)$=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[$]=s,this.#i[$]=c,this.#c.set(s,$),this.#f[this.#u]=$,this.#v[$]=this.#u,this.#u=$,this.#a++,this.#F($,W,O),O&&(O.set="add"),M=!1;else{this.#U($);let Q=this.#i[$];if(c!==Q){if(this.#E&&this.#h(Q)){Q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Pe}=Q;Pe!==void 0&&!E&&(this.#A&&this.#e?.(Pe,s,"set"),this.#y&&this.#g?.push([Pe,s,"set"]))}else E||(this.#A&&this.#e?.(Q,s,"set"),this.#y&&this.#g?.push([Q,s,"set"]));if(this.#I($),this.#F($,W,O),this.#i[$]=c,O){O.set="replace";let Pe=Q&&this.#h(Q)?Q.__staleWhileFetching:Q;Pe!==void 0&&(O.oldValue=Pe)}}else O&&(O.set="update")}if(d!==0&&!this.#b&&this.#D(),this.#b&&(M||this.#N($,d,v),O&&this.#o(O,$)),!E&&this.#y&&this.#g){let Q=this.#g,Pe;for(;Pe=Q?.shift();)this.#t?.(...Pe)}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,c;for(;c=s?.shift();)this.#t?.(...c)}}}#M(s){let c=this.#d,f=this.#l[c],d=this.#i[c];return this.#E&&this.#h(d)?d.__abortController.abort(new Error("evicted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(d,f,"evict"),this.#y&&this.#g?.push([d,f,"evict"])),this.#I(c),s&&(this.#l[c]=void 0,this.#i[c]=void 0,this.#m.push(c)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[c],this.#c.delete(f),this.#a--,c}has(s,c={}){let{updateAgeOnHas:f=this.updateAgeOnHas,status:d}=c,v=this.#c.get(s);if(v!==void 0){let E=this.#i[v];if(this.#h(E)&&E.__staleWhileFetching===void 0)return!1;if(this.#S(v))d&&(d.has="stale",this.#o(d,v));else return f&&this.#k(v),d&&(d.has="hit",this.#o(d,v)),!0}else d&&(d.has="miss");return!1}peek(s,c={}){let{allowStale:f=this.allowStale}=c,d=this.#c.get(s);if(d===void 0||!f&&this.#S(d))return;let v=this.#i[d];return this.#h(v)?v.__staleWhileFetching:v}#j(s,c,f,d){let v=c===void 0?void 0:this.#i[c];if(this.#h(v))return v;let E=new vue,{signal:A}=f;A?.addEventListener("abort",()=>E.abort(A.reason),{signal:E.signal});let O={signal:E.signal,options:f,context:d},M=t((Se,Tt=!1)=>{let{aborted:wt}=E.signal,_r=f.ignoreFetchAbort&&Se!==void 0;if(f.status&&(wt&&!Tt?(f.status.fetchAborted=!0,f.status.fetchError=E.signal.reason,_r&&(f.status.fetchAbortIgnored=!0)):f.status.fetchResolved=!0),wt&&!_r&&!Tt)return $(E.signal.reason);let lr=Pe;return this.#i[c]===Pe&&(Se===void 0?lr.__staleWhileFetching?this.#i[c]=lr.__staleWhileFetching:this.#O(s,"fetch"):(f.status&&(f.status.fetchUpdated=!0),this.set(s,Se,O.options))),Se},"cb"),W=t(Se=>(f.status&&(f.status.fetchRejected=!0,f.status.fetchError=Se),$(Se)),"eb"),$=t(Se=>{let{aborted:Tt}=E.signal,wt=Tt&&f.allowStaleOnFetchAbort,_r=wt||f.allowStaleOnFetchRejection,lr=_r||f.noDeleteOnFetchRejection,Or=Pe;if(this.#i[c]===Pe&&(!lr||Or.__staleWhileFetching===void 0?this.#O(s,"fetch"):wt||(this.#i[c]=Or.__staleWhileFetching)),_r)return f.status&&Or.__staleWhileFetching!==void 0&&(f.status.returnedStale=!0),Or.__staleWhileFetching;if(Or.__returned===Or)throw Se},"fetchFail"),Q=t((Se,Tt)=>{let wt=this.#s?.(s,v,O);wt&&wt instanceof Promise&&wt.then(_r=>Se(_r===void 0?void 0:_r),Tt),E.signal.addEventListener("abort",()=>{(!f.ignoreFetchAbort||f.allowStaleOnFetchAbort)&&(Se(void 0),f.allowStaleOnFetchAbort&&(Se=t(_r=>M(_r,!0),"res")))})},"pcall");f.status&&(f.status.fetchDispatched=!0);let Pe=new Promise(Q).then(M,W),De=Object.assign(Pe,{__abortController:E,__staleWhileFetching:v,__returned:void 0});return c===void 0?(this.set(s,De,{...O.options,status:void 0}),c=this.#c.get(s)):this.#i[c]=De,De}#h(s){if(!this.#E)return!1;let c=s;return!!c&&c instanceof Promise&&c.hasOwnProperty("__staleWhileFetching")&&c.__abortController instanceof vue}async fetch(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,ttl:E=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:O=0,sizeCalculation:M=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:$=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Q=this.allowStaleOnFetchRejection,ignoreFetchAbort:Pe=this.ignoreFetchAbort,allowStaleOnFetchAbort:De=this.allowStaleOnFetchAbort,context:Se,forceRefresh:Tt=!1,status:wt,signal:_r}=c;if(!this.#E)return wt&&(wt.fetch="get"),this.get(s,{allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,status:wt});let lr={allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,ttl:E,noDisposeOnSet:A,size:O,sizeCalculation:M,noUpdateTTL:W,noDeleteOnFetchRejection:$,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:De,ignoreFetchAbort:Pe,status:wt,signal:_r},Or=this.#c.get(s);if(Or===void 0){wt&&(wt.fetch="miss");let hr=this.#j(s,Or,lr,Se);return hr.__returned=hr}else{let hr=this.#i[Or];if(this.#h(hr)){let fo=f&&hr.__staleWhileFetching!==void 0;return wt&&(wt.fetch="inflight",fo&&(wt.returnedStale=!0)),fo?hr.__staleWhileFetching:hr.__returned=hr}let ur=this.#S(Or);if(!Tt&&!ur)return wt&&(wt.fetch="hit"),this.#U(Or),d&&this.#k(Or),wt&&this.#o(wt,Or),hr;let er=this.#j(s,Or,lr,Se),wi=er.__staleWhileFetching!==void 0&&f;return wt&&(wt.fetch=ur?"stale":"refresh",wi&&ur&&(wt.returnedStale=!0)),wi?er.__staleWhileFetching:er.__returned=er}}async forceFetch(s,c={}){let f=await this.fetch(s,c);if(f===void 0)throw new Error("fetch() returned undefined");return f}memo(s,c={}){let f=this.#p;if(!f)throw new Error("no memoMethod provided to constructor");let{context:d,forceRefresh:v,...E}=c,A=this.get(s,E);if(!v&&A!==void 0)return A;let O=f(s,A,{options:E,context:d});return this.set(s,O,E),O}get(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,status:E}=c,A=this.#c.get(s);if(A!==void 0){let O=this.#i[A],M=this.#h(O);return E&&this.#o(E,A),this.#S(A)?(E&&(E.get="stale"),M?(E&&f&&O.__staleWhileFetching!==void 0&&(E.returnedStale=!0),f?O.__staleWhileFetching:void 0):(v||this.#O(s,"expire"),E&&f&&(E.returnedStale=!0),f?O:void 0)):(E&&(E.get="hit"),M?O.__staleWhileFetching:(this.#U(A),d&&this.#k(A),O))}else E&&(E.get="miss")}#B(s,c){this.#v[c]=s,this.#f[s]=c}#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.#O(s,"delete")}#O(s,c){let f=!1;if(this.#a!==0){let d=this.#c.get(s);if(d!==void 0)if(f=!0,this.#a===1)this.#$(c);else{this.#I(d);let v=this.#i[d];if(this.#h(v)?v.__abortController.abort(new Error("deleted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(v,s,c),this.#y&&this.#g?.push([v,s,c])),this.#c.delete(s),this.#l[d]=void 0,this.#i[d]=void 0,d===this.#u)this.#u=this.#v[d];else if(d===this.#d)this.#d=this.#f[d];else{let E=this.#v[d];this.#f[E]=this.#f[d];let A=this.#f[d];this.#v[A]=this.#v[d]}this.#a--,this.#m.push(d)}}if(this.#y&&this.#g?.length){let d=this.#g,v;for(;v=d?.shift();)this.#t?.(...v)}return f}clear(){return this.#$("delete")}#$(s){for(let c of this.#P({allowStale:!0})){let f=this.#i[c];if(this.#h(f))f.__abortController.abort(new Error("deleted"));else{let d=this.#l[c];this.#A&&this.#e?.(f,d,s),this.#y&&this.#g?.push([f,d,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#C&&(this.#b.fill(0),this.#C.fill(0)),this.#x&&this.#x.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let c=this.#g,f;for(;f=c?.shift();)this.#t?.(...f)}}};import{posix as asr,win32 as I3e}from"path";import{fileURLToPath as osr}from"url";import{lstatSync as csr,readdir as lsr,readdirSync as usr,readlinkSync as fsr,realpathSync as _sr}from"fs";import*as psr from"fs";import{lstat as msr,readdir as hsr,readlink as gsr,realpath as ysr}from"fs/promises";import{EventEmitter as w3e}from"events";import put from"stream";import{StringDecoder as Kir}from"string_decoder";var lut=typeof process=="object"&&process?process:{stdout:null,stderr:null},Yir=t(a=>!!a&&typeof a=="object"&&(a instanceof X3||a instanceof put||Xir(a)||Zir(a)),"isStream"),Xir=t(a=>!!a&&typeof a=="object"&&a instanceof w3e&&typeof a.pipe=="function"&&a.pipe!==put.Writable.prototype.pipe,"isReadable"),Zir=t(a=>!!a&&typeof a=="object"&&a instanceof w3e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),RP=Symbol("EOF"),MP=Symbol("maybeEmitEnd"),Y3=Symbol("emittedEnd"),bue=Symbol("emittingEnd"),nQ=Symbol("emittedError"),Sue=Symbol("closed"),uut=Symbol("read"),Tue=Symbol("flush"),fut=Symbol("flushChunk"),fx=Symbol("encoding"),Ej=Symbol("decoder"),C0=Symbol("flowing"),iQ=Symbol("paused"),xj=Symbol("resume"),E0=Symbol("buffer"),mv=Symbol("pipes"),x0=Symbol("bufferLength"),C3e=Symbol("bufferPush"),Cue=Symbol("bufferShift"),a1=Symbol("objectMode"),vh=Symbol("destroyed"),E3e=Symbol("error"),x3e=Symbol("emitData"),_ut=Symbol("emitEnd"),D3e=Symbol("emitEnd2"),OA=Symbol("async"),A3e=Symbol("abort"),Eue=Symbol("aborted"),sQ=Symbol("signal"),TF=Symbol("dataListeners"),gS=Symbol("discarded"),aQ=t(a=>Promise.resolve().then(a),"defer"),esr=t(a=>a(),"nodefer"),tsr=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),rsr=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),nsr=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),xue=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,c,f){this.src=s,this.dest=c,this.opts=f,this.ondrain=()=>s[xj](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},k3e=class extends xue{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,c,f){super(s,c,f),this.proxyErrors=d=>c.emit("error",d),s.on("error",this.proxyErrors)}},isr=t(a=>!!a.objectMode,"isObjectModeOptions"),ssr=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),X3=class extends w3e{static{t(this,"Minipass")}[C0]=!1;[iQ]=!1;[mv]=[];[E0]=[];[a1];[fx];[OA];[Ej];[RP]=!1;[Y3]=!1;[bue]=!1;[Sue]=!1;[nQ]=null;[x0]=0;[vh]=!1;[sQ];[Eue]=!1;[TF]=0;[gS]=!1;writable=!0;readable=!0;constructor(...s){let c=s[0]||{};if(super(),c.objectMode&&typeof c.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");isr(c)?(this[a1]=!0,this[fx]=null):ssr(c)?(this[fx]=c.encoding,this[a1]=!1):(this[a1]=!1,this[fx]=null),this[OA]=!!c.async,this[Ej]=this[fx]?new Kir(this[fx]):null,c&&c.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[E0],"get")}),c&&c.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[mv],"get")});let{signal:f}=c;f&&(this[sQ]=f,f.aborted?this[A3e]():f.addEventListener("abort",()=>this[A3e]()))}get bufferLength(){return this[x0]}get encoding(){return this[fx]}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[a1]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[OA]}set async(s){this[OA]=this[OA]||!!s}[A3e](){this[Eue]=!0,this.emit("abort",this[sQ]?.reason),this.destroy(this[sQ]?.reason)}get aborted(){return this[Eue]}set aborted(s){}write(s,c,f){if(this[Eue])return!1;if(this[RP])throw new Error("write after end");if(this[vh])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof c=="function"&&(f=c,c="utf8"),c||(c="utf8");let d=this[OA]?aQ:esr;if(!this[a1]&&!Buffer.isBuffer(s)){if(nsr(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(rsr(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[a1]?(this[C0]&&this[x0]!==0&&this[Tue](!0),this[C0]?this.emit("data",s):this[C3e](s),this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0]):s.length?(typeof s=="string"&&!(c===this[fx]&&!this[Ej]?.lastNeed)&&(s=Buffer.from(s,c)),Buffer.isBuffer(s)&&this[fx]&&(s=this[Ej].write(s)),this[C0]&&this[x0]!==0&&this[Tue](!0),this[C0]?this.emit("data",s):this[C3e](s),this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0]):(this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0])}read(s){if(this[vh])return null;if(this[gS]=!1,this[x0]===0||s===0||s&&s>this[x0])return this[MP](),null;this[a1]&&(s=null),this[E0].length>1&&!this[a1]&&(this[E0]=[this[fx]?this[E0].join(""):Buffer.concat(this[E0],this[x0])]);let c=this[uut](s||null,this[E0][0]);return this[MP](),c}[uut](s,c){if(this[a1])this[Cue]();else{let f=c;s===f.length||s===null?this[Cue]():typeof f=="string"?(this[E0][0]=f.slice(s),c=f.slice(0,s),this[x0]-=s):(this[E0][0]=f.subarray(s),c=f.subarray(0,s),this[x0]-=s)}return this.emit("data",c),!this[E0].length&&!this[RP]&&this.emit("drain"),c}end(s,c,f){return typeof s=="function"&&(f=s,s=void 0),typeof c=="function"&&(f=c,c="utf8"),s!==void 0&&this.write(s,c),f&&this.once("end",f),this[RP]=!0,this.writable=!1,(this[C0]||!this[iQ])&&this[MP](),this}[xj](){this[vh]||(!this[TF]&&!this[mv].length&&(this[gS]=!0),this[iQ]=!1,this[C0]=!0,this.emit("resume"),this[E0].length?this[Tue]():this[RP]?this[MP]():this.emit("drain"))}resume(){return this[xj]()}pause(){this[C0]=!1,this[iQ]=!0,this[gS]=!1}get destroyed(){return this[vh]}get flowing(){return this[C0]}get paused(){return this[iQ]}[C3e](s){this[a1]?this[x0]+=1:this[x0]+=s.length,this[E0].push(s)}[Cue](){return this[a1]?this[x0]-=1:this[x0]-=this[E0][0].length,this[E0].shift()}[Tue](s=!1){do;while(this[fut](this[Cue]())&&this[E0].length);!s&&!this[E0].length&&!this[RP]&&this.emit("drain")}[fut](s){return this.emit("data",s),this[C0]}pipe(s,c){if(this[vh])return s;this[gS]=!1;let f=this[Y3];return c=c||{},s===lut.stdout||s===lut.stderr?c.end=!1:c.end=c.end!==!1,c.proxyErrors=!!c.proxyErrors,f?c.end&&s.end():(this[mv].push(c.proxyErrors?new k3e(this,s,c):new xue(this,s,c)),this[OA]?aQ(()=>this[xj]()):this[xj]()),s}unpipe(s){let c=this[mv].find(f=>f.dest===s);c&&(this[mv].length===1?(this[C0]&&this[TF]===0&&(this[C0]=!1),this[mv]=[]):this[mv].splice(this[mv].indexOf(c),1),c.unpipe())}addListener(s,c){return this.on(s,c)}on(s,c){let f=super.on(s,c);if(s==="data")this[gS]=!1,this[TF]++,!this[mv].length&&!this[C0]&&this[xj]();else if(s==="readable"&&this[x0]!==0)super.emit("readable");else if(tsr(s)&&this[Y3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[nQ]){let d=c;this[OA]?aQ(()=>d.call(this,this[nQ])):d.call(this,this[nQ])}return f}removeListener(s,c){return this.off(s,c)}off(s,c){let f=super.off(s,c);return s==="data"&&(this[TF]=this.listeners("data").length,this[TF]===0&&!this[gS]&&!this[mv].length&&(this[C0]=!1)),f}removeAllListeners(s){let c=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[TF]=0,!this[gS]&&!this[mv].length&&(this[C0]=!1)),c}get emittedEnd(){return this[Y3]}[MP](){!this[bue]&&!this[Y3]&&!this[vh]&&this[E0].length===0&&this[RP]&&(this[bue]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Sue]&&this.emit("close"),this[bue]=!1)}emit(s,...c){let f=c[0];if(s!=="error"&&s!=="close"&&s!==vh&&this[vh])return!1;if(s==="data")return!this[a1]&&!f?!1:this[OA]?(aQ(()=>this[x3e](f)),!0):this[x3e](f);if(s==="end")return this[_ut]();if(s==="close"){if(this[Sue]=!0,!this[Y3]&&!this[vh])return!1;let v=super.emit("close");return this.removeAllListeners("close"),v}else if(s==="error"){this[nQ]=f,super.emit(E3e,f);let v=!this[sQ]||this.listeners("error").length?super.emit("error",f):!1;return this[MP](),v}else if(s==="resume"){let v=super.emit("resume");return this[MP](),v}else if(s==="finish"||s==="prefinish"){let v=super.emit(s);return this.removeAllListeners(s),v}let d=super.emit(s,...c);return this[MP](),d}[x3e](s){for(let f of this[mv])f.dest.write(s)===!1&&this.pause();let c=this[gS]?!1:super.emit("data",s);return this[MP](),c}[_ut](){return this[Y3]?!1:(this[Y3]=!0,this.readable=!1,this[OA]?(aQ(()=>this[D3e]()),!0):this[D3e]())}[D3e](){if(this[Ej]){let c=this[Ej].end();if(c){for(let f of this[mv])f.dest.write(c);this[gS]||super.emit("data",c)}}for(let c of this[mv])c.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[a1]||(s.dataLength=0);let c=this.promise();return this.on("data",f=>{s.push(f),this[a1]||(s.dataLength+=f.length)}),await c,s}async concat(){if(this[a1])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[fx]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,c)=>{this.on(vh,()=>c(new Error("stream destroyed"))),this.on("error",f=>c(f)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[gS]=!1;let s=!1,c=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return c();let d=this.read();if(d!==null)return Promise.resolve({done:!1,value:d});if(this[RP])return c();let v,E,A=t($=>{this.off("data",O),this.off("end",M),this.off(vh,W),c(),E($)},"onerr"),O=t($=>{this.off("error",A),this.off("end",M),this.off(vh,W),this.pause(),v({value:$,done:!!this[RP]})},"ondata"),M=t(()=>{this.off("error",A),this.off("data",O),this.off(vh,W),c(),v({done:!0,value:void 0})},"onend"),W=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise(($,Q)=>{E=Q,v=$,this.once(vh,W),this.once("error",A),this.once("end",M),this.once("data",O)})},"next"),throw:c,return:c,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[gS]=!1;let s=!1,c=t(()=>(this.pause(),this.off(E3e,c),this.off(vh,c),this.off("end",c),s=!0,{done:!0,value:void 0}),"stop"),f=t(()=>{if(s)return c();let d=this.read();return d===null?c():{done:!1,value:d}},"next");return this.once("end",c),this.once(E3e,c),this.once(vh,c),{next:f,throw:c,return:c,[Symbol.iterator](){return this}}}destroy(s){if(this[vh])return s?this.emit("error",s):this.emit(vh),this;this[vh]=!0,this[gS]=!0,this[E0].length=0,this[x0]=0;let c=this;return typeof c.close=="function"&&!this[Sue]&&c.close(),s?this.emit("error",s):this.emit(vh),this}static get isStream(){return Yir}};var dsr=_sr.native,cQ={lstatSync:csr,readdir:lsr,readdirSync:usr,readlinkSync:fsr,realpathSync:dsr,promises:{lstat:msr,readdir:hsr,readlink:gsr,realpath:ysr}},yut=t(a=>!a||a===cQ||a===psr?cQ:{...cQ,...a,promises:{...cQ.promises,...a.promises||{}}},"fsFromOption"),vut=/^\\\\\?\\([a-z]:)\\?$/i,vsr=t(a=>a.replace(/\//g,"\\").replace(vut,"$1\\"),"uncToDrive"),bsr=/[\\\/]/,nC=0,but=1,Sut=2,FA=4,Tut=6,Cut=8,CF=10,Eut=12,rC=15,oQ=~rC,P3e=16,dut=32,lQ=64,_x=128,Due=256,kue=512,mut=lQ|_x|kue,Ssr=1023,N3e=t(a=>a.isFile()?Cut:a.isDirectory()?FA:a.isSymbolicLink()?CF:a.isCharacterDevice()?Sut:a.isBlockDevice()?Tut:a.isSocket()?Eut:a.isFIFO()?but:nC,"entToType"),hut=new Map,uQ=t(a=>{let s=hut.get(a);if(s)return s;let c=a.normalize("NFKD");return hut.set(a,c),c},"normalize"),gut=new Map,Aue=t(a=>{let s=gut.get(a);if(s)return s;let c=uQ(a.toLowerCase());return gut.set(a,c),c},"normalizeNocase"),wue=class extends rQ{static{t(this,"ResolveCache")}constructor(){super({max:256})}},O3e=class extends rQ{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(c=>c.length+1,"sizeCalculation")})}},xut=Symbol("PathScurry setAsCwd"),o1=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}#x;get ctime(){return this.#x}#C;get birthtime(){return this.#C}#b;#A;#E;#y;#D;#k;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,c=nC,f,d,v,E,A){this.name=s,this.#b=v?Aue(s):uQ(s),this.#o=c&Ssr,this.nocase=v,this.roots=d,this.root=f||this,this.#N=E,this.#E=A.fullpath,this.#D=A.relative,this.#k=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=yut(A.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let c=this.getRootString(s),d=s.substring(c.length).split(this.splitSep);return c?this.getRoot(c).#I(d):this.#I(d)}#I(s){let c=this;for(let f of s)c=c.child(f);return c}children(){let s=this.#N.get(this);if(s)return s;let c=Object.assign([],{provisional:0});return this.#N.set(this,c),this.#o&=~P3e,c}child(s,c){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let f=this.children(),d=this.nocase?Aue(s):uQ(s);for(let O of f)if(O.#b===d)return O;let v=this.parent?this.sep:"",E=this.#E?this.#E+v+s:void 0,A=this.newChild(s,nC,{...c,parent:this,fullpath:E});return this.canReaddir()||(A.#o|=_x),f.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,c=this.parent;if(!c)return this.#D=this.name;let f=c.relative();return f+(!f||!c.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let s=this.name,c=this.parent;if(!c)return this.#k=this.fullpathPosix();let f=c.relativePosix();return f+(!f||!c.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,c=this.parent;if(!c)return this.#E=this.name;let d=c.fullpath()+(c.parent?this.sep:"")+s;return this.#E=d}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let d=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(d)?this.#y=`//?/${d}`:this.#y=d}let s=this.parent,c=s.fullpathPosix(),f=c+(!c||!s.parent?"":"/")+this.name;return this.#y=f}isUnknown(){return(this.#o&rC)===nC}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&rC)===Cut}isDirectory(){return(this.#o&rC)===FA}isCharacterDevice(){return(this.#o&rC)===Sut}isBlockDevice(){return(this.#o&rC)===Tut}isFIFO(){return(this.#o&rC)===but}isSocket(){return(this.#o&rC)===Eut}isSymbolicLink(){return(this.#o&CF)===CF}lstatCached(){return this.#o&dut?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&rC;return!(s!==nC&&s!==CF||this.#o&Due||this.#o&_x)}calledReaddir(){return!!(this.#o&P3e)}isENOENT(){return!!(this.#o&_x)}isNamed(s){return this.nocase?this.#b===Aue(s):this.#b===uQ(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=await this.#r.promises.readlink(this.fullpath()),f=(await this.parent.realpath())?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=this.#r.readlinkSync(this.fullpath()),f=this.parent.realpathSync()?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}#F(s){this.#o|=P3e;for(let c=s.provisional;c<s.length;c++){let f=s[c];f&&f.#L()}}#L(){this.#o&_x||(this.#o=(this.#o|_x)&oQ,this.#w())}#w(){let s=this.children();s.provisional=0;for(let c of s)c.#L()}#P(){this.#o|=kue,this.#R()}#R(){if(this.#o&lQ)return;let s=this.#o;(s&rC)===FA&&(s&=oQ),this.#o=s|lQ,this.#w()}#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 c=this.#o;c|=Due,s==="ENOENT"&&(c|=_x),(s==="EINVAL"||s==="UNKNOWN")&&(c&=oQ),this.#o=c,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,c){return this.#O(s,c)||this.#U(s,c)}#U(s,c){let f=N3e(s),d=this.newChild(s.name,f,{parent:this}),v=d.#o&rC;return v!==FA&&v!==CF&&v!==nC&&(d.#o|=lQ),c.unshift(d),c.provisional++,d}#O(s,c){for(let f=c.provisional;f<c.length;f++){let d=c[f];if((this.nocase?Aue(s.name):uQ(s.name))===d.#b)return this.#$(s,d,f,c)}}#$(s,c,f,d){let v=c.name;return c.#o=c.#o&oQ|N3e(s),v!==s.name&&(c.name=s.name),f!==d.provisional&&(f===d.length-1?d.pop():d.splice(f,1),d.unshift(c)),d.provisional++,c}async lstat(){if(!(this.#o&_x))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&_x))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:c,atimeMs:f,birthtime:d,birthtimeMs:v,blksize:E,blocks:A,ctime:O,ctimeMs:M,dev:W,gid:$,ino:Q,mode:Pe,mtime:De,mtimeMs:Se,nlink:Tt,rdev:wt,size:_r,uid:lr}=s;this.#m=c,this.#f=f,this.#C=d,this.#u=v,this.#_=E,this.#i=A,this.#x=O,this.#d=M,this.#n=W,this.#p=$,this.#c=Q,this.#e=Pe,this.#g=De,this.#v=Se,this.#t=Tt,this.#a=wt,this.#l=_r,this.#s=lr;let Or=N3e(s);this.#o=this.#o&oQ|Or|dut,Or!==nC&&Or!==FA&&Or!==CF&&(this.#o|=lQ)}#q=[];#z=!1;#W(s){this.#z=!1;let c=this.#q.slice();this.#q.length=0,c.forEach(f=>f(null,s))}readdirCB(s,c=!1){if(!this.canReaddir()){c?s(null,[]):queueMicrotask(()=>s(null,[]));return}let f=this.children();if(this.calledReaddir()){let v=f.slice(0,f.provisional);c?s(null,v):queueMicrotask(()=>s(null,v));return}if(this.#q.push(s),this.#z)return;this.#z=!0;let d=this.fullpath();this.#r.readdir(d,{withFileTypes:!0},(v,E)=>{if(v)this.#M(v.code),f.provisional=0;else{for(let A of E)this.#B(A,f);this.#F(f)}this.#W(f.slice(0,f.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let c=this.fullpath();if(this.#J)await this.#J;else{let f=t(()=>{},"resolve");this.#J=new Promise(d=>f=d);try{for(let d of await this.#r.promises.readdir(c,{withFileTypes:!0}))this.#B(d,s);this.#F(s)}catch(d){this.#M(d.code),s.provisional=0}this.#J=void 0,f()}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 c=this.fullpath();try{for(let f of this.#r.readdirSync(c,{withFileTypes:!0}))this.#B(f,s);this.#F(s)}catch(f){this.#M(f.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&mut)return!1;let s=rC&this.#o;return s===nC||s===FA||s===CF}shouldWalk(s,c){return(this.#o&FA)===FA&&!(this.#o&mut)&&!s.has(this)&&(!c||c(this))}async realpath(){if(this.#T)return this.#T;if(!((kue|Due|_x)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}realpathSync(){if(this.#T)return this.#T;if(!((kue|Due|_x)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}[xut](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let c=new Set([]),f=[],d=this;for(;d&&d.parent;)c.add(d),d.#D=f.join(this.sep),d.#k=f.join("/"),d=d.parent,f.push("..");for(d=s;d&&d.parent&&!c.has(d);)d.#D=void 0,d.#k=void 0,d=d.parent}},Pue=class a extends o1{static{t(this,"PathWin32")}sep="\\";splitSep=bsr;constructor(s,c=nC,f,d,v,E,A){super(s,c,f,d,v,E,A)}newChild(s,c=nC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}getRootString(s){return I3e.parse(s).root}getRoot(s){if(s=vsr(s.toUpperCase()),s===this.root.name)return this.root;for(let[c,f]of Object.entries(this.roots))if(this.sameRoot(s,c))return this.roots[s]=f;return this.roots[s]=new Dj(s,this).root}sameRoot(s,c=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(vut,"$1\\"),s===c}},Nue=class a extends o1{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,c=nC,f,d,v,E,A){super(s,c,f,d,v,E,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,c=nC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}},Iue=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),c,f,{nocase:d,childrenCacheSize:v=16*1024,fs:E=cQ}={}){this.#t=yut(E),(s instanceof URL||s.startsWith("file://"))&&(s=osr(s));let A=c.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new wue,this.#n=new wue,this.#e=new O3e(v);let O=A.substring(this.rootPath.length).split(f);if(O.length===1&&!O[0]&&O.pop(),d===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=d,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let M=this.root,W=O.length-1,$=c.sep,Q=this.rootPath,Pe=!1;for(let De of O){let Se=W--;M=M.child(De,{relative:new Array(Se).fill("..").join($),relativePosix:new Array(Se).fill("..").join("/"),fullpath:Q+=(Pe?"":$)+De}),Pe=!0}this.cwd=M}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#r.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpath();return this.#r.set(c,d),d}resolvePosix(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#n.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpathPosix();return this.#n.set(c,d),d}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,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f}=c;if(s.canReaddir()){let d=await s.readdir();return f?d:d.map(v=>v.name)}else return[]}readdirSync(s=this.cwd,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0}=c;return s.canReaddir()?f?s.readdirSync():s.readdirSync().map(d=>d.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:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=await s.readlink();return c?f:f?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=s.readlinkSync();return c?f:f?.fullpath()}async realpath(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=await s.realpath();return c?f:f?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=s.realpathSync();return c?f:f?.fullpath()}async walk(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set,M=t(($,Q)=>{O.add($),$.readdirCB((Pe,De)=>{if(Pe)return Q(Pe);let Se=De.length;if(!Se)return Q();let Tt=t(()=>{--Se===0&&Q()},"next");for(let wt of De)(!v||v(wt))&&A.push(f?wt:wt.fullpath()),d&&wt.isSymbolicLink()?wt.realpath().then(_r=>_r?.isUnknown()?_r.lstat():_r).then(_r=>_r?.shouldWalk(O,E)?M(_r,Tt):Tt()):wt.shouldWalk(O,E)?M(wt,Tt):Tt()},!0)},"walk"),W=s;return new Promise(($,Q)=>{M(W,Pe=>{if(Pe)return Q(Pe);$(A)})})}walkSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set([s]);for(let M of O){let W=M.readdirSync();for(let $ of W){(!v||v($))&&A.push(f?$:$.fullpath());let Q=$;if($.isSymbolicLink()){if(!(d&&(Q=$.realpathSync())))continue;Q.isUnknown()&&Q.lstatSync()}Q.shouldWalk(O,E)&&O.add(Q)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,c={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd),this.stream(s,c)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c;(!v||v(s))&&(yield f?s:s.fullpath());let A=new Set([s]);for(let O of A){let M=O.readdirSync();for(let W of M){(!v||v(W))&&(yield f?W:W.fullpath());let $=W;if(W.isSymbolicLink()){if(!(d&&($=W.realpathSync())))continue;$.isUnknown()&&$.lstatSync()}$.shouldWalk(A,E)&&A.add($)}}}stream(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new X3({objectMode:!0});(!v||v(s))&&A.write(f?s:s.fullpath());let O=new Set,M=[s],W=0,$=t(()=>{let Q=!1;for(;!Q;){let Pe=M.shift();if(!Pe){W===0&&A.end();return}W++,O.add(Pe);let De=t((Tt,wt,_r=!1)=>{if(Tt)return A.emit("error",Tt);if(d&&!_r){let lr=[];for(let Or of wt)Or.isSymbolicLink()&&lr.push(Or.realpath().then(hr=>hr?.isUnknown()?hr.lstat():hr));if(lr.length){Promise.all(lr).then(()=>De(null,wt,!0));return}}for(let lr of wt)lr&&(!v||v(lr))&&(A.write(f?lr:lr.fullpath())||(Q=!0));W--;for(let lr of wt){let Or=lr.realpathCached()||lr;Or.shouldWalk(O,E)&&M.push(Or)}Q&&!A.flowing?A.once("drain",$):Se||$()},"onReaddir"),Se=!0;Pe.readdirCB(De,!0),Se=!1}},"process");return $(),A}streamSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new X3({objectMode:!0}),O=new Set;(!v||v(s))&&A.write(f?s:s.fullpath());let M=[s],W=0,$=t(()=>{let Q=!1;for(;!Q;){let Pe=M.shift();if(!Pe){W===0&&A.end();return}W++,O.add(Pe);let De=Pe.readdirSync();for(let Se of De)(!v||v(Se))&&(A.write(f?Se:Se.fullpath())||(Q=!0));W--;for(let Se of De){let Tt=Se;if(Se.isSymbolicLink()){if(!(d&&(Tt=Se.realpathSync())))continue;Tt.isUnknown()&&Tt.lstatSync()}Tt.shouldWalk(O,E)&&M.push(Tt)}}Q&&!A.flowing&&A.once("drain",$)},"process");return $(),A}chdir(s=this.cwd){let c=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[xut](c)}},Dj=class extends Iue{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,I3e,"\\",{...c,nocase:f}),this.nocase=f;for(let d=this.cwd;d;d=d.parent)d.nocase=this.nocase}parseRootPath(s){return I3e.parse(s).root.toUpperCase()}newRoot(s){return new Pue(this.rootPath,FA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},Aj=class extends Iue{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),c={}){let{nocase:f=!1}=c;super(s,asr,"/",{...c,nocase:f}),this.nocase=f}parseRootPath(s){return"/"}newRoot(s){return new Nue(this.rootPath,FA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},fQ=class extends Aj{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,{...c,nocase:f})}},X9r=process.platform==="win32"?Pue:Nue,Dut=process.platform==="win32"?Dj:process.platform==="darwin"?fQ:Aj;var Tsr=t(a=>a.length>=1,"isPatternList"),Csr=t(a=>a.length>=1,"isGlobList"),kj=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,c,f,d){if(!Tsr(s))throw new TypeError("empty pattern list");if(!Csr(c))throw new TypeError("empty glob list");if(c.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,f<0||f>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=c,this.#e=f,this.#t=d,this.#e===0){if(this.isUNC()){let[v,E,A,O,...M]=this.#r,[W,$,Q,Pe,...De]=this.#n;M[0]===""&&(M.shift(),De.shift());let Se=[v,E,A,O,""].join("/"),Tt=[W,$,Q,Pe,""].join("/");this.#r=[Se,...M],this.#n=[Tt,...De],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[v,...E]=this.#r,[A,...O]=this.#n;E[0]===""&&(E.shift(),O.shift());let M=v+"/",W=A+"/";this.#r=[M,...E],this.#n=[W,...O],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]===cy}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 Esr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",wj=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:c,nocase:f,noext:d,noglobstar:v,platform:E=Esr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=E,this.mmopts={dot:!0,nobrace:c,nocase:f,noext:d,noglobstar:v,optimizationLevel:2,platform:E,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let c=new hS(s,this.mmopts);for(let f=0;f<c.set.length;f++){let d=c.set[f],v=c.globParts[f];if(!d||!v)throw new Error("invalid pattern object");for(;d[0]==="."&&v[0]===".";)d.shift(),v.shift();let E=new kj(d,v,0,this.platform),A=new hS(E.globString(),this.mmopts),O=v[v.length-1]==="**",M=E.isAbsolute();M?this.absolute.push(A):this.relative.push(A),O&&(M?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let c=s.fullpath(),f=`${c}/`,d=s.relative()||".",v=`${d}/`;for(let E of this.relative)if(E.match(d)||E.match(v))return!0;for(let E of this.absolute)if(E.match(c)||E.match(f))return!0;return!1}childrenIgnored(s){let c=s.fullpath()+"/",f=(s.relative()||".")+"/";for(let d of this.relativeChildren)if(d.match(f))return!0;for(let d of this.absoluteChildren)if(d.match(c))return!0;return!1}};var F3e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,c){return this.store.get(s.fullpath())?.has(c.globString())}storeWalked(s,c){let f=s.fullpath(),d=this.store.get(f);d?d.add(c.globString()):this.store.set(f,new Set([c.globString()]))}},L3e=class{static{t(this,"MatchRecord")}store=new Map;add(s,c,f){let d=(c?2:0)|(f?1:0),v=this.store.get(s);this.store.set(s,v===void 0?d:d&v)}entries(){return[...this.store.entries()].map(([s,c])=>[s,!!(c&2),!!(c&1)])}},R3e=class{static{t(this,"SubWalks")}store=new Map;add(s,c){if(!s.canReaddir())return;let f=this.store.get(s);f?f.find(d=>d.globString()===c.globString())||f.push(c):this.store.set(s,[c])}get(s){let c=this.store.get(s);if(!c)throw new Error("attempting to walk unknown path");return c}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},_Q=class a{static{t(this,"Processor")}hasWalkedCache;matches=new L3e;subwalks=new R3e;patterns;follow;dot;opts;constructor(s,c){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=c?c.copy():new F3e}processPatterns(s,c){this.patterns=c;let f=c.map(d=>[s,d]);for(let[d,v]of f){this.hasWalkedCache.storeWalked(d,v);let E=v.root(),A=v.isAbsolute()&&this.opts.absolute!==!1;if(E){d=d.resolve(E==="/"&&this.opts.root!==void 0?this.opts.root:E);let $=v.rest();if($)v=$;else{this.matches.add(d,!0,!1);continue}}if(d.isENOENT())continue;let O,M,W=!1;for(;typeof(O=v.pattern())=="string"&&(M=v.rest());)d=d.resolve(O),v=M,W=!0;if(O=v.pattern(),M=v.rest(),W){if(this.hasWalkedCache.hasWalked(d,v))continue;this.hasWalkedCache.storeWalked(d,v)}if(typeof O=="string"){let $=O===".."||O===""||O===".";this.matches.add(d.resolve(O),A,$);continue}else if(O===cy){(!d.isSymbolicLink()||this.follow||v.checkFollowGlobstar())&&this.subwalks.add(d,v);let $=M?.pattern(),Q=M?.rest();if(!M||($===""||$===".")&&!Q)this.matches.add(d,A,$===""||$===".");else if($===".."){let Pe=d.parent||d;Q?this.hasWalkedCache.hasWalked(Pe,Q)||this.subwalks.add(Pe,Q):this.matches.add(Pe,A,!0)}}else O instanceof RegExp&&this.subwalks.add(d,v)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,c){let f=this.subwalks.get(s),d=this.child();for(let v of c)for(let E of f){let A=E.isAbsolute(),O=E.pattern(),M=E.rest();O===cy?d.testGlobstar(v,E,M,A):O instanceof RegExp?d.testRegExp(v,O,M,A):d.testString(v,O,M,A)}return d}testGlobstar(s,c,f,d){if((this.dot||!s.name.startsWith("."))&&(c.hasMore()||this.matches.add(s,d,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,c):s.isSymbolicLink()&&(f&&c.checkFollowGlobstar()?this.subwalks.add(s,f):c.markFollowGlobstar()&&this.subwalks.add(s,c)))),f){let v=f.pattern();if(typeof v=="string"&&v!==".."&&v!==""&&v!==".")this.testString(s,v,f.rest(),d);else if(v===".."){let E=s.parent||s;this.subwalks.add(E,f)}else v instanceof RegExp&&this.testRegExp(s,v,f.rest(),d)}}testRegExp(s,c,f,d){c.test(s.name)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}testString(s,c,f,d){s.isNamed(c)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}};var xsr=t((a,s)=>typeof a=="string"?new wj([a],s):Array.isArray(a)?new wj(a,s):a,"makeIgnore"),Oue=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,c,f){if(this.patterns=s,this.path=c,this.opts=f,this.#e=!f.posix&&f.platform==="win32"?"\\":"/",this.includeChildMatches=f.includeChildMatches!==!1,(f.ignore||!this.includeChildMatches)&&(this.#n=xsr(f.ignore??[],f),!this.includeChildMatches&&typeof this.#n.add!="function")){let d="cannot ignore child matches, ignore lacks add() method.";throw new Error(d)}this.maxDepth=f.maxDepth||1/0,f.signal&&(this.signal=f.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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||await s.realpath(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=await v.realpath();E&&(E.isUnknown()||this.opts.stat)&&await E.lstat()}return this.matchCheckTest(v,c)}matchCheckTest(s,c){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!c||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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||s.realpathSync(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=v.realpathSync();E&&(E?.isUnknown()||this.opts.stat)&&E.lstatSync()}return this.matchCheckTest(v,c)}matchFinish(s,c){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let v=`${s.relativePosix()}/**`;this.#n.add(v)}let f=this.opts.absolute===void 0?c:this.opts.absolute;this.seen.add(s);let d=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(f){let v=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(v+d)}else{let v=this.opts.posix?s.relativePosix():s.relative(),E=this.opts.dotRelative&&!v.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(v?E+v+d:"."+d)}}async match(s,c,f){let d=await this.matchCheck(s,f);d&&this.matchFinish(d,c)}matchSync(s,c,f){let d=this.matchCheckSync(s,f);d&&this.matchFinish(d,c)}walkCB(s,c,f){this.signal?.aborted&&f(),this.walkCB2(s,c,new _Q(this.opts),f)}walkCB2(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirCached();A.calledReaddir()?this.walkCB3(A,O,f,E):A.readdirCB((M,W)=>this.walkCB3(A,W,f,E),!0)}E()}walkCB3(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let[A,O]of f.subwalks.entries())v++,this.walkCB2(A,O,f.child(),E);E()}walkCBSync(s,c,f){this.signal?.aborted&&f(),this.walkCB2Sync(s,c,new _Q(this.opts),f)}walkCB2Sync(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2Sync(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirSync();this.walkCB3Sync(A,O,f,E)}E()}walkCB3Sync(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let[A,O]of f.subwalks.entries())v++,this.walkCB2Sync(A,O,f.child(),E);E()}},pQ=class extends Oue{static{t(this,"GlobWalker")}matches=new Set;constructor(s,c,f){super(s,c,f)}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,c)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?c(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}},dQ=class extends Oue{static{t(this,"GlobStream")}results;constructor(s,c,f){super(s,c,f),this.results=new X3({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 Asr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",px=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,c){if(!c)throw new TypeError("glob options required");if(this.withFileTypes=!!c.withFileTypes,this.signal=c.signal,this.follow=!!c.follow,this.dot=!!c.dot,this.dotRelative=!!c.dotRelative,this.nodir=!!c.nodir,this.mark=!!c.mark,c.cwd?(c.cwd instanceof URL||c.cwd.startsWith("file://"))&&(c.cwd=Dsr(c.cwd)):this.cwd="",this.cwd=c.cwd||"",this.root=c.root,this.magicalBraces=!!c.magicalBraces,this.nobrace=!!c.nobrace,this.noext=!!c.noext,this.realpath=!!c.realpath,this.absolute=c.absolute,this.includeChildMatches=c.includeChildMatches!==!1,this.noglobstar=!!c.noglobstar,this.matchBase=!!c.matchBase,this.maxDepth=typeof c.maxDepth=="number"?c.maxDepth:1/0,this.stat=!!c.stat,this.ignore=c.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!c.windowsPathsNoEscape||c.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(O=>O.replace(/\\/g,"/"))),this.matchBase){if(c.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(O=>O.includes("/")?O:`./**/${O}`)}if(this.pattern=s,this.platform=c.platform||Asr,this.opts={...c,platform:this.platform},c.scurry){if(this.scurry=c.scurry,c.nocase!==void 0&&c.nocase!==c.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let O=c.platform==="win32"?Dj:c.platform==="darwin"?fQ:c.platform?Aj:Dut;this.scurry=new O(this.cwd,{nocase:c.nocase,fs:c.fs})}this.nocase=this.scurry.nocase;let f=this.platform==="darwin"||this.platform==="win32",d={...c,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:f,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},v=this.pattern.map(O=>new hS(O,d)),[E,A]=v.reduce((O,M)=>(O[0].push(...M.set),O[1].push(...M.globParts),O),[[],[]]);this.patterns=E.map((O,M)=>{let W=A[M];if(!W)throw new Error("invalid pattern object");return new kj(O,W,0,this.platform)})}async walk(){return[...await new pQ(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 pQ(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 dQ(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 dQ(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 M3e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let c of a)if(new hS(c,s).hasMagic())return!0;return!1},"hasMagic");function Fue(a,s={}){return new px(a,s).streamSync()}t(Fue,"globStreamSync");function kut(a,s={}){return new px(a,s).stream()}t(kut,"globStream");function wut(a,s={}){return new px(a,s).walkSync()}t(wut,"globSync");async function Aut(a,s={}){return new px(a,s).walk()}t(Aut,"glob_");function Lue(a,s={}){return new px(a,s).iterateSync()}t(Lue,"globIterateSync");function Put(a,s={}){return new px(a,s).iterate()}t(Put,"globIterate");var ksr=Fue,wsr=Object.assign(kut,{sync:Fue}),Psr=Lue,Nsr=Object.assign(Put,{sync:Lue}),Isr=Object.assign(wut,{stream:Fue,iterate:Lue}),mQ=Object.assign(Aut,{glob:Aut,globSync:wut,sync:Isr,globStream:kut,stream:wsr,globStreamSync:Fue,streamSync:ksr,globIterate:Put,iterate:Nsr,globIterateSync:Lue,iterateSync:Psr,Glob:px,hasMagic:M3e,escape:Sj,unescape:ux});mQ.glob=mQ;import fde from"fs";import vLe from"path";var hv=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 Osr="[",Fsr="]",Lsr="{",Rsr="}",Msr=":",jsr=",",Bsr="true",Usr="false",$sr="null",Jsr="NaN",qsr="Infinity",B3e='"',hQ=new Map([[34,B3e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
558
558
  `],[102,"\f"],[114,"\r"],[116," "]]),jue=new Map([...hQ,[118,"\v"],[48,"\0"]]),zsr=new Map([[B3e,B3e],["\\","\\"],["/","/"],["\b","b"],[`
559
559
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),MLr=new Map([...zsr,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),Mue=new Map([[Osr,"LBracket"],[Fsr,"RBracket"],[Lsr,"LBrace"],[Rsr,"RBrace"],[Msr,"Colon"],[jsr,"Comma"],[Bsr,"Boolean"],[Usr,"Boolean"],[$sr,"Null"]]),Rue=new Map([...Mue,[Jsr,"Number"],[qsr,"Number"]]),U3e=new Set([10,13,8232,8233]),BP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:c,column:f,offset:d}){super(`${s} (${c}:${f})`),this.line=c,this.column=f,this.offset=d}},$3e=class extends BP{static{t(this,"UnexpectedChar")}constructor(s,c){super(`Unexpected character '${String.fromCharCode(s)}' found.`,c)}},J3e=class extends BP{static{t(this,"UnexpectedIdentifier")}constructor(s,c){super(`Unexpected identifier '${s}' found.`,c)}},EF=class extends BP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Bue=class extends BP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},Vsr=/[\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]/,Wsr=/[\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]/,Hsr=13,Nut=10,q3e=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===Hsr?(this.#s=!0,this.peek()===Nut&&this.#t++):s===Nut&&(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}},Gsr="Infinity",Qsr="NaN",Ksr=new Set([116,102,110]),z3e=new Set([32,9,10,13]),Iut=new Set([...z3e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),Ysr={mode:"json",ranges:!1},Xsr=new Set(["true","false","null"]),H_={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 jP(a){return a>=48&&a<=57}t(jP,"isDigit");function j3e(a){return jP(a)||a>=65&&a<=70||a>=97&&a<=102}t(j3e,"isHexDigit");function Zsr(a){return a>=49&&a<=57}t(Zsr,"isPositiveDigit");function ear(a){return Ksr.has(a)}t(ear,"isKeywordStart");function Fut(a){return jP(a)||a===46||a===45}t(Fut,"isNumberStart");function tar(a){return Fut(a)||a===43}t(tar,"isJSON5NumberStart");function Out(a,s){return a===34||s&&a===39}t(Out,"isStringStart");function Lut(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 Vsr.test(s)}t(Lut,"isJSON5IdentifierStart");function rar(a){if(Lut(a)||jP(a))return!0;let s=String.fromCharCode(a);return Wsr.test(s)}t(rar,"isJSON5IdentifierPart");var V3e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,c){this.#n=s,this.#r={...Ysr,...c},this.#e=new q3e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?jue.has.bind(jue):hQ.has.bind(hQ),this.#c=this.#t?U3e.has.bind(U3e):()=>!1,this.#l=this.#t?f=>f===120:()=>!1,this.#i=this.#t?Iut.has.bind(Iut):z3e.has.bind(z3e)}#f(s,c=this.#e.locate()){throw new $3e(s,c)}#v(s,c=this.#e.locate()){throw new J3e(s,c)}#d(){throw new Bue(this.#e.locate())}#u(s,c,f,d){let v=f.offset+c,E=this.#r.ranges?{range:[f.offset,v]}:void 0;return{type:s,loc:{start:f,end:d||{line:f.line,column:f.column+c,offset:v}},...E}}#m(s){let c="",f;for(let d=0;d<s;d++){if(f=this.#e.peek(),j3e(f)){this.#e.next(),c+=String.fromCharCode(f);continue}this.#f(f)}return c}#g(s){let c="";do{if(c+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),c+=String.fromCharCode(s),c+=this.#m(4)),s=this.#e.peek(),!rar(s))break;this.#e.next()}while(!0);return c}#x(s){let c=s,f=1;for(s=this.#e.peek();s!==-1&&s!==c;){if(this.#e.next(),f++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),f++;else if(s===117){this.#e.next(),f++;let d=this.#m(4);f+=d.length}else if(this.#l(s)){this.#e.next(),f++;let d=this.#m(2);f+=d.length}else this.#t?(this.#e.next(),f++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),f++,f}#C(s){let c=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let f=this.#g(s);return f!==Gsr&&f!==Qsr&&this.#f(s),c+f.length}jP(s)||this.#f(s),this.#e.next(),c++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),c++,s=this.#e.peek(),j3e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),c++,s=this.#e.peek();while(j3e(s))}else jP(s)&&this.#f(s);else if(!this.#t||s!==46)for(Zsr(s)||this.#f(s),s=this.#e.peek();jP(s);)this.#e.next(),c++,s=this.#e.peek();if(s===46){let f=-1;for(this.#e.next(),c++,f++,s=this.#e.peek();jP(s);)this.#e.next(),c++,f++,s=this.#e.peek();!this.#t&&f===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),c++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),c++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),jP(s)||(this.#e.next(),this.#f(s));jP(s);)this.#e.next(),c++,s=this.#e.peek();return c}#b(s){let c=1;if(s=this.#e.peek(),s===47){do this.#e.next(),c+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:c,multiline:!1}}if(s===42){for(this.#e.next(),c+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),c+=1,s=this.#e.peek(),s===47)return this.#e.next(),c+=1,{length:c,multiline:!0}}else this.#e.next(),c+=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 H_.EOF;let c=this.#e.locate(),f=String.fromCharCode(s);if(this.#t)if(Rue.has(f))this.#a=this.#u(Rue.get(f),1,c);else if(Lut(s)){let d=this.#g(s);Rue.has(d)?this.#a=this.#u(Rue.get(d),d.length,c):this.#a=this.#u("Identifier",d.length,c)}else if(tar(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Out(s,this.#t)){let d=this.#x(s),v=this.#e.locate();this.#a=this.#u("String",d,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);else if(Mue.has(f))this.#a=this.#u(Mue.get(f),1,c);else if(ear(s)){let d=this.#g(s);Xsr.has(d)||this.#v(d,c),this.#a=this.#u(Mue.get(d),d.length,c)}else if(Fut(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(Out(s,this.#t)){let d=this.#x(s);this.#a=this.#u("String",d,c)}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);return H_[this.#a.type]}get token(){return this.#a}};var iC={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,c={}){return{type:"Member",name:a,value:s,loc:c.loc,...c}},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}}},nar={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function iar(a,s,c=!1){let f="",d=a.indexOf("\\"),v=0;for(;d>=0;){f+=a.slice(v,d);let E=a.charAt(d+1),A=E.charCodeAt(0);if(c&&jue.has(A))f+=jue.get(A),v=d+2;else if(hQ.has(A))f+=hQ.get(A),v=d+2;else if(E==="u"){let O=a.slice(d+2,d+6);if(O.length<4||/[^0-9a-f]/i.test(O))throw new BP(`Invalid unicode escape \\u${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+6}else if(c&&E==="x"){let O=a.slice(d+2,d+4);if(O.length<2||/[^0-9a-f]/i.test(O))throw new BP(`Invalid hex escape \\x${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+4}else if(c&&U3e.has(A))v=d+2,E==="\r"&&a.charAt(v)===`
560
- `&&v++;else if(c)f+=E,v=d+2;else throw new BP(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(iar,"getStringValue");function sar(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return iar(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(sar,"getLiteralValue");function Rut(a,s){s=Object.freeze({...nar,...s});let c=[],f=new V3e(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur}t(E,"nextNoComments");function A(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur>=H_.LineComment?A():ur}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(ur,er){if(ur!==er)throw new EF(f.token)}t(M,"assertTokenType");function W(ur,er){if(!er.includes(ur))throw new EF(f.token)}t(W,"assertTokenTypes");function $(ur,er){return s.ranges?{range:[ur.offset,er.offset]}:void 0}t($,"createRange");function Q(ur){let er=f.token,Es=$(er.loc.start,er.loc.end),wi=sar(a.slice(er.loc.start.offset,er.loc.end.offset),er,d),mi={loc:{start:{...er.loc.start},end:{...er.loc.end}},...Es};switch(ur){case H_.String:return iC.string(wi,mi);case H_.Number:return iC.number(wi,mi);case H_.Boolean:return iC.boolean(wi,mi);default:throw new TypeError(`Unknown token type ${er.type}.`)}}t(Q,"createLiteralNode");function Pe(ur){let er=$(ur.loc.start,ur.loc.end),Es=a.slice(ur.loc.start.offset,ur.loc.end.offset),fo={loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er};if(ur.type!=="Identifier"){let mi="";return(Es[0]==="+"||Es[0]==="-")&&(mi=Es[0]),iC[Es.includes("NaN")?"nan":"infinity"](mi,fo)}return iC.identifier(Es,fo)}t(Pe,"createJSON5IdentifierNode");function De(ur){let er=$(ur.loc.start,ur.loc.end);return iC.null({loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er})}t(De,"createNullNode");function Se(ur){d?W(ur,[H_.String,H_.Identifier,H_.Number]):M(ur,H_.String);let er=f.token,Es=ur===H_.String?Q(ur):Pe(er);if(d&&(Es.type==="NaN"||Es.type==="Infinity")){if(Es.sign!=="")throw new EF(f.token);Es=iC.identifier(Es.type,{loc:Es.loc,...$(Es.loc.start,Es.loc.end)})}ur=O(),M(ur,H_.Colon);let wi=_r(),fo=$(Es.loc.start,wi.loc.end);return iC.member(Es,wi,{loc:{start:{...Es.loc.start},end:{...wi.loc.end}},...fo})}t(Se,"parseProperty");function Tt(ur){M(ur,H_.LBrace);let er=f.token,Es=[],wi=O();if(wi!==H_.RBrace)do{if(Es.push(Se(wi)),wi=O(),!wi)throw new Bue(Es[Es.length-1].loc.end);if(wi===H_.Comma){if(wi=O(),v&&wi===H_.RBrace)break}else break}while(wi);M(wi,H_.RBrace);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.object(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(Tt,"parseObject");function wt(ur){M(ur,H_.LBracket);let er=f.token,Es=[],wi=O();if(wi!==H_.RBracket)do{let wo=_r(wi);if(Es.push(iC.element(wo,{loc:wo.loc})),wi=O(),wi===H_.Comma){if(wi=O(),v&&wi===H_.RBracket)break}else break}while(wi);M(wi,H_.RBracket);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.array(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(wt,"parseArray");function _r(ur){ur=ur??O();let er=f.token;switch(ur){case H_.String:case H_.Boolean:return Q(ur);case H_.Number:if(d){let Es=a.slice(er.loc.start.offset,er.loc.end.offset);if((Es[0]==="+"||Es[0]==="-")&&(Es=Es.slice(1)),Es==="NaN"||Es==="Infinity")return Pe(er)}return Q(ur);case H_.Null:return De(er);case H_.LBrace:return Tt(ur);case H_.LBracket:return wt(ur);default:throw new EF(er)}}t(_r,"parseValue");let lr=_r();if(O())throw new EF(f.token);let hr={loc:{start:{line:1,column:1,offset:0},end:{...lr.loc.end}}};return s.tokens&&(hr.tokens=c),s.ranges&&(hr.range=[hr.loc.start.offset,hr.loc.end.offset]),iC.document(lr,hr)}t(Rut,"parse");var aar=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Mut(a){return a&&typeof a=="object"}t(Mut,"isObject");function oar(a){return Mut(a)&&typeof a.type=="string"}t(oar,"isNode");function car(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of aar.get(f.type)){let E=f[v];Mut(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):oar(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(car,"traverse");function jut(a,s=()=>!0){let c=[];return car(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(jut,"iterator");import lar from"fs/promises";var gQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Uue=t(async a=>{try{return await lar.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),yQ=t(async a=>{try{return Rut(a)}catch(s){if(s.column&&s.line&&s.message){let c=gQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var But=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await Uue(f),v=await uar(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),uar=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await yQ(a);if(v){for(let{node:E}of jut(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=gQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Uut from"fs/promises";import $ue from"path";var W3e="schemas",H3e=".oas.json";var xF=t(async a=>(await Uut.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(H3e)).sort(),"getOpenApiFilesByAlphabetical"),Pj=t(async a=>{let s=$ue.resolve(a,"config");return(await Uut.readdir(s)).filter(f=>f.endsWith(H3e)).length>=1},"oasFileInProject");function vQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new pv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),G3e(Q3e(c),s,A,f,d,v,E)}t(vQ,"chaseRefs");function G3e(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)G3e(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),vQ(a,s,Z3(a,O),f,d,v,E)}G3e(a,s,c[A],f,d,v,E)}}t(G3e,"lookForRefs");function Z3(a,s){let c=s.indexOf("#");return c>=0?`${$ue.resolve(a,s.substring(0,c))}${s.substring(c)}`:$ue.resolve($ue.dirname(a),s)}t(Z3,"getFullyQualifiedRefName");function Q3e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Q3e,"getFilePathNameFromRefName");var K3e=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME?process.env.ZUP_WORKING_COPY_HOSTNAME:this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},far=new K3e,Y3e=far;var RQ=Mp(_Ie(),1);var pIe={};Uct(pIe,{UnsafePathError:()=>dfe,deleteFile:()=>Xur,deleteFolder:()=>ofr,dirExists:()=>mfe,ensureDirectoryExists:()=>rfr,fileExists:()=>Yur,getParentDirFilename:()=>ifr,isNotFileOrDirectory:()=>Zur,listFolderContents:()=>dpt,listFolders:()=>tfr,mkdirForFilePathIfNotExits:()=>hpt,mkdirIfNotExists:()=>mpt,safePath:()=>nfr,tarFolderContent:()=>sfr,untar:()=>afr});import _pt from"child_process";import oN from"fs/promises";import aN from"path";var ppt=[".git","node_modules",".yarn",".DS_Store"];async function Yur(a){try{return(await oN.stat(a)).isFile()}catch{return!1}}t(Yur,"fileExists");async function Xur(a,s){return await oN.rm(a,s)}t(Xur,"deleteFile");async function mfe(a){try{return(await oN.stat(a)).isDirectory()}catch{return!1}}t(mfe,"dirExists");async function Zur(a){try{return await oN.stat(a),!1}catch{return!0}}t(Zur,"isNotFileOrDirectory");function efr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(efr,"getParentDirectory");async function tfr(a){if(!await mfe(a))return[];let s=await oN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)ppt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(tfr,"listFolders");async function dpt(a,s,c=!0){let f=efr(a,s),d=await oN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!ppt.includes(E.name)||!c)if(E.isDirectory()){let A=await dpt(aN.join(a,E.name),s,c);v.push(...A)}else v.push(aN.join(f,E.name));return v}t(dpt,"listFolderContents");var mpt=t(async a=>{if(await mfe(a))return!0;await oN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),hpt=t(async a=>{let s=aN.dirname(a);return mpt(s)},"mkdirForFilePathIfNotExits"),rfr=hpt,dfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function nfr(a){let s=t(c=>{if(!c.startsWith(a))throw new dfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(aN.resolve(...c)),"resolve")}}t(nfr,"safePath");function ifr(a){return`${aN.basename(aN.dirname(a))}/${aN.basename(a)}`}t(ifr,"getParentDirFilename");function sfr(a,s,c,f){let d=aN.join(f,c);return _pt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${d} ${s}`,{cwd:a}),d}t(sfr,"tarFolderContent");function afr(a,s,c,f=!1){_pt.execSync(`tar -xf ${s} ${f?"--strip-components=1 ":""}-C ${c}`,{cwd:a})}t(afr,"untar");async function ofr(a){if(await mfe(a))return await oN.rm(a,{recursive:!0})}t(ofr,"deleteFolder");var Ul=pIe;var cC=Mp(_Ie(),1);import{readFile as cfr}from"fs/promises";var FF=class extends Error{static{t(this,"CustomResolveError")}},cN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return RQ.$RefParser.dereference(s,{resolve:{json:!0,file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return RQ.$RefParser.bundle(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return RQ.$RefParser.parse(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return RQ.$RefParser.resolve(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function hfe(a,s){return{order:100,canRead(c){let f=ffr(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=gpt(c.url)}catch(E){throw new FF(`Malformed URI: ${c.url}`,{cause:E})}try{Ul.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=gpt(c.url)}catch(d){throw new FF(`Malformed URI: ${c.url}`,{cause:d})}try{return await cfr(f)}catch(d){throw new FF(`Error opening file "${f}"`,{cause:d})}}}}t(hfe,"customResolver");var dIe=/^win/.test(globalThis.process?globalThis.process.platform:""),lfr=/\//g,ufr=/^(\w{2,}):\/\//i,mIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function ffr(a){let s=ufr.exec(a);if(s)return s[1].toLowerCase()}t(ffr,"getProtocol");function gpt(a,s){a=decodeURI(a);for(let f=0;f<mIe.length;f+=2)a=a.replace(mIe[f],mIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),dIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=dIe?a:"/"+a)),dIe&&!c&&(a=a.replace(lfr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(gpt,"toFileSystemPath");var ypt="YOUR_KEY_HERE";async function vpt(a){let c=await new cN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return _fr({...a,relativeOpenApiPath:f},c)}t(vpt,"buildPublicOpenApiFile");async function _fr(a,s){hfr({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=dfr(c),pfr(c,a),c=mfr(c,a),bpt(c,"x-zuplo"),c}t(_fr,"buildRawOpenApiFile");function pfr(a,{customDomain:s,deploymentName:c,environmentType:f}){let d;s?d=s:f&&c&&(d=f===qct.WORKING_COPY?`${c}.${Y3e.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${Y3e.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(pfr,"addServerHost");function dfr(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(hj in A&&cue(A[hj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(W=>{let $=A[W];if(!$)return;if(cue($[hj])){delete O[W];return}let{parameters:Q}=$;if(!Q)return;let Pe=Q.filter(De=>{if(hj in De&&cue(De[hj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Pe}}),M.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(dfr,"removeHiddenRoutesAndParams");function mfr(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,Q)=>{let Pe=s.policies?.find(({name:Tt})=>Tt===Q);if(!Pe)return $;if(!(Pe.handler.export==="CompositeInboundPolicy"))return $.concat(Q);let Se=Pe.handler.options?.policies;return Se?$.concat(Se):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="ApiAuthKeyInboundPolicy"||Q.handler.export==="ApiKeyInboundPolicy")&&!Q.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(Q)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",Q=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Pe=Q!==""?`${Q} ${ypt}`:ypt,De={name:$,in:"header",required:!0,example:Pe,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Pe}\`.`};A.parameters?A.parameters.some(_r=>"name"in _r&&_r.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:Q.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(_r=>"name"in _r&&_r.type==="apiKey"||"type"in _r&&_r.type==="http"&&_r.scheme===Q)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let wt={[Tt]:[]};A.security?A.security.some(_r=>_r[Tt]!==void 0)||A.security.unshift(wt):A.security=[wt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="RateLimitInboundPolicy"||Q.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(Q)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Q={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:Q},A.responses||(A.responses={});let Pe=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Pe?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(mfr,"enrichSpecWithZuploData");function bpt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&bpt(a[c],s)}t(bpt,"removePropertiesByPrefix");function hfr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new pv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new pv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new pv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(hfr,"assertIsZuploOpenApiSpec");function gfr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let W=a.charAt(M),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let W=0,$=0,Q=0,Pe=M.length;for(;Q!==Pe&&M[Q]===0;)Q++,W++;let De=(Pe-Q)*v+1>>>0,Se=new Uint8Array(De);for(;Q!==Pe;){let _r=M[Q],lr=0;for(let Or=De-1;(_r!==0||lr<$)&&Or!==-1;Or--,lr++)_r+=256*Se[Or]>>>0,Se[Or]=_r%c>>>0,_r=_r/c>>>0;if(_r!==0)throw new Error("Non-zero carry");$=lr,Q++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let wt=f.repeat(W);for(;Tt<De;++Tt)wt+=a.charAt(Se[Tt]);return wt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let W=0,$=0,Q=0;for(;M[W]===f;)$++,W++;let Pe=(M.length-W)*d+1>>>0,De=new Uint8Array(Pe);for(;M[W];){let _r=s[M.charCodeAt(W)];if(_r===255)return;let lr=0;for(let Or=Pe-1;(_r!==0||lr<Q)&&Or!==-1;Or--,lr++)_r+=c*De[Or]>>>0,De[Or]=_r%256>>>0,_r=_r/256>>>0;if(_r!==0)throw new Error("Non-zero carry");Q=lr,W++}let Se=Pe-Q;for(;Se!==Pe&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Pe-Se)),wt=$;for(;Se!==Pe;)Tt[wt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(M){let W=A(M);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(gfr,"base");var Spt=gfr;var yfr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",gfe=Spt(yfr);var hIe="2024-09-02",Tpt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function Cpt(){return new lC({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:hIe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:Tpt[hIe]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(Cpt,"getMockEnvironment");var lC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=Cpt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(gfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var vfr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function Ept(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!vfr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(Ept,"isRestrictedEnvVariableName");function xpt(a){return!!a.startsWith("ZUPLO_")}t(xpt,"isZuploReadableEnvVariableName");var wjr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return lC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return lC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return lC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return lC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return lC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return lC.instance.build.BUILD_ID}if(!(Ept(c)&&!xpt(c)))return lC.instance.runtime[c]}});function MQ(a,s,c){return`_${zP(`${a}_${s}_${c}`)}`}t(MQ,"getRawOperationDataIdentifierName");function gIe(a,s,c,f){return`_${zP(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(gIe,"getIdForParameterSchema");function yIe(a,s,c){return`_${zP(a.toLowerCase())}_${s.toLowerCase()}_rb_${zP(c.toLowerCase())}`}t(yIe,"getIdForRequestBodySchema");function jQ(a,s){return`_${zP(a)}_${zP(s)}`}t(jQ,"getIdForRefSchema");function zP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(zP,"sanitizedIdentifierName");var nyt=Mp(mmt(),1);import q_e from"path";var eK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fdr=/[$_\p{ID_Start}]/u,_dr=/[$_\u200C\u200D\p{ID_Continue}]/u,_8e=".*";function pdr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pdr,"Re");function ymt(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&fdr.test(O)||A!==f+1&&_dr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!pdr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(ymt,"v");function vmt(a,s={}){let c=ymt(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${pC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(lr=>{if(E<c.length&&c[E].type===lr)return c[E++].value},"a"),W=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(lr=>{let Or=M(lr);if(Or!==void 0)return Or;let{type:hr,index:ur}=c[E];throw new TypeError(`Unexpected ${hr} at ${ur}, expected ${lr}`)},"d"),Q=t(()=>{let lr="",Or;for(;Or=M("CHAR")??M("ESCAPED_CHAR");)lr+=Or;return lr},"T"),Pe=t(lr=>lr,"Se"),De=s.encodePart||Pe,Se="",Tt=t(lr=>{Se+=lr},"U"),wt=t(()=>{Se.length&&(d.push(new eK(3,"","",De(Se),"",3)),Se="")},"$"),_r=t((lr,Or,hr,ur,er)=>{let Es=3;switch(er){case"?":Es=1;break;case"*":Es=0;break;case"+":Es=2;break}if(!Or&&!hr&&Es===3){Tt(lr);return}if(wt(),!Or&&!hr){if(!lr)return;d.push(new eK(3,"","",De(lr),"",Es));return}let wi;hr?hr==="*"?wi=_8e:wi=hr:wi=f;let fo=2;wi===f?(fo=1,wi=""):wi===_8e&&(fo=0,wi="");let mi;if(Or?mi=Or:hr&&(mi=v++),O.has(mi))throw new TypeError(`Duplicate name '${mi}'.`);O.add(mi),d.push(new eK(fo,mi,De(lr),wi,De(ur),Es))},"V");for(;E<c.length;){let lr=M("CHAR"),Or=M("NAME"),hr=M("REGEX");if(!Or&&!hr&&(hr=M("ASTERISK")),Or||hr){let er=lr??"";s.prefixes.indexOf(er)===-1&&(Tt(er),er=""),wt();let Es=W();_r(er,Or,hr,"",Es);continue}let ur=lr??M("ESCAPED_CHAR");if(ur){Tt(ur);continue}if(M("OPEN")){let er=Q(),Es=M("NAME"),wi=M("REGEX");!Es&&!wi&&(wi=M("ASTERISK"));let fo=Q();$("CLOSE");let mi=W();_r(er,Es,wi,fo,mi);continue}wt(),$("END")}return d}t(vmt,"D");function pC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pC,"S");function hmt(a){return a&&a.ignoreCase?"ui":"u"}t(hmt,"X");function ddr(a,s,c){return bmt(vmt(a,c),s,c)}t(ddr,"Z");function eB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(eB,"k");function bmt(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=pC(A.value):f+=`(?:${pC(A.value)})${eB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${pC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=_8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${eB(A.modifier)}`:f+=`((?:${M})${eB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${pC(A.prefix)}(${M})${pC(A.suffix)})`,f+=eB(A.modifier);continue}f+=`(?:${pC(A.prefix)}`,f+=`((?:${M})(?:`,f+=pC(A.suffix),f+=pC(A.prefix),f+=`(?:${M}))*)${pC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${pC(c.endsWith)}]|$`,v=`[${pC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,hmt(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,hmt(c))}t(bmt,"F");var _N={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mdr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hdr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gdr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gdr,"J");function Smt(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Smt,"Q");function ydr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ydr,"Ee");function Tmt(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(Tmt,"W");var Cmt=["ftp","file","http","https","ws","wss"];function Emt(a){if(!a)return!0;for(let s of Cmt)if(a.test(s))return!0;return!1}t(Emt,"N");function vdr(a,s){if(a=Smt(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(vdr,"te");function bdr(a,s){if(a=Smt(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(bdr,"re");function Sdr(a,s){return s||a===""?a:Tmt(a)?Amt(a):Dmt(a)}t(Sdr,"ne");function Tdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Tdr,"se");function Cdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Cdr,"ie");function Edr(a,s,c){if(c||a==="")return a;if(s&&!Cmt.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Edr,"ae");function xdr(a,s,c){return xmt(s)===a&&(a=""),c||a===""?a:kmt(a)}t(xdr,"oe");function Ddr(a,s){return a=ydr(a,":"),s||a===""?a:p8e(a)}t(Ddr,"ce");function xmt(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(xmt,"_");function p8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(p8e,"y");function Adr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Adr,"le");function kdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(kdr,"fe");function Dmt(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Dmt,"z");function Amt(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Amt,"j");function kmt(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(kmt,"K");function wdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(wdr,"he");function Pdr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Pdr,"ue");function Ndr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ndr,"de");function Idr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Idr,"pe");var Odr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=ymt(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,_N),a.encodePart=p8e;let s=ddr(this.#T(),void 0,a);this.#l=Emt(s)}},f8e=["protocol","username","password","hostname","port","pathname","search","hash"],fN="*";function gmt(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(gmt,"ge");function QP(a,s){return s?ZQ(a):a}t(QP,"b");function XQ(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=QP(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=QP(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=QP(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=QP(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=QP(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=QP(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=QP(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=QP(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Ddr(s.protocol,c)),typeof s.username=="string"&&(a.username=Cdr(s.username,c)),typeof s.password=="string"&&(a.password=Tdr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=Sdr(s.hostname,c)),typeof s.port=="string"&&(a.port=xdr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!gdr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=QP(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Edr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=bdr(s.search,c)),typeof s.hash=="string"&&(a.hash=vdr(s.hash,c)),a}t(XQ,"w");function ZQ(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(ZQ,"C");function Fdr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fdr,"Oe");function Ldr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Fdr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=ZQ(A.value);continue}v+=`{${ZQ(A.value)}}${eB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let Q=$.value.length>0?$.value[0]:"";M=d.test(Q)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&W&&W.type===3){let Q=W.value[W.value.length-1];M=s.prefixes.includes(Q)}M&&(v+="{"),v+=ZQ(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=ZQ(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=eB(A.modifier))}return v}t(Ldr,"ke");var wmt=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Odr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:fN,protocol:fN,username:fN,password:fN,hostname:fN,port:fN,search:fN,hash:fN};this.#r=XQ(v,a,!0),xmt(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of f8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,_N),A.encodePart=p8e;break;case"username":Object.assign(A,_N),A.encodePart=Adr;break;case"password":Object.assign(A,_N),A.encodePart=kdr;break;case"hostname":Object.assign(A,mdr),Tmt(O)?A.encodePart=Amt:A.encodePart=Dmt;break;case"port":Object.assign(A,_N),A.encodePart=kmt;break;case"pathname":Emt(this.#n.protocol)?(Object.assign(A,hdr,d),A.encodePart=wdr):(Object.assign(A,_N,d),A.encodePart=Pdr);break;case"search":Object.assign(A,_N,d),A.encodePart=Ndr;break;case"hash":Object.assign(A,_N,d),A.encodePart=Idr;break}try{this.#s[E]=vmt(O,A),this.#n[E]=bmt(this.#s[E],this.#e[E],A),this.#t[E]=Ldr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,gmt(a,s),!1)}catch{return!1}let f;for(f of f8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,gmt(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of f8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new eK(3,"","","","",3),v=new eK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let W=f(A[M],O[M]);if(W)return W}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=wmt);import{AssertionError as Rdr}from"assert";function KP(a,s){if(a===!1)throw new Rdr({message:s})}t(KP,"assert");var Hc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Hc||(Hc={}));function tB(a){return a.type===Hc.Object}t(tB,"isAstObject");function YP(a){return a.type===Hc.Property}t(YP,"isAstProperty");function Pmt(a){return a.type===Hc.Array}t(Pmt,"isAstArray");function rB(a){return a.type===Hc.Literal}t(rB,"isAstLiteral");function $F(a){if(a===void 0)throw new Error("Node is undefined");if(!tB(a))throw new Error("Node is not object")}t($F,"assertAstObject");import{findNodeAtLocation as Mdr,getNodeValue as jdr,printParseErrorCode as Bdr,visit as Udr}from"jsonc-parser";var $dr={DEFAULT:{allowTrailingComma:!1}};function tK(a,s=[],c=$dr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),Udr(a,{onObjectBegin:t((O,M,W)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,W,$,Q)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:Q+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:W,line:$,column:Q,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,W,$,Q)=>{v({type:Jdr(O),offset:M,length:W,line:$+1,column:Q+1,parent:f,value:O}),d(M+W)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,W,$,Q)=>{s.push({error:O,offset:M,length:W,line:$+1,column:Q+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(tK,"parse");function Jdr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jdr,"getNodeType");function d8e(a,s){return Mdr(a,s)}t(d8e,"findNodeAtLocation");function rK(a){return jdr(a)}t(rK,"getNodeValue");function Nmt(a){return Bdr(a)}t(Nmt,"printParseErrorCode");var nK=class{static{t(this,"AstAdapter")}parse(s){let f=tK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Hc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Hc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){KP(s.children?.length===2,"Invalid property node");let f={type:Hc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Hc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Hc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Ex={createLiteral:t((a,s)=>({type:Hc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Hc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Hc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Hc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Hc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Hc.Array,parent:s,children:[]};for(let f of a)c.children.push(Ex.createLiteral(f,c));return c},"createArrayOfLiterals")};var qdr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,iK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Hc.Array:return this.generateArray(s,c);case Hc.Object:return this.generateObject(s,c);case Hc.Property:return this.generateProperty(s,c);case Hc.Literal:return this.generateLiteral(s,c);case Hc.FunctionCall:return this.generateFunctionCall(s,c);case Hc.Identifier:return this.generateIdentifier(s,c);case Hc.Raw:return this.generateRaw(s,c);case Hc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=qdr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as zdr}from"@swc/core";import Vdr from"fs/promises";var Imt=t(async a=>{let s=new Set;try{let c=await Vdr.readFile(a,"utf-8");(await zdr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Omt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var m8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Fmt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var h8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var g8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var H0t=Mp(h0t(),1),G0t=Mp(W0t(),1);var L_e=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new G0t.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,H0t.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(M)?void 0:c[O][M][W];v={details:{property:O,index:M,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var TN=L_e.instance;TN.addSchema(g8e,"route-configuration.schema.json");TN.addSchema(Fmt,"policy-configuration.schema.json");TN.addSchema(m8e,"policies.schema.json");TN.addSchema(h8e,"open-api-route-configuration.schema.json");TN.addSchema(Omt,"fragments.schema.json");var kqr=TN.compile(g8e),Q0t=TN.compile(h8e),IFe=TN.compile(m8e);var R_e=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=IFe(s),this.results}};var M_e=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Q0t(s),this.results}};import Yvr from"path";var OFe=/\$import\((.*)\)/,j_e=/\$env\((.*?)\)/g;var r6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Kvr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),CN=t((a,s)=>{if(!a)return!1;let c=Kvr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||YP(A)&&A.name.value===v?!0:v==="{}"?A.type===Hc.Object:v==="[]"?A.type===Hc.Array:!1:!1})},"testPosition");var B_e=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),tB(s)?s.children.forEach(c=>{this.visitor(c)}):Pmt(s)?s.children.forEach(c=>{this.visitor(c)}):YP(s)&&this.visitor(s.value)}},K0t=t((a,s,c)=>f=>{if(!YP(f)||!rB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>CN(f,v))){j_e.test(f.value.value)&&s.push(new r6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(j_e).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Hc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(j_e),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Ex.createTemplateString(v,f))}},"getEnvStatementTransformer");var MK="config/routes.json",Xvr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zvr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Y0t=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ebr="handler/{}/options/{}/rewritePattern",tbr="handler/{}/options/{}/baseUrl",U_e=class extends B_e{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!YP(s)||!rB(s.value)||typeof s.value.value!="string")&&CN(s,ebr)){if(!s.parent||!tB(s.parent)){this.errors.push(new r6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:X0t(c)},d=Ex.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!YP(s)||!rB(s.value)||typeof s.value.value!="string")&&CN(s,tbr)){if(!s.parent||!tB(s.parent)){this.errors.push(new r6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:X0t(c)},d=Ex.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!YP(s)||!rB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Zvr.some(A=>CN(s,A))&&!Y0t.some(A=>CN(s,A))){if(OFe.test(c)){if(s.name.value==="$ref")return;this.errors.push(new r6("An $import() statement is not expected at this location.",MK,s.location,c))}return}let f=OFe.exec(c);if(Y0t.some(A=>CN(s,A))&&!f)return;if(!f){this.errors.push(new r6("Invalid $import() statement",MK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Yvr.join("..",d));let v=this.getImportName(d),E={type:Hc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=K0t(Xvr,this.errors,MK)};function X0t(a){return`(request, context) => {
560
+ `&&v++;else if(c)f+=E,v=d+2;else throw new BP(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(iar,"getStringValue");function sar(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return iar(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(sar,"getLiteralValue");function Rut(a,s){s=Object.freeze({...nar,...s});let c=[],f=new V3e(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur}t(E,"nextNoComments");function A(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur>=H_.LineComment?A():ur}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(ur,er){if(ur!==er)throw new EF(f.token)}t(M,"assertTokenType");function W(ur,er){if(!er.includes(ur))throw new EF(f.token)}t(W,"assertTokenTypes");function $(ur,er){return s.ranges?{range:[ur.offset,er.offset]}:void 0}t($,"createRange");function Q(ur){let er=f.token,Es=$(er.loc.start,er.loc.end),wi=sar(a.slice(er.loc.start.offset,er.loc.end.offset),er,d),mi={loc:{start:{...er.loc.start},end:{...er.loc.end}},...Es};switch(ur){case H_.String:return iC.string(wi,mi);case H_.Number:return iC.number(wi,mi);case H_.Boolean:return iC.boolean(wi,mi);default:throw new TypeError(`Unknown token type ${er.type}.`)}}t(Q,"createLiteralNode");function Pe(ur){let er=$(ur.loc.start,ur.loc.end),Es=a.slice(ur.loc.start.offset,ur.loc.end.offset),fo={loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er};if(ur.type!=="Identifier"){let mi="";return(Es[0]==="+"||Es[0]==="-")&&(mi=Es[0]),iC[Es.includes("NaN")?"nan":"infinity"](mi,fo)}return iC.identifier(Es,fo)}t(Pe,"createJSON5IdentifierNode");function De(ur){let er=$(ur.loc.start,ur.loc.end);return iC.null({loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er})}t(De,"createNullNode");function Se(ur){d?W(ur,[H_.String,H_.Identifier,H_.Number]):M(ur,H_.String);let er=f.token,Es=ur===H_.String?Q(ur):Pe(er);if(d&&(Es.type==="NaN"||Es.type==="Infinity")){if(Es.sign!=="")throw new EF(f.token);Es=iC.identifier(Es.type,{loc:Es.loc,...$(Es.loc.start,Es.loc.end)})}ur=O(),M(ur,H_.Colon);let wi=_r(),fo=$(Es.loc.start,wi.loc.end);return iC.member(Es,wi,{loc:{start:{...Es.loc.start},end:{...wi.loc.end}},...fo})}t(Se,"parseProperty");function Tt(ur){M(ur,H_.LBrace);let er=f.token,Es=[],wi=O();if(wi!==H_.RBrace)do{if(Es.push(Se(wi)),wi=O(),!wi)throw new Bue(Es[Es.length-1].loc.end);if(wi===H_.Comma){if(wi=O(),v&&wi===H_.RBrace)break}else break}while(wi);M(wi,H_.RBrace);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.object(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(Tt,"parseObject");function wt(ur){M(ur,H_.LBracket);let er=f.token,Es=[],wi=O();if(wi!==H_.RBracket)do{let wo=_r(wi);if(Es.push(iC.element(wo,{loc:wo.loc})),wi=O(),wi===H_.Comma){if(wi=O(),v&&wi===H_.RBracket)break}else break}while(wi);M(wi,H_.RBracket);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.array(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(wt,"parseArray");function _r(ur){ur=ur??O();let er=f.token;switch(ur){case H_.String:case H_.Boolean:return Q(ur);case H_.Number:if(d){let Es=a.slice(er.loc.start.offset,er.loc.end.offset);if((Es[0]==="+"||Es[0]==="-")&&(Es=Es.slice(1)),Es==="NaN"||Es==="Infinity")return Pe(er)}return Q(ur);case H_.Null:return De(er);case H_.LBrace:return Tt(ur);case H_.LBracket:return wt(ur);default:throw new EF(er)}}t(_r,"parseValue");let lr=_r();if(O())throw new EF(f.token);let hr={loc:{start:{line:1,column:1,offset:0},end:{...lr.loc.end}}};return s.tokens&&(hr.tokens=c),s.ranges&&(hr.range=[hr.loc.start.offset,hr.loc.end.offset]),iC.document(lr,hr)}t(Rut,"parse");var aar=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function Mut(a){return a&&typeof a=="object"}t(Mut,"isObject");function oar(a){return Mut(a)&&typeof a.type=="string"}t(oar,"isNode");function car(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of aar.get(f.type)){let E=f[v];Mut(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):oar(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(car,"traverse");function jut(a,s=()=>!0){let c=[];return car(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(jut,"iterator");import lar from"fs/promises";var gQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),Uue=t(async a=>{try{return await lar.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),yQ=t(async a=>{try{return Rut(a)}catch(s){if(s.column&&s.line&&s.message){let c=gQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var But=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await Uue(f),v=await uar(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),uar=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await yQ(a);if(v){for(let{node:E}of jut(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=gQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Uut from"fs/promises";import $ue from"path";var W3e="schemas",H3e=".oas.json";var xF=t(async a=>(await Uut.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(H3e)).sort(),"getOpenApiFilesByAlphabetical"),Pj=t(async a=>{let s=$ue.resolve(a,"config");return(await Uut.readdir(s)).filter(f=>f.endsWith(H3e)).length>=1},"oasFileInProject");function vQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new pv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),G3e(Q3e(c),s,A,f,d,v,E)}t(vQ,"chaseRefs");function G3e(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)G3e(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),vQ(a,s,Z3(a,O),f,d,v,E)}G3e(a,s,c[A],f,d,v,E)}}t(G3e,"lookForRefs");function Z3(a,s){let c=s.indexOf("#");return c>=0?`${$ue.resolve(a,s.substring(0,c))}${s.substring(c)}`:$ue.resolve($ue.dirname(a),s)}t(Z3,"getFullyQualifiedRefName");function Q3e(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(Q3e,"getFilePathNameFromRefName");var K3e=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},far=new K3e,Y3e=far;var RQ=Mp(_Ie(),1);var pIe={};Uct(pIe,{UnsafePathError:()=>dfe,deleteFile:()=>Xur,deleteFolder:()=>ofr,dirExists:()=>mfe,ensureDirectoryExists:()=>rfr,fileExists:()=>Yur,getParentDirFilename:()=>ifr,isNotFileOrDirectory:()=>Zur,listFolderContents:()=>dpt,listFolders:()=>tfr,mkdirForFilePathIfNotExits:()=>hpt,mkdirIfNotExists:()=>mpt,safePath:()=>nfr,tarFolderContent:()=>sfr,untar:()=>afr});import _pt from"child_process";import oN from"fs/promises";import aN from"path";var ppt=[".git","node_modules",".yarn",".DS_Store"];async function Yur(a){try{return(await oN.stat(a)).isFile()}catch{return!1}}t(Yur,"fileExists");async function Xur(a,s){return await oN.rm(a,s)}t(Xur,"deleteFile");async function mfe(a){try{return(await oN.stat(a)).isDirectory()}catch{return!1}}t(mfe,"dirExists");async function Zur(a){try{return await oN.stat(a),!1}catch{return!0}}t(Zur,"isNotFileOrDirectory");function efr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(efr,"getParentDirectory");async function tfr(a){if(!await mfe(a))return[];let s=await oN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)ppt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(tfr,"listFolders");async function dpt(a,s,c=!0){let f=efr(a,s),d=await oN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!ppt.includes(E.name)||!c)if(E.isDirectory()){let A=await dpt(aN.join(a,E.name),s,c);v.push(...A)}else v.push(aN.join(f,E.name));return v}t(dpt,"listFolderContents");var mpt=t(async a=>{if(await mfe(a))return!0;await oN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),hpt=t(async a=>{let s=aN.dirname(a);return mpt(s)},"mkdirForFilePathIfNotExits"),rfr=hpt,dfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function nfr(a){let s=t(c=>{if(!c.startsWith(a))throw new dfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(aN.resolve(...c)),"resolve")}}t(nfr,"safePath");function ifr(a){return`${aN.basename(aN.dirname(a))}/${aN.basename(a)}`}t(ifr,"getParentDirFilename");function sfr(a,s,c,f){let d=aN.join(f,c);return _pt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${d} ${s}`,{cwd:a}),d}t(sfr,"tarFolderContent");function afr(a,s,c,f=!1){_pt.execSync(`tar -xf ${s} ${f?"--strip-components=1 ":""}-C ${c}`,{cwd:a})}t(afr,"untar");async function ofr(a){if(await mfe(a))return await oN.rm(a,{recursive:!0})}t(ofr,"deleteFolder");var Ul=pIe;var cC=Mp(_Ie(),1);import{readFile as cfr}from"fs/promises";var FF=class extends Error{static{t(this,"CustomResolveError")}},cN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return RQ.$RefParser.dereference(s,{resolve:{json:!0,file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return RQ.$RefParser.bundle(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return RQ.$RefParser.parse(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return RQ.$RefParser.resolve(s,{resolve:{file:hfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function hfe(a,s){return{order:100,canRead(c){let f=ffr(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=gpt(c.url)}catch(E){throw new FF(`Malformed URI: ${c.url}`,{cause:E})}try{Ul.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=gpt(c.url)}catch(d){throw new FF(`Malformed URI: ${c.url}`,{cause:d})}try{return await cfr(f)}catch(d){throw new FF(`Error opening file "${f}"`,{cause:d})}}}}t(hfe,"customResolver");var dIe=/^win/.test(globalThis.process?globalThis.process.platform:""),lfr=/\//g,ufr=/^(\w{2,}):\/\//i,mIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function ffr(a){let s=ufr.exec(a);if(s)return s[1].toLowerCase()}t(ffr,"getProtocol");function gpt(a,s){a=decodeURI(a);for(let f=0;f<mIe.length;f+=2)a=a.replace(mIe[f],mIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),dIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=dIe?a:"/"+a)),dIe&&!c&&(a=a.replace(lfr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(gpt,"toFileSystemPath");var ypt="YOUR_KEY_HERE";async function vpt(a){let c=await new cN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return _fr({...a,relativeOpenApiPath:f},c)}t(vpt,"buildPublicOpenApiFile");async function _fr(a,s){hfr({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=dfr(c),pfr(c,a),c=mfr(c,a),bpt(c,"x-zuplo"),c}t(_fr,"buildRawOpenApiFile");function pfr(a,{customDomain:s,deploymentName:c,environmentType:f}){let d;s?d=s:f&&c&&(d=f===qct.WORKING_COPY?`${c}.${Y3e.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${Y3e.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(pfr,"addServerHost");function dfr(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(hj in A&&cue(A[hj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(W=>{let $=A[W];if(!$)return;if(cue($[hj])){delete O[W];return}let{parameters:Q}=$;if(!Q)return;let Pe=Q.filter(De=>{if(hj in De&&cue(De[hj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Pe}}),M.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(dfr,"removeHiddenRoutesAndParams");function mfr(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,Q)=>{let Pe=s.policies?.find(({name:Tt})=>Tt===Q);if(!Pe)return $;if(!(Pe.handler.export==="CompositeInboundPolicy"))return $.concat(Q);let Se=Pe.handler.options?.policies;return Se?$.concat(Se):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="ApiAuthKeyInboundPolicy"||Q.handler.export==="ApiKeyInboundPolicy")&&!Q.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(Q)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",Q=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Pe=Q!==""?`${Q} ${ypt}`:ypt,De={name:$,in:"header",required:!0,example:Pe,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Pe}\`.`};A.parameters?A.parameters.some(_r=>"name"in _r&&_r.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:Q.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(_r=>"name"in _r&&_r.type==="apiKey"||"type"in _r&&_r.type==="http"&&_r.scheme===Q)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let wt={[Tt]:[]};A.security?A.security.some(_r=>_r[Tt]!==void 0)||A.security.unshift(wt):A.security=[wt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="RateLimitInboundPolicy"||Q.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(Q)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Q={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:Q},A.responses||(A.responses={});let Pe=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Pe?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(mfr,"enrichSpecWithZuploData");function bpt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&bpt(a[c],s)}t(bpt,"removePropertiesByPrefix");function hfr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new pv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new pv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new pv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t(hfr,"assertIsZuploOpenApiSpec");function gfr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let W=a.charAt(M),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let W=0,$=0,Q=0,Pe=M.length;for(;Q!==Pe&&M[Q]===0;)Q++,W++;let De=(Pe-Q)*v+1>>>0,Se=new Uint8Array(De);for(;Q!==Pe;){let _r=M[Q],lr=0;for(let Or=De-1;(_r!==0||lr<$)&&Or!==-1;Or--,lr++)_r+=256*Se[Or]>>>0,Se[Or]=_r%c>>>0,_r=_r/c>>>0;if(_r!==0)throw new Error("Non-zero carry");$=lr,Q++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let wt=f.repeat(W);for(;Tt<De;++Tt)wt+=a.charAt(Se[Tt]);return wt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let W=0,$=0,Q=0;for(;M[W]===f;)$++,W++;let Pe=(M.length-W)*d+1>>>0,De=new Uint8Array(Pe);for(;M[W];){let _r=s[M.charCodeAt(W)];if(_r===255)return;let lr=0;for(let Or=Pe-1;(_r!==0||lr<Q)&&Or!==-1;Or--,lr++)_r+=c*De[Or]>>>0,De[Or]=_r%256>>>0,_r=_r/256>>>0;if(_r!==0)throw new Error("Non-zero carry");Q=lr,W++}let Se=Pe-Q;for(;Se!==Pe&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Pe-Se)),wt=$;for(;Se!==Pe;)Tt[wt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(M){let W=A(M);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(gfr,"base");var Spt=gfr;var yfr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",gfe=Spt(yfr);var hIe="2024-09-02",Tpt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function Cpt(){return new lC({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:hIe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:Tpt[hIe]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(Cpt,"getMockEnvironment");var lC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=Cpt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(gfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var vfr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function Ept(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!vfr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(Ept,"isRestrictedEnvVariableName");function xpt(a){return!!a.startsWith("ZUPLO_")}t(xpt,"isZuploReadableEnvVariableName");var wjr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return lC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return lC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return lC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return lC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return lC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return lC.instance.build.BUILD_ID}if(!(Ept(c)&&!xpt(c)))return lC.instance.runtime[c]}});function MQ(a,s,c){return`_${zP(`${a}_${s}_${c}`)}`}t(MQ,"getRawOperationDataIdentifierName");function gIe(a,s,c,f){return`_${zP(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(gIe,"getIdForParameterSchema");function yIe(a,s,c){return`_${zP(a.toLowerCase())}_${s.toLowerCase()}_rb_${zP(c.toLowerCase())}`}t(yIe,"getIdForRequestBodySchema");function jQ(a,s){return`_${zP(a)}_${zP(s)}`}t(jQ,"getIdForRefSchema");function zP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(zP,"sanitizedIdentifierName");var nyt=Mp(mmt(),1);import q_e from"path";var eK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},fdr=/[$_\p{ID_Start}]/u,_dr=/[$_\u200C\u200D\p{ID_Continue}]/u,_8e=".*";function pdr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(pdr,"Re");function ymt(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&fdr.test(O)||A!==f+1&&_dr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!pdr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(ymt,"v");function vmt(a,s={}){let c=ymt(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${pC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(lr=>{if(E<c.length&&c[E].type===lr)return c[E++].value},"a"),W=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(lr=>{let Or=M(lr);if(Or!==void 0)return Or;let{type:hr,index:ur}=c[E];throw new TypeError(`Unexpected ${hr} at ${ur}, expected ${lr}`)},"d"),Q=t(()=>{let lr="",Or;for(;Or=M("CHAR")??M("ESCAPED_CHAR");)lr+=Or;return lr},"T"),Pe=t(lr=>lr,"Se"),De=s.encodePart||Pe,Se="",Tt=t(lr=>{Se+=lr},"U"),wt=t(()=>{Se.length&&(d.push(new eK(3,"","",De(Se),"",3)),Se="")},"$"),_r=t((lr,Or,hr,ur,er)=>{let Es=3;switch(er){case"?":Es=1;break;case"*":Es=0;break;case"+":Es=2;break}if(!Or&&!hr&&Es===3){Tt(lr);return}if(wt(),!Or&&!hr){if(!lr)return;d.push(new eK(3,"","",De(lr),"",Es));return}let wi;hr?hr==="*"?wi=_8e:wi=hr:wi=f;let fo=2;wi===f?(fo=1,wi=""):wi===_8e&&(fo=0,wi="");let mi;if(Or?mi=Or:hr&&(mi=v++),O.has(mi))throw new TypeError(`Duplicate name '${mi}'.`);O.add(mi),d.push(new eK(fo,mi,De(lr),wi,De(ur),Es))},"V");for(;E<c.length;){let lr=M("CHAR"),Or=M("NAME"),hr=M("REGEX");if(!Or&&!hr&&(hr=M("ASTERISK")),Or||hr){let er=lr??"";s.prefixes.indexOf(er)===-1&&(Tt(er),er=""),wt();let Es=W();_r(er,Or,hr,"",Es);continue}let ur=lr??M("ESCAPED_CHAR");if(ur){Tt(ur);continue}if(M("OPEN")){let er=Q(),Es=M("NAME"),wi=M("REGEX");!Es&&!wi&&(wi=M("ASTERISK"));let fo=Q();$("CLOSE");let mi=W();_r(er,Es,wi,fo,mi);continue}wt(),$("END")}return d}t(vmt,"D");function pC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pC,"S");function hmt(a){return a&&a.ignoreCase?"ui":"u"}t(hmt,"X");function ddr(a,s,c){return bmt(vmt(a,c),s,c)}t(ddr,"Z");function eB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(eB,"k");function bmt(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=pC(A.value):f+=`(?:${pC(A.value)})${eB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${pC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=_8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${eB(A.modifier)}`:f+=`((?:${M})${eB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${pC(A.prefix)}(${M})${pC(A.suffix)})`,f+=eB(A.modifier);continue}f+=`(?:${pC(A.prefix)}`,f+=`((?:${M})(?:`,f+=pC(A.suffix),f+=pC(A.prefix),f+=`(?:${M}))*)${pC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${pC(c.endsWith)}]|$`,v=`[${pC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,hmt(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,hmt(c))}t(bmt,"F");var _N={delimiter:"",prefixes:"",sensitive:!0,strict:!0},mdr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},hdr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function gdr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(gdr,"J");function Smt(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Smt,"Q");function ydr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(ydr,"Ee");function Tmt(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(Tmt,"W");var Cmt=["ftp","file","http","https","ws","wss"];function Emt(a){if(!a)return!0;for(let s of Cmt)if(a.test(s))return!0;return!1}t(Emt,"N");function vdr(a,s){if(a=Smt(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(vdr,"te");function bdr(a,s){if(a=Smt(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(bdr,"re");function Sdr(a,s){return s||a===""?a:Tmt(a)?Amt(a):Dmt(a)}t(Sdr,"ne");function Tdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Tdr,"se");function Cdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Cdr,"ie");function Edr(a,s,c){if(c||a==="")return a;if(s&&!Cmt.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Edr,"ae");function xdr(a,s,c){return xmt(s)===a&&(a=""),c||a===""?a:kmt(a)}t(xdr,"oe");function Ddr(a,s){return a=ydr(a,":"),s||a===""?a:p8e(a)}t(Ddr,"ce");function xmt(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(xmt,"_");function p8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(p8e,"y");function Adr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Adr,"le");function kdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(kdr,"fe");function Dmt(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Dmt,"z");function Amt(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Amt,"j");function kmt(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(kmt,"K");function wdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(wdr,"he");function Pdr(a){return a===""?a:new URL(`data:${a}`).pathname}t(Pdr,"ue");function Ndr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(Ndr,"de");function Idr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(Idr,"pe");var Odr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=ymt(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,_N),a.encodePart=p8e;let s=ddr(this.#T(),void 0,a);this.#l=Emt(s)}},f8e=["protocol","username","password","hostname","port","pathname","search","hash"],fN="*";function gmt(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(gmt,"ge");function QP(a,s){return s?ZQ(a):a}t(QP,"b");function XQ(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=QP(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=QP(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=QP(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=QP(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=QP(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=QP(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=QP(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=QP(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Ddr(s.protocol,c)),typeof s.username=="string"&&(a.username=Cdr(s.username,c)),typeof s.password=="string"&&(a.password=Tdr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=Sdr(s.hostname,c)),typeof s.port=="string"&&(a.port=xdr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!gdr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=QP(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Edr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=bdr(s.search,c)),typeof s.hash=="string"&&(a.hash=vdr(s.hash,c)),a}t(XQ,"w");function ZQ(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(ZQ,"C");function Fdr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Fdr,"Oe");function Ldr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${Fdr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=ZQ(A.value);continue}v+=`{${ZQ(A.value)}}${eB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let Q=$.value.length>0?$.value[0]:"";M=d.test(Q)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&W&&W.type===3){let Q=W.value[W.value.length-1];M=s.prefixes.includes(Q)}M&&(v+="{"),v+=ZQ(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=ZQ(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=eB(A.modifier))}return v}t(Ldr,"ke");var wmt=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new Odr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:fN,protocol:fN,username:fN,password:fN,hostname:fN,port:fN,search:fN,hash:fN};this.#r=XQ(v,a,!0),xmt(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of f8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,_N),A.encodePart=p8e;break;case"username":Object.assign(A,_N),A.encodePart=Adr;break;case"password":Object.assign(A,_N),A.encodePart=kdr;break;case"hostname":Object.assign(A,mdr),Tmt(O)?A.encodePart=Amt:A.encodePart=Dmt;break;case"port":Object.assign(A,_N),A.encodePart=kmt;break;case"pathname":Emt(this.#n.protocol)?(Object.assign(A,hdr,d),A.encodePart=wdr):(Object.assign(A,_N,d),A.encodePart=Pdr);break;case"search":Object.assign(A,_N,d),A.encodePart=Ndr;break;case"hash":Object.assign(A,_N,d),A.encodePart=Idr;break}try{this.#s[E]=vmt(O,A),this.#n[E]=bmt(this.#s[E],this.#e[E],A),this.#t[E]=Ldr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,gmt(a,s),!1)}catch{return!1}let f;for(f of f8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,gmt(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of f8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new eK(3,"","","","",3),v=new eK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let W=f(A[M],O[M]);if(W)return W}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=wmt);import{AssertionError as Rdr}from"assert";function KP(a,s){if(a===!1)throw new Rdr({message:s})}t(KP,"assert");var Hc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Hc||(Hc={}));function tB(a){return a.type===Hc.Object}t(tB,"isAstObject");function YP(a){return a.type===Hc.Property}t(YP,"isAstProperty");function Pmt(a){return a.type===Hc.Array}t(Pmt,"isAstArray");function rB(a){return a.type===Hc.Literal}t(rB,"isAstLiteral");function $F(a){if(a===void 0)throw new Error("Node is undefined");if(!tB(a))throw new Error("Node is not object")}t($F,"assertAstObject");import{findNodeAtLocation as Mdr,getNodeValue as jdr,printParseErrorCode as Bdr,visit as Udr}from"jsonc-parser";var $dr={DEFAULT:{allowTrailingComma:!1}};function tK(a,s=[],c=$dr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),Udr(a,{onObjectBegin:t((O,M,W)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,W,$,Q)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:Q+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:W,line:$,column:Q,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,W,$,Q)=>{v({type:Jdr(O),offset:M,length:W,line:$+1,column:Q+1,parent:f,value:O}),d(M+W)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,W,$,Q)=>{s.push({error:O,offset:M,length:W,line:$+1,column:Q+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(tK,"parse");function Jdr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(Jdr,"getNodeType");function d8e(a,s){return Mdr(a,s)}t(d8e,"findNodeAtLocation");function rK(a){return jdr(a)}t(rK,"getNodeValue");function Nmt(a){return Bdr(a)}t(Nmt,"printParseErrorCode");var nK=class{static{t(this,"AstAdapter")}parse(s){let f=tK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Hc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Hc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){KP(s.children?.length===2,"Invalid property node");let f={type:Hc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Hc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Hc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var Ex={createLiteral:t((a,s)=>({type:Hc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Hc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Hc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Hc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Hc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Hc.Array,parent:s,children:[]};for(let f of a)c.children.push(Ex.createLiteral(f,c));return c},"createArrayOfLiterals")};var qdr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,iK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Hc.Array:return this.generateArray(s,c);case Hc.Object:return this.generateObject(s,c);case Hc.Property:return this.generateProperty(s,c);case Hc.Literal:return this.generateLiteral(s,c);case Hc.FunctionCall:return this.generateFunctionCall(s,c);case Hc.Identifier:return this.generateIdentifier(s,c);case Hc.Raw:return this.generateRaw(s,c);case Hc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=qdr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as zdr}from"@swc/core";import Vdr from"fs/promises";var Imt=t(async a=>{let s=new Set;try{let c=await Vdr.readFile(a,"utf-8");(await zdr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Omt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var m8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Fmt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var h8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var g8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var H0t=Mp(h0t(),1),G0t=Mp(W0t(),1);var L_e=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new G0t.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,H0t.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(M)?void 0:c[O][M][W];v={details:{property:O,index:M,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var TN=L_e.instance;TN.addSchema(g8e,"route-configuration.schema.json");TN.addSchema(Fmt,"policy-configuration.schema.json");TN.addSchema(m8e,"policies.schema.json");TN.addSchema(h8e,"open-api-route-configuration.schema.json");TN.addSchema(Omt,"fragments.schema.json");var kqr=TN.compile(g8e),Q0t=TN.compile(h8e),IFe=TN.compile(m8e);var R_e=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=IFe(s),this.results}};var M_e=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=Q0t(s),this.results}};import Yvr from"path";var OFe=/\$import\((.*)\)/,j_e=/\$env\((.*?)\)/g;var r6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Kvr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),CN=t((a,s)=>{if(!a)return!1;let c=Kvr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||YP(A)&&A.name.value===v?!0:v==="{}"?A.type===Hc.Object:v==="[]"?A.type===Hc.Array:!1:!1})},"testPosition");var B_e=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),tB(s)?s.children.forEach(c=>{this.visitor(c)}):Pmt(s)?s.children.forEach(c=>{this.visitor(c)}):YP(s)&&this.visitor(s.value)}},K0t=t((a,s,c)=>f=>{if(!YP(f)||!rB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>CN(f,v))){j_e.test(f.value.value)&&s.push(new r6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(j_e).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Hc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(j_e),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=Ex.createTemplateString(v,f))}},"getEnvStatementTransformer");var MK="config/routes.json",Xvr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Zvr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],Y0t=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],ebr="handler/{}/options/{}/rewritePattern",tbr="handler/{}/options/{}/baseUrl",U_e=class extends B_e{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!YP(s)||!rB(s.value)||typeof s.value.value!="string")&&CN(s,ebr)){if(!s.parent||!tB(s.parent)){this.errors.push(new r6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:X0t(c)},d=Ex.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!YP(s)||!rB(s.value)||typeof s.value.value!="string")&&CN(s,tbr)){if(!s.parent||!tB(s.parent)){this.errors.push(new r6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:X0t(c)},d=Ex.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!YP(s)||!rB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Zvr.some(A=>CN(s,A))&&!Y0t.some(A=>CN(s,A))){if(OFe.test(c)){if(s.name.value==="$ref")return;this.errors.push(new r6("An $import() statement is not expected at this location.",MK,s.location,c))}return}let f=OFe.exec(c);if(Y0t.some(A=>CN(s,A))&&!f)return;if(!f){this.errors.push(new r6("Invalid $import() statement",MK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Yvr.join("..",d));let v=this.getImportName(d),E={type:Hc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=K0t(Xvr,this.errors,MK)};function X0t(a){return`(request, context) => {
561
561
  const { params, url, query, method, headers } = request;
562
562
  const { host, hostname, origin, pathname, port, search } = new URL(url);
563
563
  const e = encodeURIComponent;
package/index.minified.js CHANGED
@@ -557,7 +557,7 @@ globstar while`,s,Q,c,Pe,De),this.matchOne(s.slice(Q),c.slice(Pe),f))return this
557
557
  >>> no match, partial?`,s,Q,c,Pe),Q===O))}let Se;if(typeof W=="string"?(Se=$===W,this.debug("string match",W,$,Se)):(Se=W.test($),this.debug("pattern match",W,$,Se)),!Se)return!1}if(E===O&&A===M)return!0;if(E===O)return f;if(A===M)return E===O-1&&s[E]==="";throw new Error("wtf?")}braceExpand(){return uut(this.pattern,this.options)}parse(s){eQ(s);let c=this.options;if(s==="**")return cy;if(s==="")return"";let f,d=null;(f=s.match(rsr))?d=c.dot?isr:nsr:(f=s.match(Wir))?d=(c.nocase?c.dot?Kir:Qir:c.dot?Gir:Hir)(f[1]):(f=s.match(ssr))?d=(c.nocase?c.dot?osr:asr:c.dot?csr:lsr)(f):(f=s.match(Yir))?d=c.dot?Zir:Xir:(f=s.match(esr))&&(d=tsr);let v=Sj.fromGlob(s,this.options).toMMPattern();return d&&typeof v=="object"&&Reflect.defineProperty(v,"test",{value:d}),v}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let s=this.set;if(!s.length)return this.regexp=!1,this.regexp;let c=this.options,f=c.noglobstar?_sr:c.dot?psr:dsr,d=new Set(c.nocase?["i"]:[]),v=s.map(O=>{let M=O.map(W=>{if(W instanceof RegExp)for(let $ of W.flags.split(""))d.add($);return typeof W=="string"?vsr(W):W===cy?cy:W._src});return M.forEach((W,$)=>{let Q=M[$+1],Pe=M[$-1];W!==cy||Pe===cy||(Pe===void 0?Q!==void 0&&Q!==cy?M[$+1]="(?:\\/|"+f+"\\/)?"+Q:M[$]=f:Q===void 0?M[$-1]=Pe+"(?:\\/|"+f+")?":Q!==cy&&(M[$-1]=Pe+"(?:\\/|\\/"+f+"\\/)"+Q,M[$+1]=cy))}),M.filter(W=>W!==cy).join("/")}).join("|"),[E,A]=s.length>1?["(?:",")"]:["",""];v="^"+E+v+A+"$",this.negate&&(v="^(?!"+v+").+$");try{this.regexp=new RegExp(v,[...d].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,c=this.partial){if(this.debug("match",s,this.pattern),this.comment)return!1;if(this.empty)return s==="";if(s==="/"&&c)return!0;let f=this.options;this.isWindows&&(s=s.split("\\").join("/"));let d=this.slashSplit(s);this.debug(this.pattern,"split",d);let v=this.set;this.debug(this.pattern,"set",v);let E=d[d.length-1];if(!E)for(let A=d.length-2;!E&&A>=0;A--)E=d[A];for(let A=0;A<v.length;A++){let O=v[A],M=d;if(f.matchBase&&O.length===1&&(M=[E]),this.matchOne(M,O,c))return f.flipNegate?!0:!this.negate}return f.flipNegate?!1:this.negate}static defaults(s){return dv.defaults(s).Minimatch}};dv.AST=Sj;dv.Minimatch=hS;dv.escape=Tj;dv.unescape=fx;import{fileURLToPath as Ysr}from"url";var Cj=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,_ut=new Set,A3e=typeof process=="object"&&process?process:{},put=t((a,s,c,f)=>{typeof A3e.emitWarning=="function"?A3e.emitWarning(a,s,c,f):console.error(`[${c}] ${s}: ${a}`)},"emitWarning"),bue=globalThis.AbortController,fut=globalThis.AbortSignal;if(typeof bue>"u"){fut=class{static{t(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(f,d){this._onabort.push(d)}},bue=class{static{t(this,"AbortController")}constructor(){s()}signal=new fut;abort(f){if(!this.signal.aborted){this.signal.reason=f,this.signal.aborted=!0;for(let d of this.signal._onabort)d(f);this.signal.onabort?.(f)}}};let a=A3e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",s=t(()=>{a&&(a=!1,put("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 bsr=t(a=>!_ut.has(a),"shouldWarn"),oLr=Symbol("type"),X3=t(a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),"isPosInt"),dut=t(a=>X3(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?Ej:null:null,"getUintArray"),Ej=class extends Array{static{t(this,"ZeroArray")}constructor(s){super(s),this.fill(0)}},k3e=class a{static{t(this,"Stack")}heap;length;static#r=!1;static create(s){let c=dut(s);if(!c)return[];a.#r=!0;let f=new a(s,c);return a.#r=!1,f}constructor(s,c){if(!a.#r)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new c(s),this.length=0}push(s){this.heap[this.length++]=s}pop(){return this.heap[--this.length]}},rQ=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;#x;#C;#b;#A;#E;#y;static unsafeExposeInternals(s){return{starts:s.#C,ttls:s.#b,sizes:s.#x,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(c=>s.#h(c),"isBackgroundFetch"),backgroundFetch:t((c,f,d,v)=>s.#j(c,f,d,v),"backgroundFetch"),moveToTail:t(c=>s.#U(c),"moveToTail"),indexes:t(c=>s.#w(c),"indexes"),rindexes:t(c=>s.#P(c),"rindexes"),isStale:t(c=>s.#S(c),"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:c=0,ttl:f,ttlResolution:d=1,ttlAutopurge:v,updateAgeOnGet:E,updateAgeOnHas:A,allowStale:O,dispose:M,disposeAfter:W,noDisposeOnSet:$,noUpdateTTL:Q,maxSize:Pe=0,maxEntrySize:De=0,sizeCalculation:Se,fetchMethod:Tt,memoMethod:wt,noDeleteOnFetchRejection:_r,noDeleteOnStaleGet:lr,allowStaleOnFetchRejection:Or,allowStaleOnFetchAbort:hr,ignoreFetchAbort:ur}=s;if(c!==0&&!X3(c))throw new TypeError("max option must be a nonnegative integer");let er=c?dut(c):Array;if(!er)throw new Error("invalid max value: "+c);if(this.#r=c,this.#n=Pe,this.maxEntrySize=De||this.#n,this.sizeCalculation=Se,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(wt!==void 0&&typeof wt!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=wt,Tt!==void 0&&typeof Tt!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=Tt,this.#E=!!Tt,this.#c=new Map,this.#l=new Array(c).fill(void 0),this.#i=new Array(c).fill(void 0),this.#f=new er(c),this.#v=new er(c),this.#d=0,this.#u=0,this.#m=k3e.create(c),this.#a=0,this.#_=0,typeof M=="function"&&(this.#e=M),typeof W=="function"?(this.#t=W,this.#g=[]):(this.#t=void 0,this.#g=void 0),this.#A=!!this.#e,this.#y=!!this.#t,this.noDisposeOnSet=!!$,this.noUpdateTTL=!!Q,this.noDeleteOnFetchRejection=!!_r,this.allowStaleOnFetchRejection=!!Or,this.allowStaleOnFetchAbort=!!hr,this.ignoreFetchAbort=!!ur,this.maxEntrySize!==0){if(this.#n!==0&&!X3(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!X3(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!O,this.noDeleteOnStaleGet=!!lr,this.updateAgeOnGet=!!E,this.updateAgeOnHas=!!A,this.ttlResolution=X3(d)||d===0?d:1,this.ttlAutopurge=!!v,this.ttl=f||0,this.ttl){if(!X3(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 Es="LRU_CACHE_UNBOUNDED";bsr(Es)&&(_ut.add(Es),put("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Es,a))}}getRemainingTTL(s){return this.#c.has(s)?1/0:0}#D(){let s=new Ej(this.#r),c=new Ej(this.#r);this.#b=s,this.#C=c,this.#N=(v,E,A=Cj.now())=>{if(c[v]=E!==0?A:0,s[v]=E,E!==0&&this.ttlAutopurge){let O=setTimeout(()=>{this.#S(v)&&this.#O(this.#l[v],"expire")},E+1);O.unref&&O.unref()}},this.#k=v=>{c[v]=s[v]!==0?Cj.now():0},this.#o=(v,E)=>{if(s[E]){let A=s[E],O=c[E];if(!A||!O)return;v.ttl=A,v.start=O,v.now=f||d();let M=v.now-O;v.remainingTTL=A-M}};let f=0,d=t(()=>{let v=Cj.now();if(this.ttlResolution>0){f=v;let E=setTimeout(()=>f=0,this.ttlResolution);E.unref&&E.unref()}return v},"getNow");this.getRemainingTTL=v=>{let E=this.#c.get(v);if(E===void 0)return 0;let A=s[E],O=c[E];if(!A||!O)return 1/0;let M=(f||d())-O;return A-M},this.#S=v=>{let E=c[v],A=s[v];return!!A&&!!E&&(f||d())-E>A}}#k=t(()=>{},"#updateItemAge");#o=t(()=>{},"#statusTTL");#N=t(()=>{},"#setItemTTL");#S=t(()=>!1,"#isStale");#T(){let s=new Ej(this.#r);this.#_=0,this.#x=s,this.#I=c=>{this.#_-=s[c],s[c]=0},this.#L=(c,f,d,v)=>{if(this.#h(f))return 0;if(!X3(d))if(v){if(typeof v!="function")throw new TypeError("sizeCalculation must be a function");if(d=v(f,c),!X3(d))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 d},this.#F=(c,f,d)=>{if(s[c]=f,this.#n){let v=this.#n-s[c];for(;this.#_>v;)this.#M(!0)}this.#_+=s[c],d&&(d.entrySize=f,d.totalCalculatedSize=this.#_)}}#I=t(s=>{},"#removeItemSize");#F=t((s,c,f)=>{},"#addItemSize");#L=t((s,c,f,d)=>{if(f||d)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#w({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#u;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#d));)c=this.#v[c]}*#P({allowStale:s=this.allowStale}={}){if(this.#a)for(let c=this.#d;!(!this.#R(c)||((s||!this.#S(c))&&(yield c),c===this.#u));)c=this.#f[c]}#R(s){return s!==void 0&&this.#c.get(this.#l[s])===s}*entries(){for(let s of this.#w())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.#P())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.#w()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*rkeys(){for(let s of this.#P()){let c=this.#l[s];c!==void 0&&!this.#h(this.#i[s])&&(yield c)}}*values(){for(let s of this.#w())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}*rvalues(){for(let s of this.#P())this.#i[s]!==void 0&&!this.#h(this.#i[s])&&(yield this.#i[s])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(s,c={}){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;if(v!==void 0&&s(v,this.#l[f],this))return this.get(this.#l[f],c)}}forEach(s,c=this){for(let f of this.#w()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}rforEach(s,c=this){for(let f of this.#P()){let d=this.#i[f],v=this.#h(d)?d.__staleWhileFetching:d;v!==void 0&&s.call(c,v,this.#l[f],this)}}purgeStale(){let s=!1;for(let c of this.#P({allowStale:!0}))this.#S(c)&&(this.#O(this.#l[c],"expire"),s=!0);return s}info(s){let c=this.#c.get(s);if(c===void 0)return;let f=this.#i[c],d=this.#h(f)?f.__staleWhileFetching:f;if(d===void 0)return;let v={value:d};if(this.#b&&this.#C){let E=this.#b[c],A=this.#C[c];if(E&&A){let O=E-(Cj.now()-A);v.ttl=O,v.start=Date.now()}}return this.#x&&(v.size=this.#x[c]),v}dump(){let s=[];for(let c of this.#w({allowStale:!0})){let f=this.#l[c],d=this.#i[c],v=this.#h(d)?d.__staleWhileFetching:d;if(v===void 0||f===void 0)continue;let E={value:v};if(this.#b&&this.#C){E.ttl=this.#b[c];let A=Cj.now()-this.#C[c];E.start=Math.floor(Date.now()-A)}this.#x&&(E.size=this.#x[c]),s.unshift([f,E])}return s}load(s){this.clear();for(let[c,f]of s){if(f.start){let d=Date.now()-f.start;f.start=Cj.now()-d}this.set(c,f.value,f)}}set(s,c,f={}){if(c===void 0)return this.delete(s),this;let{ttl:d=this.ttl,start:v,noDisposeOnSet:E=this.noDisposeOnSet,sizeCalculation:A=this.sizeCalculation,status:O}=f,{noUpdateTTL:M=this.noUpdateTTL}=f,W=this.#L(s,c,f.size||0,A);if(this.maxEntrySize&&W>this.maxEntrySize)return O&&(O.set="miss",O.maxEntrySizeExceeded=!0),this.#O(s,"set"),this;let $=this.#a===0?void 0:this.#c.get(s);if($===void 0)$=this.#a===0?this.#u:this.#m.length!==0?this.#m.pop():this.#a===this.#r?this.#M(!1):this.#a,this.#l[$]=s,this.#i[$]=c,this.#c.set(s,$),this.#f[this.#u]=$,this.#v[$]=this.#u,this.#u=$,this.#a++,this.#F($,W,O),O&&(O.set="add"),M=!1;else{this.#U($);let Q=this.#i[$];if(c!==Q){if(this.#E&&this.#h(Q)){Q.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Pe}=Q;Pe!==void 0&&!E&&(this.#A&&this.#e?.(Pe,s,"set"),this.#y&&this.#g?.push([Pe,s,"set"]))}else E||(this.#A&&this.#e?.(Q,s,"set"),this.#y&&this.#g?.push([Q,s,"set"]));if(this.#I($),this.#F($,W,O),this.#i[$]=c,O){O.set="replace";let Pe=Q&&this.#h(Q)?Q.__staleWhileFetching:Q;Pe!==void 0&&(O.oldValue=Pe)}}else O&&(O.set="update")}if(d!==0&&!this.#b&&this.#D(),this.#b&&(M||this.#N($,d,v),O&&this.#o(O,$)),!E&&this.#y&&this.#g){let Q=this.#g,Pe;for(;Pe=Q?.shift();)this.#t?.(...Pe)}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,c;for(;c=s?.shift();)this.#t?.(...c)}}}#M(s){let c=this.#d,f=this.#l[c],d=this.#i[c];return this.#E&&this.#h(d)?d.__abortController.abort(new Error("evicted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(d,f,"evict"),this.#y&&this.#g?.push([d,f,"evict"])),this.#I(c),s&&(this.#l[c]=void 0,this.#i[c]=void 0,this.#m.push(c)),this.#a===1?(this.#d=this.#u=0,this.#m.length=0):this.#d=this.#f[c],this.#c.delete(f),this.#a--,c}has(s,c={}){let{updateAgeOnHas:f=this.updateAgeOnHas,status:d}=c,v=this.#c.get(s);if(v!==void 0){let E=this.#i[v];if(this.#h(E)&&E.__staleWhileFetching===void 0)return!1;if(this.#S(v))d&&(d.has="stale",this.#o(d,v));else return f&&this.#k(v),d&&(d.has="hit",this.#o(d,v)),!0}else d&&(d.has="miss");return!1}peek(s,c={}){let{allowStale:f=this.allowStale}=c,d=this.#c.get(s);if(d===void 0||!f&&this.#S(d))return;let v=this.#i[d];return this.#h(v)?v.__staleWhileFetching:v}#j(s,c,f,d){let v=c===void 0?void 0:this.#i[c];if(this.#h(v))return v;let E=new bue,{signal:A}=f;A?.addEventListener("abort",()=>E.abort(A.reason),{signal:E.signal});let O={signal:E.signal,options:f,context:d},M=t((Se,Tt=!1)=>{let{aborted:wt}=E.signal,_r=f.ignoreFetchAbort&&Se!==void 0;if(f.status&&(wt&&!Tt?(f.status.fetchAborted=!0,f.status.fetchError=E.signal.reason,_r&&(f.status.fetchAbortIgnored=!0)):f.status.fetchResolved=!0),wt&&!_r&&!Tt)return $(E.signal.reason);let lr=Pe;return this.#i[c]===Pe&&(Se===void 0?lr.__staleWhileFetching?this.#i[c]=lr.__staleWhileFetching:this.#O(s,"fetch"):(f.status&&(f.status.fetchUpdated=!0),this.set(s,Se,O.options))),Se},"cb"),W=t(Se=>(f.status&&(f.status.fetchRejected=!0,f.status.fetchError=Se),$(Se)),"eb"),$=t(Se=>{let{aborted:Tt}=E.signal,wt=Tt&&f.allowStaleOnFetchAbort,_r=wt||f.allowStaleOnFetchRejection,lr=_r||f.noDeleteOnFetchRejection,Or=Pe;if(this.#i[c]===Pe&&(!lr||Or.__staleWhileFetching===void 0?this.#O(s,"fetch"):wt||(this.#i[c]=Or.__staleWhileFetching)),_r)return f.status&&Or.__staleWhileFetching!==void 0&&(f.status.returnedStale=!0),Or.__staleWhileFetching;if(Or.__returned===Or)throw Se},"fetchFail"),Q=t((Se,Tt)=>{let wt=this.#s?.(s,v,O);wt&&wt instanceof Promise&&wt.then(_r=>Se(_r===void 0?void 0:_r),Tt),E.signal.addEventListener("abort",()=>{(!f.ignoreFetchAbort||f.allowStaleOnFetchAbort)&&(Se(void 0),f.allowStaleOnFetchAbort&&(Se=t(_r=>M(_r,!0),"res")))})},"pcall");f.status&&(f.status.fetchDispatched=!0);let Pe=new Promise(Q).then(M,W),De=Object.assign(Pe,{__abortController:E,__staleWhileFetching:v,__returned:void 0});return c===void 0?(this.set(s,De,{...O.options,status:void 0}),c=this.#c.get(s)):this.#i[c]=De,De}#h(s){if(!this.#E)return!1;let c=s;return!!c&&c instanceof Promise&&c.hasOwnProperty("__staleWhileFetching")&&c.__abortController instanceof bue}async fetch(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,ttl:E=this.ttl,noDisposeOnSet:A=this.noDisposeOnSet,size:O=0,sizeCalculation:M=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:$=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Q=this.allowStaleOnFetchRejection,ignoreFetchAbort:Pe=this.ignoreFetchAbort,allowStaleOnFetchAbort:De=this.allowStaleOnFetchAbort,context:Se,forceRefresh:Tt=!1,status:wt,signal:_r}=c;if(!this.#E)return wt&&(wt.fetch="get"),this.get(s,{allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,status:wt});let lr={allowStale:f,updateAgeOnGet:d,noDeleteOnStaleGet:v,ttl:E,noDisposeOnSet:A,size:O,sizeCalculation:M,noUpdateTTL:W,noDeleteOnFetchRejection:$,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:De,ignoreFetchAbort:Pe,status:wt,signal:_r},Or=this.#c.get(s);if(Or===void 0){wt&&(wt.fetch="miss");let hr=this.#j(s,Or,lr,Se);return hr.__returned=hr}else{let hr=this.#i[Or];if(this.#h(hr)){let fo=f&&hr.__staleWhileFetching!==void 0;return wt&&(wt.fetch="inflight",fo&&(wt.returnedStale=!0)),fo?hr.__staleWhileFetching:hr.__returned=hr}let ur=this.#S(Or);if(!Tt&&!ur)return wt&&(wt.fetch="hit"),this.#U(Or),d&&this.#k(Or),wt&&this.#o(wt,Or),hr;let er=this.#j(s,Or,lr,Se),wi=er.__staleWhileFetching!==void 0&&f;return wt&&(wt.fetch=ur?"stale":"refresh",wi&&ur&&(wt.returnedStale=!0)),wi?er.__staleWhileFetching:er.__returned=er}}async forceFetch(s,c={}){let f=await this.fetch(s,c);if(f===void 0)throw new Error("fetch() returned undefined");return f}memo(s,c={}){let f=this.#p;if(!f)throw new Error("no memoMethod provided to constructor");let{context:d,forceRefresh:v,...E}=c,A=this.get(s,E);if(!v&&A!==void 0)return A;let O=f(s,A,{options:E,context:d});return this.set(s,O,E),O}get(s,c={}){let{allowStale:f=this.allowStale,updateAgeOnGet:d=this.updateAgeOnGet,noDeleteOnStaleGet:v=this.noDeleteOnStaleGet,status:E}=c,A=this.#c.get(s);if(A!==void 0){let O=this.#i[A],M=this.#h(O);return E&&this.#o(E,A),this.#S(A)?(E&&(E.get="stale"),M?(E&&f&&O.__staleWhileFetching!==void 0&&(E.returnedStale=!0),f?O.__staleWhileFetching:void 0):(v||this.#O(s,"expire"),E&&f&&(E.returnedStale=!0),f?O:void 0)):(E&&(E.get="hit"),M?O.__staleWhileFetching:(this.#U(A),d&&this.#k(A),O))}else E&&(E.get="miss")}#B(s,c){this.#v[c]=s,this.#f[s]=c}#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.#O(s,"delete")}#O(s,c){let f=!1;if(this.#a!==0){let d=this.#c.get(s);if(d!==void 0)if(f=!0,this.#a===1)this.#$(c);else{this.#I(d);let v=this.#i[d];if(this.#h(v)?v.__abortController.abort(new Error("deleted")):(this.#A||this.#y)&&(this.#A&&this.#e?.(v,s,c),this.#y&&this.#g?.push([v,s,c])),this.#c.delete(s),this.#l[d]=void 0,this.#i[d]=void 0,d===this.#u)this.#u=this.#v[d];else if(d===this.#d)this.#d=this.#f[d];else{let E=this.#v[d];this.#f[E]=this.#f[d];let A=this.#f[d];this.#v[A]=this.#v[d]}this.#a--,this.#m.push(d)}}if(this.#y&&this.#g?.length){let d=this.#g,v;for(;v=d?.shift();)this.#t?.(...v)}return f}clear(){return this.#$("delete")}#$(s){for(let c of this.#P({allowStale:!0})){let f=this.#i[c];if(this.#h(f))f.__abortController.abort(new Error("deleted"));else{let d=this.#l[c];this.#A&&this.#e?.(f,d,s),this.#y&&this.#g?.push([f,d,s])}}if(this.#c.clear(),this.#i.fill(void 0),this.#l.fill(void 0),this.#b&&this.#C&&(this.#b.fill(0),this.#C.fill(0)),this.#x&&this.#x.fill(0),this.#d=0,this.#u=0,this.#m.length=0,this.#_=0,this.#a=0,this.#y&&this.#g){let c=this.#g,f;for(;f=c?.shift();)this.#t?.(...f)}}};import{posix as Nsr,win32 as j3e}from"path";import{fileURLToPath as Isr}from"url";import{lstatSync as Osr,readdir as Fsr,readdirSync as Lsr,readlinkSync as Rsr,realpathSync as Msr}from"fs";import*as jsr from"fs";import{lstat as Usr,readdir as $sr,readlink as Jsr,realpath as qsr}from"fs/promises";import{EventEmitter as L3e}from"events";import vut from"stream";import{StringDecoder as Ssr}from"string_decoder";var mut=typeof process=="object"&&process?process:{stdout:null,stderr:null},Tsr=t(a=>!!a&&typeof a=="object"&&(a instanceof eN||a instanceof vut||Csr(a)||Esr(a)),"isStream"),Csr=t(a=>!!a&&typeof a=="object"&&a instanceof L3e&&typeof a.pipe=="function"&&a.pipe!==vut.Writable.prototype.pipe,"isReadable"),Esr=t(a=>!!a&&typeof a=="object"&&a instanceof L3e&&typeof a.write=="function"&&typeof a.end=="function","isWritable"),BP=Symbol("EOF"),UP=Symbol("maybeEmitEnd"),Z3=Symbol("emittedEnd"),Sue=Symbol("emittingEnd"),nQ=Symbol("emittedError"),Tue=Symbol("closed"),hut=Symbol("read"),Cue=Symbol("flush"),gut=Symbol("flushChunk"),_x=Symbol("encoding"),xj=Symbol("decoder"),C0=Symbol("flowing"),iQ=Symbol("paused"),Dj=Symbol("resume"),E0=Symbol("buffer"),mv=Symbol("pipes"),x0=Symbol("bufferLength"),w3e=Symbol("bufferPush"),Eue=Symbol("bufferShift"),a1=Symbol("objectMode"),vh=Symbol("destroyed"),P3e=Symbol("error"),N3e=Symbol("emitData"),yut=Symbol("emitEnd"),I3e=Symbol("emitEnd2"),FA=Symbol("async"),O3e=Symbol("abort"),xue=Symbol("aborted"),sQ=Symbol("signal"),EF=Symbol("dataListeners"),gS=Symbol("discarded"),aQ=t(a=>Promise.resolve().then(a),"defer"),xsr=t(a=>a(),"nodefer"),Dsr=t(a=>a==="end"||a==="finish"||a==="prefinish","isEndish"),Asr=t(a=>a instanceof ArrayBuffer||!!a&&typeof a=="object"&&a.constructor&&a.constructor.name==="ArrayBuffer"&&a.byteLength>=0,"isArrayBufferLike"),ksr=t(a=>!Buffer.isBuffer(a)&&ArrayBuffer.isView(a),"isArrayBufferView"),Due=class{static{t(this,"Pipe")}src;dest;opts;ondrain;constructor(s,c,f){this.src=s,this.dest=c,this.opts=f,this.ondrain=()=>s[Dj](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(s){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},F3e=class extends Due{static{t(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(s,c,f){super(s,c,f),this.proxyErrors=d=>c.emit("error",d),s.on("error",this.proxyErrors)}},wsr=t(a=>!!a.objectMode,"isObjectModeOptions"),Psr=t(a=>!a.objectMode&&!!a.encoding&&a.encoding!=="buffer","isEncodingOptions"),eN=class extends L3e{static{t(this,"Minipass")}[C0]=!1;[iQ]=!1;[mv]=[];[E0]=[];[a1];[_x];[FA];[xj];[BP]=!1;[Z3]=!1;[Sue]=!1;[Tue]=!1;[nQ]=null;[x0]=0;[vh]=!1;[sQ];[xue]=!1;[EF]=0;[gS]=!1;writable=!0;readable=!0;constructor(...s){let c=s[0]||{};if(super(),c.objectMode&&typeof c.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");wsr(c)?(this[a1]=!0,this[_x]=null):Psr(c)?(this[_x]=c.encoding,this[a1]=!1):(this[a1]=!1,this[_x]=null),this[FA]=!!c.async,this[xj]=this[_x]?new Ssr(this[_x]):null,c&&c.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:t(()=>this[E0],"get")}),c&&c.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:t(()=>this[mv],"get")});let{signal:f}=c;f&&(this[sQ]=f,f.aborted?this[O3e]():f.addEventListener("abort",()=>this[O3e]()))}get bufferLength(){return this[x0]}get encoding(){return this[_x]}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[a1]}set objectMode(s){throw new Error("objectMode must be set at instantiation time")}get async(){return this[FA]}set async(s){this[FA]=this[FA]||!!s}[O3e](){this[xue]=!0,this.emit("abort",this[sQ]?.reason),this.destroy(this[sQ]?.reason)}get aborted(){return this[xue]}set aborted(s){}write(s,c,f){if(this[xue])return!1;if(this[BP])throw new Error("write after end");if(this[vh])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof c=="function"&&(f=c,c="utf8"),c||(c="utf8");let d=this[FA]?aQ:xsr;if(!this[a1]&&!Buffer.isBuffer(s)){if(ksr(s))s=Buffer.from(s.buffer,s.byteOffset,s.byteLength);else if(Asr(s))s=Buffer.from(s);else if(typeof s!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[a1]?(this[C0]&&this[x0]!==0&&this[Cue](!0),this[C0]?this.emit("data",s):this[w3e](s),this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0]):s.length?(typeof s=="string"&&!(c===this[_x]&&!this[xj]?.lastNeed)&&(s=Buffer.from(s,c)),Buffer.isBuffer(s)&&this[_x]&&(s=this[xj].write(s)),this[C0]&&this[x0]!==0&&this[Cue](!0),this[C0]?this.emit("data",s):this[w3e](s),this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0]):(this[x0]!==0&&this.emit("readable"),f&&d(f),this[C0])}read(s){if(this[vh])return null;if(this[gS]=!1,this[x0]===0||s===0||s&&s>this[x0])return this[UP](),null;this[a1]&&(s=null),this[E0].length>1&&!this[a1]&&(this[E0]=[this[_x]?this[E0].join(""):Buffer.concat(this[E0],this[x0])]);let c=this[hut](s||null,this[E0][0]);return this[UP](),c}[hut](s,c){if(this[a1])this[Eue]();else{let f=c;s===f.length||s===null?this[Eue]():typeof f=="string"?(this[E0][0]=f.slice(s),c=f.slice(0,s),this[x0]-=s):(this[E0][0]=f.subarray(s),c=f.subarray(0,s),this[x0]-=s)}return this.emit("data",c),!this[E0].length&&!this[BP]&&this.emit("drain"),c}end(s,c,f){return typeof s=="function"&&(f=s,s=void 0),typeof c=="function"&&(f=c,c="utf8"),s!==void 0&&this.write(s,c),f&&this.once("end",f),this[BP]=!0,this.writable=!1,(this[C0]||!this[iQ])&&this[UP](),this}[Dj](){this[vh]||(!this[EF]&&!this[mv].length&&(this[gS]=!0),this[iQ]=!1,this[C0]=!0,this.emit("resume"),this[E0].length?this[Cue]():this[BP]?this[UP]():this.emit("drain"))}resume(){return this[Dj]()}pause(){this[C0]=!1,this[iQ]=!0,this[gS]=!1}get destroyed(){return this[vh]}get flowing(){return this[C0]}get paused(){return this[iQ]}[w3e](s){this[a1]?this[x0]+=1:this[x0]+=s.length,this[E0].push(s)}[Eue](){return this[a1]?this[x0]-=1:this[x0]-=this[E0][0].length,this[E0].shift()}[Cue](s=!1){do;while(this[gut](this[Eue]())&&this[E0].length);!s&&!this[E0].length&&!this[BP]&&this.emit("drain")}[gut](s){return this.emit("data",s),this[C0]}pipe(s,c){if(this[vh])return s;this[gS]=!1;let f=this[Z3];return c=c||{},s===mut.stdout||s===mut.stderr?c.end=!1:c.end=c.end!==!1,c.proxyErrors=!!c.proxyErrors,f?c.end&&s.end():(this[mv].push(c.proxyErrors?new F3e(this,s,c):new Due(this,s,c)),this[FA]?aQ(()=>this[Dj]()):this[Dj]()),s}unpipe(s){let c=this[mv].find(f=>f.dest===s);c&&(this[mv].length===1?(this[C0]&&this[EF]===0&&(this[C0]=!1),this[mv]=[]):this[mv].splice(this[mv].indexOf(c),1),c.unpipe())}addListener(s,c){return this.on(s,c)}on(s,c){let f=super.on(s,c);if(s==="data")this[gS]=!1,this[EF]++,!this[mv].length&&!this[C0]&&this[Dj]();else if(s==="readable"&&this[x0]!==0)super.emit("readable");else if(Dsr(s)&&this[Z3])super.emit(s),this.removeAllListeners(s);else if(s==="error"&&this[nQ]){let d=c;this[FA]?aQ(()=>d.call(this,this[nQ])):d.call(this,this[nQ])}return f}removeListener(s,c){return this.off(s,c)}off(s,c){let f=super.off(s,c);return s==="data"&&(this[EF]=this.listeners("data").length,this[EF]===0&&!this[gS]&&!this[mv].length&&(this[C0]=!1)),f}removeAllListeners(s){let c=super.removeAllListeners(s);return(s==="data"||s===void 0)&&(this[EF]=0,!this[gS]&&!this[mv].length&&(this[C0]=!1)),c}get emittedEnd(){return this[Z3]}[UP](){!this[Sue]&&!this[Z3]&&!this[vh]&&this[E0].length===0&&this[BP]&&(this[Sue]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Tue]&&this.emit("close"),this[Sue]=!1)}emit(s,...c){let f=c[0];if(s!=="error"&&s!=="close"&&s!==vh&&this[vh])return!1;if(s==="data")return!this[a1]&&!f?!1:this[FA]?(aQ(()=>this[N3e](f)),!0):this[N3e](f);if(s==="end")return this[yut]();if(s==="close"){if(this[Tue]=!0,!this[Z3]&&!this[vh])return!1;let v=super.emit("close");return this.removeAllListeners("close"),v}else if(s==="error"){this[nQ]=f,super.emit(P3e,f);let v=!this[sQ]||this.listeners("error").length?super.emit("error",f):!1;return this[UP](),v}else if(s==="resume"){let v=super.emit("resume");return this[UP](),v}else if(s==="finish"||s==="prefinish"){let v=super.emit(s);return this.removeAllListeners(s),v}let d=super.emit(s,...c);return this[UP](),d}[N3e](s){for(let f of this[mv])f.dest.write(s)===!1&&this.pause();let c=this[gS]?!1:super.emit("data",s);return this[UP](),c}[yut](){return this[Z3]?!1:(this[Z3]=!0,this.readable=!1,this[FA]?(aQ(()=>this[I3e]()),!0):this[I3e]())}[I3e](){if(this[xj]){let c=this[xj].end();if(c){for(let f of this[mv])f.dest.write(c);this[gS]||super.emit("data",c)}}for(let c of this[mv])c.end();let s=super.emit("end");return this.removeAllListeners("end"),s}async collect(){let s=Object.assign([],{dataLength:0});this[a1]||(s.dataLength=0);let c=this.promise();return this.on("data",f=>{s.push(f),this[a1]||(s.dataLength+=f.length)}),await c,s}async concat(){if(this[a1])throw new Error("cannot concat in objectMode");let s=await this.collect();return this[_x]?s.join(""):Buffer.concat(s,s.dataLength)}async promise(){return new Promise((s,c)=>{this.on(vh,()=>c(new Error("stream destroyed"))),this.on("error",f=>c(f)),this.on("end",()=>s())})}[Symbol.asyncIterator](){this[gS]=!1;let s=!1,c=t(async()=>(this.pause(),s=!0,{value:void 0,done:!0}),"stop");return{next:t(()=>{if(s)return c();let d=this.read();if(d!==null)return Promise.resolve({done:!1,value:d});if(this[BP])return c();let v,E,A=t($=>{this.off("data",O),this.off("end",M),this.off(vh,W),c(),E($)},"onerr"),O=t($=>{this.off("error",A),this.off("end",M),this.off(vh,W),this.pause(),v({value:$,done:!!this[BP]})},"ondata"),M=t(()=>{this.off("error",A),this.off("data",O),this.off(vh,W),c(),v({done:!0,value:void 0})},"onend"),W=t(()=>A(new Error("stream destroyed")),"ondestroy");return new Promise(($,Q)=>{E=Q,v=$,this.once(vh,W),this.once("error",A),this.once("end",M),this.once("data",O)})},"next"),throw:c,return:c,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[gS]=!1;let s=!1,c=t(()=>(this.pause(),this.off(P3e,c),this.off(vh,c),this.off("end",c),s=!0,{done:!0,value:void 0}),"stop"),f=t(()=>{if(s)return c();let d=this.read();return d===null?c():{done:!1,value:d}},"next");return this.once("end",c),this.once(P3e,c),this.once(vh,c),{next:f,throw:c,return:c,[Symbol.iterator](){return this}}}destroy(s){if(this[vh])return s?this.emit("error",s):this.emit(vh),this;this[vh]=!0,this[gS]=!0,this[E0].length=0,this[x0]=0;let c=this;return typeof c.close=="function"&&!this[Tue]&&c.close(),s?this.emit("error",s):this.emit(vh),this}static get isStream(){return Tsr}};var Bsr=Msr.native,cQ={lstatSync:Osr,readdir:Fsr,readdirSync:Lsr,readlinkSync:Rsr,realpathSync:Bsr,promises:{lstat:Usr,readdir:$sr,readlink:Jsr,realpath:qsr}},Eut=t(a=>!a||a===cQ||a===jsr?cQ:{...cQ,...a,promises:{...cQ.promises,...a.promises||{}}},"fsFromOption"),xut=/^\\\\\?\\([a-z]:)\\?$/i,zsr=t(a=>a.replace(/\//g,"\\").replace(xut,"$1\\"),"uncToDrive"),Vsr=/[\\\/]/,nC=0,Dut=1,Aut=2,LA=4,kut=6,wut=8,xF=10,Put=12,rC=15,oQ=~rC,R3e=16,but=32,lQ=64,px=128,Aue=256,wue=512,Sut=lQ|px|wue,Wsr=1023,M3e=t(a=>a.isFile()?wut:a.isDirectory()?LA:a.isSymbolicLink()?xF:a.isCharacterDevice()?Aut:a.isBlockDevice()?kut:a.isSocket()?Put:a.isFIFO()?Dut:nC,"entToType"),Tut=new Map,uQ=t(a=>{let s=Tut.get(a);if(s)return s;let c=a.normalize("NFKD");return Tut.set(a,c),c},"normalize"),Cut=new Map,kue=t(a=>{let s=Cut.get(a);if(s)return s;let c=uQ(a.toLowerCase());return Cut.set(a,c),c},"normalizeNocase"),Pue=class extends rQ{static{t(this,"ResolveCache")}constructor(){super({max:256})}},B3e=class extends rQ{static{t(this,"ChildrenCache")}constructor(s=16*1024){super({maxSize:s,sizeCalculation:t(c=>c.length+1,"sizeCalculation")})}},Nut=Symbol("PathScurry setAsCwd"),o1=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}#x;get ctime(){return this.#x}#C;get birthtime(){return this.#C}#b;#A;#E;#y;#D;#k;#o;#N;#S;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(s,c=nC,f,d,v,E,A){this.name=s,this.#b=v?kue(s):uQ(s),this.#o=c&Wsr,this.nocase=v,this.roots=d,this.root=f||this,this.#N=E,this.#E=A.fullpath,this.#D=A.relative,this.#k=A.relativePosix,this.parent=A.parent,this.parent?this.#r=this.parent.#r:this.#r=Eut(A.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#N}resolve(s){if(!s)return this;let c=this.getRootString(s),d=s.substring(c.length).split(this.splitSep);return c?this.getRoot(c).#I(d):this.#I(d)}#I(s){let c=this;for(let f of s)c=c.child(f);return c}children(){let s=this.#N.get(this);if(s)return s;let c=Object.assign([],{provisional:0});return this.#N.set(this,c),this.#o&=~R3e,c}child(s,c){if(s===""||s===".")return this;if(s==="..")return this.parent||this;let f=this.children(),d=this.nocase?kue(s):uQ(s);for(let O of f)if(O.#b===d)return O;let v=this.parent?this.sep:"",E=this.#E?this.#E+v+s:void 0,A=this.newChild(s,nC,{...c,parent:this,fullpath:E});return this.canReaddir()||(A.#o|=px),f.push(A),A}relative(){if(this.isCWD)return"";if(this.#D!==void 0)return this.#D;let s=this.name,c=this.parent;if(!c)return this.#D=this.name;let f=c.relative();return f+(!f||!c.parent?"":this.sep)+s}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let s=this.name,c=this.parent;if(!c)return this.#k=this.fullpathPosix();let f=c.relativePosix();return f+(!f||!c.parent?"":"/")+s}fullpath(){if(this.#E!==void 0)return this.#E;let s=this.name,c=this.parent;if(!c)return this.#E=this.name;let d=c.fullpath()+(c.parent?this.sep:"")+s;return this.#E=d}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let d=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(d)?this.#y=`//?/${d}`:this.#y=d}let s=this.parent,c=s.fullpathPosix(),f=c+(!c||!s.parent?"":"/")+this.name;return this.#y=f}isUnknown(){return(this.#o&rC)===nC}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&rC)===wut}isDirectory(){return(this.#o&rC)===LA}isCharacterDevice(){return(this.#o&rC)===Aut}isBlockDevice(){return(this.#o&rC)===kut}isFIFO(){return(this.#o&rC)===Dut}isSocket(){return(this.#o&rC)===Put}isSymbolicLink(){return(this.#o&xF)===xF}lstatCached(){return this.#o&but?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&rC;return!(s!==nC&&s!==xF||this.#o&Aue||this.#o&px)}calledReaddir(){return!!(this.#o&R3e)}isENOENT(){return!!(this.#o&px)}isNamed(s){return this.nocase?this.#b===kue(s):this.#b===uQ(s)}async readlink(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=await this.#r.promises.readlink(this.fullpath()),f=(await this.parent.realpath())?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}readlinkSync(){let s=this.#S;if(s)return s;if(this.canReadlink()&&this.parent)try{let c=this.#r.readlinkSync(this.fullpath()),f=this.parent.realpathSync()?.resolve(c);if(f)return this.#S=f}catch(c){this.#h(c.code);return}}#F(s){this.#o|=R3e;for(let c=s.provisional;c<s.length;c++){let f=s[c];f&&f.#L()}}#L(){this.#o&px||(this.#o=(this.#o|px)&oQ,this.#w())}#w(){let s=this.children();s.provisional=0;for(let c of s)c.#L()}#P(){this.#o|=wue,this.#R()}#R(){if(this.#o&lQ)return;let s=this.#o;(s&rC)===LA&&(s&=oQ),this.#o=s|lQ,this.#w()}#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 c=this.#o;c|=Aue,s==="ENOENT"&&(c|=px),(s==="EINVAL"||s==="UNKNOWN")&&(c&=oQ),this.#o=c,s==="ENOTDIR"&&this.parent&&this.parent.#R()}#B(s,c){return this.#O(s,c)||this.#U(s,c)}#U(s,c){let f=M3e(s),d=this.newChild(s.name,f,{parent:this}),v=d.#o&rC;return v!==LA&&v!==xF&&v!==nC&&(d.#o|=lQ),c.unshift(d),c.provisional++,d}#O(s,c){for(let f=c.provisional;f<c.length;f++){let d=c[f];if((this.nocase?kue(s.name):uQ(s.name))===d.#b)return this.#$(s,d,f,c)}}#$(s,c,f,d){let v=c.name;return c.#o=c.#o&oQ|M3e(s),v!==s.name&&(c.name=s.name),f!==d.provisional&&(f===d.length-1?d.pop():d.splice(f,1),d.unshift(c)),d.provisional++,c}async lstat(){if(!(this.#o&px))try{return this.#V(await this.#r.promises.lstat(this.fullpath())),this}catch(s){this.#j(s.code)}}lstatSync(){if(!(this.#o&px))try{return this.#V(this.#r.lstatSync(this.fullpath())),this}catch(s){this.#j(s.code)}}#V(s){let{atime:c,atimeMs:f,birthtime:d,birthtimeMs:v,blksize:E,blocks:A,ctime:O,ctimeMs:M,dev:W,gid:$,ino:Q,mode:Pe,mtime:De,mtimeMs:Se,nlink:Tt,rdev:wt,size:_r,uid:lr}=s;this.#m=c,this.#f=f,this.#C=d,this.#u=v,this.#_=E,this.#i=A,this.#x=O,this.#d=M,this.#n=W,this.#p=$,this.#c=Q,this.#e=Pe,this.#g=De,this.#v=Se,this.#t=Tt,this.#a=wt,this.#l=_r,this.#s=lr;let Or=M3e(s);this.#o=this.#o&oQ|Or|but,Or!==nC&&Or!==LA&&Or!==xF&&(this.#o|=lQ)}#q=[];#z=!1;#W(s){this.#z=!1;let c=this.#q.slice();this.#q.length=0,c.forEach(f=>f(null,s))}readdirCB(s,c=!1){if(!this.canReaddir()){c?s(null,[]):queueMicrotask(()=>s(null,[]));return}let f=this.children();if(this.calledReaddir()){let v=f.slice(0,f.provisional);c?s(null,v):queueMicrotask(()=>s(null,v));return}if(this.#q.push(s),this.#z)return;this.#z=!0;let d=this.fullpath();this.#r.readdir(d,{withFileTypes:!0},(v,E)=>{if(v)this.#M(v.code),f.provisional=0;else{for(let A of E)this.#B(A,f);this.#F(f)}this.#W(f.slice(0,f.provisional))})}#J;async readdir(){if(!this.canReaddir())return[];let s=this.children();if(this.calledReaddir())return s.slice(0,s.provisional);let c=this.fullpath();if(this.#J)await this.#J;else{let f=t(()=>{},"resolve");this.#J=new Promise(d=>f=d);try{for(let d of await this.#r.promises.readdir(c,{withFileTypes:!0}))this.#B(d,s);this.#F(s)}catch(d){this.#M(d.code),s.provisional=0}this.#J=void 0,f()}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 c=this.fullpath();try{for(let f of this.#r.readdirSync(c,{withFileTypes:!0}))this.#B(f,s);this.#F(s)}catch(f){this.#M(f.code),s.provisional=0}return s.slice(0,s.provisional)}canReaddir(){if(this.#o&Sut)return!1;let s=rC&this.#o;return s===nC||s===LA||s===xF}shouldWalk(s,c){return(this.#o&LA)===LA&&!(this.#o&Sut)&&!s.has(this)&&(!c||c(this))}async realpath(){if(this.#T)return this.#T;if(!((wue|Aue|px)&this.#o))try{let s=await this.#r.promises.realpath(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}realpathSync(){if(this.#T)return this.#T;if(!((wue|Aue|px)&this.#o))try{let s=this.#r.realpathSync(this.fullpath());return this.#T=this.resolve(s)}catch{this.#P()}}[Nut](s){if(s===this)return;s.isCWD=!1,this.isCWD=!0;let c=new Set([]),f=[],d=this;for(;d&&d.parent;)c.add(d),d.#D=f.join(this.sep),d.#k=f.join("/"),d=d.parent,f.push("..");for(d=s;d&&d.parent&&!c.has(d);)d.#D=void 0,d.#k=void 0,d=d.parent}},Nue=class a extends o1{static{t(this,"PathWin32")}sep="\\";splitSep=Vsr;constructor(s,c=nC,f,d,v,E,A){super(s,c,f,d,v,E,A)}newChild(s,c=nC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}getRootString(s){return j3e.parse(s).root}getRoot(s){if(s=zsr(s.toUpperCase()),s===this.root.name)return this.root;for(let[c,f]of Object.entries(this.roots))if(this.sameRoot(s,c))return this.roots[s]=f;return this.roots[s]=new Aj(s,this).root}sameRoot(s,c=this.root.name){return s=s.toUpperCase().replace(/\//g,"\\").replace(xut,"$1\\"),s===c}},Iue=class a extends o1{static{t(this,"PathPosix")}splitSep="/";sep="/";constructor(s,c=nC,f,d,v,E,A){super(s,c,f,d,v,E,A)}getRootString(s){return s.startsWith("/")?"/":""}getRoot(s){return this.root}newChild(s,c=nC,f={}){return new a(s,c,this.root,this.roots,this.nocase,this.childrenCache(),f)}},Oue=class{static{t(this,"PathScurryBase")}root;rootPath;roots;cwd;#r;#n;#e;nocase;#t;constructor(s=process.cwd(),c,f,{nocase:d,childrenCacheSize:v=16*1024,fs:E=cQ}={}){this.#t=Eut(E),(s instanceof URL||s.startsWith("file://"))&&(s=Isr(s));let A=c.resolve(s);this.roots=Object.create(null),this.rootPath=this.parseRootPath(A),this.#r=new Pue,this.#n=new Pue,this.#e=new B3e(v);let O=A.substring(this.rootPath.length).split(f);if(O.length===1&&!O[0]&&O.pop(),d===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=d,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let M=this.root,W=O.length-1,$=c.sep,Q=this.rootPath,Pe=!1;for(let De of O){let Se=W--;M=M.child(De,{relative:new Array(Se).fill("..").join($),relativePosix:new Array(Se).fill("..").join("/"),fullpath:Q+=(Pe?"":$)+De}),Pe=!0}this.cwd=M}depth(s=this.cwd){return typeof s=="string"&&(s=this.cwd.resolve(s)),s.depth()}childrenCache(){return this.#e}resolve(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#r.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpath();return this.#r.set(c,d),d}resolvePosix(...s){let c="";for(let v=s.length-1;v>=0;v--){let E=s[v];if(!(!E||E===".")&&(c=c?`${E}/${c}`:E,this.isAbsolute(E)))break}let f=this.#n.get(c);if(f!==void 0)return f;let d=this.cwd.resolve(c).fullpathPosix();return this.#n.set(c,d),d}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,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f}=c;if(s.canReaddir()){let d=await s.readdir();return f?d:d.map(v=>v.name)}else return[]}readdirSync(s=this.cwd,c={withFileTypes:!0}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0}=c;return s.canReaddir()?f?s.readdirSync():s.readdirSync().map(d=>d.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:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=await s.readlink();return c?f:f?.fullpath()}readlinkSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=s.readlinkSync();return c?f:f?.fullpath()}async realpath(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=await s.realpath();return c?f:f?.fullpath()}realpathSync(s=this.cwd,{withFileTypes:c}={withFileTypes:!1}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s.withFileTypes,s=this.cwd);let f=s.realpathSync();return c?f:f?.fullpath()}async walk(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set,M=t(($,Q)=>{O.add($),$.readdirCB((Pe,De)=>{if(Pe)return Q(Pe);let Se=De.length;if(!Se)return Q();let Tt=t(()=>{--Se===0&&Q()},"next");for(let wt of De)(!v||v(wt))&&A.push(f?wt:wt.fullpath()),d&&wt.isSymbolicLink()?wt.realpath().then(_r=>_r?.isUnknown()?_r.lstat():_r).then(_r=>_r?.shouldWalk(O,E)?M(_r,Tt):Tt()):wt.shouldWalk(O,E)?M(wt,Tt):Tt()},!0)},"walk"),W=s;return new Promise(($,Q)=>{M(W,Pe=>{if(Pe)return Q(Pe);$(A)})})}walkSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=[];(!v||v(s))&&A.push(f?s:s.fullpath());let O=new Set([s]);for(let M of O){let W=M.readdirSync();for(let $ of W){(!v||v($))&&A.push(f?$:$.fullpath());let Q=$;if($.isSymbolicLink()){if(!(d&&(Q=$.realpathSync())))continue;Q.isUnknown()&&Q.lstatSync()}Q.shouldWalk(O,E)&&O.add(Q)}}return A}[Symbol.asyncIterator](){return this.iterate()}iterate(s=this.cwd,c={}){return typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd),this.stream(s,c)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c;(!v||v(s))&&(yield f?s:s.fullpath());let A=new Set([s]);for(let O of A){let M=O.readdirSync();for(let W of M){(!v||v(W))&&(yield f?W:W.fullpath());let $=W;if(W.isSymbolicLink()){if(!(d&&($=W.realpathSync())))continue;$.isUnknown()&&$.lstatSync()}$.shouldWalk(A,E)&&A.add($)}}}stream(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new eN({objectMode:!0});(!v||v(s))&&A.write(f?s:s.fullpath());let O=new Set,M=[s],W=0,$=t(()=>{let Q=!1;for(;!Q;){let Pe=M.shift();if(!Pe){W===0&&A.end();return}W++,O.add(Pe);let De=t((Tt,wt,_r=!1)=>{if(Tt)return A.emit("error",Tt);if(d&&!_r){let lr=[];for(let Or of wt)Or.isSymbolicLink()&&lr.push(Or.realpath().then(hr=>hr?.isUnknown()?hr.lstat():hr));if(lr.length){Promise.all(lr).then(()=>De(null,wt,!0));return}}for(let lr of wt)lr&&(!v||v(lr))&&(A.write(f?lr:lr.fullpath())||(Q=!0));W--;for(let lr of wt){let Or=lr.realpathCached()||lr;Or.shouldWalk(O,E)&&M.push(Or)}Q&&!A.flowing?A.once("drain",$):Se||$()},"onReaddir"),Se=!0;Pe.readdirCB(De,!0),Se=!1}},"process");return $(),A}streamSync(s=this.cwd,c={}){typeof s=="string"?s=this.cwd.resolve(s):s instanceof o1||(c=s,s=this.cwd);let{withFileTypes:f=!0,follow:d=!1,filter:v,walkFilter:E}=c,A=new eN({objectMode:!0}),O=new Set;(!v||v(s))&&A.write(f?s:s.fullpath());let M=[s],W=0,$=t(()=>{let Q=!1;for(;!Q;){let Pe=M.shift();if(!Pe){W===0&&A.end();return}W++,O.add(Pe);let De=Pe.readdirSync();for(let Se of De)(!v||v(Se))&&(A.write(f?Se:Se.fullpath())||(Q=!0));W--;for(let Se of De){let Tt=Se;if(Se.isSymbolicLink()){if(!(d&&(Tt=Se.realpathSync())))continue;Tt.isUnknown()&&Tt.lstatSync()}Tt.shouldWalk(O,E)&&M.push(Tt)}}Q&&!A.flowing&&A.once("drain",$)},"process");return $(),A}chdir(s=this.cwd){let c=this.cwd;this.cwd=typeof s=="string"?this.cwd.resolve(s):s,this.cwd[Nut](c)}},Aj=class extends Oue{static{t(this,"PathScurryWin32")}sep="\\";constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,j3e,"\\",{...c,nocase:f}),this.nocase=f;for(let d=this.cwd;d;d=d.parent)d.nocase=this.nocase}parseRootPath(s){return j3e.parse(s).root.toUpperCase()}newRoot(s){return new Nue(this.rootPath,LA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")||s.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(s)}},kj=class extends Oue{static{t(this,"PathScurryPosix")}sep="/";constructor(s=process.cwd(),c={}){let{nocase:f=!1}=c;super(s,Nsr,"/",{...c,nocase:f}),this.nocase=f}parseRootPath(s){return"/"}newRoot(s){return new Iue(this.rootPath,LA,void 0,this.roots,this.nocase,this.childrenCache(),{fs:s})}isAbsolute(s){return s.startsWith("/")}},fQ=class extends kj{static{t(this,"PathScurryDarwin")}constructor(s=process.cwd(),c={}){let{nocase:f=!0}=c;super(s,{...c,nocase:f})}},SLr=process.platform==="win32"?Nue:Iue,Iut=process.platform==="win32"?Aj:process.platform==="darwin"?fQ:kj;var Hsr=t(a=>a.length>=1,"isPatternList"),Gsr=t(a=>a.length>=1,"isGlobList"),wj=class a{static{t(this,"Pattern")}#r;#n;#e;length;#t;#s;#p;#a;#_;#c;#l=!0;constructor(s,c,f,d){if(!Hsr(s))throw new TypeError("empty pattern list");if(!Gsr(c))throw new TypeError("empty glob list");if(c.length!==s.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=s.length,f<0||f>=this.length)throw new TypeError("index out of range");if(this.#r=s,this.#n=c,this.#e=f,this.#t=d,this.#e===0){if(this.isUNC()){let[v,E,A,O,...M]=this.#r,[W,$,Q,Pe,...De]=this.#n;M[0]===""&&(M.shift(),De.shift());let Se=[v,E,A,O,""].join("/"),Tt=[W,$,Q,Pe,""].join("/");this.#r=[Se,...M],this.#n=[Tt,...De],this.length=this.#r.length}else if(this.isDrive()||this.isAbsolute()){let[v,...E]=this.#r,[A,...O]=this.#n;E[0]===""&&(E.shift(),O.shift());let M=v+"/",W=A+"/";this.#r=[M,...E],this.#n=[W,...O],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]===cy}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 Qsr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Pj=class{static{t(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(s,{nobrace:c,nocase:f,noext:d,noglobstar:v,platform:E=Qsr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=E,this.mmopts={dot:!0,nobrace:c,nocase:f,noext:d,noglobstar:v,optimizationLevel:2,platform:E,nocomment:!0,nonegate:!0};for(let A of s)this.add(A)}add(s){let c=new hS(s,this.mmopts);for(let f=0;f<c.set.length;f++){let d=c.set[f],v=c.globParts[f];if(!d||!v)throw new Error("invalid pattern object");for(;d[0]==="."&&v[0]===".";)d.shift(),v.shift();let E=new wj(d,v,0,this.platform),A=new hS(E.globString(),this.mmopts),O=v[v.length-1]==="**",M=E.isAbsolute();M?this.absolute.push(A):this.relative.push(A),O&&(M?this.absoluteChildren.push(A):this.relativeChildren.push(A))}}ignored(s){let c=s.fullpath(),f=`${c}/`,d=s.relative()||".",v=`${d}/`;for(let E of this.relative)if(E.match(d)||E.match(v))return!0;for(let E of this.absolute)if(E.match(c)||E.match(f))return!0;return!1}childrenIgnored(s){let c=s.fullpath()+"/",f=(s.relative()||".")+"/";for(let d of this.relativeChildren)if(d.match(f))return!0;for(let d of this.absoluteChildren)if(d.match(c))return!0;return!1}};var U3e=class a{static{t(this,"HasWalkedCache")}store;constructor(s=new Map){this.store=s}copy(){return new a(new Map(this.store))}hasWalked(s,c){return this.store.get(s.fullpath())?.has(c.globString())}storeWalked(s,c){let f=s.fullpath(),d=this.store.get(f);d?d.add(c.globString()):this.store.set(f,new Set([c.globString()]))}},$3e=class{static{t(this,"MatchRecord")}store=new Map;add(s,c,f){let d=(c?2:0)|(f?1:0),v=this.store.get(s);this.store.set(s,v===void 0?d:d&v)}entries(){return[...this.store.entries()].map(([s,c])=>[s,!!(c&2),!!(c&1)])}},J3e=class{static{t(this,"SubWalks")}store=new Map;add(s,c){if(!s.canReaddir())return;let f=this.store.get(s);f?f.find(d=>d.globString()===c.globString())||f.push(c):this.store.set(s,[c])}get(s){let c=this.store.get(s);if(!c)throw new Error("attempting to walk unknown path");return c}entries(){return this.keys().map(s=>[s,this.store.get(s)])}keys(){return[...this.store.keys()].filter(s=>s.canReaddir())}},_Q=class a{static{t(this,"Processor")}hasWalkedCache;matches=new $3e;subwalks=new J3e;patterns;follow;dot;opts;constructor(s,c){this.opts=s,this.follow=!!s.follow,this.dot=!!s.dot,this.hasWalkedCache=c?c.copy():new U3e}processPatterns(s,c){this.patterns=c;let f=c.map(d=>[s,d]);for(let[d,v]of f){this.hasWalkedCache.storeWalked(d,v);let E=v.root(),A=v.isAbsolute()&&this.opts.absolute!==!1;if(E){d=d.resolve(E==="/"&&this.opts.root!==void 0?this.opts.root:E);let $=v.rest();if($)v=$;else{this.matches.add(d,!0,!1);continue}}if(d.isENOENT())continue;let O,M,W=!1;for(;typeof(O=v.pattern())=="string"&&(M=v.rest());)d=d.resolve(O),v=M,W=!0;if(O=v.pattern(),M=v.rest(),W){if(this.hasWalkedCache.hasWalked(d,v))continue;this.hasWalkedCache.storeWalked(d,v)}if(typeof O=="string"){let $=O===".."||O===""||O===".";this.matches.add(d.resolve(O),A,$);continue}else if(O===cy){(!d.isSymbolicLink()||this.follow||v.checkFollowGlobstar())&&this.subwalks.add(d,v);let $=M?.pattern(),Q=M?.rest();if(!M||($===""||$===".")&&!Q)this.matches.add(d,A,$===""||$===".");else if($===".."){let Pe=d.parent||d;Q?this.hasWalkedCache.hasWalked(Pe,Q)||this.subwalks.add(Pe,Q):this.matches.add(Pe,A,!0)}}else O instanceof RegExp&&this.subwalks.add(d,v)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new a(this.opts,this.hasWalkedCache)}filterEntries(s,c){let f=this.subwalks.get(s),d=this.child();for(let v of c)for(let E of f){let A=E.isAbsolute(),O=E.pattern(),M=E.rest();O===cy?d.testGlobstar(v,E,M,A):O instanceof RegExp?d.testRegExp(v,O,M,A):d.testString(v,O,M,A)}return d}testGlobstar(s,c,f,d){if((this.dot||!s.name.startsWith("."))&&(c.hasMore()||this.matches.add(s,d,!1),s.canReaddir()&&(this.follow||!s.isSymbolicLink()?this.subwalks.add(s,c):s.isSymbolicLink()&&(f&&c.checkFollowGlobstar()?this.subwalks.add(s,f):c.markFollowGlobstar()&&this.subwalks.add(s,c)))),f){let v=f.pattern();if(typeof v=="string"&&v!==".."&&v!==""&&v!==".")this.testString(s,v,f.rest(),d);else if(v===".."){let E=s.parent||s;this.subwalks.add(E,f)}else v instanceof RegExp&&this.testRegExp(s,v,f.rest(),d)}}testRegExp(s,c,f,d){c.test(s.name)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}testString(s,c,f,d){s.isNamed(c)&&(f?this.subwalks.add(s,f):this.matches.add(s,d,!1))}};var Ksr=t((a,s)=>typeof a=="string"?new Pj([a],s):Array.isArray(a)?new Pj(a,s):a,"makeIgnore"),Fue=class{static{t(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#r=[];#n;#e;signal;maxDepth;includeChildMatches;constructor(s,c,f){if(this.patterns=s,this.path=c,this.opts=f,this.#e=!f.posix&&f.platform==="win32"?"\\":"/",this.includeChildMatches=f.includeChildMatches!==!1,(f.ignore||!this.includeChildMatches)&&(this.#n=Ksr(f.ignore??[],f),!this.includeChildMatches&&typeof this.#n.add!="function")){let d="cannot ignore child matches, ignore lacks add() method.";throw new Error(d)}this.maxDepth=f.maxDepth||1/0,f.signal&&(this.signal=f.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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||await s.realpath(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?await s.lstat():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=await v.realpath();E&&(E.isUnknown()||this.opts.stat)&&await E.lstat()}return this.matchCheckTest(v,c)}matchCheckTest(s,c){return s&&(this.maxDepth===1/0||s.depth()<=this.maxDepth)&&(!c||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,c){if(c&&this.opts.nodir)return;let f;if(this.opts.realpath){if(f=s.realpathCached()||s.realpathSync(),!f)return;s=f}let v=s.isUnknown()||this.opts.stat?s.lstatSync():s;if(this.opts.follow&&this.opts.nodir&&v?.isSymbolicLink()){let E=v.realpathSync();E&&(E?.isUnknown()||this.opts.stat)&&E.lstatSync()}return this.matchCheckTest(v,c)}matchFinish(s,c){if(this.#t(s))return;if(!this.includeChildMatches&&this.#n?.add){let v=`${s.relativePosix()}/**`;this.#n.add(v)}let f=this.opts.absolute===void 0?c:this.opts.absolute;this.seen.add(s);let d=this.opts.mark&&s.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(s);else if(f){let v=this.opts.posix?s.fullpathPosix():s.fullpath();this.matchEmit(v+d)}else{let v=this.opts.posix?s.relativePosix():s.relative(),E=this.opts.dotRelative&&!v.startsWith(".."+this.#e)?"."+this.#e:"";this.matchEmit(v?E+v+d:"."+d)}}async match(s,c,f){let d=await this.matchCheck(s,f);d&&this.matchFinish(d,c)}matchSync(s,c,f){let d=this.matchCheckSync(s,f);d&&this.matchFinish(d,c)}walkCB(s,c,f){this.signal?.aborted&&f(),this.walkCB2(s,c,new _Q(this.opts),f)}walkCB2(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirCached();A.calledReaddir()?this.walkCB3(A,O,f,E):A.readdirCB((M,W)=>this.walkCB3(A,W,f,E),!0)}E()}walkCB3(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||(v++,this.match(A,O,M).then(()=>E()));for(let[A,O]of f.subwalks.entries())v++,this.walkCB2(A,O,f.child(),E);E()}walkCBSync(s,c,f){this.signal?.aborted&&f(),this.walkCB2Sync(s,c,new _Q(this.opts),f)}walkCB2Sync(s,c,f,d){if(this.#s(s))return d();if(this.signal?.aborted&&d(),this.paused){this.onResume(()=>this.walkCB2Sync(s,c,f,d));return}f.processPatterns(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let A of f.subwalkTargets()){if(this.maxDepth!==1/0&&A.depth()>=this.maxDepth)continue;v++;let O=A.readdirSync();this.walkCB3Sync(A,O,f,E)}E()}walkCB3Sync(s,c,f,d){f=f.filterEntries(s,c);let v=1,E=t(()=>{--v===0&&d()},"next");for(let[A,O,M]of f.matches.entries())this.#t(A)||this.matchSync(A,O,M);for(let[A,O]of f.subwalks.entries())v++,this.walkCB2Sync(A,O,f.child(),E);E()}},pQ=class extends Fue{static{t(this,"GlobWalker")}matches=new Set;constructor(s,c,f){super(s,c,f)}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,c)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?c(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}},dQ=class extends Fue{static{t(this,"GlobStream")}results;constructor(s,c,f){super(s,c,f),this.results=new eN({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 Xsr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",dx=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,c){if(!c)throw new TypeError("glob options required");if(this.withFileTypes=!!c.withFileTypes,this.signal=c.signal,this.follow=!!c.follow,this.dot=!!c.dot,this.dotRelative=!!c.dotRelative,this.nodir=!!c.nodir,this.mark=!!c.mark,c.cwd?(c.cwd instanceof URL||c.cwd.startsWith("file://"))&&(c.cwd=Ysr(c.cwd)):this.cwd="",this.cwd=c.cwd||"",this.root=c.root,this.magicalBraces=!!c.magicalBraces,this.nobrace=!!c.nobrace,this.noext=!!c.noext,this.realpath=!!c.realpath,this.absolute=c.absolute,this.includeChildMatches=c.includeChildMatches!==!1,this.noglobstar=!!c.noglobstar,this.matchBase=!!c.matchBase,this.maxDepth=typeof c.maxDepth=="number"?c.maxDepth:1/0,this.stat=!!c.stat,this.ignore=c.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof s=="string"&&(s=[s]),this.windowsPathsNoEscape=!!c.windowsPathsNoEscape||c.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(O=>O.replace(/\\/g,"/"))),this.matchBase){if(c.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(O=>O.includes("/")?O:`./**/${O}`)}if(this.pattern=s,this.platform=c.platform||Xsr,this.opts={...c,platform:this.platform},c.scurry){if(this.scurry=c.scurry,c.nocase!==void 0&&c.nocase!==c.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let O=c.platform==="win32"?Aj:c.platform==="darwin"?fQ:c.platform?kj:Iut;this.scurry=new O(this.cwd,{nocase:c.nocase,fs:c.fs})}this.nocase=this.scurry.nocase;let f=this.platform==="darwin"||this.platform==="win32",d={...c,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:f,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},v=this.pattern.map(O=>new hS(O,d)),[E,A]=v.reduce((O,M)=>(O[0].push(...M.set),O[1].push(...M.globParts),O),[[],[]]);this.patterns=E.map((O,M)=>{let W=A[M];if(!W)throw new Error("invalid pattern object");return new wj(O,W,0,this.platform)})}async walk(){return[...await new pQ(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 pQ(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 dQ(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 dQ(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 q3e=t((a,s={})=>{Array.isArray(a)||(a=[a]);for(let c of a)if(new hS(c,s).hasMagic())return!0;return!1},"hasMagic");function Lue(a,s={}){return new dx(a,s).streamSync()}t(Lue,"globStreamSync");function Fut(a,s={}){return new dx(a,s).stream()}t(Fut,"globStream");function Lut(a,s={}){return new dx(a,s).walkSync()}t(Lut,"globSync");async function Out(a,s={}){return new dx(a,s).walk()}t(Out,"glob_");function Rue(a,s={}){return new dx(a,s).iterateSync()}t(Rue,"globIterateSync");function Rut(a,s={}){return new dx(a,s).iterate()}t(Rut,"globIterate");var Zsr=Lue,ear=Object.assign(Fut,{sync:Lue}),tar=Rue,rar=Object.assign(Rut,{sync:Rue}),nar=Object.assign(Lut,{stream:Lue,iterate:Rue}),mQ=Object.assign(Out,{glob:Out,globSync:Lut,sync:nar,globStream:Fut,stream:ear,globStreamSync:Lue,streamSync:Zsr,globIterate:Rut,iterate:rar,globIterateSync:Rue,iterateSync:tar,Glob:dx,hasMagic:q3e,escape:Tj,unescape:fx});mQ.glob=mQ;import _de from"fs";import DLe from"path";var hv=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 iar="[",sar="]",aar="{",oar="}",car=":",lar=",",uar="true",far="false",_ar="null",par="NaN",dar="Infinity",V3e='"',hQ=new Map([[34,V3e],[92,"\\"],[47,"/"],[98,"\b"],[110,`
558
558
  `],[102,"\f"],[114,"\r"],[116," "]]),Bue=new Map([...hQ,[118,"\v"],[48,"\0"]]),mar=new Map([[V3e,V3e],["\\","\\"],["/","/"],["\b","b"],[`
559
559
  `,"n"],["\f","f"],["\r","r"],[" ","t"]]),aRr=new Map([...mar,["\v","v"],["\0","0"],["\u2028","u2028"],["\u2029","u2029"]]),jue=new Map([[iar,"LBracket"],[sar,"RBracket"],[aar,"LBrace"],[oar,"RBrace"],[car,"Colon"],[lar,"Comma"],[uar,"Boolean"],[far,"Boolean"],[_ar,"Null"]]),Mue=new Map([...jue,[par,"Number"],[dar,"Number"]]),W3e=new Set([10,13,8232,8233]),JP=class extends Error{static{t(this,"ErrorWithLocation")}constructor(s,{line:c,column:f,offset:d}){super(`${s} (${c}:${f})`),this.line=c,this.column=f,this.offset=d}},H3e=class extends JP{static{t(this,"UnexpectedChar")}constructor(s,c){super(`Unexpected character '${String.fromCharCode(s)}' found.`,c)}},G3e=class extends JP{static{t(this,"UnexpectedIdentifier")}constructor(s,c){super(`Unexpected identifier '${s}' found.`,c)}},DF=class extends JP{static{t(this,"UnexpectedToken")}constructor(s){super(`Unexpected token ${s.type} found.`,s.loc.start)}},Uue=class extends JP{static{t(this,"UnexpectedEOF")}constructor(s){super("Unexpected end of input found.",s)}},har=/[\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]/,gar=/[\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]/,yar=13,Mut=10,Q3e=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===yar?(this.#s=!0,this.peek()===Mut&&this.#t++):s===Mut&&(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}},bar="Infinity",Sar="NaN",Tar=new Set([116,102,110]),K3e=new Set([32,9,10,13]),jut=new Set([...K3e,11,12,160,8232,8233,65279,160,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288]),Car={mode:"json",ranges:!1},Ear=new Set(["true","false","null"]),G_={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 $P(a){return a>=48&&a<=57}t($P,"isDigit");function z3e(a){return $P(a)||a>=65&&a<=70||a>=97&&a<=102}t(z3e,"isHexDigit");function xar(a){return a>=49&&a<=57}t(xar,"isPositiveDigit");function Dar(a){return Tar.has(a)}t(Dar,"isKeywordStart");function Uut(a){return $P(a)||a===46||a===45}t(Uut,"isNumberStart");function Aar(a){return Uut(a)||a===43}t(Aar,"isJSON5NumberStart");function But(a,s){return a===34||s&&a===39}t(But,"isStringStart");function $ut(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 har.test(s)}t($ut,"isJSON5IdentifierStart");function kar(a){if($ut(a)||$P(a))return!0;let s=String.fromCharCode(a);return gar.test(s)}t(kar,"isJSON5IdentifierPart");var Y3e=class{static{t(this,"Tokenizer")}#r;#n;#e;#t;#s;#p;#a;#_;#c;#l;#i;constructor(s,c){this.#n=s,this.#r={...Car,...c},this.#e=new Q3e(s),this.#t=this.#r.mode==="json5",this.#s=this.#r.mode!=="json",this.#p=this.#r.ranges,this.#_=this.#t?Bue.has.bind(Bue):hQ.has.bind(hQ),this.#c=this.#t?W3e.has.bind(W3e):()=>!1,this.#l=this.#t?f=>f===120:()=>!1,this.#i=this.#t?jut.has.bind(jut):K3e.has.bind(K3e)}#f(s,c=this.#e.locate()){throw new H3e(s,c)}#v(s,c=this.#e.locate()){throw new G3e(s,c)}#d(){throw new Uue(this.#e.locate())}#u(s,c,f,d){let v=f.offset+c,E=this.#r.ranges?{range:[f.offset,v]}:void 0;return{type:s,loc:{start:f,end:d||{line:f.line,column:f.column+c,offset:v}},...E}}#m(s){let c="",f;for(let d=0;d<s;d++){if(f=this.#e.peek(),z3e(f)){this.#e.next(),c+=String.fromCharCode(f);continue}this.#f(f)}return c}#g(s){let c="";do{if(c+=String.fromCharCode(s),s===92&&(s=this.#e.next(),s!==117&&this.#f(s),c+=String.fromCharCode(s),c+=this.#m(4)),s=this.#e.peek(),!kar(s))break;this.#e.next()}while(!0);return c}#x(s){let c=s,f=1;for(s=this.#e.peek();s!==-1&&s!==c;){if(this.#e.next(),f++,s===92)if(s=this.#e.peek(),this.#_(s)||this.#c(s))this.#e.next(),f++;else if(s===117){this.#e.next(),f++;let d=this.#m(4);f+=d.length}else if(this.#l(s)){this.#e.next(),f++;let d=this.#m(2);f+=d.length}else this.#t?(this.#e.next(),f++):this.#f(s);s=this.#e.peek()}return s===-1&&(this.#e.next(),this.#d()),this.#e.next(),f++,f}#C(s){let c=1;if(s===45||this.#t&&s===43){if(s=this.#e.peek(),this.#t&&(s===73||s===78)){this.#e.next();let f=this.#g(s);return f!==bar&&f!==Sar&&this.#f(s),c+f.length}$P(s)||this.#f(s),this.#e.next(),c++}if(s===48)if(s=this.#e.peek(),this.#t&&(s===120||s===88)){this.#e.next(),c++,s=this.#e.peek(),z3e(s)||(this.#e.next(),this.#f(s));do this.#e.next(),c++,s=this.#e.peek();while(z3e(s))}else $P(s)&&this.#f(s);else if(!this.#t||s!==46)for(xar(s)||this.#f(s),s=this.#e.peek();$P(s);)this.#e.next(),c++,s=this.#e.peek();if(s===46){let f=-1;for(this.#e.next(),c++,f++,s=this.#e.peek();$P(s);)this.#e.next(),c++,f++,s=this.#e.peek();!this.#t&&f===0&&(this.#e.next(),s?this.#f(s):this.#d())}if(s===101||s===69)for(this.#e.next(),c++,s=this.#e.peek(),(s===43||s===45)&&(this.#e.next(),c++,s=this.#e.peek()),s===-1&&(this.#e.next(),this.#d()),$P(s)||(this.#e.next(),this.#f(s));$P(s);)this.#e.next(),c++,s=this.#e.peek();return c}#b(s){let c=1;if(s=this.#e.peek(),s===47){do this.#e.next(),c+=1,s=this.#e.peek();while(s>-1&&s!==13&&s!==10);return{length:c,multiline:!1}}if(s===42){for(this.#e.next(),c+=1;s>-1;)if(s=this.#e.peek(),s===42){if(this.#e.next(),c+=1,s=this.#e.peek(),s===47)return this.#e.next(),c+=1,{length:c,multiline:!0}}else this.#e.next(),c+=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 G_.EOF;let c=this.#e.locate(),f=String.fromCharCode(s);if(this.#t)if(Mue.has(f))this.#a=this.#u(Mue.get(f),1,c);else if($ut(s)){let d=this.#g(s);Mue.has(d)?this.#a=this.#u(Mue.get(d),d.length,c):this.#a=this.#u("Identifier",d.length,c)}else if(Aar(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(But(s,this.#t)){let d=this.#x(s),v=this.#e.locate();this.#a=this.#u("String",d,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);else if(jue.has(f))this.#a=this.#u(jue.get(f),1,c);else if(Dar(s)){let d=this.#g(s);Ear.has(d)||this.#v(d,c),this.#a=this.#u(jue.get(d),d.length,c)}else if(Uut(s)){let d=this.#C(s);this.#a=this.#u("Number",d,c)}else if(But(s,this.#t)){let d=this.#x(s);this.#a=this.#u("String",d,c)}else if(s===47&&this.#s){let d=this.#b(s),v=this.#e.locate();this.#a=this.#u(d.multiline?"BlockComment":"LineComment",d.length,c,{line:v.line,column:v.column+1,offset:v.offset+1})}else this.#f(s);return G_[this.#a.type]}get token(){return this.#a}};var iC={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,c={}){return{type:"Member",name:a,value:s,loc:c.loc,...c}},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}}},war={mode:"json",ranges:!1,tokens:!1,allowTrailingCommas:!1};function Par(a,s,c=!1){let f="",d=a.indexOf("\\"),v=0;for(;d>=0;){f+=a.slice(v,d);let E=a.charAt(d+1),A=E.charCodeAt(0);if(c&&Bue.has(A))f+=Bue.get(A),v=d+2;else if(hQ.has(A))f+=hQ.get(A),v=d+2;else if(E==="u"){let O=a.slice(d+2,d+6);if(O.length<4||/[^0-9a-f]/i.test(O))throw new JP(`Invalid unicode escape \\u${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+6}else if(c&&E==="x"){let O=a.slice(d+2,d+4);if(O.length<2||/[^0-9a-f]/i.test(O))throw new JP(`Invalid hex escape \\x${O}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});f+=String.fromCharCode(parseInt(O,16)),v=d+4}else if(c&&W3e.has(A))v=d+2,E==="\r"&&a.charAt(v)===`
560
- `&&v++;else if(c)f+=E,v=d+2;else throw new JP(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(Par,"getStringValue");function Nar(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Par(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Nar,"getLiteralValue");function Jut(a,s){s=Object.freeze({...war,...s});let c=[],f=new Y3e(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur}t(E,"nextNoComments");function A(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur>=G_.LineComment?A():ur}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(ur,er){if(ur!==er)throw new DF(f.token)}t(M,"assertTokenType");function W(ur,er){if(!er.includes(ur))throw new DF(f.token)}t(W,"assertTokenTypes");function $(ur,er){return s.ranges?{range:[ur.offset,er.offset]}:void 0}t($,"createRange");function Q(ur){let er=f.token,Es=$(er.loc.start,er.loc.end),wi=Nar(a.slice(er.loc.start.offset,er.loc.end.offset),er,d),mi={loc:{start:{...er.loc.start},end:{...er.loc.end}},...Es};switch(ur){case G_.String:return iC.string(wi,mi);case G_.Number:return iC.number(wi,mi);case G_.Boolean:return iC.boolean(wi,mi);default:throw new TypeError(`Unknown token type ${er.type}.`)}}t(Q,"createLiteralNode");function Pe(ur){let er=$(ur.loc.start,ur.loc.end),Es=a.slice(ur.loc.start.offset,ur.loc.end.offset),fo={loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er};if(ur.type!=="Identifier"){let mi="";return(Es[0]==="+"||Es[0]==="-")&&(mi=Es[0]),iC[Es.includes("NaN")?"nan":"infinity"](mi,fo)}return iC.identifier(Es,fo)}t(Pe,"createJSON5IdentifierNode");function De(ur){let er=$(ur.loc.start,ur.loc.end);return iC.null({loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er})}t(De,"createNullNode");function Se(ur){d?W(ur,[G_.String,G_.Identifier,G_.Number]):M(ur,G_.String);let er=f.token,Es=ur===G_.String?Q(ur):Pe(er);if(d&&(Es.type==="NaN"||Es.type==="Infinity")){if(Es.sign!=="")throw new DF(f.token);Es=iC.identifier(Es.type,{loc:Es.loc,...$(Es.loc.start,Es.loc.end)})}ur=O(),M(ur,G_.Colon);let wi=_r(),fo=$(Es.loc.start,wi.loc.end);return iC.member(Es,wi,{loc:{start:{...Es.loc.start},end:{...wi.loc.end}},...fo})}t(Se,"parseProperty");function Tt(ur){M(ur,G_.LBrace);let er=f.token,Es=[],wi=O();if(wi!==G_.RBrace)do{if(Es.push(Se(wi)),wi=O(),!wi)throw new Uue(Es[Es.length-1].loc.end);if(wi===G_.Comma){if(wi=O(),v&&wi===G_.RBrace)break}else break}while(wi);M(wi,G_.RBrace);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.object(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(Tt,"parseObject");function wt(ur){M(ur,G_.LBracket);let er=f.token,Es=[],wi=O();if(wi!==G_.RBracket)do{let wo=_r(wi);if(Es.push(iC.element(wo,{loc:wo.loc})),wi=O(),wi===G_.Comma){if(wi=O(),v&&wi===G_.RBracket)break}else break}while(wi);M(wi,G_.RBracket);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.array(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(wt,"parseArray");function _r(ur){ur=ur??O();let er=f.token;switch(ur){case G_.String:case G_.Boolean:return Q(ur);case G_.Number:if(d){let Es=a.slice(er.loc.start.offset,er.loc.end.offset);if((Es[0]==="+"||Es[0]==="-")&&(Es=Es.slice(1)),Es==="NaN"||Es==="Infinity")return Pe(er)}return Q(ur);case G_.Null:return De(er);case G_.LBrace:return Tt(ur);case G_.LBracket:return wt(ur);default:throw new DF(er)}}t(_r,"parseValue");let lr=_r();if(O())throw new DF(f.token);let hr={loc:{start:{line:1,column:1,offset:0},end:{...lr.loc.end}}};return s.tokens&&(hr.tokens=c),s.ranges&&(hr.range=[hr.loc.start.offset,hr.loc.end.offset]),iC.document(lr,hr)}t(Jut,"parse");var Iar=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function qut(a){return a&&typeof a=="object"}t(qut,"isObject");function Oar(a){return qut(a)&&typeof a.type=="string"}t(Oar,"isNode");function Far(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of Iar.get(f.type)){let E=f[v];qut(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):Oar(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(Far,"traverse");function zut(a,s=()=>!0){let c=[];return Far(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(zut,"iterator");import Lar from"fs/promises";var gQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),$ue=t(async a=>{try{return await Lar.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),yQ=t(async a=>{try{return Jut(a)}catch(s){if(s.column&&s.line&&s.message){let c=gQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Vut=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await $ue(f),v=await Rar(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),Rar=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await yQ(a);if(v){for(let{node:E}of zut(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=gQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Wut from"fs/promises";import Jue from"path";var X3e="schemas",Z3e=".oas.json";var AF=t(async a=>(await Wut.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(Z3e)).sort(),"getOpenApiFilesByAlphabetical"),Nj=t(async a=>{let s=Jue.resolve(a,"config");return(await Wut.readdir(s)).filter(f=>f.endsWith(Z3e)).length>=1},"oasFileInProject");function vQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new pv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),eNe(tNe(c),s,A,f,d,v,E)}t(vQ,"chaseRefs");function eNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)eNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),vQ(a,s,tN(a,O),f,d,v,E)}eNe(a,s,c[A],f,d,v,E)}}t(eNe,"lookForRefs");function tN(a,s){let c=s.indexOf("#");return c>=0?`${Jue.resolve(a,s.substring(0,c))}${s.substring(c)}`:Jue.resolve(Jue.dirname(a),s)}t(tN,"getFullyQualifiedRefName");function tNe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(tNe,"getFilePathNameFromRefName");var rNe=class{static{t(this,"Environment")}get WORKING_COPY_ENVIRONMENT(){return process.env.WORKING_COPY_ENVIRONMENT??"staging"}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME?process.env.ZUP_WORKING_COPY_HOSTNAME:this.WORKING_COPY_ENVIRONMENT==="staging"?"d1.zuplo.dev":"d2.zuplo.dev"}},Mar=new rNe,nNe=Mar;var RQ=W_(yIe(),1);var vIe={};zct(vIe,{UnsafePathError:()=>mfe,deleteFile:()=>Cfr,deleteFolder:()=>Ifr,dirExists:()=>hfe,ensureDirectoryExists:()=>Afr,fileExists:()=>Tfr,getParentDirFilename:()=>wfr,isNotFileOrDirectory:()=>Efr,listFolderContents:()=>bpt,listFolders:()=>Dfr,mkdirForFilePathIfNotExits:()=>Tpt,mkdirIfNotExists:()=>Spt,safePath:()=>kfr,tarFolderContent:()=>Pfr,untar:()=>Nfr});import ypt from"child_process";import lN from"fs/promises";import cN from"path";var vpt=[".git","node_modules",".yarn",".DS_Store"];async function Tfr(a){try{return(await lN.stat(a)).isFile()}catch{return!1}}t(Tfr,"fileExists");async function Cfr(a,s){return await lN.rm(a,s)}t(Cfr,"deleteFile");async function hfe(a){try{return(await lN.stat(a)).isDirectory()}catch{return!1}}t(hfe,"dirExists");async function Efr(a){try{return await lN.stat(a),!1}catch{return!0}}t(Efr,"isNotFileOrDirectory");function xfr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(xfr,"getParentDirectory");async function Dfr(a){if(!await hfe(a))return[];let s=await lN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)vpt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(Dfr,"listFolders");async function bpt(a,s,c=!0){let f=xfr(a,s),d=await lN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!vpt.includes(E.name)||!c)if(E.isDirectory()){let A=await bpt(cN.join(a,E.name),s,c);v.push(...A)}else v.push(cN.join(f,E.name));return v}t(bpt,"listFolderContents");var Spt=t(async a=>{if(await hfe(a))return!0;await lN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Tpt=t(async a=>{let s=cN.dirname(a);return Spt(s)},"mkdirForFilePathIfNotExits"),Afr=Tpt,mfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function kfr(a){let s=t(c=>{if(!c.startsWith(a))throw new mfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(cN.resolve(...c)),"resolve")}}t(kfr,"safePath");function wfr(a){return`${cN.basename(cN.dirname(a))}/${cN.basename(a)}`}t(wfr,"getParentDirFilename");function Pfr(a,s,c,f){let d=cN.join(f,c);return ypt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${d} ${s}`,{cwd:a}),d}t(Pfr,"tarFolderContent");function Nfr(a,s,c,f=!1){ypt.execSync(`tar -xf ${s} ${f?"--strip-components=1 ":""}-C ${c}`,{cwd:a})}t(Nfr,"untar");async function Ifr(a){if(await hfe(a))return await lN.rm(a,{recursive:!0})}t(Ifr,"deleteFolder");var Ul=vIe;var cC=W_(yIe(),1);import{readFile as Ofr}from"fs/promises";var RF=class extends Error{static{t(this,"CustomResolveError")}},uN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return RQ.$RefParser.dereference(s,{resolve:{json:!0,file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return RQ.$RefParser.bundle(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return RQ.$RefParser.parse(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return RQ.$RefParser.resolve(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function gfe(a,s){return{order:100,canRead(c){let f=Rfr(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=Cpt(c.url)}catch(E){throw new RF(`Malformed URI: ${c.url}`,{cause:E})}try{Ul.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=Cpt(c.url)}catch(d){throw new RF(`Malformed URI: ${c.url}`,{cause:d})}try{return await Ofr(f)}catch(d){throw new RF(`Error opening file "${f}"`,{cause:d})}}}}t(gfe,"customResolver");var bIe=/^win/.test(globalThis.process?globalThis.process.platform:""),Ffr=/\//g,Lfr=/^(\w{2,}):\/\//i,SIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Rfr(a){let s=Lfr.exec(a);if(s)return s[1].toLowerCase()}t(Rfr,"getProtocol");function Cpt(a,s){a=decodeURI(a);for(let f=0;f<SIe.length;f+=2)a=a.replace(SIe[f],SIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),bIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=bIe?a:"/"+a)),bIe&&!c&&(a=a.replace(Ffr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Cpt,"toFileSystemPath");var Ept="YOUR_KEY_HERE";async function xpt(a){let c=await new uN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return Mfr({...a,relativeOpenApiPath:f},c)}t(xpt,"buildPublicOpenApiFile");async function Mfr(a,s){$fr({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=Bfr(c),jfr(c,a),c=Ufr(c,a),Dpt(c,"x-zuplo"),c}t(Mfr,"buildRawOpenApiFile");function jfr(a,{customDomain:s,deploymentName:c,environmentType:f}){let d;s?d=s:f&&c&&(d=f===Yct.WORKING_COPY?`${c}.${nNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${nNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(jfr,"addServerHost");function Bfr(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(yj in A&&lue(A[yj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(W=>{let $=A[W];if(!$)return;if(lue($[yj])){delete O[W];return}let{parameters:Q}=$;if(!Q)return;let Pe=Q.filter(De=>{if(yj in De&&lue(De[yj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Pe}}),M.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(Bfr,"removeHiddenRoutesAndParams");function Ufr(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,Q)=>{let Pe=s.policies?.find(({name:Tt})=>Tt===Q);if(!Pe)return $;if(!(Pe.handler.export==="CompositeInboundPolicy"))return $.concat(Q);let Se=Pe.handler.options?.policies;return Se?$.concat(Se):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="ApiAuthKeyInboundPolicy"||Q.handler.export==="ApiKeyInboundPolicy")&&!Q.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(Q)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",Q=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Pe=Q!==""?`${Q} ${Ept}`:Ept,De={name:$,in:"header",required:!0,example:Pe,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Pe}\`.`};A.parameters?A.parameters.some(_r=>"name"in _r&&_r.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:Q.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(_r=>"name"in _r&&_r.type==="apiKey"||"type"in _r&&_r.type==="http"&&_r.scheme===Q)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let wt={[Tt]:[]};A.security?A.security.some(_r=>_r[Tt]!==void 0)||A.security.unshift(wt):A.security=[wt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="RateLimitInboundPolicy"||Q.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(Q)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Q={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:Q},A.responses||(A.responses={});let Pe=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Pe?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(Ufr,"enrichSpecWithZuploData");function Dpt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&Dpt(a[c],s)}t(Dpt,"removePropertiesByPrefix");function $fr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new pv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new pv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new pv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t($fr,"assertIsZuploOpenApiSpec");function Jfr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let W=a.charAt(M),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let W=0,$=0,Q=0,Pe=M.length;for(;Q!==Pe&&M[Q]===0;)Q++,W++;let De=(Pe-Q)*v+1>>>0,Se=new Uint8Array(De);for(;Q!==Pe;){let _r=M[Q],lr=0;for(let Or=De-1;(_r!==0||lr<$)&&Or!==-1;Or--,lr++)_r+=256*Se[Or]>>>0,Se[Or]=_r%c>>>0,_r=_r/c>>>0;if(_r!==0)throw new Error("Non-zero carry");$=lr,Q++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let wt=f.repeat(W);for(;Tt<De;++Tt)wt+=a.charAt(Se[Tt]);return wt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let W=0,$=0,Q=0;for(;M[W]===f;)$++,W++;let Pe=(M.length-W)*d+1>>>0,De=new Uint8Array(Pe);for(;M[W];){let _r=s[M.charCodeAt(W)];if(_r===255)return;let lr=0;for(let Or=Pe-1;(_r!==0||lr<Q)&&Or!==-1;Or--,lr++)_r+=c*De[Or]>>>0,De[Or]=_r%256>>>0,_r=_r/256>>>0;if(_r!==0)throw new Error("Non-zero carry");Q=lr,W++}let Se=Pe-Q;for(;Se!==Pe&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Pe-Se)),wt=$;for(;Se!==Pe;)Tt[wt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(M){let W=A(M);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(Jfr,"base");var Apt=Jfr;var qfr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",yfe=Apt(qfr);var TIe="2024-09-02",kpt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function wpt(){return new lC({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:TIe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:kpt[TIe]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(wpt,"getMockEnvironment");var lC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=wpt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(yfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var zfr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function Ppt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!zfr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(Ppt,"isRestrictedEnvVariableName");function Npt(a){return!!a.startsWith("ZUPLO_")}t(Npt,"isZuploReadableEnvVariableName");var Xjr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return lC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return lC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return lC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return lC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return lC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return lC.instance.build.BUILD_ID}if(!(Ppt(c)&&!Npt(c)))return lC.instance.runtime[c]}});function MQ(a,s,c){return`_${HP(`${a}_${s}_${c}`)}`}t(MQ,"getRawOperationDataIdentifierName");function CIe(a,s,c,f){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(CIe,"getIdForParameterSchema");function EIe(a,s,c){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_rb_${HP(c.toLowerCase())}`}t(EIe,"getIdForRequestBodySchema");function jQ(a,s){return`_${HP(a)}_${HP(s)}`}t(jQ,"getIdForRefSchema");function HP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(HP,"sanitizedIdentifierName");var lyt=W_(Smt(),1);import z_e from"path";var eK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rdr=/[$_\p{ID_Start}]/u,Mdr=/[$_\u200C\u200D\p{ID_Continue}]/u,y8e=".*";function jdr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jdr,"Re");function Emt(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Rdr.test(O)||A!==f+1&&Mdr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!jdr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(Emt,"v");function xmt(a,s={}){let c=Emt(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${pC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(lr=>{if(E<c.length&&c[E].type===lr)return c[E++].value},"a"),W=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(lr=>{let Or=M(lr);if(Or!==void 0)return Or;let{type:hr,index:ur}=c[E];throw new TypeError(`Unexpected ${hr} at ${ur}, expected ${lr}`)},"d"),Q=t(()=>{let lr="",Or;for(;Or=M("CHAR")??M("ESCAPED_CHAR");)lr+=Or;return lr},"T"),Pe=t(lr=>lr,"Se"),De=s.encodePart||Pe,Se="",Tt=t(lr=>{Se+=lr},"U"),wt=t(()=>{Se.length&&(d.push(new eK(3,"","",De(Se),"",3)),Se="")},"$"),_r=t((lr,Or,hr,ur,er)=>{let Es=3;switch(er){case"?":Es=1;break;case"*":Es=0;break;case"+":Es=2;break}if(!Or&&!hr&&Es===3){Tt(lr);return}if(wt(),!Or&&!hr){if(!lr)return;d.push(new eK(3,"","",De(lr),"",Es));return}let wi;hr?hr==="*"?wi=y8e:wi=hr:wi=f;let fo=2;wi===f?(fo=1,wi=""):wi===y8e&&(fo=0,wi="");let mi;if(Or?mi=Or:hr&&(mi=v++),O.has(mi))throw new TypeError(`Duplicate name '${mi}'.`);O.add(mi),d.push(new eK(fo,mi,De(lr),wi,De(ur),Es))},"V");for(;E<c.length;){let lr=M("CHAR"),Or=M("NAME"),hr=M("REGEX");if(!Or&&!hr&&(hr=M("ASTERISK")),Or||hr){let er=lr??"";s.prefixes.indexOf(er)===-1&&(Tt(er),er=""),wt();let Es=W();_r(er,Or,hr,"",Es);continue}let ur=lr??M("ESCAPED_CHAR");if(ur){Tt(ur);continue}if(M("OPEN")){let er=Q(),Es=M("NAME"),wi=M("REGEX");!Es&&!wi&&(wi=M("ASTERISK"));let fo=Q();$("CLOSE");let mi=W();_r(er,Es,wi,fo,mi);continue}wt(),$("END")}return d}t(xmt,"D");function pC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pC,"S");function Tmt(a){return a&&a.ignoreCase?"ui":"u"}t(Tmt,"X");function Bdr(a,s,c){return Dmt(xmt(a,c),s,c)}t(Bdr,"Z");function tB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(tB,"k");function Dmt(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=pC(A.value):f+=`(?:${pC(A.value)})${tB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${pC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=y8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${tB(A.modifier)}`:f+=`((?:${M})${tB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${pC(A.prefix)}(${M})${pC(A.suffix)})`,f+=tB(A.modifier);continue}f+=`(?:${pC(A.prefix)}`,f+=`((?:${M})(?:`,f+=pC(A.suffix),f+=pC(A.prefix),f+=`(?:${M}))*)${pC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${pC(c.endsWith)}]|$`,v=`[${pC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,Tmt(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,Tmt(c))}t(Dmt,"F");var dN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Udr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$dr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jdr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jdr,"J");function Amt(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Amt,"Q");function qdr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(qdr,"Ee");function kmt(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(kmt,"W");var wmt=["ftp","file","http","https","ws","wss"];function Pmt(a){if(!a)return!0;for(let s of wmt)if(a.test(s))return!0;return!1}t(Pmt,"N");function zdr(a,s){if(a=Amt(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(zdr,"te");function Vdr(a,s){if(a=Amt(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(Vdr,"re");function Wdr(a,s){return s||a===""?a:kmt(a)?Omt(a):Imt(a)}t(Wdr,"ne");function Hdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Hdr,"se");function Gdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Gdr,"ie");function Qdr(a,s,c){if(c||a==="")return a;if(s&&!wmt.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Qdr,"ae");function Kdr(a,s,c){return Nmt(s)===a&&(a=""),c||a===""?a:Fmt(a)}t(Kdr,"oe");function Ydr(a,s){return a=qdr(a,":"),s||a===""?a:v8e(a)}t(Ydr,"ce");function Nmt(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Nmt,"_");function v8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(v8e,"y");function Xdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Xdr,"le");function Zdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zdr,"fe");function Imt(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Imt,"z");function Omt(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Omt,"j");function Fmt(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Fmt,"K");function emr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(emr,"he");function tmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tmr,"ue");function rmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rmr,"de");function nmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nmr,"pe");var imr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Emt(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,dN),a.encodePart=v8e;let s=Bdr(this.#T(),void 0,a);this.#l=Pmt(s)}},g8e=["protocol","username","password","hostname","port","pathname","search","hash"],pN="*";function Cmt(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(Cmt,"ge");function XP(a,s){return s?ZQ(a):a}t(XP,"b");function XQ(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=XP(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=XP(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=XP(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=XP(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=XP(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=XP(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=XP(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=XP(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Ydr(s.protocol,c)),typeof s.username=="string"&&(a.username=Gdr(s.username,c)),typeof s.password=="string"&&(a.password=Hdr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=Wdr(s.hostname,c)),typeof s.port=="string"&&(a.port=Kdr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Jdr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=XP(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Qdr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=Vdr(s.search,c)),typeof s.hash=="string"&&(a.hash=zdr(s.hash,c)),a}t(XQ,"w");function ZQ(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(ZQ,"C");function smr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(smr,"Oe");function amr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${smr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=ZQ(A.value);continue}v+=`{${ZQ(A.value)}}${tB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let Q=$.value.length>0?$.value[0]:"";M=d.test(Q)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&W&&W.type===3){let Q=W.value[W.value.length-1];M=s.prefixes.includes(Q)}M&&(v+="{"),v+=ZQ(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=ZQ(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=tB(A.modifier))}return v}t(amr,"ke");var Lmt=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new imr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:pN,protocol:pN,username:pN,password:pN,hostname:pN,port:pN,search:pN,hash:pN};this.#r=XQ(v,a,!0),Nmt(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of g8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,dN),A.encodePart=v8e;break;case"username":Object.assign(A,dN),A.encodePart=Xdr;break;case"password":Object.assign(A,dN),A.encodePart=Zdr;break;case"hostname":Object.assign(A,Udr),kmt(O)?A.encodePart=Omt:A.encodePart=Imt;break;case"port":Object.assign(A,dN),A.encodePart=Fmt;break;case"pathname":Pmt(this.#n.protocol)?(Object.assign(A,$dr,d),A.encodePart=emr):(Object.assign(A,dN,d),A.encodePart=tmr);break;case"search":Object.assign(A,dN,d),A.encodePart=rmr;break;case"hash":Object.assign(A,dN,d),A.encodePart=nmr;break}try{this.#s[E]=xmt(O,A),this.#n[E]=Dmt(this.#s[E],this.#e[E],A),this.#t[E]=amr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,Cmt(a,s),!1)}catch{return!1}let f;for(f of g8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,Cmt(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of g8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new eK(3,"","","","",3),v=new eK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let W=f(A[M],O[M]);if(W)return W}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=Lmt);import{AssertionError as omr}from"assert";function ZP(a,s){if(a===!1)throw new omr({message:s})}t(ZP,"assert");var Hc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Hc||(Hc={}));function rB(a){return a.type===Hc.Object}t(rB,"isAstObject");function e6(a){return a.type===Hc.Property}t(e6,"isAstProperty");function Rmt(a){return a.type===Hc.Array}t(Rmt,"isAstArray");function nB(a){return a.type===Hc.Literal}t(nB,"isAstLiteral");function qF(a){if(a===void 0)throw new Error("Node is undefined");if(!rB(a))throw new Error("Node is not object")}t(qF,"assertAstObject");import{findNodeAtLocation as cmr,getNodeValue as lmr,printParseErrorCode as umr,visit as fmr}from"jsonc-parser";var _mr={DEFAULT:{allowTrailingComma:!1}};function tK(a,s=[],c=_mr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),fmr(a,{onObjectBegin:t((O,M,W)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,W,$,Q)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:Q+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:W,line:$,column:Q,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,W,$,Q)=>{v({type:pmr(O),offset:M,length:W,line:$+1,column:Q+1,parent:f,value:O}),d(M+W)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,W,$,Q)=>{s.push({error:O,offset:M,length:W,line:$+1,column:Q+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(tK,"parse");function pmr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(pmr,"getNodeType");function b8e(a,s){return cmr(a,s)}t(b8e,"findNodeAtLocation");function rK(a){return lmr(a)}t(rK,"getNodeValue");function Mmt(a){return umr(a)}t(Mmt,"printParseErrorCode");var nK=class{static{t(this,"AstAdapter")}parse(s){let f=tK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Hc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Hc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){ZP(s.children?.length===2,"Invalid property node");let f={type:Hc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Hc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Hc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var xx={createLiteral:t((a,s)=>({type:Hc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Hc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Hc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Hc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Hc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Hc.Array,parent:s,children:[]};for(let f of a)c.children.push(xx.createLiteral(f,c));return c},"createArrayOfLiterals")};var dmr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,iK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Hc.Array:return this.generateArray(s,c);case Hc.Object:return this.generateObject(s,c);case Hc.Property:return this.generateProperty(s,c);case Hc.Literal:return this.generateLiteral(s,c);case Hc.FunctionCall:return this.generateFunctionCall(s,c);case Hc.Identifier:return this.generateIdentifier(s,c);case Hc.Raw:return this.generateRaw(s,c);case Hc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=dmr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as mmr}from"@swc/core";import hmr from"fs/promises";var jmt=t(async a=>{let s=new Set;try{let c=await hmr.readFile(a,"utf-8");(await mmr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Bmt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var S8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Umt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var T8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var C8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Z0t=W_(T0t(),1),eyt=W_(X0t(),1);var R_e=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new eyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Z0t.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(M)?void 0:c[O][M][W];v={details:{property:O,index:M,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var EN=R_e.instance;EN.addSchema(C8e,"route-configuration.schema.json");EN.addSchema(Umt,"policy-configuration.schema.json");EN.addSchema(S8e,"policies.schema.json");EN.addSchema(T8e,"open-api-route-configuration.schema.json");EN.addSchema(Bmt,"fragments.schema.json");var Yqr=EN.compile(C8e),tyt=EN.compile(T8e),jFe=EN.compile(S8e);var M_e=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=jFe(s),this.results}};var j_e=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=tyt(s),this.results}};import Tbr from"path";var BFe=/\$import\((.*)\)/,B_e=/\$env\((.*?)\)/g;var s6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Sbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),xN=t((a,s)=>{if(!a)return!1;let c=Sbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||e6(A)&&A.name.value===v?!0:v==="{}"?A.type===Hc.Object:v==="[]"?A.type===Hc.Array:!1:!1})},"testPosition");var U_e=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),rB(s)?s.children.forEach(c=>{this.visitor(c)}):Rmt(s)?s.children.forEach(c=>{this.visitor(c)}):e6(s)&&this.visitor(s.value)}},ryt=t((a,s,c)=>f=>{if(!e6(f)||!nB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>xN(f,v))){B_e.test(f.value.value)&&s.push(new s6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(B_e).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Hc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(B_e),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=xx.createTemplateString(v,f))}},"getEnvStatementTransformer");var MK="config/routes.json",Cbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ebr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],nyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],xbr="handler/{}/options/{}/rewritePattern",Dbr="handler/{}/options/{}/baseUrl",$_e=class extends U_e{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!e6(s)||!nB(s.value)||typeof s.value.value!="string")&&xN(s,xbr)){if(!s.parent||!rB(s.parent)){this.errors.push(new s6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:iyt(c)},d=xx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!e6(s)||!nB(s.value)||typeof s.value.value!="string")&&xN(s,Dbr)){if(!s.parent||!rB(s.parent)){this.errors.push(new s6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:iyt(c)},d=xx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!e6(s)||!nB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Ebr.some(A=>xN(s,A))&&!nyt.some(A=>xN(s,A))){if(BFe.test(c)){if(s.name.value==="$ref")return;this.errors.push(new s6("An $import() statement is not expected at this location.",MK,s.location,c))}return}let f=BFe.exec(c);if(nyt.some(A=>xN(s,A))&&!f)return;if(!f){this.errors.push(new s6("Invalid $import() statement",MK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Tbr.join("..",d));let v=this.getImportName(d),E={type:Hc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=ryt(Cbr,this.errors,MK)};function iyt(a){return`(request, context) => {
560
+ `&&v++;else if(c)f+=E,v=d+2;else throw new JP(`Invalid escape \\${E}.`,{line:s.loc.start.line,column:s.loc.start.column+d,offset:s.loc.start.offset+d});d=a.indexOf("\\",v)}return f+=a.slice(v),f}t(Par,"getStringValue");function Nar(a,s,c=!1){switch(s.type){case"Boolean":return a==="true";case"Number":return Number(a);case"String":return Par(a.slice(1,-1),s,c);default:throw new TypeError(`Unknown token type "${s.type}.`)}}t(Nar,"getLiteralValue");function Jut(a,s){s=Object.freeze({...war,...s});let c=[],f=new Y3e(a,{mode:s.mode,ranges:s.ranges}),d=s.mode==="json5",v=s.allowTrailingCommas||d;function E(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur}t(E,"nextNoComments");function A(){let ur=f.next();return ur&&s.tokens&&c.push(f.token),ur>=G_.LineComment?A():ur}t(A,"nextSkipComments");let O=s.mode==="json"?E:A;function M(ur,er){if(ur!==er)throw new DF(f.token)}t(M,"assertTokenType");function W(ur,er){if(!er.includes(ur))throw new DF(f.token)}t(W,"assertTokenTypes");function $(ur,er){return s.ranges?{range:[ur.offset,er.offset]}:void 0}t($,"createRange");function Q(ur){let er=f.token,Es=$(er.loc.start,er.loc.end),wi=Nar(a.slice(er.loc.start.offset,er.loc.end.offset),er,d),mi={loc:{start:{...er.loc.start},end:{...er.loc.end}},...Es};switch(ur){case G_.String:return iC.string(wi,mi);case G_.Number:return iC.number(wi,mi);case G_.Boolean:return iC.boolean(wi,mi);default:throw new TypeError(`Unknown token type ${er.type}.`)}}t(Q,"createLiteralNode");function Pe(ur){let er=$(ur.loc.start,ur.loc.end),Es=a.slice(ur.loc.start.offset,ur.loc.end.offset),fo={loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er};if(ur.type!=="Identifier"){let mi="";return(Es[0]==="+"||Es[0]==="-")&&(mi=Es[0]),iC[Es.includes("NaN")?"nan":"infinity"](mi,fo)}return iC.identifier(Es,fo)}t(Pe,"createJSON5IdentifierNode");function De(ur){let er=$(ur.loc.start,ur.loc.end);return iC.null({loc:{start:{...ur.loc.start},end:{...ur.loc.end}},...er})}t(De,"createNullNode");function Se(ur){d?W(ur,[G_.String,G_.Identifier,G_.Number]):M(ur,G_.String);let er=f.token,Es=ur===G_.String?Q(ur):Pe(er);if(d&&(Es.type==="NaN"||Es.type==="Infinity")){if(Es.sign!=="")throw new DF(f.token);Es=iC.identifier(Es.type,{loc:Es.loc,...$(Es.loc.start,Es.loc.end)})}ur=O(),M(ur,G_.Colon);let wi=_r(),fo=$(Es.loc.start,wi.loc.end);return iC.member(Es,wi,{loc:{start:{...Es.loc.start},end:{...wi.loc.end}},...fo})}t(Se,"parseProperty");function Tt(ur){M(ur,G_.LBrace);let er=f.token,Es=[],wi=O();if(wi!==G_.RBrace)do{if(Es.push(Se(wi)),wi=O(),!wi)throw new Uue(Es[Es.length-1].loc.end);if(wi===G_.Comma){if(wi=O(),v&&wi===G_.RBrace)break}else break}while(wi);M(wi,G_.RBrace);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.object(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(Tt,"parseObject");function wt(ur){M(ur,G_.LBracket);let er=f.token,Es=[],wi=O();if(wi!==G_.RBracket)do{let wo=_r(wi);if(Es.push(iC.element(wo,{loc:wo.loc})),wi=O(),wi===G_.Comma){if(wi=O(),v&&wi===G_.RBracket)break}else break}while(wi);M(wi,G_.RBracket);let fo=f.token,mi=$(er.loc.start,fo.loc.end);return iC.array(Es,{loc:{start:{...er.loc.start},end:{...fo.loc.end}},...mi})}t(wt,"parseArray");function _r(ur){ur=ur??O();let er=f.token;switch(ur){case G_.String:case G_.Boolean:return Q(ur);case G_.Number:if(d){let Es=a.slice(er.loc.start.offset,er.loc.end.offset);if((Es[0]==="+"||Es[0]==="-")&&(Es=Es.slice(1)),Es==="NaN"||Es==="Infinity")return Pe(er)}return Q(ur);case G_.Null:return De(er);case G_.LBrace:return Tt(ur);case G_.LBracket:return wt(ur);default:throw new DF(er)}}t(_r,"parseValue");let lr=_r();if(O())throw new DF(f.token);let hr={loc:{start:{line:1,column:1,offset:0},end:{...lr.loc.end}}};return s.tokens&&(hr.tokens=c),s.ranges&&(hr.range=[hr.loc.start.offset,hr.loc.end.offset]),iC.document(lr,hr)}t(Jut,"parse");var Iar=new Map([["Document",["body"]],["Object",["members"]],["Member",["name","value"]],["Element",["value"]],["Array",["elements"]],["String",[]],["Number",[]],["Boolean",[]],["Null",[]],["NaN",[]],["Infinity",[]],["Identifier",[]]]);function qut(a){return a&&typeof a=="object"}t(qut,"isObject");function Oar(a){return qut(a)&&typeof a.type=="string"}t(Oar,"isNode");function Far(a,s){function c(f,d){typeof s.enter=="function"&&s.enter(f,d);for(let v of Iar.get(f.type)){let E=f[v];qut(E)&&(Array.isArray(E)?E.forEach(A=>c(A,f)):Oar(E)&&c(E,f))}typeof s.exit=="function"&&s.exit(f,d)}t(c,"visitNode"),c(a)}t(Far,"traverse");function zut(a,s=()=>!0){let c=[];return Far(a,{enter(f,d){c.push({node:f,parent:d,phase:"enter"})},exit(f,d){c.push({node:f,parent:d,phase:"exit"})}}),c.filter(s).values()}t(zut,"iterator");import Lar from"fs/promises";var gQ=t((a,s)=>a.split(/\r?\n/)[s-1],"getFileLineContent"),$ue=t(async a=>{try{return await Lar.readFile(a,"utf-8")}catch{return}},"getSchemaContent"),yQ=t(async a=>{try{return Jut(a)}catch(s){if(s.column&&s.line&&s.message){let c=gQ(a,s.line);return{column:s.column,line:s.line,length:void 0,lineText:c}}return}},"getSchemaAST");var Vut=t(async(a,s,c)=>{try{if(a.length===0)return;for(let f of a){let d=await $ue(f),v=await Rar(d,f,s,c);if(v)return v}}catch{}},"getRouteLocationByValue"),Rar=t(async(a,s,c,f)=>{try{if(!a)return;let d=null,v=await yQ(a);if(v){for(let{node:E}of zut(v))if(E.value&&E.value===c){d=E.loc;break}if(d!==null){let E=gQ(a,d.start.line);return{file:s,line:d.start.line,column:d.start.column,length:d.end.column-d.start.column,lineText:E,suggestion:f}}}}catch{}},"getRouteLocationByValueFromSchema");import Wut from"fs/promises";import Jue from"path";var X3e="schemas",Z3e=".oas.json";var AF=t(async a=>(await Wut.readdir(a)).map(c=>`${a}/${c}`).filter(c=>c.endsWith(Z3e)).sort(),"getOpenApiFilesByAlphabetical"),Nj=t(async a=>{let s=Jue.resolve(a,"config");return(await Wut.readdir(s)).filter(f=>f.endsWith(Z3e)).length>=1},"oasFileInProject");function vQ(a,s,c,f,d,v,E){if(v.has(c))return;let A;try{A=f.get(c)}catch(O){throw new pv({text:`Failed to resolve reference: ${c}`,detail:O.message,severity:"error",message:"Failed to resolve reference",location:{file:a,column:0,line:0,length:0,lineText:c,namespace:s,suggestion:"Check the reference and try again."}})}v.set(c,d.length),d.push(c),eNe(tNe(c),s,A,f,d,v,E)}t(vQ,"chaseRefs");function eNe(a,s,c,f,d,v,E){if(Array.isArray(c))for(let A of c)eNe(a,s,A,f,d,v,E);else if(typeof c=="object")for(let A in c){if(A==="$ref"){let O=c[A];E&&(c[A]=E(s,O)),vQ(a,s,tN(a,O),f,d,v,E)}eNe(a,s,c[A],f,d,v,E)}}t(eNe,"lookForRefs");function tN(a,s){let c=s.indexOf("#");return c>=0?`${Jue.resolve(a,s.substring(0,c))}${s.substring(c)}`:Jue.resolve(Jue.dirname(a),s)}t(tN,"getFullyQualifiedRefName");function tNe(a){let s=a.indexOf("#");return s>=0?a.substring(0,s):a}t(tNe,"getFilePathNameFromRefName");var rNe=class{static{t(this,"Environment")}get ZUP_HOSTNAME(){return process.env.ZUP_HOSTNAME??"zuplo.app"}get ZUP_WORKING_COPY_HOSTNAME(){return process.env.ZUP_WORKING_COPY_HOSTNAME??"working-copy.zuplotest.com"}},Mar=new rNe,nNe=Mar;var RQ=W_(yIe(),1);var vIe={};zct(vIe,{UnsafePathError:()=>mfe,deleteFile:()=>Cfr,deleteFolder:()=>Ifr,dirExists:()=>hfe,ensureDirectoryExists:()=>Afr,fileExists:()=>Tfr,getParentDirFilename:()=>wfr,isNotFileOrDirectory:()=>Efr,listFolderContents:()=>bpt,listFolders:()=>Dfr,mkdirForFilePathIfNotExits:()=>Tpt,mkdirIfNotExists:()=>Spt,safePath:()=>kfr,tarFolderContent:()=>Pfr,untar:()=>Nfr});import ypt from"child_process";import lN from"fs/promises";import cN from"path";var vpt=[".git","node_modules",".yarn",".DS_Store"];async function Tfr(a){try{return(await lN.stat(a)).isFile()}catch{return!1}}t(Tfr,"fileExists");async function Cfr(a,s){return await lN.rm(a,s)}t(Cfr,"deleteFile");async function hfe(a){try{return(await lN.stat(a)).isDirectory()}catch{return!1}}t(hfe,"dirExists");async function Efr(a){try{return await lN.stat(a),!1}catch{return!0}}t(Efr,"isNotFileOrDirectory");function xfr(a,s){let c=new RegExp(`(.*)(\\/${s})$|(.*)(${s}\\/)`),f=a.match(c);if(!f)return"";let d=a.split(f[0]);return d[1]===""?"":`/${d[1]}`}t(xfr,"getParentDirectory");async function Dfr(a){if(!await hfe(a))return[];let s=await lN.readdir(a,{withFileTypes:!0}),c=[];for await(let f of s)vpt.includes(f.name)||f.isDirectory()&&c.push(f.name);return c}t(Dfr,"listFolders");async function bpt(a,s,c=!0){let f=xfr(a,s),d=await lN.readdir(a,{withFileTypes:!0}),v=[];for await(let E of d)if(!vpt.includes(E.name)||!c)if(E.isDirectory()){let A=await bpt(cN.join(a,E.name),s,c);v.push(...A)}else v.push(cN.join(f,E.name));return v}t(bpt,"listFolderContents");var Spt=t(async a=>{if(await hfe(a))return!0;await lN.mkdir(a,{recursive:!0})},"mkdirIfNotExists"),Tpt=t(async a=>{let s=cN.dirname(a);return Spt(s)},"mkdirForFilePathIfNotExits"),Afr=Tpt,mfe=class extends Error{static{t(this,"UnsafePathError")}constructor(s){super(s)}};function kfr(a){let s=t(c=>{if(!c.startsWith(a))throw new mfe("Resolved path is not part of the project.");return c},"ensureSafePath");return{resolve:t((...c)=>s(cN.resolve(...c)),"resolve")}}t(kfr,"safePath");function wfr(a){return`${cN.basename(cN.dirname(a))}/${cN.basename(a)}`}t(wfr,"getParentDirFilename");function Pfr(a,s,c,f){let d=cN.join(f,c);return ypt.execSync(`tar --exclude='.git/' --exclude='dist/' -czf ${d} ${s}`,{cwd:a}),d}t(Pfr,"tarFolderContent");function Nfr(a,s,c,f=!1){ypt.execSync(`tar -xf ${s} ${f?"--strip-components=1 ":""}-C ${c}`,{cwd:a})}t(Nfr,"untar");async function Ifr(a){if(await hfe(a))return await lN.rm(a,{recursive:!0})}t(Ifr,"deleteFolder");var Ul=vIe;var cC=W_(yIe(),1);import{readFile as Ofr}from"fs/promises";var RF=class extends Error{static{t(this,"CustomResolveError")}},uN=class{static{t(this,"RefParser")}sourceDirectory;logger;constructor(s,c){this.sourceDirectory=s,this.logger=c}dereference(s,c){return RQ.$RefParser.dereference(s,{resolve:{json:!0,file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1},dereference:{circular:"ignore",onDereference:c?.onDereference}})}bundle(s){return RQ.$RefParser.bundle(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}parse(s){return RQ.$RefParser.parse(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}resolve(s){return RQ.$RefParser.resolve(s,{resolve:{file:gfe(this.sourceDirectory,this.logger),external:!0,http:!1}})}};function gfe(a,s){return{order:100,canRead(c){let f=Rfr(c.url);if(!(f===void 0||f==="file"))return!1;let v;try{v=Cpt(c.url)}catch(E){throw new RF(`Malformed URI: ${c.url}`,{cause:E})}try{Ul.safePath(a).resolve(v)}catch(E){return s?.warn(E),!1}return!0},async read(c){let f;try{f=Cpt(c.url)}catch(d){throw new RF(`Malformed URI: ${c.url}`,{cause:d})}try{return await Ofr(f)}catch(d){throw new RF(`Error opening file "${f}"`,{cause:d})}}}}t(gfe,"customResolver");var bIe=/^win/.test(globalThis.process?globalThis.process.platform:""),Ffr=/\//g,Lfr=/^(\w{2,}):\/\//i,SIe=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"];function Rfr(a){let s=Lfr.exec(a);if(s)return s[1].toLowerCase()}t(Rfr,"getProtocol");function Cpt(a,s){a=decodeURI(a);for(let f=0;f<SIe.length;f+=2)a=a.replace(SIe[f],SIe[f+1]);let c=a.substr(0,7).toLowerCase()==="file://";return c&&(a=a[7]==="/"?a.substr(8):a.substr(7),bIe&&a[1]==="/"&&(a=a[0]+":"+a.substr(1)),s?a="file:///"+a:(c=!1,a=bIe?a:"/"+a)),bIe&&!c&&(a=a.replace(Ffr,"\\"),a.substr(1,2)===":\\"&&(a=a[0].toUpperCase()+a.substr(1))),a}t(Cpt,"toFileSystemPath");var Ept="YOUR_KEY_HERE";async function xpt(a){let c=await new uN(a.sourceDirectory,a.logger).bundle(a.openApiDocPath),f=a.openApiDocPath.replace(a.sourceDirectory,"");return Mfr({...a,relativeOpenApiPath:f},c)}t(xpt,"buildPublicOpenApiFile");async function Mfr(a,s){$fr({relativeOpenApiPath:a.relativeOpenApiPath},s);let c=s;return c=Bfr(c),jfr(c,a),c=Ufr(c,a),Dpt(c,"x-zuplo"),c}t(Mfr,"buildRawOpenApiFile");function jfr(a,{customDomain:s,deploymentName:c,environmentType:f}){let d;s?d=s:f&&c&&(d=f===Yct.WORKING_COPY?`${c}.${nNe.ZUP_WORKING_COPY_HOSTNAME}`:`${c}.${nNe.ZUP_HOSTNAME}`),d?a.servers=[{url:`https://${d}`}]:a.servers=void 0}t(jfr,"addServerHost");function Bfr(a){if(!a.paths)return a;let{components:s}=a,c=s?{...s}:void 0,f=[];c&&c.parameters&&(f=Object.entries(c.parameters).reduce((v,[E,A])=>(yj in A&&lue(A[yj])&&(v.push(E),c.parameters&&delete c.parameters[E]),v),[]));let d=Object.entries(a.paths).reduce((v,[E,A])=>{if(!A)return v;let O={...A},M=["delete","get","head","patch","post","put","trace","options"];return M.forEach(W=>{let $=A[W];if(!$)return;if(lue($[yj])){delete O[W];return}let{parameters:Q}=$;if(!Q)return;let Pe=Q.filter(De=>{if(yj in De&&lue(De[yj]))return!1;if("$ref"in De){let Se=De.$ref.split("/").pop();return Se?!f.includes(Se):!0}return!0});O[W]={...$,parameters:Pe}}),M.some(W=>!!O[W])&&(v[E]=O),v},{});return{...a,paths:d,components:c}}t(Bfr,"removeHiddenRoutesAndParams");function Ufr(a,{policiesConfig:s}){if(!a.paths)return a;let c=Object.entries(a.paths).reduce((f,[d,v])=>{if(!v)return f;let E={...v};return[E.delete,E.get,E.head,E.patch,E.post,E.put,E.trace,E.options].forEach(A=>{if(!A)return;let O=A["x-zuplo-route"]?.policies?.inbound?.reduce(($,Q)=>{let Pe=s.policies?.find(({name:Tt})=>Tt===Q);if(!Pe)return $;if(!(Pe.handler.export==="CompositeInboundPolicy"))return $.concat(Q);let Se=Pe.handler.options?.policies;return Se?$.concat(Se):$},[]),M=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="ApiAuthKeyInboundPolicy"||Q.handler.export==="ApiKeyInboundPolicy")&&!Q.handler.options?.disableAutomaticallyAddingKeyHeaderToOpenApi&&M.push(Q)})}),M.length>0){let $=M.length>0&&M[0].handler&&M[0].handler.options&&M[0].handler.options.authHeader?M[0].handler.options.authHeader:"Authorization",Q=M.length>0&&M[0].handler&&M[0].handler.options&&(M[0].handler.options.authScheme||M[0].handler.options.authScheme==="")?M[0].handler.options.authScheme:"Bearer",Pe=Q!==""?`${Q} ${Ept}`:Ept,De={name:$,in:"header",required:!0,example:Pe,schema:{type:"string"},description:`The \`${$}\` header is used to authenticate with the API using your API key. Value is of the format \`${Pe}\`.`};A.parameters?A.parameters.some(_r=>"name"in _r&&_r.name===De.name)||A.parameters.unshift(De):A.parameters=[De];let Se={type:"http",scheme:Q.toLowerCase()},Tt="api_key";a.components?.securitySchemes?Object.values(a.components?.securitySchemes).some(_r=>"name"in _r&&_r.type==="apiKey"||"type"in _r&&_r.type==="http"&&_r.scheme===Q)||(a.components.securitySchemes={...a.components.securitySchemes,[Tt]:Se}):(a.components||(a.components={}),a.components.securitySchemes={[Tt]:Se});let wt={[Tt]:[]};A.security?A.security.some(_r=>_r[Tt]!==void 0)||A.security.unshift(wt):A.security=[wt]}let W=[];if(O&&O.forEach($=>{s.policies?.forEach(Q=>{Q.name===$&&(Q.handler.export==="RateLimitInboundPolicy"||Q.handler.export==="ComplexRateLimitInboundPolicy")&&W.push(Q)})}),W.length>0){let $={description:"Rate Limiting Response",content:{"application/json":{schema:{type:"object",required:["type","title","status"],examples:[{type:"https://httpproblems.com/http-status/429",title:"Too Many Requests",status:429,instance:"/foo/bar"}],properties:{type:{type:"string",example:"https://httpproblems.com/http-status/429",description:"A URI reference that identifies the problem."},title:{type:"string",example:"Too Many Requests",description:"A short, human-readable summary of the problem."},status:{type:"number",example:429,description:"The HTTP status code."},instance:{type:"string",example:"/foo/bar"}}}}}},Q={...$,headers:{"retry-after":{description:"The number of seconds to wait before making a new request.",schema:{type:"integer",example:60}}}};a.components?.responses||a.components||(a.components={}),a.components.responses={...a.components.responses,RateLimitNoRetryAfter:$,RateLimitWithRetryAfter:Q},A.responses||(A.responses={});let Pe=W.some(De=>De.handler.options?.headerMode!=="none");A.responses[429]||(A.responses[429]={$ref:Pe?"#/components/responses/RateLimitWithRetryAfter":"#/components/responses/RateLimitNoRetryAfter"})}}),f[d]=E,f},{});return{...a,paths:c}}t(Ufr,"enrichSpecWithZuploData");function Dpt(a,s){for(let c in a)c.startsWith(s)?delete a[c]:typeof a[c]=="object"&&Dpt(a[c],s)}t(Dpt,"removePropertiesByPrefix");function $fr({relativeOpenApiPath:a},s){if(!s||typeof s!="object")throw new pv({message:"The OpenAPI Document could not be parsed.",severity:"error"});if(!("info"in s)||typeof s.info!="object"||!s.info)throw new pv({message:"The OpenAPI document does not have the required 'info' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"});if(!("title"in s.info)||typeof s.info.title!="string")throw new pv({message:"The OpenAPI document does not have the required 'info.title' property.",location:{file:a,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:"Add the required 'info.title' property. https://spec.openapis.org/oas/v3.1.0#info-object"},severity:"error"})}t($fr,"assertIsZuploOpenApiSpec");function Jfr(a){if(a.length>=255)throw new TypeError("Alphabet too long");let s=new Uint8Array(256);for(let M=0;M<s.length;M++)s[M]=255;for(let M=0;M<a.length;M++){let W=a.charAt(M),$=W.charCodeAt(0);if(s[$]!==255)throw new TypeError(W+" is ambiguous");s[$]=M}let c=a.length,f=a.charAt(0),d=Math.log(c)/Math.log(256),v=Math.log(256)/Math.log(c);function E(M){if(M instanceof Uint8Array||(ArrayBuffer.isView(M)?M=new Uint8Array(M.buffer,M.byteOffset,M.byteLength):Array.isArray(M)&&(M=Uint8Array.from(M))),!(M instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(M.length===0)return"";let W=0,$=0,Q=0,Pe=M.length;for(;Q!==Pe&&M[Q]===0;)Q++,W++;let De=(Pe-Q)*v+1>>>0,Se=new Uint8Array(De);for(;Q!==Pe;){let _r=M[Q],lr=0;for(let Or=De-1;(_r!==0||lr<$)&&Or!==-1;Or--,lr++)_r+=256*Se[Or]>>>0,Se[Or]=_r%c>>>0,_r=_r/c>>>0;if(_r!==0)throw new Error("Non-zero carry");$=lr,Q++}let Tt=De-$;for(;Tt!==De&&Se[Tt]===0;)Tt++;let wt=f.repeat(W);for(;Tt<De;++Tt)wt+=a.charAt(Se[Tt]);return wt}t(E,"encode");function A(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return new Uint8Array;let W=0,$=0,Q=0;for(;M[W]===f;)$++,W++;let Pe=(M.length-W)*d+1>>>0,De=new Uint8Array(Pe);for(;M[W];){let _r=s[M.charCodeAt(W)];if(_r===255)return;let lr=0;for(let Or=Pe-1;(_r!==0||lr<Q)&&Or!==-1;Or--,lr++)_r+=c*De[Or]>>>0,De[Or]=_r%256>>>0,_r=_r/256>>>0;if(_r!==0)throw new Error("Non-zero carry");Q=lr,W++}let Se=Pe-Q;for(;Se!==Pe&&De[Se]===0;)Se++;let Tt=new Uint8Array($+(Pe-Se)),wt=$;for(;Se!==Pe;)Tt[wt++]=De[Se++];return Tt}t(A,"decodeUnsafe");function O(M){let W=A(M);if(W)return W;throw new Error("Non-base"+c+" character")}return t(O,"decode"),{encode:E,decodeUnsafe:A,decode:O}}t(Jfr,"base");var Apt=Jfr;var qfr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",yfe=Apt(qfr);var TIe="2024-09-02",kpt=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0}});function wpt(){return new lC({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:TIe,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:kpt[TIe]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}t(wpt,"getMockEnvironment");var lC=class a{static{t(this,"Environment")}config;static#r;static#n=!1;static initialize(s){this.#r||(this.#r=new a(s),this.#n=!0)}static get instance(){return this.#n||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#r=wpt()),this.#r}constructor({build:s,runtime:c}){let f;try{if(c.__ZUPLO_CONFIG){let d=atob(c.__ZUPLO_CONFIG);f=JSON.parse(d)}if(c.ZUPLO_SYSTEM_CONFIGURATIONS){let d=new TextDecoder().decode(yfe.decode(c.ZUPLO_SYSTEM_CONFIGURATIONS)),v=JSON.parse(d);for(let E of Object.keys(v))c[E]||(c[E]=v[E])}}catch(d){console.error("Failed to parse runtime configuration",d)}this.config=f??{},this.build=s,this.runtime=c,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get zudokuHostUrl(){return this.runtime.__ZUPLO_ZUDOKU_HOST_URL??this.config.zudoku_host_url??"https://zudoku.zuploedge.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var zfr=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function Ppt(a){return a.startsWith("__ZUPLO")||a.startsWith("ZUPLO_")?!zfr.includes(a)&&!a.startsWith("ZUPLO_PUBLIC_"):!1}t(Ppt,"isRestrictedEnvVariableName");function Npt(a){return!!a.startsWith("ZUPLO_")}t(Npt,"isZuploReadableEnvVariableName");var Xjr=new Proxy({},{get(a,s){let c=String(s);switch(c){case"ZUPLO_ENVIRONMENT_TYPE":return lC.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return lC.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return lC.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return lC.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return lC.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return lC.instance.build.BUILD_ID}if(!(Ppt(c)&&!Npt(c)))return lC.instance.runtime[c]}});function MQ(a,s,c){return`_${HP(`${a}_${s}_${c}`)}`}t(MQ,"getRawOperationDataIdentifierName");function CIe(a,s,c,f){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_${c.toLowerCase()}_${f.toLowerCase()}`}t(CIe,"getIdForParameterSchema");function EIe(a,s,c){return`_${HP(a.toLowerCase())}_${s.toLowerCase()}_rb_${HP(c.toLowerCase())}`}t(EIe,"getIdForRequestBodySchema");function jQ(a,s){return`_${HP(a)}_${HP(s)}`}t(jQ,"getIdForRefSchema");function HP(a){return a.replace(/[^a-zA-Z0-9]/g,"_")}t(HP,"sanitizedIdentifierName");var lyt=W_(Smt(),1);import z_e from"path";var eK=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(a,s,c,f,d,v){this.type=a,this.name=s,this.prefix=c,this.value=f,this.suffix=d,this.modifier=v}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Rdr=/[$_\p{ID_Start}]/u,Mdr=/[$_\u200C\u200D\p{ID_Continue}]/u,y8e=".*";function jdr(a,s){return(s?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(a)}t(jdr,"Re");function Emt(a,s=!1){let c=[],f=0;for(;f<a.length;){let d=a[f],v=t(function(E){if(!s)throw new TypeError(E);c.push({type:"INVALID_CHAR",index:f,value:a[f++]})},"c");if(d==="*"){c.push({type:"ASTERISK",index:f,value:a[f++]});continue}if(d==="+"||d==="?"){c.push({type:"OTHER_MODIFIER",index:f,value:a[f++]});continue}if(d==="\\"){c.push({type:"ESCAPED_CHAR",index:f++,value:a[f++]});continue}if(d==="{"){c.push({type:"OPEN",index:f,value:a[f++]});continue}if(d==="}"){c.push({type:"CLOSE",index:f,value:a[f++]});continue}if(d===":"){let E="",A=f+1;for(;A<a.length;){let O=a.substr(A,1);if(A===f+1&&Rdr.test(O)||A!==f+1&&Mdr.test(O)){E+=a[A++];continue}break}if(!E){v(`Missing parameter name at ${f}`);continue}c.push({type:"NAME",index:f,value:E}),f=A;continue}if(d==="("){let E=1,A="",O=f+1,M=!1;if(a[O]==="?"){v(`Pattern cannot start with "?" at ${O}`);continue}for(;O<a.length;){if(!jdr(a[O],!1)){v(`Invalid character '${a[O]}' at ${O}.`),M=!0;break}if(a[O]==="\\"){A+=a[O++]+a[O++];continue}if(a[O]===")"){if(E--,E===0){O++;break}}else if(a[O]==="("&&(E++,a[O+1]!=="?")){v(`Capturing groups are not allowed at ${O}`),M=!0;break}A+=a[O++]}if(M)continue;if(E){v(`Unbalanced pattern at ${f}`);continue}if(!A){v(`Missing pattern at ${f}`);continue}c.push({type:"REGEX",index:f,value:A}),f=O;continue}c.push({type:"CHAR",index:f,value:a[f++]})}return c.push({type:"END",index:f,value:""}),c}t(Emt,"v");function xmt(a,s={}){let c=Emt(a);s.delimiter??="/#?",s.prefixes??="./";let f=`[^${pC(s.delimiter)}]+?`,d=[],v=0,E=0,A="",O=new Set,M=t(lr=>{if(E<c.length&&c[E].type===lr)return c[E++].value},"a"),W=t(()=>M("OTHER_MODIFIER")??M("ASTERISK"),"f"),$=t(lr=>{let Or=M(lr);if(Or!==void 0)return Or;let{type:hr,index:ur}=c[E];throw new TypeError(`Unexpected ${hr} at ${ur}, expected ${lr}`)},"d"),Q=t(()=>{let lr="",Or;for(;Or=M("CHAR")??M("ESCAPED_CHAR");)lr+=Or;return lr},"T"),Pe=t(lr=>lr,"Se"),De=s.encodePart||Pe,Se="",Tt=t(lr=>{Se+=lr},"U"),wt=t(()=>{Se.length&&(d.push(new eK(3,"","",De(Se),"",3)),Se="")},"$"),_r=t((lr,Or,hr,ur,er)=>{let Es=3;switch(er){case"?":Es=1;break;case"*":Es=0;break;case"+":Es=2;break}if(!Or&&!hr&&Es===3){Tt(lr);return}if(wt(),!Or&&!hr){if(!lr)return;d.push(new eK(3,"","",De(lr),"",Es));return}let wi;hr?hr==="*"?wi=y8e:wi=hr:wi=f;let fo=2;wi===f?(fo=1,wi=""):wi===y8e&&(fo=0,wi="");let mi;if(Or?mi=Or:hr&&(mi=v++),O.has(mi))throw new TypeError(`Duplicate name '${mi}'.`);O.add(mi),d.push(new eK(fo,mi,De(lr),wi,De(ur),Es))},"V");for(;E<c.length;){let lr=M("CHAR"),Or=M("NAME"),hr=M("REGEX");if(!Or&&!hr&&(hr=M("ASTERISK")),Or||hr){let er=lr??"";s.prefixes.indexOf(er)===-1&&(Tt(er),er=""),wt();let Es=W();_r(er,Or,hr,"",Es);continue}let ur=lr??M("ESCAPED_CHAR");if(ur){Tt(ur);continue}if(M("OPEN")){let er=Q(),Es=M("NAME"),wi=M("REGEX");!Es&&!wi&&(wi=M("ASTERISK"));let fo=Q();$("CLOSE");let mi=W();_r(er,Es,wi,fo,mi);continue}wt(),$("END")}return d}t(xmt,"D");function pC(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pC,"S");function Tmt(a){return a&&a.ignoreCase?"ui":"u"}t(Tmt,"X");function Bdr(a,s,c){return Dmt(xmt(a,c),s,c)}t(Bdr,"Z");function tB(a){switch(a){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(tB,"k");function Dmt(a,s,c={}){c.delimiter??="/#?",c.prefixes??="./",c.sensitive??=!1,c.strict??=!1,c.end??=!0,c.start??=!0,c.endsWith="";let f=c.start?"^":"";for(let A of a){if(A.type===3){A.modifier===3?f+=pC(A.value):f+=`(?:${pC(A.value)})${tB(A.modifier)}`;continue}s&&s.push(A.name);let O=`[^${pC(c.delimiter)}]+?`,M=A.value;if(A.type===1?M=O:A.type===0&&(M=y8e),!A.prefix.length&&!A.suffix.length){A.modifier===3||A.modifier===1?f+=`(${M})${tB(A.modifier)}`:f+=`((?:${M})${tB(A.modifier)})`;continue}if(A.modifier===3||A.modifier===1){f+=`(?:${pC(A.prefix)}(${M})${pC(A.suffix)})`,f+=tB(A.modifier);continue}f+=`(?:${pC(A.prefix)}`,f+=`((?:${M})(?:`,f+=pC(A.suffix),f+=pC(A.prefix),f+=`(?:${M}))*)${pC(A.suffix)})`,A.modifier===0&&(f+="?")}let d=`[${pC(c.endsWith)}]|$`,v=`[${pC(c.delimiter)}]`;if(c.end)return c.strict||(f+=`${v}?`),c.endsWith.length?f+=`(?=${d})`:f+="$",new RegExp(f,Tmt(c));c.strict||(f+=`(?:${v}(?=${d}))?`);let E=!1;if(a.length){let A=a[a.length-1];A.type===3&&A.modifier===3&&(E=c.delimiter.indexOf(A)>-1)}return E||(f+=`(?=${v}|${d})`),new RegExp(f,Tmt(c))}t(Dmt,"F");var dN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Udr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},$dr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Jdr(a,s){return a.length?a[0]==="/"?!0:!s||a.length<2?!1:(a[0]=="\\"||a[0]=="{")&&a[1]=="/":!1}t(Jdr,"J");function Amt(a,s){return a.startsWith(s)?a.substring(s.length,a.length):a}t(Amt,"Q");function qdr(a,s){return a.endsWith(s)?a.substr(0,a.length-s.length):a}t(qdr,"Ee");function kmt(a){return!a||a.length<2?!1:a[0]==="["||(a[0]==="\\"||a[0]==="{")&&a[1]==="["}t(kmt,"W");var wmt=["ftp","file","http","https","ws","wss"];function Pmt(a){if(!a)return!0;for(let s of wmt)if(a.test(s))return!0;return!1}t(Pmt,"N");function zdr(a,s){if(a=Amt(a,"#"),s||a==="")return a;let c=new URL("https://example.com");return c.hash=a,c.hash?c.hash.substring(1,c.hash.length):""}t(zdr,"te");function Vdr(a,s){if(a=Amt(a,"?"),s||a==="")return a;let c=new URL("https://example.com");return c.search=a,c.search?c.search.substring(1,c.search.length):""}t(Vdr,"re");function Wdr(a,s){return s||a===""?a:kmt(a)?Omt(a):Imt(a)}t(Wdr,"ne");function Hdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.password=a,c.password}t(Hdr,"se");function Gdr(a,s){if(s||a==="")return a;let c=new URL("https://example.com");return c.username=a,c.username}t(Gdr,"ie");function Qdr(a,s,c){if(c||a==="")return a;if(s&&!wmt.includes(s))return new URL(`${s}:${a}`).pathname;let f=a[0]=="/";return a=new URL(f?a:"/-"+a,"https://example.com").pathname,f||(a=a.substring(2,a.length)),a}t(Qdr,"ae");function Kdr(a,s,c){return Nmt(s)===a&&(a=""),c||a===""?a:Fmt(a)}t(Kdr,"oe");function Ydr(a,s){return a=qdr(a,":"),s||a===""?a:v8e(a)}t(Ydr,"ce");function Nmt(a){switch(a){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Nmt,"_");function v8e(a){if(a==="")return a;if(/^[-+.A-Za-z0-9]*$/.test(a))return a.toLowerCase();throw new TypeError(`Invalid protocol '${a}'.`)}t(v8e,"y");function Xdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.username=a,s.username}t(Xdr,"le");function Zdr(a){if(a==="")return a;let s=new URL("https://example.com");return s.password=a,s.password}t(Zdr,"fe");function Imt(a){if(a==="")return a;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(a))throw new TypeError(`Invalid hostname '${a}'`);let s=new URL("https://example.com");return s.hostname=a,s.hostname}t(Imt,"z");function Omt(a){if(a==="")return a;if(/[^0-9a-fA-F[\]:]/g.test(a))throw new TypeError(`Invalid IPv6 hostname '${a}'`);return a.toLowerCase()}t(Omt,"j");function Fmt(a){if(a===""||/^[0-9]*$/.test(a)&&parseInt(a)<=65535)return a;throw new TypeError(`Invalid port '${a}'.`)}t(Fmt,"K");function emr(a){if(a==="")return a;let s=new URL("https://example.com");return s.pathname=a[0]!=="/"?"/-"+a:a,a[0]!=="/"?s.pathname.substring(2,s.pathname.length):s.pathname}t(emr,"he");function tmr(a){return a===""?a:new URL(`data:${a}`).pathname}t(tmr,"ue");function rmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.search=a,s.search.substring(1,s.search.length)}t(rmr,"de");function nmr(a){if(a==="")return a;let s=new URL("https://example.com");return s.hash=a,s.hash.substring(1,s.hash.length)}t(nmr,"pe");var imr=class{static{t(this,"H")}#r;#n=[];#e={};#t=0;#s=1;#p=0;#a=0;#_=0;#c=0;#l=!1;constructor(a){this.#r=a}get result(){return this.#e}parse(){for(this.#n=Emt(this.#r,!0);this.#t<this.#n.length;this.#t+=this.#s){if(this.#s=1,this.#n[this.#t].type==="END"){if(this.#a===0){this.#v(),this.#D()?this.#i(9,1):this.#y()?this.#i(8,1):this.#i(7,0);continue}else if(this.#a===2){this.#d(5);continue}this.#i(10,0);break}if(this.#_>0)if(this.#o())this.#_-=1;else continue;if(this.#k()){this.#_+=1;continue}switch(this.#a){case 0:this.#g()&&this.#d(1);break;case 1:if(this.#g()){this.#I();let a=7,s=1;this.#x()?(a=2,s=3):this.#l&&(a=2),this.#i(a,s)}break;case 2:this.#C()?this.#d(3):(this.#E()||this.#y()||this.#D())&&this.#d(5);break;case 3:this.#b()?this.#i(4,1):this.#C()&&this.#i(5,1);break;case 4:this.#C()&&this.#i(5,1);break;case 5:this.#N()?this.#c+=1:this.#S()&&(this.#c-=1),this.#A()&&!this.#c?this.#i(6,1):this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 6:this.#E()?this.#i(7,0):this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 7:this.#y()?this.#i(8,1):this.#D()&&this.#i(9,1);break;case 8:this.#D()&&this.#i(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#i(a,s){switch(this.#a){case 0:break;case 1:this.#e.protocol=this.#T();break;case 2:break;case 3:this.#e.username=this.#T();break;case 4:this.#e.password=this.#T();break;case 5:this.#e.hostname=this.#T();break;case 6:this.#e.port=this.#T();break;case 7:this.#e.pathname=this.#T();break;case 8:this.#e.search=this.#T();break;case 9:this.#e.hash=this.#T();break;case 10:break}this.#a!==0&&a!==10&&([1,2,3,4].includes(this.#a)&&[6,7,8,9].includes(a)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#a)&&[8,9].includes(a)&&(this.#e.pathname??=this.#l?"/":""),[1,2,3,4,5,6,7].includes(this.#a)&&a===9&&(this.#e.search??="")),this.#f(a,s)}#f(a,s){this.#a=a,this.#p=this.#t+s,this.#t+=s,this.#s=0}#v(){this.#t=this.#p,this.#s=0}#d(a){this.#v(),this.#a=a}#u(a){return a<0&&(a=this.#n.length-a),a<this.#n.length?this.#n[a]:this.#n[this.#n.length-1]}#m(a,s){let c=this.#u(a);return c.value===s&&(c.type==="CHAR"||c.type==="ESCAPED_CHAR"||c.type==="INVALID_CHAR")}#g(){return this.#m(this.#t,":")}#x(){return this.#m(this.#t+1,"/")&&this.#m(this.#t+2,"/")}#C(){return this.#m(this.#t,"@")}#b(){return this.#m(this.#t,":")}#A(){return this.#m(this.#t,":")}#E(){return this.#m(this.#t,"/")}#y(){if(this.#m(this.#t,"?"))return!0;if(this.#n[this.#t].value!=="?")return!1;let a=this.#u(this.#t-1);return a.type!=="NAME"&&a.type!=="REGEX"&&a.type!=="CLOSE"&&a.type!=="ASTERISK"}#D(){return this.#m(this.#t,"#")}#k(){return this.#n[this.#t].type=="OPEN"}#o(){return this.#n[this.#t].type=="CLOSE"}#N(){return this.#m(this.#t,"[")}#S(){return this.#m(this.#t,"]")}#T(){let a=this.#n[this.#t],s=this.#u(this.#p).index;return this.#r.substring(s,a.index)}#I(){let a={};Object.assign(a,dN),a.encodePart=v8e;let s=Bdr(this.#T(),void 0,a);this.#l=Pmt(s)}},g8e=["protocol","username","password","hostname","port","pathname","search","hash"],pN="*";function Cmt(a,s){if(typeof a!="string")throw new TypeError("parameter 1 is not of type 'string'.");let c=new URL(a,s);return{protocol:c.protocol.substring(0,c.protocol.length-1),username:c.username,password:c.password,hostname:c.hostname,port:c.port,pathname:c.pathname,search:c.search!==""?c.search.substring(1,c.search.length):void 0,hash:c.hash!==""?c.hash.substring(1,c.hash.length):void 0}}t(Cmt,"ge");function XP(a,s){return s?ZQ(a):a}t(XP,"b");function XQ(a,s,c){let f;if(typeof s.baseURL=="string")try{f=new URL(s.baseURL),s.protocol===void 0&&(a.protocol=XP(f.protocol.substring(0,f.protocol.length-1),c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&(a.username=XP(f.username,c)),!c&&s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.username===void 0&&s.password===void 0&&(a.password=XP(f.password,c)),s.protocol===void 0&&s.hostname===void 0&&(a.hostname=XP(f.hostname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&(a.port=XP(f.port,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&(a.pathname=XP(f.pathname,c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&(a.search=XP(f.search.substring(1,f.search.length),c)),s.protocol===void 0&&s.hostname===void 0&&s.port===void 0&&s.pathname===void 0&&s.search===void 0&&s.hash===void 0&&(a.hash=XP(f.hash.substring(1,f.hash.length),c))}catch{throw new TypeError(`invalid baseURL '${s.baseURL}'.`)}if(typeof s.protocol=="string"&&(a.protocol=Ydr(s.protocol,c)),typeof s.username=="string"&&(a.username=Gdr(s.username,c)),typeof s.password=="string"&&(a.password=Hdr(s.password,c)),typeof s.hostname=="string"&&(a.hostname=Wdr(s.hostname,c)),typeof s.port=="string"&&(a.port=Kdr(s.port,a.protocol,c)),typeof s.pathname=="string"){if(a.pathname=s.pathname,f&&!Jdr(a.pathname,c)){let d=f.pathname.lastIndexOf("/");d>=0&&(a.pathname=XP(f.pathname.substring(0,d+1),c)+a.pathname)}a.pathname=Qdr(a.pathname,a.protocol,c)}return typeof s.search=="string"&&(a.search=Vdr(s.search,c)),typeof s.hash=="string"&&(a.hash=zdr(s.hash,c)),a}t(XQ,"w");function ZQ(a){return a.replace(/([+*?:{}()\\])/g,"\\$1")}t(ZQ,"C");function smr(a){return a.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(smr,"Oe");function amr(a,s){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let c=".*",f=`[^${smr(s.delimiter)}]+?`,d=/[$_\u200C\u200D\p{ID_Continue}]/u,v="";for(let E=0;E<a.length;++E){let A=a[E];if(A.type===3){if(A.modifier===3){v+=ZQ(A.value);continue}v+=`{${ZQ(A.value)}}${tB(A.modifier)}`;continue}let O=A.hasCustomName(),M=!!A.suffix.length||!!A.prefix.length&&(A.prefix.length!==1||!s.prefixes.includes(A.prefix)),W=E>0?a[E-1]:null,$=E<a.length-1?a[E+1]:null;if(!M&&O&&A.type===1&&A.modifier===3&&$&&!$.prefix.length&&!$.suffix.length)if($.type===3){let Q=$.value.length>0?$.value[0]:"";M=d.test(Q)}else M=!$.hasCustomName();if(!M&&!A.prefix.length&&W&&W.type===3){let Q=W.value[W.value.length-1];M=s.prefixes.includes(Q)}M&&(v+="{"),v+=ZQ(A.prefix),O&&(v+=`:${A.name}`),A.type===2?v+=`(${A.value})`:A.type===1?O||(v+=`(${f})`):A.type===0&&(!O&&(!W||W.type===3||W.modifier!==3||M||A.prefix!=="")?v+="*":v+=`(${c})`),A.type===1&&O&&A.suffix.length&&d.test(A.suffix[0])&&(v+="\\"),v+=ZQ(A.suffix),M&&(v+="}"),A.modifier!==3&&(v+=tB(A.modifier))}return v}t(amr,"ke");var Lmt=class{static{t(this,"me")}#r;#n={};#e={};#t={};#s={};#p=!1;constructor(a={},s,c){try{let f;if(typeof s=="string"?f=s:c=s,typeof a=="string"){let A=new imr(a);if(A.parse(),a=A.result,f===void 0&&typeof a.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");a.baseURL=f}else{if(!a||typeof a!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(f)throw new TypeError("parameter 1 is not of type 'string'.")}typeof c>"u"&&(c={ignoreCase:!1});let d={ignoreCase:c.ignoreCase===!0},v={pathname:pN,protocol:pN,username:pN,password:pN,hostname:pN,port:pN,search:pN,hash:pN};this.#r=XQ(v,a,!0),Nmt(this.#r.protocol)===this.#r.port&&(this.#r.port="");let E;for(E of g8e){if(!(E in this.#r))continue;let A={},O=this.#r[E];switch(this.#e[E]=[],E){case"protocol":Object.assign(A,dN),A.encodePart=v8e;break;case"username":Object.assign(A,dN),A.encodePart=Xdr;break;case"password":Object.assign(A,dN),A.encodePart=Zdr;break;case"hostname":Object.assign(A,Udr),kmt(O)?A.encodePart=Omt:A.encodePart=Imt;break;case"port":Object.assign(A,dN),A.encodePart=Fmt;break;case"pathname":Pmt(this.#n.protocol)?(Object.assign(A,$dr,d),A.encodePart=emr):(Object.assign(A,dN,d),A.encodePart=tmr);break;case"search":Object.assign(A,dN,d),A.encodePart=rmr;break;case"hash":Object.assign(A,dN,d),A.encodePart=nmr;break}try{this.#s[E]=xmt(O,A),this.#n[E]=Dmt(this.#s[E],this.#e[E],A),this.#t[E]=amr(this.#s[E],A),this.#p=this.#p||this.#s[E].some(M=>M.type===2)}catch{throw new TypeError(`invalid ${E} pattern '${this.#r[E]}'.`)}}}catch(f){throw new TypeError(`Failed to construct 'URLPattern': ${f.message}`)}}test(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return!1;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,Cmt(a,s),!1)}catch{return!1}let f;for(f of g8e)if(!this.#n[f].exec(c[f]))return!1;return!0}exec(a={},s){let c={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof a!="string"&&s)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof a>"u")return;try{typeof a=="object"?c=XQ(c,a,!1):c=XQ(c,Cmt(a,s),!1)}catch{return null}let f={};s?f.inputs=[a,s]:f.inputs=[a];let d;for(d of g8e){let v=this.#n[d].exec(c[d]);if(!v)return null;let E={};for(let[A,O]of this.#e[d].entries())if(typeof O=="string"||typeof O=="number"){let M=v[A+1];E[O]=M}f[d]={input:c[d]??"",groups:E}}return f}static compareComponent(a,s,c){let f=t((A,O)=>{for(let M of["type","modifier","prefix","value","suffix"]){if(A[M]<O[M])return-1;if(A[M]!==O[M])return 1}return 0},"o"),d=new eK(3,"","","","",3),v=new eK(0,"","","","",3),E=t((A,O)=>{let M=0;for(;M<Math.min(A.length,O.length);++M){let W=f(A[M],O[M]);if(W)return W}return A.length===O.length?0:f(A[M]??d,O[M]??d)},"s");return!s.#t[a]&&!c.#t[a]?0:s.#t[a]&&!c.#t[a]?E(s.#s[a],[v]):!s.#t[a]&&c.#t[a]?E([v],c.#s[a]):E(s.#s[a],c.#s[a])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#p}};globalThis.URLPattern||(globalThis.URLPattern=Lmt);import{AssertionError as omr}from"assert";function ZP(a,s){if(a===!1)throw new omr({message:s})}t(ZP,"assert");var Hc;(function(a){a.Object="Object",a.Property="Property",a.Array="Array",a.Literal="Literal",a.TemplateString="TemplateString",a.Identifier="Identifier",a.FunctionCall="FunctionCall",a.Raw="Raw"})(Hc||(Hc={}));function rB(a){return a.type===Hc.Object}t(rB,"isAstObject");function e6(a){return a.type===Hc.Property}t(e6,"isAstProperty");function Rmt(a){return a.type===Hc.Array}t(Rmt,"isAstArray");function nB(a){return a.type===Hc.Literal}t(nB,"isAstLiteral");function qF(a){if(a===void 0)throw new Error("Node is undefined");if(!rB(a))throw new Error("Node is not object")}t(qF,"assertAstObject");import{findNodeAtLocation as cmr,getNodeValue as lmr,printParseErrorCode as umr,visit as fmr}from"jsonc-parser";var _mr={DEFAULT:{allowTrailingComma:!1}};function tK(a,s=[],c=_mr.DEFAULT){let f={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function d(O){f.type==="property"&&(f.length=O-f.offset,f=f.parent)}t(d,"ensurePropertyComplete");function v(O){return f.children?.push(O),O}t(v,"onValue"),fmr(a,{onObjectBegin:t((O,M,W)=>{f=v({type:"object",offset:O,length:-1,line:M+1,column:W+1,parent:f,children:[]})},"onObjectBegin"),onObjectProperty:t((O,M,W,$,Q)=>{f=v({type:"property",offset:M,length:-1,line:$+1,column:Q+1,parent:f,children:[]}),f.children?.push({type:"string",value:O,offset:M,length:W,line:$,column:Q,parent:f})},"onObjectProperty"),onObjectEnd:t((O,M)=>{d(O+M),f.length=O+M-f.offset,f=f.parent,d(O+M)},"onObjectEnd"),onArrayBegin:t((O,M,W,$)=>{f=v({type:"array",offset:O,length:-1,line:W+1,column:$+1,parent:f,children:[]})},"onArrayBegin"),onArrayEnd:t((O,M)=>{f.length=O+M-f.offset,f=f.parent,d(O+M)},"onArrayEnd"),onLiteralValue:t((O,M,W,$,Q)=>{v({type:pmr(O),offset:M,length:W,line:$+1,column:Q+1,parent:f,value:O}),d(M+W)},"onLiteralValue"),onSeparator:t((O,M)=>{f.type==="property"&&(O===":"?f.colonOffset=M:O===","&&d(M))},"onSeparator"),onError:t((O,M,W,$,Q)=>{s.push({error:O,offset:M,length:W,line:$+1,column:Q+1})},"onError")},c);let A=f.children[0];return A&&delete A.parent,A}t(tK,"parse");function pmr(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}t(pmr,"getNodeType");function b8e(a,s){return cmr(a,s)}t(b8e,"findNodeAtLocation");function rK(a){return lmr(a)}t(rK,"getNodeValue");function Mmt(a){return umr(a)}t(Mmt,"printParseErrorCode");var nK=class{static{t(this,"AstAdapter")}parse(s){let f=tK(s,[]);if(f)return this.parseNode(f,void 0);throw new Error("Failed to parse JSON")}convert(s){return this.parseNode(s,void 0)}parseNode(s,c){switch(s.type){case"object":return this.createObject(s,c);case"array":return this.createArray(s,c);case"property":return this.createProperty(s,c);case"string":return this.createLiteral(s,c);case"number":return this.createLiteral(s,c);case"boolean":return this.createLiteral(s,c);case"null":return this.createLiteral(s,c)}}createLiteral(s,c){return{type:Hc.Literal,location:{line:s.line,column:s.column},parent:c,value:s.type==="null"?null:s.value}}createObject(s,c){let f={type:Hc.Object,children:[],parent:c,location:{line:s.line,column:s.column}};return s.children?.forEach(d=>{f.children.push(this.parseNode(d,f))}),f}createProperty(s,c){ZP(s.children?.length===2,"Invalid property node");let f={type:Hc.Property,location:{line:s.line,column:s.column},parent:c,name:null,value:null};return f.name={value:s.children[0].value,location:{line:s.line,column:s.column},type:Hc.Identifier,parent:f},f.value=this.parseNode(s.children[1],f),f}createArray(s,c){let f={type:Hc.Array,location:{line:s.line,column:s.column},parent:c,children:[]};return s.children?.forEach(d=>f.children.push(this.parseNode(d,f))),f}};var xx={createLiteral:t((a,s)=>({type:Hc.Literal,parent:s,value:a}),"createLiteral"),createTemplateString:t((a,s)=>({type:Hc.TemplateString,parent:s,value:a}),"createTemplateString"),createIdentifier:t((a,s)=>({type:Hc.Identifier,value:a,parent:s}),"createIdentifier"),createProperty:t((a,s,c)=>{let f={type:Hc.Property,parent:c,name:null,value:s};return f.name={value:a,type:Hc.Identifier,parent:f},f.value.parent=f,f},"createProperty"),createArrayOfLiterals:t((a,s)=>{let c={type:Hc.Array,parent:s,children:[]};for(let f of a)c.children.push(xx.createLiteral(f,c));return c},"createArrayOfLiterals")};var dmr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,iK=class{static{t(this,"SourceGenerator")}generate(s){let c=[];return this.generateSource(c,s),c.join("")}generateSource(s,c){switch(c.type){case Hc.Array:return this.generateArray(s,c);case Hc.Object:return this.generateObject(s,c);case Hc.Property:return this.generateProperty(s,c);case Hc.Literal:return this.generateLiteral(s,c);case Hc.FunctionCall:return this.generateFunctionCall(s,c);case Hc.Identifier:return this.generateIdentifier(s,c);case Hc.Raw:return this.generateRaw(s,c);case Hc.TemplateString:return this.generateTemplateString(s,c)}}generateArray(s,c){s.push("["),c.children.map(f=>{this.generateSource(s,f),s.push(",")}),s.push("]")}generateObject(s,c){s.push("{"),c.children.forEach(f=>{this.generateSource(s,f),s.push(",")}),s.push("}")}generateProperty(s,c){this.generateIdentifier(s,c.name),s.push(":"),this.generateSource(s,c.value)}generateFunctionCall(s,c){s.push(c.name.value),s.push("("),c.children.forEach((f,d,v)=>{this.generateSource(s,f),d<v.length&&s.push(",")}),s.push(")")}generateRaw(s,c){s.push(c.value)}generateTemplateString(s,c){s.push("`"),s.push(c.value.replaceAll("`","\\`")),s.push("`")}generateLiteral(s,c){if(c.value===null)return s.push("null");switch(typeof c.value){case"number":case"boolean":return s.push(`${c.value}`);case"string":{let f=c.value,d=JSON.stringify(f);return s.push(`${d}`)}}}generateIdentifier(s,c){let f=dmr.test(c.value)?c.value:`'${c.value}'`;s.push(f)}};import{parse as mmr}from"@swc/core";import hmr from"fs/promises";var jmt=t(async a=>{let s=new Set;try{let c=await hmr.readFile(a,"utf-8");(await mmr(c,{syntax:"typescript"})).body.forEach(d=>{d.type==="ExportDefaultDeclaration"||d.type==="ExportDefaultExpression"?s.add("default"):d.type==="ExportDeclaration"&&d.declaration.type==="FunctionDeclaration"?s.add(d.declaration.identifier.value):d.type==="ExportDeclaration"&&d.declaration.type==="VariableDeclaration"&&d.declaration.declarations[0].id.type==="Identifier"&&s.add(d.declaration.declarations[0].id.value)})}catch{return null}return s},"getJSFileExports");var Bmt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var S8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Umt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var T8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var C8e={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var Z0t=W_(T0t(),1),eyt=W_(X0t(),1);var R_e=class a{static{t(this,"JsonValidator")}static#r=new a;static get instance(){return a.#r}ajv;constructor(){this.ajv=new eyt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,Z0t.default)(this.ajv,{mode:"fast"})}addSchema(s,c){this.ajv.addSchema(s,c)}compile(s){let c=this.ajv.compile(s);return t(d=>({isValid:c(d),errors:this.toSimpleErrors(c.errors,d),warnings:[]}),"validator")}toSimpleErrors(s,c){let f=[];return s?.forEach(d=>{d.keyword==="enum"&&d.params.allowedValues&&Array.isArray(d.params.allowedValues)&&(d.message+=`; ${d.params.allowedValues.join(", ")}`),d.instancePath&&(d.instancePath=d.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let v={details:{}},E=d.instancePath.split("/");if(E.length>2){let O=E[1],M=E[2]?parseInt(E[2]):0,W=E[3],$=isNaN(M)?void 0:c[O][M][W];v={details:{property:O,index:M,field:W,fieldValue:$}}}if(d.keyword==="required"&&d.params.missingProperty&&d.instancePath&&(d.message=`A 'path' is missing required property '${d.params.missingProperty}'`),d.keyword==="additionalProperties"&&d.params.additionalProperty&&d.instancePath&&(d.message=`A 'path' should NOT include property '${d.params.additionalProperty}'`),d.keyword==="type"&&d.params.type&&d.instancePath){let O=d.instancePath.split("/"),M=O[O.length-1];d.message=`Value of property '${M}' must be '${d.params.type}'`}let A=Object.assign(d,v);f.push(A)}),f}};var EN=R_e.instance;EN.addSchema(C8e,"route-configuration.schema.json");EN.addSchema(Umt,"policy-configuration.schema.json");EN.addSchema(S8e,"policies.schema.json");EN.addSchema(T8e,"open-api-route-configuration.schema.json");EN.addSchema(Bmt,"fragments.schema.json");var Yqr=EN.compile(C8e),tyt=EN.compile(T8e),jFe=EN.compile(S8e);var M_e=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(s){return this.results=jFe(s),this.results}};var j_e=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(s){return this.results=tyt(s),this.results}};import Tbr from"path";var BFe=/\$import\((.*)\)/,B_e=/\$env\((.*?)\)/g;var s6=class extends Error{static{t(this,"CodeGenError")}location;constructor(s,c,f,d){super(s),this.location={file:c,namespace:"",line:f?f.line:0,column:f?f.column:0,length:0,lineText:d??"",suggestion:""}}},Sbr=t(a=>{let s=[],c=a;for(;c.parent;)s.push(c),c=c.parent;return s.reverse()},"invertTree"),xN=t((a,s)=>{if(!a)return!1;let c=Sbr(a);return s.split("/").every((v,E)=>{let A=c[E];return A?v==="*"||e6(A)&&A.name.value===v?!0:v==="{}"?A.type===Hc.Object:v==="[]"?A.type===Hc.Array:!1:!1})},"testPosition");var U_e=class{static{t(this,"AstTransformer")}errors=[];transform(s){return this.visitor(s),s}visitor(s){this.visit(s),rB(s)?s.children.forEach(c=>{this.visitor(c)}):Rmt(s)?s.children.forEach(c=>{this.visitor(c)}):e6(s)&&this.visitor(s.value)}},ryt=t((a,s,c)=>f=>{if(!e6(f)||!nB(f.value)||typeof f.value.value!="string")return;if(!a.some(v=>xN(f,v))){B_e.test(f.value.value)&&s.push(new s6("An $env() statement is not expected at this location.",c,f.location,f.value.value));return}let d=new RegExp(B_e).exec(f.value.value);if(d?.length===2&&d[0]===f.value.value){let v={type:Hc.Raw,parent:null,value:`environment["${d[1]}"]`};f.value=v}else{let v=f.value.value.replaceAll(new RegExp(B_e),(E,A)=>`\${environment["${A}"] ? environment["${A}"] : ""}`);v!==f.value.value&&(f.value=xx.createTemplateString(v,f))}},"getEnvStatementTransformer");var MK="config/routes.json",Cbr=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*","corsPolicies/[]/{}/*"],Ebr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],nyt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],xbr="handler/{}/options/{}/rewritePattern",Dbr="handler/{}/options/{}/baseUrl",$_e=class extends U_e{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(s){this.addedImports.has(s)||this.addedImports.set(s,`__import${this.importCount++}`);let c=this.addedImports.get(s);if(!c)throw new Error("Import name is undefined. This should not happen.");return c}getImports(){let s=[];return this.addedImports.forEach((c,f)=>{s.push({name:c,path:f})}),s}visit(s){this.rewriteHandlerFunction(s),this.rewriteForwardFunction(s),this.replaceImportStatements(s),this.replaceEnvStatements(s)}rewriteHandlerFunction(s){if(!(!e6(s)||!nB(s.value)||typeof s.value.value!="string")&&xN(s,xbr)){if(!s.parent||!rB(s.parent)){this.errors.push(new s6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:iyt(c)},d=xx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}rewriteForwardFunction(s){if(!(!e6(s)||!nB(s.value)||typeof s.value.value!="string")&&xN(s,Dbr)){if(!s.parent||!rB(s.parent)){this.errors.push(new s6("Invalid node, expected object",MK,s.parent?s.parent.location:s.location,void 0));return}let c=s.value.value,f={type:Hc.Raw,parent:null,value:iyt(c)},d=xx.createProperty("__rewriteFunction",f,s);s.parent.children.push(d)}}replaceImportStatements(s){if(!e6(s)||!nB(s.value))return;let c=s.value.value;if(typeof c!="string")return;if(!Ebr.some(A=>xN(s,A))&&!nyt.some(A=>xN(s,A))){if(BFe.test(c)){if(s.name.value==="$ref")return;this.errors.push(new s6("An $import() statement is not expected at this location.",MK,s.location,c))}return}let f=BFe.exec(c);if(nyt.some(A=>xN(s,A))&&!f)return;if(!f){this.errors.push(new s6("Invalid $import() statement",MK,s.location,c));return}let d=f[1];d.startsWith(".")&&(d=Tbr.join("..",d));let v=this.getImportName(d),E={type:Hc.Identifier,parent:s.parent,value:v};s.value=E}replaceEnvStatements=ryt(Cbr,this.errors,MK)};function iyt(a){return`(request, context) => {
561
561
  const { params, url, query, method, headers } = request;
562
562
  const { host, hostname, origin, pathname, port, search } = new URL(url);
563
563
  const e = encodeURIComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.29.11",
3
+ "version": "6.29.13",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -40,8 +40,8 @@
40
40
  "prettier": "^3.3.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "@zuplo/graphql": "^6.29.11",
44
- "@zuplo/otel": "^6.29.11",
45
- "@zuplo/runtime": "^6.29.11"
43
+ "@zuplo/graphql": "^6.29.13",
44
+ "@zuplo/otel": "^6.29.13",
45
+ "@zuplo/runtime": "^6.29.13"
46
46
  }
47
47
  }