@holistics/cli-core 0.6.26 → 0.6.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/commands.js +3 -3
  2. package/package.json +1 -1
package/dist/commands.js CHANGED
@@ -83,7 +83,7 @@ __p += '`;if(j1)U0+=`' +
83
83
  function print() { __p += __j.call(arguments, '') }
84
84
  `:`;
85
85
  `)+U0+`return __p
86
- }`;var V1=dF(function(){return A1(C,f0+"return "+U0).apply(Z,T)});if(V1.source=U0,Xz(V1))throw V1;return V1}function lo(K){return u1(K).toLowerCase()}function oo(K){return u1(K).toUpperCase()}function so(K,V,G){if(K=u1(K),K&&(G||V===Z))return ZD(K);if(!K||!(V=D3(V)))return K;var F=H8(K),P=H8(V),C=JD(F,P),T=QD(F,P)+1;return V5(F,C,T).join("")}function no(K,V,G){if(K=u1(K),K&&(G||V===Z))return K.slice(0,xD(K)+1);if(!K||!(V=D3(V)))return K;var F=H8(K),P=QD(F,H8(V))+1;return V5(F,0,P).join("")}function ao(K,V,G){if(K=u1(K),K&&(G||V===Z))return K.replace(U9,"");if(!K||!(V=D3(V)))return K;var F=H8(K),P=JD(F,H8(V));return V5(F,P).join("")}function ro(K,V){var G=m,F=R;if(H2(V)){var P="separator"in V?V.separator:P;G="length"in V?K1(V.length):G,F="omission"in V?D3(V.omission):F}K=u1(K);var C=K.length;if(B9(K)){var T=H8(K);C=T.length}if(G>=C)return K;var c=G-M9(F);if(c<1)return F;var a=T?V5(T,0,c).join(""):K.slice(0,c);if(P===Z)return a+F;if(T)c+=a.length-c;if(xz(P)){if(K.slice(c).search(P)){var $0,K0=a;if(!P.global)P=wK(P.source,u1(PM.exec(P))+"g");P.lastIndex=0;while($0=P.exec(K0))var U0=$0.index;a=a.slice(0,U0===Z?c:U0)}}else if(K.indexOf(D3(P),c)!=c){var R0=a.lastIndexOf(P);if(R0>-1)a=a.slice(0,R0)}return a+F}function to(K){return K=u1(K),K&&Q7.test(K)?K.replace(bX,Oh):K}var eo=P9(function(K,V,G){return K+(G?" ":"")+V.toUpperCase()}),$z=lD("toUpperCase");function iF(K,V,G){if(K=u1(K),V=G?Z:V,V===Z)return _h(K)?Rh(K):Uh(K);return K.match(V)||[]}var dF=H1(function(K,V){try{return B3(K,Z,V)}catch(G){return Xz(G)?G:new X1(G)}}),Zs=j6(function(K,V){return k3(V,function(G){G=u8(G),_6(K,G,Jz(K[G],K))}),K});function Js(K){var V=K==null?0:K.length,G=d0();return K=!V?[]:W2(K,function(F){if(typeof F[1]!="function")throw new c3(x);return[G(F[0]),F[1]]}),H1(function(F){var P=-1;while(++P<V){var C=K[P];if(B3(C[0],this,F))return B3(C[1],this,F)}})}function Qs(K){return Og(p3(K,W))}function Kz(K){return function(){return K}}function Xs(K,V){return K==null||K!==K?V:K}var xs=sD(),qs=sD(!0);function n4(K){return K}function zz(K){return LD(typeof K=="function"?K:p3(K,W))}function Ys(K){return OD(p3(K,W))}function $s(K,V){return mD(K,p3(V,W))}var Ks=H1(function(K,V){return function(G){return zJ(G,K,V)}}),zs=H1(function(K,V){return function(G){return zJ(K,G,V)}});function Wz(K,V,G){var F=t2(V),P=Mx(V,F);if(G==null&&!(H2(V)&&(P.length||!F.length)))G=V,V=K,K=this,P=Mx(V,t2(V));var C=!(H2(G)&&("chain"in G))||!!G.chain,T=C6(K);return k3(P,function(c){var a=V[c];if(K[c]=a,T)K.prototype[c]=function(){var $0=this.__chain__;if(C||$0){var K0=K(this.__wrapped__),U0=K0.__actions__=l4(this.__actions__);return U0.push({func:a,args:arguments,thisArg:K}),K0.__chain__=$0,K0}return a.apply(K,x5([this.value()],arguments))}}),K}function Ws(){if(r2._===this)r2._=fh;return this}function Vz(){}function Vs(K){return K=K1(K),H1(function(V){return SD(V,K)})}var Us=hK(W2),Hs=hK(nM),Gs=hK(HK);function lF(K){return nK(K)?GK(u8(K)):gg(K)}function Bs(K){return function(V){return K==null?Z:K7(K,V)}}var Ms=aD(),Ds=aD(!0);function Uz(){return[]}function Hz(){return!1}function Fs(){return{}}function Ns(){return""}function ws(){return!0}function _s(K,V){if(K=K1(K),K<1||K>o)return[];var G=i0,F=_4(K,i0);V=d0(V),K-=i0;var P=DK(F,V);while(++G<K)V(G);return P}function Ps(K){if(x1(K))return W2(K,u8);return F3(K)?[K]:l4(UF(u1(K)))}function js(K){var V=++Ah;return u1(K)+V}var Ls=Px(function(K,V){return K+V},0),Cs=gK("ceil"),Os=Px(function(K,V){return K/V},1),ms=gK("floor");function Ss(K){return K&&K.length?Bx(K,n4,SK):Z}function Rs(K,V){return K&&K.length?Bx(K,d0(V,2),SK):Z}function Is(K){return tM(K,n4)}function Ts(K,V){return tM(K,d0(V,2))}function vs(K){return K&&K.length?Bx(K,n4,vK):Z}function As(K,V){return K&&K.length?Bx(K,d0(V,2),vK):Z}var Es=Px(function(K,V){return K*V},1),fs=gK("round"),ks=Px(function(K,V){return K-V},0);function cs(K){return K&&K.length?MK(K,n4):0}function bs(K,V){return K&&K.length?MK(K,d0(V,2)):0}if(L.after=ql,L.ary=jF,L.assign=ll,L.assignIn=cF,L.assignInWith=fx,L.assignWith=ol,L.at=sl,L.before=LF,L.bind=Jz,L.bindAll=Zs,L.bindKey=CF,L.castArray=Dl,L.chain=wF,L.chunk=Oi,L.compact=mi,L.concat=Si,L.cond=Js,L.conforms=Qs,L.constant=Kz,L.countBy=kd,L.create=nl,L.curry=OF,L.curryRight=mF,L.debounce=SF,L.defaults=al,L.defaultsDeep=rl,L.defer=Yl,L.delay=$l,L.difference=Ri,L.differenceBy=Ii,L.differenceWith=Ti,L.drop=vi,L.dropRight=Ai,L.dropRightWhile=Ei,L.dropWhile=fi,L.fill=ki,L.filter=bd,L.flatMap=ud,L.flatMapDeep=hd,L.flatMapDepth=gd,L.flatten=MF,L.flattenDeep=ci,L.flattenDepth=bi,L.flip=Kl,L.flow=xs,L.flowRight=qs,L.fromPairs=pi,L.functions=xo,L.functionsIn=qo,L.groupBy=id,L.initial=ui,L.intersection=hi,L.intersectionBy=gi,L.intersectionWith=ii,L.invert=$o,L.invertBy=Ko,L.invokeMap=ld,L.iteratee=zz,L.keyBy=od,L.keys=t2,L.keysIn=s4,L.map=Rx,L.mapKeys=Wo,L.mapValues=Vo,L.matches=Ys,L.matchesProperty=$s,L.memoize=Tx,L.merge=Uo,L.mergeWith=bF,L.method=Ks,L.methodOf=zs,L.mixin=Wz,L.negate=vx,L.nthArg=Vs,L.omit=Ho,L.omitBy=Go,L.once=zl,L.orderBy=sd,L.over=Us,L.overArgs=Wl,L.overEvery=Hs,L.overSome=Gs,L.partial=Qz,L.partialRight=RF,L.partition=nd,L.pick=Bo,L.pickBy=pF,L.property=lF,L.propertyOf=Bs,L.pull=si,L.pullAll=FF,L.pullAllBy=ni,L.pullAllWith=ai,L.pullAt=ri,L.range=Ms,L.rangeRight=Ds,L.rearg=Vl,L.reject=td,L.remove=ti,L.rest=Ul,L.reverse=eK,L.sampleSize=Zl,L.set=Do,L.setWith=Fo,L.shuffle=Jl,L.slice=ei,L.sortBy=xl,L.sortedUniq=Yd,L.sortedUniqBy=$d,L.split=uo,L.spread=Hl,L.tail=Kd,L.take=zd,L.takeRight=Wd,L.takeRightWhile=Vd,L.takeWhile=Ud,L.tap=md,L.throttle=Gl,L.thru=Sx,L.toArray=EF,L.toPairs=yF,L.toPairsIn=uF,L.toPath=Ps,L.toPlainObject=kF,L.transform=No,L.unary=Bl,L.union=Hd,L.unionBy=Gd,L.unionWith=Bd,L.uniq=Md,L.uniqBy=Dd,L.uniqWith=Fd,L.unset=wo,L.unzip=Zz,L.unzipWith=NF,L.update=_o,L.updateWith=Po,L.values=C9,L.valuesIn=jo,L.without=Nd,L.words=iF,L.wrap=Ml,L.xor=wd,L.xorBy=_d,L.xorWith=Pd,L.zip=jd,L.zipObject=Ld,L.zipObjectDeep=Cd,L.zipWith=Od,L.entries=yF,L.entriesIn=uF,L.extend=cF,L.extendWith=fx,Wz(L,L),L.add=Ls,L.attempt=dF,L.camelCase=mo,L.capitalize=hF,L.ceil=Cs,L.clamp=Lo,L.clone=Fl,L.cloneDeep=wl,L.cloneDeepWith=_l,L.cloneWith=Nl,L.conformsTo=Pl,L.deburr=gF,L.defaultTo=Xs,L.divide=Os,L.endsWith=So,L.eq=B8,L.escape=Ro,L.escapeRegExp=Io,L.every=cd,L.find=pd,L.findIndex=GF,L.findKey=tl,L.findLast=yd,L.findLastIndex=BF,L.findLastKey=el,L.floor=ms,L.forEach=_F,L.forEachRight=PF,L.forIn=Zo,L.forInRight=Jo,L.forOwn=Qo,L.forOwnRight=Xo,L.get=qz,L.gt=jl,L.gte=Ll,L.has=Yo,L.hasIn=Yz,L.head=DF,L.identity=n4,L.includes=dd,L.indexOf=yi,L.inRange=Co,L.invoke=zo,L.isArguments=V7,L.isArray=x1,L.isArrayBuffer=Cl,L.isArrayLike=o4,L.isArrayLikeObject=L2,L.isBoolean=Ol,L.isBuffer=U5,L.isDate=ml,L.isElement=Sl,L.isEmpty=Rl,L.isEqual=Il,L.isEqualWith=Tl,L.isError=Xz,L.isFinite=vl,L.isFunction=C6,L.isInteger=IF,L.isLength=Ax,L.isMap=TF,L.isMatch=Al,L.isMatchWith=El,L.isNaN=fl,L.isNative=kl,L.isNil=bl,L.isNull=cl,L.isNumber=vF,L.isObject=H2,L.isObjectLike=N2,L.isPlainObject=BJ,L.isRegExp=xz,L.isSafeInteger=pl,L.isSet=AF,L.isString=Ex,L.isSymbol=F3,L.isTypedArray=L9,L.isUndefined=yl,L.isWeakMap=ul,L.isWeakSet=hl,L.join=di,L.kebabCase=To,L.last=u3,L.lastIndexOf=li,L.lowerCase=vo,L.lowerFirst=Ao,L.lt=gl,L.lte=il,L.max=Ss,L.maxBy=Rs,L.mean=Is,L.meanBy=Ts,L.min=vs,L.minBy=As,L.stubArray=Uz,L.stubFalse=Hz,L.stubObject=Fs,L.stubString=Ns,L.stubTrue=ws,L.multiply=Es,L.nth=oi,L.noConflict=Ws,L.noop=Vz,L.now=Ix,L.pad=Eo,L.padEnd=fo,L.padStart=ko,L.parseInt=co,L.random=Oo,L.reduce=ad,L.reduceRight=rd,L.repeat=bo,L.replace=po,L.result=Mo,L.round=fs,L.runInContext=i,L.sample=ed,L.size=Ql,L.snakeCase=yo,L.some=Xl,L.sortedIndex=Zd,L.sortedIndexBy=Jd,L.sortedIndexOf=Qd,L.sortedLastIndex=Xd,L.sortedLastIndexBy=xd,L.sortedLastIndexOf=qd,L.startCase=ho,L.startsWith=go,L.subtract=ks,L.sum=cs,L.sumBy=bs,L.template=io,L.times=_s,L.toFinite=O6,L.toInteger=K1,L.toLength=fF,L.toLower=lo,L.toNumber=h3,L.toSafeInteger=dl,L.toString=u1,L.toUpper=oo,L.trim=so,L.trimEnd=no,L.trimStart=ao,L.truncate=ro,L.unescape=to,L.uniqueId=js,L.upperCase=eo,L.upperFirst=$z,L.each=_F,L.eachRight=PF,L.first=DF,Wz(L,function(){var K={};return p8(L,function(V,G){if(!y1.call(L.prototype,G))K[G]=V}),K}(),{chain:!1}),L.VERSION=J,k3(["bind","bindKey","curry","curryRight","partial","partialRight"],function(K){L[K].placeholder=L}),k3(["drop","take"],function(K,V){N1.prototype[K]=function(G){G=G===Z?1:i2(K1(G),0);var F=this.__filtered__&&!V?new N1(this):this.clone();if(F.__filtered__)F.__takeCount__=_4(G,F.__takeCount__);else F.__views__.push({size:_4(G,i0),type:K+(F.__dir__<0?"Right":"")});return F},N1.prototype[K+"Right"]=function(G){return this.reverse()[K](G).reverse()}}),k3(["filter","map","takeWhile"],function(K,V){var G=V+1,F=G==V0||G==n;N1.prototype[K]=function(P){var C=this.clone();return C.__iteratees__.push({iteratee:d0(P,3),type:G}),C.__filtered__=C.__filtered__||F,C}}),k3(["head","last"],function(K,V){var G="take"+(V?"Right":"");N1.prototype[K]=function(){return this[G](1).value()[0]}}),k3(["initial","tail"],function(K,V){var G="drop"+(V?"":"Right");N1.prototype[K]=function(){return this.__filtered__?new N1(this):this[G](1)}}),N1.prototype.compact=function(){return this.filter(n4)},N1.prototype.find=function(K){return this.filter(K).head()},N1.prototype.findLast=function(K){return this.reverse().find(K)},N1.prototype.invokeMap=H1(function(K,V){if(typeof K=="function")return new N1(this);return this.map(function(G){return zJ(G,K,V)})}),N1.prototype.reject=function(K){return this.filter(vx(d0(K)))},N1.prototype.slice=function(K,V){K=K1(K);var G=this;if(G.__filtered__&&(K>0||V<0))return new N1(G);if(K<0)G=G.takeRight(-K);else if(K)G=G.drop(K);if(V!==Z)V=K1(V),G=V<0?G.dropRight(-V):G.take(V-K);return G},N1.prototype.takeRightWhile=function(K){return this.reverse().takeWhile(K).reverse()},N1.prototype.toArray=function(){return this.take(i0)},p8(N1.prototype,function(K,V){var G=/^(?:filter|find|map|reject)|While$/.test(V),F=/^(?:head|last)$/.test(V),P=L[F?"take"+(V=="last"?"Right":""):V],C=F||/^find/.test(V);if(!P)return;L.prototype[V]=function(){var T=this.__wrapped__,c=F?[1]:arguments,a=T instanceof N1,$0=c[0],K0=a||x1(T),U0=function(D1){var j1=P.apply(L,x5([D1],c));return F&&R0?j1[0]:j1};if(K0&&G&&typeof $0=="function"&&$0.length!=1)a=K0=!1;var R0=this.__chain__,f0=!!this.__actions__.length,l0=C&&!R0,V1=a&&!f0;if(!C&&K0){T=V1?T:new N1(this);var o0=K.apply(T,c);return o0.__actions__.push({func:Sx,args:[U0],thisArg:Z}),new b3(o0,R0)}if(l0&&V1)return K.apply(this,c);return o0=this.thru(U0),l0?F?o0.value()[0]:o0.value():o0}}),k3(["pop","push","shift","sort","splice","unshift"],function(K){var V=Zx[K],G=/^(?:push|sort|unshift)$/.test(K)?"tap":"thru",F=/^(?:pop|shift)$/.test(K);L.prototype[K]=function(){var P=arguments;if(F&&!this.__chain__){var C=this.value();return V.apply(x1(C)?C:[],P)}return this[G](function(T){return V.apply(x1(T)?T:[],P)})}}),p8(N1.prototype,function(K,V){var G=L[V];if(G){var F=G.name+"";if(!y1.call(N9,F))N9[F]=[];N9[F].push({name:V,func:G})}}),N9[_x(Z,N).name]=[{name:"wrapper",func:Z}],N1.prototype.clone=rh,N1.prototype.reverse=th,N1.prototype.value=eh,L.prototype.at=Sd,L.prototype.chain=Rd,L.prototype.commit=Id,L.prototype.next=Td,L.prototype.plant=Ad,L.prototype.reverse=Ed,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=fd,L.prototype.first=L.prototype.head,QJ)L.prototype[QJ]=vd;return L},Y5=Ih();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)r2._=Y5,define(function(){return Y5});else if(X7)(X7.exports=Y5)._=Y5,zK._=Y5;else r2._=Y5}).call(zX)});var nF="0.6.26";var GN=O9(HN(),1),{program:RT0,createCommand:IT0,createArgument:TT0,createOption:vT0,CommanderError:AT0,InvalidArgumentError:ET0,InvalidOptionArgumentError:fT0,Command:g3,Argument:kT0,Option:cT0,Help:bT0}=GN.default;import T30 from"fs";var jz=(Z,J,Q)=>{let X=Z instanceof RegExp?BN(Z,Q):Z,x=J instanceof RegExp?BN(J,Q):J,q=X!==null&&x!=null&&fn(X,x,Q);return q&&{start:q[0],end:q[1],pre:Q.slice(0,q[0]),body:Q.slice(q[0]+X.length,q[1]),post:Q.slice(q[1]+x.length)}},BN=(Z,J)=>{let Q=J.match(Z);return Q?Q[0]:null},fn=(Z,J,Q)=>{let X,x,q,Y=void 0,$,z=Q.indexOf(Z),W=Q.indexOf(J,z+1),U=z;if(z>=0&&W>0){if(Z===J)return[z,W];X=[],q=Q.length;while(U>=0&&!$){if(U===z)X.push(U),z=Q.indexOf(Z,U+1);else if(X.length===1){let H=X.pop();if(H!==void 0)$=[H,W]}else{if(x=X.pop(),x!==void 0&&x<q)q=x,Y=W;W=Q.indexOf(J,U+1)}U=z<W&&z>=0?z:W}if(X.length&&Y!==void 0)$=[q,Y]}return $};var MN="\x00SLASH"+Math.random()+"\x00",DN="\x00OPEN"+Math.random()+"\x00",Cz="\x00CLOSE"+Math.random()+"\x00",FN="\x00COMMA"+Math.random()+"\x00",NN="\x00PERIOD"+Math.random()+"\x00",kn=new RegExp(MN,"g"),cn=new RegExp(DN,"g"),bn=new RegExp(Cz,"g"),pn=new RegExp(FN,"g"),yn=new RegExp(NN,"g"),un=/\\\\/g,hn=/\\{/g,gn=/\\}/g,dn=/\\,/g,ln=/\\\./g,on=1e5;function Lz(Z){return!isNaN(Z)?parseInt(Z,10):Z.charCodeAt(0)}function sn(Z){return Z.replace(un,MN).replace(hn,DN).replace(gn,Cz).replace(dn,FN).replace(ln,NN)}function nn(Z){return Z.replace(kn,"\\").replace(cn,"{").replace(bn,"}").replace(pn,",").replace(yn,".")}function wN(Z){if(!Z)return[""];let J=[],Q=jz("{","}",Z);if(!Q)return Z.split(",");let{pre:X,body:x,post:q}=Q,Y=X.split(",");Y[Y.length-1]+="{"+x+"}";let $=wN(q);if(q.length)Y[Y.length-1]+=$.shift(),Y.push.apply(Y,$);return J.push.apply(J,Y),J}function _N(Z,J={}){if(!Z)return[];let{max:Q=on}=J;if(Z.slice(0,2)==="{}")Z="\\{\\}"+Z.slice(2);return DJ(sn(Z),Q,!0).map(nn)}function an(Z){return"{"+Z+"}"}function rn(Z){return/^-?0\d/.test(Z)}function tn(Z,J){return Z<=J}function en(Z,J){return Z>=J}function DJ(Z,J,Q){let X=[],x=jz("{","}",Z);if(!x)return[Z];let q=x.pre,Y=x.post.length?DJ(x.post,J,!1):[""];if(/\$$/.test(x.pre))for(let $=0;$<Y.length&&$<J;$++){let z=q+"{"+x.body+"}"+Y[$];X.push(z)}else{let $=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(x.body),z=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(x.body),W=$||z,U=x.body.indexOf(",")>=0;if(!W&&!U){if(x.post.match(/,(?!,).*\}/))return Z=x.pre+"{"+x.body+Cz+x.post,DJ(Z,J,!0);return[Z]}let H;if(W)H=x.body.split(/\.\./);else if(H=wN(x.body),H.length===1&&H[0]!==void 0){if(H=DJ(H[0],J,!1).map(an),H.length===1)return Y.map((M)=>x.pre+H[0]+M)}let B;if(W&&H[0]!==void 0&&H[1]!==void 0){let M=Lz(H[0]),D=Lz(H[1]),N=Math.max(H[0].length,H[1].length),_=H.length===3&&H[2]!==void 0?Math.max(Math.abs(Lz(H[2])),1):1,j=tn;if(D<M)_*=-1,j=en;let A=H.some(rn);B=[];for(let h=M;j(h,D);h+=_){let u;if(z){if(u=String.fromCharCode(h),u==="\\")u=""}else if(u=String(h),A){let e=N-u.length;if(e>0){let s=new Array(e+1).join("0");if(h<0)u="-"+s+u.slice(1);else u=s+u}}B.push(u)}}else{B=[];for(let M=0;M<H.length;M++)B.push.apply(B,DJ(H[M],J,!1))}for(let M=0;M<B.length;M++)for(let D=0;D<Y.length&&X.length<J;D++){let N=q+B[M]+Y[D];if(!Q||W||N)X.push(N)}}return X}var FJ=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var Za={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},NJ=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),Ja=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),PN=(Z)=>Z.join(""),jN=(Z,J)=>{let Q=J;if(Z.charAt(Q)!=="[")throw new Error("not in a brace expression");let X=[],x=[],q=Q+1,Y=!1,$=!1,z=!1,W=!1,U=Q,H="";Z:while(q<Z.length){let N=Z.charAt(q);if((N==="!"||N==="^")&&q===Q+1){W=!0,q++;continue}if(N==="]"&&Y&&!z){U=q+1;break}if(Y=!0,N==="\\"){if(!z){z=!0,q++;continue}}if(N==="["&&!z){for(let[_,[j,O,A]]of Object.entries(Za))if(Z.startsWith(_,q)){if(H)return["$.",!1,Z.length-Q,!0];if(q+=_.length,A)x.push(j);else X.push(j);$=$||O;continue Z}}if(z=!1,H){if(N>H)X.push(NJ(H)+"-"+NJ(N));else if(N===H)X.push(NJ(N));H="",q++;continue}if(Z.startsWith("-]",q+1)){X.push(NJ(N+"-")),q+=2;continue}if(Z.startsWith("-",q+1)){H=N,q+=2;continue}X.push(NJ(N)),q++}if(U<q)return["",!1,0,!1];if(!X.length&&!x.length)return["$.",!1,Z.length-Q,!0];if(x.length===0&&X.length===1&&/^\\?.$/.test(X[0])&&!W){let N=X[0].length===2?X[0].slice(-1):X[0];return[Ja(N),!1,U-Q,!1]}let B="["+(W?"^":"")+PN(X)+"]",M="["+(W?"":"^")+PN(x)+"]";return[X.length&&x.length?"("+B+"|"+M+")":X.length?B:M,$,U-Q,!0]};var F8=(Z,{windowsPathsNoEscape:J=!1,magicalBraces:Q=!0}={})=>{if(Q)return J?Z.replace(/\[([^/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1");return J?Z.replace(/\[([^/\\{}])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1")};var a4,Qa=new Set(["!","?","+","*","@"]),Oz=(Z)=>Qa.has(Z),LN=(Z)=>Oz(Z.type),Xa=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),xa=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),qa=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),CN=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Ya="(?!(?:^|/)\\.\\.?(?:$|/))",bx="(?!\\.)",$a=new Set(["[","."]),Ka=new Set(["..","."]),za=new Set("().*{}+?[]^$\\!"),Wa=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mz="[^/]",ON=mz+"*?",mN=mz+"+?",Va=0;class m9{type;#Z;#X;#x=!1;#J=[];#Y;#j;#F;#V=!1;#$;#U;#W=!1;id=++Va;get depth(){return(this.#Y?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#Z.id,parent:this.#Y?.id,depth:this.depth,partsLength:this.#J.length,parts:this.#J}}constructor(Z,J,Q={}){if(this.type=Z,Z)this.#X=!0;if(this.#Y=J,this.#Z=this.#Y?this.#Y.#Z:this,this.#$=this.#Z===this?Q:this.#Z.#$,this.#F=this.#Z===this?[]:this.#Z.#F,Z==="!"&&!this.#Z.#V)this.#F.push(this);this.#j=this.#Y?this.#Y.#J.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let Z of this.#J){if(typeof Z==="string")continue;if(Z.type||Z.hasMagic)return this.#X=!0}return this.#X}toString(){return this.#U!==void 0?this.#U:!this.type?this.#U=this.#J.map((Z)=>String(Z)).join(""):this.#U=this.type+"("+this.#J.map((Z)=>String(Z)).join("|")+")"}#K(){if(this!==this.#Z)throw new Error("should only call on root");if(this.#V)return this;this.toString(),this.#V=!0;let Z;while(Z=this.#F.pop()){if(Z.type!=="!")continue;let J=Z,Q=J.#Y;while(Q){for(let X=J.#j+1;!Q.type&&X<Q.#J.length;X++)for(let x of Z.#J){if(typeof x==="string")throw new Error("string part in extglob AST??");x.copyIn(Q.#J[X])}J=Q,Q=J.#Y}}return this}push(...Z){for(let J of Z){if(J==="")continue;if(typeof J!=="string"&&!(J instanceof a4&&J.#Y===this))throw new Error("invalid part: "+J);this.#J.push(J)}}toJSON(){let Z=this.type===null?this.#J.slice().map((J)=>typeof J==="string"?J:J.toJSON()):[this.type,...this.#J.map((J)=>J.toJSON())];if(this.isStart()&&!this.type)Z.unshift([]);if(this.isEnd()&&(this===this.#Z||this.#Z.#V&&this.#Y?.type==="!"))Z.push({});return Z}isStart(){if(this.#Z===this)return!0;if(!this.#Y?.isStart())return!1;if(this.#j===0)return!0;let Z=this.#Y;for(let J=0;J<this.#j;J++){let Q=Z.#J[J];if(!(Q instanceof a4&&Q.type==="!"))return!1}return!0}isEnd(){if(this.#Z===this)return!0;if(this.#Y?.type==="!")return!0;if(!this.#Y?.isEnd())return!1;if(!this.type)return this.#Y?.isEnd();let Z=this.#Y?this.#Y.#J.length:0;return this.#j===Z-1}copyIn(Z){if(typeof Z==="string")this.push(Z);else this.push(Z.clone(this))}clone(Z){let J=new a4(this.type,Z);for(let Q of this.#J)J.copyIn(Q);return J}static#q(Z,J,Q,X,x){let q=X.maxExtglobRecursion??2,Y=!1,$=!1,z=-1,W=!1;if(J.type===null){let D=Q,N="";while(D<Z.length){let _=Z.charAt(D++);if(Y||_==="\\"){Y=!Y,N+=_;continue}if($){if(D===z+1){if(_==="^"||_==="!")W=!0}else if(_==="]"&&!(D===z+2&&W))$=!1;N+=_;continue}else if(_==="["){$=!0,z=D,W=!1,N+=_;continue}if(!X.noext&&Oz(_)&&Z.charAt(D)==="("&&x<=q){J.push(N),N="";let O=new a4(_,J);D=a4.#q(Z,O,D,X,x+1),J.push(O);continue}N+=_}return J.push(N),D}let U=Q+1,H=new a4(null,J),B=[],M="";while(U<Z.length){let D=Z.charAt(U++);if(Y||D==="\\"){Y=!Y,M+=D;continue}if($){if(U===z+1){if(D==="^"||D==="!")W=!0}else if(D==="]"&&!(U===z+2&&W))$=!1;M+=D;continue}else if(D==="["){$=!0,z=U,W=!1,M+=D;continue}if(!X.noext&&Oz(D)&&Z.charAt(U)==="("&&(x<=q||J&&J.#G(D))){let _=J&&J.#G(D)?0:1;H.push(M),M="";let j=new a4(D,H);H.push(j),U=a4.#q(Z,j,U,X,x+_);continue}if(D==="|"){H.push(M),M="",B.push(H),H=new a4(null,J);continue}if(D===")"){if(M===""&&J.#J.length===0)J.#W=!0;return H.push(M),M="",J.push(...B,H),U}M+=D}return J.type=null,J.#X=void 0,J.#J=[Z.substring(Q-1)],U}#N(Z){return this.#_(Z,xa)}#_(Z,J=Xa){if(!Z||typeof Z!=="object"||Z.type!==null||Z.#J.length!==1||this.type===null)return!1;let Q=Z.#J[0];if(!Q||typeof Q!=="object"||Q.type===null)return!1;return this.#G(Q.type,J)}#G(Z,J=qa){return!!J.get(this.type)?.includes(Z)}#B(Z,J){let Q=Z.#J[0],X=new a4(null,Q,this.options);X.#J.push(""),Q.push(X),this.#O(Z,J)}#O(Z,J){let Q=Z.#J[0];this.#J.splice(J,1,...Q.#J);for(let X of Q.#J)if(typeof X==="object")X.#Y=this;this.#U=void 0}#M(Z){return!!CN.get(this.type)?.has(Z)}#P(Z){if(!Z||typeof Z!=="object"||Z.type!==null||Z.#J.length!==1||this.type===null||this.#J.length!==1)return!1;let J=Z.#J[0];if(!J||typeof J!=="object"||J.type===null)return!1;return this.#M(J.type)}#L(Z){let J=CN.get(this.type),Q=Z.#J[0],X=J?.get(Q.type);if(!X)return!1;this.#J=Q.#J;for(let x of this.#J)if(typeof x==="object")x.#Y=this;this.type=X,this.#U=void 0,this.#W=!1}static fromGlob(Z,J={}){let Q=new a4(null,void 0,J);return a4.#q(Z,Q,0,J,0),Q}toMMPattern(){if(this!==this.#Z)return this.#Z.toMMPattern();let Z=this.toString(),[J,Q,X,x]=this.toRegExpSource();if(!(X||this.#X||this.#$.nocase&&!this.#$.nocaseMagicOnly&&Z.toUpperCase()!==Z.toLowerCase()))return Q;let Y=(this.#$.nocase?"i":"")+(x?"u":"");return Object.assign(new RegExp(`^${J}$`,Y),{_src:J,_glob:Z})}get options(){return this.#$}toRegExpSource(Z){let J=Z??!!this.#$.dot;if(this.#Z===this)this.#H(),this.#K();if(!LN(this)){let $=this.isStart()&&this.isEnd()&&!this.#J.some((B)=>typeof B!=="string"),z=this.#J.map((B)=>{let[M,D,N,_]=typeof B==="string"?a4.#w(B,this.#X,$):B.toRegExpSource(Z);return this.#X=this.#X||N,this.#x=this.#x||_,M}).join(""),W="";if(this.isStart()){if(typeof this.#J[0]==="string"){if(!(this.#J.length===1&&Ka.has(this.#J[0]))){let M=$a,D=J&&M.has(z.charAt(0))||z.startsWith("\\.")&&M.has(z.charAt(2))||z.startsWith("\\.\\.")&&M.has(z.charAt(4)),N=!J&&!Z&&M.has(z.charAt(0));W=D?Ya:N?bx:""}}}let U="";if(this.isEnd()&&this.#Z.#V&&this.#Y?.type==="!")U="(?:$|\\/)";return[W+z+U,F8(z),this.#X=!!this.#X,this.#x]}let Q=this.type==="*"||this.type==="+",X=this.type==="!"?"(?:(?!(?:":"(?:",x=this.#D(J);if(this.isStart()&&this.isEnd()&&!x&&this.type!=="!"){let $=this.toString(),z=this;return z.#J=[$],z.type=null,z.#X=void 0,[$,F8(this.toString()),!1,!1]}let q=!Q||Z||J||!bx?"":this.#D(!0);if(q===x)q="";if(q)x=`(?:${x})(?:${q})*?`;let Y="";if(this.type==="!"&&this.#W)Y=(this.isStart()&&!J?bx:"")+mN;else{let $=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?bx:"")+ON+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&q?")":this.type==="*"&&q?")?":`)${this.type}`;Y=X+x+$}return[Y,F8(x),this.#X=!!this.#X,this.#x]}#H(){if(!LN(this)){for(let Z of this.#J)if(typeof Z==="object")Z.#H()}else{let Z=0,J=!1;do{J=!0;for(let Q=0;Q<this.#J.length;Q++){let X=this.#J[Q];if(typeof X==="object"){if(X.#H(),this.#_(X))J=!1,this.#O(X,Q);else if(this.#N(X))J=!1,this.#B(X,Q);else if(this.#P(X))J=!1,this.#L(X)}}}while(!J&&++Z<10)}this.#U=void 0}#D(Z){return this.#J.map((J)=>{if(typeof J==="string")throw new Error("string type in extglob ast??");let[Q,X,x,q]=J.toRegExpSource(Z);return this.#x=this.#x||q,Q}).filter((J)=>!(this.isStart()&&this.isEnd())||!!J).join("|")}static#w(Z,J,Q=!1){let X=!1,x="",q=!1,Y=!1;for(let $=0;$<Z.length;$++){let z=Z.charAt($);if(X){X=!1,x+=(za.has(z)?"\\":"")+z;continue}if(z==="*"){if(Y)continue;Y=!0,x+=Q&&/^[*]+$/.test(Z)?mN:ON,J=!0;continue}else Y=!1;if(z==="\\"){if($===Z.length-1)x+="\\\\";else X=!0;continue}if(z==="["){let[W,U,H,B]=jN(Z,$);if(H){x+=W,q=q||U,$+=H-1,J=J||B;continue}}if(z==="?"){x+=mz,J=!0;continue}x+=Wa(z)}return[x,F8(Z),!!J,q]}}a4=m9;var S9=(Z,{windowsPathsNoEscape:J=!1,magicalBraces:Q=!1}={})=>{if(Q)return J?Z.replace(/[?*()[\]{}]/g,"[$&]"):Z.replace(/[?*()[\]\\{}]/g,"\\$&");return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var k4=(Z,J,Q={})=>{if(FJ(J),!Q.nocomment&&J.charAt(0)==="#")return!1;return new d3(J,Q).match(Z)},Ua=/^\*+([^+@!?*[(]*)$/,Ha=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),Ga=(Z)=>(J)=>J.endsWith(Z),Ba=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},Ma=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},Da=/^\*+\.\*+$/,Fa=(Z)=>!Z.startsWith(".")&&Z.includes("."),Na=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),wa=/^\.\*+$/,_a=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),Pa=/^\*+$/,ja=(Z)=>Z.length!==0&&!Z.startsWith("."),La=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",Ca=/^\?+([^+@!?*[(]*)?$/,Oa=([Z,J=""])=>{let Q=IN([Z]);if(!J)return Q;return J=J.toLowerCase(),(X)=>Q(X)&&X.toLowerCase().endsWith(J)},ma=([Z,J=""])=>{let Q=TN([Z]);if(!J)return Q;return J=J.toLowerCase(),(X)=>Q(X)&&X.toLowerCase().endsWith(J)},Sa=([Z,J=""])=>{let Q=TN([Z]);return!J?Q:(X)=>Q(X)&&X.endsWith(J)},Ra=([Z,J=""])=>{let Q=IN([Z]);return!J?Q:(X)=>Q(X)&&X.endsWith(J)},IN=([Z])=>{let J=Z.length;return(Q)=>Q.length===J&&!Q.startsWith(".")},TN=([Z])=>{let J=Z.length;return(Q)=>Q.length===J&&Q!=="."&&Q!==".."},vN=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",SN={win32:{sep:"\\"},posix:{sep:"/"}},Ia=vN==="win32"?SN.win32.sep:SN.posix.sep;k4.sep=Ia;var O2=Symbol("globstar **");k4.GLOBSTAR=O2;var Ta="[^/]",va=Ta+"*?",Aa="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ea="(?:(?!(?:\\/|^)\\.).)*?",fa=(Z,J={})=>(Q)=>k4(Q,Z,J);k4.filter=fa;var i3=(Z,J={})=>Object.assign({},Z,J),ka=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return k4;let J=k4;return Object.assign((X,x,q={})=>J(X,x,i3(Z,q)),{Minimatch:class X extends J.Minimatch{constructor(x,q={}){super(x,i3(Z,q))}static defaults(x){return J.defaults(i3(Z,x)).Minimatch}},AST:class X extends J.AST{constructor(x,q,Y={}){super(x,q,i3(Z,Y))}static fromGlob(x,q={}){return J.AST.fromGlob(x,i3(Z,q))}},unescape:(X,x={})=>J.unescape(X,i3(Z,x)),escape:(X,x={})=>J.escape(X,i3(Z,x)),filter:(X,x={})=>J.filter(X,i3(Z,x)),defaults:(X)=>J.defaults(i3(Z,X)),makeRe:(X,x={})=>J.makeRe(X,i3(Z,x)),braceExpand:(X,x={})=>J.braceExpand(X,i3(Z,x)),match:(X,x,q={})=>J.match(X,x,i3(Z,q)),sep:J.sep,GLOBSTAR:O2})};k4.defaults=ka;var AN=(Z,J={})=>{if(FJ(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return _N(Z,{max:J.braceExpandMax})};k4.braceExpand=AN;var ca=(Z,J={})=>new d3(Z,J).makeRe();k4.makeRe=ca;var ba=(Z,J,Q={})=>{let X=new d3(J,Q);if(Z=Z.filter((x)=>X.match(x)),X.options.nonull&&!Z.length)Z.push(J);return Z};k4.match=ba;var RN=/[?*]|[+@!]\(.*?\)|\[|\]/,pa=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class d3{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(Z,J={}){FJ(Z),J=J||{},this.options=J,this.maxGlobstarRecursion=J.maxGlobstarRecursion??200,this.pattern=Z,this.platform=J.platform||vN,this.isWindows=this.platform==="win32";let Q="allowWindowsEscape";if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J[Q]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!J.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!J.nonegate,this.comment=!1,this.empty=!1,this.partial=!!J.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=J.windowsNoMagicRoot!==void 0?J.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Z of this.set)for(let J of Z)if(typeof J!=="string")return!0;return!1}debug(...Z){}make(){let Z=this.pattern,J=this.options;if(!J.nocomment&&Z.charAt(0)==="#"){this.comment=!0;return}if(!Z){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],J.debug)this.debug=(...x)=>console.error(...x);this.debug(this.pattern,this.globSet);let Q=this.globSet.map((x)=>this.slashSplit(x));this.globParts=this.preprocess(Q),this.debug(this.pattern,this.globParts);let X=this.globParts.map((x,q,Y)=>{if(this.isWindows&&this.windowsNoMagicRoot){let $=x[0]===""&&x[1]===""&&(x[2]==="?"||!RN.test(x[2]))&&!RN.test(x[3]),z=/^[a-z]:/i.test(x[0]);if($)return[...x.slice(0,4),...x.slice(4).map((W)=>this.parse(W))];else if(z)return[x[0],...x.slice(1).map((W)=>this.parse(W))]}return x.map(($)=>this.parse($))});if(this.debug(this.pattern,X),this.set=X.filter((x)=>x.indexOf(!1)===-1),this.isWindows)for(let x=0;x<this.set.length;x++){let q=this.set[x];if(q[0]===""&&q[1]===""&&this.globParts[x][2]==="?"&&typeof q[3]==="string"&&/^[a-z]:$/i.test(q[3]))q[2]="?"}this.debug(this.pattern,this.set)}preprocess(Z){if(this.options.noglobstar){for(let Q of Z)for(let X=0;X<Q.length;X++)if(Q[X]==="**")Q[X]="*"}let{optimizationLevel:J=1}=this.options;if(J>=2)Z=this.firstPhasePreProcess(Z),Z=this.secondPhasePreProcess(Z);else if(J>=1)Z=this.levelOneOptimize(Z);else Z=this.adjascentGlobstarOptimize(Z);return Z}adjascentGlobstarOptimize(Z){return Z.map((J)=>{let Q=-1;while((Q=J.indexOf("**",Q+1))!==-1){let X=Q;while(J[X+1]==="**")X++;if(X!==Q)J.splice(Q,X-Q)}return J})}levelOneOptimize(Z){return Z.map((J)=>{return J=J.reduce((Q,X)=>{let x=Q[Q.length-1];if(X==="**"&&x==="**")return Q;if(X===".."){if(x&&x!==".."&&x!=="."&&x!=="**")return Q.pop(),Q}return Q.push(X),Q},[]),J.length===0?[""]:J})}levelTwoFileOptimize(Z){if(!Array.isArray(Z))Z=this.slashSplit(Z);let J=!1;do{if(J=!1,!this.preserveMultipleSlashes){for(let X=1;X<Z.length-1;X++){let x=Z[X];if(X===1&&x===""&&Z[0]==="")continue;if(x==="."||x==="")J=!0,Z.splice(X,1),X--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))J=!0,Z.pop()}let Q=0;while((Q=Z.indexOf("..",Q+1))!==-1){let X=Z[Q-1];if(X&&X!=="."&&X!==".."&&X!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(X)))J=!0,Z.splice(Q-1,2),Q-=2}}while(J);return Z.length===0?[""]:Z}firstPhasePreProcess(Z){let J=!1;do{J=!1;for(let Q of Z){let X=-1;while((X=Q.indexOf("**",X+1))!==-1){let q=X;while(Q[q+1]==="**")q++;if(q>X)Q.splice(X+1,q-X);let Y=Q[X+1],$=Q[X+2],z=Q[X+3];if(Y!=="..")continue;if(!$||$==="."||$===".."||!z||z==="."||z==="..")continue;J=!0,Q.splice(X,1);let W=Q.slice(0);W[X]="**",Z.push(W),X--}if(!this.preserveMultipleSlashes){for(let q=1;q<Q.length-1;q++){let Y=Q[q];if(q===1&&Y===""&&Q[0]==="")continue;if(Y==="."||Y==="")J=!0,Q.splice(q,1),q--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))J=!0,Q.pop()}let x=0;while((x=Q.indexOf("..",x+1))!==-1){let q=Q[x-1];if(q&&q!=="."&&q!==".."&&q!=="**"){J=!0;let $=x===1&&Q[x+1]==="**"?["."]:[];if(Q.splice(x-1,2,...$),Q.length===0)Q.push("");x-=2}}}}while(J);return Z}secondPhasePreProcess(Z){for(let J=0;J<Z.length-1;J++)for(let Q=J+1;Q<Z.length;Q++){let X=this.partsMatch(Z[J],Z[Q],!this.preserveMultipleSlashes);if(X){Z[J]=[],Z[Q]=X;break}}return Z.filter((J)=>J.length)}partsMatch(Z,J,Q=!1){let X=0,x=0,q=[],Y="";while(X<Z.length&&x<J.length)if(Z[X]===J[x])q.push(Y==="b"?J[x]:Z[X]),X++,x++;else if(Q&&Z[X]==="**"&&J[x]===Z[X+1])q.push(Z[X]),X++;else if(Q&&J[x]==="**"&&Z[X]===J[x+1])q.push(J[x]),x++;else if(Z[X]==="*"&&J[x]&&(this.options.dot||!J[x].startsWith("."))&&J[x]!=="**"){if(Y==="b")return!1;Y="a",q.push(Z[X]),X++,x++}else if(J[x]==="*"&&Z[X]&&(this.options.dot||!Z[X].startsWith("."))&&Z[X]!=="**"){if(Y==="a")return!1;Y="b",q.push(J[x]),X++,x++}else return!1;return Z.length===J.length&&q}parseNegate(){if(this.nonegate)return;let Z=this.pattern,J=!1,Q=0;for(let X=0;X<Z.length&&Z.charAt(X)==="!";X++)J=!J,Q++;if(Q)this.pattern=Z.slice(Q);this.negate=J}matchOne(Z,J,Q=!1){let X=0,x=0;if(this.isWindows){let Y=typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0]),$=!Y&&Z[0]===""&&Z[1]===""&&Z[2]==="?"&&/^[a-z]:$/i.test(Z[3]),z=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),W=!z&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),U=$?3:Y?0:void 0,H=W?3:z?0:void 0;if(typeof U==="number"&&typeof H==="number"){let[B,M]=[Z[U],J[H]];if(B.toLowerCase()===M.toLowerCase())J[H]=B,x=H,X=U}}let{optimizationLevel:q=1}=this.options;if(q>=2)Z=this.levelTwoFileOptimize(Z);if(J.includes(O2))return this.#Z(Z,J,Q,X,x);return this.#x(Z,J,Q,X,x)}#Z(Z,J,Q,X,x){let q=J.indexOf(O2,x),Y=J.lastIndexOf(O2),[$,z,W]=Q?[J.slice(x,q),J.slice(q+1),[]]:[J.slice(x,q),J.slice(q+1,Y),J.slice(Y+1)];if($.length){let j=Z.slice(X,X+$.length);if(!this.#x(j,$,Q,0,0))return!1;X+=$.length,x+=$.length}let U=0;if(W.length){if(W.length+X>Z.length)return!1;let j=Z.length-W.length;if(this.#x(Z,W,Q,j,0))U=W.length;else{if(Z[Z.length-1]!==""||X+W.length===Z.length)return!1;if(j--,!this.#x(Z,W,Q,j,0))return!1;U=W.length+1}}if(!z.length){let j=!!U;for(let O=X;O<Z.length-U;O++){let A=String(Z[O]);if(j=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return Q||j}let H=[[[],0]],B=H[0],M=0,D=[0];for(let j of z)if(j===O2)D.push(M),B=[[],0],H.push(B);else B[0].push(j),M++;let N=H.length-1,_=Z.length-U;for(let j of H)j[1]=_-(D[N--]+j[0].length);return!!this.#X(Z,H,X,0,Q,0,!!U)}#X(Z,J,Q,X,x,q,Y){let $=J[X];if(!$){for(let U=Q;U<Z.length;U++){Y=!0;let H=Z[U];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1}return Y}let[z,W]=$;while(Q<=W){if(this.#x(Z.slice(0,Q+z.length),z,x,Q,0)&&q<this.maxGlobstarRecursion){let B=this.#X(Z,J,Q+z.length,X+1,x,q+1,Y);if(B!==!1)return B}let H=Z[Q];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1;Q++}return x||null}#x(Z,J,Q,X,x){let q,Y,$,z;for(q=X,Y=x,z=Z.length,$=J.length;q<z&&Y<$;q++,Y++){this.debug("matchOne loop");let W=J[Y],U=Z[q];if(this.debug(J,W,U),W===!1||W===O2)return!1;let H;if(typeof W==="string")H=U===W,this.debug("string match",W,U,H);else H=W.test(U),this.debug("pattern match",W,U,H);if(!H)return!1}if(q===z&&Y===$)return!0;else if(q===z)return Q;else if(Y===$)return q===z-1&&Z[q]==="";else throw new Error("wtf?")}braceExpand(){return AN(this.pattern,this.options)}parse(Z){FJ(Z);let J=this.options;if(Z==="**")return O2;if(Z==="")return"";let Q,X=null;if(Q=Z.match(Pa))X=J.dot?La:ja;else if(Q=Z.match(Ua))X=(J.nocase?J.dot?Ma:Ba:J.dot?Ga:Ha)(Q[1]);else if(Q=Z.match(Ca))X=(J.nocase?J.dot?ma:Oa:J.dot?Sa:Ra)(Q);else if(Q=Z.match(Da))X=J.dot?Na:Fa;else if(Q=Z.match(wa))X=_a;let x=m9.fromGlob(Z,this.options).toMMPattern();if(X&&typeof x==="object")Reflect.defineProperty(x,"test",{value:X});return x}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Z=this.set;if(!Z.length)return this.regexp=!1,this.regexp;let J=this.options,Q=J.noglobstar?va:J.dot?Aa:Ea,X=new Set(J.nocase?["i"]:[]),x=Z.map(($)=>{let z=$.map((U)=>{if(U instanceof RegExp)for(let H of U.flags.split(""))X.add(H);return typeof U==="string"?pa(U):U===O2?O2:U._src});z.forEach((U,H)=>{let B=z[H+1],M=z[H-1];if(U!==O2||M===O2)return;if(M===void 0)if(B!==void 0&&B!==O2)z[H+1]="(?:\\/|"+Q+"\\/)?"+B;else z[H]=Q;else if(B===void 0)z[H-1]=M+"(?:\\/|\\/"+Q+")?";else if(B!==O2)z[H-1]=M+"(?:\\/|\\/"+Q+"\\/)"+B,z[H+1]=O2});let W=z.filter((U)=>U!==O2);if(this.partial&&W.length>=1){let U=[];for(let H=1;H<=W.length;H++)U.push(W.slice(0,H).join("/"));return"(?:"+U.join("|")+")"}return W.join("/")}).join("|"),[q,Y]=Z.length>1?["(?:",")"]:["",""];if(x="^"+q+x+Y+"$",this.partial)x="^(?:\\/|"+q+x.slice(1,-1)+Y+")$";if(this.negate)x="^(?!"+x+").+$";try{this.regexp=new RegExp(x,[...X].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let Q=this.options;if(this.isWindows)Z=Z.split("\\").join("/");let X=this.slashSplit(Z);this.debug(this.pattern,"split",X);let x=this.set;this.debug(this.pattern,"set",x);let q=X[X.length-1];if(!q)for(let Y=X.length-2;!q&&Y>=0;Y--)q=X[Y];for(let Y of x){let $=X;if(Q.matchBase&&Y.length===1)$=[q];if(this.matchOne($,Y,J)){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate}static defaults(Z){return k4.defaults(Z).Minimatch}}k4.AST=m9;k4.Minimatch=d3;k4.escape=S9;k4.unescape=F8;import{fileURLToPath as Fr}from"node:url";var ya=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,fN=new Set,Sz=typeof process==="object"&&!!process?process:{},kN=(Z,J,Q,X)=>{typeof Sz.emitWarning==="function"?Sz.emitWarning(Z,J,Q,X):console.error(`[${Q}] ${J}: ${Z}`)},px=globalThis.AbortController,EN=globalThis.AbortSignal;if(typeof px==="undefined"){EN=class Q{onabort;_onabort=[];reason;aborted=!1;addEventListener(X,x){this._onabort.push(x)}},px=class Q{constructor(){J()}signal=new EN;abort(X){if(this.signal.aborted)return;this.signal.reason=X,this.signal.aborted=!0;for(let x of this.signal._onabort)x(X);this.signal.onabort?.(X)}};let Z=Sz.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,kN("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",J)}}var ua=(Z)=>!fN.has(Z),qv0=Symbol("type"),H5=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),cN=(Z)=>!H5(Z)?null:Z<=Math.pow(2,8)?Uint8Array:Z<=Math.pow(2,16)?Uint16Array:Z<=Math.pow(2,32)?Uint32Array:Z<=Number.MAX_SAFE_INTEGER?wJ:null;class wJ extends Array{constructor(Z){super(Z);this.fill(0)}}class R9{heap;length;static#Z=!1;static create(Z){let J=cN(Z);if(!J)return[];R9.#Z=!0;let Q=new R9(Z,J);return R9.#Z=!1,Q}constructor(Z,J){if(!R9.#Z)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new J(Z),this.length=0}push(Z){this.heap[this.length++]=Z}pop(){return this.heap[--this.length]}}class U7{#Z;#X;#x;#J;#Y;#j;#F;#V;get perf(){return this.#V}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#$;#U;#W;#K;#q;#N;#_;#G;#B;#O;#M;#P;#L;#H;#D;#w;#m;#Q;#E;static unsafeExposeInternals(Z){return{starts:Z.#L,ttls:Z.#H,autopurgeTimers:Z.#D,sizes:Z.#P,keyMap:Z.#W,keyList:Z.#K,valList:Z.#q,next:Z.#N,prev:Z.#_,get head(){return Z.#G},get tail(){return Z.#B},free:Z.#O,isBackgroundFetch:(J)=>Z.#z(J),backgroundFetch:(J,Q,X,x)=>Z.#h(J,Q,X,x),moveToTail:(J)=>Z.#k(J),indexes:(J)=>Z.#I(J),rindexes:(J)=>Z.#T(J),isStale:(J)=>Z.#C(J)}}get max(){return this.#Z}get maxSize(){return this.#X}get calculatedSize(){return this.#U}get size(){return this.#$}get fetchMethod(){return this.#j}get memoMethod(){return this.#F}get dispose(){return this.#x}get onInsert(){return this.#J}get disposeAfter(){return this.#Y}constructor(Z){let{max:J=0,ttl:Q,ttlResolution:X=1,ttlAutopurge:x,updateAgeOnGet:q,updateAgeOnHas:Y,allowStale:$,dispose:z,onInsert:W,disposeAfter:U,noDisposeOnSet:H,noUpdateTTL:B,maxSize:M=0,maxEntrySize:D=0,sizeCalculation:N,fetchMethod:_,memoMethod:j,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:u,ignoreFetchAbort:e,perf:s}=Z;if(s!==void 0){if(typeof s?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#V=s??ya,J!==0&&!H5(J))throw new TypeError("max option must be a nonnegative integer");let m=J?cN(J):Array;if(!m)throw new Error("invalid max value: "+J);if(this.#Z=J,this.#X=M,this.maxEntrySize=D||this.#X,this.sizeCalculation=N,this.sizeCalculation){if(!this.#X&&!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(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=j,_!==void 0&&typeof _!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#j=_,this.#m=!!_,this.#W=new Map,this.#K=new Array(J).fill(void 0),this.#q=new Array(J).fill(void 0),this.#N=new m(J),this.#_=new m(J),this.#G=0,this.#B=0,this.#O=R9.create(J),this.#$=0,this.#U=0,typeof z==="function")this.#x=z;if(typeof W==="function")this.#J=W;if(typeof U==="function")this.#Y=U,this.#M=[];else this.#Y=void 0,this.#M=void 0;if(this.#w=!!this.#x,this.#E=!!this.#J,this.#Q=!!this.#Y,this.noDisposeOnSet=!!H,this.noUpdateTTL=!!B,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!h,this.allowStaleOnFetchAbort=!!u,this.ignoreFetchAbort=!!e,this.maxEntrySize!==0){if(this.#X!==0){if(!H5(this.#X))throw new TypeError("maxSize must be a positive integer if specified")}if(!H5(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#i()}if(this.allowStale=!!$,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!q,this.updateAgeOnHas=!!Y,this.ttlResolution=H5(X)||X===0?X:1,this.ttlAutopurge=!!x,this.ttl=Q||0,this.ttl){if(!H5(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#v()}if(this.#Z===0&&this.ttl===0&&this.#X===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Z&&!this.#X){if(ua("LRU_CACHE_UNBOUNDED"))fN.add("LRU_CACHE_UNBOUNDED"),kN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",U7)}}getRemainingTTL(Z){return this.#W.has(Z)?1/0:0}#v(){let Z=new wJ(this.#Z),J=new wJ(this.#Z);this.#H=Z,this.#L=J;let Q=this.ttlAutopurge?new Array(this.#Z):void 0;this.#D=Q,this.#b=(q,Y,$=this.#V.now())=>{if(J[q]=Y!==0?$:0,Z[q]=Y,Q?.[q])clearTimeout(Q[q]),Q[q]=void 0;if(Y!==0&&Q){let z=setTimeout(()=>{if(this.#C(q))this.#R(this.#K[q],"expire")},Y+1);if(z.unref)z.unref();Q[q]=z}},this.#S=(q)=>{J[q]=Z[q]!==0?this.#V.now():0},this.#A=(q,Y)=>{if(Z[Y]){let $=Z[Y],z=J[Y];if(!$||!z)return;q.ttl=$,q.start=z,q.now=X||x();let W=q.now-z;q.remainingTTL=$-W}};let X=0,x=()=>{let q=this.#V.now();if(this.ttlResolution>0){X=q;let Y=setTimeout(()=>X=0,this.ttlResolution);if(Y.unref)Y.unref()}return q};this.getRemainingTTL=(q)=>{let Y=this.#W.get(q);if(Y===void 0)return 0;let $=Z[Y],z=J[Y];if(!$||!z)return 1/0;let W=(X||x())-z;return $-W},this.#C=(q)=>{let Y=J[q],$=Z[q];return!!$&&!!Y&&(X||x())-Y>$}}#S=()=>{};#A=()=>{};#b=()=>{};#C=()=>!1;#i(){let Z=new wJ(this.#Z);this.#U=0,this.#P=Z,this.#c=(J)=>{this.#U-=Z[J],Z[J]=0},this.#p=(J,Q,X,x)=>{if(this.#z(Q))return 0;if(!H5(X))if(x){if(typeof x!=="function")throw new TypeError("sizeCalculation must be a function");if(X=x(Q,J),!H5(X))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 X},this.#f=(J,Q,X)=>{if(Z[J]=Q,this.#X){let x=this.#X-Z[J];while(this.#U>x)this.#u(!0)}if(this.#U+=Z[J],X)X.entrySize=Q,X.totalCalculatedSize=this.#U}}#c=(Z)=>{};#f=(Z,J,Q)=>{};#p=(Z,J,Q,X)=>{if(Q||X)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#I({allowStale:Z=this.allowStale}={}){if(this.#$)for(let J=this.#B;;){if(!this.#y(J))break;if(Z||!this.#C(J))yield J;if(J===this.#G)break;else J=this.#_[J]}}*#T({allowStale:Z=this.allowStale}={}){if(this.#$)for(let J=this.#G;;){if(!this.#y(J))break;if(Z||!this.#C(J))yield J;if(J===this.#B)break;else J=this.#N[J]}}#y(Z){return Z!==void 0&&this.#W.get(this.#K[Z])===Z}*entries(){for(let Z of this.#I())if(this.#q[Z]!==void 0&&this.#K[Z]!==void 0&&!this.#z(this.#q[Z]))yield[this.#K[Z],this.#q[Z]]}*rentries(){for(let Z of this.#T())if(this.#q[Z]!==void 0&&this.#K[Z]!==void 0&&!this.#z(this.#q[Z]))yield[this.#K[Z],this.#q[Z]]}*keys(){for(let Z of this.#I()){let J=this.#K[Z];if(J!==void 0&&!this.#z(this.#q[Z]))yield J}}*rkeys(){for(let Z of this.#T()){let J=this.#K[Z];if(J!==void 0&&!this.#z(this.#q[Z]))yield J}}*values(){for(let Z of this.#I())if(this.#q[Z]!==void 0&&!this.#z(this.#q[Z]))yield this.#q[Z]}*rvalues(){for(let Z of this.#T())if(this.#q[Z]!==void 0&&!this.#z(this.#q[Z]))yield this.#q[Z]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Z,J={}){for(let Q of this.#I()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;if(Z(x,this.#K[Q],this))return this.get(this.#K[Q],J)}}forEach(Z,J=this){for(let Q of this.#I()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;Z.call(J,x,this.#K[Q],this)}}rforEach(Z,J=this){for(let Q of this.#T()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;Z.call(J,x,this.#K[Q],this)}}purgeStale(){let Z=!1;for(let J of this.#T({allowStale:!0}))if(this.#C(J))this.#R(this.#K[J],"expire"),Z=!0;return Z}info(Z){let J=this.#W.get(Z);if(J===void 0)return;let Q=this.#q[J],X=this.#z(Q)?Q.__staleWhileFetching:Q;if(X===void 0)return;let x={value:X};if(this.#H&&this.#L){let q=this.#H[J],Y=this.#L[J];if(q&&Y){let $=q-(this.#V.now()-Y);x.ttl=$,x.start=Date.now()}}if(this.#P)x.size=this.#P[J];return x}dump(){let Z=[];for(let J of this.#I({allowStale:!0})){let Q=this.#K[J],X=this.#q[J],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0||Q===void 0)continue;let q={value:x};if(this.#H&&this.#L){q.ttl=this.#H[J];let Y=this.#V.now()-this.#L[J];q.start=Math.floor(Date.now()-Y)}if(this.#P)q.size=this.#P[J];Z.unshift([Q,q])}return Z}load(Z){this.clear();for(let[J,Q]of Z){if(Q.start){let X=Date.now()-Q.start;Q.start=this.#V.now()-X}this.set(J,Q.value,Q)}}set(Z,J,Q={}){if(J===void 0)return this.delete(Z),this;let{ttl:X=this.ttl,start:x,noDisposeOnSet:q=this.noDisposeOnSet,sizeCalculation:Y=this.sizeCalculation,status:$}=Q,{noUpdateTTL:z=this.noUpdateTTL}=Q,W=this.#p(Z,J,Q.size||0,Y);if(this.maxEntrySize&&W>this.maxEntrySize){if($)$.set="miss",$.maxEntrySizeExceeded=!0;return this.#R(Z,"set"),this}let U=this.#$===0?void 0:this.#W.get(Z);if(U===void 0){if(U=this.#$===0?this.#B:this.#O.length!==0?this.#O.pop():this.#$===this.#Z?this.#u(!1):this.#$,this.#K[U]=Z,this.#q[U]=J,this.#W.set(Z,U),this.#N[this.#B]=U,this.#_[U]=this.#B,this.#B=U,this.#$++,this.#f(U,W,$),$)$.set="add";if(z=!1,this.#E)this.#J?.(J,Z,"add")}else{this.#k(U);let H=this.#q[U];if(J!==H){if(this.#m&&this.#z(H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:B}=H;if(B!==void 0&&!q){if(this.#w)this.#x?.(B,Z,"set");if(this.#Q)this.#M?.push([B,Z,"set"])}}else if(!q){if(this.#w)this.#x?.(H,Z,"set");if(this.#Q)this.#M?.push([H,Z,"set"])}if(this.#c(U),this.#f(U,W,$),this.#q[U]=J,$){$.set="replace";let B=H&&this.#z(H)?H.__staleWhileFetching:H;if(B!==void 0)$.oldValue=B}}else if($)$.set="update";if(this.#E)this.onInsert?.(J,Z,J===H?"update":"replace")}if(X!==0&&!this.#H)this.#v();if(this.#H){if(!z)this.#b(U,X,x);if($)this.#A($,U)}if(!q&&this.#Q&&this.#M){let H=this.#M,B;while(B=H?.shift())this.#Y?.(...B)}return this}pop(){try{while(this.#$){let Z=this.#q[this.#G];if(this.#u(!0),this.#z(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#Q&&this.#M){let Z=this.#M,J;while(J=Z?.shift())this.#Y?.(...J)}}}#u(Z){let J=this.#G,Q=this.#K[J],X=this.#q[J];if(this.#m&&this.#z(X))X.__abortController.abort(new Error("evicted"));else if(this.#w||this.#Q){if(this.#w)this.#x?.(X,Q,"evict");if(this.#Q)this.#M?.push([X,Q,"evict"])}if(this.#c(J),this.#D?.[J])clearTimeout(this.#D[J]),this.#D[J]=void 0;if(Z)this.#K[J]=void 0,this.#q[J]=void 0,this.#O.push(J);if(this.#$===1)this.#G=this.#B=0,this.#O.length=0;else this.#G=this.#N[J];return this.#W.delete(Q),this.#$--,J}has(Z,J={}){let{updateAgeOnHas:Q=this.updateAgeOnHas,status:X}=J,x=this.#W.get(Z);if(x!==void 0){let q=this.#q[x];if(this.#z(q)&&q.__staleWhileFetching===void 0)return!1;if(!this.#C(x)){if(Q)this.#S(x);if(X)X.has="hit",this.#A(X,x);return!0}else if(X)X.has="stale",this.#A(X,x)}else if(X)X.has="miss";return!1}peek(Z,J={}){let{allowStale:Q=this.allowStale}=J,X=this.#W.get(Z);if(X===void 0||!Q&&this.#C(X))return;let x=this.#q[X];return this.#z(x)?x.__staleWhileFetching:x}#h(Z,J,Q,X){let x=J===void 0?void 0:this.#q[J];if(this.#z(x))return x;let q=new px,{signal:Y}=Q;Y?.addEventListener("abort",()=>q.abort(Y.reason),{signal:q.signal});let $={signal:q.signal,options:Q,context:X},z=(D,N=!1)=>{let{aborted:_}=q.signal,j=Q.ignoreFetchAbort&&D!==void 0;if(Q.status)if(_&&!N){if(Q.status.fetchAborted=!0,Q.status.fetchError=q.signal.reason,j)Q.status.fetchAbortIgnored=!0}else Q.status.fetchResolved=!0;if(_&&!j&&!N)return U(q.signal.reason);let O=B,A=this.#q[J];if(A===B||j&&N&&A===void 0)if(D===void 0)if(O.__staleWhileFetching!==void 0)this.#q[J]=O.__staleWhileFetching;else this.#R(Z,"fetch");else{if(Q.status)Q.status.fetchUpdated=!0;this.set(Z,D,$.options)}return D},W=(D)=>{if(Q.status)Q.status.fetchRejected=!0,Q.status.fetchError=D;return U(D)},U=(D)=>{let{aborted:N}=q.signal,_=N&&Q.allowStaleOnFetchAbort,j=_||Q.allowStaleOnFetchRejection,O=j||Q.noDeleteOnFetchRejection,A=B;if(this.#q[J]===B){if(!O||A.__staleWhileFetching===void 0)this.#R(Z,"fetch");else if(!_)this.#q[J]=A.__staleWhileFetching}if(j){if(Q.status&&A.__staleWhileFetching!==void 0)Q.status.returnedStale=!0;return A.__staleWhileFetching}else if(A.__returned===A)throw D},H=(D,N)=>{let _=this.#j?.(Z,x,$);if(_&&_ instanceof Promise)_.then((j)=>D(j===void 0?void 0:j),N);q.signal.addEventListener("abort",()=>{if(!Q.ignoreFetchAbort||Q.allowStaleOnFetchAbort){if(D(void 0),Q.allowStaleOnFetchAbort)D=(j)=>z(j,!0)}})};if(Q.status)Q.status.fetchDispatched=!0;let B=new Promise(H).then(z,W),M=Object.assign(B,{__abortController:q,__staleWhileFetching:x,__returned:void 0});if(J===void 0)this.set(Z,M,{...$.options,status:void 0}),J=this.#W.get(Z);else this.#q[J]=M;return M}#z(Z){if(!this.#m)return!1;let J=Z;return!!J&&J instanceof Promise&&J.hasOwnProperty("__staleWhileFetching")&&J.__abortController instanceof px}async fetch(Z,J={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:X=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,ttl:q=this.ttl,noDisposeOnSet:Y=this.noDisposeOnSet,size:$=0,sizeCalculation:z=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:U=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:H=this.allowStaleOnFetchRejection,ignoreFetchAbort:B=this.ignoreFetchAbort,allowStaleOnFetchAbort:M=this.allowStaleOnFetchAbort,context:D,forceRefresh:N=!1,status:_,signal:j}=J;if(!this.#m){if(_)_.fetch="get";return this.get(Z,{allowStale:Q,updateAgeOnGet:X,noDeleteOnStaleGet:x,status:_})}let O={allowStale:Q,updateAgeOnGet:X,noDeleteOnStaleGet:x,ttl:q,noDisposeOnSet:Y,size:$,sizeCalculation:z,noUpdateTTL:W,noDeleteOnFetchRejection:U,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:M,ignoreFetchAbort:B,status:_,signal:j},A=this.#W.get(Z);if(A===void 0){if(_)_.fetch="miss";let h=this.#h(Z,A,O,D);return h.__returned=h}else{let h=this.#q[A];if(this.#z(h)){let R=Q&&h.__staleWhileFetching!==void 0;if(_){if(_.fetch="inflight",R)_.returnedStale=!0}return R?h.__staleWhileFetching:h.__returned=h}let u=this.#C(A);if(!N&&!u){if(_)_.fetch="hit";if(this.#k(A),X)this.#S(A);if(_)this.#A(_,A);return h}let e=this.#h(Z,A,O,D),m=e.__staleWhileFetching!==void 0&&Q;if(_){if(_.fetch=u?"stale":"refresh",m&&u)_.returnedStale=!0}return m?e.__staleWhileFetching:e.__returned=e}}async forceFetch(Z,J={}){let Q=await this.fetch(Z,J);if(Q===void 0)throw new Error("fetch() returned undefined");return Q}memo(Z,J={}){let Q=this.#F;if(!Q)throw new Error("no memoMethod provided to constructor");let{context:X,forceRefresh:x,...q}=J,Y=this.get(Z,q);if(!x&&Y!==void 0)return Y;let $=Q(Z,Y,{options:q,context:X});return this.set(Z,$,q),$}get(Z,J={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:X=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,status:q}=J,Y=this.#W.get(Z);if(Y!==void 0){let $=this.#q[Y],z=this.#z($);if(q)this.#A(q,Y);if(this.#C(Y)){if(q)q.get="stale";if(!z){if(!x)this.#R(Z,"expire");if(q&&Q)q.returnedStale=!0;return Q?$:void 0}else{if(q&&Q&&$.__staleWhileFetching!==void 0)q.returnedStale=!0;return Q?$.__staleWhileFetching:void 0}}else{if(q)q.get="hit";if(z)return $.__staleWhileFetching;if(this.#k(Y),X)this.#S(Y);return $}}else if(q)q.get="miss"}#g(Z,J){this.#_[J]=Z,this.#N[Z]=J}#k(Z){if(Z!==this.#B){if(Z===this.#G)this.#G=this.#N[Z];else this.#g(this.#_[Z],this.#N[Z]);this.#g(this.#B,Z),this.#B=Z}}delete(Z){return this.#R(Z,"delete")}#R(Z,J){let Q=!1;if(this.#$!==0){let X=this.#W.get(Z);if(X!==void 0){if(this.#D?.[X])clearTimeout(this.#D?.[X]),this.#D[X]=void 0;if(Q=!0,this.#$===1)this.#d(J);else{this.#c(X);let x=this.#q[X];if(this.#z(x))x.__abortController.abort(new Error("deleted"));else if(this.#w||this.#Q){if(this.#w)this.#x?.(x,Z,J);if(this.#Q)this.#M?.push([x,Z,J])}if(this.#W.delete(Z),this.#K[X]=void 0,this.#q[X]=void 0,X===this.#B)this.#B=this.#_[X];else if(X===this.#G)this.#G=this.#N[X];else{let q=this.#_[X];this.#N[q]=this.#N[X];let Y=this.#N[X];this.#_[Y]=this.#_[X]}this.#$--,this.#O.push(X)}}}if(this.#Q&&this.#M?.length){let X=this.#M,x;while(x=X?.shift())this.#Y?.(...x)}return Q}clear(){return this.#d("delete")}#d(Z){for(let J of this.#T({allowStale:!0})){let Q=this.#q[J];if(this.#z(Q))Q.__abortController.abort(new Error("deleted"));else{let X=this.#K[J];if(this.#w)this.#x?.(Q,X,Z);if(this.#Q)this.#M?.push([Q,X,Z])}}if(this.#W.clear(),this.#q.fill(void 0),this.#K.fill(void 0),this.#H&&this.#L){this.#H.fill(0),this.#L.fill(0);for(let J of this.#D??[])if(J!==void 0)clearTimeout(J);this.#D?.fill(void 0)}if(this.#P)this.#P.fill(0);if(this.#G=0,this.#B=0,this.#O.length=0,this.#U=0,this.#$=0,this.#Q&&this.#M){let J=this.#M,Q;while(Q=J?.shift())this.#Y?.(...Q)}}}import{posix as ta,win32 as bz}from"node:path";import{fileURLToPath as ea}from"node:url";import{lstatSync as Zr,readdir as Jr,readdirSync as Qr,readlinkSync as Xr,realpathSync as xr}from"fs";import*as qr from"node:fs";import{lstat as $r,readdir as Kr,readlink as zr,realpath as Wr}from"node:fs/promises";import{EventEmitter as Ez}from"node:events";import hN from"node:stream";import{StringDecoder as ha}from"node:string_decoder";var bN=typeof process==="object"&&process?process:{stdout:null,stderr:null},ga=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof G7||Z instanceof hN||ia(Z)||da(Z)),ia=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof Ez&&typeof Z.pipe==="function"&&Z.pipe!==hN.Writable.prototype.pipe,da=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof Ez&&typeof Z.write==="function"&&typeof Z.end==="function",R6=Symbol("EOF"),I6=Symbol("maybeEmitEnd"),G5=Symbol("emittedEnd"),yx=Symbol("emittingEnd"),_J=Symbol("emittedError"),ux=Symbol("closed"),pN=Symbol("read"),hx=Symbol("flush"),yN=Symbol("flushChunk"),N8=Symbol("encoding"),I9=Symbol("decoder"),e2=Symbol("flowing"),PJ=Symbol("paused"),T9=Symbol("resume"),Z4=Symbol("buffer"),c4=Symbol("pipes"),J4=Symbol("bufferLength"),Rz=Symbol("bufferPush"),gx=Symbol("bufferShift"),j4=Symbol("objectMode"),m2=Symbol("destroyed"),Iz=Symbol("error"),Tz=Symbol("emitData"),uN=Symbol("emitEnd"),vz=Symbol("emitEnd2"),h8=Symbol("async"),Az=Symbol("abort"),ix=Symbol("aborted"),jJ=Symbol("signal"),H7=Symbol("dataListeners"),P3=Symbol("discarded"),LJ=(Z)=>Promise.resolve().then(Z),la=(Z)=>Z(),oa=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",sa=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,na=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class fz{src;dest;opts;ondrain;constructor(Z,J,Q){this.src=Z,this.dest=J,this.opts=Q,this.ondrain=()=>Z[T9](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Z){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class gN extends fz{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Z,J,Q){super(Z,J,Q);this.proxyErrors=(X)=>J.emit("error",X),Z.on("error",this.proxyErrors)}}var aa=(Z)=>!!Z.objectMode,ra=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class G7 extends Ez{[e2]=!1;[PJ]=!1;[c4]=[];[Z4]=[];[j4];[N8];[h8];[I9];[R6]=!1;[G5]=!1;[yx]=!1;[ux]=!1;[_J]=null;[J4]=0;[m2]=!1;[jJ];[ix]=!1;[H7]=0;[P3]=!1;writable=!0;readable=!0;constructor(...Z){let J=Z[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(aa(J))this[j4]=!0,this[N8]=null;else if(ra(J))this[N8]=J.encoding,this[j4]=!1;else this[j4]=!1,this[N8]=null;if(this[h8]=!!J.async,this[I9]=this[N8]?new ha(this[N8]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[Z4]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[c4]});let{signal:Q}=J;if(Q)if(this[jJ]=Q,Q.aborted)this[Az]();else Q.addEventListener("abort",()=>this[Az]())}get bufferLength(){return this[J4]}get encoding(){return this[N8]}set encoding(Z){throw new Error("Encoding must be set at instantiation time")}setEncoding(Z){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[j4]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[h8]}set["async"](Z){this[h8]=this[h8]||!!Z}[Az](){this[ix]=!0,this.emit("abort",this[jJ]?.reason),this.destroy(this[jJ]?.reason)}get aborted(){return this[ix]}set aborted(Z){}write(Z,J,Q){if(this[ix])return!1;if(this[R6])throw new Error("write after end");if(this[m2])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")Q=J,J="utf8";if(!J)J="utf8";let X=this[h8]?LJ:la;if(!this[j4]&&!Buffer.isBuffer(Z)){if(na(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(sa(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[j4]){if(this[e2]&&this[J4]!==0)this[hx](!0);if(this[e2])this.emit("data",Z);else this[Rz](Z);if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}if(!Z.length){if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}if(typeof Z==="string"&&!(J===this[N8]&&!this[I9]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[N8])Z=this[I9].write(Z);if(this[e2]&&this[J4]!==0)this[hx](!0);if(this[e2])this.emit("data",Z);else this[Rz](Z);if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}read(Z){if(this[m2])return null;if(this[P3]=!1,this[J4]===0||Z===0||Z&&Z>this[J4])return this[I6](),null;if(this[j4])Z=null;if(this[Z4].length>1&&!this[j4])this[Z4]=[this[N8]?this[Z4].join(""):Buffer.concat(this[Z4],this[J4])];let J=this[pN](Z||null,this[Z4][0]);return this[I6](),J}[pN](Z,J){if(this[j4])this[gx]();else{let Q=J;if(Z===Q.length||Z===null)this[gx]();else if(typeof Q==="string")this[Z4][0]=Q.slice(Z),J=Q.slice(0,Z),this[J4]-=Z;else this[Z4][0]=Q.subarray(Z),J=Q.subarray(0,Z),this[J4]-=Z}if(this.emit("data",J),!this[Z4].length&&!this[R6])this.emit("drain");return J}end(Z,J,Q){if(typeof Z==="function")Q=Z,Z=void 0;if(typeof J==="function")Q=J,J="utf8";if(Z!==void 0)this.write(Z,J);if(Q)this.once("end",Q);if(this[R6]=!0,this.writable=!1,this[e2]||!this[PJ])this[I6]();return this}[T9](){if(this[m2])return;if(!this[H7]&&!this[c4].length)this[P3]=!0;if(this[PJ]=!1,this[e2]=!0,this.emit("resume"),this[Z4].length)this[hx]();else if(this[R6])this[I6]();else this.emit("drain")}resume(){return this[T9]()}pause(){this[e2]=!1,this[PJ]=!0,this[P3]=!1}get destroyed(){return this[m2]}get flowing(){return this[e2]}get paused(){return this[PJ]}[Rz](Z){if(this[j4])this[J4]+=1;else this[J4]+=Z.length;this[Z4].push(Z)}[gx](){if(this[j4])this[J4]-=1;else this[J4]-=this[Z4][0].length;return this[Z4].shift()}[hx](Z=!1){do;while(this[yN](this[gx]())&&this[Z4].length);if(!Z&&!this[Z4].length&&!this[R6])this.emit("drain")}[yN](Z){return this.emit("data",Z),this[e2]}pipe(Z,J){if(this[m2])return Z;this[P3]=!1;let Q=this[G5];if(J=J||{},Z===bN.stdout||Z===bN.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,Q){if(J.end)Z.end()}else if(this[c4].push(!J.proxyErrors?new fz(this,Z,J):new gN(this,Z,J)),this[h8])LJ(()=>this[T9]());else this[T9]();return Z}unpipe(Z){let J=this[c4].find((Q)=>Q.dest===Z);if(J){if(this[c4].length===1){if(this[e2]&&this[H7]===0)this[e2]=!1;this[c4]=[]}else this[c4].splice(this[c4].indexOf(J),1);J.unpipe()}}addListener(Z,J){return this.on(Z,J)}on(Z,J){let Q=super.on(Z,J);if(Z==="data"){if(this[P3]=!1,this[H7]++,!this[c4].length&&!this[e2])this[T9]()}else if(Z==="readable"&&this[J4]!==0)super.emit("readable");else if(oa(Z)&&this[G5])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[_J]){let X=J;if(this[h8])LJ(()=>X.call(this,this[_J]));else X.call(this,this[_J])}return Q}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let Q=super.off(Z,J);if(Z==="data"){if(this[H7]=this.listeners("data").length,this[H7]===0&&!this[P3]&&!this[c4].length)this[e2]=!1}return Q}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[H7]=0,!this[P3]&&!this[c4].length)this[e2]=!1}return J}get emittedEnd(){return this[G5]}[I6](){if(!this[yx]&&!this[G5]&&!this[m2]&&this[Z4].length===0&&this[R6]){if(this[yx]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ux])this.emit("close");this[yx]=!1}}emit(Z,...J){let Q=J[0];if(Z!=="error"&&Z!=="close"&&Z!==m2&&this[m2])return!1;else if(Z==="data")return!this[j4]&&!Q?!1:this[h8]?(LJ(()=>this[Tz](Q)),!0):this[Tz](Q);else if(Z==="end")return this[uN]();else if(Z==="close"){if(this[ux]=!0,!this[G5]&&!this[m2])return!1;let x=super.emit("close");return this.removeAllListeners("close"),x}else if(Z==="error"){this[_J]=Q,super.emit(Iz,Q);let x=!this[jJ]||this.listeners("error").length?super.emit("error",Q):!1;return this[I6](),x}else if(Z==="resume"){let x=super.emit("resume");return this[I6](),x}else if(Z==="finish"||Z==="prefinish"){let x=super.emit(Z);return this.removeAllListeners(Z),x}let X=super.emit(Z,...J);return this[I6](),X}[Tz](Z){for(let Q of this[c4])if(Q.dest.write(Z)===!1)this.pause();let J=this[P3]?!1:super.emit("data",Z);return this[I6](),J}[uN](){if(this[G5])return!1;return this[G5]=!0,this.readable=!1,this[h8]?(LJ(()=>this[vz]()),!0):this[vz]()}[vz](){if(this[I9]){let J=this[I9].end();if(J){for(let Q of this[c4])Q.dest.write(J);if(!this[P3])super.emit("data",J)}}for(let J of this[c4])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[j4])Z.dataLength=0;let J=this.promise();return this.on("data",(Q)=>{if(Z.push(Q),!this[j4])Z.dataLength+=Q.length}),await J,Z}async concat(){if(this[j4])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[N8]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(m2,()=>J(new Error("stream destroyed"))),this.on("error",(Q)=>J(Q)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[P3]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[R6])return J();let x,q,Y=(U)=>{this.off("data",$),this.off("end",z),this.off(m2,W),J(),q(U)},$=(U)=>{this.off("error",Y),this.off("end",z),this.off(m2,W),this.pause(),x({value:U,done:!!this[R6]})},z=()=>{this.off("error",Y),this.off("data",$),this.off(m2,W),J(),x({done:!0,value:void 0})},W=()=>Y(new Error("stream destroyed"));return new Promise((U,H)=>{q=H,x=U,this.once(m2,W),this.once("error",Y),this.once("end",z),this.once("data",$)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[P3]=!1;let Z=!1,J=()=>{return this.pause(),this.off(Iz,J),this.off(m2,J),this.off("end",J),Z=!0,{done:!0,value:void 0}},Q=()=>{if(Z)return J();let X=this.read();return X===null?J():{done:!1,value:X}};return this.once("end",J),this.once(Iz,J),this.once(m2,J),{next:Q,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[m2]){if(Z)this.emit("error",Z);else this.emit(m2);return this}this[m2]=!0,this[P3]=!0,this[Z4].length=0,this[J4]=0;let J=this;if(typeof J.close==="function"&&!this[ux])J.close();if(Z)this.emit("error",Z);else this.emit(m2);return this}static get isStream(){return ga}}var Yr=xr.native,OJ={lstatSync:Zr,readdir:Jr,readdirSync:Qr,readlinkSync:Xr,realpathSync:Yr,promises:{lstat:$r,readdir:Kr,readlink:zr,realpath:Wr}},sN=(Z)=>!Z||Z===OJ||Z===qr?OJ:{...OJ,...Z,promises:{...OJ.promises,...Z.promises||{}}},nN=/^\\\\\?\\([a-z]:)\\?$/i,Vr=(Z)=>Z.replace(/\//g,"\\").replace(nN,"$1\\"),Ur=/[\\\/]/,o3=0,aN=1,rN=2,g8=4,tN=6,eN=8,B7=10,Zw=12,l3=15,CJ=~l3,kz=16,iN=32,mJ=64,w8=128,dx=256,ox=512,dN=mJ|w8|ox,Hr=1023,cz=(Z)=>Z.isFile()?eN:Z.isDirectory()?g8:Z.isSymbolicLink()?B7:Z.isCharacterDevice()?rN:Z.isBlockDevice()?tN:Z.isSocket()?Zw:Z.isFIFO()?aN:o3,lN=new U7({max:4096}),SJ=(Z)=>{let J=lN.get(Z);if(J)return J;let Q=Z.normalize("NFKD");return lN.set(Z,Q),Q},oN=new U7({max:4096}),lx=(Z)=>{let J=oN.get(Z);if(J)return J;let Q=SJ(Z.toLowerCase());return oN.set(Z,Q),Q};class pz extends U7{constructor(){super({max:256})}}class Jw extends U7{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var Qw=Symbol("PathScurry setAsCwd");class b4{name;root;roots;parent;nocase;isCWD=!1;#Z;#X;get dev(){return this.#X}#x;get mode(){return this.#x}#J;get nlink(){return this.#J}#Y;get uid(){return this.#Y}#j;get gid(){return this.#j}#F;get rdev(){return this.#F}#V;get blksize(){return this.#V}#$;get ino(){return this.#$}#U;get size(){return this.#U}#W;get blocks(){return this.#W}#K;get atimeMs(){return this.#K}#q;get mtimeMs(){return this.#q}#N;get ctimeMs(){return this.#N}#_;get birthtimeMs(){return this.#_}#G;get atime(){return this.#G}#B;get mtime(){return this.#B}#O;get ctime(){return this.#O}#M;get birthtime(){return this.#M}#P;#L;#H;#D;#w;#m;#Q;#E;#v;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=o3,Q,X,x,q,Y){if(this.name=Z,this.#P=x?lx(Z):SJ(Z),this.#Q=J&Hr,this.nocase=x,this.roots=X,this.root=Q||this,this.#E=q,this.#H=Y.fullpath,this.#w=Y.relative,this.#m=Y.relativePosix,this.parent=Y.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=sN(Y.fs)}depth(){if(this.#L!==void 0)return this.#L;if(!this.parent)return this.#L=0;return this.#L=this.parent.depth()+1}childrenCache(){return this.#E}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),X=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#A(X):this.#A(X)}#A(Z){let J=this;for(let Q of Z)J=J.child(Q);return J}children(){let Z=this.#E.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#E.set(this,J),this.#Q&=~kz,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let Q=this.children(),X=this.nocase?lx(Z):SJ(Z);for(let $ of Q)if($.#P===X)return $;let x=this.parent?this.sep:"",q=this.#H?this.#H+x+Z:void 0,Y=this.newChild(Z,o3,{...J,parent:this,fullpath:q});if(!this.canReaddir())Y.#Q|=w8;return Q.push(Y),Y}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let Z=this.name,J=this.parent;if(!J)return this.#w=this.name;let Q=J.relative();return Q+(!Q||!J.parent?"":this.sep)+Z}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#m!==void 0)return this.#m;let Z=this.name,J=this.parent;if(!J)return this.#m=this.fullpathPosix();let Q=J.relativePosix();return Q+(!Q||!J.parent?"":"/")+Z}fullpath(){if(this.#H!==void 0)return this.#H;let Z=this.name,J=this.parent;if(!J)return this.#H=this.name;let X=J.fullpath()+(!J.parent?"":this.sep)+Z;return this.#H=X}fullpathPosix(){if(this.#D!==void 0)return this.#D;if(this.sep==="/")return this.#D=this.fullpath();if(!this.parent){let X=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(X))return this.#D=`//?/${X}`;else return this.#D=X}let Z=this.parent,J=Z.fullpathPosix(),Q=J+(!J||!Z.parent?"":"/")+this.name;return this.#D=Q}isUnknown(){return(this.#Q&l3)===o3}isType(Z){return this[`is${Z}`]()}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.#Q&l3)===eN}isDirectory(){return(this.#Q&l3)===g8}isCharacterDevice(){return(this.#Q&l3)===rN}isBlockDevice(){return(this.#Q&l3)===tN}isFIFO(){return(this.#Q&l3)===aN}isSocket(){return(this.#Q&l3)===Zw}isSymbolicLink(){return(this.#Q&B7)===B7}lstatCached(){return this.#Q&iN?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let Z=this.#Q&l3;return!(Z!==o3&&Z!==B7||this.#Q&dx||this.#Q&w8)}calledReaddir(){return!!(this.#Q&kz)}isENOENT(){return!!(this.#Q&w8)}isNamed(Z){return!this.nocase?this.#P===SJ(Z):this.#P===lx(Z)}async readlink(){let Z=this.#v;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#Z.promises.readlink(this.fullpath()),Q=(await this.parent.realpath())?.resolve(J);if(Q)return this.#v=Q}catch(J){this.#T(J.code);return}}readlinkSync(){let Z=this.#v;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#Z.readlinkSync(this.fullpath()),Q=this.parent.realpathSync()?.resolve(J);if(Q)return this.#v=Q}catch(J){this.#T(J.code);return}}#b(Z){this.#Q|=kz;for(let J=Z.provisional;J<Z.length;J++){let Q=Z[J];if(Q)Q.#C()}}#C(){if(this.#Q&w8)return;this.#Q=(this.#Q|w8)&CJ,this.#i()}#i(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#C()}#c(){this.#Q|=ox,this.#f()}#f(){if(this.#Q&mJ)return;let Z=this.#Q;if((Z&l3)===g8)Z&=CJ;this.#Q=Z|mJ,this.#i()}#p(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#f();else if(Z==="ENOENT")this.#C();else this.children().provisional=0}#I(Z=""){if(Z==="ENOTDIR")this.parent.#f();else if(Z==="ENOENT")this.#C()}#T(Z=""){let J=this.#Q;if(J|=dx,Z==="ENOENT")J|=w8;if(Z==="EINVAL"||Z==="UNKNOWN")J&=CJ;if(this.#Q=J,Z==="ENOTDIR"&&this.parent)this.parent.#f()}#y(Z,J){return this.#h(Z,J)||this.#u(Z,J)}#u(Z,J){let Q=cz(Z),X=this.newChild(Z.name,Q,{parent:this}),x=X.#Q&l3;if(x!==g8&&x!==B7&&x!==o3)X.#Q|=mJ;return J.unshift(X),J.provisional++,X}#h(Z,J){for(let Q=J.provisional;Q<J.length;Q++){let X=J[Q];if((this.nocase?lx(Z.name):SJ(Z.name))!==X.#P)continue;return this.#z(Z,X,Q,J)}}#z(Z,J,Q,X){let x=J.name;if(J.#Q=J.#Q&CJ|cz(Z),x!==Z.name)J.name=Z.name;if(Q!==X.provisional){if(Q===X.length-1)X.pop();else X.splice(Q,1);X.unshift(J)}return X.provisional++,J}async lstat(){if((this.#Q&w8)===0)try{return this.#g(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#I(Z.code)}}lstatSync(){if((this.#Q&w8)===0)try{return this.#g(this.#Z.lstatSync(this.fullpath())),this}catch(Z){this.#I(Z.code)}}#g(Z){let{atime:J,atimeMs:Q,birthtime:X,birthtimeMs:x,blksize:q,blocks:Y,ctime:$,ctimeMs:z,dev:W,gid:U,ino:H,mode:B,mtime:M,mtimeMs:D,nlink:N,rdev:_,size:j,uid:O}=Z;this.#G=J,this.#K=Q,this.#M=X,this.#_=x,this.#V=q,this.#W=Y,this.#O=$,this.#N=z,this.#X=W,this.#j=U,this.#$=H,this.#x=B,this.#B=M,this.#q=D,this.#J=N,this.#F=_,this.#U=j,this.#Y=O;let A=cz(Z);if(this.#Q=this.#Q&CJ|A|iN,A!==o3&&A!==g8&&A!==B7)this.#Q|=mJ}#k=[];#R=!1;#d(Z){this.#R=!1;let J=this.#k.slice();this.#k.length=0,J.forEach((Q)=>Q(null,Z))}readdirCB(Z,J=!1){if(!this.canReaddir()){if(J)Z(null,[]);else queueMicrotask(()=>Z(null,[]));return}let Q=this.children();if(this.calledReaddir()){let x=Q.slice(0,Q.provisional);if(J)Z(null,x);else queueMicrotask(()=>Z(null,x));return}if(this.#k.push(Z),this.#R)return;this.#R=!0;let X=this.fullpath();this.#Z.readdir(X,{withFileTypes:!0},(x,q)=>{if(x)this.#p(x.code),Q.provisional=0;else{for(let Y of q)this.#y(Y,Q);this.#b(Q)}this.#d(Q.slice(0,Q.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();if(this.#l)await this.#l;else{let Q=()=>{};this.#l=new Promise((X)=>Q=X);try{for(let X of await this.#Z.promises.readdir(J,{withFileTypes:!0}))this.#y(X,Z);this.#b(Z)}catch(X){this.#p(X.code),Z.provisional=0}this.#l=void 0,Q()}return Z.slice(0,Z.provisional)}readdirSync(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();try{for(let Q of this.#Z.readdirSync(J,{withFileTypes:!0}))this.#y(Q,Z);this.#b(Z)}catch(Q){this.#p(Q.code),Z.provisional=0}return Z.slice(0,Z.provisional)}canReaddir(){if(this.#Q&dN)return!1;let Z=l3&this.#Q;if(!(Z===o3||Z===g8||Z===B7))return!1;return!0}shouldWalk(Z,J){return(this.#Q&g8)===g8&&!(this.#Q&dN)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((ox|dx|w8)&this.#Q)return;try{let Z=await this.#Z.promises.realpath(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#c()}}realpathSync(){if(this.#S)return this.#S;if((ox|dx|w8)&this.#Q)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#c()}}[Qw](Z){if(Z===this)return;Z.isCWD=!1,this.isCWD=!0;let J=new Set([]),Q=[],X=this;while(X&&X.parent)J.add(X),X.#w=Q.join(this.sep),X.#m=Q.join("/"),X=X.parent,Q.push("..");X=Z;while(X&&X.parent&&!J.has(X))X.#w=void 0,X.#m=void 0,X=X.parent}}class sx extends b4{sep="\\";splitSep=Ur;constructor(Z,J=o3,Q,X,x,q,Y){super(Z,J,Q,X,x,q,Y)}newChild(Z,J=o3,Q={}){return new sx(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),Q)}getRootString(Z){return bz.parse(Z).root}getRoot(Z){if(Z=Vr(Z.toUpperCase()),Z===this.root.name)return this.root;for(let[J,Q]of Object.entries(this.roots))if(this.sameRoot(Z,J))return this.roots[Z]=Q;return this.roots[Z]=new RJ(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(nN,"$1\\"),Z===J}}class nx extends b4{splitSep="/";sep="/";constructor(Z,J=o3,Q,X,x,q,Y){super(Z,J,Q,X,x,q,Y)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=o3,Q={}){return new nx(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),Q)}}class yz{root;rootPath;roots;cwd;#Z;#X;#x;nocase;#J;constructor(Z=process.cwd(),J,Q,{nocase:X,childrenCacheSize:x=16384,fs:q=OJ}={}){if(this.#J=sN(q),Z instanceof URL||Z.startsWith("file://"))Z=ea(Z);let Y=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(Y),this.#Z=new pz,this.#X=new pz,this.#x=new Jw(x);let $=Y.substring(this.rootPath.length).split(Q);if($.length===1&&!$[0])$.pop();if(X===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=X,this.root=this.newRoot(this.#J),this.roots[this.rootPath]=this.root;let z=this.root,W=$.length-1,U=J.sep,H=this.rootPath,B=!1;for(let M of $){let D=W--;z=z.child(M,{relative:new Array(D).fill("..").join(U),relativePosix:new Array(D).fill("..").join("/"),fullpath:H+=(B?"":U)+M}),B=!0}this.cwd=z}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#x}resolve(...Z){let J="";for(let x=Z.length-1;x>=0;x--){let q=Z[x];if(!q||q===".")continue;if(J=J?`${q}/${J}`:q,this.isAbsolute(q))break}let Q=this.#Z.get(J);if(Q!==void 0)return Q;let X=this.cwd.resolve(J).fullpath();return this.#Z.set(J,X),X}resolvePosix(...Z){let J="";for(let x=Z.length-1;x>=0;x--){let q=Z[x];if(!q||q===".")continue;if(J=J?`${q}/${J}`:q,this.isAbsolute(q))break}let Q=this.#X.get(J);if(Q!==void 0)return Q;let X=this.cwd.resolve(J).fullpathPosix();return this.#X.set(J,X),X}relative(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relative()}relativePosix(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relativePosix()}basename(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.name}dirname(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return(Z.parent||Z).fullpath()}async readdir(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q}=J;if(!Z.canReaddir())return[];else{let X=await Z.readdir();return Q?X:X.map((x)=>x.name)}}readdirSync(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0}=J;if(!Z.canReaddir())return[];else if(Q)return Z.readdirSync();else return Z.readdirSync().map((X)=>X.name)}async lstat(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstat()}lstatSync(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstatSync()}async readlink(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=await Z.readlink();return J?Q:Q?.fullpath()}readlinkSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=Z.readlinkSync();return J?Q:Q?.fullpath()}async realpath(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=await Z.realpath();return J?Q:Q?.fullpath()}realpathSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=Z.realpathSync();return J?Q:Q?.fullpath()}async walk(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=[];if(!x||x(Z))Y.push(Q?Z:Z.fullpath());let $=new Set,z=(U,H)=>{$.add(U),U.readdirCB((B,M)=>{if(B)return H(B);let D=M.length;if(!D)return H();let N=()=>{if(--D===0)H()};for(let _ of M){if(!x||x(_))Y.push(Q?_:_.fullpath());if(X&&_.isSymbolicLink())_.realpath().then((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk($,q)?z(j,N):N());else if(_.shouldWalk($,q))z(_,N);else N()}},!0)},W=Z;return new Promise((U,H)=>{z(W,(B)=>{if(B)return H(B);U(Y)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=[];if(!x||x(Z))Y.push(Q?Z:Z.fullpath());let $=new Set([Z]);for(let z of $){let W=z.readdirSync();for(let U of W){if(!x||x(U))Y.push(Q?U:U.fullpath());let H=U;if(U.isSymbolicLink()){if(!(X&&(H=U.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk($,q))$.add(H)}}return Y}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;return this.stream(Z,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J;if(!x||x(Z))yield Q?Z:Z.fullpath();let Y=new Set([Z]);for(let $ of Y){let z=$.readdirSync();for(let W of z){if(!x||x(W))yield Q?W:W.fullpath();let U=W;if(W.isSymbolicLink()){if(!(X&&(U=W.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(Y,q))Y.add(U)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=new G7({objectMode:!0});if(!x||x(Z))Y.write(Q?Z:Z.fullpath());let $=new Set,z=[Z],W=0,U=()=>{let H=!1;while(!H){let B=z.shift();if(!B){if(W===0)Y.end();return}W++,$.add(B);let M=(N,_,j=!1)=>{if(N)return Y.emit("error",N);if(X&&!j){let O=[];for(let A of _)if(A.isSymbolicLink())O.push(A.realpath().then((h)=>h?.isUnknown()?h.lstat():h));if(O.length){Promise.all(O).then(()=>M(null,_,!0));return}}for(let O of _)if(O&&(!x||x(O))){if(!Y.write(Q?O:O.fullpath()))H=!0}W--;for(let O of _){let A=O.realpathCached()||O;if(A.shouldWalk($,q))z.push(A)}if(H&&!Y.flowing)Y.once("drain",U);else if(!D)U()},D=!0;B.readdirCB(M,!0),D=!1}};return U(),Y}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=new G7({objectMode:!0}),$=new Set;if(!x||x(Z))Y.write(Q?Z:Z.fullpath());let z=[Z],W=0,U=()=>{let H=!1;while(!H){let B=z.shift();if(!B){if(W===0)Y.end();return}W++,$.add(B);let M=B.readdirSync();for(let D of M)if(!x||x(D)){if(!Y.write(Q?D:D.fullpath()))H=!0}W--;for(let D of M){let N=D;if(D.isSymbolicLink()){if(!(X&&(N=D.realpathSync())))continue;if(N.isUnknown())N.lstatSync()}if(N.shouldWalk($,q))z.push(N)}}if(H&&!Y.flowing)Y.once("drain",U)};return U(),Y}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[Qw](J)}}class RJ extends yz{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:Q=!0}=J;super(Z,bz,"\\",{...J,nocase:Q});this.nocase=Q;for(let X=this.cwd;X;X=X.parent)X.nocase=this.nocase}parseRootPath(Z){return bz.parse(Z).root.toUpperCase()}newRoot(Z){return new sx(this.rootPath,g8,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class IJ extends yz{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:Q=!1}=J;super(Z,ta,"/",{...J,nocase:Q});this.nocase=Q}parseRootPath(Z){return"/"}newRoot(Z){return new nx(this.rootPath,g8,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class ax extends IJ{constructor(Z=process.cwd(),J={}){let{nocase:Q=!0}=J;super(Z,{...J,nocase:Q})}}var Dv0=process.platform==="win32"?sx:nx,Xw=process.platform==="win32"?RJ:process.platform==="darwin"?ax:IJ;var Gr=(Z)=>Z.length>=1,Br=(Z)=>Z.length>=1;class v9{#Z;#X;#x;length;#J;#Y;#j;#F;#V;#$;#U=!0;constructor(Z,J,Q,X){if(!Gr(Z))throw new TypeError("empty pattern list");if(!Br(J))throw new TypeError("empty glob list");if(J.length!==Z.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=Z.length,Q<0||Q>=this.length)throw new TypeError("index out of range");if(this.#Z=Z,this.#X=J,this.#x=Q,this.#J=X,this.#x===0){if(this.isUNC()){let[x,q,Y,$,...z]=this.#Z,[W,U,H,B,...M]=this.#X;if(z[0]==="")z.shift(),M.shift();let D=[x,q,Y,$,""].join("/"),N=[W,U,H,B,""].join("/");this.#Z=[D,...z],this.#X=[N,...M],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[x,...q]=this.#Z,[Y,...$]=this.#X;if(q[0]==="")q.shift(),$.shift();let z=x+"/",W=Y+"/";this.#Z=[z,...q],this.#X=[W,...$],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#x]}isString(){return typeof this.#Z[this.#x]==="string"}isGlobstar(){return this.#Z[this.#x]===O2}isRegExp(){return this.#Z[this.#x]instanceof RegExp}globString(){return this.#j=this.#j||(this.#x===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#x).join("/"))}hasMore(){return this.length>this.#x+1}rest(){if(this.#Y!==void 0)return this.#Y;if(!this.hasMore())return this.#Y=null;return this.#Y=new v9(this.#Z,this.#X,this.#x+1,this.#J),this.#Y.#$=this.#$,this.#Y.#V=this.#V,this.#Y.#F=this.#F,this.#Y}isUNC(){let Z=this.#Z;return this.#V!==void 0?this.#V:this.#V=this.#J==="win32"&&this.#x===0&&Z[0]===""&&Z[1]===""&&typeof Z[2]==="string"&&!!Z[2]&&typeof Z[3]==="string"&&!!Z[3]}isDrive(){let Z=this.#Z;return this.#F!==void 0?this.#F:this.#F=this.#J==="win32"&&this.#x===0&&this.length>1&&typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0])}isAbsolute(){let Z=this.#Z;return this.#$!==void 0?this.#$:this.#$=Z[0]===""&&Z.length>1||this.isDrive()||this.isUNC()}root(){let Z=this.#Z[0];return typeof Z==="string"&&this.isAbsolute()&&this.#x===0?Z:""}checkFollowGlobstar(){return!(this.#x===0||!this.isGlobstar()||!this.#U)}markFollowGlobstar(){if(this.#x===0||!this.isGlobstar()||!this.#U)return!1;return this.#U=!1,!0}}var Mr=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class TJ{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:Q,noext:X,noglobstar:x,platform:q=Mr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=q,this.mmopts={dot:!0,nobrace:J,nocase:Q,noext:X,noglobstar:x,optimizationLevel:2,platform:q,nocomment:!0,nonegate:!0};for(let Y of Z)this.add(Y)}add(Z){let J=new d3(Z,this.mmopts);for(let Q=0;Q<J.set.length;Q++){let X=J.set[Q],x=J.globParts[Q];if(!X||!x)throw new Error("invalid pattern object");while(X[0]==="."&&x[0]===".")X.shift(),x.shift();let q=new v9(X,x,0,this.platform),Y=new d3(q.globString(),this.mmopts),$=x[x.length-1]==="**",z=q.isAbsolute();if(z)this.absolute.push(Y);else this.relative.push(Y);if($)if(z)this.absoluteChildren.push(Y);else this.relativeChildren.push(Y)}}ignored(Z){let J=Z.fullpath(),Q=`${J}/`,X=Z.relative()||".",x=`${X}/`;for(let q of this.relative)if(q.match(X)||q.match(x))return!0;for(let q of this.absolute)if(q.match(J)||q.match(Q))return!0;return!1}childrenIgnored(Z){let J=Z.fullpath()+"/",Q=(Z.relative()||".")+"/";for(let X of this.relativeChildren)if(X.match(Q))return!0;for(let X of this.absoluteChildren)if(X.match(J))return!0;return!1}}class uz{store;constructor(Z=new Map){this.store=Z}copy(){return new uz(new Map(this.store))}hasWalked(Z,J){return this.store.get(Z.fullpath())?.has(J.globString())}storeWalked(Z,J){let Q=Z.fullpath(),X=this.store.get(Q);if(X)X.add(J.globString());else this.store.set(Q,new Set([J.globString()]))}}class xw{store=new Map;add(Z,J,Q){let X=(J?2:0)|(Q?1:0),x=this.store.get(Z);this.store.set(Z,x===void 0?X:X&x)}entries(){return[...this.store.entries()].map(([Z,J])=>[Z,!!(J&2),!!(J&1)])}}class qw{store=new Map;add(Z,J){if(!Z.canReaddir())return;let Q=this.store.get(Z);if(Q){if(!Q.find((X)=>X.globString()===J.globString()))Q.push(J)}else this.store.set(Z,[J])}get(Z){let J=this.store.get(Z);if(!J)throw new Error("attempting to walk unknown path");return J}entries(){return this.keys().map((Z)=>[Z,this.store.get(Z)])}keys(){return[...this.store.keys()].filter((Z)=>Z.canReaddir())}}class vJ{hasWalkedCache;matches=new xw;subwalks=new qw;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new uz}processPatterns(Z,J){this.patterns=J;let Q=J.map((X)=>[Z,X]);for(let[X,x]of Q){this.hasWalkedCache.storeWalked(X,x);let q=x.root(),Y=x.isAbsolute()&&this.opts.absolute!==!1;if(q){X=X.resolve(q==="/"&&this.opts.root!==void 0?this.opts.root:q);let U=x.rest();if(!U){this.matches.add(X,!0,!1);continue}else x=U}if(X.isENOENT())continue;let $,z,W=!1;while(typeof($=x.pattern())==="string"&&(z=x.rest()))X=X.resolve($),x=z,W=!0;if($=x.pattern(),z=x.rest(),W){if(this.hasWalkedCache.hasWalked(X,x))continue;this.hasWalkedCache.storeWalked(X,x)}if(typeof $==="string"){let U=$===".."||$===""||$===".";this.matches.add(X.resolve($),Y,U);continue}else if($===O2){if(!X.isSymbolicLink()||this.follow||x.checkFollowGlobstar())this.subwalks.add(X,x);let U=z?.pattern(),H=z?.rest();if(!z||(U===""||U===".")&&!H)this.matches.add(X,Y,U===""||U===".");else if(U===".."){let B=X.parent||X;if(!H)this.matches.add(B,Y,!0);else if(!this.hasWalkedCache.hasWalked(B,H))this.subwalks.add(B,H)}}else if($ instanceof RegExp)this.subwalks.add(X,x)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new vJ(this.opts,this.hasWalkedCache)}filterEntries(Z,J){let Q=this.subwalks.get(Z),X=this.child();for(let x of J)for(let q of Q){let Y=q.isAbsolute(),$=q.pattern(),z=q.rest();if($===O2)X.testGlobstar(x,q,z,Y);else if($ instanceof RegExp)X.testRegExp(x,$,z,Y);else X.testString(x,$,z,Y)}return X}testGlobstar(Z,J,Q,X){if(this.dot||!Z.name.startsWith(".")){if(!J.hasMore())this.matches.add(Z,X,!1);if(Z.canReaddir()){if(this.follow||!Z.isSymbolicLink())this.subwalks.add(Z,J);else if(Z.isSymbolicLink()){if(Q&&J.checkFollowGlobstar())this.subwalks.add(Z,Q);else if(J.markFollowGlobstar())this.subwalks.add(Z,J)}}}if(Q){let x=Q.pattern();if(typeof x==="string"&&x!==".."&&x!==""&&x!==".")this.testString(Z,x,Q.rest(),X);else if(x===".."){let q=Z.parent||Z;this.subwalks.add(q,Q)}else if(x instanceof RegExp)this.testRegExp(Z,x,Q.rest(),X)}}testRegExp(Z,J,Q,X){if(!J.test(Z.name))return;if(!Q)this.matches.add(Z,X,!1);else this.subwalks.add(Z,Q)}testString(Z,J,Q,X){if(!Z.isNamed(J))return;if(!Q)this.matches.add(Z,X,!1);else this.subwalks.add(Z,Q)}}var Dr=(Z,J)=>typeof Z==="string"?new TJ([Z],J):Array.isArray(Z)?new TJ(Z,J):Z;class hz{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Z=[];#X;#x;signal;maxDepth;includeChildMatches;constructor(Z,J,Q){if(this.patterns=Z,this.path=J,this.opts=Q,this.#x=!Q.posix&&Q.platform==="win32"?"\\":"/",this.includeChildMatches=Q.includeChildMatches!==!1,Q.ignore||!this.includeChildMatches){if(this.#X=Dr(Q.ignore??[],Q),!this.includeChildMatches&&typeof this.#X.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Q.maxDepth||1/0,Q.signal)this.signal=Q.signal,this.signal.addEventListener("abort",()=>{this.#Z.length=0})}#J(Z){return this.seen.has(Z)||!!this.#X?.ignored?.(Z)}#Y(Z){return!!this.#X?.childrenIgnored?.(Z)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Z=void 0;while(!this.paused&&(Z=this.#Z.shift()))Z()}onResume(Z){if(this.signal?.aborted)return;if(!this.paused)Z();else this.#Z.push(Z)}async matchCheck(Z,J){if(J&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=Z.realpathCached()||await Z.realpath(),!Q)return;Z=Q}let x=Z.isUnknown()||this.opts.stat?await Z.lstat():Z;if(this.opts.follow&&this.opts.nodir&&x?.isSymbolicLink()){let q=await x.realpath();if(q&&(q.isUnknown()||this.opts.stat))await q.lstat()}return this.matchCheckTest(x,J)}matchCheckTest(Z,J){return Z&&(this.maxDepth===1/0||Z.depth()<=this.maxDepth)&&(!J||Z.canReaddir())&&(!this.opts.nodir||!Z.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Z.isSymbolicLink()||!Z.realpathCached()?.isDirectory())&&!this.#J(Z)?Z:void 0}matchCheckSync(Z,J){if(J&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=Z.realpathCached()||Z.realpathSync(),!Q)return;Z=Q}let x=Z.isUnknown()||this.opts.stat?Z.lstatSync():Z;if(this.opts.follow&&this.opts.nodir&&x?.isSymbolicLink()){let q=x.realpathSync();if(q&&(q?.isUnknown()||this.opts.stat))q.lstatSync()}return this.matchCheckTest(x,J)}matchFinish(Z,J){if(this.#J(Z))return;if(!this.includeChildMatches&&this.#X?.add){let x=`${Z.relativePosix()}/**`;this.#X.add(x)}let Q=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(Z);let X=this.opts.mark&&Z.isDirectory()?this.#x:"";if(this.opts.withFileTypes)this.matchEmit(Z);else if(Q){let x=this.opts.posix?Z.fullpathPosix():Z.fullpath();this.matchEmit(x+X)}else{let x=this.opts.posix?Z.relativePosix():Z.relative(),q=this.opts.dotRelative&&!x.startsWith(".."+this.#x)?"."+this.#x:"";this.matchEmit(!x?"."+X:q+x+X)}}async match(Z,J,Q){let X=await this.matchCheck(Z,Q);if(X)this.matchFinish(X,J)}matchSync(Z,J,Q){let X=this.matchCheckSync(Z,Q);if(X)this.matchFinish(X,J)}walkCB(Z,J,Q){if(this.signal?.aborted)Q();this.walkCB2(Z,J,new vJ(this.opts),Q)}walkCB2(Z,J,Q,X){if(this.#Y(Z))return X();if(this.signal?.aborted)X();if(this.paused){this.onResume(()=>this.walkCB2(Z,J,Q,X));return}Q.processPatterns(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;x++,this.match(Y,$,z).then(()=>q())}for(let Y of Q.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;x++;let $=Y.readdirCached();if(Y.calledReaddir())this.walkCB3(Y,$,Q,q);else Y.readdirCB((z,W)=>this.walkCB3(Y,W,Q,q),!0)}q()}walkCB3(Z,J,Q,X){Q=Q.filterEntries(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;x++,this.match(Y,$,z).then(()=>q())}for(let[Y,$]of Q.subwalks.entries())x++,this.walkCB2(Y,$,Q.child(),q);q()}walkCBSync(Z,J,Q){if(this.signal?.aborted)Q();this.walkCB2Sync(Z,J,new vJ(this.opts),Q)}walkCB2Sync(Z,J,Q,X){if(this.#Y(Z))return X();if(this.signal?.aborted)X();if(this.paused){this.onResume(()=>this.walkCB2Sync(Z,J,Q,X));return}Q.processPatterns(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;this.matchSync(Y,$,z)}for(let Y of Q.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;x++;let $=Y.readdirSync();this.walkCB3Sync(Y,$,Q,q)}q()}walkCB3Sync(Z,J,Q,X){Q=Q.filterEntries(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;this.matchSync(Y,$,z)}for(let[Y,$]of Q.subwalks.entries())x++,this.walkCB2Sync(Y,$,Q.child(),q);q()}}class rx extends hz{matches=new Set;constructor(Z,J,Q){super(Z,J,Q)}matchEmit(Z){this.matches.add(Z)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Z,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else Z(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class tx extends hz{results;constructor(Z,J,Q){super(Z,J,Q);this.results=new G7({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Z){if(this.results.write(Z),!this.results.flowing)this.pause()}stream(){let Z=this.path;if(Z.isUnknown())Z.lstat().then(()=>{this.walkCB(Z,this.patterns,()=>this.results.end())});else this.walkCB(Z,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Nr=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class i8{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(Z,J){if(!J)throw new TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=Fr(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map(($)=>$.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map(($)=>$.includes("/")?$:`./**/${$}`)}if(this.pattern=Z,this.platform=J.platform||Nr,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let $=J.platform==="win32"?RJ:J.platform==="darwin"?ax:J.platform?IJ:Xw;this.scurry=new $(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let Q=this.platform==="darwin"||this.platform==="win32",X={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Q,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},x=this.pattern.map(($)=>new d3($,X)),[q,Y]=x.reduce(($,z)=>{return $[0].push(...z.set),$[1].push(...z.globParts),$},[[],[]]);this.patterns=q.map(($,z)=>{let W=Y[z];if(!W)throw new Error("invalid pattern object");return new v9($,W,0,this.platform)})}async walk(){return[...await new rx(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 rx(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 tx(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 tx(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 gz=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let Q of Z)if(new d3(Q,J).hasMagic())return!0;return!1};function Zq(Z,J={}){return new i8(Z,J).streamSync()}function $w(Z,J={}){return new i8(Z,J).stream()}function Kw(Z,J={}){return new i8(Z,J).walkSync()}async function Yw(Z,J={}){return new i8(Z,J).walk()}function Jq(Z,J={}){return new i8(Z,J).iterateSync()}function zw(Z,J={}){return new i8(Z,J).iterate()}var wr=Zq,_r=Object.assign($w,{sync:Zq}),Pr=Jq,jr=Object.assign(zw,{sync:Jq}),Lr=Object.assign(Kw,{stream:Zq,iterate:Jq}),ex=Object.assign(Yw,{glob:Yw,globSync:Kw,sync:Lr,globStream:$w,stream:_r,globStreamSync:Zq,streamSync:wr,globIterate:zw,iterate:jr,globIterateSync:Jq,iterateSync:Pr,Glob:i8,hasMagic:gz,escape:S9,unescape:F8});ex.glob=ex;var oL=O9(UW(),1);import m30 from"fs";import S30 from"path";function cJ(Z,J){return function Q(){return Z.apply(J,arguments)}}var{toString:He}=Object.prototype,{getPrototypeOf:GW}=Object,{iterator:Hq,toStringTag:MP}=Symbol,Gq=((Z)=>(J)=>{let Q=He.call(J);return Z[Q]||(Z[Q]=Q.slice(8,-1).toLowerCase())})(Object.create(null)),P8=(Z)=>{return Z=Z.toLowerCase(),(J)=>Gq(J)===Z},Bq=(Z)=>(J)=>typeof J===Z,{isArray:b9}=Array,c9=Bq("undefined");function bJ(Z){return Z!==null&&!c9(Z)&&Z.constructor!==null&&!c9(Z.constructor)&&r4(Z.constructor.isBuffer)&&Z.constructor.isBuffer(Z)}var DP=P8("ArrayBuffer");function Ge(Z){let J;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView)J=ArrayBuffer.isView(Z);else J=Z&&Z.buffer&&DP(Z.buffer);return J}var Be=Bq("string"),r4=Bq("function"),FP=Bq("number"),pJ=(Z)=>Z!==null&&typeof Z==="object",Me=(Z)=>Z===!0||Z===!1,Uq=(Z)=>{if(Gq(Z)!=="object")return!1;let J=GW(Z);return(J===null||J===Object.prototype||Object.getPrototypeOf(J)===null)&&!(MP in Z)&&!(Hq in Z)},De=(Z)=>{if(!pJ(Z)||bJ(Z))return!1;try{return Object.keys(Z).length===0&&Object.getPrototypeOf(Z)===Object.prototype}catch(J){return!1}},Fe=P8("Date"),Ne=P8("File"),we=(Z)=>{return!!(Z&&typeof Z.uri!=="undefined")},_e=(Z)=>Z&&typeof Z.getParts!=="undefined",Pe=P8("Blob"),je=P8("FileList"),Le=(Z)=>pJ(Z)&&r4(Z.pipe);function Ce(){if(typeof globalThis!=="undefined")return globalThis;if(typeof self!=="undefined")return self;if(typeof window!=="undefined")return window;if(typeof global!=="undefined")return global;return{}}var HP=Ce(),GP=typeof HP.FormData!=="undefined"?HP.FormData:void 0,Oe=(Z)=>{let J;return Z&&(GP&&Z instanceof GP||r4(Z.append)&&((J=Gq(Z))==="formdata"||J==="object"&&r4(Z.toString)&&Z.toString()==="[object FormData]"))},me=P8("URLSearchParams"),[Se,Re,Ie,Te]=["ReadableStream","Request","Response","Headers"].map(P8),ve=(Z)=>{return Z.trim?Z.trim():Z.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function yJ(Z,J,{allOwnKeys:Q=!1}={}){if(Z===null||typeof Z==="undefined")return;let X,x;if(typeof Z!=="object")Z=[Z];if(b9(Z))for(X=0,x=Z.length;X<x;X++)J.call(null,Z[X],X,Z);else{if(bJ(Z))return;let q=Q?Object.getOwnPropertyNames(Z):Object.keys(Z),Y=q.length,$;for(X=0;X<Y;X++)$=q[X],J.call(null,Z[$],$,Z)}}function NP(Z,J){if(bJ(Z))return null;J=J.toLowerCase();let Q=Object.keys(Z),X=Q.length,x;while(X-- >0)if(x=Q[X],J===x.toLowerCase())return x;return null}var D7=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})(),wP=(Z)=>!c9(Z)&&Z!==D7;function HW(){let{caseless:Z,skipUndefined:J}=wP(this)&&this||{},Q={},X=(x,q)=>{if(q==="__proto__"||q==="constructor"||q==="prototype")return;let Y=Z&&NP(Q,q)||q;if(Uq(Q[Y])&&Uq(x))Q[Y]=HW(Q[Y],x);else if(Uq(x))Q[Y]=HW({},x);else if(b9(x))Q[Y]=x.slice();else if(!J||!c9(x))Q[Y]=x};for(let x=0,q=arguments.length;x<q;x++)arguments[x]&&yJ(arguments[x],X);return Q}var Ae=(Z,J,Q,{allOwnKeys:X}={})=>{return yJ(J,(x,q)=>{if(Q&&r4(x))Object.defineProperty(Z,q,{value:cJ(x,Q),writable:!0,enumerable:!0,configurable:!0});else Object.defineProperty(Z,q,{value:x,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:X}),Z},Ee=(Z)=>{if(Z.charCodeAt(0)===65279)Z=Z.slice(1);return Z},fe=(Z,J,Q,X)=>{Z.prototype=Object.create(J.prototype,X),Object.defineProperty(Z.prototype,"constructor",{value:Z,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(Z,"super",{value:J.prototype}),Q&&Object.assign(Z.prototype,Q)},ke=(Z,J,Q,X)=>{let x,q,Y,$={};if(J=J||{},Z==null)return J;do{x=Object.getOwnPropertyNames(Z),q=x.length;while(q-- >0)if(Y=x[q],(!X||X(Y,Z,J))&&!$[Y])J[Y]=Z[Y],$[Y]=!0;Z=Q!==!1&&GW(Z)}while(Z&&(!Q||Q(Z,J))&&Z!==Object.prototype);return J},ce=(Z,J,Q)=>{if(Z=String(Z),Q===void 0||Q>Z.length)Q=Z.length;Q-=J.length;let X=Z.indexOf(J,Q);return X!==-1&&X===Q},be=(Z)=>{if(!Z)return null;if(b9(Z))return Z;let J=Z.length;if(!FP(J))return null;let Q=new Array(J);while(J-- >0)Q[J]=Z[J];return Q},pe=((Z)=>{return(J)=>{return Z&&J instanceof Z}})(typeof Uint8Array!=="undefined"&&GW(Uint8Array)),ye=(Z,J)=>{let X=(Z&&Z[Hq]).call(Z),x;while((x=X.next())&&!x.done){let q=x.value;J.call(Z,q[0],q[1])}},ue=(Z,J)=>{let Q,X=[];while((Q=Z.exec(J))!==null)X.push(Q);return X},he=P8("HTMLFormElement"),ge=(Z)=>{return Z.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function J(Q,X,x){return X.toUpperCase()+x})},BP=(({hasOwnProperty:Z})=>(J,Q)=>Z.call(J,Q))(Object.prototype),ie=P8("RegExp"),_P=(Z,J)=>{let Q=Object.getOwnPropertyDescriptors(Z),X={};yJ(Q,(x,q)=>{let Y;if((Y=J(x,q,Z))!==!1)X[q]=Y||x}),Object.defineProperties(Z,X)},de=(Z)=>{_P(Z,(J,Q)=>{if(r4(Z)&&["arguments","caller","callee"].indexOf(Q)!==-1)return!1;let X=Z[Q];if(!r4(X))return;if(J.enumerable=!1,"writable"in J){J.writable=!1;return}if(!J.set)J.set=()=>{throw Error("Can not rewrite read-only method '"+Q+"'")}})},le=(Z,J)=>{let Q={},X=(x)=>{x.forEach((q)=>{Q[q]=!0})};return b9(Z)?X(Z):X(String(Z).split(J)),Q},oe=()=>{},se=(Z,J)=>{return Z!=null&&Number.isFinite(Z=+Z)?Z:J};function ne(Z){return!!(Z&&r4(Z.append)&&Z[MP]==="FormData"&&Z[Hq])}var ae=(Z)=>{let J=new Array(10),Q=(X,x)=>{if(pJ(X)){if(J.indexOf(X)>=0)return;if(bJ(X))return X;if(!("toJSON"in X)){J[x]=X;let q=b9(X)?[]:{};return yJ(X,(Y,$)=>{let z=Q(Y,x+1);!c9(z)&&(q[$]=z)}),J[x]=void 0,q}}return X};return Q(Z,0)},re=P8("AsyncFunction"),te=(Z)=>Z&&(pJ(Z)||r4(Z))&&r4(Z.then)&&r4(Z.catch),PP=((Z,J)=>{if(Z)return setImmediate;return J?((Q,X)=>{return D7.addEventListener("message",({source:x,data:q})=>{if(x===D7&&q===Q)X.length&&X.shift()()},!1),(x)=>{X.push(x),D7.postMessage(Q,"*")}})(`axios@${Math.random()}`,[]):(Q)=>setTimeout(Q)})(typeof setImmediate==="function",r4(D7.postMessage)),ee=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(D7):typeof process!=="undefined"&&process.nextTick||PP,Z00=(Z)=>Z!=null&&r4(Z[Hq]),b={isArray:b9,isArrayBuffer:DP,isBuffer:bJ,isFormData:Oe,isArrayBufferView:Ge,isString:Be,isNumber:FP,isBoolean:Me,isObject:pJ,isPlainObject:Uq,isEmptyObject:De,isReadableStream:Se,isRequest:Re,isResponse:Ie,isHeaders:Te,isUndefined:c9,isDate:Fe,isFile:Ne,isReactNativeBlob:we,isReactNative:_e,isBlob:Pe,isRegExp:ie,isFunction:r4,isStream:Le,isURLSearchParams:me,isTypedArray:pe,isFileList:je,forEach:yJ,merge:HW,extend:Ae,trim:ve,stripBOM:Ee,inherits:fe,toFlatObject:ke,kindOf:Gq,kindOfTest:P8,endsWith:ce,toArray:be,forEachEntry:ye,matchAll:ue,isHTMLForm:he,hasOwnProperty:BP,hasOwnProp:BP,reduceDescriptors:_P,freezeMethods:de,toObjectSet:le,toCamelCase:ge,noop:oe,toFiniteNumber:se,findKey:NP,global:D7,isContextDefined:wP,isSpecCompliantForm:ne,toJSONObject:ae,isAsyncFn:re,isThenable:te,setImmediate:PP,asap:ee,isIterable:Z00};class p4 extends Error{static from(Z,J,Q,X,x,q){let Y=new p4(Z.message,J||Z.code,Q,X,x);if(Y.cause=Z,Y.name=Z.name,Z.status!=null&&Y.status==null)Y.status=Z.status;return q&&Object.assign(Y,q),Y}constructor(Z,J,Q,X,x){super(Z);if(Object.defineProperty(this,"message",{value:Z,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,J&&(this.code=J),Q&&(this.config=Q),X&&(this.request=X),x)this.response=x,this.status=x.status}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:b.toJSONObject(this.config),code:this.code,status:this.status}}}p4.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";p4.ERR_BAD_OPTION="ERR_BAD_OPTION";p4.ECONNABORTED="ECONNABORTED";p4.ETIMEDOUT="ETIMEDOUT";p4.ERR_NETWORK="ERR_NETWORK";p4.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";p4.ERR_DEPRECATED="ERR_DEPRECATED";p4.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";p4.ERR_BAD_REQUEST="ERR_BAD_REQUEST";p4.ERR_CANCELED="ERR_CANCELED";p4.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";p4.ERR_INVALID_URL="ERR_INVALID_URL";var m0=p4;var jP=O9(UW(),1),Mq=jP.default;function MW(Z){return b.isPlainObject(Z)||b.isArray(Z)}function LP(Z){return b.endsWith(Z,"[]")?Z.slice(0,-2):Z}function BW(Z,J,Q){if(!Z)return J;return Z.concat(J).map(function X(x,q){return x=LP(x),!Q&&q?"["+x+"]":x}).join(Q?".":"")}function J00(Z){return b.isArray(Z)&&!Z.some(MW)}var Q00=b.toFlatObject(b,{},null,function Z(J){return/^is[A-Z]/.test(J)});function X00(Z,J,Q){if(!b.isObject(Z))throw new TypeError("target must be an object");J=J||new(Mq||FormData),Q=b.toFlatObject(Q,{metaTokens:!0,dots:!1,indexes:!1},!1,function D(N,_){return!b.isUndefined(_[N])});let X=Q.metaTokens,x=Q.visitor||U,q=Q.dots,Y=Q.indexes,z=(Q.Blob||typeof Blob!=="undefined"&&Blob)&&b.isSpecCompliantForm(J);if(!b.isFunction(x))throw new TypeError("visitor must be a function");function W(D){if(D===null)return"";if(b.isDate(D))return D.toISOString();if(b.isBoolean(D))return D.toString();if(!z&&b.isBlob(D))throw new m0("Blob is not supported. Use a Buffer instead.");if(b.isArrayBuffer(D)||b.isTypedArray(D))return z&&typeof Blob==="function"?new Blob([D]):Buffer.from(D);return D}function U(D,N,_){let j=D;if(b.isReactNative(J)&&b.isReactNativeBlob(D))return J.append(BW(_,N,q),W(D)),!1;if(D&&!_&&typeof D==="object"){if(b.endsWith(N,"{}"))N=X?N:N.slice(0,-2),D=JSON.stringify(D);else if(b.isArray(D)&&J00(D)||(b.isFileList(D)||b.endsWith(N,"[]"))&&(j=b.toArray(D)))return N=LP(N),j.forEach(function O(A,h){!(b.isUndefined(A)||A===null)&&J.append(Y===!0?BW([N],h,q):Y===null?N:N+"[]",W(A))}),!1}if(MW(D))return!0;return J.append(BW(_,N,q),W(D)),!1}let H=[],B=Object.assign(Q00,{defaultVisitor:U,convertValue:W,isVisitable:MW});function M(D,N){if(b.isUndefined(D))return;if(H.indexOf(D)!==-1)throw Error("Circular reference detected in "+N.join("."));H.push(D),b.forEach(D,function _(j,O){if((!(b.isUndefined(j)||j===null)&&x.call(J,j,b.isString(O)?O.trim():O,N,B))===!0)M(j,N?N.concat(O):[O])}),H.pop()}if(!b.isObject(Z))throw new TypeError("data must be an object");return M(Z),J}var M5=X00;function CP(Z){let J={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\x00"};return encodeURIComponent(Z).replace(/[!'()~]|%20|%00/g,function Q(X){return J[X]})}function OP(Z,J){this._pairs=[],Z&&M5(Z,this,J)}var mP=OP.prototype;mP.append=function Z(J,Q){this._pairs.push([J,Q])};mP.toString=function Z(J){let Q=J?function(X){return J.call(this,X,CP)}:CP;return this._pairs.map(function X(x){return Q(x[0])+"="+Q(x[1])},"").join("&")};var SP=OP;function x00(Z){return encodeURIComponent(Z).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function F7(Z,J,Q){if(!J)return Z;let X=Q&&Q.encode||x00,x=b.isFunction(Q)?{serialize:Q}:Q,q=x&&x.serialize,Y;if(q)Y=q(J,x);else Y=b.isURLSearchParams(J)?J.toString():new SP(J,x).toString(X);if(Y){let $=Z.indexOf("#");if($!==-1)Z=Z.slice(0,$);Z+=(Z.indexOf("?")===-1?"?":"&")+Y}return Z}class RP{constructor(){this.handlers=[]}use(Z,J,Q){return this.handlers.push({fulfilled:Z,rejected:J,synchronous:Q?Q.synchronous:!1,runWhen:Q?Q.runWhen:null}),this.handlers.length-1}eject(Z){if(this.handlers[Z])this.handlers[Z]=null}clear(){if(this.handlers)this.handlers=[]}forEach(Z){b.forEach(this.handlers,function J(Q){if(Q!==null)Z(Q)})}}var DW=RP;var D5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};import Y00 from"crypto";import q00 from"url";var IP=q00.URLSearchParams;var FW="abcdefghijklmnopqrstuvwxyz",TP="0123456789",vP={DIGIT:TP,ALPHA:FW,ALPHA_DIGIT:FW+FW.toUpperCase()+TP},$00=(Z=16,J=vP.ALPHA_DIGIT)=>{let Q="",{length:X}=J,x=new Uint32Array(Z);Y00.randomFillSync(x);for(let q=0;q<Z;q++)Q+=J[x[q]%X];return Q},AP={isNode:!0,classes:{URLSearchParams:IP,FormData:Mq,Blob:typeof Blob!=="undefined"&&Blob||null},ALPHABET:vP,generateString:$00,protocols:["http","https","file","data"]};var _W={};sF(_W,{origin:()=>W00,navigator:()=>NW,hasStandardBrowserWebWorkerEnv:()=>z00,hasStandardBrowserEnv:()=>K00,hasBrowserEnv:()=>wW});var wW=typeof window!=="undefined"&&typeof document!=="undefined",NW=typeof navigator==="object"&&navigator||void 0,K00=wW&&(!NW||["ReactNative","NativeScript","NS"].indexOf(NW.product)<0),z00=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})(),W00=wW&&window.location.href||"http://localhost";var T1={..._W,...AP};function PW(Z,J){return M5(Z,new T1.classes.URLSearchParams,{visitor:function(Q,X,x,q){if(T1.isNode&&b.isBuffer(Q))return this.append(X,Q.toString("base64")),!1;return q.defaultVisitor.apply(this,arguments)},...J})}function V00(Z){return b.matchAll(/\w+|\[(\w*)]/g,Z).map((J)=>{return J[0]==="[]"?"":J[1]||J[0]})}function U00(Z){let J={},Q=Object.keys(Z),X,x=Q.length,q;for(X=0;X<x;X++)q=Q[X],J[q]=Z[q];return J}function H00(Z){function J(Q,X,x,q){let Y=Q[q++];if(Y==="__proto__")return!0;let $=Number.isFinite(+Y),z=q>=Q.length;if(Y=!Y&&b.isArray(x)?x.length:Y,z){if(b.hasOwnProp(x,Y))x[Y]=[x[Y],X];else x[Y]=X;return!$}if(!x[Y]||!b.isObject(x[Y]))x[Y]=[];if(J(Q,X,x[Y],q)&&b.isArray(x[Y]))x[Y]=U00(x[Y]);return!$}if(b.isFormData(Z)&&b.isFunction(Z.entries)){let Q={};return b.forEachEntry(Z,(X,x)=>{J(V00(X),x,Q,0)}),Q}return null}var Dq=H00;function G00(Z,J,Q){if(b.isString(Z))try{return(J||JSON.parse)(Z),b.trim(Z)}catch(X){if(X.name!=="SyntaxError")throw X}return(Q||JSON.stringify)(Z)}var jW={transitional:D5,adapter:["xhr","http","fetch"],transformRequest:[function Z(J,Q){let X=Q.getContentType()||"",x=X.indexOf("application/json")>-1,q=b.isObject(J);if(q&&b.isHTMLForm(J))J=new FormData(J);if(b.isFormData(J))return x?JSON.stringify(Dq(J)):J;if(b.isArrayBuffer(J)||b.isBuffer(J)||b.isStream(J)||b.isFile(J)||b.isBlob(J)||b.isReadableStream(J))return J;if(b.isArrayBufferView(J))return J.buffer;if(b.isURLSearchParams(J))return Q.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),J.toString();let $;if(q){if(X.indexOf("application/x-www-form-urlencoded")>-1)return PW(J,this.formSerializer).toString();if(($=b.isFileList(J))||X.indexOf("multipart/form-data")>-1){let z=this.env&&this.env.FormData;return M5($?{"files[]":J}:J,z&&new z,this.formSerializer)}}if(q||x)return Q.setContentType("application/json",!1),G00(J);return J}],transformResponse:[function Z(J){let Q=this.transitional||jW.transitional,X=Q&&Q.forcedJSONParsing,x=this.responseType==="json";if(b.isResponse(J)||b.isReadableStream(J))return J;if(J&&b.isString(J)&&(X&&!this.responseType||x)){let Y=!(Q&&Q.silentJSONParsing)&&x;try{return JSON.parse(J,this.parseReviver)}catch($){if(Y){if($.name==="SyntaxError")throw m0.from($,m0.ERR_BAD_RESPONSE,this,null,this.response);throw $}}}return J}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T1.classes.FormData,Blob:T1.classes.Blob},validateStatus:function Z(J){return J>=200&&J<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};b.forEach(["delete","get","head","post","put","patch"],(Z)=>{jW.headers[Z]={}});var p9=jW;var B00=b.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),EP=(Z)=>{let J={},Q,X,x;return Z&&Z.split(`
86
+ }`;var V1=dF(function(){return A1(C,f0+"return "+U0).apply(Z,T)});if(V1.source=U0,Xz(V1))throw V1;return V1}function lo(K){return u1(K).toLowerCase()}function oo(K){return u1(K).toUpperCase()}function so(K,V,G){if(K=u1(K),K&&(G||V===Z))return ZD(K);if(!K||!(V=D3(V)))return K;var F=H8(K),P=H8(V),C=JD(F,P),T=QD(F,P)+1;return V5(F,C,T).join("")}function no(K,V,G){if(K=u1(K),K&&(G||V===Z))return K.slice(0,xD(K)+1);if(!K||!(V=D3(V)))return K;var F=H8(K),P=QD(F,H8(V))+1;return V5(F,0,P).join("")}function ao(K,V,G){if(K=u1(K),K&&(G||V===Z))return K.replace(U9,"");if(!K||!(V=D3(V)))return K;var F=H8(K),P=JD(F,H8(V));return V5(F,P).join("")}function ro(K,V){var G=m,F=R;if(H2(V)){var P="separator"in V?V.separator:P;G="length"in V?K1(V.length):G,F="omission"in V?D3(V.omission):F}K=u1(K);var C=K.length;if(B9(K)){var T=H8(K);C=T.length}if(G>=C)return K;var c=G-M9(F);if(c<1)return F;var a=T?V5(T,0,c).join(""):K.slice(0,c);if(P===Z)return a+F;if(T)c+=a.length-c;if(xz(P)){if(K.slice(c).search(P)){var $0,K0=a;if(!P.global)P=wK(P.source,u1(PM.exec(P))+"g");P.lastIndex=0;while($0=P.exec(K0))var U0=$0.index;a=a.slice(0,U0===Z?c:U0)}}else if(K.indexOf(D3(P),c)!=c){var R0=a.lastIndexOf(P);if(R0>-1)a=a.slice(0,R0)}return a+F}function to(K){return K=u1(K),K&&Q7.test(K)?K.replace(bX,Oh):K}var eo=P9(function(K,V,G){return K+(G?" ":"")+V.toUpperCase()}),$z=lD("toUpperCase");function iF(K,V,G){if(K=u1(K),V=G?Z:V,V===Z)return _h(K)?Rh(K):Uh(K);return K.match(V)||[]}var dF=H1(function(K,V){try{return B3(K,Z,V)}catch(G){return Xz(G)?G:new X1(G)}}),Zs=j6(function(K,V){return k3(V,function(G){G=u8(G),_6(K,G,Jz(K[G],K))}),K});function Js(K){var V=K==null?0:K.length,G=d0();return K=!V?[]:W2(K,function(F){if(typeof F[1]!="function")throw new c3(x);return[G(F[0]),F[1]]}),H1(function(F){var P=-1;while(++P<V){var C=K[P];if(B3(C[0],this,F))return B3(C[1],this,F)}})}function Qs(K){return Og(p3(K,W))}function Kz(K){return function(){return K}}function Xs(K,V){return K==null||K!==K?V:K}var xs=sD(),qs=sD(!0);function n4(K){return K}function zz(K){return LD(typeof K=="function"?K:p3(K,W))}function Ys(K){return OD(p3(K,W))}function $s(K,V){return mD(K,p3(V,W))}var Ks=H1(function(K,V){return function(G){return zJ(G,K,V)}}),zs=H1(function(K,V){return function(G){return zJ(K,G,V)}});function Wz(K,V,G){var F=t2(V),P=Mx(V,F);if(G==null&&!(H2(V)&&(P.length||!F.length)))G=V,V=K,K=this,P=Mx(V,t2(V));var C=!(H2(G)&&("chain"in G))||!!G.chain,T=C6(K);return k3(P,function(c){var a=V[c];if(K[c]=a,T)K.prototype[c]=function(){var $0=this.__chain__;if(C||$0){var K0=K(this.__wrapped__),U0=K0.__actions__=l4(this.__actions__);return U0.push({func:a,args:arguments,thisArg:K}),K0.__chain__=$0,K0}return a.apply(K,x5([this.value()],arguments))}}),K}function Ws(){if(r2._===this)r2._=fh;return this}function Vz(){}function Vs(K){return K=K1(K),H1(function(V){return SD(V,K)})}var Us=hK(W2),Hs=hK(nM),Gs=hK(HK);function lF(K){return nK(K)?GK(u8(K)):gg(K)}function Bs(K){return function(V){return K==null?Z:K7(K,V)}}var Ms=aD(),Ds=aD(!0);function Uz(){return[]}function Hz(){return!1}function Fs(){return{}}function Ns(){return""}function ws(){return!0}function _s(K,V){if(K=K1(K),K<1||K>o)return[];var G=i0,F=_4(K,i0);V=d0(V),K-=i0;var P=DK(F,V);while(++G<K)V(G);return P}function Ps(K){if(x1(K))return W2(K,u8);return F3(K)?[K]:l4(UF(u1(K)))}function js(K){var V=++Ah;return u1(K)+V}var Ls=Px(function(K,V){return K+V},0),Cs=gK("ceil"),Os=Px(function(K,V){return K/V},1),ms=gK("floor");function Ss(K){return K&&K.length?Bx(K,n4,SK):Z}function Rs(K,V){return K&&K.length?Bx(K,d0(V,2),SK):Z}function Is(K){return tM(K,n4)}function Ts(K,V){return tM(K,d0(V,2))}function vs(K){return K&&K.length?Bx(K,n4,vK):Z}function As(K,V){return K&&K.length?Bx(K,d0(V,2),vK):Z}var Es=Px(function(K,V){return K*V},1),fs=gK("round"),ks=Px(function(K,V){return K-V},0);function cs(K){return K&&K.length?MK(K,n4):0}function bs(K,V){return K&&K.length?MK(K,d0(V,2)):0}if(L.after=ql,L.ary=jF,L.assign=ll,L.assignIn=cF,L.assignInWith=fx,L.assignWith=ol,L.at=sl,L.before=LF,L.bind=Jz,L.bindAll=Zs,L.bindKey=CF,L.castArray=Dl,L.chain=wF,L.chunk=Oi,L.compact=mi,L.concat=Si,L.cond=Js,L.conforms=Qs,L.constant=Kz,L.countBy=kd,L.create=nl,L.curry=OF,L.curryRight=mF,L.debounce=SF,L.defaults=al,L.defaultsDeep=rl,L.defer=Yl,L.delay=$l,L.difference=Ri,L.differenceBy=Ii,L.differenceWith=Ti,L.drop=vi,L.dropRight=Ai,L.dropRightWhile=Ei,L.dropWhile=fi,L.fill=ki,L.filter=bd,L.flatMap=ud,L.flatMapDeep=hd,L.flatMapDepth=gd,L.flatten=MF,L.flattenDeep=ci,L.flattenDepth=bi,L.flip=Kl,L.flow=xs,L.flowRight=qs,L.fromPairs=pi,L.functions=xo,L.functionsIn=qo,L.groupBy=id,L.initial=ui,L.intersection=hi,L.intersectionBy=gi,L.intersectionWith=ii,L.invert=$o,L.invertBy=Ko,L.invokeMap=ld,L.iteratee=zz,L.keyBy=od,L.keys=t2,L.keysIn=s4,L.map=Rx,L.mapKeys=Wo,L.mapValues=Vo,L.matches=Ys,L.matchesProperty=$s,L.memoize=Tx,L.merge=Uo,L.mergeWith=bF,L.method=Ks,L.methodOf=zs,L.mixin=Wz,L.negate=vx,L.nthArg=Vs,L.omit=Ho,L.omitBy=Go,L.once=zl,L.orderBy=sd,L.over=Us,L.overArgs=Wl,L.overEvery=Hs,L.overSome=Gs,L.partial=Qz,L.partialRight=RF,L.partition=nd,L.pick=Bo,L.pickBy=pF,L.property=lF,L.propertyOf=Bs,L.pull=si,L.pullAll=FF,L.pullAllBy=ni,L.pullAllWith=ai,L.pullAt=ri,L.range=Ms,L.rangeRight=Ds,L.rearg=Vl,L.reject=td,L.remove=ti,L.rest=Ul,L.reverse=eK,L.sampleSize=Zl,L.set=Do,L.setWith=Fo,L.shuffle=Jl,L.slice=ei,L.sortBy=xl,L.sortedUniq=Yd,L.sortedUniqBy=$d,L.split=uo,L.spread=Hl,L.tail=Kd,L.take=zd,L.takeRight=Wd,L.takeRightWhile=Vd,L.takeWhile=Ud,L.tap=md,L.throttle=Gl,L.thru=Sx,L.toArray=EF,L.toPairs=yF,L.toPairsIn=uF,L.toPath=Ps,L.toPlainObject=kF,L.transform=No,L.unary=Bl,L.union=Hd,L.unionBy=Gd,L.unionWith=Bd,L.uniq=Md,L.uniqBy=Dd,L.uniqWith=Fd,L.unset=wo,L.unzip=Zz,L.unzipWith=NF,L.update=_o,L.updateWith=Po,L.values=C9,L.valuesIn=jo,L.without=Nd,L.words=iF,L.wrap=Ml,L.xor=wd,L.xorBy=_d,L.xorWith=Pd,L.zip=jd,L.zipObject=Ld,L.zipObjectDeep=Cd,L.zipWith=Od,L.entries=yF,L.entriesIn=uF,L.extend=cF,L.extendWith=fx,Wz(L,L),L.add=Ls,L.attempt=dF,L.camelCase=mo,L.capitalize=hF,L.ceil=Cs,L.clamp=Lo,L.clone=Fl,L.cloneDeep=wl,L.cloneDeepWith=_l,L.cloneWith=Nl,L.conformsTo=Pl,L.deburr=gF,L.defaultTo=Xs,L.divide=Os,L.endsWith=So,L.eq=B8,L.escape=Ro,L.escapeRegExp=Io,L.every=cd,L.find=pd,L.findIndex=GF,L.findKey=tl,L.findLast=yd,L.findLastIndex=BF,L.findLastKey=el,L.floor=ms,L.forEach=_F,L.forEachRight=PF,L.forIn=Zo,L.forInRight=Jo,L.forOwn=Qo,L.forOwnRight=Xo,L.get=qz,L.gt=jl,L.gte=Ll,L.has=Yo,L.hasIn=Yz,L.head=DF,L.identity=n4,L.includes=dd,L.indexOf=yi,L.inRange=Co,L.invoke=zo,L.isArguments=V7,L.isArray=x1,L.isArrayBuffer=Cl,L.isArrayLike=o4,L.isArrayLikeObject=L2,L.isBoolean=Ol,L.isBuffer=U5,L.isDate=ml,L.isElement=Sl,L.isEmpty=Rl,L.isEqual=Il,L.isEqualWith=Tl,L.isError=Xz,L.isFinite=vl,L.isFunction=C6,L.isInteger=IF,L.isLength=Ax,L.isMap=TF,L.isMatch=Al,L.isMatchWith=El,L.isNaN=fl,L.isNative=kl,L.isNil=bl,L.isNull=cl,L.isNumber=vF,L.isObject=H2,L.isObjectLike=N2,L.isPlainObject=BJ,L.isRegExp=xz,L.isSafeInteger=pl,L.isSet=AF,L.isString=Ex,L.isSymbol=F3,L.isTypedArray=L9,L.isUndefined=yl,L.isWeakMap=ul,L.isWeakSet=hl,L.join=di,L.kebabCase=To,L.last=u3,L.lastIndexOf=li,L.lowerCase=vo,L.lowerFirst=Ao,L.lt=gl,L.lte=il,L.max=Ss,L.maxBy=Rs,L.mean=Is,L.meanBy=Ts,L.min=vs,L.minBy=As,L.stubArray=Uz,L.stubFalse=Hz,L.stubObject=Fs,L.stubString=Ns,L.stubTrue=ws,L.multiply=Es,L.nth=oi,L.noConflict=Ws,L.noop=Vz,L.now=Ix,L.pad=Eo,L.padEnd=fo,L.padStart=ko,L.parseInt=co,L.random=Oo,L.reduce=ad,L.reduceRight=rd,L.repeat=bo,L.replace=po,L.result=Mo,L.round=fs,L.runInContext=i,L.sample=ed,L.size=Ql,L.snakeCase=yo,L.some=Xl,L.sortedIndex=Zd,L.sortedIndexBy=Jd,L.sortedIndexOf=Qd,L.sortedLastIndex=Xd,L.sortedLastIndexBy=xd,L.sortedLastIndexOf=qd,L.startCase=ho,L.startsWith=go,L.subtract=ks,L.sum=cs,L.sumBy=bs,L.template=io,L.times=_s,L.toFinite=O6,L.toInteger=K1,L.toLength=fF,L.toLower=lo,L.toNumber=h3,L.toSafeInteger=dl,L.toString=u1,L.toUpper=oo,L.trim=so,L.trimEnd=no,L.trimStart=ao,L.truncate=ro,L.unescape=to,L.uniqueId=js,L.upperCase=eo,L.upperFirst=$z,L.each=_F,L.eachRight=PF,L.first=DF,Wz(L,function(){var K={};return p8(L,function(V,G){if(!y1.call(L.prototype,G))K[G]=V}),K}(),{chain:!1}),L.VERSION=J,k3(["bind","bindKey","curry","curryRight","partial","partialRight"],function(K){L[K].placeholder=L}),k3(["drop","take"],function(K,V){N1.prototype[K]=function(G){G=G===Z?1:i2(K1(G),0);var F=this.__filtered__&&!V?new N1(this):this.clone();if(F.__filtered__)F.__takeCount__=_4(G,F.__takeCount__);else F.__views__.push({size:_4(G,i0),type:K+(F.__dir__<0?"Right":"")});return F},N1.prototype[K+"Right"]=function(G){return this.reverse()[K](G).reverse()}}),k3(["filter","map","takeWhile"],function(K,V){var G=V+1,F=G==V0||G==n;N1.prototype[K]=function(P){var C=this.clone();return C.__iteratees__.push({iteratee:d0(P,3),type:G}),C.__filtered__=C.__filtered__||F,C}}),k3(["head","last"],function(K,V){var G="take"+(V?"Right":"");N1.prototype[K]=function(){return this[G](1).value()[0]}}),k3(["initial","tail"],function(K,V){var G="drop"+(V?"":"Right");N1.prototype[K]=function(){return this.__filtered__?new N1(this):this[G](1)}}),N1.prototype.compact=function(){return this.filter(n4)},N1.prototype.find=function(K){return this.filter(K).head()},N1.prototype.findLast=function(K){return this.reverse().find(K)},N1.prototype.invokeMap=H1(function(K,V){if(typeof K=="function")return new N1(this);return this.map(function(G){return zJ(G,K,V)})}),N1.prototype.reject=function(K){return this.filter(vx(d0(K)))},N1.prototype.slice=function(K,V){K=K1(K);var G=this;if(G.__filtered__&&(K>0||V<0))return new N1(G);if(K<0)G=G.takeRight(-K);else if(K)G=G.drop(K);if(V!==Z)V=K1(V),G=V<0?G.dropRight(-V):G.take(V-K);return G},N1.prototype.takeRightWhile=function(K){return this.reverse().takeWhile(K).reverse()},N1.prototype.toArray=function(){return this.take(i0)},p8(N1.prototype,function(K,V){var G=/^(?:filter|find|map|reject)|While$/.test(V),F=/^(?:head|last)$/.test(V),P=L[F?"take"+(V=="last"?"Right":""):V],C=F||/^find/.test(V);if(!P)return;L.prototype[V]=function(){var T=this.__wrapped__,c=F?[1]:arguments,a=T instanceof N1,$0=c[0],K0=a||x1(T),U0=function(D1){var j1=P.apply(L,x5([D1],c));return F&&R0?j1[0]:j1};if(K0&&G&&typeof $0=="function"&&$0.length!=1)a=K0=!1;var R0=this.__chain__,f0=!!this.__actions__.length,l0=C&&!R0,V1=a&&!f0;if(!C&&K0){T=V1?T:new N1(this);var o0=K.apply(T,c);return o0.__actions__.push({func:Sx,args:[U0],thisArg:Z}),new b3(o0,R0)}if(l0&&V1)return K.apply(this,c);return o0=this.thru(U0),l0?F?o0.value()[0]:o0.value():o0}}),k3(["pop","push","shift","sort","splice","unshift"],function(K){var V=Zx[K],G=/^(?:push|sort|unshift)$/.test(K)?"tap":"thru",F=/^(?:pop|shift)$/.test(K);L.prototype[K]=function(){var P=arguments;if(F&&!this.__chain__){var C=this.value();return V.apply(x1(C)?C:[],P)}return this[G](function(T){return V.apply(x1(T)?T:[],P)})}}),p8(N1.prototype,function(K,V){var G=L[V];if(G){var F=G.name+"";if(!y1.call(N9,F))N9[F]=[];N9[F].push({name:V,func:G})}}),N9[_x(Z,N).name]=[{name:"wrapper",func:Z}],N1.prototype.clone=rh,N1.prototype.reverse=th,N1.prototype.value=eh,L.prototype.at=Sd,L.prototype.chain=Rd,L.prototype.commit=Id,L.prototype.next=Td,L.prototype.plant=Ad,L.prototype.reverse=Ed,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=fd,L.prototype.first=L.prototype.head,QJ)L.prototype[QJ]=vd;return L},Y5=Ih();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)r2._=Y5,define(function(){return Y5});else if(X7)(X7.exports=Y5)._=Y5,zK._=Y5;else r2._=Y5}).call(zX)});var nF="0.6.27";var GN=O9(HN(),1),{program:RT0,createCommand:IT0,createArgument:TT0,createOption:vT0,CommanderError:AT0,InvalidArgumentError:ET0,InvalidOptionArgumentError:fT0,Command:g3,Argument:kT0,Option:cT0,Help:bT0}=GN.default;import T30 from"fs";var jz=(Z,J,Q)=>{let X=Z instanceof RegExp?BN(Z,Q):Z,x=J instanceof RegExp?BN(J,Q):J,q=X!==null&&x!=null&&fn(X,x,Q);return q&&{start:q[0],end:q[1],pre:Q.slice(0,q[0]),body:Q.slice(q[0]+X.length,q[1]),post:Q.slice(q[1]+x.length)}},BN=(Z,J)=>{let Q=J.match(Z);return Q?Q[0]:null},fn=(Z,J,Q)=>{let X,x,q,Y=void 0,$,z=Q.indexOf(Z),W=Q.indexOf(J,z+1),U=z;if(z>=0&&W>0){if(Z===J)return[z,W];X=[],q=Q.length;while(U>=0&&!$){if(U===z)X.push(U),z=Q.indexOf(Z,U+1);else if(X.length===1){let H=X.pop();if(H!==void 0)$=[H,W]}else{if(x=X.pop(),x!==void 0&&x<q)q=x,Y=W;W=Q.indexOf(J,U+1)}U=z<W&&z>=0?z:W}if(X.length&&Y!==void 0)$=[q,Y]}return $};var MN="\x00SLASH"+Math.random()+"\x00",DN="\x00OPEN"+Math.random()+"\x00",Cz="\x00CLOSE"+Math.random()+"\x00",FN="\x00COMMA"+Math.random()+"\x00",NN="\x00PERIOD"+Math.random()+"\x00",kn=new RegExp(MN,"g"),cn=new RegExp(DN,"g"),bn=new RegExp(Cz,"g"),pn=new RegExp(FN,"g"),yn=new RegExp(NN,"g"),un=/\\\\/g,hn=/\\{/g,gn=/\\}/g,dn=/\\,/g,ln=/\\\./g,on=1e5;function Lz(Z){return!isNaN(Z)?parseInt(Z,10):Z.charCodeAt(0)}function sn(Z){return Z.replace(un,MN).replace(hn,DN).replace(gn,Cz).replace(dn,FN).replace(ln,NN)}function nn(Z){return Z.replace(kn,"\\").replace(cn,"{").replace(bn,"}").replace(pn,",").replace(yn,".")}function wN(Z){if(!Z)return[""];let J=[],Q=jz("{","}",Z);if(!Q)return Z.split(",");let{pre:X,body:x,post:q}=Q,Y=X.split(",");Y[Y.length-1]+="{"+x+"}";let $=wN(q);if(q.length)Y[Y.length-1]+=$.shift(),Y.push.apply(Y,$);return J.push.apply(J,Y),J}function _N(Z,J={}){if(!Z)return[];let{max:Q=on}=J;if(Z.slice(0,2)==="{}")Z="\\{\\}"+Z.slice(2);return DJ(sn(Z),Q,!0).map(nn)}function an(Z){return"{"+Z+"}"}function rn(Z){return/^-?0\d/.test(Z)}function tn(Z,J){return Z<=J}function en(Z,J){return Z>=J}function DJ(Z,J,Q){let X=[],x=jz("{","}",Z);if(!x)return[Z];let q=x.pre,Y=x.post.length?DJ(x.post,J,!1):[""];if(/\$$/.test(x.pre))for(let $=0;$<Y.length&&$<J;$++){let z=q+"{"+x.body+"}"+Y[$];X.push(z)}else{let $=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(x.body),z=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(x.body),W=$||z,U=x.body.indexOf(",")>=0;if(!W&&!U){if(x.post.match(/,(?!,).*\}/))return Z=x.pre+"{"+x.body+Cz+x.post,DJ(Z,J,!0);return[Z]}let H;if(W)H=x.body.split(/\.\./);else if(H=wN(x.body),H.length===1&&H[0]!==void 0){if(H=DJ(H[0],J,!1).map(an),H.length===1)return Y.map((M)=>x.pre+H[0]+M)}let B;if(W&&H[0]!==void 0&&H[1]!==void 0){let M=Lz(H[0]),D=Lz(H[1]),N=Math.max(H[0].length,H[1].length),_=H.length===3&&H[2]!==void 0?Math.max(Math.abs(Lz(H[2])),1):1,j=tn;if(D<M)_*=-1,j=en;let A=H.some(rn);B=[];for(let h=M;j(h,D);h+=_){let u;if(z){if(u=String.fromCharCode(h),u==="\\")u=""}else if(u=String(h),A){let e=N-u.length;if(e>0){let s=new Array(e+1).join("0");if(h<0)u="-"+s+u.slice(1);else u=s+u}}B.push(u)}}else{B=[];for(let M=0;M<H.length;M++)B.push.apply(B,DJ(H[M],J,!1))}for(let M=0;M<B.length;M++)for(let D=0;D<Y.length&&X.length<J;D++){let N=q+B[M]+Y[D];if(!Q||W||N)X.push(N)}}return X}var FJ=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var Za={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},NJ=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),Ja=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),PN=(Z)=>Z.join(""),jN=(Z,J)=>{let Q=J;if(Z.charAt(Q)!=="[")throw new Error("not in a brace expression");let X=[],x=[],q=Q+1,Y=!1,$=!1,z=!1,W=!1,U=Q,H="";Z:while(q<Z.length){let N=Z.charAt(q);if((N==="!"||N==="^")&&q===Q+1){W=!0,q++;continue}if(N==="]"&&Y&&!z){U=q+1;break}if(Y=!0,N==="\\"){if(!z){z=!0,q++;continue}}if(N==="["&&!z){for(let[_,[j,O,A]]of Object.entries(Za))if(Z.startsWith(_,q)){if(H)return["$.",!1,Z.length-Q,!0];if(q+=_.length,A)x.push(j);else X.push(j);$=$||O;continue Z}}if(z=!1,H){if(N>H)X.push(NJ(H)+"-"+NJ(N));else if(N===H)X.push(NJ(N));H="",q++;continue}if(Z.startsWith("-]",q+1)){X.push(NJ(N+"-")),q+=2;continue}if(Z.startsWith("-",q+1)){H=N,q+=2;continue}X.push(NJ(N)),q++}if(U<q)return["",!1,0,!1];if(!X.length&&!x.length)return["$.",!1,Z.length-Q,!0];if(x.length===0&&X.length===1&&/^\\?.$/.test(X[0])&&!W){let N=X[0].length===2?X[0].slice(-1):X[0];return[Ja(N),!1,U-Q,!1]}let B="["+(W?"^":"")+PN(X)+"]",M="["+(W?"":"^")+PN(x)+"]";return[X.length&&x.length?"("+B+"|"+M+")":X.length?B:M,$,U-Q,!0]};var F8=(Z,{windowsPathsNoEscape:J=!1,magicalBraces:Q=!0}={})=>{if(Q)return J?Z.replace(/\[([^/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1");return J?Z.replace(/\[([^/\\{}])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1")};var a4,Qa=new Set(["!","?","+","*","@"]),Oz=(Z)=>Qa.has(Z),LN=(Z)=>Oz(Z.type),Xa=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),xa=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),qa=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),CN=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Ya="(?!(?:^|/)\\.\\.?(?:$|/))",bx="(?!\\.)",$a=new Set(["[","."]),Ka=new Set(["..","."]),za=new Set("().*{}+?[]^$\\!"),Wa=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mz="[^/]",ON=mz+"*?",mN=mz+"+?",Va=0;class m9{type;#Z;#X;#x=!1;#J=[];#Y;#j;#F;#V=!1;#$;#U;#W=!1;id=++Va;get depth(){return(this.#Y?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#Z.id,parent:this.#Y?.id,depth:this.depth,partsLength:this.#J.length,parts:this.#J}}constructor(Z,J,Q={}){if(this.type=Z,Z)this.#X=!0;if(this.#Y=J,this.#Z=this.#Y?this.#Y.#Z:this,this.#$=this.#Z===this?Q:this.#Z.#$,this.#F=this.#Z===this?[]:this.#Z.#F,Z==="!"&&!this.#Z.#V)this.#F.push(this);this.#j=this.#Y?this.#Y.#J.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let Z of this.#J){if(typeof Z==="string")continue;if(Z.type||Z.hasMagic)return this.#X=!0}return this.#X}toString(){return this.#U!==void 0?this.#U:!this.type?this.#U=this.#J.map((Z)=>String(Z)).join(""):this.#U=this.type+"("+this.#J.map((Z)=>String(Z)).join("|")+")"}#K(){if(this!==this.#Z)throw new Error("should only call on root");if(this.#V)return this;this.toString(),this.#V=!0;let Z;while(Z=this.#F.pop()){if(Z.type!=="!")continue;let J=Z,Q=J.#Y;while(Q){for(let X=J.#j+1;!Q.type&&X<Q.#J.length;X++)for(let x of Z.#J){if(typeof x==="string")throw new Error("string part in extglob AST??");x.copyIn(Q.#J[X])}J=Q,Q=J.#Y}}return this}push(...Z){for(let J of Z){if(J==="")continue;if(typeof J!=="string"&&!(J instanceof a4&&J.#Y===this))throw new Error("invalid part: "+J);this.#J.push(J)}}toJSON(){let Z=this.type===null?this.#J.slice().map((J)=>typeof J==="string"?J:J.toJSON()):[this.type,...this.#J.map((J)=>J.toJSON())];if(this.isStart()&&!this.type)Z.unshift([]);if(this.isEnd()&&(this===this.#Z||this.#Z.#V&&this.#Y?.type==="!"))Z.push({});return Z}isStart(){if(this.#Z===this)return!0;if(!this.#Y?.isStart())return!1;if(this.#j===0)return!0;let Z=this.#Y;for(let J=0;J<this.#j;J++){let Q=Z.#J[J];if(!(Q instanceof a4&&Q.type==="!"))return!1}return!0}isEnd(){if(this.#Z===this)return!0;if(this.#Y?.type==="!")return!0;if(!this.#Y?.isEnd())return!1;if(!this.type)return this.#Y?.isEnd();let Z=this.#Y?this.#Y.#J.length:0;return this.#j===Z-1}copyIn(Z){if(typeof Z==="string")this.push(Z);else this.push(Z.clone(this))}clone(Z){let J=new a4(this.type,Z);for(let Q of this.#J)J.copyIn(Q);return J}static#q(Z,J,Q,X,x){let q=X.maxExtglobRecursion??2,Y=!1,$=!1,z=-1,W=!1;if(J.type===null){let D=Q,N="";while(D<Z.length){let _=Z.charAt(D++);if(Y||_==="\\"){Y=!Y,N+=_;continue}if($){if(D===z+1){if(_==="^"||_==="!")W=!0}else if(_==="]"&&!(D===z+2&&W))$=!1;N+=_;continue}else if(_==="["){$=!0,z=D,W=!1,N+=_;continue}if(!X.noext&&Oz(_)&&Z.charAt(D)==="("&&x<=q){J.push(N),N="";let O=new a4(_,J);D=a4.#q(Z,O,D,X,x+1),J.push(O);continue}N+=_}return J.push(N),D}let U=Q+1,H=new a4(null,J),B=[],M="";while(U<Z.length){let D=Z.charAt(U++);if(Y||D==="\\"){Y=!Y,M+=D;continue}if($){if(U===z+1){if(D==="^"||D==="!")W=!0}else if(D==="]"&&!(U===z+2&&W))$=!1;M+=D;continue}else if(D==="["){$=!0,z=U,W=!1,M+=D;continue}if(!X.noext&&Oz(D)&&Z.charAt(U)==="("&&(x<=q||J&&J.#G(D))){let _=J&&J.#G(D)?0:1;H.push(M),M="";let j=new a4(D,H);H.push(j),U=a4.#q(Z,j,U,X,x+_);continue}if(D==="|"){H.push(M),M="",B.push(H),H=new a4(null,J);continue}if(D===")"){if(M===""&&J.#J.length===0)J.#W=!0;return H.push(M),M="",J.push(...B,H),U}M+=D}return J.type=null,J.#X=void 0,J.#J=[Z.substring(Q-1)],U}#N(Z){return this.#_(Z,xa)}#_(Z,J=Xa){if(!Z||typeof Z!=="object"||Z.type!==null||Z.#J.length!==1||this.type===null)return!1;let Q=Z.#J[0];if(!Q||typeof Q!=="object"||Q.type===null)return!1;return this.#G(Q.type,J)}#G(Z,J=qa){return!!J.get(this.type)?.includes(Z)}#B(Z,J){let Q=Z.#J[0],X=new a4(null,Q,this.options);X.#J.push(""),Q.push(X),this.#O(Z,J)}#O(Z,J){let Q=Z.#J[0];this.#J.splice(J,1,...Q.#J);for(let X of Q.#J)if(typeof X==="object")X.#Y=this;this.#U=void 0}#M(Z){return!!CN.get(this.type)?.has(Z)}#P(Z){if(!Z||typeof Z!=="object"||Z.type!==null||Z.#J.length!==1||this.type===null||this.#J.length!==1)return!1;let J=Z.#J[0];if(!J||typeof J!=="object"||J.type===null)return!1;return this.#M(J.type)}#L(Z){let J=CN.get(this.type),Q=Z.#J[0],X=J?.get(Q.type);if(!X)return!1;this.#J=Q.#J;for(let x of this.#J)if(typeof x==="object")x.#Y=this;this.type=X,this.#U=void 0,this.#W=!1}static fromGlob(Z,J={}){let Q=new a4(null,void 0,J);return a4.#q(Z,Q,0,J,0),Q}toMMPattern(){if(this!==this.#Z)return this.#Z.toMMPattern();let Z=this.toString(),[J,Q,X,x]=this.toRegExpSource();if(!(X||this.#X||this.#$.nocase&&!this.#$.nocaseMagicOnly&&Z.toUpperCase()!==Z.toLowerCase()))return Q;let Y=(this.#$.nocase?"i":"")+(x?"u":"");return Object.assign(new RegExp(`^${J}$`,Y),{_src:J,_glob:Z})}get options(){return this.#$}toRegExpSource(Z){let J=Z??!!this.#$.dot;if(this.#Z===this)this.#H(),this.#K();if(!LN(this)){let $=this.isStart()&&this.isEnd()&&!this.#J.some((B)=>typeof B!=="string"),z=this.#J.map((B)=>{let[M,D,N,_]=typeof B==="string"?a4.#w(B,this.#X,$):B.toRegExpSource(Z);return this.#X=this.#X||N,this.#x=this.#x||_,M}).join(""),W="";if(this.isStart()){if(typeof this.#J[0]==="string"){if(!(this.#J.length===1&&Ka.has(this.#J[0]))){let M=$a,D=J&&M.has(z.charAt(0))||z.startsWith("\\.")&&M.has(z.charAt(2))||z.startsWith("\\.\\.")&&M.has(z.charAt(4)),N=!J&&!Z&&M.has(z.charAt(0));W=D?Ya:N?bx:""}}}let U="";if(this.isEnd()&&this.#Z.#V&&this.#Y?.type==="!")U="(?:$|\\/)";return[W+z+U,F8(z),this.#X=!!this.#X,this.#x]}let Q=this.type==="*"||this.type==="+",X=this.type==="!"?"(?:(?!(?:":"(?:",x=this.#D(J);if(this.isStart()&&this.isEnd()&&!x&&this.type!=="!"){let $=this.toString(),z=this;return z.#J=[$],z.type=null,z.#X=void 0,[$,F8(this.toString()),!1,!1]}let q=!Q||Z||J||!bx?"":this.#D(!0);if(q===x)q="";if(q)x=`(?:${x})(?:${q})*?`;let Y="";if(this.type==="!"&&this.#W)Y=(this.isStart()&&!J?bx:"")+mN;else{let $=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?bx:"")+ON+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&q?")":this.type==="*"&&q?")?":`)${this.type}`;Y=X+x+$}return[Y,F8(x),this.#X=!!this.#X,this.#x]}#H(){if(!LN(this)){for(let Z of this.#J)if(typeof Z==="object")Z.#H()}else{let Z=0,J=!1;do{J=!0;for(let Q=0;Q<this.#J.length;Q++){let X=this.#J[Q];if(typeof X==="object"){if(X.#H(),this.#_(X))J=!1,this.#O(X,Q);else if(this.#N(X))J=!1,this.#B(X,Q);else if(this.#P(X))J=!1,this.#L(X)}}}while(!J&&++Z<10)}this.#U=void 0}#D(Z){return this.#J.map((J)=>{if(typeof J==="string")throw new Error("string type in extglob ast??");let[Q,X,x,q]=J.toRegExpSource(Z);return this.#x=this.#x||q,Q}).filter((J)=>!(this.isStart()&&this.isEnd())||!!J).join("|")}static#w(Z,J,Q=!1){let X=!1,x="",q=!1,Y=!1;for(let $=0;$<Z.length;$++){let z=Z.charAt($);if(X){X=!1,x+=(za.has(z)?"\\":"")+z;continue}if(z==="*"){if(Y)continue;Y=!0,x+=Q&&/^[*]+$/.test(Z)?mN:ON,J=!0;continue}else Y=!1;if(z==="\\"){if($===Z.length-1)x+="\\\\";else X=!0;continue}if(z==="["){let[W,U,H,B]=jN(Z,$);if(H){x+=W,q=q||U,$+=H-1,J=J||B;continue}}if(z==="?"){x+=mz,J=!0;continue}x+=Wa(z)}return[x,F8(Z),!!J,q]}}a4=m9;var S9=(Z,{windowsPathsNoEscape:J=!1,magicalBraces:Q=!1}={})=>{if(Q)return J?Z.replace(/[?*()[\]{}]/g,"[$&]"):Z.replace(/[?*()[\]\\{}]/g,"\\$&");return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var k4=(Z,J,Q={})=>{if(FJ(J),!Q.nocomment&&J.charAt(0)==="#")return!1;return new d3(J,Q).match(Z)},Ua=/^\*+([^+@!?*[(]*)$/,Ha=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),Ga=(Z)=>(J)=>J.endsWith(Z),Ba=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},Ma=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},Da=/^\*+\.\*+$/,Fa=(Z)=>!Z.startsWith(".")&&Z.includes("."),Na=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),wa=/^\.\*+$/,_a=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),Pa=/^\*+$/,ja=(Z)=>Z.length!==0&&!Z.startsWith("."),La=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",Ca=/^\?+([^+@!?*[(]*)?$/,Oa=([Z,J=""])=>{let Q=IN([Z]);if(!J)return Q;return J=J.toLowerCase(),(X)=>Q(X)&&X.toLowerCase().endsWith(J)},ma=([Z,J=""])=>{let Q=TN([Z]);if(!J)return Q;return J=J.toLowerCase(),(X)=>Q(X)&&X.toLowerCase().endsWith(J)},Sa=([Z,J=""])=>{let Q=TN([Z]);return!J?Q:(X)=>Q(X)&&X.endsWith(J)},Ra=([Z,J=""])=>{let Q=IN([Z]);return!J?Q:(X)=>Q(X)&&X.endsWith(J)},IN=([Z])=>{let J=Z.length;return(Q)=>Q.length===J&&!Q.startsWith(".")},TN=([Z])=>{let J=Z.length;return(Q)=>Q.length===J&&Q!=="."&&Q!==".."},vN=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",SN={win32:{sep:"\\"},posix:{sep:"/"}},Ia=vN==="win32"?SN.win32.sep:SN.posix.sep;k4.sep=Ia;var O2=Symbol("globstar **");k4.GLOBSTAR=O2;var Ta="[^/]",va=Ta+"*?",Aa="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ea="(?:(?!(?:\\/|^)\\.).)*?",fa=(Z,J={})=>(Q)=>k4(Q,Z,J);k4.filter=fa;var i3=(Z,J={})=>Object.assign({},Z,J),ka=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return k4;let J=k4;return Object.assign((X,x,q={})=>J(X,x,i3(Z,q)),{Minimatch:class X extends J.Minimatch{constructor(x,q={}){super(x,i3(Z,q))}static defaults(x){return J.defaults(i3(Z,x)).Minimatch}},AST:class X extends J.AST{constructor(x,q,Y={}){super(x,q,i3(Z,Y))}static fromGlob(x,q={}){return J.AST.fromGlob(x,i3(Z,q))}},unescape:(X,x={})=>J.unescape(X,i3(Z,x)),escape:(X,x={})=>J.escape(X,i3(Z,x)),filter:(X,x={})=>J.filter(X,i3(Z,x)),defaults:(X)=>J.defaults(i3(Z,X)),makeRe:(X,x={})=>J.makeRe(X,i3(Z,x)),braceExpand:(X,x={})=>J.braceExpand(X,i3(Z,x)),match:(X,x,q={})=>J.match(X,x,i3(Z,q)),sep:J.sep,GLOBSTAR:O2})};k4.defaults=ka;var AN=(Z,J={})=>{if(FJ(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return _N(Z,{max:J.braceExpandMax})};k4.braceExpand=AN;var ca=(Z,J={})=>new d3(Z,J).makeRe();k4.makeRe=ca;var ba=(Z,J,Q={})=>{let X=new d3(J,Q);if(Z=Z.filter((x)=>X.match(x)),X.options.nonull&&!Z.length)Z.push(J);return Z};k4.match=ba;var RN=/[?*]|[+@!]\(.*?\)|\[|\]/,pa=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class d3{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(Z,J={}){FJ(Z),J=J||{},this.options=J,this.maxGlobstarRecursion=J.maxGlobstarRecursion??200,this.pattern=Z,this.platform=J.platform||vN,this.isWindows=this.platform==="win32";let Q="allowWindowsEscape";if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J[Q]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!J.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!J.nonegate,this.comment=!1,this.empty=!1,this.partial=!!J.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=J.windowsNoMagicRoot!==void 0?J.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Z of this.set)for(let J of Z)if(typeof J!=="string")return!0;return!1}debug(...Z){}make(){let Z=this.pattern,J=this.options;if(!J.nocomment&&Z.charAt(0)==="#"){this.comment=!0;return}if(!Z){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],J.debug)this.debug=(...x)=>console.error(...x);this.debug(this.pattern,this.globSet);let Q=this.globSet.map((x)=>this.slashSplit(x));this.globParts=this.preprocess(Q),this.debug(this.pattern,this.globParts);let X=this.globParts.map((x,q,Y)=>{if(this.isWindows&&this.windowsNoMagicRoot){let $=x[0]===""&&x[1]===""&&(x[2]==="?"||!RN.test(x[2]))&&!RN.test(x[3]),z=/^[a-z]:/i.test(x[0]);if($)return[...x.slice(0,4),...x.slice(4).map((W)=>this.parse(W))];else if(z)return[x[0],...x.slice(1).map((W)=>this.parse(W))]}return x.map(($)=>this.parse($))});if(this.debug(this.pattern,X),this.set=X.filter((x)=>x.indexOf(!1)===-1),this.isWindows)for(let x=0;x<this.set.length;x++){let q=this.set[x];if(q[0]===""&&q[1]===""&&this.globParts[x][2]==="?"&&typeof q[3]==="string"&&/^[a-z]:$/i.test(q[3]))q[2]="?"}this.debug(this.pattern,this.set)}preprocess(Z){if(this.options.noglobstar){for(let Q of Z)for(let X=0;X<Q.length;X++)if(Q[X]==="**")Q[X]="*"}let{optimizationLevel:J=1}=this.options;if(J>=2)Z=this.firstPhasePreProcess(Z),Z=this.secondPhasePreProcess(Z);else if(J>=1)Z=this.levelOneOptimize(Z);else Z=this.adjascentGlobstarOptimize(Z);return Z}adjascentGlobstarOptimize(Z){return Z.map((J)=>{let Q=-1;while((Q=J.indexOf("**",Q+1))!==-1){let X=Q;while(J[X+1]==="**")X++;if(X!==Q)J.splice(Q,X-Q)}return J})}levelOneOptimize(Z){return Z.map((J)=>{return J=J.reduce((Q,X)=>{let x=Q[Q.length-1];if(X==="**"&&x==="**")return Q;if(X===".."){if(x&&x!==".."&&x!=="."&&x!=="**")return Q.pop(),Q}return Q.push(X),Q},[]),J.length===0?[""]:J})}levelTwoFileOptimize(Z){if(!Array.isArray(Z))Z=this.slashSplit(Z);let J=!1;do{if(J=!1,!this.preserveMultipleSlashes){for(let X=1;X<Z.length-1;X++){let x=Z[X];if(X===1&&x===""&&Z[0]==="")continue;if(x==="."||x==="")J=!0,Z.splice(X,1),X--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))J=!0,Z.pop()}let Q=0;while((Q=Z.indexOf("..",Q+1))!==-1){let X=Z[Q-1];if(X&&X!=="."&&X!==".."&&X!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(X)))J=!0,Z.splice(Q-1,2),Q-=2}}while(J);return Z.length===0?[""]:Z}firstPhasePreProcess(Z){let J=!1;do{J=!1;for(let Q of Z){let X=-1;while((X=Q.indexOf("**",X+1))!==-1){let q=X;while(Q[q+1]==="**")q++;if(q>X)Q.splice(X+1,q-X);let Y=Q[X+1],$=Q[X+2],z=Q[X+3];if(Y!=="..")continue;if(!$||$==="."||$===".."||!z||z==="."||z==="..")continue;J=!0,Q.splice(X,1);let W=Q.slice(0);W[X]="**",Z.push(W),X--}if(!this.preserveMultipleSlashes){for(let q=1;q<Q.length-1;q++){let Y=Q[q];if(q===1&&Y===""&&Q[0]==="")continue;if(Y==="."||Y==="")J=!0,Q.splice(q,1),q--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))J=!0,Q.pop()}let x=0;while((x=Q.indexOf("..",x+1))!==-1){let q=Q[x-1];if(q&&q!=="."&&q!==".."&&q!=="**"){J=!0;let $=x===1&&Q[x+1]==="**"?["."]:[];if(Q.splice(x-1,2,...$),Q.length===0)Q.push("");x-=2}}}}while(J);return Z}secondPhasePreProcess(Z){for(let J=0;J<Z.length-1;J++)for(let Q=J+1;Q<Z.length;Q++){let X=this.partsMatch(Z[J],Z[Q],!this.preserveMultipleSlashes);if(X){Z[J]=[],Z[Q]=X;break}}return Z.filter((J)=>J.length)}partsMatch(Z,J,Q=!1){let X=0,x=0,q=[],Y="";while(X<Z.length&&x<J.length)if(Z[X]===J[x])q.push(Y==="b"?J[x]:Z[X]),X++,x++;else if(Q&&Z[X]==="**"&&J[x]===Z[X+1])q.push(Z[X]),X++;else if(Q&&J[x]==="**"&&Z[X]===J[x+1])q.push(J[x]),x++;else if(Z[X]==="*"&&J[x]&&(this.options.dot||!J[x].startsWith("."))&&J[x]!=="**"){if(Y==="b")return!1;Y="a",q.push(Z[X]),X++,x++}else if(J[x]==="*"&&Z[X]&&(this.options.dot||!Z[X].startsWith("."))&&Z[X]!=="**"){if(Y==="a")return!1;Y="b",q.push(J[x]),X++,x++}else return!1;return Z.length===J.length&&q}parseNegate(){if(this.nonegate)return;let Z=this.pattern,J=!1,Q=0;for(let X=0;X<Z.length&&Z.charAt(X)==="!";X++)J=!J,Q++;if(Q)this.pattern=Z.slice(Q);this.negate=J}matchOne(Z,J,Q=!1){let X=0,x=0;if(this.isWindows){let Y=typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0]),$=!Y&&Z[0]===""&&Z[1]===""&&Z[2]==="?"&&/^[a-z]:$/i.test(Z[3]),z=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),W=!z&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),U=$?3:Y?0:void 0,H=W?3:z?0:void 0;if(typeof U==="number"&&typeof H==="number"){let[B,M]=[Z[U],J[H]];if(B.toLowerCase()===M.toLowerCase())J[H]=B,x=H,X=U}}let{optimizationLevel:q=1}=this.options;if(q>=2)Z=this.levelTwoFileOptimize(Z);if(J.includes(O2))return this.#Z(Z,J,Q,X,x);return this.#x(Z,J,Q,X,x)}#Z(Z,J,Q,X,x){let q=J.indexOf(O2,x),Y=J.lastIndexOf(O2),[$,z,W]=Q?[J.slice(x,q),J.slice(q+1),[]]:[J.slice(x,q),J.slice(q+1,Y),J.slice(Y+1)];if($.length){let j=Z.slice(X,X+$.length);if(!this.#x(j,$,Q,0,0))return!1;X+=$.length,x+=$.length}let U=0;if(W.length){if(W.length+X>Z.length)return!1;let j=Z.length-W.length;if(this.#x(Z,W,Q,j,0))U=W.length;else{if(Z[Z.length-1]!==""||X+W.length===Z.length)return!1;if(j--,!this.#x(Z,W,Q,j,0))return!1;U=W.length+1}}if(!z.length){let j=!!U;for(let O=X;O<Z.length-U;O++){let A=String(Z[O]);if(j=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return Q||j}let H=[[[],0]],B=H[0],M=0,D=[0];for(let j of z)if(j===O2)D.push(M),B=[[],0],H.push(B);else B[0].push(j),M++;let N=H.length-1,_=Z.length-U;for(let j of H)j[1]=_-(D[N--]+j[0].length);return!!this.#X(Z,H,X,0,Q,0,!!U)}#X(Z,J,Q,X,x,q,Y){let $=J[X];if(!$){for(let U=Q;U<Z.length;U++){Y=!0;let H=Z[U];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1}return Y}let[z,W]=$;while(Q<=W){if(this.#x(Z.slice(0,Q+z.length),z,x,Q,0)&&q<this.maxGlobstarRecursion){let B=this.#X(Z,J,Q+z.length,X+1,x,q+1,Y);if(B!==!1)return B}let H=Z[Q];if(H==="."||H===".."||!this.options.dot&&H.startsWith("."))return!1;Q++}return x||null}#x(Z,J,Q,X,x){let q,Y,$,z;for(q=X,Y=x,z=Z.length,$=J.length;q<z&&Y<$;q++,Y++){this.debug("matchOne loop");let W=J[Y],U=Z[q];if(this.debug(J,W,U),W===!1||W===O2)return!1;let H;if(typeof W==="string")H=U===W,this.debug("string match",W,U,H);else H=W.test(U),this.debug("pattern match",W,U,H);if(!H)return!1}if(q===z&&Y===$)return!0;else if(q===z)return Q;else if(Y===$)return q===z-1&&Z[q]==="";else throw new Error("wtf?")}braceExpand(){return AN(this.pattern,this.options)}parse(Z){FJ(Z);let J=this.options;if(Z==="**")return O2;if(Z==="")return"";let Q,X=null;if(Q=Z.match(Pa))X=J.dot?La:ja;else if(Q=Z.match(Ua))X=(J.nocase?J.dot?Ma:Ba:J.dot?Ga:Ha)(Q[1]);else if(Q=Z.match(Ca))X=(J.nocase?J.dot?ma:Oa:J.dot?Sa:Ra)(Q);else if(Q=Z.match(Da))X=J.dot?Na:Fa;else if(Q=Z.match(wa))X=_a;let x=m9.fromGlob(Z,this.options).toMMPattern();if(X&&typeof x==="object")Reflect.defineProperty(x,"test",{value:X});return x}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Z=this.set;if(!Z.length)return this.regexp=!1,this.regexp;let J=this.options,Q=J.noglobstar?va:J.dot?Aa:Ea,X=new Set(J.nocase?["i"]:[]),x=Z.map(($)=>{let z=$.map((U)=>{if(U instanceof RegExp)for(let H of U.flags.split(""))X.add(H);return typeof U==="string"?pa(U):U===O2?O2:U._src});z.forEach((U,H)=>{let B=z[H+1],M=z[H-1];if(U!==O2||M===O2)return;if(M===void 0)if(B!==void 0&&B!==O2)z[H+1]="(?:\\/|"+Q+"\\/)?"+B;else z[H]=Q;else if(B===void 0)z[H-1]=M+"(?:\\/|\\/"+Q+")?";else if(B!==O2)z[H-1]=M+"(?:\\/|\\/"+Q+"\\/)"+B,z[H+1]=O2});let W=z.filter((U)=>U!==O2);if(this.partial&&W.length>=1){let U=[];for(let H=1;H<=W.length;H++)U.push(W.slice(0,H).join("/"));return"(?:"+U.join("|")+")"}return W.join("/")}).join("|"),[q,Y]=Z.length>1?["(?:",")"]:["",""];if(x="^"+q+x+Y+"$",this.partial)x="^(?:\\/|"+q+x.slice(1,-1)+Y+")$";if(this.negate)x="^(?!"+x+").+$";try{this.regexp=new RegExp(x,[...X].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let Q=this.options;if(this.isWindows)Z=Z.split("\\").join("/");let X=this.slashSplit(Z);this.debug(this.pattern,"split",X);let x=this.set;this.debug(this.pattern,"set",x);let q=X[X.length-1];if(!q)for(let Y=X.length-2;!q&&Y>=0;Y--)q=X[Y];for(let Y of x){let $=X;if(Q.matchBase&&Y.length===1)$=[q];if(this.matchOne($,Y,J)){if(Q.flipNegate)return!0;return!this.negate}}if(Q.flipNegate)return!1;return this.negate}static defaults(Z){return k4.defaults(Z).Minimatch}}k4.AST=m9;k4.Minimatch=d3;k4.escape=S9;k4.unescape=F8;import{fileURLToPath as Fr}from"node:url";var ya=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,fN=new Set,Sz=typeof process==="object"&&!!process?process:{},kN=(Z,J,Q,X)=>{typeof Sz.emitWarning==="function"?Sz.emitWarning(Z,J,Q,X):console.error(`[${Q}] ${J}: ${Z}`)},px=globalThis.AbortController,EN=globalThis.AbortSignal;if(typeof px==="undefined"){EN=class Q{onabort;_onabort=[];reason;aborted=!1;addEventListener(X,x){this._onabort.push(x)}},px=class Q{constructor(){J()}signal=new EN;abort(X){if(this.signal.aborted)return;this.signal.reason=X,this.signal.aborted=!0;for(let x of this.signal._onabort)x(X);this.signal.onabort?.(X)}};let Z=Sz.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,kN("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",J)}}var ua=(Z)=>!fN.has(Z),qv0=Symbol("type"),H5=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),cN=(Z)=>!H5(Z)?null:Z<=Math.pow(2,8)?Uint8Array:Z<=Math.pow(2,16)?Uint16Array:Z<=Math.pow(2,32)?Uint32Array:Z<=Number.MAX_SAFE_INTEGER?wJ:null;class wJ extends Array{constructor(Z){super(Z);this.fill(0)}}class R9{heap;length;static#Z=!1;static create(Z){let J=cN(Z);if(!J)return[];R9.#Z=!0;let Q=new R9(Z,J);return R9.#Z=!1,Q}constructor(Z,J){if(!R9.#Z)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new J(Z),this.length=0}push(Z){this.heap[this.length++]=Z}pop(){return this.heap[--this.length]}}class U7{#Z;#X;#x;#J;#Y;#j;#F;#V;get perf(){return this.#V}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#$;#U;#W;#K;#q;#N;#_;#G;#B;#O;#M;#P;#L;#H;#D;#w;#m;#Q;#E;static unsafeExposeInternals(Z){return{starts:Z.#L,ttls:Z.#H,autopurgeTimers:Z.#D,sizes:Z.#P,keyMap:Z.#W,keyList:Z.#K,valList:Z.#q,next:Z.#N,prev:Z.#_,get head(){return Z.#G},get tail(){return Z.#B},free:Z.#O,isBackgroundFetch:(J)=>Z.#z(J),backgroundFetch:(J,Q,X,x)=>Z.#h(J,Q,X,x),moveToTail:(J)=>Z.#k(J),indexes:(J)=>Z.#I(J),rindexes:(J)=>Z.#T(J),isStale:(J)=>Z.#C(J)}}get max(){return this.#Z}get maxSize(){return this.#X}get calculatedSize(){return this.#U}get size(){return this.#$}get fetchMethod(){return this.#j}get memoMethod(){return this.#F}get dispose(){return this.#x}get onInsert(){return this.#J}get disposeAfter(){return this.#Y}constructor(Z){let{max:J=0,ttl:Q,ttlResolution:X=1,ttlAutopurge:x,updateAgeOnGet:q,updateAgeOnHas:Y,allowStale:$,dispose:z,onInsert:W,disposeAfter:U,noDisposeOnSet:H,noUpdateTTL:B,maxSize:M=0,maxEntrySize:D=0,sizeCalculation:N,fetchMethod:_,memoMethod:j,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:u,ignoreFetchAbort:e,perf:s}=Z;if(s!==void 0){if(typeof s?.now!=="function")throw new TypeError("perf option must have a now() method if specified")}if(this.#V=s??ya,J!==0&&!H5(J))throw new TypeError("max option must be a nonnegative integer");let m=J?cN(J):Array;if(!m)throw new Error("invalid max value: "+J);if(this.#Z=J,this.#X=M,this.maxEntrySize=D||this.#X,this.sizeCalculation=N,this.sizeCalculation){if(!this.#X&&!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(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=j,_!==void 0&&typeof _!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#j=_,this.#m=!!_,this.#W=new Map,this.#K=new Array(J).fill(void 0),this.#q=new Array(J).fill(void 0),this.#N=new m(J),this.#_=new m(J),this.#G=0,this.#B=0,this.#O=R9.create(J),this.#$=0,this.#U=0,typeof z==="function")this.#x=z;if(typeof W==="function")this.#J=W;if(typeof U==="function")this.#Y=U,this.#M=[];else this.#Y=void 0,this.#M=void 0;if(this.#w=!!this.#x,this.#E=!!this.#J,this.#Q=!!this.#Y,this.noDisposeOnSet=!!H,this.noUpdateTTL=!!B,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!h,this.allowStaleOnFetchAbort=!!u,this.ignoreFetchAbort=!!e,this.maxEntrySize!==0){if(this.#X!==0){if(!H5(this.#X))throw new TypeError("maxSize must be a positive integer if specified")}if(!H5(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#i()}if(this.allowStale=!!$,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!q,this.updateAgeOnHas=!!Y,this.ttlResolution=H5(X)||X===0?X:1,this.ttlAutopurge=!!x,this.ttl=Q||0,this.ttl){if(!H5(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#v()}if(this.#Z===0&&this.ttl===0&&this.#X===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Z&&!this.#X){if(ua("LRU_CACHE_UNBOUNDED"))fN.add("LRU_CACHE_UNBOUNDED"),kN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",U7)}}getRemainingTTL(Z){return this.#W.has(Z)?1/0:0}#v(){let Z=new wJ(this.#Z),J=new wJ(this.#Z);this.#H=Z,this.#L=J;let Q=this.ttlAutopurge?new Array(this.#Z):void 0;this.#D=Q,this.#b=(q,Y,$=this.#V.now())=>{if(J[q]=Y!==0?$:0,Z[q]=Y,Q?.[q])clearTimeout(Q[q]),Q[q]=void 0;if(Y!==0&&Q){let z=setTimeout(()=>{if(this.#C(q))this.#R(this.#K[q],"expire")},Y+1);if(z.unref)z.unref();Q[q]=z}},this.#S=(q)=>{J[q]=Z[q]!==0?this.#V.now():0},this.#A=(q,Y)=>{if(Z[Y]){let $=Z[Y],z=J[Y];if(!$||!z)return;q.ttl=$,q.start=z,q.now=X||x();let W=q.now-z;q.remainingTTL=$-W}};let X=0,x=()=>{let q=this.#V.now();if(this.ttlResolution>0){X=q;let Y=setTimeout(()=>X=0,this.ttlResolution);if(Y.unref)Y.unref()}return q};this.getRemainingTTL=(q)=>{let Y=this.#W.get(q);if(Y===void 0)return 0;let $=Z[Y],z=J[Y];if(!$||!z)return 1/0;let W=(X||x())-z;return $-W},this.#C=(q)=>{let Y=J[q],$=Z[q];return!!$&&!!Y&&(X||x())-Y>$}}#S=()=>{};#A=()=>{};#b=()=>{};#C=()=>!1;#i(){let Z=new wJ(this.#Z);this.#U=0,this.#P=Z,this.#c=(J)=>{this.#U-=Z[J],Z[J]=0},this.#p=(J,Q,X,x)=>{if(this.#z(Q))return 0;if(!H5(X))if(x){if(typeof x!=="function")throw new TypeError("sizeCalculation must be a function");if(X=x(Q,J),!H5(X))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 X},this.#f=(J,Q,X)=>{if(Z[J]=Q,this.#X){let x=this.#X-Z[J];while(this.#U>x)this.#u(!0)}if(this.#U+=Z[J],X)X.entrySize=Q,X.totalCalculatedSize=this.#U}}#c=(Z)=>{};#f=(Z,J,Q)=>{};#p=(Z,J,Q,X)=>{if(Q||X)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#I({allowStale:Z=this.allowStale}={}){if(this.#$)for(let J=this.#B;;){if(!this.#y(J))break;if(Z||!this.#C(J))yield J;if(J===this.#G)break;else J=this.#_[J]}}*#T({allowStale:Z=this.allowStale}={}){if(this.#$)for(let J=this.#G;;){if(!this.#y(J))break;if(Z||!this.#C(J))yield J;if(J===this.#B)break;else J=this.#N[J]}}#y(Z){return Z!==void 0&&this.#W.get(this.#K[Z])===Z}*entries(){for(let Z of this.#I())if(this.#q[Z]!==void 0&&this.#K[Z]!==void 0&&!this.#z(this.#q[Z]))yield[this.#K[Z],this.#q[Z]]}*rentries(){for(let Z of this.#T())if(this.#q[Z]!==void 0&&this.#K[Z]!==void 0&&!this.#z(this.#q[Z]))yield[this.#K[Z],this.#q[Z]]}*keys(){for(let Z of this.#I()){let J=this.#K[Z];if(J!==void 0&&!this.#z(this.#q[Z]))yield J}}*rkeys(){for(let Z of this.#T()){let J=this.#K[Z];if(J!==void 0&&!this.#z(this.#q[Z]))yield J}}*values(){for(let Z of this.#I())if(this.#q[Z]!==void 0&&!this.#z(this.#q[Z]))yield this.#q[Z]}*rvalues(){for(let Z of this.#T())if(this.#q[Z]!==void 0&&!this.#z(this.#q[Z]))yield this.#q[Z]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Z,J={}){for(let Q of this.#I()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;if(Z(x,this.#K[Q],this))return this.get(this.#K[Q],J)}}forEach(Z,J=this){for(let Q of this.#I()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;Z.call(J,x,this.#K[Q],this)}}rforEach(Z,J=this){for(let Q of this.#T()){let X=this.#q[Q],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0)continue;Z.call(J,x,this.#K[Q],this)}}purgeStale(){let Z=!1;for(let J of this.#T({allowStale:!0}))if(this.#C(J))this.#R(this.#K[J],"expire"),Z=!0;return Z}info(Z){let J=this.#W.get(Z);if(J===void 0)return;let Q=this.#q[J],X=this.#z(Q)?Q.__staleWhileFetching:Q;if(X===void 0)return;let x={value:X};if(this.#H&&this.#L){let q=this.#H[J],Y=this.#L[J];if(q&&Y){let $=q-(this.#V.now()-Y);x.ttl=$,x.start=Date.now()}}if(this.#P)x.size=this.#P[J];return x}dump(){let Z=[];for(let J of this.#I({allowStale:!0})){let Q=this.#K[J],X=this.#q[J],x=this.#z(X)?X.__staleWhileFetching:X;if(x===void 0||Q===void 0)continue;let q={value:x};if(this.#H&&this.#L){q.ttl=this.#H[J];let Y=this.#V.now()-this.#L[J];q.start=Math.floor(Date.now()-Y)}if(this.#P)q.size=this.#P[J];Z.unshift([Q,q])}return Z}load(Z){this.clear();for(let[J,Q]of Z){if(Q.start){let X=Date.now()-Q.start;Q.start=this.#V.now()-X}this.set(J,Q.value,Q)}}set(Z,J,Q={}){if(J===void 0)return this.delete(Z),this;let{ttl:X=this.ttl,start:x,noDisposeOnSet:q=this.noDisposeOnSet,sizeCalculation:Y=this.sizeCalculation,status:$}=Q,{noUpdateTTL:z=this.noUpdateTTL}=Q,W=this.#p(Z,J,Q.size||0,Y);if(this.maxEntrySize&&W>this.maxEntrySize){if($)$.set="miss",$.maxEntrySizeExceeded=!0;return this.#R(Z,"set"),this}let U=this.#$===0?void 0:this.#W.get(Z);if(U===void 0){if(U=this.#$===0?this.#B:this.#O.length!==0?this.#O.pop():this.#$===this.#Z?this.#u(!1):this.#$,this.#K[U]=Z,this.#q[U]=J,this.#W.set(Z,U),this.#N[this.#B]=U,this.#_[U]=this.#B,this.#B=U,this.#$++,this.#f(U,W,$),$)$.set="add";if(z=!1,this.#E)this.#J?.(J,Z,"add")}else{this.#k(U);let H=this.#q[U];if(J!==H){if(this.#m&&this.#z(H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:B}=H;if(B!==void 0&&!q){if(this.#w)this.#x?.(B,Z,"set");if(this.#Q)this.#M?.push([B,Z,"set"])}}else if(!q){if(this.#w)this.#x?.(H,Z,"set");if(this.#Q)this.#M?.push([H,Z,"set"])}if(this.#c(U),this.#f(U,W,$),this.#q[U]=J,$){$.set="replace";let B=H&&this.#z(H)?H.__staleWhileFetching:H;if(B!==void 0)$.oldValue=B}}else if($)$.set="update";if(this.#E)this.onInsert?.(J,Z,J===H?"update":"replace")}if(X!==0&&!this.#H)this.#v();if(this.#H){if(!z)this.#b(U,X,x);if($)this.#A($,U)}if(!q&&this.#Q&&this.#M){let H=this.#M,B;while(B=H?.shift())this.#Y?.(...B)}return this}pop(){try{while(this.#$){let Z=this.#q[this.#G];if(this.#u(!0),this.#z(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#Q&&this.#M){let Z=this.#M,J;while(J=Z?.shift())this.#Y?.(...J)}}}#u(Z){let J=this.#G,Q=this.#K[J],X=this.#q[J];if(this.#m&&this.#z(X))X.__abortController.abort(new Error("evicted"));else if(this.#w||this.#Q){if(this.#w)this.#x?.(X,Q,"evict");if(this.#Q)this.#M?.push([X,Q,"evict"])}if(this.#c(J),this.#D?.[J])clearTimeout(this.#D[J]),this.#D[J]=void 0;if(Z)this.#K[J]=void 0,this.#q[J]=void 0,this.#O.push(J);if(this.#$===1)this.#G=this.#B=0,this.#O.length=0;else this.#G=this.#N[J];return this.#W.delete(Q),this.#$--,J}has(Z,J={}){let{updateAgeOnHas:Q=this.updateAgeOnHas,status:X}=J,x=this.#W.get(Z);if(x!==void 0){let q=this.#q[x];if(this.#z(q)&&q.__staleWhileFetching===void 0)return!1;if(!this.#C(x)){if(Q)this.#S(x);if(X)X.has="hit",this.#A(X,x);return!0}else if(X)X.has="stale",this.#A(X,x)}else if(X)X.has="miss";return!1}peek(Z,J={}){let{allowStale:Q=this.allowStale}=J,X=this.#W.get(Z);if(X===void 0||!Q&&this.#C(X))return;let x=this.#q[X];return this.#z(x)?x.__staleWhileFetching:x}#h(Z,J,Q,X){let x=J===void 0?void 0:this.#q[J];if(this.#z(x))return x;let q=new px,{signal:Y}=Q;Y?.addEventListener("abort",()=>q.abort(Y.reason),{signal:q.signal});let $={signal:q.signal,options:Q,context:X},z=(D,N=!1)=>{let{aborted:_}=q.signal,j=Q.ignoreFetchAbort&&D!==void 0;if(Q.status)if(_&&!N){if(Q.status.fetchAborted=!0,Q.status.fetchError=q.signal.reason,j)Q.status.fetchAbortIgnored=!0}else Q.status.fetchResolved=!0;if(_&&!j&&!N)return U(q.signal.reason);let O=B,A=this.#q[J];if(A===B||j&&N&&A===void 0)if(D===void 0)if(O.__staleWhileFetching!==void 0)this.#q[J]=O.__staleWhileFetching;else this.#R(Z,"fetch");else{if(Q.status)Q.status.fetchUpdated=!0;this.set(Z,D,$.options)}return D},W=(D)=>{if(Q.status)Q.status.fetchRejected=!0,Q.status.fetchError=D;return U(D)},U=(D)=>{let{aborted:N}=q.signal,_=N&&Q.allowStaleOnFetchAbort,j=_||Q.allowStaleOnFetchRejection,O=j||Q.noDeleteOnFetchRejection,A=B;if(this.#q[J]===B){if(!O||A.__staleWhileFetching===void 0)this.#R(Z,"fetch");else if(!_)this.#q[J]=A.__staleWhileFetching}if(j){if(Q.status&&A.__staleWhileFetching!==void 0)Q.status.returnedStale=!0;return A.__staleWhileFetching}else if(A.__returned===A)throw D},H=(D,N)=>{let _=this.#j?.(Z,x,$);if(_&&_ instanceof Promise)_.then((j)=>D(j===void 0?void 0:j),N);q.signal.addEventListener("abort",()=>{if(!Q.ignoreFetchAbort||Q.allowStaleOnFetchAbort){if(D(void 0),Q.allowStaleOnFetchAbort)D=(j)=>z(j,!0)}})};if(Q.status)Q.status.fetchDispatched=!0;let B=new Promise(H).then(z,W),M=Object.assign(B,{__abortController:q,__staleWhileFetching:x,__returned:void 0});if(J===void 0)this.set(Z,M,{...$.options,status:void 0}),J=this.#W.get(Z);else this.#q[J]=M;return M}#z(Z){if(!this.#m)return!1;let J=Z;return!!J&&J instanceof Promise&&J.hasOwnProperty("__staleWhileFetching")&&J.__abortController instanceof px}async fetch(Z,J={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:X=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,ttl:q=this.ttl,noDisposeOnSet:Y=this.noDisposeOnSet,size:$=0,sizeCalculation:z=this.sizeCalculation,noUpdateTTL:W=this.noUpdateTTL,noDeleteOnFetchRejection:U=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:H=this.allowStaleOnFetchRejection,ignoreFetchAbort:B=this.ignoreFetchAbort,allowStaleOnFetchAbort:M=this.allowStaleOnFetchAbort,context:D,forceRefresh:N=!1,status:_,signal:j}=J;if(!this.#m){if(_)_.fetch="get";return this.get(Z,{allowStale:Q,updateAgeOnGet:X,noDeleteOnStaleGet:x,status:_})}let O={allowStale:Q,updateAgeOnGet:X,noDeleteOnStaleGet:x,ttl:q,noDisposeOnSet:Y,size:$,sizeCalculation:z,noUpdateTTL:W,noDeleteOnFetchRejection:U,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:M,ignoreFetchAbort:B,status:_,signal:j},A=this.#W.get(Z);if(A===void 0){if(_)_.fetch="miss";let h=this.#h(Z,A,O,D);return h.__returned=h}else{let h=this.#q[A];if(this.#z(h)){let R=Q&&h.__staleWhileFetching!==void 0;if(_){if(_.fetch="inflight",R)_.returnedStale=!0}return R?h.__staleWhileFetching:h.__returned=h}let u=this.#C(A);if(!N&&!u){if(_)_.fetch="hit";if(this.#k(A),X)this.#S(A);if(_)this.#A(_,A);return h}let e=this.#h(Z,A,O,D),m=e.__staleWhileFetching!==void 0&&Q;if(_){if(_.fetch=u?"stale":"refresh",m&&u)_.returnedStale=!0}return m?e.__staleWhileFetching:e.__returned=e}}async forceFetch(Z,J={}){let Q=await this.fetch(Z,J);if(Q===void 0)throw new Error("fetch() returned undefined");return Q}memo(Z,J={}){let Q=this.#F;if(!Q)throw new Error("no memoMethod provided to constructor");let{context:X,forceRefresh:x,...q}=J,Y=this.get(Z,q);if(!x&&Y!==void 0)return Y;let $=Q(Z,Y,{options:q,context:X});return this.set(Z,$,q),$}get(Z,J={}){let{allowStale:Q=this.allowStale,updateAgeOnGet:X=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,status:q}=J,Y=this.#W.get(Z);if(Y!==void 0){let $=this.#q[Y],z=this.#z($);if(q)this.#A(q,Y);if(this.#C(Y)){if(q)q.get="stale";if(!z){if(!x)this.#R(Z,"expire");if(q&&Q)q.returnedStale=!0;return Q?$:void 0}else{if(q&&Q&&$.__staleWhileFetching!==void 0)q.returnedStale=!0;return Q?$.__staleWhileFetching:void 0}}else{if(q)q.get="hit";if(z)return $.__staleWhileFetching;if(this.#k(Y),X)this.#S(Y);return $}}else if(q)q.get="miss"}#g(Z,J){this.#_[J]=Z,this.#N[Z]=J}#k(Z){if(Z!==this.#B){if(Z===this.#G)this.#G=this.#N[Z];else this.#g(this.#_[Z],this.#N[Z]);this.#g(this.#B,Z),this.#B=Z}}delete(Z){return this.#R(Z,"delete")}#R(Z,J){let Q=!1;if(this.#$!==0){let X=this.#W.get(Z);if(X!==void 0){if(this.#D?.[X])clearTimeout(this.#D?.[X]),this.#D[X]=void 0;if(Q=!0,this.#$===1)this.#d(J);else{this.#c(X);let x=this.#q[X];if(this.#z(x))x.__abortController.abort(new Error("deleted"));else if(this.#w||this.#Q){if(this.#w)this.#x?.(x,Z,J);if(this.#Q)this.#M?.push([x,Z,J])}if(this.#W.delete(Z),this.#K[X]=void 0,this.#q[X]=void 0,X===this.#B)this.#B=this.#_[X];else if(X===this.#G)this.#G=this.#N[X];else{let q=this.#_[X];this.#N[q]=this.#N[X];let Y=this.#N[X];this.#_[Y]=this.#_[X]}this.#$--,this.#O.push(X)}}}if(this.#Q&&this.#M?.length){let X=this.#M,x;while(x=X?.shift())this.#Y?.(...x)}return Q}clear(){return this.#d("delete")}#d(Z){for(let J of this.#T({allowStale:!0})){let Q=this.#q[J];if(this.#z(Q))Q.__abortController.abort(new Error("deleted"));else{let X=this.#K[J];if(this.#w)this.#x?.(Q,X,Z);if(this.#Q)this.#M?.push([Q,X,Z])}}if(this.#W.clear(),this.#q.fill(void 0),this.#K.fill(void 0),this.#H&&this.#L){this.#H.fill(0),this.#L.fill(0);for(let J of this.#D??[])if(J!==void 0)clearTimeout(J);this.#D?.fill(void 0)}if(this.#P)this.#P.fill(0);if(this.#G=0,this.#B=0,this.#O.length=0,this.#U=0,this.#$=0,this.#Q&&this.#M){let J=this.#M,Q;while(Q=J?.shift())this.#Y?.(...Q)}}}import{posix as ta,win32 as bz}from"node:path";import{fileURLToPath as ea}from"node:url";import{lstatSync as Zr,readdir as Jr,readdirSync as Qr,readlinkSync as Xr,realpathSync as xr}from"fs";import*as qr from"node:fs";import{lstat as $r,readdir as Kr,readlink as zr,realpath as Wr}from"node:fs/promises";import{EventEmitter as Ez}from"node:events";import hN from"node:stream";import{StringDecoder as ha}from"node:string_decoder";var bN=typeof process==="object"&&process?process:{stdout:null,stderr:null},ga=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof G7||Z instanceof hN||ia(Z)||da(Z)),ia=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof Ez&&typeof Z.pipe==="function"&&Z.pipe!==hN.Writable.prototype.pipe,da=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof Ez&&typeof Z.write==="function"&&typeof Z.end==="function",R6=Symbol("EOF"),I6=Symbol("maybeEmitEnd"),G5=Symbol("emittedEnd"),yx=Symbol("emittingEnd"),_J=Symbol("emittedError"),ux=Symbol("closed"),pN=Symbol("read"),hx=Symbol("flush"),yN=Symbol("flushChunk"),N8=Symbol("encoding"),I9=Symbol("decoder"),e2=Symbol("flowing"),PJ=Symbol("paused"),T9=Symbol("resume"),Z4=Symbol("buffer"),c4=Symbol("pipes"),J4=Symbol("bufferLength"),Rz=Symbol("bufferPush"),gx=Symbol("bufferShift"),j4=Symbol("objectMode"),m2=Symbol("destroyed"),Iz=Symbol("error"),Tz=Symbol("emitData"),uN=Symbol("emitEnd"),vz=Symbol("emitEnd2"),h8=Symbol("async"),Az=Symbol("abort"),ix=Symbol("aborted"),jJ=Symbol("signal"),H7=Symbol("dataListeners"),P3=Symbol("discarded"),LJ=(Z)=>Promise.resolve().then(Z),la=(Z)=>Z(),oa=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",sa=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,na=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class fz{src;dest;opts;ondrain;constructor(Z,J,Q){this.src=Z,this.dest=J,this.opts=Q,this.ondrain=()=>Z[T9](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Z){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class gN extends fz{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Z,J,Q){super(Z,J,Q);this.proxyErrors=(X)=>J.emit("error",X),Z.on("error",this.proxyErrors)}}var aa=(Z)=>!!Z.objectMode,ra=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class G7 extends Ez{[e2]=!1;[PJ]=!1;[c4]=[];[Z4]=[];[j4];[N8];[h8];[I9];[R6]=!1;[G5]=!1;[yx]=!1;[ux]=!1;[_J]=null;[J4]=0;[m2]=!1;[jJ];[ix]=!1;[H7]=0;[P3]=!1;writable=!0;readable=!0;constructor(...Z){let J=Z[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(aa(J))this[j4]=!0,this[N8]=null;else if(ra(J))this[N8]=J.encoding,this[j4]=!1;else this[j4]=!1,this[N8]=null;if(this[h8]=!!J.async,this[I9]=this[N8]?new ha(this[N8]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[Z4]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[c4]});let{signal:Q}=J;if(Q)if(this[jJ]=Q,Q.aborted)this[Az]();else Q.addEventListener("abort",()=>this[Az]())}get bufferLength(){return this[J4]}get encoding(){return this[N8]}set encoding(Z){throw new Error("Encoding must be set at instantiation time")}setEncoding(Z){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[j4]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[h8]}set["async"](Z){this[h8]=this[h8]||!!Z}[Az](){this[ix]=!0,this.emit("abort",this[jJ]?.reason),this.destroy(this[jJ]?.reason)}get aborted(){return this[ix]}set aborted(Z){}write(Z,J,Q){if(this[ix])return!1;if(this[R6])throw new Error("write after end");if(this[m2])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")Q=J,J="utf8";if(!J)J="utf8";let X=this[h8]?LJ:la;if(!this[j4]&&!Buffer.isBuffer(Z)){if(na(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(sa(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[j4]){if(this[e2]&&this[J4]!==0)this[hx](!0);if(this[e2])this.emit("data",Z);else this[Rz](Z);if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}if(!Z.length){if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}if(typeof Z==="string"&&!(J===this[N8]&&!this[I9]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[N8])Z=this[I9].write(Z);if(this[e2]&&this[J4]!==0)this[hx](!0);if(this[e2])this.emit("data",Z);else this[Rz](Z);if(this[J4]!==0)this.emit("readable");if(Q)X(Q);return this[e2]}read(Z){if(this[m2])return null;if(this[P3]=!1,this[J4]===0||Z===0||Z&&Z>this[J4])return this[I6](),null;if(this[j4])Z=null;if(this[Z4].length>1&&!this[j4])this[Z4]=[this[N8]?this[Z4].join(""):Buffer.concat(this[Z4],this[J4])];let J=this[pN](Z||null,this[Z4][0]);return this[I6](),J}[pN](Z,J){if(this[j4])this[gx]();else{let Q=J;if(Z===Q.length||Z===null)this[gx]();else if(typeof Q==="string")this[Z4][0]=Q.slice(Z),J=Q.slice(0,Z),this[J4]-=Z;else this[Z4][0]=Q.subarray(Z),J=Q.subarray(0,Z),this[J4]-=Z}if(this.emit("data",J),!this[Z4].length&&!this[R6])this.emit("drain");return J}end(Z,J,Q){if(typeof Z==="function")Q=Z,Z=void 0;if(typeof J==="function")Q=J,J="utf8";if(Z!==void 0)this.write(Z,J);if(Q)this.once("end",Q);if(this[R6]=!0,this.writable=!1,this[e2]||!this[PJ])this[I6]();return this}[T9](){if(this[m2])return;if(!this[H7]&&!this[c4].length)this[P3]=!0;if(this[PJ]=!1,this[e2]=!0,this.emit("resume"),this[Z4].length)this[hx]();else if(this[R6])this[I6]();else this.emit("drain")}resume(){return this[T9]()}pause(){this[e2]=!1,this[PJ]=!0,this[P3]=!1}get destroyed(){return this[m2]}get flowing(){return this[e2]}get paused(){return this[PJ]}[Rz](Z){if(this[j4])this[J4]+=1;else this[J4]+=Z.length;this[Z4].push(Z)}[gx](){if(this[j4])this[J4]-=1;else this[J4]-=this[Z4][0].length;return this[Z4].shift()}[hx](Z=!1){do;while(this[yN](this[gx]())&&this[Z4].length);if(!Z&&!this[Z4].length&&!this[R6])this.emit("drain")}[yN](Z){return this.emit("data",Z),this[e2]}pipe(Z,J){if(this[m2])return Z;this[P3]=!1;let Q=this[G5];if(J=J||{},Z===bN.stdout||Z===bN.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,Q){if(J.end)Z.end()}else if(this[c4].push(!J.proxyErrors?new fz(this,Z,J):new gN(this,Z,J)),this[h8])LJ(()=>this[T9]());else this[T9]();return Z}unpipe(Z){let J=this[c4].find((Q)=>Q.dest===Z);if(J){if(this[c4].length===1){if(this[e2]&&this[H7]===0)this[e2]=!1;this[c4]=[]}else this[c4].splice(this[c4].indexOf(J),1);J.unpipe()}}addListener(Z,J){return this.on(Z,J)}on(Z,J){let Q=super.on(Z,J);if(Z==="data"){if(this[P3]=!1,this[H7]++,!this[c4].length&&!this[e2])this[T9]()}else if(Z==="readable"&&this[J4]!==0)super.emit("readable");else if(oa(Z)&&this[G5])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[_J]){let X=J;if(this[h8])LJ(()=>X.call(this,this[_J]));else X.call(this,this[_J])}return Q}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let Q=super.off(Z,J);if(Z==="data"){if(this[H7]=this.listeners("data").length,this[H7]===0&&!this[P3]&&!this[c4].length)this[e2]=!1}return Q}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[H7]=0,!this[P3]&&!this[c4].length)this[e2]=!1}return J}get emittedEnd(){return this[G5]}[I6](){if(!this[yx]&&!this[G5]&&!this[m2]&&this[Z4].length===0&&this[R6]){if(this[yx]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ux])this.emit("close");this[yx]=!1}}emit(Z,...J){let Q=J[0];if(Z!=="error"&&Z!=="close"&&Z!==m2&&this[m2])return!1;else if(Z==="data")return!this[j4]&&!Q?!1:this[h8]?(LJ(()=>this[Tz](Q)),!0):this[Tz](Q);else if(Z==="end")return this[uN]();else if(Z==="close"){if(this[ux]=!0,!this[G5]&&!this[m2])return!1;let x=super.emit("close");return this.removeAllListeners("close"),x}else if(Z==="error"){this[_J]=Q,super.emit(Iz,Q);let x=!this[jJ]||this.listeners("error").length?super.emit("error",Q):!1;return this[I6](),x}else if(Z==="resume"){let x=super.emit("resume");return this[I6](),x}else if(Z==="finish"||Z==="prefinish"){let x=super.emit(Z);return this.removeAllListeners(Z),x}let X=super.emit(Z,...J);return this[I6](),X}[Tz](Z){for(let Q of this[c4])if(Q.dest.write(Z)===!1)this.pause();let J=this[P3]?!1:super.emit("data",Z);return this[I6](),J}[uN](){if(this[G5])return!1;return this[G5]=!0,this.readable=!1,this[h8]?(LJ(()=>this[vz]()),!0):this[vz]()}[vz](){if(this[I9]){let J=this[I9].end();if(J){for(let Q of this[c4])Q.dest.write(J);if(!this[P3])super.emit("data",J)}}for(let J of this[c4])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[j4])Z.dataLength=0;let J=this.promise();return this.on("data",(Q)=>{if(Z.push(Q),!this[j4])Z.dataLength+=Q.length}),await J,Z}async concat(){if(this[j4])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[N8]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(m2,()=>J(new Error("stream destroyed"))),this.on("error",(Q)=>J(Q)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[P3]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[R6])return J();let x,q,Y=(U)=>{this.off("data",$),this.off("end",z),this.off(m2,W),J(),q(U)},$=(U)=>{this.off("error",Y),this.off("end",z),this.off(m2,W),this.pause(),x({value:U,done:!!this[R6]})},z=()=>{this.off("error",Y),this.off("data",$),this.off(m2,W),J(),x({done:!0,value:void 0})},W=()=>Y(new Error("stream destroyed"));return new Promise((U,H)=>{q=H,x=U,this.once(m2,W),this.once("error",Y),this.once("end",z),this.once("data",$)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[P3]=!1;let Z=!1,J=()=>{return this.pause(),this.off(Iz,J),this.off(m2,J),this.off("end",J),Z=!0,{done:!0,value:void 0}},Q=()=>{if(Z)return J();let X=this.read();return X===null?J():{done:!1,value:X}};return this.once("end",J),this.once(Iz,J),this.once(m2,J),{next:Q,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[m2]){if(Z)this.emit("error",Z);else this.emit(m2);return this}this[m2]=!0,this[P3]=!0,this[Z4].length=0,this[J4]=0;let J=this;if(typeof J.close==="function"&&!this[ux])J.close();if(Z)this.emit("error",Z);else this.emit(m2);return this}static get isStream(){return ga}}var Yr=xr.native,OJ={lstatSync:Zr,readdir:Jr,readdirSync:Qr,readlinkSync:Xr,realpathSync:Yr,promises:{lstat:$r,readdir:Kr,readlink:zr,realpath:Wr}},sN=(Z)=>!Z||Z===OJ||Z===qr?OJ:{...OJ,...Z,promises:{...OJ.promises,...Z.promises||{}}},nN=/^\\\\\?\\([a-z]:)\\?$/i,Vr=(Z)=>Z.replace(/\//g,"\\").replace(nN,"$1\\"),Ur=/[\\\/]/,o3=0,aN=1,rN=2,g8=4,tN=6,eN=8,B7=10,Zw=12,l3=15,CJ=~l3,kz=16,iN=32,mJ=64,w8=128,dx=256,ox=512,dN=mJ|w8|ox,Hr=1023,cz=(Z)=>Z.isFile()?eN:Z.isDirectory()?g8:Z.isSymbolicLink()?B7:Z.isCharacterDevice()?rN:Z.isBlockDevice()?tN:Z.isSocket()?Zw:Z.isFIFO()?aN:o3,lN=new U7({max:4096}),SJ=(Z)=>{let J=lN.get(Z);if(J)return J;let Q=Z.normalize("NFKD");return lN.set(Z,Q),Q},oN=new U7({max:4096}),lx=(Z)=>{let J=oN.get(Z);if(J)return J;let Q=SJ(Z.toLowerCase());return oN.set(Z,Q),Q};class pz extends U7{constructor(){super({max:256})}}class Jw extends U7{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var Qw=Symbol("PathScurry setAsCwd");class b4{name;root;roots;parent;nocase;isCWD=!1;#Z;#X;get dev(){return this.#X}#x;get mode(){return this.#x}#J;get nlink(){return this.#J}#Y;get uid(){return this.#Y}#j;get gid(){return this.#j}#F;get rdev(){return this.#F}#V;get blksize(){return this.#V}#$;get ino(){return this.#$}#U;get size(){return this.#U}#W;get blocks(){return this.#W}#K;get atimeMs(){return this.#K}#q;get mtimeMs(){return this.#q}#N;get ctimeMs(){return this.#N}#_;get birthtimeMs(){return this.#_}#G;get atime(){return this.#G}#B;get mtime(){return this.#B}#O;get ctime(){return this.#O}#M;get birthtime(){return this.#M}#P;#L;#H;#D;#w;#m;#Q;#E;#v;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=o3,Q,X,x,q,Y){if(this.name=Z,this.#P=x?lx(Z):SJ(Z),this.#Q=J&Hr,this.nocase=x,this.roots=X,this.root=Q||this,this.#E=q,this.#H=Y.fullpath,this.#w=Y.relative,this.#m=Y.relativePosix,this.parent=Y.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=sN(Y.fs)}depth(){if(this.#L!==void 0)return this.#L;if(!this.parent)return this.#L=0;return this.#L=this.parent.depth()+1}childrenCache(){return this.#E}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),X=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#A(X):this.#A(X)}#A(Z){let J=this;for(let Q of Z)J=J.child(Q);return J}children(){let Z=this.#E.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#E.set(this,J),this.#Q&=~kz,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let Q=this.children(),X=this.nocase?lx(Z):SJ(Z);for(let $ of Q)if($.#P===X)return $;let x=this.parent?this.sep:"",q=this.#H?this.#H+x+Z:void 0,Y=this.newChild(Z,o3,{...J,parent:this,fullpath:q});if(!this.canReaddir())Y.#Q|=w8;return Q.push(Y),Y}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let Z=this.name,J=this.parent;if(!J)return this.#w=this.name;let Q=J.relative();return Q+(!Q||!J.parent?"":this.sep)+Z}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#m!==void 0)return this.#m;let Z=this.name,J=this.parent;if(!J)return this.#m=this.fullpathPosix();let Q=J.relativePosix();return Q+(!Q||!J.parent?"":"/")+Z}fullpath(){if(this.#H!==void 0)return this.#H;let Z=this.name,J=this.parent;if(!J)return this.#H=this.name;let X=J.fullpath()+(!J.parent?"":this.sep)+Z;return this.#H=X}fullpathPosix(){if(this.#D!==void 0)return this.#D;if(this.sep==="/")return this.#D=this.fullpath();if(!this.parent){let X=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(X))return this.#D=`//?/${X}`;else return this.#D=X}let Z=this.parent,J=Z.fullpathPosix(),Q=J+(!J||!Z.parent?"":"/")+this.name;return this.#D=Q}isUnknown(){return(this.#Q&l3)===o3}isType(Z){return this[`is${Z}`]()}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.#Q&l3)===eN}isDirectory(){return(this.#Q&l3)===g8}isCharacterDevice(){return(this.#Q&l3)===rN}isBlockDevice(){return(this.#Q&l3)===tN}isFIFO(){return(this.#Q&l3)===aN}isSocket(){return(this.#Q&l3)===Zw}isSymbolicLink(){return(this.#Q&B7)===B7}lstatCached(){return this.#Q&iN?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let Z=this.#Q&l3;return!(Z!==o3&&Z!==B7||this.#Q&dx||this.#Q&w8)}calledReaddir(){return!!(this.#Q&kz)}isENOENT(){return!!(this.#Q&w8)}isNamed(Z){return!this.nocase?this.#P===SJ(Z):this.#P===lx(Z)}async readlink(){let Z=this.#v;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#Z.promises.readlink(this.fullpath()),Q=(await this.parent.realpath())?.resolve(J);if(Q)return this.#v=Q}catch(J){this.#T(J.code);return}}readlinkSync(){let Z=this.#v;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#Z.readlinkSync(this.fullpath()),Q=this.parent.realpathSync()?.resolve(J);if(Q)return this.#v=Q}catch(J){this.#T(J.code);return}}#b(Z){this.#Q|=kz;for(let J=Z.provisional;J<Z.length;J++){let Q=Z[J];if(Q)Q.#C()}}#C(){if(this.#Q&w8)return;this.#Q=(this.#Q|w8)&CJ,this.#i()}#i(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#C()}#c(){this.#Q|=ox,this.#f()}#f(){if(this.#Q&mJ)return;let Z=this.#Q;if((Z&l3)===g8)Z&=CJ;this.#Q=Z|mJ,this.#i()}#p(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#f();else if(Z==="ENOENT")this.#C();else this.children().provisional=0}#I(Z=""){if(Z==="ENOTDIR")this.parent.#f();else if(Z==="ENOENT")this.#C()}#T(Z=""){let J=this.#Q;if(J|=dx,Z==="ENOENT")J|=w8;if(Z==="EINVAL"||Z==="UNKNOWN")J&=CJ;if(this.#Q=J,Z==="ENOTDIR"&&this.parent)this.parent.#f()}#y(Z,J){return this.#h(Z,J)||this.#u(Z,J)}#u(Z,J){let Q=cz(Z),X=this.newChild(Z.name,Q,{parent:this}),x=X.#Q&l3;if(x!==g8&&x!==B7&&x!==o3)X.#Q|=mJ;return J.unshift(X),J.provisional++,X}#h(Z,J){for(let Q=J.provisional;Q<J.length;Q++){let X=J[Q];if((this.nocase?lx(Z.name):SJ(Z.name))!==X.#P)continue;return this.#z(Z,X,Q,J)}}#z(Z,J,Q,X){let x=J.name;if(J.#Q=J.#Q&CJ|cz(Z),x!==Z.name)J.name=Z.name;if(Q!==X.provisional){if(Q===X.length-1)X.pop();else X.splice(Q,1);X.unshift(J)}return X.provisional++,J}async lstat(){if((this.#Q&w8)===0)try{return this.#g(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#I(Z.code)}}lstatSync(){if((this.#Q&w8)===0)try{return this.#g(this.#Z.lstatSync(this.fullpath())),this}catch(Z){this.#I(Z.code)}}#g(Z){let{atime:J,atimeMs:Q,birthtime:X,birthtimeMs:x,blksize:q,blocks:Y,ctime:$,ctimeMs:z,dev:W,gid:U,ino:H,mode:B,mtime:M,mtimeMs:D,nlink:N,rdev:_,size:j,uid:O}=Z;this.#G=J,this.#K=Q,this.#M=X,this.#_=x,this.#V=q,this.#W=Y,this.#O=$,this.#N=z,this.#X=W,this.#j=U,this.#$=H,this.#x=B,this.#B=M,this.#q=D,this.#J=N,this.#F=_,this.#U=j,this.#Y=O;let A=cz(Z);if(this.#Q=this.#Q&CJ|A|iN,A!==o3&&A!==g8&&A!==B7)this.#Q|=mJ}#k=[];#R=!1;#d(Z){this.#R=!1;let J=this.#k.slice();this.#k.length=0,J.forEach((Q)=>Q(null,Z))}readdirCB(Z,J=!1){if(!this.canReaddir()){if(J)Z(null,[]);else queueMicrotask(()=>Z(null,[]));return}let Q=this.children();if(this.calledReaddir()){let x=Q.slice(0,Q.provisional);if(J)Z(null,x);else queueMicrotask(()=>Z(null,x));return}if(this.#k.push(Z),this.#R)return;this.#R=!0;let X=this.fullpath();this.#Z.readdir(X,{withFileTypes:!0},(x,q)=>{if(x)this.#p(x.code),Q.provisional=0;else{for(let Y of q)this.#y(Y,Q);this.#b(Q)}this.#d(Q.slice(0,Q.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();if(this.#l)await this.#l;else{let Q=()=>{};this.#l=new Promise((X)=>Q=X);try{for(let X of await this.#Z.promises.readdir(J,{withFileTypes:!0}))this.#y(X,Z);this.#b(Z)}catch(X){this.#p(X.code),Z.provisional=0}this.#l=void 0,Q()}return Z.slice(0,Z.provisional)}readdirSync(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();try{for(let Q of this.#Z.readdirSync(J,{withFileTypes:!0}))this.#y(Q,Z);this.#b(Z)}catch(Q){this.#p(Q.code),Z.provisional=0}return Z.slice(0,Z.provisional)}canReaddir(){if(this.#Q&dN)return!1;let Z=l3&this.#Q;if(!(Z===o3||Z===g8||Z===B7))return!1;return!0}shouldWalk(Z,J){return(this.#Q&g8)===g8&&!(this.#Q&dN)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((ox|dx|w8)&this.#Q)return;try{let Z=await this.#Z.promises.realpath(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#c()}}realpathSync(){if(this.#S)return this.#S;if((ox|dx|w8)&this.#Q)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#c()}}[Qw](Z){if(Z===this)return;Z.isCWD=!1,this.isCWD=!0;let J=new Set([]),Q=[],X=this;while(X&&X.parent)J.add(X),X.#w=Q.join(this.sep),X.#m=Q.join("/"),X=X.parent,Q.push("..");X=Z;while(X&&X.parent&&!J.has(X))X.#w=void 0,X.#m=void 0,X=X.parent}}class sx extends b4{sep="\\";splitSep=Ur;constructor(Z,J=o3,Q,X,x,q,Y){super(Z,J,Q,X,x,q,Y)}newChild(Z,J=o3,Q={}){return new sx(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),Q)}getRootString(Z){return bz.parse(Z).root}getRoot(Z){if(Z=Vr(Z.toUpperCase()),Z===this.root.name)return this.root;for(let[J,Q]of Object.entries(this.roots))if(this.sameRoot(Z,J))return this.roots[Z]=Q;return this.roots[Z]=new RJ(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(nN,"$1\\"),Z===J}}class nx extends b4{splitSep="/";sep="/";constructor(Z,J=o3,Q,X,x,q,Y){super(Z,J,Q,X,x,q,Y)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=o3,Q={}){return new nx(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),Q)}}class yz{root;rootPath;roots;cwd;#Z;#X;#x;nocase;#J;constructor(Z=process.cwd(),J,Q,{nocase:X,childrenCacheSize:x=16384,fs:q=OJ}={}){if(this.#J=sN(q),Z instanceof URL||Z.startsWith("file://"))Z=ea(Z);let Y=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(Y),this.#Z=new pz,this.#X=new pz,this.#x=new Jw(x);let $=Y.substring(this.rootPath.length).split(Q);if($.length===1&&!$[0])$.pop();if(X===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=X,this.root=this.newRoot(this.#J),this.roots[this.rootPath]=this.root;let z=this.root,W=$.length-1,U=J.sep,H=this.rootPath,B=!1;for(let M of $){let D=W--;z=z.child(M,{relative:new Array(D).fill("..").join(U),relativePosix:new Array(D).fill("..").join("/"),fullpath:H+=(B?"":U)+M}),B=!0}this.cwd=z}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#x}resolve(...Z){let J="";for(let x=Z.length-1;x>=0;x--){let q=Z[x];if(!q||q===".")continue;if(J=J?`${q}/${J}`:q,this.isAbsolute(q))break}let Q=this.#Z.get(J);if(Q!==void 0)return Q;let X=this.cwd.resolve(J).fullpath();return this.#Z.set(J,X),X}resolvePosix(...Z){let J="";for(let x=Z.length-1;x>=0;x--){let q=Z[x];if(!q||q===".")continue;if(J=J?`${q}/${J}`:q,this.isAbsolute(q))break}let Q=this.#X.get(J);if(Q!==void 0)return Q;let X=this.cwd.resolve(J).fullpathPosix();return this.#X.set(J,X),X}relative(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relative()}relativePosix(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relativePosix()}basename(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.name}dirname(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return(Z.parent||Z).fullpath()}async readdir(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q}=J;if(!Z.canReaddir())return[];else{let X=await Z.readdir();return Q?X:X.map((x)=>x.name)}}readdirSync(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0}=J;if(!Z.canReaddir())return[];else if(Q)return Z.readdirSync();else return Z.readdirSync().map((X)=>X.name)}async lstat(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstat()}lstatSync(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstatSync()}async readlink(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=await Z.readlink();return J?Q:Q?.fullpath()}readlinkSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=Z.readlinkSync();return J?Q:Q?.fullpath()}async realpath(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=await Z.realpath();return J?Q:Q?.fullpath()}realpathSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z.withFileTypes,Z=this.cwd;let Q=Z.realpathSync();return J?Q:Q?.fullpath()}async walk(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=[];if(!x||x(Z))Y.push(Q?Z:Z.fullpath());let $=new Set,z=(U,H)=>{$.add(U),U.readdirCB((B,M)=>{if(B)return H(B);let D=M.length;if(!D)return H();let N=()=>{if(--D===0)H()};for(let _ of M){if(!x||x(_))Y.push(Q?_:_.fullpath());if(X&&_.isSymbolicLink())_.realpath().then((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk($,q)?z(j,N):N());else if(_.shouldWalk($,q))z(_,N);else N()}},!0)},W=Z;return new Promise((U,H)=>{z(W,(B)=>{if(B)return H(B);U(Y)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=[];if(!x||x(Z))Y.push(Q?Z:Z.fullpath());let $=new Set([Z]);for(let z of $){let W=z.readdirSync();for(let U of W){if(!x||x(U))Y.push(Q?U:U.fullpath());let H=U;if(U.isSymbolicLink()){if(!(X&&(H=U.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk($,q))$.add(H)}}return Y}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;return this.stream(Z,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J;if(!x||x(Z))yield Q?Z:Z.fullpath();let Y=new Set([Z]);for(let $ of Y){let z=$.readdirSync();for(let W of z){if(!x||x(W))yield Q?W:W.fullpath();let U=W;if(W.isSymbolicLink()){if(!(X&&(U=W.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(Y,q))Y.add(U)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=new G7({objectMode:!0});if(!x||x(Z))Y.write(Q?Z:Z.fullpath());let $=new Set,z=[Z],W=0,U=()=>{let H=!1;while(!H){let B=z.shift();if(!B){if(W===0)Y.end();return}W++,$.add(B);let M=(N,_,j=!1)=>{if(N)return Y.emit("error",N);if(X&&!j){let O=[];for(let A of _)if(A.isSymbolicLink())O.push(A.realpath().then((h)=>h?.isUnknown()?h.lstat():h));if(O.length){Promise.all(O).then(()=>M(null,_,!0));return}}for(let O of _)if(O&&(!x||x(O))){if(!Y.write(Q?O:O.fullpath()))H=!0}W--;for(let O of _){let A=O.realpathCached()||O;if(A.shouldWalk($,q))z.push(A)}if(H&&!Y.flowing)Y.once("drain",U);else if(!D)U()},D=!0;B.readdirCB(M,!0),D=!1}};return U(),Y}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof b4))J=Z,Z=this.cwd;let{withFileTypes:Q=!0,follow:X=!1,filter:x,walkFilter:q}=J,Y=new G7({objectMode:!0}),$=new Set;if(!x||x(Z))Y.write(Q?Z:Z.fullpath());let z=[Z],W=0,U=()=>{let H=!1;while(!H){let B=z.shift();if(!B){if(W===0)Y.end();return}W++,$.add(B);let M=B.readdirSync();for(let D of M)if(!x||x(D)){if(!Y.write(Q?D:D.fullpath()))H=!0}W--;for(let D of M){let N=D;if(D.isSymbolicLink()){if(!(X&&(N=D.realpathSync())))continue;if(N.isUnknown())N.lstatSync()}if(N.shouldWalk($,q))z.push(N)}}if(H&&!Y.flowing)Y.once("drain",U)};return U(),Y}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[Qw](J)}}class RJ extends yz{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:Q=!0}=J;super(Z,bz,"\\",{...J,nocase:Q});this.nocase=Q;for(let X=this.cwd;X;X=X.parent)X.nocase=this.nocase}parseRootPath(Z){return bz.parse(Z).root.toUpperCase()}newRoot(Z){return new sx(this.rootPath,g8,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class IJ extends yz{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:Q=!1}=J;super(Z,ta,"/",{...J,nocase:Q});this.nocase=Q}parseRootPath(Z){return"/"}newRoot(Z){return new nx(this.rootPath,g8,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class ax extends IJ{constructor(Z=process.cwd(),J={}){let{nocase:Q=!0}=J;super(Z,{...J,nocase:Q})}}var Dv0=process.platform==="win32"?sx:nx,Xw=process.platform==="win32"?RJ:process.platform==="darwin"?ax:IJ;var Gr=(Z)=>Z.length>=1,Br=(Z)=>Z.length>=1;class v9{#Z;#X;#x;length;#J;#Y;#j;#F;#V;#$;#U=!0;constructor(Z,J,Q,X){if(!Gr(Z))throw new TypeError("empty pattern list");if(!Br(J))throw new TypeError("empty glob list");if(J.length!==Z.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=Z.length,Q<0||Q>=this.length)throw new TypeError("index out of range");if(this.#Z=Z,this.#X=J,this.#x=Q,this.#J=X,this.#x===0){if(this.isUNC()){let[x,q,Y,$,...z]=this.#Z,[W,U,H,B,...M]=this.#X;if(z[0]==="")z.shift(),M.shift();let D=[x,q,Y,$,""].join("/"),N=[W,U,H,B,""].join("/");this.#Z=[D,...z],this.#X=[N,...M],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[x,...q]=this.#Z,[Y,...$]=this.#X;if(q[0]==="")q.shift(),$.shift();let z=x+"/",W=Y+"/";this.#Z=[z,...q],this.#X=[W,...$],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#x]}isString(){return typeof this.#Z[this.#x]==="string"}isGlobstar(){return this.#Z[this.#x]===O2}isRegExp(){return this.#Z[this.#x]instanceof RegExp}globString(){return this.#j=this.#j||(this.#x===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#x).join("/"))}hasMore(){return this.length>this.#x+1}rest(){if(this.#Y!==void 0)return this.#Y;if(!this.hasMore())return this.#Y=null;return this.#Y=new v9(this.#Z,this.#X,this.#x+1,this.#J),this.#Y.#$=this.#$,this.#Y.#V=this.#V,this.#Y.#F=this.#F,this.#Y}isUNC(){let Z=this.#Z;return this.#V!==void 0?this.#V:this.#V=this.#J==="win32"&&this.#x===0&&Z[0]===""&&Z[1]===""&&typeof Z[2]==="string"&&!!Z[2]&&typeof Z[3]==="string"&&!!Z[3]}isDrive(){let Z=this.#Z;return this.#F!==void 0?this.#F:this.#F=this.#J==="win32"&&this.#x===0&&this.length>1&&typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0])}isAbsolute(){let Z=this.#Z;return this.#$!==void 0?this.#$:this.#$=Z[0]===""&&Z.length>1||this.isDrive()||this.isUNC()}root(){let Z=this.#Z[0];return typeof Z==="string"&&this.isAbsolute()&&this.#x===0?Z:""}checkFollowGlobstar(){return!(this.#x===0||!this.isGlobstar()||!this.#U)}markFollowGlobstar(){if(this.#x===0||!this.isGlobstar()||!this.#U)return!1;return this.#U=!1,!0}}var Mr=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class TJ{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:Q,noext:X,noglobstar:x,platform:q=Mr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=q,this.mmopts={dot:!0,nobrace:J,nocase:Q,noext:X,noglobstar:x,optimizationLevel:2,platform:q,nocomment:!0,nonegate:!0};for(let Y of Z)this.add(Y)}add(Z){let J=new d3(Z,this.mmopts);for(let Q=0;Q<J.set.length;Q++){let X=J.set[Q],x=J.globParts[Q];if(!X||!x)throw new Error("invalid pattern object");while(X[0]==="."&&x[0]===".")X.shift(),x.shift();let q=new v9(X,x,0,this.platform),Y=new d3(q.globString(),this.mmopts),$=x[x.length-1]==="**",z=q.isAbsolute();if(z)this.absolute.push(Y);else this.relative.push(Y);if($)if(z)this.absoluteChildren.push(Y);else this.relativeChildren.push(Y)}}ignored(Z){let J=Z.fullpath(),Q=`${J}/`,X=Z.relative()||".",x=`${X}/`;for(let q of this.relative)if(q.match(X)||q.match(x))return!0;for(let q of this.absolute)if(q.match(J)||q.match(Q))return!0;return!1}childrenIgnored(Z){let J=Z.fullpath()+"/",Q=(Z.relative()||".")+"/";for(let X of this.relativeChildren)if(X.match(Q))return!0;for(let X of this.absoluteChildren)if(X.match(J))return!0;return!1}}class uz{store;constructor(Z=new Map){this.store=Z}copy(){return new uz(new Map(this.store))}hasWalked(Z,J){return this.store.get(Z.fullpath())?.has(J.globString())}storeWalked(Z,J){let Q=Z.fullpath(),X=this.store.get(Q);if(X)X.add(J.globString());else this.store.set(Q,new Set([J.globString()]))}}class xw{store=new Map;add(Z,J,Q){let X=(J?2:0)|(Q?1:0),x=this.store.get(Z);this.store.set(Z,x===void 0?X:X&x)}entries(){return[...this.store.entries()].map(([Z,J])=>[Z,!!(J&2),!!(J&1)])}}class qw{store=new Map;add(Z,J){if(!Z.canReaddir())return;let Q=this.store.get(Z);if(Q){if(!Q.find((X)=>X.globString()===J.globString()))Q.push(J)}else this.store.set(Z,[J])}get(Z){let J=this.store.get(Z);if(!J)throw new Error("attempting to walk unknown path");return J}entries(){return this.keys().map((Z)=>[Z,this.store.get(Z)])}keys(){return[...this.store.keys()].filter((Z)=>Z.canReaddir())}}class vJ{hasWalkedCache;matches=new xw;subwalks=new qw;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new uz}processPatterns(Z,J){this.patterns=J;let Q=J.map((X)=>[Z,X]);for(let[X,x]of Q){this.hasWalkedCache.storeWalked(X,x);let q=x.root(),Y=x.isAbsolute()&&this.opts.absolute!==!1;if(q){X=X.resolve(q==="/"&&this.opts.root!==void 0?this.opts.root:q);let U=x.rest();if(!U){this.matches.add(X,!0,!1);continue}else x=U}if(X.isENOENT())continue;let $,z,W=!1;while(typeof($=x.pattern())==="string"&&(z=x.rest()))X=X.resolve($),x=z,W=!0;if($=x.pattern(),z=x.rest(),W){if(this.hasWalkedCache.hasWalked(X,x))continue;this.hasWalkedCache.storeWalked(X,x)}if(typeof $==="string"){let U=$===".."||$===""||$===".";this.matches.add(X.resolve($),Y,U);continue}else if($===O2){if(!X.isSymbolicLink()||this.follow||x.checkFollowGlobstar())this.subwalks.add(X,x);let U=z?.pattern(),H=z?.rest();if(!z||(U===""||U===".")&&!H)this.matches.add(X,Y,U===""||U===".");else if(U===".."){let B=X.parent||X;if(!H)this.matches.add(B,Y,!0);else if(!this.hasWalkedCache.hasWalked(B,H))this.subwalks.add(B,H)}}else if($ instanceof RegExp)this.subwalks.add(X,x)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new vJ(this.opts,this.hasWalkedCache)}filterEntries(Z,J){let Q=this.subwalks.get(Z),X=this.child();for(let x of J)for(let q of Q){let Y=q.isAbsolute(),$=q.pattern(),z=q.rest();if($===O2)X.testGlobstar(x,q,z,Y);else if($ instanceof RegExp)X.testRegExp(x,$,z,Y);else X.testString(x,$,z,Y)}return X}testGlobstar(Z,J,Q,X){if(this.dot||!Z.name.startsWith(".")){if(!J.hasMore())this.matches.add(Z,X,!1);if(Z.canReaddir()){if(this.follow||!Z.isSymbolicLink())this.subwalks.add(Z,J);else if(Z.isSymbolicLink()){if(Q&&J.checkFollowGlobstar())this.subwalks.add(Z,Q);else if(J.markFollowGlobstar())this.subwalks.add(Z,J)}}}if(Q){let x=Q.pattern();if(typeof x==="string"&&x!==".."&&x!==""&&x!==".")this.testString(Z,x,Q.rest(),X);else if(x===".."){let q=Z.parent||Z;this.subwalks.add(q,Q)}else if(x instanceof RegExp)this.testRegExp(Z,x,Q.rest(),X)}}testRegExp(Z,J,Q,X){if(!J.test(Z.name))return;if(!Q)this.matches.add(Z,X,!1);else this.subwalks.add(Z,Q)}testString(Z,J,Q,X){if(!Z.isNamed(J))return;if(!Q)this.matches.add(Z,X,!1);else this.subwalks.add(Z,Q)}}var Dr=(Z,J)=>typeof Z==="string"?new TJ([Z],J):Array.isArray(Z)?new TJ(Z,J):Z;class hz{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Z=[];#X;#x;signal;maxDepth;includeChildMatches;constructor(Z,J,Q){if(this.patterns=Z,this.path=J,this.opts=Q,this.#x=!Q.posix&&Q.platform==="win32"?"\\":"/",this.includeChildMatches=Q.includeChildMatches!==!1,Q.ignore||!this.includeChildMatches){if(this.#X=Dr(Q.ignore??[],Q),!this.includeChildMatches&&typeof this.#X.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Q.maxDepth||1/0,Q.signal)this.signal=Q.signal,this.signal.addEventListener("abort",()=>{this.#Z.length=0})}#J(Z){return this.seen.has(Z)||!!this.#X?.ignored?.(Z)}#Y(Z){return!!this.#X?.childrenIgnored?.(Z)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Z=void 0;while(!this.paused&&(Z=this.#Z.shift()))Z()}onResume(Z){if(this.signal?.aborted)return;if(!this.paused)Z();else this.#Z.push(Z)}async matchCheck(Z,J){if(J&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=Z.realpathCached()||await Z.realpath(),!Q)return;Z=Q}let x=Z.isUnknown()||this.opts.stat?await Z.lstat():Z;if(this.opts.follow&&this.opts.nodir&&x?.isSymbolicLink()){let q=await x.realpath();if(q&&(q.isUnknown()||this.opts.stat))await q.lstat()}return this.matchCheckTest(x,J)}matchCheckTest(Z,J){return Z&&(this.maxDepth===1/0||Z.depth()<=this.maxDepth)&&(!J||Z.canReaddir())&&(!this.opts.nodir||!Z.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Z.isSymbolicLink()||!Z.realpathCached()?.isDirectory())&&!this.#J(Z)?Z:void 0}matchCheckSync(Z,J){if(J&&this.opts.nodir)return;let Q;if(this.opts.realpath){if(Q=Z.realpathCached()||Z.realpathSync(),!Q)return;Z=Q}let x=Z.isUnknown()||this.opts.stat?Z.lstatSync():Z;if(this.opts.follow&&this.opts.nodir&&x?.isSymbolicLink()){let q=x.realpathSync();if(q&&(q?.isUnknown()||this.opts.stat))q.lstatSync()}return this.matchCheckTest(x,J)}matchFinish(Z,J){if(this.#J(Z))return;if(!this.includeChildMatches&&this.#X?.add){let x=`${Z.relativePosix()}/**`;this.#X.add(x)}let Q=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(Z);let X=this.opts.mark&&Z.isDirectory()?this.#x:"";if(this.opts.withFileTypes)this.matchEmit(Z);else if(Q){let x=this.opts.posix?Z.fullpathPosix():Z.fullpath();this.matchEmit(x+X)}else{let x=this.opts.posix?Z.relativePosix():Z.relative(),q=this.opts.dotRelative&&!x.startsWith(".."+this.#x)?"."+this.#x:"";this.matchEmit(!x?"."+X:q+x+X)}}async match(Z,J,Q){let X=await this.matchCheck(Z,Q);if(X)this.matchFinish(X,J)}matchSync(Z,J,Q){let X=this.matchCheckSync(Z,Q);if(X)this.matchFinish(X,J)}walkCB(Z,J,Q){if(this.signal?.aborted)Q();this.walkCB2(Z,J,new vJ(this.opts),Q)}walkCB2(Z,J,Q,X){if(this.#Y(Z))return X();if(this.signal?.aborted)X();if(this.paused){this.onResume(()=>this.walkCB2(Z,J,Q,X));return}Q.processPatterns(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;x++,this.match(Y,$,z).then(()=>q())}for(let Y of Q.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;x++;let $=Y.readdirCached();if(Y.calledReaddir())this.walkCB3(Y,$,Q,q);else Y.readdirCB((z,W)=>this.walkCB3(Y,W,Q,q),!0)}q()}walkCB3(Z,J,Q,X){Q=Q.filterEntries(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;x++,this.match(Y,$,z).then(()=>q())}for(let[Y,$]of Q.subwalks.entries())x++,this.walkCB2(Y,$,Q.child(),q);q()}walkCBSync(Z,J,Q){if(this.signal?.aborted)Q();this.walkCB2Sync(Z,J,new vJ(this.opts),Q)}walkCB2Sync(Z,J,Q,X){if(this.#Y(Z))return X();if(this.signal?.aborted)X();if(this.paused){this.onResume(()=>this.walkCB2Sync(Z,J,Q,X));return}Q.processPatterns(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;this.matchSync(Y,$,z)}for(let Y of Q.subwalkTargets()){if(this.maxDepth!==1/0&&Y.depth()>=this.maxDepth)continue;x++;let $=Y.readdirSync();this.walkCB3Sync(Y,$,Q,q)}q()}walkCB3Sync(Z,J,Q,X){Q=Q.filterEntries(Z,J);let x=1,q=()=>{if(--x===0)X()};for(let[Y,$,z]of Q.matches.entries()){if(this.#J(Y))continue;this.matchSync(Y,$,z)}for(let[Y,$]of Q.subwalks.entries())x++,this.walkCB2Sync(Y,$,Q.child(),q);q()}}class rx extends hz{matches=new Set;constructor(Z,J,Q){super(Z,J,Q)}matchEmit(Z){this.matches.add(Z)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Z,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else Z(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class tx extends hz{results;constructor(Z,J,Q){super(Z,J,Q);this.results=new G7({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Z){if(this.results.write(Z),!this.results.flowing)this.pause()}stream(){let Z=this.path;if(Z.isUnknown())Z.lstat().then(()=>{this.walkCB(Z,this.patterns,()=>this.results.end())});else this.walkCB(Z,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var Nr=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class i8{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(Z,J){if(!J)throw new TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=Fr(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map(($)=>$.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map(($)=>$.includes("/")?$:`./**/${$}`)}if(this.pattern=Z,this.platform=J.platform||Nr,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let $=J.platform==="win32"?RJ:J.platform==="darwin"?ax:J.platform?IJ:Xw;this.scurry=new $(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let Q=this.platform==="darwin"||this.platform==="win32",X={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Q,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},x=this.pattern.map(($)=>new d3($,X)),[q,Y]=x.reduce(($,z)=>{return $[0].push(...z.set),$[1].push(...z.globParts),$},[[],[]]);this.patterns=q.map(($,z)=>{let W=Y[z];if(!W)throw new Error("invalid pattern object");return new v9($,W,0,this.platform)})}async walk(){return[...await new rx(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 rx(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 tx(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 tx(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 gz=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let Q of Z)if(new d3(Q,J).hasMagic())return!0;return!1};function Zq(Z,J={}){return new i8(Z,J).streamSync()}function $w(Z,J={}){return new i8(Z,J).stream()}function Kw(Z,J={}){return new i8(Z,J).walkSync()}async function Yw(Z,J={}){return new i8(Z,J).walk()}function Jq(Z,J={}){return new i8(Z,J).iterateSync()}function zw(Z,J={}){return new i8(Z,J).iterate()}var wr=Zq,_r=Object.assign($w,{sync:Zq}),Pr=Jq,jr=Object.assign(zw,{sync:Jq}),Lr=Object.assign(Kw,{stream:Zq,iterate:Jq}),ex=Object.assign(Yw,{glob:Yw,globSync:Kw,sync:Lr,globStream:$w,stream:_r,globStreamSync:Zq,streamSync:wr,globIterate:zw,iterate:jr,globIterateSync:Jq,iterateSync:Pr,Glob:i8,hasMagic:gz,escape:S9,unescape:F8});ex.glob=ex;var oL=O9(UW(),1);import m30 from"fs";import S30 from"path";function cJ(Z,J){return function Q(){return Z.apply(J,arguments)}}var{toString:He}=Object.prototype,{getPrototypeOf:GW}=Object,{iterator:Hq,toStringTag:MP}=Symbol,Gq=((Z)=>(J)=>{let Q=He.call(J);return Z[Q]||(Z[Q]=Q.slice(8,-1).toLowerCase())})(Object.create(null)),P8=(Z)=>{return Z=Z.toLowerCase(),(J)=>Gq(J)===Z},Bq=(Z)=>(J)=>typeof J===Z,{isArray:b9}=Array,c9=Bq("undefined");function bJ(Z){return Z!==null&&!c9(Z)&&Z.constructor!==null&&!c9(Z.constructor)&&r4(Z.constructor.isBuffer)&&Z.constructor.isBuffer(Z)}var DP=P8("ArrayBuffer");function Ge(Z){let J;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView)J=ArrayBuffer.isView(Z);else J=Z&&Z.buffer&&DP(Z.buffer);return J}var Be=Bq("string"),r4=Bq("function"),FP=Bq("number"),pJ=(Z)=>Z!==null&&typeof Z==="object",Me=(Z)=>Z===!0||Z===!1,Uq=(Z)=>{if(Gq(Z)!=="object")return!1;let J=GW(Z);return(J===null||J===Object.prototype||Object.getPrototypeOf(J)===null)&&!(MP in Z)&&!(Hq in Z)},De=(Z)=>{if(!pJ(Z)||bJ(Z))return!1;try{return Object.keys(Z).length===0&&Object.getPrototypeOf(Z)===Object.prototype}catch(J){return!1}},Fe=P8("Date"),Ne=P8("File"),we=(Z)=>{return!!(Z&&typeof Z.uri!=="undefined")},_e=(Z)=>Z&&typeof Z.getParts!=="undefined",Pe=P8("Blob"),je=P8("FileList"),Le=(Z)=>pJ(Z)&&r4(Z.pipe);function Ce(){if(typeof globalThis!=="undefined")return globalThis;if(typeof self!=="undefined")return self;if(typeof window!=="undefined")return window;if(typeof global!=="undefined")return global;return{}}var HP=Ce(),GP=typeof HP.FormData!=="undefined"?HP.FormData:void 0,Oe=(Z)=>{let J;return Z&&(GP&&Z instanceof GP||r4(Z.append)&&((J=Gq(Z))==="formdata"||J==="object"&&r4(Z.toString)&&Z.toString()==="[object FormData]"))},me=P8("URLSearchParams"),[Se,Re,Ie,Te]=["ReadableStream","Request","Response","Headers"].map(P8),ve=(Z)=>{return Z.trim?Z.trim():Z.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function yJ(Z,J,{allOwnKeys:Q=!1}={}){if(Z===null||typeof Z==="undefined")return;let X,x;if(typeof Z!=="object")Z=[Z];if(b9(Z))for(X=0,x=Z.length;X<x;X++)J.call(null,Z[X],X,Z);else{if(bJ(Z))return;let q=Q?Object.getOwnPropertyNames(Z):Object.keys(Z),Y=q.length,$;for(X=0;X<Y;X++)$=q[X],J.call(null,Z[$],$,Z)}}function NP(Z,J){if(bJ(Z))return null;J=J.toLowerCase();let Q=Object.keys(Z),X=Q.length,x;while(X-- >0)if(x=Q[X],J===x.toLowerCase())return x;return null}var D7=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})(),wP=(Z)=>!c9(Z)&&Z!==D7;function HW(){let{caseless:Z,skipUndefined:J}=wP(this)&&this||{},Q={},X=(x,q)=>{if(q==="__proto__"||q==="constructor"||q==="prototype")return;let Y=Z&&NP(Q,q)||q;if(Uq(Q[Y])&&Uq(x))Q[Y]=HW(Q[Y],x);else if(Uq(x))Q[Y]=HW({},x);else if(b9(x))Q[Y]=x.slice();else if(!J||!c9(x))Q[Y]=x};for(let x=0,q=arguments.length;x<q;x++)arguments[x]&&yJ(arguments[x],X);return Q}var Ae=(Z,J,Q,{allOwnKeys:X}={})=>{return yJ(J,(x,q)=>{if(Q&&r4(x))Object.defineProperty(Z,q,{value:cJ(x,Q),writable:!0,enumerable:!0,configurable:!0});else Object.defineProperty(Z,q,{value:x,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:X}),Z},Ee=(Z)=>{if(Z.charCodeAt(0)===65279)Z=Z.slice(1);return Z},fe=(Z,J,Q,X)=>{Z.prototype=Object.create(J.prototype,X),Object.defineProperty(Z.prototype,"constructor",{value:Z,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(Z,"super",{value:J.prototype}),Q&&Object.assign(Z.prototype,Q)},ke=(Z,J,Q,X)=>{let x,q,Y,$={};if(J=J||{},Z==null)return J;do{x=Object.getOwnPropertyNames(Z),q=x.length;while(q-- >0)if(Y=x[q],(!X||X(Y,Z,J))&&!$[Y])J[Y]=Z[Y],$[Y]=!0;Z=Q!==!1&&GW(Z)}while(Z&&(!Q||Q(Z,J))&&Z!==Object.prototype);return J},ce=(Z,J,Q)=>{if(Z=String(Z),Q===void 0||Q>Z.length)Q=Z.length;Q-=J.length;let X=Z.indexOf(J,Q);return X!==-1&&X===Q},be=(Z)=>{if(!Z)return null;if(b9(Z))return Z;let J=Z.length;if(!FP(J))return null;let Q=new Array(J);while(J-- >0)Q[J]=Z[J];return Q},pe=((Z)=>{return(J)=>{return Z&&J instanceof Z}})(typeof Uint8Array!=="undefined"&&GW(Uint8Array)),ye=(Z,J)=>{let X=(Z&&Z[Hq]).call(Z),x;while((x=X.next())&&!x.done){let q=x.value;J.call(Z,q[0],q[1])}},ue=(Z,J)=>{let Q,X=[];while((Q=Z.exec(J))!==null)X.push(Q);return X},he=P8("HTMLFormElement"),ge=(Z)=>{return Z.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function J(Q,X,x){return X.toUpperCase()+x})},BP=(({hasOwnProperty:Z})=>(J,Q)=>Z.call(J,Q))(Object.prototype),ie=P8("RegExp"),_P=(Z,J)=>{let Q=Object.getOwnPropertyDescriptors(Z),X={};yJ(Q,(x,q)=>{let Y;if((Y=J(x,q,Z))!==!1)X[q]=Y||x}),Object.defineProperties(Z,X)},de=(Z)=>{_P(Z,(J,Q)=>{if(r4(Z)&&["arguments","caller","callee"].indexOf(Q)!==-1)return!1;let X=Z[Q];if(!r4(X))return;if(J.enumerable=!1,"writable"in J){J.writable=!1;return}if(!J.set)J.set=()=>{throw Error("Can not rewrite read-only method '"+Q+"'")}})},le=(Z,J)=>{let Q={},X=(x)=>{x.forEach((q)=>{Q[q]=!0})};return b9(Z)?X(Z):X(String(Z).split(J)),Q},oe=()=>{},se=(Z,J)=>{return Z!=null&&Number.isFinite(Z=+Z)?Z:J};function ne(Z){return!!(Z&&r4(Z.append)&&Z[MP]==="FormData"&&Z[Hq])}var ae=(Z)=>{let J=new Array(10),Q=(X,x)=>{if(pJ(X)){if(J.indexOf(X)>=0)return;if(bJ(X))return X;if(!("toJSON"in X)){J[x]=X;let q=b9(X)?[]:{};return yJ(X,(Y,$)=>{let z=Q(Y,x+1);!c9(z)&&(q[$]=z)}),J[x]=void 0,q}}return X};return Q(Z,0)},re=P8("AsyncFunction"),te=(Z)=>Z&&(pJ(Z)||r4(Z))&&r4(Z.then)&&r4(Z.catch),PP=((Z,J)=>{if(Z)return setImmediate;return J?((Q,X)=>{return D7.addEventListener("message",({source:x,data:q})=>{if(x===D7&&q===Q)X.length&&X.shift()()},!1),(x)=>{X.push(x),D7.postMessage(Q,"*")}})(`axios@${Math.random()}`,[]):(Q)=>setTimeout(Q)})(typeof setImmediate==="function",r4(D7.postMessage)),ee=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(D7):typeof process!=="undefined"&&process.nextTick||PP,Z00=(Z)=>Z!=null&&r4(Z[Hq]),b={isArray:b9,isArrayBuffer:DP,isBuffer:bJ,isFormData:Oe,isArrayBufferView:Ge,isString:Be,isNumber:FP,isBoolean:Me,isObject:pJ,isPlainObject:Uq,isEmptyObject:De,isReadableStream:Se,isRequest:Re,isResponse:Ie,isHeaders:Te,isUndefined:c9,isDate:Fe,isFile:Ne,isReactNativeBlob:we,isReactNative:_e,isBlob:Pe,isRegExp:ie,isFunction:r4,isStream:Le,isURLSearchParams:me,isTypedArray:pe,isFileList:je,forEach:yJ,merge:HW,extend:Ae,trim:ve,stripBOM:Ee,inherits:fe,toFlatObject:ke,kindOf:Gq,kindOfTest:P8,endsWith:ce,toArray:be,forEachEntry:ye,matchAll:ue,isHTMLForm:he,hasOwnProperty:BP,hasOwnProp:BP,reduceDescriptors:_P,freezeMethods:de,toObjectSet:le,toCamelCase:ge,noop:oe,toFiniteNumber:se,findKey:NP,global:D7,isContextDefined:wP,isSpecCompliantForm:ne,toJSONObject:ae,isAsyncFn:re,isThenable:te,setImmediate:PP,asap:ee,isIterable:Z00};class p4 extends Error{static from(Z,J,Q,X,x,q){let Y=new p4(Z.message,J||Z.code,Q,X,x);if(Y.cause=Z,Y.name=Z.name,Z.status!=null&&Y.status==null)Y.status=Z.status;return q&&Object.assign(Y,q),Y}constructor(Z,J,Q,X,x){super(Z);if(Object.defineProperty(this,"message",{value:Z,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,J&&(this.code=J),Q&&(this.config=Q),X&&(this.request=X),x)this.response=x,this.status=x.status}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:b.toJSONObject(this.config),code:this.code,status:this.status}}}p4.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";p4.ERR_BAD_OPTION="ERR_BAD_OPTION";p4.ECONNABORTED="ECONNABORTED";p4.ETIMEDOUT="ETIMEDOUT";p4.ERR_NETWORK="ERR_NETWORK";p4.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";p4.ERR_DEPRECATED="ERR_DEPRECATED";p4.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";p4.ERR_BAD_REQUEST="ERR_BAD_REQUEST";p4.ERR_CANCELED="ERR_CANCELED";p4.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";p4.ERR_INVALID_URL="ERR_INVALID_URL";var m0=p4;var jP=O9(UW(),1),Mq=jP.default;function MW(Z){return b.isPlainObject(Z)||b.isArray(Z)}function LP(Z){return b.endsWith(Z,"[]")?Z.slice(0,-2):Z}function BW(Z,J,Q){if(!Z)return J;return Z.concat(J).map(function X(x,q){return x=LP(x),!Q&&q?"["+x+"]":x}).join(Q?".":"")}function J00(Z){return b.isArray(Z)&&!Z.some(MW)}var Q00=b.toFlatObject(b,{},null,function Z(J){return/^is[A-Z]/.test(J)});function X00(Z,J,Q){if(!b.isObject(Z))throw new TypeError("target must be an object");J=J||new(Mq||FormData),Q=b.toFlatObject(Q,{metaTokens:!0,dots:!1,indexes:!1},!1,function D(N,_){return!b.isUndefined(_[N])});let X=Q.metaTokens,x=Q.visitor||U,q=Q.dots,Y=Q.indexes,z=(Q.Blob||typeof Blob!=="undefined"&&Blob)&&b.isSpecCompliantForm(J);if(!b.isFunction(x))throw new TypeError("visitor must be a function");function W(D){if(D===null)return"";if(b.isDate(D))return D.toISOString();if(b.isBoolean(D))return D.toString();if(!z&&b.isBlob(D))throw new m0("Blob is not supported. Use a Buffer instead.");if(b.isArrayBuffer(D)||b.isTypedArray(D))return z&&typeof Blob==="function"?new Blob([D]):Buffer.from(D);return D}function U(D,N,_){let j=D;if(b.isReactNative(J)&&b.isReactNativeBlob(D))return J.append(BW(_,N,q),W(D)),!1;if(D&&!_&&typeof D==="object"){if(b.endsWith(N,"{}"))N=X?N:N.slice(0,-2),D=JSON.stringify(D);else if(b.isArray(D)&&J00(D)||(b.isFileList(D)||b.endsWith(N,"[]"))&&(j=b.toArray(D)))return N=LP(N),j.forEach(function O(A,h){!(b.isUndefined(A)||A===null)&&J.append(Y===!0?BW([N],h,q):Y===null?N:N+"[]",W(A))}),!1}if(MW(D))return!0;return J.append(BW(_,N,q),W(D)),!1}let H=[],B=Object.assign(Q00,{defaultVisitor:U,convertValue:W,isVisitable:MW});function M(D,N){if(b.isUndefined(D))return;if(H.indexOf(D)!==-1)throw Error("Circular reference detected in "+N.join("."));H.push(D),b.forEach(D,function _(j,O){if((!(b.isUndefined(j)||j===null)&&x.call(J,j,b.isString(O)?O.trim():O,N,B))===!0)M(j,N?N.concat(O):[O])}),H.pop()}if(!b.isObject(Z))throw new TypeError("data must be an object");return M(Z),J}var M5=X00;function CP(Z){let J={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\x00"};return encodeURIComponent(Z).replace(/[!'()~]|%20|%00/g,function Q(X){return J[X]})}function OP(Z,J){this._pairs=[],Z&&M5(Z,this,J)}var mP=OP.prototype;mP.append=function Z(J,Q){this._pairs.push([J,Q])};mP.toString=function Z(J){let Q=J?function(X){return J.call(this,X,CP)}:CP;return this._pairs.map(function X(x){return Q(x[0])+"="+Q(x[1])},"").join("&")};var SP=OP;function x00(Z){return encodeURIComponent(Z).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function F7(Z,J,Q){if(!J)return Z;let X=Q&&Q.encode||x00,x=b.isFunction(Q)?{serialize:Q}:Q,q=x&&x.serialize,Y;if(q)Y=q(J,x);else Y=b.isURLSearchParams(J)?J.toString():new SP(J,x).toString(X);if(Y){let $=Z.indexOf("#");if($!==-1)Z=Z.slice(0,$);Z+=(Z.indexOf("?")===-1?"?":"&")+Y}return Z}class RP{constructor(){this.handlers=[]}use(Z,J,Q){return this.handlers.push({fulfilled:Z,rejected:J,synchronous:Q?Q.synchronous:!1,runWhen:Q?Q.runWhen:null}),this.handlers.length-1}eject(Z){if(this.handlers[Z])this.handlers[Z]=null}clear(){if(this.handlers)this.handlers=[]}forEach(Z){b.forEach(this.handlers,function J(Q){if(Q!==null)Z(Q)})}}var DW=RP;var D5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};import Y00 from"crypto";import q00 from"url";var IP=q00.URLSearchParams;var FW="abcdefghijklmnopqrstuvwxyz",TP="0123456789",vP={DIGIT:TP,ALPHA:FW,ALPHA_DIGIT:FW+FW.toUpperCase()+TP},$00=(Z=16,J=vP.ALPHA_DIGIT)=>{let Q="",{length:X}=J,x=new Uint32Array(Z);Y00.randomFillSync(x);for(let q=0;q<Z;q++)Q+=J[x[q]%X];return Q},AP={isNode:!0,classes:{URLSearchParams:IP,FormData:Mq,Blob:typeof Blob!=="undefined"&&Blob||null},ALPHABET:vP,generateString:$00,protocols:["http","https","file","data"]};var _W={};sF(_W,{origin:()=>W00,navigator:()=>NW,hasStandardBrowserWebWorkerEnv:()=>z00,hasStandardBrowserEnv:()=>K00,hasBrowserEnv:()=>wW});var wW=typeof window!=="undefined"&&typeof document!=="undefined",NW=typeof navigator==="object"&&navigator||void 0,K00=wW&&(!NW||["ReactNative","NativeScript","NS"].indexOf(NW.product)<0),z00=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})(),W00=wW&&window.location.href||"http://localhost";var T1={..._W,...AP};function PW(Z,J){return M5(Z,new T1.classes.URLSearchParams,{visitor:function(Q,X,x,q){if(T1.isNode&&b.isBuffer(Q))return this.append(X,Q.toString("base64")),!1;return q.defaultVisitor.apply(this,arguments)},...J})}function V00(Z){return b.matchAll(/\w+|\[(\w*)]/g,Z).map((J)=>{return J[0]==="[]"?"":J[1]||J[0]})}function U00(Z){let J={},Q=Object.keys(Z),X,x=Q.length,q;for(X=0;X<x;X++)q=Q[X],J[q]=Z[q];return J}function H00(Z){function J(Q,X,x,q){let Y=Q[q++];if(Y==="__proto__")return!0;let $=Number.isFinite(+Y),z=q>=Q.length;if(Y=!Y&&b.isArray(x)?x.length:Y,z){if(b.hasOwnProp(x,Y))x[Y]=[x[Y],X];else x[Y]=X;return!$}if(!x[Y]||!b.isObject(x[Y]))x[Y]=[];if(J(Q,X,x[Y],q)&&b.isArray(x[Y]))x[Y]=U00(x[Y]);return!$}if(b.isFormData(Z)&&b.isFunction(Z.entries)){let Q={};return b.forEachEntry(Z,(X,x)=>{J(V00(X),x,Q,0)}),Q}return null}var Dq=H00;function G00(Z,J,Q){if(b.isString(Z))try{return(J||JSON.parse)(Z),b.trim(Z)}catch(X){if(X.name!=="SyntaxError")throw X}return(Q||JSON.stringify)(Z)}var jW={transitional:D5,adapter:["xhr","http","fetch"],transformRequest:[function Z(J,Q){let X=Q.getContentType()||"",x=X.indexOf("application/json")>-1,q=b.isObject(J);if(q&&b.isHTMLForm(J))J=new FormData(J);if(b.isFormData(J))return x?JSON.stringify(Dq(J)):J;if(b.isArrayBuffer(J)||b.isBuffer(J)||b.isStream(J)||b.isFile(J)||b.isBlob(J)||b.isReadableStream(J))return J;if(b.isArrayBufferView(J))return J.buffer;if(b.isURLSearchParams(J))return Q.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),J.toString();let $;if(q){if(X.indexOf("application/x-www-form-urlencoded")>-1)return PW(J,this.formSerializer).toString();if(($=b.isFileList(J))||X.indexOf("multipart/form-data")>-1){let z=this.env&&this.env.FormData;return M5($?{"files[]":J}:J,z&&new z,this.formSerializer)}}if(q||x)return Q.setContentType("application/json",!1),G00(J);return J}],transformResponse:[function Z(J){let Q=this.transitional||jW.transitional,X=Q&&Q.forcedJSONParsing,x=this.responseType==="json";if(b.isResponse(J)||b.isReadableStream(J))return J;if(J&&b.isString(J)&&(X&&!this.responseType||x)){let Y=!(Q&&Q.silentJSONParsing)&&x;try{return JSON.parse(J,this.parseReviver)}catch($){if(Y){if($.name==="SyntaxError")throw m0.from($,m0.ERR_BAD_RESPONSE,this,null,this.response);throw $}}}return J}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T1.classes.FormData,Blob:T1.classes.Blob},validateStatus:function Z(J){return J>=200&&J<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};b.forEach(["delete","get","head","post","put","patch"],(Z)=>{jW.headers[Z]={}});var p9=jW;var B00=b.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),EP=(Z)=>{let J={},Q,X,x;return Z&&Z.split(`
87
87
  `).forEach(function q(Y){if(x=Y.indexOf(":"),Q=Y.substring(0,x).trim().toLowerCase(),X=Y.substring(x+1).trim(),!Q||J[Q]&&B00[Q])return;if(Q==="set-cookie")if(J[Q])J[Q].push(X);else J[Q]=[X];else J[Q]=J[Q]?J[Q]+", "+X:X}),J};var fP=Symbol("internals"),M00=(Z)=>!/[\r\n]/.test(Z);function kP(Z,J){if(Z===!1||Z==null)return;if(b.isArray(Z)){Z.forEach((Q)=>kP(Q,J));return}if(!M00(String(Z)))throw new Error(`Invalid character in header content ["${J}"]`)}function uJ(Z){return Z&&String(Z).trim().toLowerCase()}function D00(Z){let J=Z.length;while(J>0){let Q=Z.charCodeAt(J-1);if(Q!==10&&Q!==13)break;J-=1}return J===Z.length?Z:Z.slice(0,J)}function Fq(Z){if(Z===!1||Z==null)return Z;return b.isArray(Z)?Z.map(Fq):D00(String(Z))}function F00(Z){let J=Object.create(null),Q=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,X;while(X=Q.exec(Z))J[X[1]]=X[2];return J}var N00=(Z)=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(Z.trim());function LW(Z,J,Q,X,x){if(b.isFunction(X))return X.call(this,J,Q);if(x)J=Q;if(!b.isString(J))return;if(b.isString(X))return J.indexOf(X)!==-1;if(b.isRegExp(X))return X.test(J)}function w00(Z){return Z.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(J,Q,X)=>{return Q.toUpperCase()+X})}function _00(Z,J){let Q=b.toCamelCase(" "+J);["get","set","has"].forEach((X)=>{Object.defineProperty(Z,X+Q,{value:function(x,q,Y){return this[X].call(this,J,x,q,Y)},configurable:!0})})}class hJ{constructor(Z){Z&&this.set(Z)}set(Z,J,Q){let X=this;function x(Y,$,z){let W=uJ($);if(!W)throw new Error("header name must be a non-empty string");let U=b.findKey(X,W);if(!U||X[U]===void 0||z===!0||z===void 0&&X[U]!==!1)kP(Y,$),X[U||$]=Fq(Y)}let q=(Y,$)=>b.forEach(Y,(z,W)=>x(z,W,$));if(b.isPlainObject(Z)||Z instanceof this.constructor)q(Z,J);else if(b.isString(Z)&&(Z=Z.trim())&&!N00(Z))q(EP(Z),J);else if(b.isObject(Z)&&b.isIterable(Z)){let Y={},$,z;for(let W of Z){if(!b.isArray(W))throw TypeError("Object iterator must return a key-value pair");Y[z=W[0]]=($=Y[z])?b.isArray($)?[...$,W[1]]:[$,W[1]]:W[1]}q(Y,J)}else Z!=null&&x(J,Z,Q);return this}get(Z,J){if(Z=uJ(Z),Z){let Q=b.findKey(this,Z);if(Q){let X=this[Q];if(!J)return X;if(J===!0)return F00(X);if(b.isFunction(J))return J.call(this,X,Q);if(b.isRegExp(J))return J.exec(X);throw new TypeError("parser must be boolean|regexp|function")}}}has(Z,J){if(Z=uJ(Z),Z){let Q=b.findKey(this,Z);return!!(Q&&this[Q]!==void 0&&(!J||LW(this,this[Q],Q,J)))}return!1}delete(Z,J){let Q=this,X=!1;function x(q){if(q=uJ(q),q){let Y=b.findKey(Q,q);if(Y&&(!J||LW(Q,Q[Y],Y,J)))delete Q[Y],X=!0}}if(b.isArray(Z))Z.forEach(x);else x(Z);return X}clear(Z){let J=Object.keys(this),Q=J.length,X=!1;while(Q--){let x=J[Q];if(!Z||LW(this,this[x],x,Z,!0))delete this[x],X=!0}return X}normalize(Z){let J=this,Q={};return b.forEach(this,(X,x)=>{let q=b.findKey(Q,x);if(q){J[q]=Fq(X),delete J[x];return}let Y=Z?w00(x):String(x).trim();if(Y!==x)delete J[x];J[Y]=Fq(X),Q[Y]=!0}),this}concat(...Z){return this.constructor.concat(this,...Z)}toJSON(Z){let J=Object.create(null);return b.forEach(this,(Q,X)=>{Q!=null&&Q!==!1&&(J[X]=Z&&b.isArray(Q)?Q.join(", "):Q)}),J}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([Z,J])=>Z+": "+J).join(`
88
88
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(Z){return Z instanceof this?Z:new this(Z)}static concat(Z,...J){let Q=new this(Z);return J.forEach((X)=>Q.set(X)),Q}static accessor(Z){let Q=(this[fP]=this[fP]={accessors:{}}).accessors,X=this.prototype;function x(q){let Y=uJ(q);if(!Q[Y])_00(X,q),Q[Y]=!0}return b.isArray(Z)?Z.forEach(x):x(Z),this}}hJ.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);b.reduceDescriptors(hJ.prototype,({value:Z},J)=>{let Q=J[0].toUpperCase()+J.slice(1);return{get:()=>Z,set(X){this[Q]=X}}});b.freezeMethods(hJ);var G2=hJ;function gJ(Z,J){let Q=this||p9,X=J||Q,x=G2.from(X.headers),q=X.data;return b.forEach(Z,function Y($){q=$.call(Q,q,x.normalize(),J?J.status:void 0)}),x.normalize(),q}function iJ(Z){return!!(Z&&Z.__CANCEL__)}class cP extends m0{constructor(Z,J,Q){super(Z==null?"canceled":Z,m0.ERR_CANCELED,J,Q);this.name="CanceledError",this.__CANCEL__=!0}}var j3=cP;function d8(Z,J,Q){let X=Q.config.validateStatus;if(!Q.status||!X||X(Q.status))Z(Q);else J(new m0("Request failed with status code "+Q.status,[m0.ERR_BAD_REQUEST,m0.ERR_BAD_RESPONSE][Math.floor(Q.status/100)-4],Q.config,Q.request,Q))}function CW(Z){if(typeof Z!=="string")return!1;return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(Z)}function OW(Z,J){return J?Z.replace(/\/?\/$/,"")+"/"+J.replace(/^\/+/,""):Z}function N7(Z,J,Q){let X=!CW(J);if(Z&&(X||Q==!1))return OW(Z,J);return J}var P00={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function j00(Z){try{return new URL(Z)}catch{return null}}function bP(Z){var J=(typeof Z==="string"?j00(Z):Z)||{},Q=J.protocol,X=J.host,x=J.port;if(typeof X!=="string"||!X||typeof Q!=="string")return"";if(Q=Q.split(":",1)[0],X=X.replace(/:\d*$/,""),x=parseInt(x)||P00[Q]||0,!L00(X,x))return"";var q=mW(Q+"_proxy")||mW("all_proxy");if(q&&q.indexOf("://")===-1)q=Q+"://"+q;return q}function L00(Z,J){var Q=mW("no_proxy").toLowerCase();if(!Q)return!0;if(Q==="*")return!1;return Q.split(/[,\s]/).every(function(X){if(!X)return!0;var x=X.match(/^(.+):(\d+)$/),q=x?x[1]:X,Y=x?parseInt(x[2]):0;if(Y&&Y!==J)return!0;if(!/^[.*]/.test(q))return Z!==q;if(q.charAt(0)==="*")q=q.slice(1);return!Z.endsWith(q)})}function mW(Z){return process.env[Z.toLowerCase()]||process.env[Z.toUpperCase()]||""}var Lj=O9(Yj(),1);import f10 from"http";import k10 from"https";import Pj from"http2";import jj from"util";import N5 from"zlib";var L7="1.15.0";function aJ(Z){let J=/^([-+\w]{1,25})(:?\/\/|:)/.exec(Z);return J&&J[1]||""}var w10=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function gW(Z,J,Q){let X=Q&&Q.Blob||T1.classes.Blob,x=aJ(Z);if(J===void 0&&X)J=!0;if(x==="data"){Z=x.length?Z.slice(x.length+1):Z;let q=w10.exec(Z);if(!q)throw new m0("Invalid URL",m0.ERR_INVALID_URL);let Y=q[1],$=q[2],z=q[3],W=Buffer.from(decodeURIComponent(z),$?"base64":"utf8");if(J){if(!X)throw new m0("Blob is not supported",m0.ERR_NOT_SUPPORT);return new X([W],{type:Y})}return W}throw new m0("Unsupported protocol "+x,m0.ERR_NOT_SUPPORT)}import F5 from"stream";import _10 from"stream";var iW=Symbol("internals");class $j extends _10.Transform{constructor(Z){Z=b.toFlatObject(Z,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(Q,X)=>{return!b.isUndefined(X[Q])});super({readableHighWaterMark:Z.chunkSize});let J=this[iW]={timeWindow:Z.timeWindow,chunkSize:Z.chunkSize,maxRate:Z.maxRate,minChunkSize:Z.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(Q)=>{if(Q==="progress"){if(!J.isCaptured)J.isCaptured=!0}})}_read(Z){let J=this[iW];if(J.onReadCallback)J.onReadCallback();return super._read(Z)}_transform(Z,J,Q){let X=this[iW],x=X.maxRate,q=this.readableHighWaterMark,Y=X.timeWindow,$=1000/Y,z=x/$,W=X.minChunkSize!==!1?Math.max(X.minChunkSize,z*0.01):0,U=(B,M)=>{let D=Buffer.byteLength(B);if(X.bytesSeen+=D,X.bytes+=D,X.isCaptured&&this.emit("progress",X.bytesSeen),this.push(B))process.nextTick(M);else X.onReadCallback=()=>{X.onReadCallback=null,process.nextTick(M)}},H=(B,M)=>{let D=Buffer.byteLength(B),N=null,_=q,j,O=0;if(x){let A=Date.now();if(!X.ts||(O=A-X.ts)>=Y)X.ts=A,j=z-X.bytes,X.bytes=j<0?-j:0,O=0;j=z-X.bytes}if(x){if(j<=0)return setTimeout(()=>{M(null,B)},Y-O);if(j<_)_=j}if(_&&D>_&&D-_>W)N=B.subarray(_),B=B.subarray(0,_);U(B,N?()=>{process.nextTick(M,null,N)}:M)};H(Z,function B(M,D){if(M)return Q(M);if(D)H(D,B);else Q(null)})}}var dW=$j;import{EventEmitter as c10}from"events";import j10 from"util";import{Readable as L10}from"stream";var{asyncIterator:Kj}=Symbol,P10=async function*(Z){if(Z.stream)yield*Z.stream();else if(Z.arrayBuffer)yield await Z.arrayBuffer();else if(Z[Kj])yield*Z[Kj]();else yield Z},Lq=P10;var C10=T1.ALPHABET.ALPHA_DIGIT+"-_",rJ=typeof TextEncoder==="function"?new TextEncoder:new j10.TextEncoder,C7=`\r
89
89
  `,O10=rJ.encode(C7),m10=2;class zj{constructor(Z,J){let{escapeName:Q}=this.constructor,X=b.isString(J),x=`Content-Disposition: form-data; name="${Q(Z)}"${!X&&J.name?`; filename="${Q(J.name)}"`:""}${C7}`;if(X)J=rJ.encode(String(J).replace(/\r?\n|\r\n?/g,C7));else x+=`Content-Type: ${J.type||"application/octet-stream"}${C7}`;this.headers=rJ.encode(x+C7),this.contentLength=X?J.byteLength:J.size,this.size=this.headers.byteLength+this.contentLength+m10,this.name=Z,this.value=J}async*encode(){yield this.headers;let{value:Z}=this;if(b.isTypedArray(Z))yield Z;else yield*Lq(Z);yield O10}static escapeName(Z){return String(Z).replace(/[\r\n"]/g,(J)=>({"\r":"%0D","\n":"%0A",'"':"%22"})[J])}}var S10=(Z,J,Q)=>{let{tag:X="form-data-boundary",size:x=25,boundary:q=X+"-"+T1.generateString(x,C10)}=Q||{};if(!b.isFormData(Z))throw TypeError("FormData instance required");if(q.length<1||q.length>70)throw Error("boundary must be 10-70 characters long");let Y=rJ.encode("--"+q+C7),$=rJ.encode("--"+q+"--"+C7),z=$.byteLength,W=Array.from(Z.entries()).map(([H,B])=>{let M=new zj(H,B);return z+=M.size,M});z+=Y.byteLength*W.length,z=b.toFiniteNumber(z);let U={"Content-Type":`multipart/form-data; boundary=${q}`};if(Number.isFinite(z))U["Content-Length"]=z;return J&&J(U),L10.from(async function*(){for(let H of W)yield Y,yield*H.encode();yield $}())},Wj=S10;import R10 from"stream";class Vj extends R10.Transform{__transform(Z,J,Q){this.push(Z),Q()}_transform(Z,J,Q){if(Z.length!==0){if(this._transform=this.__transform,Z[0]!==120){let X=Buffer.alloc(2);X[0]=120,X[1]=156,this.push(X,J)}}this.__transform(Z,J,Q)}}var Uj=Vj;var I10=(Z,J)=>{return b.isAsyncFn(Z)?function(...Q){let X=Q.pop();Z.apply(this,Q).then((x)=>{try{J?X(null,...J(x)):X(null,x)}catch(q){X(q)}},X)}:Z},Hj=I10;var T10={http:80,https:443,ws:80,wss:443,ftp:21},v10=(Z)=>{let J=Z,Q=0;if(J.charAt(0)==="["){let q=J.indexOf("]");if(q!==-1){let Y=J.slice(1,q),$=J.slice(q+1);if($.charAt(0)===":"&&/^\d+$/.test($.slice(1)))Q=Number.parseInt($.slice(1),10);return[Y,Q]}}let X=J.indexOf(":"),x=J.lastIndexOf(":");if(X!==-1&&X===x&&/^\d+$/.test(J.slice(x+1)))Q=Number.parseInt(J.slice(x+1),10),J=J.slice(0,x);return[J,Q]},Gj=(Z)=>{if(!Z)return Z;if(Z.charAt(0)==="["&&Z.charAt(Z.length-1)==="]")Z=Z.slice(1,-1);return Z.replace(/\.+$/,"")};function lW(Z){let J;try{J=new URL(Z)}catch(q){return!1}let Q=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!Q)return!1;if(Q==="*")return!0;let X=Number.parseInt(J.port,10)||T10[J.protocol.split(":",1)[0]]||0,x=Gj(J.hostname.toLowerCase());return Q.split(/[\s,]+/).some((q)=>{if(!q)return!1;let[Y,$]=v10(q);if(Y=Gj(Y),!Y)return!1;if($&&$!==X)return!1;if(Y.charAt(0)==="*")Y=Y.slice(1);if(Y.charAt(0)===".")return x.endsWith(Y);return x===Y})}function A10(Z,J){Z=Z||10;let Q=new Array(Z),X=new Array(Z),x=0,q=0,Y;return J=J!==void 0?J:1000,function $(z){let W=Date.now(),U=X[q];if(!Y)Y=W;Q[x]=z,X[x]=W;let H=q,B=0;while(H!==x)B+=Q[H++],H=H%Z;if(x=(x+1)%Z,x===q)q=(q+1)%Z;if(W-Y<J)return;let M=U&&W-U;return M?Math.round(B*1000/M):void 0}}var Bj=A10;function E10(Z,J){let Q=0,X=1000/J,x,q,Y=(W,U=Date.now())=>{if(Q=U,x=null,q)clearTimeout(q),q=null;Z(...W)};return[(...W)=>{let U=Date.now(),H=U-Q;if(H>=X)Y(W,U);else if(x=W,!q)q=setTimeout(()=>{q=null,Y(x)},X-H)},()=>x&&Y(x)]}var Mj=E10;var T6=(Z,J,Q=3)=>{let X=0,x=Bj(50,250);return Mj((q)=>{let Y=q.loaded,$=q.lengthComputable?q.total:void 0,z=Y-X,W=x(z),U=Y<=$;X=Y;let H={loaded:Y,total:$,progress:$?Y/$:void 0,bytes:z,rate:W?W:void 0,estimated:W&&$&&U?($-Y)/W:void 0,event:q,lengthComputable:$!=null,[J?"download":"upload"]:!0};Z(H)},Q)},g9=(Z,J)=>{let Q=Z!=null;return[(X)=>J[0]({lengthComputable:Q,total:Z,loaded:X}),J[1]]},i9=(Z)=>(...J)=>b.asap(()=>Z(...J));function oW(Z){if(!Z||typeof Z!=="string")return 0;if(!Z.startsWith("data:"))return 0;let J=Z.indexOf(",");if(J<0)return 0;let Q=Z.slice(5,J),X=Z.slice(J+1);if(/;base64/i.test(Q)){let{length:q,length:Y}=X;for(let B=0;B<Y;B++)if(X.charCodeAt(B)===37&&B+2<Y){let M=X.charCodeAt(B+1),D=X.charCodeAt(B+2);if((M>=48&&M<=57||M>=65&&M<=70||M>=97&&M<=102)&&(D>=48&&D<=57||D>=65&&D<=70||D>=97&&D<=102))q-=2,B+=2}let $=0,z=Y-1,W=(B)=>B>=2&&X.charCodeAt(B-2)===37&&X.charCodeAt(B-1)===51&&(X.charCodeAt(B)===68||X.charCodeAt(B)===100);if(z>=0){if(X.charCodeAt(z)===61)$++,z--;else if(W(z))$++,z-=3}if($===1&&z>=0){if(X.charCodeAt(z)===61)$++;else if(W(z))$++}let H=Math.floor(q/4)*3-($||0);return H>0?H:0}return Buffer.byteLength(X,"utf8")}var Dj={flush:N5.constants.Z_SYNC_FLUSH,finishFlush:N5.constants.Z_SYNC_FLUSH},b10={flush:N5.constants.BROTLI_OPERATION_FLUSH,finishFlush:N5.constants.BROTLI_OPERATION_FLUSH},Fj=b.isFunction(N5.createBrotliDecompress),{http:p10,https:y10}=Lj.default,u10=/https:?/,Nj=T1.protocols.map((Z)=>{return Z+":"}),wj=(Z,[J,Q])=>{return Z.on("end",Q).on("error",Q),J};class Cj{constructor(){this.sessions=Object.create(null)}getSession(Z,J){J=Object.assign({sessionTimeout:1000},J);let Q=this.sessions[Z];if(Q){let W=Q.length;for(let U=0;U<W;U++){let[H,B]=Q[U];if(!H.destroyed&&!H.closed&&jj.isDeepStrictEqual(B,J))return H}}let X=Pj.connect(Z,J),x,q=()=>{if(x)return;x=!0;let W=Q,U=W.length,H=U;while(H--)if(W[H][0]===X){if(U===1)delete this.sessions[Z];else W.splice(H,1);if(!X.closed)X.close();return}},Y=X.request,{sessionTimeout:$}=J;if($!=null){let W,U=0;X.request=function(){let H=Y.apply(this,arguments);if(U++,W)clearTimeout(W),W=null;return H.once("close",()=>{if(!--U)W=setTimeout(()=>{W=null,q()},$)}),H}}X.once("close",q);let z=[X,J];return Q?Q.push(z):Q=this.sessions[Z]=[z],X}}var h10=new Cj;function g10(Z,J){if(Z.beforeRedirects.proxy)Z.beforeRedirects.proxy(Z);if(Z.beforeRedirects.config)Z.beforeRedirects.config(Z,J)}function Oj(Z,J,Q){let X=J;if(!X&&X!==!1){let x=bP(Q);if(x){if(!lW(Q))X=new URL(x)}}if(X){if(X.username)X.auth=(X.username||"")+":"+(X.password||"");if(X.auth){if(Boolean(X.auth.username||X.auth.password))X.auth=(X.auth.username||"")+":"+(X.auth.password||"");else if(typeof X.auth==="object")throw new m0("Invalid proxy authorization",m0.ERR_BAD_OPTION,{proxy:X});let Y=Buffer.from(X.auth,"utf8").toString("base64");Z.headers["Proxy-Authorization"]="Basic "+Y}Z.headers.host=Z.hostname+(Z.port?":"+Z.port:"");let x=X.hostname||X.host;if(Z.hostname=x,Z.host=x,Z.port=X.port,Z.path=Q,X.protocol)Z.protocol=X.protocol.includes(":")?X.protocol:`${X.protocol}:`}Z.beforeRedirects.proxy=function x(q){Oj(q,J,q.href)}}var i10=typeof process!=="undefined"&&b.kindOf(process)==="process",d10=(Z)=>{return new Promise((J,Q)=>{let X,x,q=(z,W)=>{if(x)return;x=!0,X&&X(z,W)},Y=(z)=>{q(z),J(z)},$=(z)=>{q(z,!0),Q(z)};Z(Y,$,(z)=>X=z).catch($)})},l10=({address:Z,family:J})=>{if(!b.isString(Z))throw TypeError("address must be a string");return{address:Z,family:J||(Z.indexOf(".")<0?6:4)}},_j=(Z,J)=>l10(b.isObject(Z)?Z:{address:Z,family:J}),o10={request(Z,J){let Q=Z.protocol+"//"+Z.hostname+":"+(Z.port||(Z.protocol==="https:"?443:80)),{http2Options:X,headers:x}=Z,q=h10.getSession(Q,X),{HTTP2_HEADER_SCHEME:Y,HTTP2_HEADER_METHOD:$,HTTP2_HEADER_PATH:z,HTTP2_HEADER_STATUS:W}=Pj.constants,U={[Y]:Z.protocol.replace(":",""),[$]:Z.method,[z]:Z.path};b.forEach(x,(B,M)=>{M.charAt(0)!==":"&&(U[M]=B)});let H=q.request(U);return H.once("response",(B)=>{let M=H;B=Object.assign({},B);let D=B[W];delete B[W],M.headers=B,M.statusCode=+D,J(M)}),H}},mj=i10&&function Z(J){return d10(async function Q(X,x,q){let{data:Y,lookup:$,family:z,httpVersion:W=1,http2Options:U}=J,{responseType:H,responseEncoding:B}=J,M=J.method.toUpperCase(),D,N=!1,_;if(W=+W,Number.isNaN(W))throw TypeError(`Invalid protocol version: '${J.httpVersion}' is not a number`);if(W!==1&&W!==2)throw TypeError(`Unsupported protocol version '${W}'`);let j=W===2;if($){let N0=Hj($,(z0)=>b.isArray(z0)?z0:[z0]);$=(z0,r0,_1)=>{N0(z0,r0,(Q1,v0,A0)=>{if(Q1)return _1(Q1);let G1=b.isArray(v0)?v0.map((P0)=>_j(P0)):[_j(v0,A0)];r0.all?_1(Q1,G1):_1(Q1,G1[0].address,G1[0].family)})}}let O=new c10;function A(N0){try{O.emit("abort",!N0||N0.type?new j3(null,J,_):N0)}catch(z0){console.warn("emit error",z0)}}O.once("abort",x);let h=()=>{if(J.cancelToken)J.cancelToken.unsubscribe(A);if(J.signal)J.signal.removeEventListener("abort",A);O.removeAllListeners()};if(J.cancelToken||J.signal){if(J.cancelToken&&J.cancelToken.subscribe(A),J.signal)J.signal.aborted?A():J.signal.addEventListener("abort",A)}q((N0,z0)=>{if(D=!0,z0){N=!0,h();return}let{data:r0}=N0;if(r0 instanceof F5.Readable||r0 instanceof F5.Duplex){let _1=F5.finished(r0,()=>{_1(),h()})}else h()});let u=N7(J.baseURL,J.url,J.allowAbsoluteUrls),e=new URL(u,T1.hasBrowserEnv?T1.origin:void 0),s=e.protocol||Nj[0];if(s==="data:"){if(J.maxContentLength>-1){let z0=String(J.url||u||"");if(oW(z0)>J.maxContentLength)return x(new m0("maxContentLength size of "+J.maxContentLength+" exceeded",m0.ERR_BAD_RESPONSE,J))}let N0;if(M!=="GET")return d8(X,x,{status:405,statusText:"method not allowed",headers:{},config:J});try{N0=gW(J.url,H==="blob",{Blob:J.env&&J.env.Blob})}catch(z0){throw m0.from(z0,m0.ERR_BAD_REQUEST,J)}if(H==="text"){if(N0=N0.toString(B),!B||B==="utf8")N0=b.stripBOM(N0)}else if(H==="stream")N0=F5.Readable.from(N0);return d8(X,x,{data:N0,status:200,statusText:"OK",headers:new G2,config:J})}if(Nj.indexOf(s)===-1)return x(new m0("Unsupported protocol "+s,m0.ERR_BAD_REQUEST,J));let m=G2.from(J.headers).normalize();m.set("User-Agent","axios/"+L7,!1);let{onUploadProgress:R,onDownloadProgress:f}=J,E=J.maxRate,V0=void 0,M0=void 0;if(b.isSpecCompliantForm(Y)){let N0=m.getContentType(/boundary=([-_\w\d]{10,70})/i);Y=Wj(Y,(z0)=>{m.set(z0)},{tag:`axios-${L7}-boundary`,boundary:N0&&N0[1]||void 0})}else if(b.isFormData(Y)&&b.isFunction(Y.getHeaders)){if(m.set(Y.getHeaders()),!m.hasContentLength())try{let N0=await jj.promisify(Y.getLength).call(Y);Number.isFinite(N0)&&N0>=0&&m.setContentLength(N0)}catch(N0){}}else if(b.isBlob(Y)||b.isFile(Y))Y.size&&m.setContentType(Y.type||"application/octet-stream"),m.setContentLength(Y.size||0),Y=F5.Readable.from(Lq(Y));else if(Y&&!b.isStream(Y)){if(Buffer.isBuffer(Y));else if(b.isArrayBuffer(Y))Y=Buffer.from(new Uint8Array(Y));else if(b.isString(Y))Y=Buffer.from(Y,"utf-8");else return x(new m0("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",m0.ERR_BAD_REQUEST,J));if(m.setContentLength(Y.length,!1),J.maxBodyLength>-1&&Y.length>J.maxBodyLength)return x(new m0("Request body larger than maxBodyLength limit",m0.ERR_BAD_REQUEST,J))}let n=b.toFiniteNumber(m.getContentLength());if(b.isArray(E))V0=E[0],M0=E[1];else V0=M0=E;if(Y&&(R||V0)){if(!b.isStream(Y))Y=F5.Readable.from(Y,{objectMode:!1});Y=F5.pipeline([Y,new dW({maxRate:b.toFiniteNumber(V0)})],b.noop),R&&Y.on("progress",wj(Y,g9(n,T6(i9(R),!1,3))))}let I=void 0;if(J.auth){let N0=J.auth.username||"",z0=J.auth.password||"";I=N0+":"+z0}if(!I&&e.username){let{username:N0,password:z0}=e;I=N0+":"+z0}I&&m.delete("authorization");let o;try{o=F7(e.pathname+e.search,J.params,J.paramsSerializer).replace(/^\?/,"")}catch(N0){let z0=new Error(N0.message);return z0.config=J,z0.url=J.url,z0.exists=!0,x(z0)}m.set("Accept-Encoding","gzip, compress, deflate"+(Fj?", br":""),!1);let F0={path:o,method:M,headers:m.toJSON(),agents:{http:J.httpAgent,https:J.httpsAgent},auth:I,protocol:s,family:z,beforeRedirect:g10,beforeRedirects:{},http2Options:U};if(!b.isUndefined($)&&(F0.lookup=$),J.socketPath)F0.socketPath=J.socketPath;else F0.hostname=e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,F0.port=e.port,Oj(F0,J.proxy,s+"//"+e.hostname+(e.port?":"+e.port:"")+F0.path);let D0,i0=u10.test(F0.protocol);if(F0.agent=i0?J.httpsAgent:J.httpAgent,j)D0=o10;else if(J.transport)D0=J.transport;else if(J.maxRedirects===0)D0=i0?k10:f10;else{if(J.maxRedirects)F0.maxRedirects=J.maxRedirects;if(J.beforeRedirect)F0.beforeRedirects.config=J.beforeRedirect;D0=i0?y10:p10}if(J.maxBodyLength>-1)F0.maxBodyLength=J.maxBodyLength;else F0.maxBodyLength=1/0;if(J.insecureHTTPParser)F0.insecureHTTPParser=J.insecureHTTPParser;if(_=D0.request(F0,function N0(z0){if(_.destroyed)return;let r0=[z0],_1=b.toFiniteNumber(z0.headers["content-length"]);if(f||M0){let G1=new dW({maxRate:b.toFiniteNumber(M0)});f&&G1.on("progress",wj(G1,g9(_1,T6(i9(f),!0,3)))),r0.push(G1)}let Q1=z0,v0=z0.req||_;if(J.decompress!==!1&&z0.headers["content-encoding"]){if(M==="HEAD"||z0.statusCode===204)delete z0.headers["content-encoding"];switch((z0.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":r0.push(N5.createUnzip(Dj)),delete z0.headers["content-encoding"];break;case"deflate":r0.push(new Uj),r0.push(N5.createUnzip(Dj)),delete z0.headers["content-encoding"];break;case"br":if(Fj)r0.push(N5.createBrotliDecompress(b10)),delete z0.headers["content-encoding"]}}Q1=r0.length>1?F5.pipeline(r0,b.noop):r0[0];let A0={status:z0.statusCode,statusText:z0.statusMessage,headers:new G2(z0.headers),config:J,request:v0};if(H==="stream")A0.data=Q1,d8(X,x,A0);else{let G1=[],P0=0;Q1.on("data",function W0(X0){if(G1.push(X0),P0+=X0.length,J.maxContentLength>-1&&P0>J.maxContentLength)N=!0,Q1.destroy(),A(new m0("maxContentLength size of "+J.maxContentLength+" exceeded",m0.ERR_BAD_RESPONSE,J,v0))}),Q1.on("aborted",function W0(){if(N)return;let X0=new m0("stream has been aborted",m0.ERR_BAD_RESPONSE,J,v0);Q1.destroy(X0),x(X0)}),Q1.on("error",function W0(X0){if(_.destroyed)return;x(m0.from(X0,null,J,v0))}),Q1.on("end",function W0(){try{let X0=G1.length===1?G1[0]:Buffer.concat(G1);if(H!=="arraybuffer"){if(X0=X0.toString(B),!B||B==="utf8")X0=b.stripBOM(X0)}A0.data=X0}catch(X0){return x(m0.from(X0,null,J,A0.request,A0))}d8(X,x,A0)})}O.once("abort",(G1)=>{if(!Q1.destroyed)Q1.emit("error",G1),Q1.destroy()})}),O.once("abort",(N0)=>{if(_.close)_.close();else _.destroy(N0)}),_.on("error",function N0(z0){x(m0.from(z0,null,J,_))}),_.on("socket",function N0(z0){z0.setKeepAlive(!0,60000)}),J.timeout){let N0=parseInt(J.timeout,10);if(Number.isNaN(N0)){A(new m0("error trying to parse `config.timeout` to int",m0.ERR_BAD_OPTION_VALUE,J,_));return}_.setTimeout(N0,function z0(){if(D)return;let r0=J.timeout?"timeout of "+J.timeout+"ms exceeded":"timeout exceeded",_1=J.transitional||D5;if(J.timeoutErrorMessage)r0=J.timeoutErrorMessage;A(new m0(r0,_1.clarifyTimeoutError?m0.ETIMEDOUT:m0.ECONNABORTED,J,_))})}else _.setTimeout(0);if(b.isStream(Y)){let N0=!1,z0=!1;Y.on("end",()=>{N0=!0}),Y.once("error",(r0)=>{z0=!0,_.destroy(r0)}),Y.on("close",()=>{if(!N0&&!z0)A(new j3("Request stream has been aborted",J,_))}),Y.pipe(_)}else Y&&_.write(Y),_.end()})};var Sj=T1.hasStandardBrowserEnv?((Z,J)=>(Q)=>{return Q=new URL(Q,T1.origin),Z.protocol===Q.protocol&&Z.host===Q.host&&(J||Z.port===Q.port)})(new URL(T1.origin),T1.navigator&&/(msie|trident)/i.test(T1.navigator.userAgent)):()=>!0;var Rj=T1.hasStandardBrowserEnv?{write(Z,J,Q,X,x,q,Y){if(typeof document==="undefined")return;let $=[`${Z}=${encodeURIComponent(J)}`];if(b.isNumber(Q))$.push(`expires=${new Date(Q).toUTCString()}`);if(b.isString(X))$.push(`path=${X}`);if(b.isString(x))$.push(`domain=${x}`);if(q===!0)$.push("secure");if(b.isString(Y))$.push(`SameSite=${Y}`);document.cookie=$.join("; ")},read(Z){if(typeof document==="undefined")return null;let J=document.cookie.match(new RegExp("(?:^|; )"+Z+"=([^;]*)"));return J?decodeURIComponent(J[1]):null},remove(Z){this.write(Z,"",Date.now()-86400000,"/")}}:{write(){},read(){return null},remove(){}};var Ij=(Z)=>Z instanceof G2?{...Z}:Z;function j8(Z,J){J=J||{};let Q={};function X(W,U,H,B){if(b.isPlainObject(W)&&b.isPlainObject(U))return b.merge.call({caseless:B},W,U);else if(b.isPlainObject(U))return b.merge({},U);else if(b.isArray(U))return U.slice();return U}function x(W,U,H,B){if(!b.isUndefined(U))return X(W,U,H,B);else if(!b.isUndefined(W))return X(void 0,W,H,B)}function q(W,U){if(!b.isUndefined(U))return X(void 0,U)}function Y(W,U){if(!b.isUndefined(U))return X(void 0,U);else if(!b.isUndefined(W))return X(void 0,W)}function $(W,U,H){if(H in J)return X(W,U);else if(H in Z)return X(void 0,W)}let z={url:q,method:q,data:q,baseURL:Y,transformRequest:Y,transformResponse:Y,paramsSerializer:Y,timeout:Y,timeoutMessage:Y,withCredentials:Y,withXSRFToken:Y,adapter:Y,responseType:Y,xsrfCookieName:Y,xsrfHeaderName:Y,onUploadProgress:Y,onDownloadProgress:Y,decompress:Y,maxContentLength:Y,maxBodyLength:Y,beforeRedirect:Y,transport:Y,httpAgent:Y,httpsAgent:Y,cancelToken:Y,socketPath:Y,responseEncoding:Y,validateStatus:$,headers:(W,U,H)=>x(Ij(W),Ij(U),H,!0)};return b.forEach(Object.keys({...Z,...J}),function W(U){if(U==="__proto__"||U==="constructor"||U==="prototype")return;let H=b.hasOwnProp(z,U)?z[U]:x,B=H(Z[U],J[U],U);b.isUndefined(B)&&H!==$||(Q[U]=B)}),Q}var Cq=(Z)=>{let J=j8({},Z),{data:Q,withXSRFToken:X,xsrfHeaderName:x,xsrfCookieName:q,headers:Y,auth:$}=J;if(J.headers=Y=G2.from(Y),J.url=F7(N7(J.baseURL,J.url,J.allowAbsoluteUrls),Z.params,Z.paramsSerializer),$)Y.set("Authorization","Basic "+btoa(($.username||"")+":"+($.password?unescape(encodeURIComponent($.password)):"")));if(b.isFormData(Q)){if(T1.hasStandardBrowserEnv||T1.hasStandardBrowserWebWorkerEnv)Y.setContentType(void 0);else if(b.isFunction(Q.getHeaders)){let z=Q.getHeaders(),W=["content-type","content-length"];Object.entries(z).forEach(([U,H])=>{if(W.includes(U.toLowerCase()))Y.set(U,H)})}}if(T1.hasStandardBrowserEnv){if(X&&b.isFunction(X)&&(X=X(J)),X||X!==!1&&Sj(J.url)){let z=x&&q&&Rj.read(q);if(z)Y.set(x,z)}}return J};var s10=typeof XMLHttpRequest!=="undefined",Tj=s10&&function(Z){return new Promise(function J(Q,X){let x=Cq(Z),q=x.data,Y=G2.from(x.headers).normalize(),{responseType:$,onUploadProgress:z,onDownloadProgress:W}=x,U,H,B,M,D;function N(){M&&M(),D&&D(),x.cancelToken&&x.cancelToken.unsubscribe(U),x.signal&&x.signal.removeEventListener("abort",U)}let _=new XMLHttpRequest;_.open(x.method.toUpperCase(),x.url,!0),_.timeout=x.timeout;function j(){if(!_)return;let A=G2.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),u={data:!$||$==="text"||$==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:A,config:Z,request:_};d8(function e(s){Q(s),N()},function e(s){X(s),N()},u),_=null}if("onloadend"in _)_.onloadend=j;else _.onreadystatechange=function A(){if(!_||_.readyState!==4)return;if(_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0))return;setTimeout(j)};if(_.onabort=function A(){if(!_)return;X(new m0("Request aborted",m0.ECONNABORTED,Z,_)),_=null},_.onerror=function A(h){let u=h&&h.message?h.message:"Network Error",e=new m0(u,m0.ERR_NETWORK,Z,_);e.event=h||null,X(e),_=null},_.ontimeout=function A(){let h=x.timeout?"timeout of "+x.timeout+"ms exceeded":"timeout exceeded",u=x.transitional||D5;if(x.timeoutErrorMessage)h=x.timeoutErrorMessage;X(new m0(h,u.clarifyTimeoutError?m0.ETIMEDOUT:m0.ECONNABORTED,Z,_)),_=null},q===void 0&&Y.setContentType(null),"setRequestHeader"in _)b.forEach(Y.toJSON(),function A(h,u){_.setRequestHeader(u,h)});if(!b.isUndefined(x.withCredentials))_.withCredentials=!!x.withCredentials;if($&&$!=="json")_.responseType=x.responseType;if(W)[B,D]=T6(W,!0),_.addEventListener("progress",B);if(z&&_.upload)[H,M]=T6(z),_.upload.addEventListener("progress",H),_.upload.addEventListener("loadend",M);if(x.cancelToken||x.signal){if(U=(A)=>{if(!_)return;X(!A||A.type?new j3(null,Z,_):A),_.abort(),_=null},x.cancelToken&&x.cancelToken.subscribe(U),x.signal)x.signal.aborted?U():x.signal.addEventListener("abort",U)}let O=aJ(x.url);if(O&&T1.protocols.indexOf(O)===-1){X(new m0("Unsupported protocol "+O+":",m0.ERR_BAD_REQUEST,Z));return}_.send(q||null)})};var n10=(Z,J)=>{let{length:Q}=Z=Z?Z.filter(Boolean):[];if(J||Q){let X=new AbortController,x,q=function(W){if(!x){x=!0,$();let U=W instanceof Error?W:this.reason;X.abort(U instanceof m0?U:new j3(U instanceof Error?U.message:U))}},Y=J&&setTimeout(()=>{Y=null,q(new m0(`timeout of ${J}ms exceeded`,m0.ETIMEDOUT))},J),$=()=>{if(Z)Y&&clearTimeout(Y),Y=null,Z.forEach((W)=>{W.unsubscribe?W.unsubscribe(q):W.removeEventListener("abort",q)}),Z=null};Z.forEach((W)=>W.addEventListener("abort",q));let{signal:z}=X;return z.unsubscribe=()=>b.asap($),z}},vj=n10;var a10=function*(Z,J){let Q=Z.byteLength;if(!J||Q<J){yield Z;return}let X=0,x;while(X<Q)x=X+J,yield Z.slice(X,x),X=x},r10=async function*(Z,J){for await(let Q of t10(Z))yield*a10(Q,J)},t10=async function*(Z){if(Z[Symbol.asyncIterator]){yield*Z;return}let J=Z.getReader();try{for(;;){let{done:Q,value:X}=await J.read();if(Q)break;yield X}}finally{await J.cancel()}},sW=(Z,J,Q,X)=>{let x=r10(Z,J),q=0,Y,$=(z)=>{if(!Y)Y=!0,X&&X(z)};return new ReadableStream({async pull(z){try{let{done:W,value:U}=await x.next();if(W){$(),z.close();return}let H=U.byteLength;if(Q){let B=q+=H;Q(B)}z.enqueue(new Uint8Array(U))}catch(W){throw $(W),W}},cancel(z){return $(z),x.return()}},{highWaterMark:2})};var Aj=65536,{isFunction:Oq}=b,e10=(({Request:Z,Response:J})=>({Request:Z,Response:J}))(b.global),{ReadableStream:Ej,TextEncoder:fj}=b.global,kj=(Z,...J)=>{try{return!!Z(...J)}catch(Q){return!1}},Z20=(Z)=>{Z=b.merge.call({skipUndefined:!0},e10,Z);let{fetch:J,Request:Q,Response:X}=Z,x=J?Oq(J):typeof fetch==="function",q=Oq(Q),Y=Oq(X);if(!x)return!1;let $=x&&Oq(Ej),z=x&&(typeof fj==="function"?((D)=>(N)=>D.encode(N))(new fj):async(D)=>new Uint8Array(await new Q(D).arrayBuffer())),W=q&&$&&kj(()=>{let D=!1,N=new Ej,_=new Q(T1.origin,{body:N,method:"POST",get duplex(){return D=!0,"half"}}).headers.has("Content-Type");return N.cancel(),D&&!_}),U=Y&&$&&kj(()=>b.isReadableStream(new X("").body)),H={stream:U&&((D)=>D.body)};x&&(()=>{["text","arrayBuffer","blob","formData","stream"].forEach((D)=>{!H[D]&&(H[D]=(N,_)=>{let j=N&&N[D];if(j)return j.call(N);throw new m0(`Response type '${D}' is not supported`,m0.ERR_NOT_SUPPORT,_)})})})();let B=async(D)=>{if(D==null)return 0;if(b.isBlob(D))return D.size;if(b.isSpecCompliantForm(D))return(await new Q(T1.origin,{method:"POST",body:D}).arrayBuffer()).byteLength;if(b.isArrayBufferView(D)||b.isArrayBuffer(D))return D.byteLength;if(b.isURLSearchParams(D))D=D+"";if(b.isString(D))return(await z(D)).byteLength},M=async(D,N)=>{let _=b.toFiniteNumber(D.getContentLength());return _==null?B(N):_};return async(D)=>{let{url:N,method:_,data:j,signal:O,cancelToken:A,timeout:h,onDownloadProgress:u,onUploadProgress:e,responseType:s,headers:m,withCredentials:R="same-origin",fetchOptions:f}=Cq(D),E=J||fetch;s=s?(s+"").toLowerCase():"text";let V0=vj([O,A&&A.toAbortSignal()],h),M0=null,n=V0&&V0.unsubscribe&&(()=>{V0.unsubscribe()}),I;try{if(e&&W&&_!=="get"&&_!=="head"&&(I=await M(m,j))!==0){let z0=new Q(N,{method:"POST",body:j,duplex:"half"}),r0;if(b.isFormData(j)&&(r0=z0.headers.get("content-type")))m.setContentType(r0);if(z0.body){let[_1,Q1]=g9(I,T6(i9(e)));j=sW(z0.body,Aj,_1,Q1)}}if(!b.isString(R))R=R?"include":"omit";let o=q&&"credentials"in Q.prototype,F0={...f,signal:V0,method:_.toUpperCase(),headers:m.normalize().toJSON(),body:j,duplex:"half",credentials:o?R:void 0};M0=q&&new Q(N,F0);let D0=await(q?E(M0,f):E(N,F0)),i0=U&&(s==="stream"||s==="response");if(U&&(u||i0&&n)){let z0={};["status","statusText","headers"].forEach((v0)=>{z0[v0]=D0[v0]});let r0=b.toFiniteNumber(D0.headers.get("content-length")),[_1,Q1]=u&&g9(r0,T6(i9(u),!0))||[];D0=new X(sW(D0.body,Aj,_1,()=>{Q1&&Q1(),n&&n()}),z0)}s=s||"text";let N0=await H[b.findKey(H,s)||"text"](D0,D);return!i0&&n&&n(),await new Promise((z0,r0)=>{d8(z0,r0,{data:N0,headers:G2.from(D0.headers),status:D0.status,statusText:D0.statusText,config:D,request:M0})})}catch(o){if(n&&n(),o&&o.name==="TypeError"&&/Load failed|fetch/i.test(o.message))throw Object.assign(new m0("Network Error",m0.ERR_NETWORK,D,M0,o&&o.response),{cause:o.cause||o});throw m0.from(o,o&&o.code,D,M0,o&&o.response)}}},J20=new Map,nW=(Z)=>{let J=Z&&Z.env||{},{fetch:Q,Request:X,Response:x}=J,q=[X,x,Q],Y=q.length,$=Y,z,W,U=J20;while($--)z=q[$],W=U.get(z),W===void 0&&U.set(z,W=$?new Map:Z20(J)),U=W;return W},ak0=nW();var aW={http:mj,xhr:Tj,fetch:{get:nW}};b.forEach(aW,(Z,J)=>{if(Z){try{Object.defineProperty(Z,"name",{value:J})}catch(Q){}Object.defineProperty(Z,"adapterName",{value:J})}});var cj=(Z)=>`- ${Z}`,X20=(Z)=>b.isFunction(Z)||Z===null||Z===!1;function x20(Z,J){Z=b.isArray(Z)?Z:[Z];let{length:Q}=Z,X,x,q={};for(let Y=0;Y<Q;Y++){X=Z[Y];let $;if(x=X,!X20(X)){if(x=aW[($=String(X)).toLowerCase()],x===void 0)throw new m0(`Unknown adapter '${$}'`)}if(x&&(b.isFunction(x)||(x=x.get(J))))break;q[$||"#"+Y]=x}if(!x){let Y=Object.entries(q).map(([z,W])=>`adapter ${z} `+(W===!1?"is not supported by the environment":"is not available in the build")),$=Q?Y.length>1?`since :
@@ -132,11 +132,11 @@ Examples:
132
132
  holistics auth <api-key> # Default: Use the Asia-Pacific server
133
133
  holistics auth eu <api-key> # Use the EU server
134
134
  holistics auth secure.holistics.io <api-key> # Use the custom server`).allowExcessArguments(!1).action(function(Z){if(Z.length===0)console.error(`error: missing required argument 'api-key'
135
- `),this.outputHelp(),process.exit(1);let J=y30(Z);ZC(J.apiKey,u30(J.address))}),QC=h30;import*as K9 from"fs";import*as a5 from"path";var Bu=O9(TR(),1);import VT0 from"fs";var e8={};sF(e8,{voidType:()=>FZ,version:()=>oI,uniqDiagnostics:()=>s7,typecheckSerializer:()=>JG0,traceNodeDependency:()=>xG0,toServiceDiagnostics:()=>Z$,toServiceDiagnostic:()=>OG,subsetOfUnionType:()=>AH,subsetOf:()=>i1,stringType:()=>V4,slotType:()=>rQ,serializeTable:()=>MG,serializeSymbolTableSlot:()=>GG,send:()=>G0,scopeOfFileSerializer:()=>bE,runParseBenchmark:()=>cG0,rootVtable:()=>vQ,resolveReferenceChain:()=>rv,removeFQNameFromMembers:()=>tY0,releaseCacheForQueries:()=>r$0,releaseCacheForFile:()=>a$0,refCustomModules:()=>KX,recoverInterpretFile:()=>xv,readAmlFileInfo:()=>Af,pushArray:()=>g,prettyPrintStats:()=>pf,parseFromSource:()=>KG,parseFqn:()=>NQ,parseFile:()=>Ef,numberType:()=>m3,newObj:()=>Uv,moduleType:()=>wH,mergeMap:()=>x3,mergeExtendAmlList:()=>Gv,mergeExtendAmlDynamicPropList:()=>Bv,mergeDiagResultDiagnostics:()=>g$0,mergeAmlObjects:()=>TQ,membersOfModuleSerializer:()=>pE,lookupSymbol:()=>i4,lookUp:()=>LH,loadProjectSources:()=>qf,listVtable:()=>JZ,listLeafNodeDependencies:()=>qG0,listAmlFiles:()=>Tf,languageModule:()=>qM0,kind:()=>O8,isUseDeclaration:()=>t8,isUniqueKeyObj:()=>sv,isUnionTypecheckResult:()=>pY,isTypecheckCorrect:()=>n2,isTypeProperty:()=>b5,isTypeNode:()=>JX,isType:()=>iH,isTrivia:()=>RA,isTrait:()=>uY,isSyntaxNode:()=>hH,isStringToken:()=>bU,isStaticString:()=>oH,isSpaceLikeToken:()=>ov,isRulesetNode:()=>iv,isRelExpr:()=>AA,isPropertyAccessExpression:()=>$4,isMacro:()=>kA,isLiteralFunction:()=>kH,isLiteralElement:()=>n7,isKeyword:()=>hv,isInsideBlockExpression:()=>o$0,isImport:()=>gv,isImpl:()=>cH,isIdentifierWithValue:()=>sH,isFunctionArgument:()=>pH,isFunction:()=>v8,isFileTreeNode:()=>VY,isFieldRefExpression:()=>av,isExpression:()=>d6,isElementSymbol:()=>a7,isElementProperty:()=>l6,isElementNameOfDeclaration:()=>d$0,isElement:()=>bH,isDocument:()=>r7,isDeclaration:()=>_Z,isChildNode:()=>dv,isBlockScopedDeclaration:()=>QX,isAssignmentExpression:()=>n$0,isArgumentName:()=>l$0,isAmlSymbol:()=>gH,isAcceptedModule:()=>k1,interpretNode:()=>jH,interpretFileNoTypecheck:()=>Qv,interpretFileJson:()=>qv,interpretFile:()=>Xv,intType:()=>C5,heredocType:()=>vY,hasSelf:()=>c$0,hasErrorDiagnostics:()=>b2,getValueForJsBinding:()=>RG,getTypeOfElementPropNodeForTypeWithMembers:()=>VZ,getTypeOfElementPropNode:()=>MY,getTypeForJsBinding:()=>oQ,getSymbolDefinitionLocation:()=>$k,getSuggestions:()=>qk,getSuggestionKindOfSymbol:()=>rf,getOuterScope:()=>o6,getModuleHierarchyFromFile:()=>Kk,getFoldingRangesFromSource:()=>gf,getFoldingRangesFromNode:()=>wG,getDiagnostics:()=>Yk,getDefinitionLocationFromNode:()=>$Y,getDeclarationNameNode:()=>uv,getDeclarationName:()=>i$0,getDeclarationForJsBinding:()=>SG,getChildIndexFromParent:()=>lv,getAttachedDocument:()=>I8,getAstsFromPaths:()=>s$0,getAstFromNode:()=>yH,generateTypesAndLookupHelper:()=>nv,genCodeFromTypeParameter:()=>Df,genCodeFromTrivia:()=>dU,genCodeFromToken:()=>h1,genCodeFromTemplateString:()=>NG,genCodeFromReturnTypeNode:()=>Sf,genCodeFromPrimaryExpression:()=>Nf,genCodeFromPrefixExpression:()=>Gf,genCodeFromPostfixExpression:()=>Mf,genCodeFromLiteralElementExpression:()=>wf,genCodeFromListExpression:()=>Pf,genCodeFromInfixExpression:()=>Bf,genCodeFromImportModule:()=>If,genCodeFromImportDeclaration:()=>Uf,genCodeFromImportBody:()=>Rf,genCodeFromIdentifier:()=>Ff,genCodeFromHeredoc:()=>_f,genCodeFromGroupExpression:()=>Lf,genCodeFromExpression:()=>Kf,genCodeFromEqualityDeclaration:()=>zf,genCodeFromEmbeddedExpression:()=>Cf,genCodeFromElementDeclaration:()=>Wf,genCodeFromDeclaration:()=>$f,genCodeFromCallExpression:()=>Hf,genCodeFromBlockExpression:()=>jf,genCodeFromBlock:()=>Vf,genCodeFromAst:()=>Yf,genCodeFromArgumentList:()=>Of,genCodeFromArgumentExpression:()=>mf,genCode:()=>C1,formatType:()=>c0,formatDependencyPath:()=>gE,formatBenchmarkResult:()=>Xf,forEachChild:()=>s0,forEachAncestor:()=>uH,flattenTokenStream:()=>gQ,findLeafNodeDependencies:()=>dE,findDependencyPath:()=>uE,filesSerializer:()=>cE,fileContentSerializer:()=>kE,expandRelationshipMacro:()=>WH0,expandRelMacro:()=>zH0,expandMacros:()=>fA,exhaustiveCheck:()=>lH,deserializeTable:()=>DG,deserializeSymbolTableSlot:()=>BG,deproxy:()=>I2,delegate:()=>Wv,decorator:()=>TG,createVt:()=>Vv,createUnionType:()=>q8,createTypeVariable:()=>R5,createSuggestion:()=>e7,createSlotType:()=>J6,createSlotTemplateStringType:()=>gT,createSlotInfixExpressionType:()=>dT,createSlotIfExpressionType:()=>iT,createSlotGenericType:()=>yT,createSignature:()=>J3,createServiceDiagnostic:()=>eU,createRefFunc:()=>ZG,createProductType:()=>T8,createPartialType:()=>pT,createLiteralType:()=>O5,createListType:()=>$Z,createGraphNodeIdFromArgs:()=>fQ,createElementFqn:()=>p5,createDynamicType:()=>qY,createDynamicBodyType:()=>jQ,createDictType:()=>aQ,createDiagnosticForOriginalNode:()=>P2,createDiagnosticChainAfterTypecheck:()=>h6,createCreateSlotFunctionType:()=>hT,createBlockType:()=>I5,createAccessExpressionType:()=>uT,convertToJsMetadata:()=>JH,convertToJsBinding:()=>KY,computeObjectStats:()=>kf,computeLexStats:()=>cf,computeFileStats:()=>ff,computeAstStats:()=>bf,comparsionMethods:()=>v7,combineTypes:()=>_H,collectProjectStats:()=>yf,codegen:()=>IG,classifyFileKind:()=>vf,checkParenthesesPair:()=>hf,checkModuleExistsSerializer:()=>yE,builtInType:()=>L1,buildDiagMessage:()=>Z6,booleanType:()=>Q3,benchmarkParserPipeline:()=>Qf,attachMetaToCheckResult:()=>ZX,attachLocationToDiagnostics:()=>BY,assignable:()=>x4,assignBaseFQNameToMembers:()=>Yv,asDiag:()=>tq0,applyClosure:()=>$v,anyType:()=>n0,analyzeTokenFrequencies:()=>AG0,analyzeAndPrintProjectStats:()=>uG0,allocate:()=>Kv,addMethod:()=>zv,accessElementVtable:()=>AQ,Vtable:()=>kY,VirtualPath:()=>w0,VfsPathSerializer:()=>ZE,VfsPathDeserializer:()=>NE,Vfs:()=>PH,ValueSerializer:()=>$6,ValueKind:()=>B0,ValueDeserializer:()=>K6,UnresolvedLocationDiagnostic:()=>l,TypecheckResultKind:()=>vH,TypecheckModuleResult:()=>hY,TypecheckFileResult:()=>X8,TypeParameter:()=>y5,TypeKind:()=>t,TokenFlags:()=>m5,TemplateString:()=>a1,SyntaxTokenKind:()=>w,SyntaxToken:()=>l1,SyntaxNodeKind:()=>Y0,SyntaxNodeIdSerializer:()=>KE,SyntaxNodeIdDeserializer:()=>mE,SyntaxNodeId:()=>UZ,SymbolSerializer:()=>WE,SymbolDeserializer:()=>RE,SuggestionKindMap:()=>sU,SuggestionKind:()=>$3,Service:()=>zk,SerializedEngine:()=>HG,ReturnTypeNode:()=>x6,Queue:()=>dH,QueryRunKind:()=>l2,QueryError:()=>v,Program:()=>$X,PrimitiveTypeKind:()=>I0,PrimaryExpression:()=>c1,PrettyPrinter:()=>rY,PrefixExpression:()=>B4,PostfixExpression:()=>v3,ParsingError:()=>Z3,ParseModuleResult:()=>tH,ParseFileResult:()=>rH,Ok:()=>X3,ObjVtable:()=>cY,NodeSymbolId:()=>S8,NodeSymbol:()=>H0,NodeIdKind:()=>aH,NodeFlags:()=>t7,NODE_ID_BITS:()=>nH,ModuleTable:()=>k5,ModuleSymbolId:()=>TY,ModuleSymbol:()=>q4,MEMORY_CLEARED:()=>EQ,LiteralElementExpression:()=>C0,ListExpression:()=>M4,JsFuncVtable:()=>CQ,JsFunc:()=>E0,InterpretModuleResult:()=>JA,InterpretFileResult:()=>b7,InfixExpression:()=>k0,ImportModule:()=>u5,ImportDeclaration:()=>A3,ImportBody:()=>s6,IfExpression:()=>K3,Identifier:()=>Z0,HeredocVtable:()=>GY,HeredocData:()=>bY,Heredoc:()=>y2,GroupExpression:()=>z3,GnodeIdSerializer:()=>xE,GeneratedSymbolId:()=>R8,GNodeSerializer:()=>QE,GNodeIdDeserializer:()=>jE,GNodeDeserializer:()=>_E,FuncData:()=>mH,EvalResult:()=>U1,Err:()=>T2,EqualityDeclaration:()=>S1,EnvData:()=>SH,Env:()=>A5,EncounteredOuterContextTokenError:()=>pQ,EmbeddedExpression:()=>q3,ElementDeclaration:()=>_0,EarlyResolvedTable:()=>s2,DiagnosticWithLocation:()=>M1,DiagnosticSerializer:()=>YE,DiagnosticDeserializer:()=>CE,DiagnosticCategory:()=>g1,Diagnostic:()=>e1,DiagOk:()=>d,DiagMessages:()=>k,DiagErr:()=>r,Decorator:()=>q6,DEFAULT_CUSTOM_QUERY_ALLOW_LIST:()=>GH0,CustomQueryLog:()=>yQ,CustomHookStrategy:()=>Y3,CompoundSymbol:()=>YZ,Callable:()=>tQ,CallExpression:()=>I1,BlockExpression:()=>K2,Block:()=>S0,BindingData:()=>RH,Binding:()=>V2,AstTable:()=>J8,Ast:()=>v1,ArgumentList:()=>k2,ArgumentExpression:()=>O4,AmlVoidVtable:()=>UY,AmlVoid:()=>a8,AmlValueSerializer:()=>UE,AmlValueDeserializer:()=>TE,AmlUndefinedVtable:()=>HY,AmlUndefined:()=>M2,AmlSymbolKind:()=>p,AmlSymbol:()=>nQ,AmlStringVtable:()=>A7,AmlString:()=>h0,AmlRuntimeError:()=>H4,AmlProxy:()=>o1,AmlObjectVtable:()=>o2,AmlObject:()=>g0,AmlNumberVtable:()=>e3,AmlNumber:()=>h4,AmlModuleIdSerializer:()=>ME,AmlModuleIdDeserializer:()=>fE,AmlModuleId:()=>PZ,AmlModule:()=>p7,AmlList:()=>C4,AmlHeredoc:()=>zZ,AmlFuncVtable:()=>LQ,AmlFunc:()=>OH,AmlFqnObjectSerializer:()=>GE,AmlFqnObjectDeserializer:()=>AE,AmlDynamicPropDict:()=>v5,AmlBooleanVtable:()=>f6,AmlBoolean:()=>R1,AmlAccessExpressionObject:()=>CH,AccessModifier:()=>o7,AbstractSyntaxNode:()=>d1});var n8={globalModuleName:"::",languageExtension:"aml"};class w0{constructor(Z){this.path=Z,this.key=this.path}static create(Z){return Z.startsWith("/")?new w0(Z):new w0(`/${Z}`)}asInternKey(Z,J){return this.program===J.program&&this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internPath(this),this.idVerifiedAt=Z.revision,this.program=J.program,this.id)}toString(){return this.path}equals(Z){return this.path===Z.path}nameAndExtension(){let Z=this.path.toString().split("/").pop().split(".");if(Z.length>2){let J=Z.pop();return[Z.join("."),J]}return[Z[0],Z[1]]}isAmlFile(){let[,Z]=this.nameAndExtension();return Z===n8.languageExtension}getParentDir(){let Z=this.path.toString().split("/").filter((Q)=>Q);if(!Z.length)return;Z.pop();let J=Z.join("/");return w0.create(J)}isInternalDecoratorPath(){return this.path.startsWith("/__decorator")}isInternalJsFuncPath(){return this.path.startsWith("/__jsfunc")}}import f7 from"fs";import wQ from"path";var __dirname="/home/circleci/holistics/node_modules/.pnpm/@holistics+aml@7.3.7/node_modules/@holistics/aml/dist";var oI="7.3.7",sI=typeof global=="object"&&global&&global.Object===Object&&global,AZ0=typeof self=="object"&&self&&self.Object===Object&&self,X6=sI||AZ0||Function("return this")(),Q8=X6.Symbol,nI=Object.prototype,EZ0=nI.hasOwnProperty,fZ0=nI.toString,HQ=Q8?Q8.toStringTag:void 0;function kZ0(Z){var J=EZ0.call(Z,HQ),Q=Z[HQ];try{Z[HQ]=void 0;var X=!0}catch{}var x=fZ0.call(Z);return X&&(J?Z[HQ]=Q:delete Z[HQ]),x}var cZ0=Object.prototype,bZ0=cZ0.toString;function pZ0(Z){return bZ0.call(Z)}var yZ0="[object Null]",uZ0="[object Undefined]",vR=Q8?Q8.toStringTag:void 0;function MZ(Z){return Z==null?Z===void 0?uZ0:yZ0:vR&&(vR in Object(Z))?kZ0(Z):pZ0(Z)}function S5(Z){return Z!=null&&typeof Z=="object"}var hZ0="[object Symbol]";function QH(Z){return typeof Z=="symbol"||S5(Z)&&MZ(Z)==hZ0}function aI(Z,J){for(var Q=-1,X=Z==null?0:Z.length,x=Array(X);++Q<X;)x[Q]=J(Z[Q],Q,Z);return x}var R3=Array.isArray,AR=Q8?Q8.prototype:void 0,ER=AR?AR.toString:void 0;function rI(Z){if(typeof Z=="string")return Z;if(R3(Z))return aI(Z,rI)+"";if(QH(Z))return ER?ER.call(Z):"";var J=Z+"";return J=="0"&&1/Z==-1/0?"-0":J}function DZ(Z){var J=typeof Z;return Z!=null&&(J=="object"||J=="function")}function tI(Z){return Z}var gZ0="[object AsyncFunction]",iZ0="[object Function]",dZ0="[object GeneratorFunction]",lZ0="[object Proxy]";function eI(Z){if(!DZ(Z))return!1;var J=MZ(Z);return J==iZ0||J==dZ0||J==gZ0||J==lZ0}var VU=X6["__core-js_shared__"],fR=function(){var Z=/[^.]+$/.exec(VU&&VU.keys&&VU.keys.IE_PROTO||"");return Z?"Symbol(src)_1."+Z:""}();function oZ0(Z){return!!fR&&fR in Z}var sZ0=Function.prototype,nZ0=sZ0.toString;function i7(Z){if(Z!=null){try{return nZ0.call(Z)}catch{}try{return Z+""}catch{}}return""}var aZ0=/[\\^$.*+?()[\]{}|]/g,rZ0=/^\[object .+?Constructor\]$/,tZ0=Function.prototype,eZ0=Object.prototype,ZJ0=tZ0.toString,JJ0=eZ0.hasOwnProperty,QJ0=RegExp("^"+ZJ0.call(JJ0).replace(aZ0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function XJ0(Z){if(!DZ(Z)||oZ0(Z))return!1;var J=eI(Z)?QJ0:rZ0;return J.test(i7(Z))}function xJ0(Z,J){return Z==null?void 0:Z[J]}function d7(Z,J){var Q=xJ0(Z,J);return XJ0(Q)?Q:void 0}var OU=d7(X6,"WeakMap"),kR=Object.create,qJ0=function(){function Z(){}return function(J){if(!DZ(J))return{};if(kR)return kR(J);Z.prototype=J;var Q=new Z;return Z.prototype=void 0,Q}}();function YJ0(){}function $J0(Z,J){var Q=-1,X=Z.length;for(J||(J=Array(X));++Q<X;)J[Q]=Z[Q];return J}var cR=function(){try{var Z=d7(Object,"defineProperty");return Z({},"",{}),Z}catch{}}();function ZT(Z,J){for(var Q=-1,X=Z==null?0:Z.length;++Q<X&&J(Z[Q],Q,Z)!==!1;);return Z}function KJ0(Z,J,Q,X){for(var x=Z.length,q=Q+-1;++q<x;)if(J(Z[q],q,Z))return q;return-1}function zJ0(Z){return Z!==Z}function WJ0(Z,J,Q){for(var X=Q-1,x=Z.length;++X<x;)if(Z[X]===J)return X;return-1}function VJ0(Z,J,Q){return J===J?WJ0(Z,J,Q):KJ0(Z,zJ0,Q)}function UJ0(Z,J){var Q=Z==null?0:Z.length;return!!Q&&VJ0(Z,J,0)>-1}var HJ0=9007199254740991,GJ0=/^(?:0|[1-9]\d*)$/;function JT(Z,J){var Q=typeof Z;return J=J??HJ0,!!J&&(Q=="number"||Q!="symbol"&&GJ0.test(Z))&&Z>-1&&Z%1==0&&Z<J}function QT(Z,J,Q){J=="__proto__"&&cR?cR(Z,J,{configurable:!0,enumerable:!0,value:Q,writable:!0}):Z[J]=Q}function XH(Z,J){return Z===J||Z!==Z&&J!==J}var BJ0=Object.prototype,MJ0=BJ0.hasOwnProperty;function XT(Z,J,Q){var X=Z[J];(!(MJ0.call(Z,J)&&XH(X,Q))||Q===void 0&&!(J in Z))&&QT(Z,J,Q)}function CY(Z,J,Q,X){var x=!Q;Q||(Q={});for(var q=-1,Y=J.length;++q<Y;){var $=J[q],z=void 0;z===void 0&&(z=Z[$]),x?QT(Q,$,z):XT(Q,$,z)}return Q}var DJ0=9007199254740991;function xH(Z){return typeof Z=="number"&&Z>-1&&Z%1==0&&Z<=DJ0}function OY(Z){return Z!=null&&xH(Z.length)&&!eI(Z)}var FJ0=Object.prototype;function qH(Z){var J=Z&&Z.constructor,Q=typeof J=="function"&&J.prototype||FJ0;return Z===Q}function NJ0(Z,J){for(var Q=-1,X=Array(Z);++Q<Z;)X[Q]=J(Q);return X}var wJ0="[object Arguments]";function bR(Z){return S5(Z)&&MZ(Z)==wJ0}var xT=Object.prototype,_J0=xT.hasOwnProperty,PJ0=xT.propertyIsEnumerable,YH=bR(function(){return arguments}())?bR:function(Z){return S5(Z)&&_J0.call(Z,"callee")&&!PJ0.call(Z,"callee")};function jJ0(){return!1}var qT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,pR=qT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,LJ0=pR&&pR.exports===qT,yR=LJ0?X6.Buffer:void 0,CJ0=yR?yR.isBuffer:void 0,zY=CJ0||jJ0,OJ0="[object Arguments]",mJ0="[object Array]",SJ0="[object Boolean]",RJ0="[object Date]",IJ0="[object Error]",TJ0="[object Function]",vJ0="[object Map]",AJ0="[object Number]",EJ0="[object Object]",fJ0="[object RegExp]",kJ0="[object Set]",cJ0="[object String]",bJ0="[object WeakMap]",pJ0="[object ArrayBuffer]",yJ0="[object DataView]",uJ0="[object Float32Array]",hJ0="[object Float64Array]",gJ0="[object Int8Array]",iJ0="[object Int16Array]",dJ0="[object Int32Array]",lJ0="[object Uint8Array]",oJ0="[object Uint8ClampedArray]",sJ0="[object Uint16Array]",nJ0="[object Uint32Array]",$2={};$2[uJ0]=$2[hJ0]=$2[gJ0]=$2[iJ0]=$2[dJ0]=$2[lJ0]=$2[oJ0]=$2[sJ0]=$2[nJ0]=!0;$2[OJ0]=$2[mJ0]=$2[pJ0]=$2[SJ0]=$2[yJ0]=$2[RJ0]=$2[IJ0]=$2[TJ0]=$2[vJ0]=$2[AJ0]=$2[EJ0]=$2[fJ0]=$2[kJ0]=$2[cJ0]=$2[bJ0]=!1;function aJ0(Z){return S5(Z)&&xH(Z.length)&&!!$2[MZ(Z)]}function $H(Z){return function(J){return Z(J)}}var YT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,_Q=YT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,rJ0=_Q&&_Q.exports===YT,UU=rJ0&&sI.process,qZ=function(){try{var Z=_Q&&_Q.require&&_Q.require("util").types;return Z||UU&&UU.binding&&UU.binding("util")}catch{}}(),uR=qZ&&qZ.isTypedArray,$T=uR?$H(uR):aJ0,tJ0=Object.prototype,eJ0=tJ0.hasOwnProperty;function KT(Z,J){var Q=R3(Z),X=!Q&&YH(Z),x=!Q&&!X&&zY(Z),q=!Q&&!X&&!x&&$T(Z),Y=Q||X||x||q,$=Y?NJ0(Z.length,String):[],z=$.length;for(var W in Z)(J||eJ0.call(Z,W))&&!(Y&&(W=="length"||x&&(W=="offset"||W=="parent")||q&&(W=="buffer"||W=="byteLength"||W=="byteOffset")||JT(W,z)))&&$.push(W);return $}function zT(Z,J){return function(Q){return Z(J(Q))}}var ZQ0=zT(Object.keys,Object),JQ0=Object.prototype,QQ0=JQ0.hasOwnProperty;function XQ0(Z){if(!qH(Z))return ZQ0(Z);var J=[];for(var Q in Object(Z))QQ0.call(Z,Q)&&Q!="constructor"&&J.push(Q);return J}function sQ(Z){return OY(Z)?KT(Z):XQ0(Z)}function xQ0(Z){var J=[];if(Z!=null)for(var Q in Object(Z))J.push(Q);return J}var qQ0=Object.prototype,YQ0=qQ0.hasOwnProperty;function $Q0(Z){if(!DZ(Z))return xQ0(Z);var J=qH(Z),Q=[];for(var X in Z)X=="constructor"&&(J||!YQ0.call(Z,X))||Q.push(X);return Q}function KH(Z){return OY(Z)?KT(Z,!0):$Q0(Z)}var KQ0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zQ0=/^\w*$/;function zH(Z,J){if(R3(Z))return!1;var Q=typeof Z;return Q=="number"||Q=="symbol"||Q=="boolean"||Z==null||QH(Z)?!0:zQ0.test(Z)||!KQ0.test(Z)||J!=null&&(Z in Object(J))}var OQ=d7(Object,"create");function WQ0(){this.__data__=OQ?OQ(null):{},this.size=0}function VQ0(Z){var J=this.has(Z)&&delete this.__data__[Z];return this.size-=J?1:0,J}var UQ0="__lodash_hash_undefined__",HQ0=Object.prototype,GQ0=HQ0.hasOwnProperty;function BQ0(Z){var J=this.__data__;if(OQ){var Q=J[Z];return Q===UQ0?void 0:Q}return GQ0.call(J,Z)?J[Z]:void 0}var MQ0=Object.prototype,DQ0=MQ0.hasOwnProperty;function FQ0(Z){var J=this.__data__;return OQ?J[Z]!==void 0:DQ0.call(J,Z)}var NQ0="__lodash_hash_undefined__";function wQ0(Z,J){var Q=this.__data__;return this.size+=this.has(Z)?0:1,Q[Z]=OQ&&J===void 0?NQ0:J,this}function c7(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}c7.prototype.clear=WQ0;c7.prototype.delete=VQ0;c7.prototype.get=BQ0;c7.prototype.has=FQ0;c7.prototype.set=wQ0;function _Q0(){this.__data__=[],this.size=0}function mY(Z,J){for(var Q=Z.length;Q--;)if(XH(Z[Q][0],J))return Q;return-1}var PQ0=Array.prototype,jQ0=PQ0.splice;function LQ0(Z){var J=this.__data__,Q=mY(J,Z);if(Q<0)return!1;var X=J.length-1;return Q==X?J.pop():jQ0.call(J,Q,1),--this.size,!0}function CQ0(Z){var J=this.__data__,Q=mY(J,Z);return Q<0?void 0:J[Q][1]}function OQ0(Z){return mY(this.__data__,Z)>-1}function mQ0(Z,J){var Q=this.__data__,X=mY(Q,Z);return X<0?(++this.size,Q.push([Z,J])):Q[X][1]=J,this}function g6(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}g6.prototype.clear=_Q0;g6.prototype.delete=LQ0;g6.prototype.get=CQ0;g6.prototype.has=OQ0;g6.prototype.set=mQ0;var mQ=d7(X6,"Map");function SQ0(){this.size=0,this.__data__={hash:new c7,map:new(mQ||g6),string:new c7}}function RQ0(Z){var J=typeof Z;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?Z!=="__proto__":Z===null}function SY(Z,J){var Q=Z.__data__;return RQ0(J)?Q[typeof J=="string"?"string":"hash"]:Q.map}function IQ0(Z){var J=SY(this,Z).delete(Z);return this.size-=J?1:0,J}function TQ0(Z){return SY(this,Z).get(Z)}function vQ0(Z){return SY(this,Z).has(Z)}function AQ0(Z,J){var Q=SY(this,Z),X=Q.size;return Q.set(Z,J),this.size+=Q.size==X?0:1,this}function i6(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}i6.prototype.clear=SQ0;i6.prototype.delete=IQ0;i6.prototype.get=TQ0;i6.prototype.has=vQ0;i6.prototype.set=AQ0;var EQ0="Expected a function";function WH(Z,J){if(typeof Z!="function"||J!=null&&typeof J!="function")throw new TypeError(EQ0);var Q=function(){var X=arguments,x=J?J.apply(this,X):X[0],q=Q.cache;if(q.has(x))return q.get(x);var Y=Z.apply(this,X);return Q.cache=q.set(x,Y)||q,Y};return Q.cache=new(WH.Cache||i6),Q}WH.Cache=i6;var fQ0=500;function kQ0(Z){var J=WH(Z,function(X){return Q.size===fQ0&&Q.clear(),X}),Q=J.cache;return J}var cQ0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bQ0=/\\(\\)?/g,pQ0=kQ0(function(Z){var J=[];return Z.charCodeAt(0)===46&&J.push(""),Z.replace(cQ0,function(Q,X,x,q){J.push(x?q.replace(bQ0,"$1"):X||Q)}),J});function WT(Z){return Z==null?"":rI(Z)}function VT(Z,J){return R3(Z)?Z:zH(Z,J)?[Z]:pQ0(WT(Z))}function RY(Z){if(typeof Z=="string"||QH(Z))return Z;var J=Z+"";return J=="0"&&1/Z==-1/0?"-0":J}function UT(Z,J){J=VT(J,Z);for(var Q=0,X=J.length;Z!=null&&Q<X;)Z=Z[RY(J[Q++])];return Q&&Q==X?Z:void 0}function yQ0(Z,J,Q){var X=Z==null?void 0:UT(Z,J);return X===void 0?Q:X}function VH(Z,J){for(var Q=-1,X=J.length,x=Z.length;++Q<X;)Z[x+Q]=J[Q];return Z}var hR=Q8?Q8.isConcatSpreadable:void 0;function uQ0(Z){return R3(Z)||YH(Z)||!!(hR&&Z&&Z[hR])}function IY(Z,J,Q,X,x){var q=-1,Y=Z.length;for(Q||(Q=uQ0),x||(x=[]);++q<Y;){var $=Z[q];J>0&&Q($)?J>1?IY($,J-1,Q,X,x):VH(x,$):x[x.length]=$}return x}function HT(Z){var J=Z==null?0:Z.length;return J?IY(Z,1):[]}var GT=zT(Object.getPrototypeOf,Object);function hQ0(Z,J,Q){var X=-1,x=Z.length;J<0&&(J=-J>x?0:x+J),Q=Q>x?x:Q,Q<0&&(Q+=x),x=J>Q?0:Q-J>>>0,J>>>=0;for(var q=Array(x);++X<x;)q[X]=Z[X+J];return q}function gQ0(Z,J,Q){var X=Z.length;return Q=Q===void 0?X:Q,!J&&Q>=X?Z:hQ0(Z,J,Q)}var iQ0="\\ud800-\\udfff",dQ0="\\u0300-\\u036f",lQ0="\\ufe20-\\ufe2f",oQ0="\\u20d0-\\u20ff",sQ0=dQ0+lQ0+oQ0,nQ0="\\ufe0e\\ufe0f",aQ0="\\u200d",rQ0=RegExp("["+aQ0+iQ0+sQ0+nQ0+"]");function BT(Z){return rQ0.test(Z)}function tQ0(Z){return Z.split("")}var MT="\\ud800-\\udfff",eQ0="\\u0300-\\u036f",ZX0="\\ufe20-\\ufe2f",JX0="\\u20d0-\\u20ff",QX0=eQ0+ZX0+JX0,XX0="\\ufe0e\\ufe0f",xX0="["+MT+"]",mU="["+QX0+"]",SU="\\ud83c[\\udffb-\\udfff]",qX0="(?:"+mU+"|"+SU+")",DT="[^"+MT+"]",FT="(?:\\ud83c[\\udde6-\\uddff]){2}",NT="[\\ud800-\\udbff][\\udc00-\\udfff]",YX0="\\u200d",wT=qX0+"?",_T="["+XX0+"]?",$X0="(?:"+YX0+"(?:"+[DT,FT,NT].join("|")+")"+_T+wT+")*",KX0=_T+wT+$X0,zX0="(?:"+[DT+mU+"?",mU,FT,NT,xX0].join("|")+")",WX0=RegExp(SU+"(?="+SU+")|"+zX0+KX0,"g");function VX0(Z){return Z.match(WX0)||[]}function UX0(Z){return BT(Z)?VX0(Z):tQ0(Z)}function HX0(Z){return function(J){J=WT(J);var Q=BT(J)?UX0(J):void 0,X=Q?Q[0]:J.charAt(0),x=Q?gQ0(Q,1).join(""):J.slice(1);return X[Z]()+x}}var QZ=HX0("toUpperCase");function GX0(){this.__data__=new g6,this.size=0}function BX0(Z){var J=this.__data__,Q=J.delete(Z);return this.size=J.size,Q}function MX0(Z){return this.__data__.get(Z)}function DX0(Z){return this.__data__.has(Z)}var FX0=200;function NX0(Z,J){var Q=this.__data__;if(Q instanceof g6){var X=Q.__data__;if(!mQ||X.length<FX0-1)return X.push([Z,J]),this.size=++Q.size,this;Q=this.__data__=new i6(X)}return Q.set(Z,J),this.size=Q.size,this}function r8(Z){var J=this.__data__=new g6(Z);this.size=J.size}r8.prototype.clear=GX0;r8.prototype.delete=BX0;r8.prototype.get=MX0;r8.prototype.has=DX0;r8.prototype.set=NX0;function wX0(Z,J){return Z&&CY(J,sQ(J),Z)}function _X0(Z,J){return Z&&CY(J,KH(J),Z)}var PT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,gR=PT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,PX0=gR&&gR.exports===PT,iR=PX0?X6.Buffer:void 0,dR=iR?iR.allocUnsafe:void 0;function jX0(Z,J){if(J)return Z.slice();var Q=Z.length,X=dR?dR(Q):new Z.constructor(Q);return Z.copy(X),X}function LX0(Z,J){for(var Q=-1,X=Z==null?0:Z.length,x=0,q=[];++Q<X;){var Y=Z[Q];J(Y,Q,Z)&&(q[x++]=Y)}return q}function jT(){return[]}var CX0=Object.prototype,OX0=CX0.propertyIsEnumerable,lR=Object.getOwnPropertySymbols,UH=lR?function(Z){return Z==null?[]:(Z=Object(Z),LX0(lR(Z),function(J){return OX0.call(Z,J)}))}:jT;function mX0(Z,J){return CY(Z,UH(Z),J)}var SX0=Object.getOwnPropertySymbols,LT=SX0?function(Z){for(var J=[];Z;)VH(J,UH(Z)),Z=GT(Z);return J}:jT;function RX0(Z,J){return CY(Z,LT(Z),J)}function CT(Z,J,Q){var X=J(Z);return R3(Z)?X:VH(X,Q(Z))}function RU(Z){return CT(Z,sQ,UH)}function IX0(Z){return CT(Z,KH,LT)}var IU=d7(X6,"DataView"),TU=d7(X6,"Promise"),XZ=d7(X6,"Set"),oR="[object Map]",TX0="[object Object]",sR="[object Promise]",nR="[object Set]",aR="[object WeakMap]",rR="[object DataView]",vX0=i7(IU),AX0=i7(mQ),EX0=i7(TU),fX0=i7(XZ),kX0=i7(OU),m8=MZ;(IU&&m8(new IU(new ArrayBuffer(1)))!=rR||mQ&&m8(new mQ)!=oR||TU&&m8(TU.resolve())!=sR||XZ&&m8(new XZ)!=nR||OU&&m8(new OU)!=aR)&&(m8=function(Z){var J=MZ(Z),Q=J==TX0?Z.constructor:void 0,X=Q?i7(Q):"";if(X)switch(X){case vX0:return rR;case AX0:return oR;case EX0:return sR;case fX0:return nR;case kX0:return aR}return J});var cX0=Object.prototype,bX0=cX0.hasOwnProperty;function pX0(Z){var J=Z.length,Q=new Z.constructor(J);return J&&typeof Z[0]=="string"&&bX0.call(Z,"index")&&(Q.index=Z.index,Q.input=Z.input),Q}var WY=X6.Uint8Array;function HH(Z){var J=new Z.constructor(Z.byteLength);return new WY(J).set(new WY(Z)),J}function yX0(Z,J){var Q=J?HH(Z.buffer):Z.buffer;return new Z.constructor(Q,Z.byteOffset,Z.byteLength)}var uX0=/\w*$/;function hX0(Z){var J=new Z.constructor(Z.source,uX0.exec(Z));return J.lastIndex=Z.lastIndex,J}var tR=Q8?Q8.prototype:void 0,eR=tR?tR.valueOf:void 0;function gX0(Z){return eR?Object(eR.call(Z)):{}}function iX0(Z,J){var Q=J?HH(Z.buffer):Z.buffer;return new Z.constructor(Q,Z.byteOffset,Z.length)}var dX0="[object Boolean]",lX0="[object Date]",oX0="[object Map]",sX0="[object Number]",nX0="[object RegExp]",aX0="[object Set]",rX0="[object String]",tX0="[object Symbol]",eX0="[object ArrayBuffer]",Zx0="[object DataView]",Jx0="[object Float32Array]",Qx0="[object Float64Array]",Xx0="[object Int8Array]",xx0="[object Int16Array]",qx0="[object Int32Array]",Yx0="[object Uint8Array]",$x0="[object Uint8ClampedArray]",Kx0="[object Uint16Array]",zx0="[object Uint32Array]";function Wx0(Z,J,Q){var X=Z.constructor;switch(J){case eX0:return HH(Z);case dX0:case lX0:return new X(+Z);case Zx0:return yX0(Z,Q);case Jx0:case Qx0:case Xx0:case xx0:case qx0:case Yx0:case $x0:case Kx0:case zx0:return iX0(Z,Q);case oX0:return new X;case sX0:case rX0:return new X(Z);case nX0:return hX0(Z);case aX0:return new X;case tX0:return gX0(Z)}}function Vx0(Z){return typeof Z.constructor=="function"&&!qH(Z)?qJ0(GT(Z)):{}}var Ux0="[object Map]";function Hx0(Z){return S5(Z)&&m8(Z)==Ux0}var ZI=qZ&&qZ.isMap,Gx0=ZI?$H(ZI):Hx0,Bx0="[object Set]";function Mx0(Z){return S5(Z)&&m8(Z)==Bx0}var JI=qZ&&qZ.isSet,Dx0=JI?$H(JI):Mx0,Fx0=1,Nx0=2,wx0=4,OT="[object Arguments]",_x0="[object Array]",Px0="[object Boolean]",jx0="[object Date]",Lx0="[object Error]",mT="[object Function]",Cx0="[object GeneratorFunction]",Ox0="[object Map]",mx0="[object Number]",ST="[object Object]",Sx0="[object RegExp]",Rx0="[object Set]",Ix0="[object String]",Tx0="[object Symbol]",vx0="[object WeakMap]",Ax0="[object ArrayBuffer]",Ex0="[object DataView]",fx0="[object Float32Array]",kx0="[object Float64Array]",cx0="[object Int8Array]",bx0="[object Int16Array]",px0="[object Int32Array]",yx0="[object Uint8Array]",ux0="[object Uint8ClampedArray]",hx0="[object Uint16Array]",gx0="[object Uint32Array]",t1={};t1[OT]=t1[_x0]=t1[Ax0]=t1[Ex0]=t1[Px0]=t1[jx0]=t1[fx0]=t1[kx0]=t1[cx0]=t1[bx0]=t1[px0]=t1[Ox0]=t1[mx0]=t1[ST]=t1[Sx0]=t1[Rx0]=t1[Ix0]=t1[Tx0]=t1[yx0]=t1[ux0]=t1[hx0]=t1[gx0]=!0;t1[Lx0]=t1[mT]=t1[vx0]=!1;function PQ(Z,J,Q,X,x,q){var Y,$=J&Fx0,z=J&Nx0,W=J&wx0;if(Y!==void 0)return Y;if(!DZ(Z))return Z;var U=R3(Z);if(U){if(Y=pX0(Z),!$)return $J0(Z,Y)}else{var H=m8(Z),B=H==mT||H==Cx0;if(zY(Z))return jX0(Z,$);if(H==ST||H==OT||B&&!x){if(Y=z||B?{}:Vx0(Z),!$)return z?RX0(Z,_X0(Y,Z)):mX0(Z,wX0(Y,Z))}else{if(!t1[H])return x?Z:{};Y=Wx0(Z,H,$)}}q||(q=new r8);var M=q.get(Z);if(M)return M;q.set(Z,Y),Dx0(Z)?Z.forEach(function(_){Y.add(PQ(_,J,Q,_,Z,q))}):Gx0(Z)&&Z.forEach(function(_,j){Y.set(j,PQ(_,J,Q,j,Z,q))});var D=W?z?IX0:RU:z?KH:sQ,N=U?void 0:D(Z);return ZT(N||Z,function(_,j){N&&(j=_,_=Z[j]),XT(Y,j,PQ(_,J,Q,j,Z,q))}),Y}var ix0=4;function l7(Z){return PQ(Z,ix0)}var dx0=1,lx0=4;function ox0(Z){return PQ(Z,dx0|lx0)}function GH(Z){for(var J=-1,Q=Z==null?0:Z.length,X=0,x=[];++J<Q;){var q=Z[J];q&&(x[X++]=q)}return x}var sx0="__lodash_hash_undefined__";function nx0(Z){return this.__data__.set(Z,sx0),this}function ax0(Z){return this.__data__.has(Z)}function SQ(Z){var J=-1,Q=Z==null?0:Z.length;for(this.__data__=new i6;++J<Q;)this.add(Z[J])}SQ.prototype.add=SQ.prototype.push=nx0;SQ.prototype.has=ax0;function rx0(Z,J){for(var Q=-1,X=Z==null?0:Z.length;++Q<X;)if(J(Z[Q],Q,Z))return!0;return!1}function RT(Z,J){return Z.has(J)}var tx0=1,ex0=2;function IT(Z,J,Q,X,x,q){var Y=Q&tx0,$=Z.length,z=J.length;if($!=z&&!(Y&&z>$))return!1;var W=q.get(Z),U=q.get(J);if(W&&U)return W==J&&U==Z;var H=-1,B=!0,M=Q&ex0?new SQ:void 0;for(q.set(Z,J),q.set(J,Z);++H<$;){var D=Z[H],N=J[H];if(X)var _=Y?X(N,D,H,J,Z,q):X(D,N,H,Z,J,q);if(_!==void 0){if(_)continue;B=!1;break}if(M){if(!rx0(J,function(j,O){if(!RT(M,O)&&(D===j||x(D,j,Q,X,q)))return M.push(O)})){B=!1;break}}else if(!(D===N||x(D,N,Q,X,q))){B=!1;break}}return q.delete(Z),q.delete(J),B}function Zq0(Z){var J=-1,Q=Array(Z.size);return Z.forEach(function(X,x){Q[++J]=[x,X]}),Q}function BH(Z){var J=-1,Q=Array(Z.size);return Z.forEach(function(X){Q[++J]=X}),Q}var Jq0=1,Qq0=2,Xq0="[object Boolean]",xq0="[object Date]",qq0="[object Error]",Yq0="[object Map]",$q0="[object Number]",Kq0="[object RegExp]",zq0="[object Set]",Wq0="[object String]",Vq0="[object Symbol]",Uq0="[object ArrayBuffer]",Hq0="[object DataView]",QI=Q8?Q8.prototype:void 0,HU=QI?QI.valueOf:void 0;function Gq0(Z,J,Q,X,x,q,Y){switch(Q){case Hq0:if(Z.byteLength!=J.byteLength||Z.byteOffset!=J.byteOffset)return!1;Z=Z.buffer,J=J.buffer;case Uq0:return!(Z.byteLength!=J.byteLength||!q(new WY(Z),new WY(J)));case Xq0:case xq0:case $q0:return XH(+Z,+J);case qq0:return Z.name==J.name&&Z.message==J.message;case Kq0:case Wq0:return Z==J+"";case Yq0:var $=Zq0;case zq0:var z=X&Jq0;if($||($=BH),Z.size!=J.size&&!z)return!1;var W=Y.get(Z);if(W)return W==J;X|=Qq0,Y.set(Z,J);var U=IT($(Z),$(J),X,x,q,Y);return Y.delete(Z),U;case Vq0:if(HU)return HU.call(Z)==HU.call(J)}return!1}var Bq0=1,Mq0=Object.prototype,Dq0=Mq0.hasOwnProperty;function Fq0(Z,J,Q,X,x,q){var Y=Q&Bq0,$=RU(Z),z=$.length,W=RU(J),U=W.length;if(z!=U&&!Y)return!1;for(var H=z;H--;){var B=$[H];if(!(Y?B in J:Dq0.call(J,B)))return!1}var M=q.get(Z),D=q.get(J);if(M&&D)return M==J&&D==Z;var N=!0;q.set(Z,J),q.set(J,Z);for(var _=Y;++H<z;){B=$[H];var j=Z[B],O=J[B];if(X)var A=Y?X(O,j,B,J,Z,q):X(j,O,B,Z,J,q);if(!(A===void 0?j===O||x(j,O,Q,X,q):A)){N=!1;break}_||(_=B=="constructor")}if(N&&!_){var h=Z.constructor,u=J.constructor;h!=u&&"constructor"in Z&&"constructor"in J&&!(typeof h=="function"&&h instanceof h&&typeof u=="function"&&u instanceof u)&&(N=!1)}return q.delete(Z),q.delete(J),N}var Nq0=1,XI="[object Arguments]",xI="[object Array]",JY="[object Object]",wq0=Object.prototype,qI=wq0.hasOwnProperty;function _q0(Z,J,Q,X,x,q){var Y=R3(Z),$=R3(J),z=Y?xI:m8(Z),W=$?xI:m8(J);z=z==XI?JY:z,W=W==XI?JY:W;var U=z==JY,H=W==JY,B=z==W;if(B&&zY(Z)){if(!zY(J))return!1;Y=!0,U=!1}if(B&&!U)return q||(q=new r8),Y||$T(Z)?IT(Z,J,Q,X,x,q):Gq0(Z,J,z,Q,X,x,q);if(!(Q&Nq0)){var M=U&&qI.call(Z,"__wrapped__"),D=H&&qI.call(J,"__wrapped__");if(M||D){var N=M?Z.value():Z,_=D?J.value():J;return q||(q=new r8),x(N,_,Q,X,q)}}return B?(q||(q=new r8),Fq0(Z,J,Q,X,x,q)):!1}function MH(Z,J,Q,X,x){return Z===J?!0:Z==null||J==null||!S5(Z)&&!S5(J)?Z!==Z&&J!==J:_q0(Z,J,Q,X,MH,x)}var Pq0=1,jq0=2;function Lq0(Z,J,Q,X){var x=Q.length,q=x;if(Z==null)return!q;for(Z=Object(Z);x--;){var Y=Q[x];if(Y[2]?Y[1]!==Z[Y[0]]:!(Y[0]in Z))return!1}for(;++x<q;){Y=Q[x];var $=Y[0],z=Z[$],W=Y[1];if(Y[2]){if(z===void 0&&!($ in Z))return!1}else{var U=new r8,H;if(!(H===void 0?MH(W,z,Pq0|jq0,X,U):H))return!1}}return!0}function TT(Z){return Z===Z&&!DZ(Z)}function Cq0(Z){for(var J=sQ(Z),Q=J.length;Q--;){var X=J[Q],x=Z[X];J[Q]=[X,x,TT(x)]}return J}function vT(Z,J){return function(Q){return Q==null?!1:Q[Z]===J&&(J!==void 0||(Z in Object(Q)))}}function Oq0(Z){var J=Cq0(Z);return J.length==1&&J[0][2]?vT(J[0][0],J[0][1]):function(Q){return Q===Z||Lq0(Q,Z,J)}}function mq0(Z,J){return Z!=null&&J in Object(Z)}function Sq0(Z,J,Q){J=VT(J,Z);for(var X=-1,x=J.length,q=!1;++X<x;){var Y=RY(J[X]);if(!(q=Z!=null&&Q(Z,Y)))break;Z=Z[Y]}return q||++X!=x?q:(x=Z==null?0:Z.length,!!x&&xH(x)&&JT(Y,x)&&(R3(Z)||YH(Z)))}function Rq0(Z,J){return Z!=null&&Sq0(Z,J,mq0)}var Iq0=1,Tq0=2;function vq0(Z,J){return zH(Z)&&TT(J)?vT(RY(Z),J):function(Q){var X=yQ0(Q,Z);return X===void 0&&X===J?Rq0(Q,Z):MH(J,X,Iq0|Tq0)}}function Aq0(Z){return function(J){return J==null?void 0:J[Z]}}function Eq0(Z){return function(J){return UT(J,Z)}}function fq0(Z){return zH(Z)?Aq0(RY(Z)):Eq0(Z)}function AT(Z){return typeof Z=="function"?Z:Z==null?tI:typeof Z=="object"?R3(Z)?vq0(Z[0],Z[1]):Oq0(Z):fq0(Z)}function kq0(Z){return function(J,Q,X){for(var x=-1,q=Object(J),Y=X(J),$=Y.length;$--;){var z=Y[++x];if(Q(q[z],z,q)===!1)break}return J}}var cq0=kq0();function bq0(Z,J){return Z&&cq0(Z,J,sQ)}function pq0(Z,J){return function(Q,X){if(Q==null)return Q;if(!OY(Q))return Z(Q,X);for(var x=Q.length,q=-1,Y=Object(Q);++q<x&&X(Y[q],q,Y)!==!1;);return Q}}var ET=pq0(bq0);function yq0(Z,J,Q){for(var X=-1,x=Z==null?0:Z.length;++X<x;)if(Q(J,Z[X]))return!0;return!1}function f5(Z){var J=Z==null?0:Z.length;return J?Z[J-1]:void 0}function uq0(Z){return typeof Z=="function"?Z:tI}function hq0(Z,J){var Q=R3(Z)?ZT:ET;return Q(Z,uq0(J))}function gq0(Z,J){var Q=-1,X=OY(Z)?Array(Z.length):[];return ET(Z,function(x,q,Y){X[++Q]=J(x,q,Y)}),X}function iq0(Z,J){var Q=R3(Z)?aI:gq0;return Q(Z,AT(J))}function dq0(Z,J){return IY(iq0(Z,J),1)}var lq0=1/0;function oq0(Z){var J=Z==null?0:Z.length;return J?IY(Z,lq0):[]}var sq0=1/0,nq0=XZ&&1/BH(new XZ([,-0]))[1]==sq0?function(Z){return new XZ(Z)}:YJ0,aq0=200;function DH(Z,J,Q){var X=-1,x=UJ0,q=Z.length,Y=!0,$=[],z=$;if(Q)Y=!1,x=yq0;else if(q>=aq0){var W=J?null:nq0(Z);if(W)return BH(W);Y=!1,x=RT,z=new SQ}else z=J?[]:$;Z:for(;++X<q;){var U=Z[X],H=J?J(U):U;if(U=Q||U!==0?U:0,Y&&H===H){for(var B=z.length;B--;)if(z[B]===H)continue Z;J&&z.push(H),$.push(U)}else x(z,H,Q)||(z!==$&&z.push(H),$.push(U))}return $}function rq0(Z){return Z&&Z.length?DH(Z):[]}function FH(Z,J){return Z&&Z.length?DH(Z,AT(J)):[]}function NH(Z,J){return J=typeof J=="function"?J:void 0,Z&&Z.length?DH(Z,void 0,J):[]}var g1=((Z)=>(Z.Warning="Warning",Z.Error="Error",Z.Suggestion="Suggestion",Z))(g1||{});function tq0(Z){return Z}var k={SyntaxError:{code:1000,category:"Error",message:"'{0}' expected."},WrongArgumentNumber:{code:2000,category:"Error",message:"Expected {0} arguments, but got {1}."},MissingTraitMethod:{code:2001,category:"Error",message:"Method '{0}' is missing on impl but required on trait '{1}'."},DuplicatedName:{code:2002,category:"Error",message:"Duplicated name '{0}'."},NonExistentName:{code:2003,category:"Error",message:"Cannot find name '{0}'."},TakenOptionValue:{code:2004,category:"Error",message:"'{0}' is either a reserved value or already used value."},ExpectedThings:{code:2005,category:"Error",message:"Expected {0}."},ModuleNoMember:{code:2006,category:"Error",message:"Module '{0}' has no item '{1}'"},ExpressionNotCallable:{code:2007,category:"Error",message:"The expression is not callable. Type '{0}' has no call signatures."},UnexpectedArgumentExpression:{code:2008,category:"Error",message:"Unexpected argument expression."},CannotAssignTwiceToImmutableVariable:{code:2009,category:"Error",message:"Cannot assign twice to immutable variable '{0}'"},LhsAssignmentExprMustBeName:{code:2010,category:"Error",message:"The left-hand sign of an assignment expression must be name."},UnexpectedThings:{code:2011,category:"Error",message:"Unexpected {0}."},BlockScopedVariableUsedBeforeDefined:{code:2012,category:"Error",message:"Block-scoped variable '{0}' used before its declaration."},InvalidTypeBody:{code:2013,category:"Error",message:"Invalid type's body."},InvalidTypeProperty:{code:2014,category:"Error",message:"Invalid type's property."},ExpectedOperator:{code:2015,category:"Error",message:"Expected '{0}' operator."},DuplicatedNameInModuleScope:{code:2016,category:"Error",message:"Duplicated name '{0}' ({1})."},InvalidDirectFileInModule:{code:2017,category:"Error",message:"Files reside directly in 'modules' directory is not allowed. Please put them in subdirectories instead."},PositionalArgumentAfterKeywordArgument:{code:2018,category:"Error",message:"Positional arguments should placed before keyword arguments."},PositionalAfterNamedArg:{code:2019,category:"Error",message:"Positional arguments must be placed before named arguments."},InvalidParameterName:{code:2020,category:"Error",message:"No parameter named '{0}' exists in function signature."},DuplicateArgument:{code:2021,category:"Error",message:"Parameter '{0}' is specified multiple times."},MissingRequiredParameter:{code:2022,category:"Error",message:"Required parameter '{0}' is missing."},ExpectedThingsWarning:{code:2023,category:"Warning",message:"Expected {0}."},MismatchedArgumentType:{code:3000,category:"Error",message:"Argument of type '{0}' is not assignable to parameter of type '{1}'."},MismatchedType:{code:3001,category:"Error",message:"Type '{0}' is not assignable to type '{1}'"},NonExistentProperty:{code:3002,category:"Error",message:"Property '{0}' does not exist on type '{1}'."},MissingPropertyOnElement:{code:3003,category:"Error",message:"Property '{0}' is missing on element but required on type '{1}'."},InvalidProperty:{code:3004,category:"Error",message:"Invalid property '{0}'"},PrefixOperatorCannotAppliedForType:{code:3005,category:"Error",message:"Prefix operator '{0}' cannot be applied to type '{1}'."},OperatorCannotAppliedForTypes:{code:3006,category:"Error",message:"Operator '{0}' cannot be applied for type '{1}' and '{2}'"},DuplicatedPropertyOrMethod:{code:3007,category:"Error",message:"Type '{0}' already had '{1}' property or method."},CannotResolveExpressionToType:{code:3008,category:"Error",message:"Cannot resolve this expression to a type."},MismatchElementUnionType:{code:3009,category:"Error",message:"This element does not match with type '{0}'."},MoreThanOneDynamicElement:{code:3010,category:"Error",message:"Can only have one '{0}' dynamic element."},StatementMustBeDeclaredAtTopModule:{code:3011,category:"Error",message:"{0} must be declared at the top of module."},IncompatibleRule:{code:3012,category:"Error",message:"Incompatible rule '{0}.'"},IncompatibleProperty:{code:3013,category:"Error",message:"Incompatible property '{0}'."},ExpectedType:{code:3014,category:"Error",message:"Expected type '{0}', found '{1}'."},MismatchedFunctionReturnType:{code:3015,category:"Error",message:"Mismatch function's return type."},MismatchedRuleValueType:{code:3016,category:"Error",message:"Mismatch rule's value type."},InvalidThings:{code:3017,category:"Error",message:"Invalid {0}."},MissingThings:{code:3018,category:"Error",message:"Missing {0}."},NonExistentType:{code:3019,category:"Error",message:"Cannot find type '{0}'."},RecursiveType:{code:3020,category:"Error",message:"Type '{0}' circularly references itself."},IncompatiblePropertyOfType:{code:3021,category:"Error",message:"Incompatible property '{0}' of '{1}'."},TypeIsUsedAsValue:{code:3022,category:"Error",message:"'{0}' refers to a type, but is being used as a value here"},NonExistentNameInModule:{code:3023,category:"Error",message:"Cannot find name '{0}' in module '{1}'."},UnresolvedModuleExpression:{code:3024,category:"Error",message:"Cannot resolve this expression to module."},ValueIsUsedAsType:{code:3025,category:"Error",message:"'{0}' refers to a value, but is being used as a type here."},NonExistentNameInRootModule:{code:3026,category:"Error",message:"Cannot find name '{0}' in root module."},InvalidOperator:{code:3027,category:"Error",message:"Invalid operator '{0}'."},CustomTypeError:{code:3028,category:"Error",message:"{0}"},CustomTypeWarning:{code:3029,category:"Warning",message:"{0}"},MissingTypeArguments:{code:3030,category:"Error",message:"Type {0} requires {1} type arguments."},GenericTypeNeedTypeArgument:{code:3031,category:"Error",message:"Generic type '{0}' needs {1} type argument(s)."},PartialTypeNonApplicable:{code:3032,category:"Error",message:"Partial cannot be used with '{0}'."},SlotTypeNonApplicable:{code:3033,category:"Error",message:"Slot cannot be used with '{0}'."},NonExistentDecorator:{code:3034,category:"Error",message:"Cannot find decorator '{0}'."},CannotApplyDecorator:{code:3035,category:"Error",message:"Cannot apply decorator '{0}' on '{1}'."},DoubleSpacesInTagName:{code:3036,category:"Error",message:"Double spaces are not allowed in tag name."},LeadingTrailingSpacesInTagName:{code:3037,category:"Error",message:"Leading or trailing spaces are not allowed in tag name."},InvalidSpacingAroundSlashInTagName:{code:3038,category:"Error",message:"Invalid spacing around slash in tag name."},TooManySlashesInTagName:{code:3039,category:"Error",message:"Tag names can contain at most one slash."},InvalidParameterOrder:{code:3040,category:"Error",message:"Required parameters must come before optional parameters."},RuleRequiresRules:{code:3041,category:"Error",message:"Rule '{0}' requires rule(s) {1} to be enabled."},TagNameCannotBeEmpty:{code:3042,category:"Error",message:"Tag name cannot be empty or contain only whitespace."},CannotResolveRef:{code:3043,category:"Warning",message:"This reference cannot be statically verified - manual verification required."},AdhocError:{code:3044,category:"Error",message:"{0}"},ModuleCircularDependencies:{code:4000,category:"Error",message:"Circular dependencies detected at '{0}'."},MissingPropertiesForExtend:{code:4001,category:"Error",message:"Missing properties for the Extend function: {0}."},DatasetDimensionFieldNotFound:{code:4002,category:"Error",message:"Cannot find dimension field '{0}' in dataset '{1}'."},LoadFileError:{code:7000,category:"Error",message:"Cannot load file {0}."}};function Z6(Z,...J){return J.length===0?Z:Z.replace(/{(\d+)}/g,(Q,X)=>`${J[Number.parseInt(X,10)]}`)}var fT=class Z{constructor(J,Q,X,x){this.id=Z.idSeq,Z.idSeq+=1,this.message=J,this.category=Q,this.code=X,this.children=x}static create(J,...Q){return new Z(Z6(J.message,...Q),J.category,J.code)}static createChain(J,Q,...X){return new Z(Z6(J.message,...X),J.category,J.code,Q)}};fT.idSeq=0;var e1=fT;class l extends e1{constructor(Z,J,Q,X,x){super(J,Q,X,x),this.nodeId=Z}static createForNode(Z,J,...Q){return new l(Z,Z6(J.message,...Q),J.category,J.code)}static createChainForNode(Z,J,Q,...X){return new l(Z,Z6(J.message,...X),J.category,J.code,Q)}resolve(Z){let J=Z.nodeById(this.nodeId);if(!J)throw new Error("Expected node");let Q=w0.create(this.nodeId.filepath);if(!Q)throw new Error("Expected filepath");let{originalAst:X,transformedAst:x,transformedRanges:q}=Z.ast(Q).unwrap(),Y=X.getTokenStream(),$=x.getTokenStream(),z=J.getTokenStream(),W=z[0],U=z[z.length-1],H=$.findIndex((j)=>j===W),B=$.findIndex((j)=>j===U),M=H,D=B;for(let j of q){if(j.transformed[0]>B)break;j.transformed[0]<=H&&H<=j.transformed[1]?M-=H-j.transformed[0]:j.transformed[1]<H&&(M-=j.transformed[1]-j.transformed[0]+1-(j.original[1]-j.original[0]+1)),j.transformed[0]<=B&&B<=j.transformed[1]?D-=B-j.transformed[0]:j.transformed[1]<B&&(D-=j.transformed[1]-j.transformed[0]+1-(j.original[1]-j.original[0]+1))}let N=Y[M],_=Y[D];return new M1(this.message,this.category,this.code,Q,N.offset,_.offset+_.text.length,this.children)}}class M1 extends e1{constructor(Z,J,Q,X,x,q,Y){super(Z,J,Q,Y),this.file=X,this.start=x,this.end=q}static createWithLocation(Z,J,Q,X,...x){return new M1(Z6(X.message,...x),X.category,X.code,Z,J,Q)}static createChainWithLocation(Z,J,Q,X,x,...q){return new M1(Z6(X.message,...q),X.category,X.code,Z,J,Q,x)}}class S8{constructor(Z){this.nodeId=Z,this.key=this.toString()}get id(){return this.nodeId.id}toString(){return this.id.toString()}asInternKey(Z,J){return this.id}}var kT=class Z{constructor(){this.id=BigInt(0)<<BigInt(nH)|BigInt(Z.generatedIdSeq),Z.generatedIdSeq+=1}get key(){return this.id.toString()}toString(){return this.id.toString()}asInternKey(J,Q){return this.id}};kT.generatedIdSeq=0;var R8=kT;class TY{constructor(Z){this.moduleId=Z,this.key=this.toString()}toString(){return`symbol@${this.moduleId.key}`}asInternKey(Z,J){return this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internSymbolId(this),this.idVerifiedAt=Z.revision,this.id)}}var p=((Z)=>(Z.None="None",Z.BlockScopedVariable="BlockScopedVariable",Z.FunctionScopedVariable="FunctionScopedVariable",Z.Function="Function",Z.Method="Method",Z.MethodSignature="MethodSignature",Z.MethodSelf="MethodSelf",Z.TypeProperty="TypeProperty",Z.DynamicAttributes="DynamicAttributes",Z.DynamicAttributeProperty="DynamicAttributeProperty",Z.DynamicBody="DynamicBody",Z.DynamicTypeAs="DynamicTypeAs",Z.DynamicNameAs="DynamicNameAs",Z.ElementProperty="ElementProperty",Z.DefaultElementName="DefaultElementName",Z.Trait="Trait",Z.Type="Type",Z.Element="Element",Z.Ast="Ast",Z.Module="Module",Z.ModuleItem="ModuleItem",Z.ModuleItemAlias="ModuleItemAlias",Z.TypeAlias="TypeAlias",Z.BuiltInType="BuiltInType",Z.BuiltInProperty="BuiltInProperty",Z.BuiltInFunction="BuiltInFunction",Z.CompoundSymbol="CompoundSymbol",Z))(p||{});class nQ{constructor(Z,J,Q){this.id=Z,this.name=J,this.kind=Q}members(Z){var J;if((J=this.generatedProps)!=null&&J.members)return this.generatedProps.members;let Q=Z.members(this.id);if(Q.isOk())return Q.unwrap()}type(Z){var J;if((J=this.generatedProps)!=null&&J.type)return this.generatedProps.type;let Q=Z.typeOfSymbol(this.id);if(Q.isOk())return Q.unwrap()}ref(Z){var J;if((J=this.generatedProps)!=null&&J.ref)return this.generatedProps.ref;let Q=Z.symbolReference(this.id);if(Q.isOk())return Q.unwrap()}}class H0 extends nQ{constructor(Z,J,Q,X){super(Z,J,Q),this.declarationId=X}static createVoidSymbol(){let Z=new R8;return new H0(Z,"","None")}static createSymbol(Z,J,Q){let X=new S8(Q);return new H0(X,Z,J,Q)}static createGeneratedSymbol(Z,J,Q){let X=Q?new S8(Q):new R8,x=new H0(X,Z,J);return x.generatedProps={},X.symbol=x,x}}class YZ extends H0{constructor(Z,J,Q,X){super(Z,J,Q),this.symbols=X}static create(Z,J){let Q=new R8;return new YZ(Q,Z,"CompoundSymbol",J)}static createGeneratedCompoundSymbol(Z,J){let Q=new R8,X=new YZ(Q,Z,"CompoundSymbol",J);return X.generatedProps={},Q.symbol=X,X}}class q4 extends nQ{constructor(Z,J,Q){super(Z,J,"Module"),this.moduleId=Q}static createSymbol(Z,J){let Q=new TY(J);return new q4(Q,Z,J)}}var o7=((Z)=>(Z.Public="Public",Z.Private="Private",Z))(o7||{});class s2{constructor(Z){Z?this.table=Z:this.table=new Map}set(Z,J,Q="Public"){this.table.set(Z,{symbol:J,accessModifier:Q})}get(Z,J){return this.table.get(J)}has(Z,J){return this.table.has(J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.getEarlyBinding(Z)}forEach(Z,J){return this.table.forEach(Z,J)}merge(Z,J=["Public","Private"],Q){let X=x3(this.table,Z.table,(x)=>J.includes(x.accessModifier),Q);return Z instanceof J8&&J.includes("Private")?new J8(Z.file,X,Z.unresolvedModules):new s2(X)}}class J8{constructor(Z,J,Q){this.file=Z,this.table=J||new Map,this.unresolvedModules=Q||[]}set(Z,J,Q="Public"){this.table.set(Z,{symbol:J,accessModifier:Q})}get(Z,J){if(this.table.has(J))return this.table.get(J);let Q;for(let X of this.unresolvedModules){if(!X.includedFull)continue;let x=Z.symbolOfModulePath(X.node.id).chain((Y)=>Z.members(Y.id));if(x.isErr())continue;let q=x.unwrap();q.hasEarlyBinding(J)&&(Q=q.getEarlyBinding(J))}return Q}has(Z,J){return this.table.has(J)?!0:!!this.get(Z,J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.getEarlyBinding(Z)}forEachEarlyBinding(Z,J){return this.table.forEach(Z,J)}merge(Z,J=["Public","Private"],Q){let X=x3(this.table,Z.table,(x)=>J.includes(x.accessModifier),Q);if(J.includes("Private")){if(Z instanceof s2||Z instanceof k5)return new J8(this.file,X,this.unresolvedModules);if(Z instanceof J8)return new J8(this.file,X,this.unresolvedModules.concat(Z.unresolvedModules));throw new Error("Unreachable")}return new s2(X)}}class k5{constructor(){this.table=new Map,this.duplicatedTable=new Map}set(Z,J,Q="Public"){if(!this.table.has(Z)){this.table.set(Z,{symbol:J,accessModifier:Q});return}let X=this.duplicatedTable.get(Z)||[];X.push({symbol:J,accessModifier:Q}),this.duplicatedTable.set(Z,X)}get(Z,J){return this.table.get(J)}has(Z,J){return this.table.has(J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.table.has(Z)}merge(Z,J=["Public","Private"]){return Z.table.forEach((Q,X)=>{J.includes(Q.accessModifier)&&this.set(X,Q.symbol,Q.accessModifier)}),this}}function Z2(Z,J){if(Z.kind!==t.ProductType)return Z;let Q=Z,X=J.length?l7(Q):Q;return X.typeArguments=J,X}function RQ(Z){var J;let Q=(J=Z.typeArguments)==null?void 0:J[0];if(!Q)throw new Error("Cannot get inner type of Slot");return Q}function YI(Z){var J;return(J=Z.typeArguments)==null?void 0:J[0]}function k6(Z){return Z.kind===t.UnionType?Z.types.some((J)=>k6(J)):b6(Z)}function cT(Z){if(!b6(Z))return!1;let J=RQ(Z);return J.kind===t.ProductType&&J.name==="TemplateString"}function eq0(Z){if(Z.kind!==t.ProductType||Z.name!=="Heredoc")return!1;let J=Z.typeArguments;return!J||J.length===0?!1:cT(J[0])}function R5(Z){return{kind:t.TypeVariable,name:Z}}function O5(Z,J,Q){return{...L1(J,Z),kind:t.LiteralType,value:Q}}function J3(Z,J,Q,X,x){return{kind:t.Signature,parameters:Z,returnType:J,symbol:X,members:Q.baseTypeMembers(),isBuiltIn:x}}function q8(Z,J){return Z=NH(bT(Z),(Q,X)=>u6(Q,X)),Z.length===1?Z[0]:{kind:t.UnionType,types:Z,origin:J}}function bT(Z){let J=[];return Z.forEach((Q)=>{Q.kind===t.UnionType?g(J,bT(Q.types)):J.push(Q)}),J}function T8(Z,J,Q,X){return{kind:t.ProductType,name:Q,members:x3(J.baseTypeMembers(),Z,void 0,(x,q,Y,$)=>{x.set($,Y)}),symbol:X}}function qY(Z,J,Q){return{kind:t.DynamicType,ruleset:Z,type:J,symbol:Q}}function jQ(Z,J,Q){return{kind:t.DynamicBodyType,type:Z,parentType:J,symbol:Q}}function I5(Z){return{kind:t.BlockType,blkId:Z.id}}function ZY0(Z,J=L1(Z,I0.Any),Q){let X=H0.createGeneratedSymbol("key",p.FunctionScopedVariable);X.generatedProps.type=L1(Z,I0.Any);let x=H0.createGeneratedSymbol("__call__",p.Method),q=J3([{symbol:X,type:L1(Z,I0.Any)}],J,Z);x.generatedProps.type=q;let Y=H0.createGeneratedSymbol("key",p.FunctionScopedVariable);Y.generatedProps.type=L1(Z,I0.String);let $=H0.createGeneratedSymbol("defaultValue",p.FunctionScopedVariable);$.generatedProps.type=L1(Z,I0.Any);let z=H0.createGeneratedSymbol("get",p.Method),W=J3([{symbol:Y,type:L1(Z,I0.String)},{symbol:$,type:L1(Z,I0.Any),hasDefaultValue:!0}],J,Z,z);z.generatedProps.type=W;let U=new Map;return U.set("__call__",{type:q,symbol:x}),U.set("get",{type:W,symbol:z}),T8(U,Z,"Dict",Q)}function aQ(Z,J=L1(Z,I0.Any),Q){let X=ZY0(Z,J,Q),x=R5("K"),q=R5("V");return Z2(X,[x,q])}function JY0(Z,J=L1(Z,I0.Any),Q){let X=H0.createGeneratedSymbol("idx",p.FunctionScopedVariable);X.generatedProps.type=L1(Z,I0.Number);let x=H0.createGeneratedSymbol("__call__",p.Method),q=J3([{symbol:X,type:L1(Z,I0.Any)}],J,Z);x.generatedProps.type=q;let Y=H0.createGeneratedSymbol("length",p.Method),$=L1(Z,I0.Number);Y.generatedProps.type=$;let z=H0.createGeneratedSymbol("idx",p.FunctionScopedVariable);z.generatedProps.type=L1(Z,I0.Number);let W=H0.createGeneratedSymbol("defaultValue",p.FunctionScopedVariable);W.generatedProps.type=L1(Z,I0.Any);let U=H0.createGeneratedSymbol("get",p.Method),H=J3([{symbol:z,type:L1(Z,I0.Number)},{symbol:W,type:L1(Z,I0.Any),hasDefaultValue:!0}],J,Z,U);U.generatedProps.type=H;let B=new Map;return B.set("__call__",{type:q,symbol:x}),B.set("get",{type:H,symbol:U}),B.set("length",{type:$,symbol:Y}),T8(B,Z,"List",Q)}function $Z(Z,J=L1(Z,I0.Any),Q){let X=JY0(Z,J,Q),x=R5("T");return Z2(X,[x])}function pT(Z,J){let Q=T8(new Map,Z,"Partial",J),X=R5("U");return Z2(Q,[X])}function yT(Z,J){let Q=T8(new Map,Z,"Slot",J),X=R5("U");return Z2(Q,[X])}function uT(Z,J){let Q=T8(new Map,Z,"AccessExpression",J),X=R5("T");return Z2(Q,[X])}function vU(Z){if(b6(Z))return vU(RQ(Z));if(eQ(Z)){let J=Z.types.map((Q)=>vU(Q));return q8(J)}return Z}function J6(Z,J){return b6(J)?J:Z2(l7(rQ(Z)),[vU(J)])}function hT(Z){let J=H0.createGeneratedSymbol("values",p.FunctionScopedVariable),Q=Z2(aQ(Z,L1(Z,I0.Any)),[L1(Z,I0.String),L1(Z,I0.Any)]);J.generatedProps.type=Q;let X=J6(Z,L1(Z,I0.Any));return J3([{symbol:J,type:Q}],X,Z)}function L1(Z,J){var Q;return(Q=Z.builtInTypes())==null?void 0:Q.get(J)}function O8(Z){return L1(Z,I0.Kind)}function m3(Z){return L1(Z,I0.Number)}function C5(Z){return L1(Z,I0.Int)}function V4(Z){return L1(Z,I0.String)}function Q3(Z){return L1(Z,I0.Boolean)}function vY(Z,J){let Q=new Map,X=R5("T"),x=T8(Q,Z,"Heredoc",J);return Z2(x,[X])}function wH(Z){return L1(Z,I0.Module)}function n0(Z){return L1(Z,I0.Any)}function FZ(Z){return L1(Z,I0.Void)}function rQ(Z){let J=Z.globalScope().get(Z,"Slot").symbol;return Z.typeFromTypeSymbol(J.id).unwrap()}function gT(Z){let J=rQ(Z),Q=T8(new Map,Z,"TemplateString");return Z2(J,[Q])}function iT(Z){let J=rQ(Z),Q=T8(new Map,Z,"IfExpression");return Z2(J,[Q])}function dT(Z){let J=rQ(Z),Q=T8(new Map,Z,"InfixExpression");return Z2(J,[Q])}function _H(Z,J){return J.length?J.length===1?J[0]:q8(J):n0(Z)}function QY0(Z,J,Q,X){var x;if(!Z.has(J,Q)){let q=H0.createGeneratedSymbol(Q,p.ElementProperty);q.generatedProps.type=X,q.generatedProps.members=new s2,Z.set(Q,q)}return(x=Z.get(J,Q))==null?void 0:x.symbol}function XY0(Z,J){if(J===Y1.DictName&&Z instanceof _0&&Z.elementName instanceof Z0)return Z.elementName.value.value;if(Z.elementType instanceof Z0)return Z.elementType.value.value}function xY0(Z,J,Q,X,x){var q;let{ruleset:Y}=x.parentType,{structure:$}=Y;if($===Y1.DictName||$===Y1.DictType){let z=QY0(J,Z,Y.name,x.parentType);if(!z)return;let W=XY0(Q,$);W&&((q=z.generatedProps)!=null&&q.members&&z.generatedProps.members.set(W,X),Y.isRuleOn(j0.RootNamespace)&&Y.isRuleOn(j0.NameAs)&&Y.isRuleOn(j0.UniqueName)&&!J.has(Z,W)&&J.set(W,X))}else $!==Y1.List&&J.set(X.name,X)}function qY0(Z,J,Q){let X=Z.symbol(Q.id);if(X.isErr())return;let x=X.unwrap(),q=Z.specificType(x.id);if(q.isErr())return;let Y=q.unwrap();G4(Y)?xY0(Z,J,Q,x,Y):J.set(x.name,x)}function lT(Z,J){let Q=new s2;if(J.body instanceof S0)J.body.body.forEach((X)=>{!(X instanceof _0)&&!(X instanceof C0)||qY0(Z,Q,X)});else if(J.body){let X=Z.symbol(J.body.id);if(X.isOk()){let x=Z.members(X.unwrap().id);if(x.isOk()){let q=x.unwrap();return new s2(q.table)}}}return Q}function oT(Z){let{ruleset:J}=Z,{structure:Q}=J;if(Q===Y1.DictType||Q===Y1.DictName||Q===Y1.List){let X=Z.type.members.get("__call__").type.returnType;if(!X)throw new Error("Expected body type");return X}return Z.type}function c0(Z,J={},Q=new Map){var X,x,q,Y;if(Q.has(Z))return Q.get(Z);let $=Z.kind===t.ProductType&&((X=Z.aliasSymbol)!=null&&X.name||Z.name)?((x=Z.aliasSymbol)==null?void 0:x.name)||Z.name:"<circular>";Q.set(Z,$);let{rawValueForLiteral:z=!1,rawValueForAnonymousTypeProperty:W=!1,db:U=void 0,includeTypeArgumentsForHeredoc:H=!0}=J,B;switch(Z.kind){case t.PrimitiveType:B=Z.aliasSymbol?Z.aliasSymbol.name:Z.primitiveTypeKind;break;case t.LiteralType:Z.aliasSymbol?B=Z.aliasSymbol.name:z?Z.primitiveTypeKind===I0.String?B=`"${Z.value}"`:B=Z.value.toString():B=Z.primitiveTypeKind;break;case t.Signature:B=Z.aliasSymbol?Z.aliasSymbol.name:`(${Z.parameters.map((M)=>`${M.symbol.name}: ${c0(M.type,{...J,rawValueForLiteral:!0},Q)}`).join(", ")}) => ${c0(Z.returnType,{...J,rawValueForLiteral:!0},Q)}`;break;case t.UnionType:B=Z.aliasSymbol?Z.aliasSymbol.name:`${Z.types.map((M)=>c0(M,{rawValueForLiteral:!0},Q)).join(" | ")}`;break;case t.ProductType:{let M="";if((q=Z.typeArguments)!=null&&q.length&&(Z.name!=="Heredoc"||H)&&(M+=Z.typeArguments.map((D)=>c0(D,J,Q)).join(", "),M=`[${M}]`),Z.aliasSymbol)B=`${Z.aliasSymbol.name}`;else if(Z.name)B=`${Z.name}${M}`;else if(W||((Y=Z.symbol)==null?void 0:Y.kind)!==p.TypeProperty||!U)B=`${`{ ${[...Z.members].filter(([D,N])=>N.symbol.kind!==p.BuiltInProperty).map(([D,N])=>`${D}: ${c0(N.type,J,Q)}`).join(", ")} }`}${M}`;else{let D=[];for(let N=U.nodeById(Z.symbol.declarationId);N!==void 0;N=N.container()){let _=N.symbol(U);[p.TypeProperty,p.Type].includes(_.kind)&&D.unshift(_.name)}B=D.join(".")}break}case t.DynamicType:B=c0(oT(Z),J,Q);break;case t.DynamicBodyType:B=c0(Z.type,J,Q);break;case t.BlockType:B="Block";break;case t.TypeVariable:B=Z.name;break;default:B=Z.toString()}return Q.set(Z,B),B}function NZ(Z){return Z instanceof YZ}function VY(Z){return Z?Z.type==="file"||Z.type==="directory":!1}class PH{constructor(){this.loadPath=w0.create(`__load__.${n8.languageExtension}`),this.loadDefinitionPath=w0.create(`__loadDefinition__.${n8.languageExtension}`),this.amlDefinitionPath=w0.create(`__amlDefinition__.${n8.languageExtension}`),this.internalPathSet=new Set([this.loadPath.toString(),this.loadDefinitionPath.toString(),this.amlDefinitionPath.toString()]),this.fileContentMap=new Map}setFileContent(Z,J){this.fileContentMap.set(Z.toString(),J)}getFileContent(Z){return this.fileContentMap.get(Z.toString())}deleteFile(Z){this.fileContentMap.delete(Z.toString())}flatFiles(){return[...this.fileContentMap.keys()].map((Z)=>w0.create(Z))}internalPaths(){return Array.from(this.internalPathSet).map((Z)=>w0.create(Z)).concat(this.flatFiles().filter((Z)=>Z.isInternalDecoratorPath()||Z.isInternalJsFuncPath()))}}function T5(Z,J,Q=(X,x)=>X===x){return Z.length!==J.length?!1:Z.every((X,x)=>Q(X,J[x]))}function YY0(Z){return Z?Z.originalAst&&Z.transformedAst:!1}function sT(Z){return Z?Z.symbol&&Z.nodeId:!1}function nT(Z){return Z?Z.category&&Z.code:!1}function aT(Z){return Z?Z.symbol&&Z.accessModifier:!1}function u0(Z,J){if(Z instanceof v1)return $Y0(Z,J);if(Z instanceof c1)return KY0(Z,J);if(Z instanceof Z0)return zY0(Z,J);if(Z instanceof I1)return WY0(Z,J);if(Z instanceof k2)return VY0(Z,J);if(Z instanceof O4)return UY0(Z,J);if(Z instanceof B4)return HY0(Z,J);if(Z instanceof k0)return GY0(Z,J);if(Z instanceof v3)return BY0(Z,J);if(Z instanceof C0)return AU(Z,J);if(Z instanceof S1)return MY0(Z,J);if(Z instanceof x6)return DY0(Z,J);if(Z instanceof _0)return EU(Z,J);if(Z instanceof S0)return FY0(Z,J);if(Z instanceof K2)return NY0(Z,J);if(Z instanceof M4)return wY0(Z,J);if(Z instanceof z3)return _Y0(Z,J);if(Z instanceof y2)return PY0(Z,J);if(Z instanceof A3)return jY0(Z,J);if(Z instanceof s6)return LY0(Z,J);if(Z instanceof u5)return CY0(Z,J);if(Z instanceof K3)return OY0(Z,J);if(Z instanceof a1)return rT(Z,J);if(Z instanceof q3)return mY0(Z,J);if(Z instanceof q6)return AY(Z,J);throw new Error("Unreachable")}function $Y0(Z,J){return!(J instanceof v1)||Z.statements.length!==J.statements.length?!1:Z.statements.every((Q,X)=>u0(Q,J.statements[X]))}function KY0(Z,J){return J instanceof c1?U4(Z.value,J.value):!1}function zY0(Z,J){return J instanceof Z0?U4(Z.value,J.value):!1}function WY0(Z,J){return J instanceof I1?u0(Z.callee,J.callee)&&u0(Z.args,J.args):!1}function VY0(Z,J){return!(J instanceof k2)||Z.args.length!==J.args.length?!1:Z.args.every((Q,X)=>u0(Q,J.args[X]))}function UY0(Z,J){if(!(J instanceof O4))return!1;let Q=(x,q)=>x!==void 0&&q!==void 0?u0(x,q):x===q,X=(x,q)=>x!==void 0&&q!==void 0?U4(x,q):x===q;return Q(Z.name,J.name)&&X(Z.separatorColonToken,J.separatorColonToken)&&Q(Z.typeReferenceExpression,J.typeReferenceExpression)&&X(Z.equalSign,J.equalSign)&&Q(Z.value,J.value)}function HY0(Z,J){return J instanceof B4?U4(Z.op,J.op)&&u0(Z.expression,J.expression):!1}function GY0(Z,J){return J instanceof k0?u0(Z.leftExpression,J.leftExpression)&&U4(Z.op,J.op)&&u0(Z.rightExpression,J.rightExpression):!1}function BY0(Z,J){return J instanceof v3?u0(Z.expression,J.expression)&&U4(Z.op,J.op):!1}function AU(Z,J){if(!(J instanceof C0))return!1;let Q=Z.decorators,X=J.decorators,x=Q===void 0&&X===void 0?!0:Q!==void 0&&X!==void 0&&Q.length===X.length&&Q.every((q,Y)=>AY(q,X[Y]));return u0(Z.elementType,J.elementType)&&(Z.params?J.params?u0(Z.params,J.params):!1:!0)&&(Z.returnType?J.returnType?u0(Z.returnType,J.returnType):!1:!0)&&u0(Z.body,J.body)&&x}function MY0(Z,J){return J instanceof S1?u0(Z.elementType,J.elementType)&&u0(Z.elementName,J.elementName)&&u0(Z.body,J.body):!1}function DY0(Z,J){return J instanceof x6?u0(Z.typeExpr,J.typeExpr):!1}function EU(Z,J){if(!(J instanceof _0))return!1;let Q=Z.decorators,X=J.decorators,x=Q===void 0&&X===void 0?!0:Q!==void 0&&X!==void 0&&Q.length===X.length&&Q.every((q,Y)=>AY(q,X[Y]));return u0(Z.elementType,J.elementType)&&u0(Z.elementName,J.elementName)&&(Z.params?J.params?u0(Z.params,J.params):!1:!0)&&(Z.returnType?J.returnType?u0(Z.returnType,J.returnType):!1:!0)&&(Z.body?J.body?u0(Z.body,J.body):!1:!0)&&x}function FY0(Z,J){return!(J instanceof S0)||Z.body.length!==J.body.length?!1:Z.body.every((Q,X)=>u0(Q,J.body[X]))}function NY0(Z,J){return!(J instanceof K2)||Z.body.length!==J.body.length?!1:Z.body.every((Q,X)=>u0(Q,J.body[X]))}function wY0(Z,J){return!(J instanceof M4)||Z.exprList.length!==J.exprList.length?!1:Z.exprList.every((Q,X)=>u0(Q,J.exprList[X]))}function _Y0(Z,J){return J instanceof z3?u0(Z.expr,J.expr):!1}function PY0(Z,J){return J instanceof y2?U4(Z.name,J.name)&&rT(Z.content,J.content):!1}function jY0(Z,J){return J instanceof A3?U4(Z.path,J.path)&&(Z.body?J.body?u0(Z.body,J.body):!1:!0)&&(Z.moduleName?J.moduleName?u0(Z.moduleName,J.moduleName):!1:!0):!1}function LY0(Z,J){return!(J instanceof s6)||Z.modules.length!==J.modules.length?!1:Z.modules.every((Q,X)=>u0(Q,J.modules[X]))}function CY0(Z,J){return J instanceof u5?u0(Z.moduleName,J.moduleName)&&(Z.moduleNameAs?J.moduleNameAs?u0(Z.moduleNameAs,J.moduleNameAs):!1:!0):!1}function OY0(Z,J){return J instanceof K3?u0(Z.ifKeyword,J.ifKeyword)&&(Z.condition?J.condition?u0(Z.condition,J.condition):!1:!0)&&(Z.thenBranch?J.thenBranch?u0(Z.thenBranch,J.thenBranch):!1:!0)&&(Z.elseKeyword?J.elseKeyword?u0(Z.elseKeyword,J.elseKeyword):!1:!0)&&(Z.elseBranch?J.elseBranch?u0(Z.elseBranch,J.elseBranch):!1:!0):!1}function rT(Z,J){return J instanceof a1?Z.elements.length===J.elements.length&&Z.elements.every((Q,X)=>u0(Q,J.elements[X])):!1}function mY0(Z,J){return J instanceof q3&&u0(Z.value,J.value)}function U4(Z,J){return bU(Z)&&bU(J)?Z.value===J.value:Z.kind!==J.kind?!1:Z.kind===w.NUMBER_LITERAL||Z.kind===w.OPERATOR||Z.kind===w.IDENTIFIER?Z.value===J.value:!0}function AY(Z,J){return J instanceof q6?U4(Z.atSignToken,J.atSignToken)&&u0(Z.name,J.name)&&u0(Z.args,J.args):!1}function c2(Z,J,Q){return Z===J?!0:Z instanceof Map?fY0(Z,J):Z instanceof s2||Z instanceof J8||Z instanceof k5?SY0(Z,J):Z instanceof d?AY0(Z,J):Z instanceof r?EY0(Z,J):hH(Z)?!1:gH(Z)?EY(Z,J):iH(Z)?KZ(Z,J):YY0(Z)?!1:sT(Z)?kY0(Z,J):Array.isArray(Z)?Array.isArray(J)?Z.length===0?J.length===0:nT(Z[0])?IQ(Z,J):T5(Z,J,(X,x)=>c2(X,x)):!1:Z instanceof w0?J instanceof w0?Z.equals(J):!1:Z instanceof p7?Zv(Z,J):VY(Z)?VY(J)?Jv(Z,J):!1:aT(Z)?vY0(Z,J):Z instanceof PZ?aY0(Z,J):Z instanceof b7?!1:Z instanceof X8?J instanceof X8?IQ(Z.diagnostics(),J.diagnostics()):!1:$$0(Z)||K$0(Z)?!1:(typeof Z=="object"&&(!Q||!["interpretFileJson"].includes(Q))&&(console.error("v1 does not implement Equal interface"),console.error(Z)),Z===J)}function SY0(Z,J){if(Z instanceof s2)return RY0(Z,J);if(Z instanceof J8)return IY0(Z,J);if(Z instanceof k5)return TY0(Z,J);throw new Error("Unreachable")}function RY0(Z,J){return J instanceof s2?c2(Z.table,J.table):!1}function IY0(Z,J){return J instanceof J8?c2(Z.file,J.file)&&c2(Z.table,J.table)&&T5(Z.unresolvedModules,J.unresolvedModules,(Q,X)=>cY0(Q.node,X.node)&&Q.includedFull===X.includedFull):!1}function TY0(Z,J){return J instanceof k5?c2(Z.table,J.table)&&c2(Z.duplicatedTable,J.duplicatedTable):!1}function vY0(Z,J){return aT(J)?c2(Z.symbol,J.symbol)&&Z.accessModifier===J.accessModifier:!1}function AY0(Z,J){return J instanceof d?c2(Z.unwrap(),J.unwrap())&&IQ(Z.diagnostics,J.diagnostics):!1}function EY0(Z,J){return J instanceof r?c2(Z.err(),J.err())&&IQ(Z.diagnostics,J.diagnostics):!1}function fY0(Z,J){return!(J instanceof Map)||Z.size!==J.size?!1:[...Z.entries()].every(([Q,X])=>J.has(Q)?c2(X,J.get(Q)):!1)}function kY0(Z,J){return sT(J)?EY(Z.symbol,J.symbol)&&Z.nodeId.key===J.nodeId.key:!1}function IQ(Z,J){return J.length===0?Z.length===0:nT(J[0])?T5(Z,J,tT):!1}function tT(Z,J){var Q,X;if(Z instanceof l&&(!(J instanceof l)||Z.nodeId.key!==J.nodeId.key)||Z instanceof M1&&(!(J instanceof M1)||!Z.file.equals(J.file)||Z.start!==J.start||Z.end!==J.end))return!1;let x=!1;return Z.children===void 0||J.children===void 0?x=Z.children===J.children:x=IQ(Z.children,J.children),x&&Z.code===J.code&&Z.message===J.message&&Z.category===J.category&&c2((Q=Z.meta)==null?void 0:Q.unionMatchedType,(X=J.meta)==null?void 0:X.unionMatchedType)}function cY0(Z,J){return hH(J)?u0(Z,J):!1}function EY(Z,J){return gH(J)?NZ(Z)?bY0(Z,J):Z instanceof H0?eT(Z,J):pY0(Z,J):!1}function eT(Z,J){var Q,X;return J instanceof H0?Z.name===J.name&&Z.kind===J.kind&&c2((Q=Z.declarationId)==null?void 0:Q.key,(X=J.declarationId)==null?void 0:X.key):!1}function bY0(Z,J){return NZ(J)?eT(Z,J)&&T5(Z.symbols,J.symbols,(Q,X)=>EY(Q,X)):!1}function pY0(Z,J){return J instanceof q4?Z.name===J.name&&Z.kind===J.kind&&c2(Z.moduleId.key,J.moduleId.key):!1}function KZ(Z,J){if(!iH(J))return!1;if(Z.kind===t.PrimitiveType)return yY0(Z,J);if(Z.kind===t.LiteralType)return uY0(Z,J);if(Z.kind===t.Signature)return hY0(Z,J);if(Z.kind===t.UnionType)return gY0(Z,J);if(Z.kind===t.ProductType)return iY0(Z,J);if(Z.kind===t.BlockType)return!1;if(Z.kind===t.DynamicType)return lY0(Z,J);if(Z.kind===t.DynamicBodyType)return oY0(Z,J);throw new Error("Unreachable")}function fY(Z,J){var Q,X;return Z.kind===J.kind&&c2(Z.symbol,J.symbol)&&c2(Z.aliasSymbol,J.aliasSymbol)&&((Q=Z.members)==null?void 0:Q.size)===((X=J.members)==null?void 0:X.size)&&[...Z.members?Z.members:[]].every(([x,q])=>{var Y,$,z;if(!((Y=J.members)!=null&&Y.has(x)))return!1;let W=c2(q.symbol,($=J.members.get(x))==null?void 0:$.symbol),U=c2(q.type,(z=J.members.get(x))==null?void 0:z.type);return W&&U})}function yY0(Z,J){return J.kind!==t.PrimitiveType?!1:Z.primitiveTypeKind===J.primitiveTypeKind&&Z.value===J.value&&c2(Z.aliasSymbol,J.aliasSymbol)}function uY0(Z,J){return J.kind!==t.LiteralType?!1:Z.primitiveTypeKind===J.primitiveTypeKind&&Z.value===J.value&&fY(Z,J)}function hY0(Z,J){return J.kind!==t.Signature?!1:Z.isBuiltIn&&J.isBuiltIn?!0:Z.isBuiltIn||J.isBuiltIn?!1:T5(Z.parameters,J.parameters,(Q,X)=>EY(Q.symbol,X.symbol)&&KZ(Q.type,X.type))&&KZ(Z.returnType,J.returnType)&&fY(Z,J)}function gY0(Z,J){return J.kind!==t.UnionType?!1:T5(Z.types,J.types,(Q,X)=>KZ(Q,X))&&c2(Z.origin,J.origin)&&fY(Z,J)}function iY0(Z,J){return!(J.kind!==t.ProductType||Z.name!==J.name||!fY(Z,J)||!dY0(Z.typeArguments,J.typeArguments)||U2(Z)&&Z.raw||U2(J)&&J.raw)}function dY0(Z,J){return Z===void 0||J===void 0?Z===J:Z.length===J.length&&Z.every((Q,X)=>KZ(Q,J[X]))}function lY0(Z,J){return J.kind!==t.DynamicType?!1:Z.ruleset.declarationId.key===J.ruleset.declarationId.key&&KZ(Z.type,J.type)}function oY0(Z,J){return J.kind,t.DynamicBodyType,!1}function Zv(Z,J){return J instanceof p7?Z.id.key===J.id.key&&T5(Z.amlFiles,J.amlFiles,(Q,X)=>Q.equals(X))&&T5(Z.modules,J.modules,(Q,X)=>Zv(Q,X)):!1}function Jv(Z,J){return VY(J)?Z.type==="file"?sY0(Z,J):nY0(Z,J):!1}function sY0(Z,J){return J.type!=="file"?!1:Z.name===J.name&&Z.path.equals(J.path)}function nY0(Z,J){return J.type!=="directory"?!1:Z.name===J.name&&Object.keys(Z.children).length===Object.keys(J.children).length&&Object.keys(Z.children).every((Q)=>Jv(Z.children[Q],J.children[Q]))}function aY0(Z,J){return J instanceof PZ?Z.key===J.key:!1}function b2(Z){return Z.some((J)=>J.category===g1.Error)}function s7(Z){return NH(Z,tT)}function jH(Z,J,Q){let X=v.WrongKind,{program:x}=Z;for(let q of x.customModuleProviders.evaluate.replacing)if(X=q(J,Q,Z),X!==v.WrongKind)break;if(X===v.WrongKind){for(let q of x.moduleProviders.evaluate)if(X=q(J,Q,Z),X!==v.WrongKind)break}for(let q of x.customModuleProviders.evaluate.extending)X=q(J,Q,Z,X);if(X!==v.WrongKind)return J.evalValue=X.returnVal,X;throw new Error("No handler for this node")}function Qv(Z,J){let Q=Z.ast(J).unwrap().transformedAst;if(!Q.filePath)throw new Error("Expected ast filepath");let{program:X}=Z,x=new A5({parent:X.globalEnv});return jH(Z,Q,x)}function Xv(Z,J){let Q=Z.fileDependencies(J),X=[],x=Z.ast(J);return g(X,x.diagnostics),Q.forEach((q)=>{g(X,Z.typecheckFile(q).diagnostics())}),b2(X)?new b7(new X8(X)):new b7(new X8(X),new X3(Qv(Z,J)))}function xv(Z,J){if(J.query.name==="interpretFile"){let Q=Z.ast(J.key.value).unwrap().transformedAst;throw new H4(l.createForNode(Q.id,k.ModuleCircularDependencies,Q.filePath.toString()))}throw new Error("Circular dependency detected")}function qv(Z,J){let{program:Q}=Z,X=Q.interpretFile(J);if(X.isOk()){let x=X.env().data.bindings.map((Y)=>Y.toJsStructure()),q=X.returnVal().toJsStructure();return new X3({bindings:x,returnVal:q})}return new T2(X.resolvedDiagnostics(Q.db))}class H4 extends Error{constructor(Z){super(Z.message),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.diag=Z}}function rY0(Z,J){return x3(Z,J,void 0,(Q,X,x,q)=>{var Y;let $;if(x instanceof o1&&!((Y=x.hiddenMetadata)!=null&&Y.shouldMerge))$=x;else{let z=I2(X),W=I2(x);if(z instanceof M2)$=x;else if(W instanceof M2)$=X;else if(z instanceof C4){if(!(W instanceof C4))throw new Error("Cannot merge dynamic prop list with non-dynamic prop list");$=Gv(z,W)}else if(z instanceof v5){if(!(W instanceof v5))throw new Error("Cannot merge dynamic prop dict with non-dynamic prop dict");$=TQ(z,W)}else $=TQ(z,W);x instanceof o1&&!($ instanceof o1)&&($=new o1($,x.metadata,x.rules,x.hiddenMetadata))}Q.set(q,$)})}function TQ(Z,J){if(Z instanceof o1||J instanceof o1){let x=TQ(I2(Z),I2(J));return J instanceof o1?new o1(x,J.metadata,J.rules,J.hiddenMetadata):x}let Q=rY0(Z.members,J.members),X=new g0(Q,Z.vTable,Z.type);return X.data=J.data,Object.setPrototypeOf(X,Object.getPrototypeOf(Z)),X}function tY0(Z){Z.members.delete("__fqn__")}function Yv(Z,J){J.set("__baseFqn__",Z)}class kY{constructor(Z,J,Q){this.parentObj=Z,this.vTable=J,this.data=Q}static new(Z){return Vv(Z)}static newObj(Z){return Uv(Z)}}function $v(Z,J){return typeof Z=="function"?Z(...J):G0(Z,"__call__",...J)}function Kv(Z){return{vTable:Z,parentObj:cY,data:null,type:null}}function zv(Z,J,Q){Z.data===null&&(Z.data=new Map),Z.data.set(J,Q)}function Wv(Z){return{vTable:Z.vTable,parentObj:Z,data:new Map}}function LH(Z,J){if(!J)throw new Error("Undefined method symbol");return Z.data.has(J)?Z.data.get(J):Z.parentObj!==null?G0(Z.parentObj,"lookUp",J):M2.Instance}function G0(Z,J,...Q){if(Z===null)return null;if("target"in Z){if(J!=="__lookUp__")return G0(Z.target,J,...Q);if(Q[0]==="__meta__")return Z.metaObject;let x=G0(Z.target,J,...Q);return x!==M2.Instance?x:Z.metadata.get(Q[0])??M2.Instance}let X;if(J==="lookUp"&&Z.vTable===Z)X=LH(Z.vTable,"lookUp");else if(Z.vTable!==null)X=G0(Z.vTable,"lookUp",J);else throw new Error(`Object ${Z} has no vTable`);return $v(X,[Z].concat(Q))}var vQ=new kY(null,null,new Map().set("addMethod",zv).set("allocate",Kv).set("delegate",Wv).set("lookUp",LH)),cY={parentObj:null,vTable:vQ,data:new Map};vQ.parentObj=cY;vQ.vTable=vQ;function Vv(Z){let J=G0(cY,"delegate");for(let Q in Z)if(Object.prototype.hasOwnProperty.call(Z,Q)){let X=Z[Q];G0(J,"addMethod",Q,X)}return J}function Uv(Z){return G0(Z,"allocate")}var o2=kY.new({}),AQ=G0(o2,"delegate"),JZ=G0(o2,"delegate");class g0{constructor(Z,J,Q){this.parentObj=null,this.vTable=o2,this.members=new Map,Z&&(this.members=Z),J&&(this.vTable=J),this.type=Q}clone(){let Z={...this,jsObject:void 0,members:this.cloneMembers()};return Object.setPrototypeOf(Z,Object.getPrototypeOf(this)),Z}cloneMembers(){let Z=new Map;return this.members.forEach((J,Q)=>{Z.set(Q,J.clone())}),Z}clearJsObjectCache(){this.jsObject=void 0}getCachedJsObject(){return this.jsObject}setCachedJsObject(Z){this.jsObject=Z}toJsStructure(){return G0(this,"to_js_structure")}}class o1 extends g0{constructor(Z,J,Q,X){super(),this.target=Z,this.metadata=J,this.metaObject=new g0(J),this.hiddenMetadata=X,this.rules=Q,this.data=Z.data,this.members=Z.members,this.type=Z.type,this.vTable=Z.vTable}toJsStructure(){var Z;let J=G0(this.target,"to_js_structure");if((Z=this.rules)!=null&&Z.body_as){let Q={};for(let[X,x]of this.metadata.entries())Q[X]=G0(x,"to_js_structure");return Q[this.rules.body_as]=J,Q}if(typeof J=="object"&&J!==null&&!Array.isArray(J)){let Q={};for(let[X,x]of this.metadata.entries())Q[X]=G0(x,"to_js_structure");return{...Q,...J}}return J}}function I2(Z){return Z instanceof o1?Z.target:Z}var v7={"==":function(Z,J){return Z.data===J.data?R1.True:R1.False},">":function(Z,J){return Z.data>J.data?R1.True:R1.False},"<":function(Z,J){return Z.data<J.data?R1.True:R1.False},"<=":function(Z,J){return Z.data<=J.data?R1.True:R1.False},">=":function(Z,J){return Z.data>=J.data?R1.True:R1.False},"!=":function(Z,J){return Z.data!==J.data?R1.True:R1.False}},f6=G0(o2,"delegate");class R1 extends g0{constructor(Z){super(),this.vTable=f6,this.data=Z}static get True(){return R1._trueInstance||(R1._trueInstance=new R1(!0)),R1._trueInstance}static get False(){return R1._falseInstance||(R1._falseInstance=new R1(!1)),R1._falseInstance}}var A7=G0(o2,"delegate"),Hv=class Z extends g0{constructor(J){super(),this.vTable=A7,this.data=J}static create(J){let Q=Z.stringCache.get(J);return Q||(Q=new Z(J),Z.stringCache.set(J,Q)),Q}clone(){return new this.constructor(this.data)}};Hv.stringCache=new Map;var h0=Hv,e3=G0(o2,"delegate");class h4 extends g0{constructor(Z){super(),this.vTable=e3,this.data=Z}}var UY=G0(o2,"delegate");class a8 extends g0{constructor(){super(),this.vTable=UY,this.data=null}static get Instance(){return a8._instance||(a8._instance=new a8),a8._instance}}var HY=G0(o2,"delegate");class M2 extends g0{constructor(){super(),this.vTable=HY,this.data=void 0}static get Instance(){return M2._instance||(M2._instance=new M2),M2._instance}}class CH extends g0{constructor(Z,J){super(),this.vTable=o2,this.data=Z,this.env=J}}class tQ extends g0{clone(){return ox0(this)}}var LQ=G0(o2,"delegate");class OH extends tQ{constructor(Z,J,Q,X){super(),this.vTable=LQ,this.data=new mH(Z,J,Q,X)}addArgs(Z,J,Q){let{params:X}=this.data;if(X.length!==J.length)throw new Error(`Argument mismatch: Expect ${X.length} arguments but got ${J.length} arguments instead`);let x=J.map((q,Y)=>{let $=X[Y].asParameter().name.name??"",z=q,W=Q.db.symbol(X[Y].id).unwrap();return new V2({name:$,symbol:W,type:W.type(Q.db),value:z})});return Z.data.bindings=Z.data.bindings.concat(x),Z}bind(Z){this.data.bindObj=Z}}class mH{constructor(Z,J,Q,X){this.params=Z,this.body=J,this.env=Q,this.program=X}toJson(){return{args:this.params.map((Z)=>Z.asParameter().name.name)}}}var CQ=G0(o2,"delegate");class E0 extends tQ{constructor(Z,J,Q,X){super(),this.vTable=CQ,this.data={jsFunc:Z,bindObj:J},this.isDecorated=Q,this.partialType=X}bind(Z){this.data.bindObj=Z}}var GY=G0(o2,"delegate");class zZ extends g0{constructor(Z,J,Q){super(),this.vTable=GY,this.data=new bY(Z,J),this.type=Q}clone(){let Z=super.clone();return Z.data=this.data.clone(),Z}}class bY{constructor(Z,J){this.name=Z,this.content=J}clone(){return new bY(this.name,this.content)}}class v5 extends g0{constructor(Z=new Map,J=void 0){super(Z,AQ,J)}merge(Z){let J=x3(this.members,Z.members,void 0,(Q,X,x,q)=>{Q.set(q,x)});return new v5(J)}}class C4 extends g0{constructor(Z=[],J=!1){super(),this.data=[],this.vTable=JZ,this.isDynamicPropList=!1,this.data=Z,this.members.set("length",new h4(Z.length)),this.isDynamicPropList=J}clone(){let Z=super.clone();return Z.data=this.data,Z}}class SH{constructor(Z,J){this.parent=Z,this.bindings=J}toJsStructure(){return{parent:this.parent===null?"null":this.parent.toJsStructure(),bindings:this.bindings.map((Z)=>Z.toJsStructure())}}}class A5 extends g0{constructor({parent:Z,bindings:J=[]}){super(),this.data=new SH(Z,J)}static rootEnv(){return new A5({parent:null})}find(Z){let J=this.data.bindings.find((Q)=>Q.data.name===Z);if(J)return J.data.value;if(this.data.parent!==null){let Q=this.data.parent.find(Z);if(Q)return Q}throw new H4(e1.create(k.AdhocError,`Identifier "${Z}" not found in scope`))}findBinding(Z){return this.data.bindings.find((J)=>J.data.name===Z)}toJsStructure(){return{data:this.data.toJsStructure()}}createLocal(){return new A5({parent:this})}}class RH{constructor(Z,J,Q,X){this.name=Z,this.symbol=J,this.type=Q,this.value=X}toJsStructure(){return{name:this.name,_type:c0(this.type),value:this.value.toJsStructure()}}}class V2 extends g0{constructor({name:Z,symbol:J,type:Q,value:X}){super(),this.data=new RH(Z,J,Q,X)}toJsStructure(){return this.data.toJsStructure()}}function Gv(Z,J){if(Z.isDynamicPropList){if(!J.isDynamicPropList)throw new Error("Cannot merge non-dynamic prop list into dynamic prop list");return Bv(Z,J)}return J}function Bv(Z,J){let Q=Z.clone(),X=Q.members.get("length");return J.data.forEach((x)=>{Q.data.push(x),X.data+=1}),Q}function Mv(Z){let J=Z.split(/\r?\n/);J.length>0&&!J[0].trim()&&J.shift(),J.length>0&&!J[J.length-1].trim()&&J.pop();let Q=(x)=>{let q=0;for(;q<x.length&&x[q]===" ";)q+=1;return q},X=J.filter((x)=>x.trim()).reduce((x,q)=>Math.min(x,Q(q)),Number.MAX_SAFE_INTEGER);return J=J.map((x)=>x.slice(X)),J.join(`
135
+ `),this.outputHelp(),process.exit(1);let J=y30(Z);ZC(J.apiKey,u30(J.address))}),QC=h30;import*as K9 from"fs";import*as a5 from"path";var Bu=O9(TR(),1);import VT0 from"fs";var e8={};sF(e8,{voidType:()=>FZ,version:()=>oI,uniqDiagnostics:()=>s7,typecheckSerializer:()=>JG0,traceNodeDependency:()=>xG0,toServiceDiagnostics:()=>Z$,toServiceDiagnostic:()=>OG,subsetOfUnionType:()=>AH,subsetOf:()=>i1,stringType:()=>V4,slotType:()=>rQ,serializeTable:()=>MG,serializeSymbolTableSlot:()=>GG,send:()=>G0,scopeOfFileSerializer:()=>bE,runParseBenchmark:()=>cG0,rootVtable:()=>vQ,resolveReferenceChain:()=>rv,removeFQNameFromMembers:()=>tY0,releaseCacheForQueries:()=>r$0,releaseCacheForFile:()=>a$0,refCustomModules:()=>KX,recoverInterpretFile:()=>xv,readAmlFileInfo:()=>Af,pushArray:()=>g,prettyPrintStats:()=>pf,parseFromSource:()=>KG,parseFqn:()=>NQ,parseFile:()=>Ef,numberType:()=>m3,newObj:()=>Uv,moduleType:()=>wH,mergeMap:()=>x3,mergeExtendAmlList:()=>Gv,mergeExtendAmlDynamicPropList:()=>Bv,mergeDiagResultDiagnostics:()=>g$0,mergeAmlObjects:()=>TQ,membersOfModuleSerializer:()=>pE,lookupSymbol:()=>i4,lookUp:()=>LH,loadProjectSources:()=>qf,listVtable:()=>JZ,listLeafNodeDependencies:()=>qG0,listAmlFiles:()=>Tf,languageModule:()=>qM0,kind:()=>O8,isUseDeclaration:()=>t8,isUniqueKeyObj:()=>sv,isUnionTypecheckResult:()=>pY,isTypecheckCorrect:()=>n2,isTypeProperty:()=>b5,isTypeNode:()=>JX,isType:()=>iH,isTrivia:()=>RA,isTrait:()=>uY,isSyntaxNode:()=>hH,isStringToken:()=>bU,isStaticString:()=>oH,isSpaceLikeToken:()=>ov,isRulesetNode:()=>iv,isRelExpr:()=>AA,isPropertyAccessExpression:()=>$4,isMacro:()=>kA,isLiteralFunction:()=>kH,isLiteralElement:()=>n7,isKeyword:()=>hv,isInsideBlockExpression:()=>o$0,isImport:()=>gv,isImpl:()=>cH,isIdentifierWithValue:()=>sH,isFunctionArgument:()=>pH,isFunction:()=>v8,isFileTreeNode:()=>VY,isFieldRefExpression:()=>av,isExpression:()=>d6,isElementSymbol:()=>a7,isElementProperty:()=>l6,isElementNameOfDeclaration:()=>d$0,isElement:()=>bH,isDocument:()=>r7,isDeclaration:()=>_Z,isChildNode:()=>dv,isBlockScopedDeclaration:()=>QX,isAssignmentExpression:()=>n$0,isArgumentName:()=>l$0,isAmlSymbol:()=>gH,isAcceptedModule:()=>k1,interpretNode:()=>jH,interpretFileNoTypecheck:()=>Qv,interpretFileJson:()=>qv,interpretFile:()=>Xv,intType:()=>C5,heredocType:()=>vY,hasSelf:()=>c$0,hasErrorDiagnostics:()=>b2,getValueForJsBinding:()=>RG,getTypeOfElementPropNodeForTypeWithMembers:()=>VZ,getTypeOfElementPropNode:()=>MY,getTypeForJsBinding:()=>oQ,getSymbolDefinitionLocation:()=>$k,getSuggestions:()=>qk,getSuggestionKindOfSymbol:()=>rf,getOuterScope:()=>o6,getModuleHierarchyFromFile:()=>Kk,getFoldingRangesFromSource:()=>gf,getFoldingRangesFromNode:()=>wG,getDiagnostics:()=>Yk,getDefinitionLocationFromNode:()=>$Y,getDeclarationNameNode:()=>uv,getDeclarationName:()=>i$0,getDeclarationForJsBinding:()=>SG,getChildIndexFromParent:()=>lv,getAttachedDocument:()=>I8,getAstsFromPaths:()=>s$0,getAstFromNode:()=>yH,generateTypesAndLookupHelper:()=>nv,genCodeFromTypeParameter:()=>Df,genCodeFromTrivia:()=>dU,genCodeFromToken:()=>h1,genCodeFromTemplateString:()=>NG,genCodeFromReturnTypeNode:()=>Sf,genCodeFromPrimaryExpression:()=>Nf,genCodeFromPrefixExpression:()=>Gf,genCodeFromPostfixExpression:()=>Mf,genCodeFromLiteralElementExpression:()=>wf,genCodeFromListExpression:()=>Pf,genCodeFromInfixExpression:()=>Bf,genCodeFromImportModule:()=>If,genCodeFromImportDeclaration:()=>Uf,genCodeFromImportBody:()=>Rf,genCodeFromIdentifier:()=>Ff,genCodeFromHeredoc:()=>_f,genCodeFromGroupExpression:()=>Lf,genCodeFromExpression:()=>Kf,genCodeFromEqualityDeclaration:()=>zf,genCodeFromEmbeddedExpression:()=>Cf,genCodeFromElementDeclaration:()=>Wf,genCodeFromDeclaration:()=>$f,genCodeFromCallExpression:()=>Hf,genCodeFromBlockExpression:()=>jf,genCodeFromBlock:()=>Vf,genCodeFromAst:()=>Yf,genCodeFromArgumentList:()=>Of,genCodeFromArgumentExpression:()=>mf,genCode:()=>C1,formatType:()=>c0,formatDependencyPath:()=>gE,formatBenchmarkResult:()=>Xf,forEachChild:()=>s0,forEachAncestor:()=>uH,flattenTokenStream:()=>gQ,findLeafNodeDependencies:()=>dE,findDependencyPath:()=>uE,filesSerializer:()=>cE,fileContentSerializer:()=>kE,expandRelationshipMacro:()=>WH0,expandRelMacro:()=>zH0,expandMacros:()=>fA,exhaustiveCheck:()=>lH,deserializeTable:()=>DG,deserializeSymbolTableSlot:()=>BG,deproxy:()=>I2,delegate:()=>Wv,decorator:()=>TG,createVt:()=>Vv,createUnionType:()=>q8,createTypeVariable:()=>R5,createSuggestion:()=>e7,createSlotType:()=>J6,createSlotTemplateStringType:()=>gT,createSlotInfixExpressionType:()=>dT,createSlotIfExpressionType:()=>iT,createSlotGenericType:()=>yT,createSignature:()=>J3,createServiceDiagnostic:()=>eU,createRefFunc:()=>ZG,createProductType:()=>T8,createPartialType:()=>pT,createLiteralType:()=>O5,createListType:()=>$Z,createGraphNodeIdFromArgs:()=>fQ,createElementFqn:()=>p5,createDynamicType:()=>qY,createDynamicBodyType:()=>jQ,createDictType:()=>aQ,createDiagnosticForOriginalNode:()=>P2,createDiagnosticChainAfterTypecheck:()=>h6,createCreateSlotFunctionType:()=>hT,createBlockType:()=>I5,createAccessExpressionType:()=>uT,convertToJsMetadata:()=>JH,convertToJsBinding:()=>KY,computeObjectStats:()=>kf,computeLexStats:()=>cf,computeFileStats:()=>ff,computeAstStats:()=>bf,comparsionMethods:()=>v7,combineTypes:()=>_H,collectProjectStats:()=>yf,codegen:()=>IG,classifyFileKind:()=>vf,checkParenthesesPair:()=>hf,checkModuleExistsSerializer:()=>yE,builtInType:()=>L1,buildDiagMessage:()=>Z6,booleanType:()=>Q3,benchmarkParserPipeline:()=>Qf,attachMetaToCheckResult:()=>ZX,attachLocationToDiagnostics:()=>BY,assignable:()=>x4,assignBaseFQNameToMembers:()=>Yv,asDiag:()=>tq0,applyClosure:()=>$v,anyType:()=>n0,analyzeTokenFrequencies:()=>AG0,analyzeAndPrintProjectStats:()=>uG0,allocate:()=>Kv,addMethod:()=>zv,accessElementVtable:()=>AQ,Vtable:()=>kY,VirtualPath:()=>w0,VfsPathSerializer:()=>ZE,VfsPathDeserializer:()=>NE,Vfs:()=>PH,ValueSerializer:()=>$6,ValueKind:()=>B0,ValueDeserializer:()=>K6,UnresolvedLocationDiagnostic:()=>l,TypecheckResultKind:()=>vH,TypecheckModuleResult:()=>hY,TypecheckFileResult:()=>X8,TypeParameter:()=>y5,TypeKind:()=>t,TokenFlags:()=>m5,TemplateString:()=>a1,SyntaxTokenKind:()=>w,SyntaxToken:()=>l1,SyntaxNodeKind:()=>Y0,SyntaxNodeIdSerializer:()=>KE,SyntaxNodeIdDeserializer:()=>mE,SyntaxNodeId:()=>UZ,SymbolSerializer:()=>WE,SymbolDeserializer:()=>RE,SuggestionKindMap:()=>sU,SuggestionKind:()=>$3,Service:()=>zk,SerializedEngine:()=>HG,ReturnTypeNode:()=>x6,Queue:()=>dH,QueryRunKind:()=>l2,QueryError:()=>v,Program:()=>$X,PrimitiveTypeKind:()=>I0,PrimaryExpression:()=>c1,PrettyPrinter:()=>rY,PrefixExpression:()=>B4,PostfixExpression:()=>v3,ParsingError:()=>Z3,ParseModuleResult:()=>tH,ParseFileResult:()=>rH,Ok:()=>X3,ObjVtable:()=>cY,NodeSymbolId:()=>S8,NodeSymbol:()=>H0,NodeIdKind:()=>aH,NodeFlags:()=>t7,NODE_ID_BITS:()=>nH,ModuleTable:()=>k5,ModuleSymbolId:()=>TY,ModuleSymbol:()=>q4,MEMORY_CLEARED:()=>EQ,LiteralElementExpression:()=>C0,ListExpression:()=>M4,JsFuncVtable:()=>CQ,JsFunc:()=>E0,InterpretModuleResult:()=>JA,InterpretFileResult:()=>b7,InfixExpression:()=>k0,ImportModule:()=>u5,ImportDeclaration:()=>A3,ImportBody:()=>s6,IfExpression:()=>K3,Identifier:()=>Z0,HeredocVtable:()=>GY,HeredocData:()=>bY,Heredoc:()=>y2,GroupExpression:()=>z3,GnodeIdSerializer:()=>xE,GeneratedSymbolId:()=>R8,GNodeSerializer:()=>QE,GNodeIdDeserializer:()=>jE,GNodeDeserializer:()=>_E,FuncData:()=>mH,EvalResult:()=>U1,Err:()=>T2,EqualityDeclaration:()=>S1,EnvData:()=>SH,Env:()=>A5,EncounteredOuterContextTokenError:()=>pQ,EmbeddedExpression:()=>q3,ElementDeclaration:()=>_0,EarlyResolvedTable:()=>s2,DiagnosticWithLocation:()=>M1,DiagnosticSerializer:()=>YE,DiagnosticDeserializer:()=>CE,DiagnosticCategory:()=>g1,Diagnostic:()=>e1,DiagOk:()=>d,DiagMessages:()=>k,DiagErr:()=>r,Decorator:()=>q6,DEFAULT_CUSTOM_QUERY_ALLOW_LIST:()=>GH0,CustomQueryLog:()=>yQ,CustomHookStrategy:()=>Y3,CompoundSymbol:()=>YZ,Callable:()=>tQ,CallExpression:()=>I1,BlockExpression:()=>K2,Block:()=>S0,BindingData:()=>RH,Binding:()=>V2,AstTable:()=>J8,Ast:()=>v1,ArgumentList:()=>k2,ArgumentExpression:()=>O4,AmlVoidVtable:()=>UY,AmlVoid:()=>a8,AmlValueSerializer:()=>UE,AmlValueDeserializer:()=>TE,AmlUndefinedVtable:()=>HY,AmlUndefined:()=>M2,AmlSymbolKind:()=>p,AmlSymbol:()=>nQ,AmlStringVtable:()=>A7,AmlString:()=>h0,AmlRuntimeError:()=>H4,AmlProxy:()=>o1,AmlObjectVtable:()=>o2,AmlObject:()=>g0,AmlNumberVtable:()=>e3,AmlNumber:()=>h4,AmlModuleIdSerializer:()=>ME,AmlModuleIdDeserializer:()=>fE,AmlModuleId:()=>PZ,AmlModule:()=>p7,AmlList:()=>C4,AmlHeredoc:()=>zZ,AmlFuncVtable:()=>LQ,AmlFunc:()=>OH,AmlFqnObjectSerializer:()=>GE,AmlFqnObjectDeserializer:()=>AE,AmlDynamicPropDict:()=>v5,AmlBooleanVtable:()=>f6,AmlBoolean:()=>R1,AmlAccessExpressionObject:()=>CH,AccessModifier:()=>o7,AbstractSyntaxNode:()=>d1});var n8={globalModuleName:"::",languageExtension:"aml"};class w0{constructor(Z){this.path=Z,this.key=this.path}static create(Z){return Z.startsWith("/")?new w0(Z):new w0(`/${Z}`)}asInternKey(Z,J){return this.program===J.program&&this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internPath(this),this.idVerifiedAt=Z.revision,this.program=J.program,this.id)}toString(){return this.path}equals(Z){return this.path===Z.path}nameAndExtension(){let Z=this.path.toString().split("/").pop().split(".");if(Z.length>2){let J=Z.pop();return[Z.join("."),J]}return[Z[0],Z[1]]}isAmlFile(){let[,Z]=this.nameAndExtension();return Z===n8.languageExtension}getParentDir(){let Z=this.path.toString().split("/").filter((Q)=>Q);if(!Z.length)return;Z.pop();let J=Z.join("/");return w0.create(J)}isInternalDecoratorPath(){return this.path.startsWith("/__decorator")}isInternalJsFuncPath(){return this.path.startsWith("/__jsfunc")}}import f7 from"fs";import wQ from"path";var __dirname="/home/circleci/holistics/node_modules/.pnpm/@holistics+aml@7.3.8/node_modules/@holistics/aml/dist";var oI="7.3.8",sI=typeof global=="object"&&global&&global.Object===Object&&global,AZ0=typeof self=="object"&&self&&self.Object===Object&&self,X6=sI||AZ0||Function("return this")(),Q8=X6.Symbol,nI=Object.prototype,EZ0=nI.hasOwnProperty,fZ0=nI.toString,HQ=Q8?Q8.toStringTag:void 0;function kZ0(Z){var J=EZ0.call(Z,HQ),Q=Z[HQ];try{Z[HQ]=void 0;var X=!0}catch{}var x=fZ0.call(Z);return X&&(J?Z[HQ]=Q:delete Z[HQ]),x}var cZ0=Object.prototype,bZ0=cZ0.toString;function pZ0(Z){return bZ0.call(Z)}var yZ0="[object Null]",uZ0="[object Undefined]",vR=Q8?Q8.toStringTag:void 0;function MZ(Z){return Z==null?Z===void 0?uZ0:yZ0:vR&&(vR in Object(Z))?kZ0(Z):pZ0(Z)}function S5(Z){return Z!=null&&typeof Z=="object"}var hZ0="[object Symbol]";function QH(Z){return typeof Z=="symbol"||S5(Z)&&MZ(Z)==hZ0}function aI(Z,J){for(var Q=-1,X=Z==null?0:Z.length,x=Array(X);++Q<X;)x[Q]=J(Z[Q],Q,Z);return x}var R3=Array.isArray,AR=Q8?Q8.prototype:void 0,ER=AR?AR.toString:void 0;function rI(Z){if(typeof Z=="string")return Z;if(R3(Z))return aI(Z,rI)+"";if(QH(Z))return ER?ER.call(Z):"";var J=Z+"";return J=="0"&&1/Z==-1/0?"-0":J}function DZ(Z){var J=typeof Z;return Z!=null&&(J=="object"||J=="function")}function tI(Z){return Z}var gZ0="[object AsyncFunction]",iZ0="[object Function]",dZ0="[object GeneratorFunction]",lZ0="[object Proxy]";function eI(Z){if(!DZ(Z))return!1;var J=MZ(Z);return J==iZ0||J==dZ0||J==gZ0||J==lZ0}var VU=X6["__core-js_shared__"],fR=function(){var Z=/[^.]+$/.exec(VU&&VU.keys&&VU.keys.IE_PROTO||"");return Z?"Symbol(src)_1."+Z:""}();function oZ0(Z){return!!fR&&fR in Z}var sZ0=Function.prototype,nZ0=sZ0.toString;function i7(Z){if(Z!=null){try{return nZ0.call(Z)}catch{}try{return Z+""}catch{}}return""}var aZ0=/[\\^$.*+?()[\]{}|]/g,rZ0=/^\[object .+?Constructor\]$/,tZ0=Function.prototype,eZ0=Object.prototype,ZJ0=tZ0.toString,JJ0=eZ0.hasOwnProperty,QJ0=RegExp("^"+ZJ0.call(JJ0).replace(aZ0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function XJ0(Z){if(!DZ(Z)||oZ0(Z))return!1;var J=eI(Z)?QJ0:rZ0;return J.test(i7(Z))}function xJ0(Z,J){return Z==null?void 0:Z[J]}function d7(Z,J){var Q=xJ0(Z,J);return XJ0(Q)?Q:void 0}var OU=d7(X6,"WeakMap"),kR=Object.create,qJ0=function(){function Z(){}return function(J){if(!DZ(J))return{};if(kR)return kR(J);Z.prototype=J;var Q=new Z;return Z.prototype=void 0,Q}}();function YJ0(){}function $J0(Z,J){var Q=-1,X=Z.length;for(J||(J=Array(X));++Q<X;)J[Q]=Z[Q];return J}var cR=function(){try{var Z=d7(Object,"defineProperty");return Z({},"",{}),Z}catch{}}();function ZT(Z,J){for(var Q=-1,X=Z==null?0:Z.length;++Q<X&&J(Z[Q],Q,Z)!==!1;);return Z}function KJ0(Z,J,Q,X){for(var x=Z.length,q=Q+-1;++q<x;)if(J(Z[q],q,Z))return q;return-1}function zJ0(Z){return Z!==Z}function WJ0(Z,J,Q){for(var X=Q-1,x=Z.length;++X<x;)if(Z[X]===J)return X;return-1}function VJ0(Z,J,Q){return J===J?WJ0(Z,J,Q):KJ0(Z,zJ0,Q)}function UJ0(Z,J){var Q=Z==null?0:Z.length;return!!Q&&VJ0(Z,J,0)>-1}var HJ0=9007199254740991,GJ0=/^(?:0|[1-9]\d*)$/;function JT(Z,J){var Q=typeof Z;return J=J??HJ0,!!J&&(Q=="number"||Q!="symbol"&&GJ0.test(Z))&&Z>-1&&Z%1==0&&Z<J}function QT(Z,J,Q){J=="__proto__"&&cR?cR(Z,J,{configurable:!0,enumerable:!0,value:Q,writable:!0}):Z[J]=Q}function XH(Z,J){return Z===J||Z!==Z&&J!==J}var BJ0=Object.prototype,MJ0=BJ0.hasOwnProperty;function XT(Z,J,Q){var X=Z[J];(!(MJ0.call(Z,J)&&XH(X,Q))||Q===void 0&&!(J in Z))&&QT(Z,J,Q)}function CY(Z,J,Q,X){var x=!Q;Q||(Q={});for(var q=-1,Y=J.length;++q<Y;){var $=J[q],z=void 0;z===void 0&&(z=Z[$]),x?QT(Q,$,z):XT(Q,$,z)}return Q}var DJ0=9007199254740991;function xH(Z){return typeof Z=="number"&&Z>-1&&Z%1==0&&Z<=DJ0}function OY(Z){return Z!=null&&xH(Z.length)&&!eI(Z)}var FJ0=Object.prototype;function qH(Z){var J=Z&&Z.constructor,Q=typeof J=="function"&&J.prototype||FJ0;return Z===Q}function NJ0(Z,J){for(var Q=-1,X=Array(Z);++Q<Z;)X[Q]=J(Q);return X}var wJ0="[object Arguments]";function bR(Z){return S5(Z)&&MZ(Z)==wJ0}var xT=Object.prototype,_J0=xT.hasOwnProperty,PJ0=xT.propertyIsEnumerable,YH=bR(function(){return arguments}())?bR:function(Z){return S5(Z)&&_J0.call(Z,"callee")&&!PJ0.call(Z,"callee")};function jJ0(){return!1}var qT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,pR=qT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,LJ0=pR&&pR.exports===qT,yR=LJ0?X6.Buffer:void 0,CJ0=yR?yR.isBuffer:void 0,zY=CJ0||jJ0,OJ0="[object Arguments]",mJ0="[object Array]",SJ0="[object Boolean]",RJ0="[object Date]",IJ0="[object Error]",TJ0="[object Function]",vJ0="[object Map]",AJ0="[object Number]",EJ0="[object Object]",fJ0="[object RegExp]",kJ0="[object Set]",cJ0="[object String]",bJ0="[object WeakMap]",pJ0="[object ArrayBuffer]",yJ0="[object DataView]",uJ0="[object Float32Array]",hJ0="[object Float64Array]",gJ0="[object Int8Array]",iJ0="[object Int16Array]",dJ0="[object Int32Array]",lJ0="[object Uint8Array]",oJ0="[object Uint8ClampedArray]",sJ0="[object Uint16Array]",nJ0="[object Uint32Array]",$2={};$2[uJ0]=$2[hJ0]=$2[gJ0]=$2[iJ0]=$2[dJ0]=$2[lJ0]=$2[oJ0]=$2[sJ0]=$2[nJ0]=!0;$2[OJ0]=$2[mJ0]=$2[pJ0]=$2[SJ0]=$2[yJ0]=$2[RJ0]=$2[IJ0]=$2[TJ0]=$2[vJ0]=$2[AJ0]=$2[EJ0]=$2[fJ0]=$2[kJ0]=$2[cJ0]=$2[bJ0]=!1;function aJ0(Z){return S5(Z)&&xH(Z.length)&&!!$2[MZ(Z)]}function $H(Z){return function(J){return Z(J)}}var YT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,_Q=YT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,rJ0=_Q&&_Q.exports===YT,UU=rJ0&&sI.process,qZ=function(){try{var Z=_Q&&_Q.require&&_Q.require("util").types;return Z||UU&&UU.binding&&UU.binding("util")}catch{}}(),uR=qZ&&qZ.isTypedArray,$T=uR?$H(uR):aJ0,tJ0=Object.prototype,eJ0=tJ0.hasOwnProperty;function KT(Z,J){var Q=R3(Z),X=!Q&&YH(Z),x=!Q&&!X&&zY(Z),q=!Q&&!X&&!x&&$T(Z),Y=Q||X||x||q,$=Y?NJ0(Z.length,String):[],z=$.length;for(var W in Z)(J||eJ0.call(Z,W))&&!(Y&&(W=="length"||x&&(W=="offset"||W=="parent")||q&&(W=="buffer"||W=="byteLength"||W=="byteOffset")||JT(W,z)))&&$.push(W);return $}function zT(Z,J){return function(Q){return Z(J(Q))}}var ZQ0=zT(Object.keys,Object),JQ0=Object.prototype,QQ0=JQ0.hasOwnProperty;function XQ0(Z){if(!qH(Z))return ZQ0(Z);var J=[];for(var Q in Object(Z))QQ0.call(Z,Q)&&Q!="constructor"&&J.push(Q);return J}function sQ(Z){return OY(Z)?KT(Z):XQ0(Z)}function xQ0(Z){var J=[];if(Z!=null)for(var Q in Object(Z))J.push(Q);return J}var qQ0=Object.prototype,YQ0=qQ0.hasOwnProperty;function $Q0(Z){if(!DZ(Z))return xQ0(Z);var J=qH(Z),Q=[];for(var X in Z)X=="constructor"&&(J||!YQ0.call(Z,X))||Q.push(X);return Q}function KH(Z){return OY(Z)?KT(Z,!0):$Q0(Z)}var KQ0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zQ0=/^\w*$/;function zH(Z,J){if(R3(Z))return!1;var Q=typeof Z;return Q=="number"||Q=="symbol"||Q=="boolean"||Z==null||QH(Z)?!0:zQ0.test(Z)||!KQ0.test(Z)||J!=null&&(Z in Object(J))}var OQ=d7(Object,"create");function WQ0(){this.__data__=OQ?OQ(null):{},this.size=0}function VQ0(Z){var J=this.has(Z)&&delete this.__data__[Z];return this.size-=J?1:0,J}var UQ0="__lodash_hash_undefined__",HQ0=Object.prototype,GQ0=HQ0.hasOwnProperty;function BQ0(Z){var J=this.__data__;if(OQ){var Q=J[Z];return Q===UQ0?void 0:Q}return GQ0.call(J,Z)?J[Z]:void 0}var MQ0=Object.prototype,DQ0=MQ0.hasOwnProperty;function FQ0(Z){var J=this.__data__;return OQ?J[Z]!==void 0:DQ0.call(J,Z)}var NQ0="__lodash_hash_undefined__";function wQ0(Z,J){var Q=this.__data__;return this.size+=this.has(Z)?0:1,Q[Z]=OQ&&J===void 0?NQ0:J,this}function c7(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}c7.prototype.clear=WQ0;c7.prototype.delete=VQ0;c7.prototype.get=BQ0;c7.prototype.has=FQ0;c7.prototype.set=wQ0;function _Q0(){this.__data__=[],this.size=0}function mY(Z,J){for(var Q=Z.length;Q--;)if(XH(Z[Q][0],J))return Q;return-1}var PQ0=Array.prototype,jQ0=PQ0.splice;function LQ0(Z){var J=this.__data__,Q=mY(J,Z);if(Q<0)return!1;var X=J.length-1;return Q==X?J.pop():jQ0.call(J,Q,1),--this.size,!0}function CQ0(Z){var J=this.__data__,Q=mY(J,Z);return Q<0?void 0:J[Q][1]}function OQ0(Z){return mY(this.__data__,Z)>-1}function mQ0(Z,J){var Q=this.__data__,X=mY(Q,Z);return X<0?(++this.size,Q.push([Z,J])):Q[X][1]=J,this}function g6(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}g6.prototype.clear=_Q0;g6.prototype.delete=LQ0;g6.prototype.get=CQ0;g6.prototype.has=OQ0;g6.prototype.set=mQ0;var mQ=d7(X6,"Map");function SQ0(){this.size=0,this.__data__={hash:new c7,map:new(mQ||g6),string:new c7}}function RQ0(Z){var J=typeof Z;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?Z!=="__proto__":Z===null}function SY(Z,J){var Q=Z.__data__;return RQ0(J)?Q[typeof J=="string"?"string":"hash"]:Q.map}function IQ0(Z){var J=SY(this,Z).delete(Z);return this.size-=J?1:0,J}function TQ0(Z){return SY(this,Z).get(Z)}function vQ0(Z){return SY(this,Z).has(Z)}function AQ0(Z,J){var Q=SY(this,Z),X=Q.size;return Q.set(Z,J),this.size+=Q.size==X?0:1,this}function i6(Z){var J=-1,Q=Z==null?0:Z.length;for(this.clear();++J<Q;){var X=Z[J];this.set(X[0],X[1])}}i6.prototype.clear=SQ0;i6.prototype.delete=IQ0;i6.prototype.get=TQ0;i6.prototype.has=vQ0;i6.prototype.set=AQ0;var EQ0="Expected a function";function WH(Z,J){if(typeof Z!="function"||J!=null&&typeof J!="function")throw new TypeError(EQ0);var Q=function(){var X=arguments,x=J?J.apply(this,X):X[0],q=Q.cache;if(q.has(x))return q.get(x);var Y=Z.apply(this,X);return Q.cache=q.set(x,Y)||q,Y};return Q.cache=new(WH.Cache||i6),Q}WH.Cache=i6;var fQ0=500;function kQ0(Z){var J=WH(Z,function(X){return Q.size===fQ0&&Q.clear(),X}),Q=J.cache;return J}var cQ0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bQ0=/\\(\\)?/g,pQ0=kQ0(function(Z){var J=[];return Z.charCodeAt(0)===46&&J.push(""),Z.replace(cQ0,function(Q,X,x,q){J.push(x?q.replace(bQ0,"$1"):X||Q)}),J});function WT(Z){return Z==null?"":rI(Z)}function VT(Z,J){return R3(Z)?Z:zH(Z,J)?[Z]:pQ0(WT(Z))}function RY(Z){if(typeof Z=="string"||QH(Z))return Z;var J=Z+"";return J=="0"&&1/Z==-1/0?"-0":J}function UT(Z,J){J=VT(J,Z);for(var Q=0,X=J.length;Z!=null&&Q<X;)Z=Z[RY(J[Q++])];return Q&&Q==X?Z:void 0}function yQ0(Z,J,Q){var X=Z==null?void 0:UT(Z,J);return X===void 0?Q:X}function VH(Z,J){for(var Q=-1,X=J.length,x=Z.length;++Q<X;)Z[x+Q]=J[Q];return Z}var hR=Q8?Q8.isConcatSpreadable:void 0;function uQ0(Z){return R3(Z)||YH(Z)||!!(hR&&Z&&Z[hR])}function IY(Z,J,Q,X,x){var q=-1,Y=Z.length;for(Q||(Q=uQ0),x||(x=[]);++q<Y;){var $=Z[q];J>0&&Q($)?J>1?IY($,J-1,Q,X,x):VH(x,$):x[x.length]=$}return x}function HT(Z){var J=Z==null?0:Z.length;return J?IY(Z,1):[]}var GT=zT(Object.getPrototypeOf,Object);function hQ0(Z,J,Q){var X=-1,x=Z.length;J<0&&(J=-J>x?0:x+J),Q=Q>x?x:Q,Q<0&&(Q+=x),x=J>Q?0:Q-J>>>0,J>>>=0;for(var q=Array(x);++X<x;)q[X]=Z[X+J];return q}function gQ0(Z,J,Q){var X=Z.length;return Q=Q===void 0?X:Q,!J&&Q>=X?Z:hQ0(Z,J,Q)}var iQ0="\\ud800-\\udfff",dQ0="\\u0300-\\u036f",lQ0="\\ufe20-\\ufe2f",oQ0="\\u20d0-\\u20ff",sQ0=dQ0+lQ0+oQ0,nQ0="\\ufe0e\\ufe0f",aQ0="\\u200d",rQ0=RegExp("["+aQ0+iQ0+sQ0+nQ0+"]");function BT(Z){return rQ0.test(Z)}function tQ0(Z){return Z.split("")}var MT="\\ud800-\\udfff",eQ0="\\u0300-\\u036f",ZX0="\\ufe20-\\ufe2f",JX0="\\u20d0-\\u20ff",QX0=eQ0+ZX0+JX0,XX0="\\ufe0e\\ufe0f",xX0="["+MT+"]",mU="["+QX0+"]",SU="\\ud83c[\\udffb-\\udfff]",qX0="(?:"+mU+"|"+SU+")",DT="[^"+MT+"]",FT="(?:\\ud83c[\\udde6-\\uddff]){2}",NT="[\\ud800-\\udbff][\\udc00-\\udfff]",YX0="\\u200d",wT=qX0+"?",_T="["+XX0+"]?",$X0="(?:"+YX0+"(?:"+[DT,FT,NT].join("|")+")"+_T+wT+")*",KX0=_T+wT+$X0,zX0="(?:"+[DT+mU+"?",mU,FT,NT,xX0].join("|")+")",WX0=RegExp(SU+"(?="+SU+")|"+zX0+KX0,"g");function VX0(Z){return Z.match(WX0)||[]}function UX0(Z){return BT(Z)?VX0(Z):tQ0(Z)}function HX0(Z){return function(J){J=WT(J);var Q=BT(J)?UX0(J):void 0,X=Q?Q[0]:J.charAt(0),x=Q?gQ0(Q,1).join(""):J.slice(1);return X[Z]()+x}}var QZ=HX0("toUpperCase");function GX0(){this.__data__=new g6,this.size=0}function BX0(Z){var J=this.__data__,Q=J.delete(Z);return this.size=J.size,Q}function MX0(Z){return this.__data__.get(Z)}function DX0(Z){return this.__data__.has(Z)}var FX0=200;function NX0(Z,J){var Q=this.__data__;if(Q instanceof g6){var X=Q.__data__;if(!mQ||X.length<FX0-1)return X.push([Z,J]),this.size=++Q.size,this;Q=this.__data__=new i6(X)}return Q.set(Z,J),this.size=Q.size,this}function r8(Z){var J=this.__data__=new g6(Z);this.size=J.size}r8.prototype.clear=GX0;r8.prototype.delete=BX0;r8.prototype.get=MX0;r8.prototype.has=DX0;r8.prototype.set=NX0;function wX0(Z,J){return Z&&CY(J,sQ(J),Z)}function _X0(Z,J){return Z&&CY(J,KH(J),Z)}var PT=typeof e8=="object"&&e8&&!e8.nodeType&&e8,gR=PT&&typeof Z8=="object"&&Z8&&!Z8.nodeType&&Z8,PX0=gR&&gR.exports===PT,iR=PX0?X6.Buffer:void 0,dR=iR?iR.allocUnsafe:void 0;function jX0(Z,J){if(J)return Z.slice();var Q=Z.length,X=dR?dR(Q):new Z.constructor(Q);return Z.copy(X),X}function LX0(Z,J){for(var Q=-1,X=Z==null?0:Z.length,x=0,q=[];++Q<X;){var Y=Z[Q];J(Y,Q,Z)&&(q[x++]=Y)}return q}function jT(){return[]}var CX0=Object.prototype,OX0=CX0.propertyIsEnumerable,lR=Object.getOwnPropertySymbols,UH=lR?function(Z){return Z==null?[]:(Z=Object(Z),LX0(lR(Z),function(J){return OX0.call(Z,J)}))}:jT;function mX0(Z,J){return CY(Z,UH(Z),J)}var SX0=Object.getOwnPropertySymbols,LT=SX0?function(Z){for(var J=[];Z;)VH(J,UH(Z)),Z=GT(Z);return J}:jT;function RX0(Z,J){return CY(Z,LT(Z),J)}function CT(Z,J,Q){var X=J(Z);return R3(Z)?X:VH(X,Q(Z))}function RU(Z){return CT(Z,sQ,UH)}function IX0(Z){return CT(Z,KH,LT)}var IU=d7(X6,"DataView"),TU=d7(X6,"Promise"),XZ=d7(X6,"Set"),oR="[object Map]",TX0="[object Object]",sR="[object Promise]",nR="[object Set]",aR="[object WeakMap]",rR="[object DataView]",vX0=i7(IU),AX0=i7(mQ),EX0=i7(TU),fX0=i7(XZ),kX0=i7(OU),m8=MZ;(IU&&m8(new IU(new ArrayBuffer(1)))!=rR||mQ&&m8(new mQ)!=oR||TU&&m8(TU.resolve())!=sR||XZ&&m8(new XZ)!=nR||OU&&m8(new OU)!=aR)&&(m8=function(Z){var J=MZ(Z),Q=J==TX0?Z.constructor:void 0,X=Q?i7(Q):"";if(X)switch(X){case vX0:return rR;case AX0:return oR;case EX0:return sR;case fX0:return nR;case kX0:return aR}return J});var cX0=Object.prototype,bX0=cX0.hasOwnProperty;function pX0(Z){var J=Z.length,Q=new Z.constructor(J);return J&&typeof Z[0]=="string"&&bX0.call(Z,"index")&&(Q.index=Z.index,Q.input=Z.input),Q}var WY=X6.Uint8Array;function HH(Z){var J=new Z.constructor(Z.byteLength);return new WY(J).set(new WY(Z)),J}function yX0(Z,J){var Q=J?HH(Z.buffer):Z.buffer;return new Z.constructor(Q,Z.byteOffset,Z.byteLength)}var uX0=/\w*$/;function hX0(Z){var J=new Z.constructor(Z.source,uX0.exec(Z));return J.lastIndex=Z.lastIndex,J}var tR=Q8?Q8.prototype:void 0,eR=tR?tR.valueOf:void 0;function gX0(Z){return eR?Object(eR.call(Z)):{}}function iX0(Z,J){var Q=J?HH(Z.buffer):Z.buffer;return new Z.constructor(Q,Z.byteOffset,Z.length)}var dX0="[object Boolean]",lX0="[object Date]",oX0="[object Map]",sX0="[object Number]",nX0="[object RegExp]",aX0="[object Set]",rX0="[object String]",tX0="[object Symbol]",eX0="[object ArrayBuffer]",Zx0="[object DataView]",Jx0="[object Float32Array]",Qx0="[object Float64Array]",Xx0="[object Int8Array]",xx0="[object Int16Array]",qx0="[object Int32Array]",Yx0="[object Uint8Array]",$x0="[object Uint8ClampedArray]",Kx0="[object Uint16Array]",zx0="[object Uint32Array]";function Wx0(Z,J,Q){var X=Z.constructor;switch(J){case eX0:return HH(Z);case dX0:case lX0:return new X(+Z);case Zx0:return yX0(Z,Q);case Jx0:case Qx0:case Xx0:case xx0:case qx0:case Yx0:case $x0:case Kx0:case zx0:return iX0(Z,Q);case oX0:return new X;case sX0:case rX0:return new X(Z);case nX0:return hX0(Z);case aX0:return new X;case tX0:return gX0(Z)}}function Vx0(Z){return typeof Z.constructor=="function"&&!qH(Z)?qJ0(GT(Z)):{}}var Ux0="[object Map]";function Hx0(Z){return S5(Z)&&m8(Z)==Ux0}var ZI=qZ&&qZ.isMap,Gx0=ZI?$H(ZI):Hx0,Bx0="[object Set]";function Mx0(Z){return S5(Z)&&m8(Z)==Bx0}var JI=qZ&&qZ.isSet,Dx0=JI?$H(JI):Mx0,Fx0=1,Nx0=2,wx0=4,OT="[object Arguments]",_x0="[object Array]",Px0="[object Boolean]",jx0="[object Date]",Lx0="[object Error]",mT="[object Function]",Cx0="[object GeneratorFunction]",Ox0="[object Map]",mx0="[object Number]",ST="[object Object]",Sx0="[object RegExp]",Rx0="[object Set]",Ix0="[object String]",Tx0="[object Symbol]",vx0="[object WeakMap]",Ax0="[object ArrayBuffer]",Ex0="[object DataView]",fx0="[object Float32Array]",kx0="[object Float64Array]",cx0="[object Int8Array]",bx0="[object Int16Array]",px0="[object Int32Array]",yx0="[object Uint8Array]",ux0="[object Uint8ClampedArray]",hx0="[object Uint16Array]",gx0="[object Uint32Array]",t1={};t1[OT]=t1[_x0]=t1[Ax0]=t1[Ex0]=t1[Px0]=t1[jx0]=t1[fx0]=t1[kx0]=t1[cx0]=t1[bx0]=t1[px0]=t1[Ox0]=t1[mx0]=t1[ST]=t1[Sx0]=t1[Rx0]=t1[Ix0]=t1[Tx0]=t1[yx0]=t1[ux0]=t1[hx0]=t1[gx0]=!0;t1[Lx0]=t1[mT]=t1[vx0]=!1;function PQ(Z,J,Q,X,x,q){var Y,$=J&Fx0,z=J&Nx0,W=J&wx0;if(Y!==void 0)return Y;if(!DZ(Z))return Z;var U=R3(Z);if(U){if(Y=pX0(Z),!$)return $J0(Z,Y)}else{var H=m8(Z),B=H==mT||H==Cx0;if(zY(Z))return jX0(Z,$);if(H==ST||H==OT||B&&!x){if(Y=z||B?{}:Vx0(Z),!$)return z?RX0(Z,_X0(Y,Z)):mX0(Z,wX0(Y,Z))}else{if(!t1[H])return x?Z:{};Y=Wx0(Z,H,$)}}q||(q=new r8);var M=q.get(Z);if(M)return M;q.set(Z,Y),Dx0(Z)?Z.forEach(function(_){Y.add(PQ(_,J,Q,_,Z,q))}):Gx0(Z)&&Z.forEach(function(_,j){Y.set(j,PQ(_,J,Q,j,Z,q))});var D=W?z?IX0:RU:z?KH:sQ,N=U?void 0:D(Z);return ZT(N||Z,function(_,j){N&&(j=_,_=Z[j]),XT(Y,j,PQ(_,J,Q,j,Z,q))}),Y}var ix0=4;function l7(Z){return PQ(Z,ix0)}var dx0=1,lx0=4;function ox0(Z){return PQ(Z,dx0|lx0)}function GH(Z){for(var J=-1,Q=Z==null?0:Z.length,X=0,x=[];++J<Q;){var q=Z[J];q&&(x[X++]=q)}return x}var sx0="__lodash_hash_undefined__";function nx0(Z){return this.__data__.set(Z,sx0),this}function ax0(Z){return this.__data__.has(Z)}function SQ(Z){var J=-1,Q=Z==null?0:Z.length;for(this.__data__=new i6;++J<Q;)this.add(Z[J])}SQ.prototype.add=SQ.prototype.push=nx0;SQ.prototype.has=ax0;function rx0(Z,J){for(var Q=-1,X=Z==null?0:Z.length;++Q<X;)if(J(Z[Q],Q,Z))return!0;return!1}function RT(Z,J){return Z.has(J)}var tx0=1,ex0=2;function IT(Z,J,Q,X,x,q){var Y=Q&tx0,$=Z.length,z=J.length;if($!=z&&!(Y&&z>$))return!1;var W=q.get(Z),U=q.get(J);if(W&&U)return W==J&&U==Z;var H=-1,B=!0,M=Q&ex0?new SQ:void 0;for(q.set(Z,J),q.set(J,Z);++H<$;){var D=Z[H],N=J[H];if(X)var _=Y?X(N,D,H,J,Z,q):X(D,N,H,Z,J,q);if(_!==void 0){if(_)continue;B=!1;break}if(M){if(!rx0(J,function(j,O){if(!RT(M,O)&&(D===j||x(D,j,Q,X,q)))return M.push(O)})){B=!1;break}}else if(!(D===N||x(D,N,Q,X,q))){B=!1;break}}return q.delete(Z),q.delete(J),B}function Zq0(Z){var J=-1,Q=Array(Z.size);return Z.forEach(function(X,x){Q[++J]=[x,X]}),Q}function BH(Z){var J=-1,Q=Array(Z.size);return Z.forEach(function(X){Q[++J]=X}),Q}var Jq0=1,Qq0=2,Xq0="[object Boolean]",xq0="[object Date]",qq0="[object Error]",Yq0="[object Map]",$q0="[object Number]",Kq0="[object RegExp]",zq0="[object Set]",Wq0="[object String]",Vq0="[object Symbol]",Uq0="[object ArrayBuffer]",Hq0="[object DataView]",QI=Q8?Q8.prototype:void 0,HU=QI?QI.valueOf:void 0;function Gq0(Z,J,Q,X,x,q,Y){switch(Q){case Hq0:if(Z.byteLength!=J.byteLength||Z.byteOffset!=J.byteOffset)return!1;Z=Z.buffer,J=J.buffer;case Uq0:return!(Z.byteLength!=J.byteLength||!q(new WY(Z),new WY(J)));case Xq0:case xq0:case $q0:return XH(+Z,+J);case qq0:return Z.name==J.name&&Z.message==J.message;case Kq0:case Wq0:return Z==J+"";case Yq0:var $=Zq0;case zq0:var z=X&Jq0;if($||($=BH),Z.size!=J.size&&!z)return!1;var W=Y.get(Z);if(W)return W==J;X|=Qq0,Y.set(Z,J);var U=IT($(Z),$(J),X,x,q,Y);return Y.delete(Z),U;case Vq0:if(HU)return HU.call(Z)==HU.call(J)}return!1}var Bq0=1,Mq0=Object.prototype,Dq0=Mq0.hasOwnProperty;function Fq0(Z,J,Q,X,x,q){var Y=Q&Bq0,$=RU(Z),z=$.length,W=RU(J),U=W.length;if(z!=U&&!Y)return!1;for(var H=z;H--;){var B=$[H];if(!(Y?B in J:Dq0.call(J,B)))return!1}var M=q.get(Z),D=q.get(J);if(M&&D)return M==J&&D==Z;var N=!0;q.set(Z,J),q.set(J,Z);for(var _=Y;++H<z;){B=$[H];var j=Z[B],O=J[B];if(X)var A=Y?X(O,j,B,J,Z,q):X(j,O,B,Z,J,q);if(!(A===void 0?j===O||x(j,O,Q,X,q):A)){N=!1;break}_||(_=B=="constructor")}if(N&&!_){var h=Z.constructor,u=J.constructor;h!=u&&"constructor"in Z&&"constructor"in J&&!(typeof h=="function"&&h instanceof h&&typeof u=="function"&&u instanceof u)&&(N=!1)}return q.delete(Z),q.delete(J),N}var Nq0=1,XI="[object Arguments]",xI="[object Array]",JY="[object Object]",wq0=Object.prototype,qI=wq0.hasOwnProperty;function _q0(Z,J,Q,X,x,q){var Y=R3(Z),$=R3(J),z=Y?xI:m8(Z),W=$?xI:m8(J);z=z==XI?JY:z,W=W==XI?JY:W;var U=z==JY,H=W==JY,B=z==W;if(B&&zY(Z)){if(!zY(J))return!1;Y=!0,U=!1}if(B&&!U)return q||(q=new r8),Y||$T(Z)?IT(Z,J,Q,X,x,q):Gq0(Z,J,z,Q,X,x,q);if(!(Q&Nq0)){var M=U&&qI.call(Z,"__wrapped__"),D=H&&qI.call(J,"__wrapped__");if(M||D){var N=M?Z.value():Z,_=D?J.value():J;return q||(q=new r8),x(N,_,Q,X,q)}}return B?(q||(q=new r8),Fq0(Z,J,Q,X,x,q)):!1}function MH(Z,J,Q,X,x){return Z===J?!0:Z==null||J==null||!S5(Z)&&!S5(J)?Z!==Z&&J!==J:_q0(Z,J,Q,X,MH,x)}var Pq0=1,jq0=2;function Lq0(Z,J,Q,X){var x=Q.length,q=x;if(Z==null)return!q;for(Z=Object(Z);x--;){var Y=Q[x];if(Y[2]?Y[1]!==Z[Y[0]]:!(Y[0]in Z))return!1}for(;++x<q;){Y=Q[x];var $=Y[0],z=Z[$],W=Y[1];if(Y[2]){if(z===void 0&&!($ in Z))return!1}else{var U=new r8,H;if(!(H===void 0?MH(W,z,Pq0|jq0,X,U):H))return!1}}return!0}function TT(Z){return Z===Z&&!DZ(Z)}function Cq0(Z){for(var J=sQ(Z),Q=J.length;Q--;){var X=J[Q],x=Z[X];J[Q]=[X,x,TT(x)]}return J}function vT(Z,J){return function(Q){return Q==null?!1:Q[Z]===J&&(J!==void 0||(Z in Object(Q)))}}function Oq0(Z){var J=Cq0(Z);return J.length==1&&J[0][2]?vT(J[0][0],J[0][1]):function(Q){return Q===Z||Lq0(Q,Z,J)}}function mq0(Z,J){return Z!=null&&J in Object(Z)}function Sq0(Z,J,Q){J=VT(J,Z);for(var X=-1,x=J.length,q=!1;++X<x;){var Y=RY(J[X]);if(!(q=Z!=null&&Q(Z,Y)))break;Z=Z[Y]}return q||++X!=x?q:(x=Z==null?0:Z.length,!!x&&xH(x)&&JT(Y,x)&&(R3(Z)||YH(Z)))}function Rq0(Z,J){return Z!=null&&Sq0(Z,J,mq0)}var Iq0=1,Tq0=2;function vq0(Z,J){return zH(Z)&&TT(J)?vT(RY(Z),J):function(Q){var X=yQ0(Q,Z);return X===void 0&&X===J?Rq0(Q,Z):MH(J,X,Iq0|Tq0)}}function Aq0(Z){return function(J){return J==null?void 0:J[Z]}}function Eq0(Z){return function(J){return UT(J,Z)}}function fq0(Z){return zH(Z)?Aq0(RY(Z)):Eq0(Z)}function AT(Z){return typeof Z=="function"?Z:Z==null?tI:typeof Z=="object"?R3(Z)?vq0(Z[0],Z[1]):Oq0(Z):fq0(Z)}function kq0(Z){return function(J,Q,X){for(var x=-1,q=Object(J),Y=X(J),$=Y.length;$--;){var z=Y[++x];if(Q(q[z],z,q)===!1)break}return J}}var cq0=kq0();function bq0(Z,J){return Z&&cq0(Z,J,sQ)}function pq0(Z,J){return function(Q,X){if(Q==null)return Q;if(!OY(Q))return Z(Q,X);for(var x=Q.length,q=-1,Y=Object(Q);++q<x&&X(Y[q],q,Y)!==!1;);return Q}}var ET=pq0(bq0);function yq0(Z,J,Q){for(var X=-1,x=Z==null?0:Z.length;++X<x;)if(Q(J,Z[X]))return!0;return!1}function f5(Z){var J=Z==null?0:Z.length;return J?Z[J-1]:void 0}function uq0(Z){return typeof Z=="function"?Z:tI}function hq0(Z,J){var Q=R3(Z)?ZT:ET;return Q(Z,uq0(J))}function gq0(Z,J){var Q=-1,X=OY(Z)?Array(Z.length):[];return ET(Z,function(x,q,Y){X[++Q]=J(x,q,Y)}),X}function iq0(Z,J){var Q=R3(Z)?aI:gq0;return Q(Z,AT(J))}function dq0(Z,J){return IY(iq0(Z,J),1)}var lq0=1/0;function oq0(Z){var J=Z==null?0:Z.length;return J?IY(Z,lq0):[]}var sq0=1/0,nq0=XZ&&1/BH(new XZ([,-0]))[1]==sq0?function(Z){return new XZ(Z)}:YJ0,aq0=200;function DH(Z,J,Q){var X=-1,x=UJ0,q=Z.length,Y=!0,$=[],z=$;if(Q)Y=!1,x=yq0;else if(q>=aq0){var W=J?null:nq0(Z);if(W)return BH(W);Y=!1,x=RT,z=new SQ}else z=J?[]:$;Z:for(;++X<q;){var U=Z[X],H=J?J(U):U;if(U=Q||U!==0?U:0,Y&&H===H){for(var B=z.length;B--;)if(z[B]===H)continue Z;J&&z.push(H),$.push(U)}else x(z,H,Q)||(z!==$&&z.push(H),$.push(U))}return $}function rq0(Z){return Z&&Z.length?DH(Z):[]}function FH(Z,J){return Z&&Z.length?DH(Z,AT(J)):[]}function NH(Z,J){return J=typeof J=="function"?J:void 0,Z&&Z.length?DH(Z,void 0,J):[]}var g1=((Z)=>(Z.Warning="Warning",Z.Error="Error",Z.Suggestion="Suggestion",Z))(g1||{});function tq0(Z){return Z}var k={SyntaxError:{code:1000,category:"Error",message:"'{0}' expected."},WrongArgumentNumber:{code:2000,category:"Error",message:"Expected {0} arguments, but got {1}."},MissingTraitMethod:{code:2001,category:"Error",message:"Method '{0}' is missing on impl but required on trait '{1}'."},DuplicatedName:{code:2002,category:"Error",message:"Duplicated name '{0}'."},NonExistentName:{code:2003,category:"Error",message:"Cannot find name '{0}'."},TakenOptionValue:{code:2004,category:"Error",message:"'{0}' is either a reserved value or already used value."},ExpectedThings:{code:2005,category:"Error",message:"Expected {0}."},ModuleNoMember:{code:2006,category:"Error",message:"Module '{0}' has no item '{1}'"},ExpressionNotCallable:{code:2007,category:"Error",message:"The expression is not callable. Type '{0}' has no call signatures."},UnexpectedArgumentExpression:{code:2008,category:"Error",message:"Unexpected argument expression."},CannotAssignTwiceToImmutableVariable:{code:2009,category:"Error",message:"Cannot assign twice to immutable variable '{0}'"},LhsAssignmentExprMustBeName:{code:2010,category:"Error",message:"The left-hand sign of an assignment expression must be name."},UnexpectedThings:{code:2011,category:"Error",message:"Unexpected {0}."},BlockScopedVariableUsedBeforeDefined:{code:2012,category:"Error",message:"Block-scoped variable '{0}' used before its declaration."},InvalidTypeBody:{code:2013,category:"Error",message:"Invalid type's body."},InvalidTypeProperty:{code:2014,category:"Error",message:"Invalid type's property."},ExpectedOperator:{code:2015,category:"Error",message:"Expected '{0}' operator."},DuplicatedNameInModuleScope:{code:2016,category:"Error",message:"Duplicated name '{0}' ({1})."},InvalidDirectFileInModule:{code:2017,category:"Error",message:"Files reside directly in 'modules' directory is not allowed. Please put them in subdirectories instead."},PositionalArgumentAfterKeywordArgument:{code:2018,category:"Error",message:"Positional arguments should placed before keyword arguments."},PositionalAfterNamedArg:{code:2019,category:"Error",message:"Positional arguments must be placed before named arguments."},InvalidParameterName:{code:2020,category:"Error",message:"No parameter named '{0}' exists in function signature."},DuplicateArgument:{code:2021,category:"Error",message:"Parameter '{0}' is specified multiple times."},MissingRequiredParameter:{code:2022,category:"Error",message:"Required parameter '{0}' is missing."},ExpectedThingsWarning:{code:2023,category:"Warning",message:"Expected {0}."},MismatchedArgumentType:{code:3000,category:"Error",message:"Argument of type '{0}' is not assignable to parameter of type '{1}'."},MismatchedType:{code:3001,category:"Error",message:"Type '{0}' is not assignable to type '{1}'"},NonExistentProperty:{code:3002,category:"Error",message:"Property '{0}' does not exist on type '{1}'."},MissingPropertyOnElement:{code:3003,category:"Error",message:"Property '{0}' is missing on element but required on type '{1}'."},InvalidProperty:{code:3004,category:"Error",message:"Invalid property '{0}'"},PrefixOperatorCannotAppliedForType:{code:3005,category:"Error",message:"Prefix operator '{0}' cannot be applied to type '{1}'."},OperatorCannotAppliedForTypes:{code:3006,category:"Error",message:"Operator '{0}' cannot be applied for type '{1}' and '{2}'"},DuplicatedPropertyOrMethod:{code:3007,category:"Error",message:"Type '{0}' already had '{1}' property or method."},CannotResolveExpressionToType:{code:3008,category:"Error",message:"Cannot resolve this expression to a type."},MismatchElementUnionType:{code:3009,category:"Error",message:"This element does not match with type '{0}'."},MoreThanOneDynamicElement:{code:3010,category:"Error",message:"Can only have one '{0}' dynamic element."},StatementMustBeDeclaredAtTopModule:{code:3011,category:"Error",message:"{0} must be declared at the top of module."},IncompatibleRule:{code:3012,category:"Error",message:"Incompatible rule '{0}.'"},IncompatibleProperty:{code:3013,category:"Error",message:"Incompatible property '{0}'."},ExpectedType:{code:3014,category:"Error",message:"Expected type '{0}', found '{1}'."},MismatchedFunctionReturnType:{code:3015,category:"Error",message:"Mismatch function's return type."},MismatchedRuleValueType:{code:3016,category:"Error",message:"Mismatch rule's value type."},InvalidThings:{code:3017,category:"Error",message:"Invalid {0}."},MissingThings:{code:3018,category:"Error",message:"Missing {0}."},NonExistentType:{code:3019,category:"Error",message:"Cannot find type '{0}'."},RecursiveType:{code:3020,category:"Error",message:"Type '{0}' circularly references itself."},IncompatiblePropertyOfType:{code:3021,category:"Error",message:"Incompatible property '{0}' of '{1}'."},TypeIsUsedAsValue:{code:3022,category:"Error",message:"'{0}' refers to a type, but is being used as a value here"},NonExistentNameInModule:{code:3023,category:"Error",message:"Cannot find name '{0}' in module '{1}'."},UnresolvedModuleExpression:{code:3024,category:"Error",message:"Cannot resolve this expression to module."},ValueIsUsedAsType:{code:3025,category:"Error",message:"'{0}' refers to a value, but is being used as a type here."},NonExistentNameInRootModule:{code:3026,category:"Error",message:"Cannot find name '{0}' in root module."},InvalidOperator:{code:3027,category:"Error",message:"Invalid operator '{0}'."},CustomTypeError:{code:3028,category:"Error",message:"{0}"},CustomTypeWarning:{code:3029,category:"Warning",message:"{0}"},MissingTypeArguments:{code:3030,category:"Error",message:"Type {0} requires {1} type arguments."},GenericTypeNeedTypeArgument:{code:3031,category:"Error",message:"Generic type '{0}' needs {1} type argument(s)."},PartialTypeNonApplicable:{code:3032,category:"Error",message:"Partial cannot be used with '{0}'."},SlotTypeNonApplicable:{code:3033,category:"Error",message:"Slot cannot be used with '{0}'."},NonExistentDecorator:{code:3034,category:"Error",message:"Cannot find decorator '{0}'."},CannotApplyDecorator:{code:3035,category:"Error",message:"Cannot apply decorator '{0}' on '{1}'."},DoubleSpacesInTagName:{code:3036,category:"Error",message:"Double spaces are not allowed in tag name."},LeadingTrailingSpacesInTagName:{code:3037,category:"Error",message:"Leading or trailing spaces are not allowed in tag name."},InvalidSpacingAroundSlashInTagName:{code:3038,category:"Error",message:"Invalid spacing around slash in tag name."},TooManySlashesInTagName:{code:3039,category:"Error",message:"Tag names can contain at most one slash."},InvalidParameterOrder:{code:3040,category:"Error",message:"Required parameters must come before optional parameters."},RuleRequiresRules:{code:3041,category:"Error",message:"Rule '{0}' requires rule(s) {1} to be enabled."},TagNameCannotBeEmpty:{code:3042,category:"Error",message:"Tag name cannot be empty or contain only whitespace."},CannotResolveRef:{code:3043,category:"Warning",message:"This reference cannot be statically verified - manual verification required."},AdhocError:{code:3044,category:"Error",message:"{0}"},ModuleCircularDependencies:{code:4000,category:"Error",message:"Circular dependencies detected at '{0}'."},MissingPropertiesForExtend:{code:4001,category:"Error",message:"Missing properties for the Extend function: {0}."},DatasetDimensionFieldNotFound:{code:4002,category:"Error",message:"Cannot find dimension field '{0}' in dataset '{1}'."},LoadFileError:{code:7000,category:"Error",message:"Cannot load file {0}."}};function Z6(Z,...J){return J.length===0?Z:Z.replace(/{(\d+)}/g,(Q,X)=>`${J[Number.parseInt(X,10)]}`)}var fT=class Z{constructor(J,Q,X,x){this.id=Z.idSeq,Z.idSeq+=1,this.message=J,this.category=Q,this.code=X,this.children=x}static create(J,...Q){return new Z(Z6(J.message,...Q),J.category,J.code)}static createChain(J,Q,...X){return new Z(Z6(J.message,...X),J.category,J.code,Q)}};fT.idSeq=0;var e1=fT;class l extends e1{constructor(Z,J,Q,X,x){super(J,Q,X,x),this.nodeId=Z}static createForNode(Z,J,...Q){return new l(Z,Z6(J.message,...Q),J.category,J.code)}static createChainForNode(Z,J,Q,...X){return new l(Z,Z6(J.message,...X),J.category,J.code,Q)}resolve(Z){let J=Z.nodeById(this.nodeId);if(!J)throw new Error("Expected node");let Q=w0.create(this.nodeId.filepath);if(!Q)throw new Error("Expected filepath");let{originalAst:X,transformedAst:x,transformedRanges:q}=Z.ast(Q).unwrap(),Y=X.getTokenStream(),$=x.getTokenStream(),z=J.getTokenStream(),W=z[0],U=z[z.length-1],H=$.findIndex((j)=>j===W),B=$.findIndex((j)=>j===U),M=H,D=B;for(let j of q){if(j.transformed[0]>B)break;j.transformed[0]<=H&&H<=j.transformed[1]?M-=H-j.transformed[0]:j.transformed[1]<H&&(M-=j.transformed[1]-j.transformed[0]+1-(j.original[1]-j.original[0]+1)),j.transformed[0]<=B&&B<=j.transformed[1]?D-=B-j.transformed[0]:j.transformed[1]<B&&(D-=j.transformed[1]-j.transformed[0]+1-(j.original[1]-j.original[0]+1))}let N=Y[M],_=Y[D];return new M1(this.message,this.category,this.code,Q,N.offset,_.offset+_.text.length,this.children)}}class M1 extends e1{constructor(Z,J,Q,X,x,q,Y){super(Z,J,Q,Y),this.file=X,this.start=x,this.end=q}static createWithLocation(Z,J,Q,X,...x){return new M1(Z6(X.message,...x),X.category,X.code,Z,J,Q)}static createChainWithLocation(Z,J,Q,X,x,...q){return new M1(Z6(X.message,...q),X.category,X.code,Z,J,Q,x)}}class S8{constructor(Z){this.nodeId=Z,this.key=this.toString()}get id(){return this.nodeId.id}toString(){return this.id.toString()}asInternKey(Z,J){return this.id}}var kT=class Z{constructor(){this.id=BigInt(0)<<BigInt(nH)|BigInt(Z.generatedIdSeq),Z.generatedIdSeq+=1}get key(){return this.id.toString()}toString(){return this.id.toString()}asInternKey(J,Q){return this.id}};kT.generatedIdSeq=0;var R8=kT;class TY{constructor(Z){this.moduleId=Z,this.key=this.toString()}toString(){return`symbol@${this.moduleId.key}`}asInternKey(Z,J){return this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internSymbolId(this),this.idVerifiedAt=Z.revision,this.id)}}var p=((Z)=>(Z.None="None",Z.BlockScopedVariable="BlockScopedVariable",Z.FunctionScopedVariable="FunctionScopedVariable",Z.Function="Function",Z.Method="Method",Z.MethodSignature="MethodSignature",Z.MethodSelf="MethodSelf",Z.TypeProperty="TypeProperty",Z.DynamicAttributes="DynamicAttributes",Z.DynamicAttributeProperty="DynamicAttributeProperty",Z.DynamicBody="DynamicBody",Z.DynamicTypeAs="DynamicTypeAs",Z.DynamicNameAs="DynamicNameAs",Z.ElementProperty="ElementProperty",Z.DefaultElementName="DefaultElementName",Z.Trait="Trait",Z.Type="Type",Z.Element="Element",Z.Ast="Ast",Z.Module="Module",Z.ModuleItem="ModuleItem",Z.ModuleItemAlias="ModuleItemAlias",Z.TypeAlias="TypeAlias",Z.BuiltInType="BuiltInType",Z.BuiltInProperty="BuiltInProperty",Z.BuiltInFunction="BuiltInFunction",Z.CompoundSymbol="CompoundSymbol",Z))(p||{});class nQ{constructor(Z,J,Q){this.id=Z,this.name=J,this.kind=Q}members(Z){var J;if((J=this.generatedProps)!=null&&J.members)return this.generatedProps.members;let Q=Z.members(this.id);if(Q.isOk())return Q.unwrap()}type(Z){var J;if((J=this.generatedProps)!=null&&J.type)return this.generatedProps.type;let Q=Z.typeOfSymbol(this.id);if(Q.isOk())return Q.unwrap()}ref(Z){var J;if((J=this.generatedProps)!=null&&J.ref)return this.generatedProps.ref;let Q=Z.symbolReference(this.id);if(Q.isOk())return Q.unwrap()}}class H0 extends nQ{constructor(Z,J,Q,X){super(Z,J,Q),this.declarationId=X}static createVoidSymbol(){let Z=new R8;return new H0(Z,"","None")}static createSymbol(Z,J,Q){let X=new S8(Q);return new H0(X,Z,J,Q)}static createGeneratedSymbol(Z,J,Q){let X=Q?new S8(Q):new R8,x=new H0(X,Z,J);return x.generatedProps={},X.symbol=x,x}}class YZ extends H0{constructor(Z,J,Q,X){super(Z,J,Q),this.symbols=X}static create(Z,J){let Q=new R8;return new YZ(Q,Z,"CompoundSymbol",J)}static createGeneratedCompoundSymbol(Z,J){let Q=new R8,X=new YZ(Q,Z,"CompoundSymbol",J);return X.generatedProps={},Q.symbol=X,X}}class q4 extends nQ{constructor(Z,J,Q){super(Z,J,"Module"),this.moduleId=Q}static createSymbol(Z,J){let Q=new TY(J);return new q4(Q,Z,J)}}var o7=((Z)=>(Z.Public="Public",Z.Private="Private",Z))(o7||{});class s2{constructor(Z){Z?this.table=Z:this.table=new Map}set(Z,J,Q="Public"){this.table.set(Z,{symbol:J,accessModifier:Q})}get(Z,J){return this.table.get(J)}has(Z,J){return this.table.has(J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.getEarlyBinding(Z)}forEach(Z,J){return this.table.forEach(Z,J)}merge(Z,J=["Public","Private"],Q){let X=x3(this.table,Z.table,(x)=>J.includes(x.accessModifier),Q);return Z instanceof J8&&J.includes("Private")?new J8(Z.file,X,Z.unresolvedModules):new s2(X)}}class J8{constructor(Z,J,Q){this.file=Z,this.table=J||new Map,this.unresolvedModules=Q||[]}set(Z,J,Q="Public"){this.table.set(Z,{symbol:J,accessModifier:Q})}get(Z,J){if(this.table.has(J))return this.table.get(J);let Q;for(let X of this.unresolvedModules){if(!X.includedFull)continue;let x=Z.symbolOfModulePath(X.node.id).chain((Y)=>Z.members(Y.id));if(x.isErr())continue;let q=x.unwrap();q.hasEarlyBinding(J)&&(Q=q.getEarlyBinding(J))}return Q}has(Z,J){return this.table.has(J)?!0:!!this.get(Z,J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.getEarlyBinding(Z)}forEachEarlyBinding(Z,J){return this.table.forEach(Z,J)}merge(Z,J=["Public","Private"],Q){let X=x3(this.table,Z.table,(x)=>J.includes(x.accessModifier),Q);if(J.includes("Private")){if(Z instanceof s2||Z instanceof k5)return new J8(this.file,X,this.unresolvedModules);if(Z instanceof J8)return new J8(this.file,X,this.unresolvedModules.concat(Z.unresolvedModules));throw new Error("Unreachable")}return new s2(X)}}class k5{constructor(){this.table=new Map,this.duplicatedTable=new Map}set(Z,J,Q="Public"){if(!this.table.has(Z)){this.table.set(Z,{symbol:J,accessModifier:Q});return}let X=this.duplicatedTable.get(Z)||[];X.push({symbol:J,accessModifier:Q}),this.duplicatedTable.set(Z,X)}get(Z,J){return this.table.get(J)}has(Z,J){return this.table.has(J)}getEarlyBinding(Z){return this.table.get(Z)}hasEarlyBinding(Z){return!!this.table.has(Z)}merge(Z,J=["Public","Private"]){return Z.table.forEach((Q,X)=>{J.includes(Q.accessModifier)&&this.set(X,Q.symbol,Q.accessModifier)}),this}}function Z2(Z,J){if(Z.kind!==t.ProductType)return Z;let Q=Z,X=J.length?l7(Q):Q;return X.typeArguments=J,X}function RQ(Z){var J;let Q=(J=Z.typeArguments)==null?void 0:J[0];if(!Q)throw new Error("Cannot get inner type of Slot");return Q}function YI(Z){var J;return(J=Z.typeArguments)==null?void 0:J[0]}function k6(Z){return Z.kind===t.UnionType?Z.types.some((J)=>k6(J)):b6(Z)}function cT(Z){if(!b6(Z))return!1;let J=RQ(Z);return J.kind===t.ProductType&&J.name==="TemplateString"}function eq0(Z){if(Z.kind!==t.ProductType||Z.name!=="Heredoc")return!1;let J=Z.typeArguments;return!J||J.length===0?!1:cT(J[0])}function R5(Z){return{kind:t.TypeVariable,name:Z}}function O5(Z,J,Q){return{...L1(J,Z),kind:t.LiteralType,value:Q}}function J3(Z,J,Q,X,x){return{kind:t.Signature,parameters:Z,returnType:J,symbol:X,members:Q.baseTypeMembers(),isBuiltIn:x}}function q8(Z,J){return Z=NH(bT(Z),(Q,X)=>u6(Q,X)),Z.length===1?Z[0]:{kind:t.UnionType,types:Z,origin:J}}function bT(Z){let J=[];return Z.forEach((Q)=>{Q.kind===t.UnionType?g(J,bT(Q.types)):J.push(Q)}),J}function T8(Z,J,Q,X){return{kind:t.ProductType,name:Q,members:x3(J.baseTypeMembers(),Z,void 0,(x,q,Y,$)=>{x.set($,Y)}),symbol:X}}function qY(Z,J,Q){return{kind:t.DynamicType,ruleset:Z,type:J,symbol:Q}}function jQ(Z,J,Q){return{kind:t.DynamicBodyType,type:Z,parentType:J,symbol:Q}}function I5(Z){return{kind:t.BlockType,blkId:Z.id}}function ZY0(Z,J=L1(Z,I0.Any),Q){let X=H0.createGeneratedSymbol("key",p.FunctionScopedVariable);X.generatedProps.type=L1(Z,I0.Any);let x=H0.createGeneratedSymbol("__call__",p.Method),q=J3([{symbol:X,type:L1(Z,I0.Any)}],J,Z);x.generatedProps.type=q;let Y=H0.createGeneratedSymbol("key",p.FunctionScopedVariable);Y.generatedProps.type=L1(Z,I0.String);let $=H0.createGeneratedSymbol("defaultValue",p.FunctionScopedVariable);$.generatedProps.type=L1(Z,I0.Any);let z=H0.createGeneratedSymbol("get",p.Method),W=J3([{symbol:Y,type:L1(Z,I0.String)},{symbol:$,type:L1(Z,I0.Any),hasDefaultValue:!0}],J,Z,z);z.generatedProps.type=W;let U=new Map;return U.set("__call__",{type:q,symbol:x}),U.set("get",{type:W,symbol:z}),T8(U,Z,"Dict",Q)}function aQ(Z,J=L1(Z,I0.Any),Q){let X=ZY0(Z,J,Q),x=R5("K"),q=R5("V");return Z2(X,[x,q])}function JY0(Z,J=L1(Z,I0.Any),Q){let X=H0.createGeneratedSymbol("idx",p.FunctionScopedVariable);X.generatedProps.type=L1(Z,I0.Number);let x=H0.createGeneratedSymbol("__call__",p.Method),q=J3([{symbol:X,type:L1(Z,I0.Any)}],J,Z);x.generatedProps.type=q;let Y=H0.createGeneratedSymbol("length",p.Method),$=L1(Z,I0.Number);Y.generatedProps.type=$;let z=H0.createGeneratedSymbol("idx",p.FunctionScopedVariable);z.generatedProps.type=L1(Z,I0.Number);let W=H0.createGeneratedSymbol("defaultValue",p.FunctionScopedVariable);W.generatedProps.type=L1(Z,I0.Any);let U=H0.createGeneratedSymbol("get",p.Method),H=J3([{symbol:z,type:L1(Z,I0.Number)},{symbol:W,type:L1(Z,I0.Any),hasDefaultValue:!0}],J,Z,U);U.generatedProps.type=H;let B=new Map;return B.set("__call__",{type:q,symbol:x}),B.set("get",{type:H,symbol:U}),B.set("length",{type:$,symbol:Y}),T8(B,Z,"List",Q)}function $Z(Z,J=L1(Z,I0.Any),Q){let X=JY0(Z,J,Q),x=R5("T");return Z2(X,[x])}function pT(Z,J){let Q=T8(new Map,Z,"Partial",J),X=R5("U");return Z2(Q,[X])}function yT(Z,J){let Q=T8(new Map,Z,"Slot",J),X=R5("U");return Z2(Q,[X])}function uT(Z,J){let Q=T8(new Map,Z,"AccessExpression",J),X=R5("T");return Z2(Q,[X])}function vU(Z){if(b6(Z))return vU(RQ(Z));if(eQ(Z)){let J=Z.types.map((Q)=>vU(Q));return q8(J)}return Z}function J6(Z,J){return b6(J)?J:Z2(l7(rQ(Z)),[vU(J)])}function hT(Z){let J=H0.createGeneratedSymbol("values",p.FunctionScopedVariable),Q=Z2(aQ(Z,L1(Z,I0.Any)),[L1(Z,I0.String),L1(Z,I0.Any)]);J.generatedProps.type=Q;let X=J6(Z,L1(Z,I0.Any));return J3([{symbol:J,type:Q}],X,Z)}function L1(Z,J){var Q;return(Q=Z.builtInTypes())==null?void 0:Q.get(J)}function O8(Z){return L1(Z,I0.Kind)}function m3(Z){return L1(Z,I0.Number)}function C5(Z){return L1(Z,I0.Int)}function V4(Z){return L1(Z,I0.String)}function Q3(Z){return L1(Z,I0.Boolean)}function vY(Z,J){let Q=new Map,X=R5("T"),x=T8(Q,Z,"Heredoc",J);return Z2(x,[X])}function wH(Z){return L1(Z,I0.Module)}function n0(Z){return L1(Z,I0.Any)}function FZ(Z){return L1(Z,I0.Void)}function rQ(Z){let J=Z.globalScope().get(Z,"Slot").symbol;return Z.typeFromTypeSymbol(J.id).unwrap()}function gT(Z){let J=rQ(Z),Q=T8(new Map,Z,"TemplateString");return Z2(J,[Q])}function iT(Z){let J=rQ(Z),Q=T8(new Map,Z,"IfExpression");return Z2(J,[Q])}function dT(Z){let J=rQ(Z),Q=T8(new Map,Z,"InfixExpression");return Z2(J,[Q])}function _H(Z,J){return J.length?J.length===1?J[0]:q8(J):n0(Z)}function QY0(Z,J,Q,X){var x;if(!Z.has(J,Q)){let q=H0.createGeneratedSymbol(Q,p.ElementProperty);q.generatedProps.type=X,q.generatedProps.members=new s2,Z.set(Q,q)}return(x=Z.get(J,Q))==null?void 0:x.symbol}function XY0(Z,J){if(J===Y1.DictName&&Z instanceof _0&&Z.elementName instanceof Z0)return Z.elementName.value.value;if(Z.elementType instanceof Z0)return Z.elementType.value.value}function xY0(Z,J,Q,X,x){var q;let{ruleset:Y}=x.parentType,{structure:$}=Y;if($===Y1.DictName||$===Y1.DictType){let z=QY0(J,Z,Y.name,x.parentType);if(!z)return;let W=XY0(Q,$);W&&((q=z.generatedProps)!=null&&q.members&&z.generatedProps.members.set(W,X),Y.isRuleOn(j0.RootNamespace)&&Y.isRuleOn(j0.NameAs)&&Y.isRuleOn(j0.UniqueName)&&!J.has(Z,W)&&J.set(W,X))}else $!==Y1.List&&J.set(X.name,X)}function qY0(Z,J,Q){let X=Z.symbol(Q.id);if(X.isErr())return;let x=X.unwrap(),q=Z.specificType(x.id);if(q.isErr())return;let Y=q.unwrap();G4(Y)?xY0(Z,J,Q,x,Y):J.set(x.name,x)}function lT(Z,J){let Q=new s2;if(J.body instanceof S0)J.body.body.forEach((X)=>{!(X instanceof _0)&&!(X instanceof C0)||qY0(Z,Q,X)});else if(J.body){let X=Z.symbol(J.body.id);if(X.isOk()){let x=Z.members(X.unwrap().id);if(x.isOk()){let q=x.unwrap();return new s2(q.table)}}}return Q}function oT(Z){let{ruleset:J}=Z,{structure:Q}=J;if(Q===Y1.DictType||Q===Y1.DictName||Q===Y1.List){let X=Z.type.members.get("__call__").type.returnType;if(!X)throw new Error("Expected body type");return X}return Z.type}function c0(Z,J={},Q=new Map){var X,x,q,Y;if(Q.has(Z))return Q.get(Z);let $=Z.kind===t.ProductType&&((X=Z.aliasSymbol)!=null&&X.name||Z.name)?((x=Z.aliasSymbol)==null?void 0:x.name)||Z.name:"<circular>";Q.set(Z,$);let{rawValueForLiteral:z=!1,rawValueForAnonymousTypeProperty:W=!1,db:U=void 0,includeTypeArgumentsForHeredoc:H=!0}=J,B;switch(Z.kind){case t.PrimitiveType:B=Z.aliasSymbol?Z.aliasSymbol.name:Z.primitiveTypeKind;break;case t.LiteralType:Z.aliasSymbol?B=Z.aliasSymbol.name:z?Z.primitiveTypeKind===I0.String?B=`"${Z.value}"`:B=Z.value.toString():B=Z.primitiveTypeKind;break;case t.Signature:B=Z.aliasSymbol?Z.aliasSymbol.name:`(${Z.parameters.map((M)=>`${M.symbol.name}: ${c0(M.type,{...J,rawValueForLiteral:!0},Q)}`).join(", ")}) => ${c0(Z.returnType,{...J,rawValueForLiteral:!0},Q)}`;break;case t.UnionType:B=Z.aliasSymbol?Z.aliasSymbol.name:`${Z.types.map((M)=>c0(M,{rawValueForLiteral:!0},Q)).join(" | ")}`;break;case t.ProductType:{let M="";if((q=Z.typeArguments)!=null&&q.length&&(Z.name!=="Heredoc"||H)&&(M+=Z.typeArguments.map((D)=>c0(D,J,Q)).join(", "),M=`[${M}]`),Z.aliasSymbol)B=`${Z.aliasSymbol.name}`;else if(Z.name)B=`${Z.name}${M}`;else if(W||((Y=Z.symbol)==null?void 0:Y.kind)!==p.TypeProperty||!U)B=`${`{ ${[...Z.members].filter(([D,N])=>N.symbol.kind!==p.BuiltInProperty).map(([D,N])=>`${D}: ${c0(N.type,J,Q)}`).join(", ")} }`}${M}`;else{let D=[];for(let N=U.nodeById(Z.symbol.declarationId);N!==void 0;N=N.container()){let _=N.symbol(U);[p.TypeProperty,p.Type].includes(_.kind)&&D.unshift(_.name)}B=D.join(".")}break}case t.DynamicType:B=c0(oT(Z),J,Q);break;case t.DynamicBodyType:B=c0(Z.type,J,Q);break;case t.BlockType:B="Block";break;case t.TypeVariable:B=Z.name;break;default:B=Z.toString()}return Q.set(Z,B),B}function NZ(Z){return Z instanceof YZ}function VY(Z){return Z?Z.type==="file"||Z.type==="directory":!1}class PH{constructor(){this.loadPath=w0.create(`__load__.${n8.languageExtension}`),this.loadDefinitionPath=w0.create(`__loadDefinition__.${n8.languageExtension}`),this.amlDefinitionPath=w0.create(`__amlDefinition__.${n8.languageExtension}`),this.internalPathSet=new Set([this.loadPath.toString(),this.loadDefinitionPath.toString(),this.amlDefinitionPath.toString()]),this.fileContentMap=new Map}setFileContent(Z,J){this.fileContentMap.set(Z.toString(),J)}getFileContent(Z){return this.fileContentMap.get(Z.toString())}deleteFile(Z){this.fileContentMap.delete(Z.toString())}flatFiles(){return[...this.fileContentMap.keys()].map((Z)=>w0.create(Z))}internalPaths(){return Array.from(this.internalPathSet).map((Z)=>w0.create(Z)).concat(this.flatFiles().filter((Z)=>Z.isInternalDecoratorPath()||Z.isInternalJsFuncPath()))}}function T5(Z,J,Q=(X,x)=>X===x){return Z.length!==J.length?!1:Z.every((X,x)=>Q(X,J[x]))}function YY0(Z){return Z?Z.originalAst&&Z.transformedAst:!1}function sT(Z){return Z?Z.symbol&&Z.nodeId:!1}function nT(Z){return Z?Z.category&&Z.code:!1}function aT(Z){return Z?Z.symbol&&Z.accessModifier:!1}function u0(Z,J){if(Z instanceof v1)return $Y0(Z,J);if(Z instanceof c1)return KY0(Z,J);if(Z instanceof Z0)return zY0(Z,J);if(Z instanceof I1)return WY0(Z,J);if(Z instanceof k2)return VY0(Z,J);if(Z instanceof O4)return UY0(Z,J);if(Z instanceof B4)return HY0(Z,J);if(Z instanceof k0)return GY0(Z,J);if(Z instanceof v3)return BY0(Z,J);if(Z instanceof C0)return AU(Z,J);if(Z instanceof S1)return MY0(Z,J);if(Z instanceof x6)return DY0(Z,J);if(Z instanceof _0)return EU(Z,J);if(Z instanceof S0)return FY0(Z,J);if(Z instanceof K2)return NY0(Z,J);if(Z instanceof M4)return wY0(Z,J);if(Z instanceof z3)return _Y0(Z,J);if(Z instanceof y2)return PY0(Z,J);if(Z instanceof A3)return jY0(Z,J);if(Z instanceof s6)return LY0(Z,J);if(Z instanceof u5)return CY0(Z,J);if(Z instanceof K3)return OY0(Z,J);if(Z instanceof a1)return rT(Z,J);if(Z instanceof q3)return mY0(Z,J);if(Z instanceof q6)return AY(Z,J);throw new Error("Unreachable")}function $Y0(Z,J){return!(J instanceof v1)||Z.statements.length!==J.statements.length?!1:Z.statements.every((Q,X)=>u0(Q,J.statements[X]))}function KY0(Z,J){return J instanceof c1?U4(Z.value,J.value):!1}function zY0(Z,J){return J instanceof Z0?U4(Z.value,J.value):!1}function WY0(Z,J){return J instanceof I1?u0(Z.callee,J.callee)&&u0(Z.args,J.args):!1}function VY0(Z,J){return!(J instanceof k2)||Z.args.length!==J.args.length?!1:Z.args.every((Q,X)=>u0(Q,J.args[X]))}function UY0(Z,J){if(!(J instanceof O4))return!1;let Q=(x,q)=>x!==void 0&&q!==void 0?u0(x,q):x===q,X=(x,q)=>x!==void 0&&q!==void 0?U4(x,q):x===q;return Q(Z.name,J.name)&&X(Z.separatorColonToken,J.separatorColonToken)&&Q(Z.typeReferenceExpression,J.typeReferenceExpression)&&X(Z.equalSign,J.equalSign)&&Q(Z.value,J.value)}function HY0(Z,J){return J instanceof B4?U4(Z.op,J.op)&&u0(Z.expression,J.expression):!1}function GY0(Z,J){return J instanceof k0?u0(Z.leftExpression,J.leftExpression)&&U4(Z.op,J.op)&&u0(Z.rightExpression,J.rightExpression):!1}function BY0(Z,J){return J instanceof v3?u0(Z.expression,J.expression)&&U4(Z.op,J.op):!1}function AU(Z,J){if(!(J instanceof C0))return!1;let Q=Z.decorators,X=J.decorators,x=Q===void 0&&X===void 0?!0:Q!==void 0&&X!==void 0&&Q.length===X.length&&Q.every((q,Y)=>AY(q,X[Y]));return u0(Z.elementType,J.elementType)&&(Z.params?J.params?u0(Z.params,J.params):!1:!0)&&(Z.returnType?J.returnType?u0(Z.returnType,J.returnType):!1:!0)&&u0(Z.body,J.body)&&x}function MY0(Z,J){return J instanceof S1?u0(Z.elementType,J.elementType)&&u0(Z.elementName,J.elementName)&&u0(Z.body,J.body):!1}function DY0(Z,J){return J instanceof x6?u0(Z.typeExpr,J.typeExpr):!1}function EU(Z,J){if(!(J instanceof _0))return!1;let Q=Z.decorators,X=J.decorators,x=Q===void 0&&X===void 0?!0:Q!==void 0&&X!==void 0&&Q.length===X.length&&Q.every((q,Y)=>AY(q,X[Y]));return u0(Z.elementType,J.elementType)&&u0(Z.elementName,J.elementName)&&(Z.params?J.params?u0(Z.params,J.params):!1:!0)&&(Z.returnType?J.returnType?u0(Z.returnType,J.returnType):!1:!0)&&(Z.body?J.body?u0(Z.body,J.body):!1:!0)&&x}function FY0(Z,J){return!(J instanceof S0)||Z.body.length!==J.body.length?!1:Z.body.every((Q,X)=>u0(Q,J.body[X]))}function NY0(Z,J){return!(J instanceof K2)||Z.body.length!==J.body.length?!1:Z.body.every((Q,X)=>u0(Q,J.body[X]))}function wY0(Z,J){return!(J instanceof M4)||Z.exprList.length!==J.exprList.length?!1:Z.exprList.every((Q,X)=>u0(Q,J.exprList[X]))}function _Y0(Z,J){return J instanceof z3?u0(Z.expr,J.expr):!1}function PY0(Z,J){return J instanceof y2?U4(Z.name,J.name)&&rT(Z.content,J.content):!1}function jY0(Z,J){return J instanceof A3?U4(Z.path,J.path)&&(Z.body?J.body?u0(Z.body,J.body):!1:!0)&&(Z.moduleName?J.moduleName?u0(Z.moduleName,J.moduleName):!1:!0):!1}function LY0(Z,J){return!(J instanceof s6)||Z.modules.length!==J.modules.length?!1:Z.modules.every((Q,X)=>u0(Q,J.modules[X]))}function CY0(Z,J){return J instanceof u5?u0(Z.moduleName,J.moduleName)&&(Z.moduleNameAs?J.moduleNameAs?u0(Z.moduleNameAs,J.moduleNameAs):!1:!0):!1}function OY0(Z,J){return J instanceof K3?u0(Z.ifKeyword,J.ifKeyword)&&(Z.condition?J.condition?u0(Z.condition,J.condition):!1:!0)&&(Z.thenBranch?J.thenBranch?u0(Z.thenBranch,J.thenBranch):!1:!0)&&(Z.elseKeyword?J.elseKeyword?u0(Z.elseKeyword,J.elseKeyword):!1:!0)&&(Z.elseBranch?J.elseBranch?u0(Z.elseBranch,J.elseBranch):!1:!0):!1}function rT(Z,J){return J instanceof a1?Z.elements.length===J.elements.length&&Z.elements.every((Q,X)=>u0(Q,J.elements[X])):!1}function mY0(Z,J){return J instanceof q3&&u0(Z.value,J.value)}function U4(Z,J){return bU(Z)&&bU(J)?Z.value===J.value:Z.kind!==J.kind?!1:Z.kind===w.NUMBER_LITERAL||Z.kind===w.OPERATOR||Z.kind===w.IDENTIFIER?Z.value===J.value:!0}function AY(Z,J){return J instanceof q6?U4(Z.atSignToken,J.atSignToken)&&u0(Z.name,J.name)&&u0(Z.args,J.args):!1}function c2(Z,J,Q){return Z===J?!0:Z instanceof Map?fY0(Z,J):Z instanceof s2||Z instanceof J8||Z instanceof k5?SY0(Z,J):Z instanceof d?AY0(Z,J):Z instanceof r?EY0(Z,J):hH(Z)?!1:gH(Z)?EY(Z,J):iH(Z)?KZ(Z,J):YY0(Z)?!1:sT(Z)?kY0(Z,J):Array.isArray(Z)?Array.isArray(J)?Z.length===0?J.length===0:nT(Z[0])?IQ(Z,J):T5(Z,J,(X,x)=>c2(X,x)):!1:Z instanceof w0?J instanceof w0?Z.equals(J):!1:Z instanceof p7?Zv(Z,J):VY(Z)?VY(J)?Jv(Z,J):!1:aT(Z)?vY0(Z,J):Z instanceof PZ?aY0(Z,J):Z instanceof b7?!1:Z instanceof X8?J instanceof X8?IQ(Z.diagnostics(),J.diagnostics()):!1:$$0(Z)||K$0(Z)?!1:(typeof Z=="object"&&(!Q||!["interpretFileJson"].includes(Q))&&(console.error("v1 does not implement Equal interface"),console.error(Z)),Z===J)}function SY0(Z,J){if(Z instanceof s2)return RY0(Z,J);if(Z instanceof J8)return IY0(Z,J);if(Z instanceof k5)return TY0(Z,J);throw new Error("Unreachable")}function RY0(Z,J){return J instanceof s2?c2(Z.table,J.table):!1}function IY0(Z,J){return J instanceof J8?c2(Z.file,J.file)&&c2(Z.table,J.table)&&T5(Z.unresolvedModules,J.unresolvedModules,(Q,X)=>cY0(Q.node,X.node)&&Q.includedFull===X.includedFull):!1}function TY0(Z,J){return J instanceof k5?c2(Z.table,J.table)&&c2(Z.duplicatedTable,J.duplicatedTable):!1}function vY0(Z,J){return aT(J)?c2(Z.symbol,J.symbol)&&Z.accessModifier===J.accessModifier:!1}function AY0(Z,J){return J instanceof d?c2(Z.unwrap(),J.unwrap())&&IQ(Z.diagnostics,J.diagnostics):!1}function EY0(Z,J){return J instanceof r?c2(Z.err(),J.err())&&IQ(Z.diagnostics,J.diagnostics):!1}function fY0(Z,J){return!(J instanceof Map)||Z.size!==J.size?!1:[...Z.entries()].every(([Q,X])=>J.has(Q)?c2(X,J.get(Q)):!1)}function kY0(Z,J){return sT(J)?EY(Z.symbol,J.symbol)&&Z.nodeId.key===J.nodeId.key:!1}function IQ(Z,J){return J.length===0?Z.length===0:nT(J[0])?T5(Z,J,tT):!1}function tT(Z,J){var Q,X;if(Z instanceof l&&(!(J instanceof l)||Z.nodeId.key!==J.nodeId.key)||Z instanceof M1&&(!(J instanceof M1)||!Z.file.equals(J.file)||Z.start!==J.start||Z.end!==J.end))return!1;let x=!1;return Z.children===void 0||J.children===void 0?x=Z.children===J.children:x=IQ(Z.children,J.children),x&&Z.code===J.code&&Z.message===J.message&&Z.category===J.category&&c2((Q=Z.meta)==null?void 0:Q.unionMatchedType,(X=J.meta)==null?void 0:X.unionMatchedType)}function cY0(Z,J){return hH(J)?u0(Z,J):!1}function EY(Z,J){return gH(J)?NZ(Z)?bY0(Z,J):Z instanceof H0?eT(Z,J):pY0(Z,J):!1}function eT(Z,J){var Q,X;return J instanceof H0?Z.name===J.name&&Z.kind===J.kind&&c2((Q=Z.declarationId)==null?void 0:Q.key,(X=J.declarationId)==null?void 0:X.key):!1}function bY0(Z,J){return NZ(J)?eT(Z,J)&&T5(Z.symbols,J.symbols,(Q,X)=>EY(Q,X)):!1}function pY0(Z,J){return J instanceof q4?Z.name===J.name&&Z.kind===J.kind&&c2(Z.moduleId.key,J.moduleId.key):!1}function KZ(Z,J){if(!iH(J))return!1;if(Z.kind===t.PrimitiveType)return yY0(Z,J);if(Z.kind===t.LiteralType)return uY0(Z,J);if(Z.kind===t.Signature)return hY0(Z,J);if(Z.kind===t.UnionType)return gY0(Z,J);if(Z.kind===t.ProductType)return iY0(Z,J);if(Z.kind===t.BlockType)return!1;if(Z.kind===t.DynamicType)return lY0(Z,J);if(Z.kind===t.DynamicBodyType)return oY0(Z,J);throw new Error("Unreachable")}function fY(Z,J){var Q,X;return Z.kind===J.kind&&c2(Z.symbol,J.symbol)&&c2(Z.aliasSymbol,J.aliasSymbol)&&((Q=Z.members)==null?void 0:Q.size)===((X=J.members)==null?void 0:X.size)&&[...Z.members?Z.members:[]].every(([x,q])=>{var Y,$,z;if(!((Y=J.members)!=null&&Y.has(x)))return!1;let W=c2(q.symbol,($=J.members.get(x))==null?void 0:$.symbol),U=c2(q.type,(z=J.members.get(x))==null?void 0:z.type);return W&&U})}function yY0(Z,J){return J.kind!==t.PrimitiveType?!1:Z.primitiveTypeKind===J.primitiveTypeKind&&Z.value===J.value&&c2(Z.aliasSymbol,J.aliasSymbol)}function uY0(Z,J){return J.kind!==t.LiteralType?!1:Z.primitiveTypeKind===J.primitiveTypeKind&&Z.value===J.value&&fY(Z,J)}function hY0(Z,J){return J.kind!==t.Signature?!1:Z.isBuiltIn&&J.isBuiltIn?!0:Z.isBuiltIn||J.isBuiltIn?!1:T5(Z.parameters,J.parameters,(Q,X)=>EY(Q.symbol,X.symbol)&&KZ(Q.type,X.type))&&KZ(Z.returnType,J.returnType)&&fY(Z,J)}function gY0(Z,J){return J.kind!==t.UnionType?!1:T5(Z.types,J.types,(Q,X)=>KZ(Q,X))&&c2(Z.origin,J.origin)&&fY(Z,J)}function iY0(Z,J){return!(J.kind!==t.ProductType||Z.name!==J.name||!fY(Z,J)||!dY0(Z.typeArguments,J.typeArguments)||U2(Z)&&Z.raw||U2(J)&&J.raw)}function dY0(Z,J){return Z===void 0||J===void 0?Z===J:Z.length===J.length&&Z.every((Q,X)=>KZ(Q,J[X]))}function lY0(Z,J){return J.kind!==t.DynamicType?!1:Z.ruleset.declarationId.key===J.ruleset.declarationId.key&&KZ(Z.type,J.type)}function oY0(Z,J){return J.kind,t.DynamicBodyType,!1}function Zv(Z,J){return J instanceof p7?Z.id.key===J.id.key&&T5(Z.amlFiles,J.amlFiles,(Q,X)=>Q.equals(X))&&T5(Z.modules,J.modules,(Q,X)=>Zv(Q,X)):!1}function Jv(Z,J){return VY(J)?Z.type==="file"?sY0(Z,J):nY0(Z,J):!1}function sY0(Z,J){return J.type!=="file"?!1:Z.name===J.name&&Z.path.equals(J.path)}function nY0(Z,J){return J.type!=="directory"?!1:Z.name===J.name&&Object.keys(Z.children).length===Object.keys(J.children).length&&Object.keys(Z.children).every((Q)=>Jv(Z.children[Q],J.children[Q]))}function aY0(Z,J){return J instanceof PZ?Z.key===J.key:!1}function b2(Z){return Z.some((J)=>J.category===g1.Error)}function s7(Z){return NH(Z,tT)}function jH(Z,J,Q){let X=v.WrongKind,{program:x}=Z;for(let q of x.customModuleProviders.evaluate.replacing)if(X=q(J,Q,Z),X!==v.WrongKind)break;if(X===v.WrongKind){for(let q of x.moduleProviders.evaluate)if(X=q(J,Q,Z),X!==v.WrongKind)break}for(let q of x.customModuleProviders.evaluate.extending)X=q(J,Q,Z,X);if(X!==v.WrongKind)return J.evalValue=X.returnVal,X;throw new Error("No handler for this node")}function Qv(Z,J){let Q=Z.ast(J).unwrap().transformedAst;if(!Q.filePath)throw new Error("Expected ast filepath");let{program:X}=Z,x=new A5({parent:X.globalEnv});return jH(Z,Q,x)}function Xv(Z,J){let Q=Z.fileDependencies(J),X=[],x=Z.ast(J);return g(X,x.diagnostics),Q.forEach((q)=>{g(X,Z.typecheckFile(q).diagnostics())}),b2(X)?new b7(new X8(X)):new b7(new X8(X),new X3(Qv(Z,J)))}function xv(Z,J){if(J.query.name==="interpretFile"){let Q=Z.ast(J.key.value).unwrap().transformedAst;throw new H4(l.createForNode(Q.id,k.ModuleCircularDependencies,Q.filePath.toString()))}throw new Error("Circular dependency detected")}function qv(Z,J){let{program:Q}=Z,X=Q.interpretFile(J);if(X.isOk()){let x=X.env().data.bindings.map((Y)=>Y.toJsStructure()),q=X.returnVal().toJsStructure();return new X3({bindings:x,returnVal:q})}return new T2(X.resolvedDiagnostics(Q.db))}class H4 extends Error{constructor(Z){super(Z.message),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.diag=Z}}function rY0(Z,J){return x3(Z,J,void 0,(Q,X,x,q)=>{var Y;let $;if(x instanceof o1&&!((Y=x.hiddenMetadata)!=null&&Y.shouldMerge))$=x;else{let z=I2(X),W=I2(x);if(z instanceof M2)$=x;else if(W instanceof M2)$=X;else if(z instanceof C4){if(!(W instanceof C4))throw new Error("Cannot merge dynamic prop list with non-dynamic prop list");$=Gv(z,W)}else if(z instanceof v5){if(!(W instanceof v5))throw new Error("Cannot merge dynamic prop dict with non-dynamic prop dict");$=TQ(z,W)}else $=TQ(z,W);x instanceof o1&&!($ instanceof o1)&&($=new o1($,x.metadata,x.rules,x.hiddenMetadata))}Q.set(q,$)})}function TQ(Z,J){if(Z instanceof o1||J instanceof o1){let x=TQ(I2(Z),I2(J));return J instanceof o1?new o1(x,J.metadata,J.rules,J.hiddenMetadata):x}let Q=rY0(Z.members,J.members),X=new g0(Q,Z.vTable,Z.type);return X.data=J.data,Object.setPrototypeOf(X,Object.getPrototypeOf(Z)),X}function tY0(Z){Z.members.delete("__fqn__")}function Yv(Z,J){J.set("__baseFqn__",Z)}class kY{constructor(Z,J,Q){this.parentObj=Z,this.vTable=J,this.data=Q}static new(Z){return Vv(Z)}static newObj(Z){return Uv(Z)}}function $v(Z,J){return typeof Z=="function"?Z(...J):G0(Z,"__call__",...J)}function Kv(Z){return{vTable:Z,parentObj:cY,data:null,type:null}}function zv(Z,J,Q){Z.data===null&&(Z.data=new Map),Z.data.set(J,Q)}function Wv(Z){return{vTable:Z.vTable,parentObj:Z,data:new Map}}function LH(Z,J){if(!J)throw new Error("Undefined method symbol");return Z.data.has(J)?Z.data.get(J):Z.parentObj!==null?G0(Z.parentObj,"lookUp",J):M2.Instance}function G0(Z,J,...Q){if(Z===null)return null;if("target"in Z){if(J!=="__lookUp__")return G0(Z.target,J,...Q);if(Q[0]==="__meta__")return Z.metaObject;let x=G0(Z.target,J,...Q);return x!==M2.Instance?x:Z.metadata.get(Q[0])??M2.Instance}let X;if(J==="lookUp"&&Z.vTable===Z)X=LH(Z.vTable,"lookUp");else if(Z.vTable!==null)X=G0(Z.vTable,"lookUp",J);else throw new Error(`Object ${Z} has no vTable`);return $v(X,[Z].concat(Q))}var vQ=new kY(null,null,new Map().set("addMethod",zv).set("allocate",Kv).set("delegate",Wv).set("lookUp",LH)),cY={parentObj:null,vTable:vQ,data:new Map};vQ.parentObj=cY;vQ.vTable=vQ;function Vv(Z){let J=G0(cY,"delegate");for(let Q in Z)if(Object.prototype.hasOwnProperty.call(Z,Q)){let X=Z[Q];G0(J,"addMethod",Q,X)}return J}function Uv(Z){return G0(Z,"allocate")}var o2=kY.new({}),AQ=G0(o2,"delegate"),JZ=G0(o2,"delegate");class g0{constructor(Z,J,Q){this.parentObj=null,this.vTable=o2,this.members=new Map,Z&&(this.members=Z),J&&(this.vTable=J),this.type=Q}clone(){let Z={...this,jsObject:void 0,members:this.cloneMembers()};return Object.setPrototypeOf(Z,Object.getPrototypeOf(this)),Z}cloneMembers(){let Z=new Map;return this.members.forEach((J,Q)=>{Z.set(Q,J.clone())}),Z}clearJsObjectCache(){this.jsObject=void 0}getCachedJsObject(){return this.jsObject}setCachedJsObject(Z){this.jsObject=Z}toJsStructure(){return G0(this,"to_js_structure")}}class o1 extends g0{constructor(Z,J,Q,X){super(),this.target=Z,this.metadata=J,this.metaObject=new g0(J),this.hiddenMetadata=X,this.rules=Q,this.data=Z.data,this.members=Z.members,this.type=Z.type,this.vTable=Z.vTable}toJsStructure(){var Z;let J=G0(this.target,"to_js_structure");if((Z=this.rules)!=null&&Z.body_as){let Q={};for(let[X,x]of this.metadata.entries())Q[X]=G0(x,"to_js_structure");return Q[this.rules.body_as]=J,Q}if(typeof J=="object"&&J!==null&&!Array.isArray(J)){let Q={};for(let[X,x]of this.metadata.entries())Q[X]=G0(x,"to_js_structure");return{...Q,...J}}return J}}function I2(Z){return Z instanceof o1?Z.target:Z}var v7={"==":function(Z,J){return Z.data===J.data?R1.True:R1.False},">":function(Z,J){return Z.data>J.data?R1.True:R1.False},"<":function(Z,J){return Z.data<J.data?R1.True:R1.False},"<=":function(Z,J){return Z.data<=J.data?R1.True:R1.False},">=":function(Z,J){return Z.data>=J.data?R1.True:R1.False},"!=":function(Z,J){return Z.data!==J.data?R1.True:R1.False}},f6=G0(o2,"delegate");class R1 extends g0{constructor(Z){super(),this.vTable=f6,this.data=Z}static get True(){return R1._trueInstance||(R1._trueInstance=new R1(!0)),R1._trueInstance}static get False(){return R1._falseInstance||(R1._falseInstance=new R1(!1)),R1._falseInstance}}var A7=G0(o2,"delegate"),Hv=class Z extends g0{constructor(J){super(),this.vTable=A7,this.data=J}static create(J){let Q=Z.stringCache.get(J);return Q||(Q=new Z(J),Z.stringCache.set(J,Q)),Q}clone(){return new this.constructor(this.data)}};Hv.stringCache=new Map;var h0=Hv,e3=G0(o2,"delegate");class h4 extends g0{constructor(Z){super(),this.vTable=e3,this.data=Z}}var UY=G0(o2,"delegate");class a8 extends g0{constructor(){super(),this.vTable=UY,this.data=null}static get Instance(){return a8._instance||(a8._instance=new a8),a8._instance}}var HY=G0(o2,"delegate");class M2 extends g0{constructor(){super(),this.vTable=HY,this.data=void 0}static get Instance(){return M2._instance||(M2._instance=new M2),M2._instance}}class CH extends g0{constructor(Z,J){super(),this.vTable=o2,this.data=Z,this.env=J}}class tQ extends g0{clone(){return ox0(this)}}var LQ=G0(o2,"delegate");class OH extends tQ{constructor(Z,J,Q,X){super(),this.vTable=LQ,this.data=new mH(Z,J,Q,X)}addArgs(Z,J,Q){let{params:X}=this.data;if(X.length!==J.length)throw new Error(`Argument mismatch: Expect ${X.length} arguments but got ${J.length} arguments instead`);let x=J.map((q,Y)=>{let $=X[Y].asParameter().name.name??"",z=q,W=Q.db.symbol(X[Y].id).unwrap();return new V2({name:$,symbol:W,type:W.type(Q.db),value:z})});return Z.data.bindings=Z.data.bindings.concat(x),Z}bind(Z){this.data.bindObj=Z}}class mH{constructor(Z,J,Q,X){this.params=Z,this.body=J,this.env=Q,this.program=X}toJson(){return{args:this.params.map((Z)=>Z.asParameter().name.name)}}}var CQ=G0(o2,"delegate");class E0 extends tQ{constructor(Z,J,Q,X){super(),this.vTable=CQ,this.data={jsFunc:Z,bindObj:J},this.isDecorated=Q,this.partialType=X}bind(Z){this.data.bindObj=Z}}var GY=G0(o2,"delegate");class zZ extends g0{constructor(Z,J,Q){super(),this.vTable=GY,this.data=new bY(Z,J),this.type=Q}clone(){let Z=super.clone();return Z.data=this.data.clone(),Z}}class bY{constructor(Z,J){this.name=Z,this.content=J}clone(){return new bY(this.name,this.content)}}class v5 extends g0{constructor(Z=new Map,J=void 0){super(Z,AQ,J)}merge(Z){let J=x3(this.members,Z.members,void 0,(Q,X,x,q)=>{Q.set(q,x)});return new v5(J)}}class C4 extends g0{constructor(Z=[],J=!1){super(),this.data=[],this.vTable=JZ,this.isDynamicPropList=!1,this.data=Z,this.members.set("length",new h4(Z.length)),this.isDynamicPropList=J}clone(){let Z=super.clone();return Z.data=this.data,Z}}class SH{constructor(Z,J){this.parent=Z,this.bindings=J}toJsStructure(){return{parent:this.parent===null?"null":this.parent.toJsStructure(),bindings:this.bindings.map((Z)=>Z.toJsStructure())}}}class A5 extends g0{constructor({parent:Z,bindings:J=[]}){super(),this.data=new SH(Z,J)}static rootEnv(){return new A5({parent:null})}find(Z){let J=this.data.bindings.find((Q)=>Q.data.name===Z);if(J)return J.data.value;if(this.data.parent!==null){let Q=this.data.parent.find(Z);if(Q)return Q}throw new H4(e1.create(k.AdhocError,`Identifier "${Z}" not found in scope`))}findBinding(Z){return this.data.bindings.find((J)=>J.data.name===Z)}toJsStructure(){return{data:this.data.toJsStructure()}}createLocal(){return new A5({parent:this})}}class RH{constructor(Z,J,Q,X){this.name=Z,this.symbol=J,this.type=Q,this.value=X}toJsStructure(){return{name:this.name,_type:c0(this.type),value:this.value.toJsStructure()}}}class V2 extends g0{constructor({name:Z,symbol:J,type:Q,value:X}){super(),this.data=new RH(Z,J,Q,X)}toJsStructure(){return this.data.toJsStructure()}}function Gv(Z,J){if(Z.isDynamicPropList){if(!J.isDynamicPropList)throw new Error("Cannot merge non-dynamic prop list into dynamic prop list");return Bv(Z,J)}return J}function Bv(Z,J){let Q=Z.clone(),X=Q.members.get("length");return J.data.forEach((x)=>{Q.data.push(x),X.data+=1}),Q}function Mv(Z){let J=Z.split(/\r?\n/);J.length>0&&!J[0].trim()&&J.shift(),J.length>0&&!J[J.length-1].trim()&&J.pop();let Q=(x)=>{let q=0;for(;q<x.length&&x[q]===" ";)q+=1;return q},X=J.filter((x)=>x.trim()).reduce((x,q)=>Math.min(x,Q(q)),Number.MAX_SAFE_INTEGER);return J=J.map((x)=>x.slice(X)),J.join(`
136
136
  `)}function eY0(Z){let[J,...Q]=Z.split(/\r?\n/);J=J.trim();let X=(q)=>{let Y=0;for(;Y<q.length&&q[Y]===" ";)Y+=1;return Y},x=Q.filter((q)=>q.trim()).reduce((q,Y)=>Math.min(q,X(Y)),Number.MAX_SAFE_INTEGER);for(Q=Q.map((q)=>q.slice(x));Q.length&&!f5(Q).trim();)Q.pop();if(J)return[J,...Q].join(`
137
137
  `);for(;Q.length&&!Q[0].trim();)Q.shift();return Q.join(`
138
138
  `)}function IH(Z,J){for(let Q of J.elements)if(Q instanceof q3){let X=Z.type(Q.value.id);if(X.isOk()){let x=X.unwrap();if(k6(x)||eq0(x))return!0}}return!1}function Z$0(Z,J){return J instanceof a1?J.isNormalString()?Z.type(J.elements[0].id):IH(Z,J)?new d(gT(Z)):new d(V4(Z)):new r(v.WrongKind)}function Dv(Z,J){if(!(J instanceof a1))return new r(v.WrongKind);if(J.isNormalString())return Z.typeFromTypeExpression(J.elements[0].id);let Q=[];return J.getEmbeddedExpressions().forEach((X)=>{Q.push(l.createForNode(X.value.id,k.ValueIsUsedAsType,X.value.text()))}),new d(V4(Z),Q)}function J$0(Z,J){if(!(J instanceof a1))return v.WrongKind;let Q=J.getEmbeddedExpressions(),X=[];return Q.forEach((x)=>g(X,Z.typecheck(x.value.id))),X}function Q$0(Z,J,Q){if(!(Z instanceof a1))return v.WrongKind;let X=Q.type(Z.id).unwrap();if(cT(X)){let q=Z.elements.map(($)=>$ instanceof q3?Q.program.interpretNode($.value,J).returnVal:Q.program.interpretNode($,J).returnVal),Y=new Map;return Y.set("parts",new C4(q)),new U1(J,new g0(Y,void 0,X))}let x="";return Z.elements.forEach((q)=>{if(q instanceof q3){let Y=I2(Q.program.interpretNode(q.value,J).returnVal);Y instanceof zZ&&typeof Y.data.content=="string"?x+=Y.data.content:x+=G0(Y,"to_string").data}else x+=G0(Q.program.interpretNode(q,J).returnVal,"to_string").data}),(Z.closeQuoteToken.value==="'''"||Z.closeQuoteToken.value===";;")&&(x=Z.parent instanceof y2&&Z.parent.isRaw()?eY0(x):Mv(x)),new U1(J,h0.create(x))}function TH(Z,J,Q){if(J instanceof a1&&J.isNormalString())return new d(J.elements[0]);let X;return Q?X=Dv(Z,J).diagnostics:X=[l.createForNode(J.id,k.ExpectedThings,"string value determined at compile time")],new r(v.WrongKind,X)}var X$0={name:"StringExperssion",hooks:{type:Z$0,typeFromTypeExpression:Dv,typecheck:J$0,evaluate:Q$0}};function Fv(Z,J){let Q=[];return Z.rules.forEach((X,x)=>{let q=J.rules.get(x);q&&x$0(X,q)||Q.push(e1.create(k.IncompatibleRule,x))}),{kind:vH.Ordinary,diags:Q}}function x$0(Z,J){return Z.name===J.name&&Z.enabled===J.enabled&&Z.value===J.value}function eQ(Z){return Z?Z.kind===t.UnionType:!1}function q$0(Z){return Z.kind===t.Signature}function c6(Z){return Z.kind===t.ProductType}function U2(Z){return c6(Z)&&Z.name==="Partial"}function b6(Z){return c6(Z)&&Z.name==="Slot"}function Y$0(Z){return c6(Z)&&Z.name==="Heredoc"}function Y4(Z){return Z.kind===t.DynamicType}function G4(Z){return Z.kind===t.DynamicBodyType}function p6(Z){return Z.kind===t.PrimitiveType}function y6(Z){return Z.kind===t.LiteralType}function R2(Z){return p6(Z)&&Z.primitiveTypeKind===I0.Any}function $I(Z){return p6(Z)&&Z.primitiveTypeKind===I0.Kind}function Nv(Z){return c6(Z)&&Z.name==="AccessExpression"}function $$0(Z){return typeof Z=="object"&&Z!==null&&"signature"in Z&&"resolutionResult"in Z}function K$0(Z){return typeof Z=="object"&&Z!==null&&"resolvedArgs"in Z&&"missingParams"in Z&&"typeCompatibilityScore"in Z&&"typeCompatibilityDiags"in Z}function wv(Z){return U2(Z)?!0:eQ(Z)?Z.types.some((J)=>U2(J)):!1}function u6(Z,J){switch(Z.kind){case t.PrimitiveType:return z$0(Z,J);case t.LiteralType:return W$0(Z,J);case t.Signature:return V$0(Z,J);case t.UnionType:return U$0(Z,J);case t.ProductType:return G$0(Z,J);case t.DynamicType:return B$0(Z,J);case t.DynamicBodyType:return M$0(Z,J);default:throw new Error("Unreachable")}}function z$0(Z,J){return J.kind===t.PrimitiveType&&Z.primitiveTypeKind===J.primitiveTypeKind}function W$0(Z,J){return J.kind===t.LiteralType&&Z.primitiveTypeKind===J.primitiveTypeKind&&Z.value===J.value}function V$0(Z,J){return J.kind!==t.Signature?!1:Z.isBuiltIn&&J.isBuiltIn?!0:Z.isBuiltIn||J.isBuiltIn?!1:Z.parameters.length===J.parameters.length&&Z.parameters.every((Q,X)=>u6(Q.type,J.parameters[X].type))&&u6(Z.returnType,J.returnType)}function U$0(Z,J){return J.kind===t.UnionType&&Z.types.length===J.types.length&&Z.types.every((Q)=>J.types.some((X)=>u6(Q,X)))}function H$0(Z,J){if(!Z.typeArguments||!J.typeArguments)return!0;if(Z.typeArguments.length!==J.typeArguments.length)return!1;for(let Q=0;Q<Z.typeArguments.length;Q++){let X=Z.typeArguments[Q],x=J.typeArguments[Q];if(!u6(X,x))return!1}return!0}function G$0(Z,J){if(J.kind!==t.ProductType)return!1;let Q=["Dict","List","Partial","Slot"];return Z.name&&J.name&&!Q.includes(Z.name)&&!Q.includes(J.name)?Z.name===J.name:Z.members.size===J.members.size&&[...Z.members].every(([X,x])=>[...J.members].some(([q,Y])=>X===q&&u6(x.type,Y.type)))&&H$0(Z,J)}function B$0(Z,J){return J.kind===t.DynamicType&&u6(Z.type,J.type)&&n2(Fv(Z.ruleset,J.ruleset))}function M$0(Z,J){return J.kind===t.DynamicBodyType&&u6(Z.type,J.type)}function I7(Z){return new d(n0(Z))}function D$0(Z){var J;if(!c6(Z))return!1;let Q=["List","Dict","Heredoc","Partial","Slot","AccessExpression"].includes(Z.name),X=(J=Z.typeArguments)==null?void 0:J.some((x)=>x.kind===t.TypeVariable);return Q&&!!X}function F$0(Z){if(Z.name!=="List")throw new Error("Expected List type");return Z.typeArguments[0]}function N$0(Z){if(Z.name!=="AccessExpression")throw new Error("Expected AccessExpression type");return Z.typeArguments[0]}function _v(Z,J){let Q=J.asParameter();return Q.type?Z.typeFromTypeExpression(Q.type.node.id):Q.defaultValue?Z.type(Q.defaultValue.node.id):new d(n0(Z))}function Pv(Z,J){let Q=J.asArgument();return Q.value?Z.type(Q.value.node.id):new d(n0(Z))}function jv(Z,J){let Q=[],X=J.asAmlTypeOption();if(X.value){let x;if(X.value.node instanceof Z0||X.value.node instanceof c1)x=X.value.node.value.value;else if(X.value.node instanceof a1){let q=TH(Z,X.value.node,!1);q.isOk()&&(x=q.unwrap().value.value),g(Q,q.diagnostics)}else X.name.name!=="default"&&Q.push(l.createForNode(X.value.node.id,k.ExpectedThings,"literal value, not expression"));return new d(x,Q)}return new d(!0,Q)}function w$0(Z,J){let Q=J.asAmlTypeOption();return Q.value?Z.type(Q.value.node.id):new d(Q3(Z))}function _$0(Z){if(!Y4(Z))return!1;let{ruleset:J}=Z;return J.isRuleOn(j0.RootNamespace)}var j0=((Z)=>(Z.TypeAs="elem_type_as",Z.NameAs="elem_name_as",Z.Multiple="multiple",Z.BodyAs="body_as",Z.UniqueType="unique_elem_type",Z.UniqueName="unique_elem_name",Z.Attr="has_attributes",Z.Optional="optional",Z.Doc="doc",Z.Default="default",Z.RootNamespace="root_namespace",Z.AllowNoBody="allow_no_body",Z))(j0||{});class T3{constructor(Z,J){this.enabled=!1,this.name=Z,this.valueType=J}enable(Z,J){let Q=[];if(Z){if(!J)throw new Error("Expected db");let X=Z.asAmlTypeOption(),x=w$0(J,Z);g(Q,x.diagnostics);let q=x.unwrap(),Y=h6(this.valueType,q,X.value?X.value.node:X.name.node,k.MismatchedRuleValueType,J);Y&&g(Q,Y);let $=jv(J,Z);g(Q,$.diagnostics),this.value=$.unwrap()}return this.enabled=!0,Q}}class fU extends T3{constructor(Z){super("multiple",Q3(Z))}}class Lv extends T3{constructor(Z){super("elem_type_as",V4(Z))}}class Cv extends T3{constructor(Z){super("elem_name_as",V4(Z))}}class Ov extends T3{constructor(Z){super("unique_elem_type",Q3(Z)),this.typeMap=new Set}}class mv extends T3{constructor(Z){super("unique_elem_name",Q3(Z)),this.nameMap=new Set}}class Sv extends T3{constructor(Z){super("body_as",V4(Z))}}class Rv extends T3{constructor(Z){super("has_attributes",Q3(Z))}}class Iv extends T3{constructor(Z){super("root_namespace",Q3(Z))}}class Tv extends T3{constructor(Z){super("allow_no_body",Q3(Z))}}class vv extends T3{constructor(Z){super("optional",Q3(Z))}}class Av extends T3{constructor(Z){super("doc",V4(Z))}}class Ev extends T3{constructor(Z,J){super("default",J),this.propName=Z}}var Y1=((Z)=>(Z.DictType="DictType",Z.DictName="DictName",Z.List="List",Z.Obj="Obj",Z.Static="Static",Z))(Y1||{}),kU=class Z{constructor(J,Q,X){this.rules=new Map,this.id=Z.idCounter,Z.idCounter+=1,this.name=J,this.rules=Q,this.declarationId=X.id}static initRules(J){let Q=new Map;return Q.set(j0.TypeAs,new Lv(J)),Q.set(j0.NameAs,new Cv(J)),Q.set(j0.Multiple,new fU(J)),Q.set(j0.BodyAs,new Sv(J)),Q.set(j0.UniqueType,new Ov(J)),Q.set(j0.UniqueName,new mv(J)),Q.set(j0.Attr,new Rv(J)),Q.set(j0.Optional,new vv(J)),Q.set(j0.Doc,new Av(J)),Q.set(j0.RootNamespace,new Iv(J)),Q.set(j0.AllowNoBody,new Tv(J)),Q}static create(J,Q){if(J instanceof C0&&!(J.elementType instanceof Z0)||J instanceof I1&&!(J.callee instanceof Z0))throw new Error("Expected identifier");if(J instanceof _0&&J.elementType.value.kind!==w.TYPE_KEYWORD)throw new Error("Expected type");let X=[],x="";J instanceof C0?x=J.elementType.value.value:J instanceof I1?x=J.callee.value.value:J instanceof _0&&(x=J.elementName.value.value);let q;if(J instanceof I1?q=J.args:q=J.params,!q)throw new Error("Expected params");let Y=Z.initRules(Q);if(q.args.forEach((z)=>{let W=z.asAmlTypeOption();if(!W.name.name){X.push(l.createForNode(W.name.node.id,k.ExpectedThings,"identifier"));return}let U;if(W.name.name===j0.Default){if(J instanceof C0)if(d6(J.body)){let B=Q.typeFromTypeExpression(J.body.id);g(X,B.diagnostics),B.isOk()&&(U=new Ev(J.elementType.value.value,B.unwrap()),Y.set(j0.Default,U))}else X.push(l.createForNode(J.body.id,k.ExpectedThings,"expression body"))}else U=Y.get(W.name.name);if(!U){X.push(l.createForNode(W.name.node.id,k.InvalidThings,"option"));return}let H=U.enable(z,Q);g(X,H),U.declarationId=z.id}),!(J instanceof _0)){let z=Z.validateRules(Y,J,Q);g(X,z)}let $=new Z(x,Y,J);return new d($,X)}static validateRules(J,Q,X){let x=[];return g(x,Z.checkTypeAsRule(J,X)),g(x,Z.checkUniqueTypeRule(J,Q,X)),g(x,Z.checkUniqueNameRule(J,Q,X)),g(x,Z.checkBodyAsRule(J,Q,X)),g(x,Z.checkRootNamespaceRule(J,Q,X)),!Z.isRuleOn(J,j0.NameAs)&&(Q instanceof I1||!Q.body)&&x.push(l.createForNode(Q.id,k.ExpectedThings,"element body")),x}static isRuleOn(J,Q){if(!Z.isRuleEnabled(J,Q))return!1;let X=J.get(Q);return p6(X.valueType)&&X.valueType.primitiveTypeKind===I0.Boolean?X.value:!0}static isRuleEnabled(J,Q){return J.has(Q)&&J.get(Q).enabled}static checkTypeAsRule(J,Q){if(Z.isRuleOn(J,j0.TypeAs)&&!Z.isRuleEnabled(J,j0.Multiple)){let X=new fU(Q);X.enable(),X.value=!0,J.set(j0.Multiple,X)}return[]}static checkUniqueTypeRule(J,Q,X){let x=[];return Z.isRuleOn(J,j0.UniqueType)&&(Z.isRuleOn(J,j0.TypeAs)||x.push(l.createForNode(Q.id,k.ExpectedThings,"'elem_type_as' option when 'unique_type_as' is set")),Z.isRuleOn(J,j0.Multiple)||x.push(l.createForNode(Q.id,k.ExpectedThings,"'multiple' option is on when 'unique_type_as' is set"))),x}static checkUniqueNameRule(J,Q,X){let x=[];return Z.isRuleOn(J,j0.UniqueName)&&(Z.isRuleOn(J,j0.NameAs)||x.push(l.createForNode(Q.id,k.ExpectedThings,"'elem_name_as' option when 'unique_name_as' is set")),Z.isRuleOn(J,j0.Multiple)||x.push(l.createForNode(Q.id,k.ExpectedThings,"'multiple' option is on when 'unique_name_as' is set"))),x}static checkBodyAsRule(J,Q,X){let x=[];return Z.isRuleOn(J,j0.BodyAs)&&(Q instanceof C0&&(Q.body instanceof S0||Q.body instanceof K2)&&x.push(l.createForNode(Q.body.id,k.ExpectedThings,"simple body when 'body_as' is set")),Q instanceof I1&&x.push(l.createForNode(Q.id,k.ExpectedThings,"body when 'body_as' is set"))),x}static checkRootNamespaceRule(J,Q,X){let x=[],q=J.get(j0.RootNamespace);if(q!=null&&q.enabled){let Y=Z.isRuleOn(J,j0.NameAs),$=Z.isRuleOn(J,j0.UniqueName);if(!Y||!$){let z=[];Y||z.push(`'${j0.NameAs}'`),$||z.push(`'${j0.UniqueName}'`);let W=q.declarationId??Q.id;x.push(l.createForNode(W,k.RuleRequiresRules,j0.RootNamespace,z.join(" and ")))}}return x}isRuleOn(J){if(!this.isRuleEnabled(J))return!1;let Q=this.rules.get(J);return p6(Q.valueType)&&Q.valueType.primitiveTypeKind===I0.Boolean?Q.value:!0}isRuleEnabled(J){return this.rules.has(J)&&this.rules.get(J).enabled}every(J){return Array.from(this.rules).every(([Q,X])=>J(Q,X))}getRule(J){return this.rules.get(J)}get structure(){return this.isRuleOn(j0.TypeAs)&&this.isRuleOn(j0.UniqueType)?this.isRuleOn(j0.Multiple)?"DictType":"Obj":this.isRuleOn(j0.NameAs)&&this.isRuleOn(j0.UniqueName)&&this.isRuleOn(j0.Multiple)?"DictName":this.isRuleOn(j0.Multiple)?"List":this.every((J)=>this.isRuleOn(J)?J===j0.Optional||J===j0.Doc||J===j0.Default:!0)?"Static":"Obj"}};kU.staticRuleName=[j0.Optional,j0.Doc,j0.Default],kU.idCounter=0;var P$0=kU;function c5(Z){var J;let Q=(J=Z.typeArguments)==null?void 0:J[0];if(!Q||!c6(Q))throw new Error("Unexpected. Concrete type of a Partial must be a Product");return Q}function KI(Z){var J;return(J=Z.typeArguments)==null?void 0:J[0]}function wZ(Z){return Z.type.kind===t.DynamicBodyType?Z.type.type:Z.type}var t=((Z)=>(Z.PrimitiveType="PrimitiveType",Z.LiteralType="LiteralType",Z.Signature="Signature",Z.UnionType="UnionType",Z.ProductType="ProductType",Z.BlockType="BlockType",Z.DynamicType="DynamicType",Z.DynamicBodyType="DynamicBodyType",Z.TypeVariable="TypeVariable",Z))(t||{}),I0=((Z)=>(Z.Int="Int",Z.Number="Number",Z.String="String",Z.Boolean="Boolean",Z.Any="Any",Z.Module="Module",Z.Kind="Kind",Z.Void="Void",Z))(I0||{}),vH=((Z)=>(Z.Ordinary="Ordinary",Z.Union="Union",Z.Product="Product",Z))(vH||{});function pY(Z){return Z.kind==="Union"}function n2(Z){return!b2(Z.diags)}function g4(){return{kind:"Ordinary",diags:[]}}function i1(Z,J,Q,X){let x=Z.kind==="DynamicBodyType"?Z.type:Z,q=J.kind==="DynamicBodyType"?J.type:J;if(x.kind==="UnionType")return AH(x,q,Q,X);if(x.kind==="PrimitiveType")return j$0(x,q,Q,X);if(x.kind==="LiteralType")return L$0(x,q,Q,X);if(x.kind==="ProductType")return U2(x)?R$0(x,q,Q,X):b6(x)?I$0(x,q,Q,X):C$0(x,q,Q,X);if(x.kind==="Signature")return S$0(x,q,Q,X);if(x.kind==="DynamicType")return f$0(x,q,Q,X);throw new Error("Unreachable")}function fv(Z,J){return Z==="Number"&&J==="Int"?!0:Z===J}function j$0(Z,J,Q,X){if(R2(J)||R2(Z))return g4();if(J.kind==="BlockType")return{kind:"Ordinary",diags:[e1.create(k.UnexpectedThings,"block body")]};let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;return x.kind==="PrimitiveType"||x.kind==="LiteralType"?fv(Z.primitiveTypeKind,x.primitiveTypeKind)?g4():S3(Z,x,Q):x.kind==="UnionType"&&x.types.every((q)=>n2(i1(Z,q,Q,X)))?g4():S3(Z,x,Q)}function L$0(Z,J,Q,X){if(R2(J))return g4();let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;return(x.kind==="PrimitiveType"||x.kind==="LiteralType")&&fv(Z.primitiveTypeKind,x.primitiveTypeKind)?Z.value===x.value?g4():S3(Z,x,Q):x.kind==="UnionType"&&x.types.every((q)=>n2(i1(Z,q,Q,X)))?g4():S3(Z,x,Q)}function C$0(Z,J,Q,X){if(R2(J))return{kind:"Product",diags:[]};if(!U2(Z)&&U2(J))return{kind:"Product",diags:S3(Z,J,Q).diags};let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;if(x.kind==="BlockType"){let q=cU(Z,x,Q,X);return{kind:"Product",diags:q.diags,staticState:q.staticState,dynamicState:q.dynamicState}}if(x.kind==="ProductType"){let q=O$0(Z,x,Q,X);return{kind:"Product",diags:q.diags,staticState:q.staticState,dynamicState:q.dynamicState}}return x.kind==="UnionType"?x.types.every((q)=>n2(i1(Z,q,Q,X)))?{kind:"Product",diags:[]}:{kind:"Product",diags:S3(Z,x,Q).diags}:{kind:"Product",diags:S3(Z,x,Q).diags}}function O$0(Z,J,Q,X){let x={matchProps:new Map},q={existed:new Set},Y=[];if(Z.name!==J.name){let z=[];[...Z.members].forEach(([W,{type:U}])=>{if(J.members.has(W)){let H=i1(U,J.members.get(W).type,Q,X);if(n2(H))if(Y4(U)){let{ruleset:B}=U;B.structure===Y1.Static?x.matchProps.set(W,!0):q.existed.add(W)}else x.matchProps.set(W,!0);else if(Y4(U)){let{ruleset:B}=U;B.structure===Y1.Static?x.matchProps.set(W,!1):q.existed.add(W)}else x.matchProps.set(W,!1);g(z,H.diags)}else z.push(e1.create(k.MissingPropertyOnElement,W,c0(Z,{db:Q})))}),Y=WZ(Z,J,Q,z)}let $=m$0(Q,Z.typeArguments,J.typeArguments,{t1Name:c0(Z,{db:Q})},X);return g(Y,$.diags),{diags:Y,staticState:x,dynamicState:q}}function m$0(Z,J,Q,{t1Name:X},x){let q=[],Y=()=>({diags:q});if(!J||J.length===0)return Y();if(!Q||J.length>Q.length)return q.push(e1.create(k.MissingTypeArguments,X,J.length)),Y();for(let $=0;$<J.length;$++){let z=J[$],W=Q[$],U=i1(z,W,Z,x);g(q,U.diags)}return Y()}function S$0(Z,J,Q,X){if(R2(J))return g4();let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;if(x.kind==="UnionType")return x.types.every((Y)=>n2(i1(Z,Y,Q,X)))?g4():S3(Z,x,Q);if(x.kind!=="Signature")return S3(Z,x,Q);if(Z.isBuiltIn&&x.isBuiltIn)return g4();if(Z.isBuiltIn||x.isBuiltIn)return S3(Z,x,Q);if(Z.parameters.length!==x.parameters.length)return{kind:"Ordinary",diags:[e1.create(k.WrongArgumentNumber,Z.parameters.length,x.parameters.length)]};let q=[];return Z.parameters.forEach((Y,$)=>{let z=Y.type,W=x.parameters[$].type;g(q,i1(W,z,Q,X).diags)}),g(q,i1(Z.returnType,x.returnType,Q,X).diags),{kind:"Ordinary",diags:q}}function AH(Z,J,Q,X){if(R2(J))return{kind:"Union",matchedType:Z.types[0],diags:[]};let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;if(x.kind==="UnionType"){let H=[];for(let B=0;B<x.types.length;B+=1){let M=AH(Z,x.types[B],Q,X);if(!n2(M))return{kind:"Union",matchedType:M.matchedType?M.matchedType:void 0,diags:WZ(Z,x,Q,M.diags)};M.matchedType&&H.push(M.matchedType)}return{kind:"Union",matchedType:q8(H),diags:[]}}let q,Y,$,z,W=g4(),U={...Z,types:Z.types.map((H)=>U2(H)?c5(H):G4(H)?H.type:H)};for(let H=0;H<Z.types.length;H+=1){if(W=i1(Z.types[H],x,Q,X),n2(W))return{kind:"Union",matchedType:Z.types[H],matchedCheck:W,diags:[]};if((x.kind==="ProductType"||x.kind==="BlockType")&&W.kind==="Product"){if(!c6(U.types[H]))throw new Error("Unreachable");let B=v$0(W,U.types[H],U,Q,X);q?T$0(q,B)&&(q=B,Y=W,$=Z.types[H],z=W):(q=B,Y=W,$=U.types[H],z=W)}}return{kind:"Union",matchedType:Y?$:void 0,matchedCheck:z,diags:Y?Y.diags:WZ(Z,J,Q)}}function R$0(Z,J,Q,X){let x=()=>S3(Z,J,Q),q=()=>({kind:"Product",diags:[]});if(R2(J))return q();let Y=KI(Z);if(!Y)return{kind:"Product",diags:[e1.create(k.MissingTypeArguments,"Partial","1")]};if(!c6(Y))return{kind:"Product",diags:[e1.create(k.PartialTypeNonApplicable,Y.kind)]};if(J.kind==="ProductType"&&Y.name===J.name)return q();if(U2(J)){let $=KI(J);if(!$)return{kind:"Product",diags:[e1.create(k.MissingTypeArguments,"Partial","1")]};if(!c6($))return{kind:"Product",diags:[e1.create(k.PartialTypeNonApplicable,$.kind)]};if(Y.name!==$.name){if(J.raw){let z=cU(Y,J.raw,Q,{...X,propsOptional:!0});if(!b2(z.diags))return q()}return x()}return q()}return J.kind==="BlockType"?{kind:"Product",diags:cU(Y,J,Q,{...X,propsOptional:!0}).diags}:x()}function I$0(Z,J,Q,X){if(R2(J))return g4();let x=Y4(J)&&J.ruleset.structure===Y1.Static?wZ(J):J;if(x.kind==="UnionType")return x.types.every(($)=>n2(i1(Z,$,Q,X)))?g4():S3(Z,x,Q);let q=YI(Z);if(!q)return{kind:"Product",diags:[e1.create(k.MissingTypeArguments,"Slot","1")]};if(!b6(x)){let $;return q.kind==="ProductType"&&q.name==="TemplateString"?$=i1(V4(Q),x,Q,X):$=i1(q,x,Q,X),b2($.diags)?{kind:$.kind,diags:WZ(Z,x,Q,$.diags)}:$}let Y=YI(x);return Y?q.kind==="PrimitiveType"&&q.primitiveTypeKind==="String"&&Y.kind==="ProductType"&&Y.name==="TemplateString"?g4():i1(q,Y,Q,X):{kind:"Product",diags:[e1.create(k.MissingTypeArguments,"Slot","2")]}}function T$0(Z,J){return Z.kind==="disjoint"?!1:J.kind==="disjoint"||J.correctPropCount>Z.correctPropCount?!0:J.correctPropCount===Z.correctPropCount?J.existedPropCount>Z.existedPropCount:!1}function v$0(Z,J,Q,X,x){var q;let Y=A$0(Z,J,Q,X,x);if(Y)return{kind:"disjoint",name:Y};let $=0,z=0;return(q=Z.staticState)==null||q.matchProps.forEach((W)=>{W?$+=1:z+=1}),{kind:"count",correctPropCount:$,existedPropCount:z}}function A$0(Z,J,Q,X,x){let{staticState:q}=Z;for(let[Y,$]of(q==null?void 0:q.matchProps.entries())??[])if($&&E$0(J,Y,Q,X,x))return Y}function E$0(Z,J,Q,X,x){let q=Z.members.get(J).type;for(let Y of Q.types){if(Y.kind!=="ProductType"||Y===Z)continue;let $=Y.members.get(J);if($&&(n2(i1(q,$.type,X,x))||n2(i1($.type,q,X,x))))return!1}return!0}function f$0(Z,J,Q,X){return R2(J)?g4():Y4(J)?n2(Fv(Z.ruleset,J.ruleset))&&n2(i1(Z.type,J.type,Q,X))?g4():{kind:"Ordinary",diags:WZ(Z,J,Q)}:Z.ruleset.structure===Y1.Static?{kind:"Ordinary",diags:i1(Z.type,J,Q,X).diags}:S3(Z,J,Q)}function S3(Z,J,Q,X){return{kind:"Ordinary",diags:WZ(Z,J,Q,X)}}function WZ(Z,J,Q,X){let x=Z.kind==="LiteralType"&&J.kind==="LiteralType"&&Z.primitiveTypeKind===J.primitiveTypeKind,q=c0(Z,{rawValueForLiteral:x,db:Q}),Y=c0(J,{rawValueForLiteral:x,db:Q});return X?[e1.createChain(k.MismatchedType,X,Y,q)]:[e1.create(k.MismatchedType,Y,q)]}function cU(Z,J,Q,X){let x=[],q={matchProps:new Map},Y={existed:new Set,uniqueName:new Map,uniqueType:new Map},$=Q.nodeById(J.blkId);if(!($ instanceof S0)&&!($ instanceof K2))throw new Error("Expected block");return $.body.forEach((z)=>{if(z instanceof C0&&z.elementType instanceof Z0){let W=VZ(z.elementType.value.value,Z);if(!W){x.push(l.createForNode(z.elementType.id,k.NonExistentProperty,z.elementType.value.value,c0(Z,{db:Q})));return}W.type.kind==="DynamicType"?g(x,zI(W,z,Z,Q,Y,X)):g(x,k$0({name:W.name,type:W.type},z,Z,Q,q,X))}else if(z instanceof _0&&z.elementName instanceof Z0){let W=VZ(z.elementType.value.value,Z);if(!W){x.push(l.createForNode(z.elementType.id,k.NonExistentProperty,z.elementType.value.value,c0(Z,{db:Q})));return}W.type.kind==="DynamicType"?g(x,zI(W,z,Z,Q,Y,X)):x.push(l.createForNode(z.elementType.id,k.UnexpectedThings,"element"))}else r7(z)||x.push(l.createForNode(z.id,k.UnexpectedThings,"element"))}),X!=null&&X.propsOptional||Z.members.forEach((z,W)=>{!Y4(z.type)&&z.symbol.kind!==p.BuiltInProperty&&z.symbol.kind!==p.DefaultElementName&&!q.matchProps.has(W)&&x.push(e1.create(k.MissingPropertyOnElement,W,c0(Z,{db:Q})))}),X!=null&&X.propsOptional&&(x=x.filter((z)=>z.code!==3003)),{diags:x,staticState:q,dynamicState:Y}}function k$0(Z,J,Q,X,x,q){if(x.matchProps.has(Z.name))return[l.createForNode(J.elementType.id,k.DuplicatedName,Z.name)];if(x.matchProps.set(Z.name,!0),J.body instanceof S0){let W=i1(Z.type,I5(J.body),X,q);return b2(W.diags)&&x.matchProps.set(Z.name,!1),ZX(W,J.elementType).diags}let Y=[];g(Y,q!=null&&q.propsOptional?X.typecheckWithPropsOptionalCtx(J.body.id):X.typecheck(J.body.id));let $=q!=null&&q.propsOptional?X.typeWithPropsOptionalCtx(J.body.id):X.type(J.body.id);if(g(Y,$.diagnostics),$.isErr())return Y;let z=i1(Z.type,$.unwrap(),X,q).diags;return b2(z)?(Y.push(kv(J.elementType,z,J.elementType.value.value,Q)),x.matchProps.set(Z.name,!1)):g(Y,z),Y}function zI(Z,J,Q,X,x,q){if(!(J.elementType instanceof Z0))throw new Error("Expected identifier");if(J instanceof _0&&!(J.elementName instanceof Z0))throw new Error("Expected identifier");let{ruleset:Y}=Z.type,$=Z.name,{structure:z}=Y,W;if(z===Y1.DictName||z===Y1.DictType||z===Y1.List){if(Z.type.type.kind!=="ProductType")throw new Error("Expected product type");if(!Z.type.type.members.has("__call__"))throw new Error("Expected Dict type");let H=Z.type.type.members.get("__call__").type;if(H.kind!=="Signature")throw new Error("Expected Signature");W=H.returnType}else W=Z.type.type;G4(W)&&(W=W.type);let U=[];if(Y.isRuleOn(j0.NameAs)&&J instanceof C0)return[l.createForNode(J.elementType.id,k.ExpectedThings,"element's name")];if(!Y.isRuleOn(j0.NameAs)&&J instanceof _0)return[l.createForNode(J.elementName.id,k.UnexpectedThings,"element's name")];if(!Y.isRuleOn(j0.Multiple)&&x.existed.has($))return[l.createForNode(J.elementType.id,k.MoreThanOneDynamicElement,$)];if(x.existed.add($),Y.isRuleOn(j0.UniqueType)){let H=x.uniqueType.get($)||new Set;if(H.has(J.elementType.value.value))return[l.createForNode(J.elementType.id,k.DuplicatedName,J.elementType.value.value)];H.add(J.elementType.value.value),x.uniqueType.set($,H)}if(Y.isRuleOn(j0.UniqueName)){if(!(J instanceof _0))throw new Error("Expected element declaration");x.uniqueName.has($)||x.uniqueName.set($,new Map);let H=X.symbol(J.id).unwrap(),B=x.uniqueName.get($);if(B.has(J.elementName.value.value))return[l.createForNode(J.elementName.id,k.DuplicatedName,J.elementName.value.value)];B.set(J.elementName.value.value,H)}if(J.params&&!Y.isRuleOn(j0.Attr)&&U.push(l.createForNode(J.params.id,k.UnexpectedThings,"attributes")),J.body)if(!W)U.push(l.createForNode(J.body.id,k.UnexpectedThings,"body"));else if(J.body instanceof S0){let H=i1(W,I5(J.body),X,q);g(U,ZX(H,J.elementType).diags)}else{let H=q!=null&&q.propsOptional?X.typeWithPropsOptionalCtx(J.body.id):X.type(J.body.id);if(g(U,H.diagnostics),H.isOk()){let B=i1(W,H.unwrap(),X,q).diags;b2(B)?U.push(kv(J.elementType,B,J.elementType.value.value,Q)):g(U,B)}}else Y.isRuleOn(j0.AllowNoBody)||U.push(l.createForNode(J.elementType.id,k.ExpectedThings,"body's value for this property"));return U}function kv(Z,J,Q,X,x){return X.name?l.createChainForNode(Z.id,k.IncompatiblePropertyOfType,J,Q,X.name):l.createChainForNode(Z.id,k.IncompatibleProperty,J,Q)}function ZX(Z,J){return pY(Z)?{...Z,diags:BY(Z.diags,J).map((Q)=>(Q.meta={unionMatchedType:Z.matchedType},Q))}:{...Z,diags:BY(Z.diags,J)}}function BY(Z,J){return Z.map((Q)=>Q instanceof l||Q instanceof M1?Q:new l(J.id,Q.message,Q.category,Q.code,Q.children))}function c$0(Z){return Z.parameters.length>0&&Z.parameters[0].symbol.name==="self"}function x4(Z,J,Q){return n2(i1(Z,J,Q))}function VZ(Z,J){if(!J.members)return;let Q=J.members.get(Z);if(Q)return{name:Z,type:Q.type,symbol:Q.symbol};let X=[...J.members].find(([x,{type:q}])=>Y4(q)&&q.ruleset.isRuleOn(j0.TypeAs));return X?{name:X[0],type:X[1].type,symbol:X[1].symbol}:void 0}function MY(Z,J){var Q,X,x;if(G4(J))return MY(Z,J.type);if(J.kind==="UnionType"){let q=[];return J.types.forEach((Y)=>{let $=MY(Z,Y);$&&q.push($)}),q=NH(q,u6),q.length===0?void 0:q8(q)}if(J.members){let q=(Q=VZ(Z,J))==null?void 0:Q.type;if(q&&Y4(q)){let{ruleset:Y}=q,{structure:$}=Y;if($===Y1.DictType||$===Y1.DictName||$===Y1.List){let{returnType:z}=(x=(X=q.type.members)==null?void 0:X.get("__call__"))==null?void 0:x.type;return z}return q.type}return q}}function h6(Z,J,Q,X,x,...q){let Y=i1(Z,J,x);if(!n2(Y))return l.createChainForNode(Q.id,X,Y.diags,...q)}var EQ=Symbol("MEMORY_CLEARED");function cv(Z,...J){if(J.length>0){if(!J[0].asInternKey)throw new Error("Key must be implement InternKey interface");return{keyId:J[0].asInternKey(Z,Z.queries),key:J[0],keyName:J[0].toString?J[0].toString():void 0}}return{keyId:0}}function fQ(Z,J,Q,...X){let{keyId:x,keyName:q,key:Y}=cv(Z,...X);return Z.createGraphNodeId({name:J,id:Q},{name:q,value:Y,id:x})}function bv(Z,J,Q,X){let{stacktrace:x}=J;if(x.length===0)return;let q=x[x.length-1];q.deps.add(Z),X.changedAt>q.changedAt&&(q.changedAt=X.changedAt)}class YY{constructor(){this.data=new Map}set(Z,J,Q){this.data.get(Z).set(J,Q)}has(Z,J){return!!this.data.get(Z).has(J)}get(Z,J){return this.data.get(Z).get(J)}delete(Z,J){this.data.get(Z).delete(J)}forEach(Z,J){return this.data.forEach(Z,J)}size(){let Z=0;return this.data.forEach((J)=>{Z+=J.size}),Z}}function pv(Z,J,Q,X){return X.equals?X.equals(Z,J,Q):Z===J}function b$0(Z,J){let Q=new Map;return J.data.forEach((X,x)=>{let q=Z.queryNameInterner.lookup(x),Y=new Map;X.forEach(($,z)=>{$.currentNodeId?Y.set($.currentNodeId.key.name||z.toString(),$):Y.set(z.toString(),$)}),Q.set(q,Y)}),Q}function yY(Z,J,Q){var X;let x=Z.graph.get(J.id,Q.id);return x||((X=Z.serializedEngine)==null?void 0:X.serializedCache)===void 0||(x=Z.serializedEngine.getQuery(J.name,Q.value),x&&Z.graph.set(J.id,Q.id,x)),x}function EH(Z){return Z instanceof C0&&sH(Z.elementType,"Tag")}var fH={DOUBLE_SPACES:/\s{2,}/,LEADING_TRAILING_SPACES:/^\s+|\s+$/,INVALID_SLASH_SPACING:/(\s+\/|\/\s+)/};function p$0(Z,J){return fH.DOUBLE_SPACES.test(Z)?[l.createForNode(J.id,k.DoubleSpacesInTagName)]:[]}function y$0(Z,J){return fH.LEADING_TRAILING_SPACES.test(Z)?[l.createForNode(J.id,k.LeadingTrailingSpacesInTagName)]:[]}function u$0(Z,J){let Q=[];return fH.INVALID_SLASH_SPACING.test(Z)&&Q.push(l.createForNode(J.id,k.InvalidSpacingAroundSlashInTagName)),(Z.match(/\//g)||[]).length>1&&Q.push(l.createForNode(J.id,k.TooManySlashesInTagName)),Q}function yv(Z,J){return Z.trim()===""?[l.createForNode(J.id,k.TagNameCannotBeEmpty)]:[...p$0(Z,J),...y$0(Z,J),...u$0(Z,J)]}function h$0(Z,J){if(!(J.body instanceof S0))return new r(v.Error,[l.createForNode(J.body.id,k.ExpectedThings,"block body")]);let Q=J.body.body.find((Y)=>n7(Y)&&sH(Y.elementType,"name"));if(!Q)return new r(v.Error,[]);if(!oH(Q.body))return new r(v.Error,[l.createForNode(Q.body.id,k.ExpectedThings,"static tag name")]);let X=Q.body.elements[0].value.value,x=yv(X,Q.body),q=`__tag__::${X}`.trim().toLowerCase().replace(/\s+/g," ");return new d(q,x)}class d{constructor(Z,J=[]){this.value=new X3(Z),this.diagnostics=J}unwrap(){return this.value.unwrap()}err(){throw new Error("Cannot get error from Result::Ok")}isOk(){return!0}isErr(){return!1}chain(Z){let J=Z(this.value.unwrap());return J.isOk()?new d(J.value.unwrap(),this.diagnostics.concat(J.diagnostics)):new r(J.value.err(),this.diagnostics.concat(J.diagnostics))}_chain(Z){return this.chain(Z)}guard(Z,J){return Z(this.value.unwrap())?this:new r(J,this.diagnostics)}}class r{constructor(Z,J=[]){this.value=new T2(Z),this.diagnostics=J}unwrap(){throw new Error("Cannot unwrap Result::Err")}err(){return this.value.err()}isOk(){return!1}isErr(){return!0}chain(Z){return new r(this.value.err(),this.diagnostics)}_chain(Z){throw new Error("Expected DiagOk")}guard(Z,J){return this}}function g$0(...Z){return Z.reduce((J,Q)=>J.concat(Q.diagnostics),[])}class X3{constructor(Z){this.value=Z}isOk(){return!0}isErr(){return!1}unwrap(){return this.value}err(){throw new Error("Cannot get error from Result::Ok")}}class T2{constructor(Z){this.error=Z}isOk(){return!1}isErr(){return!0}unwrap(){throw new Error("Cannot unwrap Result::Err")}err(){return this.error}}function bU(Z){return Z.kind===w.MIDDLE_STRING_LITERAL}function _Z(Z){return Z instanceof S1||Z instanceof _0||Z instanceof S0||Z instanceof A3||EH(Z)}function i$0(Z){if(Z.elementName instanceof k0)throw new Error("Declaration has quantifier name");return Z.elementName.value.value}function uv(Z){if(Z.elementName instanceof k0)throw new Error("Declaration has quantifier name");return Z.elementName}function d6(Z){return Z instanceof I1||Z instanceof B4||Z instanceof k0||Z instanceof v3||Z instanceof Z0||Z instanceof c1||Z instanceof C0||Z instanceof y2||Z instanceof M4||Z instanceof K2||Z instanceof z3||Z instanceof K3||Z instanceof a1||Z instanceof q3}function hv(Z){return Z instanceof Z0&&(Z.value.kind===w.FUNC_KEYWORD||Z.value.kind===w.IMPL_KEYWORD||Z.value.kind===w.TYPE_KEYWORD||Z.value.kind===w.CONST_KEYWORD||Z.value.kind===w.TRAIT_KEYWORD||Z.value.kind===w.IMPORT_KEYWORD||Z.value.kind===w.IF_KEYWORD||Z.value.kind===w.ELSE_KEYWORD)}function v8(Z){return Z instanceof _0&&Z.elementType.value.kind===w.FUNC_KEYWORD}function kH(Z){return Z instanceof C0&&Z.elementType instanceof Z0&&Z.elementType.value.kind===w.FUNC_KEYWORD}function uY(Z){return Z instanceof _0&&Z.elementType.value.kind===w.TRAIT_KEYWORD}function cH(Z){return Z instanceof _0&&Z.elementType.value.kind===w.IMPL_KEYWORD}function JX(Z){return Z instanceof _0&&Z.elementType.value.kind===w.TYPE_KEYWORD&&Z.body instanceof S0}function $4(Z){return Z instanceof k0&&Z.op.value==="."}function bH(Z){return Z instanceof _0&&Z.elementType.value.kind!==w.FUNC_KEYWORD&&Z.elementType.value.kind!==w.IMPL_KEYWORD&&Z.elementType.value.kind!==w.IMPORT_KEYWORD&&Z.elementType.value.kind!==w.TYPE_KEYWORD&&Z.elementType.value.kind!==w.CONST_KEYWORD&&Z.elementType.value.kind!==w.AS_KEYWORD&&Z.elementType.value.kind!==w.TRAIT_KEYWORD&&Z.elementType.value.kind!==w.USE_KEYWORD}function n7(Z){return Z instanceof C0?Z.elementType instanceof Z0&&Z.elementType.value.kind!==w.FUNC_KEYWORD&&Z.elementType.value.kind!==w.IMPL_KEYWORD&&Z.elementType.value.kind!==w.IMPORT_KEYWORD&&Z.elementType.value.kind!==w.TYPE_KEYWORD&&Z.elementType.value.kind!==w.CONST_KEYWORD&&Z.elementType.value.kind!==w.AS_KEYWORD&&Z.elementType.value.kind!==w.TRAIT_KEYWORD&&Z.elementType.value.kind!==w.USE_KEYWORD||Z.elementType instanceof k0:!1}function pH(Z){var J;if(!((J=Z.parent)!=null&&J.parent))throw new Error("Expected node parent");return v8(Z.parent.parent)||kH(Z.parent.parent)}function gv(Z){return Z instanceof A3}function QX(Z){return Z instanceof S1&&Z.elementType.value.kind!==w.TYPE_KEYWORD&&Z.elementType.value.kind!==w.USE_KEYWORD}function t8(Z){return Z instanceof _0&&Z.elementType.value.kind===w.USE_KEYWORD}function b5(Z){var J;return!(Z instanceof C0)&&!(Z instanceof I1)||!((J=Z.parent)!=null&&J.parent)?!1:JX(Z.parent.parent)||b5(Z.parent.parent)}function iv(Z){return!!(Z instanceof C0&&Z.params)||Z instanceof I1}function l6(Z){var J;return Z instanceof _0&&Z.parent instanceof K2?!0:!(Z instanceof C0)&&!(Z instanceof _0)||!((J=Z.parent)!=null&&J.parent)||b5(Z)||!(Z.parent instanceof S0)?!1:bH(Z.parent.parent)||n7(Z.parent.parent)||l6(Z.parent.parent)}function a7(Z){return!(!(Z instanceof _0)||Z.elementType.value.kind!==w.IDENTIFIER||l6(Z))}function s0(Z,J){if(Z){if(Z instanceof v1)return Z.statements.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof S1)return e0(Z.elementType,J)||s0(Z.elementType,J)||e0(Z.elementName,J)||e0(Z.body,J)||s0(Z.body,J)||Z.decorators&&Z.decorators.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof _0)return e0(Z.elementType,J)||s0(Z.elementType,J)||e0(Z.elementName,J)||s0(Z.elementName,J)||e0(Z.params,J)||s0(Z.params,J)||e0(Z.returnType,J)||s0(Z.returnType,J)||e0(Z.body,J)||s0(Z.body,J)||Z.decorators&&Z.decorators.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof S0)return Z.body.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof A3)return e0(Z.body,J)||s0(Z.body,J)||e0(Z.moduleName,J);if(Z instanceof I1)return e0(Z.callee,J)||s0(Z.callee,J)||e0(Z.args,J)||s0(Z.args,J);if(Z instanceof B4)return e0(Z.expression,J)||s0(Z.expression,J);if(Z instanceof k0)return e0(Z.leftExpression,J)||s0(Z.leftExpression,J)||e0(Z.rightExpression,J)||s0(Z.rightExpression,J);if(Z instanceof v3)return e0(Z.expression,J)||s0(Z.expression,J);if(Z instanceof C0)return e0(Z.elementType,J)||s0(Z.elementType,J)||e0(Z.params,J)||s0(Z.params,J)||e0(Z.returnType,J)||s0(Z.returnType,J)||e0(Z.body,J)||s0(Z.body,J);if(Z instanceof M4)return Z.exprList.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof K2)return Z.body.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof z3)return e0(Z.expr,J)||s0(Z.expr,J);if(Z instanceof k2)return Z.args.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof O4)return e0(Z.name,J)||e0(Z.typeReferenceExpression,J)||s0(Z.typeReferenceExpression,J)||e0(Z.value,J)||s0(Z.value,J);if(Z instanceof x6)return e0(Z.typeExpr,J)||s0(Z.typeExpr,J);if(Z instanceof s6)return Z.modules.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof u5)return e0(Z.moduleName,J)||e0(Z.moduleNameAs,J);if(Z instanceof K3)return e0(Z.ifKeyword,J)||e0(Z.condition,J)||s0(Z.condition,J)||e0(Z.thenBranch,J)||s0(Z.thenBranch,J)||e0(Z.elseKeyword,J)||e0(Z.elseBranch,J)||s0(Z.elseBranch,J);if(Z instanceof q3)return e0(Z.value,J)||s0(Z.value,J);if(Z instanceof a1)return Z.elements.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof y2)return e0(Z.content,J)||s0(Z.content,J);if(Z instanceof Z0&&Z.typeParameter)return e0(Z.typeParameter,J)||s0(Z.typeParameter,J);if(Z instanceof y5)return Z.expressions.reduce((Q,X)=>Q||e0(X,J)||s0(X,J),void 0);if(Z instanceof q6)return e0(Z.name,J)||s0(Z.name,J)||e0(Z.args,J)||s0(Z.args,J)}}function e0(Z,J){return Z&&J(Z)}function dv(Z,J){return!!s0(Z,(Q)=>Q.id.key===J.id.key)}function yH(Z){if(Z instanceof v1)return Z;if(Z.parent)return yH(Z.parent)}function lv(Z){if(Z.parent instanceof S0)return Z.parent.body.findIndex((J)=>J===Z)}function d$0(Z){return Z.parent?(Z.parent instanceof _0||Z.parent instanceof S1)&&!cH(Z.parent)&&Z.parent.elementName===Z:!1}function l$0(Z){var J;return!Z.parent||!((J=Z.parent.parent)!=null&&J.parent)?!1:Z.parent instanceof O4&&Z.parent.name===Z&&pH(Z.parent)}function uH(Z,J){if(Z)return e0(Z.parent,J)||uH(Z.parent,J)}function o$0(Z){return!!uH(Z,(J)=>J instanceof K2)}function o6(Z){if(!Z.parent)throw new Error("Expected node parent");return Z.parent instanceof v1||Z.parent instanceof S0&&(Z.parent.parent instanceof _0&&Z.parent.parent.elementType.value.kind===w.FUNC_KEYWORD||Z.parent.parent instanceof S0||Z.parent.parent instanceof v1||Z.parent.parent instanceof K3)?Z.parent:o6(Z.parent)}function x3(Z,J,Q,X=(x,q,Y,$)=>{x.set($,Y)}){let x=new Map(Z);return J.forEach((q,Y)=>{x.has(Y)&&(Q&&Q(x.get(Y))||!Q)?X(x,x.get(Y),q,Y):(Q&&Q(q)||!Q)&&x.set(Y,q)}),x}function k1(Z){return!(Z.isErr()&&Z.err()===v.WrongKind)}function I8(Z){let J=Z.document();return J!=null&&J.content.isNormalString()?Mv(J.content.elements[0].value.value):""}function r7(Z){return Z instanceof y2&&Z.name.value==="doc"}function s$0(Z,J){let Q=[],X=[];return Z.forEach((x)=>{let q=J.ast(x);Q.push(q.unwrap().transformedAst),g(X,q.diagnostics)}),new d(Q,X)}function hH(Z){return Z instanceof d1}function gH(Z){return Z instanceof nQ}function iH(Z){return Z?Z.kind in t:!1}class dH{constructor(){this.data=[],this.head=0,this.tail=-1}add(Z){this.tail+=1,this.data[this.tail]=Z}dequeue(){return this.head+=1,this.data[this.head-1]}empty(){return this.head>this.tail}get size(){return this.tail-this.head+1}}function p5(Z,J,Q){let X=Q.moduleIdOfFile(Z);return X?X.createIdForObjectInScope(J):J}function ov(Z){return Z.kind===w.CR||Z.kind===w.END_OF_LINE||Z.kind===w.TAB||Z.kind===w.WHITESPACE}function sv(Z){return typeof Z=="object"&&Z!==null&&"key"in Z}function g(Z,...J){J.forEach((Q)=>Array.isArray(Q)?Q.forEach((X)=>Z.push(X)):Z.push(Q))}function lH(Z){throw new Error("Unreachable")}function n$0(Z){return Z instanceof k0&&Z.op.kind===w.EQUAL}function oH(Z){return Z instanceof a1&&Z.elements.length===1&&Z.elements[0]instanceof c1&&Z.elements[0].value.kind===w.MIDDLE_STRING_LITERAL}function sH(Z,J){return Z instanceof Z0&&Z.value.value===J}function nv(Z,J,Q,X,x){var q;let Y=w0.create(`${Q}${J}__.aml`),$=[...((q=X==null?void 0:X.params)==null?void 0:q.map((W,U)=>Array.isArray(W.type)?`Type ${Q}${J}_p${U}__ = ${W.type.join(" | ")}`:`Type ${Q}${J}_p${U}__ = ${W.type}`))??[]].concat(X!=null&&X.returnType?Array.isArray(X.returnType)?`Type ${Q}${J}_return_type__ = ${X.returnType.join(" | ")}`:`Type ${Q}${J}_return_type__ = ${X.returnType}`:[]).concat(x?Array.isArray(x)?`Type ${Q}${J}_target_type__ = ${x.join(" | ")}`:`Type ${Q}${J}_target_type__ = ${x}`:[]).join(`;
139
- `);Z.setFileContent(Y,$);let z=Z.parse(Y).transformedAst();return{decoratorAst:z,lookupType:(W)=>{let U=z.statements[W];if(!U)return FZ(Z.db);let H=Z.typeFromTypeExpression(U.body.id);if(H.isErr()||b2(H.diagnostics))throw new Error(`Cannot get type '${U.body.fullText()}'.`);return H.unwrap()}}}function av(Z){var J,Q;return((Q=(J=Z.parent)==null?void 0:J.parent)==null?void 0:Q.parent)instanceof I1&&Z.parent.parent.parent.callee instanceof Z0&&Z.parent.parent.parent.callee.value.value==="r"}function rv(Z,J,Q){let X=Q?Q(Z,J):Z.symbol(J.id);if(X.isErr())return X;let x=X.unwrap(),q=Z.symbolReference(x.id);q.isOk()&&(x=q.unwrap());let Y=[];return g(Y,X.diagnostics,q.diagnostics),new d(x,Y)}function a$0(Z,J,Q){try{let X=Z.masterDb,{queryNameInterner:x}=X,q=(Y)=>{let $=fQ(X,Y,x.intern(Y),J),z=X.graph.get($.query.id,$.key.id);z&&(z.result=EQ)};Q.forEach(q)}catch{}}function r$0(Z,J){try{let Q=Z.masterDb,{queryNameInterner:X}=Q;J.forEach((x)=>{let q=X.map.get(x);if(!q)return;let Y=q.id,$=Q.graph.data.get(Y);$&&$.forEach((z)=>{z.result=EQ})})}catch(Q){console.error("Failed to release cache for queries:",Q)}}var nH=32,tv=class Z{constructor(J,Q,X){this.kind=J,this.filepath=Q,this.id=BigInt(X)<<BigInt(nH)|BigInt(Z.idSeq),Z.idSeq+=1}get key(){return this.id}static createWithId(J,Q,X){let x=new Z(J,Q,0);return x.id=X,x}toString(){return this.id.toString()}asInternKey(J,Q){return this.id}};tv.idSeq=0;var UZ=tv,aH=((Z)=>(Z.Decl="Decl",Z.Expr="Expr",Z.Syntax="Syntax",Z.Body="Body",Z.Import="Import",Z.Block="Block",Z))(aH||{});function z2(Z,J,Q,X){return new UZ(J,Q,X)}var Y0=((Z)=>(Z.Ast="Ast",Z.PrimaryExpression="PrimaryExpression",Z.Identifier="Identifier",Z.CallExpression="CallExpression",Z.ArgumentList="ArgumentList",Z.ArgumentExpression="ArgumentExpression",Z.ArithmeticExpression="ArithmeticExpression",Z.PrefixExpression="PrefixExpression",Z.InfixExpression="InfixExpression",Z.PostfixExpression="PostfixExpression",Z.TernaryExpression="TernaryExpression",Z.LiteralElementExpression="LiteralElementExpression",Z.EqualityDeclaration="EqualityDeclaration",Z.ReturnTypeNode="ReturnTypeNode",Z.ElementDeclaration="ElementDeclaration",Z.Block="Block",Z.BlockExpression="BlockExpression",Z.ListExpression="ListExpression",Z.GroupExpression="GroupExpression",Z.Heredoc="Heredoc",Z.ImportDeclaration="ImportDeclaration",Z.ImportBody="ImportBody",Z.ImportModule="ImportModule",Z.IfExpression="IfExpression",Z.EmbeddedExpression="EmbeddedExpression",Z.TemplateString="TemplateString",Z.TypeParameter="TypeParameter",Z.Decorator="Decorator",Z))(Y0||{}),t7=((Z)=>(Z.None="None",Z.HasError="HasError",Z))(t7||{}),ev=class Z{constructor(){this.flags="None"}getTokenStream(){if(this instanceof v1){let J=v1.tokenCache.get(this);if(J)return J;let Q=this.computeTokenStream();return v1.tokenCache.set(this,Q),Q}return this.computeTokenStream()}invalidateTokenStreamCache(J=!1){this instanceof v1&&v1.tokenCache.delete(this),J&&this.parent&&this.parent.invalidateTokenStreamCache(!0)}container(){if(this.parent instanceof S0||this.parent instanceof s6)return this.parent.parent instanceof _0||this.parent.parent instanceof C0||this.parent.parent instanceof A3?this.parent.parent:void 0;if(this.parent instanceof v1)return this.parent}children(){}prevSibling(){let J=this.container();if(!J)return;let Q=J.children(),X=Q.findIndex((x)=>x===this);if(!(X===-1||X===0))return Q[X-1]}nextSibling(){let J=this.container();if(!J)return;let Q=J.children(),X=Q.findIndex((x)=>x===this);if(!(X===-1||X===Q.length-1))return Q[X+1]}siblings(){let J=this.container();return J?J.children().filter((Q)=>Q!==this):void 0}span(){let J=this.getTokenStream();if(J.length===0)throw new Error("Unreachable");return{start:J[0].offset,end:J[J.length-1].offset+J[J.length-1].text.length}}fullSpan(){var J,Q,X;let x=this.getTokenStream();if(x.length===0)throw new Error("Unreachable");let q=x[0],Y=x[x.length-1],$=((Q=(J=q.leadingTrivia)==null?void 0:J[0])==null?void 0:Q.offset)??q.offset,z=(X=Y.trailingTrivia)==null?void 0:X[Y.trailingTrivia.length-1],W=z?z.offset+z.text.length:Y.offset+Y.text.length;return{start:$,end:W}}setEndingSeparator(J){this.endingSeparator=J}text(){let J=this.getTokenStream();if(J.length===0)return"";if(J.length===1)return J[0].text;let Q="";Q+=J[0].text;for(let X=1;X<J.length-1;X+=1)Q+=J[X].fullText();return Q+=J[J.length-1].text,Q}fullText(){return this.getTokenStream().map((J)=>J.fullText()).join("")}symbol(J){let Q=J.symbol(this.id);if(Q.isOk())return Q.unwrap()}locals(J){let Q=J.scope(this.id);if(Q.isOk())return Q.unwrap()}type(J){let Q=J.type(this.id);if(Q.isOk())return Q.unwrap()}};ev.tokenCache=new WeakMap;var d1=ev,m5=((Z)=>(Z[Z.None=0]="None",Z[Z.HasTrailingEndOfLine=1]="HasTrailingEndOfLine",Z))(m5||{});class l1{constructor(Z,J,Q,X,x){this.flags=0,this.data=Z,this.offset=J,this.leadingTrivia=Q,this.trailingTrivia=X,x&&(this.flags=x)}get kind(){return this.data.kind}get text(){return this.data.text}get value(){return this.data.value}get isFloat(){return this.data.isFloat}end(){return this.offset+this.text.length}fullText(){var Z,J;let Q="";return(Z=this.leadingTrivia)==null||Z.forEach((X)=>{Q+=X.text}),Q+=this.text,(J=this.trailingTrivia)==null||J.forEach((X)=>{Q+=X.text}),Q}clone(){var Z,J;return new l1(this.data,this.offset,(Z=this.leadingTrivia)==null?void 0:Z.map((Q)=>Q.clone()),(J=this.trailingTrivia)==null?void 0:J.map((Q)=>Q.clone()),this.flags)}}var w=((Z)=>(Z.OPEN_EMBEDDED_EXPRESSION="OPEN_EMBEDDED_EXPRESSION",Z.CLOSE_EMBEDDED_EXPRESSION="CLOSE_EMBEDDED_EXPRESSION",Z.STRING_START="STRING_START",Z.STRING_END="STRING_END",Z.INVALID_STRING_END="INVALID_STRING_END",Z.MIDDLE_STRING_LITERAL="MIDDLE_STRING_LITERAL",Z.NUMBER_LITERAL="NUMBER_LITERAL",Z.TRUE_LITERAL="TRUE_LITERAL",Z.FALSE_LITERAL="FALSE_LITERAL",Z.CONST_KEYWORD="CONST_KEYWORD",Z.TYPE_KEYWORD="TYPE_KEYWORD",Z.IMPORT_KEYWORD="IMPORT_KEYWORD",Z.FUNC_KEYWORD="FUNC_KEYWORD",Z.TRAIT_KEYWORD="TRAIT_KEYWORD",Z.IMPL_KEYWORD="IMPL_KEYWORD",Z.USE_KEYWORD="USE_KEYWORD",Z.AS_KEYWORD="AS_KEYWORD",Z.LBRACE="LBRACE",Z.RBRACE="RBRACE",Z.LPAREN="LPAREN",Z.RPAREN="RPAREN",Z.LBRACKET="LBRACKET",Z.RBRACKET="RBRACKET",Z.COLON="COLON",Z.SEMICOLON="SEMICOLON",Z.COMMA="COMMA",Z.EQUAL="EQUAL",Z.ARROW="ARROW",Z.OPERATOR="OPERATOR",Z.AT_SIGN="AT_SIGN",Z.RAW_AT_SIGN="RAW_AT_SIGN",Z.HEREDOC_CONTENT="HEREDOC_CONTENT",Z.IDENTIFIER="IDENTIFIER",Z.IF_KEYWORD="IF_KEYWORD",Z.ELSE_KEYWORD="ELSE_KEYWORD",Z.WHITESPACE="WHITESPACE",Z.TAB="TAB",Z.CR="CR",Z.END_OF_LINE="END_OF_LINE",Z.SINGLE_LINE_COMMENT="SINGLE_LINE_COMMENT",Z.MULTILINE_COMMENT="MULTILINE_COMMENT",Z.HEREDOC="HEREDOC",Z.INVALID="INVALID",Z.EOF="EOF",Z))(w||{}),ZA=class Z extends d1{constructor(J=[],Q,X){super(),this.kind="Ast",this.statements=J,this.statements.forEach((x)=>x.parent=this),this.filePath=Q,this.filepathId=X}addStatement(J){J.parent=this,this.statements.push(J),this.invalidateTokenStreamCache(!0)}setEofToken(J){this.eofToken=J,this.invalidateTokenStreamCache(!0)}assignIds(){let J;if(UZ.idSeq=0,this.filePath)J=this.filePath.toString(),this.id=new UZ("Decl",J,this.filepathId);else throw new Error("Cannot assign ids to Ast without a filepath");this.statements.forEach((Q)=>{let X;Q instanceof A3?X="Import":Q instanceof S0?X="Block":_Z(Q)?X="Decl":X="Expr",Q.assignIds(X,J,this.filepathId)})}computeTokenStream(){let J=[];return this.statements.forEach((Q)=>g(J,Q.getTokenStream())),this.eofToken&&J.push(this.eofToken),J}children(){return this.statements}};ZA.defaultPathCounter=0;var v1=ZA;class q3 extends d1{constructor(Z,J,Q){super(),this.kind="EmbeddedExpression",this.openBraceToken=Z,this.closeBraceToken=Q,this.value=J,this.value.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.value.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.openBraceToken,this.value.getTokenStream(),this.closeBraceToken),Z}}class a1 extends d1{constructor(Z,J,Q){super(),this.kind="TemplateString",this.openQuoteToken=Z,this.closeQuoteToken=Q,this.elements=J,this.elements.forEach((X)=>{X.parent=this})}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.elements.forEach((X)=>{X.assignIds("Expr",J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openQuoteToken),this.elements.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeQuoteToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}getEmbeddedExpressions(){return this.elements.filter((Z)=>Z.kind==="EmbeddedExpression")}isNormalString(){return this.elements.length!==0&&this.getEmbeddedExpressions().length===0}stringText(){return this.elements.map((Z)=>Z.text()).join("")}}class K3 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="IfExpression",this.ifKeyword=Z,this.condition=J,this.thenBranch=Q,this.elseKeyword=X,this.elseBranch=x,this.ifKeyword.parent=this,this.condition&&(this.condition.parent=this),this.thenBranch&&(this.thenBranch.parent=this),this.elseKeyword&&(this.elseKeyword.parent=this),this.elseBranch&&(this.elseBranch.parent=this)}assignIds(Z,J,Q){var X,x,q,Y;this.id=z2(this,Z,J,Q),this.ifKeyword.assignIds("Syntax",J,Q),(X=this.condition)==null||X.assignIds("Expr",J,Q),(x=this.thenBranch)==null||x.assignIds("Block",J,Q),(q=this.elseKeyword)==null||q.assignIds("Syntax",J,Q),this.elseBranch instanceof S0?this.elseBranch.assignIds("Block",J,Q):(Y=this.elseBranch)==null||Y.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.ifKeyword.getTokenStream()),this.condition&&g(Z,this.condition.getTokenStream()),this.thenBranch&&g(Z,this.thenBranch.getTokenStream()),this.elseKeyword&&g(Z,this.elseKeyword.getTokenStream()),this.elseBranch&&g(Z,this.elseBranch.getTokenStream()),this.endingSeparator&&g(Z,this.endingSeparator),Z}}class c1 extends d1{constructor(Z){super(),this.kind="PrimaryExpression",this.value=Z}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q)}computeTokenStream(){let Z=[];return Z.push(this.value),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class y5 extends d1{constructor(Z,J,Q,X){super(),this.kind="TypeParameter",this.openToken=Z,this.expressions=J,this.expressions.forEach((x)=>{x.parent=this}),this.closeToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expressions.forEach((X)=>X.assignIds("Expr",J,Q))}computeTokenStream(){let Z=this.expressions.reduce((J,Q,X)=>X<this.commaSeparatorList.length?J.concat(Q.getTokenStream()).concat(this.commaSeparatorList[X]):J.concat(Q.getTokenStream()),[]);return[this.openToken].concat(Z).concat([this.closeToken])}}class Z0 extends d1{constructor(Z,J){super(),this.kind="Identifier",this.value=Z,this.typeParameter=J,this.typeParameter&&(this.typeParameter.parent=this)}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),(X=this.typeParameter)==null||X.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return Z.push(this.value),this.typeParameter&&g(Z,this.typeParameter.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class I1 extends d1{constructor(Z,J){super(),this.kind="CallExpression",this.callee=Z,this.args=J,this.callee.parent=this,this.args.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.callee.assignIds("Syntax",J,Q),this.args.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.callee.getTokenStream()),g(Z,this.args.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class k2 extends d1{constructor(Z,J,Q,X){super(),this.kind="ArgumentList",this.args=Z,this.args.forEach((x)=>{x.parent=this}),this.openParenToken=J,this.closeParenToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.args.forEach((X)=>X.assignIds("Syntax",J,Q))}computeTokenStream(){let Z=[];return Z.push(this.openParenToken),this.args.forEach((J,Q)=>Q<this.commaSeparatorList.length?g(Z,J.getTokenStream(),this.commaSeparatorList[Q]):g(Z,J.getTokenStream())),Z.push(this.closeParenToken),Z}}class O4 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="ArgumentExpression",this.value=Z,this.value&&(this.value.parent=this),this.name=J,this.name&&(this.name.parent=this),this.separatorColonToken=Q,this.typeReferenceExpression=X,this.typeReferenceExpression&&(this.typeReferenceExpression.parent=this),this.equalSign=x}asParameter(){let{nameNode:Z,nameValue:J}=this.extractNameInfo(),Q={name:{node:Z,name:J}};if(this.typeReferenceExpression&&(Q.type={node:this.typeReferenceExpression}),this.equalSign){if(!this.value)throw new Error("Value expected");Q.defaultValue={node:this.value}}return Q}asArgument(){let Z={};return this.name&&this.name instanceof Z0&&(Z.name={node:this.name,name:this.name.value.value}),this.value&&(Z.value={node:this.value}),Z}asAmlTypeOption(){let{nameNode:Z,nameValue:J}=this.extractNameInfo(),Q={name:{node:Z,name:J}};return this.typeReferenceExpression&&(Q.value={node:this.typeReferenceExpression}),Q}extractNameInfo(){if(this.name)return{nameNode:this.name,nameValue:this.name.value.value};if(!this.value)throw new Error("Value expected");return{nameNode:this.value,nameValue:this.value instanceof Z0?this.value.value.value:void 0}}assignIds(Z,J,Q){var X,x,q;this.id=z2(this,Z,J,Q),(X=this.name)==null||X.assignIds("Syntax",J,Q),(x=this.value)==null||x.assignIds("Syntax",J,Q),(q=this.typeReferenceExpression)==null||q.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];if(this.name){if(g(Z,this.name.getTokenStream()),this.separatorColonToken&&this.typeReferenceExpression&&g(Z,this.separatorColonToken,this.typeReferenceExpression.getTokenStream()),this.equalSign){if(!this.value)throw new Error("Value expected");g(Z,this.equalSign,this.value.getTokenStream())}}else{if(!this.value)throw new Error("Value expected");g(Z,this.value.getTokenStream())}return Z}}class B4 extends d1{constructor(Z,J){super(),this.kind="PrefixExpression",this.op=Z,this.expression=J,this.expression.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.op,this.expression.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class k0 extends d1{constructor(Z,J,Q){super(),this.kind="InfixExpression",this.leftExpression=Z,this.leftExpression.parent=this,this.op=J,this.rightExpression=Q,this.rightExpression.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.leftExpression.assignIds("Expr",J,Q),this.rightExpression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.leftExpression.getTokenStream(),this.op,this.rightExpression.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class v3 extends d1{constructor(Z,J){super(),this.kind="PostfixExpression",this.expression=Z,this.expression.parent=this,this.op=J}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.expression.getTokenStream(),this.op),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class C0 extends d1{constructor(Z,J,Q,X,x,q){super(),this.kind="LiteralElementExpression",this.elementType=Z,this.elementType.parent=this,this.params=Q,this.params&&(this.params.parent=this),this.returnType=X,this.returnType&&(this.returnType.parent=this),this.body=J,this.body.parent=this,this.colonSeparator=x,this.decorators=q,this.decorators&&this.decorators.forEach((Y)=>{Y.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X,x,q;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),(X=this.params)==null||X.assignIds("Syntax",J,Q),(x=this.returnType)==null||x.assignIds("Syntax",J,Q),d6(this.body)?this.body.assignIds("Expr",J,Q):this.body.assignIds("Body",J,Q),(q=this.decorators)==null||q.forEach((Y)=>{Y.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream()),this.params&&g(Z,this.params.getTokenStream()),this.returnType&&g(Z,this.returnType.getTokenStream()),this.body instanceof S0?g(Z,this.body.getTokenStream()):g(Z,this.colonSeparator,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}children(){return this.body instanceof S0?this.body.body:void 0}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class S1 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="EqualityDeclaration",this.elementType=Z,this.elementType.parent=this,this.elementName=J,this.elementName.parent=this,this.equalSign=Q,this.body=X,this.body&&(this.body.parent=this),this.decorators=x,this.decorators&&this.decorators.forEach((q)=>{q.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),this.elementName.assignIds("Syntax",J,Q),this.body.assignIds("Expr",J,Q),(X=this.decorators)==null||X.forEach((x)=>{x.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream(),this.elementName.getTokenStream(),this.equalSign,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class x6 extends d1{constructor(Z,J){super(),this.kind="ReturnTypeNode",this.arrowToken=Z,this.typeExpr=J,this.typeExpr.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.typeExpr.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.arrowToken,this.typeExpr.getTokenStream()),Z}}class _0 extends d1{constructor(Z,J,Q,X,x,q,Y){super(),this.kind="ElementDeclaration",this.elementType=Z,this.elementType.parent=this,this.elementName=J,this.elementName.parent=this,this.decorators=Y,this.params=Q,this.params&&(this.params.parent=this),this.returnType=X,this.returnType&&(this.returnType.parent=this),this.body=x,this.colonSeparator=q,this.body&&(this.body.parent=this),this.decorators&&this.decorators.forEach(($)=>{$.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X,x,q,Y;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),this.elementName.assignIds("Syntax",J,Q),(X=this.params)==null||X.assignIds("Syntax",J,Q),(x=this.returnType)==null||x.assignIds("Syntax",J,Q),this.body instanceof S0?this.body.assignIds("Body",J,Q):(q=this.body)==null||q.assignIds("Expr",J,Q),(Y=this.decorators)==null||Y.forEach(($)=>{$.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream(),this.elementName.getTokenStream()),this.params&&g(Z,this.params.getTokenStream()),this.returnType&&g(Z,this.returnType.getTokenStream()),this.body instanceof S0?g(Z,this.body.getTokenStream()):this.body&&g(Z,this.colonSeparator,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}children(){return this.body instanceof S0?this.body.body:void 0}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class S0 extends d1{constructor(Z,J,Q){super(),this.kind="Block",this.body=Z,this.body.forEach((X)=>{X.parent=this}),this.openBraceToken=J,this.closeBraceToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.body.forEach((X)=>{let x;X instanceof A3?x="Import":X instanceof S0?x="Block":_Z(X)||X instanceof C0?x="Decl":x="Expr",X.assignIds(x,J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openBraceToken),this.body.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeBraceToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class K2 extends d1{constructor(Z,J,Q){super(),this.kind="BlockExpression",this.body=Z,this.body.forEach((X)=>{X.parent=this}),this.openBraceToken=J,this.closeBraceToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.body.forEach((X)=>{_Z(X)||X instanceof C0?X.assignIds("Decl",J,Q):X.assignIds("Expr",J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openBraceToken),this.body.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeBraceToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class M4 extends d1{constructor(Z,J,Q,X){super(),this.kind="ListExpression",this.exprList=Z,this.exprList.forEach((x)=>{x.parent=this}),this.openBracketToken=J,this.closeBracketToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.exprList.forEach((X)=>X.assignIds("Expr",J,Q))}computeTokenStream(){let Z=[];return Z.push(this.openBracketToken),this.exprList.forEach((J,Q)=>Q<this.commaSeparatorList.length?g(Z,J.getTokenStream(),this.commaSeparatorList[Q]):g(Z,J.getTokenStream())),Z.push(this.closeBracketToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class z3 extends d1{constructor(Z,J,Q){super(),this.kind="GroupExpression",this.expr=Z,this.expr.parent=this,this.openParenToken=J,this.closeParenToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expr.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.openParenToken,this.expr.getTokenStream(),this.closeParenToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class y2 extends d1{constructor(Z,J,Q){super(),this.kind="Heredoc",this.atSignToken=Z,this.name=J,this.content=Q,this.content.parent=this}isRaw(){return this.atSignToken.kind==="RAW_AT_SIGN"}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.content.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.atSignToken,this.name,this.content.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class q6 extends d1{constructor(Z,J,Q){super(),this.kind="Decorator",this.atSignToken=Z,this.name=J,this.args=Q,this.name.parent=this,this.args&&(this.args.parent=this)}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.name.assignIds("Syntax",J,Q),this.args&&this.args.assignIds("Syntax",J,Q)}computeTokenStream(){var Z;let J=[];return g(J,this.atSignToken,this.name.getTokenStream(),(Z=this.args)==null?void 0:Z.getTokenStream()),this.endingSeparator&&J.push(this.endingSeparator),J}}class A3 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="ImportDeclaration",this.importToken=Z,this.path=J,this.body=Q,this.body&&(this.body.parent=this),this.asToken=X,this.moduleName=x,this.moduleName&&(this.moduleName.parent=this),this.body&&(this.body.parent=this)}assignIds(Z,J,Q){var X,x;this.id=z2(this,Z,J,Q),(X=this.body)==null||X.assignIds("Body",J,Q),(x=this.moduleName)==null||x.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return Z=Z.concat([this.importToken,this.path]),this.body&&(Z=Z.concat(this.body.getTokenStream())),this.asToken&&(Z=Z.concat([this.asToken])),this.moduleName&&(Z=Z.concat(this.moduleName.getTokenStream())),Z.concat(this.endingSeparator?[this.endingSeparator]:[])}children(){return this.body?this.body.modules:void 0}}class s6 extends d1{constructor(Z,J,Q){super(),this.kind="ImportBody",this.openBraceToken=Z,this.closeBraceToken=J,this.modules=Q,this.modules.forEach((X)=>{X.parent=this})}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.modules.forEach((X)=>X.assignIds("Decl",J,Q))}computeTokenStream(){return[this.openBraceToken].concat(this.modules.reduce((Z,J)=>Z.concat(J.getTokenStream()),[])).concat([this.closeBraceToken])}}class u5 extends d1{constructor(Z,J,Q){super(),this.kind="ImportModule",this.moduleName=Z,this.moduleName.parent=this,this.asToken=J,this.moduleNameAs=Q,this.moduleNameAs&&(this.moduleNameAs.parent=this)}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),this.moduleName.assignIds("Decl",J,Q),(X=this.moduleNameAs)==null||X.assignIds("Decl",J,Q)}computeTokenStream(){return this.asToken&&this.moduleNameAs?this.moduleName.getTokenStream().concat([this.asToken]).concat(this.moduleNameAs.getTokenStream()).concat(this.endingSeparator?[this.endingSeparator]:[]):this.moduleName.getTokenStream().concat(this.endingSeparator?[this.endingSeparator]:[])}}class U1{constructor(Z,J){this.env=Z,this.returnVal=J}toJsStructure(){return{env:this.env.toJsStructure(),returnVal:this.returnVal.toJsStructure()}}}var v=((Z)=>(Z.WrongKind="WrongKind",Z.Error="Error",Z))(v||{}),Y3=((Z)=>(Z.REPLACE_BUILTIN="REPLACE_BUILTIN",Z.EXTEND_BUILTIN="EXTEND_BUILTIN",Z))(Y3||{});class rH{constructor(Z){this._parseResult=Z}originalAst(){return this._parseResult.unwrap().originalAst}transformedAst(){return this._parseResult.unwrap().transformedAst}parseDiagnostics(){return this._parseResult.diagnostics}diagnostics(){return this.parseDiagnostics()}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class X8{constructor(Z){this.diags=Z}diagnostics(){return this.diags}isOk(){return!b2(this.diagnostics())}isErr(){return!this.isOk()}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class b7 extends X8{constructor(Z,J){super(Z.diags),this._evalResult=J}isOk(){var Z;return!!((Z=this._evalResult)!=null&&Z.isOk())}isErr(){return!this.isOk()}evalResult(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap():void 0}returnVal(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().returnVal:void 0}env(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().env:void 0}evalDiagnostics(){var Z;return(Z=this._evalResult)!=null&&Z.isErr()?this._evalResult.err():[]}diagnostics(){return super.diagnostics().concat(this.evalDiagnostics())}}class tH{constructor(Z){this.parseMap=Z}diagnostics(){return[...this.parseMap.values()].reduce((Z,J)=>(g(Z,J.diagnostics()),Z),[])}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class hY{constructor(Z){this.typecheckMap=Z}diagnostics(){return this.typecheckDiagnostics()}typecheckDiagnostics(){return[...this.typecheckMap.values()].reduce((Z,J)=>(g(Z,J.diagnostics()),Z),[])}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class JA extends hY{constructor(Z,J){super(Z.typecheckMap),this._evalResult=J}diagnostics(){var Z;return(Z=this._evalResult)!=null&&Z.isErr()?super.diagnostics().concat(this._evalResult.err()):super.diagnostics()}isOk(){var Z;return!!((Z=this._evalResult)!=null&&Z.isOk())}isErr(){return!this.isOk()}evalResult(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap():void 0}returnVal(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().returnVal:void 0}env(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().env:void 0}}class PZ{constructor(Z,J){this.name=Z,this.parent=J,this.key=this.toString()}isRoot(){return this.name===n8.globalModuleName&&!this.parent}toString(){return this.parent?this.parent.isRoot()?this.name:`${this.parent.key}::${this.name}`:this.name}createIdForObjectInScope(Z){return this.isRoot()?Z:`${this.key}::${Z}`}asInternKey(Z,J){return this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internModuleId(this),this.idVerifiedAt=Z.revision,this.id)}}class p7{constructor(Z,J,Q=[],X=[]){this.id=Z,this.name=J,this.amlFiles=Q,this.modules=X}}function t$0(Z,J){return J.kind!==p.Module?new r(v.WrongKind):new d(wH(Z))}function e$0(Z,J){if(J.kind!==p.Module)return new r(v.WrongKind);if(!(J instanceof q4))throw new Error("Expected module symbol");return Z.membersOfModule(J.moduleId)}function ZK0(Z,J){let Q=Z.moduleById(J),X=new k5,x=[];return Q.amlFiles.forEach((q)=>{let Y=Z.scopeOfFile(q);g(x,Y.diagnostics),Y.isOk()&&X.merge(Y.unwrap(),[o7.Public])}),Q.modules.forEach((q)=>{let Y=Z.symbolOfModule(q.id);if(Y.isErr())return;let $=Y.unwrap();X.set($.name,$)}),new d(X,x)}function JK0(Z,J,Q){if(J instanceof H0){let X=Z.nodeById(J.declarationId),x=X instanceof _0||X instanceof S1?X.elementName:X;return l.createForNode(x.id,k.DuplicatedNameInModuleScope,J.name,`there is another ${QK0(Z,Q)}`)}throw new Error("Expected s1 to be NodeSymbol")}function QK0(Z,J){return J.map((Q)=>{if(Q.kind===p.Module)return`module name '${Q.name}'`;let X=Z.filepathFromSymbol(Q.id);return X?`'${Q.name}' in file '${X}'`:`'${Q.name} in global scope'`}).join(", ")}function XK0(Z,J){if(!$4(J))throw new Error("Expected property access expression");let Q=Z.symbol(J.leftExpression.id);if(Q.isErr())return;if(Q.unwrap()instanceof q4&&J.rightExpression instanceof Z0){let X=Z.symbol(J.id);if(X.isErr())return;let x=X.unwrap();return!(x instanceof H0)||!x.declarationId?void 0:w0.create(x.declarationId.filepath)}}function gY(Z,J,Q){let X=[],x=Z.membersOfModule(J),q=x.unwrap();return g(X,x.diagnostics),q.has(Z,Q)?new d(q.get(Z,Q).symbol,X):J.parent?gY(Z,J.parent,Q).chain((Y)=>new d(Y,X)):new r(v.Error)}var xK0={name:"ModuleSystem",hooks:{typeOfSymbol:t$0,members:e$0}};function qK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.symbol.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.symbol)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.symbol.extending)x=q(Z,X,x);return x}function i4(Z,J,Q,X){let x=Q.scope(Z.id),q=[];if(g(q,x.diagnostics),x.isOk()){let Y=x.unwrap();if(Y.has(Q,J))return new d(Y.get(Q,J).symbol,q);if(!(Z instanceof v1)){if(!Z.parent)throw new Error("Node parent is undefined");let U=i4(Z.parent,J,Q,X);return g(q,U.diagnostics),U.isOk()?new d(U.unwrap(),q):new r(U.err(),q)}if(Q.globalScope().has(Q,J))return new d(Q.globalScope().get(Q,J).symbol,q);let $=w0.create(X.id.filepath);if(!$)return q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q);let z=Q.moduleIdOfFile($);if(!z)return q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q);let W=HZ(Q,()=>gY(Q,z,J));return g(q,W.diagnostics),W.isOk()?new d(W.unwrap(),q):(q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q))}if(!Z.parent)throw new Error("Node parent is undefined");return i4(Z.parent,J,Q,X).chain((Y)=>new d(Y,q))}function QY(Z,J){if(Z.globalScope().has(Z,J))return Z.globalScope().get(Z,J).symbol;let Q=HZ(Z,()=>{let X=Z.moduleIdMap().get(n8.globalModuleName);return gY(Z,X.id,J)});if(Q.isOk())return Q.unwrap()}function HZ(Z,J){let{masterDb:Q}=Z.program,{trackDeps:X}=Q;Q.trackDeps=!1;let x=J();if(Q.trackDeps=X,x.isOk()){let q=x.unwrap();if(q instanceof H0&&q.declarationId){let Y=w0.create(q.declarationId.filepath);Z.scopeOfFile(Y)}else q instanceof q4?Z.checkModuleExists(q.moduleId):J();return new d(x.unwrap())}return J(),x}function YK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.scope.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.scope)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.scope.extending)x=q(Z,X,x);return x}function $K0(Z,J){return Z.ast(J).chain(({transformedAst:Q})=>Z.scope(Q.id))}function KK0(Z,J){let{program:Q}=Z,X=Z.symbolById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.symbolReference.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.symbolReference)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.symbolReference.extending)x=q(Z,X,x);return x}function zK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.allSymbolsFromContext.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.allSymbolsFromContext)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.allSymbolsFromContext.extending)x=q(Z,X,x);return x}function WK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!(X instanceof Z0))return x;for(let q of Q.customModuleProviders.identifierSymbol.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.identifierSymbol)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.identifierSymbol.extending)x=q(Z,X,x);return x}function h5(Z,J){return Z.find(({nodeId:Q})=>Q.key===J.id.key)}function VK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.mergeableInnerScope.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.mergeableInnerScope)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.mergeableInnerScope.extending)x=q(Z,X,x);return x}var QA="modules";function UK0(Z){let[J,Q]=Z.nameAndExtension();return Q?!1:J===QA}function HK0(Z,J){let Q=[],X=Z.getParentDir();if(!X)return Q;if(UK0(X)){let x=l.createForNode(J,k.InvalidDirectFileInModule);Q.push(x)}return Q}function GK0(Z){let J=[],Q=!1;return[!Z.some((X)=>X.asArgument().name?(Q=!0,!1):Q?(J.push(l.createForNode(X.id,k.PositionalAfterNamedArg)),!0):!1),J]}function BK0(Z,J,Q){let X=[],x=Z.filter((q,Y)=>!J.has(Y));return x.forEach((q)=>{q.hasDefaultValue||X.push(l.createForNode(Q.id,k.MissingRequiredParameter,q.symbol.name))}),[x,X]}function MK0(Z){let J=new Map;return Z.forEach((Q,X)=>{J.set(Q.symbol.name,{param:Q,index:X})}),J}function DK0(Z,J,Q){let X=[],x=new Map,q=new Set;return Z.forEach((Y)=>{let $=Y.asArgument();if($.name){let z=$.name.name;if(!Q.has(z)){X.push(l.createForNode($.name.node.id,k.InvalidParameterName,z));return}let{param:W,index:U}=Q.get(z);if(q.has(U)){X.push(l.createForNode($.name.node.id,k.DuplicateArgument,z));return}q.add(U),x.set(z,{argId:Y.id,paramIndex:U})}else{let z;for(let U=0;U<J.length;U++)if(!q.has(U)){z=U;break}if(z===void 0){X.push(l.createForNode(Y.id,k.WrongArgumentNumber,J.length,Z.length));return}let W=J[z];q.add(z),x.set(W.symbol.name,{argId:Y.id,paramIndex:z})}}),[x,q,X]}function FK0(Z,J,Q){let X=N$0(J),x=Z.symbol(Q.id);if(x.isErr())return[...x.diagnostics];let q=Z.type(Q.id).unwrap(),Y=Q.leftExpression;if(G4(q)){let W=q.parentType,{ruleset:U}=W;if(U.isRuleOn(j0.RootNamespace)){let H=Z.type(Q.leftExpression.id).unwrap();if(Y4(H)){if(!$4(Q.leftExpression))throw new Error("Expected property access expression");Y=Q.leftExpression.leftExpression}}}let $=Z.type(Y.id).unwrap(),z=h6(X,$,Y,k.MismatchedArgumentType,Z,c0($,{db:Z}),c0(X,{db:Z}));return z?[z]:[]}var pU=((Z)=>(Z[Z.TYPE_MATCH=100]="TYPE_MATCH",Z[Z.STRUCTURAL_MATCH=40]="STRUCTURAL_MATCH",Z[Z.NO_MATCH=0]="NO_MATCH",Z))(pU||{});function NK0(Z,J,Q){let X=_K0(Z,J,Q);return{score:X.length===0?100:40,typeCompatibilityDiags:X}}function wK0(Z,J,Q){let X=[];if(J){let x=Q.nodeById(J.argId);if(!x)return X;let q=x.asArgument();if(q.value){let Y=Pv(Q,x);if(g(X,Y.diagnostics),Nv(Z.type))if(!$4(q.value.node))X.push(l.createForNode(x.id,k.ExpectedThings,"property access expression"));else{let $=FK0(Q,Z.type,q.value.node);g(X,$)}else{let $=h6(Z.type,Y.unwrap(),x,k.MismatchedArgumentType,Q,c0(Y.unwrap(),{db:Q}),c0(Z.type,{db:Q}));$&&X.push($)}}}return X}function _K0(Z,J,Q){let X=[];return Z.forEach((x)=>{let q=x.symbol.name,Y=J.get(q),$=wK0(x,Y,Q);g(X,$)}),X}function PK0(Z,J,Q,X){let[x,q]=GK0(Z);if(!x)return new T2(q);let Y=MK0(J),[$,z,W]=DK0(Z,J,Y);if(W.length>0)return new T2(W);let[U,H]=BK0(J,z,X);if(H.length>0)return new T2(H);let B=NK0(J,$,Q);return new X3({resolvedArgs:$,missingParams:U,typeCompatibilityScore:B.score,typeCompatibilityDiags:B.typeCompatibilityDiags})}function eH(Z,J,Q,X){switch(Z.kind){case t.Signature:return XA(Z,J,Q,X);case t.ProductType:return jK0(Z,J,Q,X);case t.UnionType:return LK0(Z,J,Q,X);default:return Y4(Z)?eH(Z.type,J,Q,X):void 0}}function XA(Z,J,Q,X){let x=PK0(J,Z.parameters,Q,X);return{signature:Z,resolutionResult:x}}function jK0(Z,J,Q,X){let x=Z.members.get("__call__");if(x&&x.type.kind===t.Signature)return XA(x.type,J,Q,X)}function LK0(Z,J,Q,X){let x,q=pU.NO_MATCH,Y;for(let $=0;$<Z.types.length;$++){let z=Z.types[$],W=eH(z,J,Q,X);if(W&&(Y||(Y=W),W.resolutionResult.isOk())){let U=W.resolutionResult.unwrap().typeCompatibilityScore;if(U===pU.TYPE_MATCH)return W;U>q&&(x=W,q=U)}}return x||Y}function CK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.type.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.type)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.type.extending)x=q(Z,X,x);return x}function OK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.typeOfSymbol.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.typeOfSymbol)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.typeOfSymbol.extending)Y=$(Z,q,Y);return Y.isOk()?Y:new d(n0(Z),Y.diagnostics)}function mK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.specificType.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.specificType)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.specificType.extending)Y=$(Z,q,Y);return Y.isOk()?Y:Z.typeOfSymbol(J)}function SK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.typeWithPropsOptionalCtx.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.typeWithPropsOptionalCtx)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.typeWithPropsOptionalCtx.extending)x=q(Z,X,x);return x.isErr()||!k1(x)?Z.type(J):x}function RK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.specificTypeWithPropsOptionalCtx.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.specificTypeWithPropsOptionalCtx)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.specificTypeWithPropsOptionalCtx.extending)Y=$(Z,q,Y);return Y.isErr()||!k1(Y)?Z.specificType(J):Y}function IK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.typeFromTypeExpression.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.typeFromTypeExpression)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.typeFromTypeExpression.extending)x=q(Z,X,x);return x.isOk()?x:X&&d6(X)?new d(n0(Z),[l.createForNode(J,k.CannotResolveExpressionToType)]):x}function TK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.typeFromTypeSymbol))return new d(J.symbol.generatedProps.typeFromTypeSymbol);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.typeFromTypeSymbol.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.typeFromTypeSymbol)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.typeFromTypeSymbol.extending)Y=$(Z,q,Y);return Y.isOk(),Y}function vK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return[];let x=v.WrongKind;for(let q of Q.customModuleProviders.typecheck.replacing)if(x=q(Z,X),x!==v.WrongKind)return x;for(let q of Q.moduleProviders.typecheck)if(x=q(Z,X),x!==v.WrongKind)break;for(let q of Q.customModuleProviders.typecheck.extending)x=q(Z,X,x);return x===v.WrongKind?[]:x}function AK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return[];let x=v.WrongKind;for(let q of Q.customModuleProviders.typecheckWithPropsOptionalCtx.replacing)if(x=q(Z,X),x!==v.WrongKind)return x;for(let q of Q.moduleProviders.typecheckWithPropsOptionalCtx)if(x=q(Z,X),x!==v.WrongKind)break;for(let q of Q.customModuleProviders.typecheckWithPropsOptionalCtx.extending)x=q(Z,X,x);return x===v.WrongKind?Z.typecheck(J):x}function EK0(Z,J){let Q=Z.typecheckDuplicatedNamesInFile(J),X=Z.ast(J),x=X.unwrap().transformedAst,q=HK0(J,x.id);if(q.length)return new X8(q);let Y=Z.typecheck(x.id),$=X.diagnostics.concat(Y).concat(Q);return new X8($)}function fK0(Z,J){let Q=Z.moduleIdOfFile(J);if(!Q)return[];let X=Z.membersOfModule(Q).unwrap(),x=Z.scopeOfFile(J).unwrap(),q=[];return x.table.forEach((Y,$)=>{if(Y.accessModifier!==o7.Public)return;let z=(X.get(Z,$)?[X.get(Z,$),...X.duplicatedTable.get($)||[]]:[]).filter((W)=>W.symbol.id.key!==Y.symbol.id.key).map((W)=>W.symbol);z.length!==0&&q.push(JK0(Z,Y.symbol,z))}),q}function kK0(Z,J){let Q=Z.nodeById(J);if(!Q||!(Q instanceof I1))return new r(v.WrongKind);let X=Z.type(Q.callee.id);if(X.isErr())return new r(v.Error,X.diagnostics);let x=X.unwrap(),q=eH(x,Q.args.args,Z,Q);return q?new d(q,X.diagnostics):new r(v.Error,X.diagnostics)}function DY(Z,J){return J.kind===t.DynamicType||J.kind===t.DynamicBodyType?DY(Z,J.type):J.kind===t.UnionType?J.types.reduce((Q,X)=>{let x=DY(Z,X);return x?x3(Q,x,void 0,(q,Y,$,z)=>{let W=NZ(Y.symbol)?Y.symbol.symbols:[Y.symbol,$.symbol],U=YZ.createGeneratedCompoundSymbol(z,W);U.generatedProps.type=q8([Y.type,$.type]),q.set(z,{symbol:U,type:U.generatedProps.type})}):Q},new Map):J.members}function cK0(Z,J,Q,X=!1){var x;let q=DY(Z,J);if(q){if(X){for(let Y of q.values())if(_$0(Y.type)&&(x=Y.type.type.members)!=null&&x.has(Q))return Y.type.type.members.get(Q)}if(q.has(Q))return q.get(Q);if(q.has("*"))return q.get("*")}}function bK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.members))return new d(J.symbol.generatedProps.members);let{program:x}=Z,q=Z.symbolById(J),Y=new r(v.WrongKind);if(!q)return Y;for(let $ of x.customModuleProviders.members.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.members)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.members.extending)Y=$(Z,q,Y);return Y}function Y6(Z,J){let Q=DY(Z,J),X=new s2;return Q==null||Q.forEach((x,q)=>X.set(q,x.symbol)),Q?new d(X):new r(v.Error)}function xA(Z,J,Q){if(J.name){let x=Z.findIndex((q)=>q.name===J.name);return x!==-1?{param:Z[x],paramIdx:x}:void 0}if(Q<Z.length)return{param:Z[Q],paramIdx:Q};let X=f5(Z);if(X!=null&&X.isRestParam)return{param:X,paramIdx:Z.length-1};throw new Error("Param out of range")}function pK0(Z){let J=[],Q=!1;for(let X of Z)!X.name&&Q?J.push(l.createForNode(X.node.id,k.PositionalArgumentAfterKeywordArgument)):X.name&&(Q=!0);return J}function yK0(Z,J,Q,X){let x=[];if(x.push(...pK0(Q)),b2(x))return x;let q=new Set;return Q.forEach((Y,$)=>{let z=xA(J,Y,$);if(z===void 0){x.push(l.createForNode(Y.node.id,k.UnexpectedThings,`keyword argument${Y.name?` '${Y.name}'`:""}`));return}q.add(z.paramIdx);let W;if(z.param.isRestParam){let U=F$0(z.param.type);W=h6(U,Y.type,Y.node,k.MismatchedArgumentType,Z,c0(Y.type,{db:Z}),c0(U,{db:Z}))}else W=h6(z.param.type,Y.type,Y.node,k.MismatchedArgumentType,Z,c0(Y.type,{db:Z}),c0(z.param.type,{db:Z}));W&&x.push(W)}),J.forEach((Y,$)=>{!q.has($)&&Y.defaultValue===void 0&&x.push(l.createForNode(X.id,k.MissingThings,`'${Y.name}' argument`))}),x}function qA(Z,J){let Q=[],X=J.asArgument(),x=Pv(Z,J);if(g(Q,...x.diagnostics),X.name)return X.value?new d({name:X.name.name,type:x.unwrap(),node:X.name.node}):(Q.push(l.createForNode(X.name.node.id,k.ExpectedThings,"argument's value")),new d({type:x.unwrap(),node:X.name.node},Q));if(!X.value)throw new Error("Incomplete argument");return new d({type:x.unwrap(),node:X.value.node},x.diagnostics)}function jZ(Z,J,Q,X,x){var q;let Y=X;return(q=Y.members.get("__decorators__"))==null||q.members.delete("tag"),J.forEach(($)=>{let z=Z.decorators.find((U)=>U.name===$.name.value.value);if(z===void 0)throw new Error("Expected decorator");let W=[];$.args.args.forEach((U,H)=>{let B=qA(Z.db,U).unwrap(),M=U.asArgument(),D=xA(z.signature.params,B,H);if(D===void 0)throw new Error("Unreachable");D.param.isRestParam?W.push(Z.interpretNode(M.value.node,x).returnVal):W[D.paramIdx]=Z.interpretNode(M.value.node,x).returnVal});for(let U=0;U<z.signature.params.length;U+=1)if(W[U]===void 0){if(z.signature.params[U].defaultValue===void 0)throw new Error("Expected default value");W[U]=z.signature.params[U].defaultValue}Y=z.provider(Z,Q,Y,x,...W)}),Y}var GU;function uK0(){if(!GU){let Z=G0(o2,"delegate");G0(Z,"addMethod","to_js_structure",new E0((J)=>{var Q;let X=J.getCachedJsObject();if(X)return X;let x={};for(let[q,Y]of J.members.entries())Y instanceof o1&&((Q=Y.rules)!=null&&Q.root_namespace)||(x[q]=Y.toJsStructure());return J.type&&!G4(J.type)&&(x.__type__=c0(J.type)),J.setCachedJsObject(x),x})),GU=Z}return GU}function ZG(Z){return new E0((J)=>{let Q=YA(Z,J.data,J.env),X=Q.slice(0,-1).join("."),x=f5(Q);if(!x)throw new Error("Cannot resolve the access expression to a field reference");let q=new Map([["model",h0.create(X)],["field",h0.create(x)],["__type__",h0.create("FieldRef")]]);return new g0(q)})}function hK0(Z){var J;return Z instanceof o1?(J=Z.metadata.get("__fqn__"))==null?void 0:J.data:void 0}function YA(Z,J,Q){let X=Z.interpretNode(J,Q).returnVal,x=hK0(X);if(x)return[x.replaceAll("::",".")];if(!(J instanceof k0))throw new Error("Cannot resolve the access expression to a field reference");if((J.leftExpression instanceof Z0||J.leftExpression instanceof k0)&&J.rightExpression instanceof Z0){let q=YA(Z,J.leftExpression,Q),Y=Z.type(J.id).unwrap();if(G4(Y)){let{ruleset:$}=Y.parentType;if($.isRuleOn(j0.RootNamespace)&&f5(q)===$.name)return[...q.slice(0,-1),J.rightExpression.value.value]}return[...q,J.rightExpression.value.value]}throw new Error("Cannot resolve the access expression to a field reference")}function gK0(Z,J,Q,X,x,q,Y){if(Z!==Y1.Static||!J.body)return;if(Y&&J.body instanceof S0){let W=iY(Y.obj,Y.path);if(W&&!(W instanceof M2)){if(!W.type||W.type.kind!==t.ProductType)throw new H4(l.createForNode(J.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return{value:y7(J.body,X,x,W.type,{baseContext:Y},q),metadata:new Map,hiddenMetadata:{shouldMerge:!0}}}}if(J.body instanceof S0){let W=Q.type;if(W.kind!==t.ProductType)throw W.kind===t.UnionType?new H4(l.createForNode(J.body.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure")):new Error("Expected product type");return{value:y7(J.body,X,x,W,{baseContext:Y},q),metadata:new Map,hiddenMetadata:{shouldMerge:!0}}}let{value:$,isSameType:z}=xG(J.body,X,x,Y);return z&&n7(J.body)?{value:$,metadata:new Map,hiddenMetadata:{shouldMerge:!0}}:{value:$,metadata:new Map,hiddenMetadata:{shouldMerge:!1}}}function iK0(){return{metadata:new Map,rules:{}}}function dK0(Z,J,Q){if(!Z.isRuleOn(j0.TypeAs))return;let X=Z.getRule(j0.TypeAs),x=Q.elementType.value.value;J.set(X.value,h0.create(x))}function lK0(Z,J,Q,X){if(!Z.isRuleOn(j0.NameAs))return;let x=Z.getRule(j0.NameAs),q=X.elementName.value.value;J.set(x.value,h0.create(q)),Q.name_as=q}function oK0(Z,J,Q){let X=new Map,x=Z.asAmlTypeOption();if(X.set("name",h0.create(x.name.name)),x.value){let q=Q.interpretNode(x.value.node,J).returnVal;X.set("value",q)}else X.set("value",R1.True);return new g0(X)}function sK0(Z,J,Q,X,x){if(!Z.isRuleOn(j0.Attr)||!Q.params)return;let q=Q.params.args.map(($)=>oK0($,X,x)),Y=new C4(q);J.set("attributes",Y)}function nK0(Z,J,Q){if(!Z.isRuleOn(j0.BodyAs))return;if(!J.body){if(Z.isRuleOn(j0.AllowNoBody))return;throw new Error("Expected body")}let X=Z.getRule(j0.BodyAs);if(!X)throw new Error("BodyAs rule not found");Q.body_as=X.value}function iY(Z,J){return J.reduce((Q,X)=>{var x;return(x=Q==null?void 0:Q.members)==null?void 0:x.get(X)},Z)}function aK0(Z,J,Q,X,x,q){if(!(Z.body instanceof S0))return;let Y=J.type;if(q){let $=J.parentType,{ruleset:z}=$,{structure:W}=z;if(W!==Y1.List){let U=iY(q.obj,q.path);if(U!=null&&U.type)Y=U.type;else if(U&&!(U instanceof M2))throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"))}}if(Y.kind!==t.ProductType)throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return y7(Z.body,Q,X,Y,{baseContext:q},x)}function rK0(Z,J,Q,X,x){return{value:Z??new g0(void 0,void 0,X),metadata:J,rules:Q,hiddenMetadata:x}}function tK0(Z){var J;return!((J=Z.data.parent)!=null&&J.data.parent)}function JG(Z,J,Q,X,x){var q;let Y=new o1(I2(J),new Map);if(((q=J.type)==null?void 0:q.kind)===t.ProductType){let z=[...(U2(J.type)?c5(J.type):J.type).members].find(([,W])=>W.symbol.kind===p.DefaultElementName);z&&Y.metadata.set(z[0],h0.create(Q))}if(!tK0(X))return Y;let $=p5(x,Q,Z.program);return Y.metadata.set("__fqn__",h0.create($)),Y}function QG(Z,J,Q){var X,x;let q=Z.symbol(J.id)._chain(($)=>Z.specificType($.id)).unwrap();if(q.kind!==t.ProductType)throw new Error("Expected product type");let Y=U2(q)?c5(q):q;for(let $=0;$<Q.data.length;$++){let z=Q.data[$],W=(X=kQ(z))==null?void 0:X.name;if(typeof W!="string")throw new Error("Unexpected: Cannot extract object name");if(W===Y.name){let U=U2(q)&&((x=z.members.get("isPartial"))==null?void 0:x.data),H=!U2(q);if(U||H)return G0(z,"__lookUp__","constructor")}}}function kQ(Z){var J,Q,X,x;let q=(J=Z.members.get("name"))==null?void 0:J.data,Y=(Q=Z.members.get("__fqn__"))==null?void 0:Q.data;return!q&&Z instanceof o1&&(q=(X=Z.metadata.get("name"))==null?void 0:X.data),!Y&&Z instanceof o1&&(Y=(x=Z.metadata.get("__fqn__"))==null?void 0:x.data),{name:q,fqn:Y}}function BU(Z){var J;return Z instanceof o1?(J=Z.hiddenMetadata)==null?void 0:J.nodeId:void 0}function XG(Z,J,Q,X){let x=new g0;return x.data={node:J,env:Q,program:Z.program,isRawBlockObject:!0},x.type=X,x}function eK0(Z,J){if(l6(J))return new r(v.WrongKind);let Q=J;if(!(Q instanceof C0))return new r(v.WrongKind);if(Q.elementType instanceof Z0&&Q.elementType.value.value==="Func"){let q=H0.createSymbol("_function_",p.Function,Q.id);return new d(q)}if(Q.elementType instanceof k0)return new r(v.Error,[l.createForNode(Q.elementType.id,k.ExpectedThings,"identifier")]);let X=Q.parent instanceof K2?p.ElementProperty:p.Element,x=H0.createSymbol(Q.elementType.value.value,X,J.id);return new d(x)}function $A(Z,J,Q){if(l6(J))return new r(v.WrongKind);let X=J;if(!(X instanceof C0))return new r(v.WrongKind);let x=Z.symbol(X.id).chain((q)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx(q.id):Z.specificType(q.id));return x.isErr()?new d(n0(Z),x.diagnostics):x}function Zz0(Z,J){return $A(Z,J,{propsOptional:!0})}function KA(Z,J,Q){if(!(J instanceof C0))return v.WrongKind;let X=Z.symbol(J.id).chain(($)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx($.id):Z.specificType($.id)),x=X.diagnostics,q=(Q==null?void 0:Q.propsOptional)??!1;X.isOk()&&U2(X.unwrap())&&(q=!0);let Y=J.body instanceof S0?J.body.body.reduce(($,z)=>$.concat(q?Z.typecheckWithPropsOptionalCtx(z.id):Z.typecheck(z.id)),[]):J.body?q?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[];return x.concat(Y)}function Jz0(Z,J){return KA(Z,J,{propsOptional:!0})}function Qz0(Z,J,Q,X){if(!(Z instanceof C0))return v.WrongKind;let x=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(Z.elementType instanceof k0&&(x.data.bindObj=null),x instanceof C4){let Y=QG(Q,Z,x);Y&&(x=Y)}let q;return x instanceof E0&&x.partialType&&Z.body instanceof S0?q=XG(Q,Z.body,J,x.partialType):q=G0(x,"__call__",J,Z.body,X),Z.decorators&&(q=jZ(Q.program,Z.decorators,Z,q,J)),new U1(J,q)}var FY={name:"LiteralElementExpression",hooks:{symbol:eK0,type:$A,typeWithPropsOptionalCtx:Zz0,typecheck:KA,typecheckWithPropsOptionalCtx:Jz0,evaluate:Qz0}};function zA(Z,J,Q={},X={}){if(Z instanceof o1){let x=new Map;return Q.name_as||(Z.metadata.has("__fqn__")&&x.set("__fqn__",Z.metadata.get("__fqn__")),Z.metadata.has("name")&&x.set("name",Z.metadata.get("name")),Z.metadata.has("uname")&&x.set("uname",Z.metadata.get("uname"))),J==null||J.forEach((q,Y)=>{x.set(Y,q)}),new o1(Z.target,x,Q,X)}return new o1(Z,J??new Map,Q,X)}function xG(Z,J,Q,X){let x=Xz0(Z,Q,X);return{value:n7(Z)&&x?FY.hooks.evaluate(Z,J,Q.db,{baseContext:X}).returnVal:Q.interpretNode(Z,J).returnVal,isSameType:x}}function Xz0(Z,J,Q){if(!Q)return!1;let X=iY(Q.obj,Q.path);if(!(X!=null&&X.type))return!1;let x=J.type(Z.id).unwrap();return x4(X.type,x,J.db)}function WA(Z,J){let Q=c5(Z);return new E0((X,x,q)=>{let Y=y7(x,X,J,Q,q,!0);return Y.type=Z,Y},void 0,void 0,Z)}function VA(Z,J){return U2(Z)?WA(Z,J):new E0((Q,X,x)=>y7(X,Q,J,Z,x))}function xz0(Z,J,Q,X=!1){let x=new Map,q;return Z.members.forEach((Y,$)=>{if(Y4(Y.type)){if(x.set($,M2.Instance),!X&&Y.type.ruleset.isRuleEnabled(j0.Default)){let z=Y.type.ruleset.getRule(j0.Default),W=Q.nodeById(z.declarationId).asAmlTypeOption(),U=Q.interpretNode(W.value.node,J).returnVal;x.set($,U)}}else Y.symbol.kind===p.DefaultElementName&&(q=$)}),{members:x,defaultElementName:q}}function qz0(Z,J){return x3(Z,J,void 0,(Q,X,x,q)=>{Q.set(q,x)})}function Yz0(Z,J,Q,X,x,q){if(!(Z.body instanceof S0))throw new Error("Unreachable");let Y=J;if(q){let $=iY(q.obj,q.path);if($!=null&&$.type)Y=$.type;else if($&&!($ instanceof M2))throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"))}if(Y.kind!==t.ProductType)throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return y7(Z.body,Q,X,Y,{baseContext:q},x)}function y7(Z,J,Q,X,x,q=!1){let Y=x==null?void 0:x.baseContext,$=new Map,z=!1,W=xz0(X,J,Q,q);return $=qz0($,W.members),Z.body.forEach((U)=>{if(r7(U))return;let H=Q.symbol(U.id).unwrap(),B=Q.specificType(H.id).unwrap();if(G4(B)){if(!(U instanceof C0)&&!(U instanceof _0))throw new Error("Unreachable");if(!(U.elementType instanceof Z0))throw new Error("Expected identifier");let M=h0.create(I8(U)),{parentType:D}=B,{ruleset:N}=D,{structure:_}=N;if(_===Y1.List){let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat(N.name)}:void 0);G0(j,"push",O),$.set(N.name,j)}else if(_===Y1.DictType){let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([N.name,U.elementType.value.value])}:void 0);j.members.set(U.elementType.value.value,O),$.set(N.name,j)}else if(_===Y1.DictName){if(!(U instanceof _0)||!(U.elementName instanceof Z0))throw new Error("Unreachable");let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([N.name,U.elementName.value.value])}:void 0);j.members.set(U.elementName.value.value,O),$.set(N.name,j),N.isRuleOn(j0.RootNamespace)&&N.isRuleOn(j0.NameAs)&&N.isRuleOn(j0.UniqueName)&&!$.has(U.elementName.value.value)&&(z=!0,$.set(U.elementName.value.value,new o1(O.target,O.metadata,{...O.rules,root_namespace:!0},{...O.hiddenMetadata,nodeId:U.id,dynamicPropType:B})))}else{let j=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([H.name])}:void 0);$.set(H.name,j)}}else{if(!(U instanceof C0)||!(U.elementType instanceof Z0))throw new Error("Unreachable");let M,D=!1;if(U.body instanceof S0)D=!0,M=Yz0(U,B,J,Q,q,Y?{obj:Y.obj,path:Y.path.concat(H.name)}:void 0);else{let{value:j,isSameType:O}=xG(U.body,J,Q,Y?{obj:Y.obj,path:Y.path.concat(H.name)}:void 0);M=j,O&&n7(U.body)&&(D=!0)}U.decorators&&(M=jZ(Q,U.decorators,U,M,J));let N=h0.create(I8(U)),_=zA(M,new Map([["__doc__",N]]),void 0,{nodeId:U.id,shouldMerge:D});$.set(U.elementType.value.value,_)}}),z?new g0($,uK0(),X):new g0($,void 0,X)}function $z0(Z,J){let{structure:Q}=J;if(![Y1.List,Y1.DictType,Y1.DictName].includes(Q))return;let X=lv(Z);if(X!==void 0)return new h4(X)}function Kz0(Z,J,Q){let X=$z0(Z,Q);X&&J.metadata.set("__childIdx__",X)}function XY(Z,J,Q,X,x,q,Y,$){let{value:z,metadata:W,rules:U,hiddenMetadata:H}=zz0(Z,J,Q,X,x,$,q),B=z;Q.decorators&&(B=jZ(x,Q.decorators,Q,B,X)),W.set("__doc__",Y);let M=zA(B,W,U,{nodeId:Q.id,dynamicPropType:J,...H});return x.options.childIdxForDynamicProp&&Kz0(Q,M,Z.ruleset),M}function MU(Z,J,Q,X){return Z.get(J.name)&&I2(Z.get(J.name))instanceof M2&&(Q===Y1.List?Z.set(J.name,new C4([],!0)):Q===Y1.DictType?Z.set(J.name,new v5):Q===Y1.DictName&&Z.set(J.name,new v5(void 0,void 0))),Z.get(J.name)}function zz0(Z,J,Q,X,x,q,Y=!1){let{ruleset:$}=Z,{structure:z}=$,W=gK0(z,Q,J,X,x,Y,q);if(W)return W;let{metadata:U,rules:H}=iK0();dK0($,U,Q),lK0($,U,H,Q),sK0($,U,Q,X,x),nK0($,Q,H);let B=!1,M;if(Q.body instanceof S0)B=!0,M=aK0(Q,J,X,x,Y,q);else if(Q.body){let{value:D,isSameType:N}=xG(Q.body,X,x,q);M=D,N&&n7(Q.body)&&(B=!0)}return rK0(M,U,H,J,{shouldMerge:B})}function E6(Z){return new E0((...J)=>{throw new Error("Built-in constructors shouldn't be called directly")})}function Wz0(Z){return new E0((J,Q)=>{let X=Q.body.map((x)=>Z.interpretNode(x,J).returnVal);return new C4(X)})}function Vz0(Z){return new E0((J,Q)=>{let X=new Map;return Q.body.forEach((x)=>{if(x instanceof C0&&!(x.body instanceof S0)&&x.elementType instanceof Z0){let q=Z.interpretNode(x.body,J).returnVal;X.set(x.elementType.value.value,q)}}),new g0(X,AQ)})}function Uz0(){return new E0(()=>{throw new Error("Invalid constructor for Partial Type.")})}var UA="extend",WI=!1;function HA(Z){var J;let Q=Z instanceof o1?Z:void 0,X=Q==null?void 0:Q.type;if(X&&!G4(X)){let x=X;if(!eQ(x)&&x.kind===t.ProductType){let q=[];x.members.forEach((z,W)=>{var U;((U=z==null?void 0:z.symbol)==null?void 0:U.kind)===p.TypeProperty&&(Y4(z.type)||q.push(W))});let Y=Z.members,$=[];if(q.forEach((z)=>{let W=Y.get(z);W&&!(W instanceof M2)||$.push(z)}),$.length){let z=$.join(", "),W=Z instanceof o1?(J=Z.hiddenMetadata)==null?void 0:J.nodeId:void 0;throw W?new H4(l.createForNode(W,k.MissingPropertiesForExtend,z)):new H4(e1.create(k.MissingPropertiesForExtend,z))}}}I2(Z)instanceof h0||Z.members.forEach((x)=>HA(x))}function Hz0(){if(!WI){G0(o2,"addMethod","__lookUp__",new E0((Z,J)=>Z.members.has(J)?Z.members.get(J):G0(Z.vTable,"lookUp",J))),G0(o2,"addMethod","to_json",new E0((Z)=>{let J=Z.toJsStructure();return h0.create(JSON.stringify(J))})),G0(o2,"addMethod","to_js_structure",new E0((Z)=>{let J=Z.getCachedJsObject();if(J)return J;let Q={};for(let[X,x]of Z.members.entries())Q[X]=x.toJsStructure();return Z.type&&!G4(Z.type)&&!(Z.type.kind===t.ProductType&&!Z.type.name)&&(Q.__type__=c0(Z.type)),Z.setCachedJsObject(Q),Q})),G0(o2,"addMethod",UA,new E0((Z,J)=>{let Q=J;if(J.data&&J.data.isRawBlockObject){let Y=c5(J.type);Q=y7(J.data.node,J.data.env,J.data.program,Y,{baseContext:{obj:Z,path:[]}},!0)}let X=I2(Z).clone();X.clearJsObjectCache();let x=TQ(X,Q);HA(x);let q=Z instanceof o1?Z.metadata.get("__fqn__"):void 0;return q&&I2(q)instanceof h0&&Yv(I2(q),x.members),x})),G0(o2,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(f6,"addMethod","==",new E0(v7["=="])),G0(f6,"addMethod","!=",new E0(v7["!="])),G0(f6,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(f6,"addMethod","||",new E0((Z,J)=>Z.data||J.data?R1.True:R1.False)),G0(f6,"addMethod","&&",new E0((Z,J)=>!Z.data||!J.data?R1.False:R1.True)),G0(f6,"addMethod","_P!",new E0((Z)=>Z.data?R1.False:R1.True)),G0(f6,"addMethod","to_string",new E0((Z)=>h0.create(`${Z.data}`))),G0(A7,"addMethod","+",new E0((Z,J)=>h0.create(Z.data+J.data))),G0(A7,"addMethod","length",new E0((Z)=>new h4(Z.data.length)));for(let Z in v7)G0(A7,"addMethod",Z,new E0(v7[Z]));G0(A7,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(A7,"addMethod","to_string",new E0((Z)=>Z)),G0(e3,"addMethod","_P+",new E0((Z)=>Z)),G0(e3,"addMethod","_P-",new E0((Z)=>new h4(-Z.data))),G0(e3,"addMethod","add",new E0((Z,J)=>new h4(Z.data+J.data))),G0(e3,"addMethod","+",new E0((Z,J)=>new h4(Z.data+J.data))),G0(e3,"addMethod","-",new E0((Z,J)=>new h4(Z.data-J.data))),G0(e3,"addMethod","*",new E0((Z,J)=>new h4(Z.data*J.data))),G0(e3,"addMethod","/",new E0((Z,J)=>new h4(Z.data/J.data)));for(let Z in v7)G0(e3,"addMethod",Z,new E0(v7[Z]));G0(e3,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(e3,"addMethod","to_string",new E0((Z)=>h0.create(`${Z.data}`))),G0(HY,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(HY,"addMethod","to_string",new E0((Z)=>h0.create("undefined"))),G0(UY,"addMethod","to_js_structure",new E0((Z)=>"void")),G0(UY,"addMethod","to_string",new E0((Z)=>h0.create("undefined"))),G0(LQ,"addMethod","__call__",new E0((Z,...J)=>{let Q=new A5({parent:Z.data.env}),X=J.map((x,q)=>{var Y;if(I2(x)instanceof M2){let $=(Y=Z.data.params[q])==null?void 0:Y.asParameter();if($!=null&&$.defaultValue)return Z.data.program.interpretNode($.defaultValue.node,Z.data.env).returnVal}return x});return Q=Z.addArgs(Q,X,Z.data.program),Z.data.program.interpretNode(Z.data.body,Q).returnVal})),G0(LQ,"addMethod","to_js_structure",new E0((Z)=>"Callable")),G0(LQ,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(CQ,"addMethod","__call__",(Z,...J)=>Z.data.bindObj?Z.data.jsFunc.apply(null,[Z.data.bindObj].concat(J)):Z.data.jsFunc.apply(null,J)),G0(CQ,"addMethod","to_js_structure",new E0((Z)=>{if(Z.isDecorated){let J=G0(Z.vTable.parentObj,"lookUp","to_js_structure");return G0(J,"__call__",Z)}return"Callable"})),G0(CQ,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(GY,"addMethod","to_js_structure",new E0((Z)=>typeof Z.data.content=="string"?{__type__:c0(Z.type,{includeTypeArgumentsForHeredoc:!1}),...Z.data}:{__type__:c0(Z.type,{includeTypeArgumentsForHeredoc:!1}),name:Z.data.name,content:Z.data.content.toJsStructure()})),G0(GY,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(AQ,"addMethod","__call__",(Z,J)=>G0(Z,"__lookUp__",J.data.toString())),G0(AQ,"addMethod","get",new E0((Z,J,Q=M2.Instance)=>{let X=J.data;return Z.members.has(X)?Z.members.get(X):Q})),G0(JZ,"addMethod","__call__",(Z,J)=>{let Q=Z.members.get("length");return J.data<0||J.data>=Q.data?M2.Instance:Z.data[J.data]}),G0(JZ,"addMethod","to_js_structure",new E0((Z)=>Z.data.map((J)=>J.toJsStructure()))),G0(JZ,"addMethod","push",new E0((Z,J)=>{if(!Z.members.has("length"))throw new Error("Expected length");Z.data.push(J);let Q=Z.members.get("length");Q.data+=1})),G0(JZ,"addMethod","get",new E0((Z,J,Q=M2.Instance)=>{let X=Z.members.get("length");return J.data<0||J.data>=X.data?Q:Z.data[J.data]})),WI=!0}}function VI(Z){return gv(Z)?0:JX(Z)?1:v8(Z)?2:cH(Z)?3:4}function Gz0(Z,J){if(!(J instanceof v1))return new r(v.WrongKind);if(J.filePath===void 0)throw new Error("Ast filepath is undefined");let Q=H0.createSymbol(J.filePath.toString(),p.Ast,J.id);return new d(Q)}function Bz0(Z,J){if(J.kind!==p.Ast)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=[],X=n0(Z),x=Z.nodeById(J.declarationId),q=Z.scope(x.id);g(Q,q.diagnostics);let Y=q.unwrap(),$=new Map;return Y.forEachEarlyBinding((z,W)=>{let U=Z.specificType(z.symbol.id);g(Q,U.diagnostics),$.set(W,{type:U.unwrap(),symbol:z.symbol})}),X={kind:t.ProductType,members:$,symbol:J},new d(X,Q)}function Mz0(Z,J){return J instanceof v1?qG(J,J.statements,Z):new r(v.WrongKind)}function qG(Z,J,Q,X=new s2){let x=[];return J.filter((q)=>_Z(q)&&!(q instanceof S0)).forEach((q)=>{let Y=Q.mergeableInnerScope(q.id);if(Y.isOk()){g(x,Y.diagnostics);let z=Y.unwrap();X=X.merge(z,void 0,(W,U,H,B)=>{x.push(l.createForNode(H.symbol.declarationId,k.DuplicatedName,H.symbol.name)),W.set(B,H)});return}let $=Q.symbol(q.id);if($.isOk()){g(x,$.diagnostics);let z=$.unwrap();X.hasEarlyBinding(z.name)?q instanceof _0||q instanceof S1?x.push(l.createForNode(uv(q).id,k.DuplicatedName,z.name)):x.push(l.createForNode(q.id,k.DuplicatedName,z.name)):X.set(z.name,z)}}),new d(X,x)}function Dz0(Z,J){if(!(J instanceof v1))return v.WrongKind;let Q=[],X=Z.scope(J.id);return g(Q,X.diagnostics),J.statements.forEach((x)=>{let q=Z.typecheck(x.id);g(Q,q)}),Q}function Fz0(Z,J,Q){if(!(Z instanceof v1))return v.WrongKind;let X=[...Z.statements],x=X.length>0?X[X.length-1]:null;X.sort((Y,$)=>VI(Y)-VI($));let q=a8.Instance;return X.forEach((Y)=>{let $=Q.program.interpretNode(Y,J);x&&Y.id.key===x.id.key&&(q=$.returnVal)}),new U1(J,q)}var Nz0={name:"Ast",hooks:{symbol:Gz0,typeOfSymbol:Bz0,scope:Mz0,typecheck:Dz0,evaluate:Fz0}};function wz0(Z,J){return J instanceof S0?qG(J,J.body,Z):new r(v.WrongKind)}function _z0(Z,J){if(!(J instanceof S0))return v.WrongKind;let Q=[],X=Z.scope(J.id);return g(Q,X.diagnostics),J.body.forEach((x)=>{let q=Z.typecheck(x.id);g(Q,q)}),Q}function Pz0(Z,J,Q){if(!(Z instanceof S0))return v.WrongKind;let X=J.createLocal(),x=a8.Instance;return Z.body.forEach((q)=>{x=Q.program.interpretNode(q,J).returnVal}),new U1(X,x)}var jz0={name:"Block",hooks:{scope:wz0,typecheck:_z0,evaluate:Pz0}};function NY(Z,J,Q){let X=[];return J.forEach((x)=>{let q=Z.decorators.find(($)=>$.name===x.name.value.value);if(q===void 0){g(X,l.createForNode(x.name.id,k.NonExistentDecorator,x.name.value.value));return}g(X,mz0(Z,q,x)),q.typecheck&&g(X,q.typecheck(Z,x));let Y=h6(q.targetType,Q,x.name,k.CannotApplyDecorator,Z.db,q.name,c0(Q));Y&&g(X,Y)}),X}function Lz0(Z,J,Q){return J.args.args.map((X)=>{let x=qA(Z.db,X);return g(Q,x.diagnostics),x.unwrap()})}function Cz0(Z,J,Q,X,x){let q=yK0(Z.db,J,Q,X.name);g(x,q)}function Oz0(Z,J,Q){J.args.args.forEach((X)=>{let x=X.asArgument();x.value&&g(Q,Z.typecheck(x.value.node.id))})}function mz0(Z,J,Q){let X=[],{params:x}=J.signature,q=Lz0(Z,Q,X);return Cz0(Z,x,q,Q,X),Oz0(Z,Q,X),X}function Sz0(Z,J){let Q=J.filter((x)=>x.isRestParam);if(Q.length>1)throw new Error("Decorator cannot have more than one rest parameter");if(Q.length===0)return;let[X]=Q;if(X.type.kind!==t.ProductType||X.type.name!=="List")throw new Error("Decorator rest parameter must be of type List")}function Rz0(Z,J){if(!QX(J))return new r(v.WrongKind);let Q=H0.createSymbol(J.elementName.value.value,p.BlockScopedVariable,J.id);return new d(Q)}function Iz0(Z,J){return QX(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function Tz0(Z,J){return J.parent&&QX(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function vz0(Z,J){if(J.kind!==p.BlockScopedVariable)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=Z.nodeById(J.declarationId);if(!(Q instanceof S1))throw new Error("Expected equality declaration");return Q.elementType.value.kind!==w.CONST_KEYWORD?Z.typeFromTypeExpression(Q.elementType.id):Z.type(Q.body.id)}function Az0(Z,J){if(J.kind!==p.BlockScopedVariable)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=Z.nodeById(J.declarationId);if(!(Q instanceof S1))throw new Error("Expected equality declaration");let X=Z.type(Q.body.id);return X.isOk()&&X.unwrap().kind===t.ProductType?X:Q.elementType.value.kind!==w.CONST_KEYWORD?Z.typeFromTypeExpression(Q.elementType.id):X}function Ez0(Z,J){if(!QX(J))return v.WrongKind;if(J.elementType.value.kind!==w.CONST_KEYWORD){let x=Z.typeFromTypeExpression(J.elementType.id),q=J.decorators&&x.isOk()?NY(Z.program,J.decorators,x.unwrap()):[];return x.chain((Y)=>Z.type(J.body.id).chain(($)=>new d({t:Y,bodyType:$}))).chain(({t:Y,bodyType:$})=>new d(Y,BY(i1(Y,$,Z).diags,J.elementName))).diagnostics.concat(Z.typecheck(J.body.id),q)}let Q=Z.type(J.body.id),X=J.decorators&&Q.isOk()?NY(Z.program,J.decorators,Q.unwrap()):[];return Z.typecheck(J.body.id).concat(X)}function fz0(Z,J){return J.kind!==p.BlockScopedVariable?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function kz0(Z,J,Q){var X;if(!(Z instanceof S1)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.BlockScopedVariable)return v.WrongKind;if(!Z.body)throw new Error("Expected node body");let x=Q.program.interpretNode(Z.body,J).returnVal;x.members.set("__doc__",h0.create(I8(Z)));let q=Q.symbol(Z.id).unwrap();return Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J)),x=JG(Q,x,Z.elementName.value.value,J,w0.create(Z.id.filepath)),J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x})),new U1(J,x)}var cz0={name:"BlockScopedVariable",hooks:{symbol:Rz0,allSymbolsFromContext:Iz0,identifierSymbol:Tz0,typeOfSymbol:vz0,specificType:Az0,members:fz0,typecheck:Ez0,evaluate:kz0}};function bz0(Z,J){return J.kind!==p.BuiltInType?new r(v.WrongKind):new d(J.type(Z))}function pz0(Z,J){return J.kind!==p.BuiltInType?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}var yz0={name:"BuiltInType",hooks:{typeOfSymbol:bz0,members:pz0}};function uz0(Z,J){if(!NZ(J))return new r(v.WrongKind);let Q=[],X=[];J.symbols.forEach((q)=>{let Y=Z.specificType(q.id);g(Q,Y.diagnostics),X.push(Y.unwrap())});let x=q8(X);return new d(x)}function hz0(Z,J){return NZ(J)?Z.specificType(J.id).chain((Q)=>Y6(Z,Q)):new r(v.WrongKind)}var gz0={name:"CompoundSymbol",hooks:{typeOfSymbol:uz0,members:hz0}};function iz0(Z,J){if(!a7(J))return new r(v.WrongKind);if(J.elementName instanceof k0)return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=H0.createSymbol(J.elementName.value.value,p.Element,J.id);return new d(Q)}function dz0(Z,J){if(J.kind!==p.Element)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0)&&!(Q instanceof C0))throw new Error("Expected symbol declaration");return Z.typeFromTypeExpression(Q.elementType.id)}function GA(Z,J,Q){if(J.kind!==p.Element)return new r(v.WrongKind);let X=Z.nodeById(J.declarationId);if(!(X instanceof _0)&&!(X instanceof C0))throw new Error("Expected symbol declaration");let x=[],q=Z.typeFromTypeExpression(X.elementType.id),Y=q.unwrap();if(g(x,q.diagnostics),X.body instanceof S0){let $=ZX(i1(Y,I5(X.body),Z,Q),X instanceof _0?X.elementName:X.elementType);if(g(x,$.diags),pY($)){if(Y.kind!==t.UnionType)throw new Error("Expected union type");n2($)&&$.matchedType&&(Y=$.matchedType)}U2(Y)&&(Y=l7(Y),Y.raw=I5(X.body))}else x.push(l.createForNode(X instanceof _0?X.elementName.id:X.elementType.id,k.ExpectedThings,"element's body"));return new d(Y,x)}function lz0(Z,J){return GA(Z,J,{propsOptional:!0})}function BA(Z,J,Q){if(!a7(J))return v.WrongKind;let X=Z.symbol(J.id).chain((W)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx(W.id):Z.specificType(W.id)),x=X.isOk()?X.unwrap():void 0,q=(Q==null?void 0:Q.propsOptional)??!1;x&&U2(x)&&(q=!0);let Y=J.decorators&&x?NY(Z.program,J.decorators,x):[],$=X.diagnostics,z=J.body instanceof S0?J.body.body.reduce((W,U)=>W.concat(q?Z.typecheckWithPropsOptionalCtx(U.id):Z.typecheck(U.id)),[]):J.body?q?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[];return x&&U2(x)&&(z=z.filter((W)=>W.code!==3003)),$.concat(z,Y)}function oz0(Z,J){return BA(Z,J,{propsOptional:!0})}function sz0(Z,J){if(J.kind!==p.Element)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0)&&!(Q instanceof C0))throw new Error("Expected symbol declaration");let X=[],x=lT(Z,Q),q=Z.specificType(J.id).chain(($)=>Y6(Z,$));g(X,q.diagnostics);let Y=x3(q.unwrap().table,x.table);return new d(new s2(Y),X)}function nz0(Z,J,Q){if(!a7(Z))return v.WrongKind;if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");let X=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(X instanceof C4){let $=QG(Q,Z,X);$&&(X=$)}let x;X instanceof E0&&X.partialType&&Z.body instanceof S0?x=XG(Q,Z.body,J,X.partialType):x=G0(X,"__call__",J,Z.body,{elementName:Z.elementName.value.value,filepath:w0.create(Z.id.filepath)}),x.members.set("__doc__",h0.create(I8(Z)));let q=Q.symbol(Z.elementName.id).unwrap();Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J)),x=JG(Q,x,Z.elementName.value.value,J,w0.create(Z.id.filepath));let Y=new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x});return J.data.bindings.push(Y),new U1(J,x)}var az0={name:"Element",hooks:{symbol:iz0,typeOfSymbol:dz0,specificType:GA,specificTypeWithPropsOptionalCtx:lz0,members:sz0,typecheck:BA,typecheckWithPropsOptionalCtx:oz0,evaluate:nz0}};function rz0(Z,J){if(!l6(J))return new r(v.WrongKind);if(J instanceof C0){if(!(J.elementType instanceof Z0))return new r(v.Error,[l.createForNode(J.elementType.id,k.ExpectedThings,"identifier")])}else if(!(J.elementName instanceof Z0))return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=J instanceof _0?H0.createSymbol(J.elementName.value.value,p.ElementProperty,J.id):H0.createSymbol(J.elementType.value.value,p.ElementProperty,J.id);return new d(Q)}function tz0(Z,J){return l6(J)?Z.symbol(J.id).chain((Q)=>{if(J instanceof C0)return new d([{symbol:Q,nodeId:J.elementType.id},{symbol:Q,nodeId:J.id}]);let X=H0.createSymbol(J.elementName.value.value,Q.kind,Q.declarationId);return new d([{symbol:Q,nodeId:J.elementType.id},{symbol:X,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])}):new r(v.WrongKind)}function ez0(Z,J){return J.parent&&l6(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function ZW0(Z,J){var Q;if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let X=Z.nodeById(J.declarationId);if(!(X instanceof C0)&&!(X instanceof _0))throw new Error("Expected node");if(!((Q=X.parent)!=null&&Q.parent))throw new Error("Expected node parent");let x=[],q;if(X.parent instanceof K2?q=Z.type(X.parent.id):q=Z.symbol(X.parent.parent.id).chain((W)=>Z.specificType(W.id)),g(x,q.diagnostics),q.isErr())return new d(n0(Z),x);let Y=q.unwrap();U2(Y)&&(Y=c5(Y));let $=X.elementType.value.value,z=MY($,Y);return z?new d(z,x):new d(n0(Z),x)}function JW0(Z,J){if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof C0)&&!(Q instanceof _0))throw new Error("Expected node");return Z.typeOfSymbol(J.id).chain((X)=>{let x=G4(X)?X.type:X,q=x,Y=[];if(Q.body instanceof S0)q=I5(Q.body);else if(Q.body){let z=Z.symbol(Q.body.id);if(g(Y,z.diagnostics),z.isOk()){let W=Z.specificType(z.unwrap().id);g(Y,W.diagnostics),q=W.unwrap()}else{let W=Z.type(Q.body.id);g(Y,W.diagnostics),q=W.unwrap()}}let $=ZX(i1(x,q,Z),Q instanceof _0?Q.elementName:Q.elementType);if(pY($)){if(x.kind!==t.UnionType)throw new Error("Expected union type");n2($)&&$.matchedType&&(x=$.matchedType)}return U2(x)&&Q.body instanceof S0&&(x=l7(x),x.raw=I5(Q.body)),G4(X)?new d(jQ(x,X.parentType,X.symbol)):new d(x,Y)})}function MA(Z,J,Q){return l6(J)?J.body instanceof S0?J.body.body.reduce((X,x)=>X.concat(Q!=null&&Q.propsOptional?Z.typecheckWithPropsOptionalCtx(x.id):Z.typecheck(x.id)),[]):J.body?Q!=null&&Q.propsOptional?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[]:v.WrongKind}function QW0(Z,J){return MA(Z,J,{propsOptional:!0})}function XW0(Z,J){if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof C0)&&!(Q instanceof _0))throw new Error("Expected node");let X=[],x=lT(Z,Q),q=Z.specificType(J.id).chain(($)=>Y6(Z,$));g(X,q.diagnostics);let Y=x3(q.unwrap().table,x.table);return new d(new s2(Y),X)}var xW0={name:"ElementProperty",hooks:{symbol:rz0,allSymbolsFromContext:tz0,identifierSymbol:ez0,typeOfSymbol:ZW0,specificType:JW0,members:XW0,typecheck:MA,typecheckWithPropsOptionalCtx:QW0}};function cQ(Z,J){if(y6(J))switch(J.primitiveTypeKind){case I0.Any:return n0(Z);case I0.Boolean:return Q3(Z);case I0.Int:return C5(Z);case I0.Kind:return O8(Z);case I0.Module:return wH(Z);case I0.Number:return m3(Z);case I0.String:return V4(Z);case I0.Void:return FZ(Z);default:lH(J.primitiveTypeKind)}else if(J.kind===t.ProductType&&J.name==="List"){if(eQ(J.typeArguments[0])){let x=q8(J.typeArguments[0].types.map((Y)=>cQ(Z,Y))),q=$Z(Z,x);return Z2(q,[x])}let Q=cQ(Z,J.typeArguments[0]),X=$Z(Z,Q);return Z2(X,[Q])}return J}function wY(Z,J){if(y6(J))return cQ(Z,J);if(J.kind===t.ProductType&&J.name==="TemplateString")return V4(Z);if(b6(J)){let Q=RQ(J),X=wY(Z,Q);return J6(Z,X)}if(eQ(J)){let Q=J.types.map((X)=>wY(Z,X));return q8(Q)}return J}function DA(Z){return!v8(Z)||!Z.decorators||Z.decorators.length===0?!1:Z.decorators.some((J)=>{if(J.name.value.value!=="tag"||!J.args||J.args.args.length===0||!J.args.args[0].value)return!1;let Q=J.args.args[0].value;if(Q.kind===Y0.TemplateString){let X=Q;return X.isNormalString()&&X.stringText()==="js_func"}return!1})}function qW0(Z,J){var Q;if(!v8(J))return new r(v.WrongKind);if((Q=J.parent)!=null&&Q.parent&&uY(J.parent.parent))return new r(v.WrongKind);let X=H0.createVoidSymbol(),x=[];return J.elementName instanceof k0?x.push(l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")):X=H0.createSymbol(J.elementName.value.value,p.Function,J.id),new d(X,x)}function YW0(Z,J){return v8(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function $W0(Z,J){return J.parent&&v8(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function KW0(Z,J){if(J.kind!==p.Function)return new r(v.WrongKind);let Q=[],X=J3([],n0(Z),Z,J);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let x=Z.nodeById(J.declarationId);if(!(x instanceof _0)&&!(x instanceof C0))throw new Error("Expected element");if(!x.params)Q.push(l.createForNode(x.id,k.ExpectedThings,"function's parameters"));else{let q=zW0(x.params,Z,Q),Y=WW0(x,Z,Q);if(X=J3(q,Y,Z,J),DA(x))X=J3(q,Y,Z,J);else{let{updatedReturnType:$}=VW0(x,Y,Z,Q);X=J3(q,$,Z,J)}}return new d(X,Q)}function zW0(Z,J,Q){let X=[];return Z.args.forEach((x)=>{let q=x.asParameter(),Y=n0(J),$=!1;if(q.type){let U=J.typeFromTypeExpression(q.type.node.id);g(Q,U.diagnostics),U.isOk()&&(Y=U.unwrap())}else if(q.defaultValue){let U=J.type(q.defaultValue.node.id);g(Q,U.diagnostics),U.isOk()&&(Y=cQ(J,U.unwrap()))}q.defaultValue&&($=!0);let z=J.symbol(q.name.node.id);g(Q,z.diagnostics);let W=z.unwrap();X.push({type:Y,symbol:W,hasDefaultValue:$})}),X}function WW0(Z,J,Q){let X=n0(J);if(Z.returnType){let x=J.typeFromTypeExpression(Z.returnType.typeExpr.id);g(Q,x.diagnostics),x.isOk()&&(X=x.unwrap())}return X}function VW0(Z,J,Q,X){let x=null;Z.body?Z.body instanceof S0?x=Z.body.body.length>0?Z.body.body[Z.body.body.length-1]:null:x=Z.body:X.push(l.createForNode(Z.id,k.ExpectedThings,"function's body"));let q=FZ(Q);if(x){let z=Q.type(x.id);g(X,z.diagnostics),z.isOk()&&(q=z.unwrap())}let Y=J,$=h6(J,q,x||Z.returnType,k.MismatchedFunctionReturnType,Q);return $?X.push($):Z.returnType||(Y=cQ(Q,q)),{bodyType:q,updatedReturnType:Y}}function UW0(Z,J){if(!HW0(J))return new r(v.WrongKind);if(!(J.body instanceof S0))return new r(v.WrongKind);let Q=new s2,X=[];if(J.params){let q=GW0(J.params,Z,Q);g(X,q.diagnostics),Q=q.unwrap()}let x=qG(J,J.body.body,Z,Q);return g(X,x.diagnostics),Q=x.unwrap(),new d(Q,X)}function HW0(Z){return v8(Z)||kH(Z)}function GW0(Z,J,Q=new s2){let X=[];return Z.args.forEach((x)=>{let q=J.symbol(x.id);g(X,q.diagnostics);let Y=q.unwrap();Q.has(J,Y.name)?X.push(l.createForNode(x.asParameter().name.node.id,k.DuplicatedName,Y.name)):Q.set(Y.name,Y)}),new d(Q,X)}function BW0(Z,J){return J.kind!==p.Function?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function MW0(Z,J){var Q;if(!v8(J)||(Q=J.parent)!=null&&Q.parent&&uY(J.parent.parent))return v.WrongKind;let X=DW0(J,Z),x=FW0(J,Z),q=NW0(J,Z),Y=wW0(J,Z),$=[];return g($,x),g($,q),g($,X),g($,Y),$}function DW0(Z,J){let Q=Z.decorators?NY(J.program,Z.decorators,n0(J)):[];return Array.from(Q)}function FW0(Z,J){let Q=J.symbol(Z.id).chain((X)=>J.specificType(X.id));return Array.from(Q.diagnostics)}function NW0(Z,J){return Z.body instanceof S0?Array.from(J.typecheck(Z.body.id)):[]}function wW0(Z,J){let Q=[];if(!Z.params)return Q;let X=!1;return Z.params.args.forEach((x)=>{let q=x.asParameter();_W0(x,q,X,Q),q.defaultValue&&(X=!0),PW0(x,q,J,Q)}),Q}function _W0(Z,J,Q,X){!J.defaultValue&&Q&&X.push(l.createForNode(Z.id,k.InvalidParameterOrder))}function PW0(Z,J,Q,X){if(!J.defaultValue||!J.type)return;let x=Q.typeFromTypeExpression(J.type.node.id);if(!x.isOk())return;let q=x.unwrap(),Y=Q.type(J.defaultValue.node.id);g(X,Y.diagnostics);let $=Y.unwrap(),z=h6(q,$,J.defaultValue.node,k.MismatchedType,Q,c0($),c0(q));z&&X.push(z)}function jW0(Z,J,Q){var X;if(!(Z instanceof _0)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.Function)return v.WrongKind;if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");if(!Z.body)throw new Error("Expected node body");let x;if(DA(Z)){let $=Q.program.jsFuncs.get(Z.elementName.value.value);if(!$)throw new Error(`JsFunc ${Z.elementName.value.value} not found`);x=$}else x=new OH(Z.params.args,Z.body,J,Q.program),x.members.set("__doc__",h0.create(I8(Z))),Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J));let q=Q.symbol(Z.elementName.id).unwrap(),Y=new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x});return J.data.bindings.push(Y),new U1(J,x)}var LW0={name:"Function",hooks:{symbol:qW0,allSymbolsFromContext:YW0,identifierSymbol:$W0,typeOfSymbol:KW0,scope:UW0,members:BW0,typecheck:MW0,evaluate:jW0}};function CW0(Z,J){if(!dY(J))return new r(v.WrongKind);let Q=H0.createVoidSymbol(),X=[],x=J.asParameter();return x.name.node instanceof Z0?Q=H0.createSymbol(x.name.name,p.FunctionScopedVariable,J.id):X.push(l.createForNode(x.name.node.id,k.ExpectedThings,"identifier")),new d(Q,X)}function OW0(Z,J){return dY(J)?Z.symbol(J.id).chain((Q)=>{let X=J.asParameter();return new d([{symbol:Q,nodeId:X.name.node.id},{symbol:Q,nodeId:J.id}])}):new r(v.WrongKind)}function mW0(Z,J){return J.parent&&dY(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function dY(Z){return Z instanceof O4&&pH(Z)}function SW0(Z,J){if(J.kind!==p.FunctionScopedVariable)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);return _v(Z,Q)}function RW0(Z,J){return J.kind!==p.FunctionScopedVariable?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function IW0(Z,J){return dY(J)?Z.symbol(J.id).chain((Q)=>Z.specificType(Q.id)).diagnostics:v.WrongKind}var TW0={name:"FunctionScopedVariable",hooks:{symbol:CW0,allSymbolsFromContext:OW0,identifierSymbol:mW0,typeOfSymbol:SW0,members:RW0,typecheck:IW0}};function vW0(Z,J,Q){return $4(J)?(J.leftExpression instanceof Z0?i4(o6(J),J.leftExpression.value.value,Z,J.leftExpression):Z.symbol(J.leftExpression.id)).chain((X)=>Z.members(X.id).chain((x)=>new d({moduleSymbol:X,moduleMembers:x}))).chain(({moduleMembers:X,moduleSymbol:x})=>X.has(Z,Q)?new d(X.get(Z,Q).symbol):new r(v.Error,[l.createForNode(J.rightExpression.id,k.ModuleNoMember,x.name,Q)])):new r(v.WrongKind)}function AW0(Z,J,Q){if(J.isOk()){let X=J.unwrap(),x=Z.members(X.id);if(x.isOk()){let q=x.unwrap();if(q.has(Z,Q)){let Y=q.get(Z,Q);if(Y)return Y.symbol}}}}function EW0(Z,J,Q,X){return(X?X.chain((x)=>Z.specificType(x.id)):Z.type(J.leftExpression.id)).chain((x)=>{if(x.kind===t.PrimitiveType&&x.primitiveTypeKind===I0.Module)return HZ(Z,()=>vW0(Z,J,Q));let q=cK0(Z,x,J.rightExpression.value.value,av(J));return q?new d(q.symbol):new r(v.Error,[l.createForNode(J.rightExpression.id,k.NonExistentProperty,Q,c0(x,{db:Z}))])})}function fW0(Z,J){if(!$4(J))return new r(v.WrongKind);if(J.rightExpression.flags===t7.HasError)return new r(v.WrongKind);if(J.rightExpression instanceof Z0){let Q=J.rightExpression.value.value,X=J.leftExpression instanceof Z0?i4(o6(J),J.leftExpression.value.value,Z,J.leftExpression):void 0,x=X||Z.symbol(J.leftExpression.id),q=AW0(Z,x,Q);if(q)return new d(q);if(x.isOk()){let Y=x.unwrap();if(Y.kind===p.Element||Y.kind===p.ElementProperty)return new r(v.Error,[l.createForNode(J.rightExpression.id,k.NonExistentName,Q)])}return EW0(Z,J,Q,X)}return new r(v.Error,[l.createForNode(J.rightExpression.id,k.ExpectedThings,"identifier")])}function kW0(Z,J){return $4(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.rightExpression.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function cW0(Z,J){return J.parent&&$4(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function bW0(Z,J){if(!$4(J))return new r(v.WrongKind);if(J.rightExpression.flags===t7.HasError)return new r(v.WrongKind);let Q=Z.symbol(J.id);return Q.isOk()?Q.chain((X)=>Z.specificType(X.id)):new d(n0(Z),Q.diagnostics)}function pW0(Z,J){return $4(J)?J.rightExpression.flags===t7.HasError?[]:Z.type(J.id).diagnostics:v.WrongKind}function yW0(Z,J,Q){if(!$4(Z))return v.WrongKind;let X=XK0(Q,Z);if(X){let Y=Q.interpretFile(X).env();if(Z.rightExpression instanceof Z0||Z.rightExpression instanceof c1)return new U1(J,Y.find(Z.rightExpression.value.value));throw new Error("Only identifier or string is accepted as message")}let x=Q.program.interpretNode(Z.leftExpression,J).returnVal,q;if(Z.rightExpression instanceof Z0)q=G0(x,"__lookUp__",Z.rightExpression.value.value);else if(Z.rightExpression instanceof c1)q=G0(x,"__lookUp__",Z.rightExpression.value.value);else throw new Error("Only identifier or string is accepted as message");return q instanceof tQ&&(q=q.clone(),q.bind(x)),new U1(J,q)}var FA={name:"PropertyAcessExpression",hooks:{symbol:fW0,allSymbolsFromContext:kW0,identifierSymbol:cW0,type:bW0,typecheck:pW0,evaluate:yW0}};function uW0(Z,J){return NA(J)?hW0(J,Z):new r(v.WrongKind)}function NA(Z){return Z instanceof k0&&Z.op.value==="|"}function hW0(Z,J){let Q=[],X=n0(J),x=_Y(Z,J);g(Q,x.diagnostics);let q=x.unwrap(),Y=[];for(let $ of q){let z=J.typeFromTypeExpression($.id);if(g(Q,z.diagnostics),z.isErr())return new d(X,Q);Y.push(z.unwrap())}return X=q8(Y),new d(X,Q)}function _Y(Z,J){let Q=[],X=[];if(Z instanceof c1||Z instanceof Z0)return X.push(Z),new d(X,Q);if(Z instanceof a1){let x=TH(J,Z,!0);return x.isOk()&&X.push(x.unwrap()),g(Q,x.diagnostics),new d(X,Q)}if(Z.op.value!=="|")Q.push(M1.createWithLocation(J.astFromNode(Z.id).filePath,Z.op.offset,Z.op.end(),k.ExpectedOperator,"|"));else if(Z.leftExpression instanceof k0||Z.leftExpression instanceof c1||Z.leftExpression instanceof Z0||Z.leftExpression instanceof a1){let x=_Y(Z.leftExpression,J);g(Q,x.diagnostics);let q=x.unwrap();if(X=X.concat(q),!(Z.rightExpression instanceof Z0)&&!(Z.rightExpression instanceof c1)&&!(Z.rightExpression instanceof a1))Q.push(l.createForNode(Z.rightExpression.id,k.ExpectedThings,"identifier or primary expression"));else{let Y=_Y(Z.rightExpression,J);X=X.concat(Y.unwrap()),g(Q,Y.diagnostics)}}else Q.push(l.createForNode(Z.leftExpression.id,k.ExpectedThings,"identifier or primary expression"));return new d(X,Q)}function gW0(Z,J){return NA(J)?[l.createForNode(J.id,k.UnexpectedThings,"union expression")]:v.WrongKind}var iW0={name:"UnionTypeExpression",hooks:{typeFromTypeExpression:uW0,typecheck:gW0}};function dW0(Z,J){if(!(J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD))return new r(v.WrongKind);let Q=[],X=H0.createVoidSymbol();return X=H0.createSymbol(J.elementName.value.value,p.TypeAlias,J.id),new d(X,Q)}function lW0(Z,J){return J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function oW0(Z,J){return J.parent&&J.parent instanceof S1&&J.parent.elementType.value.kind===w.TYPE_KEYWORD?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function sW0(Z,J){return J.kind!==p.TypeAlias?new r(v.WrongKind):new d(O8(Z))}function nW0(Z,J){if(J.kind!==p.TypeAlias)return new r(v.WrongKind);let Q=[],X=n0(Z),x=Z.nodeById(J.declarationId);if(!(x instanceof S1))throw new Error("Expected equality declaration");if(!x.body)Q.push(l.createForNode(x.id,k.ExpectedThings,"type's body"));else if(x.body instanceof k0||x.body instanceof Z0||x.body instanceof c1||x.body instanceof a1){let q=Z.typeFromTypeExpression(x.body.id);g(Q,q.diagnostics),X=l7(q.unwrap()),X.aliasSymbol=J}else Q.push(l.createForNode(x.id,k.InvalidTypeBody));return new d(X,Q)}function aW0(Z,J){return J.kind!==p.TypeAlias?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function rW0(Z,J){return J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD?Z.symbol(J.id).chain((Q)=>Z.typeFromTypeSymbol(Q.id)).diagnostics:v.WrongKind}function tW0(Z,J,Q){var X;if(!(Z instanceof S1)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.TypeAlias)return v.WrongKind;if(!(Z.body instanceof k0)&&!(Z.body instanceof Z0)&&!(Z.body instanceof c1))throw new Error("Expected infix expression or identifier");let x=_Y(Z.body,Q).unwrap(),q=new C4;x.forEach(($)=>{if($ instanceof Z0){let z=Q.typeFromTypeExpression($.id).unwrap();if(z.kind===t.ProductType){let W=U2(z),U=W?c5(z):z,H=W?WA(z,Q.program):VA(z,Q.program),B=new Map;B.set("name",h0.create(U.name)),B.set("constructor",H),W&&B.set("isPartial",R1.True),G0(q,"push",new g0(B))}}}),q.members.set("__doc__",h0.create(I8(Z)));let Y=Q.symbol(Z.elementName.id).unwrap();return J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:Y,type:Y.type(Q),value:q})),new U1(J,q)}var eW0={name:"TypeAlias",hooks:{symbol:dW0,allSymbolsFromContext:lW0,identifierSymbol:oW0,typeOfSymbol:sW0,typeFromTypeSymbol:nW0,members:aW0,typecheck:rW0,evaluate:tW0}};function ZV0(Z,J){var Q,X;let x=new Map;if(!L1(Z,I0.Any))throw new Error("Built-in types are expected to be available.");let q=(X=(Q=Z.globalScope())==null?void 0:Q.get(Z,"Partial"))==null?void 0:X.symbol;if(!q)throw new Error("Expected Partial Symbol.");let Y=Z.typeFromTypeSymbol(q.id).unwrap();Y=Z2(Y,[J]);let $=H0.createGeneratedSymbol("baseObj",p.FunctionScopedVariable);$.generatedProps.type=Y;let z=H0.createGeneratedSymbol(UA,p.BuiltInProperty),W=J3([{symbol:$,type:Y}],J,Z,void 0,!0);return z.generatedProps.type=W,x.set(z.name,{symbol:z,type:Z.specificType(z.id).unwrap()}),x}function wA(Z,J){let Q=ZV0(Z,J);J.members=x3(J.members,Q)}function JV0(Z,J){let Q=J.nodeById(Z.declarationId);if(!(Q instanceof _0))throw new Error("Expected element declaration");if(!(Q.body instanceof S0)&&!(Q.body instanceof K2))throw new Error("Expected block body");let X=[],x=QV0(Q,J);g(X,x.diagnostics);let q=YG(Q.body,J,Z);g(X,q.diagnostics);let Y={...q.unwrap(),name:Z.name};wA(J,Y);let $=[x.unwrap(),Y.members].reduce((z,W)=>x3(z,W,void 0,(U,H,B,M)=>{let D=J.nodeById(B.symbol.declarationId),N=D instanceof C0||D instanceof _0?D.elementType:D;X.push(l.createForNode(N.id,k.DuplicatedName,M))}));return Y.members=$,new d(Y,X)}function QV0(Z,J){if(!Z.params)return new d(new Map);let Q=[],X=new Map;return Z.params.args.forEach((x)=>{let q=x.asAmlTypeOption();if(q.name.name!=="elem_name_as"){Q.push(l.createForNode(q.name.node.id,k.InvalidThings,"type option"));return}let Y=jv(J,x);if(Y.isErr()){g(Q,Y.diagnostics);return}let $=Y.unwrap(),z=H0.createGeneratedSymbol($.toString(),p.DefaultElementName,x.id);z.generatedProps.type=V4(J),X.set($.toString(),{type:V4(J),symbol:z})}),new d(X,Q)}function YG(Z,J,Q){let X=[],x=new Map,q=!1;Z.body.forEach(($)=>{if($ instanceof C0||$ instanceof I1){let z=J.symbol($.id)._chain((B)=>J.specificType(B.id)._chain((M)=>new d({elementSymbol:B,elementType:M})));if(g(X,z.diagnostics),z.isErr())return;let{elementSymbol:W,elementType:U}=z.unwrap(),H=$ instanceof C0?$.elementType:$.callee;if(!(H instanceof Z0))return;if(Y4(U)){let{ruleset:B}=U;B.isRuleOn(j0.TypeAs)&&(q?X.push(l.createForNode(B.getRule(j0.TypeAs).declarationId,k.UnexpectedThings,"'elem_type_as' option. 'elem_type_as' is already set for another property")):q=!0)}x.has(H.value.value)?X.push(l.createForNode(H.id,k.DuplicatedName,H.value.value)):x.set(H.value.value,{type:U,symbol:W})}else r7($)||X.push(l.createForNode($.id,k.InvalidTypeProperty))});let Y=T8(x,J,void 0,Q);return new d(Y,X)}function XV0(Z,J){if(!(J instanceof _0&&J.elementType.value.kind===w.TYPE_KEYWORD))return new r(v.WrongKind);if(J.elementName instanceof k0)return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=H0.createSymbol(J.elementName.value.value,p.Type,J.id);return new d(Q)}function xV0(Z,J){return J.kind!==p.Type?new r(v.WrongKind):new d(O8(Z))}function qV0(Z,J){if(J.kind!==p.Type)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0))throw new Error("Expected element declaration");return Q.body instanceof S0?JV0(J,Z):new d(n0(Z),[l.createForNode(Q.id,k.ExpectedThings,"type's body")])}function YV0(Z,J){return J.kind!==p.Type?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function $V0(Z,J){if(!(J instanceof _0&&J.elementType.value.kind===w.TYPE_KEYWORD))return v.WrongKind;let Q=Z.symbol(J.id).chain((x)=>Z.typeFromTypeSymbol(x.id)).diagnostics,X=J.body instanceof S0?J.body.body.reduce((x,q)=>(g(x,Z.typecheck(q.id)),x),[]):[];return Q=Q.concat(X),Q}function KV0(Z,J,Q){var X;if(!JX(Z)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.Type)return v.WrongKind;if(!Z.body)throw new Error("Expected body");if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");let x=Q.typeFromTypeExpression(Z.elementName.id).unwrap();if(x.kind!==t.ProductType)throw new Error("Expected product type");let q=VA(x,Q.program);q.members.set("__doc__",h0.create(I8(Z)));let Y=Q.symbol(Z.elementName.id).unwrap();return J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:Y,type:Q.typeOfSymbol(Y.id).unwrap(),value:q})),new U1(J,q)}var zV0={name:"Type",hooks:{symbol:XV0,typeOfSymbol:xV0,typeFromTypeSymbol:qV0,typecheck:$V0,members:YV0,evaluate:KV0}};function WV0(Z,J){let Q=J.nodeById(Z.declarationId);if(!Q)throw new Error("Expected declaration");if(!b5(Q))throw new Error("Expect literal element expression");if(iv(Q))return VV0(Q,J,Z);if(!(Q instanceof C0))throw new Error("Expected literal element");return Q.body instanceof S0||Q.body instanceof K2?YG(Q.body,J,Z):J.typeFromTypeExpression(Q.body.id)}function VV0(Z,J,Q){return P$0.create(Z,J)._chain((X)=>UV0(Z,X,J,Q)._chain((x)=>new d({ruleset:X,bodyType:x})))._chain(({ruleset:X,bodyType:x})=>{let{structure:q}=X;if(q===Y1.DictName||q===Y1.DictType){let z=jQ(x,void 0,Q),W=Z2(aQ(J,z,Q),[V4(J),n0(J)]),U=H0.createGeneratedSymbol("*",p.TypeProperty);U.generatedProps.type=z;let H=qY(X,W,Q);return W.members.set("*",{type:z,symbol:U}),z.parentType=H,new d(H)}if(q===Y1.List){let z=jQ(x,void 0,Q),W=$Z(J,z,Q),U=Z2(W,[n0(J)]),H=qY(X,U,Q);return z.parentType=H,new d(H)}let Y=jQ(x,void 0,Q),$=qY(X,Y,Q);return Y.parentType=$,new d($)})}function UV0(Z,J,Q,X){let x=[],q=n0(Q);if(Z instanceof C0)if(Z.body instanceof S0||Z.body instanceof K2){let Y=YG(Z.body,Q,X);g(x,Y.diagnostics),q=Y.unwrap()}else{let Y=Q.typeFromTypeExpression(Z.body.id);g(x,Y.diagnostics),q=Y.unwrap()}return q.kind===t.ProductType&&wA(Q,q),new d(q,x)}function HV0(Z,J){if(!b5(J))return new r(v.WrongKind);let Q=J instanceof C0?J.elementType:J.callee;if(Q instanceof Z0){let X=H0.createSymbol(Q.value.value,p.TypeProperty,J.id);return new d(X)}return new r(v.Error,[l.createForNode(Q.id,k.ExpectedThings,"identifier")])}function GV0(Z,J){return b5(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J instanceof C0?J.elementType.id:J.callee.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function BV0(Z,J){return J.parent&&b5(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function MV0(Z,J){return J.kind!==p.TypeProperty?new r(v.WrongKind):WV0(J,Z)}function DV0(Z,J){return J.kind!==p.TypeProperty?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function FV0(Z,J){if(!b5(J))return v.WrongKind;let Q=Z.symbol(J.id).chain((x)=>Z.specificType(x.id)).diagnostics,X=J instanceof C0&&J.body instanceof S0?J.body.body.reduce((x,q)=>(g(x,Z.typecheck(q.id)),x),[]):[];return Q=Q.concat(X),Q}var NV0={name:"TypeProperty",hooks:{symbol:HV0,allSymbolsFromContext:GV0,identifierSymbol:BV0,typeOfSymbol:MV0,members:DV0,typecheck:FV0}};function _A(Z,J){let Q=J.expressions.map((x)=>Z.typeFromTypeExpression(x.id)),X=Q.reduce((x,q)=>x.concat(q.diagnostics),[]);return{paramTypes:Q.filter((x)=>x.isOk()).map((x)=>x.unwrap()),diags:X}}function wV0(Z,J){if(!(J instanceof Z0))return new r(v.WrongKind);if(!J.parent)throw new Error("Node parent is undefined");let Q=Z.identifierSymbol(J.id);return Q.isOk()?Q:i4(o6(J),J.value.value,Z,J)}function _V0(Z,J){if(!(J instanceof Z0)||hv(J))return new r(v.WrongKind);let Q=Z.symbol(J.id).chain((x)=>Z.specificType(x.id));if(Q.isErr())return new d(n0(Z),Q.diagnostics);let X=[];if(g(X,Q.diagnostics),J.value.value==="create_slot"&&J.typeParameter){let{diags:x,paramTypes:q}=_A(Z,J.typeParameter);if(g(X,x),q.length){let Y=J6(Z,q[0]),$=l7(Q.unwrap());return $.returnType=Y,new d($,X)}return X.push(l.createForNode(J.id,k.GenericTypeNeedTypeArgument,c0(Q.unwrap(),{db:Z}),1)),new d(Q.unwrap(),X)}return Q}function PV0(Z,J){if(!(J instanceof Z0))return v.WrongKind;let Q=[],X=Z.symbol(J.id);if(g(Q,X.diagnostics),X.isErr())return Q;let x=X.unwrap(),q=Z.symbolReference(x.id);g(Q,q.diagnostics);let Y=x instanceof H0&&x.declarationId?Z.nodeById(x.declarationId):void 0;q.isOk()?x=q.unwrap():Y&&jV0(Z,Y,J)&&Q.push(l.createForNode(J.id,k.BlockScopedVariableUsedBeforeDefined,J.value.value));let $=Z.specificType(x.id);return g(Q,$.diagnostics),J.typeParameter&&!$I($.unwrap())&&Q.push(l.createForNode(J.id,k.ValueIsUsedAsType,J.value.value)),$I($.unwrap())&&g(Q,Z.typeFromTypeExpression(J.id).diagnostics),Q}function jV0(Z,J,Q){return J.id.filepath!==Q.id.filepath||v8(J)||uY(J)?!1:(J instanceof S1||J instanceof _0)&&J.body&&dv(J.body,Q)?!0:J.span().start>Q.span().start}function LV0(Z,J){var Q,X,x,q;if(!(J instanceof Z0))return new r(v.WrongKind);let Y=Z.symbol(J.id).chain((W)=>Z.typeFromTypeSymbol(W.id));if(Y.isErr())return Z.symbol(J.id).isOk()?new d(n0(Z),[l.createForNode(J.id,k.ValueIsUsedAsType,J.value.value)]):new d(n0(Z),[l.createForNode(J.id,k.NonExistentType,J.value.value)]);let $=Y.unwrap();if(!D$0($)||Y.isErr())return Y;let z=[...Y.diagnostics];if(J.typeParameter){let{diags:W,paramTypes:U}=_A(Z,J.typeParameter);if(g(z,W),U.length){let H=Z.symbol(J.id),B=(Q=Z.globalScope().get(Z,"Partial"))==null?void 0:Q.symbol;H.isOk()&&H.unwrap().id.key===(B==null?void 0:B.id.key)&&U[0].kind!==t.ProductType&&g(z,l.createForNode(J.typeParameter.id,k.PartialTypeNonApplicable,U[0].kind));let M=(X=Z.globalScope().get(Z,"Slot"))==null?void 0:X.symbol;H.isOk()&&H.unwrap().id.key===(M==null?void 0:M.id.key)&&U[0].kind!==t.PrimitiveType&&!Y$0(U[0])&&g(z,l.createForNode(J.typeParameter.id,k.SlotTypeNonApplicable,U[0].kind))}if(((x=$.typeArguments)==null?void 0:x.length)===U.length){let H=Z2($,U);return new d(H,z)}}return z.push(l.createForNode(J.id,k.GenericTypeNeedTypeArgument,c0($,{db:Z}),((q=$==null?void 0:$.typeArguments)==null?void 0:q.length)??"")),new d(n0(Z),z)}function CV0(Z,J,Q){if(!(Z instanceof Z0))return v.WrongKind;let X=Q.symbol(Z.id);if(X.isErr())throw new H4(l.createForNode(Z.id,k.NonExistentName,Z.value.value));let x=X.unwrap(),q=Q.typeFromTypeExpression(Z.id);if(q.isOk()&&U2(q.unwrap())&&x.kind!==p.TypeAlias)return Q.program.interpretNode(Z.typeParameter.expressions[0],J);if(x instanceof q4)return new U1(J,new g0);if(x instanceof H0&&x.declarationId){let Y=w0.create(Z.id.filepath),$=w0.create(x.declarationId.filepath);if(Y&&$&&!Y.equals($)){let z=Q.interpretFile($).env();return new U1(z,z.find(Z.value.value))}}return new U1(J,J.find(Z.value.value))}var OV0={name:"Identifier",hooks:{symbol:wV0,type:_V0,typeFromTypeExpression:LV0,typecheck:PV0,evaluate:CV0}};function mV0(Z){let J=[],Q,X=()=>({diags:J,validatedExpr:Q});return Z instanceof C0||Z instanceof _0?(Q=Z,X()):(J.push(l.createForNode(Z.id,k.UnexpectedThings,"expression")),X())}function SV0(Z,J){let Q=[],X=J.body.map(($)=>mV0($));X.forEach(($)=>g(Q,$.diags));let x=X.filter(($)=>$.validatedExpr instanceof C0).map(($)=>$.validatedExpr).map(($)=>Z.type($.body.id));x.forEach(($)=>g(Q,$.diagnostics));let q=x.filter(($)=>$.isOk()).map(($)=>$.unwrap()),Y=_H(Z,q);return{keyType:L1(Z,I0.String),valueType:Y,diags:Q}}function RV0(Z){var J,Q,X;let x={},q=(Q=(J=Z.parent)==null?void 0:J.parent)==null?void 0:Q.parent,Y=(X=Z.parent)==null?void 0:X.parent,$=Z.parent;if(!(q instanceof I1&&Y instanceof k2&&$ instanceof O4))return x;let z=Y.args.findIndex((W)=>W===$);return z<0?x:{callExpr:q,argList:Y,argExpr:$,paramIndex:z}}function IV0(Z,J){return J.body.reduce((Q,X)=>X instanceof C0?X.body instanceof S0?(Q.push(l.createForNode(X.elementType.id,k.UnexpectedThings,"element")),Q):(g(Q,Z.typecheck(X.body.id)),Q):(Q.push(l.createForNode(X.id,k.UnexpectedThings,"expression")),Q),[])}function TV0(Z,J){var Q,X;if(!(J instanceof K2))return new r(v.WrongKind);let x=(X=(Q=J.parent)==null?void 0:Q.parent)==null?void 0:X.parent;if(x instanceof I1){let U=Z.type(x.callee.id),H=U.unwrap();if(!q$0(H))return new d(n0(Z),U.diagnostics);let{paramIndex:B}=RV0(J);if(B===void 0)return new d(n0(Z),[l.createForNode(J.id,k.ExpectedThings,"valid function parameter")]);let M=H.parameters[B];if(M!=null&&M.type&&wv(M.type))return new d(M.type,U.diagnostics)}let{keyType:q,valueType:Y,diags:$}=SV0(Z,J),z=aQ(Z,Y),W=Z2(z,[q,Y]);return new d(W,$)}function vV0(Z,J){if(!(J instanceof K2))return v.WrongKind;let Q=[],X=Z.type(J.id);g(Q,X.diagnostics);let x=X.unwrap();if((x==null?void 0:x.name)==="Dict"){let q=IV0(Z,J);g(Q,q)}else{let q=i1(x,I5(J),Z);g(Q,q.diags),J.body.forEach((Y)=>g(Q,Z.typecheckWithPropsOptionalCtx(Y.id))),Q=Q.filter((Y)=>Y.code!==3003)}return Q}function AV0(Z,J,Q){if(!(Z instanceof K2))return v.WrongKind;let X=Q.type(Z.id).unwrap();if(!U2(X)){let q=J.find("Dict");if(!q)throw new Error("Expected a constructor for the Block Expression.");let Y=G0(q,"__call__",J,Z);return new U1(J,Y)}let x=XG(Q,Z,J,X);return new U1(J,x)}var EV0={name:"BlockExpression",hooks:{type:TV0,typecheck:vV0,evaluate:AV0}};function fV0(Z,J,Q,X){return Z.parameters.map((x)=>{let q=x.symbol.name,Y=J.get(q);if(Y){let $=X.nodeById(Y.argId).asArgument();if($.value)return Nv(x.type)?new CH($.value.node,Q):X.program.interpretNode($.value.node,Q).returnVal}return M2.Instance})}function UI(Z,J){throw Z instanceof l?Z:Z instanceof e1?new l(J,Z.message,Z.category,Z.code):Z}function HI(Z,J){return J.kind===t.Signature&&k6(J.returnType)&&(Z.type=J.returnType),Z}function kV0(Z,J){if(!(J instanceof I1))return new r(v.WrongKind);let Q=n0(Z),X=Z.callSiteResolution(J.id);return X.isOk()&&(Q=X.unwrap().signature.returnType),new d(Q,X.diagnostics)}function cV0(Z,J){if(!(J instanceof I1))return v.WrongKind;let Q=[],X=Z.type(J.callee.id);if(X.isErr())return X.diagnostics;g(Q,X.diagnostics);let x=X.unwrap();if(R2(x))return Q;J.args.args.forEach((z)=>{let W=z.asArgument();if(!W.value){Q.push(l.createForNode(z.id,k.ExpectedThings,"argument's value"));return}g(Q,Z.typecheck(W.value.node.id))});let q=Z.callSiteResolution(J.id);if(q.isErr())return g(Q,q.diagnostics,l.createForNode(J.callee.id,k.ExpressionNotCallable,c0(x,{db:Z}))),Q;let{resolutionResult:Y}=q.unwrap();if(Y.isErr())return g(Q,Y.err()),Q;let{typeCompatibilityDiags:$}=Y.unwrap();return g(Q,$),Q}function GI(Z){return Z.callee instanceof Z0&&Z.callee.value.value==="create_slot"}function bV0(Z,J,Q){if(!(Z instanceof I1))return v.WrongKind;let X=Q.type(Z.callee.id);if(X.isErr())throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot evaluate this expression"));let x=X.unwrap();if(R2(x)){let W=Z.args.args.map((H)=>{let B=H.asArgument();return Q.program.interpretNode(B.value.node,J).returnVal}),U=Q.program.interpretNode(Z.callee,J).returnVal;try{let H=G0(U,"__call__",...W),B=GI(Z)?HI(H,x):H;return new U1(J,B)}catch(H){UI(H,Z.id)}}let q=Q.program.interpretNode(Z.callee,J).returnVal,Y=Q.callSiteResolution(Z.id);if(Y.isErr())throw new Error("No signature found for call expression");let{signature:$,resolutionResult:z}=Y.unwrap();if(z.isErr())throw new Error("Argument resolution failed for call expression");try{let W=fV0($,z.unwrap().resolvedArgs,J,Q),U=G0(q,"__call__",...W),H=GI(Z)?HI(U,x):U;return new U1(J,H)}catch(W){UI(W,Z.id)}}var PA={name:"CallExpression",hooks:{type:kV0,typecheck:cV0,evaluate:bV0}};function pV0(Z,J){return J instanceof z3?Z.type(J.expr.id):new r(v.WrongKind)}function yV0(Z,J){return J instanceof z3?Z.typecheck(J.expr.id):v.WrongKind}function uV0(Z,J,Q){return Z instanceof z3?Q.program.interpretNode(Z.expr,J):v.WrongKind}var hV0={name:"GroupExpression",hooks:{type:pV0,typecheck:yV0,evaluate:uV0}};function gV0(Z,J){if(!(J instanceof y2))return new r(v.WrongKind);let Q=vY(Z),X=O5(I0.String,Z,J.name.value),x;if(IH(Z,J.content)){let q=Z2(Q,[X]);x=J6(Z,q)}else x=Z2(Q,[X]);return new d(x)}function iV0(Z,J){if(!(J instanceof y2))return new r(v.WrongKind);let Q=vY(Z),X=O5(I0.String,Z,J.name.value),x;if(IH(Z,J.content)){let Y=Z2(Q,[X]);x=J6(Z,Y)}else x=Z2(Q,[X]);let q=TH(Z,J.content,!0);return new d(x,q.diagnostics)}function dV0(Z,J){return J instanceof y2?Z.typecheck(J.content.id):v.WrongKind}function lV0(Z,J,Q){if(!(Z instanceof y2))return v.WrongKind;let X=I2(Q.program.interpretNode(Z.content,J).returnVal),x=Q.type(Z.id).unwrap(),q=X instanceof h0?new zZ(Z.name.value,X.data,x):new zZ(Z.name.value,X,x);return new U1(J,q)}var oV0={name:"Heredoc",hooks:{type:gV0,typeFromTypeExpression:iV0,typecheck:dV0,evaluate:lV0}};function sV0(Z,J){return!!(Z.type&&k6(Z.type)||J.type&&k6(J.type))}function nV0(Z,J){if(!(J instanceof k0))return new r(v.WrongKind);let Q=[],X=n0(Z);switch(J.op.value){case"=":J.leftExpression instanceof Z0?Q.push(l.createForNode(J.leftExpression.id,k.CannotAssignTwiceToImmutableVariable,J.leftExpression.value.value)):J.leftExpression instanceof c1?Q.push(l.createForNode(J.leftExpression.id,k.LhsAssignmentExprMustBeName)):Q.push(l.createForNode(J.leftExpression.id,k.UnexpectedThings,"expression"));break;case"==":case"!=":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();LA(q,$)||x4(q,$,Z)||x4($,q,Z)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"<":case"<=":case">":case">=":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,Q3(Z));break}x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"+":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(C5(Z),q,Z)&&x4(C5(Z),$,Z)?X=O3(Z,q,$,C5(Z)):x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):x4(V4(Z),q,Z)&&x4(V4(Z),$,Z)?X=O3(Z,q,$,V4(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"-":case"*":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(C5(Z),q,Z)&&x4(C5(Z),$,Z)?X=O3(Z,q,$,C5(Z)):x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"/":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case".":{let x=Z.symbol(J.id).chain((q)=>Z.specificType(q.id));g(Q,x.diagnostics),x.isOk()&&(X=x.unwrap());break}case"||":case"&&":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();jA(q,$)||aV0(q,$)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}default:Q.push(l.createForNode(J.id,k.InvalidOperator,J.op.value));break}return new d(X,Q)}function jA(Z,J){return LA(Z,J)&&Z.primitiveTypeKind===I0.Boolean}function aV0(Z,J){let Q=b6(Z)?RQ(Z):Z,X=b6(J)?RQ(J):J;return jA(Q,X)}function LA(Z,J){return(y6(Z)||p6(Z))&&(y6(J)||p6(J))&&Z.primitiveTypeKind===J.primitiveTypeKind}function O3(Z,J,Q,X){return k6(J)||k6(Q)?J6(Z,X):X}function rV0(Z,J){return J instanceof k0?Z.type(J.id).diagnostics.concat(Z.typecheck(J.leftExpression.id)).concat(Z.typecheck(J.rightExpression.id)):v.WrongKind}function tV0(Z,J,Q){if(!(Z instanceof k0)||Z.op.value===".")return v.WrongKind;let X=Q.program.interpretNode(Z.leftExpression,J).returnVal,x=Q.program.interpretNode(Z.rightExpression,J).returnVal;if(sV0(X,x)){let Y=new Map;return Y.set("leftExpression",X),Y.set("operator",h0.create(Z.op.value)),Y.set("rightExpression",x),new U1(J,new g0(Y,void 0,dT(Q)))}let q=G0(X,Z.op.value,x);return new U1(J,q)}var eV0={name:"InfixExpression",hooks:{type:nV0,typecheck:rV0,evaluate:tV0}};function ZU0(Z,J){let Q=J.exprList.map((q)=>Z.type(q.id)),X=Q.reduce((q,Y)=>q.concat(Y.diagnostics),[]),x=Q.filter((q)=>q.isOk()).map((q)=>q.unwrap());return{contentType:_H(Z,x),diags:X}}function JU0(Z,J){if(!(J instanceof M4))return new r(v.WrongKind);let{contentType:Q,diags:X}=ZU0(Z,J),x=$Z(Z,Q),q=Z2(x,[Q]);return new d(q,X)}function QU0(Z,J){return J instanceof M4?J.exprList.reduce((Q,X)=>(g(Q,Z.typecheck(X.id)),Q),[]):v.WrongKind}function XU0(Z,J,Q){if(!(Z instanceof M4))return v.WrongKind;let X=new C4;return Z.exprList.forEach((x)=>{let q=Q.program.interpretNode(x,J).returnVal;G0(X,"push",q)}),new U1(J,X)}var xU0={name:"ListExpression",hooks:{type:JU0,typecheck:QU0,evaluate:XU0}};function qU0(Z,J){if(!(J instanceof v3))return new r(v.WrongKind);let Q=n0(Z);return new d(Q)}function YU0(Z,J){return J instanceof v3?Z.type(J.id).diagnostics:v.WrongKind}function $U0(Z,J,Q){if(!(Z instanceof v3))return v.WrongKind;let X=Q.program.interpretNode(Z.expression,J).returnVal,x=G0(X,`_PO${Z.op.value}`);return new U1(J,x)}var KU0={name:"PostfixExpression",hooks:{type:qU0,typecheck:YU0,evaluate:$U0}};function zU0(Z,J){return!p6(Z)&&!y6(Z)?!1:J==="!"?Z.primitiveTypeKind===I0.Boolean:Z.primitiveTypeKind===I0.Any||Z.primitiveTypeKind===I0.Number||Z.primitiveTypeKind===I0.Int}function WU0(Z,J){if(!(J instanceof B4))return new r(v.WrongKind);let Q=[],X=n0(Z),x=Z.type(J.expression.id);g(Q,x.diagnostics);let q=x.unwrap();if(!zU0(q,J.op.value))return Q.push(l.createForNode(J.id,k.PrefixOperatorCannotAppliedForType,J.op.value,c0(q,{db:Z}))),new d(X,Q);switch(J.op.value){case"+":case"-":{p6(q)?X=L1(Z,q.primitiveTypeKind):y6(q)&&(X=O5(q.primitiveTypeKind,Z,J.op.value==="-"?-q.value:q.value));break}case"!":{p6(q)?X=L1(Z,q.primitiveTypeKind):y6(q)&&(X=O5(q.primitiveTypeKind,Z,!q.value));break}default:Q.push(l.createForNode(J.id,k.PrefixOperatorCannotAppliedForType,J.op.value,c0(q,{db:Z})));break}return new d(X,Q)}function VU0(Z,J){return J instanceof B4?Z.type(J.id).diagnostics:v.WrongKind}function UU0(Z,J,Q){if(!(Z instanceof B4))return v.WrongKind;let X=Q.program.interpretNode(Z.expression,J).returnVal,x=G0(X,`_P${Z.op.value}`);return new U1(J,x)}var HU0={name:"PrefixExpression",hooks:{type:WU0,typecheck:VU0,evaluate:UU0}};function GU0(Z,J){return J instanceof c1?CA(J,Z):new r(v.WrongKind)}function CA(Z,J){let Q=n0(J);switch(Z.value.kind){case w.MIDDLE_STRING_LITERAL:Q=O5(I0.String,J,Z.value.value);break;case w.NUMBER_LITERAL:{let X=Z.value.isFloat?I0.Number:I0.Int;Q=O5(X,J,Z.value.value);break}case w.TRUE_LITERAL:case w.FALSE_LITERAL:Q=O5(I0.Boolean,J,Z.value.value);break;default:throw new Error("Invalid primary expression")}return new d(Q)}function BU0(Z,J){return J instanceof c1?CA(J,Z):new r(v.WrongKind)}function MU0(Z,J){return J instanceof c1?Z.type(J.id).diagnostics:v.WrongKind}function DU0(Z,J,Q){if(!(Z instanceof c1))return v.WrongKind;switch(Z.value.kind){case w.NUMBER_LITERAL:return new U1(J,new h4(Z.value.value));case w.TRUE_LITERAL:case w.FALSE_LITERAL:return new U1(J,Z.value.value?R1.True:R1.False);case w.MIDDLE_STRING_LITERAL:return new U1(J,h0.create(Z.value.value));default:throw new Error("Unknown constant type")}}var FU0={name:"PrimaryExpression",hooks:{type:GU0,typeFromTypeExpression:BU0,typecheck:MU0,evaluate:DU0}};function NU0(Z,J){let Q=Z.nodeById(J);if(!Q)return new r(v.WrongKind);if(!(Q instanceof Z0)&&!$4(Q))return new r(v.WrongKind);if(Q instanceof Z0){let X=w0.create(Q.id.filepath),x=Z.moduleIdOfFile(X),q=HZ(Z,()=>gY(Z,x,Q.value.value));if(q.isOk()){if(q.unwrap()instanceof q4)return q;let Y=q.diagnostics;return Y=Y.concat(l.createForNode(Q.id,k.UnresolvedModuleExpression)),new r(v.Error,Y)}return new r(v.Error,[l.createForNode(Q.id,k.NonExistentNameInModule,Q.value.value,x.name)])}return Q.rightExpression instanceof Z0?Z.symbolOfModulePath(Q.leftExpression.id).chain((X)=>Z.members(X.id).chain((x)=>new d({leftSymbol:X,members:x}))).chain(({members:X,leftSymbol:x})=>{var q;let Y=(q=X.get(Z,Q.rightExpression.value.value))==null?void 0:q.symbol;return Y?Y instanceof q4?new d(Y):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.UnresolvedModuleExpression)]):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.NonExistentNameInModule,Q.rightExpression.value.value,x.name)])}):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.UnexpectedThings,"expression")])}function wU0(Z,J){if(!t8(J))return new r(v.WrongKind);if(J.body instanceof S0){let Q=[],X=[];return J.body.body.forEach((x)=>{if(x instanceof Z0){let q=H0.createSymbol(x.value.value,p.ModuleItem,x.id);Q.push({symbol:q,nodeId:x.id})}else if(x instanceof C0&&x.elementType instanceof Z0&&x.body instanceof Z0){let q=H0.createSymbol(x.elementType.value.value,p.ModuleItem,x.elementType.id);Q.push({symbol:q,nodeId:x.elementType.id});let Y=H0.createSymbol(x.body.value.value,p.ModuleItemAlias,x.body.id);Q.push({symbol:Y,nodeId:x.body.id})}else X.push(l.createForNode(x.id,k.InvalidThings,"syntax"))}),new d(Q,X)}return J.body?new r(v.Error,[l.createForNode(J.body.id,k.InvalidThings,"syntax")]):new d([])}function _U0(Z,J){var Q,X,x;let q;return(Q=J.parent)!=null&&Q.parent&&t8(J.parent.parent)?q=J.parent.parent:(x=(X=J.parent)==null?void 0:X.parent)!=null&&x.parent&&t8(J.parent.parent.parent)&&(q=J.parent.parent.parent),q?Z.allSymbolsFromContext(q.id).chain((Y)=>{var $;let z=($=h5(Y,J))==null?void 0:$.symbol;return z?new d(z):new r(v.Error)}):new r(v.WrongKind)}function PU0(Z,J){return t8(J)?J.body?J.body instanceof S0?Z.allSymbolsFromContext(J.id).chain((Q)=>{var X;let x=new J8((X=Z.astFromNode(J.id))==null?void 0:X.filePath,void 0,[{node:J.elementName,includedFull:!1}]),q=[];return Q.forEach(({symbol:Y,nodeId:$})=>{let z=Z.nodeById($);z.parent instanceof C0&&z.parent.elementType.id.key===z.id.key||(x.has(Z,Y.name)?q.push(l.createForNode(z.id,k.DuplicatedName,Y.name)):x.set(Y.name,Y,o7.Private))}),new d(x,q)}):new r(v.Error):J.elementName instanceof Z0||$4(J.elementName)?new d(new J8(Z.astFromNode(J.id).filePath,void 0,[{node:J.elementName,includedFull:!0}])):new r(v.Error,[l.createForNode(J.elementName.id,k.InvalidThings,"syntax")]):new r(v.WrongKind)}function jU0(Z,J){var Q,X,x,q,Y;if(J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias)return new r(v.WrongKind);if(J.kind===p.ModuleItem){let U=Z.nodeById(J.declarationId),H=t8(U.parent.parent)?(Q=U.parent)==null?void 0:Q.parent:(x=(X=U==null?void 0:U.parent)==null?void 0:X.parent)==null?void 0:x.parent;if(!H||!t8(H))throw new Error("Expected use declaration");return HZ(Z,()=>Z.symbolOfModulePath(H.elementName.id).chain((B)=>Z.members(B.id).chain((M)=>new d({moduleSymbol:B,members:M}))).chain(({moduleSymbol:B,members:M})=>M.has(Z,J.name)?new d(M.get(Z,J.name).symbol):new r(v.Error,[l.createForNode(U.id,k.ModuleNoMember,B.name,J.name)])))}let $=Z.nodeById(J.declarationId),z=($==null?void 0:$.parent).elementType,W=(Y=(q=z==null?void 0:z.parent)==null?void 0:q.parent)==null?void 0:Y.parent;if(!W||!t8(W))throw new Error("Expected use declaration");return HZ(Z,()=>Z.symbolOfModulePath(W.elementName.id).chain((U)=>Z.members(U.id).chain((H)=>new d({moduleSymbol:U,members:H}))).chain(({moduleSymbol:U,members:H})=>H.has(Z,z.value.value)?new d(H.get(Z,z.value.value).symbol):new r(v.Error,[l.createForNode(z.id,k.ModuleNoMember,U.name,z.value.value)])))}function LU0(Z,J){if(J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias)return new r(v.WrongKind);let Q=Z.symbolReference(J.id).chain((X)=>Z.specificType(X.id));return Q.isOk()?Q:new d(n0(Z),Q.diagnostics)}function CU0(Z,J){return J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias?new r(v.WrongKind):Z.symbolReference(J.id).chain((Q)=>Z.typeFromTypeSymbol(Q.id))}function OU0(Z,J){return t8(J)?!J.body||J.body instanceof S0&&J.body.body.length===0?Z.symbolOfModulePath(J.elementName.id).diagnostics:Z.allSymbolsFromContext(J.id).chain((Q)=>{let X=[];Q.forEach(({symbol:Y})=>{g(X,Z.specificType(Y.id).diagnostics)});let x=[],q=!1;return X.forEach((Y)=>{q?Y.code!==3024&&x.push(Y):(Y.code===3024&&(q=!0),x.push(Y))}),new d(void 0,x)}).diagnostics:v.WrongKind}function mU0(Z,J){return J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias?new r(v.WrongKind):Z.symbolReference(J.id).chain((Q)=>Z.members(Q.id))}function SU0(Z,J,Q){return t8(Z)?(Z.body&&Z.body instanceof S0&&Z.body.body.forEach((X)=>{if(X instanceof Z0){let x=BI(X,J,Q).returnVal,q=Q.symbol(X.id).unwrap();J.data.bindings.push(new V2({name:X.value.value,symbol:q,type:q.type(Q),value:x}))}else if(X instanceof C0&&X.elementType instanceof Z0&&X.body instanceof Z0){let x=BI(X.elementType,J,Q).returnVal,q=Q.symbol(X.body.id).unwrap();J.data.bindings.push(new V2({name:X.body.value.value,symbol:q,type:q.type(Q),value:x}))}}),new U1(J,a8.Instance)):v.WrongKind}function BI(Z,J,Q){let X=Q.symbol(Z.id).chain((x)=>Q.symbolReference(x.id)).unwrap();if(X instanceof q4)return new U1(J,new g0);if(X instanceof H0&&X.declarationId){let x=w0.create(X.declarationId.filepath),q=Q.interpretFile(x).env();return new U1(q,q.find(Z.value.value))}throw new Error("Unreachable")}var RU0={name:"UseDeclaration",hooks:{allSymbolsFromContext:wU0,identifierSymbol:_U0,mergeableInnerScope:PU0,symbolReference:jU0,typeOfSymbol:LU0,typeFromTypeSymbol:CU0,typecheck:OU0,members:mU0,evaluate:SU0}};function MI(Z){return Z.kind===t.UnionType?Z.types:[Z]}function OA(Z,J,Q=!1){if(!J)return new d(n0(Z));let X=J.body.length>0?J.body[J.body.length-1]:null;if(X){let x=Z.type(X.id);return Q?new d(J6(Z,wY(Z,x.unwrap())),x.diagnostics):x}return new d(FZ(Z))}function IU0(Z,J,Q=!1){if(J instanceof S0||!J){let x=OA(Z,J);return Q?new d(J6(Z,wY(Z,x.unwrap())),x.diagnostics):x}let X=Z.type(J.id);return Q?new d(J6(Z,X.unwrap()),X.diagnostics):X}function TU0(Z,J){if(!J.condition)return!1;let Q=Z.type(J.condition.id).unwrap();return k6(Q)}function vU0(Z,J){if(!(J instanceof K3))return new r(v.WrongKind);let Q=TU0(Z,J),X=OA(Z,J.thenBranch,Q);if(!J.elseKeyword)return X;let x=IU0(Z,J.elseBranch,Q),q=X.diagnostics.concat(x.diagnostics);if(R2(X.value.unwrap()))return new d(n0(Z),q);if(R2(x.value.unwrap()))return new d(n0(Z),q);let Y=MI(X.value.unwrap()).concat(MI(x.value.unwrap())),$=q8(Y);return new d($,q)}function AU0(Z,J){if(!(J instanceof K3))return v.WrongKind;let Q=[];return g(Q,Z.type(J.id).diagnostics),J.condition&&g(Q,Z.typecheck(J.condition.id)),J.thenBranch&&g(Q,Z.typecheck(J.thenBranch.id)),J.elseBranch&&g(Q,Z.typecheck(J.elseBranch.id)),Q}function EU0(Z,J,Q){if(!(Z instanceof K3))return v.WrongKind;if(!Z.condition)throw new Error("Expected condition");if(!Z.thenBranch)throw new Error("Expected node body");let X=Q.program.interpretNode(Z.condition,J).returnVal;if(X.type&&k6(X.type)){let x=Q.program.interpretNode(Z.thenBranch,J).returnVal,q=new Map;if(q.set("condition",X),q.set("then",x),Z.elseBranch){let Y=Q.program.interpretNode(Z.elseBranch,J).returnVal;q.set("else",Y)}return new U1(J,new g0(q,void 0,iT(Q)))}return X.data?Q.program.interpretNode(Z.thenBranch,J):Z.elseBranch?Q.program.interpretNode(Z.elseBranch,J):new U1(J,a8.Instance)}var fU0={name:"IfExpression",hooks:{type:vU0,typecheck:AU0,evaluate:EU0}};function XX(Z){return Z instanceof B4&&Z.op.value==="::"&&Z.expression instanceof Z0}function kU0(Z,J){if(!XX(J))return new r(v.WrongKind);let Q=Z.moduleTree();return Z.membersOfModule(Q.id).chain((X)=>X.has(Z,J.expression.value.value)?new d(X.get(Z,J.expression.value.value).symbol):new r(v.Error,[l.createForNode(J.expression.id,k.NonExistentNameInRootModule,J.expression.value.value)]))}function cU0(Z,J){return XX(J)?Z.symbol(J.id).chain((Q)=>Z.specificType(Q.id)):new r(v.WrongKind)}function bU0(Z,J){return XX(J)?Z.type(J.id).diagnostics:v.WrongKind}function pU0(Z,J,Q){if(!XX(Z))return v.WrongKind;let X=Q.symbol(Z.id).unwrap();if(X.kind===p.Module)return new U1(J,new g0);if(!(X instanceof H0)||!X.declarationId)throw new Error("Unreachable");let x=w0.create(X.declarationId.filepath);if(!x)throw new Error("Unreachable");let q=Q.interpretFile(x).env();return new U1(J,q.find(X.name))}var yU0={name:"AbsoluteModuleAccessExpression",hooks:{symbol:kU0,type:cU0,typecheck:bU0,evaluate:pU0}};function uU0(Z,J){if(!EH(J))return new r(v.WrongKind);let Q=h$0(Z,J);if(Q.isErr())return new r(v.Error,Q.diagnostics);let X=Q.unwrap(),x=H0.createSymbol(X,p.Element,J.id);return new d(x,Q.diagnostics)}function hU0(Z,J,Q){if(!EH(Z))return v.WrongKind;let X=Q.symbol(Z.id).unwrap(),x=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(x instanceof C4){let $=QG(Q,Z,x);$&&(x=$)}let q=G0(x,"__call__",J,Z.body,{elementName:X.name,filepath:w0.create(Z.id.filepath)});q.members.set("__doc__",h0.create(I8(Z))),q=JG(Q,q,X.name,J,w0.create(Z.id.filepath));let Y=new V2({name:X.name,symbol:X,type:X.type(Q),value:q});return J.data.bindings.push(Y),new U1(J,q)}var gU0={name:"Tag",hooks:{symbol:uU0,type:FY.hooks.type,typecheck:FY.hooks.typecheck,evaluate:hU0}},E7=1,bQ=2,$G=4,iU0=bQ|$G,dU0=bQ|$G|E7,yU=8,mA=16,lU0=32,oU0=64,sU0=128,SA=new Array(128).fill(0);for(let Z=0;Z<128;Z++){let J=0;Z>=48&&Z<=57&&(J|=E7),(Z>=65&&Z<=90||Z>=97&&Z<=122)&&(J|=bQ),Z===95&&(J|=$G),(Z===43||Z===45||Z===42||Z===47||Z===124||Z===38||Z===46||Z===33||Z===60||Z===62||Z===61||Z===58||Z===92)&&(J|=yU),(Z===32||Z===9||Z===13||Z===10)&&(J|=mA),(Z===32||Z===9||Z===13)&&(J|=lU0),(Z===34||Z===39)&&(J|=oU0),(Z===43||Z===45)&&(J|=sU0),SA[Z]=J}function DI(Z){return Z<0||Z>127?0:SA[Z]}class B2{constructor(){this.cache=new Map}static getInstance(){return B2.instance||(B2.instance=new B2),B2.instance}getOrCreate(Z,J,Q,X){let x=`${Z}:${J}`;typeof Q=="string"&&Q!==J&&(x+="#d");let q=this.cache.get(x);return q===void 0&&(q=Object.freeze({kind:Z,text:J,value:Q,isFloat:X}),this.cache.set(x,q)),q}getCacheSize(){return this.cache.size}}var y0={Tab:9,LineFeed:10,CarriageReturn:13,Space:32,Exclamation:33,DoubleQuote:34,Ampersand:38,Apostrophe:39,LeftParen:40,RightParen:41,Comma:44,Dot:46,Slash:47,Zero:48,Colon:58,Semicolon:59,LessThan:60,Equals:61,GreaterThan:62,At:64,Asterisk:42,LeftBracket:91,RightBracket:93,LowerB:98,LowerF:102,LowerN:110,LowerR:114,LowerT:116,LowerU:117,LowerV:118,LeftBrace:123,VerticalBar:124,RightBrace:125,Tilde:126},FI=new Map([["const",w.CONST_KEYWORD],["Type",w.TYPE_KEYWORD],["use",w.USE_KEYWORD],["Func",w.FUNC_KEYWORD],["Trait",w.TRAIT_KEYWORD],["Impl",w.IMPL_KEYWORD],["if",w.IF_KEYWORD],["else",w.ELSE_KEYWORD]]),nU0=new Map([[w.LBRACE,{text:"{"}],[w.RBRACE,{text:"}"}],[w.LPAREN,{text:"("}],[w.RPAREN,{text:")"}],[w.LBRACKET,{text:"["}],[w.RBRACKET,{text:"]"}],[w.COLON,{text:":"}],[w.SEMICOLON,{text:";"}],[w.COMMA,{text:","}],[w.EQUAL,{text:"="}],[w.ARROW,{text:"=>"}],[w.AT_SIGN,{text:"@"}],[w.RAW_AT_SIGN,{text:"@~"}],[w.OPEN_EMBEDDED_EXPRESSION,{text:"${"}],[w.CLOSE_EMBEDDED_EXPRESSION,{text:"}",value:"}"}],[w.CONST_KEYWORD,{text:"const"}],[w.TYPE_KEYWORD,{text:"Type"}],[w.IMPORT_KEYWORD,{text:"import"}],[w.USE_KEYWORD,{text:"use"}],[w.FUNC_KEYWORD,{text:"Func"}],[w.TRAIT_KEYWORD,{text:"Trait"}],[w.IMPL_KEYWORD,{text:"Impl"}],[w.IF_KEYWORD,{text:"if"}],[w.ELSE_KEYWORD,{text:"else"}],[w.AS_KEYWORD,{text:"as"}],[w.TRUE_LITERAL,{text:"true",value:!0}],[w.FALSE_LITERAL,{text:"false",value:!1}],[w.WHITESPACE,{text:" "}],[w.TAB,{text:"\t"}],[w.CR,{text:"\r"}],[w.END_OF_LINE,{text:`
139
+ `);Z.setFileContent(Y,$);let z=Z.parse(Y).transformedAst();return{decoratorAst:z,lookupType:(W)=>{let U=z.statements[W];if(!U)return FZ(Z.db);let H=Z.typeFromTypeExpression(U.body.id);if(H.isErr()||b2(H.diagnostics))throw new Error(`Cannot get type '${U.body.fullText()}'.`);return H.unwrap()}}}function av(Z){var J,Q;return((Q=(J=Z.parent)==null?void 0:J.parent)==null?void 0:Q.parent)instanceof I1&&Z.parent.parent.parent.callee instanceof Z0&&Z.parent.parent.parent.callee.value.value==="r"}function rv(Z,J,Q){let X=Q?Q(Z,J):Z.symbol(J.id);if(X.isErr())return X;let x=X.unwrap(),q=Z.symbolReference(x.id);q.isOk()&&(x=q.unwrap());let Y=[];return g(Y,X.diagnostics,q.diagnostics),new d(x,Y)}function a$0(Z,J,Q){try{let X=Z.masterDb,{queryNameInterner:x}=X,q=(Y)=>{let $=fQ(X,Y,x.intern(Y),J),z=X.graph.get($.query.id,$.key.id);z&&(z.result=EQ)};Q.forEach(q)}catch{}}function r$0(Z,J){try{let Q=Z.masterDb,{queryNameInterner:X}=Q;J.forEach((x)=>{let q=X.map.get(x);if(!q)return;let Y=q.id,$=Q.graph.data.get(Y);$&&$.forEach((z)=>{z.result=EQ})})}catch(Q){console.error("Failed to release cache for queries:",Q)}}var nH=32,tv=class Z{constructor(J,Q,X){this.kind=J,this.filepath=Q,this.id=BigInt(X)<<BigInt(nH)|BigInt(Z.idSeq),Z.idSeq+=1}get key(){return this.id}static createWithId(J,Q,X){let x=new Z(J,Q,0);return x.id=X,x}toString(){return this.id.toString()}asInternKey(J,Q){return this.id}};tv.idSeq=0;var UZ=tv,aH=((Z)=>(Z.Decl="Decl",Z.Expr="Expr",Z.Syntax="Syntax",Z.Body="Body",Z.Import="Import",Z.Block="Block",Z))(aH||{});function z2(Z,J,Q,X){return new UZ(J,Q,X)}var Y0=((Z)=>(Z.Ast="Ast",Z.PrimaryExpression="PrimaryExpression",Z.Identifier="Identifier",Z.CallExpression="CallExpression",Z.ArgumentList="ArgumentList",Z.ArgumentExpression="ArgumentExpression",Z.ArithmeticExpression="ArithmeticExpression",Z.PrefixExpression="PrefixExpression",Z.InfixExpression="InfixExpression",Z.PostfixExpression="PostfixExpression",Z.TernaryExpression="TernaryExpression",Z.LiteralElementExpression="LiteralElementExpression",Z.EqualityDeclaration="EqualityDeclaration",Z.ReturnTypeNode="ReturnTypeNode",Z.ElementDeclaration="ElementDeclaration",Z.Block="Block",Z.BlockExpression="BlockExpression",Z.ListExpression="ListExpression",Z.GroupExpression="GroupExpression",Z.Heredoc="Heredoc",Z.ImportDeclaration="ImportDeclaration",Z.ImportBody="ImportBody",Z.ImportModule="ImportModule",Z.IfExpression="IfExpression",Z.EmbeddedExpression="EmbeddedExpression",Z.TemplateString="TemplateString",Z.TypeParameter="TypeParameter",Z.Decorator="Decorator",Z))(Y0||{}),t7=((Z)=>(Z.None="None",Z.HasError="HasError",Z))(t7||{}),ev=class Z{constructor(){this.flags="None"}getTokenStream(){if(this instanceof v1){let J=v1.tokenCache.get(this);if(J)return J;let Q=this.computeTokenStream();return v1.tokenCache.set(this,Q),Q}return this.computeTokenStream()}invalidateTokenStreamCache(J=!1){this instanceof v1&&v1.tokenCache.delete(this),J&&this.parent&&this.parent.invalidateTokenStreamCache(!0)}container(){if(this.parent instanceof S0||this.parent instanceof s6)return this.parent.parent instanceof _0||this.parent.parent instanceof C0||this.parent.parent instanceof A3?this.parent.parent:void 0;if(this.parent instanceof v1)return this.parent}children(){}prevSibling(){let J=this.container();if(!J)return;let Q=J.children(),X=Q.findIndex((x)=>x===this);if(!(X===-1||X===0))return Q[X-1]}nextSibling(){let J=this.container();if(!J)return;let Q=J.children(),X=Q.findIndex((x)=>x===this);if(!(X===-1||X===Q.length-1))return Q[X+1]}siblings(){let J=this.container();return J?J.children().filter((Q)=>Q!==this):void 0}span(){let J=this.getTokenStream();if(J.length===0)throw new Error("Unreachable");return{start:J[0].offset,end:J[J.length-1].offset+J[J.length-1].text.length}}fullSpan(){var J,Q,X;let x=this.getTokenStream();if(x.length===0)throw new Error("Unreachable");let q=x[0],Y=x[x.length-1],$=((Q=(J=q.leadingTrivia)==null?void 0:J[0])==null?void 0:Q.offset)??q.offset,z=(X=Y.trailingTrivia)==null?void 0:X[Y.trailingTrivia.length-1],W=z?z.offset+z.text.length:Y.offset+Y.text.length;return{start:$,end:W}}setEndingSeparator(J){this.endingSeparator=J}text(){let J=this.getTokenStream();if(J.length===0)return"";if(J.length===1)return J[0].text;let Q="";Q+=J[0].text;for(let X=1;X<J.length-1;X+=1)Q+=J[X].fullText();return Q+=J[J.length-1].text,Q}fullText(){return this.getTokenStream().map((J)=>J.fullText()).join("")}symbol(J){let Q=J.symbol(this.id);if(Q.isOk())return Q.unwrap()}locals(J){let Q=J.scope(this.id);if(Q.isOk())return Q.unwrap()}type(J){let Q=J.type(this.id);if(Q.isOk())return Q.unwrap()}};ev.tokenCache=new WeakMap;var d1=ev,m5=((Z)=>(Z[Z.None=0]="None",Z[Z.HasTrailingEndOfLine=1]="HasTrailingEndOfLine",Z))(m5||{});class l1{constructor(Z,J,Q,X,x){this.flags=0,this.data=Z,this.offset=J,this.leadingTrivia=Q,this.trailingTrivia=X,x&&(this.flags=x)}get kind(){return this.data.kind}get text(){return this.data.text}get value(){return this.data.value}get isFloat(){return this.data.isFloat}end(){return this.offset+this.text.length}fullText(){var Z,J;let Q="";return(Z=this.leadingTrivia)==null||Z.forEach((X)=>{Q+=X.text}),Q+=this.text,(J=this.trailingTrivia)==null||J.forEach((X)=>{Q+=X.text}),Q}clone(){var Z,J;return new l1(this.data,this.offset,(Z=this.leadingTrivia)==null?void 0:Z.map((Q)=>Q.clone()),(J=this.trailingTrivia)==null?void 0:J.map((Q)=>Q.clone()),this.flags)}}var w=((Z)=>(Z.OPEN_EMBEDDED_EXPRESSION="OPEN_EMBEDDED_EXPRESSION",Z.CLOSE_EMBEDDED_EXPRESSION="CLOSE_EMBEDDED_EXPRESSION",Z.STRING_START="STRING_START",Z.STRING_END="STRING_END",Z.INVALID_STRING_END="INVALID_STRING_END",Z.MIDDLE_STRING_LITERAL="MIDDLE_STRING_LITERAL",Z.NUMBER_LITERAL="NUMBER_LITERAL",Z.TRUE_LITERAL="TRUE_LITERAL",Z.FALSE_LITERAL="FALSE_LITERAL",Z.CONST_KEYWORD="CONST_KEYWORD",Z.TYPE_KEYWORD="TYPE_KEYWORD",Z.IMPORT_KEYWORD="IMPORT_KEYWORD",Z.FUNC_KEYWORD="FUNC_KEYWORD",Z.TRAIT_KEYWORD="TRAIT_KEYWORD",Z.IMPL_KEYWORD="IMPL_KEYWORD",Z.USE_KEYWORD="USE_KEYWORD",Z.AS_KEYWORD="AS_KEYWORD",Z.LBRACE="LBRACE",Z.RBRACE="RBRACE",Z.LPAREN="LPAREN",Z.RPAREN="RPAREN",Z.LBRACKET="LBRACKET",Z.RBRACKET="RBRACKET",Z.COLON="COLON",Z.SEMICOLON="SEMICOLON",Z.COMMA="COMMA",Z.EQUAL="EQUAL",Z.ARROW="ARROW",Z.OPERATOR="OPERATOR",Z.AT_SIGN="AT_SIGN",Z.RAW_AT_SIGN="RAW_AT_SIGN",Z.HEREDOC_CONTENT="HEREDOC_CONTENT",Z.IDENTIFIER="IDENTIFIER",Z.IF_KEYWORD="IF_KEYWORD",Z.ELSE_KEYWORD="ELSE_KEYWORD",Z.WHITESPACE="WHITESPACE",Z.TAB="TAB",Z.CR="CR",Z.END_OF_LINE="END_OF_LINE",Z.SINGLE_LINE_COMMENT="SINGLE_LINE_COMMENT",Z.MULTILINE_COMMENT="MULTILINE_COMMENT",Z.HEREDOC="HEREDOC",Z.INVALID="INVALID",Z.EOF="EOF",Z))(w||{}),ZA=class Z extends d1{constructor(J=[],Q,X){super(),this.kind="Ast",this.statements=J,this.statements.forEach((x)=>x.parent=this),this.filePath=Q,this.filepathId=X}addStatement(J){J.parent=this,this.statements.push(J),this.invalidateTokenStreamCache(!0)}setEofToken(J){this.eofToken=J,this.invalidateTokenStreamCache(!0)}assignIds(){let J;if(UZ.idSeq=0,this.filePath)J=this.filePath.toString(),this.id=new UZ("Decl",J,this.filepathId);else throw new Error("Cannot assign ids to Ast without a filepath");this.statements.forEach((Q)=>{let X;Q instanceof A3?X="Import":Q instanceof S0?X="Block":_Z(Q)?X="Decl":X="Expr",Q.assignIds(X,J,this.filepathId)})}computeTokenStream(){let J=[];return this.statements.forEach((Q)=>g(J,Q.getTokenStream())),this.eofToken&&J.push(this.eofToken),J}children(){return this.statements}};ZA.defaultPathCounter=0;var v1=ZA;class q3 extends d1{constructor(Z,J,Q){super(),this.kind="EmbeddedExpression",this.openBraceToken=Z,this.closeBraceToken=Q,this.value=J,this.value.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.value.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.openBraceToken,this.value.getTokenStream(),this.closeBraceToken),Z}}class a1 extends d1{constructor(Z,J,Q){super(),this.kind="TemplateString",this.openQuoteToken=Z,this.closeQuoteToken=Q,this.elements=J,this.elements.forEach((X)=>{X.parent=this})}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.elements.forEach((X)=>{X.assignIds("Expr",J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openQuoteToken),this.elements.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeQuoteToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}getEmbeddedExpressions(){return this.elements.filter((Z)=>Z.kind==="EmbeddedExpression")}isNormalString(){return this.elements.length!==0&&this.getEmbeddedExpressions().length===0}stringText(){return this.elements.map((Z)=>Z.text()).join("")}}class K3 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="IfExpression",this.ifKeyword=Z,this.condition=J,this.thenBranch=Q,this.elseKeyword=X,this.elseBranch=x,this.ifKeyword.parent=this,this.condition&&(this.condition.parent=this),this.thenBranch&&(this.thenBranch.parent=this),this.elseKeyword&&(this.elseKeyword.parent=this),this.elseBranch&&(this.elseBranch.parent=this)}assignIds(Z,J,Q){var X,x,q,Y;this.id=z2(this,Z,J,Q),this.ifKeyword.assignIds("Syntax",J,Q),(X=this.condition)==null||X.assignIds("Expr",J,Q),(x=this.thenBranch)==null||x.assignIds("Block",J,Q),(q=this.elseKeyword)==null||q.assignIds("Syntax",J,Q),this.elseBranch instanceof S0?this.elseBranch.assignIds("Block",J,Q):(Y=this.elseBranch)==null||Y.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.ifKeyword.getTokenStream()),this.condition&&g(Z,this.condition.getTokenStream()),this.thenBranch&&g(Z,this.thenBranch.getTokenStream()),this.elseKeyword&&g(Z,this.elseKeyword.getTokenStream()),this.elseBranch&&g(Z,this.elseBranch.getTokenStream()),this.endingSeparator&&g(Z,this.endingSeparator),Z}}class c1 extends d1{constructor(Z){super(),this.kind="PrimaryExpression",this.value=Z}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q)}computeTokenStream(){let Z=[];return Z.push(this.value),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class y5 extends d1{constructor(Z,J,Q,X){super(),this.kind="TypeParameter",this.openToken=Z,this.expressions=J,this.expressions.forEach((x)=>{x.parent=this}),this.closeToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expressions.forEach((X)=>X.assignIds("Expr",J,Q))}computeTokenStream(){let Z=this.expressions.reduce((J,Q,X)=>X<this.commaSeparatorList.length?J.concat(Q.getTokenStream()).concat(this.commaSeparatorList[X]):J.concat(Q.getTokenStream()),[]);return[this.openToken].concat(Z).concat([this.closeToken])}}class Z0 extends d1{constructor(Z,J){super(),this.kind="Identifier",this.value=Z,this.typeParameter=J,this.typeParameter&&(this.typeParameter.parent=this)}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),(X=this.typeParameter)==null||X.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return Z.push(this.value),this.typeParameter&&g(Z,this.typeParameter.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class I1 extends d1{constructor(Z,J){super(),this.kind="CallExpression",this.callee=Z,this.args=J,this.callee.parent=this,this.args.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.callee.assignIds("Syntax",J,Q),this.args.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.callee.getTokenStream()),g(Z,this.args.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class k2 extends d1{constructor(Z,J,Q,X){super(),this.kind="ArgumentList",this.args=Z,this.args.forEach((x)=>{x.parent=this}),this.openParenToken=J,this.closeParenToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.args.forEach((X)=>X.assignIds("Syntax",J,Q))}computeTokenStream(){let Z=[];return Z.push(this.openParenToken),this.args.forEach((J,Q)=>Q<this.commaSeparatorList.length?g(Z,J.getTokenStream(),this.commaSeparatorList[Q]):g(Z,J.getTokenStream())),Z.push(this.closeParenToken),Z}}class O4 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="ArgumentExpression",this.value=Z,this.value&&(this.value.parent=this),this.name=J,this.name&&(this.name.parent=this),this.separatorColonToken=Q,this.typeReferenceExpression=X,this.typeReferenceExpression&&(this.typeReferenceExpression.parent=this),this.equalSign=x}asParameter(){let{nameNode:Z,nameValue:J}=this.extractNameInfo(),Q={name:{node:Z,name:J}};if(this.typeReferenceExpression&&(Q.type={node:this.typeReferenceExpression}),this.equalSign){if(!this.value)throw new Error("Value expected");Q.defaultValue={node:this.value}}return Q}asArgument(){let Z={};return this.name&&this.name instanceof Z0&&(Z.name={node:this.name,name:this.name.value.value}),this.value&&(Z.value={node:this.value}),Z}asAmlTypeOption(){let{nameNode:Z,nameValue:J}=this.extractNameInfo(),Q={name:{node:Z,name:J}};return this.typeReferenceExpression&&(Q.value={node:this.typeReferenceExpression}),Q}extractNameInfo(){if(this.name)return{nameNode:this.name,nameValue:this.name.value.value};if(!this.value)throw new Error("Value expected");return{nameNode:this.value,nameValue:this.value instanceof Z0?this.value.value.value:void 0}}assignIds(Z,J,Q){var X,x,q;this.id=z2(this,Z,J,Q),(X=this.name)==null||X.assignIds("Syntax",J,Q),(x=this.value)==null||x.assignIds("Syntax",J,Q),(q=this.typeReferenceExpression)==null||q.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];if(this.name){if(g(Z,this.name.getTokenStream()),this.separatorColonToken&&this.typeReferenceExpression&&g(Z,this.separatorColonToken,this.typeReferenceExpression.getTokenStream()),this.equalSign){if(!this.value)throw new Error("Value expected");g(Z,this.equalSign,this.value.getTokenStream())}}else{if(!this.value)throw new Error("Value expected");g(Z,this.value.getTokenStream())}return Z}}class B4 extends d1{constructor(Z,J){super(),this.kind="PrefixExpression",this.op=Z,this.expression=J,this.expression.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.op,this.expression.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class k0 extends d1{constructor(Z,J,Q){super(),this.kind="InfixExpression",this.leftExpression=Z,this.leftExpression.parent=this,this.op=J,this.rightExpression=Q,this.rightExpression.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.leftExpression.assignIds("Expr",J,Q),this.rightExpression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.leftExpression.getTokenStream(),this.op,this.rightExpression.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class v3 extends d1{constructor(Z,J){super(),this.kind="PostfixExpression",this.expression=Z,this.expression.parent=this,this.op=J}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expression.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.expression.getTokenStream(),this.op),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class C0 extends d1{constructor(Z,J,Q,X,x,q){super(),this.kind="LiteralElementExpression",this.elementType=Z,this.elementType.parent=this,this.params=Q,this.params&&(this.params.parent=this),this.returnType=X,this.returnType&&(this.returnType.parent=this),this.body=J,this.body.parent=this,this.colonSeparator=x,this.decorators=q,this.decorators&&this.decorators.forEach((Y)=>{Y.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X,x,q;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),(X=this.params)==null||X.assignIds("Syntax",J,Q),(x=this.returnType)==null||x.assignIds("Syntax",J,Q),d6(this.body)?this.body.assignIds("Expr",J,Q):this.body.assignIds("Body",J,Q),(q=this.decorators)==null||q.forEach((Y)=>{Y.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream()),this.params&&g(Z,this.params.getTokenStream()),this.returnType&&g(Z,this.returnType.getTokenStream()),this.body instanceof S0?g(Z,this.body.getTokenStream()):g(Z,this.colonSeparator,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}children(){return this.body instanceof S0?this.body.body:void 0}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class S1 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="EqualityDeclaration",this.elementType=Z,this.elementType.parent=this,this.elementName=J,this.elementName.parent=this,this.equalSign=Q,this.body=X,this.body&&(this.body.parent=this),this.decorators=x,this.decorators&&this.decorators.forEach((q)=>{q.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),this.elementName.assignIds("Syntax",J,Q),this.body.assignIds("Expr",J,Q),(X=this.decorators)==null||X.forEach((x)=>{x.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream(),this.elementName.getTokenStream(),this.equalSign,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class x6 extends d1{constructor(Z,J){super(),this.kind="ReturnTypeNode",this.arrowToken=Z,this.typeExpr=J,this.typeExpr.parent=this}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.typeExpr.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.arrowToken,this.typeExpr.getTokenStream()),Z}}class _0 extends d1{constructor(Z,J,Q,X,x,q,Y){super(),this.kind="ElementDeclaration",this.elementType=Z,this.elementType.parent=this,this.elementName=J,this.elementName.parent=this,this.decorators=Y,this.params=Q,this.params&&(this.params.parent=this),this.returnType=X,this.returnType&&(this.returnType.parent=this),this.body=x,this.colonSeparator=q,this.body&&(this.body.parent=this),this.decorators&&this.decorators.forEach(($)=>{$.parent=this})}setDecorators(Z){this.decorators=Z,this.decorators.forEach((J)=>{J.parent=this})}assignIds(Z,J,Q){var X,x,q,Y;this.id=z2(this,Z,J,Q),this.elementType.assignIds("Syntax",J,Q),this.elementName.assignIds("Syntax",J,Q),(X=this.params)==null||X.assignIds("Syntax",J,Q),(x=this.returnType)==null||x.assignIds("Syntax",J,Q),this.body instanceof S0?this.body.assignIds("Body",J,Q):(q=this.body)==null||q.assignIds("Expr",J,Q),(Y=this.decorators)==null||Y.forEach(($)=>{$.assignIds("Syntax",J,Q)})}computeTokenStream(){let Z=[];return this.decorators&&this.decorators.forEach((J)=>{g(Z,J.getTokenStream())}),g(Z,this.elementType.getTokenStream(),this.elementName.getTokenStream()),this.params&&g(Z,this.params.getTokenStream()),this.returnType&&g(Z,this.returnType.getTokenStream()),this.body instanceof S0?g(Z,this.body.getTokenStream()):this.body&&g(Z,this.colonSeparator,this.body.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}children(){return this.body instanceof S0?this.body.body:void 0}document(){let Z=this.prevSibling();return Z&&r7(Z)?Z:void 0}}class S0 extends d1{constructor(Z,J,Q){super(),this.kind="Block",this.body=Z,this.body.forEach((X)=>{X.parent=this}),this.openBraceToken=J,this.closeBraceToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.body.forEach((X)=>{let x;X instanceof A3?x="Import":X instanceof S0?x="Block":_Z(X)||X instanceof C0?x="Decl":x="Expr",X.assignIds(x,J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openBraceToken),this.body.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeBraceToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class K2 extends d1{constructor(Z,J,Q){super(),this.kind="BlockExpression",this.body=Z,this.body.forEach((X)=>{X.parent=this}),this.openBraceToken=J,this.closeBraceToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.body.forEach((X)=>{_Z(X)||X instanceof C0?X.assignIds("Decl",J,Q):X.assignIds("Expr",J,Q)})}computeTokenStream(){let Z=[];return Z.push(this.openBraceToken),this.body.forEach((J)=>g(Z,J.getTokenStream())),Z.push(this.closeBraceToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class M4 extends d1{constructor(Z,J,Q,X){super(),this.kind="ListExpression",this.exprList=Z,this.exprList.forEach((x)=>{x.parent=this}),this.openBracketToken=J,this.closeBracketToken=Q,this.commaSeparatorList=X}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.exprList.forEach((X)=>X.assignIds("Expr",J,Q))}computeTokenStream(){let Z=[];return Z.push(this.openBracketToken),this.exprList.forEach((J,Q)=>Q<this.commaSeparatorList.length?g(Z,J.getTokenStream(),this.commaSeparatorList[Q]):g(Z,J.getTokenStream())),Z.push(this.closeBracketToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class z3 extends d1{constructor(Z,J,Q){super(),this.kind="GroupExpression",this.expr=Z,this.expr.parent=this,this.openParenToken=J,this.closeParenToken=Q}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.expr.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.openParenToken,this.expr.getTokenStream(),this.closeParenToken),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class y2 extends d1{constructor(Z,J,Q){super(),this.kind="Heredoc",this.atSignToken=Z,this.name=J,this.content=Q,this.content.parent=this}isRaw(){return this.atSignToken.kind==="RAW_AT_SIGN"}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.content.assignIds("Expr",J,Q)}computeTokenStream(){let Z=[];return g(Z,this.atSignToken,this.name,this.content.getTokenStream()),this.endingSeparator&&Z.push(this.endingSeparator),Z}}class q6 extends d1{constructor(Z,J,Q){super(),this.kind="Decorator",this.atSignToken=Z,this.name=J,this.args=Q,this.name.parent=this,this.args&&(this.args.parent=this)}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.name.assignIds("Syntax",J,Q),this.args&&this.args.assignIds("Syntax",J,Q)}computeTokenStream(){var Z;let J=[];return g(J,this.atSignToken,this.name.getTokenStream(),(Z=this.args)==null?void 0:Z.getTokenStream()),this.endingSeparator&&J.push(this.endingSeparator),J}}class A3 extends d1{constructor(Z,J,Q,X,x){super(),this.kind="ImportDeclaration",this.importToken=Z,this.path=J,this.body=Q,this.body&&(this.body.parent=this),this.asToken=X,this.moduleName=x,this.moduleName&&(this.moduleName.parent=this),this.body&&(this.body.parent=this)}assignIds(Z,J,Q){var X,x;this.id=z2(this,Z,J,Q),(X=this.body)==null||X.assignIds("Body",J,Q),(x=this.moduleName)==null||x.assignIds("Syntax",J,Q)}computeTokenStream(){let Z=[];return Z=Z.concat([this.importToken,this.path]),this.body&&(Z=Z.concat(this.body.getTokenStream())),this.asToken&&(Z=Z.concat([this.asToken])),this.moduleName&&(Z=Z.concat(this.moduleName.getTokenStream())),Z.concat(this.endingSeparator?[this.endingSeparator]:[])}children(){return this.body?this.body.modules:void 0}}class s6 extends d1{constructor(Z,J,Q){super(),this.kind="ImportBody",this.openBraceToken=Z,this.closeBraceToken=J,this.modules=Q,this.modules.forEach((X)=>{X.parent=this})}assignIds(Z,J,Q){this.id=z2(this,Z,J,Q),this.modules.forEach((X)=>X.assignIds("Decl",J,Q))}computeTokenStream(){return[this.openBraceToken].concat(this.modules.reduce((Z,J)=>Z.concat(J.getTokenStream()),[])).concat([this.closeBraceToken])}}class u5 extends d1{constructor(Z,J,Q){super(),this.kind="ImportModule",this.moduleName=Z,this.moduleName.parent=this,this.asToken=J,this.moduleNameAs=Q,this.moduleNameAs&&(this.moduleNameAs.parent=this)}assignIds(Z,J,Q){var X;this.id=z2(this,Z,J,Q),this.moduleName.assignIds("Decl",J,Q),(X=this.moduleNameAs)==null||X.assignIds("Decl",J,Q)}computeTokenStream(){return this.asToken&&this.moduleNameAs?this.moduleName.getTokenStream().concat([this.asToken]).concat(this.moduleNameAs.getTokenStream()).concat(this.endingSeparator?[this.endingSeparator]:[]):this.moduleName.getTokenStream().concat(this.endingSeparator?[this.endingSeparator]:[])}}class U1{constructor(Z,J){this.env=Z,this.returnVal=J}toJsStructure(){return{env:this.env.toJsStructure(),returnVal:this.returnVal.toJsStructure()}}}var v=((Z)=>(Z.WrongKind="WrongKind",Z.Error="Error",Z))(v||{}),Y3=((Z)=>(Z.REPLACE_BUILTIN="REPLACE_BUILTIN",Z.EXTEND_BUILTIN="EXTEND_BUILTIN",Z))(Y3||{});class rH{constructor(Z){this._parseResult=Z}originalAst(){return this._parseResult.unwrap().originalAst}transformedAst(){return this._parseResult.unwrap().transformedAst}parseDiagnostics(){return this._parseResult.diagnostics}diagnostics(){return this.parseDiagnostics()}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class X8{constructor(Z){this.diags=Z}diagnostics(){return this.diags}isOk(){return!b2(this.diagnostics())}isErr(){return!this.isOk()}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class b7 extends X8{constructor(Z,J){super(Z.diags),this._evalResult=J}isOk(){var Z;return!!((Z=this._evalResult)!=null&&Z.isOk())}isErr(){return!this.isOk()}evalResult(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap():void 0}returnVal(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().returnVal:void 0}env(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().env:void 0}evalDiagnostics(){var Z;return(Z=this._evalResult)!=null&&Z.isErr()?this._evalResult.err():[]}diagnostics(){return super.diagnostics().concat(this.evalDiagnostics())}}class tH{constructor(Z){this.parseMap=Z}diagnostics(){return[...this.parseMap.values()].reduce((Z,J)=>(g(Z,J.diagnostics()),Z),[])}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class hY{constructor(Z){this.typecheckMap=Z}diagnostics(){return this.typecheckDiagnostics()}typecheckDiagnostics(){return[...this.typecheckMap.values()].reduce((Z,J)=>(g(Z,J.diagnostics()),Z),[])}resolvedDiagnostics(Z){return s7(this.diagnostics()).map((J)=>J instanceof l?J.resolve(Z):J)}}class JA extends hY{constructor(Z,J){super(Z.typecheckMap),this._evalResult=J}diagnostics(){var Z;return(Z=this._evalResult)!=null&&Z.isErr()?super.diagnostics().concat(this._evalResult.err()):super.diagnostics()}isOk(){var Z;return!!((Z=this._evalResult)!=null&&Z.isOk())}isErr(){return!this.isOk()}evalResult(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap():void 0}returnVal(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().returnVal:void 0}env(){var Z;return(Z=this._evalResult)!=null&&Z.isOk()?this._evalResult.unwrap().env:void 0}}class PZ{constructor(Z,J){this.name=Z,this.parent=J,this.key=this.toString()}isRoot(){return this.name===n8.globalModuleName&&!this.parent}toString(){return this.parent?this.parent.isRoot()?this.name:`${this.parent.key}::${this.name}`:this.name}createIdForObjectInScope(Z){return this.isRoot()?Z:`${this.key}::${Z}`}asInternKey(Z,J){return this.id&&this.idVerifiedAt===Z.revision?this.id:(this.id=J.internModuleId(this),this.idVerifiedAt=Z.revision,this.id)}}class p7{constructor(Z,J,Q=[],X=[]){this.id=Z,this.name=J,this.amlFiles=Q,this.modules=X}}function t$0(Z,J){return J.kind!==p.Module?new r(v.WrongKind):new d(wH(Z))}function e$0(Z,J){if(J.kind!==p.Module)return new r(v.WrongKind);if(!(J instanceof q4))throw new Error("Expected module symbol");return Z.membersOfModule(J.moduleId)}function ZK0(Z,J){let Q=Z.moduleById(J),X=new k5,x=[];return Q.amlFiles.forEach((q)=>{let Y=Z.scopeOfFile(q);g(x,Y.diagnostics),Y.isOk()&&X.merge(Y.unwrap(),[o7.Public])}),Q.modules.forEach((q)=>{let Y=Z.symbolOfModule(q.id);if(Y.isErr())return;let $=Y.unwrap();X.set($.name,$)}),new d(X,x)}function JK0(Z,J,Q){if(J instanceof H0){let X=Z.nodeById(J.declarationId),x=X instanceof _0||X instanceof S1?X.elementName:X;return l.createForNode(x.id,k.DuplicatedNameInModuleScope,J.name,`there is another ${QK0(Z,Q)}`)}throw new Error("Expected s1 to be NodeSymbol")}function QK0(Z,J){return J.map((Q)=>{if(Q.kind===p.Module)return`module name '${Q.name}'`;let X=Z.filepathFromSymbol(Q.id);return X?`'${Q.name}' in file '${X}'`:`'${Q.name} in global scope'`}).join(", ")}function XK0(Z,J){if(!$4(J))throw new Error("Expected property access expression");let Q=Z.symbol(J.leftExpression.id);if(Q.isErr())return;if(Q.unwrap()instanceof q4&&J.rightExpression instanceof Z0){let X=Z.symbol(J.id);if(X.isErr())return;let x=X.unwrap();return!(x instanceof H0)||!x.declarationId?void 0:w0.create(x.declarationId.filepath)}}function gY(Z,J,Q){let X=[],x=Z.membersOfModule(J),q=x.unwrap();return g(X,x.diagnostics),q.has(Z,Q)?new d(q.get(Z,Q).symbol,X):J.parent?gY(Z,J.parent,Q).chain((Y)=>new d(Y,X)):new r(v.Error)}var xK0={name:"ModuleSystem",hooks:{typeOfSymbol:t$0,members:e$0}};function qK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.symbol.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.symbol)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.symbol.extending)x=q(Z,X,x);return x}function i4(Z,J,Q,X){let x=Q.scope(Z.id),q=[];if(g(q,x.diagnostics),x.isOk()){let Y=x.unwrap();if(Y.has(Q,J))return new d(Y.get(Q,J).symbol,q);if(!(Z instanceof v1)){if(!Z.parent)throw new Error("Node parent is undefined");let U=i4(Z.parent,J,Q,X);return g(q,U.diagnostics),U.isOk()?new d(U.unwrap(),q):new r(U.err(),q)}if(Q.globalScope().has(Q,J))return new d(Q.globalScope().get(Q,J).symbol,q);let $=w0.create(X.id.filepath);if(!$)return q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q);let z=Q.moduleIdOfFile($);if(!z)return q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q);let W=HZ(Q,()=>gY(Q,z,J));return g(q,W.diagnostics),W.isOk()?new d(W.unwrap(),q):(q.push(l.createForNode(X.id,k.NonExistentName,J)),new r(v.Error,q))}if(!Z.parent)throw new Error("Node parent is undefined");return i4(Z.parent,J,Q,X).chain((Y)=>new d(Y,q))}function QY(Z,J){if(Z.globalScope().has(Z,J))return Z.globalScope().get(Z,J).symbol;let Q=HZ(Z,()=>{let X=Z.moduleIdMap().get(n8.globalModuleName);return gY(Z,X.id,J)});if(Q.isOk())return Q.unwrap()}function HZ(Z,J){let{masterDb:Q}=Z.program,{trackDeps:X}=Q;Q.trackDeps=!1;let x=J();if(Q.trackDeps=X,x.isOk()){let q=x.unwrap();if(q instanceof H0&&q.declarationId){let Y=w0.create(q.declarationId.filepath);Z.scopeOfFile(Y)}else q instanceof q4?Z.checkModuleExists(q.moduleId):J();return new d(x.unwrap())}return J(),x}function YK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.scope.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.scope)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.scope.extending)x=q(Z,X,x);return x}function $K0(Z,J){return Z.ast(J).chain(({transformedAst:Q})=>Z.scope(Q.id))}function KK0(Z,J){let{program:Q}=Z,X=Z.symbolById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.symbolReference.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.symbolReference)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.symbolReference.extending)x=q(Z,X,x);return x}function zK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.allSymbolsFromContext.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.allSymbolsFromContext)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.allSymbolsFromContext.extending)x=q(Z,X,x);return x}function WK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!(X instanceof Z0))return x;for(let q of Q.customModuleProviders.identifierSymbol.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.identifierSymbol)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.identifierSymbol.extending)x=q(Z,X,x);return x}function h5(Z,J){return Z.find(({nodeId:Q})=>Q.key===J.id.key)}function VK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J),x=new r(v.WrongKind);if(!X)return x;for(let q of Q.customModuleProviders.mergeableInnerScope.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.mergeableInnerScope)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.mergeableInnerScope.extending)x=q(Z,X,x);return x}var QA="modules";function UK0(Z){let[J,Q]=Z.nameAndExtension();return Q?!1:J===QA}function HK0(Z,J){let Q=[],X=Z.getParentDir();if(!X)return Q;if(UK0(X)){let x=l.createForNode(J,k.InvalidDirectFileInModule);Q.push(x)}return Q}function GK0(Z){let J=[],Q=!1;return[!Z.some((X)=>X.asArgument().name?(Q=!0,!1):Q?(J.push(l.createForNode(X.id,k.PositionalAfterNamedArg)),!0):!1),J]}function BK0(Z,J,Q){let X=[],x=Z.filter((q,Y)=>!J.has(Y));return x.forEach((q)=>{q.hasDefaultValue||X.push(l.createForNode(Q.id,k.MissingRequiredParameter,q.symbol.name))}),[x,X]}function MK0(Z){let J=new Map;return Z.forEach((Q,X)=>{J.set(Q.symbol.name,{param:Q,index:X})}),J}function DK0(Z,J,Q){let X=[],x=new Map,q=new Set;return Z.forEach((Y)=>{let $=Y.asArgument();if($.name){let z=$.name.name;if(!Q.has(z)){X.push(l.createForNode($.name.node.id,k.InvalidParameterName,z));return}let{param:W,index:U}=Q.get(z);if(q.has(U)){X.push(l.createForNode($.name.node.id,k.DuplicateArgument,z));return}q.add(U),x.set(z,{argId:Y.id,paramIndex:U})}else{let z;for(let U=0;U<J.length;U++)if(!q.has(U)){z=U;break}if(z===void 0){X.push(l.createForNode(Y.id,k.WrongArgumentNumber,J.length,Z.length));return}let W=J[z];q.add(z),x.set(W.symbol.name,{argId:Y.id,paramIndex:z})}}),[x,q,X]}function FK0(Z,J,Q){let X=N$0(J),x=Z.symbol(Q.id);if(x.isErr())return[...x.diagnostics];let q=Z.type(Q.id).unwrap(),Y=Q.leftExpression;if(G4(q)){let W=q.parentType,{ruleset:U}=W;if(U.isRuleOn(j0.RootNamespace)){let H=Z.type(Q.leftExpression.id).unwrap();if(Y4(H)){if(!$4(Q.leftExpression))throw new Error("Expected property access expression");Y=Q.leftExpression.leftExpression}}}let $=Z.type(Y.id).unwrap(),z=h6(X,$,Y,k.MismatchedArgumentType,Z,c0($,{db:Z}),c0(X,{db:Z}));return z?[z]:[]}var pU=((Z)=>(Z[Z.TYPE_MATCH=100]="TYPE_MATCH",Z[Z.STRUCTURAL_MATCH=40]="STRUCTURAL_MATCH",Z[Z.NO_MATCH=0]="NO_MATCH",Z))(pU||{});function NK0(Z,J,Q){let X=_K0(Z,J,Q);return{score:X.length===0?100:40,typeCompatibilityDiags:X}}function wK0(Z,J,Q){let X=[];if(J){let x=Q.nodeById(J.argId);if(!x)return X;let q=x.asArgument();if(q.value){let Y=Pv(Q,x);if(g(X,Y.diagnostics),Nv(Z.type))if(!$4(q.value.node))X.push(l.createForNode(x.id,k.ExpectedThings,"property access expression"));else{let $=FK0(Q,Z.type,q.value.node);g(X,$)}else{let $=h6(Z.type,Y.unwrap(),x,k.MismatchedArgumentType,Q,c0(Y.unwrap(),{db:Q}),c0(Z.type,{db:Q}));$&&X.push($)}}}return X}function _K0(Z,J,Q){let X=[];return Z.forEach((x)=>{let q=x.symbol.name,Y=J.get(q),$=wK0(x,Y,Q);g(X,$)}),X}function PK0(Z,J,Q,X){let[x,q]=GK0(Z);if(!x)return new T2(q);let Y=MK0(J),[$,z,W]=DK0(Z,J,Y);if(W.length>0)return new T2(W);let[U,H]=BK0(J,z,X);if(H.length>0)return new T2(H);let B=NK0(J,$,Q);return new X3({resolvedArgs:$,missingParams:U,typeCompatibilityScore:B.score,typeCompatibilityDiags:B.typeCompatibilityDiags})}function eH(Z,J,Q,X){switch(Z.kind){case t.Signature:return XA(Z,J,Q,X);case t.ProductType:return jK0(Z,J,Q,X);case t.UnionType:return LK0(Z,J,Q,X);default:return Y4(Z)?eH(Z.type,J,Q,X):void 0}}function XA(Z,J,Q,X){let x=PK0(J,Z.parameters,Q,X);return{signature:Z,resolutionResult:x}}function jK0(Z,J,Q,X){let x=Z.members.get("__call__");if(x&&x.type.kind===t.Signature)return XA(x.type,J,Q,X)}function LK0(Z,J,Q,X){let x,q=pU.NO_MATCH,Y;for(let $=0;$<Z.types.length;$++){let z=Z.types[$],W=eH(z,J,Q,X);if(W&&(Y||(Y=W),W.resolutionResult.isOk())){let U=W.resolutionResult.unwrap().typeCompatibilityScore;if(U===pU.TYPE_MATCH)return W;U>q&&(x=W,q=U)}}return x||Y}function CK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.type.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.type)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.type.extending)x=q(Z,X,x);return x}function OK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.typeOfSymbol.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.typeOfSymbol)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.typeOfSymbol.extending)Y=$(Z,q,Y);return Y.isOk()?Y:new d(n0(Z),Y.diagnostics)}function mK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.specificType.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.specificType)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.specificType.extending)Y=$(Z,q,Y);return Y.isOk()?Y:Z.typeOfSymbol(J)}function SK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.typeWithPropsOptionalCtx.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.typeWithPropsOptionalCtx)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.typeWithPropsOptionalCtx.extending)x=q(Z,X,x);return x.isErr()||!k1(x)?Z.type(J):x}function RK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.type))return new d(J.symbol.generatedProps.type);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.specificTypeWithPropsOptionalCtx.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.specificTypeWithPropsOptionalCtx)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.specificTypeWithPropsOptionalCtx.extending)Y=$(Z,q,Y);return Y.isErr()||!k1(Y)?Z.specificType(J):Y}function IK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return new d(n0(Z));let x=new r(v.WrongKind);for(let q of Q.customModuleProviders.typeFromTypeExpression.replacing)if(x=q(Z,X),k1(x))return x;for(let q of Q.moduleProviders.typeFromTypeExpression)if(x=q(Z,X),k1(x))break;for(let q of Q.customModuleProviders.typeFromTypeExpression.extending)x=q(Z,X,x);return x.isOk()?x:X&&d6(X)?new d(n0(Z),[l.createForNode(J,k.CannotResolveExpressionToType)]):x}function TK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.typeFromTypeSymbol))return new d(J.symbol.generatedProps.typeFromTypeSymbol);let{program:x}=Z,q=Z.symbolById(J);if(!q)return new d(n0(Z));let Y=new r(v.WrongKind);for(let $ of x.customModuleProviders.typeFromTypeSymbol.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.typeFromTypeSymbol)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.typeFromTypeSymbol.extending)Y=$(Z,q,Y);return Y.isOk(),Y}function vK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return[];let x=v.WrongKind;for(let q of Q.customModuleProviders.typecheck.replacing)if(x=q(Z,X),x!==v.WrongKind)return x;for(let q of Q.moduleProviders.typecheck)if(x=q(Z,X),x!==v.WrongKind)break;for(let q of Q.customModuleProviders.typecheck.extending)x=q(Z,X,x);return x===v.WrongKind?[]:x}function AK0(Z,J){let{program:Q}=Z,X=Z.nodeById(J);if(!X)return[];let x=v.WrongKind;for(let q of Q.customModuleProviders.typecheckWithPropsOptionalCtx.replacing)if(x=q(Z,X),x!==v.WrongKind)return x;for(let q of Q.moduleProviders.typecheckWithPropsOptionalCtx)if(x=q(Z,X),x!==v.WrongKind)break;for(let q of Q.customModuleProviders.typecheckWithPropsOptionalCtx.extending)x=q(Z,X,x);return x===v.WrongKind?Z.typecheck(J):x}function EK0(Z,J){let Q=Z.typecheckDuplicatedNamesInFile(J),X=Z.ast(J),x=X.unwrap().transformedAst,q=HK0(J,x.id);if(q.length)return new X8(q);let Y=Z.typecheck(x.id),$=X.diagnostics.concat(Y).concat(Q);return new X8($)}function fK0(Z,J){let Q=Z.moduleIdOfFile(J);if(!Q)return[];let X=Z.membersOfModule(Q).unwrap(),x=Z.scopeOfFile(J).unwrap(),q=[];return x.table.forEach((Y,$)=>{if(Y.accessModifier!==o7.Public)return;let z=(X.get(Z,$)?[X.get(Z,$),...X.duplicatedTable.get($)||[]]:[]).filter((W)=>W.symbol.id.key!==Y.symbol.id.key).map((W)=>W.symbol);z.length!==0&&q.push(JK0(Z,Y.symbol,z))}),q}function kK0(Z,J){let Q=Z.nodeById(J);if(!Q||!(Q instanceof I1))return new r(v.WrongKind);let X=Z.type(Q.callee.id);if(X.isErr())return new r(v.Error,X.diagnostics);let x=X.unwrap(),q=eH(x,Q.args.args,Z,Q);return q?new d(q,X.diagnostics):new r(v.Error,X.diagnostics)}function DY(Z,J){return J.kind===t.DynamicType||J.kind===t.DynamicBodyType?DY(Z,J.type):J.kind===t.UnionType?J.types.reduce((Q,X)=>{let x=DY(Z,X);return x?x3(Q,x,void 0,(q,Y,$,z)=>{let W=NZ(Y.symbol)?Y.symbol.symbols:[Y.symbol,$.symbol],U=YZ.createGeneratedCompoundSymbol(z,W);U.generatedProps.type=q8([Y.type,$.type]),q.set(z,{symbol:U,type:U.generatedProps.type})}):Q},new Map):J.members}function cK0(Z,J,Q,X=!1){var x;let q=DY(Z,J);if(q){if(X){for(let Y of q.values())if(_$0(Y.type)&&(x=Y.type.type.members)!=null&&x.has(Q))return Y.type.type.members.get(Q)}if(q.has(Q))return q.get(Q);if(q.has("*"))return q.get("*")}}function bK0(Z,J){var Q,X;if((J instanceof R8||J instanceof S8)&&((X=(Q=J.symbol)==null?void 0:Q.generatedProps)!=null&&X.members))return new d(J.symbol.generatedProps.members);let{program:x}=Z,q=Z.symbolById(J),Y=new r(v.WrongKind);if(!q)return Y;for(let $ of x.customModuleProviders.members.replacing)if(Y=$(Z,q),k1(Y))return Y;for(let $ of x.moduleProviders.members)if(Y=$(Z,q),k1(Y))break;for(let $ of x.customModuleProviders.members.extending)Y=$(Z,q,Y);return Y}function Y6(Z,J){let Q=DY(Z,J),X=new s2;return Q==null||Q.forEach((x,q)=>X.set(q,x.symbol)),Q?new d(X):new r(v.Error)}function xA(Z,J,Q){if(J.name){let x=Z.findIndex((q)=>q.name===J.name);return x!==-1?{param:Z[x],paramIdx:x}:void 0}if(Q<Z.length)return{param:Z[Q],paramIdx:Q};let X=f5(Z);if(X!=null&&X.isRestParam)return{param:X,paramIdx:Z.length-1};throw new Error("Param out of range")}function pK0(Z){let J=[],Q=!1;for(let X of Z)!X.name&&Q?J.push(l.createForNode(X.node.id,k.PositionalArgumentAfterKeywordArgument)):X.name&&(Q=!0);return J}function yK0(Z,J,Q,X){let x=[];if(x.push(...pK0(Q)),b2(x))return x;let q=new Set;return Q.forEach((Y,$)=>{let z=xA(J,Y,$);if(z===void 0){x.push(l.createForNode(Y.node.id,k.UnexpectedThings,`keyword argument${Y.name?` '${Y.name}'`:""}`));return}q.add(z.paramIdx);let W;if(z.param.isRestParam){let U=F$0(z.param.type);W=h6(U,Y.type,Y.node,k.MismatchedArgumentType,Z,c0(Y.type,{db:Z}),c0(U,{db:Z}))}else W=h6(z.param.type,Y.type,Y.node,k.MismatchedArgumentType,Z,c0(Y.type,{db:Z}),c0(z.param.type,{db:Z}));W&&x.push(W)}),J.forEach((Y,$)=>{!q.has($)&&Y.defaultValue===void 0&&x.push(l.createForNode(X.id,k.MissingThings,`'${Y.name}' argument`))}),x}function qA(Z,J){let Q=[],X=J.asArgument(),x=Pv(Z,J);if(g(Q,...x.diagnostics),X.name)return X.value?new d({name:X.name.name,type:x.unwrap(),node:X.name.node}):(Q.push(l.createForNode(X.name.node.id,k.ExpectedThings,"argument's value")),new d({type:x.unwrap(),node:X.name.node},Q));if(!X.value)throw new Error("Incomplete argument");return new d({type:x.unwrap(),node:X.value.node},x.diagnostics)}function jZ(Z,J,Q,X,x){var q;let Y=X;return(q=Y.members.get("__decorators__"))==null||q.members.delete("tag"),J.forEach(($)=>{let z=Z.decorators.find((U)=>U.name===$.name.value.value);if(z===void 0)throw new Error("Expected decorator");let W=[];$.args.args.forEach((U,H)=>{let B=qA(Z.db,U).unwrap(),M=U.asArgument(),D=xA(z.signature.params,B,H);if(D===void 0)throw new Error("Unreachable");D.param.isRestParam?W.push(Z.interpretNode(M.value.node,x).returnVal):W[D.paramIdx]=Z.interpretNode(M.value.node,x).returnVal});for(let U=0;U<z.signature.params.length;U+=1)if(W[U]===void 0){if(z.signature.params[U].defaultValue===void 0)throw new Error("Expected default value");W[U]=z.signature.params[U].defaultValue}Y=z.provider(Z,Q,Y,x,...W)}),Y}var GU;function uK0(){if(!GU){let Z=G0(o2,"delegate");G0(Z,"addMethod","to_js_structure",new E0((J)=>{var Q;let X=J.getCachedJsObject();if(X)return X;let x={};for(let[q,Y]of J.members.entries())Y instanceof o1&&((Q=Y.rules)!=null&&Q.root_namespace)||(x[q]=Y.toJsStructure());return J.type&&!G4(J.type)&&(x.__type__=c0(J.type)),J.setCachedJsObject(x),x})),GU=Z}return GU}function ZG(Z){return new E0((J)=>{let Q=YA(Z,J.data,J.env),X=Q.slice(0,-1).join("."),x=f5(Q);if(!x)throw new Error("Cannot resolve the access expression to a field reference");let q=new Map([["model",h0.create(X)],["field",h0.create(x)],["__type__",h0.create("FieldRef")]]);return new g0(q)})}function hK0(Z){var J;return Z instanceof o1?(J=Z.metadata.get("__fqn__"))==null?void 0:J.data:void 0}function YA(Z,J,Q){let X=Z.interpretNode(J,Q).returnVal,x=hK0(X);if(x)return[x.replaceAll("::",".")];if(!(J instanceof k0))throw new Error("Cannot resolve the access expression to a field reference");if((J.leftExpression instanceof Z0||J.leftExpression instanceof k0)&&J.rightExpression instanceof Z0){let q=YA(Z,J.leftExpression,Q),Y=Z.type(J.id).unwrap();if(G4(Y)){let{ruleset:$}=Y.parentType;if($.isRuleOn(j0.RootNamespace)&&f5(q)===$.name)return[...q.slice(0,-1),J.rightExpression.value.value]}return[...q,J.rightExpression.value.value]}throw new Error("Cannot resolve the access expression to a field reference")}function gK0(Z,J,Q,X,x,q,Y){if(Z!==Y1.Static||!J.body)return;if(Y&&J.body instanceof S0){let W=iY(Y.obj,Y.path);if(W&&!(W instanceof M2)){if(!W.type||W.type.kind!==t.ProductType)throw new H4(l.createForNode(J.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return{value:y7(J.body,X,x,W.type,{baseContext:Y},q),metadata:new Map,hiddenMetadata:{shouldMerge:!0}}}}if(J.body instanceof S0){let W=Q.type;if(W.kind!==t.ProductType)throw W.kind===t.UnionType?new H4(l.createForNode(J.body.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure")):new Error("Expected product type");return{value:y7(J.body,X,x,W,{baseContext:Y},q),metadata:new Map,hiddenMetadata:{shouldMerge:!0}}}let{value:$,isSameType:z}=xG(J.body,X,x,Y);return z&&n7(J.body)?{value:$,metadata:new Map,hiddenMetadata:{shouldMerge:!0}}:{value:$,metadata:new Map,hiddenMetadata:{shouldMerge:!1}}}function iK0(){return{metadata:new Map,rules:{}}}function dK0(Z,J,Q){if(!Z.isRuleOn(j0.TypeAs))return;let X=Z.getRule(j0.TypeAs),x=Q.elementType.value.value;J.set(X.value,h0.create(x))}function lK0(Z,J,Q,X){if(!Z.isRuleOn(j0.NameAs))return;let x=Z.getRule(j0.NameAs),q=X.elementName.value.value;J.set(x.value,h0.create(q)),Q.name_as=q}function oK0(Z,J,Q){let X=new Map,x=Z.asAmlTypeOption();if(X.set("name",h0.create(x.name.name)),x.value){let q=Q.interpretNode(x.value.node,J).returnVal;X.set("value",q)}else X.set("value",R1.True);return new g0(X)}function sK0(Z,J,Q,X,x){if(!Z.isRuleOn(j0.Attr)||!Q.params)return;let q=Q.params.args.map(($)=>oK0($,X,x)),Y=new C4(q);J.set("attributes",Y)}function nK0(Z,J,Q){if(!Z.isRuleOn(j0.BodyAs))return;if(!J.body){if(Z.isRuleOn(j0.AllowNoBody))return;throw new Error("Expected body")}let X=Z.getRule(j0.BodyAs);if(!X)throw new Error("BodyAs rule not found");Q.body_as=X.value}function iY(Z,J){return J.reduce((Q,X)=>{var x;return(x=Q==null?void 0:Q.members)==null?void 0:x.get(X)},Z)}function aK0(Z,J,Q,X,x,q){if(!(Z.body instanceof S0))return;let Y=J.type;if(q){let $=J.parentType,{ruleset:z}=$,{structure:W}=z;if(W!==Y1.List){let U=iY(q.obj,q.path);if(U!=null&&U.type)Y=U.type;else if(U&&!(U instanceof M2))throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"))}}if(Y.kind!==t.ProductType)throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return y7(Z.body,Q,X,Y,{baseContext:q},x)}function rK0(Z,J,Q,X,x){return{value:Z??new g0(void 0,void 0,X),metadata:J,rules:Q,hiddenMetadata:x}}function tK0(Z){var J;return!((J=Z.data.parent)!=null&&J.data.parent)}function JG(Z,J,Q,X,x){var q;let Y=new o1(I2(J),new Map);if(((q=J.type)==null?void 0:q.kind)===t.ProductType){let z=[...(U2(J.type)?c5(J.type):J.type).members].find(([,W])=>W.symbol.kind===p.DefaultElementName);z&&Y.metadata.set(z[0],h0.create(Q))}if(!tK0(X))return Y;let $=p5(x,Q,Z.program);return Y.metadata.set("__fqn__",h0.create($)),Y}function QG(Z,J,Q){var X,x;let q=Z.symbol(J.id)._chain(($)=>Z.specificType($.id)).unwrap();if(q.kind!==t.ProductType)throw new Error("Expected product type");let Y=U2(q)?c5(q):q;for(let $=0;$<Q.data.length;$++){let z=Q.data[$],W=(X=kQ(z))==null?void 0:X.name;if(typeof W!="string")throw new Error("Unexpected: Cannot extract object name");if(W===Y.name){let U=U2(q)&&((x=z.members.get("isPartial"))==null?void 0:x.data),H=!U2(q);if(U||H)return G0(z,"__lookUp__","constructor")}}}function kQ(Z){var J,Q,X,x;let q=(J=Z.members.get("name"))==null?void 0:J.data,Y=(Q=Z.members.get("__fqn__"))==null?void 0:Q.data;return!q&&Z instanceof o1&&(q=(X=Z.metadata.get("name"))==null?void 0:X.data),!Y&&Z instanceof o1&&(Y=(x=Z.metadata.get("__fqn__"))==null?void 0:x.data),{name:q,fqn:Y}}function BU(Z){var J;return Z instanceof o1?(J=Z.hiddenMetadata)==null?void 0:J.nodeId:void 0}function XG(Z,J,Q,X){let x=new g0;return x.data={node:J,env:Q,program:Z.program,isRawBlockObject:!0},x.type=X,x}function eK0(Z,J){if(l6(J))return new r(v.WrongKind);let Q=J;if(!(Q instanceof C0))return new r(v.WrongKind);if(Q.elementType instanceof Z0&&Q.elementType.value.value==="Func"){let q=H0.createSymbol("_function_",p.Function,Q.id);return new d(q)}if(Q.elementType instanceof k0)return new r(v.Error,[l.createForNode(Q.elementType.id,k.ExpectedThings,"identifier")]);let X=Q.parent instanceof K2?p.ElementProperty:p.Element,x=H0.createSymbol(Q.elementType.value.value,X,J.id);return new d(x)}function $A(Z,J,Q){if(l6(J))return new r(v.WrongKind);let X=J;if(!(X instanceof C0))return new r(v.WrongKind);let x=Z.symbol(X.id).chain((q)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx(q.id):Z.specificType(q.id));return x.isErr()?new d(n0(Z),x.diagnostics):x}function Zz0(Z,J){return $A(Z,J,{propsOptional:!0})}function KA(Z,J,Q){if(!(J instanceof C0))return v.WrongKind;let X=Z.symbol(J.id).chain(($)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx($.id):Z.specificType($.id)),x=X.diagnostics,q=(Q==null?void 0:Q.propsOptional)??!1;X.isOk()&&U2(X.unwrap())&&(q=!0);let Y=J.body instanceof S0?J.body.body.reduce(($,z)=>$.concat(q?Z.typecheckWithPropsOptionalCtx(z.id):Z.typecheck(z.id)),[]):J.body?q?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[];return x.concat(Y)}function Jz0(Z,J){return KA(Z,J,{propsOptional:!0})}function Qz0(Z,J,Q,X){if(!(Z instanceof C0))return v.WrongKind;let x=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(Z.elementType instanceof k0&&(x.data.bindObj=null),x instanceof C4){let Y=QG(Q,Z,x);Y&&(x=Y)}let q;return x instanceof E0&&x.partialType&&Z.body instanceof S0?q=XG(Q,Z.body,J,x.partialType):q=G0(x,"__call__",J,Z.body,X),Z.decorators&&(q=jZ(Q.program,Z.decorators,Z,q,J)),new U1(J,q)}var FY={name:"LiteralElementExpression",hooks:{symbol:eK0,type:$A,typeWithPropsOptionalCtx:Zz0,typecheck:KA,typecheckWithPropsOptionalCtx:Jz0,evaluate:Qz0}};function zA(Z,J,Q={},X={}){if(Z instanceof o1){let x=new Map;return Q.name_as||(Z.metadata.has("__fqn__")&&x.set("__fqn__",Z.metadata.get("__fqn__")),Z.metadata.has("name")&&x.set("name",Z.metadata.get("name")),Z.metadata.has("uname")&&x.set("uname",Z.metadata.get("uname"))),J==null||J.forEach((q,Y)=>{x.set(Y,q)}),new o1(Z.target,x,Q,X)}return new o1(Z,J??new Map,Q,X)}function xG(Z,J,Q,X){let x=Xz0(Z,Q,X);return{value:n7(Z)&&x?FY.hooks.evaluate(Z,J,Q.db,{baseContext:X}).returnVal:Q.interpretNode(Z,J).returnVal,isSameType:x}}function Xz0(Z,J,Q){if(!Q)return!1;let X=iY(Q.obj,Q.path);if(!(X!=null&&X.type))return!1;let x=J.type(Z.id).unwrap();return x4(X.type,x,J.db)}function WA(Z,J){let Q=c5(Z);return new E0((X,x,q)=>{let Y=y7(x,X,J,Q,q,!0);return Y.type=Z,Y},void 0,void 0,Z)}function VA(Z,J){return U2(Z)?WA(Z,J):new E0((Q,X,x)=>y7(X,Q,J,Z,x))}function xz0(Z,J,Q,X=!1){let x=new Map,q;return Z.members.forEach((Y,$)=>{if(Y4(Y.type)){if(x.set($,M2.Instance),!X&&Y.type.ruleset.isRuleEnabled(j0.Default)){let z=Y.type.ruleset.getRule(j0.Default),W=Q.nodeById(z.declarationId).asAmlTypeOption(),U=Q.interpretNode(W.value.node,J).returnVal;x.set($,U)}}else Y.symbol.kind===p.DefaultElementName&&(q=$)}),{members:x,defaultElementName:q}}function qz0(Z,J){return x3(Z,J,void 0,(Q,X,x,q)=>{Q.set(q,x)})}function Yz0(Z,J,Q,X,x,q){if(!(Z.body instanceof S0))throw new Error("Unreachable");let Y=J;if(q){let $=iY(q.obj,q.path);if($!=null&&$.type)Y=$.type;else if($&&!($ instanceof M2))throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"))}if(Y.kind!==t.ProductType)throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot infer exact type for this prop. Please specify the type explicitly and declare the full structure"));return y7(Z.body,Q,X,Y,{baseContext:q},x)}function y7(Z,J,Q,X,x,q=!1){let Y=x==null?void 0:x.baseContext,$=new Map,z=!1,W=xz0(X,J,Q,q);return $=qz0($,W.members),Z.body.forEach((U)=>{if(r7(U))return;let H=Q.symbol(U.id).unwrap(),B=Q.specificType(H.id).unwrap();if(G4(B)){if(!(U instanceof C0)&&!(U instanceof _0))throw new Error("Unreachable");if(!(U.elementType instanceof Z0))throw new Error("Expected identifier");let M=h0.create(I8(U)),{parentType:D}=B,{ruleset:N}=D,{structure:_}=N;if(_===Y1.List){let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat(N.name)}:void 0);G0(j,"push",O),$.set(N.name,j)}else if(_===Y1.DictType){let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([N.name,U.elementType.value.value])}:void 0);j.members.set(U.elementType.value.value,O),$.set(N.name,j)}else if(_===Y1.DictName){if(!(U instanceof _0)||!(U.elementName instanceof Z0))throw new Error("Unreachable");let j=MU($,N,_),O=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([N.name,U.elementName.value.value])}:void 0);j.members.set(U.elementName.value.value,O),$.set(N.name,j),N.isRuleOn(j0.RootNamespace)&&N.isRuleOn(j0.NameAs)&&N.isRuleOn(j0.UniqueName)&&!$.has(U.elementName.value.value)&&(z=!0,$.set(U.elementName.value.value,new o1(O.target,O.metadata,{...O.rules,root_namespace:!0},{...O.hiddenMetadata,nodeId:U.id,dynamicPropType:B})))}else{let j=XY(D,B,U,J,Q,q,M,Y?{obj:Y.obj,path:Y.path.concat([H.name])}:void 0);$.set(H.name,j)}}else{if(!(U instanceof C0)||!(U.elementType instanceof Z0))throw new Error("Unreachable");let M,D=!1;if(U.body instanceof S0)D=!0,M=Yz0(U,B,J,Q,q,Y?{obj:Y.obj,path:Y.path.concat(H.name)}:void 0);else{let{value:j,isSameType:O}=xG(U.body,J,Q,Y?{obj:Y.obj,path:Y.path.concat(H.name)}:void 0);M=j,O&&n7(U.body)&&(D=!0)}U.decorators&&(M=jZ(Q,U.decorators,U,M,J));let N=h0.create(I8(U)),_=zA(M,new Map([["__doc__",N]]),void 0,{nodeId:U.id,shouldMerge:D});$.set(U.elementType.value.value,_)}}),z?new g0($,uK0(),X):new g0($,void 0,X)}function $z0(Z,J){let{structure:Q}=J;if(![Y1.List,Y1.DictType,Y1.DictName].includes(Q))return;let X=lv(Z);if(X!==void 0)return new h4(X)}function Kz0(Z,J,Q){let X=$z0(Z,Q);X&&J.metadata.set("__childIdx__",X)}function XY(Z,J,Q,X,x,q,Y,$){let{value:z,metadata:W,rules:U,hiddenMetadata:H}=zz0(Z,J,Q,X,x,$,q),B=z;Q.decorators&&(B=jZ(x,Q.decorators,Q,B,X)),W.set("__doc__",Y);let M=zA(B,W,U,{nodeId:Q.id,dynamicPropType:J,...H});return x.options.childIdxForDynamicProp&&Kz0(Q,M,Z.ruleset),M}function MU(Z,J,Q,X){return Z.get(J.name)&&I2(Z.get(J.name))instanceof M2&&(Q===Y1.List?Z.set(J.name,new C4([],!0)):Q===Y1.DictType?Z.set(J.name,new v5):Q===Y1.DictName&&Z.set(J.name,new v5(void 0,void 0))),Z.get(J.name)}function zz0(Z,J,Q,X,x,q,Y=!1){let{ruleset:$}=Z,{structure:z}=$,W=gK0(z,Q,J,X,x,Y,q);if(W)return W;let{metadata:U,rules:H}=iK0();dK0($,U,Q),lK0($,U,H,Q),sK0($,U,Q,X,x),nK0($,Q,H);let B=!1,M;if(Q.body instanceof S0)B=!0,M=aK0(Q,J,X,x,Y,q);else if(Q.body){let{value:D,isSameType:N}=xG(Q.body,X,x,q);M=D,N&&n7(Q.body)&&(B=!0)}return rK0(M,U,H,J,{shouldMerge:B})}function E6(Z){return new E0((...J)=>{throw new Error("Built-in constructors shouldn't be called directly")})}function Wz0(Z){return new E0((J,Q)=>{let X=Q.body.map((x)=>Z.interpretNode(x,J).returnVal);return new C4(X)})}function Vz0(Z){return new E0((J,Q)=>{let X=new Map;return Q.body.forEach((x)=>{if(x instanceof C0&&!(x.body instanceof S0)&&x.elementType instanceof Z0){let q=Z.interpretNode(x.body,J).returnVal;X.set(x.elementType.value.value,q)}}),new g0(X,AQ)})}function Uz0(){return new E0(()=>{throw new Error("Invalid constructor for Partial Type.")})}var UA="extend",WI=!1;function HA(Z){var J;let Q=Z instanceof o1?Z:void 0,X=Q==null?void 0:Q.type;if(X&&!G4(X)){let x=X;if(!eQ(x)&&x.kind===t.ProductType){let q=[];x.members.forEach((z,W)=>{var U;((U=z==null?void 0:z.symbol)==null?void 0:U.kind)===p.TypeProperty&&(Y4(z.type)||q.push(W))});let Y=Z.members,$=[];if(q.forEach((z)=>{let W=Y.get(z);W&&!(W instanceof M2)||$.push(z)}),$.length){let z=$.join(", "),W=Z instanceof o1?(J=Z.hiddenMetadata)==null?void 0:J.nodeId:void 0;throw W?new H4(l.createForNode(W,k.MissingPropertiesForExtend,z)):new H4(e1.create(k.MissingPropertiesForExtend,z))}}}I2(Z)instanceof h0||Z.members.forEach((x)=>HA(x))}function Hz0(){if(!WI){G0(o2,"addMethod","__lookUp__",new E0((Z,J)=>Z.members.has(J)?Z.members.get(J):G0(Z.vTable,"lookUp",J))),G0(o2,"addMethod","to_json",new E0((Z)=>{let J=Z.toJsStructure();return h0.create(JSON.stringify(J))})),G0(o2,"addMethod","to_js_structure",new E0((Z)=>{let J=Z.getCachedJsObject();if(J)return J;let Q={};for(let[X,x]of Z.members.entries())Q[X]=x.toJsStructure();return Z.type&&!G4(Z.type)&&!(Z.type.kind===t.ProductType&&!Z.type.name)&&(Q.__type__=c0(Z.type)),Z.setCachedJsObject(Q),Q})),G0(o2,"addMethod",UA,new E0((Z,J)=>{let Q=J;if(J.data&&J.data.isRawBlockObject){let Y=c5(J.type);Q=y7(J.data.node,J.data.env,J.data.program,Y,{baseContext:{obj:Z,path:[]}},!0)}let X=I2(Z).clone();X.clearJsObjectCache();let x=TQ(X,Q);HA(x);let q=Z instanceof o1?Z.metadata.get("__fqn__"):void 0;return q&&I2(q)instanceof h0&&Yv(I2(q),x.members),x})),G0(o2,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(f6,"addMethod","==",new E0(v7["=="])),G0(f6,"addMethod","!=",new E0(v7["!="])),G0(f6,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(f6,"addMethod","||",new E0((Z,J)=>Z.data||J.data?R1.True:R1.False)),G0(f6,"addMethod","&&",new E0((Z,J)=>!Z.data||!J.data?R1.False:R1.True)),G0(f6,"addMethod","_P!",new E0((Z)=>Z.data?R1.False:R1.True)),G0(f6,"addMethod","to_string",new E0((Z)=>h0.create(`${Z.data}`))),G0(A7,"addMethod","+",new E0((Z,J)=>h0.create(Z.data+J.data))),G0(A7,"addMethod","length",new E0((Z)=>new h4(Z.data.length)));for(let Z in v7)G0(A7,"addMethod",Z,new E0(v7[Z]));G0(A7,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(A7,"addMethod","to_string",new E0((Z)=>Z)),G0(e3,"addMethod","_P+",new E0((Z)=>Z)),G0(e3,"addMethod","_P-",new E0((Z)=>new h4(-Z.data))),G0(e3,"addMethod","add",new E0((Z,J)=>new h4(Z.data+J.data))),G0(e3,"addMethod","+",new E0((Z,J)=>new h4(Z.data+J.data))),G0(e3,"addMethod","-",new E0((Z,J)=>new h4(Z.data-J.data))),G0(e3,"addMethod","*",new E0((Z,J)=>new h4(Z.data*J.data))),G0(e3,"addMethod","/",new E0((Z,J)=>new h4(Z.data/J.data)));for(let Z in v7)G0(e3,"addMethod",Z,new E0(v7[Z]));G0(e3,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(e3,"addMethod","to_string",new E0((Z)=>h0.create(`${Z.data}`))),G0(HY,"addMethod","to_js_structure",new E0((Z)=>Z.data)),G0(HY,"addMethod","to_string",new E0((Z)=>h0.create("undefined"))),G0(UY,"addMethod","to_js_structure",new E0((Z)=>"void")),G0(UY,"addMethod","to_string",new E0((Z)=>h0.create("undefined"))),G0(LQ,"addMethod","__call__",new E0((Z,...J)=>{let Q=new A5({parent:Z.data.env}),X=J.map((x,q)=>{var Y;if(I2(x)instanceof M2){let $=(Y=Z.data.params[q])==null?void 0:Y.asParameter();if($!=null&&$.defaultValue)return Z.data.program.interpretNode($.defaultValue.node,Z.data.env).returnVal}return x});return Q=Z.addArgs(Q,X,Z.data.program),Z.data.program.interpretNode(Z.data.body,Q).returnVal})),G0(LQ,"addMethod","to_js_structure",new E0((Z)=>"Callable")),G0(LQ,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(CQ,"addMethod","__call__",(Z,...J)=>Z.data.bindObj?Z.data.jsFunc.apply(null,[Z.data.bindObj].concat(J)):Z.data.jsFunc.apply(null,J)),G0(CQ,"addMethod","to_js_structure",new E0((Z)=>{if(Z.isDecorated){let J=G0(Z.vTable.parentObj,"lookUp","to_js_structure");return G0(J,"__call__",Z)}return"Callable"})),G0(CQ,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(GY,"addMethod","to_js_structure",new E0((Z)=>typeof Z.data.content=="string"?{__type__:c0(Z.type,{includeTypeArgumentsForHeredoc:!1}),...Z.data}:{__type__:c0(Z.type,{includeTypeArgumentsForHeredoc:!1}),name:Z.data.name,content:Z.data.content.toJsStructure()})),G0(GY,"addMethod","to_string",new E0((Z)=>G0(Z,"to_json"))),G0(AQ,"addMethod","__call__",(Z,J)=>G0(Z,"__lookUp__",J.data.toString())),G0(AQ,"addMethod","get",new E0((Z,J,Q=M2.Instance)=>{let X=J.data;return Z.members.has(X)?Z.members.get(X):Q})),G0(JZ,"addMethod","__call__",(Z,J)=>{let Q=Z.members.get("length");return J.data<0||J.data>=Q.data?M2.Instance:Z.data[J.data]}),G0(JZ,"addMethod","to_js_structure",new E0((Z)=>Z.data.map((J)=>J.toJsStructure()))),G0(JZ,"addMethod","push",new E0((Z,J)=>{if(!Z.members.has("length"))throw new Error("Expected length");Z.data.push(J);let Q=Z.members.get("length");Q.data+=1})),G0(JZ,"addMethod","get",new E0((Z,J,Q=M2.Instance)=>{let X=Z.members.get("length");return J.data<0||J.data>=X.data?Q:Z.data[J.data]})),WI=!0}}function VI(Z){return gv(Z)?0:JX(Z)?1:v8(Z)?2:cH(Z)?3:4}function Gz0(Z,J){if(!(J instanceof v1))return new r(v.WrongKind);if(J.filePath===void 0)throw new Error("Ast filepath is undefined");let Q=H0.createSymbol(J.filePath.toString(),p.Ast,J.id);return new d(Q)}function Bz0(Z,J){if(J.kind!==p.Ast)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=[],X=n0(Z),x=Z.nodeById(J.declarationId),q=Z.scope(x.id);g(Q,q.diagnostics);let Y=q.unwrap(),$=new Map;return Y.forEachEarlyBinding((z,W)=>{let U=Z.specificType(z.symbol.id);g(Q,U.diagnostics),$.set(W,{type:U.unwrap(),symbol:z.symbol})}),X={kind:t.ProductType,members:$,symbol:J},new d(X,Q)}function Mz0(Z,J){return J instanceof v1?qG(J,J.statements,Z):new r(v.WrongKind)}function qG(Z,J,Q,X=new s2){let x=[];return J.filter((q)=>_Z(q)&&!(q instanceof S0)).forEach((q)=>{let Y=Q.mergeableInnerScope(q.id);if(Y.isOk()){g(x,Y.diagnostics);let z=Y.unwrap();X=X.merge(z,void 0,(W,U,H,B)=>{x.push(l.createForNode(H.symbol.declarationId,k.DuplicatedName,H.symbol.name)),W.set(B,H)});return}let $=Q.symbol(q.id);if($.isOk()){g(x,$.diagnostics);let z=$.unwrap();X.hasEarlyBinding(z.name)?q instanceof _0||q instanceof S1?x.push(l.createForNode(uv(q).id,k.DuplicatedName,z.name)):x.push(l.createForNode(q.id,k.DuplicatedName,z.name)):X.set(z.name,z)}}),new d(X,x)}function Dz0(Z,J){if(!(J instanceof v1))return v.WrongKind;let Q=[],X=Z.scope(J.id);return g(Q,X.diagnostics),J.statements.forEach((x)=>{let q=Z.typecheck(x.id);g(Q,q)}),Q}function Fz0(Z,J,Q){if(!(Z instanceof v1))return v.WrongKind;let X=[...Z.statements],x=X.length>0?X[X.length-1]:null;X.sort((Y,$)=>VI(Y)-VI($));let q=a8.Instance;return X.forEach((Y)=>{let $=Q.program.interpretNode(Y,J);x&&Y.id.key===x.id.key&&(q=$.returnVal)}),new U1(J,q)}var Nz0={name:"Ast",hooks:{symbol:Gz0,typeOfSymbol:Bz0,scope:Mz0,typecheck:Dz0,evaluate:Fz0}};function wz0(Z,J){return J instanceof S0?qG(J,J.body,Z):new r(v.WrongKind)}function _z0(Z,J){if(!(J instanceof S0))return v.WrongKind;let Q=[],X=Z.scope(J.id);return g(Q,X.diagnostics),J.body.forEach((x)=>{let q=Z.typecheck(x.id);g(Q,q)}),Q}function Pz0(Z,J,Q){if(!(Z instanceof S0))return v.WrongKind;let X=J.createLocal(),x=a8.Instance;return Z.body.forEach((q)=>{x=Q.program.interpretNode(q,J).returnVal}),new U1(X,x)}var jz0={name:"Block",hooks:{scope:wz0,typecheck:_z0,evaluate:Pz0}};function NY(Z,J,Q){let X=[];return J.forEach((x)=>{let q=Z.decorators.find(($)=>$.name===x.name.value.value);if(q===void 0){g(X,l.createForNode(x.name.id,k.NonExistentDecorator,x.name.value.value));return}g(X,mz0(Z,q,x)),q.typecheck&&g(X,q.typecheck(Z,x));let Y=h6(q.targetType,Q,x.name,k.CannotApplyDecorator,Z.db,q.name,c0(Q));Y&&g(X,Y)}),X}function Lz0(Z,J,Q){return J.args.args.map((X)=>{let x=qA(Z.db,X);return g(Q,x.diagnostics),x.unwrap()})}function Cz0(Z,J,Q,X,x){let q=yK0(Z.db,J,Q,X.name);g(x,q)}function Oz0(Z,J,Q){J.args.args.forEach((X)=>{let x=X.asArgument();x.value&&g(Q,Z.typecheck(x.value.node.id))})}function mz0(Z,J,Q){let X=[],{params:x}=J.signature,q=Lz0(Z,Q,X);return Cz0(Z,x,q,Q,X),Oz0(Z,Q,X),X}function Sz0(Z,J){let Q=J.filter((x)=>x.isRestParam);if(Q.length>1)throw new Error("Decorator cannot have more than one rest parameter");if(Q.length===0)return;let[X]=Q;if(X.type.kind!==t.ProductType||X.type.name!=="List")throw new Error("Decorator rest parameter must be of type List")}function Rz0(Z,J){if(!QX(J))return new r(v.WrongKind);let Q=H0.createSymbol(J.elementName.value.value,p.BlockScopedVariable,J.id);return new d(Q)}function Iz0(Z,J){return QX(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function Tz0(Z,J){return J.parent&&QX(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function vz0(Z,J){if(J.kind!==p.BlockScopedVariable)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=Z.nodeById(J.declarationId);if(!(Q instanceof S1))throw new Error("Expected equality declaration");return Q.elementType.value.kind!==w.CONST_KEYWORD?Z.typeFromTypeExpression(Q.elementType.id):Z.type(Q.body.id)}function Az0(Z,J){if(J.kind!==p.BlockScopedVariable)return new r(v.WrongKind);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let Q=Z.nodeById(J.declarationId);if(!(Q instanceof S1))throw new Error("Expected equality declaration");let X=Z.type(Q.body.id);return X.isOk()&&X.unwrap().kind===t.ProductType?X:Q.elementType.value.kind!==w.CONST_KEYWORD?Z.typeFromTypeExpression(Q.elementType.id):X}function Ez0(Z,J){if(!QX(J))return v.WrongKind;if(J.elementType.value.kind!==w.CONST_KEYWORD){let x=Z.typeFromTypeExpression(J.elementType.id),q=J.decorators&&x.isOk()?NY(Z.program,J.decorators,x.unwrap()):[];return x.chain((Y)=>Z.type(J.body.id).chain(($)=>new d({t:Y,bodyType:$}))).chain(({t:Y,bodyType:$})=>new d(Y,BY(i1(Y,$,Z).diags,J.elementName))).diagnostics.concat(Z.typecheck(J.body.id),q)}let Q=Z.type(J.body.id),X=J.decorators&&Q.isOk()?NY(Z.program,J.decorators,Q.unwrap()):[];return Z.typecheck(J.body.id).concat(X)}function fz0(Z,J){return J.kind!==p.BlockScopedVariable?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function kz0(Z,J,Q){var X;if(!(Z instanceof S1)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.BlockScopedVariable)return v.WrongKind;if(!Z.body)throw new Error("Expected node body");let x=Q.program.interpretNode(Z.body,J).returnVal;x.members.set("__doc__",h0.create(I8(Z)));let q=Q.symbol(Z.id).unwrap();return Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J)),x=JG(Q,x,Z.elementName.value.value,J,w0.create(Z.id.filepath)),J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x})),new U1(J,x)}var cz0={name:"BlockScopedVariable",hooks:{symbol:Rz0,allSymbolsFromContext:Iz0,identifierSymbol:Tz0,typeOfSymbol:vz0,specificType:Az0,members:fz0,typecheck:Ez0,evaluate:kz0}};function bz0(Z,J){return J.kind!==p.BuiltInType?new r(v.WrongKind):new d(J.type(Z))}function pz0(Z,J){return J.kind!==p.BuiltInType?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}var yz0={name:"BuiltInType",hooks:{typeOfSymbol:bz0,members:pz0}};function uz0(Z,J){if(!NZ(J))return new r(v.WrongKind);let Q=[],X=[];J.symbols.forEach((q)=>{let Y=Z.specificType(q.id);g(Q,Y.diagnostics),X.push(Y.unwrap())});let x=q8(X);return new d(x)}function hz0(Z,J){return NZ(J)?Z.specificType(J.id).chain((Q)=>Y6(Z,Q)):new r(v.WrongKind)}var gz0={name:"CompoundSymbol",hooks:{typeOfSymbol:uz0,members:hz0}};function iz0(Z,J){if(!a7(J))return new r(v.WrongKind);if(J.elementName instanceof k0)return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=H0.createSymbol(J.elementName.value.value,p.Element,J.id);return new d(Q)}function dz0(Z,J){if(J.kind!==p.Element)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0)&&!(Q instanceof C0))throw new Error("Expected symbol declaration");return Z.typeFromTypeExpression(Q.elementType.id)}function GA(Z,J,Q){if(J.kind!==p.Element)return new r(v.WrongKind);let X=Z.nodeById(J.declarationId);if(!(X instanceof _0)&&!(X instanceof C0))throw new Error("Expected symbol declaration");let x=[],q=Z.typeFromTypeExpression(X.elementType.id),Y=q.unwrap();if(g(x,q.diagnostics),X.body instanceof S0){let $=ZX(i1(Y,I5(X.body),Z,Q),X instanceof _0?X.elementName:X.elementType);if(g(x,$.diags),pY($)){if(Y.kind!==t.UnionType)throw new Error("Expected union type");n2($)&&$.matchedType&&(Y=$.matchedType)}U2(Y)&&(Y=l7(Y),Y.raw=I5(X.body))}else x.push(l.createForNode(X instanceof _0?X.elementName.id:X.elementType.id,k.ExpectedThings,"element's body"));return new d(Y,x)}function lz0(Z,J){return GA(Z,J,{propsOptional:!0})}function BA(Z,J,Q){if(!a7(J))return v.WrongKind;let X=Z.symbol(J.id).chain((W)=>Q!=null&&Q.propsOptional?Z.specificTypeWithPropsOptionalCtx(W.id):Z.specificType(W.id)),x=X.isOk()?X.unwrap():void 0,q=(Q==null?void 0:Q.propsOptional)??!1;x&&U2(x)&&(q=!0);let Y=J.decorators&&x?NY(Z.program,J.decorators,x):[],$=X.diagnostics,z=J.body instanceof S0?J.body.body.reduce((W,U)=>W.concat(q?Z.typecheckWithPropsOptionalCtx(U.id):Z.typecheck(U.id)),[]):J.body?q?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[];return x&&U2(x)&&(z=z.filter((W)=>W.code!==3003)),$.concat(z,Y)}function oz0(Z,J){return BA(Z,J,{propsOptional:!0})}function sz0(Z,J){if(J.kind!==p.Element)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0)&&!(Q instanceof C0))throw new Error("Expected symbol declaration");let X=[],x=lT(Z,Q),q=Z.specificType(J.id).chain(($)=>Y6(Z,$));g(X,q.diagnostics);let Y=x3(q.unwrap().table,x.table);return new d(new s2(Y),X)}function nz0(Z,J,Q){if(!a7(Z))return v.WrongKind;if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");let X=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(X instanceof C4){let $=QG(Q,Z,X);$&&(X=$)}let x;X instanceof E0&&X.partialType&&Z.body instanceof S0?x=XG(Q,Z.body,J,X.partialType):x=G0(X,"__call__",J,Z.body,{elementName:Z.elementName.value.value,filepath:w0.create(Z.id.filepath)}),x.members.set("__doc__",h0.create(I8(Z)));let q=Q.symbol(Z.elementName.id).unwrap();Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J)),x=JG(Q,x,Z.elementName.value.value,J,w0.create(Z.id.filepath));let Y=new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x});return J.data.bindings.push(Y),new U1(J,x)}var az0={name:"Element",hooks:{symbol:iz0,typeOfSymbol:dz0,specificType:GA,specificTypeWithPropsOptionalCtx:lz0,members:sz0,typecheck:BA,typecheckWithPropsOptionalCtx:oz0,evaluate:nz0}};function rz0(Z,J){if(!l6(J))return new r(v.WrongKind);if(J instanceof C0){if(!(J.elementType instanceof Z0))return new r(v.Error,[l.createForNode(J.elementType.id,k.ExpectedThings,"identifier")])}else if(!(J.elementName instanceof Z0))return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=J instanceof _0?H0.createSymbol(J.elementName.value.value,p.ElementProperty,J.id):H0.createSymbol(J.elementType.value.value,p.ElementProperty,J.id);return new d(Q)}function tz0(Z,J){return l6(J)?Z.symbol(J.id).chain((Q)=>{if(J instanceof C0)return new d([{symbol:Q,nodeId:J.elementType.id},{symbol:Q,nodeId:J.id}]);let X=H0.createSymbol(J.elementName.value.value,Q.kind,Q.declarationId);return new d([{symbol:Q,nodeId:J.elementType.id},{symbol:X,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])}):new r(v.WrongKind)}function ez0(Z,J){return J.parent&&l6(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function ZW0(Z,J){var Q;if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let X=Z.nodeById(J.declarationId);if(!(X instanceof C0)&&!(X instanceof _0))throw new Error("Expected node");if(!((Q=X.parent)!=null&&Q.parent))throw new Error("Expected node parent");let x=[],q;if(X.parent instanceof K2?q=Z.type(X.parent.id):q=Z.symbol(X.parent.parent.id).chain((W)=>Z.specificType(W.id)),g(x,q.diagnostics),q.isErr())return new d(n0(Z),x);let Y=q.unwrap();U2(Y)&&(Y=c5(Y));let $=X.elementType.value.value,z=MY($,Y);return z?new d(z,x):new d(n0(Z),x)}function JW0(Z,J){if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof C0)&&!(Q instanceof _0))throw new Error("Expected node");return Z.typeOfSymbol(J.id).chain((X)=>{let x=G4(X)?X.type:X,q=x,Y=[];if(Q.body instanceof S0)q=I5(Q.body);else if(Q.body){let z=Z.symbol(Q.body.id);if(g(Y,z.diagnostics),z.isOk()){let W=Z.specificType(z.unwrap().id);g(Y,W.diagnostics),q=W.unwrap()}else{let W=Z.type(Q.body.id);g(Y,W.diagnostics),q=W.unwrap()}}let $=ZX(i1(x,q,Z),Q instanceof _0?Q.elementName:Q.elementType);if(pY($)){if(x.kind!==t.UnionType)throw new Error("Expected union type");n2($)&&$.matchedType&&(x=$.matchedType)}return U2(x)&&Q.body instanceof S0&&(x=l7(x),x.raw=I5(Q.body)),G4(X)?new d(jQ(x,X.parentType,X.symbol)):new d(x,Y)})}function MA(Z,J,Q){return l6(J)?J.body instanceof S0?J.body.body.reduce((X,x)=>X.concat(Q!=null&&Q.propsOptional?Z.typecheckWithPropsOptionalCtx(x.id):Z.typecheck(x.id)),[]):J.body?Q!=null&&Q.propsOptional?Z.typecheckWithPropsOptionalCtx(J.body.id):Z.typecheck(J.body.id):[]:v.WrongKind}function QW0(Z,J){return MA(Z,J,{propsOptional:!0})}function XW0(Z,J){if(J.kind!==p.ElementProperty)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof C0)&&!(Q instanceof _0))throw new Error("Expected node");let X=[],x=lT(Z,Q),q=Z.specificType(J.id).chain(($)=>Y6(Z,$));g(X,q.diagnostics);let Y=x3(q.unwrap().table,x.table);return new d(new s2(Y),X)}var xW0={name:"ElementProperty",hooks:{symbol:rz0,allSymbolsFromContext:tz0,identifierSymbol:ez0,typeOfSymbol:ZW0,specificType:JW0,members:XW0,typecheck:MA,typecheckWithPropsOptionalCtx:QW0}};function cQ(Z,J){if(y6(J))switch(J.primitiveTypeKind){case I0.Any:return n0(Z);case I0.Boolean:return Q3(Z);case I0.Int:return C5(Z);case I0.Kind:return O8(Z);case I0.Module:return wH(Z);case I0.Number:return m3(Z);case I0.String:return V4(Z);case I0.Void:return FZ(Z);default:lH(J.primitiveTypeKind)}else if(J.kind===t.ProductType&&J.name==="List"){if(eQ(J.typeArguments[0])){let x=q8(J.typeArguments[0].types.map((Y)=>cQ(Z,Y))),q=$Z(Z,x);return Z2(q,[x])}let Q=cQ(Z,J.typeArguments[0]),X=$Z(Z,Q);return Z2(X,[Q])}return J}function wY(Z,J){if(y6(J))return cQ(Z,J);if(J.kind===t.ProductType&&J.name==="TemplateString")return V4(Z);if(b6(J)){let Q=RQ(J),X=wY(Z,Q);return J6(Z,X)}if(eQ(J)){let Q=J.types.map((X)=>wY(Z,X));return q8(Q)}return J}function DA(Z){return!v8(Z)||!Z.decorators||Z.decorators.length===0?!1:Z.decorators.some((J)=>{if(J.name.value.value!=="tag"||!J.args||J.args.args.length===0||!J.args.args[0].value)return!1;let Q=J.args.args[0].value;if(Q.kind===Y0.TemplateString){let X=Q;return X.isNormalString()&&X.stringText()==="js_func"}return!1})}function qW0(Z,J){var Q;if(!v8(J))return new r(v.WrongKind);if((Q=J.parent)!=null&&Q.parent&&uY(J.parent.parent))return new r(v.WrongKind);let X=H0.createVoidSymbol(),x=[];return J.elementName instanceof k0?x.push(l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")):X=H0.createSymbol(J.elementName.value.value,p.Function,J.id),new d(X,x)}function YW0(Z,J){return v8(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function $W0(Z,J){return J.parent&&v8(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function KW0(Z,J){if(J.kind!==p.Function)return new r(v.WrongKind);let Q=[],X=J3([],n0(Z),Z,J);if(!(J instanceof H0)||!J.declarationId)throw new Error("Expected declaration id");let x=Z.nodeById(J.declarationId);if(!(x instanceof _0)&&!(x instanceof C0))throw new Error("Expected element");if(!x.params)Q.push(l.createForNode(x.id,k.ExpectedThings,"function's parameters"));else{let q=zW0(x.params,Z,Q),Y=WW0(x,Z,Q);if(X=J3(q,Y,Z,J),DA(x))X=J3(q,Y,Z,J);else{let{updatedReturnType:$}=VW0(x,Y,Z,Q);X=J3(q,$,Z,J)}}return new d(X,Q)}function zW0(Z,J,Q){let X=[];return Z.args.forEach((x)=>{let q=x.asParameter(),Y=n0(J),$=!1;if(q.type){let U=J.typeFromTypeExpression(q.type.node.id);g(Q,U.diagnostics),U.isOk()&&(Y=U.unwrap())}else if(q.defaultValue){let U=J.type(q.defaultValue.node.id);g(Q,U.diagnostics),U.isOk()&&(Y=cQ(J,U.unwrap()))}q.defaultValue&&($=!0);let z=J.symbol(q.name.node.id);g(Q,z.diagnostics);let W=z.unwrap();X.push({type:Y,symbol:W,hasDefaultValue:$})}),X}function WW0(Z,J,Q){let X=n0(J);if(Z.returnType){let x=J.typeFromTypeExpression(Z.returnType.typeExpr.id);g(Q,x.diagnostics),x.isOk()&&(X=x.unwrap())}return X}function VW0(Z,J,Q,X){let x=null;Z.body?Z.body instanceof S0?x=Z.body.body.length>0?Z.body.body[Z.body.body.length-1]:null:x=Z.body:X.push(l.createForNode(Z.id,k.ExpectedThings,"function's body"));let q=FZ(Q);if(x){let z=Q.type(x.id);g(X,z.diagnostics),z.isOk()&&(q=z.unwrap())}let Y=J,$=h6(J,q,x||Z.returnType,k.MismatchedFunctionReturnType,Q);return $?X.push($):Z.returnType||(Y=cQ(Q,q)),{bodyType:q,updatedReturnType:Y}}function UW0(Z,J){if(!HW0(J))return new r(v.WrongKind);if(!(J.body instanceof S0))return new r(v.WrongKind);let Q=new s2,X=[];if(J.params){let q=GW0(J.params,Z,Q);g(X,q.diagnostics),Q=q.unwrap()}let x=qG(J,J.body.body,Z,Q);return g(X,x.diagnostics),Q=x.unwrap(),new d(Q,X)}function HW0(Z){return v8(Z)||kH(Z)}function GW0(Z,J,Q=new s2){let X=[];return Z.args.forEach((x)=>{let q=J.symbol(x.id);g(X,q.diagnostics);let Y=q.unwrap();Q.has(J,Y.name)?X.push(l.createForNode(x.asParameter().name.node.id,k.DuplicatedName,Y.name)):Q.set(Y.name,Y)}),new d(Q,X)}function BW0(Z,J){return J.kind!==p.Function?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function MW0(Z,J){var Q;if(!v8(J)||(Q=J.parent)!=null&&Q.parent&&uY(J.parent.parent))return v.WrongKind;let X=DW0(J,Z),x=FW0(J,Z),q=NW0(J,Z),Y=wW0(J,Z),$=[];return g($,x),g($,q),g($,X),g($,Y),$}function DW0(Z,J){let Q=Z.decorators?NY(J.program,Z.decorators,n0(J)):[];return Array.from(Q)}function FW0(Z,J){let Q=J.symbol(Z.id).chain((X)=>J.specificType(X.id));return Array.from(Q.diagnostics)}function NW0(Z,J){return Z.body instanceof S0?Array.from(J.typecheck(Z.body.id)):[]}function wW0(Z,J){let Q=[];if(!Z.params)return Q;let X=!1;return Z.params.args.forEach((x)=>{let q=x.asParameter();_W0(x,q,X,Q),q.defaultValue&&(X=!0),PW0(x,q,J,Q)}),Q}function _W0(Z,J,Q,X){!J.defaultValue&&Q&&X.push(l.createForNode(Z.id,k.InvalidParameterOrder))}function PW0(Z,J,Q,X){if(!J.defaultValue||!J.type)return;let x=Q.typeFromTypeExpression(J.type.node.id);if(!x.isOk())return;let q=x.unwrap(),Y=Q.type(J.defaultValue.node.id);g(X,Y.diagnostics);let $=Y.unwrap(),z=h6(q,$,J.defaultValue.node,k.MismatchedType,Q,c0($),c0(q));z&&X.push(z)}function jW0(Z,J,Q){var X;if(!(Z instanceof _0)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.Function)return v.WrongKind;if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");if(!Z.body)throw new Error("Expected node body");let x;if(DA(Z)){let $=Q.program.jsFuncs.get(Z.elementName.value.value);if(!$)throw new Error(`JsFunc ${Z.elementName.value.value} not found`);x=$}else x=new OH(Z.params.args,Z.body,J,Q.program),x.members.set("__doc__",h0.create(I8(Z))),Z.decorators&&(x=jZ(Q.program,Z.decorators,Z,x,J));let q=Q.symbol(Z.elementName.id).unwrap(),Y=new V2({name:Z.elementName.value.value,symbol:q,type:q.type(Q),value:x});return J.data.bindings.push(Y),new U1(J,x)}var LW0={name:"Function",hooks:{symbol:qW0,allSymbolsFromContext:YW0,identifierSymbol:$W0,typeOfSymbol:KW0,scope:UW0,members:BW0,typecheck:MW0,evaluate:jW0}};function CW0(Z,J){if(!dY(J))return new r(v.WrongKind);let Q=H0.createVoidSymbol(),X=[],x=J.asParameter();return x.name.node instanceof Z0?Q=H0.createSymbol(x.name.name,p.FunctionScopedVariable,J.id):X.push(l.createForNode(x.name.node.id,k.ExpectedThings,"identifier")),new d(Q,X)}function OW0(Z,J){return dY(J)?Z.symbol(J.id).chain((Q)=>{let X=J.asParameter();return new d([{symbol:Q,nodeId:X.name.node.id},{symbol:Q,nodeId:J.id}])}):new r(v.WrongKind)}function mW0(Z,J){return J.parent&&dY(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function dY(Z){return Z instanceof O4&&pH(Z)}function SW0(Z,J){if(J.kind!==p.FunctionScopedVariable)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);return _v(Z,Q)}function RW0(Z,J){return J.kind!==p.FunctionScopedVariable?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function IW0(Z,J){return dY(J)?Z.symbol(J.id).chain((Q)=>Z.specificType(Q.id)).diagnostics:v.WrongKind}var TW0={name:"FunctionScopedVariable",hooks:{symbol:CW0,allSymbolsFromContext:OW0,identifierSymbol:mW0,typeOfSymbol:SW0,members:RW0,typecheck:IW0}};function vW0(Z,J,Q){return $4(J)?(J.leftExpression instanceof Z0?i4(o6(J),J.leftExpression.value.value,Z,J.leftExpression):Z.symbol(J.leftExpression.id)).chain((X)=>Z.members(X.id).chain((x)=>new d({moduleSymbol:X,moduleMembers:x}))).chain(({moduleMembers:X,moduleSymbol:x})=>X.has(Z,Q)?new d(X.get(Z,Q).symbol):new r(v.Error,[l.createForNode(J.rightExpression.id,k.ModuleNoMember,x.name,Q)])):new r(v.WrongKind)}function AW0(Z,J,Q){if(J.isOk()){let X=J.unwrap(),x=Z.members(X.id);if(x.isOk()){let q=x.unwrap();if(q.has(Z,Q)){let Y=q.get(Z,Q);if(Y)return Y.symbol}}}}function EW0(Z,J,Q,X){return(X?X.chain((x)=>Z.specificType(x.id)):Z.type(J.leftExpression.id)).chain((x)=>{if(x.kind===t.PrimitiveType&&x.primitiveTypeKind===I0.Module)return HZ(Z,()=>vW0(Z,J,Q));let q=cK0(Z,x,J.rightExpression.value.value,av(J));return q?new d(q.symbol):new r(v.Error,[l.createForNode(J.rightExpression.id,k.NonExistentProperty,Q,c0(x,{db:Z}))])})}function fW0(Z,J){if(!$4(J))return new r(v.WrongKind);if(J.rightExpression.flags===t7.HasError)return new r(v.WrongKind);if(J.rightExpression instanceof Z0){let Q=J.rightExpression.value.value,X=J.leftExpression instanceof Z0?i4(o6(J),J.leftExpression.value.value,Z,J.leftExpression):void 0,x=X||Z.symbol(J.leftExpression.id),q=AW0(Z,x,Q);if(q)return new d(q);if(x.isOk()){let Y=x.unwrap();if(Y.kind===p.Element||Y.kind===p.ElementProperty)return new r(v.Error,[l.createForNode(J.rightExpression.id,k.NonExistentName,Q)])}return EW0(Z,J,Q,X)}return new r(v.Error,[l.createForNode(J.rightExpression.id,k.ExpectedThings,"identifier")])}function kW0(Z,J){return $4(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.rightExpression.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function cW0(Z,J){return J.parent&&$4(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function bW0(Z,J){if(!$4(J))return new r(v.WrongKind);if(J.rightExpression.flags===t7.HasError)return new r(v.WrongKind);let Q=Z.symbol(J.id);return Q.isOk()?Q.chain((X)=>Z.specificType(X.id)):new d(n0(Z),Q.diagnostics)}function pW0(Z,J){return $4(J)?J.rightExpression.flags===t7.HasError?[]:Z.type(J.id).diagnostics:v.WrongKind}function yW0(Z,J,Q){if(!$4(Z))return v.WrongKind;let X=XK0(Q,Z);if(X){let Y=Q.interpretFile(X).env();if(Z.rightExpression instanceof Z0||Z.rightExpression instanceof c1)return new U1(J,Y.find(Z.rightExpression.value.value));throw new Error("Only identifier or string is accepted as message")}let x=Q.program.interpretNode(Z.leftExpression,J).returnVal,q;if(Z.rightExpression instanceof Z0)q=G0(x,"__lookUp__",Z.rightExpression.value.value);else if(Z.rightExpression instanceof c1)q=G0(x,"__lookUp__",Z.rightExpression.value.value);else throw new Error("Only identifier or string is accepted as message");return q instanceof tQ&&(q=q.clone(),q.bind(x)),new U1(J,q)}var FA={name:"PropertyAcessExpression",hooks:{symbol:fW0,allSymbolsFromContext:kW0,identifierSymbol:cW0,type:bW0,typecheck:pW0,evaluate:yW0}};function uW0(Z,J){return NA(J)?hW0(J,Z):new r(v.WrongKind)}function NA(Z){return Z instanceof k0&&Z.op.value==="|"}function hW0(Z,J){let Q=[],X=n0(J),x=_Y(Z,J);g(Q,x.diagnostics);let q=x.unwrap(),Y=[];for(let $ of q){let z=J.typeFromTypeExpression($.id);if(g(Q,z.diagnostics),z.isErr())return new d(X,Q);Y.push(z.unwrap())}return X=q8(Y),new d(X,Q)}function _Y(Z,J){let Q=[],X=[];if(Z instanceof c1||Z instanceof Z0)return X.push(Z),new d(X,Q);if(Z instanceof a1){let x=TH(J,Z,!0);return x.isOk()&&X.push(x.unwrap()),g(Q,x.diagnostics),new d(X,Q)}if(Z.op.value!=="|")Q.push(M1.createWithLocation(J.astFromNode(Z.id).filePath,Z.op.offset,Z.op.end(),k.ExpectedOperator,"|"));else if(Z.leftExpression instanceof k0||Z.leftExpression instanceof c1||Z.leftExpression instanceof Z0||Z.leftExpression instanceof a1){let x=_Y(Z.leftExpression,J);g(Q,x.diagnostics);let q=x.unwrap();if(X=X.concat(q),!(Z.rightExpression instanceof Z0)&&!(Z.rightExpression instanceof c1)&&!(Z.rightExpression instanceof a1))Q.push(l.createForNode(Z.rightExpression.id,k.ExpectedThings,"identifier or primary expression"));else{let Y=_Y(Z.rightExpression,J);X=X.concat(Y.unwrap()),g(Q,Y.diagnostics)}}else Q.push(l.createForNode(Z.leftExpression.id,k.ExpectedThings,"identifier or primary expression"));return new d(X,Q)}function gW0(Z,J){return NA(J)?[l.createForNode(J.id,k.UnexpectedThings,"union expression")]:v.WrongKind}var iW0={name:"UnionTypeExpression",hooks:{typeFromTypeExpression:uW0,typecheck:gW0}};function dW0(Z,J){if(!(J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD))return new r(v.WrongKind);let Q=[],X=H0.createVoidSymbol();return X=H0.createSymbol(J.elementName.value.value,p.TypeAlias,J.id),new d(X,Q)}function lW0(Z,J){return J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J.elementName.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function oW0(Z,J){return J.parent&&J.parent instanceof S1&&J.parent.elementType.value.kind===w.TYPE_KEYWORD?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function sW0(Z,J){return J.kind!==p.TypeAlias?new r(v.WrongKind):new d(O8(Z))}function nW0(Z,J){if(J.kind!==p.TypeAlias)return new r(v.WrongKind);let Q=[],X=n0(Z),x=Z.nodeById(J.declarationId);if(!(x instanceof S1))throw new Error("Expected equality declaration");if(!x.body)Q.push(l.createForNode(x.id,k.ExpectedThings,"type's body"));else if(x.body instanceof k0||x.body instanceof Z0||x.body instanceof c1||x.body instanceof a1){let q=Z.typeFromTypeExpression(x.body.id);g(Q,q.diagnostics),X=l7(q.unwrap()),X.aliasSymbol=J}else Q.push(l.createForNode(x.id,k.InvalidTypeBody));return new d(X,Q)}function aW0(Z,J){return J.kind!==p.TypeAlias?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function rW0(Z,J){return J instanceof S1&&J.elementType.value.kind===w.TYPE_KEYWORD?Z.symbol(J.id).chain((Q)=>Z.typeFromTypeSymbol(Q.id)).diagnostics:v.WrongKind}function tW0(Z,J,Q){var X;if(!(Z instanceof S1)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.TypeAlias)return v.WrongKind;if(!(Z.body instanceof k0)&&!(Z.body instanceof Z0)&&!(Z.body instanceof c1))throw new Error("Expected infix expression or identifier");let x=_Y(Z.body,Q).unwrap(),q=new C4;x.forEach(($)=>{if($ instanceof Z0){let z=Q.typeFromTypeExpression($.id).unwrap();if(z.kind===t.ProductType){let W=U2(z),U=W?c5(z):z,H=W?WA(z,Q.program):VA(z,Q.program),B=new Map;B.set("name",h0.create(U.name)),B.set("constructor",H),W&&B.set("isPartial",R1.True),G0(q,"push",new g0(B))}}}),q.members.set("__doc__",h0.create(I8(Z)));let Y=Q.symbol(Z.elementName.id).unwrap();return J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:Y,type:Y.type(Q),value:q})),new U1(J,q)}var eW0={name:"TypeAlias",hooks:{symbol:dW0,allSymbolsFromContext:lW0,identifierSymbol:oW0,typeOfSymbol:sW0,typeFromTypeSymbol:nW0,members:aW0,typecheck:rW0,evaluate:tW0}};function ZV0(Z,J){var Q,X;let x=new Map;if(!L1(Z,I0.Any))throw new Error("Built-in types are expected to be available.");let q=(X=(Q=Z.globalScope())==null?void 0:Q.get(Z,"Partial"))==null?void 0:X.symbol;if(!q)throw new Error("Expected Partial Symbol.");let Y=Z.typeFromTypeSymbol(q.id).unwrap();Y=Z2(Y,[J]);let $=H0.createGeneratedSymbol("baseObj",p.FunctionScopedVariable);$.generatedProps.type=Y;let z=H0.createGeneratedSymbol(UA,p.BuiltInProperty),W=J3([{symbol:$,type:Y}],J,Z,void 0,!0);return z.generatedProps.type=W,x.set(z.name,{symbol:z,type:Z.specificType(z.id).unwrap()}),x}function wA(Z,J){let Q=ZV0(Z,J);J.members=x3(J.members,Q)}function JV0(Z,J){let Q=J.nodeById(Z.declarationId);if(!(Q instanceof _0))throw new Error("Expected element declaration");if(!(Q.body instanceof S0)&&!(Q.body instanceof K2))throw new Error("Expected block body");let X=[],x=QV0(Q,J);g(X,x.diagnostics);let q=YG(Q.body,J,Z);g(X,q.diagnostics);let Y={...q.unwrap(),name:Z.name};wA(J,Y);let $=[x.unwrap(),Y.members].reduce((z,W)=>x3(z,W,void 0,(U,H,B,M)=>{let D=J.nodeById(B.symbol.declarationId),N=D instanceof C0||D instanceof _0?D.elementType:D;X.push(l.createForNode(N.id,k.DuplicatedName,M))}));return Y.members=$,new d(Y,X)}function QV0(Z,J){if(!Z.params)return new d(new Map);let Q=[],X=new Map;return Z.params.args.forEach((x)=>{let q=x.asAmlTypeOption();if(q.name.name!=="elem_name_as"){Q.push(l.createForNode(q.name.node.id,k.InvalidThings,"type option"));return}let Y=jv(J,x);if(Y.isErr()){g(Q,Y.diagnostics);return}let $=Y.unwrap(),z=H0.createGeneratedSymbol($.toString(),p.DefaultElementName,x.id);z.generatedProps.type=V4(J),X.set($.toString(),{type:V4(J),symbol:z})}),new d(X,Q)}function YG(Z,J,Q){let X=[],x=new Map,q=!1;Z.body.forEach(($)=>{if($ instanceof C0||$ instanceof I1){let z=J.symbol($.id)._chain((B)=>J.specificType(B.id)._chain((M)=>new d({elementSymbol:B,elementType:M})));if(g(X,z.diagnostics),z.isErr())return;let{elementSymbol:W,elementType:U}=z.unwrap(),H=$ instanceof C0?$.elementType:$.callee;if(!(H instanceof Z0))return;if(Y4(U)){let{ruleset:B}=U;B.isRuleOn(j0.TypeAs)&&(q?X.push(l.createForNode(B.getRule(j0.TypeAs).declarationId,k.UnexpectedThings,"'elem_type_as' option. 'elem_type_as' is already set for another property")):q=!0)}x.has(H.value.value)?X.push(l.createForNode(H.id,k.DuplicatedName,H.value.value)):x.set(H.value.value,{type:U,symbol:W})}else r7($)||X.push(l.createForNode($.id,k.InvalidTypeProperty))});let Y=T8(x,J,void 0,Q);return new d(Y,X)}function XV0(Z,J){if(!(J instanceof _0&&J.elementType.value.kind===w.TYPE_KEYWORD))return new r(v.WrongKind);if(J.elementName instanceof k0)return new r(v.Error,[l.createForNode(J.elementName.id,k.ExpectedThings,"identifier")]);let Q=H0.createSymbol(J.elementName.value.value,p.Type,J.id);return new d(Q)}function xV0(Z,J){return J.kind!==p.Type?new r(v.WrongKind):new d(O8(Z))}function qV0(Z,J){if(J.kind!==p.Type)return new r(v.WrongKind);let Q=Z.nodeById(J.declarationId);if(!(Q instanceof _0))throw new Error("Expected element declaration");return Q.body instanceof S0?JV0(J,Z):new d(n0(Z),[l.createForNode(Q.id,k.ExpectedThings,"type's body")])}function YV0(Z,J){return J.kind!==p.Type?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function $V0(Z,J){if(!(J instanceof _0&&J.elementType.value.kind===w.TYPE_KEYWORD))return v.WrongKind;let Q=Z.symbol(J.id).chain((x)=>Z.typeFromTypeSymbol(x.id)).diagnostics,X=J.body instanceof S0?J.body.body.reduce((x,q)=>(g(x,Z.typecheck(q.id)),x),[]):[];return Q=Q.concat(X),Q}function KV0(Z,J,Q){var X;if(!JX(Z)||((X=Z.symbol(Q))==null?void 0:X.kind)!==p.Type)return v.WrongKind;if(!Z.body)throw new Error("Expected body");if(!(Z.elementName instanceof Z0))throw new Error("Expected identifier");let x=Q.typeFromTypeExpression(Z.elementName.id).unwrap();if(x.kind!==t.ProductType)throw new Error("Expected product type");let q=VA(x,Q.program);q.members.set("__doc__",h0.create(I8(Z)));let Y=Q.symbol(Z.elementName.id).unwrap();return J.data.bindings.push(new V2({name:Z.elementName.value.value,symbol:Y,type:Q.typeOfSymbol(Y.id).unwrap(),value:q})),new U1(J,q)}var zV0={name:"Type",hooks:{symbol:XV0,typeOfSymbol:xV0,typeFromTypeSymbol:qV0,typecheck:$V0,members:YV0,evaluate:KV0}};function WV0(Z,J){let Q=J.nodeById(Z.declarationId);if(!Q)throw new Error("Expected declaration");if(!b5(Q))throw new Error("Expect literal element expression");if(iv(Q))return VV0(Q,J,Z);if(!(Q instanceof C0))throw new Error("Expected literal element");return Q.body instanceof S0||Q.body instanceof K2?YG(Q.body,J,Z):J.typeFromTypeExpression(Q.body.id)}function VV0(Z,J,Q){return P$0.create(Z,J)._chain((X)=>UV0(Z,X,J,Q)._chain((x)=>new d({ruleset:X,bodyType:x})))._chain(({ruleset:X,bodyType:x})=>{let{structure:q}=X;if(q===Y1.DictName||q===Y1.DictType){let z=jQ(x,void 0,Q),W=Z2(aQ(J,z,Q),[V4(J),n0(J)]),U=H0.createGeneratedSymbol("*",p.TypeProperty);U.generatedProps.type=z;let H=qY(X,W,Q);return W.members.set("*",{type:z,symbol:U}),z.parentType=H,new d(H)}if(q===Y1.List){let z=jQ(x,void 0,Q),W=$Z(J,z,Q),U=Z2(W,[n0(J)]),H=qY(X,U,Q);return z.parentType=H,new d(H)}let Y=jQ(x,void 0,Q),$=qY(X,Y,Q);return Y.parentType=$,new d($)})}function UV0(Z,J,Q,X){let x=[],q=n0(Q);if(Z instanceof C0)if(Z.body instanceof S0||Z.body instanceof K2){let Y=YG(Z.body,Q,X);g(x,Y.diagnostics),q=Y.unwrap()}else{let Y=Q.typeFromTypeExpression(Z.body.id);g(x,Y.diagnostics),q=Y.unwrap()}return q.kind===t.ProductType&&wA(Q,q),new d(q,x)}function HV0(Z,J){if(!b5(J))return new r(v.WrongKind);let Q=J instanceof C0?J.elementType:J.callee;if(Q instanceof Z0){let X=H0.createSymbol(Q.value.value,p.TypeProperty,J.id);return new d(X)}return new r(v.Error,[l.createForNode(Q.id,k.ExpectedThings,"identifier")])}function GV0(Z,J){return b5(J)?Z.symbol(J.id).chain((Q)=>new d([{symbol:Q,nodeId:J instanceof C0?J.elementType.id:J.callee.id},{symbol:Q,nodeId:J.id}])):new r(v.WrongKind)}function BV0(Z,J){return J.parent&&b5(J.parent)?Z.allSymbolsFromContext(J.parent.id).chain((Q)=>{var X;let x=(X=h5(Q,J))==null?void 0:X.symbol;return x?new d(x):new r(v.Error)}):new r(v.WrongKind)}function MV0(Z,J){return J.kind!==p.TypeProperty?new r(v.WrongKind):WV0(J,Z)}function DV0(Z,J){return J.kind!==p.TypeProperty?new r(v.WrongKind):Z.specificType(J.id).chain((Q)=>Y6(Z,Q))}function FV0(Z,J){if(!b5(J))return v.WrongKind;let Q=Z.symbol(J.id).chain((x)=>Z.specificType(x.id)).diagnostics,X=J instanceof C0&&J.body instanceof S0?J.body.body.reduce((x,q)=>(g(x,Z.typecheck(q.id)),x),[]):[];return Q=Q.concat(X),Q}var NV0={name:"TypeProperty",hooks:{symbol:HV0,allSymbolsFromContext:GV0,identifierSymbol:BV0,typeOfSymbol:MV0,members:DV0,typecheck:FV0}};function _A(Z,J){let Q=J.expressions.map((x)=>Z.typeFromTypeExpression(x.id)),X=Q.reduce((x,q)=>x.concat(q.diagnostics),[]);return{paramTypes:Q.filter((x)=>x.isOk()).map((x)=>x.unwrap()),diags:X}}function wV0(Z,J){if(!(J instanceof Z0))return new r(v.WrongKind);if(!J.parent)throw new Error("Node parent is undefined");let Q=Z.identifierSymbol(J.id);return Q.isOk()?Q:i4(o6(J),J.value.value,Z,J)}function _V0(Z,J){if(!(J instanceof Z0)||hv(J))return new r(v.WrongKind);let Q=Z.symbol(J.id).chain((x)=>Z.specificType(x.id));if(Q.isErr())return new d(n0(Z),Q.diagnostics);let X=[];if(g(X,Q.diagnostics),J.value.value==="create_slot"&&J.typeParameter){let{diags:x,paramTypes:q}=_A(Z,J.typeParameter);if(g(X,x),q.length){let Y=J6(Z,q[0]),$=l7(Q.unwrap());return $.returnType=Y,new d($,X)}return X.push(l.createForNode(J.id,k.GenericTypeNeedTypeArgument,c0(Q.unwrap(),{db:Z}),1)),new d(Q.unwrap(),X)}return Q}function PV0(Z,J){if(!(J instanceof Z0))return v.WrongKind;let Q=[],X=Z.symbol(J.id);if(g(Q,X.diagnostics),X.isErr())return Q;let x=X.unwrap(),q=Z.symbolReference(x.id);g(Q,q.diagnostics);let Y=x instanceof H0&&x.declarationId?Z.nodeById(x.declarationId):void 0;q.isOk()?x=q.unwrap():Y&&jV0(Z,Y,J)&&Q.push(l.createForNode(J.id,k.BlockScopedVariableUsedBeforeDefined,J.value.value));let $=Z.specificType(x.id);return g(Q,$.diagnostics),J.typeParameter&&!$I($.unwrap())&&Q.push(l.createForNode(J.id,k.ValueIsUsedAsType,J.value.value)),$I($.unwrap())&&g(Q,Z.typeFromTypeExpression(J.id).diagnostics),Q}function jV0(Z,J,Q){return J.id.filepath!==Q.id.filepath||v8(J)||uY(J)?!1:(J instanceof S1||J instanceof _0)&&J.body&&dv(J.body,Q)?!0:J.span().start>Q.span().start}function LV0(Z,J){var Q,X,x,q;if(!(J instanceof Z0))return new r(v.WrongKind);let Y=Z.symbol(J.id).chain((W)=>Z.typeFromTypeSymbol(W.id));if(Y.isErr())return Z.symbol(J.id).isOk()?new d(n0(Z),[l.createForNode(J.id,k.ValueIsUsedAsType,J.value.value)]):new d(n0(Z),[l.createForNode(J.id,k.NonExistentType,J.value.value)]);let $=Y.unwrap();if(!D$0($)||Y.isErr())return Y;let z=[...Y.diagnostics];if(J.typeParameter){let{diags:W,paramTypes:U}=_A(Z,J.typeParameter);if(g(z,W),U.length){let H=Z.symbol(J.id),B=(Q=Z.globalScope().get(Z,"Partial"))==null?void 0:Q.symbol;H.isOk()&&H.unwrap().id.key===(B==null?void 0:B.id.key)&&U[0].kind!==t.ProductType&&g(z,l.createForNode(J.typeParameter.id,k.PartialTypeNonApplicable,U[0].kind));let M=(X=Z.globalScope().get(Z,"Slot"))==null?void 0:X.symbol,D=[t.PrimitiveType,t.LiteralType,t.UnionType];H.isOk()&&H.unwrap().id.key===(M==null?void 0:M.id.key)&&!D.includes(U[0].kind)&&!Y$0(U[0])&&g(z,l.createForNode(J.typeParameter.id,k.SlotTypeNonApplicable,U[0].kind))}if(((x=$.typeArguments)==null?void 0:x.length)===U.length){let H=Z2($,U);return new d(H,z)}}return z.push(l.createForNode(J.id,k.GenericTypeNeedTypeArgument,c0($,{db:Z}),((q=$==null?void 0:$.typeArguments)==null?void 0:q.length)??"")),new d(n0(Z),z)}function CV0(Z,J,Q){if(!(Z instanceof Z0))return v.WrongKind;let X=Q.symbol(Z.id);if(X.isErr())throw new H4(l.createForNode(Z.id,k.NonExistentName,Z.value.value));let x=X.unwrap(),q=Q.typeFromTypeExpression(Z.id);if(q.isOk()&&U2(q.unwrap())&&x.kind!==p.TypeAlias)return Q.program.interpretNode(Z.typeParameter.expressions[0],J);if(x instanceof q4)return new U1(J,new g0);if(x instanceof H0&&x.declarationId){let Y=w0.create(Z.id.filepath),$=w0.create(x.declarationId.filepath);if(Y&&$&&!Y.equals($)){let z=Q.interpretFile($).env();return new U1(z,z.find(Z.value.value))}}return new U1(J,J.find(Z.value.value))}var OV0={name:"Identifier",hooks:{symbol:wV0,type:_V0,typeFromTypeExpression:LV0,typecheck:PV0,evaluate:CV0}};function mV0(Z){let J=[],Q,X=()=>({diags:J,validatedExpr:Q});return Z instanceof C0||Z instanceof _0?(Q=Z,X()):(J.push(l.createForNode(Z.id,k.UnexpectedThings,"expression")),X())}function SV0(Z,J){let Q=[],X=J.body.map(($)=>mV0($));X.forEach(($)=>g(Q,$.diags));let x=X.filter(($)=>$.validatedExpr instanceof C0).map(($)=>$.validatedExpr).map(($)=>Z.type($.body.id));x.forEach(($)=>g(Q,$.diagnostics));let q=x.filter(($)=>$.isOk()).map(($)=>$.unwrap()),Y=_H(Z,q);return{keyType:L1(Z,I0.String),valueType:Y,diags:Q}}function RV0(Z){var J,Q,X;let x={},q=(Q=(J=Z.parent)==null?void 0:J.parent)==null?void 0:Q.parent,Y=(X=Z.parent)==null?void 0:X.parent,$=Z.parent;if(!(q instanceof I1&&Y instanceof k2&&$ instanceof O4))return x;let z=Y.args.findIndex((W)=>W===$);return z<0?x:{callExpr:q,argList:Y,argExpr:$,paramIndex:z}}function IV0(Z,J){return J.body.reduce((Q,X)=>X instanceof C0?X.body instanceof S0?(Q.push(l.createForNode(X.elementType.id,k.UnexpectedThings,"element")),Q):(g(Q,Z.typecheck(X.body.id)),Q):(Q.push(l.createForNode(X.id,k.UnexpectedThings,"expression")),Q),[])}function TV0(Z,J){var Q,X;if(!(J instanceof K2))return new r(v.WrongKind);let x=(X=(Q=J.parent)==null?void 0:Q.parent)==null?void 0:X.parent;if(x instanceof I1){let U=Z.type(x.callee.id),H=U.unwrap();if(!q$0(H))return new d(n0(Z),U.diagnostics);let{paramIndex:B}=RV0(J);if(B===void 0)return new d(n0(Z),[l.createForNode(J.id,k.ExpectedThings,"valid function parameter")]);let M=H.parameters[B];if(M!=null&&M.type&&wv(M.type))return new d(M.type,U.diagnostics)}let{keyType:q,valueType:Y,diags:$}=SV0(Z,J),z=aQ(Z,Y),W=Z2(z,[q,Y]);return new d(W,$)}function vV0(Z,J){if(!(J instanceof K2))return v.WrongKind;let Q=[],X=Z.type(J.id);g(Q,X.diagnostics);let x=X.unwrap();if((x==null?void 0:x.name)==="Dict"){let q=IV0(Z,J);g(Q,q)}else{let q=i1(x,I5(J),Z);g(Q,q.diags),J.body.forEach((Y)=>g(Q,Z.typecheckWithPropsOptionalCtx(Y.id))),Q=Q.filter((Y)=>Y.code!==3003)}return Q}function AV0(Z,J,Q){if(!(Z instanceof K2))return v.WrongKind;let X=Q.type(Z.id).unwrap();if(!U2(X)){let q=J.find("Dict");if(!q)throw new Error("Expected a constructor for the Block Expression.");let Y=G0(q,"__call__",J,Z);return new U1(J,Y)}let x=XG(Q,Z,J,X);return new U1(J,x)}var EV0={name:"BlockExpression",hooks:{type:TV0,typecheck:vV0,evaluate:AV0}};function fV0(Z,J,Q,X){return Z.parameters.map((x)=>{let q=x.symbol.name,Y=J.get(q);if(Y){let $=X.nodeById(Y.argId).asArgument();if($.value)return Nv(x.type)?new CH($.value.node,Q):X.program.interpretNode($.value.node,Q).returnVal}return M2.Instance})}function UI(Z,J){throw Z instanceof l?Z:Z instanceof e1?new l(J,Z.message,Z.category,Z.code):Z}function HI(Z,J){return J.kind===t.Signature&&k6(J.returnType)&&(Z.type=J.returnType),Z}function kV0(Z,J){if(!(J instanceof I1))return new r(v.WrongKind);let Q=n0(Z),X=Z.callSiteResolution(J.id);return X.isOk()&&(Q=X.unwrap().signature.returnType),new d(Q,X.diagnostics)}function cV0(Z,J){if(!(J instanceof I1))return v.WrongKind;let Q=[],X=Z.type(J.callee.id);if(X.isErr())return X.diagnostics;g(Q,X.diagnostics);let x=X.unwrap();if(R2(x))return Q;J.args.args.forEach((z)=>{let W=z.asArgument();if(!W.value){Q.push(l.createForNode(z.id,k.ExpectedThings,"argument's value"));return}g(Q,Z.typecheck(W.value.node.id))});let q=Z.callSiteResolution(J.id);if(q.isErr())return g(Q,q.diagnostics,l.createForNode(J.callee.id,k.ExpressionNotCallable,c0(x,{db:Z}))),Q;let{resolutionResult:Y}=q.unwrap();if(Y.isErr())return g(Q,Y.err()),Q;let{typeCompatibilityDiags:$}=Y.unwrap();return g(Q,$),Q}function GI(Z){return Z.callee instanceof Z0&&Z.callee.value.value==="create_slot"}function bV0(Z,J,Q){if(!(Z instanceof I1))return v.WrongKind;let X=Q.type(Z.callee.id);if(X.isErr())throw new H4(l.createForNode(Z.id,k.AdhocError,"Cannot evaluate this expression"));let x=X.unwrap();if(R2(x)){let W=Z.args.args.map((H)=>{let B=H.asArgument();return Q.program.interpretNode(B.value.node,J).returnVal}),U=Q.program.interpretNode(Z.callee,J).returnVal;try{let H=G0(U,"__call__",...W),B=GI(Z)?HI(H,x):H;return new U1(J,B)}catch(H){UI(H,Z.id)}}let q=Q.program.interpretNode(Z.callee,J).returnVal,Y=Q.callSiteResolution(Z.id);if(Y.isErr())throw new Error("No signature found for call expression");let{signature:$,resolutionResult:z}=Y.unwrap();if(z.isErr())throw new Error("Argument resolution failed for call expression");try{let W=fV0($,z.unwrap().resolvedArgs,J,Q),U=G0(q,"__call__",...W),H=GI(Z)?HI(U,x):U;return new U1(J,H)}catch(W){UI(W,Z.id)}}var PA={name:"CallExpression",hooks:{type:kV0,typecheck:cV0,evaluate:bV0}};function pV0(Z,J){return J instanceof z3?Z.type(J.expr.id):new r(v.WrongKind)}function yV0(Z,J){return J instanceof z3?Z.typecheck(J.expr.id):v.WrongKind}function uV0(Z,J,Q){return Z instanceof z3?Q.program.interpretNode(Z.expr,J):v.WrongKind}var hV0={name:"GroupExpression",hooks:{type:pV0,typecheck:yV0,evaluate:uV0}};function gV0(Z,J){if(!(J instanceof y2))return new r(v.WrongKind);let Q=vY(Z),X=O5(I0.String,Z,J.name.value),x;if(IH(Z,J.content)){let q=Z2(Q,[X]);x=J6(Z,q)}else x=Z2(Q,[X]);return new d(x)}function iV0(Z,J){if(!(J instanceof y2))return new r(v.WrongKind);let Q=vY(Z),X=O5(I0.String,Z,J.name.value),x;if(IH(Z,J.content)){let Y=Z2(Q,[X]);x=J6(Z,Y)}else x=Z2(Q,[X]);let q=TH(Z,J.content,!0);return new d(x,q.diagnostics)}function dV0(Z,J){return J instanceof y2?Z.typecheck(J.content.id):v.WrongKind}function lV0(Z,J,Q){if(!(Z instanceof y2))return v.WrongKind;let X=I2(Q.program.interpretNode(Z.content,J).returnVal),x=Q.type(Z.id).unwrap(),q=X instanceof h0?new zZ(Z.name.value,X.data,x):new zZ(Z.name.value,X,x);return new U1(J,q)}var oV0={name:"Heredoc",hooks:{type:gV0,typeFromTypeExpression:iV0,typecheck:dV0,evaluate:lV0}};function sV0(Z,J){return!!(Z.type&&k6(Z.type)||J.type&&k6(J.type))}function nV0(Z,J){if(!(J instanceof k0))return new r(v.WrongKind);let Q=[],X=n0(Z);switch(J.op.value){case"=":J.leftExpression instanceof Z0?Q.push(l.createForNode(J.leftExpression.id,k.CannotAssignTwiceToImmutableVariable,J.leftExpression.value.value)):J.leftExpression instanceof c1?Q.push(l.createForNode(J.leftExpression.id,k.LhsAssignmentExprMustBeName)):Q.push(l.createForNode(J.leftExpression.id,k.UnexpectedThings,"expression"));break;case"==":case"!=":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();LA(q,$)||x4(q,$,Z)||x4($,q,Z)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"<":case"<=":case">":case">=":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,Q3(Z));break}x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"+":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(C5(Z),q,Z)&&x4(C5(Z),$,Z)?X=O3(Z,q,$,C5(Z)):x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):x4(V4(Z),q,Z)&&x4(V4(Z),$,Z)?X=O3(Z,q,$,V4(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"-":case"*":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(C5(Z),q,Z)&&x4(C5(Z),$,Z)?X=O3(Z,q,$,C5(Z)):x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case"/":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();if(R2(q)||R2($)){X=O3(Z,q,$,n0(Z));break}x4(m3(Z),q,Z)&&x4(m3(Z),$,Z)?X=O3(Z,q,$,m3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}case".":{let x=Z.symbol(J.id).chain((q)=>Z.specificType(q.id));g(Q,x.diagnostics),x.isOk()&&(X=x.unwrap());break}case"||":case"&&":{let x=Z.type(J.leftExpression.id);g(Q,x.diagnostics);let q=x.unwrap(),Y=Z.type(J.rightExpression.id);g(Q,Y.diagnostics);let $=Y.unwrap();jA(q,$)||aV0(q,$)?X=O3(Z,q,$,Q3(Z)):Q.push(l.createForNode(J.id,k.OperatorCannotAppliedForTypes,J.op.value,c0(q,{db:Z}),c0($,{db:Z})));break}default:Q.push(l.createForNode(J.id,k.InvalidOperator,J.op.value));break}return new d(X,Q)}function jA(Z,J){return LA(Z,J)&&Z.primitiveTypeKind===I0.Boolean}function aV0(Z,J){let Q=b6(Z)?RQ(Z):Z,X=b6(J)?RQ(J):J;return jA(Q,X)}function LA(Z,J){return(y6(Z)||p6(Z))&&(y6(J)||p6(J))&&Z.primitiveTypeKind===J.primitiveTypeKind}function O3(Z,J,Q,X){return k6(J)||k6(Q)?J6(Z,X):X}function rV0(Z,J){return J instanceof k0?Z.type(J.id).diagnostics.concat(Z.typecheck(J.leftExpression.id)).concat(Z.typecheck(J.rightExpression.id)):v.WrongKind}function tV0(Z,J,Q){if(!(Z instanceof k0)||Z.op.value===".")return v.WrongKind;let X=Q.program.interpretNode(Z.leftExpression,J).returnVal,x=Q.program.interpretNode(Z.rightExpression,J).returnVal;if(sV0(X,x)){let Y=new Map;return Y.set("leftExpression",X),Y.set("operator",h0.create(Z.op.value)),Y.set("rightExpression",x),new U1(J,new g0(Y,void 0,dT(Q)))}let q=G0(X,Z.op.value,x);return new U1(J,q)}var eV0={name:"InfixExpression",hooks:{type:nV0,typecheck:rV0,evaluate:tV0}};function ZU0(Z,J){let Q=J.exprList.map((q)=>Z.type(q.id)),X=Q.reduce((q,Y)=>q.concat(Y.diagnostics),[]),x=Q.filter((q)=>q.isOk()).map((q)=>q.unwrap());return{contentType:_H(Z,x),diags:X}}function JU0(Z,J){if(!(J instanceof M4))return new r(v.WrongKind);let{contentType:Q,diags:X}=ZU0(Z,J),x=$Z(Z,Q),q=Z2(x,[Q]);return new d(q,X)}function QU0(Z,J){return J instanceof M4?J.exprList.reduce((Q,X)=>(g(Q,Z.typecheck(X.id)),Q),[]):v.WrongKind}function XU0(Z,J,Q){if(!(Z instanceof M4))return v.WrongKind;let X=new C4;return Z.exprList.forEach((x)=>{let q=Q.program.interpretNode(x,J).returnVal;G0(X,"push",q)}),new U1(J,X)}var xU0={name:"ListExpression",hooks:{type:JU0,typecheck:QU0,evaluate:XU0}};function qU0(Z,J){if(!(J instanceof v3))return new r(v.WrongKind);let Q=n0(Z);return new d(Q)}function YU0(Z,J){return J instanceof v3?Z.type(J.id).diagnostics:v.WrongKind}function $U0(Z,J,Q){if(!(Z instanceof v3))return v.WrongKind;let X=Q.program.interpretNode(Z.expression,J).returnVal,x=G0(X,`_PO${Z.op.value}`);return new U1(J,x)}var KU0={name:"PostfixExpression",hooks:{type:qU0,typecheck:YU0,evaluate:$U0}};function zU0(Z,J){return!p6(Z)&&!y6(Z)?!1:J==="!"?Z.primitiveTypeKind===I0.Boolean:Z.primitiveTypeKind===I0.Any||Z.primitiveTypeKind===I0.Number||Z.primitiveTypeKind===I0.Int}function WU0(Z,J){if(!(J instanceof B4))return new r(v.WrongKind);let Q=[],X=n0(Z),x=Z.type(J.expression.id);g(Q,x.diagnostics);let q=x.unwrap();if(!zU0(q,J.op.value))return Q.push(l.createForNode(J.id,k.PrefixOperatorCannotAppliedForType,J.op.value,c0(q,{db:Z}))),new d(X,Q);switch(J.op.value){case"+":case"-":{p6(q)?X=L1(Z,q.primitiveTypeKind):y6(q)&&(X=O5(q.primitiveTypeKind,Z,J.op.value==="-"?-q.value:q.value));break}case"!":{p6(q)?X=L1(Z,q.primitiveTypeKind):y6(q)&&(X=O5(q.primitiveTypeKind,Z,!q.value));break}default:Q.push(l.createForNode(J.id,k.PrefixOperatorCannotAppliedForType,J.op.value,c0(q,{db:Z})));break}return new d(X,Q)}function VU0(Z,J){return J instanceof B4?Z.type(J.id).diagnostics:v.WrongKind}function UU0(Z,J,Q){if(!(Z instanceof B4))return v.WrongKind;let X=Q.program.interpretNode(Z.expression,J).returnVal,x=G0(X,`_P${Z.op.value}`);return new U1(J,x)}var HU0={name:"PrefixExpression",hooks:{type:WU0,typecheck:VU0,evaluate:UU0}};function GU0(Z,J){return J instanceof c1?CA(J,Z):new r(v.WrongKind)}function CA(Z,J){let Q=n0(J);switch(Z.value.kind){case w.MIDDLE_STRING_LITERAL:Q=O5(I0.String,J,Z.value.value);break;case w.NUMBER_LITERAL:{let X=Z.value.isFloat?I0.Number:I0.Int;Q=O5(X,J,Z.value.value);break}case w.TRUE_LITERAL:case w.FALSE_LITERAL:Q=O5(I0.Boolean,J,Z.value.value);break;default:throw new Error("Invalid primary expression")}return new d(Q)}function BU0(Z,J){return J instanceof c1?CA(J,Z):new r(v.WrongKind)}function MU0(Z,J){return J instanceof c1?Z.type(J.id).diagnostics:v.WrongKind}function DU0(Z,J,Q){if(!(Z instanceof c1))return v.WrongKind;switch(Z.value.kind){case w.NUMBER_LITERAL:return new U1(J,new h4(Z.value.value));case w.TRUE_LITERAL:case w.FALSE_LITERAL:return new U1(J,Z.value.value?R1.True:R1.False);case w.MIDDLE_STRING_LITERAL:return new U1(J,h0.create(Z.value.value));default:throw new Error("Unknown constant type")}}var FU0={name:"PrimaryExpression",hooks:{type:GU0,typeFromTypeExpression:BU0,typecheck:MU0,evaluate:DU0}};function NU0(Z,J){let Q=Z.nodeById(J);if(!Q)return new r(v.WrongKind);if(!(Q instanceof Z0)&&!$4(Q))return new r(v.WrongKind);if(Q instanceof Z0){let X=w0.create(Q.id.filepath),x=Z.moduleIdOfFile(X),q=HZ(Z,()=>gY(Z,x,Q.value.value));if(q.isOk()){if(q.unwrap()instanceof q4)return q;let Y=q.diagnostics;return Y=Y.concat(l.createForNode(Q.id,k.UnresolvedModuleExpression)),new r(v.Error,Y)}return new r(v.Error,[l.createForNode(Q.id,k.NonExistentNameInModule,Q.value.value,x.name)])}return Q.rightExpression instanceof Z0?Z.symbolOfModulePath(Q.leftExpression.id).chain((X)=>Z.members(X.id).chain((x)=>new d({leftSymbol:X,members:x}))).chain(({members:X,leftSymbol:x})=>{var q;let Y=(q=X.get(Z,Q.rightExpression.value.value))==null?void 0:q.symbol;return Y?Y instanceof q4?new d(Y):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.UnresolvedModuleExpression)]):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.NonExistentNameInModule,Q.rightExpression.value.value,x.name)])}):new r(v.Error,[l.createForNode(Q.rightExpression.id,k.UnexpectedThings,"expression")])}function wU0(Z,J){if(!t8(J))return new r(v.WrongKind);if(J.body instanceof S0){let Q=[],X=[];return J.body.body.forEach((x)=>{if(x instanceof Z0){let q=H0.createSymbol(x.value.value,p.ModuleItem,x.id);Q.push({symbol:q,nodeId:x.id})}else if(x instanceof C0&&x.elementType instanceof Z0&&x.body instanceof Z0){let q=H0.createSymbol(x.elementType.value.value,p.ModuleItem,x.elementType.id);Q.push({symbol:q,nodeId:x.elementType.id});let Y=H0.createSymbol(x.body.value.value,p.ModuleItemAlias,x.body.id);Q.push({symbol:Y,nodeId:x.body.id})}else X.push(l.createForNode(x.id,k.InvalidThings,"syntax"))}),new d(Q,X)}return J.body?new r(v.Error,[l.createForNode(J.body.id,k.InvalidThings,"syntax")]):new d([])}function _U0(Z,J){var Q,X,x;let q;return(Q=J.parent)!=null&&Q.parent&&t8(J.parent.parent)?q=J.parent.parent:(x=(X=J.parent)==null?void 0:X.parent)!=null&&x.parent&&t8(J.parent.parent.parent)&&(q=J.parent.parent.parent),q?Z.allSymbolsFromContext(q.id).chain((Y)=>{var $;let z=($=h5(Y,J))==null?void 0:$.symbol;return z?new d(z):new r(v.Error)}):new r(v.WrongKind)}function PU0(Z,J){return t8(J)?J.body?J.body instanceof S0?Z.allSymbolsFromContext(J.id).chain((Q)=>{var X;let x=new J8((X=Z.astFromNode(J.id))==null?void 0:X.filePath,void 0,[{node:J.elementName,includedFull:!1}]),q=[];return Q.forEach(({symbol:Y,nodeId:$})=>{let z=Z.nodeById($);z.parent instanceof C0&&z.parent.elementType.id.key===z.id.key||(x.has(Z,Y.name)?q.push(l.createForNode(z.id,k.DuplicatedName,Y.name)):x.set(Y.name,Y,o7.Private))}),new d(x,q)}):new r(v.Error):J.elementName instanceof Z0||$4(J.elementName)?new d(new J8(Z.astFromNode(J.id).filePath,void 0,[{node:J.elementName,includedFull:!0}])):new r(v.Error,[l.createForNode(J.elementName.id,k.InvalidThings,"syntax")]):new r(v.WrongKind)}function jU0(Z,J){var Q,X,x,q,Y;if(J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias)return new r(v.WrongKind);if(J.kind===p.ModuleItem){let U=Z.nodeById(J.declarationId),H=t8(U.parent.parent)?(Q=U.parent)==null?void 0:Q.parent:(x=(X=U==null?void 0:U.parent)==null?void 0:X.parent)==null?void 0:x.parent;if(!H||!t8(H))throw new Error("Expected use declaration");return HZ(Z,()=>Z.symbolOfModulePath(H.elementName.id).chain((B)=>Z.members(B.id).chain((M)=>new d({moduleSymbol:B,members:M}))).chain(({moduleSymbol:B,members:M})=>M.has(Z,J.name)?new d(M.get(Z,J.name).symbol):new r(v.Error,[l.createForNode(U.id,k.ModuleNoMember,B.name,J.name)])))}let $=Z.nodeById(J.declarationId),z=($==null?void 0:$.parent).elementType,W=(Y=(q=z==null?void 0:z.parent)==null?void 0:q.parent)==null?void 0:Y.parent;if(!W||!t8(W))throw new Error("Expected use declaration");return HZ(Z,()=>Z.symbolOfModulePath(W.elementName.id).chain((U)=>Z.members(U.id).chain((H)=>new d({moduleSymbol:U,members:H}))).chain(({moduleSymbol:U,members:H})=>H.has(Z,z.value.value)?new d(H.get(Z,z.value.value).symbol):new r(v.Error,[l.createForNode(z.id,k.ModuleNoMember,U.name,z.value.value)])))}function LU0(Z,J){if(J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias)return new r(v.WrongKind);let Q=Z.symbolReference(J.id).chain((X)=>Z.specificType(X.id));return Q.isOk()?Q:new d(n0(Z),Q.diagnostics)}function CU0(Z,J){return J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias?new r(v.WrongKind):Z.symbolReference(J.id).chain((Q)=>Z.typeFromTypeSymbol(Q.id))}function OU0(Z,J){return t8(J)?!J.body||J.body instanceof S0&&J.body.body.length===0?Z.symbolOfModulePath(J.elementName.id).diagnostics:Z.allSymbolsFromContext(J.id).chain((Q)=>{let X=[];Q.forEach(({symbol:Y})=>{g(X,Z.specificType(Y.id).diagnostics)});let x=[],q=!1;return X.forEach((Y)=>{q?Y.code!==3024&&x.push(Y):(Y.code===3024&&(q=!0),x.push(Y))}),new d(void 0,x)}).diagnostics:v.WrongKind}function mU0(Z,J){return J.kind!==p.ModuleItem&&J.kind!==p.ModuleItemAlias?new r(v.WrongKind):Z.symbolReference(J.id).chain((Q)=>Z.members(Q.id))}function SU0(Z,J,Q){return t8(Z)?(Z.body&&Z.body instanceof S0&&Z.body.body.forEach((X)=>{if(X instanceof Z0){let x=BI(X,J,Q).returnVal,q=Q.symbol(X.id).unwrap();J.data.bindings.push(new V2({name:X.value.value,symbol:q,type:q.type(Q),value:x}))}else if(X instanceof C0&&X.elementType instanceof Z0&&X.body instanceof Z0){let x=BI(X.elementType,J,Q).returnVal,q=Q.symbol(X.body.id).unwrap();J.data.bindings.push(new V2({name:X.body.value.value,symbol:q,type:q.type(Q),value:x}))}}),new U1(J,a8.Instance)):v.WrongKind}function BI(Z,J,Q){let X=Q.symbol(Z.id).chain((x)=>Q.symbolReference(x.id)).unwrap();if(X instanceof q4)return new U1(J,new g0);if(X instanceof H0&&X.declarationId){let x=w0.create(X.declarationId.filepath),q=Q.interpretFile(x).env();return new U1(q,q.find(Z.value.value))}throw new Error("Unreachable")}var RU0={name:"UseDeclaration",hooks:{allSymbolsFromContext:wU0,identifierSymbol:_U0,mergeableInnerScope:PU0,symbolReference:jU0,typeOfSymbol:LU0,typeFromTypeSymbol:CU0,typecheck:OU0,members:mU0,evaluate:SU0}};function MI(Z){return Z.kind===t.UnionType?Z.types:[Z]}function OA(Z,J,Q=!1){if(!J)return new d(n0(Z));let X=J.body.length>0?J.body[J.body.length-1]:null;if(X){let x=Z.type(X.id);return Q?new d(J6(Z,wY(Z,x.unwrap())),x.diagnostics):x}return new d(FZ(Z))}function IU0(Z,J,Q=!1){if(J instanceof S0||!J){let x=OA(Z,J);return Q?new d(J6(Z,wY(Z,x.unwrap())),x.diagnostics):x}let X=Z.type(J.id);return Q?new d(J6(Z,X.unwrap()),X.diagnostics):X}function TU0(Z,J){if(!J.condition)return!1;let Q=Z.type(J.condition.id).unwrap();return k6(Q)}function vU0(Z,J){if(!(J instanceof K3))return new r(v.WrongKind);let Q=TU0(Z,J),X=OA(Z,J.thenBranch,Q);if(!J.elseKeyword)return X;let x=IU0(Z,J.elseBranch,Q),q=X.diagnostics.concat(x.diagnostics);if(R2(X.value.unwrap()))return new d(n0(Z),q);if(R2(x.value.unwrap()))return new d(n0(Z),q);let Y=MI(X.value.unwrap()).concat(MI(x.value.unwrap())),$=q8(Y);return new d($,q)}function AU0(Z,J){if(!(J instanceof K3))return v.WrongKind;let Q=[];return g(Q,Z.type(J.id).diagnostics),J.condition&&g(Q,Z.typecheck(J.condition.id)),J.thenBranch&&g(Q,Z.typecheck(J.thenBranch.id)),J.elseBranch&&g(Q,Z.typecheck(J.elseBranch.id)),Q}function EU0(Z,J,Q){if(!(Z instanceof K3))return v.WrongKind;if(!Z.condition)throw new Error("Expected condition");if(!Z.thenBranch)throw new Error("Expected node body");let X=Q.program.interpretNode(Z.condition,J).returnVal;if(X.type&&k6(X.type)){let x=Q.program.interpretNode(Z.thenBranch,J).returnVal,q=new Map;if(q.set("condition",X),q.set("then",x),Z.elseBranch){let Y=Q.program.interpretNode(Z.elseBranch,J).returnVal;q.set("else",Y)}return new U1(J,new g0(q,void 0,iT(Q)))}return X.data?Q.program.interpretNode(Z.thenBranch,J):Z.elseBranch?Q.program.interpretNode(Z.elseBranch,J):new U1(J,a8.Instance)}var fU0={name:"IfExpression",hooks:{type:vU0,typecheck:AU0,evaluate:EU0}};function XX(Z){return Z instanceof B4&&Z.op.value==="::"&&Z.expression instanceof Z0}function kU0(Z,J){if(!XX(J))return new r(v.WrongKind);let Q=Z.moduleTree();return Z.membersOfModule(Q.id).chain((X)=>X.has(Z,J.expression.value.value)?new d(X.get(Z,J.expression.value.value).symbol):new r(v.Error,[l.createForNode(J.expression.id,k.NonExistentNameInRootModule,J.expression.value.value)]))}function cU0(Z,J){return XX(J)?Z.symbol(J.id).chain((Q)=>Z.specificType(Q.id)):new r(v.WrongKind)}function bU0(Z,J){return XX(J)?Z.type(J.id).diagnostics:v.WrongKind}function pU0(Z,J,Q){if(!XX(Z))return v.WrongKind;let X=Q.symbol(Z.id).unwrap();if(X.kind===p.Module)return new U1(J,new g0);if(!(X instanceof H0)||!X.declarationId)throw new Error("Unreachable");let x=w0.create(X.declarationId.filepath);if(!x)throw new Error("Unreachable");let q=Q.interpretFile(x).env();return new U1(J,q.find(X.name))}var yU0={name:"AbsoluteModuleAccessExpression",hooks:{symbol:kU0,type:cU0,typecheck:bU0,evaluate:pU0}};function uU0(Z,J){if(!EH(J))return new r(v.WrongKind);let Q=h$0(Z,J);if(Q.isErr())return new r(v.Error,Q.diagnostics);let X=Q.unwrap(),x=H0.createSymbol(X,p.Element,J.id);return new d(x,Q.diagnostics)}function hU0(Z,J,Q){if(!EH(Z))return v.WrongKind;let X=Q.symbol(Z.id).unwrap(),x=I2(Q.program.interpretNode(Z.elementType,J).returnVal);if(x instanceof C4){let $=QG(Q,Z,x);$&&(x=$)}let q=G0(x,"__call__",J,Z.body,{elementName:X.name,filepath:w0.create(Z.id.filepath)});q.members.set("__doc__",h0.create(I8(Z))),q=JG(Q,q,X.name,J,w0.create(Z.id.filepath));let Y=new V2({name:X.name,symbol:X,type:X.type(Q),value:q});return J.data.bindings.push(Y),new U1(J,q)}var gU0={name:"Tag",hooks:{symbol:uU0,type:FY.hooks.type,typecheck:FY.hooks.typecheck,evaluate:hU0}},E7=1,bQ=2,$G=4,iU0=bQ|$G,dU0=bQ|$G|E7,yU=8,mA=16,lU0=32,oU0=64,sU0=128,SA=new Array(128).fill(0);for(let Z=0;Z<128;Z++){let J=0;Z>=48&&Z<=57&&(J|=E7),(Z>=65&&Z<=90||Z>=97&&Z<=122)&&(J|=bQ),Z===95&&(J|=$G),(Z===43||Z===45||Z===42||Z===47||Z===124||Z===38||Z===46||Z===33||Z===60||Z===62||Z===61||Z===58||Z===92)&&(J|=yU),(Z===32||Z===9||Z===13||Z===10)&&(J|=mA),(Z===32||Z===9||Z===13)&&(J|=lU0),(Z===34||Z===39)&&(J|=oU0),(Z===43||Z===45)&&(J|=sU0),SA[Z]=J}function DI(Z){return Z<0||Z>127?0:SA[Z]}class B2{constructor(){this.cache=new Map}static getInstance(){return B2.instance||(B2.instance=new B2),B2.instance}getOrCreate(Z,J,Q,X){let x=`${Z}:${J}`;typeof Q=="string"&&Q!==J&&(x+="#d");let q=this.cache.get(x);return q===void 0&&(q=Object.freeze({kind:Z,text:J,value:Q,isFloat:X}),this.cache.set(x,q)),q}getCacheSize(){return this.cache.size}}var y0={Tab:9,LineFeed:10,CarriageReturn:13,Space:32,Exclamation:33,DoubleQuote:34,Ampersand:38,Apostrophe:39,LeftParen:40,RightParen:41,Comma:44,Dot:46,Slash:47,Zero:48,Colon:58,Semicolon:59,LessThan:60,Equals:61,GreaterThan:62,At:64,Asterisk:42,LeftBracket:91,RightBracket:93,LowerB:98,LowerF:102,LowerN:110,LowerR:114,LowerT:116,LowerU:117,LowerV:118,LeftBrace:123,VerticalBar:124,RightBrace:125,Tilde:126},FI=new Map([["const",w.CONST_KEYWORD],["Type",w.TYPE_KEYWORD],["use",w.USE_KEYWORD],["Func",w.FUNC_KEYWORD],["Trait",w.TRAIT_KEYWORD],["Impl",w.IMPL_KEYWORD],["if",w.IF_KEYWORD],["else",w.ELSE_KEYWORD]]),nU0=new Map([[w.LBRACE,{text:"{"}],[w.RBRACE,{text:"}"}],[w.LPAREN,{text:"("}],[w.RPAREN,{text:")"}],[w.LBRACKET,{text:"["}],[w.RBRACKET,{text:"]"}],[w.COLON,{text:":"}],[w.SEMICOLON,{text:";"}],[w.COMMA,{text:","}],[w.EQUAL,{text:"="}],[w.ARROW,{text:"=>"}],[w.AT_SIGN,{text:"@"}],[w.RAW_AT_SIGN,{text:"@~"}],[w.OPEN_EMBEDDED_EXPRESSION,{text:"${"}],[w.CLOSE_EMBEDDED_EXPRESSION,{text:"}",value:"}"}],[w.CONST_KEYWORD,{text:"const"}],[w.TYPE_KEYWORD,{text:"Type"}],[w.IMPORT_KEYWORD,{text:"import"}],[w.USE_KEYWORD,{text:"use"}],[w.FUNC_KEYWORD,{text:"Func"}],[w.TRAIT_KEYWORD,{text:"Trait"}],[w.IMPL_KEYWORD,{text:"Impl"}],[w.IF_KEYWORD,{text:"if"}],[w.ELSE_KEYWORD,{text:"else"}],[w.AS_KEYWORD,{text:"as"}],[w.TRUE_LITERAL,{text:"true",value:!0}],[w.FALSE_LITERAL,{text:"false",value:!1}],[w.WHITESPACE,{text:" "}],[w.TAB,{text:"\t"}],[w.CR,{text:"\r"}],[w.END_OF_LINE,{text:`
140
140
  `}],[w.EOF,{text:""}]]);class ZZ{constructor(Z,J,Q){this.kind=Z,this.start=J,this.openBraceCnt=Q}shouldExit(Z=""){switch(this.kind){case"SINGLE_QUOTE_STRING":return Z==="'";case"EMBEDDED_EXPRESSION":return this.openBraceCnt===0;case"DOUBLE_QUOTE_STRING":return Z==='"';case"MULTILINE_STRING":return Z==="'''";case"RAW_HEREDOC":case"HEREDOC":return Z===";;"}}}class xX{constructor(Z,J=new v1,Q={},X=void 0){this.diags=[],this.source=Z,this.start=0,this.current=0,this.ast=J,this.modes=[],this.tokenInterner=B2.getInstance(),this.options={skipTrivia:Q.skipTrivia},this.db=X;let x=Q.trackScanner;this.trackScanTokens=x==="entrypoint"||x==="all",this.trackScanToken=x==="all",this.trackScanTokenStringMode=x==="all",this.trackScanTokenEmbeddedExpressionMode=x==="all",this.trackScanTokenByMode=x==="all"}advance(Z=1){return this.current+=Z,Z===1?this.source.charAt(this.current-1):this.source.slice(this.current-Z,this.current)}match(Z){return this.isAtEnd||this.source.charAt(this.current)!==Z?!1:(this.current+=1,!0)}advanceCharCode(Z=1){if(this.current+=Z,Z===1)return this.source.charCodeAt(this.current-1);let J=this.current-1;return J<this.source.length?this.source.charCodeAt(J):-1}matchCharCode(Z){return this.isAtEnd||this.source.charCodeAt(this.current)!==Z?!1:(this.current+=1,!0)}peek(Z=0){return this.current+Z>=this.source.length?"\x00":this.source.charAt(this.current+Z)}peekCharCode(Z=0){let J=this.current+Z;return J>=this.source.length?-1:this.source.charCodeAt(J)}getCharTypeAt(Z=0){return DI(this.peekCharCode(Z))}get isAtEnd(){return this.current>=this.source.length}constructToken(Z,J,Q){let X=nU0.get(Z),x=(X==null?void 0:X.text)??this.source.substring(this.start,this.current),q=J??(X==null?void 0:X.value)??x,Y=Q??(Z===w.NUMBER_LITERAL?x.includes("."):void 0),$=this.tokenInterner.getOrCreate(Z,x,q,Y);return new l1($,this.start)}exitMode(){let Z=this.modes[this.modes.length-1];switch(Z==null?void 0:Z.kind){case"SINGLE_QUOTE_STRING":case"DOUBLE_QUOTE_STRING":case"MULTILINE_STRING":case"HEREDOC":case"RAW_HEREDOC":break;case"EMBEDDED_EXPRESSION":{Z.shouldExit()&&this.modes.pop();break}}}scanTokens(){var Z,J,Q,X;this.trackScanTokens&&((J=this.db)==null||J.program.masterDb.markPerformanceStart("scanTokens",(Z=this.ast.filePath)==null?void 0:Z.toString()));let x=[],q=null,Y,$,z=()=>(Y||(Y=[]),Y),W=()=>($||($=[]),$),U=()=>{if(!q)return;let N=Y,_=$,j=N&&N.length>0?N:void 0,O=_&&_.length>0?_:void 0;q.flags=this.updateTokenFlagsForTrailingEOL(q.flags,_),this.options.skipTrivia?(q.leadingTrivia=void 0,q.trailingTrivia=void 0):(q.leadingTrivia=j,q.trailingTrivia=O),x.push(q),q=null,Y=void 0,$=void 0},H=(N)=>{q?(W().push(N),N.kind===w.END_OF_LINE&&U()):z().push(N)},B=(N)=>{if(RA(N)){H(N);return}N.kind!==w.INVALID&&(q&&U(),q=N)},M=(N)=>{if(Array.isArray(N)){N.forEach(B);return}B(N)};for(;!this.isAtEnd;){let N=this.scanTokenByMode();this.exitMode(),M(N),this.start=this.current}for(;this.modes.length!==0;){if(this.modes[this.modes.length-1].kind!=="EMBEDDED_EXPRESSION"){let N=this.constructToken(w.INVALID_STRING_END);M(N)}this.modes.pop()}let D=this.constructToken(w.EOF);return M(D),U(),this.trackScanTokens&&((X=this.db)==null||X.program.masterDb.markPerformanceEnd("scanTokens",(Q=this.ast.filePath)==null?void 0:Q.toString())),[x,this.diags]}scanTokenByMode(){var Z,J,Q,X,x,q,Y,$,z,W,U;let H=this.current;this.trackScanTokenByMode&&((Z=this.db)==null||Z.program.masterDb.markPerformanceStart("scanTokenByMode",H));let B;switch((J=this.modes[this.modes.length-1])==null?void 0:J.kind){case"SINGLE_QUOTE_STRING":case"DOUBLE_QUOTE_STRING":case"MULTILINE_STRING":case"HEREDOC":this.trackScanTokenStringMode&&((Q=this.db)==null||Q.program.masterDb.markPerformanceStart("scanTokenStringMode",H)),B=this.scanTokenStringMode({noEscape:!1}),this.trackScanTokenStringMode&&((X=this.db)==null||X.program.masterDb.markPerformanceEnd("scanTokenStringMode",H));break;case"RAW_HEREDOC":this.trackScanTokenStringMode&&((x=this.db)==null||x.program.masterDb.markPerformanceStart("scanTokenStringMode",H)),B=this.scanTokenStringMode({noEscape:!0}),this.trackScanTokenStringMode&&((q=this.db)==null||q.program.masterDb.markPerformanceEnd("scanTokenStringMode",H));break;case"EMBEDDED_EXPRESSION":this.trackScanTokenEmbeddedExpressionMode&&((Y=this.db)==null||Y.program.masterDb.markPerformanceStart("scanTokenEmbeddedExpressionMode",H)),B=this.scanTokenEmbeddedExpressionMode(),this.trackScanTokenEmbeddedExpressionMode&&(($=this.db)==null||$.program.masterDb.markPerformanceEnd("scanTokenEmbeddedExpressionMode",H));break;default:this.trackScanToken&&((z=this.db)==null||z.program.masterDb.markPerformanceStart("scanToken",H)),B=this.scanToken(),this.trackScanToken&&((W=this.db)==null||W.program.masterDb.markPerformanceEnd("scanToken",H));break}return this.trackScanTokenByMode&&((U=this.db)==null||U.program.masterDb.markPerformanceEnd("scanTokenByMode",H)),B}scanTokenEmbeddedExpressionMode(){let Z=this.scanToken();if(!(Z instanceof l1))return Z;let J=this.modes[this.modes.length-1];if(typeof Z.value=="string"&&Z.value.length===1){let Q=Z.value.charCodeAt(0);J.openBraceCnt-=Q===y0.RightBrace?1:0,J.openBraceCnt+=Q===y0.LeftBrace?1:0}return J.shouldExit()&&(Z=this.constructToken(w.CLOSE_EMBEDDED_EXPRESSION,"}")),Z}scanTokenStringMode(Z){let J=this.modes[this.modes.length-1],{kind:Q}=J,{source:X}=this,x=X.length,q=this.current,Y=!1,$,z=()=>{Y||(Y=!0,$=[],q<this.current&&$.push(X.substring(q,this.current)),q=this.current)},W=(U)=>{if(Y)return q<this.current&&($.push(X.substring(q,this.current)),q=this.current),$.join("")};for(;;){if(this.current>=x){let O=W();return this.handleStringEndAndGetTokens(O)}let U=-1,H;switch(Q){case"SINGLE_QUOTE_STRING":H="'",U=X.indexOf("'",this.current);break;case"DOUBLE_QUOTE_STRING":H='"',U=X.indexOf('"',this.current);break;case"MULTILINE_STRING":H="'''",U=X.indexOf("'''",this.current);break;case"HEREDOC":case"RAW_HEREDOC":H=";;",U=X.indexOf(";;",this.current);break}let B=X.indexOf("${",this.current),M=Z.noEscape?-1:X.indexOf("\\",this.current),D=Q==="SINGLE_QUOTE_STRING"||Q==="DOUBLE_QUOTE_STRING"?X.indexOf(`
141
141
  `,this.current):-1,N="eof",_=x,j=(O,A)=>{A!==-1&&A<_&&(N=O,_=A)};switch(j("close",U),j("dollar",B),j("escape",M),j("newline",D),_>this.current&&(Y&&q<_&&($.push(X.substring(q,_)),q=_),this.current=_),N){case"escape":{z(),$.push(this.escapeSequence()),q=this.current;break}case"dollar":{let O=W();return this.switchToEmbeddedExpressionModeAndGetTokens(O)}case"close":{let O=W();return this.handleStringEndAndGetTokens(O,H)}case"newline":{this.advanceCharCode();let O=W();return this.handleStringEndAndGetTokens(O)}case"eof":{let O=W();return this.handleStringEndAndGetTokens(O)}}}}handleStringEndAndGetTokens(Z,J){let Q=this.modes[this.modes.length-1];this.modes.pop();let X=[],x=this.start<this.current,q=Q.kind==="MULTILINE_STRING"?3:Q.kind==="HEREDOC"||Q.kind==="RAW_HEREDOC"?2:1,Y=!!J&&!x&&this.current===Q.start+q;return Z!==void 0?(Z!==""||Y)&&X.push(this.constructToken(w.MIDDLE_STRING_LITERAL,Z)):(x||Y)&&X.push(this.constructToken(w.MIDDLE_STRING_LITERAL)),this.start=this.current,J?(this.advanceCharCode(J.length),X.push(this.constructToken(w.STRING_END)),X):(X.push(this.constructToken(w.INVALID_STRING_END)),X)}switchToEmbeddedExpressionModeAndGetTokens(Z){let J=[];return Z!==void 0?Z!==""&&J.push(this.constructToken(w.MIDDLE_STRING_LITERAL,Z)):this.start<this.current&&J.push(this.constructToken(w.MIDDLE_STRING_LITERAL)),this.start=this.current,this.advanceCharCode(),this.advanceCharCode(),J.push(this.constructToken(w.OPEN_EMBEDDED_EXPRESSION)),this.modes.push(new ZZ("EMBEDDED_EXPRESSION",this.start,1)),J}scanToken(){let Z=this.advanceCharCode(),J=DI(Z);switch(Z){case y0.Space:return this.constructToken(w.WHITESPACE);case y0.CarriageReturn:return this.constructToken(w.CR);case y0.Tab:return this.constructToken(w.TAB);case y0.LineFeed:return this.constructToken(w.END_OF_LINE);case y0.LeftBrace:return this.constructToken(w.LBRACE);case y0.RightBrace:return this.constructToken(w.RBRACE);case y0.LeftBracket:return this.constructToken(w.LBRACKET);case y0.RightBracket:return this.constructToken(w.RBRACKET);case y0.LeftParen:return this.constructToken(w.LPAREN);case y0.RightParen:return this.constructToken(w.RPAREN);case y0.Colon:return this.matchCharCode(y0.Colon)?this.constructToken(w.OPERATOR):this.constructToken(w.COLON);case y0.Semicolon:return this.constructToken(w.SEMICOLON);case y0.Comma:return this.constructToken(w.COMMA);case y0.Equals:return this.matchCharCode(y0.GreaterThan)?this.constructToken(w.ARROW):(this.getCharTypeAt()&yU)!==0?this.operator(y0.Equals):this.constructToken(w.EQUAL);case y0.At:{let x=this.matchCharCode(y0.Tilde),q=this.constructToken(x?w.RAW_AT_SIGN:w.AT_SIGN);if(this.start=this.current,(this.getCharTypeAt()&bQ)===0)return q;let Y=this.identifier();return(this.getCharTypeAt()&mA)===0?[q,Y]:(this.start=this.current,this.modes.push(new ZZ(x?"RAW_HEREDOC":"HEREDOC",this.start)),this.matchCharCode(y0.Space),[q,Y,this.constructToken(w.STRING_START)])}case y0.Slash:if(this.matchCharCode(y0.Slash)){for(;this.peekCharCode()!==y0.LineFeed&&!this.isAtEnd;)this.advanceCharCode();return this.constructToken(w.SINGLE_LINE_COMMENT)}if(this.matchCharCode(y0.Asterisk)){let x=!1;for(;!this.isAtEnd;){if(this.peekCharCode()===y0.Asterisk&&this.peekCharCode(1)===y0.Slash){this.advanceCharCode(2),x=!0;break}this.advanceCharCode()}if(!x){let q={message:"Expected */",code:1000,category:g1.Error};this.diags.push(M1.createWithLocation(this.ast.filePath,this.current,this.current,q))}return this.constructToken(w.MULTILINE_COMMENT)}break;case y0.DoubleQuote:return this.modes.push(new ZZ("DOUBLE_QUOTE_STRING",this.start)),this.constructToken(w.STRING_START);case y0.Apostrophe:return this.peekCharCode()===y0.Apostrophe&&this.peekCharCode(1)===y0.Apostrophe?(this.advanceCharCode(),this.advanceCharCode(),this.modes.push(new ZZ("MULTILINE_STRING",this.start))):this.modes.push(new ZZ("SINGLE_QUOTE_STRING",this.start)),this.constructToken(w.STRING_START)}if((J&yU)!==0)return this.operator(Z);if((J&E7)!==0)return this.number();if((J&iU0)!==0)return this.identifier();let Q=this.constructToken(w.INVALID),X={message:`Unexpected '${Q.text}'`,code:1000,category:g1.Error};return this.diags.push(M1.createWithLocation(this.ast.filePath,this.start,this.current,X)),Q}escapeSequence(){this.advanceCharCode();let Z=this.advanceCharCode();switch(Z){case y0.Zero:return"\x00";case y0.LowerN:return`
142
142
  `;case y0.LowerB:return"\b";case y0.LowerT:return"\t";case y0.LowerV:return"\v";case y0.LowerF:return"\f";case y0.LowerR:return"\r";case y0.Apostrophe:return"'";case y0.DoubleQuote:return'"';case y0.LowerU:{let J="";for(let Q=0;Q<=3;Q+=1)if((this.getCharTypeAt()&(bQ|E7))!==0)J+=this.advance();else{let X={message:"Invalid Unicode escapes sequence",code:1000,category:g1.Error};return this.diags.push(M1.createWithLocation(this.ast.filePath,this.current,this.current,X)),`\\u${J}`}return String.fromCharCode(parseInt(J,16))}default:return String.fromCharCode(Z)}}number(){let Z;for(;(this.getCharTypeAt()&E7)!==0;)this.advanceCharCode();if(this.peekCharCode()===y0.Dot&&(this.getCharTypeAt(1)&E7)!==0)for(Z=!0,this.advanceCharCode();(this.getCharTypeAt()&E7)!==0;)this.advanceCharCode();return this.constructToken(w.NUMBER_LITERAL,Number(this.source.substring(this.start,this.current)),Z)}identifier(){for(;(this.getCharTypeAt()&dU0)!==0;)this.advanceCharCode();let Z=this.source.substring(this.start,this.current);return FI.has(Z)?this.constructToken(FI.get(Z)):Z==="true"?this.constructToken(w.TRUE_LITERAL,!0):Z==="false"?this.constructToken(w.FALSE_LITERAL,!1):this.constructToken(w.IDENTIFIER,Z)}operator(Z){switch(Z){case y0.Exclamation:case y0.Equals:this.peekCharCode()===y0.Equals&&this.advanceCharCode();break;case y0.LessThan:case y0.GreaterThan:this.peekCharCode()===y0.Equals&&this.advanceCharCode();break;case y0.VerticalBar:this.peekCharCode()===y0.VerticalBar&&this.advanceCharCode();break;case y0.Ampersand:this.peekCharCode()===y0.Ampersand&&this.advanceCharCode();break;case y0.Colon:this.peekCharCode()===y0.Colon&&this.advanceCharCode();break}return this.constructToken(w.OPERATOR)}updateTokenFlagsForTrailingEOL(Z,J){return!J||J.length===0?Z:J[J.length-1].kind===w.END_OF_LINE?Z|m5.HasTrailingEndOfLine:Z}}function RA(Z){switch(Z.kind){case w.WHITESPACE:case w.TAB:case w.CR:case w.END_OF_LINE:case w.SINGLE_LINE_COMMENT:case w.INVALID:case w.MULTILINE_COMMENT:return!0;default:return!1}}function NI(Z){switch(Z){case">":case"<":case"+":case"-":return{lbp:null,rbp:13};case"!":return{lbp:null,rbp:15.1};case"::":return{lbp:null,rbp:19};default:return!1}}function wI(Z){switch(Z){case"=":return{lbp:2,rbp:1};case"||":return{lbp:3,rbp:4};case"&&":return{lbp:4.1,rbp:4.2};case"|":return{lbp:4.3,rbp:4.4};case"==":case"!=":return{lbp:5,rbp:6};case"<":case"<=":case">":case">=":return{lbp:7,rbp:8};case"+":case"-":return{lbp:9,rbp:10};case"*":case"/":return{lbp:11,rbp:12};case".":return{lbp:17,rbp:18};default:return!1}}function GQ(Z){switch(Z){case"!":case"(":case"{":case":":return{lbp:15,rbp:null};default:return!1}}class Z3 extends Error{get offset(){return this.token.offset||0}constructor(Z,J){super(Z),this.name=this.constructor.name,this.token=J,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,Z3.prototype)}}class pQ extends Z3{constructor(Z,J,Q){super(Z,J),this.outerContextIndex=Q,Object.setPrototypeOf(this,pQ.prototype)}}var _2=((Z)=>(Z.ArgumentList="ArgumentList",Z.Argument="Argument",Z.Function="Function",Z.List="List",Z.Block="Block",Z.IfCondition="IfCondition",Z.TypeParameter="TypeParameter",Z.TypeReferenceExpression="TypeReferenceExpression",Z))(_2||{}),aU0={name:_2.Block,isSeparatorToken(Z){return[w.SEMICOLON,w.COLON].includes(Z.kind)},isTerminatorToken(Z){return Z.kind===w.RBRACE}},rU0={name:_2.List,isSeparatorToken(Z){return Z.kind===w.COMMA},isTerminatorToken(Z){return Z.kind===w.RBRACKET}},tU0={name:_2.IfCondition,isSeparatorToken(Z){return!1},isTerminatorToken(Z){return Z.kind===w.RPAREN}},eU0={name:_2.ArgumentList,isSeparatorToken(Z){return Z.kind===w.COMMA},isTerminatorToken(Z){return Z.kind===w.RPAREN}},ZH0=(Z)=>{switch(Z){case _2.Block:return aU0;case _2.IfCondition:return tU0;case _2.List:return rU0;case _2.ArgumentList:return eU0;default:throw new Error(`context name '${Z}' is invalid.`)}};class IA{constructor(){this.stack=[]}findOuterContext(Z){for(let J=this.stack.length-2;J>=0;J--){let Q=this.stack[J];if(Z(Q))return{context:Q,index:J}}return null}getPeekIndex(){return this.stack.length-1}withParsingContext(Z,J){return(...Q)=>{try{let X=ZH0(Z);return this.stack.push(X),J(...Q)}finally{this.stack.pop()}}}}var _I=1095584768,JH0=3,QH0=4294967295,TA=((Z)=>(Z[Z.Root=0]="Root",Z[Z.EqualityDeclaration=1]="EqualityDeclaration",Z[Z.ElementDeclaration=2]="ElementDeclaration",Z[Z.ElementProto=3]="ElementProto",Z[Z.FnDeclaration=4]="FnDeclaration",Z[Z.FnProto=5]="FnProto",Z[Z.TypeDeclaration=6]="TypeDeclaration",Z[Z.TypeProto=7]="TypeProto",Z[Z.Block=8]="Block",Z[Z.CallExpression=9]="CallExpression",Z[Z.PrefixExpression=10]="PrefixExpression",Z[Z.AbsoluteModuleAccessExpression=11]="AbsoluteModuleAccessExpression",Z[Z.InfixExpression=12]="InfixExpression",Z[Z.PropertyAccessExpression=13]="PropertyAccessExpression",Z[Z.Identifier=14]="Identifier",Z[Z.TypeParameter=15]="TypeParameter",Z[Z.PrimaryExpression=16]="PrimaryExpression",Z[Z.LiteralElementExpression=17]="LiteralElementExpression",Z[Z.Heredoc=18]="Heredoc",Z[Z.ListExpression=19]="ListExpression",Z[Z.BlockExpression=20]="BlockExpression",Z[Z.GroupExpression=21]="GroupExpression",Z[Z.IfExpression=22]="IfExpression",Z[Z.TemplateString=23]="TemplateString",Z[Z.EmbeddedExpression=24]="EmbeddedExpression",Z[Z.ArgumentExpression=25]="ArgumentExpression",Z[Z.ReturnTypeNode=26]="ReturnTypeNode",Z[Z.Decorator=27]="Decorator",Z[Z.UseDeclaration=28]="UseDeclaration",Z))(TA||{}),XH0=[w.STRING_START,w.MIDDLE_STRING_LITERAL,w.STRING_END,w.OPEN_EMBEDDED_EXPRESSION,w.CLOSE_EMBEDDED_EXPRESSION,w.INVALID_STRING_END,w.STRING_END,w.MIDDLE_STRING_LITERAL,w.NUMBER_LITERAL,w.TRUE_LITERAL,w.FALSE_LITERAL,w.CONST_KEYWORD,w.TYPE_KEYWORD,w.FUNC_KEYWORD,w.USE_KEYWORD,w.LBRACE,w.RBRACE,w.LPAREN,w.RPAREN,w.LBRACKET,w.RBRACKET,w.COLON,w.SEMICOLON,w.COMMA,w.EQUAL,w.ARROW,w.AT_SIGN,w.RAW_AT_SIGN,w.HEREDOC_CONTENT,w.IDENTIFIER,w.IF_KEYWORD,w.ELSE_KEYWORD,w.HEREDOC,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.OPERATOR,w.INVALID,w.EOF],xH0=[w.WHITESPACE,w.TAB,w.CR,w.END_OF_LINE,w.SINGLE_LINE_COMMENT,w.MULTILINE_COMMENT,w.HEREDOC];class vA{constructor(Z){this.offset=0,this.view=new DataView(Z.buffer,Z.byteOffset,Z.byteLength)}readU32(){let Z=this.view.getUint32(this.offset,!0);return this.offset+=4,Z}readU8(){return this.view.getUint8(this.offset++)}skip(Z){this.offset+=Z}getOffset(){return this.offset}setOffset(Z){this.offset=Z}}function u4(Z){return Z!==QH0}function BQ(Z){return(4-Z%4)%4}class uU{constructor(Z,J){this.numTrivia=0,this.numTokenTrivia=0,this.isRawHeredoc=!1,this.source=J,this.tokenInterner=B2.getInstance();let Q=new vA(Z),X=Q.readU32();if(X!==_I)throw new Error(`Invalid magic bytes: expected 0x${_I.toString(16)}, got 0x${X.toString(16)}`);let x=Q.readU32();if(x!==JH0)throw new Error(`Unsupported protocol version: ${x}`);this.numNodes=Q.readU32(),this.numTokens=Q.readU32(),this.numTrivia=Q.readU32(),this.numTokenTrivia=Q.readU32();let q=Q.readU32();Q.readU32();let Y=Q.getOffset(),$=this.numNodes,z=BQ($),W=this.numNodes*3*4,U=q*4,H=this.numTokens,B=BQ(H),M=this.numTokens*4*2,D=this.numTokens,N=this.numNodes*4,_=this.numNodes*4,j=this.numTrivia,O=this.numTokenTrivia,A=BQ(j),h=Y+$+z+W+U+H+B+M+D+N+_+j+A+j*4*2+O*4*4+H*4;if(Z.byteLength<h)throw new Error(`Invalid AST blob: expected at least ${h} bytes, got ${Z.byteLength}`);let u=Y;this.nodeTags=new Uint8Array(Z.buffer,Z.byteOffset+u,this.numNodes),u+=$+z,this.nodeData=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numNodes*3),u+=W,this.extraData=new Uint32Array(Z.buffer,Z.byteOffset+u,q),u+=U,this.tokenTags=new Uint8Array(Z.buffer,Z.byteOffset+u,this.numTokens),u+=H+B,this.tokenStarts=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numTokens),u+=this.numTokens*4,this.tokenEnds=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numTokens),u+=this.numTokens*4,this.tokenExtraFlags=new Uint8Array(Z.buffer,Z.byteOffset+u,this.numTokens),u+=D+BQ(D),this.nodeStarts=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numNodes),u+=N,this.nodeEnds=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numNodes),u+=_,this.triviaTags=new Uint8Array(Z.buffer,Z.byteOffset+u,j),u+=j+BQ(j),this.triviaStarts=new Uint32Array(Z.buffer,Z.byteOffset+u,j),u+=j*4,this.triviaEnds=new Uint32Array(Z.buffer,Z.byteOffset+u,j),u+=j*4,this.tokenTriviaMapping=new Uint32Array(Z.buffer,Z.byteOffset+u,O*4),u+=O*4*4,this.tokenTriviaIndices=new Uint32Array(Z.buffer,Z.byteOffset+u,this.numTokens),u+=this.numTokens*4}getTokenText(Z){let J=this.tokenStarts[Z],Q=this.tokenEnds[Z];return this.source.substring(J,Q)}unescapeString(Z){if(!Z.includes("\\"))return Z;let J="",Q=0;for(;Q<Z.length;)if(Z[Q]==="\\"&&Q+1<Z.length){let X=Z[Q+1];switch(X){case"0":J+="\x00",Q+=2;break;case"n":J+=`