@seanhogg/builderforce-webcontainers 2026.10.10 → 2026.10.11

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.
@@ -1,72 +1,72 @@
1
- "use strict";(()=>{var Ta=Object.defineProperty;var La=(t,e,r)=>e in t?Ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var m=(t,e,r)=>La(t,typeof e!="symbol"?e+"":e,r);function O(t){let e=[];for(let r of t.replace(/\\/g,"/").split("/"))!r||r==="."||(r===".."?e.pop():e.push(r));return"/"+e.join("/")}function $(t){let e=O(t),r=e.lastIndexOf("/");return r<=0?"/":e.slice(0,r)}function ze(t){let e=O(t);return e.slice(e.lastIndexOf("/")+1)}function k(...t){return O(t.join("/"))}function Qt(t){let e=ze(t),r=e.lastIndexOf(".");return r<=0?"":e.slice(r).toLowerCase()}var Ma=new TextDecoder,kt=class{constructor(){m(this,"files",new Map);m(this,"versions",new Map);m(this,"mtimes",new Map);m(this,"children",new Map([["/",new Set]]));m(this,"explicit",new Set);m(this,"listeners",new Set);m(this,"clock",0)}writeFile(e,r){let n=O(e);if(n==="/"||this.children.has(n))throw new Error(`EISDIR: illegal operation on a directory, open '${n}'`);let s=!this.files.has(n);s&&this.link(n),this.files.set(n,r),this.versions.set(n,++this.clock),this.mtimes.set(n,Date.now()),this.emit({type:"write",path:n,created:s})}readFile(e){return this.files.get(O(e))}readText(e){let r=this.readFile(e);if(r!==void 0)return typeof r=="string"?r:Ma.decode(r)}isFile(e){return this.files.has(O(e))}isDirectory(e){return this.children.has(O(e))}exists(e){return this.isFile(e)||this.isDirectory(e)}mkdir(e){let r=O(e);if(this.files.has(r))throw new Error(`EEXIST: file already exists, mkdir '${r}'`);if(r==="/")return;let n=this.children.has(r);this.explicit.add(r),!n&&(this.ensureDir(r),this.emit({type:"mkdir",path:r}))}readdir(e){return[...this.children.get(O(e))??[]].sort()}entries(e){let r=O(e);return this.readdir(r).map(n=>({name:n,kind:this.children.has(k(r,n))?"directory":"file"}))}rename(e,r){let n=O(e),s=O(r);if(n===s)return;if(!this.exists(n))throw new Error(`ENOENT: no such file or directory, rename '${n}' -> '${s}'`);if(this.exists(s))throw new Error(`EEXIST: file already exists, rename '${n}' -> '${s}'`);if(s.startsWith(n+"/"))throw new Error(`EINVAL: cannot move '${n}' into itself`);if(this.files.has(n)){let c=this.files.get(n);this.removeFile(n),this.writeFile(s,c);return}let i=n+"/",o=[...this.files].filter(([c])=>c.startsWith(i)),a=[...this.explicit].filter(c=>c===n||c.startsWith(i));this.rm(n),this.mkdir(s);for(let c of a)this.mkdir(s+c.slice(n.length));for(let[c,u]of o)this.writeFile(s+c.slice(n.length),u)}list(){return[...this.files.keys()].sort()}explicitDirectories(){return[...this.explicit].sort()}rm(e){let r=O(e);if(this.files.has(r)){this.removeFile(r);return}if(!this.children.has(r))return;for(let s of[...this.children.get(r)??[]])this.rm(r==="/"?"/"+s:`${r}/${s}`);if(r==="/")return;let n=this.explicit.delete(r);this.children.has(r)&&this.unlinkDir(r),n&&this.emit({type:"remove",path:r})}version(e){return this.versions.get(O(e))}mtime(e){return this.mtimes.get(O(e))}writeTree(e,r="/"){for(let[n,s]of Object.entries(e)){let i=k(r,n);typeof s=="string"||s instanceof Uint8Array?this.writeFile(i,s):(this.mkdir(i),this.writeTree(s,i))}}toFlat(){let e={};for(let[r,n]of this.files)e[r.slice(1)]=n;return e}watch(e,r={}){let n=r.under===void 0?void 0:O(r.under),s=n===void 0||n==="/"?e:i=>(i.path===n||i.path.startsWith(n+"/"))&&e(i);return this.listeners.add(s),()=>this.listeners.delete(s)}removeFile(e){this.files.delete(e),this.versions.delete(e),this.mtimes.delete(e),this.unlink(e),this.emit({type:"remove",path:e})}link(e){let r=$(e);this.ensureDir(r),this.children.get(r).add(e.slice(e.lastIndexOf("/")+1))}ensureDir(e){if(!this.children.has(e)){if(this.files.has(e))throw new Error(`ENOTDIR: not a directory, '${e}'`);this.children.set(e,new Set),this.link(e)}}unlink(e){let r=$(e),n=this.children.get(r);n&&(n.delete(e.slice(e.lastIndexOf("/")+1)),n.size===0&&r!=="/"&&!this.explicit.has(r)&&this.unlinkDir(r))}unlinkDir(e){this.children.delete(e),this.unlink(e)}emit(e){for(let r of this.listeners)r(e)}};var K=Uint8Array,de=Uint16Array,on=Int32Array,Zt=new K([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Xt=new K([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),tn=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ys=function(t,e){for(var r=new de(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var s=new on(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)s[i]=i-r[n]<<5|n;return{b:r,r:s}},Es=ys(Zt,2),bs=Es.b,rn=Es.r;bs[28]=258,rn[258]=28;var Cs=ys(Xt,0),Fa=Cs.b,gs=Cs.r,nn=new de(32768);for(F=0;F<32768;++F)_e=(F&43690)>>1|(F&21845)<<1,_e=(_e&52428)>>2|(_e&13107)<<2,_e=(_e&61680)>>4|(_e&3855)<<4,nn[F]=((_e&65280)>>8|(_e&255)<<8)>>1;var _e,F,Se=function(t,e,r){for(var n=t.length,s=0,i=new de(e);s<n;++s)t[s]&&++i[t[s]-1];var o=new de(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var a;if(r){a=new de(1<<e);var c=15-e;for(s=0;s<n;++s)if(t[s])for(var u=s<<4|t[s],f=e-t[s],l=o[t[s]-1]++<<f,d=l|(1<<f)-1;l<=d;++l)a[nn[l]>>c]=u}else for(a=new de(n),s=0;s<n;++s)t[s]&&(a[s]=nn[o[t[s]-1]++]>>15-t[s]);return a},Ue=new K(288);for(F=0;F<144;++F)Ue[F]=8;var F;for(F=144;F<256;++F)Ue[F]=9;var F;for(F=256;F<280;++F)Ue[F]=7;var F;for(F=280;F<288;++F)Ue[F]=8;var F,Ot=new K(32);for(F=0;F<32;++F)Ot[F]=5;var F,$a=Se(Ue,9,0),Ua=Se(Ue,9,1),Pa=Se(Ot,5,0),ja=Se(Ot,5,1),Zr=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},ge=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},Xr=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},er=function(t){return(t+7)/8|0},Dt=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new K(t.subarray(e,r))};var Ka=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],z=function(t,e,r){var n=new Error(e||Ka[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,z),!r)throw n;return n},tr=function(t,e,r,n){var s=t.length,i=n?n.length:0;if(!s||e.f&&!e.l)return r||new K(0);var o=!r,a=o||e.i!=2,c=e.i;o&&(r=new K(s*3));var u=function(Bt){var It=r.length;if(Bt>It){var at=new K(Math.max(It*2,Bt));at.set(r),r=at}},f=e.f||0,l=e.p||0,d=e.b||0,h=e.l,p=e.d,y=e.m,b=e.n,E=s*8;do{if(!h){f=ge(t,l,1);var C=ge(t,l+1,3);if(l+=3,C)if(C==1)h=Ua,p=ja,y=9,b=5;else if(C==2){var S=ge(t,l,31)+257,I=ge(t,l+10,15)+4,v=S+ge(t,l+5,31)+1;l+=14;for(var B=new K(v),Q=new K(19),_=0;_<I;++_)Q[tn[_]]=ge(t,l+_*3,7);l+=I*3;for(var N=Zr(Q),L=(1<<N)-1,J=Se(Q,N,1),_=0;_<v;){var te=J[ge(t,l,L)];l+=te&15;var A=te>>4;if(A<16)B[_++]=A;else{var G=0,j=0;for(A==16?(j=3+ge(t,l,3),l+=2,G=B[_-1]):A==17?(j=3+ge(t,l,7),l+=3):A==18&&(j=11+ge(t,l,127),l+=7);j--;)B[_++]=G}}var re=B.subarray(0,S),q=B.subarray(S);y=Zr(re),b=Zr(q),h=Se(re,y,1),p=Se(q,b,1)}else z(1);else{var A=er(l)+4,g=t[A-4]|t[A-3]<<8,w=A+g;if(w>s){c&&z(0);break}a&&u(d+g),r.set(t.subarray(A,w),d),e.b=d+=g,e.p=l=w*8,e.f=f;continue}if(l>E){c&&z(0);break}}a&&u(d+131072);for(var le=(1<<y)-1,Y=(1<<b)-1,be=l;;be=l){var G=h[Xr(t,l)&le],fe=G>>4;if(l+=G&15,l>E){c&&z(0);break}if(G||z(2),fe<256)r[d++]=fe;else if(fe==256){be=l,h=null;break}else{var ue=fe-254;if(fe>264){var _=fe-257,W=Zt[_];ue=ge(t,l,(1<<W)-1)+bs[_],l+=W}var Ce=p[Xr(t,l)&Y],it=Ce>>4;Ce||z(3),l+=Ce&15;var q=Fa[it];if(it>3){var W=Xt[it];q+=Xr(t,l)&(1<<W)-1,l+=W}if(l>E){c&&z(0);break}a&&u(d+131072);var ot=d+ue;if(d<q){var Gt=i-q,Yt=Math.min(q,ot);for(Gt+d<0&&z(3);d<Yt;++d)r[d]=n[Gt+d]}for(;d<ot;++d)r[d]=r[d-q]}}e.l=h,e.p=be,e.b=d,e.f=f,h&&(f=1,e.m=y,e.d=p,e.n=b)}while(!f);return d!=r.length&&o?Dt(r,0,d):r.subarray(0,d)},De=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},xt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8,t[n+2]|=r>>16},en=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,i=r.slice();if(!s)return{t:Vt,l:0};if(s==1){var o=new K(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(w,S){return w.f-S.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],u=0,f=1,l=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};f!=s-1;)a=r[r[u].f<r[l].f?u++:l++],c=r[u!=f&&r[u].f<r[l].f?u++:l++],r[f++]={s:-1,f:a.f+c.f,l:a,r:c};for(var d=i[0].s,n=1;n<s;++n)i[n].s>d&&(d=i[n].s);var h=new de(d+1),p=sn(r[f-1],h,0);if(p>e){var n=0,y=0,b=p-e,E=1<<b;for(i.sort(function(S,I){return h[I.s]-h[S.s]||S.f-I.f});n<s;++n){var C=i[n].s;if(h[C]>e)y+=E-(1<<p-h[C]),h[C]=e;else break}for(y>>=b;y>0;){var A=i[n].s;h[A]<e?y-=1<<e-h[A]++-1:++n}for(;n>=0&&y;--n){var g=i[n].s;h[g]==e&&(--h[g],++y)}p=e}return{t:new K(h),l:p}},sn=function(t,e,r){return t.s==-1?Math.max(sn(t.l,e,r+1),sn(t.r,e,r+1)):e[t.s]=r},ms=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new de(++e),n=0,s=t[0],i=1,o=function(c){r[n++]=c},a=1;a<=e;++a)if(t[a]==s&&a!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[a]}return{c:r.subarray(0,n),n:e}},_t=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},an=function(t,e,r){var n=r.length,s=er(e+2);t[s]=n&255,t[s+1]=n>>8,t[s+2]=t[s]^255,t[s+3]=t[s+1]^255;for(var i=0;i<n;++i)t[s+i+4]=r[i];return(s+4+n)*8},ws=function(t,e,r,n,s,i,o,a,c,u,f){De(e,f++,r),++s[256];for(var l=en(s,15),d=l.t,h=l.l,p=en(i,15),y=p.t,b=p.l,E=ms(d),C=E.c,A=E.n,g=ms(y),w=g.c,S=g.n,I=new de(19),v=0;v<C.length;++v)++I[C[v]&31];for(var v=0;v<w.length;++v)++I[w[v]&31];for(var B=en(I,7),Q=B.t,_=B.l,N=19;N>4&&!Q[tn[N-1]];--N);var L=u+5<<3,J=_t(s,Ue)+_t(i,Ot)+o,te=_t(s,d)+_t(i,y)+o+14+3*N+_t(I,Q)+2*I[16]+3*I[17]+7*I[18];if(c>=0&&L<=J&&L<=te)return an(e,f,t.subarray(c,c+u));var G,j,re,q;if(De(e,f,1+(te<J)),f+=2,te<J){G=Se(d,h,0),j=d,re=Se(y,b,0),q=y;var le=Se(Q,_,0);De(e,f,A-257),De(e,f+5,S-1),De(e,f+10,N-4),f+=14;for(var v=0;v<N;++v)De(e,f+3*v,Q[tn[v]]);f+=3*N;for(var Y=[C,w],be=0;be<2;++be)for(var fe=Y[be],v=0;v<fe.length;++v){var ue=fe[v]&31;De(e,f,le[ue]),f+=Q[ue],ue>15&&(De(e,f,fe[v]>>5&127),f+=fe[v]>>12)}}else G=$a,j=Ue,re=Pa,q=Ot;for(var v=0;v<a;++v){var W=n[v];if(W>255){var ue=W>>18&31;xt(e,f,G[ue+257]),f+=j[ue+257],ue>7&&(De(e,f,W>>23&31),f+=Zt[ue]);var Ce=W&31;xt(e,f,re[Ce]),f+=q[Ce],Ce>3&&(xt(e,f,W>>5&8191),f+=Xt[Ce])}else xt(e,f,G[W]),f+=j[W]}return xt(e,f,G[256]),f+j[256]},Ha=new on([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vt=new K(0),Wa=function(t,e,r,n,s,i){var o=i.z||t.length,a=new K(n+o+5*(1+Math.ceil(o/7e3))+s),c=a.subarray(n,a.length-s),u=i.l,f=(i.r||0)&7;if(e){f&&(c[0]=i.r>>3);for(var l=Ha[e-1],d=l>>13,h=l&8191,p=(1<<r)-1,y=i.p||new de(32768),b=i.h||new de(p+1),E=Math.ceil(r/3),C=2*E,A=function(Vr){return(t[Vr]^t[Vr+1]<<E^t[Vr+2]<<C)&p},g=new on(25e3),w=new de(288),S=new de(32),I=0,v=0,B=i.i||0,Q=0,_=i.w||0,N=0;B+2<o;++B){var L=A(B),J=B&32767,te=b[L];if(y[J]=te,b[L]=J,_<=B){var G=o-B;if((I>7e3||Q>24576)&&(G>423||!u)){f=ws(t,c,0,g,w,S,v,Q,N,B-N,f),Q=I=v=0,N=B;for(var j=0;j<286;++j)w[j]=0;for(var j=0;j<30;++j)S[j]=0}var re=2,q=0,le=h,Y=J-te&32767;if(G>2&&L==A(B-Y))for(var be=Math.min(d,G)-1,fe=Math.min(32767,B),ue=Math.min(258,G);Y<=fe&&--le&&J!=te;){if(t[B+re]==t[B+re-Y]){for(var W=0;W<ue&&t[B+W]==t[B+W-Y];++W);if(W>re){if(re=W,q=Y,W>be)break;for(var Ce=Math.min(Y,W-2),it=0,j=0;j<Ce;++j){var ot=B-Y+j&32767,Gt=y[ot],Yt=ot-Gt&32767;Yt>it&&(it=Yt,te=ot)}}}J=te,te=y[J],Y+=J-te&32767}if(q){g[Q++]=268435456|rn[re]<<18|gs[q];var Bt=rn[re]&31,It=gs[q]&31;v+=Zt[Bt]+Xt[It],++w[257+Bt],++S[It],_=B+re,++I}else g[Q++]=t[B],++w[t[B]]}}for(B=Math.max(B,_);B<o;++B)g[Q++]=t[B],++w[t[B]];f=ws(t,c,u,g,w,S,v,Q,N,B-N,f),u||(i.r=f&7|c[f/8|0]<<3,f-=7,i.h=b,i.p=y,i.i=B,i.w=_)}else{for(var B=i.w||0;B<o+u;B+=65535){var at=B+65535;at>=o&&(c[f/8|0]=u,at=o),f=an(c,f+1,t.subarray(B,at))}i.i=o}return Dt(a,0,n+er(f)+s)},Ja=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var r=e,n=9;--n;)r=(r&1&&-306674912)^r>>>1;t[e]=r}return t}(),vs=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=Ja[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}},cn=function(){var t=1,e=0;return{p:function(r){for(var n=t,s=e,i=r.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)s+=n+=r[o];n=(n&65535)+15*(n>>16),s=(s&65535)+15*(s>>16)}t=n,e=s},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},ct=function(t,e,r,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new K(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return Wa(t,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,r,n,s)};var Pe=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Ss=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Pe(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var n=0;n<=r.length;++n)t[n+10]=r.charCodeAt(n)}},Bs=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&z(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=(t[10]|t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(e&2)},qa=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},Is=function(t){return 10+(t.filename?t.filename.length+1:0)},Qs=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;if(t[0]=120,t[1]=n<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var s=cn();s.p(e.dictionary),Pe(t,2,s.d())}},ks=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&z(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&z(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function za(t,e){return typeof t=="function"&&(e=t,t={}),this.ondata=e,t}var $e=function(){function t(e,r){if(typeof e=="function"&&(r=e,e={}),this.ondata=r,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new K(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(e,r){this.ondata(ct(e,this.o,0,0,this.s),r)},t.prototype.push=function(e,r){this.ondata||z(5),this.s.l&&z(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new K(n&-32768);s.set(this.b.subarray(0,this.s.z)),this.b=s}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=r&1,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2),r&&(this.s=this.o={},this.b=Vt)},t.prototype.flush=function(e){if(this.ondata||z(5),this.s.l&&z(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var r=new K(6);r[0]=this.s.r>>3;var n=an(r,this.s.r,Vt);this.s.r=0,this.ondata(r.subarray(0,n>>3),!1)}},t}();function xs(t,e){return ct(t,e||{},0,0)}var ve=function(){function t(e,r){typeof e=="function"&&(r=e,e={}),this.ondata=r;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new K(32768),this.p=new K(0),n&&this.o.set(n)}return t.prototype.e=function(e){if(this.ondata||z(5),this.d&&z(4),!this.p.length)this.p=e;else if(e.length){var r=new K(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length),this.p=r}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var r=this.s.b,n=tr(this.p,this.s,this.o);this.ondata(Dt(n,r,this.s.b),this.d),this.o=Dt(n,this.s.b-32768),this.s.b=this.o.length,this.p=Dt(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,r){this.e(e),this.c(r)},t}();function ln(t,e){return tr(t,{i:2},e&&e.out,e&&e.dictionary)}var _s=function(){function t(e,r){this.c=vs(),this.l=0,this.v=1,$e.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),this.l+=e.length,$e.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=ct(e,this.o,this.v&&Is(this.o),r&&8,this.s);this.v&&(Ss(n,this.o),this.v=0),r&&(Pe(n,n.length-8,this.c.d()),Pe(n,n.length-4,this.l)),this.ondata(n,r)},t.prototype.flush=function(e){$e.prototype.flush.call(this,e)},t}();function Ds(t,e){e||(e={});var r=vs(),n=t.length;r.p(t);var s=ct(t,e,Is(e),8),i=s.length;return Ss(s,e),Pe(s,i-8,r.d()),Pe(s,i-4,n),s}var fn=function(){function t(e,r){this.v=1,this.r=0,ve.call(this,e,r)}return t.prototype.push=function(e,r){if(ve.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),s=n.length>3?Bs(n):4;if(s>n.length){if(!r)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(s),this.v=0}ve.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=er(this.s.p)+9,this.s={i:0},this.o=new K(0),this.push(new K(0),r)):r&&ve.prototype.c.call(this,r)},t}();function Nt(t,e){var r=Bs(t);return r+8>t.length&&z(6,"invalid gzip data"),tr(t.subarray(r,-8),{i:2},e&&e.out||new K(qa(t)),e&&e.dictionary)}var Os=function(){function t(e,r){this.c=cn(),this.v=1,$e.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),$e.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=ct(e,this.o,this.v&&(this.o.dictionary?6:2),r&&4,this.s);this.v&&(Qs(n,this.o),this.v=0),r&&Pe(n,n.length-4,this.c.d()),this.ondata(n,r)},t.prototype.flush=function(e){$e.prototype.flush.call(this,e)},t}();function Ns(t,e){e||(e={});var r=cn();r.p(t);var n=ct(t,e,e.dictionary?6:2,4);return Qs(n,e),Pe(n,n.length-4,r.d()),n}var un=function(){function t(e,r){ve.call(this,e,r),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,r){if(ve.prototype.e.call(this,e),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(ks(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&z(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),ve.prototype.c.call(this,r)},t}();function dn(t,e){return tr(t.subarray(ks(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Rs=function(){function t(e,r){this.o=za.call(this,e,r)||{},this.G=fn,this.I=ve,this.Z=un}return t.prototype.i=function(){var e=this;this.s.ondata=function(r,n){e.ondata(r,n)}},t.prototype.push=function(e,r){if(this.ondata||z(5),this.s)this.s.push(e,r);else{if(this.p&&this.p.length){var n=new K(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,r),this.p=null)}},t}();function Ts(t,e){return t[0]==31&&t[1]==139&&t[2]==8?Nt(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?ln(t,e):dn(t,e)}var Ga=typeof TextDecoder<"u"&&new TextDecoder,Ya=0;try{Ga.decode(Vt,{stream:!0}),Ya=1}catch{}function Ls(t){let e={};for(let r of t.split(/\r?\n/)){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let i=n.slice(0,s).replace(/^export\s+/,"").trim(),o=n.slice(s+1).trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),e[i]=o}return e}function Ms(t){let e=t.split("/"),r=t.startsWith("@")?2:1;return{name:e.slice(0,r).join("/"),subpath:e.length>r?"/"+e.slice(r).join("/"):""}}var Za=[{dependency:"next",reason:"Next.js needs its Node server."},{dependency:"nuxt",reason:"Nuxt needs its Node server."},{dependency:"@remix-run/dev",reason:"Remix needs its Node server."},{dependency:"@sveltejs/kit",reason:"SvelteKit needs its Node server."},{dependency:"astro",reason:"Astro needs its build pipeline."}];function Xa(t){try{let e=JSON.parse(t.readText("/package.json")??"{}");return new Set([...Object.keys(e.dependencies??{}),...Object.keys(e.devDependencies??{})])}catch{return new Set}}function Fs(t){let e=Xa(t);return Za.find(r=>e.has(r.dependency))?.reason}var $s;(function(t){t[t.Static=1]="Static",t[t.Dynamic=2]="Dynamic",t[t.ImportMeta=3]="ImportMeta",t[t.StaticSourcePhase=4]="StaticSourcePhase",t[t.DynamicSourcePhase=5]="DynamicSourcePhase",t[t.StaticDeferPhase=6]="StaticDeferPhase",t[t.DynamicDeferPhase=7]="DynamicDeferPhase"})($s||($s={}));var ec=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function Rt(t,e="@"){if(!P)return hn.then(()=>Rt(t));let r=t.length+1,n=(P.__heap_base.value||P.__heap_base)+4*r-P.memory.buffer.byteLength;n>0&&P.memory.grow(Math.ceil(n/65536));let s=P.sa(r-1);if((ec?rc:tc)(t,new Uint16Array(P.memory.buffer,s,r)),!P.parse())throw Object.assign(new Error(`Parse error ${e}:${t.slice(0,P.e()).split(`
1
+ "use strict";(()=>{var Fa=Object.defineProperty;var Ma=(t,e,r)=>e in t?Fa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var m=(t,e,r)=>Ma(t,typeof e!="symbol"?e+"":e,r);function O(t){let e=[];for(let r of t.replace(/\\/g,"/").split("/"))!r||r==="."||(r===".."?e.pop():e.push(r));return"/"+e.join("/")}function $(t){let e=O(t),r=e.lastIndexOf("/");return r<=0?"/":e.slice(0,r)}function ze(t){let e=O(t);return e.slice(e.lastIndexOf("/")+1)}function k(...t){return O(t.join("/"))}function kt(t){let e=ze(t),r=e.lastIndexOf(".");return r<=0?"":e.slice(r).toLowerCase()}var $a=new TextDecoder,Ge=class{constructor(){m(this,"files",new Map);m(this,"versions",new Map);m(this,"mtimes",new Map);m(this,"children",new Map([["/",new Set]]));m(this,"explicit",new Set);m(this,"listeners",new Set);m(this,"clock",0)}writeFile(e,r){let n=O(e);if(n==="/"||this.children.has(n))throw new Error(`EISDIR: illegal operation on a directory, open '${n}'`);let s=!this.files.has(n);s&&this.link(n),this.files.set(n,r),this.versions.set(n,++this.clock),this.mtimes.set(n,Date.now()),this.emit({type:"write",path:n,created:s})}readFile(e){return this.files.get(O(e))}readText(e){let r=this.readFile(e);if(r!==void 0)return typeof r=="string"?r:$a.decode(r)}isFile(e){return this.files.has(O(e))}isDirectory(e){return this.children.has(O(e))}exists(e){return this.isFile(e)||this.isDirectory(e)}mkdir(e){let r=O(e);if(this.files.has(r))throw new Error(`EEXIST: file already exists, mkdir '${r}'`);if(r==="/")return;let n=this.children.has(r);this.explicit.add(r),!n&&(this.ensureDir(r),this.emit({type:"mkdir",path:r}))}readdir(e){return[...this.children.get(O(e))??[]].sort()}entries(e){let r=O(e);return this.readdir(r).map(n=>({name:n,kind:this.children.has(k(r,n))?"directory":"file"}))}rename(e,r){let n=O(e),s=O(r);if(n===s)return;if(!this.exists(n))throw new Error(`ENOENT: no such file or directory, rename '${n}' -> '${s}'`);if(this.exists(s))throw new Error(`EEXIST: file already exists, rename '${n}' -> '${s}'`);if(s.startsWith(n+"/"))throw new Error(`EINVAL: cannot move '${n}' into itself`);if(this.files.has(n)){let c=this.files.get(n);this.removeFile(n),this.writeFile(s,c);return}let i=n+"/",o=[...this.files].filter(([c])=>c.startsWith(i)),a=[...this.explicit].filter(c=>c===n||c.startsWith(i));this.rm(n),this.mkdir(s);for(let c of a)this.mkdir(s+c.slice(n.length));for(let[c,u]of o)this.writeFile(s+c.slice(n.length),u)}list(){return[...this.files.keys()].sort()}explicitDirectories(){return[...this.explicit].sort()}rm(e){let r=O(e);if(this.files.has(r)){this.removeFile(r);return}if(!this.children.has(r))return;for(let s of[...this.children.get(r)??[]])this.rm(r==="/"?"/"+s:`${r}/${s}`);if(r==="/")return;let n=this.explicit.delete(r);this.children.has(r)&&this.unlinkDir(r),n&&this.emit({type:"remove",path:r})}version(e){return this.versions.get(O(e))}mtime(e){return this.mtimes.get(O(e))}writeTree(e,r="/"){for(let[n,s]of Object.entries(e)){let i=k(r,n);typeof s=="string"||s instanceof Uint8Array?this.writeFile(i,s):(this.mkdir(i),this.writeTree(s,i))}}toFlat(){let e={};for(let[r,n]of this.files)e[r.slice(1)]=n;return e}watch(e,r={}){let n=r.under===void 0?void 0:O(r.under),s=n===void 0||n==="/"?e:i=>(i.path===n||i.path.startsWith(n+"/"))&&e(i);return this.listeners.add(s),()=>this.listeners.delete(s)}removeFile(e){this.files.delete(e),this.versions.delete(e),this.mtimes.delete(e),this.unlink(e),this.emit({type:"remove",path:e})}link(e){let r=$(e);this.ensureDir(r),this.children.get(r).add(e.slice(e.lastIndexOf("/")+1))}ensureDir(e){if(!this.children.has(e)){if(this.files.has(e))throw new Error(`ENOTDIR: not a directory, '${e}'`);this.children.set(e,new Set),this.link(e)}}unlink(e){let r=$(e),n=this.children.get(r);n&&(n.delete(e.slice(e.lastIndexOf("/")+1)),n.size===0&&r!=="/"&&!this.explicit.has(r)&&this.unlinkDir(r))}unlinkDir(e){this.children.delete(e),this.unlink(e)}emit(e){for(let r of this.listeners)r(e)}};var Zr=class extends Ge{constructor(r,n){super();m(this,"base");m(this,"root");m(this,"prefix");this.base=r,this.root=n,this.prefix=n+"/"}real(r){let n=O(r);return n==="/"?this.root:this.root+n}local(r){return r===this.root?"/":r.slice(this.root.length)}writeFile(r,n){if(O(r)==="/")throw new Error("EISDIR: illegal operation on a directory, open '/'");this.base.writeFile(this.real(r),n)}readFile(r){return this.base.readFile(this.real(r))}isFile(r){return this.base.isFile(this.real(r))}isDirectory(r){return O(r)==="/"||this.base.isDirectory(this.real(r))}mkdir(r){O(r)!=="/"&&this.base.mkdir(this.real(r))}readdir(r){return this.base.readdir(this.real(r))}entries(r){return this.base.entries(this.real(r))}rename(r,n){this.base.rename(this.real(r),this.real(n))}list(){return this.base.list().filter(r=>r.startsWith(this.prefix)).map(r=>this.local(r))}explicitDirectories(){return this.base.explicitDirectories().filter(r=>r.startsWith(this.prefix)).map(r=>this.local(r))}rm(r){this.base.rm(this.real(r))}version(r){return this.base.version(this.real(r))}mtime(r){return this.base.mtime(this.real(r))}toFlat(){let r={};for(let n of this.list())r[n.slice(1)]=this.readFile(n);return r}watch(r,n={}){return this.base.watch(s=>{s.path!==this.root&&r({...s,path:this.local(s.path)})},{under:this.real(n.under??"/")})}};function ms(t,e){let r=O(e);return r==="/"?t:new Zr(t,r)}var K=Uint8Array,de=Uint16Array,an=Int32Array,Zt=new K([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Xt=new K([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rn=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bs=function(t,e){for(var r=new de(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var s=new an(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)s[i]=i-r[n]<<5|n;return{b:r,r:s}},Cs=bs(Zt,2),vs=Cs.b,nn=Cs.r;vs[28]=258,nn[258]=28;var Ss=bs(Xt,0),Ua=Ss.b,ws=Ss.r,sn=new de(32768);for(M=0;M<32768;++M)_e=(M&43690)>>1|(M&21845)<<1,_e=(_e&52428)>>2|(_e&13107)<<2,_e=(_e&61680)>>4|(_e&3855)<<4,sn[M]=((_e&65280)>>8|(_e&255)<<8)>>1;var _e,M,Se=function(t,e,r){for(var n=t.length,s=0,i=new de(e);s<n;++s)t[s]&&++i[t[s]-1];var o=new de(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var a;if(r){a=new de(1<<e);var c=15-e;for(s=0;s<n;++s)if(t[s])for(var u=s<<4|t[s],f=e-t[s],l=o[t[s]-1]++<<f,d=l|(1<<f)-1;l<=d;++l)a[sn[l]>>c]=u}else for(a=new de(n),s=0;s<n;++s)t[s]&&(a[s]=sn[o[t[s]-1]++]>>15-t[s]);return a},Ue=new K(288);for(M=0;M<144;++M)Ue[M]=8;var M;for(M=144;M<256;++M)Ue[M]=9;var M;for(M=256;M<280;++M)Ue[M]=7;var M;for(M=280;M<288;++M)Ue[M]=8;var M,Ot=new K(32);for(M=0;M<32;++M)Ot[M]=5;var M,Pa=Se(Ue,9,0),ja=Se(Ue,9,1),Ka=Se(Ot,5,0),Ha=Se(Ot,5,1),Xr=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},ge=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},en=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},er=function(t){return(t+7)/8|0},Dt=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new K(t.subarray(e,r))};var Wa=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],z=function(t,e,r){var n=new Error(e||Wa[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,z),!r)throw n;return n},tr=function(t,e,r,n){var s=t.length,i=n?n.length:0;if(!s||e.f&&!e.l)return r||new K(0);var o=!r,a=o||e.i!=2,c=e.i;o&&(r=new K(s*3));var u=function(It){var Qt=r.length;if(It>Qt){var ct=new K(Math.max(Qt*2,It));ct.set(r),r=ct}},f=e.f||0,l=e.p||0,d=e.b||0,h=e.l,p=e.d,y=e.m,b=e.n,E=s*8;do{if(!h){f=ge(t,l,1);var C=ge(t,l+1,3);if(l+=3,C)if(C==1)h=ja,p=Ha,y=9,b=5;else if(C==2){var S=ge(t,l,31)+257,I=ge(t,l+10,15)+4,v=S+ge(t,l+5,31)+1;l+=14;for(var B=new K(v),Q=new K(19),_=0;_<I;++_)Q[rn[_]]=ge(t,l+_*3,7);l+=I*3;for(var N=Xr(Q),L=(1<<N)-1,J=Se(Q,N,1),_=0;_<v;){var te=J[ge(t,l,L)];l+=te&15;var A=te>>4;if(A<16)B[_++]=A;else{var G=0,j=0;for(A==16?(j=3+ge(t,l,3),l+=2,G=B[_-1]):A==17?(j=3+ge(t,l,7),l+=3):A==18&&(j=11+ge(t,l,127),l+=7);j--;)B[_++]=G}}var re=B.subarray(0,S),q=B.subarray(S);y=Xr(re),b=Xr(q),h=Se(re,y,1),p=Se(q,b,1)}else z(1);else{var A=er(l)+4,g=t[A-4]|t[A-3]<<8,w=A+g;if(w>s){c&&z(0);break}a&&u(d+g),r.set(t.subarray(A,w),d),e.b=d+=g,e.p=l=w*8,e.f=f;continue}if(l>E){c&&z(0);break}}a&&u(d+131072);for(var le=(1<<y)-1,Y=(1<<b)-1,be=l;;be=l){var G=h[en(t,l)&le],fe=G>>4;if(l+=G&15,l>E){c&&z(0);break}if(G||z(2),fe<256)r[d++]=fe;else if(fe==256){be=l,h=null;break}else{var ue=fe-254;if(fe>264){var _=fe-257,W=Zt[_];ue=ge(t,l,(1<<W)-1)+vs[_],l+=W}var Ce=p[en(t,l)&Y],ot=Ce>>4;Ce||z(3),l+=Ce&15;var q=Ua[ot];if(ot>3){var W=Xt[ot];q+=en(t,l)&(1<<W)-1,l+=W}if(l>E){c&&z(0);break}a&&u(d+131072);var at=d+ue;if(d<q){var Gt=i-q,Yt=Math.min(q,at);for(Gt+d<0&&z(3);d<Yt;++d)r[d]=n[Gt+d]}for(;d<at;++d)r[d]=r[d-q]}}e.l=h,e.p=be,e.b=d,e.f=f,h&&(f=1,e.m=y,e.d=p,e.n=b)}while(!f);return d!=r.length&&o?Dt(r,0,d):r.subarray(0,d)},De=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},xt=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8,t[n+2]|=r>>16},tn=function(t,e){for(var r=[],n=0;n<t.length;++n)t[n]&&r.push({s:n,f:t[n]});var s=r.length,i=r.slice();if(!s)return{t:Vt,l:0};if(s==1){var o=new K(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(w,S){return w.f-S.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],u=0,f=1,l=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};f!=s-1;)a=r[r[u].f<r[l].f?u++:l++],c=r[u!=f&&r[u].f<r[l].f?u++:l++],r[f++]={s:-1,f:a.f+c.f,l:a,r:c};for(var d=i[0].s,n=1;n<s;++n)i[n].s>d&&(d=i[n].s);var h=new de(d+1),p=on(r[f-1],h,0);if(p>e){var n=0,y=0,b=p-e,E=1<<b;for(i.sort(function(S,I){return h[I.s]-h[S.s]||S.f-I.f});n<s;++n){var C=i[n].s;if(h[C]>e)y+=E-(1<<p-h[C]),h[C]=e;else break}for(y>>=b;y>0;){var A=i[n].s;h[A]<e?y-=1<<e-h[A]++-1:++n}for(;n>=0&&y;--n){var g=i[n].s;h[g]==e&&(--h[g],++y)}p=e}return{t:new K(h),l:p}},on=function(t,e,r){return t.s==-1?Math.max(on(t.l,e,r+1),on(t.r,e,r+1)):e[t.s]=r},ys=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new de(++e),n=0,s=t[0],i=1,o=function(c){r[n++]=c},a=1;a<=e;++a)if(t[a]==s&&a!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[a]}return{c:r.subarray(0,n),n:e}},_t=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},cn=function(t,e,r){var n=r.length,s=er(e+2);t[s]=n&255,t[s+1]=n>>8,t[s+2]=t[s]^255,t[s+3]=t[s+1]^255;for(var i=0;i<n;++i)t[s+i+4]=r[i];return(s+4+n)*8},Es=function(t,e,r,n,s,i,o,a,c,u,f){De(e,f++,r),++s[256];for(var l=tn(s,15),d=l.t,h=l.l,p=tn(i,15),y=p.t,b=p.l,E=ys(d),C=E.c,A=E.n,g=ys(y),w=g.c,S=g.n,I=new de(19),v=0;v<C.length;++v)++I[C[v]&31];for(var v=0;v<w.length;++v)++I[w[v]&31];for(var B=tn(I,7),Q=B.t,_=B.l,N=19;N>4&&!Q[rn[N-1]];--N);var L=u+5<<3,J=_t(s,Ue)+_t(i,Ot)+o,te=_t(s,d)+_t(i,y)+o+14+3*N+_t(I,Q)+2*I[16]+3*I[17]+7*I[18];if(c>=0&&L<=J&&L<=te)return cn(e,f,t.subarray(c,c+u));var G,j,re,q;if(De(e,f,1+(te<J)),f+=2,te<J){G=Se(d,h,0),j=d,re=Se(y,b,0),q=y;var le=Se(Q,_,0);De(e,f,A-257),De(e,f+5,S-1),De(e,f+10,N-4),f+=14;for(var v=0;v<N;++v)De(e,f+3*v,Q[rn[v]]);f+=3*N;for(var Y=[C,w],be=0;be<2;++be)for(var fe=Y[be],v=0;v<fe.length;++v){var ue=fe[v]&31;De(e,f,le[ue]),f+=Q[ue],ue>15&&(De(e,f,fe[v]>>5&127),f+=fe[v]>>12)}}else G=Pa,j=Ue,re=Ka,q=Ot;for(var v=0;v<a;++v){var W=n[v];if(W>255){var ue=W>>18&31;xt(e,f,G[ue+257]),f+=j[ue+257],ue>7&&(De(e,f,W>>23&31),f+=Zt[ue]);var Ce=W&31;xt(e,f,re[Ce]),f+=q[Ce],Ce>3&&(xt(e,f,W>>5&8191),f+=Xt[Ce])}else xt(e,f,G[W]),f+=j[W]}return xt(e,f,G[256]),f+j[256]},Ja=new an([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vt=new K(0),qa=function(t,e,r,n,s,i){var o=i.z||t.length,a=new K(n+o+5*(1+Math.ceil(o/7e3))+s),c=a.subarray(n,a.length-s),u=i.l,f=(i.r||0)&7;if(e){f&&(c[0]=i.r>>3);for(var l=Ja[e-1],d=l>>13,h=l&8191,p=(1<<r)-1,y=i.p||new de(32768),b=i.h||new de(p+1),E=Math.ceil(r/3),C=2*E,A=function(Vr){return(t[Vr]^t[Vr+1]<<E^t[Vr+2]<<C)&p},g=new an(25e3),w=new de(288),S=new de(32),I=0,v=0,B=i.i||0,Q=0,_=i.w||0,N=0;B+2<o;++B){var L=A(B),J=B&32767,te=b[L];if(y[J]=te,b[L]=J,_<=B){var G=o-B;if((I>7e3||Q>24576)&&(G>423||!u)){f=Es(t,c,0,g,w,S,v,Q,N,B-N,f),Q=I=v=0,N=B;for(var j=0;j<286;++j)w[j]=0;for(var j=0;j<30;++j)S[j]=0}var re=2,q=0,le=h,Y=J-te&32767;if(G>2&&L==A(B-Y))for(var be=Math.min(d,G)-1,fe=Math.min(32767,B),ue=Math.min(258,G);Y<=fe&&--le&&J!=te;){if(t[B+re]==t[B+re-Y]){for(var W=0;W<ue&&t[B+W]==t[B+W-Y];++W);if(W>re){if(re=W,q=Y,W>be)break;for(var Ce=Math.min(Y,W-2),ot=0,j=0;j<Ce;++j){var at=B-Y+j&32767,Gt=y[at],Yt=at-Gt&32767;Yt>ot&&(ot=Yt,te=at)}}}J=te,te=y[J],Y+=J-te&32767}if(q){g[Q++]=268435456|nn[re]<<18|ws[q];var It=nn[re]&31,Qt=ws[q]&31;v+=Zt[It]+Xt[Qt],++w[257+It],++S[Qt],_=B+re,++I}else g[Q++]=t[B],++w[t[B]]}}for(B=Math.max(B,_);B<o;++B)g[Q++]=t[B],++w[t[B]];f=Es(t,c,u,g,w,S,v,Q,N,B-N,f),u||(i.r=f&7|c[f/8|0]<<3,f-=7,i.h=b,i.p=y,i.i=B,i.w=_)}else{for(var B=i.w||0;B<o+u;B+=65535){var ct=B+65535;ct>=o&&(c[f/8|0]=u,ct=o),f=cn(c,f+1,t.subarray(B,ct))}i.i=o}return Dt(a,0,n+er(f)+s)},za=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var r=e,n=9;--n;)r=(r&1&&-306674912)^r>>>1;t[e]=r}return t}(),Bs=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=za[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}},ln=function(){var t=1,e=0;return{p:function(r){for(var n=t,s=e,i=r.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)s+=n+=r[o];n=(n&65535)+15*(n>>16),s=(s&65535)+15*(s>>16)}t=n,e=s},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},lt=function(t,e,r,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new K(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return qa(t,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,r,n,s)};var Pe=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Is=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Pe(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var n=0;n<=r.length;++n)t[n+10]=r.charCodeAt(n)}},Qs=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&z(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=(t[10]|t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(e&2)},Ga=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ks=function(t){return 10+(t.filename?t.filename.length+1:0)},xs=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;if(t[0]=120,t[1]=n<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var s=ln();s.p(e.dictionary),Pe(t,2,s.d())}},_s=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&z(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&z(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function Ya(t,e){return typeof t=="function"&&(e=t,t={}),this.ondata=e,t}var $e=function(){function t(e,r){if(typeof e=="function"&&(r=e,e={}),this.ondata=r,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new K(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(e,r){this.ondata(lt(e,this.o,0,0,this.s),r)},t.prototype.push=function(e,r){this.ondata||z(5),this.s.l&&z(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new K(n&-32768);s.set(this.b.subarray(0,this.s.z)),this.b=s}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=r&1,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2),r&&(this.s=this.o={},this.b=Vt)},t.prototype.flush=function(e){if(this.ondata||z(5),this.s.l&&z(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var r=new K(6);r[0]=this.s.r>>3;var n=cn(r,this.s.r,Vt);this.s.r=0,this.ondata(r.subarray(0,n>>3),!1)}},t}();function Ds(t,e){return lt(t,e||{},0,0)}var ve=function(){function t(e,r){typeof e=="function"&&(r=e,e={}),this.ondata=r;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new K(32768),this.p=new K(0),n&&this.o.set(n)}return t.prototype.e=function(e){if(this.ondata||z(5),this.d&&z(4),!this.p.length)this.p=e;else if(e.length){var r=new K(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length),this.p=r}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var r=this.s.b,n=tr(this.p,this.s,this.o);this.ondata(Dt(n,r,this.s.b),this.d),this.o=Dt(n,this.s.b-32768),this.s.b=this.o.length,this.p=Dt(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,r){this.e(e),this.c(r)},t}();function fn(t,e){return tr(t,{i:2},e&&e.out,e&&e.dictionary)}var Os=function(){function t(e,r){this.c=Bs(),this.l=0,this.v=1,$e.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),this.l+=e.length,$e.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=lt(e,this.o,this.v&&ks(this.o),r&&8,this.s);this.v&&(Is(n,this.o),this.v=0),r&&(Pe(n,n.length-8,this.c.d()),Pe(n,n.length-4,this.l)),this.ondata(n,r)},t.prototype.flush=function(e){$e.prototype.flush.call(this,e)},t}();function Ns(t,e){e||(e={});var r=Bs(),n=t.length;r.p(t);var s=lt(t,e,ks(e),8),i=s.length;return Is(s,e),Pe(s,i-8,r.d()),Pe(s,i-4,n),s}var un=function(){function t(e,r){this.v=1,this.r=0,ve.call(this,e,r)}return t.prototype.push=function(e,r){if(ve.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),s=n.length>3?Qs(n):4;if(s>n.length){if(!r)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(s),this.v=0}ve.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=er(this.s.p)+9,this.s={i:0},this.o=new K(0),this.push(new K(0),r)):r&&ve.prototype.c.call(this,r)},t}();function Nt(t,e){var r=Qs(t);return r+8>t.length&&z(6,"invalid gzip data"),tr(t.subarray(r,-8),{i:2},e&&e.out||new K(Ga(t)),e&&e.dictionary)}var Rs=function(){function t(e,r){this.c=ln(),this.v=1,$e.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),$e.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=lt(e,this.o,this.v&&(this.o.dictionary?6:2),r&&4,this.s);this.v&&(xs(n,this.o),this.v=0),r&&Pe(n,n.length-4,this.c.d()),this.ondata(n,r)},t.prototype.flush=function(e){$e.prototype.flush.call(this,e)},t}();function Ts(t,e){e||(e={});var r=ln();r.p(t);var n=lt(t,e,e.dictionary?6:2,4);return xs(n,e),Pe(n,n.length-4,r.d()),n}var dn=function(){function t(e,r){ve.call(this,e,r),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,r){if(ve.prototype.e.call(this,e),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(_s(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&z(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),ve.prototype.c.call(this,r)},t}();function hn(t,e){return tr(t.subarray(_s(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Ls=function(){function t(e,r){this.o=Ya.call(this,e,r)||{},this.G=un,this.I=ve,this.Z=dn}return t.prototype.i=function(){var e=this;this.s.ondata=function(r,n){e.ondata(r,n)}},t.prototype.push=function(e,r){if(this.ondata||z(5),this.s)this.s.push(e,r);else{if(this.p&&this.p.length){var n=new K(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,r),this.p=null)}},t}();function Fs(t,e){return t[0]==31&&t[1]==139&&t[2]==8?Nt(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?fn(t,e):hn(t,e)}var Va=typeof TextDecoder<"u"&&new TextDecoder,Za=0;try{Va.decode(Vt,{stream:!0}),Za=1}catch{}function Ms(t){let e={};for(let r of t.split(/\r?\n/)){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let i=n.slice(0,s).replace(/^export\s+/,"").trim(),o=n.slice(s+1).trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),e[i]=o}return e}function $s(t){let e=t.split("/"),r=t.startsWith("@")?2:1;return{name:e.slice(0,r).join("/"),subpath:e.length>r?"/"+e.slice(r).join("/"):""}}var ec=[{dependency:"next",reason:"Next.js needs its Node server."},{dependency:"nuxt",reason:"Nuxt needs its Node server."},{dependency:"@remix-run/dev",reason:"Remix needs its Node server."},{dependency:"@sveltejs/kit",reason:"SvelteKit needs its Node server."},{dependency:"astro",reason:"Astro needs its build pipeline."}];function tc(t){try{let e=JSON.parse(t.readText("/package.json")??"{}");return new Set([...Object.keys(e.dependencies??{}),...Object.keys(e.devDependencies??{})])}catch{return new Set}}function Us(t){let e=tc(t);return ec.find(r=>e.has(r.dependency))?.reason}var Ps;(function(t){t[t.Static=1]="Static",t[t.Dynamic=2]="Dynamic",t[t.ImportMeta=3]="ImportMeta",t[t.StaticSourcePhase=4]="StaticSourcePhase",t[t.DynamicSourcePhase=5]="DynamicSourcePhase",t[t.StaticDeferPhase=6]="StaticDeferPhase",t[t.DynamicDeferPhase=7]="DynamicDeferPhase"})(Ps||(Ps={}));var rc=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function Rt(t,e="@"){if(!P)return pn.then(()=>Rt(t));let r=t.length+1,n=(P.__heap_base.value||P.__heap_base)+4*r-P.memory.buffer.byteLength;n>0&&P.memory.grow(Math.ceil(n/65536));let s=P.sa(r-1);if((rc?sc:nc)(t,new Uint16Array(P.memory.buffer,s,r)),!P.parse())throw Object.assign(new Error(`Parse error ${e}:${t.slice(0,P.e()).split(`
2
2
  `).length}:${P.e()-t.lastIndexOf(`
3
- `,P.e()-1)}`),{idx:P.e()});let i=[],o=[];for(;P.ri();){let c=P.is(),u=P.ie(),f=P.it(),l=P.ai(),d=P.id(),h=P.ss(),p=P.se(),y;P.ip()&&(y=a(t.slice(d===-1?c-1:c,d===-1?u+1:u))),i.push({n:y,t:f,s:c,e:u,ss:h,se:p,d,a:l})}for(;P.re();){let c=P.es(),u=P.ee(),f=P.els(),l=P.ele(),d=t.slice(c,u),h=d[0],p=f<0?void 0:t.slice(f,l),y=p?p[0]:"";o.push({s:c,e:u,ls:f,le:l,n:h==='"'||h==="'"?a(d):d,ln:y==='"'||y==="'"?a(p):p})}function a(c){try{return(0,eval)(c)}catch{}}return[i,o,!!P.f(),!!P.ms()]}function tc(t,e){let r=t.length,n=0;for(;n<r;){let s=t.charCodeAt(n);e[n++]=(255&s)<<8|s>>>8}}function rc(t,e){let r=t.length,n=0;for(;n<r;)e[n]=t.charCodeAt(n++)}var P,nc=()=>{return t="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GzYCHAtBAEEAKAKwCkECajYCsAoCQAJAAkACQEEAECkiAUHhAEYNACABQfcARg0BQQAoArAKIQEMAgtBACgCsAoiAUECakHACEEKEC8NAUEGIQIMAgtBACgCsAoiAS8BAkHpAEcNACABLwEEQfQARw0AQQQhAiABLwEGQegARg0BC0EAIAFBfmo2ArAKDwtBACABIAJBAXRqNgKwCgJAQQEQKUH7AEYNAEEAIAE2ArAKDwtBACgCsAoiACECA0BBACACQQJqNgKwCgJAAkACQEEBECkiAkEiRg0AIAJBJ0cNAUEnEBpBAEEAKAKwCkECajYCsApBARApIQIMAgtBIhAaQQBBACgCsApBAmo2ArAKQQEQKSECDAELIAIQLCECCwJAIAJBOkYNAEEAIAE2ArAKDwtBAEEAKAKwCkECajYCsAoCQEEBECkiAkEiRg0AIAJBJ0YNAEEAIAE2ArAKDwsgAhAaQQBBACgCsApBAmo2ArAKAkACQEEBECkiAkEsRg0AIAJB/QBGDQFBACABNgKwCg8LQQBBACgCsApBAmo2ArAKQQEQKUH9AEYNAEEAKAKwCiECDAELC0EAKALwCSIBIAA2AhAgAUEAKAKwCkECajYCDAttAQJ/AkACQANAAkAgAEH//wNxIgFBd2oiAkEXSw0AQQEgAnRBn4CABHENAgsgAUGgAUYNASAAIQIgARAoDQJBACECQQBBACgCsAoiAEECajYCsAogAC8BAiIADQAMAgsLIAAhAgsgAkH//wNxC6sBAQR/AkACQEEAKAKwCiICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=",typeof Buffer<"u"?Buffer.from(t,"base64"):Uint8Array.from(atob(t),e=>e.charCodeAt(0));var t},hn=WebAssembly.compile(nc()).then(WebAssembly.instantiate).then(({exports:t})=>{P=t});function Ps(){return{scopes:{},tokens:{}}}var Us=t=>t.replace(/\/+$/,"");function sc(t,e={},r=Ps()){for(let n of t.split(/\r?\n/)){let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let i=s.indexOf("=");if(i<0)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim().replace(/^(["'])(.*)\1$/,"$2").replace(/\$\{([^}]+)\}/g,(c,u)=>e[u]??"");o==="registry"?r.registry=Us(a):/^@[^:]+:registry$/.test(o)?r.scopes[o.slice(0,o.indexOf(":"))]=Us(a):o.startsWith("//")&&o.endsWith(":_authToken")&&(r.tokens[o.slice(0,-11).replace(/\/?$/,"/")]=a)}return r}function js(t,e,r={}){let n=Ps();for(let s of e){let i=t.readText(s);i!==void 0&&sc(i,r,n)}return n}function Ks(t,e,r){if(e.startsWith("@")){let n=t?.scopes[e.slice(0,e.indexOf("/"))];if(n)return n}return r}function Hs(t,e){if(!t)return{};let r=e.replace(/^https?:/,""),n="";for(let s of Object.keys(t.tokens))(r.startsWith(s)||r+"/"===s)&&s.length>n.length&&(n=s);return n?{authorization:`Bearer ${t.tokens[n]}`}:{}}var ic="https://registry.npmjs.org",oc="application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",ac=new TextEncoder,Ws=new TextDecoder;function cc(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function lc(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function Js(t,e){let r=globalThis.crypto?.subtle;if(!r)return!0;let n=async s=>new Uint8Array(await r.digest(s,t));if(e.integrity){let s={sha512:"SHA-512",sha384:"SHA-384",sha256:"SHA-256",sha1:"SHA-1"};for(let i of e.integrity.split(/\s+/)){let o=i.indexOf("-"),a=s[i.slice(0,o)];if(a&&cc(await n(a))===i.slice(o+1))return!0}return!1}return e.shasum?lc(await n("SHA-1"))===e.shasum:!0}var rr=class{constructor(e){m(this,"options");m(this,"registry");m(this,"packuments",new Map);this.options=e,this.registry=(e.registry??ic).replace(/\/+$/,"")}packument(e){let r=this.packuments.get(e);return r||(r=this.loadPackument(e),r.catch(()=>this.packuments.delete(e)),this.packuments.set(e,r)),r}async tarball(e){let{dist:r}=e,n=`tarball:${r.integrity??r.shasum??r.tarball}`,s=await this.options.cache?.get(n);if(s&&await Js(s,r))return s;let i=await this.get(r.tarball,{});if(!await Js(i,r))throw new Error(`Integrity check failed for ${e.name}@${e.version}`);return await this.options.cache?.put(n,i),i}async loadPackument(e){let r=Ks(this.options.npmrc,e,this.registry),n=`packument:${r}/${e}`,s=this.options.packumentMaxAgeMs??10*6e4,i=await this.options.cache?.get(n);if(i)try{let u=JSON.parse(Ws.decode(i));if(Date.now()-u.t<s)return u.p}catch{}let o=`${r}/${e.startsWith("@")?"@"+encodeURIComponent(e.slice(1)):encodeURIComponent(e)}`,a=await this.get(o,{accept:oc},e,r),c=JSON.parse(Ws.decode(a));if(!c.versions)throw new Error(`The registry returned no versions for "${e}".`);return await this.options.cache?.put(n,ac.encode(JSON.stringify({t:Date.now(),p:c}))),c}async get(e,r,n,s=this.registry){r={...r,...Hs(this.options.npmrc,e)};let i;for(let o=0;o<2;o++){let a;try{a=await this.options.fetch(e,{headers:r,signal:this.options.signal})}catch(c){if(this.options.signal?.aborted)throw c;i=c;continue}if(a.status===404&&n)throw new Error(`Package "${n}" was not found in ${s}.`);if((a.status===401||a.status===403)&&n)throw new Error(`${s} refused "${n}" (HTTP ${a.status}). Add an auth token to .npmrc.`);if(!a.ok)throw new Error(`GET ${e} failed with HTTP ${a.status}.`);return new Uint8Array(await a.arrayBuffer())}throw new Error(`GET ${e} failed: ${i instanceof Error?i.message:String(i)}`)}};var fc=/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|https?:|workspace:)/;function pn(t){let e=t.indexOf("@",t.startsWith("@")?1:0),r=e<0?t:t.slice(0,e),n=e<0?"":t.slice(e+1);return An(r,n)}function An(t,e){if(!t||/\s/.test(t))throw new Error(`Invalid package name "${t}".`);if(e.startsWith("npm:")){let r=pn(e.slice(4));return{name:t,registryName:r.registryName,range:r.range}}if(fc.test(e)||/^[^@/\s]+\/[^@/\s]+(#.*)?$/.test(e))throw new Error(`"${t}@${e}": only registry packages are supported (not git, file or URL dependencies).`);return{name:t,registryName:t,range:e.trim()}}function nr(t){return Object.fromEntries(Object.entries(t).sort(([e],[r])=>e<r?-1:e>r?1:0))}var uc=/^\s*[v=]*\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?\s*$/,dc=/^[v=]*(\d+|[xX*])?(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/;function lt(t){let e=uc.exec(t);if(!e)return null;let r=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return he(Number(e[1]),Number(e[2]),Number(e[3]),r)}function he(t,e,r,n=[]){let s=n.length?`-${n.join(".")}`:"";return{major:t,minor:e,patch:r,prerelease:n,version:`${t}.${e}.${r}${s}`}}function mn(t){return lt(t)?.version??null}function hc(t,e){if(!t.prerelease.length||!e.prerelease.length)return(e.prerelease.length?1:0)-(t.prerelease.length?1:0)||0;for(let r=0;;r++){let n=t.prerelease[r],s=e.prerelease[r];if(n===void 0&&s===void 0)return 0;if(n===void 0)return-1;if(s===void 0)return 1;if(n!==s)return typeof n=="number"&&typeof s=="number"?n<s?-1:1:typeof n=="number"?-1:typeof s=="number"?1:n<s?-1:1}}function zs(t,e){let r=typeof t=="string"?lt(t):t,n=typeof e=="string"?lt(e):e;if(!r||!n)throw new TypeError(`Invalid version: ${String(r?e:t)}`);return Math.sign(r.major-n.major||r.minor-n.minor||r.patch-n.patch)||hc(r,n)}var sr=t=>t===void 0||t==="x"||t==="X"||t==="*";function gn(t){let e=/^(~>?|\^|<=|>=|<|>|=)?(.*)$/.exec(t),r=e[1]??"",n=dc.exec(e[2]);if(!n)return null;let[,s,i,o,a]=n,c=a?a.split(".").map(C=>/^\d+$/.test(C)?Number(C):C):[],u=sr(s),f=u||sr(i),l=f||sr(o),d=u?0:Number(s),h=f?0:Number(i),p=l?0:Number(o),y=C=>({op:">=",version:C}),b=C=>({op:"<",version:C}),E=(C,A,g)=>b(he(C,A,g,[0]));if(r==="^"){if(u)return[];let C=y(he(d,h,p,c));return d>0||f?[C,E(d+1,0,0)]:h>0||l?[C,E(0,h+1,0)]:[C,E(0,0,p+1)]}if(r==="~"||r==="~>"){if(u)return[];let C=y(he(d,h,p,c));return f?[C,E(d+1,0,0)]:[C,E(d,h+1,0)]}return r===""||r==="="?u?[]:f?[y(he(d,0,0)),E(d+1,0,0)]:l?[y(he(d,h,0)),E(d,h+1,0)]:[{op:"=",version:he(d,h,p,c)}]:u?r==="<"||r===">"?[b(he(0,0,0,[0]))]:[]:l?r===">"?[y(f?he(d+1,0,0):he(d,h+1,0))]:r==="<="?[f?E(d+1,0,0):E(d,h+1,0)]:r==="<"?[b(he(d,h,0,[0]))]:[y(he(d,h,0))]:[{op:r,version:he(d,h,p,c)}]}function pc(t){return{parts:t.replace(/^[v=]+/,"").split("-")[0].split("."),full:lt(t)}}function Ac(t,e){let r=gn(`>=${t}`);if(!r)return null;let{parts:n,full:s}=pc(e);if(s)return[...r,{op:"<=",version:s}];if(sr(n[0]))return r;let i=gn(`<=${e}`);return i?[...r,...i]:null}var qs=new Map;function Gs(t){let e=qs.get(t);if(e!==void 0)return e;let r=[];for(let n of t.split("||")){let s=n.trim().replace(/(<=|>=|<|>|=|~>?|\^)\s+/g,"$1"),i=/^(\S+)\s+-\s+(\S+)$/.exec(s),o=i?Ac(i[1],i[2]):s.split(/\s+/).filter(Boolean).reduce((a,c)=>{let u=a&&gn(c);return u?[...a,...u]:null},[]);if(!o){r=null;break}r.push(o)}return qs.set(t,r),r}function Ge(t){return Gs(t)!==null}function gc(t,e){let r=zs(e,t.version);switch(t.op){case"<":return r<0;case"<=":return r<=0;case">":return r>0;case">=":return r>=0;default:return r===0}}function mc(t,e,r){return t.every(n=>gc(n,e))?!e.prerelease.length||r?!0:t.some(n=>n.version.prerelease.length>0&&n.version.major===e.major&&n.version.minor===e.minor&&n.version.patch===e.patch):!1}function je(t,e,r={}){let n=typeof t=="string"?lt(t):t,s=Gs(e);return!n||!s?!1:s.some(i=>mc(i,n,r.includePrerelease??!1))}function Ys(t,e){let r=null;for(let n of t){let s=lt(n);s&&je(s,e)&&(!r||zs(s,r)>0)&&(r=s)}return r?.version??null}var wc={esbuild:"esbuild-wasm",rollup:"@rollup/wasm-node"},wn=/-(?:darwin|linux|win32|android|freebsd|openharmony|sunos|aix)-[a-z0-9_-]+$/,yc=["-wasm32-wasip1","-wasm32-wasi"];function Vs(t){let e=Object.entries(t??{}).filter(([a])=>wn.test(a));if(e.length<2)return[];let[r,n]=e[0],s=r.replace(wn,"");if(e.some(([a])=>a.replace(wn,"")!==s))return[];let[i,o]=yc.map(a=>s+a);return t[i]?[]:[{name:i,range:n},{name:o,range:n,fallbackFor:i}]}function Zs(t){let e=t.registryName===t.name?wc[t.name]:void 0;return e?{...t,registryName:e}:void 0}var Tt=(t,e)=>t?`${t}/node_modules/${e}`:`node_modules/${e}`;function Ye(t){let e=t.lastIndexOf("/node_modules/");return e<0?"":t.slice(0,e)}function*Xs(t){let e=t;for(;;){if(yield e,!e)return;e=Ye(e)}}var ei=(t,e)=>e===""||t===e||t.startsWith(e+"/node_modules/"),ti={os:"linux",cpu:"wasm32"};function Ec(t){let e=(r,n)=>!r?.length||r.some(s=>s===n)&&!r.includes("!"+n)||r.every(s=>s.startsWith("!"))&&!r.includes("!"+n);return e(t.os,ti.os)&&e(t.cpu,ti.cpu)}function bc(t){let e=t.bundleDependencies??t.bundledDependencies;return e===!0?new Set(Object.keys(t.dependencies??{})):new Set(Array.isArray(e)?e:[])}function ri(t,e,r){let n=new Map,s=(o,a,c)=>{for(let[u,f]of Object.entries(o??{}))(!n.has(u)||a==="optional")&&n.set(u,{name:u,range:f,type:a,implied:c})};e&&!r&&s(t.devDependencies,"dev"),s(t.dependencies,"prod"),s(t.optionalDependencies,"optional");for(let o of Vs(t.optionalDependencies)){let a=n.get(o.name);n.set(o.name,a?{...a,fallbackFor:o.fallbackFor}:{name:o.name,range:o.range,type:"optional",implied:!0,fallbackFor:o.fallbackFor})}if(!e){let o=t.peerDependenciesMeta??{};for(let[a,c]of Object.entries(t.peerDependencies??{}))!n.has(a)&&!o[a]?.optional&&n.set(a,{name:a,range:c,type:"peer"})}let i=bc(t);return[...n.values()].filter(o=>!i.has(o.name)).sort((o,a)=>+!!o.fallbackFor-+!!a.fallbackFor||(o.name<a.name?-1:1))}async function Cc(t,e){let r=Zs(e);if(r)try{return await t.pick(r)}catch{}return t.pick(e)}function yn(t,e){let r=e||"*";return Ge(r)&&je(t,r)}async function ni(t){let e=new Map,r=[],n=new Map,s=t.production??!1,i=(f,l)=>{for(let d of Xs(f)){let h=Tt(d,l);if(e.has(h))return h}},o=f=>{r.push(f);let l=n.get(f.name)??[];l.push(f),n.set(f.name,l)},a=(f,l)=>(n.get(l)??[]).filter(d=>ei(d.from,f)&&!(ei(Ye(d.to),f)&&Ye(d.to)!==f)),c=(f,l,d)=>{let h;for(let p of Xs(f)){if(e.has(Tt(p,l))||a(p,l).some(y=>!yn(d,y.range)))break;h=p}return h===void 0?void 0:Tt(h,l)},u=[{location:"",deps:ri(t.root,!0,s)}];for(;u.length;){let{location:f,deps:l}=u.shift(),d=new Map;for(let h of l)try{let p=An(h.name,h.range);d.set(h.name,p),t.prefetch?.(p)}catch(p){if(h.type!=="optional")throw p;t.warn(`skipped optional ${h.name}: ${p.message}`)}for(let h of l){let p=d.get(h.name);if(!p)continue;if(h.fallbackFor){let g=i(f,h.fallbackFor);if(g&&yn(e.get(g).manifest.version,d.get(h.fallbackFor)?.range??p.range))continue}let y=h.type==="peer"?Ye(f):f,b=i(y,h.name),E={...h,range:p.range,owner:f,from:y};if(b&&yn(e.get(b).manifest.version,p.range)){o({...E,to:b});continue}if(b&&h.type==="peer"){t.warn(`peer dependency conflict: ${f||"root"} wants ${h.name}@${p.range}, found ${e.get(b).manifest.version}`),o({...E,to:b});continue}let C;try{C=await Cc(t,p)}catch(g){if(h.type!=="optional")throw g;h.implied||t.warn(`skipped optional ${h.name}: ${g.message}`);continue}if(!Ec(C)){if(h.type==="optional")continue;t.warn(`${C.name}@${C.version} targets ${[C.os,C.cpu].flat().filter(Boolean).join("/")} and may not work here`)}if(b&&e.get(b).manifest.version===C.version){o({...E,to:b});continue}let A=c(y,h.name,C.version);if(!A){t.warn(`could not place ${h.name}@${C.version} for ${f||"root"}`);continue}for(let g of a(Ye(A),h.name))g.to=A;e.set(A,{location:A,name:h.name,manifest:C,dev:!1,optional:!1}),o({...E,to:A}),t.onResolved?.({name:h.name,version:C.version}),u.push({location:A,deps:ri(C,!1,s)})}}return vc(e,r),e}function vc(t,e){let r=i=>{let o=new Set,a=[""];for(;a.length;){let c=a.pop();for(let u of e)u.owner!==c||i(u)||o.has(u.to)||(o.add(u.to),a.push(u.to))}return o},n=r(i=>i.owner===""&&i.type==="dev"),s=r(i=>i.type==="optional");for(let i of t.values())i.dev=!n.has(i.location),i.optional=!s.has(i.location)}function si(t){if(t)try{let e=JSON.parse(t);return e.lockfileVersion>=2&&e.packages?e:void 0}catch{return}}var Sc=t=>t.slice(t.lastIndexOf("node_modules/")+13);function Bc(t,e){if(!(!e.version||!e.resolved))return{name:e.name??Sc(t),version:e.version,dependencies:e.dependencies,optionalDependencies:e.optionalDependencies,peerDependencies:e.peerDependencies,peerDependenciesMeta:e.peerDependenciesMeta,bin:e.bin,engines:e.engines,os:e.os,cpu:e.cpu,hasInstallScript:e.hasInstallScript,deprecated:e.deprecated,license:e.license,dist:{tarball:e.resolved,integrity:e.integrity}}}function ii(t){let e=new Map;for(let[r,n]of Object.entries(t?.packages??{})){if(!r.includes("node_modules/"))continue;let s=Bc(r,n);if(!s)continue;let i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}return e}function En(t,e,r){let n=r||"*";if(!Ge(n))return;let s;for(let i of t.get(e)??[])je(i.version,n)&&(!s||je(i.version,`>${s.version}`))&&(s=i);return s}var oi=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function ai(t,e){let r=t.packages[""]??{};return oi.every(n=>{let s=e[n]??{},i=r[n]??{};return[...new Set([...Object.keys(s),...Object.keys(i)])].every(a=>s[a]===i[a])})}var ft=t=>t&&Object.keys(t).length?t:void 0;function ci(t,e){let r={name:t.name,version:t.version};for(let s of oi)ft(t[s])&&(r[s]=t[s]);t.bin&&(r.bin=t.bin);let n={"":JSON.parse(JSON.stringify(r))};for(let s of[...e.keys()].sort()){let i=e.get(s),o=i.manifest,a={name:o.name!==i.name?o.name:void 0,version:o.version,resolved:o.dist.tarball,integrity:o.dist.integrity,dev:i.dev||void 0,optional:i.optional||void 0,license:o.license,dependencies:ft(o.dependencies&&nr(o.dependencies)),optionalDependencies:ft(o.optionalDependencies),peerDependencies:ft(o.peerDependencies),peerDependenciesMeta:ft(o.peerDependenciesMeta),bin:o.bin,engines:ft(o.engines),os:o.os,cpu:o.cpu,hasInstallScript:o.hasInstallScript||void 0,deprecated:o.deprecated};n[s]=JSON.parse(JSON.stringify(a))}return{name:t.name,version:t.version,lockfileVersion:3,requires:!0,packages:n}}var ui=new TextDecoder;function Ve(t,e,r){let n=t.subarray(e,e+r),s=n.indexOf(0);return ui.decode(s<0?n:n.subarray(0,s))}function li(t,e,r){if(t[e]&128){let s=0;for(let i=e+1;i<e+r;i++)s=s*256+t[i];return s}let n=Ve(t,e,r).trim();return n?parseInt(n,8):0}function fi(t){let e={},r=ui.decode(t),n=0;for(;n<r.length;){let s=r.indexOf(" ",n);if(s<0)break;let i=parseInt(r.slice(n,s),10);if(!i)break;let o=r.slice(s+1,n+i);o.endsWith(`
3
+ `,P.e()-1)}`),{idx:P.e()});let i=[],o=[];for(;P.ri();){let c=P.is(),u=P.ie(),f=P.it(),l=P.ai(),d=P.id(),h=P.ss(),p=P.se(),y;P.ip()&&(y=a(t.slice(d===-1?c-1:c,d===-1?u+1:u))),i.push({n:y,t:f,s:c,e:u,ss:h,se:p,d,a:l})}for(;P.re();){let c=P.es(),u=P.ee(),f=P.els(),l=P.ele(),d=t.slice(c,u),h=d[0],p=f<0?void 0:t.slice(f,l),y=p?p[0]:"";o.push({s:c,e:u,ls:f,le:l,n:h==='"'||h==="'"?a(d):d,ln:y==='"'||y==="'"?a(p):p})}function a(c){try{return(0,eval)(c)}catch{}}return[i,o,!!P.f(),!!P.ms()]}function nc(t,e){let r=t.length,n=0;for(;n<r;){let s=t.charCodeAt(n);e[n++]=(255&s)<<8|s>>>8}}function sc(t,e){let r=t.length,n=0;for(;n<r;)e[n]=t.charCodeAt(n++)}var P,ic=()=>{return t="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GzYCHAtBAEEAKAKwCkECajYCsAoCQAJAAkACQEEAECkiAUHhAEYNACABQfcARg0BQQAoArAKIQEMAgtBACgCsAoiAUECakHACEEKEC8NAUEGIQIMAgtBACgCsAoiAS8BAkHpAEcNACABLwEEQfQARw0AQQQhAiABLwEGQegARg0BC0EAIAFBfmo2ArAKDwtBACABIAJBAXRqNgKwCgJAQQEQKUH7AEYNAEEAIAE2ArAKDwtBACgCsAoiACECA0BBACACQQJqNgKwCgJAAkACQEEBECkiAkEiRg0AIAJBJ0cNAUEnEBpBAEEAKAKwCkECajYCsApBARApIQIMAgtBIhAaQQBBACgCsApBAmo2ArAKQQEQKSECDAELIAIQLCECCwJAIAJBOkYNAEEAIAE2ArAKDwtBAEEAKAKwCkECajYCsAoCQEEBECkiAkEiRg0AIAJBJ0YNAEEAIAE2ArAKDwsgAhAaQQBBACgCsApBAmo2ArAKAkACQEEBECkiAkEsRg0AIAJB/QBGDQFBACABNgKwCg8LQQBBACgCsApBAmo2ArAKQQEQKUH9AEYNAEEAKAKwCiECDAELC0EAKALwCSIBIAA2AhAgAUEAKAKwCkECajYCDAttAQJ/AkACQANAAkAgAEH//wNxIgFBd2oiAkEXSw0AQQEgAnRBn4CABHENAgsgAUGgAUYNASAAIQIgARAoDQJBACECQQBBACgCsAoiAEECajYCsAogAC8BAiIADQAMAgsLIAAhAgsgAkH//wNxC6sBAQR/AkACQEEAKAKwCiICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=",typeof Buffer<"u"?Buffer.from(t,"base64"):Uint8Array.from(atob(t),e=>e.charCodeAt(0));var t},pn=WebAssembly.compile(ic()).then(WebAssembly.instantiate).then(({exports:t})=>{P=t});function Ks(){return{scopes:{},tokens:{}}}var js=t=>t.replace(/\/+$/,"");function oc(t,e={},r=Ks()){for(let n of t.split(/\r?\n/)){let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let i=s.indexOf("=");if(i<0)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim().replace(/^(["'])(.*)\1$/,"$2").replace(/\$\{([^}]+)\}/g,(c,u)=>e[u]??"");o==="registry"?r.registry=js(a):/^@[^:]+:registry$/.test(o)?r.scopes[o.slice(0,o.indexOf(":"))]=js(a):o.startsWith("//")&&o.endsWith(":_authToken")&&(r.tokens[o.slice(0,-11).replace(/\/?$/,"/")]=a)}return r}function Hs(t,e,r={}){let n=Ks();for(let s of e){let i=t.readText(s);i!==void 0&&oc(i,r,n)}return n}function Ws(t,e,r){if(e.startsWith("@")){let n=t?.scopes[e.slice(0,e.indexOf("/"))];if(n)return n}return r}function Js(t,e){if(!t)return{};let r=e.replace(/^https?:/,""),n="";for(let s of Object.keys(t.tokens))(r.startsWith(s)||r+"/"===s)&&s.length>n.length&&(n=s);return n?{authorization:`Bearer ${t.tokens[n]}`}:{}}var ac="https://registry.npmjs.org",cc="application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",lc=new TextEncoder,qs=new TextDecoder;function fc(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function uc(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function zs(t,e){let r=globalThis.crypto?.subtle;if(!r)return!0;let n=async s=>new Uint8Array(await r.digest(s,t));if(e.integrity){let s={sha512:"SHA-512",sha384:"SHA-384",sha256:"SHA-256",sha1:"SHA-1"};for(let i of e.integrity.split(/\s+/)){let o=i.indexOf("-"),a=s[i.slice(0,o)];if(a&&fc(await n(a))===i.slice(o+1))return!0}return!1}return e.shasum?uc(await n("SHA-1"))===e.shasum:!0}var rr=class{constructor(e){m(this,"options");m(this,"registry");m(this,"packuments",new Map);this.options=e,this.registry=(e.registry??ac).replace(/\/+$/,"")}packument(e){let r=this.packuments.get(e);return r||(r=this.loadPackument(e),r.catch(()=>this.packuments.delete(e)),this.packuments.set(e,r)),r}async tarball(e){let{dist:r}=e,n=`tarball:${r.integrity??r.shasum??r.tarball}`,s=await this.options.cache?.get(n);if(s&&await zs(s,r))return s;let i=await this.get(r.tarball,{});if(!await zs(i,r))throw new Error(`Integrity check failed for ${e.name}@${e.version}`);return await this.options.cache?.put(n,i),i}async loadPackument(e){let r=Ws(this.options.npmrc,e,this.registry),n=`packument:${r}/${e}`,s=this.options.packumentMaxAgeMs??10*6e4,i=await this.options.cache?.get(n);if(i)try{let u=JSON.parse(qs.decode(i));if(Date.now()-u.t<s)return u.p}catch{}let o=`${r}/${e.startsWith("@")?"@"+encodeURIComponent(e.slice(1)):encodeURIComponent(e)}`,a=await this.get(o,{accept:cc},e,r),c=JSON.parse(qs.decode(a));if(!c.versions)throw new Error(`The registry returned no versions for "${e}".`);return await this.options.cache?.put(n,lc.encode(JSON.stringify({t:Date.now(),p:c}))),c}async get(e,r,n,s=this.registry){r={...r,...Js(this.options.npmrc,e)};let i;for(let o=0;o<2;o++){let a;try{a=await this.options.fetch(e,{headers:r,signal:this.options.signal})}catch(c){if(this.options.signal?.aborted)throw c;i=c;continue}if(a.status===404&&n)throw new Error(`Package "${n}" was not found in ${s}.`);if((a.status===401||a.status===403)&&n)throw new Error(`${s} refused "${n}" (HTTP ${a.status}). Add an auth token to .npmrc.`);if(!a.ok)throw new Error(`GET ${e} failed with HTTP ${a.status}.`);return new Uint8Array(await a.arrayBuffer())}throw new Error(`GET ${e} failed: ${i instanceof Error?i.message:String(i)}`)}};var dc=/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|https?:|workspace:)/;function An(t){let e=t.indexOf("@",t.startsWith("@")?1:0),r=e<0?t:t.slice(0,e),n=e<0?"":t.slice(e+1);return gn(r,n)}function gn(t,e){if(!t||/\s/.test(t))throw new Error(`Invalid package name "${t}".`);if(e.startsWith("npm:")){let r=An(e.slice(4));return{name:t,registryName:r.registryName,range:r.range}}if(dc.test(e)||/^[^@/\s]+\/[^@/\s]+(#.*)?$/.test(e))throw new Error(`"${t}@${e}": only registry packages are supported (not git, file or URL dependencies).`);return{name:t,registryName:t,range:e.trim()}}function nr(t){return Object.fromEntries(Object.entries(t).sort(([e],[r])=>e<r?-1:e>r?1:0))}var hc=/^\s*[v=]*\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?\s*$/,pc=/^[v=]*(\d+|[xX*])?(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/;function ft(t){let e=hc.exec(t);if(!e)return null;let r=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return he(Number(e[1]),Number(e[2]),Number(e[3]),r)}function he(t,e,r,n=[]){let s=n.length?`-${n.join(".")}`:"";return{major:t,minor:e,patch:r,prerelease:n,version:`${t}.${e}.${r}${s}`}}function wn(t){return ft(t)?.version??null}function Ac(t,e){if(!t.prerelease.length||!e.prerelease.length)return(e.prerelease.length?1:0)-(t.prerelease.length?1:0)||0;for(let r=0;;r++){let n=t.prerelease[r],s=e.prerelease[r];if(n===void 0&&s===void 0)return 0;if(n===void 0)return-1;if(s===void 0)return 1;if(n!==s)return typeof n=="number"&&typeof s=="number"?n<s?-1:1:typeof n=="number"?-1:typeof s=="number"?1:n<s?-1:1}}function Ys(t,e){let r=typeof t=="string"?ft(t):t,n=typeof e=="string"?ft(e):e;if(!r||!n)throw new TypeError(`Invalid version: ${String(r?e:t)}`);return Math.sign(r.major-n.major||r.minor-n.minor||r.patch-n.patch)||Ac(r,n)}var sr=t=>t===void 0||t==="x"||t==="X"||t==="*";function mn(t){let e=/^(~>?|\^|<=|>=|<|>|=)?(.*)$/.exec(t),r=e[1]??"",n=pc.exec(e[2]);if(!n)return null;let[,s,i,o,a]=n,c=a?a.split(".").map(C=>/^\d+$/.test(C)?Number(C):C):[],u=sr(s),f=u||sr(i),l=f||sr(o),d=u?0:Number(s),h=f?0:Number(i),p=l?0:Number(o),y=C=>({op:">=",version:C}),b=C=>({op:"<",version:C}),E=(C,A,g)=>b(he(C,A,g,[0]));if(r==="^"){if(u)return[];let C=y(he(d,h,p,c));return d>0||f?[C,E(d+1,0,0)]:h>0||l?[C,E(0,h+1,0)]:[C,E(0,0,p+1)]}if(r==="~"||r==="~>"){if(u)return[];let C=y(he(d,h,p,c));return f?[C,E(d+1,0,0)]:[C,E(d,h+1,0)]}return r===""||r==="="?u?[]:f?[y(he(d,0,0)),E(d+1,0,0)]:l?[y(he(d,h,0)),E(d,h+1,0)]:[{op:"=",version:he(d,h,p,c)}]:u?r==="<"||r===">"?[b(he(0,0,0,[0]))]:[]:l?r===">"?[y(f?he(d+1,0,0):he(d,h+1,0))]:r==="<="?[f?E(d+1,0,0):E(d,h+1,0)]:r==="<"?[b(he(d,h,0,[0]))]:[y(he(d,h,0))]:[{op:r,version:he(d,h,p,c)}]}function gc(t){return{parts:t.replace(/^[v=]+/,"").split("-")[0].split("."),full:ft(t)}}function mc(t,e){let r=mn(`>=${t}`);if(!r)return null;let{parts:n,full:s}=gc(e);if(s)return[...r,{op:"<=",version:s}];if(sr(n[0]))return r;let i=mn(`<=${e}`);return i?[...r,...i]:null}var Gs=new Map;function Vs(t){let e=Gs.get(t);if(e!==void 0)return e;let r=[];for(let n of t.split("||")){let s=n.trim().replace(/(<=|>=|<|>|=|~>?|\^)\s+/g,"$1"),i=/^(\S+)\s+-\s+(\S+)$/.exec(s),o=i?mc(i[1],i[2]):s.split(/\s+/).filter(Boolean).reduce((a,c)=>{let u=a&&mn(c);return u?[...a,...u]:null},[]);if(!o){r=null;break}r.push(o)}return Gs.set(t,r),r}function Ye(t){return Vs(t)!==null}function wc(t,e){let r=Ys(e,t.version);switch(t.op){case"<":return r<0;case"<=":return r<=0;case">":return r>0;case">=":return r>=0;default:return r===0}}function yc(t,e,r){return t.every(n=>wc(n,e))?!e.prerelease.length||r?!0:t.some(n=>n.version.prerelease.length>0&&n.version.major===e.major&&n.version.minor===e.minor&&n.version.patch===e.patch):!1}function je(t,e,r={}){let n=typeof t=="string"?ft(t):t,s=Vs(e);return!n||!s?!1:s.some(i=>yc(i,n,r.includePrerelease??!1))}function Zs(t,e){let r=null;for(let n of t){let s=ft(n);s&&je(s,e)&&(!r||Ys(s,r)>0)&&(r=s)}return r?.version??null}var Ec={esbuild:"esbuild-wasm",rollup:"@rollup/wasm-node"},yn=/-(?:darwin|linux|win32|android|freebsd|openharmony|sunos|aix)-[a-z0-9_-]+$/,bc=["-wasm32-wasip1","-wasm32-wasi"];function Xs(t){let e=Object.entries(t??{}).filter(([a])=>yn.test(a));if(e.length<2)return[];let[r,n]=e[0],s=r.replace(yn,"");if(e.some(([a])=>a.replace(yn,"")!==s))return[];let[i,o]=bc.map(a=>s+a);return t[i]?[]:[{name:i,range:n},{name:o,range:n,fallbackFor:i}]}function ei(t){let e=t.registryName===t.name?Ec[t.name]:void 0;return e?{...t,registryName:e}:void 0}var Tt=(t,e)=>t?`${t}/node_modules/${e}`:`node_modules/${e}`;function Ve(t){let e=t.lastIndexOf("/node_modules/");return e<0?"":t.slice(0,e)}function*ti(t){let e=t;for(;;){if(yield e,!e)return;e=Ve(e)}}var ri=(t,e)=>e===""||t===e||t.startsWith(e+"/node_modules/"),ni={os:"linux",cpu:"wasm32"};function Cc(t){let e=(r,n)=>!r?.length||r.some(s=>s===n)&&!r.includes("!"+n)||r.every(s=>s.startsWith("!"))&&!r.includes("!"+n);return e(t.os,ni.os)&&e(t.cpu,ni.cpu)}function vc(t){let e=t.bundleDependencies??t.bundledDependencies;return e===!0?new Set(Object.keys(t.dependencies??{})):new Set(Array.isArray(e)?e:[])}function si(t,e,r){let n=new Map,s=(o,a,c)=>{for(let[u,f]of Object.entries(o??{}))(!n.has(u)||a==="optional")&&n.set(u,{name:u,range:f,type:a,implied:c})};e&&!r&&s(t.devDependencies,"dev"),s(t.dependencies,"prod"),s(t.optionalDependencies,"optional");for(let o of Xs(t.optionalDependencies)){let a=n.get(o.name);n.set(o.name,a?{...a,fallbackFor:o.fallbackFor}:{name:o.name,range:o.range,type:"optional",implied:!0,fallbackFor:o.fallbackFor})}if(!e){let o=t.peerDependenciesMeta??{};for(let[a,c]of Object.entries(t.peerDependencies??{}))!n.has(a)&&!o[a]?.optional&&n.set(a,{name:a,range:c,type:"peer"})}let i=vc(t);return[...n.values()].filter(o=>!i.has(o.name)).sort((o,a)=>+!!o.fallbackFor-+!!a.fallbackFor||(o.name<a.name?-1:1))}async function Sc(t,e){let r=ei(e);if(r)try{return await t.pick(r)}catch{}return t.pick(e)}function En(t,e){let r=e||"*";return Ye(r)&&je(t,r)}async function ii(t){let e=new Map,r=[],n=new Map,s=t.production??!1,i=(f,l)=>{for(let d of ti(f)){let h=Tt(d,l);if(e.has(h))return h}},o=f=>{r.push(f);let l=n.get(f.name)??[];l.push(f),n.set(f.name,l)},a=(f,l)=>(n.get(l)??[]).filter(d=>ri(d.from,f)&&!(ri(Ve(d.to),f)&&Ve(d.to)!==f)),c=(f,l,d)=>{let h;for(let p of ti(f)){if(e.has(Tt(p,l))||a(p,l).some(y=>!En(d,y.range)))break;h=p}return h===void 0?void 0:Tt(h,l)},u=[{location:"",deps:si(t.root,!0,s)}];for(;u.length;){let{location:f,deps:l}=u.shift(),d=new Map;for(let h of l)try{let p=gn(h.name,h.range);d.set(h.name,p),t.prefetch?.(p)}catch(p){if(h.type!=="optional")throw p;t.warn(`skipped optional ${h.name}: ${p.message}`)}for(let h of l){let p=d.get(h.name);if(!p)continue;if(h.fallbackFor){let g=i(f,h.fallbackFor);if(g&&En(e.get(g).manifest.version,d.get(h.fallbackFor)?.range??p.range))continue}let y=h.type==="peer"?Ve(f):f,b=i(y,h.name),E={...h,range:p.range,owner:f,from:y};if(b&&En(e.get(b).manifest.version,p.range)){o({...E,to:b});continue}if(b&&h.type==="peer"){t.warn(`peer dependency conflict: ${f||"root"} wants ${h.name}@${p.range}, found ${e.get(b).manifest.version}`),o({...E,to:b});continue}let C;try{C=await Sc(t,p)}catch(g){if(h.type!=="optional")throw g;h.implied||t.warn(`skipped optional ${h.name}: ${g.message}`);continue}if(!Cc(C)){if(h.type==="optional")continue;t.warn(`${C.name}@${C.version} targets ${[C.os,C.cpu].flat().filter(Boolean).join("/")} and may not work here`)}if(b&&e.get(b).manifest.version===C.version){o({...E,to:b});continue}let A=c(y,h.name,C.version);if(!A){t.warn(`could not place ${h.name}@${C.version} for ${f||"root"}`);continue}for(let g of a(Ve(A),h.name))g.to=A;e.set(A,{location:A,name:h.name,manifest:C,dev:!1,optional:!1}),o({...E,to:A}),t.onResolved?.({name:h.name,version:C.version}),u.push({location:A,deps:si(C,!1,s)})}}return Bc(e,r),e}function Bc(t,e){let r=i=>{let o=new Set,a=[""];for(;a.length;){let c=a.pop();for(let u of e)u.owner!==c||i(u)||o.has(u.to)||(o.add(u.to),a.push(u.to))}return o},n=r(i=>i.owner===""&&i.type==="dev"),s=r(i=>i.type==="optional");for(let i of t.values())i.dev=!n.has(i.location),i.optional=!s.has(i.location)}function oi(t){if(t)try{let e=JSON.parse(t);return e.lockfileVersion>=2&&e.packages?e:void 0}catch{return}}var Ic=t=>t.slice(t.lastIndexOf("node_modules/")+13);function Qc(t,e){if(!(!e.version||!e.resolved))return{name:e.name??Ic(t),version:e.version,dependencies:e.dependencies,optionalDependencies:e.optionalDependencies,peerDependencies:e.peerDependencies,peerDependenciesMeta:e.peerDependenciesMeta,bin:e.bin,engines:e.engines,os:e.os,cpu:e.cpu,hasInstallScript:e.hasInstallScript,deprecated:e.deprecated,license:e.license,dist:{tarball:e.resolved,integrity:e.integrity}}}function ai(t){let e=new Map;for(let[r,n]of Object.entries(t?.packages??{})){if(!r.includes("node_modules/"))continue;let s=Qc(r,n);if(!s)continue;let i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}return e}function bn(t,e,r){let n=r||"*";if(!Ye(n))return;let s;for(let i of t.get(e)??[])je(i.version,n)&&(!s||je(i.version,`>${s.version}`))&&(s=i);return s}var ci=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function li(t,e){let r=t.packages[""]??{};return ci.every(n=>{let s=e[n]??{},i=r[n]??{};return[...new Set([...Object.keys(s),...Object.keys(i)])].every(a=>s[a]===i[a])})}var ut=t=>t&&Object.keys(t).length?t:void 0;function fi(t,e){let r={name:t.name,version:t.version};for(let s of ci)ut(t[s])&&(r[s]=t[s]);t.bin&&(r.bin=t.bin);let n={"":JSON.parse(JSON.stringify(r))};for(let s of[...e.keys()].sort()){let i=e.get(s),o=i.manifest,a={name:o.name!==i.name?o.name:void 0,version:o.version,resolved:o.dist.tarball,integrity:o.dist.integrity,dev:i.dev||void 0,optional:i.optional||void 0,license:o.license,dependencies:ut(o.dependencies&&nr(o.dependencies)),optionalDependencies:ut(o.optionalDependencies),peerDependencies:ut(o.peerDependencies),peerDependenciesMeta:ut(o.peerDependenciesMeta),bin:o.bin,engines:ut(o.engines),os:o.os,cpu:o.cpu,hasInstallScript:o.hasInstallScript||void 0,deprecated:o.deprecated};n[s]=JSON.parse(JSON.stringify(a))}return{name:t.name,version:t.version,lockfileVersion:3,requires:!0,packages:n}}var hi=new TextDecoder;function Ze(t,e,r){let n=t.subarray(e,e+r),s=n.indexOf(0);return hi.decode(s<0?n:n.subarray(0,s))}function ui(t,e,r){if(t[e]&128){let s=0;for(let i=e+1;i<e+r;i++)s=s*256+t[i];return s}let n=Ze(t,e,r).trim();return n?parseInt(n,8):0}function di(t){let e={},r=hi.decode(t),n=0;for(;n<r.length;){let s=r.indexOf(" ",n);if(s<0)break;let i=parseInt(r.slice(n,s),10);if(!i)break;let o=r.slice(s+1,n+i);o.endsWith(`
4
4
  `)||(o=r.slice(s+1,r.indexOf(`
5
- `,s)+1));let a=o.indexOf("=");a>0&&(e[o.slice(0,a)]=o.slice(a+1).replace(/\n$/,"")),n=s+1+o.length}return e}function Ic(t,e){for(let r=e;r<e+512;r++)if(t[r]!==0)return!1;return!0}function di(t){let e=[],r=0,n={},s={},i,o;for(;r+512<=t.length&&!Ic(t,r);){let a=Ve(t,r,100),c=li(t,r+100,8),u=li(t,r+124,12),f=String.fromCharCode(t[r+156]||48),l=Ve(t,r+157,100),h=Ve(t,r+257,6).startsWith("ustar")?Ve(t,r+345,155):"",p={...s,...n},y=p.size?Number(p.size):u,b=r+512,E=t.subarray(b,b+y);if(r=b+Math.ceil(y/512)*512,f==="x"){n=fi(E);continue}if(f==="g"){s={...s,...fi(E)};continue}if(f==="L"){i=Ve(E,0,E.length);continue}if(f==="K"){o=Ve(E,0,E.length);continue}let C=p.path??i??(h?`${h}/${a}`:a),A=p.linkpath??o??l;n={},i=void 0,o=void 0,f==="0"||f==="\0"||f==="7"?e.push({path:C,type:"file",data:E,mode:c}):f==="5"?e.push({path:C,type:"directory",data:new Uint8Array(0),mode:c}):f==="2"?e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A}):f==="1"&&e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A})}return e}var bn="// @bfwc-bin ";function Qc(t,e){if(!e)return{};let r=typeof e=="string"?[[t.replace(/^@[^/]+\//,""),e]]:Object.entries(e),n={};for(let[s,i]of r){let o=s.replace(/^@[^/]+\//,"");!o||/[/\\]/.test(o)||o==="."||o===".."||typeof i!="string"||(n[o]=i.replace(/^\.\//,""))}return n}function kc(t){return`#!/usr/bin/env node
6
- ${bn}${t}
5
+ `,s)+1));let a=o.indexOf("=");a>0&&(e[o.slice(0,a)]=o.slice(a+1).replace(/\n$/,"")),n=s+1+o.length}return e}function kc(t,e){for(let r=e;r<e+512;r++)if(t[r]!==0)return!1;return!0}function pi(t){let e=[],r=0,n={},s={},i,o;for(;r+512<=t.length&&!kc(t,r);){let a=Ze(t,r,100),c=ui(t,r+100,8),u=ui(t,r+124,12),f=String.fromCharCode(t[r+156]||48),l=Ze(t,r+157,100),h=Ze(t,r+257,6).startsWith("ustar")?Ze(t,r+345,155):"",p={...s,...n},y=p.size?Number(p.size):u,b=r+512,E=t.subarray(b,b+y);if(r=b+Math.ceil(y/512)*512,f==="x"){n=di(E);continue}if(f==="g"){s={...s,...di(E)};continue}if(f==="L"){i=Ze(E,0,E.length);continue}if(f==="K"){o=Ze(E,0,E.length);continue}let C=p.path??i??(h?`${h}/${a}`:a),A=p.linkpath??o??l;n={},i=void 0,o=void 0,f==="0"||f==="\0"||f==="7"?e.push({path:C,type:"file",data:E,mode:c}):f==="5"?e.push({path:C,type:"directory",data:new Uint8Array(0),mode:c}):f==="2"?e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A}):f==="1"&&e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A})}return e}var Cn="// @bfwc-bin ";function xc(t,e){if(!e)return{};let r=typeof e=="string"?[[t.replace(/^@[^/]+\//,""),e]]:Object.entries(e),n={};for(let[s,i]of r){let o=s.replace(/^@[^/]+\//,"");!o||/[/\\]/.test(o)||o==="."||o===".."||typeof i!="string"||(n[o]=i.replace(/^\.\//,""))}return n}function _c(t){return`#!/usr/bin/env node
6
+ ${Cn}${t}
7
7
  require(${JSON.stringify(t)});
8
8
  `}function ir(t,e){let r=t.readText(e);if(!r)return;let n=r.split(`
9
- `).find(s=>s.startsWith(bn));return n?k($(O(e)),n.slice(bn.length).trim()):void 0}function hi(t,e,r){let n={};for(let s of r)for(let[i,o]of Object.entries(Qc(s.name,s.bin))){let a=k(s.dir,o);if(!t.isFile(a))continue;let c=xc(e,a);t.writeFile(k(e,i),kc(c)),n[i]=a}return n}function xc(t,e){let r=O(t).split("/").filter(Boolean),n=O(e).split("/").filter(Boolean),s=0;for(;s<r.length&&s<n.length&&r[s]===n[s];)s++;let o=[...r.slice(s).map(()=>".."),...n.slice(s)].join("/");return o.startsWith("..")?o:`./${o}`}var _c=new TextDecoder("utf-8",{fatal:!0}),Dc=/\.(?:png|jpe?g|gif|webp|ico|bmp|wasm|node|gz|tgz|zip|br|woff2?|ttf|otf|eot|pdf|mp[34]|webm|ogg|wav|bin|dat)$/i;function pi(t,e){if(Dc.test(t)||e.subarray(0,8e3).includes(0))return e.slice();try{return _c.decode(e)}catch{return e.slice()}}function gi(t,e){let r=t["dist-tags"]??{},n=e||"*";if(!Ge(n)){let o=r[n];if(o&&t.versions[o])return o;throw new Error(`No version of ${t.name} is tagged "${e}".`)}let s=r.latest;if(s&&t.versions[s]&&je(s,n))return s;let i=Ys(Object.keys(t.versions),n);if(!i)throw new Error(`No matching version found for ${t.name}@${e}.`);return i}async function Oc(t,e,r){let n=0,s=Array.from({length:Math.min(e,t.length)},async()=>{for(;n<t.length;)await r(t[n++])});await Promise.all(s)}function Cn(t,e){try{let r=t.readText(e);return r===void 0?void 0:JSON.parse(r)}catch{return}}var Ai=(t,e,r)=>t.writeFile(e,JSON.stringify(r,null,2)+`
10
- `);function Nc(t,e){let r=new Map,n=s=>{let i=k(e,s,"node_modules"),o=[];for(let a of t.readdir(i))if(!a.startsWith("."))if(a.startsWith("@"))for(let c of t.readdir(k(i,a)))o.push(`${a}/${c}`);else o.push(a);for(let a of o){let c=Tt(s,a),u=Cn(t,k(e,c,"package.json"));r.set(c,`${u?.name??""}@${u?.version??""}`),n(c)}};return n(""),r}async function Rc(t,e,r,n){let s=n?"devDependencies":"dependencies",i=n?"dependencies":"devDependencies";for(let o of r){let a=pn(o),c=a.range;if(!c||!Ge(c)?c=`^${gi(await t.packument(a.registryName),c||"latest")}`:mn(c)&&(c=`^${mn(c)}`),a.registryName!==a.name&&(c=`npm:${a.registryName}@${c}`),e[s]=nr({...e[s]??{},[a.name]:c}),e[i]?.[a.name]){let u={...e[i]};delete u[a.name],e[i]=u}}}async function mi(t){let{fs:e,signal:r}=t,n=k("/",t.cwd??"/"),s=k(n,"package.json"),i=k(n,"package-lock.json"),o=[],a=new rr({fetch:t.fetch,registry:t.registry??t.npmrc?.registry,npmrc:t.npmrc,cache:t.cache,signal:r}),c=w=>t.onProgress?.(w),u=Cn(e,s);if(!u){if(e.isFile(s))throw new Error(`${s} is not valid JSON.`);if(!t.add?.length)throw new Error(`No package.json in ${n}.`);u={}}t.add?.length&&(await Rc(a,u,t.add,t.saveDev??!1),Ai(e,s,u));let f=si(e.readText(i));if(t.ci){if(!f)throw new Error("npm ci needs a package-lock.json (lockfileVersion 2 or 3).");if(!ai(f,u))throw new Error("package.json and package-lock.json are out of sync. Run npm install to update the lockfile.");e.rm(k(n,"node_modules"))}let l=ii(f),d=new Map,h=w=>{let S=`${w.registryName}@${w.range}`,I=d.get(S);if(!I){let v=En(l,w.registryName,w.range);v?I=Promise.resolve(v):t.ci?I=Promise.reject(new Error(`${S} is missing from package-lock.json. Run npm install to update it.`)):I=a.packument(w.registryName).then(B=>{let Q=B.versions[gi(B,w.range)];return{...Q,name:Q.name??w.registryName}}),I.catch(()=>{}),d.set(S,I)}return I},p=0,y=await ni({root:u,pick:h,prefetch:w=>void(En(l,w.registryName,w.range)||t.ci||a.packument(w.registryName).catch(()=>{})),production:t.production,warn:w=>o.push(w),onResolved:({name:w,version:S})=>c({phase:"resolve",package:`${w}@${S}`,done:++p,total:p})});r?.throwIfAborted();let b=0;for(let[w,S]of[...Nc(e,n)].sort(([I],[v])=>I.length-v.length)){let I=k(n,w);if(!e.exists(I))continue;let v=y.get(w);(!v||S!==`${v.manifest.name}@${v.manifest.version}`)&&(e.rm(I),b++)}let E=[...y.values()].filter(w=>!e.isFile(k(n,w.location,"package.json"))),C=0;await Oc(E,t.concurrency??8,async w=>{r?.throwIfAborted(),await Tc(e,k(n,w.location),await a.tarball(w.manifest)),c({phase:"fetch",package:`${w.name}@${w.manifest.version}`,done:++C,total:E.length})});for(let w of y.values())w.manifest.hasInstallScript&&o.push(`skipped install scripts of ${w.name}@${w.manifest.version} (they cannot run in the browser)`),w.manifest.deprecated&&o.push(`deprecated ${w.name}@${w.manifest.version}: ${w.manifest.deprecated}`);let A=Lc(e,n,y),g=ci(u,y);return Ai(e,i,g),c({phase:"done",done:y.size,total:y.size}),{added:E.length,removed:b,total:y.size,bins:A,lockfile:g,warnings:o}}async function Tc(t,e,r){let n=di(Nt(r)),s;for(let i of n){if(i.type!=="file")continue;let o=i.path.split("/").slice(1).join("/");!o||o.split("/").includes("..")||(o==="package.json"?s=i.data:t.writeFile(k(e,o),pi(o,i.data)))}if(!s)throw new Error(`The tarball for ${e} has no package.json.`);t.writeFile(k(e,"package.json"),pi("package.json",s))}function Lc(t,e,r){let n=new Map;for(let i of r.values()){let o=Ye(i.location);n.set(o,[...n.get(o)??[],i])}t.rm(k(e,"node_modules/.bin"));let s={};for(let[i,o]of n){let a=k(e,i,"node_modules/.bin"),c=hi(t,a,o.map(u=>({dir:k(e,u.location),name:u.name,bin:Cn(t,k(e,u.location,"package.json"))?.bin??u.manifest.bin})));i===""&&(s=c)}return s}function Lt(t){let e,r=!1;return{stream:new ReadableStream({start:s=>void(e=s),cancel:s=>{r||(r=!0,t?.(s))}}),push(s){!r&&s.byteLength&&e.enqueue(s)},end(){r||(r=!0,e.close())},fail(s){r||(r=!0,e.error(s))},get done(){return r}}}function wi(t){return new ReadableStream({start(e){t.byteLength&&e.enqueue(t),e.close()}})}function Mt(t,e){return{status:t,headers:{"content-type":"text/plain; charset=utf-8"},body:wi(new TextEncoder().encode(e))}}function vn(t){return{status:t.status,statusText:t.statusText,headers:t.headers}}function Sn(t,e){let r=t.getReader(),n=!1;return(async()=>{try{for(;;){let{value:s,done:i}=await r.read();if(i||n)break;e.chunk(s)}n||e.end()}catch(s){n||e.end(s instanceof Error?s.message:String(s))}})(),()=>{n||(n=!0,r.cancel().catch(()=>{}))}}var or=class{constructor(){m(this,"peer");m(this,"closed",!1);m(this,"data",new Set);m(this,"closes",new Set)}send(e){if(this.closed)return;let r=new Uint8Array(e);queueMicrotask(()=>{if(!this.peer.closed)for(let n of this.peer.data)n(r)})}close(){this.closed||(this.closed=!0,queueMicrotask(()=>{if(!this.peer.closed){this.peer.closed=!0;for(let e of this.peer.closes)e()}}))}onData(e){return this.data.add(e),()=>this.data.delete(e)}onClose(e){return this.closes.add(e),()=>this.closes.delete(e)}};function Bn(){let t=new or,e=new or;return t.peer=e,e.peer=t,[t,e]}var Mc=["/usr/local/bin","/usr/bin","/bin"];function Fc(t,e){if(!e.startsWith("/"))return;let r=O(e);if(!(!Mc.includes($(r))||t.isFile(r)))return r.slice($(r).length+1)}function ut(t){let e=[];for(let r=O(t);;r=$(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules/.bin")),r==="/")return e}function me(t,e,r,n){if(e.includes("/")){let i=e.startsWith("/")?O(e):k(r,e);return t.isFile(i)?i:void 0}let s=[...(n.PATH??"").split(":").filter(Boolean),...ut(r)];for(let i of s){let o=k(i.startsWith("/")?i:k(r,i),e);if(t.isFile(o))return o}}function yi(t,e){let r=ir(t,e);if(r)return{name:"node",args:[r]};let n=(t.readText(e)??"").split(`
11
- `,1)[0]??"";return/^#!.*\b(?:sh|bash|bfsh|zsh|dash)\b/.test(n)?{name:"bfsh",args:[e]}:[".sh",".bash"].includes(Qt(e))?{name:"bfsh",args:[e]}:{name:"node",args:[e]}}function ar(t,e,r,n,s,i){if(!r.includes("/")&&Object.prototype.hasOwnProperty.call(e,r))return{name:r,program:e[r],args:n};let o=Fc(t,r);if(o&&Object.prototype.hasOwnProperty.call(e,o))return{name:o,program:e[o],args:n};let a=me(t,r,s,i);if(!a)return;let{name:c,args:u}=yi(t,a),f=e[c];return f?{name:c,program:f,args:[...u,...n]}:void 0}function In(t){return Object.assign(new Error(`spawn ${t} ENOENT`),{code:"ENOENT",errno:-2,syscall:`spawn ${t}`,path:t})}var oe=class{constructor(){m(this,"buffered",[]);m(this,"listeners",new Set);m(this,"ended",!1);m(this,"draining",!1)}push(e){this.ended||(e===null&&(this.ended=!0),this.buffered.push(e),this.drain())}subscribe(e){return this.listeners.add(e),this.drain(),()=>this.listeners.delete(e)}drain(){this.draining||!this.listeners.size||!this.buffered.length||(this.draining=!0,queueMicrotask(()=>{for(this.draining=!1;this.buffered.length&&this.listeners.size;){let e=this.buffered.shift();for(let r of[...this.listeners])r(e)}}))}readAll(){return new Promise(e=>{let r="",n=this.subscribe(ae(s=>{s===null?(n(),e(r)):r+=s}))})}get isEnded(){return this.ended}};function ae(t){let e=new TextDecoder;return r=>{if(r===null){let s=e.decode();s&&t(s),t(null);return}let n=typeof r=="string"?r:e.decode(r,{stream:!0});n&&t(n)}}var Ze=class{constructor(e){m(this,"options");m(this,"raw",!1);m(this,"line","");this.options=e}input(e){if(this.raw){this.options.deliver(e);return}let r=e.replace(/\x1b\[[0-9;]*[A-Za-z~]|\x1bO[A-Za-z]/g,"");for(let n of r)switch(n){case"\r":case`
9
+ `).find(s=>s.startsWith(Cn));return n?k($(O(e)),n.slice(Cn.length).trim()):void 0}function Ai(t,e,r){let n={};for(let s of r)for(let[i,o]of Object.entries(xc(s.name,s.bin))){let a=k(s.dir,o);if(!t.isFile(a))continue;let c=Dc(e,a);t.writeFile(k(e,i),_c(c)),n[i]=a}return n}function Dc(t,e){let r=O(t).split("/").filter(Boolean),n=O(e).split("/").filter(Boolean),s=0;for(;s<r.length&&s<n.length&&r[s]===n[s];)s++;let o=[...r.slice(s).map(()=>".."),...n.slice(s)].join("/");return o.startsWith("..")?o:`./${o}`}var Oc=new TextDecoder("utf-8",{fatal:!0}),Nc=/\.(?:png|jpe?g|gif|webp|ico|bmp|wasm|node|gz|tgz|zip|br|woff2?|ttf|otf|eot|pdf|mp[34]|webm|ogg|wav|bin|dat)$/i;function gi(t,e){if(Nc.test(t)||e.subarray(0,8e3).includes(0))return e.slice();try{return Oc.decode(e)}catch{return e.slice()}}function wi(t,e){let r=t["dist-tags"]??{},n=e||"*";if(!Ye(n)){let o=r[n];if(o&&t.versions[o])return o;throw new Error(`No version of ${t.name} is tagged "${e}".`)}let s=r.latest;if(s&&t.versions[s]&&je(s,n))return s;let i=Zs(Object.keys(t.versions),n);if(!i)throw new Error(`No matching version found for ${t.name}@${e}.`);return i}async function Rc(t,e,r){let n=0,s=Array.from({length:Math.min(e,t.length)},async()=>{for(;n<t.length;)await r(t[n++])});await Promise.all(s)}function vn(t,e){try{let r=t.readText(e);return r===void 0?void 0:JSON.parse(r)}catch{return}}var mi=(t,e,r)=>t.writeFile(e,JSON.stringify(r,null,2)+`
10
+ `);function Tc(t,e){let r=new Map,n=s=>{let i=k(e,s,"node_modules"),o=[];for(let a of t.readdir(i))if(!a.startsWith("."))if(a.startsWith("@"))for(let c of t.readdir(k(i,a)))o.push(`${a}/${c}`);else o.push(a);for(let a of o){let c=Tt(s,a),u=vn(t,k(e,c,"package.json"));r.set(c,`${u?.name??""}@${u?.version??""}`),n(c)}};return n(""),r}async function Lc(t,e,r,n){let s=n?"devDependencies":"dependencies",i=n?"dependencies":"devDependencies";for(let o of r){let a=An(o),c=a.range;if(!c||!Ye(c)?c=`^${wi(await t.packument(a.registryName),c||"latest")}`:wn(c)&&(c=`^${wn(c)}`),a.registryName!==a.name&&(c=`npm:${a.registryName}@${c}`),e[s]=nr({...e[s]??{},[a.name]:c}),e[i]?.[a.name]){let u={...e[i]};delete u[a.name],e[i]=u}}}async function yi(t){let{fs:e,signal:r}=t,n=k("/",t.cwd??"/"),s=k(n,"package.json"),i=k(n,"package-lock.json"),o=[],a=new rr({fetch:t.fetch,registry:t.registry??t.npmrc?.registry,npmrc:t.npmrc,cache:t.cache,signal:r}),c=w=>t.onProgress?.(w),u=vn(e,s);if(!u){if(e.isFile(s))throw new Error(`${s} is not valid JSON.`);if(!t.add?.length)throw new Error(`No package.json in ${n}.`);u={}}t.add?.length&&(await Lc(a,u,t.add,t.saveDev??!1),mi(e,s,u));let f=oi(e.readText(i));if(t.ci){if(!f)throw new Error("npm ci needs a package-lock.json (lockfileVersion 2 or 3).");if(!li(f,u))throw new Error("package.json and package-lock.json are out of sync. Run npm install to update the lockfile.");e.rm(k(n,"node_modules"))}let l=ai(f),d=new Map,h=w=>{let S=`${w.registryName}@${w.range}`,I=d.get(S);if(!I){let v=bn(l,w.registryName,w.range);v?I=Promise.resolve(v):t.ci?I=Promise.reject(new Error(`${S} is missing from package-lock.json. Run npm install to update it.`)):I=a.packument(w.registryName).then(B=>{let Q=B.versions[wi(B,w.range)];return{...Q,name:Q.name??w.registryName}}),I.catch(()=>{}),d.set(S,I)}return I},p=0,y=await ii({root:u,pick:h,prefetch:w=>void(bn(l,w.registryName,w.range)||t.ci||a.packument(w.registryName).catch(()=>{})),production:t.production,warn:w=>o.push(w),onResolved:({name:w,version:S})=>c({phase:"resolve",package:`${w}@${S}`,done:++p,total:p})});r?.throwIfAborted();let b=0;for(let[w,S]of[...Tc(e,n)].sort(([I],[v])=>I.length-v.length)){let I=k(n,w);if(!e.exists(I))continue;let v=y.get(w);(!v||S!==`${v.manifest.name}@${v.manifest.version}`)&&(e.rm(I),b++)}let E=[...y.values()].filter(w=>!e.isFile(k(n,w.location,"package.json"))),C=0;await Rc(E,t.concurrency??8,async w=>{r?.throwIfAborted(),await Fc(e,k(n,w.location),await a.tarball(w.manifest)),c({phase:"fetch",package:`${w.name}@${w.manifest.version}`,done:++C,total:E.length})});for(let w of y.values())w.manifest.hasInstallScript&&o.push(`skipped install scripts of ${w.name}@${w.manifest.version} (they cannot run in the browser)`),w.manifest.deprecated&&o.push(`deprecated ${w.name}@${w.manifest.version}: ${w.manifest.deprecated}`);let A=Mc(e,n,y),g=fi(u,y);return mi(e,i,g),c({phase:"done",done:y.size,total:y.size}),{added:E.length,removed:b,total:y.size,bins:A,lockfile:g,warnings:o}}async function Fc(t,e,r){let n=pi(Nt(r)),s;for(let i of n){if(i.type!=="file")continue;let o=i.path.split("/").slice(1).join("/");!o||o.split("/").includes("..")||(o==="package.json"?s=i.data:t.writeFile(k(e,o),gi(o,i.data)))}if(!s)throw new Error(`The tarball for ${e} has no package.json.`);t.writeFile(k(e,"package.json"),gi("package.json",s))}function Mc(t,e,r){let n=new Map;for(let i of r.values()){let o=Ve(i.location);n.set(o,[...n.get(o)??[],i])}t.rm(k(e,"node_modules/.bin"));let s={};for(let[i,o]of n){let a=k(e,i,"node_modules/.bin"),c=Ai(t,a,o.map(u=>({dir:k(e,u.location),name:u.name,bin:vn(t,k(e,u.location,"package.json"))?.bin??u.manifest.bin})));i===""&&(s=c)}return s}function Lt(t){let e,r=!1;return{stream:new ReadableStream({start:s=>void(e=s),cancel:s=>{r||(r=!0,t?.(s))}}),push(s){!r&&s.byteLength&&e.enqueue(s)},end(){r||(r=!0,e.close())},fail(s){r||(r=!0,e.error(s))},get done(){return r}}}function Ei(t){return new ReadableStream({start(e){t.byteLength&&e.enqueue(t),e.close()}})}function Ft(t,e){return{status:t,headers:{"content-type":"text/plain; charset=utf-8"},body:Ei(new TextEncoder().encode(e))}}function Sn(t){return{status:t.status,statusText:t.statusText,headers:t.headers}}function Bn(t,e){let r=t.getReader(),n=!1;return(async()=>{try{for(;;){let{value:s,done:i}=await r.read();if(i||n)break;e.chunk(s)}n||e.end()}catch(s){n||e.end(s instanceof Error?s.message:String(s))}})(),()=>{n||(n=!0,r.cancel().catch(()=>{}))}}var or=class{constructor(){m(this,"peer");m(this,"closed",!1);m(this,"data",new Set);m(this,"closes",new Set)}send(e){if(this.closed)return;let r=new Uint8Array(e);queueMicrotask(()=>{if(!this.peer.closed)for(let n of this.peer.data)n(r)})}close(){this.closed||(this.closed=!0,queueMicrotask(()=>{if(!this.peer.closed){this.peer.closed=!0;for(let e of this.peer.closes)e()}}))}onData(e){return this.data.add(e),()=>this.data.delete(e)}onClose(e){return this.closes.add(e),()=>this.closes.delete(e)}};function In(){let t=new or,e=new or;return t.peer=e,e.peer=t,[t,e]}var $c=["/usr/local/bin","/usr/bin","/bin"];function Uc(t,e){if(!e.startsWith("/"))return;let r=O(e);if(!(!$c.includes($(r))||t.isFile(r)))return r.slice($(r).length+1)}function dt(t){let e=[];for(let r=O(t);;r=$(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules/.bin")),r==="/")return e}function me(t,e,r,n){if(e.includes("/")){let i=e.startsWith("/")?O(e):k(r,e);return t.isFile(i)?i:void 0}let s=[...(n.PATH??"").split(":").filter(Boolean),...dt(r)];for(let i of s){let o=k(i.startsWith("/")?i:k(r,i),e);if(t.isFile(o))return o}}function bi(t,e){let r=ir(t,e);if(r)return{name:"node",args:[r]};let n=(t.readText(e)??"").split(`
11
+ `,1)[0]??"";return/^#!.*\b(?:sh|bash|bfsh|zsh|dash)\b/.test(n)?{name:"bfsh",args:[e]}:[".sh",".bash"].includes(kt(e))?{name:"bfsh",args:[e]}:{name:"node",args:[e]}}function ar(t,e,r,n,s,i){if(!r.includes("/")&&Object.prototype.hasOwnProperty.call(e,r))return{name:r,program:e[r],args:n};let o=Uc(t,r);if(o&&Object.prototype.hasOwnProperty.call(e,o))return{name:o,program:e[o],args:n};let a=me(t,r,s,i);if(!a)return;let{name:c,args:u}=bi(t,a),f=e[c];return f?{name:c,program:f,args:[...u,...n]}:void 0}function Qn(t){return Object.assign(new Error(`spawn ${t} ENOENT`),{code:"ENOENT",errno:-2,syscall:`spawn ${t}`,path:t})}var oe=class{constructor(){m(this,"buffered",[]);m(this,"listeners",new Set);m(this,"ended",!1);m(this,"draining",!1)}push(e){this.ended||(e===null&&(this.ended=!0),this.buffered.push(e),this.drain())}subscribe(e){return this.listeners.add(e),this.drain(),()=>this.listeners.delete(e)}drain(){this.draining||!this.listeners.size||!this.buffered.length||(this.draining=!0,queueMicrotask(()=>{for(this.draining=!1;this.buffered.length&&this.listeners.size;){let e=this.buffered.shift();for(let r of[...this.listeners])r(e)}}))}readAll(){return new Promise(e=>{let r="",n=this.subscribe(ae(s=>{s===null?(n(),e(r)):r+=s}))})}get isEnded(){return this.ended}};function ae(t){let e=new TextDecoder;return r=>{if(r===null){let s=e.decode();s&&t(s),t(null);return}let n=typeof r=="string"?r:e.decode(r,{stream:!0});n&&t(n)}}var Xe=class{constructor(e){m(this,"options");m(this,"raw",!1);m(this,"line","");this.options=e}input(e){if(this.raw){this.options.deliver(e);return}let r=e.replace(/\x1b\[[0-9;]*[A-Za-z~]|\x1bO[A-Za-z]/g,"");for(let n of r)switch(n){case"\r":case`
12
12
  `:this.options.echo(`\r
13
13
  `),this.options.deliver(this.line+`
14
14
  `),this.line="";break;case"\x7F":case"\b":this.line&&(this.line=[...this.line].slice(0,-1).join(""),this.options.echo("\b \b"));break;case"":this.options.echo(`^C\r
15
- `),this.line="",this.options.signal("SIGINT");break;case"":this.options.signal("SIGQUIT");break;case"":this.line?(this.options.deliver(this.line),this.line=""):this.options.deliver(null);break;case"":this.options.echo("\b \b".repeat([...this.line].length)),this.line="";break;default:(n>=" "||n===" ")&&(this.line+=n,this.options.echo(n))}}};var $c=1e3;function Ei(){return $c++}function Qn(t){let e=t.pid??Ei(),r=new oe,n=new Set,s=new Set,i=new Set,o=new AbortController,a=A=>u||n.forEach(g=>g(A)),c=A=>u||s.forEach(g=>g(A)),u=!1,f=()=>{},l=(A="SIGTERM")=>{u||(o.signal.aborted?A==="SIGKILL"&&f(137):o.abort(A))},d=t.terminal?{...t.terminal}:void 0,h=d?new Ze({echo:a,deliver:A=>r.push(A),signal:A=>l(A)}):void 0,p={stdout:a,stderr:c,onStdin:A=>r.subscribe(A),terminal:d&&h?{get cols(){return d.cols},get rows(){return d.rows},onResize(A){return i.add(A),()=>i.delete(A)},setRawMode(A){h.raw=A}}:void 0},y=new Set,b={...t.system,spawn(A,g,w){let S=t.system.spawn(A,g,w);return w?.detached||(y.add(S),S.exit.then(()=>y.delete(S))),S}},E=(A,g)=>{t.channel?.disconnect(),u=!0;for(let w of y)w.kill("SIGTERM");A(g)},C=new Promise(A=>{f=g=>E(A,g),queueMicrotask(async()=>{let g;try{g=await t.program({args:t.args,cwd:t.cwd,env:t.env,io:p,system:b,signal:o.signal,ipc:t.channel,thread:t.thread})}catch(w){p.stderr(`${w instanceof Error?w.stack??w.message:String(w)}
16
- `),g=1}E(A,g)})});return{pid:e,onStdout(A){return n.add(A),()=>n.delete(A)},onStderr(A){return s.add(A),()=>s.delete(A)},write(A){h?h.input(typeof A=="string"?A:new TextDecoder().decode(A)):r.push(A)},closeStdin:()=>r.push(null),kill:l,resize(A,g){d&&(d.cols=A,d.rows=g,i.forEach(w=>w(A,g)))},exit:C}}function cr(t,e=()=>{}){let r=new Set,n=new Set,s=[],i=!0,o=c=>{i&&(i=!1,s=[],c&&e(),queueMicrotask(()=>n.forEach(u=>u())))};return{endpoint:{send(c){if(!i)throw Object.assign(new Error("Channel closed"),{code:"ERR_IPC_CHANNEL_CLOSED"});t(structuredClone(c))},onMessage(c){if(r.add(c),s.length){let u=s;s=[],queueMicrotask(()=>u.forEach(f=>c(f)))}return()=>r.delete(c)},disconnect:()=>o(!0),onDisconnect(c){return n.add(c),()=>n.delete(c)},get connected(){return i}},receive(c){i&&(r.size?queueMicrotask(()=>r.forEach(u=>u(c))):s.push(c))},closed:()=>o(!1)}}var lr=(t,e)=>t<<e|t>>>32-e,Be=(t,e)=>t>>>e|t<<32-e;function fr(t,e,r,n){let s=t.length*8,i=Math.ceil((t.length+1+r)/e)*e,o=new Uint8Array(i);o.set(t),o[t.length]=128;let a=new DataView(o.buffer),c=Math.floor(s/2**32),u=s>>>0;return n?(a.setUint32(i-8,u,!0),a.setUint32(i-4,c,!0)):(a.setUint32(i-4,u),a.setUint32(i-8,c)),o}var Uc=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Pc=Array.from({length:64},(t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function jc(t){let e=fr(t,64,8,!0),r=new DataView(e.buffer),n=1732584193,s=4023233417,i=2562383102,o=271733878;for(let c=0;c<e.length;c+=64){let u=n,f=s,l=i,d=o;for(let h=0;h<64;h++){let p,y;h<16?[p,y]=[f&l|~f&d,h]:h<32?[p,y]=[d&f|~d&l,(5*h+1)%16]:h<48?[p,y]=[f^l^d,(3*h+5)%16]:[p,y]=[l^(f|~d),7*h%16];let b=d;d=l,l=f,f=f+lr(u+p+Pc[h]+r.getUint32(c+y*4,!0)|0,Uc[(h>>4)*4+h%4])|0,u=b}n=n+u|0,s=s+f|0,i=i+l|0,o=o+d|0}let a=new DataView(new ArrayBuffer(16));return[n,s,i,o].forEach((c,u)=>a.setUint32(u*4,c,!0)),new Uint8Array(a.buffer)}function Kc(t){let e=fr(t,64,8,!1),r=new DataView(e.buffer),n=[1732584193,4023233417,2562383102,271733878,3285377520],s=new Int32Array(80);for(let o=0;o<e.length;o+=64){for(let d=0;d<16;d++)s[d]=r.getInt32(o+d*4);for(let d=16;d<80;d++)s[d]=lr(s[d-3]^s[d-8]^s[d-14]^s[d-16],1);let[a,c,u,f,l]=n;for(let d=0;d<80;d++){let[h,p]=d<20?[c&u|~c&f,1518500249]:d<40?[c^u^f,1859775393]:d<60?[c&u|c&f|u&f,2400959708]:[c^u^f,3395469782],y=lr(a,5)+h+l+p+s[d]|0;l=f,f=u,u=lr(c,30),c=a,a=y}n[0]=n[0]+a|0,n[1]=n[1]+c|0,n[2]=n[2]+u|0,n[3]=n[3]+f|0,n[4]=n[4]+l|0}let i=new DataView(new ArrayBuffer(20));return n.forEach((o,a)=>i.setUint32(a*4,o>>>0)),new Uint8Array(i.buffer)}var Hc=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function bi(t,e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=8){let n=fr(t,64,8,!1),s=new DataView(n.buffer),i=[...e],o=new Int32Array(64);for(let c=0;c<n.length;c+=64){for(let E=0;E<16;E++)o[E]=s.getInt32(c+E*4);for(let E=16;E<64;E++){let C=Be(o[E-15],7)^Be(o[E-15],18)^o[E-15]>>>3,A=Be(o[E-2],17)^Be(o[E-2],19)^o[E-2]>>>10;o[E]=o[E-16]+C+o[E-7]+A|0}let[u,f,l,d,h,p,y,b]=i;for(let E=0;E<64;E++){let C=b+(Be(h,6)^Be(h,11)^Be(h,25))+(h&p^~h&y)+Hc[E]+o[E]|0,A=(Be(u,2)^Be(u,13)^Be(u,22))+(u&f^u&l^f&l)|0;b=y,y=p,p=h,h=d+C|0,d=l,l=f,f=u,u=C+A|0}[u,f,l,d,h,p,y,b].forEach((E,C)=>i[C]=i[C]+E|0)}let a=new DataView(new ArrayBuffer(r*4));for(let c=0;c<r;c++)a.setUint32(c*4,i[c]>>>0);return new Uint8Array(a.buffer)}var Wc=["428a2f98d728ae22","7137449123ef65cd","b5c0fbcfec4d3b2f","e9b5dba58189dbbc","3956c25bf348b538","59f111f1b605d019","923f82a4af194f9b","ab1c5ed5da6d8118","d807aa98a3030242","12835b0145706fbe","243185be4ee4b28c","550c7dc3d5ffb4e2","72be5d74f27b896f","80deb1fe3b1696b1","9bdc06a725c71235","c19bf174cf692694","e49b69c19ef14ad2","efbe4786384f25e3","0fc19dc68b8cd5b5","240ca1cc77ac9c65","2de92c6f592b0275","4a7484aa6ea6e483","5cb0a9dcbd41fbd4","76f988da831153b5","983e5152ee66dfab","a831c66d2db43210","b00327c898fb213f","bf597fc7beef0ee4","c6e00bf33da88fc2","d5a79147930aa725","06ca6351e003826f","142929670a0e6e70","27b70a8546d22ffc","2e1b21385c26c926","4d2c6dfc5ac42aed","53380d139d95b3df","650a73548baf63de","766a0abb3c77b2a8","81c2c92e47edaee6","92722c851482353b","a2bfe8a14cf10364","a81a664bbc423001","c24b8b70d0f89791","c76c51a30654be30","d192e819d6ef5218","d69906245565a910","f40e35855771202a","106aa07032bbd1b8","19a4c116b8d2d0c8","1e376c085141ab53","2748774cdf8eeb99","34b0bcb5e19b48a8","391c0cb3c5c95a63","4ed8aa4ae3418acb","5b9cca4f7763e373","682e6ff3d6b2b8a3","748f82ee5defb2fc","78a5636f43172f60","84c87814a1f0ab72","8cc702081a6439ec","90befffa23631e28","a4506cebde82bde9","bef9a3f7b2c67915","c67178f2e372532b","ca273eceea26619c","d186b8c721c0c207","eada7dd6cde0eb1e","f57d4f7fee6ed178","06f067aa72176fba","0a637dc5a2c898a6","113f9804bef90dae","1b710b35131c471b","28db77f523047d84","32caab7b40c72493","3c9ebe0a15c9bebc","431d67c49c100d4c","4cc5d4becb3e42b6","597f299cfc657e2a","5fcb6fab3ad6faec","6c44198c4a475817"].map(t=>BigInt("0x"+t)),Ke=(1n<<64n)-1n,Ie=(t,e)=>(t>>e|t<<64n-e)&Ke;function Ci(t,e,r){let n=fr(t,128,16,!1),s=new DataView(n.buffer),i=e.map(c=>BigInt("0x"+c)),o=new Array(80);for(let c=0;c<n.length;c+=128){for(let E=0;E<16;E++)o[E]=s.getBigUint64(c+E*8);for(let E=16;E<80;E++){let C=Ie(o[E-15],1n)^Ie(o[E-15],8n)^o[E-15]>>7n,A=Ie(o[E-2],19n)^Ie(o[E-2],61n)^o[E-2]>>6n;o[E]=o[E-16]+C+o[E-7]+A&Ke}let[u,f,l,d,h,p,y,b]=i;for(let E=0;E<80;E++){let C=b+(Ie(h,14n)^Ie(h,18n)^Ie(h,41n))+(h&p^~h&Ke&y)+Wc[E]+o[E]&Ke,A=(Ie(u,28n)^Ie(u,34n)^Ie(u,39n))+(u&f^u&l^f&l)&Ke;b=y,y=p,p=h,h=d+C&Ke,d=l,l=f,f=u,u=C+A&Ke}[u,f,l,d,h,p,y,b].forEach((E,C)=>i[C]=i[C]+E&Ke)}let a=new DataView(new ArrayBuffer(64));return i.forEach((c,u)=>a.setBigUint64(u*8,c)),new Uint8Array(a.buffer).slice(0,r)}var Jc=["6a09e667f3bcc908","bb67ae8584caa73b","3c6ef372fe94f82b","a54ff53a5f1d36f1","510e527fade682d1","9b05688c2b3e6c1f","1f83d9abfb41bd6b","5be0cd19137e2179"],qc=["cbbb9d5dc1059ed8","629a292a367cd507","9159015a3070dd17","152fecd8f70e5939","67332667ffc00b31","8eb44a8768581511","db0c2e0d64f98fa7","47b5481dbefa4fa4"],kn={md5:{digest:jc,blockSize:64},sha1:{digest:Kc,blockSize:64},sha256:{digest:t=>bi(t),blockSize:64},sha224:{digest:t=>bi(t,[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],7),blockSize:64},sha384:{digest:t=>Ci(t,qc,48),blockSize:128},sha512:{digest:t=>Ci(t,Jc,64),blockSize:128}};function Ft(t){let e=t.toLowerCase().replace(/^rsa-/,"").replace("-",""),r=kn[e];if(!r)throw new Error(`Digest method not supported: ${t}`);return r}function xn(t,e,r,n,s){let i,o=!0,a=!1,c=()=>e.some(l=>t.listenerCount(l)>0),u=()=>{!a&&c()&&(a=!0,s());let l=o&&n()&&c();l&&!i?i=r.hold():!l&&i&&(i(),i=void 0)},f=l=>{typeof l=="string"&&e.includes(l)&&queueMicrotask(u)};return t.on("newListener",f),t.on("removeListener",f),{update:u,ref(){o=!0,u()},unref(){o=!1,u()},hasRef:()=>o}}function vi(t,e,r){let n=xn(t,["message","disconnect"],r,()=>e.connected,()=>{e.onMessage(s=>r._run(()=>t.emit("message",s,void 0)))});e.onDisconnect(()=>{t.connected=!1,r._run(()=>t.emit("disconnect")),n.update()}),Object.assign(t,{connected:!0,channel:{ref:n.ref,unref:n.unref,hasRef:n.hasRef},send(s,...i){let o=i.find(a=>typeof a=="function");try{e.send(s)}catch(a){if(!o)throw a;return queueMicrotask(()=>r._run(()=>o(a))),!1}return o&&queueMicrotask(()=>r._run(()=>o(null))),!0},disconnect:()=>e.disconnect()})}function ce(t,e){let r=function(...n){return new.target?Reflect.construct(t,n,new.target):(e(this,...n),this)};return Object.defineProperty(r,"name",{value:t.name}),r.prototype=t.prototype,Object.setPrototypeOf(r,t),Object.defineProperty(t.prototype,"constructor",{value:r,writable:!0,configurable:!0,enumerable:!1}),r}var dt=class dt{constructor(){Bi(this)}static once(e,r){return new Promise((n,s)=>{let i=a=>{e.removeListener(r,o),s(a)},o=(...a)=>{r!=="error"&&e.removeListener("error",i),n(a)};e.once(r,o),r!=="error"&&e.once("error",i)})}static listenerCount(e,r){return e.listenerCount(r)}addListener(e,r){return this._add(e,r,!1)}on(e,r){return this._add(e,r,!1)}prependListener(e,r){return this._add(e,r,!0)}once(e,r){return this._add(e,this._onceWrap(e,r),!1)}prependOnceListener(e,r){return this._add(e,this._onceWrap(e,r),!0)}removeListener(e,r){let n=this._events?.get(e);if(!n)return this;for(let s=n.length-1;s>=0;s--){let i=n[s];if(i===r||i.listener===r){n.splice(s,1),n.length||this._events.delete(e),this._events.has("removeListener")&&this.emit("removeListener",e,r);break}}return this}off(e,r){return this.removeListener(e,r)}removeAllListeners(e){return this._events?(e===void 0?this._events.clear():this._events.delete(e),this):this}emit(e,...r){let n=this._events?.get(e);if(e==="error"&&(this._events?.get(dt.errorMonitor)?.slice().forEach(s=>s.apply(this,r)),!n?.length)){let s=r[0];if(s instanceof Error)throw s;let i=new Error(`Unhandled error. (${String(s)})`);throw i.context=s,i}if(!n?.length)return!1;for(let s of n.slice())s.apply(this,r);return!0}listeners(e){return(this._events?.get(e)??[]).map(r=>r.listener??r)}rawListeners(e){return[...this._events?.get(e)??[]]}listenerCount(e){return this._events?.get(e)?.length??0}eventNames(){return[...this._events?.keys()??[]]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners??dt.defaultMaxListeners}_add(e,r,n){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type function');this._events||(this._events=new Map),this._events.has("newListener")&&this.emit("newListener",e,r.listener??r);let s=this._events.get(e)??[];return n?s.unshift(r):s.push(r),this._events.set(e,s),this}_onceWrap(e,r){let n=!1,s=(...i)=>{if(!n)return n=!0,this.removeListener(e,s),r.apply(this,i)};return s.listener=r,s}};m(dt,"defaultMaxListeners",10),m(dt,"errorMonitor",Symbol("events.errorMonitor"));var M=dt;function Bi(t){(!t._events||!(t._events instanceof Map))&&(t._events=new Map)}var Si=ce(M,Bi);function Ii(){let t=Si;return t.EventEmitter=Si,t.once=M.once,t.defaultMaxListeners=M.defaultMaxListeners,t}var zc=new TextEncoder,Gc=new TextDecoder;function _n(t){switch(String(t??"utf8").toLowerCase()){case"utf8":case"utf-8":return"utf8";case"hex":return"hex";case"base64":return"base64";case"base64url":return"base64url";case"latin1":case"binary":return"latin1";case"ascii":return"ascii";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";default:throw new TypeError(`Unknown encoding: ${String(t)}`)}}function Yc(t){let e=t.replace(/[^A-Za-z0-9+/\-_]/g,"").replace(/-/g,"+").replace(/_/g,"/"),r=e+"=".repeat((4-e.length%4)%4),n=atob(e.length%4===1?r.slice(0,-3):r),s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);return s}function ur(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return e}function se(t,e){switch(_n(e)){case"utf8":return zc.encode(t);case"hex":{let r=Math.floor(t.length/2),n=new Uint8Array(r);for(let s=0;s<r;s++){let i=parseInt(t.substr(s*2,2),16);if(Number.isNaN(i))return n.subarray(0,s);n[s]=i}return n}case"base64":case"base64url":return Yc(t);case"utf16le":{let r=new Uint8Array(t.length*2);for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);r[n*2]=s&255,r[n*2+1]=s>>8}return r}default:{let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n)&255;return r}}}function Dn(t,e){switch(_n(e)){case"utf8":return Gc.decode(t);case"hex":return Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");case"base64":return btoa(ur(t));case"base64url":return btoa(ur(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");case"ascii":return ur(t.map(r=>r&127));case"utf16le":{let r="";for(let n=0;n+1<t.length;n+=2)r+=String.fromCharCode(t[n]|t[n+1]<<8);return r}default:return ur(t)}}var Vc=Uint8Array,ne=class ne extends Vc{constructor(e,r,n){typeof e=="string"?super(se(e,r)):e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer?super(e,r,n):super(e)}static from(e,r,n){if(typeof e=="string")return new ne(se(e,r));if(e instanceof ArrayBuffer)return new ne(e,r,n);if(ArrayBuffer.isView(e))return new ne(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e&&e.type==="Buffer"&&Array.isArray(e.data))return new ne(e.data);if(e&&typeof e=="object"&&typeof e.length=="number")return new ne(e);throw new TypeError("The first argument must be of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}static alloc(e,r,n){let s=new ne(e);return r!==void 0&&r!==0&&s.fill(r,0,e,n),s}static allocUnsafe(e){return new ne(e)}static allocUnsafeSlow(e){return new ne(e)}static isBuffer(e){return e instanceof ne}static isEncoding(e){try{return _n(e),typeof e=="string"}catch{return!1}}static byteLength(e,r){return typeof e=="string"?se(e,r).length:e.byteLength}static concat(e,r){let n=r??e.reduce((o,a)=>o+a.length,0),s=ne.alloc(n),i=0;for(let o of e){if(i>=n)break;s.set(o.subarray(0,n-i),i),i+=o.length}return s}static compare(e,r){let n=Math.min(e.length,r.length);for(let s=0;s<n;s++)if(e[s]!==r[s])return e[s]<r[s]?-1:1;return Math.sign(e.length-r.length)}get parent(){return this.buffer}toString(e,r=0,n=this.length){return Dn(this.subarray(Math.max(0,r),Math.min(this.length,n)),e)}toLocaleString(){return this.toString()}toJSON(){return{type:"Buffer",data:Array.from(this)}}equals(e){return ne.compare(this,e)===0}compare(e,r=0,n=e.length,s=0,i=this.length){return ne.compare(this.subarray(s,i),e.subarray(r,n))}copy(e,r=0,n=0,s=this.length){let i=this.subarray(n,Math.min(s,n+(e.length-r)));return e.set(i,r),i.length}slice(e,r){return this.subarray(e,r)}subarray(e,r){let n=super.subarray(e,r);return new ne(n.buffer,n.byteOffset,n.length)}write(e,r,n,s){typeof r=="string"?[s,r,n]=[r,0,void 0]:typeof n=="string"&&([s,n]=[n,void 0]);let i=r??0,o=se(e,s).subarray(0,Math.min(n??1/0,this.length-i));return this.set(o,i),o.length}fill(e,r=0,n=this.length,s){if(typeof r=="string"&&([s,r]=[r,0]),typeof e=="number")return super.fill(e&255,r,n);let i=typeof e=="string"?se(e,s):e;if(!i.length)return super.fill(0,r,n);for(let o=r,a=0;o<n;o++,a=(a+1)%i.length)this[o]=i[a];return this}indexOf(e,r=0,n){if(typeof e=="number")return super.indexOf(e&255,r);let s=typeof e=="string"?se(e,n):e,i=r<0?Math.max(0,this.length+r):r;if(!s.length)return Math.min(i,this.length);e:for(let o=i;o<=this.length-s.length;o++){for(let a=0;a<s.length;a++)if(this[o+a]!==s[a])continue e;return o}return-1}lastIndexOf(e,r=this.length,n){if(typeof e=="number")return super.lastIndexOf(e&255,r);let s=typeof e=="string"?se(e,n):e;e:for(let i=Math.min(r,this.length-s.length);i>=0;i--){for(let o=0;o<s.length;o++)if(this[i+o]!==s[o])continue e;return i}return-1}includes(e,r=0,n){return this.indexOf(e,r,n)!==-1}view(){return new DataView(this.buffer,this.byteOffset,this.byteLength)}readUInt8(e=0){return this.view().getUint8(e)}readUInt16LE(e=0){return this.view().getUint16(e,!0)}readUInt16BE(e=0){return this.view().getUint16(e)}readUInt32LE(e=0){return this.view().getUint32(e,!0)}readUInt32BE(e=0){return this.view().getUint32(e)}readInt8(e=0){return this.view().getInt8(e)}readInt16LE(e=0){return this.view().getInt16(e,!0)}readInt16BE(e=0){return this.view().getInt16(e)}readInt32LE(e=0){return this.view().getInt32(e,!0)}readInt32BE(e=0){return this.view().getInt32(e)}readFloatLE(e=0){return this.view().getFloat32(e,!0)}readFloatBE(e=0){return this.view().getFloat32(e)}readDoubleLE(e=0){return this.view().getFloat64(e,!0)}readDoubleBE(e=0){return this.view().getFloat64(e)}readBigUInt64LE(e=0){return this.view().getBigUint64(e,!0)}readBigUInt64BE(e=0){return this.view().getBigUint64(e)}readBigInt64LE(e=0){return this.view().getBigInt64(e,!0)}readBigInt64BE(e=0){return this.view().getBigInt64(e)}writeUInt8(e,r=0){return this.view().setUint8(r,e),r+1}writeUInt16LE(e,r=0){return this.view().setUint16(r,e,!0),r+2}writeUInt16BE(e,r=0){return this.view().setUint16(r,e),r+2}writeUInt32LE(e,r=0){return this.view().setUint32(r,e,!0),r+4}writeUInt32BE(e,r=0){return this.view().setUint32(r,e),r+4}writeInt8(e,r=0){return this.view().setInt8(r,e),r+1}writeInt16LE(e,r=0){return this.view().setInt16(r,e,!0),r+2}writeInt16BE(e,r=0){return this.view().setInt16(r,e),r+2}writeInt32LE(e,r=0){return this.view().setInt32(r,e,!0),r+4}writeInt32BE(e,r=0){return this.view().setInt32(r,e),r+4}writeFloatLE(e,r=0){return this.view().setFloat32(r,e,!0),r+4}writeFloatBE(e,r=0){return this.view().setFloat32(r,e),r+4}writeDoubleLE(e,r=0){return this.view().setFloat64(r,e,!0),r+8}writeDoubleBE(e,r=0){return this.view().setFloat64(r,e),r+8}writeBigUInt64LE(e,r=0){return this.view().setBigUint64(r,e,!0),r+8}writeBigUInt64BE(e,r=0){return this.view().setBigUint64(r,e),r+8}};m(ne,"poolSize",8192);var D=ne;for(let t of Object.getOwnPropertyNames(D.prototype)){let e=t.replace(/UInt/,"Uint");e!==t&&Object.defineProperty(D.prototype,e,Object.getOwnPropertyDescriptor(D.prototype,t))}function Qi(){return{Buffer:D,SlowBuffer:D,kMaxLength:2**31-1,constants:{MAX_LENGTH:2**31-1,MAX_STRING_LENGTH:2**29-24},INSPECT_MAX_BYTES:50,Blob:globalThis.Blob,atob:globalThis.atob,btoa:globalThis.btoa}}var He=class{constructor(e){m(this,"code");this.code=e}};function T(t){queueMicrotask(()=>{try{t()}catch(e){if(!(e instanceof He))throw e}})}var we=T,dr=(t,e)=>t.objectMode?1:e.length;function ht(t,e={}){let r=!!(e.objectMode||e.readableObjectMode);t._readableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),buffer:[],length:0,flowing:null,ended:!1,endEmitted:!1,reading:!1,destroyed:!1,closed:!1,errored:null,encoding:e.encoding??null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0,flowScheduled:!1,pipes:[]},typeof e.read=="function"&&(t._read=e.read),typeof e.destroy=="function"&&(t._destroy=e.destroy),e.signal?.addEventListener("abort",()=>t.destroy(new Error("The operation was aborted")))}var X=class t extends M{constructor(e){super(),ht(this,e)}static from(e,r={}){if(typeof e=="string"||e instanceof Uint8Array){let i=new t({objectMode:!1,...r,read(){}});return i.push(e),i.push(null),i}let n=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator](),s=!1;return new t({objectMode:!0,...r,async read(){if(!s){s=!0;try{for(;;){let{value:i,done:o}=await n.next();if(o){this.push(null);break}if(!this.push(await i))break}}catch(i){this.destroy(i)}finally{s=!1}}}})}get readable(){let e=this._readableState;return!!e&&!e.destroyed&&!e.endEmitted&&!e.errored}set readable(e){}get readableEnded(){return this._readableState.endEmitted}get readableFlowing(){return this._readableState.flowing}get readableLength(){return this._readableState.length}get readableHighWaterMark(){return this._readableState.highWaterMark}get readableObjectMode(){return this._readableState.objectMode}get readableEncoding(){return this._readableState.encoding}get destroyed(){return this._readableState.destroyed}set destroyed(e){this._readableState.destroyed=e}get closed(){return this._readableState.closed}get errored(){return this._readableState.errored}_read(e){throw new Error("The _read() method is not implemented")}_destroy(e,r){r(e)}push(e,r){let n=this._readableState;if(n.reading=!1,e===null)return n.ended=!0,this._scheduleFlow(),!1;if(n.ended||n.destroyed)return!1;let s=e;return!n.objectMode&&(typeof s=="string"?s=n.encoding?s:D.from(s,r):s instanceof Uint8Array&&!(s instanceof D)&&(s=D.from(s.buffer,s.byteOffset,s.byteLength)),n.encoding&&s instanceof Uint8Array&&(s=s.toString(n.encoding)),s.length===0)||(n.buffer.push(s),n.length+=dr(n,s),this._scheduleFlow()),n.length<n.highWaterMark}unshift(e){let r=this._readableState;r.buffer.unshift(e),r.length+=dr(r,e)}read(e){let r=this._readableState;if(!r.buffer.length)return r.ended?this._scheduleFlow():this._pull(),null;let n;if(r.objectMode)n=r.buffer.shift();else if(e===void 0||e>=r.length){if(e!==void 0&&e>r.length&&!r.ended)return this._pull(),null;n=r.encoding?r.buffer.join(""):r.buffer.length===1?r.buffer[0]:D.concat(r.buffer),r.buffer=[]}else{let s=r.encoding?r.buffer.join(""):D.concat(r.buffer);n=s.slice(0,e),r.buffer=[s.slice(e)]}return r.length-=dr(r,n),r.length<r.highWaterMark&&this._pull(),r.ended&&!r.buffer.length&&this._scheduleFlow(),n}setEncoding(e){let r=this._readableState;return r.encoding=e,r.buffer=r.buffer.map(n=>n instanceof Uint8Array?n.toString(e):n),this}on(e,r){super.on(e,r);let n=this._readableState;return e==="data"&&n.flowing!==!1&&this.resume(),e==="readable"&&(n.flowing=!1,this._scheduleFlow()),this}addListener(e,r){return this.on(e,r)}resume(){return this._readableState.flowing=!0,this._scheduleFlow(),this}pause(){return this._readableState.flowing=!1,this}isPaused(){return this._readableState.flowing===!1}pipe(e,r={}){this._readableState.pipes.push(e);let s=i=>{e.write(i)===!1&&(this.pause(),(e.once??e.on)?.call(e,"drain",()=>this.resume()))};return this.on("data",s),r.end!==!1&&this.once("end",()=>e.end()),e.emit?.("pipe",this),this.resume(),e}unpipe(e){let r=this._readableState;return r.pipes=e?r.pipes.filter(n=>n!==e):[],r.pipes.length||this.removeAllListeners("data"),this}destroy(e){let r=this._readableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{we(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}async*[Symbol.asyncIterator](){let e=this._readableState,r,n,s=()=>{r?.(),r=void 0};this.on("readable",s),this.on("end",s),this.on("close",s),this.on("error",i=>{n=i,s()});try{for(;;){if(n)throw n;let i=this.read();if(i!==null){yield i;continue}if(e.endEmitted||e.ended&&!e.length||e.destroyed){if(n)throw n;return}await new Promise(o=>r=o)}}finally{e.endEmitted||this.destroy()}}_pull(){let e=this._readableState;if(!(e.reading||e.ended||e.destroyed)){e.reading=!0;try{this._read(e.highWaterMark)}catch(r){this.destroy(r)}}}_scheduleFlow(){let e=this._readableState;e.flowScheduled||(e.flowScheduled=!0,we(()=>{e.flowScheduled=!1,this._flow()}))}_flow(){let e=this._readableState;if(!e.destroyed){for(e.flowing===!1&&e.buffer.length&&this.emit("readable");e.flowing===!0&&e.buffer.length;){let r=e.buffer.shift();e.length-=dr(e,r),this.emit("data",r)}if(e.ended&&!e.buffer.length){if(!e.endEmitted&&(e.flowing!==null||this.listenerCount("end")||this.listenerCount("readable"))){e.flowing===!1&&this.emit("readable"),e.endEmitted=!0,this.emit("end");let r=this._writableState;e.autoDestroy&&(!r||r.finished)&&this.destroy()}return}e.flowing&&e.length<e.highWaterMark&&this._pull()}}};function ki(t){let e=t instanceof Error?t:new Error(String(t));return{kind:"error",error:{name:e.name,message:e.message,stack:e.stack}}}function Zc(t){let e=new Error(t.error.message);return e.name=t.error.name,t.error.stack&&(e.stack=t.error.stack),e}var Xc=1,On=class extends M{constructor(r,n){super();m(this,"ipc");m(this,"keepAlive");this.ipc=r,this.keepAlive=xn(this,["message"],n,()=>r.connected,()=>{r.onMessage(s=>{let{kind:i,value:o}=s;i==="message"&&n._run(()=>this.emit("message",o))})}),r.onDisconnect(()=>{n._run(()=>this.emit("close")),this.keepAlive.update()})}postMessage(r){this.ipc.send({kind:"message",value:r})}close(){this.ipc.disconnect()}start(){}ref(){return this.keepAlive.ref(),this}unref(){return this.keepAlive.unref(),this}};function xi(t){let{loop:e}=t,r=new Map;class n extends M{constructor(a,c={}){super();m(this,"threadId",Xc++);m(this,"resourceLimits",{});m(this,"stdin",null);m(this,"stdout");m(this,"stderr");m(this,"handle");m(this,"release");m(this,"terminated",!1);this.stdout=new X({read(){}}),this.stderr=new X({read(){}});let u=a instanceof URL?decodeURIComponent(a.pathname):String(a),f=c.eval?["-e",u]:[u.startsWith("/")?u:k(t.cwd(),u)],l={},d=typeof c.env=="object"?c.env:t.env();for(let[p,y]of Object.entries(d))y!==void 0&&(l[p]=String(y));this.release=e.hold();try{this.handle=t.system.spawn("node",[...f,...(c.argv??[]).map(String)],{cwd:t.cwd(),env:l,ipc:!0,thread:{threadId:this.threadId,workerData:c.workerData??null}})}catch(p){this.releaseLoop(),queueMicrotask(()=>e._run(()=>this.emit("error",p)));return}let h=this.handle;h.onStdout(p=>c.stdout?this.stdout.push(D.from(p)):t.stdout(p)),h.onStderr(p=>c.stderr?this.stderr.push(D.from(p)):t.stderr(p)),h.ipc?.onMessage(p=>{let y=p;e._run(()=>y.kind==="error"?this.emit("error",Zc(y)):this.emit("message",y.value))}),queueMicrotask(()=>e._run(()=>this.emit("online"))),h.exit.then(p=>{this.stdout.push(null),this.stderr.push(null),e._run(()=>this.emit("exit",this.terminated?1:p)),this.releaseLoop()})}postMessage(a){this.handle?.ipc?.send({kind:"message",value:a})}terminate(){return this.handle?(this.terminated=!0,this.handle.kill("SIGKILL"),this.handle.exit.then(()=>1)):Promise.resolve(1)}ref(){return!this.release&&!this.terminated&&(this.release=e.hold()),this}unref(){return this.releaseLoop(),this}getHeapSnapshot(){return Promise.reject(Object.assign(new Error("Heap snapshots are not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"}))}releaseLoop(){this.release?.(),this.release=void 0}}let s=!!t.thread&&!!t.ipc;return{isMainThread:!s,parentPort:s?new On(t.ipc,e):null,workerData:t.thread?.workerData??null,threadId:t.thread?.threadId??0,resourceLimits:{},Worker:n,MessageChannel:globalThis.MessageChannel,MessagePort:globalThis.MessagePort,BroadcastChannel:globalThis.BroadcastChannel,receiveMessageOnPort:()=>{},markAsUntransferable:()=>{},isMarkedAsUntransferable:()=>!1,moveMessagePortToContext:i=>i,setEnvironmentData:(i,o)=>void r.set(i,o),getEnvironmentData:i=>r.get(i),SHARE_ENV:Symbol.for("nodejs.worker_threads.SHARE_ENV")}}function _i(t,e){let r=[];for(let n of t.split("/"))!n||n==="."||(n===".."?r.length&&r[r.length-1]!==".."?r.pop():e&&r.push(".."):r.push(n));return r.join("/")}function Di(t){let e=n=>{if(typeof n!="string")throw new TypeError(`The "path" argument must be of type string. Received ${typeof n}`)},r={sep:"/",delimiter:":",normalize(n){if(e(n),!n)return".";let s=n.startsWith("/"),i=n.endsWith("/"),o=_i(n,!s);return!o&&!s&&(o="."),o&&i&&(o+="/"),s?"/"+o:o},join(...n){n.forEach(e);let s=n.filter(Boolean).join("/");return s?r.normalize(s):"."},resolve(...n){let s="";for(let o=n.length-1;o>=-1&&!s.startsWith("/");o--){let a=o>=0?n[o]:t();e(a),a&&(s=s?`${a}/${s}`:a)}return"/"+_i(s,!1)},isAbsolute(n){return e(n),n.startsWith("/")},relative(n,s){let i=r.resolve(n).split("/").filter(Boolean),o=r.resolve(s).split("/").filter(Boolean),a=0;for(;a<i.length&&a<o.length&&i[a]===o[a];)a++;return[...i.slice(a).map(()=>".."),...o.slice(a)].join("/")},dirname(n){if(e(n),!n)return".";let s=n.length>1?n.replace(/\/+$/,""):n,i=s.lastIndexOf("/");return i<0?".":i===0?"/":s.slice(0,i)},basename(n,s){e(n);let i=n.length>1?n.replace(/\/+$/,""):n,o=i.slice(i.lastIndexOf("/")+1);return s&&o.endsWith(s)&&o!==s&&(o=o.slice(0,-s.length)),o},extname(n){let s=r.basename(n),i=s.lastIndexOf(".");return i<=0?"":s.slice(i)},parse(n){let s=n.startsWith("/")?"/":"",i=r.basename(n),o=r.extname(n),a=r.dirname(n),c=a==="."&&!n.includes("/")?"":a;return{root:s,dir:c,base:i,ext:o,name:o?i.slice(0,-o.length):i}},format(n){let s=n.dir??n.root??"",i=n.base??`${n.name??""}${n.ext??""}`;return s?s===n.root?`${s}${i}`:`${s}/${i}`:i},toNamespacedPath(n){return n},matchesGlob(n,s){let i=s.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\/?/g,"\0").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").replace(/\u0000/g,"(?:.*/)?");return new RegExp(`^${i}$`).test(n)}};return r.posix=r,r.win32=r,r}var Oi=Symbol.for("nodejs.util.inspect.custom"),el=/^[A-Za-z_$][\w$]*$/;function Ni(t){let e=t.includes("'")&&!t.includes('"')?'"':"'";return e+t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(new RegExp(e,"g"),"\\"+e)+e}function hr(t){return typeof t=="symbol"?`[${t.toString()}]`:el.test(t)?t:Ni(t)}function pt(t,e,r,n,s){if(!e.length)return`${t}${r}`;let i=`${t} ${e.join(", ")} ${r}`;if(i.length+s.length<=n&&!e.some(a=>a.includes(`
15
+ `),this.line="",this.options.signal("SIGINT");break;case"":this.options.signal("SIGQUIT");break;case"":this.line?(this.options.deliver(this.line),this.line=""):this.options.deliver(null);break;case"":this.options.echo("\b \b".repeat([...this.line].length)),this.line="";break;default:(n>=" "||n===" ")&&(this.line+=n,this.options.echo(n))}}};var Pc=1e3;function Ci(){return Pc++}function kn(t){let e=t.pid??Ci(),r=new oe,n=new Set,s=new Set,i=new Set,o=new AbortController,a=A=>u||n.forEach(g=>g(A)),c=A=>u||s.forEach(g=>g(A)),u=!1,f=()=>{},l=(A="SIGTERM")=>{u||(o.signal.aborted?A==="SIGKILL"&&f(137):o.abort(A))},d=t.terminal?{...t.terminal}:void 0,h=d?new Xe({echo:a,deliver:A=>r.push(A),signal:A=>l(A)}):void 0,p={stdout:a,stderr:c,onStdin:A=>r.subscribe(A),terminal:d&&h?{get cols(){return d.cols},get rows(){return d.rows},onResize(A){return i.add(A),()=>i.delete(A)},setRawMode(A){h.raw=A}}:void 0},y=new Set,b={...t.system,spawn(A,g,w){let S=t.system.spawn(A,g,w);return w?.detached||(y.add(S),S.exit.then(()=>y.delete(S))),S}},E=(A,g)=>{t.channel?.disconnect(),u=!0;for(let w of y)w.kill("SIGTERM");A(g)},C=new Promise(A=>{f=g=>E(A,g),queueMicrotask(async()=>{let g;try{g=await t.program({args:t.args,cwd:t.cwd,env:t.env,io:p,system:b,signal:o.signal,ipc:t.channel,thread:t.thread})}catch(w){p.stderr(`${w instanceof Error?w.stack??w.message:String(w)}
16
+ `),g=1}E(A,g)})});return{pid:e,onStdout(A){return n.add(A),()=>n.delete(A)},onStderr(A){return s.add(A),()=>s.delete(A)},write(A){h?h.input(typeof A=="string"?A:new TextDecoder().decode(A)):r.push(A)},closeStdin:()=>r.push(null),kill:l,resize(A,g){d&&(d.cols=A,d.rows=g,i.forEach(w=>w(A,g)))},exit:C}}function cr(t,e=()=>{}){let r=new Set,n=new Set,s=[],i=!0,o=c=>{i&&(i=!1,s=[],c&&e(),queueMicrotask(()=>n.forEach(u=>u())))};return{endpoint:{send(c){if(!i)throw Object.assign(new Error("Channel closed"),{code:"ERR_IPC_CHANNEL_CLOSED"});t(structuredClone(c))},onMessage(c){if(r.add(c),s.length){let u=s;s=[],queueMicrotask(()=>u.forEach(f=>c(f)))}return()=>r.delete(c)},disconnect:()=>o(!0),onDisconnect(c){return n.add(c),()=>n.delete(c)},get connected(){return i}},receive(c){i&&(r.size?queueMicrotask(()=>r.forEach(u=>u(c))):s.push(c))},closed:()=>o(!1)}}var lr=(t,e)=>t<<e|t>>>32-e,Be=(t,e)=>t>>>e|t<<32-e;function fr(t,e,r,n){let s=t.length*8,i=Math.ceil((t.length+1+r)/e)*e,o=new Uint8Array(i);o.set(t),o[t.length]=128;let a=new DataView(o.buffer),c=Math.floor(s/2**32),u=s>>>0;return n?(a.setUint32(i-8,u,!0),a.setUint32(i-4,c,!0)):(a.setUint32(i-4,u),a.setUint32(i-8,c)),o}var jc=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Kc=Array.from({length:64},(t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function Hc(t){let e=fr(t,64,8,!0),r=new DataView(e.buffer),n=1732584193,s=4023233417,i=2562383102,o=271733878;for(let c=0;c<e.length;c+=64){let u=n,f=s,l=i,d=o;for(let h=0;h<64;h++){let p,y;h<16?[p,y]=[f&l|~f&d,h]:h<32?[p,y]=[d&f|~d&l,(5*h+1)%16]:h<48?[p,y]=[f^l^d,(3*h+5)%16]:[p,y]=[l^(f|~d),7*h%16];let b=d;d=l,l=f,f=f+lr(u+p+Kc[h]+r.getUint32(c+y*4,!0)|0,jc[(h>>4)*4+h%4])|0,u=b}n=n+u|0,s=s+f|0,i=i+l|0,o=o+d|0}let a=new DataView(new ArrayBuffer(16));return[n,s,i,o].forEach((c,u)=>a.setUint32(u*4,c,!0)),new Uint8Array(a.buffer)}function Wc(t){let e=fr(t,64,8,!1),r=new DataView(e.buffer),n=[1732584193,4023233417,2562383102,271733878,3285377520],s=new Int32Array(80);for(let o=0;o<e.length;o+=64){for(let d=0;d<16;d++)s[d]=r.getInt32(o+d*4);for(let d=16;d<80;d++)s[d]=lr(s[d-3]^s[d-8]^s[d-14]^s[d-16],1);let[a,c,u,f,l]=n;for(let d=0;d<80;d++){let[h,p]=d<20?[c&u|~c&f,1518500249]:d<40?[c^u^f,1859775393]:d<60?[c&u|c&f|u&f,2400959708]:[c^u^f,3395469782],y=lr(a,5)+h+l+p+s[d]|0;l=f,f=u,u=lr(c,30),c=a,a=y}n[0]=n[0]+a|0,n[1]=n[1]+c|0,n[2]=n[2]+u|0,n[3]=n[3]+f|0,n[4]=n[4]+l|0}let i=new DataView(new ArrayBuffer(20));return n.forEach((o,a)=>i.setUint32(a*4,o>>>0)),new Uint8Array(i.buffer)}var Jc=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function vi(t,e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=8){let n=fr(t,64,8,!1),s=new DataView(n.buffer),i=[...e],o=new Int32Array(64);for(let c=0;c<n.length;c+=64){for(let E=0;E<16;E++)o[E]=s.getInt32(c+E*4);for(let E=16;E<64;E++){let C=Be(o[E-15],7)^Be(o[E-15],18)^o[E-15]>>>3,A=Be(o[E-2],17)^Be(o[E-2],19)^o[E-2]>>>10;o[E]=o[E-16]+C+o[E-7]+A|0}let[u,f,l,d,h,p,y,b]=i;for(let E=0;E<64;E++){let C=b+(Be(h,6)^Be(h,11)^Be(h,25))+(h&p^~h&y)+Jc[E]+o[E]|0,A=(Be(u,2)^Be(u,13)^Be(u,22))+(u&f^u&l^f&l)|0;b=y,y=p,p=h,h=d+C|0,d=l,l=f,f=u,u=C+A|0}[u,f,l,d,h,p,y,b].forEach((E,C)=>i[C]=i[C]+E|0)}let a=new DataView(new ArrayBuffer(r*4));for(let c=0;c<r;c++)a.setUint32(c*4,i[c]>>>0);return new Uint8Array(a.buffer)}var qc=["428a2f98d728ae22","7137449123ef65cd","b5c0fbcfec4d3b2f","e9b5dba58189dbbc","3956c25bf348b538","59f111f1b605d019","923f82a4af194f9b","ab1c5ed5da6d8118","d807aa98a3030242","12835b0145706fbe","243185be4ee4b28c","550c7dc3d5ffb4e2","72be5d74f27b896f","80deb1fe3b1696b1","9bdc06a725c71235","c19bf174cf692694","e49b69c19ef14ad2","efbe4786384f25e3","0fc19dc68b8cd5b5","240ca1cc77ac9c65","2de92c6f592b0275","4a7484aa6ea6e483","5cb0a9dcbd41fbd4","76f988da831153b5","983e5152ee66dfab","a831c66d2db43210","b00327c898fb213f","bf597fc7beef0ee4","c6e00bf33da88fc2","d5a79147930aa725","06ca6351e003826f","142929670a0e6e70","27b70a8546d22ffc","2e1b21385c26c926","4d2c6dfc5ac42aed","53380d139d95b3df","650a73548baf63de","766a0abb3c77b2a8","81c2c92e47edaee6","92722c851482353b","a2bfe8a14cf10364","a81a664bbc423001","c24b8b70d0f89791","c76c51a30654be30","d192e819d6ef5218","d69906245565a910","f40e35855771202a","106aa07032bbd1b8","19a4c116b8d2d0c8","1e376c085141ab53","2748774cdf8eeb99","34b0bcb5e19b48a8","391c0cb3c5c95a63","4ed8aa4ae3418acb","5b9cca4f7763e373","682e6ff3d6b2b8a3","748f82ee5defb2fc","78a5636f43172f60","84c87814a1f0ab72","8cc702081a6439ec","90befffa23631e28","a4506cebde82bde9","bef9a3f7b2c67915","c67178f2e372532b","ca273eceea26619c","d186b8c721c0c207","eada7dd6cde0eb1e","f57d4f7fee6ed178","06f067aa72176fba","0a637dc5a2c898a6","113f9804bef90dae","1b710b35131c471b","28db77f523047d84","32caab7b40c72493","3c9ebe0a15c9bebc","431d67c49c100d4c","4cc5d4becb3e42b6","597f299cfc657e2a","5fcb6fab3ad6faec","6c44198c4a475817"].map(t=>BigInt("0x"+t)),Ke=(1n<<64n)-1n,Ie=(t,e)=>(t>>e|t<<64n-e)&Ke;function Si(t,e,r){let n=fr(t,128,16,!1),s=new DataView(n.buffer),i=e.map(c=>BigInt("0x"+c)),o=new Array(80);for(let c=0;c<n.length;c+=128){for(let E=0;E<16;E++)o[E]=s.getBigUint64(c+E*8);for(let E=16;E<80;E++){let C=Ie(o[E-15],1n)^Ie(o[E-15],8n)^o[E-15]>>7n,A=Ie(o[E-2],19n)^Ie(o[E-2],61n)^o[E-2]>>6n;o[E]=o[E-16]+C+o[E-7]+A&Ke}let[u,f,l,d,h,p,y,b]=i;for(let E=0;E<80;E++){let C=b+(Ie(h,14n)^Ie(h,18n)^Ie(h,41n))+(h&p^~h&Ke&y)+qc[E]+o[E]&Ke,A=(Ie(u,28n)^Ie(u,34n)^Ie(u,39n))+(u&f^u&l^f&l)&Ke;b=y,y=p,p=h,h=d+C&Ke,d=l,l=f,f=u,u=C+A&Ke}[u,f,l,d,h,p,y,b].forEach((E,C)=>i[C]=i[C]+E&Ke)}let a=new DataView(new ArrayBuffer(64));return i.forEach((c,u)=>a.setBigUint64(u*8,c)),new Uint8Array(a.buffer).slice(0,r)}var zc=["6a09e667f3bcc908","bb67ae8584caa73b","3c6ef372fe94f82b","a54ff53a5f1d36f1","510e527fade682d1","9b05688c2b3e6c1f","1f83d9abfb41bd6b","5be0cd19137e2179"],Gc=["cbbb9d5dc1059ed8","629a292a367cd507","9159015a3070dd17","152fecd8f70e5939","67332667ffc00b31","8eb44a8768581511","db0c2e0d64f98fa7","47b5481dbefa4fa4"],xn={md5:{digest:Hc,blockSize:64},sha1:{digest:Wc,blockSize:64},sha256:{digest:t=>vi(t),blockSize:64},sha224:{digest:t=>vi(t,[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],7),blockSize:64},sha384:{digest:t=>Si(t,Gc,48),blockSize:128},sha512:{digest:t=>Si(t,zc,64),blockSize:128}};function Mt(t){let e=t.toLowerCase().replace(/^rsa-/,"").replace("-",""),r=xn[e];if(!r)throw new Error(`Digest method not supported: ${t}`);return r}function _n(t,e,r,n,s){let i,o=!0,a=!1,c=()=>e.some(l=>t.listenerCount(l)>0),u=()=>{!a&&c()&&(a=!0,s());let l=o&&n()&&c();l&&!i?i=r.hold():!l&&i&&(i(),i=void 0)},f=l=>{typeof l=="string"&&e.includes(l)&&queueMicrotask(u)};return t.on("newListener",f),t.on("removeListener",f),{update:u,ref(){o=!0,u()},unref(){o=!1,u()},hasRef:()=>o}}function Bi(t,e,r){let n=_n(t,["message","disconnect"],r,()=>e.connected,()=>{e.onMessage(s=>r._run(()=>t.emit("message",s,void 0)))});e.onDisconnect(()=>{t.connected=!1,r._run(()=>t.emit("disconnect")),n.update()}),Object.assign(t,{connected:!0,channel:{ref:n.ref,unref:n.unref,hasRef:n.hasRef},send(s,...i){let o=i.find(a=>typeof a=="function");try{e.send(s)}catch(a){if(!o)throw a;return queueMicrotask(()=>r._run(()=>o(a))),!1}return o&&queueMicrotask(()=>r._run(()=>o(null))),!0},disconnect:()=>e.disconnect()})}function ce(t,e){let r=function(...n){return new.target?Reflect.construct(t,n,new.target):(e(this,...n),this)};return Object.defineProperty(r,"name",{value:t.name}),r.prototype=t.prototype,Object.setPrototypeOf(r,t),Object.defineProperty(t.prototype,"constructor",{value:r,writable:!0,configurable:!0,enumerable:!1}),r}var ht=class ht{constructor(){Qi(this)}static once(e,r){return new Promise((n,s)=>{let i=a=>{e.removeListener(r,o),s(a)},o=(...a)=>{r!=="error"&&e.removeListener("error",i),n(a)};e.once(r,o),r!=="error"&&e.once("error",i)})}static listenerCount(e,r){return e.listenerCount(r)}addListener(e,r){return this._add(e,r,!1)}on(e,r){return this._add(e,r,!1)}prependListener(e,r){return this._add(e,r,!0)}once(e,r){return this._add(e,this._onceWrap(e,r),!1)}prependOnceListener(e,r){return this._add(e,this._onceWrap(e,r),!0)}removeListener(e,r){let n=this._events?.get(e);if(!n)return this;for(let s=n.length-1;s>=0;s--){let i=n[s];if(i===r||i.listener===r){n.splice(s,1),n.length||this._events.delete(e),this._events.has("removeListener")&&this.emit("removeListener",e,r);break}}return this}off(e,r){return this.removeListener(e,r)}removeAllListeners(e){return this._events?(e===void 0?this._events.clear():this._events.delete(e),this):this}emit(e,...r){let n=this._events?.get(e);if(e==="error"&&(this._events?.get(ht.errorMonitor)?.slice().forEach(s=>s.apply(this,r)),!n?.length)){let s=r[0];if(s instanceof Error)throw s;let i=new Error(`Unhandled error. (${String(s)})`);throw i.context=s,i}if(!n?.length)return!1;for(let s of n.slice())s.apply(this,r);return!0}listeners(e){return(this._events?.get(e)??[]).map(r=>r.listener??r)}rawListeners(e){return[...this._events?.get(e)??[]]}listenerCount(e){return this._events?.get(e)?.length??0}eventNames(){return[...this._events?.keys()??[]]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners??ht.defaultMaxListeners}_add(e,r,n){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type function');this._events||(this._events=new Map),this._events.has("newListener")&&this.emit("newListener",e,r.listener??r);let s=this._events.get(e)??[];return n?s.unshift(r):s.push(r),this._events.set(e,s),this}_onceWrap(e,r){let n=!1,s=(...i)=>{if(!n)return n=!0,this.removeListener(e,s),r.apply(this,i)};return s.listener=r,s}};m(ht,"defaultMaxListeners",10),m(ht,"errorMonitor",Symbol("events.errorMonitor"));var F=ht;function Qi(t){(!t._events||!(t._events instanceof Map))&&(t._events=new Map)}var Ii=ce(F,Qi);function ki(){let t=Ii;return t.EventEmitter=Ii,t.once=F.once,t.defaultMaxListeners=F.defaultMaxListeners,t}var Yc=new TextEncoder,Vc=new TextDecoder;function Dn(t){switch(String(t??"utf8").toLowerCase()){case"utf8":case"utf-8":return"utf8";case"hex":return"hex";case"base64":return"base64";case"base64url":return"base64url";case"latin1":case"binary":return"latin1";case"ascii":return"ascii";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";default:throw new TypeError(`Unknown encoding: ${String(t)}`)}}function Zc(t){let e=t.replace(/[^A-Za-z0-9+/\-_]/g,"").replace(/-/g,"+").replace(/_/g,"/"),r=e+"=".repeat((4-e.length%4)%4),n=atob(e.length%4===1?r.slice(0,-3):r),s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);return s}function ur(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return e}function se(t,e){switch(Dn(e)){case"utf8":return Yc.encode(t);case"hex":{let r=Math.floor(t.length/2),n=new Uint8Array(r);for(let s=0;s<r;s++){let i=parseInt(t.substr(s*2,2),16);if(Number.isNaN(i))return n.subarray(0,s);n[s]=i}return n}case"base64":case"base64url":return Zc(t);case"utf16le":{let r=new Uint8Array(t.length*2);for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);r[n*2]=s&255,r[n*2+1]=s>>8}return r}default:{let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n)&255;return r}}}function On(t,e){switch(Dn(e)){case"utf8":return Vc.decode(t);case"hex":return Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");case"base64":return btoa(ur(t));case"base64url":return btoa(ur(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");case"ascii":return ur(t.map(r=>r&127));case"utf16le":{let r="";for(let n=0;n+1<t.length;n+=2)r+=String.fromCharCode(t[n]|t[n+1]<<8);return r}default:return ur(t)}}var Xc=Uint8Array,ne=class ne extends Xc{constructor(e,r,n){typeof e=="string"?super(se(e,r)):e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer?super(e,r,n):super(e)}static from(e,r,n){if(typeof e=="string")return new ne(se(e,r));if(e instanceof ArrayBuffer)return new ne(e,r,n);if(ArrayBuffer.isView(e))return new ne(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e&&e.type==="Buffer"&&Array.isArray(e.data))return new ne(e.data);if(e&&typeof e=="object"&&typeof e.length=="number")return new ne(e);throw new TypeError("The first argument must be of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}static alloc(e,r,n){let s=new ne(e);return r!==void 0&&r!==0&&s.fill(r,0,e,n),s}static allocUnsafe(e){return new ne(e)}static allocUnsafeSlow(e){return new ne(e)}static isBuffer(e){return e instanceof ne}static isEncoding(e){try{return Dn(e),typeof e=="string"}catch{return!1}}static byteLength(e,r){return typeof e=="string"?se(e,r).length:e.byteLength}static concat(e,r){let n=r??e.reduce((o,a)=>o+a.length,0),s=ne.alloc(n),i=0;for(let o of e){if(i>=n)break;s.set(o.subarray(0,n-i),i),i+=o.length}return s}static compare(e,r){let n=Math.min(e.length,r.length);for(let s=0;s<n;s++)if(e[s]!==r[s])return e[s]<r[s]?-1:1;return Math.sign(e.length-r.length)}get parent(){return this.buffer}toString(e,r=0,n=this.length){return On(this.subarray(Math.max(0,r),Math.min(this.length,n)),e)}toLocaleString(){return this.toString()}toJSON(){return{type:"Buffer",data:Array.from(this)}}equals(e){return ne.compare(this,e)===0}compare(e,r=0,n=e.length,s=0,i=this.length){return ne.compare(this.subarray(s,i),e.subarray(r,n))}copy(e,r=0,n=0,s=this.length){let i=this.subarray(n,Math.min(s,n+(e.length-r)));return e.set(i,r),i.length}slice(e,r){return this.subarray(e,r)}subarray(e,r){let n=super.subarray(e,r);return new ne(n.buffer,n.byteOffset,n.length)}write(e,r,n,s){typeof r=="string"?[s,r,n]=[r,0,void 0]:typeof n=="string"&&([s,n]=[n,void 0]);let i=r??0,o=se(e,s).subarray(0,Math.min(n??1/0,this.length-i));return this.set(o,i),o.length}fill(e,r=0,n=this.length,s){if(typeof r=="string"&&([s,r]=[r,0]),typeof e=="number")return super.fill(e&255,r,n);let i=typeof e=="string"?se(e,s):e;if(!i.length)return super.fill(0,r,n);for(let o=r,a=0;o<n;o++,a=(a+1)%i.length)this[o]=i[a];return this}indexOf(e,r=0,n){if(typeof e=="number")return super.indexOf(e&255,r);let s=typeof e=="string"?se(e,n):e,i=r<0?Math.max(0,this.length+r):r;if(!s.length)return Math.min(i,this.length);e:for(let o=i;o<=this.length-s.length;o++){for(let a=0;a<s.length;a++)if(this[o+a]!==s[a])continue e;return o}return-1}lastIndexOf(e,r=this.length,n){if(typeof e=="number")return super.lastIndexOf(e&255,r);let s=typeof e=="string"?se(e,n):e;e:for(let i=Math.min(r,this.length-s.length);i>=0;i--){for(let o=0;o<s.length;o++)if(this[i+o]!==s[o])continue e;return i}return-1}includes(e,r=0,n){return this.indexOf(e,r,n)!==-1}view(){return new DataView(this.buffer,this.byteOffset,this.byteLength)}readUInt8(e=0){return this.view().getUint8(e)}readUInt16LE(e=0){return this.view().getUint16(e,!0)}readUInt16BE(e=0){return this.view().getUint16(e)}readUInt32LE(e=0){return this.view().getUint32(e,!0)}readUInt32BE(e=0){return this.view().getUint32(e)}readInt8(e=0){return this.view().getInt8(e)}readInt16LE(e=0){return this.view().getInt16(e,!0)}readInt16BE(e=0){return this.view().getInt16(e)}readInt32LE(e=0){return this.view().getInt32(e,!0)}readInt32BE(e=0){return this.view().getInt32(e)}readFloatLE(e=0){return this.view().getFloat32(e,!0)}readFloatBE(e=0){return this.view().getFloat32(e)}readDoubleLE(e=0){return this.view().getFloat64(e,!0)}readDoubleBE(e=0){return this.view().getFloat64(e)}readBigUInt64LE(e=0){return this.view().getBigUint64(e,!0)}readBigUInt64BE(e=0){return this.view().getBigUint64(e)}readBigInt64LE(e=0){return this.view().getBigInt64(e,!0)}readBigInt64BE(e=0){return this.view().getBigInt64(e)}writeUInt8(e,r=0){return this.view().setUint8(r,e),r+1}writeUInt16LE(e,r=0){return this.view().setUint16(r,e,!0),r+2}writeUInt16BE(e,r=0){return this.view().setUint16(r,e),r+2}writeUInt32LE(e,r=0){return this.view().setUint32(r,e,!0),r+4}writeUInt32BE(e,r=0){return this.view().setUint32(r,e),r+4}writeInt8(e,r=0){return this.view().setInt8(r,e),r+1}writeInt16LE(e,r=0){return this.view().setInt16(r,e,!0),r+2}writeInt16BE(e,r=0){return this.view().setInt16(r,e),r+2}writeInt32LE(e,r=0){return this.view().setInt32(r,e,!0),r+4}writeInt32BE(e,r=0){return this.view().setInt32(r,e),r+4}writeFloatLE(e,r=0){return this.view().setFloat32(r,e,!0),r+4}writeFloatBE(e,r=0){return this.view().setFloat32(r,e),r+4}writeDoubleLE(e,r=0){return this.view().setFloat64(r,e,!0),r+8}writeDoubleBE(e,r=0){return this.view().setFloat64(r,e),r+8}writeBigUInt64LE(e,r=0){return this.view().setBigUint64(r,e,!0),r+8}writeBigUInt64BE(e,r=0){return this.view().setBigUint64(r,e),r+8}};m(ne,"poolSize",8192);var D=ne;for(let t of Object.getOwnPropertyNames(D.prototype)){let e=t.replace(/UInt/,"Uint");e!==t&&Object.defineProperty(D.prototype,e,Object.getOwnPropertyDescriptor(D.prototype,t))}function xi(){return{Buffer:D,SlowBuffer:D,kMaxLength:2**31-1,constants:{MAX_LENGTH:2**31-1,MAX_STRING_LENGTH:2**29-24},INSPECT_MAX_BYTES:50,Blob:globalThis.Blob,atob:globalThis.atob,btoa:globalThis.btoa}}var He=class{constructor(e){m(this,"code");this.code=e}};function T(t){queueMicrotask(()=>{try{t()}catch(e){if(!(e instanceof He))throw e}})}var we=T,dr=(t,e)=>t.objectMode?1:e.length;function pt(t,e={}){let r=!!(e.objectMode||e.readableObjectMode);t._readableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),buffer:[],length:0,flowing:null,ended:!1,endEmitted:!1,reading:!1,destroyed:!1,closed:!1,errored:null,encoding:e.encoding??null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0,flowScheduled:!1,pipes:[]},typeof e.read=="function"&&(t._read=e.read),typeof e.destroy=="function"&&(t._destroy=e.destroy),e.signal?.addEventListener("abort",()=>t.destroy(new Error("The operation was aborted")))}var X=class t extends F{constructor(e){super(),pt(this,e)}static from(e,r={}){if(typeof e=="string"||e instanceof Uint8Array){let i=new t({objectMode:!1,...r,read(){}});return i.push(e),i.push(null),i}let n=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator](),s=!1;return new t({objectMode:!0,...r,async read(){if(!s){s=!0;try{for(;;){let{value:i,done:o}=await n.next();if(o){this.push(null);break}if(!this.push(await i))break}}catch(i){this.destroy(i)}finally{s=!1}}}})}get readable(){let e=this._readableState;return!!e&&!e.destroyed&&!e.endEmitted&&!e.errored}set readable(e){}get readableEnded(){return this._readableState.endEmitted}get readableFlowing(){return this._readableState.flowing}get readableLength(){return this._readableState.length}get readableHighWaterMark(){return this._readableState.highWaterMark}get readableObjectMode(){return this._readableState.objectMode}get readableEncoding(){return this._readableState.encoding}get destroyed(){return this._readableState.destroyed}set destroyed(e){this._readableState.destroyed=e}get closed(){return this._readableState.closed}get errored(){return this._readableState.errored}_read(e){throw new Error("The _read() method is not implemented")}_destroy(e,r){r(e)}push(e,r){let n=this._readableState;if(n.reading=!1,e===null)return n.ended=!0,this._scheduleFlow(),!1;if(n.ended||n.destroyed)return!1;let s=e;return!n.objectMode&&(typeof s=="string"?s=n.encoding?s:D.from(s,r):s instanceof Uint8Array&&!(s instanceof D)&&(s=D.from(s.buffer,s.byteOffset,s.byteLength)),n.encoding&&s instanceof Uint8Array&&(s=s.toString(n.encoding)),s.length===0)||(n.buffer.push(s),n.length+=dr(n,s),this._scheduleFlow()),n.length<n.highWaterMark}unshift(e){let r=this._readableState;r.buffer.unshift(e),r.length+=dr(r,e)}read(e){let r=this._readableState;if(!r.buffer.length)return r.ended?this._scheduleFlow():this._pull(),null;let n;if(r.objectMode)n=r.buffer.shift();else if(e===void 0||e>=r.length){if(e!==void 0&&e>r.length&&!r.ended)return this._pull(),null;n=r.encoding?r.buffer.join(""):r.buffer.length===1?r.buffer[0]:D.concat(r.buffer),r.buffer=[]}else{let s=r.encoding?r.buffer.join(""):D.concat(r.buffer);n=s.slice(0,e),r.buffer=[s.slice(e)]}return r.length-=dr(r,n),r.length<r.highWaterMark&&this._pull(),r.ended&&!r.buffer.length&&this._scheduleFlow(),n}setEncoding(e){let r=this._readableState;return r.encoding=e,r.buffer=r.buffer.map(n=>n instanceof Uint8Array?n.toString(e):n),this}on(e,r){super.on(e,r);let n=this._readableState;return e==="data"&&n.flowing!==!1&&this.resume(),e==="readable"&&(n.flowing=!1,this._scheduleFlow()),this}addListener(e,r){return this.on(e,r)}resume(){return this._readableState.flowing=!0,this._scheduleFlow(),this}pause(){return this._readableState.flowing=!1,this}isPaused(){return this._readableState.flowing===!1}pipe(e,r={}){this._readableState.pipes.push(e);let s=i=>{e.write(i)===!1&&(this.pause(),(e.once??e.on)?.call(e,"drain",()=>this.resume()))};return this.on("data",s),r.end!==!1&&this.once("end",()=>e.end()),e.emit?.("pipe",this),this.resume(),e}unpipe(e){let r=this._readableState;return r.pipes=e?r.pipes.filter(n=>n!==e):[],r.pipes.length||this.removeAllListeners("data"),this}destroy(e){let r=this._readableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{we(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}async*[Symbol.asyncIterator](){let e=this._readableState,r,n,s=()=>{r?.(),r=void 0};this.on("readable",s),this.on("end",s),this.on("close",s),this.on("error",i=>{n=i,s()});try{for(;;){if(n)throw n;let i=this.read();if(i!==null){yield i;continue}if(e.endEmitted||e.ended&&!e.length||e.destroyed){if(n)throw n;return}await new Promise(o=>r=o)}}finally{e.endEmitted||this.destroy()}}_pull(){let e=this._readableState;if(!(e.reading||e.ended||e.destroyed)){e.reading=!0;try{this._read(e.highWaterMark)}catch(r){this.destroy(r)}}}_scheduleFlow(){let e=this._readableState;e.flowScheduled||(e.flowScheduled=!0,we(()=>{e.flowScheduled=!1,this._flow()}))}_flow(){let e=this._readableState;if(!e.destroyed){for(e.flowing===!1&&e.buffer.length&&this.emit("readable");e.flowing===!0&&e.buffer.length;){let r=e.buffer.shift();e.length-=dr(e,r),this.emit("data",r)}if(e.ended&&!e.buffer.length){if(!e.endEmitted&&(e.flowing!==null||this.listenerCount("end")||this.listenerCount("readable"))){e.flowing===!1&&this.emit("readable"),e.endEmitted=!0,this.emit("end");let r=this._writableState;e.autoDestroy&&(!r||r.finished)&&this.destroy()}return}e.flowing&&e.length<e.highWaterMark&&this._pull()}}};function _i(t){let e=t instanceof Error?t:new Error(String(t));return{kind:"error",error:{name:e.name,message:e.message,stack:e.stack}}}function el(t){let e=new Error(t.error.message);return e.name=t.error.name,t.error.stack&&(e.stack=t.error.stack),e}var tl=1,Nn=class extends F{constructor(r,n){super();m(this,"ipc");m(this,"keepAlive");this.ipc=r,this.keepAlive=_n(this,["message"],n,()=>r.connected,()=>{r.onMessage(s=>{let{kind:i,value:o}=s;i==="message"&&n._run(()=>this.emit("message",o))})}),r.onDisconnect(()=>{n._run(()=>this.emit("close")),this.keepAlive.update()})}postMessage(r){this.ipc.send({kind:"message",value:r})}close(){this.ipc.disconnect()}start(){}ref(){return this.keepAlive.ref(),this}unref(){return this.keepAlive.unref(),this}};function Di(t){let{loop:e}=t,r=new Map;class n extends F{constructor(a,c={}){super();m(this,"threadId",tl++);m(this,"resourceLimits",{});m(this,"stdin",null);m(this,"stdout");m(this,"stderr");m(this,"handle");m(this,"release");m(this,"terminated",!1);this.stdout=new X({read(){}}),this.stderr=new X({read(){}});let u=a instanceof URL?decodeURIComponent(a.pathname):String(a),f=c.eval?["-e",u]:[u.startsWith("/")?u:k(t.cwd(),u)],l={},d=typeof c.env=="object"?c.env:t.env();for(let[p,y]of Object.entries(d))y!==void 0&&(l[p]=String(y));this.release=e.hold();try{this.handle=t.system.spawn("node",[...f,...(c.argv??[]).map(String)],{cwd:t.cwd(),env:l,ipc:!0,thread:{threadId:this.threadId,workerData:c.workerData??null}})}catch(p){this.releaseLoop(),queueMicrotask(()=>e._run(()=>this.emit("error",p)));return}let h=this.handle;h.onStdout(p=>c.stdout?this.stdout.push(D.from(p)):t.stdout(p)),h.onStderr(p=>c.stderr?this.stderr.push(D.from(p)):t.stderr(p)),h.ipc?.onMessage(p=>{let y=p;e._run(()=>y.kind==="error"?this.emit("error",el(y)):this.emit("message",y.value))}),queueMicrotask(()=>e._run(()=>this.emit("online"))),h.exit.then(p=>{this.stdout.push(null),this.stderr.push(null),e._run(()=>this.emit("exit",this.terminated?1:p)),this.releaseLoop()})}postMessage(a){this.handle?.ipc?.send({kind:"message",value:a})}terminate(){return this.handle?(this.terminated=!0,this.handle.kill("SIGKILL"),this.handle.exit.then(()=>1)):Promise.resolve(1)}ref(){return!this.release&&!this.terminated&&(this.release=e.hold()),this}unref(){return this.releaseLoop(),this}getHeapSnapshot(){return Promise.reject(Object.assign(new Error("Heap snapshots are not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"}))}releaseLoop(){this.release?.(),this.release=void 0}}let s=!!t.thread&&!!t.ipc;return{isMainThread:!s,parentPort:s?new Nn(t.ipc,e):null,workerData:t.thread?.workerData??null,threadId:t.thread?.threadId??0,resourceLimits:{},Worker:n,MessageChannel:globalThis.MessageChannel,MessagePort:globalThis.MessagePort,BroadcastChannel:globalThis.BroadcastChannel,receiveMessageOnPort:()=>{},markAsUntransferable:()=>{},isMarkedAsUntransferable:()=>!1,moveMessagePortToContext:i=>i,setEnvironmentData:(i,o)=>void r.set(i,o),getEnvironmentData:i=>r.get(i),SHARE_ENV:Symbol.for("nodejs.worker_threads.SHARE_ENV")}}function Oi(t,e){let r=[];for(let n of t.split("/"))!n||n==="."||(n===".."?r.length&&r[r.length-1]!==".."?r.pop():e&&r.push(".."):r.push(n));return r.join("/")}function Ni(t){let e=n=>{if(typeof n!="string")throw new TypeError(`The "path" argument must be of type string. Received ${typeof n}`)},r={sep:"/",delimiter:":",normalize(n){if(e(n),!n)return".";let s=n.startsWith("/"),i=n.endsWith("/"),o=Oi(n,!s);return!o&&!s&&(o="."),o&&i&&(o+="/"),s?"/"+o:o},join(...n){n.forEach(e);let s=n.filter(Boolean).join("/");return s?r.normalize(s):"."},resolve(...n){let s="";for(let o=n.length-1;o>=-1&&!s.startsWith("/");o--){let a=o>=0?n[o]:t();e(a),a&&(s=s?`${a}/${s}`:a)}return"/"+Oi(s,!1)},isAbsolute(n){return e(n),n.startsWith("/")},relative(n,s){let i=r.resolve(n).split("/").filter(Boolean),o=r.resolve(s).split("/").filter(Boolean),a=0;for(;a<i.length&&a<o.length&&i[a]===o[a];)a++;return[...i.slice(a).map(()=>".."),...o.slice(a)].join("/")},dirname(n){if(e(n),!n)return".";let s=n.length>1?n.replace(/\/+$/,""):n,i=s.lastIndexOf("/");return i<0?".":i===0?"/":s.slice(0,i)},basename(n,s){e(n);let i=n.length>1?n.replace(/\/+$/,""):n,o=i.slice(i.lastIndexOf("/")+1);return s&&o.endsWith(s)&&o!==s&&(o=o.slice(0,-s.length)),o},extname(n){let s=r.basename(n),i=s.lastIndexOf(".");return i<=0?"":s.slice(i)},parse(n){let s=n.startsWith("/")?"/":"",i=r.basename(n),o=r.extname(n),a=r.dirname(n),c=a==="."&&!n.includes("/")?"":a;return{root:s,dir:c,base:i,ext:o,name:o?i.slice(0,-o.length):i}},format(n){let s=n.dir??n.root??"",i=n.base??`${n.name??""}${n.ext??""}`;return s?s===n.root?`${s}${i}`:`${s}/${i}`:i},toNamespacedPath(n){return n},matchesGlob(n,s){let i=s.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\/?/g,"\0").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").replace(/\u0000/g,"(?:.*/)?");return new RegExp(`^${i}$`).test(n)}};return r.posix=r,r.win32=r,r}var Ri=Symbol.for("nodejs.util.inspect.custom"),rl=/^[A-Za-z_$][\w$]*$/;function Ti(t){let e=t.includes("'")&&!t.includes('"')?'"':"'";return e+t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(new RegExp(e,"g"),"\\"+e)+e}function hr(t){return typeof t=="symbol"?`[${t.toString()}]`:rl.test(t)?t:Ti(t)}function At(t,e,r,n,s){if(!e.length)return`${t}${r}`;let i=`${t} ${e.join(", ")} ${r}`;if(i.length+s.length<=n&&!e.some(a=>a.includes(`
17
17
  `)))return i;let o=s+" ";return`${t}
18
18
  ${e.map(a=>o+a).join(`,
19
19
  `)}
20
- ${s}${r}`}function $t(t){let e=Object.getPrototypeOf(t);if(e===null)return"[Object: null prototype]";let r=e?.constructor?.name;return r&&r!=="Object"?r:void 0}function V(t,e={}){let r=e.depth===null?1/0:e.depth??2,n=e.breakLength??80,s=[],i=(o,a,c,u)=>{switch(typeof o){case"string":return u?Ni(o):o;case"number":return Object.is(o,-0)?"-0":String(o);case"bigint":return`${o}n`;case"boolean":return String(o);case"undefined":return"undefined";case"symbol":return o.toString();case"function":{let p=o.name?`: ${o.name}`:" (anonymous)",y=/^class\s/.test(Function.prototype.toString.call(o))?"class":"Function",b=Object.keys(o),E=y==="class"?`[class ${o.name||"(anonymous)"}]`:`[${y}${p}]`;return!b.length||a>r?E:pt(`${E} {`,b.map(C=>`${hr(C)}: ${i(o[C],a+1,c+" ",!0)}`),"}",n,c)}}if(o===null)return"null";let f=o,l=f[Oi];if(typeof l=="function"){let p=l.call(f,r-a,{...e,stylize:y=>y},V);return typeof p=="string"?p:i(p,a,c,u)}if(s.includes(f))return"[Circular *1]";if(o instanceof Error){let p=o.stack&&o.stack.includes(o.message)?o.stack:`${o.name}: ${o.message}${o.stack?`
20
+ ${s}${r}`}function $t(t){let e=Object.getPrototypeOf(t);if(e===null)return"[Object: null prototype]";let r=e?.constructor?.name;return r&&r!=="Object"?r:void 0}function V(t,e={}){let r=e.depth===null?1/0:e.depth??2,n=e.breakLength??80,s=[],i=(o,a,c,u)=>{switch(typeof o){case"string":return u?Ti(o):o;case"number":return Object.is(o,-0)?"-0":String(o);case"bigint":return`${o}n`;case"boolean":return String(o);case"undefined":return"undefined";case"symbol":return o.toString();case"function":{let p=o.name?`: ${o.name}`:" (anonymous)",y=/^class\s/.test(Function.prototype.toString.call(o))?"class":"Function",b=Object.keys(o),E=y==="class"?`[class ${o.name||"(anonymous)"}]`:`[${y}${p}]`;return!b.length||a>r?E:At(`${E} {`,b.map(C=>`${hr(C)}: ${i(o[C],a+1,c+" ",!0)}`),"}",n,c)}}if(o===null)return"null";let f=o,l=f[Ri];if(typeof l=="function"){let p=l.call(f,r-a,{...e,stylize:y=>y},V);return typeof p=="string"?p:i(p,a,c,u)}if(s.includes(f))return"[Circular *1]";if(o instanceof Error){let p=o.stack&&o.stack.includes(o.message)?o.stack:`${o.name}: ${o.message}${o.stack?`
21
21
  `+o.stack.split(`
22
22
  `).slice(1).join(`
23
- `):""}`,y=Object.keys(o).filter(E=>E!=="stack"&&E!=="message");if(!y.length||a>r)return p;s.push(f);let b=pt(`${p} {`,y.map(E=>`${hr(E)}: ${i(f[E],a+1,c+" ",!0)}`),"}",n,c);return s.pop(),b}if(o instanceof Date)return Number.isNaN(o.getTime())?"Invalid Date":o.toISOString();if(o instanceof RegExp)return String(o);if(o instanceof Promise)return"Promise { <pending> }";if(o instanceof WeakMap)return"WeakMap { <items unknown> }";if(o instanceof WeakSet)return"WeakSet { <items unknown> }";if(ArrayBuffer.isView(o)&&!(o instanceof DataView)){let p=o;if(p.constructor.name==="Buffer"){let y=Array.from(p).slice(0,50).map(b=>b.toString(16).padStart(2,"0"));return`<Buffer${y.length?" "+y.join(" "):""}${p.length>50?` ... ${p.length-50} more bytes`:""}>`}return`${p.constructor.name}(${p.length}) [ ${Array.from(p).slice(0,100).join(", ")} ]`}if(a>r)return Array.isArray(o)?"[Array]":`[${$t(f)??"Object"}]`;s.push(f);let d=p=>i(p,a+1,c+" ",!0),h;if(Array.isArray(o)){let p=o.slice(0,100).map(d);o.length>100&&p.push(`... ${o.length-100} more items`);for(let b of Object.keys(o))/^\d+$/.test(b)||p.push(`${hr(b)}: ${d(f[b])}`);let y=$t(f)&&$t(f)!=="Array"?`${$t(f)}(${o.length}) `:"";h=pt(`${y}[`,p,"]",n,c)}else if(o instanceof Map)h=pt(`Map(${o.size}) {`,[...o].map(([p,y])=>`${d(p)} => ${d(y)}`),"}",n,c);else if(o instanceof Set)h=pt(`Set(${o.size}) {`,[...o].map(d),"}",n,c);else{let p=[...Object.keys(f),...Object.getOwnPropertySymbols(f).filter(A=>Object.getOwnPropertyDescriptor(f,A)?.enumerable)];e.sorted&&p.sort();let y=p.map(A=>{let g=Object.getOwnPropertyDescriptor(f,A),w=g&&(g.get||g.set)?g.get&&g.set?"[Getter/Setter]":g.get?"[Getter]":"[Setter]":d(f[A]);return`${hr(A)}: ${w}`}),b=$t(f),E=f[Symbol.toStringTag],C=b?`${b}${E&&E!==b?` [${E}]`:""} `:E?`Object [${E}] `:"";h=y.length||!C?pt(`${C}{`,y,"}",n,c):`${C}{}`}return s.pop(),h};return i(t,0,"",!1)}V.custom=Oi;V.defaultOptions={depth:2};function Oe(...t){let[e,...r]=t;if(typeof e!="string")return t.map(i=>V(i)).join(" ");let n=0,s=e.replace(/%([sdifjoOc%])/g,(i,o)=>{if(o==="%")return"%";if(n>=r.length)return i;let a=r[n++];switch(o){case"s":return typeof a=="string"?a:typeof a=="bigint"?`${a}n`:typeof a=="object"&&a!==null?V(a,{depth:1}):String(a);case"d":return typeof a=="bigint"?`${a}n`:String(Number(a));case"i":return typeof a=="bigint"?`${a}n`:String(parseInt(String(a),10));case"f":return String(parseFloat(String(a)));case"j":try{return JSON.stringify(a)}catch{return"[Circular]"}case"c":return"";default:return V(a,{depth:o==="o"?4:2})}});for(;n<r.length;n++){let i=r[n];s+=" "+(typeof i=="string"?i:V(i))}return s}var Ri=Symbol.for("nodejs.util.promisify.custom");function Ti(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');let e=t[Ri];if(typeof e=="function")return e;function r(...n){return new Promise((s,i)=>{t.call(this,...n,(o,...a)=>{o?i(o):s(a.length>1?a:a[0])})})}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(t))}Ti.custom=Ri;function tl(t,e){if(!e?.prototype)throw new TypeError('The "superCtor.prototype" property must be of type object');t.super_=e,Object.setPrototypeOf(t.prototype,e.prototype)}function Qe(t,e,r=new Map){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(r.get(t)===e)return!0;if(r.set(t,e),t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return String(t)===String(e);if(t instanceof Map){let i=e;if(t.size!==i.size)return!1;for(let[o,a]of t)if(!i.has(o)||!Qe(a,i.get(o),r))return!1;return!0}if(t instanceof Set){let i=e;if(t.size!==i.size)return!1;for(let o of t)if(!i.has(o)&&![...i].some(a=>Qe(o,a,r)))return!1;return!0}if(ArrayBuffer.isView(t)){let i=t,o=e;if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++)if(!Object.is(i[a],o[a]))return!1;return!0}let n=Object.keys(t),s=Object.keys(e);return n.length!==s.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Qe(t[i],e[i],r))}var Xe=t=>Object.prototype.toString.call(t).slice(8,-1),At={isPromise:t=>t instanceof Promise,isDate:t=>t instanceof Date,isRegExp:t=>t instanceof RegExp,isMap:t=>t instanceof Map,isSet:t=>t instanceof Set,isWeakMap:t=>t instanceof WeakMap,isWeakSet:t=>t instanceof WeakSet,isNativeError:t=>t instanceof Error,isTypedArray:t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),isUint8Array:t=>t instanceof Uint8Array,isArrayBuffer:t=>t instanceof ArrayBuffer,isAnyArrayBuffer:t=>t instanceof ArrayBuffer||Xe(t)==="SharedArrayBuffer",isArrayBufferView:t=>ArrayBuffer.isView(t),isDataView:t=>t instanceof DataView,isAsyncFunction:t=>Xe(t)==="AsyncFunction"||Xe(t)==="AsyncGeneratorFunction",isGeneratorFunction:t=>Xe(t)==="GeneratorFunction"||Xe(t)==="AsyncGeneratorFunction",isGeneratorObject:t=>Xe(t)==="Generator",isBoxedPrimitive:t=>t instanceof Number||t instanceof String||t instanceof Boolean,isProxy:()=>!1,isExternal:()=>!1,isModuleNamespaceObject:t=>Xe(t)==="Module"};function Li(t,e){let r=new Set;return{format:Oe,formatWithOptions:(n,...s)=>Oe(...s),inspect:V,inherits:tl,promisify:Ti,callbackify(n){return function(...s){let i=s.pop();n.apply(this,s).then(o=>i(null,o),o=>i(o??new Error("Promise was rejected with a falsy value")))}},deprecate(n,s,i){return function(...o){let a=i??s;return r.has(a)||(r.add(a),e(`(node) [${i??"DEP"}] DeprecationWarning: ${s}`)),n.apply(this,o)}},debuglog(n){let s=new RegExp(`\\b${n}\\b`,"i").test(t().NODE_DEBUG??""),i=(...o)=>s&&e(`${n.toUpperCase()}: ${Oe(...o)}`);return i.enabled=s,i},isDeepStrictEqual:(n,s)=>Qe(n,s),types:At,TextEncoder,TextDecoder,stripVTControlCharacters:n=>n.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g,""),styleText:(n,s)=>s,toUSVString:n=>n.replace(/[\uD800-\uDFFF]/g,"\uFFFD"),isArray:Array.isArray,isBoolean:n=>typeof n=="boolean",isNull:n=>n===null,isNullOrUndefined:n=>n==null,isNumber:n=>typeof n=="number",isString:n=>typeof n=="string",isSymbol:n=>typeof n=="symbol",isUndefined:n=>n===void 0,isRegExp:At.isRegExp,isObject:n=>n!==null&&typeof n=="object",isDate:At.isDate,isError:At.isNativeError,isFunction:n=>typeof n=="function",isPrimitive:n=>n===null||typeof n!="object"&&typeof n!="function",isBuffer:n=>n?.constructor?.name==="Buffer"}}function gt(t,e={}){let r=!!(e.objectMode||e.writableObjectMode);t._writableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),decodeStrings:e.decodeStrings!==!1,defaultEncoding:e.defaultEncoding??"utf8",queue:[],length:0,writing:!1,corked:0,needDrain:!1,ending:!1,ended:!1,finalCalled:!1,finished:!1,destroyed:!1,closed:!1,errored:null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0},typeof e.write=="function"&&(t._write=e.write),typeof e.writev=="function"&&(t._writev=e.writev),typeof e.final=="function"&&(t._final=e.final),typeof e.destroy=="function"&&(t._destroy=e.destroy)}var ie=class extends M{constructor(e){super(),gt(this,e)}get writable(){let e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&!e.errored}set writable(e){}get writableEnded(){return this._writableState.ending}get writableFinished(){return this._writableState.finished}get writableLength(){return this._writableState.length}get writableHighWaterMark(){return this._writableState.highWaterMark}get writableObjectMode(){return this._writableState.objectMode}get writableCorked(){return this._writableState.corked}get writableNeedDrain(){return this._writableState.needDrain}get destroyed(){return this._writableState.destroyed}set destroyed(e){this._writableState.destroyed=e}_write(e,r,n){if(this._writev)this._writev([{chunk:e,encoding:r}],n);else throw new Error("The _write() method is not implemented")}_destroy(e,r){r(e)}write(e,r,n){typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;if(s.ending||s.destroyed){let c=Object.assign(new Error(s.destroyed?"Cannot call write after a stream was destroyed":"write after end"),{code:s.destroyed?"ERR_STREAM_DESTROYED":"ERR_STREAM_WRITE_AFTER_END"});return we(()=>{n?.(c),this.emit("error",c)}),!1}let i=e,o=r??s.defaultEncoding;if(!s.objectMode){if(typeof i=="string"&&s.decodeStrings)i=D.from(i,o),o="buffer";else if(i instanceof Uint8Array)i instanceof D||(i=D.from(i.buffer,i.byteOffset,i.byteLength)),o="buffer";else if(typeof i!="string")throw new TypeError('The "chunk" argument must be of type string or an instance of Buffer or Uint8Array')}s.length+=s.objectMode?1:i.length,s.queue.push({chunk:i,encoding:o,callback:n});let a=s.length<s.highWaterMark;return a||(s.needDrain=!0),s.corked||this._drainQueue(),a}end(e,r,n){typeof e=="function"?[n,e]=[e,void 0]:typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;return e!=null&&this.write(e,r),n&&(s.finished?we(()=>n()):this.once("finish",()=>n())),s.ending?this:(s.ending=!0,s.corked=0,this._drainQueue(),this)}cork(){this._writableState.corked++}uncork(){let e=this._writableState;e.corked&&e.corked--,e.corked||this._drainQueue()}setDefaultEncoding(e){return this._writableState.defaultEncoding=e,this}destroy(e){let r=this._writableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{we(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}_drainQueue(){let e=this._writableState;if(e.writing||e.destroyed)return;let r=e.queue.shift();if(!r){e.ending&&this._finishMaybe();return}e.writing=!0;let n=!0,s=i=>{let o=()=>{if(e.writing=!1,e.length-=e.objectMode?1:r.chunk.length,r.callback?.(i??null),i){e.errored=i,this.destroy(i);return}e.needDrain&&e.length===0&&(e.needDrain=!1,this.emit("drain")),this._drainQueue()};n?we(o):o()};try{this._write(r.chunk,r.encoding,s)}catch(i){s(i)}n=!1}_finishMaybe(){let e=this._writableState;if(e.finished||e.finalCalled||e.writing||e.queue.length)return;e.finalCalled=!0,e.ended=!0;let r=n=>{if(n){this.destroy(n);return}e.finished=!0,this.emit("finish");let s=this._readableState;e.autoDestroy&&(!s||s.endEmitted)&&this.destroy()};this._final?this._final(n=>we(()=>r(n))):we(()=>r())}};var Ut=class extends M{pipe(e){return this.on("data",r=>e.write(r)),this.on("end",()=>e.end()),e}};Object.setPrototypeOf(X.prototype,Ut.prototype);Object.setPrototypeOf(ie.prototype,Ut.prototype);function Ln(t,e={}){ht(t,e),gt(t,e),t.allowHalfOpen=e.allowHalfOpen!==!1,t.allowHalfOpen||t.once("end",()=>t.end())}var Ne=class extends X{constructor(e){super(e),Ln(this,e)}destroy(e){let r=this._writableState;return r&&(r.destroyed=!0),super.destroy(e)}};for(let t of Object.getOwnPropertyNames(ie.prototype))t==="constructor"||t==="destroy"||t==="destroyed"||t==="_destroy"||t in Ne.prototype&&Object.getOwnPropertyDescriptor(Ne.prototype,t)||Object.defineProperty(Ne.prototype,t,Object.getOwnPropertyDescriptor(ie.prototype,t));function Nn(t,e={}){Ln(t,e),typeof e.transform=="function"&&(t._transform=e.transform),typeof e.flush=="function"&&(t._flush=e.flush)}var We=class extends Ne{constructor(e){super(e),Nn(this,e)}_transform(e,r,n){throw new Error("The _transform() method is not implemented")}_read(){}_write(e,r,n){this._transform(e,r,(s,i)=>{if(s)return n(s);i!=null&&this.push(i),n()})}_final(e){let r=(n,s)=>{if(n)return e(n);s!=null&&this.push(s),this.push(null),e()};this._flush?this._flush(r):r()}},Rn=class extends We{_transform(e,r,n){n(null,e)}};function Tn(t,e,r){let n=typeof e=="function"?e:r,s=!1,i=l=>{s||(s=!0,f(),n(l??null))},o=l=>i(l),a=()=>i(),c=()=>{let l=t._readableState,d=t._writableState;l&&!l.endEmitted||d&&!d.finished?i(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"})):i()},u=!!t._writableState&&!t._readableState;t.on("error",o),t.on(u?"finish":"end",a),t._readableState&&t._writableState&&t.on("finish",()=>t._readableState.endEmitted&&i()),t.on("close",c);let f=()=>{t.removeListener("error",o),t.removeListener("end",a),t.removeListener("finish",a),t.removeListener("close",c)};return(t._readableState?.endEmitted&&!t._writableState||u&&t._writableState.finished)&&we(()=>i()),f}function Mi(...t){let e=typeof t[t.length-1]=="function"?t.pop():void 0,r=Array.isArray(t[0])?t[0]:t;if(r.length<2)throw new Error("pipeline requires at least two streams");let n=!1,s=o=>{if(!n){n=!0;for(let a of r)a.destroy?.(o);e?.(o)}};for(let o=0;o<r.length-1;o++)r[o].pipe(r[o+1]);r.forEach((o,a)=>{a<r.length-1&&o.on("error",s)});let i=r[r.length-1];return Tn(i,o=>{o?s(o):n||e?.(null)}),i}function Fi(){let t=ce(Ut,()=>{}),e={Readable:ce(X,(n,s)=>ht(n,s)),Writable:ce(ie,(n,s)=>gt(n,s)),Duplex:ce(Ne,(n,s)=>Ln(n,s)),Transform:ce(We,(n,s)=>Nn(n,s)),PassThrough:ce(Rn,(n,s)=>Nn(n,s))};return Object.assign(t,e,{Stream:t,pipeline:Mi,finished:Tn,promises:{pipeline:(...n)=>new Promise((s,i)=>Mi(...n,o=>o?i(o):s())),finished:n=>new Promise((s,i)=>Tn(n,o=>o?i(o):s()))},addAbortSignal:(n,s)=>s,isReadable:n=>!!n?.readable,isErrored:n=>!!n?._readableState?.errored,isDisturbed:n=>!!n?._readableState?.endEmitted||(n?._readableState?.flowing??null)!==null,getDefaultHighWaterMark:n=>n?16:16*1024,setDefaultHighWaterMark:()=>{}}),t}var rl={ENOENT:[-2,"no such file or directory"],EEXIST:[-17,"file already exists"],EISDIR:[-21,"illegal operation on a directory"],ENOTDIR:[-20,"not a directory"],ENOTEMPTY:[-39,"directory not empty"],EBADF:[-9,"bad file descriptor"],EINVAL:[-22,"invalid argument"],EPERM:[-1,"operation not permitted"],EACCES:[-13,"permission denied"],ENOSYS:[-38,"function not implemented"]};function R(t,e,r,n){let[s,i]=rl[t]??[-1,t.toLowerCase()],o=r===void 0?"":n===void 0?` '${r}'`:` '${r}' -> '${n}'`,a=new Error(`${t}: ${i}, ${e}${o}`);return a.code=t,a.errno=s,a.syscall=e,r!==void 0&&(a.path=r),n!==void 0&&(a.dest=n),a}function nl(t){let e=5381;for(let r=0;r<t.length;r++)e=(e*33^t.charCodeAt(r))>>>0;return e}var Mn=32768,Fn=16384,Re=class{constructor(e,r,n,s){m(this,"dev",2049);m(this,"ino");m(this,"mode");m(this,"nlink",1);m(this,"uid",1e3);m(this,"gid",1e3);m(this,"rdev",0);m(this,"size");m(this,"blksize",4096);m(this,"blocks");m(this,"atimeMs");m(this,"mtimeMs");m(this,"ctimeMs");m(this,"birthtimeMs");m(this,"atime");m(this,"mtime");m(this,"ctime");m(this,"birthtime");this.ino=nl(e),this.mode=r==="file"?Mn|420:Fn|493,this.size=n,this.blocks=Math.ceil(n/512),this.atimeMs=this.mtimeMs=this.ctimeMs=this.birthtimeMs=s,this.atime=new Date(s),this.mtime=new Date(s),this.ctime=new Date(s),this.birthtime=new Date(s)}isFile(){return(this.mode&61440)===Mn}isDirectory(){return(this.mode&61440)===Fn}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},mt=class{constructor(e,r,n){m(this,"name");m(this,"parentPath");m(this,"kind");this.name=e,this.parentPath=r,this.kind=n}get path(){return this.parentPath}isFile(){return this.kind==="file"}isDirectory(){return this.kind==="directory"}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},ke={F_OK:0,R_OK:4,W_OK:2,X_OK:1,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOFOLLOW:131072,O_SYNC:1052672,O_DSYNC:4096,O_NONBLOCK:2048,S_IFMT:61440,S_IFREG:Mn,S_IFDIR:Fn,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,UV_FS_COPYFILE_EXCL:1};var pr=t=>typeof t=="string"?t:t?.encoding;function $i(t){let{vfs:e}=t,r=new Map,n=20,s=A=>{if(A instanceof URL){if(A.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return O(decodeURIComponent(A.pathname))}let g=typeof A=="string"?A:new TextDecoder().decode(A);if(typeof g!="string")throw new TypeError('The "path" argument must be of type string, Buffer or URL');return g.startsWith("file://")?O(decodeURIComponent(new URL(g).pathname)):g.startsWith("/")?O(g):k(t.cwd(),g)},i=A=>{let g=e.readFile(A);return typeof g=="string"?se(g):g},o=(A,g)=>{let w=$(A);if(e.isFile(w))throw R("ENOTDIR",g,A);if(!e.isDirectory(w))throw R("ENOENT",g,A)},a=(A,g)=>typeof A=="string"?!g||/^utf-?8$/i.test(g)?A:se(A,g).slice():new Uint8Array(A.buffer,A.byteOffset,A.byteLength).slice(),c=(A,g)=>{let w=s(A);if(e.isFile(w))return new Re(w,"file",i(w).length,e.mtime(w)??Date.now());if(e.isDirectory(w))return new Re(w,"directory",4096,0);if(g?.throwIfNoEntry!==!1)throw R("ENOENT","stat",w)},u=(A,g,w)=>{if(typeof A=="number")return f(A,g);let S=s(A),I=typeof w=="object"&&w?w.flag??"w":"w";if(e.isDirectory(S))throw R("EISDIR","open",S);if(o(S,"open"),I.includes("x")&&e.isFile(S))throw R("EEXIST","open",S);if(I.startsWith("a")&&e.isFile(S)){let v=e.readFile(S),B=a(g,pr(w));e.writeFile(S,typeof v=="string"&&typeof B=="string"?v+B:D.concat([typeof v=="string"?se(v):v,typeof B=="string"?se(B):B]));return}e.writeFile(S,a(g,pr(w)))},f=(A,g,w,S,I)=>{let v=typeof g=="string"?se(g,typeof w=="string"?w:void 0):new Uint8Array(g.buffer,g.byteOffset+(typeof w=="number"?w:0),S??g.byteLength-(typeof w=="number"?w:0));if(A===1||A===2)return(A===1?t.stdout:t.stderr)(v.slice()),v.length;let B=r.get(A);if(!B||B.flags==="r")throw R("EBADF","write");let Q=e.isFile(B.path)?i(B.path):new Uint8Array,_=B.flags.startsWith("a")?Q.length:I??B.position,N=new Uint8Array(Math.max(Q.length,_+v.length));return N.set(Q),N.set(v,_),e.writeFile(B.path,N),I==null&&(B.position=_+v.length),v.length},l=(A,g,w="")=>{let S=[];for(let I of e.readdir(A)){let v=k(A,I),B=e.isDirectory(v)?"directory":"file";S.push({name:w+I,parent:A,kind:B}),g&&B==="directory"&&S.push(...l(v,!0,`${w}${I}/`))}return S},d=(A,g)=>{let w=s(A),S=typeof g=="object"&&!!g?.recursive;if(e.isFile(w))throw R("EEXIST","mkdir",w);if(e.isDirectory(w)){if(S)return;throw R("EEXIST","mkdir",w)}S||o(w,"mkdir");let I;for(let v=w;!e.isDirectory(v);v=$(v)){if(e.isFile(v))throw R("ENOTDIR","mkdir",w);I=v}return e.mkdir(w),S?I:void 0},h=(A,g)=>{let w=s(A);if(!e.exists(w)){if(g?.force)return;throw R("ENOENT","rm",w)}if(e.isDirectory(w)&&!g?.recursive)throw Object.assign(R("EISDIR","rm",w),{code:"ERR_FS_EISDIR"});e.rm(w)},p=(A,g,w=0)=>{let S=s(A),I=s(g);if(!e.isFile(S))throw R(e.isDirectory(S)?"EISDIR":"ENOENT","copyfile",S,I);if(w&ke.COPYFILE_EXCL&&e.exists(I))throw R("EEXIST","copyfile",S,I);o(I,"copyfile");let v=e.readFile(S);e.writeFile(I,typeof v=="string"?v:v.slice())},y=(A,g)=>{if(e.isFile(A)){let w=e.readFile(A);e.writeFile(g,typeof w=="string"?w:w.slice());return}e.mkdir(g);for(let w of e.readdir(A))y(k(A,w),k(g,w))},b=(A,g="r")=>{let w=s(A),S=typeof g=="number"?g&ke.O_APPEND?"a":g&(ke.O_WRONLY|ke.O_RDWR)?"w":"r":g;if(e.isDirectory(w)&&S!=="r")throw R("EISDIR","open",w);if(S.startsWith("r")){if(!e.exists(w))throw R("ENOENT","open",w)}else{if(S.includes("x")&&e.exists(w))throw R("EEXIST","open",w);o(w,"open"),(S.startsWith("w")||!e.isFile(w))&&e.writeFile(w,"")}let I=n++;return r.set(I,{path:w,flags:S,position:0}),I},E=(A,g)=>{let w=r.get(A);if(!w)throw R("EBADF",g);return w},C={existsSync:A=>{try{return e.exists(s(A))}catch{return!1}},accessSync(A){let g=s(A);if(!e.exists(g))throw R("ENOENT","access",g)},statSync:c,lstatSync:c,fstatSync:A=>c(E(A,"fstat").path),readFileSync(A,g){if(A===0)return D.alloc(0);let w=typeof A=="number"?E(A,"read").path:s(A);if(e.isDirectory(w))throw R("EISDIR","read",w);let S=e.readFile(w);if(S===void 0)throw R("ENOENT","open",w);let I=pr(g);return I?typeof S=="string"&&/^utf-?8$/i.test(I)?S:D.from(typeof S=="string"?se(S):S).toString(I):D.from(typeof S=="string"?se(S):S)},writeFileSync:u,appendFileSync:(A,g,w)=>u(A,g,{...typeof w=="string"?{encoding:w}:w??{},flag:"a"}),mkdirSync:d,mkdtempSync(A){let g=`${A}${Math.random().toString(36).slice(2,8)}`;return d(g),s(g)},readdirSync(A,g){let w=s(A);if(e.isFile(w))throw R("ENOTDIR","scandir",w);if(!e.isDirectory(w))throw R("ENOENT","scandir",w);let S=typeof g=="object"?g:void 0,I=l(w,!!S?.recursive);return S?.withFileTypes?I.map(v=>new mt(v.name.slice(v.name.lastIndexOf("/")+1),v.name.includes("/")?k(w,v.name,".."):v.parent,v.kind)):I.map(v=>pr(g)==="buffer"?D.from(v.name):v.name)},rmSync:h,rmdirSync(A,g){let w=s(A);if(e.isFile(w))throw R("ENOTDIR","rmdir",w);if(!e.isDirectory(w))throw R("ENOENT","rmdir",w);if(e.readdir(w).length&&!g?.recursive)throw R("ENOTEMPTY","rmdir",w);e.rm(w)},unlinkSync(A){let g=s(A);if(e.isDirectory(g))throw R("EISDIR","unlink",g);if(!e.isFile(g))throw R("ENOENT","unlink",g);e.rm(g)},renameSync(A,g){let w=s(A),S=s(g);if(!e.exists(w))throw R("ENOENT","rename",w,S);if(w!==S){if(e.isDirectory(S)&&e.isFile(w))throw R("EISDIR","rename",w,S);if(o(S,"rename"),e.isFile(S)&&e.isDirectory(w))throw R("ENOTDIR","rename",w,S);e.rm(S),y(w,S),e.rm(w)}},copyFileSync:p,cpSync(A,g,w){let S=s(A);if(e.isDirectory(S)&&!w?.recursive)throw Object.assign(R("EISDIR","cp",S),{code:"ERR_FS_EISDIR"});if(!e.exists(S))throw R("ENOENT","cp",S);y(S,s(g))},realpathSync:Object.assign(A=>{let g=s(A);if(!e.exists(g))throw R("ENOENT","realpath",g);return g},{native:A=>C.realpathSync(A)}),readlinkSync:A=>{throw R("EINVAL","readlink",s(A))},symlinkSync(A,g){let w=s(g),S=typeof A=="string"&&!A.startsWith("/")?k($(w),A):s(A);y(S,w)},linkSync:(A,g)=>p(A,g),truncateSync(A,g=0){let w=s(A);if(!e.isFile(w))throw R("ENOENT","open",w);let S=i(w),I=new Uint8Array(g);I.set(S.subarray(0,g)),e.writeFile(w,I)},chmodSync:A=>void C.accessSync(A),lchmodSync:A=>void C.accessSync(A),chownSync:A=>void C.accessSync(A),lchownSync:A=>void C.accessSync(A),utimesSync:A=>void C.accessSync(A),lutimesSync:A=>void C.accessSync(A),fchmodSync:A=>void E(A,"fchmod"),fchownSync:A=>void E(A,"fchown"),futimesSync:A=>void E(A,"futimes"),fsyncSync:A=>void E(A,"fsync"),fdatasyncSync:A=>void E(A,"fdatasync"),ftruncateSync:(A,g=0)=>C.truncateSync(E(A,"ftruncate").path,g),openSync:b,closeSync(A){A>2&&E(A,"close"),r.delete(A)},readSync(A,g,w,S,I){let v=typeof w=="object"?w:{offset:w,length:S,position:I},B=E(A,"read"),Q=i(B.path),_=new Uint8Array(g.buffer,g.byteOffset,g.byteLength),N=v.offset??0,L=v.position??B.position,J=Q.subarray(L,L+Math.min(v.length??_.length-N,_.length-N));return _.set(J,N),(v.position===void 0||v.position===null)&&(B.position=L+J.length),J.length},writeSync:f,writevSync(A,g,w){let S=0;for(let I of g)S+=f(A,I,0,I.byteLength,w==null?null:w+S);return S},readvSync(A,g,w){let S=0;for(let I of g){let v=C.readSync(A,I,0,I.byteLength,w==null?null:w+S);if(S+=v,v<I.byteLength)break}return S},opendirSync(A){let g=s(A),w=C.readdirSync(g,{withFileTypes:!0}),S=0;return{path:g,readSync:()=>w[S++]??null,read:async()=>w[S++]??null,closeSync:()=>{},close:async()=>{},async*[Symbol.asyncIterator](){for(;S<w.length;)yield w[S++]}}},_resolve:s};return C}var Ui=64*1024,Ar=t=>typeof t=="string"?{encoding:t}:t??{};function Pi(t,e){class r extends X{constructor(a,c){let u=Ar(c);super({highWaterMark:u.highWaterMark??Ui,encoding:u.encoding}),n(this,a,u)}open(){}_read(){if(!this.data){this._readableState.reading=!1;return}let a=Math.min(this.data.length,this.endAt+1);if(this.offset>=a){this.push(null);return}let c=this.data.subarray(this.offset,Math.min(a,this.offset+this._readableState.highWaterMark));this.offset+=c.length,this.bytesRead+=c.length,this.push(D.from(c))}close(a){this.destroy(),a&&this.once("close",a)}}function n(o,a,c){o.bytesRead=0,o.fd=null,o.pending=!0,o.flags=c.flags??"r",o.mode=c.mode??438,o.path=c.fd!==void 0?"":t._resolve(a),o.offset=c.start??0,o.endAt=c.end??1/0,T(()=>{try{o.data=t.readFileSync(o.path),o.pending=!1,o.open!==r.prototype.open?o.open():(o.fd=-1,o.emit("open",o.fd),o.emit("ready")),o._pull()}catch(u){o.destroy(u)}})}class s extends ie{constructor(a,c){super({decodeStrings:!0}),i(this,a,Ar(c))}open(){}ensureFile(){this.started||(this.started=!0,(!this.flags.startsWith("a")||!e.vfs.isFile(this.path))&&t.writeFileSync(this.path,"",{flag:this.flags.includes("x")?"wx":"w"}))}_write(a,c,u){if(this.fd===null&&this.open!==s.prototype.open){this.once("open",()=>this._write(a,c,u));return}try{this.ensureFile(),t.appendFileSync(this.path,a),this.bytesWritten+=a.length,u()}catch(f){u(f)}}close(a){this.end(),a&&this.once("close",a)}}function i(o,a,c){o.bytesWritten=0,o.fd=null,o.pending=!1,o.started=!1,o.flags=c.flags??"w",o.mode=c.mode??438,o.path=t._resolve(a),T(()=>{try{if(o.open!==s.prototype.open){o.started=!0,o.open();return}o.ensureFile(),o.fd=-1,o.emit("open",o.fd),o.emit("ready")}catch(u){o.destroy(u)}})}return{ReadStream:ce(r,(o,a,c)=>{let u=Ar(c);ht(o,{highWaterMark:u.highWaterMark??Ui,encoding:u.encoding}),n(o,a,u)}),WriteStream:ce(s,(o,a,c)=>{gt(o,{decodeStrings:!0}),i(o,a,Ar(c))})}}function ji(t){return typeof t[t.length-1]=="function"?t.pop():void 0}function Ki(t){let e=$i(t),r=(p,y=b=>[b])=>(...b)=>{let E=ji(b);T(()=>{let C;try{C=p(...b)}catch(A){E?.(A);return}E?.(null,...y(C,b))})},n=p=>async(...y)=>p(...y),{ReadStream:s,WriteStream:i}=Pi(e,t);class o extends M{constructor(b,E,C){super();m(this,"release");m(this,"unwatch");let A=O(b);C&&this.on("change",C),this.release=t.hold(),this.unwatch=t.vfs.watch(g=>{let w=g.path;if(!(w===A||w.startsWith(A==="/"?"/":A+"/")))return;let I=w===A?w.slice(w.lastIndexOf("/")+1):w.slice(A.length+(A==="/"?0:1));!E&&I.includes("/")||this.emit("change",g.type==="write"&&!g.created?"change":"rename",I)})}close(){this.unwatch(),this.release(),this.emit("close")}ref(){return this}unref(){return this}}let a=(p,y,b)=>{typeof y=="function"&&([b,y]=[y,void 0]);let E=e._resolve(p);if(!t.vfs.exists(E))throw e.statSync(E);return new o(E,typeof y=="object"&&!!y?.recursive,b)},c=new Map,u=(p,y,b)=>{let E=typeof y=="function"?y:b,C=e._resolve(p),A=c.get(C);if(!A){let g=new o(C,!1),w={watcher:g,listeners:[]},S=e.statSync(C,{throwIfNoEntry:!1})??new Re(C,"file",0,0);g.on("change",()=>{let I=e.statSync(C,{throwIfNoEntry:!1})??new Re(C,"file",0,0);for(let v of w.listeners)v(I,S);S=I}),c.set(C,A=w)}return A.listeners.push(E),A.watcher},f=(p,y)=>{let b=e._resolve(p),E=c.get(b);E&&(E.listeners=y?E.listeners.filter(C=>C!==y):[],E.listeners.length||(E.watcher.close(),c.delete(b)))},l={...e,constants:ke,Stats:Re,Dirent:mt,ReadStream:s,WriteStream:i,FSWatcher:o,F_OK:0,R_OK:4,W_OK:2,X_OK:1};delete l._resolve;for(let p of Object.keys(e)){if(!p.endsWith("Sync"))continue;let y=p.slice(0,-4),b=e[p];y==="exists"?l.exists=(E,C)=>T(()=>C(e.existsSync(E))):["read","write","readv","writev"].includes(y)?l[y]=r(b,(E,C)=>[E,C[1]]):l[y]=r(b)}let d=l.read;l.read=(p,...y)=>{if(p!==0||!t.readStdin)return d(p,...y);let b=ji(y),E=y[0]&&!ArrayBuffer.isView(y[0])?y[0]:typeof y[1]=="object"&&y[1]?{buffer:y[0],...y[1]}:{buffer:y[0],offset:y[1],length:y[2]},C=E.buffer,A=Number(E.offset??0),g=Number(E.length??C.byteLength-A);t.readStdin(new Uint8Array(C.buffer,C.byteOffset+A,g)).then(w=>T(()=>b?.(null,w,C)),w=>T(()=>b?.(w,0,C)))},l.realpath.native=l.realpath,l.createReadStream=(p,y)=>new s(p,y),l.createWriteStream=(p,y)=>new i(p,y),l.watch=a,l.watchFile=u,l.unwatchFile=f;let h={constants:ke};for(let p of Object.keys(e))!p.endsWith("Sync")||p==="existsSync"||(h[p.slice(0,-4)]=n(e[p]));return h.open=async(p,y)=>sl(e,e.openSync(p,y),e._resolve(p)),h.watch=(p,y)=>il(a(p,y),y?.signal),l.promises=h,l}function sl(t,e,r){return{fd:e,readFile:async n=>t.readFileSync(e,n),writeFile:async n=>void t.writeFileSync(r,n),appendFile:async n=>void t.appendFileSync(r,n),read:async(n,s,i,o)=>({bytesRead:t.readSync(e,n,s,i,o),buffer:n}),write:async(n,...s)=>({bytesWritten:t.writeSync(e,n,...s),buffer:n}),writev:async(n,s)=>({bytesWritten:t.writevSync(e,n,s),buffers:n}),readv:async(n,s)=>({bytesRead:t.readvSync(e,n,s),buffers:n}),stat:async()=>t.fstatSync(e),truncate:async n=>t.ftruncateSync(e,n),sync:async()=>{},datasync:async()=>{},chmod:async()=>{},close:async()=>t.closeSync(e)}}async function*il(t,e){let r=[],n;t.on("change",(s,i)=>{r.push({eventType:s,filename:i}),n?.()}),e?.addEventListener("abort",()=>n?.());try{for(;!e?.aborted;)r.length?yield r.shift():await new Promise(s=>n=s)}finally{t.close()}}function Hi(t,e){let r=[],n=!1,s=[],i=!1,o=()=>{i||(i=!0,t.onStdin(a=>{a===null?n=!0:r.push(typeof a=="string"?new TextEncoder().encode(a):a);let c=s;s=[];for(let u of c)u()}))};return async a=>{for(o();!r.length&&!n;){let f=e();await new Promise(l=>s.push(l)),f()}let c=r[0];if(!c)return 0;let u=Math.min(c.length,a.length);return a.set(c.subarray(0,u)),u===c.length?r.shift():r[0]=c.subarray(u),u}}var wt=(t,e)=>typeof t=="string"?D.from(t,e):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Pn=(t,e)=>e&&e!=="buffer"?D.from(t).toString(e):D.from(t),mr=class t extends We{constructor(r){super();m(this,"algorithm");m(this,"chunks",[]);m(this,"done",!1);this.algorithm=r,Ft(r)}update(r,n){if(this.done)throw Object.assign(new Error("Digest already called"),{code:"ERR_CRYPTO_HASH_FINALIZED"});return this.chunks.push(wt(r,n).slice()),this}digest(r){return this.done=!0,Pn(Ft(this.algorithm).digest(D.concat(this.chunks)),r)}copy(){let r=new t(this.algorithm);return r.chunks=[...this.chunks],r}_transform(r,n,s){this.update(r),s()}_flush(r){r(null,this.digest())}};function $n(t,e,r){let{digest:n,blockSize:s}=Ft(t),i=e.length>s?n(e):e,o=new Uint8Array(s);o.set(i),i=o;let a=new Uint8Array(s+r.length),c=new Uint8Array(s);for(let l=0;l<s;l++)a[l]=i[l]^54,c[l]=i[l]^92;a.set(r,s);let u=n(a),f=new Uint8Array(s+u.length);return f.set(c),f.set(u,s),n(f)}var Un=class extends mr{constructor(r,n){super(r);m(this,"hmacAlgorithm");m(this,"hmacKey");m(this,"parts",[]);this.hmacAlgorithm=r,this.hmacKey=wt(n).slice()}update(r,n){return this.parts.push(wt(r,n).slice()),this}digest(r){return Pn($n(this.hmacAlgorithm,this.hmacKey,D.concat(this.parts)),r)}};function Wi(t,e,r,n,s="sha1"){let i=wt(t),o=wt(e),a=new Uint8Array(n);for(let c=1,u=0;u<n;c++){let f=new Uint8Array(o.length+4);f.set(o),new DataView(f.buffer).setUint32(o.length,c);let l=$n(s,i,f),d=l.slice();for(let h=1;h<r;h++){l=$n(s,i,l);for(let p=0;p<d.length;p++)d[p]=d[p]^l[p]}a.set(d.subarray(0,n-u),u),u+=d.length}return D.from(a)}function gr(t){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(let r=0;r<e.length;r+=65536)globalThis.crypto.getRandomValues(e.subarray(r,r+65536));return t}var xe=t=>()=>{throw Object.assign(new Error(`crypto.${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Ji(){let t=(e,r)=>{let n=gr(D.alloc(e));return r&&T(()=>r(null,n)),n};return{createHash:e=>new mr(e),createHmac:(e,r)=>new Un(e,r),hash:(e,r,n="hex")=>Pn(Ft(e).digest(wt(r)),n),getHashes:()=>Object.keys(kn),getCiphers:()=>[],getCurves:()=>[],randomBytes:t,pseudoRandomBytes:t,randomFillSync:(e,r=0,n)=>(gr(new Uint8Array(e.buffer,e.byteOffset+r,n??e.byteLength-r)),e),randomFill:(e,...r)=>{let n=r.pop();gr(e),T(()=>n(null,e))},randomUUID:()=>globalThis.crypto.randomUUID(),randomInt(e,r,n){typeof r!="number"&&([n,r,e]=[r,e,0]);let s=e+Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0]/2**32*(r-e));return n&&T(()=>n(null,s)),s},getRandomValues:e=>gr(e),timingSafeEqual(e,r){if(e.byteLength!==r.byteLength)throw new RangeError("Input buffers must have the same byte length");let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i=0;for(let o=0;o<n.length;o++)i|=n[o]^s[o];return i===0},pbkdf2Sync:Wi,pbkdf2(e,r,n,s,i,o){T(()=>{try{o(null,Wi(e,r,n,s,i))}catch(a){o(a)}})},webcrypto:globalThis.crypto,subtle:globalThis.crypto?.subtle,constants:{},createCipheriv:xe("createCipheriv"),createDecipheriv:xe("createDecipheriv"),createSign:xe("createSign"),createVerify:xe("createVerify"),generateKeyPairSync:xe("generateKeyPairSync"),generateKeyPair:xe("generateKeyPair"),createPrivateKey:xe("createPrivateKey"),createPublicKey:xe("createPublicKey"),scryptSync:xe("scryptSync"),scrypt:xe("scrypt")}}function qi(){let t=i=>encodeURIComponent(i),e=i=>{try{return decodeURIComponent(i)}catch{return i}},r=i=>typeof i=="string"?i:typeof i=="number"&&Number.isFinite(i)||typeof i=="boolean"||typeof i=="bigint"?String(i):"",n=(i,o="&",a="=",c)=>{let u=Object.create(null);if(typeof i!="string"||!i)return u;let f=c?.decodeURIComponent??e,l=i.split(o),d=c?.maxKeys??1e3;for(let h of d>0?l.slice(0,d):l){if(!h)continue;let p=h.indexOf(a),y=f((p>=0?h.slice(0,p):h).replace(/\+/g," ")),b=p>=0?f(h.slice(p+a.length).replace(/\+/g," ")):"",E=u[y];E===void 0?u[y]=b:Array.isArray(E)?E.push(b):u[y]=[E,b]}return u},s=(i,o="&",a="=",c)=>{let u=c?.encodeURIComponent??t;return!i||typeof i!="object"?"":Object.keys(i).map(f=>{let l=i[f],d=u(r(f))+a;return Array.isArray(l)?l.map(h=>d+u(r(h))).join(o):d+u(r(l))}).filter(Boolean).join(o)};return{parse:n,decode:n,stringify:s,encode:s,escape:t,unescape:e}}function zi(t,e){function r(i,o=!1,a=!1){let c=i.trim(),u={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:""},f=c.indexOf("#");f>=0&&(u.hash=c.slice(f),c=c.slice(0,f));let l=c.indexOf("?");l>=0?(u.search=c.slice(l),u.query=c.slice(l+1),c=c.slice(0,l)):o&&(u.search="",u.query={});let d=/^([a-z][a-z0-9.+-]*:)/i.exec(c);if(d&&(u.protocol=d[1].toLowerCase(),c=c.slice(d[1].length)),(d||a)&&c.startsWith("//")){u.slashes=!0,c=c.slice(2);let h=c.search(/[/]/),p=h>=0?c.slice(0,h):c;c=h>=0?c.slice(h):"";let y=p.lastIndexOf("@");y>=0&&(u.auth=decodeURIComponent(p.slice(0,y)),p=p.slice(y+1)),u.host=p.toLowerCase();let b=/:(\d*)$/.exec(u.host);b?(u.port=b[1]||null,u.hostname=u.host.slice(0,-b[0].length)):u.hostname=u.host,u.hostname.startsWith("[")&&u.hostname.endsWith("]")&&(u.hostname=u.hostname.slice(1,-1)),!c&&u.protocol&&/^(https?|ftp|wss?|file):$/.test(u.protocol)&&(c="/")}return u.pathname=c||(u.slashes?"/":null),o&&typeof u.query=="string"&&(u.query=t.parse(u.query)),u.path=(u.pathname??"")+(u.search??"")||null,u.href=n(u),u}function n(i){if(typeof i=="string")return n(r(i));if(i instanceof URL)return i.href;let o=i.protocol?i.protocol.endsWith(":")?i.protocol:i.protocol+":":"",a="";i.host?a=(i.auth?encodeURIComponent(i.auth).replace(/%3A/i,":")+"@":"")+i.host:i.hostname&&(a=(i.auth?i.auth+"@":"")+(i.hostname.includes(":")?`[${i.hostname}]`:i.hostname)+(i.port?":"+i.port:""));let c=i.search??"";if(!c&&i.query&&typeof i.query=="object"){let d=t.stringify(i.query);d&&(c="?"+d)}else c&&!c.startsWith("?")&&(c="?"+c);let u=i.slashes||a&&/^(https?|ftp|wss?|file):$/.test(o)?"//":"",f=i.pathname??"";a&&f&&!f.startsWith("/")&&(f="/"+f);let l=i.hash?i.hash.startsWith("#")?i.hash:"#"+i.hash:"";return`${o}${u}${a}${f}${c}${l}`}function s(i,o){let a=new URL(i,"resolve://"),c=new URL(o,a);if(c.protocol==="resolve:"){let{pathname:u,search:f,hash:l}=c;return u+f+l}return c.href}return{URL,URLSearchParams,parse:r,format:n,resolve:s,resolveObject:(i,o)=>r(s(i,o)),fileURLToPath:i=>{let o=typeof i=="string"?new URL(i):i;if(o.protocol!=="file:")throw Object.assign(new TypeError("The URL must be of scheme file"),{code:"ERR_INVALID_URL_SCHEME"});return decodeURIComponent(o.pathname)},pathToFileURL:i=>{let o=e(i);i.endsWith("/")&&!o.endsWith("/")&&(o+="/");let a=new URL("file://");return a.pathname=o.replace(/%/g,"%25").replace(/\\/g,"%5C").replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/\t/g,"%09"),a},domainToASCII:i=>i,domainToUnicode:i=>i,urlToHttpOptions:i=>({protocol:i.protocol,hostname:i.hostname,hash:i.hash,search:i.search,pathname:i.pathname,path:i.pathname+i.search,href:i.href,port:i.port?Number(i.port):void 0}),Url:function(){}}}var x={SUCCESS:0,ACCES:2,BADF:8,EXIST:20,FAULT:21,INVAL:28,IO:29,ISDIR:31,LOOP:32,NAMETOOLONG:37,NOENT:44,NOSPC:51,NOSYS:52,NOTDIR:54,NOTEMPTY:55,NOTSUP:58,PERM:63,SPIPE:70,NOTCAPABLE:76},Te={UNKNOWN:0,CHARACTER_DEVICE:2,DIRECTORY:3,REGULAR_FILE:4},et={CREAT:1,DIRECTORY:2,EXCL:4,TRUNC:8},Er={APPEND:1},br={SET:0,CUR:1,END:2},yt={REALTIME:0,MONOTONIC:1,PROCESS_CPUTIME:2,THREAD_CPUTIME:3},jn=0x1fffffffn,wr=class extends Error{};function ye(t){try{return t()}catch(e){throw e instanceof RangeError?new wr(e.message):e}}function U(t){try{return t()??x.SUCCESS}catch(e){return Kn(e)}}var tt=t=>Number.isFinite(t)?BigInt(Math.max(0,Math.round(t))):0n;function Kn(t){if(t instanceof wr)return x.FAULT;if(t instanceof RangeError)return x.INVAL;switch(t?.code){case"ENOENT":return x.NOENT;case"EEXIST":return x.EXIST;case"EISDIR":return x.ISDIR;case"ENOTDIR":return x.NOTDIR;case"ENOTEMPTY":return x.NOTEMPTY;case"EBADF":return x.BADF;case"EINVAL":return x.INVAL;case"EACCES":return x.ACCES;case"EPERM":return x.PERM;case"ENOSPC":return x.NOSPC;case"ENAMETOOLONG":return x.NAMETOOLONG;case"ELOOP":return x.LOOP;default:return x.IO}}var yr=class{constructor(e){m(this,"memory");this.memory=e}get view(){return new DataView(this.memory().buffer)}bytes(e,r){return ye(()=>new Uint8Array(this.memory().buffer,e,r))}u32(e,r){ye(()=>this.view.setUint32(e,r,!0))}u64(e,r){ye(()=>this.view.setBigUint64(e,r,!0))}text(e,r){return new TextDecoder().decode(this.bytes(e,r).slice())}iovecs(e,r){return ye(()=>{let n=this.view,s=[];for(let i=0;i<r;i++)s.push(this.bytes(n.getUint32(e+i*8,!0),n.getUint32(e+i*8+4,!0)));return s})}strings(e,r,n){ye(()=>{let s=this.view,i=n;e.forEach((o,a)=>{let c=new TextEncoder().encode(o+"\0");s.setUint32(r+a*4,i,!0),this.bytes(i,c.length).set(c),i+=c.length})})}sizes(e,r,n){this.u32(r,e.length),this.u32(n,e.reduce((s,i)=>s+new TextEncoder().encode(i).length+1,0))}};var ol=64;function Yi(t,e,r,n){let s=new Map([[0,{kind:"stdio",path:"",root:"",position:0,append:!1}],[1,{kind:"stdio",path:"",root:"",position:0,append:!1}],[2,{kind:"stdio",path:"",root:"",position:0,append:!1}]]),i=3;for(let[f,l]of Object.entries(n)){let d=O(l);s.set(i++,{kind:"dir",path:d,root:d,preopen:f,position:0,append:!1})}let o=(f,l,d)=>{let h=s.get(f);if(!h)return x.BADF;if(h.kind!=="dir")return x.NOTDIR;let p;try{p=r.text(l,d)}catch(b){return Kn(b)}if(p.startsWith("/"))return x.NOTCAPABLE;let y=O(`${h.path}/${p}`);return y===h.root||y.startsWith(h.root==="/"?"/":`${h.root}/`)?y:x.NOTCAPABLE},a=(f,l,d)=>ye(()=>{let h=r.view;r.bytes(f,ol).fill(0),h.setBigUint64(f+8,tt(l.ino??0),!0),h.setUint8(f+16,d??(l.isDirectory()?Te.DIRECTORY:Te.REGULAR_FILE)),h.setBigUint64(f+24,1n,!0),h.setBigUint64(f+32,tt(l.size),!0);let p=tt(l.mtimeMs)*1000000n;for(let y of[40,48,56])h.setBigUint64(f+y,p,!0)}),c=(f,l,d)=>{let h=new Uint8Array(l.reduce((b,E)=>b+E.length,0)),p=t.readSync(f.host,h,0,h.length,d),y=0;for(let b of l)if(b.set(h.subarray(y,Math.min(p,y+b.length))),y+=b.length,y>=p)break;return p},u=(f,l,d)=>{let h=Gi(l);return t.writeSync(f.host,h,0,h.length,d)};return{closeAll(){for(let f of s.values())try{f.host!==void 0&&t.closeSync(f.host)}catch{}s.clear()},fd_write(f,l,d,h){let p=s.get(f);return p?U(()=>{let y=r.iovecs(l,d),b;if(p.kind==="stdio"){let E=Gi(y);if(f===1)e.stdout(E);else if(f===2)e.stderr(E);else return x.BADF;b=E.length}else if(p.kind==="file"){let E=p.append?t.fstatSync(p.host).size:p.position;b=u(p,y,E),p.position=E+b}else return x.ISDIR;r.u32(h,b)}):x.BADF},fd_pwrite(f,l,d,h,p){let y=s.get(f);return!y||y.kind!=="file"?y?x.INVAL:x.BADF:U(()=>r.u32(p,u(y,r.iovecs(l,d),Number(h))))},fd_read(f,l,d,h){let p=s.get(f);return p?U(()=>{let y=p.kind==="file"?c(p,r.iovecs(l,d),p.position):p.kind==="stdio"?0:-1;if(y<0)return x.ISDIR;p.position+=y,r.u32(h,y)}):x.BADF},fd_pread(f,l,d,h,p){let y=s.get(f);return!y||y.kind!=="file"?y?x.INVAL:x.BADF:U(()=>r.u32(p,c(y,r.iovecs(l,d),Number(h))))},fd_seek(f,l,d,h){let p=s.get(f);return p?p.kind==="stdio"?x.SPIPE:p.kind!=="file"?x.INVAL:U(()=>{let y=d===br.SET?0:d===br.CUR?p.position:d===br.END?t.fstatSync(p.host).size:-1;if(y<0||y+Number(l)<0)return x.INVAL;p.position=y+Number(l),r.u64(h,BigInt(p.position))}):x.BADF},fd_tell(f,l){let d=s.get(f);return d?d.kind==="stdio"?x.SPIPE:U(()=>r.u64(l,BigInt(d.position))):x.BADF},fd_close(f){let l=s.get(f);return l?(s.delete(f),U(()=>{l.host!==void 0&&t.closeSync(l.host)})):x.BADF},fd_fdstat_get(f,l){let d=s.get(f);return d?U(()=>ye(()=>{let h=r.view;h.setUint8(l,d.kind==="stdio"?Te.CHARACTER_DEVICE:d.kind==="dir"?Te.DIRECTORY:Te.REGULAR_FILE),h.setUint16(l+2,d.append?Er.APPEND:0,!0),h.setBigUint64(l+8,jn,!0),h.setBigUint64(l+16,jn,!0)})):x.BADF},fd_fdstat_set_flags(f,l){let d=s.get(f);return d?(d.append=(l&Er.APPEND)!==0,x.SUCCESS):x.BADF},fd_filestat_get(f,l){let d=s.get(f);return d?d.kind==="stdio"?U(()=>a(l,{isDirectory:()=>!1,size:0,mtimeMs:0},Te.CHARACTER_DEVICE)):U(()=>a(l,d.host!==void 0?t.fstatSync(d.host):t.statSync(d.path))):x.BADF},fd_filestat_set_size(f,l){let d=s.get(f);return!d||d.kind!=="file"?d?x.INVAL:x.BADF:U(()=>t.ftruncateSync(d.host,Number(l)))},fd_prestat_get(f,l){let d=s.get(f);return d?.preopen?U(()=>ye(()=>{r.view.setUint8(l,0),r.view.setUint32(l+4,new TextEncoder().encode(d.preopen).length,!0)})):x.BADF},fd_prestat_dir_name(f,l,d){let h=s.get(f);return h?.preopen?U(()=>void r.bytes(l,d).set(new TextEncoder().encode(h.preopen).subarray(0,d))):x.BADF},fd_readdir(f,l,d,h,p){let y=s.get(f);return y?y.kind!=="dir"?x.NOTDIR:U(()=>{let b=t.readdirSync(y.path,{withFileTypes:!0}),E=0;for(let C=Number(h);C<b.length&&E<d;C++){let A=b[C],g=new TextEncoder().encode(A.name),w=new Uint8Array(24+g.length),S=new DataView(w.buffer);S.setBigUint64(0,BigInt(C+1),!0),S.setUint32(16,g.length,!0),S.setUint8(20,A.isDirectory()?Te.DIRECTORY:Te.REGULAR_FILE),w.set(g,24);let I=Math.min(w.length,d-E);r.bytes(l+E,I).set(w.subarray(0,I)),E+=I}r.u32(p,E)}):x.BADF},path_open(f,l,d,h,p,y,b,E,C){let A=o(f,d,h);return typeof A=="number"?A:U(()=>{let g=t.statSync(A,{throwIfNoEntry:!1}),w=!!(p&et.EXCL&&p&et.CREAT);if(g&&w)return x.EXIST;if(!g&&!(p&et.CREAT))return x.NOENT;if(g?.isDirectory()){if(p&et.TRUNC)return x.ISDIR}else if(p&et.DIRECTORY)return g?x.NOTDIR:x.NOENT;let S=s.get(f),I=!!g?.isDirectory(),v=i;r.u32(C,v);let B=I?void 0:t.openSync(A,w?"wx+":!g||p&et.TRUNC?"w+":"r+");i++,s.set(v,{kind:I?"dir":"file",path:A,root:S.root,host:B,position:0,append:(E&Er.APPEND)!==0})})},path_filestat_get(f,l,d,h,p){let y=o(f,d,h);return typeof y=="number"?y:U(()=>{let b=t.statSync(y,{throwIfNoEntry:!1});if(!b)return x.NOENT;a(p,b)})},path_create_directory(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.mkdirSync(h))},path_remove_directory(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.rmdirSync(h))},path_unlink_file(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.unlinkSync(h))},path_rename(f,l,d,h,p,y){let b=o(f,l,d),E=o(h,p,y);return typeof b=="number"?b:typeof E=="number"?E:U(()=>t.renameSync(b,E))},fd_sync:f=>s.has(f)?x.SUCCESS:x.BADF,fd_datasync:f=>s.has(f)?x.SUCCESS:x.BADF,fd_advise:f=>s.has(f)?x.SUCCESS:x.BADF,fd_allocate:f=>s.has(f)?x.SUCCESS:x.BADF,fd_filestat_set_times:f=>s.has(f)?x.SUCCESS:x.BADF,path_filestat_set_times:()=>x.SUCCESS}}function Gi(t){if(t.length===1)return t[0].slice();let e=new Uint8Array(t.reduce((n,s)=>n+s.length,0)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e}var al=["args_get","args_sizes_get","environ_get","environ_sizes_get","clock_res_get","clock_time_get","fd_advise","fd_allocate","fd_close","fd_datasync","fd_fdstat_get","fd_fdstat_set_flags","fd_fdstat_set_rights","fd_filestat_get","fd_filestat_set_size","fd_filestat_set_times","fd_pread","fd_prestat_get","fd_prestat_dir_name","fd_pwrite","fd_read","fd_readdir","fd_renumber","fd_seek","fd_sync","fd_tell","fd_write","path_create_directory","path_filestat_get","path_filestat_set_times","path_link","path_open","path_readlink","path_remove_directory","path_rename","path_symlink","path_unlink_file","poll_oneoff","proc_exit","proc_raise","sched_yield","random_get","sock_accept","sock_recv","sock_send","sock_shutdown"],Vi=t=>t===yt.REALTIME||t===yt.MONOTONIC||t===yt.PROCESS_CPUTIME||t===yt.THREAD_CPUTIME,Cr=class extends Error{constructor(r){super(`WASI exit ${r}`);m(this,"code");this.code=r}};function Zi(t){class e{constructor(n={}){m(this,"wasiImport");m(this,"memory");m(this,"returnOnExit");m(this,"started",!1);m(this,"closeAll");if(n.version!==void 0&&n.version!=="preview1")throw new TypeError(`WASI version "${n.version}" is not supported: only 'preview1' is`);this.returnOnExit=n.returnOnExit??!0;let s=n.args??[],i=Object.entries(n.env??{}).flatMap(([f,l])=>l===void 0?[]:[`${f}=${l}`]),o=new yr(()=>{if(!this.memory)throw new Error("WASI: the instance has not been started or initialized");return this.memory}),{closeAll:a,...c}=Yi(t.fs,t,o,n.preopens??{});this.closeAll=a;let u={...c,args_get:(f,l)=>U(()=>o.strings(s,f,l)),args_sizes_get:(f,l)=>U(()=>o.sizes(s,f,l)),environ_get:(f,l)=>U(()=>o.strings(i,f,l)),environ_sizes_get:(f,l)=>U(()=>o.sizes(i,f,l)),clock_res_get:(f,l)=>Vi(f)?U(()=>o.u64(l,1000n)):x.INVAL,clock_time_get:(f,l,d)=>Vi(f)?U(()=>o.u64(d,f===yt.REALTIME?tt(Date.now())*1000000n:tt(performance.now()*1e6))):x.INVAL,random_get:(f,l)=>U(()=>{for(let d=0;d<l;d+=65536){let h=new Uint8Array(Math.min(65536,l-d));crypto.getRandomValues(h),o.bytes(f+d,h.length).set(h)}}),poll_oneoff:(f,l,d,h)=>U(()=>ye(()=>{let p=o.view;for(let y=0;y<d;y++){let b=f+y*48,E=l+y*32;o.bytes(E,32).fill(0),p.setBigUint64(E,p.getBigUint64(b,!0),!0),p.setUint8(E+10,p.getUint8(b+8))}p.setUint32(h,d,!0)})),proc_exit:f=>{throw new Cr(f)},sched_yield:()=>x.SUCCESS};this.wasiImport=Object.fromEntries(al.map(f=>[f,u[f]??(()=>x.NOSYS)]))}getImportObject(){return{wasi_snapshot_preview1:this.wasiImport}}start(n){let{_start:s}=this.attach(n);if(typeof s!="function")throw new TypeError("instance.exports._start is not a function");try{return s(),0}catch(i){if(!(i instanceof Cr))throw i;if(this.returnOnExit)return i.code;t.exit(i.code);return}finally{this.closeAll()}}initialize(n){let{_start:s,_initialize:i}=this.attach(n);if(typeof s=="function")throw new TypeError("instance.exports._start must not be a function for initialize()");typeof i=="function"&&i()}attach(n){if(this.started)throw new Error("WASI instance has already started");this.started=!0;let s=n.exports.memory;if(!(s instanceof WebAssembly.Memory))throw new TypeError("instance.exports.memory must be a WebAssembly.Memory");return this.memory=s,n.exports}}return{WASI:e}}var vr=class extends Error{constructor(r){let n=r.message===void 0;super(n?`${V(r.actual)} ${r.operator??"=="} ${V(r.expected)}`:String(r.message));m(this,"code","ERR_ASSERTION");m(this,"actual");m(this,"expected");m(this,"operator");m(this,"generatedMessage");this.name="AssertionError",this.actual=r.actual,this.expected=r.expected,this.operator=r.operator??"==",this.generatedMessage=n}};function Hn(t,e){if(t==e)return!0;if(typeof t!="object"||typeof e!="object"||!t||!e)return!1;let r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(s=>Hn(t[s],e[s]))}function Z(t,e,r,n){throw t instanceof Error?t:new vr({message:t,actual:e,expected:r,operator:n})}function Xi(t,e){return e===void 0?!0:typeof e=="function"?e.prototype!==void 0&&t instanceof e?!0:Error.isPrototypeOf(e)?!1:e(t)===!0:e instanceof RegExp?e.test(String(t instanceof Error?t.message:t))||e.test(String(t)):typeof e=="object"&&e?Object.entries(e).every(([r,n])=>n instanceof RegExp?n.test(String(t?.[r])):Qe(t?.[r],n)):!1}function Sr(t=!1){let e=(a,c)=>{a||Z(c??"The expression evaluated to a falsy value",a,!0,"==")},r=t?(a,c,u)=>!Object.is(a,c)&&Z(u,a,c,"strictEqual"):(a,c,u)=>a!=c&&!(Number.isNaN(a)&&Number.isNaN(c))&&Z(u,a,c,"=="),n=t?(a,c,u)=>!Qe(a,c)&&Z(u,a,c,"deepStrictEqual"):(a,c,u)=>!Hn(a,c)&&Z(u,a,c,"deepEqual"),s=(a,c,u)=>{typeof c=="string"&&([u,c]=[c,void 0]);try{a()}catch(f){if(!Xi(f,c))throw f;return}Z(u??"Missing expected exception.",void 0,c,"throws")},i=async(a,c,u)=>{typeof c=="string"&&([u,c]=[c,void 0]);try{await(typeof a=="function"?a():a)}catch(f){if(!Xi(f,c))throw f;return}Z(u??"Missing expected rejection.",void 0,c,"rejects")},o=(a,c)=>e(a,c);return Object.assign(o,{ok:e,equal:r,notEqual:t?(a,c,u)=>Object.is(a,c)&&Z(u,a,c,"notStrictEqual"):(a,c,u)=>a==c&&Z(u,a,c,"!="),strictEqual:(a,c,u)=>!Object.is(a,c)&&Z(u,a,c,"strictEqual"),notStrictEqual:(a,c,u)=>Object.is(a,c)&&Z(u,a,c,"notStrictEqual"),deepEqual:n,notDeepEqual:(a,c,u)=>(t?Qe(a,c):Hn(a,c))&&Z(u,a,c,"notDeepEqual"),deepStrictEqual:(a,c,u)=>!Qe(a,c)&&Z(u,a,c,"deepStrictEqual"),notDeepStrictEqual:(a,c,u)=>Qe(a,c)&&Z(u,a,c,"notDeepStrictEqual"),throws:s,doesNotThrow:(a,c)=>{try{a()}catch(u){Z(c??`Got unwanted exception: ${u?.message??u}`,u,void 0,"doesNotThrow")}},rejects:i,doesNotReject:async(a,c)=>{try{await(typeof a=="function"?a():a)}catch(u){Z(c??"Got unwanted rejection.",u,void 0,"doesNotReject")}},match:(a,c,u)=>!c.test(a)&&Z(u??`The input did not match the regular expression ${c}. Input: ${V(a)}`,a,c,"match"),doesNotMatch:(a,c,u)=>c.test(a)&&Z(u,a,c,"doesNotMatch"),ifError:a=>{if(a!=null)throw a},fail:a=>Z(a??"Failed",void 0,void 0,"fail"),AssertionError:vr}),o.strict=t?o:Sr(!0),o}var Wn=t=>typeof t=="string"?D.from(t):t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),bt=t=>t?.level===void 0||t.level<0?6:Math.min(9,t.level),cl={gzip:(t,e)=>Ds(t,{level:bt(e)}),gunzip:t=>Nt(t),deflate:(t,e)=>Ns(t,{level:bt(e)}),inflate:t=>dn(t),deflateRaw:(t,e)=>xs(t,{level:bt(e)}),inflateRaw:t=>ln(t),unzip:t=>Ts(t)},eo={Gzip:t=>new _s({level:bt(t)}),Gunzip:()=>new fn,Deflate:t=>new Os({level:bt(t)}),Inflate:()=>new un,DeflateRaw:t=>new $e({level:bt(t)}),InflateRaw:()=>new ve,Unzip:()=>new Rs},to=4;function Pt(t){let e=t instanceof Error?t.message:String(t);return Object.assign(new Error(e||"invalid compressed data"),{code:"Z_DATA_ERROR",errno:-3})}var Br=class extends We{constructor(r,n){super();m(this,"engine");m(this,"bytesWritten",0);m(this,"_handle",{close:()=>{}});this.engine=eo[r](n),this.engine.ondata=s=>{s.length&&this.push(D.from(s))}}_transform(r,n,s){try{this.bytesWritten+=r.length,this.engine.push(r,!1),s()}catch(i){s(Pt(i))}}_flush(r){try{this.engine.push(new Uint8Array(0),!0),r()}catch(n){r(Pt(n))}}_processChunk(r,n){let s=[],i=this.engine.ondata;this.engine.ondata=o=>void(o.length&&s.push(o));try{this.bytesWritten+=r.length,this.engine.push(r,n===to)}catch(o){throw Pt(o)}finally{this.engine.ondata=i}return D.concat(s)}flush(r,n){n?.()}params(r,n,s){s?.()}close(r){this.destroy(),r?.()}},Et=()=>{throw Object.assign(new Error("Brotli is not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function ro(){let t={constants:{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:to,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_PARAM_QUALITY:1},brotliCompressSync:Et,brotliDecompressSync:Et,brotliCompress:Et,brotliDecompress:Et,createBrotliCompress:Et,createBrotliDecompress:Et,crc32:(e,r=0)=>{let n=~r>>>0;for(let s of Wn(e)){n^=s;for(let i=0;i<8;i++)n=n&1?n>>>1^3988292384:n>>>1}return~n>>>0}};for(let[e,r]of Object.entries(cl))t[`${e}Sync`]=(n,s)=>{try{return D.from(r(Wn(n),s))}catch(i){throw Pt(i)}},t[e]=(n,s,i)=>{let o=typeof s=="function"?s:i;T(()=>{try{o(null,D.from(r(Wn(n),typeof s=="object"?s:void 0)))}catch(a){o(Pt(a))}})};for(let e of Object.keys(eo))t[`create${e}`]=r=>new Br(e,r),t[e]=class extends Br{constructor(r){super(e,r)}};return t}var Ee=class extends M{constructor(r=0){super();m(this,"remoteAddress","127.0.0.1");m(this,"remotePort",5e4+Math.floor(Math.random()*1e4));m(this,"remoteFamily","IPv4");m(this,"localAddress","127.0.0.1");m(this,"localPort");m(this,"encrypted",!1);m(this,"readable",!0);m(this,"writable",!0);m(this,"destroyed",!1);m(this,"bytesRead",0);m(this,"bytesWritten",0);this.localPort=r}setTimeout(r,n){return n&&this.once("timeout",n),this}setNoDelay(){return this}setKeepAlive(){return this}address(){return{address:this.localAddress,family:"IPv4",port:this.localPort}}ref(){return this}unref(){return this}cork(){}uncork(){}write(){return!0}end(){return this}destroy(){return this.destroyed=!0,this}};function ll(t){let e={},r=[];for(let[n,s]of Object.entries(t)){let i=n.toLowerCase();r.push(n,s),e[i]=i==="set-cookie"?[s]:s}return{headers:e,raw:r}}var Le=class extends X{constructor(r=new Ee){super();m(this,"httpVersion","1.1");m(this,"httpVersionMajor",1);m(this,"httpVersionMinor",1);m(this,"method");m(this,"url");m(this,"statusCode");m(this,"statusMessage");m(this,"headers",{});m(this,"rawHeaders",[]);m(this,"trailers",{});m(this,"rawTrailers",[]);m(this,"complete",!1);m(this,"aborted",!1);m(this,"socket");m(this,"connection");this.socket=r,this.connection=r}_read(){}setTimeout(r,n){return n&&this.once("timeout",n),this}_fill(r,n){this._setHeaders(r),n?.length&&this.push(D.from(n)),this._complete()}_setHeaders(r){let{headers:n,raw:s}=ll(r);this.headers=n,this.rawHeaders=s}_complete(){this.push(null),this.complete=!0}},Me=class extends ie{constructor(){super(...arguments);m(this,"_headers",new Map);m(this,"headersSent",!1);m(this,"sendDate",!0)}setHeader(r,n){if(this.headersSent)throw Object.assign(new Error("Cannot set headers after they are sent to the client"),{code:"ERR_HTTP_HEADERS_SENT"});return this._headers.set(r.toLowerCase(),{name:r,value:Array.isArray(n)?n.map(String):String(n)}),this}appendHeader(r,n){let s=this.getHeader(r),i=[...s===void 0?[]:Array.isArray(s)?s:[String(s)],...Array.isArray(n)?n:[n]];return this.setHeader(r,i)}getHeader(r){return this._headers.get(r.toLowerCase())?.value}getHeaders(){let r=Object.create(null);for(let[n,{value:s}]of this._headers)r[n]=s;return r}getHeaderNames(){return[...this._headers.keys()]}getRawHeaderNames(){return[...this._headers.values()].map(r=>r.name)}hasHeader(r){return this._headers.has(r.toLowerCase())}removeHeader(r){this._headers.delete(r.toLowerCase())}flushHeaders(){this.headersSent=!0}setTimeout(r,n){return n&&this.once("timeout",n),this}};var fl=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]),ul=new Set(["host","connection","content-length","keep-alive","transfer-encoding","upgrade","expect","te","trailer","proxy-connection"]);function dl(t,e,r){let n={};if(typeof t=="string"||t instanceof URL){let s=new URL(String(t));n={protocol:s.protocol,hostname:s.hostname.replace(/^\[|\]$/g,""),port:s.port,path:s.pathname+s.search,auth:s.username?`${decodeURIComponent(s.username)}:${decodeURIComponent(s.password)}`:void 0},e&&typeof e=="object"&&(n={...n,...e})}else t&&typeof t=="object"&&(n={...t});if(n.protocol??(n.protocol=r),!n.hostname&&n.host){let[s,i]=n.host.split(":");n.hostname=s,n.port??(n.port=i)}return n.hostname??(n.hostname="localhost"),n.path??(n.path="/"),n.method=(n.method??"GET").toUpperCase(),n}function no(t){return fl.has(t.toLowerCase())}function so(t){let e={};return t.forEach((r,n)=>e[n]=r),e}async function io(t,e,r,n){if(no(e.hostname)){let o=Number(e.port||(e.protocol==="https:"?443:80)),a=await t.loopback(o,r);if(!a)throw Object.assign(new Error(`connect ECONNREFUSED 127.0.0.1:${o}`),{code:"ECONNREFUSED",errno:-111,syscall:"connect",address:"127.0.0.1",port:o});let c=new Headers;for(let[f,l]of Object.entries(a.headers))for(let d of Array.isArray(l)?l:[l])c.append(f,String(d));let u=a.status===204||a.status===304||r.method==="HEAD";return u&&a.body.cancel().catch(()=>{}),new Response(u?null:a.body,{status:a.status,statusText:a.statusText,headers:c})}let s={};for(let[o,a]of Object.entries(r.headers))ul.has(o.toLowerCase())||(s[o]=a);let i=r.body&&r.method!=="GET"&&r.method!=="HEAD";return t.fetch(e.href,{method:r.method,headers:s,body:i?r.body:void 0,signal:n})}var jt=class extends Me{constructor(r,n,s,i,o){super({decodeStrings:!0,autoDestroy:!1});m(this,"deps");m(this,"method");m(this,"path");m(this,"host");m(this,"protocol");m(this,"aborted",!1);m(this,"reusedSocket",!1);m(this,"socket",new Ee);m(this,"connection",this.socket);m(this,"chunks",[]);m(this,"controller",new AbortController);m(this,"options");this.deps=r,typeof s=="function"&&([i,s]=[s,void 0]),this.options=dl(n,s,o),this.method=this.options.method,this.path=this.options.path,this.host=this.options.hostname,this.protocol=this.options.protocol;for(let[a,c]of Object.entries(this.options.headers??{}))this.setHeader(a,c);this.options.auth&&!this.hasHeader("authorization")&&this.setHeader("authorization",`Basic ${D.from(this.options.auth).toString("base64")}`),i&&this.once("response",i),this.options.signal?.addEventListener("abort",()=>this.destroy(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"})))}_write(r,n,s){this.chunks.push(r),s()}_final(r){this.headersSent=!0,r(),this.perform()}abort(){this.aborted=!0,this.controller.abort(),this.emit("abort"),this.destroy()}destroy(r){return this.controller.abort(),super.destroy(r)}setNoDelay(){}setSocketKeepAlive(){}async streamBody(r,n){let s=r.body?.getReader();if(s){let i=()=>void s.cancel().catch(()=>{});this.controller.signal.addEventListener("abort",i);try{for(;;){let{value:o,done:a}=await s.read();if(a||this.controller.signal.aborted)break;this.deps.loop._run(()=>n.push(D.from(o.buffer,o.byteOffset,o.byteLength)))}}catch(o){if(this.controller.signal.aborted)return;this.deps.loop._run(()=>{n.aborted=!0,n.destroy(o)});return}finally{this.controller.signal.removeEventListener("abort",i)}}this.controller.signal.aborted||this.deps.loop._run(()=>n._complete())}async perform(){let r=this.deps.loop.hold();try{let n=this.options.port?`:${this.options.port}`:"",s=this.host.includes(":")?`[${this.host}]`:this.host,i=new URL(`${this.protocol}//${s}${n}${this.path}`),o={};for(let[f,l]of Object.entries(this.getHeaders()))o[f]=Array.isArray(l)?l.join(", "):String(l);let a=this.chunks.length?D.concat(this.chunks):null,c=await io(this.deps.system,i,{method:this.method,url:this.path,headers:o,body:a},this.controller.signal),u=new Le(this.socket);u.statusCode=c.status,u.statusMessage=c.statusText,u._setHeaders(so(c.headers)),this.deps.loop._run(()=>{this.emit("response",u)||u.resume()}),await this.streamBody(c,u)}catch(n){this.aborted||this.deps.loop._run(()=>this.emit("error",n))}finally{r()}}};function Jn(t){return async(e,r)=>{let n=t.loop.hold();try{let s=new Request(e instanceof URL?e.href:e,r),i=new URL(s.url);if(!no(i.hostname))return await t.system.fetch(i.href,r??(typeof e=="object"&&!(e instanceof URL)?{method:s.method,headers:s.headers,body:s.body,signal:s.signal}:void 0));let o=s.method==="GET"||s.method==="HEAD"?null:new Uint8Array(await s.arrayBuffer()),a=await io(t.system,i,{method:s.method,url:i.pathname+i.search,headers:so(s.headers),body:o});return hl(a,()=>t.loop.hold())}finally{n()}}}function hl(t,e){if(!t.body)return t;let r=t.body.getReader(),n=new ReadableStream({async pull(s){let i=e();try{let{value:o,done:a}=await r.read();a?s.close():s.enqueue(o)}catch(o){s.error(o)}finally{i()}},cancel:s=>r.cancel(s)},{highWaterMark:0});return new Response(n,{status:t.status,statusText:t.statusText,headers:t.headers})}var Ir={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},oo=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];var pl=new Set([101,204,304]),rt=class extends Me{constructor(r,n){super({decodeStrings:!0});m(this,"sink");m(this,"statusCode",200);m(this,"statusMessage","");m(this,"req");m(this,"socket");m(this,"connection");m(this,"chunkedEncoding",!1);m(this,"shouldKeepAlive",!1);m(this,"headWritten",!1);m(this,"hungUp",!1);this.sink=n,this.req=r,this.socket=r.socket,this.connection=r.socket}get finished(){return this.writableEnded}writeHead(r,n,s){if(typeof n!="string"&&([s,n]=[n,void 0]),this.statusCode=r,n&&(this.statusMessage=n),Array.isArray(s))for(let i=0;i+1<s.length;i+=2)this.setHeader(String(s[i]),s[i+1]);else if(s)for(let[i,o]of Object.entries(s))o!==void 0&&this.setHeader(i,o);return this.sendHead(),this}flushHeaders(){this.sendHead()}_implicitHeader(){this.sendHead()}get _header(){return this.headersSent}writeContinue(){}writeProcessing(){}writeEarlyHints(){}addTrailers(){}assignSocket(){}detachSocket(){}_write(r,n,s){this.sendHead(),!this.hungUp&&this.req.method!=="HEAD"&&!pl.has(this.statusCode)&&this.sink.chunk(new Uint8Array(r)),s()}_final(r){this.sendHead(),this.hungUp||this.sink.end(),r()}_hangUp(){this.hungUp||this.writableFinished||(this.hungUp=!0,this._writableState.emitClose=!1,this.req.aborted=!0,this.req.emit("aborted"),this.req.emit("close"),this.socket.destroyed=!0,this.socket.emit("close",!1),this.emit("close"))}sendHead(){if(this.headersSent=!0,this.headWritten)return;this.headWritten=!0;let r={};for(let{name:n,value:s}of this._headers.values())r[n]=s;this.sink.head({status:this.statusCode,statusText:this.statusMessage||Ir[this.statusCode]||"",headers:r})}};var Qr=class extends Ne{constructor(r,n,s){super({allowHalfOpen:!1});m(this,"channel");m(this,"remoteAddress","127.0.0.1");m(this,"remotePort",5e4+Math.floor(Math.random()*1e4));m(this,"remoteFamily","IPv4");m(this,"localAddress","127.0.0.1");m(this,"localPort");m(this,"encrypted",!1);m(this,"connecting",!1);m(this,"bytesRead",0);m(this,"bytesWritten",0);m(this,"release");this.channel=r,this.localPort=n,this.release=s?.(),r.onData(i=>{this.bytesRead+=i.byteLength,this.push(D.from(i.buffer,i.byteOffset,i.byteLength))}),r.onClose(()=>{this.push(null),this.end()}),this.once("close",()=>{this.release?.(),this.release=void 0})}_read(){}_write(r,n,s){this.bytesWritten+=r.byteLength,this.channel.send(r),s()}_final(r){this.channel.close(),this.push(null),r()}_destroy(r,n){this.channel.close(),n(r)}setTimeout(r,n){return n&&this.once("timeout",n),this}setNoDelay(){return this}setKeepAlive(){return this}address(){return{address:this.localAddress,family:"IPv4",port:this.localPort}}ref(){return this}unref(){return this.release?.(),this.release=void 0,this}};var Kt=class extends M{constructor(r,n,s){super();m(this,"deps");m(this,"listening",!1);m(this,"timeout",0);m(this,"keepAliveTimeout",5e3);m(this,"headersTimeout",6e4);m(this,"requestTimeout",3e5);m(this,"maxHeadersCount",null);m(this,"registration");m(this,"release");this.deps=r,typeof n=="function"&&(s=n),s&&this.on("request",s)}listen(...r){let n=typeof r[r.length-1]=="function"?r.pop():void 0,s=r[0],i=Number(typeof s=="object"&&s?s.port??0:s??0);n&&this.once("listening",n);try{this.registration=this.deps.system.listen(i,o=>this.handle(o),(o,a)=>this.upgrade(o,a))}catch(o){return T(()=>this.emit("error",o)),this}return this.listening=!0,this.release=this.deps.loop.hold(),T(()=>this.emit("listening")),this}address(){return this.registration?{address:"::",family:"IPv6",port:this.registration.port}:null}close(r){return this.registration?(this.registration.close(),this.registration=void 0,this.listening=!1,this.release?.(),this.release=void 0,r&&this.once("close",r),T(()=>this.emit("close")),this):(r&&T(()=>r(Object.assign(new Error("Server is not running."),{code:"ERR_SERVER_NOT_RUNNING"}))),this)}closeAllConnections(){}closeIdleConnections(){}setTimeout(r=0,n){return this.timeout=r,n&&this.on("timeout",n),this}ref(){return this.registration&&!this.release&&(this.release=this.deps.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}getConnections(r){r(null,0)}toIncoming(r,n,s,i){let o=new Le(n);o.method=r.method.toUpperCase(),o.url=r.url;let a=Object.keys(s).some(c=>c.toLowerCase()==="host");return o._fill(a?s:{...s,host:`localhost:${n.localPort}`},i),o}handle(r){return new Promise(n=>{let s={...r.headers};!Object.keys(s).some(u=>/^(content-length|transfer-encoding)$/i.test(u))&&r.body?.length&&(s["content-length"]=String(r.body.length));let o=this.toIncoming(r,new Ee(this.registration?.port??0),s,r.body),a=Lt(()=>this.deps.loop._run(()=>c._hangUp())),c=new rt(o,{head:u=>n({...u,body:a.stream}),chunk:u=>a.push(u),end:()=>a.end()});this.deps.loop._run(()=>{try{this.emit("request",o,c)}catch(u){throw c.writableEnded||(c.statusCode=500,c.end("Internal Server Error")),u}})})}upgrade(r,n){if(!this.listenerCount("upgrade"))return n.close();let s=new Qr(n,this.registration?.port??0,()=>this.deps.loop.hold()),i=this.toIncoming(r,s,r.headers,null);this.deps.loop._run(()=>this.emit("upgrade",i,s,D.alloc(0)))}};var kr=class extends M{constructor(r={}){super();m(this,"options");m(this,"maxSockets",1/0);m(this,"maxFreeSockets",256);m(this,"sockets",{});m(this,"requests",{});m(this,"freeSockets",{});this.options=r}destroy(){}};function qn(t,e){let r=(i,o,a)=>new jt(t,i,o,a,e),n=(i,o,a)=>{let c=r(i,o,a);return c.end(),c},s=new kr;return{createServer:(i,o)=>new Kt(t,i,o),request:r,get:n,Server:class extends Kt{constructor(i,o){super(t,i,o)}},IncomingMessage:Le,ServerResponse:rt,OutgoingMessage:Me,ClientRequest:jt,Agent:kr,globalAgent:s,STATUS_CODES:Ir,METHODS:oo,maxHeaderSize:16384,validateHeaderName(i){if(!/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/.test(i))throw Object.assign(new TypeError(`Header name must be a valid HTTP token ["${i}"]`),{code:"ERR_INVALID_HTTP_TOKEN"})},validateHeaderValue(i,o){if(o===void 0)throw Object.assign(new TypeError(`Invalid value "undefined" for header "${i}"`),{code:"ERR_HTTP_INVALID_HEADER_VALUE"})},setMaxIdleHTTPParsers:()=>{}}}var ao=/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/,co=/^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;function lo(t){class e extends M{constructor(){super(...arguments);m(this,"reservation");m(this,"release");m(this,"listening",!1)}listen(...i){let o=typeof i[i.length-1]=="function"?i.pop():void 0,a=i[0],c=Number(typeof a=="object"&&a?a.port??0:a??0);o&&this.once("listening",o);try{this.reservation=t.system.listen(c,async()=>Mt(502,"Not an HTTP server"))}catch(u){return T(()=>this.emit("error",u)),this}return this.listening=!0,this.release=t.loop.hold(),T(()=>this.emit("listening")),this}address(){return this.reservation?{address:"::",family:"IPv6",port:this.reservation.port}:null}close(i){return this.reservation?.close(),this.reservation=void 0,this.listening=!1,this.release?.(),i&&this.once("close",i),T(()=>this.emit("close")),this}ref(){return this}unref(){return this.release?.(),this.release=void 0,this}}let r=()=>{throw Object.assign(new Error("Raw TCP sockets are not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};return{createServer:()=>new e,Server:e,Socket:Ee,Stream:Ee,connect:r,createConnection:r,isIP:n=>ao.test(n)?4:co.test(n)?6:0,isIPv4:n=>ao.test(n),isIPv6:n=>co.test(n),getDefaultAutoSelectFamily:()=>!0,setDefaultAutoSelectFamily:()=>{}}}var Al=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,nt=class extends M{constructor(r,n,s,i){super();m(this,"pid");m(this,"exitCode",null);m(this,"signalCode",null);m(this,"killed",!1);m(this,"connected",!1);m(this,"spawnfile");m(this,"spawnargs");m(this,"stdin");m(this,"stdout");m(this,"stderr");m(this,"stdio");m(this,"handle");m(this,"ipc");m(this,"release");m(this,"exited",!1);m(this,"hold");this.spawnfile=n,this.spawnargs=[n,...s],this.stdout=new X({read(){}}),this.stderr=new X({read(){}}),this.stdin=new ie({write:(h,p,y)=>{this.handle?.write(typeof h=="string"?h:new Uint8Array(h)),y()},final:h=>{this.handle?.closeStdin(),h()}}),this.stdio=[this.stdin,this.stdout,this.stderr];let o=h=>i.stdio==="inherit"||Array.isArray(i.stdio)&&i.stdio[h]==="inherit",[a,c]=[o(1),o(2)],u={};for(let[h,p]of Object.entries(i.env??r.env()))p!==void 0&&(u[h]=String(p));let[f,l]=i.shell?["bfsh",["-c",[n,...s].join(" ")]]:[n,s];this.hold=()=>r.loop.hold(),this.release=this.hold();try{this.handle=r.system.spawn(f,l,{cwd:i.cwd??r.cwd(),env:u,ipc:i.ipc,detached:i.detached})}catch(h){this.unref();let p=h.code??"ENOENT",y=Object.assign(new Error(`spawn ${n} ${p}`),{code:p,errno:-2,syscall:`spawn ${n}`,path:n,spawnargs:s});T(()=>{this.emit("error",y),this.emit("close",-2,null)});return}this.pid=this.handle.pid;let d=this.handle.ipc;d&&(this.ipc=d,this.connected=!0,d.onMessage(h=>r.loop._run(()=>this.emit("message",h,void 0))),d.onDisconnect(()=>{this.connected=!1,r.loop._run(()=>this.emit("disconnect"))})),this.handle.onStdout(h=>a?r.stdout(h):this.stdout.push(D.from(h))),this.handle.onStderr(h=>c?r.stderr(h):this.stderr.push(D.from(h))),i.signal?.addEventListener("abort",()=>this.kill()),T(()=>this.emit("spawn")),this.handle.exit.then(h=>{this.exited=!0,this.exitCode=this.killed?null:h,this.stdout.push(null),this.stderr.push(null),r.loop._run(()=>{this.emit("exit",this.exitCode,this.signalCode),this.emit("close",this.exitCode,this.signalCode)}),this.unref()})}kill(r="SIGTERM"){return!this.handle||this.exitCode!==null?!1:(this.killed=!0,this.signalCode=r,this.handle.kill(r),!0)}send(r,...n){let s=n.find(o=>typeof o=="function"),i=o=>(s?T(()=>s(o)):T(()=>this.emit("error",o)),!1);if(!this.ipc)return i(Object.assign(new Error("Channel closed"),{code:"ERR_IPC_CHANNEL_CLOSED"}));try{this.ipc.send(r)}catch(o){return i(o)}return s&&T(()=>s(null)),!0}disconnect(){this.ipc?.disconnect()}ref(){!this.release&&this.handle&&!this.exited&&(this.release=this.hold())}unref(){this.release?.(),this.release=void 0}};function fo(t,e,r){let n="",s="";return t.stdout.on("data",i=>n+=String(i)),t.stderr.on("data",i=>s+=String(i)),t.on("error",i=>r?.(i,n,s)),t.on("close",(i,o)=>{if(i===-2)return;let a=i===0?null:Object.assign(new Error(`Command failed: ${e}
24
- ${s}`),{code:i??void 0,killed:t.killed,signal:o,cmd:e});r?.(a,n,s)}),t}var zn=t=>()=>{throw Object.assign(new Error(`child_process.${t} is not supported in the browser runtime (a synchronous child would block the thread it needs). Use the async form.`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function uo(t){return{spawn:(r,n,s)=>(Array.isArray(n)||([s,n]=[n,[]]),new nt(t,r,n.map(String),s??{})),exec(r,n,s){return typeof n=="function"&&([s,n]=[n,{}]),fo(new nt(t,r,[],{...n,shell:!0}),r,s)},execFile(r,n,s,i){return typeof n=="function"?[i,n,s]=[n,[],{}]:Array.isArray(n)||([i,s,n]=[s,n,[]]),typeof s=="function"&&([i,s]=[s,{}]),fo(new nt(t,r,n,s??{}),[r,...n].map(Al).join(" "),i)},fork(r,n,s){Array.isArray(n)||([s,n]=[n,[]]);let i=s??{},o=i.stdio??(i.silent?"pipe":"inherit");return new nt(t,"node",[...i.execArgv??[],r,...n.map(String)],{...i,stdio:o,ipc:!0})},execSync:zn("execSync"),execFileSync:zn("execFileSync"),spawnSync:zn("spawnSync"),ChildProcess:nt}}var _r=class extends M{constructor(r,n,s={}){super();m(this,"input");m(this,"output");m(this,"line","");m(this,"cursor",0);m(this,"terminal");m(this,"closed",!1);m(this,"buffer","");m(this,"promptText","> ");m(this,"pendingQuestion");m(this,"onData",r=>this.feed(String(r)));m(this,"onEnd",()=>{this.buffer&&this.emitLine(this.buffer),this.buffer="",this.close()});this.input=r,this.output=n,this.terminal=s.terminal??!!n?.isTTY,s.prompt!==void 0&&(this.promptText=s.prompt),r.setEncoding?.("utf8"),r.on("data",this.onData),r.on("end",this.onEnd),r.resume?.()}setPrompt(r){this.promptText=r}getPrompt(){return this.promptText}prompt(){this.output?.write(this.promptText)}question(r,n,s){let i=typeof n=="function"?n:s;this.output?.write(r),this.pendingQuestion=i}write(r){this.feed(r)}pause(){return this.input.pause?.(),this.emit("pause"),this}resume(){return this.input.resume?.(),this.emit("resume"),this}close(){this.closed||(this.closed=!0,this.input.removeListener("data",this.onData),this.input.removeListener("end",this.onEnd),this.input.pause?.(),this.emit("close"))}getCursorPos(){return{rows:0,cols:this.cursor}}async*[Symbol.asyncIterator](){let r=[],n;for(this.on("line",s=>{r.push(s),n?.()}),this.on("close",()=>n?.());;)if(r.length)yield r.shift();else{if(this.closed)return;await new Promise(s=>n=s)}}feed(r){for(this.buffer+=r;;){let n=this.buffer.search(/\r\n|\n|\r/);if(n<0)break;let s=this.buffer.slice(0,n);this.buffer=this.buffer.slice(this.buffer[n]==="\r"&&this.buffer[n+1]===`
25
- `?n+2:n+1),this.emitLine(s)}this.line=this.buffer,this.cursor=this.buffer.length}emitLine(r){let n=this.pendingQuestion;n?(this.pendingQuestion=void 0,n(r)):this.emit("line",r)}},xr=(t,e,r)=>(t?.write(e),r?.(),!0);function Gn(t=!1){let r={createInterface:(n,s)=>{let i="input"in n&&n.input?n:{input:n,output:s},o=new _r(i.input,i.output,i);if(t){let a=o.question.bind(o);o.question=c=>new Promise(u=>a(c,void 0,u))}return o},Interface:_r,clearLine:(n,s,i)=>xr(n,s<0?"\x1B[1K":s>0?"\x1B[0K":"\x1B[2K",i),clearScreenDown:(n,s)=>xr(n,"\x1B[0J",s),cursorTo:(n,s,i,o)=>xr(n,typeof i=="number"?`\x1B[${i+1};${s+1}H`:`\x1B[${s+1}G`,typeof i=="function"?i:o),moveCursor:(n,s,i,o)=>xr(n,(s<0?`\x1B[${-s}D`:s>0?`\x1B[${s}C`:"")+(i<0?`\x1B[${-i}A`:i>0?`\x1B[${i}B`:""),o),emitKeypressEvents(n){n.__keypress||(n.__keypress=!0,n.on("data",s=>{for(let i of String(s)){let o=i==="\r"||i===`
26
- `?"return":i==="\x7F"?"backspace":i===""?"c":/[a-z]/i.test(i)?i.toLowerCase():void 0;n.emit("keypress",i,{sequence:i,name:o,ctrl:i==="",meta:!1,shift:/[A-Z]/.test(i)})}}))}};return t||(r.promises=Gn(!0)),r}function ho(t){let e=Array.from({length:Math.max(1,Math.min(16,globalThis.navigator?.hardwareConcurrency??4))},()=>({model:"Browser CPU",speed:2400,times:{user:0,nice:0,sys:0,idle:0,irq:0}}));return{EOL:`
27
- `,devNull:"/dev/null",platform:()=>"linux",type:()=>"Linux",release:()=>"6.1.0-bfwc",version:()=>"#1 SMP BuilderForce WebContainers",machine:()=>"x86_64",arch:()=>"x64",hostname:()=>"localhost",homedir:()=>t().HOME??"/home/user",tmpdir:()=>t().TMPDIR??"/tmp",userInfo:()=>({uid:1e3,gid:1e3,username:t().USER??"user",homedir:t().HOME??"/home/user",shell:"/bin/bfsh"}),cpus:()=>e,availableParallelism:()=>e.length,totalmem:()=>4*1024**3,freemem:()=>2*1024**3,loadavg:()=>[0,0,0],uptime:()=>Math.floor(performance.now()/1e3),networkInterfaces:()=>({lo:[{address:"127.0.0.1",netmask:"255.0.0.0",family:"IPv4",mac:"00:00:00:00:00:00",internal:!0,cidr:"127.0.0.1/8"}]}),endianness:()=>"LE",getPriority:()=>0,setPriority:()=>{},constants:{signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGKILL:9,SIGTERM:15},errno:{},priority:{}}}}function po(t){return{isatty:e=>t&&e>=0&&e<=2,ReadStream:class extends M{},WriteStream:class extends M{}}}function Ao(t){let e={setTimeout:(r,n,s)=>new Promise((i,o)=>{let a=t.setTimeout(()=>i(n),r);s?.signal?.addEventListener("abort",()=>{t.clearTimeout(a),o(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"}))})}),setImmediate:r=>new Promise(n=>t.setImmediate(()=>n(r))),async*setInterval(r,n){for(;;)await new Promise(s=>t.setTimeout(s,r)),yield n},scheduler:{wait:r=>new Promise(n=>t.setTimeout(n,r)),yield:()=>new Promise(r=>t.setImmediate(r))}};return{setTimeout:t.setTimeout,clearTimeout:t.clearTimeout,setInterval:t.setInterval,clearInterval:t.clearInterval,setImmediate:t.setImmediate,clearImmediate:t.clearImmediate,promises:e}}function go(){let t=(r,n)=>{r.encoding=(n??"utf8").toLowerCase().replace("-",""),r.encoding==="utf8"&&(r.utf8=new TextDecoder("utf-8"))};class e{constructor(n){t(this,n)}write(n){return typeof n=="string"?n:this.utf8?this.utf8.decode(n,{stream:!0}):Dn(n,this.encoding)}end(n){return(n===void 0?"":this.write(n))+(this.utf8?this.utf8.decode():"")}}return{StringDecoder:ce(e,t)}}function mo(){class t{constructor(){m(this,"store")}getStore(){return this.store}run(n,s,...i){let o=this.store;this.store=n;try{return s(...i)}finally{this.store=o}}enterWith(n){this.store=n}exit(n,...s){return this.run(void 0,n,...s)}disable(){this.store=void 0}static bind(n){return n}static snapshot(){return(n,...s)=>n(...s)}}class e{constructor(n){m(this,"type");this.type=n}runInAsyncScope(n,s,...i){return n.apply(s,i)}bind(n){return n}static bind(n){return n}emitDestroy(){return this}asyncId(){return 1}triggerAsyncId(){return 0}}return{AsyncLocalStorage:t,AsyncResource:e,createHook:()=>({enable(){return this},disable(){return this}}),executionAsyncId:()=>1,triggerAsyncId:()=>0,executionAsyncResource:()=>({})}}var Yn="__bfwc_vm_code";function wo(){let t=(r,n={})=>{let s=new Proxy(n,{has:(i,o)=>o!==Yn,get:(i,o)=>{if(o!==Symbol.unscopables)return o==="globalThis"?s:o in i?i[o]:Reflect.get(globalThis,o)},set:(i,o,a)=>Reflect.set(i,o,a)});return new Function(Yn,`with (this) { return eval(${Yn}); }`).call(s,r)};class e{constructor(n){m(this,"code");this.code=n}runInThisContext(){return(0,eval)(this.code)}runInNewContext(n){return t(this.code,n)}runInContext(n){return t(this.code,n)}}return{Script:e,runInThisContext:r=>(0,eval)(r),runInNewContext:t,runInContext:t,createContext:(r={})=>r,isContext:()=>!0,compileFunction:(r,n=[])=>new Function(...n,r)}}function yo(){let t=new Map,e=r=>{let n=t.get(r);if(!n){let s=new Set;n=Object.assign({subscribers:s,name:r},{get hasSubscribers(){return s.size>0},publish:i=>s.forEach(o=>o(i,r)),subscribe:i=>void s.add(i),unsubscribe:i=>s.delete(i)}),t.set(r,n)}return n};return{channel:e,hasSubscribers:r=>(t.get(r)?.subscribers.size??0)>0,subscribe:(r,n)=>e(r).subscribers.add(n),unsubscribe:(r,n)=>e(r).subscribers.delete(n),tracingChannel:r=>({start:e(`tracing:${r}:start`),end:e(`tracing:${r}:end`),error:e(`tracing:${r}:error`),traceSync:n=>n(),tracePromise:n=>n()})}}var pe=t=>()=>{throw Object.assign(new Error(`${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Eo(){return{perf_hooks:{performance:globalThis.performance,PerformanceObserver:class{observe(){}disconnect(){}},monitorEventLoopDelay:()=>({enable(){},disable(){},percentile:()=>0,mean:0,max:0,min:0}),constants:{}},dns:{lookup:(t,e,r)=>T(()=>(typeof e=="function"?e:r)(null,t==="localhost"?"127.0.0.1":t,4)),resolve:pe("dns.resolve"),promises:{lookup:async t=>({address:t==="localhost"?"127.0.0.1":t,family:4})},setDefaultResultOrder:()=>{}},v8:{getHeapStatistics:()=>({total_heap_size:3e7,used_heap_size:2e7,heap_size_limit:2e9}),getHeapSpaceStatistics:()=>[],serialize:t=>new TextEncoder().encode(JSON.stringify(t)),deserialize:t=>JSON.parse(new TextDecoder().decode(t)),setFlagsFromString:()=>{},cachedDataVersionTag:()=>0},cluster:{isMaster:!0,isPrimary:!0,isWorker:!1,workers:{},fork:pe("cluster.fork"),on:()=>{},settings:{}},inspector:{open:()=>{},close:()=>{},url:()=>{},Session:class{connect(){}post(){}disconnect(){}},console:globalThis.console},punycode:{toASCII:t=>new URL(`http://${t}`).hostname,toUnicode:t=>t,encode:t=>t,decode:t=>t,ucs2:{decode:t=>Array.from(t,e=>e.codePointAt(0)),encode:t=>String.fromCodePoint(...t)}},tls:{connect:pe("tls.connect"),createServer:pe("tls.createServer"),createSecureContext:()=>({}),DEFAULT_MIN_VERSION:"TLSv1.2",DEFAULT_MAX_VERSION:"TLSv1.3",rootCertificates:[]},dgram:{createSocket:pe("dgram.createSocket")},http2:{connect:pe("http2.connect"),createServer:pe("http2.createServer"),createSecureServer:pe("http2.createSecureServer"),constants:{}},trace_events:{createTracing:()=>({enable(){},disable(){}}),getEnabledCategories:()=>""},sqlite:{DatabaseSync:pe("sqlite.DatabaseSync")},test:{test:pe("node:test"),describe:pe("node:test"),it:pe("node:test")},repl:{start:pe("repl.start")},domain:{create:()=>Object.assign(new M,{run:t=>t(),add(){},remove(){},bind:t=>t,intercept:t=>t,enter(){},exit(){},dispose(){}})}}}function bo(t){let{process:e,loop:r,system:n}=t,s=()=>e.env,i=Eo(),o={system:n,loop:r},a={system:n,loop:r,cwd:()=>e.cwd(),env:s,stdout:l=>void e.stdout.write(l),stderr:l=>void e.stderr.write(l)},c={assert:()=>Sr(!1),"assert/strict":()=>Sr(!0),async_hooks:()=>mo(),buffer:()=>Qi(),child_process:()=>uo(a),worker_threads:()=>xi({...a,thread:t.thread,ipc:t.ipc}),console:()=>Object.assign(Object.create(t.console),{Console:function(){return t.console}}),constants:l=>({...ke,...l("os").constants.signals}),crypto:()=>Ji(),diagnostics_channel:()=>yo(),"dns/promises":l=>l("dns").promises,events:()=>Ii(),fs:()=>Ki({vfs:t.fs,cwd:()=>e.cwd(),stdout:t.io.stdout,stderr:t.io.stderr,hold:()=>r.hold(),readStdin:Hi(t.io,()=>r.hold())}),"fs/promises":l=>l("fs").promises,http:()=>qn(o,"http:"),https:()=>qn(o,"https:"),net:()=>lo(o),os:()=>ho(s),path:()=>Di(()=>e.cwd()),"path/posix":l=>l("path"),"path/win32":l=>l("path"),process:()=>e,querystring:()=>qi(),readline:()=>Gn(),"readline/promises":l=>l("readline").promises,stream:()=>Fi(),"stream/promises":l=>l("stream").promises,"stream/web":()=>({ReadableStream,WritableStream,TransformStream,TextEncoderStream,TextDecoderStream,ByteLengthQueuingStrategy,CountQueuingStrategy}),"stream/consumers":()=>({text:async l=>{let d="";for await(let h of l)d+=typeof h=="string"?h:new TextDecoder().decode(h);return d},json:async l=>{let d="";for await(let h of l)d+=typeof h=="string"?h:new TextDecoder().decode(h);return JSON.parse(d)}}),string_decoder:()=>go(),sys:l=>l("util"),timers:()=>Ao(r),"timers/promises":l=>l("timers").promises,tty:()=>po(!!t.io.terminal),url:l=>zi(l("querystring"),d=>l("path").resolve(d)),util:()=>Li(s,l=>e.stderr.write(l+`
28
- `)),"util/types":()=>At,vm:()=>wo(),wasi:l=>Zi({fs:l("fs"),stdout:d=>void e.stdout.write(d),stderr:d=>void e.stderr.write(d),exit:d=>e.exit(d)}),zlib:()=>ro()};for(let[l,d]of Object.entries(i))c[l]??(c[l]=()=>d);let u=new Map,f=l=>{if(u.has(l))return u.get(l);let d=c[l];if(!d)throw Object.assign(new Error(`No such built-in module: ${l}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});let h=d(f);return u.set(l,h),h};return{names:[...Object.keys(c),"module"].sort(),isBuiltin:l=>l==="module"||l in c,get:f,fetch:Jn(o)}}var So=hn,Vn=Symbol.for("bfwc.esm"),gl=/^[\p{L}_$][\p{L}\p{N}_$]*$/u;function Bo(t){return/(?:^|[\s;})])(?:import\s*[\w{*'"]|export\s+|export\s*[{*])/.test(t)}function Io(t){try{let[e,r]=Rt(t);return r.length>0||e.some(n=>n.t===1||n.t===3)}catch{return!1}}function Co(t){return t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let r=/^(?:type\s+)?("[^"]*"|'[^']*'|[^\s]+)(?:\s+as\s+("[^"]*"|'[^']*'|[^\s]+))?$/.exec(e);if(!r)throw new SyntaxError(`Cannot parse import/export list entry "${e}"`);let n=s=>/^["']/.test(s)?s.slice(1,-1):s;return[n(r[1]),n(r[2]??r[1])]})}var ml=(t,e)=>gl.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;function wl(t,e){let r=[],n=0;for(let s=e;s<t.length;s++){let i=t[s];if(i==='"'||i==="'"||i==="`"){let o=i;for(s++;s<t.length&&t[s]!==o;s++)t[s]==="\\"&&s++;continue}if(i==="("||i==="["||i==="{")n++;else if(i===")"||i==="]"||i==="}")n--;else{if(n===0&&i===";")break;if(n===0&&i===`
29
- `){let o=t.slice(e,s).trimEnd(),a=t.slice(s+1).trimStart();if(!/[,=+\-*/%&|^?:(]$/.test(o)&&!/^[,.=+\-*/%&|^?:)]/.test(a))break}else if(n===0&&i===","){let o=/^\s*([\p{L}_$][\p{L}\p{N}_$]*)/u.exec(t.slice(s+1));o&&r.push(o[1])}}if(n<0)break}return r}var vo=t=>!!t&&/[\p{L}\p{N}_$]/u.test(t);function yl(t,e){for(let r=t.lastIndexOf("export",e-1);r>=0;r=t.lastIndexOf("export",r-1))if(!vo(t[r-1])&&!vo(t[r+6]))return r;return-1}function Qo(t){if(!/\bimport\s*\(/.test(t))return t;let e;try{[e]=Rt(t)}catch{return t}let r="",n=0;for(let s of e)s.t===2&&(r+=t.slice(n,s.ss)+"__bfwc_dynamic",n=s.d);return n?r+t.slice(n):t}function Zn(t){let[e,r]=Rt(t),n=[],s=new Map,i=new Set,o=new Set,a=0,c=d=>`__bfwc_import(${JSON.stringify(d)})`;for(let d of e){if(d.t===2){n.push({start:d.ss,end:d.d,text:"__bfwc_dynamic"});continue}if(d.t===3){n.push({start:d.s,end:d.e,text:"__bfwc_meta"});continue}if(d.t!==1||d.n===void 0)continue;let h=t.slice(d.ss,d.se),p=`__bfwc_m${a++}`,y=`const ${p} = ${c(d.n)};`;if(h.startsWith("export")){o.add(d.ss);let g=/^export\s*\*\s*as\s+("[^"]*"|'[^']*'|[^\s]+)/.exec(h);if(g)s.set(g[1].replace(/^["']|["']$/g,""),p);else if(/^export\s*\*/.test(h))n.push({start:d.ss,end:d.se,text:`${y} __bfwc_star(__bfwc_exports, ${p});`});else for(let[w,S]of Co(/\{([^}]*)\}/.exec(h)?.[1]??""))s.set(S,ml(p,w));n.some(w=>w.start===d.ss)||n.push({start:d.ss,end:d.se,text:y});continue}let b=/^import\s*([\s\S]*?)\s*from\s*["']/.exec(h)?.[1];if(b===void 0){n.push({start:d.ss,end:d.se,text:`${c(d.n)};`});continue}let E=[y],C=/\{([\s\S]*)\}/.exec(b),A=b.replace(/\{[\s\S]*\}/,"").split(",").map(g=>g.trim()).filter(Boolean);for(let g of A){let w=/^\*\s*as\s+(\S+)$/.exec(g);w?E.push(`const ${w[1]} = ${p};`):E.push(`const ${g} = __bfwc_get(${p}, "default");`)}if(C)for(let[g,w]of Co(C[1]))E.push(`const ${w} = __bfwc_get(${p}, ${JSON.stringify(g)});`);n.push({start:d.ss,end:d.se,text:E.join(" ")})}let u=new Map;for(let d of r){let h=yl(t,d.s);if(h<0||o.has(h))continue;let p=t.slice(h+6,d.s);if(/^\s*\{/.test(p)){if(!u.has(h)){let b=t.indexOf("}",h)+1,E=/^\s*;/.exec(t.slice(b));E&&(b+=E[0].length),u.set(h,b),n.push({start:h,end:b,text:""})}s.set(d.n,d.ln??d.n);continue}if(d.n==="default"&&t.startsWith("default",d.s)&&!p.trim()){d.ln&&d.ls>=0?(n.push({start:h,end:d.e,text:""}),s.set("default",d.ln)):(n.push({start:h,end:d.e,text:"const __bfwc_default ="}),s.set("default","__bfwc_default"));continue}if(!i.has(h)&&(i.add(h),n.push({start:h,end:h+6,text:""}),/^\s*(const|let|var)\b/.exec(p)))for(let b of wl(t,d.e))s.set(b,b);s.set(d.n,d.ln??d.n)}n.sort((d,h)=>h.start-d.start);let f=t;for(let d of n)f=f.slice(0,d.start)+d.text+f.slice(d.end);return`"use strict";__bfwc_esm(__bfwc_exports, { ${[...s].map(([d,h])=>`${JSON.stringify(d)}: () => ${h}`).join(", ")} });${f}`}var Or=["node","require","default"],Xn=["node","import","default"],_o=[".js",".json",".cjs",".mjs",".node"];function Ht(t,e){let r=new Error(`Cannot find module '${t}'${e?`
23
+ `):""}`,y=Object.keys(o).filter(E=>E!=="stack"&&E!=="message");if(!y.length||a>r)return p;s.push(f);let b=At(`${p} {`,y.map(E=>`${hr(E)}: ${i(f[E],a+1,c+" ",!0)}`),"}",n,c);return s.pop(),b}if(o instanceof Date)return Number.isNaN(o.getTime())?"Invalid Date":o.toISOString();if(o instanceof RegExp)return String(o);if(o instanceof Promise)return"Promise { <pending> }";if(o instanceof WeakMap)return"WeakMap { <items unknown> }";if(o instanceof WeakSet)return"WeakSet { <items unknown> }";if(ArrayBuffer.isView(o)&&!(o instanceof DataView)){let p=o;if(p.constructor.name==="Buffer"){let y=Array.from(p).slice(0,50).map(b=>b.toString(16).padStart(2,"0"));return`<Buffer${y.length?" "+y.join(" "):""}${p.length>50?` ... ${p.length-50} more bytes`:""}>`}return`${p.constructor.name}(${p.length}) [ ${Array.from(p).slice(0,100).join(", ")} ]`}if(a>r)return Array.isArray(o)?"[Array]":`[${$t(f)??"Object"}]`;s.push(f);let d=p=>i(p,a+1,c+" ",!0),h;if(Array.isArray(o)){let p=o.slice(0,100).map(d);o.length>100&&p.push(`... ${o.length-100} more items`);for(let b of Object.keys(o))/^\d+$/.test(b)||p.push(`${hr(b)}: ${d(f[b])}`);let y=$t(f)&&$t(f)!=="Array"?`${$t(f)}(${o.length}) `:"";h=At(`${y}[`,p,"]",n,c)}else if(o instanceof Map)h=At(`Map(${o.size}) {`,[...o].map(([p,y])=>`${d(p)} => ${d(y)}`),"}",n,c);else if(o instanceof Set)h=At(`Set(${o.size}) {`,[...o].map(d),"}",n,c);else{let p=[...Object.keys(f),...Object.getOwnPropertySymbols(f).filter(A=>Object.getOwnPropertyDescriptor(f,A)?.enumerable)];e.sorted&&p.sort();let y=p.map(A=>{let g=Object.getOwnPropertyDescriptor(f,A),w=g&&(g.get||g.set)?g.get&&g.set?"[Getter/Setter]":g.get?"[Getter]":"[Setter]":d(f[A]);return`${hr(A)}: ${w}`}),b=$t(f),E=f[Symbol.toStringTag],C=b?`${b}${E&&E!==b?` [${E}]`:""} `:E?`Object [${E}] `:"";h=y.length||!C?At(`${C}{`,y,"}",n,c):`${C}{}`}return s.pop(),h};return i(t,0,"",!1)}V.custom=Ri;V.defaultOptions={depth:2};function Oe(...t){let[e,...r]=t;if(typeof e!="string")return t.map(i=>V(i)).join(" ");let n=0,s=e.replace(/%([sdifjoOc%])/g,(i,o)=>{if(o==="%")return"%";if(n>=r.length)return i;let a=r[n++];switch(o){case"s":return typeof a=="string"?a:typeof a=="bigint"?`${a}n`:typeof a=="object"&&a!==null?V(a,{depth:1}):String(a);case"d":return typeof a=="bigint"?`${a}n`:String(Number(a));case"i":return typeof a=="bigint"?`${a}n`:String(parseInt(String(a),10));case"f":return String(parseFloat(String(a)));case"j":try{return JSON.stringify(a)}catch{return"[Circular]"}case"c":return"";default:return V(a,{depth:o==="o"?4:2})}});for(;n<r.length;n++){let i=r[n];s+=" "+(typeof i=="string"?i:V(i))}return s}var Li=Symbol.for("nodejs.util.promisify.custom");function Fi(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');let e=t[Li];if(typeof e=="function")return e;function r(...n){return new Promise((s,i)=>{t.call(this,...n,(o,...a)=>{o?i(o):s(a.length>1?a:a[0])})})}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,Object.getOwnPropertyDescriptors(t))}Fi.custom=Li;function nl(t,e){if(!e?.prototype)throw new TypeError('The "superCtor.prototype" property must be of type object');t.super_=e,Object.setPrototypeOf(t.prototype,e.prototype)}function Qe(t,e,r=new Map){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(r.get(t)===e)return!0;if(r.set(t,e),t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return String(t)===String(e);if(t instanceof Map){let i=e;if(t.size!==i.size)return!1;for(let[o,a]of t)if(!i.has(o)||!Qe(a,i.get(o),r))return!1;return!0}if(t instanceof Set){let i=e;if(t.size!==i.size)return!1;for(let o of t)if(!i.has(o)&&![...i].some(a=>Qe(o,a,r)))return!1;return!0}if(ArrayBuffer.isView(t)){let i=t,o=e;if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++)if(!Object.is(i[a],o[a]))return!1;return!0}let n=Object.keys(t),s=Object.keys(e);return n.length!==s.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Qe(t[i],e[i],r))}var et=t=>Object.prototype.toString.call(t).slice(8,-1),gt={isPromise:t=>t instanceof Promise,isDate:t=>t instanceof Date,isRegExp:t=>t instanceof RegExp,isMap:t=>t instanceof Map,isSet:t=>t instanceof Set,isWeakMap:t=>t instanceof WeakMap,isWeakSet:t=>t instanceof WeakSet,isNativeError:t=>t instanceof Error,isTypedArray:t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),isUint8Array:t=>t instanceof Uint8Array,isArrayBuffer:t=>t instanceof ArrayBuffer,isAnyArrayBuffer:t=>t instanceof ArrayBuffer||et(t)==="SharedArrayBuffer",isArrayBufferView:t=>ArrayBuffer.isView(t),isDataView:t=>t instanceof DataView,isAsyncFunction:t=>et(t)==="AsyncFunction"||et(t)==="AsyncGeneratorFunction",isGeneratorFunction:t=>et(t)==="GeneratorFunction"||et(t)==="AsyncGeneratorFunction",isGeneratorObject:t=>et(t)==="Generator",isBoxedPrimitive:t=>t instanceof Number||t instanceof String||t instanceof Boolean,isProxy:()=>!1,isExternal:()=>!1,isModuleNamespaceObject:t=>et(t)==="Module"};function Mi(t,e){let r=new Set;return{format:Oe,formatWithOptions:(n,...s)=>Oe(...s),inspect:V,inherits:nl,promisify:Fi,callbackify(n){return function(...s){let i=s.pop();n.apply(this,s).then(o=>i(null,o),o=>i(o??new Error("Promise was rejected with a falsy value")))}},deprecate(n,s,i){return function(...o){let a=i??s;return r.has(a)||(r.add(a),e(`(node) [${i??"DEP"}] DeprecationWarning: ${s}`)),n.apply(this,o)}},debuglog(n){let s=new RegExp(`\\b${n}\\b`,"i").test(t().NODE_DEBUG??""),i=(...o)=>s&&e(`${n.toUpperCase()}: ${Oe(...o)}`);return i.enabled=s,i},isDeepStrictEqual:(n,s)=>Qe(n,s),types:gt,TextEncoder,TextDecoder,stripVTControlCharacters:n=>n.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g,""),styleText:(n,s)=>s,toUSVString:n=>n.replace(/[\uD800-\uDFFF]/g,"\uFFFD"),isArray:Array.isArray,isBoolean:n=>typeof n=="boolean",isNull:n=>n===null,isNullOrUndefined:n=>n==null,isNumber:n=>typeof n=="number",isString:n=>typeof n=="string",isSymbol:n=>typeof n=="symbol",isUndefined:n=>n===void 0,isRegExp:gt.isRegExp,isObject:n=>n!==null&&typeof n=="object",isDate:gt.isDate,isError:gt.isNativeError,isFunction:n=>typeof n=="function",isPrimitive:n=>n===null||typeof n!="object"&&typeof n!="function",isBuffer:n=>n?.constructor?.name==="Buffer"}}function mt(t,e={}){let r=!!(e.objectMode||e.writableObjectMode);t._writableState={objectMode:r,highWaterMark:e.highWaterMark??(r?16:16*1024),decodeStrings:e.decodeStrings!==!1,defaultEncoding:e.defaultEncoding??"utf8",queue:[],length:0,writing:!1,corked:0,needDrain:!1,ending:!1,ended:!1,finalCalled:!1,finished:!1,destroyed:!1,closed:!1,errored:null,autoDestroy:e.autoDestroy??!0,emitClose:e.emitClose??!0},typeof e.write=="function"&&(t._write=e.write),typeof e.writev=="function"&&(t._writev=e.writev),typeof e.final=="function"&&(t._final=e.final),typeof e.destroy=="function"&&(t._destroy=e.destroy)}var ie=class extends F{constructor(e){super(),mt(this,e)}get writable(){let e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&!e.errored}set writable(e){}get writableEnded(){return this._writableState.ending}get writableFinished(){return this._writableState.finished}get writableLength(){return this._writableState.length}get writableHighWaterMark(){return this._writableState.highWaterMark}get writableObjectMode(){return this._writableState.objectMode}get writableCorked(){return this._writableState.corked}get writableNeedDrain(){return this._writableState.needDrain}get destroyed(){return this._writableState.destroyed}set destroyed(e){this._writableState.destroyed=e}_write(e,r,n){if(this._writev)this._writev([{chunk:e,encoding:r}],n);else throw new Error("The _write() method is not implemented")}_destroy(e,r){r(e)}write(e,r,n){typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;if(s.ending||s.destroyed){let c=Object.assign(new Error(s.destroyed?"Cannot call write after a stream was destroyed":"write after end"),{code:s.destroyed?"ERR_STREAM_DESTROYED":"ERR_STREAM_WRITE_AFTER_END"});return we(()=>{n?.(c),this.emit("error",c)}),!1}let i=e,o=r??s.defaultEncoding;if(!s.objectMode){if(typeof i=="string"&&s.decodeStrings)i=D.from(i,o),o="buffer";else if(i instanceof Uint8Array)i instanceof D||(i=D.from(i.buffer,i.byteOffset,i.byteLength)),o="buffer";else if(typeof i!="string")throw new TypeError('The "chunk" argument must be of type string or an instance of Buffer or Uint8Array')}s.length+=s.objectMode?1:i.length,s.queue.push({chunk:i,encoding:o,callback:n});let a=s.length<s.highWaterMark;return a||(s.needDrain=!0),s.corked||this._drainQueue(),a}end(e,r,n){typeof e=="function"?[n,e]=[e,void 0]:typeof r=="function"&&([n,r]=[r,void 0]);let s=this._writableState;return e!=null&&this.write(e,r),n&&(s.finished?we(()=>n()):this.once("finish",()=>n())),s.ending?this:(s.ending=!0,s.corked=0,this._drainQueue(),this)}cork(){this._writableState.corked++}uncork(){let e=this._writableState;e.corked&&e.corked--,e.corked||this._drainQueue()}setDefaultEncoding(e){return this._writableState.defaultEncoding=e,this}destroy(e){let r=this._writableState;return r.destroyed?this:(r.destroyed=!0,e&&(r.errored=e),this._destroy(e??null,n=>{we(()=>{n&&this.emit("error",n),r.closed=!0,r.emitClose&&this.emit("close")})}),this)}_drainQueue(){let e=this._writableState;if(e.writing||e.destroyed)return;let r=e.queue.shift();if(!r){e.ending&&this._finishMaybe();return}e.writing=!0;let n=!0,s=i=>{let o=()=>{if(e.writing=!1,e.length-=e.objectMode?1:r.chunk.length,r.callback?.(i??null),i){e.errored=i,this.destroy(i);return}e.needDrain&&e.length===0&&(e.needDrain=!1,this.emit("drain")),this._drainQueue()};n?we(o):o()};try{this._write(r.chunk,r.encoding,s)}catch(i){s(i)}n=!1}_finishMaybe(){let e=this._writableState;if(e.finished||e.finalCalled||e.writing||e.queue.length)return;e.finalCalled=!0,e.ended=!0;let r=n=>{if(n){this.destroy(n);return}e.finished=!0,this.emit("finish");let s=this._readableState;e.autoDestroy&&(!s||s.endEmitted)&&this.destroy()};this._final?this._final(n=>we(()=>r(n))):we(()=>r())}};var Ut=class extends F{pipe(e){return this.on("data",r=>e.write(r)),this.on("end",()=>e.end()),e}};Object.setPrototypeOf(X.prototype,Ut.prototype);Object.setPrototypeOf(ie.prototype,Ut.prototype);function Fn(t,e={}){pt(t,e),mt(t,e),t.allowHalfOpen=e.allowHalfOpen!==!1,t.allowHalfOpen||t.once("end",()=>t.end())}var Ne=class extends X{constructor(e){super(e),Fn(this,e)}destroy(e){let r=this._writableState;return r&&(r.destroyed=!0),super.destroy(e)}};for(let t of Object.getOwnPropertyNames(ie.prototype))t==="constructor"||t==="destroy"||t==="destroyed"||t==="_destroy"||t in Ne.prototype&&Object.getOwnPropertyDescriptor(Ne.prototype,t)||Object.defineProperty(Ne.prototype,t,Object.getOwnPropertyDescriptor(ie.prototype,t));function Rn(t,e={}){Fn(t,e),typeof e.transform=="function"&&(t._transform=e.transform),typeof e.flush=="function"&&(t._flush=e.flush)}var We=class extends Ne{constructor(e){super(e),Rn(this,e)}_transform(e,r,n){throw new Error("The _transform() method is not implemented")}_read(){}_write(e,r,n){this._transform(e,r,(s,i)=>{if(s)return n(s);i!=null&&this.push(i),n()})}_final(e){let r=(n,s)=>{if(n)return e(n);s!=null&&this.push(s),this.push(null),e()};this._flush?this._flush(r):r()}},Tn=class extends We{_transform(e,r,n){n(null,e)}};function Ln(t,e,r){let n=typeof e=="function"?e:r,s=!1,i=l=>{s||(s=!0,f(),n(l??null))},o=l=>i(l),a=()=>i(),c=()=>{let l=t._readableState,d=t._writableState;l&&!l.endEmitted||d&&!d.finished?i(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"})):i()},u=!!t._writableState&&!t._readableState;t.on("error",o),t.on(u?"finish":"end",a),t._readableState&&t._writableState&&t.on("finish",()=>t._readableState.endEmitted&&i()),t.on("close",c);let f=()=>{t.removeListener("error",o),t.removeListener("end",a),t.removeListener("finish",a),t.removeListener("close",c)};return(t._readableState?.endEmitted&&!t._writableState||u&&t._writableState.finished)&&we(()=>i()),f}function $i(...t){let e=typeof t[t.length-1]=="function"?t.pop():void 0,r=Array.isArray(t[0])?t[0]:t;if(r.length<2)throw new Error("pipeline requires at least two streams");let n=!1,s=o=>{if(!n){n=!0;for(let a of r)a.destroy?.(o);e?.(o)}};for(let o=0;o<r.length-1;o++)r[o].pipe(r[o+1]);r.forEach((o,a)=>{a<r.length-1&&o.on("error",s)});let i=r[r.length-1];return Ln(i,o=>{o?s(o):n||e?.(null)}),i}function Ui(){let t=ce(Ut,()=>{}),e={Readable:ce(X,(n,s)=>pt(n,s)),Writable:ce(ie,(n,s)=>mt(n,s)),Duplex:ce(Ne,(n,s)=>Fn(n,s)),Transform:ce(We,(n,s)=>Rn(n,s)),PassThrough:ce(Tn,(n,s)=>Rn(n,s))};return Object.assign(t,e,{Stream:t,pipeline:$i,finished:Ln,promises:{pipeline:(...n)=>new Promise((s,i)=>$i(...n,o=>o?i(o):s())),finished:n=>new Promise((s,i)=>Ln(n,o=>o?i(o):s()))},addAbortSignal:(n,s)=>s,isReadable:n=>!!n?.readable,isErrored:n=>!!n?._readableState?.errored,isDisturbed:n=>!!n?._readableState?.endEmitted||(n?._readableState?.flowing??null)!==null,getDefaultHighWaterMark:n=>n?16:16*1024,setDefaultHighWaterMark:()=>{}}),t}var sl={ENOENT:[-2,"no such file or directory"],EEXIST:[-17,"file already exists"],EISDIR:[-21,"illegal operation on a directory"],ENOTDIR:[-20,"not a directory"],ENOTEMPTY:[-39,"directory not empty"],EBADF:[-9,"bad file descriptor"],EINVAL:[-22,"invalid argument"],EPERM:[-1,"operation not permitted"],EACCES:[-13,"permission denied"],ENOSYS:[-38,"function not implemented"]};function R(t,e,r,n){let[s,i]=sl[t]??[-1,t.toLowerCase()],o=r===void 0?"":n===void 0?` '${r}'`:` '${r}' -> '${n}'`,a=new Error(`${t}: ${i}, ${e}${o}`);return a.code=t,a.errno=s,a.syscall=e,r!==void 0&&(a.path=r),n!==void 0&&(a.dest=n),a}function il(t){let e=5381;for(let r=0;r<t.length;r++)e=(e*33^t.charCodeAt(r))>>>0;return e}var Mn=32768,$n=16384,Re=class{constructor(e,r,n,s){m(this,"dev",2049);m(this,"ino");m(this,"mode");m(this,"nlink",1);m(this,"uid",1e3);m(this,"gid",1e3);m(this,"rdev",0);m(this,"size");m(this,"blksize",4096);m(this,"blocks");m(this,"atimeMs");m(this,"mtimeMs");m(this,"ctimeMs");m(this,"birthtimeMs");m(this,"atime");m(this,"mtime");m(this,"ctime");m(this,"birthtime");this.ino=il(e),this.mode=r==="file"?Mn|420:$n|493,this.size=n,this.blocks=Math.ceil(n/512),this.atimeMs=this.mtimeMs=this.ctimeMs=this.birthtimeMs=s,this.atime=new Date(s),this.mtime=new Date(s),this.ctime=new Date(s),this.birthtime=new Date(s)}isFile(){return(this.mode&61440)===Mn}isDirectory(){return(this.mode&61440)===$n}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},wt=class{constructor(e,r,n){m(this,"name");m(this,"parentPath");m(this,"kind");this.name=e,this.parentPath=r,this.kind=n}get path(){return this.parentPath}isFile(){return this.kind==="file"}isDirectory(){return this.kind==="directory"}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},ke={F_OK:0,R_OK:4,W_OK:2,X_OK:1,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOFOLLOW:131072,O_SYNC:1052672,O_DSYNC:4096,O_NONBLOCK:2048,S_IFMT:61440,S_IFREG:Mn,S_IFDIR:$n,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,UV_FS_COPYFILE_EXCL:1};var pr=t=>typeof t=="string"?t:t?.encoding;function Pi(t){let{vfs:e}=t,r=new Map,n=20,s=A=>{if(A instanceof URL){if(A.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return O(decodeURIComponent(A.pathname))}let g=typeof A=="string"?A:new TextDecoder().decode(A);if(typeof g!="string")throw new TypeError('The "path" argument must be of type string, Buffer or URL');return g.startsWith("file://")?O(decodeURIComponent(new URL(g).pathname)):g.startsWith("/")?O(g):k(t.cwd(),g)},i=A=>{let g=e.readFile(A);return typeof g=="string"?se(g):g},o=(A,g)=>{let w=$(A);if(e.isFile(w))throw R("ENOTDIR",g,A);if(!e.isDirectory(w))throw R("ENOENT",g,A)},a=(A,g)=>typeof A=="string"?!g||/^utf-?8$/i.test(g)?A:se(A,g).slice():new Uint8Array(A.buffer,A.byteOffset,A.byteLength).slice(),c=(A,g)=>{let w=s(A);if(e.isFile(w))return new Re(w,"file",i(w).length,e.mtime(w)??Date.now());if(e.isDirectory(w))return new Re(w,"directory",4096,0);if(g?.throwIfNoEntry!==!1)throw R("ENOENT","stat",w)},u=(A,g,w)=>{if(typeof A=="number")return f(A,g);let S=s(A),I=typeof w=="object"&&w?w.flag??"w":"w";if(e.isDirectory(S))throw R("EISDIR","open",S);if(o(S,"open"),I.includes("x")&&e.isFile(S))throw R("EEXIST","open",S);if(I.startsWith("a")&&e.isFile(S)){let v=e.readFile(S),B=a(g,pr(w));e.writeFile(S,typeof v=="string"&&typeof B=="string"?v+B:D.concat([typeof v=="string"?se(v):v,typeof B=="string"?se(B):B]));return}e.writeFile(S,a(g,pr(w)))},f=(A,g,w,S,I)=>{let v=typeof g=="string"?se(g,typeof w=="string"?w:void 0):new Uint8Array(g.buffer,g.byteOffset+(typeof w=="number"?w:0),S??g.byteLength-(typeof w=="number"?w:0));if(A===1||A===2)return(A===1?t.stdout:t.stderr)(v.slice()),v.length;let B=r.get(A);if(!B||B.flags==="r")throw R("EBADF","write");let Q=e.isFile(B.path)?i(B.path):new Uint8Array,_=B.flags.startsWith("a")?Q.length:I??B.position,N=new Uint8Array(Math.max(Q.length,_+v.length));return N.set(Q),N.set(v,_),e.writeFile(B.path,N),I==null&&(B.position=_+v.length),v.length},l=(A,g,w="")=>{let S=[];for(let I of e.readdir(A)){let v=k(A,I),B=e.isDirectory(v)?"directory":"file";S.push({name:w+I,parent:A,kind:B}),g&&B==="directory"&&S.push(...l(v,!0,`${w}${I}/`))}return S},d=(A,g)=>{let w=s(A),S=typeof g=="object"&&!!g?.recursive;if(e.isFile(w))throw R("EEXIST","mkdir",w);if(e.isDirectory(w)){if(S)return;throw R("EEXIST","mkdir",w)}S||o(w,"mkdir");let I;for(let v=w;!e.isDirectory(v);v=$(v)){if(e.isFile(v))throw R("ENOTDIR","mkdir",w);I=v}return e.mkdir(w),S?I:void 0},h=(A,g)=>{let w=s(A);if(!e.exists(w)){if(g?.force)return;throw R("ENOENT","rm",w)}if(e.isDirectory(w)&&!g?.recursive)throw Object.assign(R("EISDIR","rm",w),{code:"ERR_FS_EISDIR"});e.rm(w)},p=(A,g,w=0)=>{let S=s(A),I=s(g);if(!e.isFile(S))throw R(e.isDirectory(S)?"EISDIR":"ENOENT","copyfile",S,I);if(w&ke.COPYFILE_EXCL&&e.exists(I))throw R("EEXIST","copyfile",S,I);o(I,"copyfile");let v=e.readFile(S);e.writeFile(I,typeof v=="string"?v:v.slice())},y=(A,g)=>{if(e.isFile(A)){let w=e.readFile(A);e.writeFile(g,typeof w=="string"?w:w.slice());return}e.mkdir(g);for(let w of e.readdir(A))y(k(A,w),k(g,w))},b=(A,g="r")=>{let w=s(A),S=typeof g=="number"?g&ke.O_APPEND?"a":g&(ke.O_WRONLY|ke.O_RDWR)?"w":"r":g;if(e.isDirectory(w)&&S!=="r")throw R("EISDIR","open",w);if(S.startsWith("r")){if(!e.exists(w))throw R("ENOENT","open",w)}else{if(S.includes("x")&&e.exists(w))throw R("EEXIST","open",w);o(w,"open"),(S.startsWith("w")||!e.isFile(w))&&e.writeFile(w,"")}let I=n++;return r.set(I,{path:w,flags:S,position:0}),I},E=(A,g)=>{let w=r.get(A);if(!w)throw R("EBADF",g);return w},C={existsSync:A=>{try{return e.exists(s(A))}catch{return!1}},accessSync(A){let g=s(A);if(!e.exists(g))throw R("ENOENT","access",g)},statSync:c,lstatSync:c,fstatSync:A=>c(E(A,"fstat").path),readFileSync(A,g){if(A===0)return D.alloc(0);let w=typeof A=="number"?E(A,"read").path:s(A);if(e.isDirectory(w))throw R("EISDIR","read",w);let S=e.readFile(w);if(S===void 0)throw R("ENOENT","open",w);let I=pr(g);return I?typeof S=="string"&&/^utf-?8$/i.test(I)?S:D.from(typeof S=="string"?se(S):S).toString(I):D.from(typeof S=="string"?se(S):S)},writeFileSync:u,appendFileSync:(A,g,w)=>u(A,g,{...typeof w=="string"?{encoding:w}:w??{},flag:"a"}),mkdirSync:d,mkdtempSync(A){let g=`${A}${Math.random().toString(36).slice(2,8)}`;return d(g),s(g)},readdirSync(A,g){let w=s(A);if(e.isFile(w))throw R("ENOTDIR","scandir",w);if(!e.isDirectory(w))throw R("ENOENT","scandir",w);let S=typeof g=="object"?g:void 0,I=l(w,!!S?.recursive);return S?.withFileTypes?I.map(v=>new wt(v.name.slice(v.name.lastIndexOf("/")+1),v.name.includes("/")?k(w,v.name,".."):v.parent,v.kind)):I.map(v=>pr(g)==="buffer"?D.from(v.name):v.name)},rmSync:h,rmdirSync(A,g){let w=s(A);if(e.isFile(w))throw R("ENOTDIR","rmdir",w);if(!e.isDirectory(w))throw R("ENOENT","rmdir",w);if(e.readdir(w).length&&!g?.recursive)throw R("ENOTEMPTY","rmdir",w);e.rm(w)},unlinkSync(A){let g=s(A);if(e.isDirectory(g))throw R("EISDIR","unlink",g);if(!e.isFile(g))throw R("ENOENT","unlink",g);e.rm(g)},renameSync(A,g){let w=s(A),S=s(g);if(!e.exists(w))throw R("ENOENT","rename",w,S);if(w!==S){if(e.isDirectory(S)&&e.isFile(w))throw R("EISDIR","rename",w,S);if(o(S,"rename"),e.isFile(S)&&e.isDirectory(w))throw R("ENOTDIR","rename",w,S);e.rm(S),y(w,S),e.rm(w)}},copyFileSync:p,cpSync(A,g,w){let S=s(A);if(e.isDirectory(S)&&!w?.recursive)throw Object.assign(R("EISDIR","cp",S),{code:"ERR_FS_EISDIR"});if(!e.exists(S))throw R("ENOENT","cp",S);y(S,s(g))},realpathSync:Object.assign(A=>{let g=s(A);if(!e.exists(g))throw R("ENOENT","realpath",g);return g},{native:A=>C.realpathSync(A)}),readlinkSync:A=>{throw R("EINVAL","readlink",s(A))},symlinkSync(A,g){let w=s(g),S=typeof A=="string"&&!A.startsWith("/")?k($(w),A):s(A);y(S,w)},linkSync:(A,g)=>p(A,g),truncateSync(A,g=0){let w=s(A);if(!e.isFile(w))throw R("ENOENT","open",w);let S=i(w),I=new Uint8Array(g);I.set(S.subarray(0,g)),e.writeFile(w,I)},chmodSync:A=>void C.accessSync(A),lchmodSync:A=>void C.accessSync(A),chownSync:A=>void C.accessSync(A),lchownSync:A=>void C.accessSync(A),utimesSync:A=>void C.accessSync(A),lutimesSync:A=>void C.accessSync(A),fchmodSync:A=>void E(A,"fchmod"),fchownSync:A=>void E(A,"fchown"),futimesSync:A=>void E(A,"futimes"),fsyncSync:A=>void E(A,"fsync"),fdatasyncSync:A=>void E(A,"fdatasync"),ftruncateSync:(A,g=0)=>C.truncateSync(E(A,"ftruncate").path,g),openSync:b,closeSync(A){A>2&&E(A,"close"),r.delete(A)},readSync(A,g,w,S,I){let v=typeof w=="object"?w:{offset:w,length:S,position:I},B=E(A,"read"),Q=i(B.path),_=new Uint8Array(g.buffer,g.byteOffset,g.byteLength),N=v.offset??0,L=v.position??B.position,J=Q.subarray(L,L+Math.min(v.length??_.length-N,_.length-N));return _.set(J,N),(v.position===void 0||v.position===null)&&(B.position=L+J.length),J.length},writeSync:f,writevSync(A,g,w){let S=0;for(let I of g)S+=f(A,I,0,I.byteLength,w==null?null:w+S);return S},readvSync(A,g,w){let S=0;for(let I of g){let v=C.readSync(A,I,0,I.byteLength,w==null?null:w+S);if(S+=v,v<I.byteLength)break}return S},opendirSync(A){let g=s(A),w=C.readdirSync(g,{withFileTypes:!0}),S=0;return{path:g,readSync:()=>w[S++]??null,read:async()=>w[S++]??null,closeSync:()=>{},close:async()=>{},async*[Symbol.asyncIterator](){for(;S<w.length;)yield w[S++]}}},_resolve:s};return C}var ji=64*1024,Ar=t=>typeof t=="string"?{encoding:t}:t??{};function Ki(t,e){class r extends X{constructor(a,c){let u=Ar(c);super({highWaterMark:u.highWaterMark??ji,encoding:u.encoding}),n(this,a,u)}open(){}_read(){if(!this.data){this._readableState.reading=!1;return}let a=Math.min(this.data.length,this.endAt+1);if(this.offset>=a){this.push(null);return}let c=this.data.subarray(this.offset,Math.min(a,this.offset+this._readableState.highWaterMark));this.offset+=c.length,this.bytesRead+=c.length,this.push(D.from(c))}close(a){this.destroy(),a&&this.once("close",a)}}function n(o,a,c){o.bytesRead=0,o.fd=null,o.pending=!0,o.flags=c.flags??"r",o.mode=c.mode??438,o.path=c.fd!==void 0?"":t._resolve(a),o.offset=c.start??0,o.endAt=c.end??1/0,T(()=>{try{o.data=t.readFileSync(o.path),o.pending=!1,o.open!==r.prototype.open?o.open():(o.fd=-1,o.emit("open",o.fd),o.emit("ready")),o._pull()}catch(u){o.destroy(u)}})}class s extends ie{constructor(a,c){super({decodeStrings:!0}),i(this,a,Ar(c))}open(){}ensureFile(){this.started||(this.started=!0,(!this.flags.startsWith("a")||!e.vfs.isFile(this.path))&&t.writeFileSync(this.path,"",{flag:this.flags.includes("x")?"wx":"w"}))}_write(a,c,u){if(this.fd===null&&this.open!==s.prototype.open){this.once("open",()=>this._write(a,c,u));return}try{this.ensureFile(),t.appendFileSync(this.path,a),this.bytesWritten+=a.length,u()}catch(f){u(f)}}close(a){this.end(),a&&this.once("close",a)}}function i(o,a,c){o.bytesWritten=0,o.fd=null,o.pending=!1,o.started=!1,o.flags=c.flags??"w",o.mode=c.mode??438,o.path=t._resolve(a),T(()=>{try{if(o.open!==s.prototype.open){o.started=!0,o.open();return}o.ensureFile(),o.fd=-1,o.emit("open",o.fd),o.emit("ready")}catch(u){o.destroy(u)}})}return{ReadStream:ce(r,(o,a,c)=>{let u=Ar(c);pt(o,{highWaterMark:u.highWaterMark??ji,encoding:u.encoding}),n(o,a,u)}),WriteStream:ce(s,(o,a,c)=>{mt(o,{decodeStrings:!0}),i(o,a,Ar(c))})}}function Hi(t){return typeof t[t.length-1]=="function"?t.pop():void 0}function Wi(t){let e=Pi(t),r=(p,y=b=>[b])=>(...b)=>{let E=Hi(b);T(()=>{let C;try{C=p(...b)}catch(A){E?.(A);return}E?.(null,...y(C,b))})},n=p=>async(...y)=>p(...y),{ReadStream:s,WriteStream:i}=Ki(e,t);class o extends F{constructor(b,E,C){super();m(this,"release");m(this,"unwatch");let A=O(b);C&&this.on("change",C),this.release=t.hold(),this.unwatch=t.vfs.watch(g=>{let w=g.path;if(!(w===A||w.startsWith(A==="/"?"/":A+"/")))return;let I=w===A?w.slice(w.lastIndexOf("/")+1):w.slice(A.length+(A==="/"?0:1));!E&&I.includes("/")||this.emit("change",g.type==="write"&&!g.created?"change":"rename",I)})}close(){this.unwatch(),this.release(),this.emit("close")}ref(){return this}unref(){return this}}let a=(p,y,b)=>{typeof y=="function"&&([b,y]=[y,void 0]);let E=e._resolve(p);if(!t.vfs.exists(E))throw e.statSync(E);return new o(E,typeof y=="object"&&!!y?.recursive,b)},c=new Map,u=(p,y,b)=>{let E=typeof y=="function"?y:b,C=e._resolve(p),A=c.get(C);if(!A){let g=new o(C,!1),w={watcher:g,listeners:[]},S=e.statSync(C,{throwIfNoEntry:!1})??new Re(C,"file",0,0);g.on("change",()=>{let I=e.statSync(C,{throwIfNoEntry:!1})??new Re(C,"file",0,0);for(let v of w.listeners)v(I,S);S=I}),c.set(C,A=w)}return A.listeners.push(E),A.watcher},f=(p,y)=>{let b=e._resolve(p),E=c.get(b);E&&(E.listeners=y?E.listeners.filter(C=>C!==y):[],E.listeners.length||(E.watcher.close(),c.delete(b)))},l={...e,constants:ke,Stats:Re,Dirent:wt,ReadStream:s,WriteStream:i,FSWatcher:o,F_OK:0,R_OK:4,W_OK:2,X_OK:1};delete l._resolve;for(let p of Object.keys(e)){if(!p.endsWith("Sync"))continue;let y=p.slice(0,-4),b=e[p];y==="exists"?l.exists=(E,C)=>T(()=>C(e.existsSync(E))):["read","write","readv","writev"].includes(y)?l[y]=r(b,(E,C)=>[E,C[1]]):l[y]=r(b)}let d=l.read;l.read=(p,...y)=>{if(p!==0||!t.readStdin)return d(p,...y);let b=Hi(y),E=y[0]&&!ArrayBuffer.isView(y[0])?y[0]:typeof y[1]=="object"&&y[1]?{buffer:y[0],...y[1]}:{buffer:y[0],offset:y[1],length:y[2]},C=E.buffer,A=Number(E.offset??0),g=Number(E.length??C.byteLength-A);t.readStdin(new Uint8Array(C.buffer,C.byteOffset+A,g)).then(w=>T(()=>b?.(null,w,C)),w=>T(()=>b?.(w,0,C)))},l.realpath.native=l.realpath,l.createReadStream=(p,y)=>new s(p,y),l.createWriteStream=(p,y)=>new i(p,y),l.watch=a,l.watchFile=u,l.unwatchFile=f;let h={constants:ke};for(let p of Object.keys(e))!p.endsWith("Sync")||p==="existsSync"||(h[p.slice(0,-4)]=n(e[p]));return h.open=async(p,y)=>ol(e,e.openSync(p,y),e._resolve(p)),h.watch=(p,y)=>al(a(p,y),y?.signal),l.promises=h,l}function ol(t,e,r){return{fd:e,readFile:async n=>t.readFileSync(e,n),writeFile:async n=>void t.writeFileSync(r,n),appendFile:async n=>void t.appendFileSync(r,n),read:async(n,s,i,o)=>({bytesRead:t.readSync(e,n,s,i,o),buffer:n}),write:async(n,...s)=>({bytesWritten:t.writeSync(e,n,...s),buffer:n}),writev:async(n,s)=>({bytesWritten:t.writevSync(e,n,s),buffers:n}),readv:async(n,s)=>({bytesRead:t.readvSync(e,n,s),buffers:n}),stat:async()=>t.fstatSync(e),truncate:async n=>t.ftruncateSync(e,n),sync:async()=>{},datasync:async()=>{},chmod:async()=>{},close:async()=>t.closeSync(e)}}async function*al(t,e){let r=[],n;t.on("change",(s,i)=>{r.push({eventType:s,filename:i}),n?.()}),e?.addEventListener("abort",()=>n?.());try{for(;!e?.aborted;)r.length?yield r.shift():await new Promise(s=>n=s)}finally{t.close()}}function Ji(t,e){let r=[],n=!1,s=[],i=!1,o=()=>{i||(i=!0,t.onStdin(a=>{a===null?n=!0:r.push(typeof a=="string"?new TextEncoder().encode(a):a);let c=s;s=[];for(let u of c)u()}))};return async a=>{for(o();!r.length&&!n;){let f=e();await new Promise(l=>s.push(l)),f()}let c=r[0];if(!c)return 0;let u=Math.min(c.length,a.length);return a.set(c.subarray(0,u)),u===c.length?r.shift():r[0]=c.subarray(u),u}}var yt=(t,e)=>typeof t=="string"?D.from(t,e):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),jn=(t,e)=>e&&e!=="buffer"?D.from(t).toString(e):D.from(t),mr=class t extends We{constructor(r){super();m(this,"algorithm");m(this,"chunks",[]);m(this,"done",!1);this.algorithm=r,Mt(r)}update(r,n){if(this.done)throw Object.assign(new Error("Digest already called"),{code:"ERR_CRYPTO_HASH_FINALIZED"});return this.chunks.push(yt(r,n).slice()),this}digest(r){return this.done=!0,jn(Mt(this.algorithm).digest(D.concat(this.chunks)),r)}copy(){let r=new t(this.algorithm);return r.chunks=[...this.chunks],r}_transform(r,n,s){this.update(r),s()}_flush(r){r(null,this.digest())}};function Un(t,e,r){let{digest:n,blockSize:s}=Mt(t),i=e.length>s?n(e):e,o=new Uint8Array(s);o.set(i),i=o;let a=new Uint8Array(s+r.length),c=new Uint8Array(s);for(let l=0;l<s;l++)a[l]=i[l]^54,c[l]=i[l]^92;a.set(r,s);let u=n(a),f=new Uint8Array(s+u.length);return f.set(c),f.set(u,s),n(f)}var Pn=class extends mr{constructor(r,n){super(r);m(this,"hmacAlgorithm");m(this,"hmacKey");m(this,"parts",[]);this.hmacAlgorithm=r,this.hmacKey=yt(n).slice()}update(r,n){return this.parts.push(yt(r,n).slice()),this}digest(r){return jn(Un(this.hmacAlgorithm,this.hmacKey,D.concat(this.parts)),r)}};function qi(t,e,r,n,s="sha1"){let i=yt(t),o=yt(e),a=new Uint8Array(n);for(let c=1,u=0;u<n;c++){let f=new Uint8Array(o.length+4);f.set(o),new DataView(f.buffer).setUint32(o.length,c);let l=Un(s,i,f),d=l.slice();for(let h=1;h<r;h++){l=Un(s,i,l);for(let p=0;p<d.length;p++)d[p]=d[p]^l[p]}a.set(d.subarray(0,n-u),u),u+=d.length}return D.from(a)}function gr(t){let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(let r=0;r<e.length;r+=65536)globalThis.crypto.getRandomValues(e.subarray(r,r+65536));return t}var xe=t=>()=>{throw Object.assign(new Error(`crypto.${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function zi(){let t=(e,r)=>{let n=gr(D.alloc(e));return r&&T(()=>r(null,n)),n};return{createHash:e=>new mr(e),createHmac:(e,r)=>new Pn(e,r),hash:(e,r,n="hex")=>jn(Mt(e).digest(yt(r)),n),getHashes:()=>Object.keys(xn),getCiphers:()=>[],getCurves:()=>[],randomBytes:t,pseudoRandomBytes:t,randomFillSync:(e,r=0,n)=>(gr(new Uint8Array(e.buffer,e.byteOffset+r,n??e.byteLength-r)),e),randomFill:(e,...r)=>{let n=r.pop();gr(e),T(()=>n(null,e))},randomUUID:()=>globalThis.crypto.randomUUID(),randomInt(e,r,n){typeof r!="number"&&([n,r,e]=[r,e,0]);let s=e+Math.floor(globalThis.crypto.getRandomValues(new Uint32Array(1))[0]/2**32*(r-e));return n&&T(()=>n(null,s)),s},getRandomValues:e=>gr(e),timingSafeEqual(e,r){if(e.byteLength!==r.byteLength)throw new RangeError("Input buffers must have the same byte length");let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i=0;for(let o=0;o<n.length;o++)i|=n[o]^s[o];return i===0},pbkdf2Sync:qi,pbkdf2(e,r,n,s,i,o){T(()=>{try{o(null,qi(e,r,n,s,i))}catch(a){o(a)}})},webcrypto:globalThis.crypto,subtle:globalThis.crypto?.subtle,constants:{},createCipheriv:xe("createCipheriv"),createDecipheriv:xe("createDecipheriv"),createSign:xe("createSign"),createVerify:xe("createVerify"),generateKeyPairSync:xe("generateKeyPairSync"),generateKeyPair:xe("generateKeyPair"),createPrivateKey:xe("createPrivateKey"),createPublicKey:xe("createPublicKey"),scryptSync:xe("scryptSync"),scrypt:xe("scrypt")}}function Gi(){let t=i=>encodeURIComponent(i),e=i=>{try{return decodeURIComponent(i)}catch{return i}},r=i=>typeof i=="string"?i:typeof i=="number"&&Number.isFinite(i)||typeof i=="boolean"||typeof i=="bigint"?String(i):"",n=(i,o="&",a="=",c)=>{let u=Object.create(null);if(typeof i!="string"||!i)return u;let f=c?.decodeURIComponent??e,l=i.split(o),d=c?.maxKeys??1e3;for(let h of d>0?l.slice(0,d):l){if(!h)continue;let p=h.indexOf(a),y=f((p>=0?h.slice(0,p):h).replace(/\+/g," ")),b=p>=0?f(h.slice(p+a.length).replace(/\+/g," ")):"",E=u[y];E===void 0?u[y]=b:Array.isArray(E)?E.push(b):u[y]=[E,b]}return u},s=(i,o="&",a="=",c)=>{let u=c?.encodeURIComponent??t;return!i||typeof i!="object"?"":Object.keys(i).map(f=>{let l=i[f],d=u(r(f))+a;return Array.isArray(l)?l.map(h=>d+u(r(h))).join(o):d+u(r(l))}).filter(Boolean).join(o)};return{parse:n,decode:n,stringify:s,encode:s,escape:t,unescape:e}}function Yi(t,e){function r(i,o=!1,a=!1){let c=i.trim(),u={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:""},f=c.indexOf("#");f>=0&&(u.hash=c.slice(f),c=c.slice(0,f));let l=c.indexOf("?");l>=0?(u.search=c.slice(l),u.query=c.slice(l+1),c=c.slice(0,l)):o&&(u.search="",u.query={});let d=/^([a-z][a-z0-9.+-]*:)/i.exec(c);if(d&&(u.protocol=d[1].toLowerCase(),c=c.slice(d[1].length)),(d||a)&&c.startsWith("//")){u.slashes=!0,c=c.slice(2);let h=c.search(/[/]/),p=h>=0?c.slice(0,h):c;c=h>=0?c.slice(h):"";let y=p.lastIndexOf("@");y>=0&&(u.auth=decodeURIComponent(p.slice(0,y)),p=p.slice(y+1)),u.host=p.toLowerCase();let b=/:(\d*)$/.exec(u.host);b?(u.port=b[1]||null,u.hostname=u.host.slice(0,-b[0].length)):u.hostname=u.host,u.hostname.startsWith("[")&&u.hostname.endsWith("]")&&(u.hostname=u.hostname.slice(1,-1)),!c&&u.protocol&&/^(https?|ftp|wss?|file):$/.test(u.protocol)&&(c="/")}return u.pathname=c||(u.slashes?"/":null),o&&typeof u.query=="string"&&(u.query=t.parse(u.query)),u.path=(u.pathname??"")+(u.search??"")||null,u.href=n(u),u}function n(i){if(typeof i=="string")return n(r(i));if(i instanceof URL)return i.href;let o=i.protocol?i.protocol.endsWith(":")?i.protocol:i.protocol+":":"",a="";i.host?a=(i.auth?encodeURIComponent(i.auth).replace(/%3A/i,":")+"@":"")+i.host:i.hostname&&(a=(i.auth?i.auth+"@":"")+(i.hostname.includes(":")?`[${i.hostname}]`:i.hostname)+(i.port?":"+i.port:""));let c=i.search??"";if(!c&&i.query&&typeof i.query=="object"){let d=t.stringify(i.query);d&&(c="?"+d)}else c&&!c.startsWith("?")&&(c="?"+c);let u=i.slashes||a&&/^(https?|ftp|wss?|file):$/.test(o)?"//":"",f=i.pathname??"";a&&f&&!f.startsWith("/")&&(f="/"+f);let l=i.hash?i.hash.startsWith("#")?i.hash:"#"+i.hash:"";return`${o}${u}${a}${f}${c}${l}`}function s(i,o){let a=new URL(i,"resolve://"),c=new URL(o,a);if(c.protocol==="resolve:"){let{pathname:u,search:f,hash:l}=c;return u+f+l}return c.href}return{URL,URLSearchParams,parse:r,format:n,resolve:s,resolveObject:(i,o)=>r(s(i,o)),fileURLToPath:i=>{let o=typeof i=="string"?new URL(i):i;if(o.protocol!=="file:")throw Object.assign(new TypeError("The URL must be of scheme file"),{code:"ERR_INVALID_URL_SCHEME"});return decodeURIComponent(o.pathname)},pathToFileURL:i=>{let o=e(i);i.endsWith("/")&&!o.endsWith("/")&&(o+="/");let a=new URL("file://");return a.pathname=o.replace(/%/g,"%25").replace(/\\/g,"%5C").replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/\t/g,"%09"),a},domainToASCII:i=>i,domainToUnicode:i=>i,urlToHttpOptions:i=>({protocol:i.protocol,hostname:i.hostname,hash:i.hash,search:i.search,pathname:i.pathname,path:i.pathname+i.search,href:i.href,port:i.port?Number(i.port):void 0}),Url:function(){}}}var x={SUCCESS:0,ACCES:2,BADF:8,EXIST:20,FAULT:21,INVAL:28,IO:29,ISDIR:31,LOOP:32,NAMETOOLONG:37,NOENT:44,NOSPC:51,NOSYS:52,NOTDIR:54,NOTEMPTY:55,NOTSUP:58,PERM:63,SPIPE:70,NOTCAPABLE:76},Te={UNKNOWN:0,CHARACTER_DEVICE:2,DIRECTORY:3,REGULAR_FILE:4},tt={CREAT:1,DIRECTORY:2,EXCL:4,TRUNC:8},Er={APPEND:1},br={SET:0,CUR:1,END:2},Et={REALTIME:0,MONOTONIC:1,PROCESS_CPUTIME:2,THREAD_CPUTIME:3},Kn=0x1fffffffn,wr=class extends Error{};function ye(t){try{return t()}catch(e){throw e instanceof RangeError?new wr(e.message):e}}function U(t){try{return t()??x.SUCCESS}catch(e){return Hn(e)}}var rt=t=>Number.isFinite(t)?BigInt(Math.max(0,Math.round(t))):0n;function Hn(t){if(t instanceof wr)return x.FAULT;if(t instanceof RangeError)return x.INVAL;switch(t?.code){case"ENOENT":return x.NOENT;case"EEXIST":return x.EXIST;case"EISDIR":return x.ISDIR;case"ENOTDIR":return x.NOTDIR;case"ENOTEMPTY":return x.NOTEMPTY;case"EBADF":return x.BADF;case"EINVAL":return x.INVAL;case"EACCES":return x.ACCES;case"EPERM":return x.PERM;case"ENOSPC":return x.NOSPC;case"ENAMETOOLONG":return x.NAMETOOLONG;case"ELOOP":return x.LOOP;default:return x.IO}}var yr=class{constructor(e){m(this,"memory");this.memory=e}get view(){return new DataView(this.memory().buffer)}bytes(e,r){return ye(()=>new Uint8Array(this.memory().buffer,e,r))}u32(e,r){ye(()=>this.view.setUint32(e,r,!0))}u64(e,r){ye(()=>this.view.setBigUint64(e,r,!0))}text(e,r){return new TextDecoder().decode(this.bytes(e,r).slice())}iovecs(e,r){return ye(()=>{let n=this.view,s=[];for(let i=0;i<r;i++)s.push(this.bytes(n.getUint32(e+i*8,!0),n.getUint32(e+i*8+4,!0)));return s})}strings(e,r,n){ye(()=>{let s=this.view,i=n;e.forEach((o,a)=>{let c=new TextEncoder().encode(o+"\0");s.setUint32(r+a*4,i,!0),this.bytes(i,c.length).set(c),i+=c.length})})}sizes(e,r,n){this.u32(r,e.length),this.u32(n,e.reduce((s,i)=>s+new TextEncoder().encode(i).length+1,0))}};var cl=64;function Zi(t,e,r,n){let s=new Map([[0,{kind:"stdio",path:"",root:"",position:0,append:!1}],[1,{kind:"stdio",path:"",root:"",position:0,append:!1}],[2,{kind:"stdio",path:"",root:"",position:0,append:!1}]]),i=3;for(let[f,l]of Object.entries(n)){let d=O(l);s.set(i++,{kind:"dir",path:d,root:d,preopen:f,position:0,append:!1})}let o=(f,l,d)=>{let h=s.get(f);if(!h)return x.BADF;if(h.kind!=="dir")return x.NOTDIR;let p;try{p=r.text(l,d)}catch(b){return Hn(b)}if(p.startsWith("/"))return x.NOTCAPABLE;let y=O(`${h.path}/${p}`);return y===h.root||y.startsWith(h.root==="/"?"/":`${h.root}/`)?y:x.NOTCAPABLE},a=(f,l,d)=>ye(()=>{let h=r.view;r.bytes(f,cl).fill(0),h.setBigUint64(f+8,rt(l.ino??0),!0),h.setUint8(f+16,d??(l.isDirectory()?Te.DIRECTORY:Te.REGULAR_FILE)),h.setBigUint64(f+24,1n,!0),h.setBigUint64(f+32,rt(l.size),!0);let p=rt(l.mtimeMs)*1000000n;for(let y of[40,48,56])h.setBigUint64(f+y,p,!0)}),c=(f,l,d)=>{let h=new Uint8Array(l.reduce((b,E)=>b+E.length,0)),p=t.readSync(f.host,h,0,h.length,d),y=0;for(let b of l)if(b.set(h.subarray(y,Math.min(p,y+b.length))),y+=b.length,y>=p)break;return p},u=(f,l,d)=>{let h=Vi(l);return t.writeSync(f.host,h,0,h.length,d)};return{closeAll(){for(let f of s.values())try{f.host!==void 0&&t.closeSync(f.host)}catch{}s.clear()},fd_write(f,l,d,h){let p=s.get(f);return p?U(()=>{let y=r.iovecs(l,d),b;if(p.kind==="stdio"){let E=Vi(y);if(f===1)e.stdout(E);else if(f===2)e.stderr(E);else return x.BADF;b=E.length}else if(p.kind==="file"){let E=p.append?t.fstatSync(p.host).size:p.position;b=u(p,y,E),p.position=E+b}else return x.ISDIR;r.u32(h,b)}):x.BADF},fd_pwrite(f,l,d,h,p){let y=s.get(f);return!y||y.kind!=="file"?y?x.INVAL:x.BADF:U(()=>r.u32(p,u(y,r.iovecs(l,d),Number(h))))},fd_read(f,l,d,h){let p=s.get(f);return p?U(()=>{let y=p.kind==="file"?c(p,r.iovecs(l,d),p.position):p.kind==="stdio"?0:-1;if(y<0)return x.ISDIR;p.position+=y,r.u32(h,y)}):x.BADF},fd_pread(f,l,d,h,p){let y=s.get(f);return!y||y.kind!=="file"?y?x.INVAL:x.BADF:U(()=>r.u32(p,c(y,r.iovecs(l,d),Number(h))))},fd_seek(f,l,d,h){let p=s.get(f);return p?p.kind==="stdio"?x.SPIPE:p.kind!=="file"?x.INVAL:U(()=>{let y=d===br.SET?0:d===br.CUR?p.position:d===br.END?t.fstatSync(p.host).size:-1;if(y<0||y+Number(l)<0)return x.INVAL;p.position=y+Number(l),r.u64(h,BigInt(p.position))}):x.BADF},fd_tell(f,l){let d=s.get(f);return d?d.kind==="stdio"?x.SPIPE:U(()=>r.u64(l,BigInt(d.position))):x.BADF},fd_close(f){let l=s.get(f);return l?(s.delete(f),U(()=>{l.host!==void 0&&t.closeSync(l.host)})):x.BADF},fd_fdstat_get(f,l){let d=s.get(f);return d?U(()=>ye(()=>{let h=r.view;h.setUint8(l,d.kind==="stdio"?Te.CHARACTER_DEVICE:d.kind==="dir"?Te.DIRECTORY:Te.REGULAR_FILE),h.setUint16(l+2,d.append?Er.APPEND:0,!0),h.setBigUint64(l+8,Kn,!0),h.setBigUint64(l+16,Kn,!0)})):x.BADF},fd_fdstat_set_flags(f,l){let d=s.get(f);return d?(d.append=(l&Er.APPEND)!==0,x.SUCCESS):x.BADF},fd_filestat_get(f,l){let d=s.get(f);return d?d.kind==="stdio"?U(()=>a(l,{isDirectory:()=>!1,size:0,mtimeMs:0},Te.CHARACTER_DEVICE)):U(()=>a(l,d.host!==void 0?t.fstatSync(d.host):t.statSync(d.path))):x.BADF},fd_filestat_set_size(f,l){let d=s.get(f);return!d||d.kind!=="file"?d?x.INVAL:x.BADF:U(()=>t.ftruncateSync(d.host,Number(l)))},fd_prestat_get(f,l){let d=s.get(f);return d?.preopen?U(()=>ye(()=>{r.view.setUint8(l,0),r.view.setUint32(l+4,new TextEncoder().encode(d.preopen).length,!0)})):x.BADF},fd_prestat_dir_name(f,l,d){let h=s.get(f);return h?.preopen?U(()=>void r.bytes(l,d).set(new TextEncoder().encode(h.preopen).subarray(0,d))):x.BADF},fd_readdir(f,l,d,h,p){let y=s.get(f);return y?y.kind!=="dir"?x.NOTDIR:U(()=>{let b=t.readdirSync(y.path,{withFileTypes:!0}),E=0;for(let C=Number(h);C<b.length&&E<d;C++){let A=b[C],g=new TextEncoder().encode(A.name),w=new Uint8Array(24+g.length),S=new DataView(w.buffer);S.setBigUint64(0,BigInt(C+1),!0),S.setUint32(16,g.length,!0),S.setUint8(20,A.isDirectory()?Te.DIRECTORY:Te.REGULAR_FILE),w.set(g,24);let I=Math.min(w.length,d-E);r.bytes(l+E,I).set(w.subarray(0,I)),E+=I}r.u32(p,E)}):x.BADF},path_open(f,l,d,h,p,y,b,E,C){let A=o(f,d,h);return typeof A=="number"?A:U(()=>{let g=t.statSync(A,{throwIfNoEntry:!1}),w=!!(p&tt.EXCL&&p&tt.CREAT);if(g&&w)return x.EXIST;if(!g&&!(p&tt.CREAT))return x.NOENT;if(g?.isDirectory()){if(p&tt.TRUNC)return x.ISDIR}else if(p&tt.DIRECTORY)return g?x.NOTDIR:x.NOENT;let S=s.get(f),I=!!g?.isDirectory(),v=i;r.u32(C,v);let B=I?void 0:t.openSync(A,w?"wx+":!g||p&tt.TRUNC?"w+":"r+");i++,s.set(v,{kind:I?"dir":"file",path:A,root:S.root,host:B,position:0,append:(E&Er.APPEND)!==0})})},path_filestat_get(f,l,d,h,p){let y=o(f,d,h);return typeof y=="number"?y:U(()=>{let b=t.statSync(y,{throwIfNoEntry:!1});if(!b)return x.NOENT;a(p,b)})},path_create_directory(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.mkdirSync(h))},path_remove_directory(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.rmdirSync(h))},path_unlink_file(f,l,d){let h=o(f,l,d);return typeof h=="number"?h:U(()=>t.unlinkSync(h))},path_rename(f,l,d,h,p,y){let b=o(f,l,d),E=o(h,p,y);return typeof b=="number"?b:typeof E=="number"?E:U(()=>t.renameSync(b,E))},fd_sync:f=>s.has(f)?x.SUCCESS:x.BADF,fd_datasync:f=>s.has(f)?x.SUCCESS:x.BADF,fd_advise:f=>s.has(f)?x.SUCCESS:x.BADF,fd_allocate:f=>s.has(f)?x.SUCCESS:x.BADF,fd_filestat_set_times:f=>s.has(f)?x.SUCCESS:x.BADF,path_filestat_set_times:()=>x.SUCCESS}}function Vi(t){if(t.length===1)return t[0].slice();let e=new Uint8Array(t.reduce((n,s)=>n+s.length,0)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e}var ll=["args_get","args_sizes_get","environ_get","environ_sizes_get","clock_res_get","clock_time_get","fd_advise","fd_allocate","fd_close","fd_datasync","fd_fdstat_get","fd_fdstat_set_flags","fd_fdstat_set_rights","fd_filestat_get","fd_filestat_set_size","fd_filestat_set_times","fd_pread","fd_prestat_get","fd_prestat_dir_name","fd_pwrite","fd_read","fd_readdir","fd_renumber","fd_seek","fd_sync","fd_tell","fd_write","path_create_directory","path_filestat_get","path_filestat_set_times","path_link","path_open","path_readlink","path_remove_directory","path_rename","path_symlink","path_unlink_file","poll_oneoff","proc_exit","proc_raise","sched_yield","random_get","sock_accept","sock_recv","sock_send","sock_shutdown"],Xi=t=>t===Et.REALTIME||t===Et.MONOTONIC||t===Et.PROCESS_CPUTIME||t===Et.THREAD_CPUTIME,Cr=class extends Error{constructor(r){super(`WASI exit ${r}`);m(this,"code");this.code=r}};function eo(t){class e{constructor(n={}){m(this,"wasiImport");m(this,"memory");m(this,"returnOnExit");m(this,"started",!1);m(this,"closeAll");if(n.version!==void 0&&n.version!=="preview1")throw new TypeError(`WASI version "${n.version}" is not supported: only 'preview1' is`);this.returnOnExit=n.returnOnExit??!0;let s=n.args??[],i=Object.entries(n.env??{}).flatMap(([f,l])=>l===void 0?[]:[`${f}=${l}`]),o=new yr(()=>{if(!this.memory)throw new Error("WASI: the instance has not been started or initialized");return this.memory}),{closeAll:a,...c}=Zi(t.fs,t,o,n.preopens??{});this.closeAll=a;let u={...c,args_get:(f,l)=>U(()=>o.strings(s,f,l)),args_sizes_get:(f,l)=>U(()=>o.sizes(s,f,l)),environ_get:(f,l)=>U(()=>o.strings(i,f,l)),environ_sizes_get:(f,l)=>U(()=>o.sizes(i,f,l)),clock_res_get:(f,l)=>Xi(f)?U(()=>o.u64(l,1000n)):x.INVAL,clock_time_get:(f,l,d)=>Xi(f)?U(()=>o.u64(d,f===Et.REALTIME?rt(Date.now())*1000000n:rt(performance.now()*1e6))):x.INVAL,random_get:(f,l)=>U(()=>{for(let d=0;d<l;d+=65536){let h=new Uint8Array(Math.min(65536,l-d));crypto.getRandomValues(h),o.bytes(f+d,h.length).set(h)}}),poll_oneoff:(f,l,d,h)=>U(()=>ye(()=>{let p=o.view;for(let y=0;y<d;y++){let b=f+y*48,E=l+y*32;o.bytes(E,32).fill(0),p.setBigUint64(E,p.getBigUint64(b,!0),!0),p.setUint8(E+10,p.getUint8(b+8))}p.setUint32(h,d,!0)})),proc_exit:f=>{throw new Cr(f)},sched_yield:()=>x.SUCCESS};this.wasiImport=Object.fromEntries(ll.map(f=>[f,u[f]??(()=>x.NOSYS)]))}getImportObject(){return{wasi_snapshot_preview1:this.wasiImport}}start(n){let{_start:s}=this.attach(n);if(typeof s!="function")throw new TypeError("instance.exports._start is not a function");try{return s(),0}catch(i){if(!(i instanceof Cr))throw i;if(this.returnOnExit)return i.code;t.exit(i.code);return}finally{this.closeAll()}}initialize(n){let{_start:s,_initialize:i}=this.attach(n);if(typeof s=="function")throw new TypeError("instance.exports._start must not be a function for initialize()");typeof i=="function"&&i()}attach(n){if(this.started)throw new Error("WASI instance has already started");this.started=!0;let s=n.exports.memory;if(!(s instanceof WebAssembly.Memory))throw new TypeError("instance.exports.memory must be a WebAssembly.Memory");return this.memory=s,n.exports}}return{WASI:e}}var vr=class extends Error{constructor(r){let n=r.message===void 0;super(n?`${V(r.actual)} ${r.operator??"=="} ${V(r.expected)}`:String(r.message));m(this,"code","ERR_ASSERTION");m(this,"actual");m(this,"expected");m(this,"operator");m(this,"generatedMessage");this.name="AssertionError",this.actual=r.actual,this.expected=r.expected,this.operator=r.operator??"==",this.generatedMessage=n}};function Wn(t,e){if(t==e)return!0;if(typeof t!="object"||typeof e!="object"||!t||!e)return!1;let r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(s=>Wn(t[s],e[s]))}function Z(t,e,r,n){throw t instanceof Error?t:new vr({message:t,actual:e,expected:r,operator:n})}function to(t,e){return e===void 0?!0:typeof e=="function"?e.prototype!==void 0&&t instanceof e?!0:Error.isPrototypeOf(e)?!1:e(t)===!0:e instanceof RegExp?e.test(String(t instanceof Error?t.message:t))||e.test(String(t)):typeof e=="object"&&e?Object.entries(e).every(([r,n])=>n instanceof RegExp?n.test(String(t?.[r])):Qe(t?.[r],n)):!1}function Sr(t=!1){let e=(a,c)=>{a||Z(c??"The expression evaluated to a falsy value",a,!0,"==")},r=t?(a,c,u)=>!Object.is(a,c)&&Z(u,a,c,"strictEqual"):(a,c,u)=>a!=c&&!(Number.isNaN(a)&&Number.isNaN(c))&&Z(u,a,c,"=="),n=t?(a,c,u)=>!Qe(a,c)&&Z(u,a,c,"deepStrictEqual"):(a,c,u)=>!Wn(a,c)&&Z(u,a,c,"deepEqual"),s=(a,c,u)=>{typeof c=="string"&&([u,c]=[c,void 0]);try{a()}catch(f){if(!to(f,c))throw f;return}Z(u??"Missing expected exception.",void 0,c,"throws")},i=async(a,c,u)=>{typeof c=="string"&&([u,c]=[c,void 0]);try{await(typeof a=="function"?a():a)}catch(f){if(!to(f,c))throw f;return}Z(u??"Missing expected rejection.",void 0,c,"rejects")},o=(a,c)=>e(a,c);return Object.assign(o,{ok:e,equal:r,notEqual:t?(a,c,u)=>Object.is(a,c)&&Z(u,a,c,"notStrictEqual"):(a,c,u)=>a==c&&Z(u,a,c,"!="),strictEqual:(a,c,u)=>!Object.is(a,c)&&Z(u,a,c,"strictEqual"),notStrictEqual:(a,c,u)=>Object.is(a,c)&&Z(u,a,c,"notStrictEqual"),deepEqual:n,notDeepEqual:(a,c,u)=>(t?Qe(a,c):Wn(a,c))&&Z(u,a,c,"notDeepEqual"),deepStrictEqual:(a,c,u)=>!Qe(a,c)&&Z(u,a,c,"deepStrictEqual"),notDeepStrictEqual:(a,c,u)=>Qe(a,c)&&Z(u,a,c,"notDeepStrictEqual"),throws:s,doesNotThrow:(a,c)=>{try{a()}catch(u){Z(c??`Got unwanted exception: ${u?.message??u}`,u,void 0,"doesNotThrow")}},rejects:i,doesNotReject:async(a,c)=>{try{await(typeof a=="function"?a():a)}catch(u){Z(c??"Got unwanted rejection.",u,void 0,"doesNotReject")}},match:(a,c,u)=>!c.test(a)&&Z(u??`The input did not match the regular expression ${c}. Input: ${V(a)}`,a,c,"match"),doesNotMatch:(a,c,u)=>c.test(a)&&Z(u,a,c,"doesNotMatch"),ifError:a=>{if(a!=null)throw a},fail:a=>Z(a??"Failed",void 0,void 0,"fail"),AssertionError:vr}),o.strict=t?o:Sr(!0),o}var Jn=t=>typeof t=="string"?D.from(t):t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Ct=t=>t?.level===void 0||t.level<0?6:Math.min(9,t.level),fl={gzip:(t,e)=>Ns(t,{level:Ct(e)}),gunzip:t=>Nt(t),deflate:(t,e)=>Ts(t,{level:Ct(e)}),inflate:t=>hn(t),deflateRaw:(t,e)=>Ds(t,{level:Ct(e)}),inflateRaw:t=>fn(t),unzip:t=>Fs(t)},ro={Gzip:t=>new Os({level:Ct(t)}),Gunzip:()=>new un,Deflate:t=>new Rs({level:Ct(t)}),Inflate:()=>new dn,DeflateRaw:t=>new $e({level:Ct(t)}),InflateRaw:()=>new ve,Unzip:()=>new Ls},no=4;function Pt(t){let e=t instanceof Error?t.message:String(t);return Object.assign(new Error(e||"invalid compressed data"),{code:"Z_DATA_ERROR",errno:-3})}var Br=class extends We{constructor(r,n){super();m(this,"engine");m(this,"bytesWritten",0);m(this,"_handle",{close:()=>{}});this.engine=ro[r](n),this.engine.ondata=s=>{s.length&&this.push(D.from(s))}}_transform(r,n,s){try{this.bytesWritten+=r.length,this.engine.push(r,!1),s()}catch(i){s(Pt(i))}}_flush(r){try{this.engine.push(new Uint8Array(0),!0),r()}catch(n){r(Pt(n))}}_processChunk(r,n){let s=[],i=this.engine.ondata;this.engine.ondata=o=>void(o.length&&s.push(o));try{this.bytesWritten+=r.length,this.engine.push(r,n===no)}catch(o){throw Pt(o)}finally{this.engine.ondata=i}return D.concat(s)}flush(r,n){n?.()}params(r,n,s){s?.()}close(r){this.destroy(),r?.()}},bt=()=>{throw Object.assign(new Error("Brotli is not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function so(){let t={constants:{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:no,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_PARAM_QUALITY:1},brotliCompressSync:bt,brotliDecompressSync:bt,brotliCompress:bt,brotliDecompress:bt,createBrotliCompress:bt,createBrotliDecompress:bt,crc32:(e,r=0)=>{let n=~r>>>0;for(let s of Jn(e)){n^=s;for(let i=0;i<8;i++)n=n&1?n>>>1^3988292384:n>>>1}return~n>>>0}};for(let[e,r]of Object.entries(fl))t[`${e}Sync`]=(n,s)=>{try{return D.from(r(Jn(n),s))}catch(i){throw Pt(i)}},t[e]=(n,s,i)=>{let o=typeof s=="function"?s:i;T(()=>{try{o(null,D.from(r(Jn(n),typeof s=="object"?s:void 0)))}catch(a){o(Pt(a))}})};for(let e of Object.keys(ro))t[`create${e}`]=r=>new Br(e,r),t[e]=class extends Br{constructor(r){super(e,r)}};return t}var Ee=class extends F{constructor(r=0){super();m(this,"remoteAddress","127.0.0.1");m(this,"remotePort",5e4+Math.floor(Math.random()*1e4));m(this,"remoteFamily","IPv4");m(this,"localAddress","127.0.0.1");m(this,"localPort");m(this,"encrypted",!1);m(this,"readable",!0);m(this,"writable",!0);m(this,"destroyed",!1);m(this,"bytesRead",0);m(this,"bytesWritten",0);this.localPort=r}setTimeout(r,n){return n&&this.once("timeout",n),this}setNoDelay(){return this}setKeepAlive(){return this}address(){return{address:this.localAddress,family:"IPv4",port:this.localPort}}ref(){return this}unref(){return this}cork(){}uncork(){}write(){return!0}end(){return this}destroy(){return this.destroyed=!0,this}};function ul(t){let e={},r=[];for(let[n,s]of Object.entries(t)){let i=n.toLowerCase();r.push(n,s),e[i]=i==="set-cookie"?[s]:s}return{headers:e,raw:r}}var Le=class extends X{constructor(r=new Ee){super();m(this,"httpVersion","1.1");m(this,"httpVersionMajor",1);m(this,"httpVersionMinor",1);m(this,"method");m(this,"url");m(this,"statusCode");m(this,"statusMessage");m(this,"headers",{});m(this,"rawHeaders",[]);m(this,"trailers",{});m(this,"rawTrailers",[]);m(this,"complete",!1);m(this,"aborted",!1);m(this,"socket");m(this,"connection");this.socket=r,this.connection=r}_read(){}setTimeout(r,n){return n&&this.once("timeout",n),this}_fill(r,n){this._setHeaders(r),n?.length&&this.push(D.from(n)),this._complete()}_setHeaders(r){let{headers:n,raw:s}=ul(r);this.headers=n,this.rawHeaders=s}_complete(){this.push(null),this.complete=!0}},Fe=class extends ie{constructor(){super(...arguments);m(this,"_headers",new Map);m(this,"headersSent",!1);m(this,"sendDate",!0)}setHeader(r,n){if(this.headersSent)throw Object.assign(new Error("Cannot set headers after they are sent to the client"),{code:"ERR_HTTP_HEADERS_SENT"});return this._headers.set(r.toLowerCase(),{name:r,value:Array.isArray(n)?n.map(String):String(n)}),this}appendHeader(r,n){let s=this.getHeader(r),i=[...s===void 0?[]:Array.isArray(s)?s:[String(s)],...Array.isArray(n)?n:[n]];return this.setHeader(r,i)}getHeader(r){return this._headers.get(r.toLowerCase())?.value}getHeaders(){let r=Object.create(null);for(let[n,{value:s}]of this._headers)r[n]=s;return r}getHeaderNames(){return[...this._headers.keys()]}getRawHeaderNames(){return[...this._headers.values()].map(r=>r.name)}hasHeader(r){return this._headers.has(r.toLowerCase())}removeHeader(r){this._headers.delete(r.toLowerCase())}flushHeaders(){this.headersSent=!0}setTimeout(r,n){return n&&this.once("timeout",n),this}};var dl=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]),hl=new Set(["host","connection","content-length","keep-alive","transfer-encoding","upgrade","expect","te","trailer","proxy-connection"]);function pl(t,e,r){let n={};if(typeof t=="string"||t instanceof URL){let s=new URL(String(t));n={protocol:s.protocol,hostname:s.hostname.replace(/^\[|\]$/g,""),port:s.port,path:s.pathname+s.search,auth:s.username?`${decodeURIComponent(s.username)}:${decodeURIComponent(s.password)}`:void 0},e&&typeof e=="object"&&(n={...n,...e})}else t&&typeof t=="object"&&(n={...t});if(n.protocol??(n.protocol=r),!n.hostname&&n.host){let[s,i]=n.host.split(":");n.hostname=s,n.port??(n.port=i)}return n.hostname??(n.hostname="localhost"),n.path??(n.path="/"),n.method=(n.method??"GET").toUpperCase(),n}function io(t){return dl.has(t.toLowerCase())}function oo(t){let e={};return t.forEach((r,n)=>e[n]=r),e}async function ao(t,e,r,n){if(io(e.hostname)){let o=Number(e.port||(e.protocol==="https:"?443:80)),a=await t.loopback(o,r);if(!a)throw Object.assign(new Error(`connect ECONNREFUSED 127.0.0.1:${o}`),{code:"ECONNREFUSED",errno:-111,syscall:"connect",address:"127.0.0.1",port:o});let c=new Headers;for(let[f,l]of Object.entries(a.headers))for(let d of Array.isArray(l)?l:[l])c.append(f,String(d));let u=a.status===204||a.status===304||r.method==="HEAD";return u&&a.body.cancel().catch(()=>{}),new Response(u?null:a.body,{status:a.status,statusText:a.statusText,headers:c})}let s={};for(let[o,a]of Object.entries(r.headers))hl.has(o.toLowerCase())||(s[o]=a);let i=r.body&&r.method!=="GET"&&r.method!=="HEAD";return t.fetch(e.href,{method:r.method,headers:s,body:i?r.body:void 0,signal:n})}var jt=class extends Fe{constructor(r,n,s,i,o){super({decodeStrings:!0,autoDestroy:!1});m(this,"deps");m(this,"method");m(this,"path");m(this,"host");m(this,"protocol");m(this,"aborted",!1);m(this,"reusedSocket",!1);m(this,"socket",new Ee);m(this,"connection",this.socket);m(this,"chunks",[]);m(this,"controller",new AbortController);m(this,"options");this.deps=r,typeof s=="function"&&([i,s]=[s,void 0]),this.options=pl(n,s,o),this.method=this.options.method,this.path=this.options.path,this.host=this.options.hostname,this.protocol=this.options.protocol;for(let[a,c]of Object.entries(this.options.headers??{}))this.setHeader(a,c);this.options.auth&&!this.hasHeader("authorization")&&this.setHeader("authorization",`Basic ${D.from(this.options.auth).toString("base64")}`),i&&this.once("response",i),this.options.signal?.addEventListener("abort",()=>this.destroy(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"})))}_write(r,n,s){this.chunks.push(r),s()}_final(r){this.headersSent=!0,r(),this.perform()}abort(){this.aborted=!0,this.controller.abort(),this.emit("abort"),this.destroy()}destroy(r){return this.controller.abort(),super.destroy(r)}setNoDelay(){}setSocketKeepAlive(){}async streamBody(r,n){let s=r.body?.getReader();if(s){let i=()=>void s.cancel().catch(()=>{});this.controller.signal.addEventListener("abort",i);try{for(;;){let{value:o,done:a}=await s.read();if(a||this.controller.signal.aborted)break;this.deps.loop._run(()=>n.push(D.from(o.buffer,o.byteOffset,o.byteLength)))}}catch(o){if(this.controller.signal.aborted)return;this.deps.loop._run(()=>{n.aborted=!0,n.destroy(o)});return}finally{this.controller.signal.removeEventListener("abort",i)}}this.controller.signal.aborted||this.deps.loop._run(()=>n._complete())}async perform(){let r=this.deps.loop.hold();try{let n=this.options.port?`:${this.options.port}`:"",s=this.host.includes(":")?`[${this.host}]`:this.host,i=new URL(`${this.protocol}//${s}${n}${this.path}`),o={};for(let[f,l]of Object.entries(this.getHeaders()))o[f]=Array.isArray(l)?l.join(", "):String(l);let a=this.chunks.length?D.concat(this.chunks):null,c=await ao(this.deps.system,i,{method:this.method,url:this.path,headers:o,body:a},this.controller.signal),u=new Le(this.socket);u.statusCode=c.status,u.statusMessage=c.statusText,u._setHeaders(oo(c.headers)),this.deps.loop._run(()=>{this.emit("response",u)||u.resume()}),await this.streamBody(c,u)}catch(n){this.aborted||this.deps.loop._run(()=>this.emit("error",n))}finally{r()}}};function qn(t){return async(e,r)=>{let n=t.loop.hold();try{let s=new Request(e instanceof URL?e.href:e,r),i=new URL(s.url);if(!io(i.hostname))return await t.system.fetch(i.href,r??(typeof e=="object"&&!(e instanceof URL)?{method:s.method,headers:s.headers,body:s.body,signal:s.signal}:void 0));let o=s.method==="GET"||s.method==="HEAD"?null:new Uint8Array(await s.arrayBuffer()),a=await ao(t.system,i,{method:s.method,url:i.pathname+i.search,headers:oo(s.headers),body:o});return Al(a,()=>t.loop.hold())}finally{n()}}}function Al(t,e){if(!t.body)return t;let r=t.body.getReader(),n=new ReadableStream({async pull(s){let i=e();try{let{value:o,done:a}=await r.read();a?s.close():s.enqueue(o)}catch(o){s.error(o)}finally{i()}},cancel:s=>r.cancel(s)},{highWaterMark:0});return new Response(n,{status:t.status,statusText:t.statusText,headers:t.headers})}var Ir={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},co=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];var gl=new Set([101,204,304]),nt=class extends Fe{constructor(r,n){super({decodeStrings:!0});m(this,"sink");m(this,"statusCode",200);m(this,"statusMessage","");m(this,"req");m(this,"socket");m(this,"connection");m(this,"chunkedEncoding",!1);m(this,"shouldKeepAlive",!1);m(this,"headWritten",!1);m(this,"hungUp",!1);this.sink=n,this.req=r,this.socket=r.socket,this.connection=r.socket}get finished(){return this.writableEnded}writeHead(r,n,s){if(typeof n!="string"&&([s,n]=[n,void 0]),this.statusCode=r,n&&(this.statusMessage=n),Array.isArray(s))for(let i=0;i+1<s.length;i+=2)this.setHeader(String(s[i]),s[i+1]);else if(s)for(let[i,o]of Object.entries(s))o!==void 0&&this.setHeader(i,o);return this.sendHead(),this}flushHeaders(){this.sendHead()}_implicitHeader(){this.sendHead()}get _header(){return this.headersSent}writeContinue(){}writeProcessing(){}writeEarlyHints(){}addTrailers(){}assignSocket(){}detachSocket(){}_write(r,n,s){this.sendHead(),!this.hungUp&&this.req.method!=="HEAD"&&!gl.has(this.statusCode)&&this.sink.chunk(new Uint8Array(r)),s()}_final(r){this.sendHead(),this.hungUp||this.sink.end(),r()}_hangUp(){this.hungUp||this.writableFinished||(this.hungUp=!0,this._writableState.emitClose=!1,this.req.aborted=!0,this.req.emit("aborted"),this.req.emit("close"),this.socket.destroyed=!0,this.socket.emit("close",!1),this.emit("close"))}sendHead(){if(this.headersSent=!0,this.headWritten)return;this.headWritten=!0;let r={};for(let{name:n,value:s}of this._headers.values())r[n]=s;this.sink.head({status:this.statusCode,statusText:this.statusMessage||Ir[this.statusCode]||"",headers:r})}};var Qr=class extends Ne{constructor(r,n,s){super({allowHalfOpen:!1});m(this,"channel");m(this,"remoteAddress","127.0.0.1");m(this,"remotePort",5e4+Math.floor(Math.random()*1e4));m(this,"remoteFamily","IPv4");m(this,"localAddress","127.0.0.1");m(this,"localPort");m(this,"encrypted",!1);m(this,"connecting",!1);m(this,"bytesRead",0);m(this,"bytesWritten",0);m(this,"release");this.channel=r,this.localPort=n,this.release=s?.(),r.onData(i=>{this.bytesRead+=i.byteLength,this.push(D.from(i.buffer,i.byteOffset,i.byteLength))}),r.onClose(()=>{this.push(null),this.end()}),this.once("close",()=>{this.release?.(),this.release=void 0})}_read(){}_write(r,n,s){this.bytesWritten+=r.byteLength,this.channel.send(r),s()}_final(r){this.channel.close(),this.push(null),r()}_destroy(r,n){this.channel.close(),n(r)}setTimeout(r,n){return n&&this.once("timeout",n),this}setNoDelay(){return this}setKeepAlive(){return this}address(){return{address:this.localAddress,family:"IPv4",port:this.localPort}}ref(){return this}unref(){return this.release?.(),this.release=void 0,this}};var Kt=class extends F{constructor(r,n,s){super();m(this,"deps");m(this,"listening",!1);m(this,"timeout",0);m(this,"keepAliveTimeout",5e3);m(this,"headersTimeout",6e4);m(this,"requestTimeout",3e5);m(this,"maxHeadersCount",null);m(this,"registration");m(this,"release");this.deps=r,typeof n=="function"&&(s=n),s&&this.on("request",s)}listen(...r){let n=typeof r[r.length-1]=="function"?r.pop():void 0,s=r[0],i=Number(typeof s=="object"&&s?s.port??0:s??0);n&&this.once("listening",n);try{this.registration=this.deps.system.listen(i,o=>this.handle(o),(o,a)=>this.upgrade(o,a))}catch(o){return T(()=>this.emit("error",o)),this}return this.listening=!0,this.release=this.deps.loop.hold(),T(()=>this.emit("listening")),this}address(){return this.registration?{address:"::",family:"IPv6",port:this.registration.port}:null}close(r){return this.registration?(this.registration.close(),this.registration=void 0,this.listening=!1,this.release?.(),this.release=void 0,r&&this.once("close",r),T(()=>this.emit("close")),this):(r&&T(()=>r(Object.assign(new Error("Server is not running."),{code:"ERR_SERVER_NOT_RUNNING"}))),this)}closeAllConnections(){}closeIdleConnections(){}setTimeout(r=0,n){return this.timeout=r,n&&this.on("timeout",n),this}ref(){return this.registration&&!this.release&&(this.release=this.deps.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}getConnections(r){r(null,0)}toIncoming(r,n,s,i){let o=new Le(n);o.method=r.method.toUpperCase(),o.url=r.url;let a=Object.keys(s).some(c=>c.toLowerCase()==="host");return o._fill(a?s:{...s,host:`localhost:${n.localPort}`},i),o}handle(r){return new Promise(n=>{let s={...r.headers};!Object.keys(s).some(u=>/^(content-length|transfer-encoding)$/i.test(u))&&r.body?.length&&(s["content-length"]=String(r.body.length));let o=this.toIncoming(r,new Ee(this.registration?.port??0),s,r.body),a=Lt(()=>this.deps.loop._run(()=>c._hangUp())),c=new nt(o,{head:u=>n({...u,body:a.stream}),chunk:u=>a.push(u),end:()=>a.end()});this.deps.loop._run(()=>{try{this.emit("request",o,c)}catch(u){throw c.writableEnded||(c.statusCode=500,c.end("Internal Server Error")),u}})})}upgrade(r,n){if(!this.listenerCount("upgrade"))return n.close();let s=new Qr(n,this.registration?.port??0,()=>this.deps.loop.hold()),i=this.toIncoming(r,s,r.headers,null);this.deps.loop._run(()=>this.emit("upgrade",i,s,D.alloc(0)))}};var kr=class extends F{constructor(r={}){super();m(this,"options");m(this,"maxSockets",1/0);m(this,"maxFreeSockets",256);m(this,"sockets",{});m(this,"requests",{});m(this,"freeSockets",{});this.options=r}destroy(){}};function zn(t,e){let r=(i,o,a)=>new jt(t,i,o,a,e),n=(i,o,a)=>{let c=r(i,o,a);return c.end(),c},s=new kr;return{createServer:(i,o)=>new Kt(t,i,o),request:r,get:n,Server:class extends Kt{constructor(i,o){super(t,i,o)}},IncomingMessage:Le,ServerResponse:nt,OutgoingMessage:Fe,ClientRequest:jt,Agent:kr,globalAgent:s,STATUS_CODES:Ir,METHODS:co,maxHeaderSize:16384,validateHeaderName(i){if(!/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/.test(i))throw Object.assign(new TypeError(`Header name must be a valid HTTP token ["${i}"]`),{code:"ERR_INVALID_HTTP_TOKEN"})},validateHeaderValue(i,o){if(o===void 0)throw Object.assign(new TypeError(`Invalid value "undefined" for header "${i}"`),{code:"ERR_HTTP_INVALID_HEADER_VALUE"})},setMaxIdleHTTPParsers:()=>{}}}var lo=/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/,fo=/^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;function uo(t){class e extends F{constructor(){super(...arguments);m(this,"reservation");m(this,"release");m(this,"listening",!1)}listen(...i){let o=typeof i[i.length-1]=="function"?i.pop():void 0,a=i[0],c=Number(typeof a=="object"&&a?a.port??0:a??0);o&&this.once("listening",o);try{this.reservation=t.system.listen(c,async()=>Ft(502,"Not an HTTP server"))}catch(u){return T(()=>this.emit("error",u)),this}return this.listening=!0,this.release=t.loop.hold(),T(()=>this.emit("listening")),this}address(){return this.reservation?{address:"::",family:"IPv6",port:this.reservation.port}:null}close(i){return this.reservation?.close(),this.reservation=void 0,this.listening=!1,this.release?.(),i&&this.once("close",i),T(()=>this.emit("close")),this}ref(){return this}unref(){return this.release?.(),this.release=void 0,this}}let r=()=>{throw Object.assign(new Error("Raw TCP sockets are not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};return{createServer:()=>new e,Server:e,Socket:Ee,Stream:Ee,connect:r,createConnection:r,isIP:n=>lo.test(n)?4:fo.test(n)?6:0,isIPv4:n=>lo.test(n),isIPv6:n=>fo.test(n),getDefaultAutoSelectFamily:()=>!0,setDefaultAutoSelectFamily:()=>{}}}var ml=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,st=class extends F{constructor(r,n,s,i){super();m(this,"pid");m(this,"exitCode",null);m(this,"signalCode",null);m(this,"killed",!1);m(this,"connected",!1);m(this,"spawnfile");m(this,"spawnargs");m(this,"stdin");m(this,"stdout");m(this,"stderr");m(this,"stdio");m(this,"handle");m(this,"ipc");m(this,"release");m(this,"exited",!1);m(this,"hold");this.spawnfile=n,this.spawnargs=[n,...s],this.stdout=new X({read(){}}),this.stderr=new X({read(){}}),this.stdin=new ie({write:(h,p,y)=>{this.handle?.write(typeof h=="string"?h:new Uint8Array(h)),y()},final:h=>{this.handle?.closeStdin(),h()}}),this.stdio=[this.stdin,this.stdout,this.stderr];let o=h=>i.stdio==="inherit"||Array.isArray(i.stdio)&&i.stdio[h]==="inherit",[a,c]=[o(1),o(2)],u={};for(let[h,p]of Object.entries(i.env??r.env()))p!==void 0&&(u[h]=String(p));let[f,l]=i.shell?["bfsh",["-c",[n,...s].join(" ")]]:[n,s];this.hold=()=>r.loop.hold(),this.release=this.hold();try{this.handle=r.system.spawn(f,l,{cwd:i.cwd??r.cwd(),env:u,ipc:i.ipc,detached:i.detached})}catch(h){this.unref();let p=h.code??"ENOENT",y=Object.assign(new Error(`spawn ${n} ${p}`),{code:p,errno:-2,syscall:`spawn ${n}`,path:n,spawnargs:s});T(()=>{this.emit("error",y),this.emit("close",-2,null)});return}this.pid=this.handle.pid;let d=this.handle.ipc;d&&(this.ipc=d,this.connected=!0,d.onMessage(h=>r.loop._run(()=>this.emit("message",h,void 0))),d.onDisconnect(()=>{this.connected=!1,r.loop._run(()=>this.emit("disconnect"))})),this.handle.onStdout(h=>a?r.stdout(h):this.stdout.push(D.from(h))),this.handle.onStderr(h=>c?r.stderr(h):this.stderr.push(D.from(h))),i.signal?.addEventListener("abort",()=>this.kill()),T(()=>this.emit("spawn")),this.handle.exit.then(h=>{this.exited=!0,this.exitCode=this.killed?null:h,this.stdout.push(null),this.stderr.push(null),r.loop._run(()=>{this.emit("exit",this.exitCode,this.signalCode),this.emit("close",this.exitCode,this.signalCode)}),this.unref()})}kill(r="SIGTERM"){return!this.handle||this.exitCode!==null?!1:(this.killed=!0,this.signalCode=r,this.handle.kill(r),!0)}send(r,...n){let s=n.find(o=>typeof o=="function"),i=o=>(s?T(()=>s(o)):T(()=>this.emit("error",o)),!1);if(!this.ipc)return i(Object.assign(new Error("Channel closed"),{code:"ERR_IPC_CHANNEL_CLOSED"}));try{this.ipc.send(r)}catch(o){return i(o)}return s&&T(()=>s(null)),!0}disconnect(){this.ipc?.disconnect()}ref(){!this.release&&this.handle&&!this.exited&&(this.release=this.hold())}unref(){this.release?.(),this.release=void 0}};function ho(t,e,r){let n="",s="";return t.stdout.on("data",i=>n+=String(i)),t.stderr.on("data",i=>s+=String(i)),t.on("error",i=>r?.(i,n,s)),t.on("close",(i,o)=>{if(i===-2)return;let a=i===0?null:Object.assign(new Error(`Command failed: ${e}
24
+ ${s}`),{code:i??void 0,killed:t.killed,signal:o,cmd:e});r?.(a,n,s)}),t}var Gn=t=>()=>{throw Object.assign(new Error(`child_process.${t} is not supported in the browser runtime (a synchronous child would block the thread it needs). Use the async form.`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function po(t){return{spawn:(r,n,s)=>(Array.isArray(n)||([s,n]=[n,[]]),new st(t,r,n.map(String),s??{})),exec(r,n,s){return typeof n=="function"&&([s,n]=[n,{}]),ho(new st(t,r,[],{...n,shell:!0}),r,s)},execFile(r,n,s,i){return typeof n=="function"?[i,n,s]=[n,[],{}]:Array.isArray(n)||([i,s,n]=[s,n,[]]),typeof s=="function"&&([i,s]=[s,{}]),ho(new st(t,r,n,s??{}),[r,...n].map(ml).join(" "),i)},fork(r,n,s){Array.isArray(n)||([s,n]=[n,[]]);let i=s??{},o=i.stdio??(i.silent?"pipe":"inherit");return new st(t,"node",[...i.execArgv??[],r,...n.map(String)],{...i,stdio:o,ipc:!0})},execSync:Gn("execSync"),execFileSync:Gn("execFileSync"),spawnSync:Gn("spawnSync"),ChildProcess:st}}var _r=class extends F{constructor(r,n,s={}){super();m(this,"input");m(this,"output");m(this,"line","");m(this,"cursor",0);m(this,"terminal");m(this,"closed",!1);m(this,"buffer","");m(this,"promptText","> ");m(this,"pendingQuestion");m(this,"onData",r=>this.feed(String(r)));m(this,"onEnd",()=>{this.buffer&&this.emitLine(this.buffer),this.buffer="",this.close()});this.input=r,this.output=n,this.terminal=s.terminal??!!n?.isTTY,s.prompt!==void 0&&(this.promptText=s.prompt),r.setEncoding?.("utf8"),r.on("data",this.onData),r.on("end",this.onEnd),r.resume?.()}setPrompt(r){this.promptText=r}getPrompt(){return this.promptText}prompt(){this.output?.write(this.promptText)}question(r,n,s){let i=typeof n=="function"?n:s;this.output?.write(r),this.pendingQuestion=i}write(r){this.feed(r)}pause(){return this.input.pause?.(),this.emit("pause"),this}resume(){return this.input.resume?.(),this.emit("resume"),this}close(){this.closed||(this.closed=!0,this.input.removeListener("data",this.onData),this.input.removeListener("end",this.onEnd),this.input.pause?.(),this.emit("close"))}getCursorPos(){return{rows:0,cols:this.cursor}}async*[Symbol.asyncIterator](){let r=[],n;for(this.on("line",s=>{r.push(s),n?.()}),this.on("close",()=>n?.());;)if(r.length)yield r.shift();else{if(this.closed)return;await new Promise(s=>n=s)}}feed(r){for(this.buffer+=r;;){let n=this.buffer.search(/\r\n|\n|\r/);if(n<0)break;let s=this.buffer.slice(0,n);this.buffer=this.buffer.slice(this.buffer[n]==="\r"&&this.buffer[n+1]===`
25
+ `?n+2:n+1),this.emitLine(s)}this.line=this.buffer,this.cursor=this.buffer.length}emitLine(r){let n=this.pendingQuestion;n?(this.pendingQuestion=void 0,n(r)):this.emit("line",r)}},xr=(t,e,r)=>(t?.write(e),r?.(),!0);function Yn(t=!1){let r={createInterface:(n,s)=>{let i="input"in n&&n.input?n:{input:n,output:s},o=new _r(i.input,i.output,i);if(t){let a=o.question.bind(o);o.question=c=>new Promise(u=>a(c,void 0,u))}return o},Interface:_r,clearLine:(n,s,i)=>xr(n,s<0?"\x1B[1K":s>0?"\x1B[0K":"\x1B[2K",i),clearScreenDown:(n,s)=>xr(n,"\x1B[0J",s),cursorTo:(n,s,i,o)=>xr(n,typeof i=="number"?`\x1B[${i+1};${s+1}H`:`\x1B[${s+1}G`,typeof i=="function"?i:o),moveCursor:(n,s,i,o)=>xr(n,(s<0?`\x1B[${-s}D`:s>0?`\x1B[${s}C`:"")+(i<0?`\x1B[${-i}A`:i>0?`\x1B[${i}B`:""),o),emitKeypressEvents(n){n.__keypress||(n.__keypress=!0,n.on("data",s=>{for(let i of String(s)){let o=i==="\r"||i===`
26
+ `?"return":i==="\x7F"?"backspace":i===""?"c":/[a-z]/i.test(i)?i.toLowerCase():void 0;n.emit("keypress",i,{sequence:i,name:o,ctrl:i==="",meta:!1,shift:/[A-Z]/.test(i)})}}))}};return t||(r.promises=Yn(!0)),r}function Ao(t){let e=Array.from({length:Math.max(1,Math.min(16,globalThis.navigator?.hardwareConcurrency??4))},()=>({model:"Browser CPU",speed:2400,times:{user:0,nice:0,sys:0,idle:0,irq:0}}));return{EOL:`
27
+ `,devNull:"/dev/null",platform:()=>"linux",type:()=>"Linux",release:()=>"6.1.0-bfwc",version:()=>"#1 SMP BuilderForce WebContainers",machine:()=>"x86_64",arch:()=>"x64",hostname:()=>"localhost",homedir:()=>t().HOME??"/home/user",tmpdir:()=>t().TMPDIR??"/tmp",userInfo:()=>({uid:1e3,gid:1e3,username:t().USER??"user",homedir:t().HOME??"/home/user",shell:"/bin/bfsh"}),cpus:()=>e,availableParallelism:()=>e.length,totalmem:()=>4*1024**3,freemem:()=>2*1024**3,loadavg:()=>[0,0,0],uptime:()=>Math.floor(performance.now()/1e3),networkInterfaces:()=>({lo:[{address:"127.0.0.1",netmask:"255.0.0.0",family:"IPv4",mac:"00:00:00:00:00:00",internal:!0,cidr:"127.0.0.1/8"}]}),endianness:()=>"LE",getPriority:()=>0,setPriority:()=>{},constants:{signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGKILL:9,SIGTERM:15},errno:{},priority:{}}}}function go(t){return{isatty:e=>t&&e>=0&&e<=2,ReadStream:class extends F{},WriteStream:class extends F{}}}function mo(t){let e={setTimeout:(r,n,s)=>new Promise((i,o)=>{let a=t.setTimeout(()=>i(n),r);s?.signal?.addEventListener("abort",()=>{t.clearTimeout(a),o(Object.assign(new Error("The operation was aborted"),{name:"AbortError",code:"ABORT_ERR"}))})}),setImmediate:r=>new Promise(n=>t.setImmediate(()=>n(r))),async*setInterval(r,n){for(;;)await new Promise(s=>t.setTimeout(s,r)),yield n},scheduler:{wait:r=>new Promise(n=>t.setTimeout(n,r)),yield:()=>new Promise(r=>t.setImmediate(r))}};return{setTimeout:t.setTimeout,clearTimeout:t.clearTimeout,setInterval:t.setInterval,clearInterval:t.clearInterval,setImmediate:t.setImmediate,clearImmediate:t.clearImmediate,promises:e}}function wo(){let t=(r,n)=>{r.encoding=(n??"utf8").toLowerCase().replace("-",""),r.encoding==="utf8"&&(r.utf8=new TextDecoder("utf-8"))};class e{constructor(n){t(this,n)}write(n){return typeof n=="string"?n:this.utf8?this.utf8.decode(n,{stream:!0}):On(n,this.encoding)}end(n){return(n===void 0?"":this.write(n))+(this.utf8?this.utf8.decode():"")}}return{StringDecoder:ce(e,t)}}function yo(){class t{constructor(){m(this,"store")}getStore(){return this.store}run(n,s,...i){let o=this.store;this.store=n;try{return s(...i)}finally{this.store=o}}enterWith(n){this.store=n}exit(n,...s){return this.run(void 0,n,...s)}disable(){this.store=void 0}static bind(n){return n}static snapshot(){return(n,...s)=>n(...s)}}class e{constructor(n){m(this,"type");this.type=n}runInAsyncScope(n,s,...i){return n.apply(s,i)}bind(n){return n}static bind(n){return n}emitDestroy(){return this}asyncId(){return 1}triggerAsyncId(){return 0}}return{AsyncLocalStorage:t,AsyncResource:e,createHook:()=>({enable(){return this},disable(){return this}}),executionAsyncId:()=>1,triggerAsyncId:()=>0,executionAsyncResource:()=>({})}}var Vn="__bfwc_vm_code";function Eo(){let t=(r,n={})=>{let s=new Proxy(n,{has:(i,o)=>o!==Vn,get:(i,o)=>{if(o!==Symbol.unscopables)return o==="globalThis"?s:o in i?i[o]:Reflect.get(globalThis,o)},set:(i,o,a)=>Reflect.set(i,o,a)});return new Function(Vn,`with (this) { return eval(${Vn}); }`).call(s,r)};class e{constructor(n){m(this,"code");this.code=n}runInThisContext(){return(0,eval)(this.code)}runInNewContext(n){return t(this.code,n)}runInContext(n){return t(this.code,n)}}return{Script:e,runInThisContext:r=>(0,eval)(r),runInNewContext:t,runInContext:t,createContext:(r={})=>r,isContext:()=>!0,compileFunction:(r,n=[])=>new Function(...n,r)}}function bo(){let t=new Map,e=r=>{let n=t.get(r);if(!n){let s=new Set;n=Object.assign({subscribers:s,name:r},{get hasSubscribers(){return s.size>0},publish:i=>s.forEach(o=>o(i,r)),subscribe:i=>void s.add(i),unsubscribe:i=>s.delete(i)}),t.set(r,n)}return n};return{channel:e,hasSubscribers:r=>(t.get(r)?.subscribers.size??0)>0,subscribe:(r,n)=>e(r).subscribers.add(n),unsubscribe:(r,n)=>e(r).subscribers.delete(n),tracingChannel:r=>({start:e(`tracing:${r}:start`),end:e(`tracing:${r}:end`),error:e(`tracing:${r}:error`),traceSync:n=>n(),tracePromise:n=>n()})}}var pe=t=>()=>{throw Object.assign(new Error(`${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Co(){return{perf_hooks:{performance:globalThis.performance,PerformanceObserver:class{observe(){}disconnect(){}},monitorEventLoopDelay:()=>({enable(){},disable(){},percentile:()=>0,mean:0,max:0,min:0}),constants:{}},dns:{lookup:(t,e,r)=>T(()=>(typeof e=="function"?e:r)(null,t==="localhost"?"127.0.0.1":t,4)),resolve:pe("dns.resolve"),promises:{lookup:async t=>({address:t==="localhost"?"127.0.0.1":t,family:4})},setDefaultResultOrder:()=>{}},v8:{getHeapStatistics:()=>({total_heap_size:3e7,used_heap_size:2e7,heap_size_limit:2e9}),getHeapSpaceStatistics:()=>[],serialize:t=>new TextEncoder().encode(JSON.stringify(t)),deserialize:t=>JSON.parse(new TextDecoder().decode(t)),setFlagsFromString:()=>{},cachedDataVersionTag:()=>0},cluster:{isMaster:!0,isPrimary:!0,isWorker:!1,workers:{},fork:pe("cluster.fork"),on:()=>{},settings:{}},inspector:{open:()=>{},close:()=>{},url:()=>{},Session:class{connect(){}post(){}disconnect(){}},console:globalThis.console},punycode:{toASCII:t=>new URL(`http://${t}`).hostname,toUnicode:t=>t,encode:t=>t,decode:t=>t,ucs2:{decode:t=>Array.from(t,e=>e.codePointAt(0)),encode:t=>String.fromCodePoint(...t)}},tls:{connect:pe("tls.connect"),createServer:pe("tls.createServer"),createSecureContext:()=>({}),DEFAULT_MIN_VERSION:"TLSv1.2",DEFAULT_MAX_VERSION:"TLSv1.3",rootCertificates:[]},dgram:{createSocket:pe("dgram.createSocket")},http2:{connect:pe("http2.connect"),createServer:pe("http2.createServer"),createSecureServer:pe("http2.createSecureServer"),constants:{}},trace_events:{createTracing:()=>({enable(){},disable(){}}),getEnabledCategories:()=>""},sqlite:{DatabaseSync:pe("sqlite.DatabaseSync")},test:{test:pe("node:test"),describe:pe("node:test"),it:pe("node:test")},repl:{start:pe("repl.start")},domain:{create:()=>Object.assign(new F,{run:t=>t(),add(){},remove(){},bind:t=>t,intercept:t=>t,enter(){},exit(){},dispose(){}})}}}function vo(t){let{process:e,loop:r,system:n}=t,s=()=>e.env,i=Co(),o={system:n,loop:r},a={system:n,loop:r,cwd:()=>e.cwd(),env:s,stdout:l=>void e.stdout.write(l),stderr:l=>void e.stderr.write(l)},c={assert:()=>Sr(!1),"assert/strict":()=>Sr(!0),async_hooks:()=>yo(),buffer:()=>xi(),child_process:()=>po(a),worker_threads:()=>Di({...a,thread:t.thread,ipc:t.ipc}),console:()=>Object.assign(Object.create(t.console),{Console:function(){return t.console}}),constants:l=>({...ke,...l("os").constants.signals}),crypto:()=>zi(),diagnostics_channel:()=>bo(),"dns/promises":l=>l("dns").promises,events:()=>ki(),fs:()=>Wi({vfs:t.fs,cwd:()=>e.cwd(),stdout:t.io.stdout,stderr:t.io.stderr,hold:()=>r.hold(),readStdin:Ji(t.io,()=>r.hold())}),"fs/promises":l=>l("fs").promises,http:()=>zn(o,"http:"),https:()=>zn(o,"https:"),net:()=>uo(o),os:()=>Ao(s),path:()=>Ni(()=>e.cwd()),"path/posix":l=>l("path"),"path/win32":l=>l("path"),process:()=>e,querystring:()=>Gi(),readline:()=>Yn(),"readline/promises":l=>l("readline").promises,stream:()=>Ui(),"stream/promises":l=>l("stream").promises,"stream/web":()=>({ReadableStream,WritableStream,TransformStream,TextEncoderStream,TextDecoderStream,ByteLengthQueuingStrategy,CountQueuingStrategy}),"stream/consumers":()=>({text:async l=>{let d="";for await(let h of l)d+=typeof h=="string"?h:new TextDecoder().decode(h);return d},json:async l=>{let d="";for await(let h of l)d+=typeof h=="string"?h:new TextDecoder().decode(h);return JSON.parse(d)}}),string_decoder:()=>wo(),sys:l=>l("util"),timers:()=>mo(r),"timers/promises":l=>l("timers").promises,tty:()=>go(!!t.io.terminal),url:l=>Yi(l("querystring"),d=>l("path").resolve(d)),util:()=>Mi(s,l=>e.stderr.write(l+`
28
+ `)),"util/types":()=>gt,vm:()=>Eo(),wasi:l=>eo({fs:l("fs"),stdout:d=>void e.stdout.write(d),stderr:d=>void e.stderr.write(d),exit:d=>e.exit(d)}),zlib:()=>so()};for(let[l,d]of Object.entries(i))c[l]??(c[l]=()=>d);let u=new Map,f=l=>{if(u.has(l))return u.get(l);let d=c[l];if(!d)throw Object.assign(new Error(`No such built-in module: ${l}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});let h=d(f);return u.set(l,h),h};return{names:[...Object.keys(c),"module"].sort(),isBuiltin:l=>l==="module"||l in c,get:f,fetch:qn(o)}}var Io=pn,Zn=Symbol.for("bfwc.esm"),wl=/^[\p{L}_$][\p{L}\p{N}_$]*$/u;function Qo(t){return/(?:^|[\s;})])(?:import\s*[\w{*'"]|export\s+|export\s*[{*])/.test(t)}function ko(t){try{let[e,r]=Rt(t);return r.length>0||e.some(n=>n.t===1||n.t===3)}catch{return!1}}function So(t){return t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let r=/^(?:type\s+)?("[^"]*"|'[^']*'|[^\s]+)(?:\s+as\s+("[^"]*"|'[^']*'|[^\s]+))?$/.exec(e);if(!r)throw new SyntaxError(`Cannot parse import/export list entry "${e}"`);let n=s=>/^["']/.test(s)?s.slice(1,-1):s;return[n(r[1]),n(r[2]??r[1])]})}var yl=(t,e)=>wl.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;function El(t,e){let r=[],n=0;for(let s=e;s<t.length;s++){let i=t[s];if(i==='"'||i==="'"||i==="`"){let o=i;for(s++;s<t.length&&t[s]!==o;s++)t[s]==="\\"&&s++;continue}if(i==="("||i==="["||i==="{")n++;else if(i===")"||i==="]"||i==="}")n--;else{if(n===0&&i===";")break;if(n===0&&i===`
29
+ `){let o=t.slice(e,s).trimEnd(),a=t.slice(s+1).trimStart();if(!/[,=+\-*/%&|^?:(]$/.test(o)&&!/^[,.=+\-*/%&|^?:)]/.test(a))break}else if(n===0&&i===","){let o=/^\s*([\p{L}_$][\p{L}\p{N}_$]*)/u.exec(t.slice(s+1));o&&r.push(o[1])}}if(n<0)break}return r}var Bo=t=>!!t&&/[\p{L}\p{N}_$]/u.test(t);function bl(t,e){for(let r=t.lastIndexOf("export",e-1);r>=0;r=t.lastIndexOf("export",r-1))if(!Bo(t[r-1])&&!Bo(t[r+6]))return r;return-1}function xo(t){if(!/\bimport\s*\(/.test(t))return t;let e;try{[e]=Rt(t)}catch{return t}let r="",n=0;for(let s of e)s.t===2&&(r+=t.slice(n,s.ss)+"__bfwc_dynamic",n=s.d);return n?r+t.slice(n):t}function Xn(t){let[e,r]=Rt(t),n=[],s=new Map,i=new Set,o=new Set,a=0,c=d=>`__bfwc_import(${JSON.stringify(d)})`;for(let d of e){if(d.t===2){n.push({start:d.ss,end:d.d,text:"__bfwc_dynamic"});continue}if(d.t===3){n.push({start:d.s,end:d.e,text:"__bfwc_meta"});continue}if(d.t!==1||d.n===void 0)continue;let h=t.slice(d.ss,d.se),p=`__bfwc_m${a++}`,y=`const ${p} = ${c(d.n)};`;if(h.startsWith("export")){o.add(d.ss);let g=/^export\s*\*\s*as\s+("[^"]*"|'[^']*'|[^\s]+)/.exec(h);if(g)s.set(g[1].replace(/^["']|["']$/g,""),p);else if(/^export\s*\*/.test(h))n.push({start:d.ss,end:d.se,text:`${y} __bfwc_star(__bfwc_exports, ${p});`});else for(let[w,S]of So(/\{([^}]*)\}/.exec(h)?.[1]??""))s.set(S,yl(p,w));n.some(w=>w.start===d.ss)||n.push({start:d.ss,end:d.se,text:y});continue}let b=/^import\s*([\s\S]*?)\s*from\s*["']/.exec(h)?.[1];if(b===void 0){n.push({start:d.ss,end:d.se,text:`${c(d.n)};`});continue}let E=[y],C=/\{([\s\S]*)\}/.exec(b),A=b.replace(/\{[\s\S]*\}/,"").split(",").map(g=>g.trim()).filter(Boolean);for(let g of A){let w=/^\*\s*as\s+(\S+)$/.exec(g);w?E.push(`const ${w[1]} = ${p};`):E.push(`const ${g} = __bfwc_get(${p}, "default");`)}if(C)for(let[g,w]of So(C[1]))E.push(`const ${w} = __bfwc_get(${p}, ${JSON.stringify(g)});`);n.push({start:d.ss,end:d.se,text:E.join(" ")})}let u=new Map;for(let d of r){let h=bl(t,d.s);if(h<0||o.has(h))continue;let p=t.slice(h+6,d.s);if(/^\s*\{/.test(p)){if(!u.has(h)){let b=t.indexOf("}",h)+1,E=/^\s*;/.exec(t.slice(b));E&&(b+=E[0].length),u.set(h,b),n.push({start:h,end:b,text:""})}s.set(d.n,d.ln??d.n);continue}if(d.n==="default"&&t.startsWith("default",d.s)&&!p.trim()){d.ln&&d.ls>=0?(n.push({start:h,end:d.e,text:""}),s.set("default",d.ln)):(n.push({start:h,end:d.e,text:"const __bfwc_default ="}),s.set("default","__bfwc_default"));continue}if(!i.has(h)&&(i.add(h),n.push({start:h,end:h+6,text:""}),/^\s*(const|let|var)\b/.exec(p)))for(let b of El(t,d.e))s.set(b,b);s.set(d.n,d.ln??d.n)}n.sort((d,h)=>h.start-d.start);let f=t;for(let d of n)f=f.slice(0,d.start)+d.text+f.slice(d.end);return`"use strict";__bfwc_esm(__bfwc_exports, { ${[...s].map(([d,h])=>`${JSON.stringify(d)}: () => ${h}`).join(", ")} });${f}`}var Or=["node","require","default"],es=["node","import","default"],Oo=[".js",".json",".cjs",".mjs",".node"];function Ht(t,e){let r=new Error(`Cannot find module '${t}'${e?`
30
30
  Require stack:
31
- - ${e}`:""}`);return r.code="MODULE_NOT_FOUND",e&&(r.requireStack=[e]),r}function es(t,e){let r=t.readText(k(e,"package.json"));if(r!==void 0)try{return JSON.parse(r)}catch{return}}function Je(t,e){for(let r=O(e);;r=$(r)){if(!r.endsWith("/node_modules")){let n=es(t,r);if(n)return{dir:r,pkg:n}}if(r==="/")return}}function ts(t,e){if(t.isFile(e))return e;for(let r of _o)if(t.isFile(e+r))return e+r}function ko(t,e){for(let r of _o)if(t.isFile(k(e,"index"+r)))return k(e,"index"+r)}function Do(t,e){if(!t.isDirectory(e))return;let r=es(t,e)?.main;if(typeof r=="string"&&r){let n=k(e,r),s=ts(t,n)??ko(t,n);if(s)return s}return ko(t,e)}function Oo(t,e){return ts(t,e)??Do(t,e)}function Dr(t,e,r){if(typeof t=="string")return t.replace(/\*/g,e);if(Array.isArray(t)){for(let n of t){let s=Dr(n,e,r);if(s!==void 0)return s}return}if(t&&typeof t=="object"){for(let[n,s]of Object.entries(t)){if(n!=="default"&&!r.includes(n))continue;let i=Dr(s,e,r);if(i!==void 0)return i}return}return t===null?null:void 0}function No(t,e,r){let s=typeof t=="string"||Array.isArray(t)||t&&typeof t=="object"&&!Object.keys(t).some(a=>a.startsWith(".")||a.startsWith("#"))?{".":t}:t;if(!s||typeof s!="object")return;if(Object.prototype.hasOwnProperty.call(s,e)&&!e.includes("*"))return Dr(s[e],"",r);let i;for(let a of Object.keys(s)){let c=a.indexOf("*");if(c>=0){let u=a.slice(0,c),f=a.slice(c+1);e.startsWith(u)&&e.length>=a.length-1&&e.endsWith(f)&&(!i||u.length>i.key.indexOf("*"))&&(i={key:a,match:e.slice(u.length,e.length-f.length)})}else a.endsWith("/")&&e.startsWith(a)&&(!i||a.length>i.key.length)&&(i={key:a,match:""})}if(!i)return;let o=Dr(s[i.key],i.match,r);return o&&i.key.endsWith("/")&&!i.key.includes("*")?o+e.slice(i.key.length):o}function El(t,e){let r=new Error(`Package subpath '${e}' is not defined by "exports" in /node_modules/${t}/package.json`);return r.code="ERR_PACKAGE_PATH_NOT_EXPORTED",r}function xo(t,e,r,n,s,i,o){let a=es(t,e);if(a?.exports!==void 0&&a.exports!==null){let u=n?`.${n}`:".",f=No(a.exports,u,s);if(!f)throw El(r,u);let l=k(e,f);if(t.isFile(l))return l;throw Ht(i,o)}let c=Oo(t,k(e,n||"."));if(!c)throw Ht(i,o);return c}function Nr(t,e,r,n){let{conditions:s,from:i}=n;if(e.startsWith("node:")){let l=e.slice(5);if(!n.isBuiltin(l))throw Object.assign(new Error(`No such built-in module: ${e}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});return{builtin:l}}if(n.isBuiltin(e))return{builtin:e};if(e.startsWith("#")){let l=Je(t,r),d=l?.pkg.imports?No(l.pkg.imports,e,s):void 0;if(!d||!l)throw Object.assign(new Error(`Package import specifier "${e}" is not defined${l?` in package ${l.dir}/package.json`:""}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});if(!d.startsWith("./"))return Nr(t,d,l.dir,n);let h=k(l.dir,d);if(t.isFile(h))return{path:h};throw Ht(e,i)}if(e==="."||e===".."||e.startsWith("./")||e.startsWith("../")||e.startsWith("/")){let l=e.startsWith("/")?O(e):k(r,e),d=e.endsWith("/")?Do(t,l):Oo(t,l);if(!d)throw Ht(e,i);return{path:d}}let{name:o,subpath:a}=Ms(e),c=Je(t,r);if(c?.pkg.name===o&&c.pkg.exports!==void 0)return{path:xo(t,c.dir,o,a,s,e,i)};let u=n.paths??[],f=[];for(let l=O(r);l.endsWith("/node_modules")||f.push(k(l,"node_modules")),l!=="/";l=$(l));for(let l of u)f.push(l.endsWith("node_modules")?l:k(l,"node_modules"));for(let l of f){let d=k(l,o);if(t.isDirectory(d)||t.isFile(d+".js")||t.isFile(d+".json"))return t.isDirectory(d)?{path:xo(t,d,o,a,s,e,i)}:{path:ts(t,d)}}throw Ht(e,i)}function Rr(t){let e=[];for(let r=O(t);;r=$(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules")),r==="/")return e}function Tr(t){let e=t.charCodeAt(0)===65279?t.slice(1):t;return e.startsWith("#!")?"//"+e.slice(2):e}function Ro(t){let{fs:e}=t,r=Object.create(null),n=new WeakMap,s=Object.keys(t.globals),i=s.map(b=>t.globals[b]),o;function a(b,E){let C=Qt(b);return C===".mjs"?!0:C===".cjs"?!1:Je(e,$(b))?.pkg.type==="module"?!0:Bo(E)&&Io(E)}function c(b){if(b&&b[Vn])return b;if(typeof b!="object"&&typeof b!="function"||b===null)return{default:b};let E=n.get(b);if(!E){E=Object.create(null);for(let C of Object.keys(b))C!=="default"&&Object.defineProperty(E,C,{enumerable:!0,get:()=>b[C]});Object.defineProperty(E,"default",{enumerable:!0,value:b}),n.set(b,E)}return E}let y=class y{constructor(E="",C=void 0){m(this,"parent");m(this,"id");m(this,"filename");m(this,"path");m(this,"exports",{});m(this,"loaded",!1);m(this,"children",[]);m(this,"paths");m(this,"__tla");this.parent=C,this.id=E,this.filename=E,this.path=$(E||"/"),this.paths=Rr(this.path),C?.children.push(this)}static _resolveFilename(E,C,A,g){let w=C?.filename?$(C.filename):t.globals.process?.cwd()??"/",S=Nr(e,E,w,{conditions:g?.conditions??Or,isBuiltin:t.isBuiltin,from:C?.filename,paths:g?.paths});return"builtin"in S?`node:${S.builtin}`:S.path}static _load(E,C,A=!1){let g=y._resolveFilename(E,C,A);return h(g,C,A).exports}require(E){if(typeof E!="string"||!E)throw new TypeError('The "id" argument must be a non-empty string');return y._load(E,this,!1)}_compile(E,C,A=!1){let g=p(this),w=$(C),S=["exports","require","module","__filename","__dirname"],I=[this.exports,g,this,C,w],v=E,B=[],Q=[];A?(B=["__bfwc_exports","__bfwc_import","__bfwc_dynamic","__bfwc_meta","__bfwc_esm","__bfwc_star","__bfwc_get"],Q=[this.exports,...d(this,C)]):(v=Qo(E))!==E&&(B=["__bfwc_dynamic"],Q=[d(this,C)[1]]);let _=`${Tr(v)}
31
+ - ${e}`:""}`);return r.code="MODULE_NOT_FOUND",e&&(r.requireStack=[e]),r}function ts(t,e){let r=t.readText(k(e,"package.json"));if(r!==void 0)try{return JSON.parse(r)}catch{return}}function Je(t,e){for(let r=O(e);;r=$(r)){if(!r.endsWith("/node_modules")){let n=ts(t,r);if(n)return{dir:r,pkg:n}}if(r==="/")return}}function rs(t,e){if(t.isFile(e))return e;for(let r of Oo)if(t.isFile(e+r))return e+r}function _o(t,e){for(let r of Oo)if(t.isFile(k(e,"index"+r)))return k(e,"index"+r)}function No(t,e){if(!t.isDirectory(e))return;let r=ts(t,e)?.main;if(typeof r=="string"&&r){let n=k(e,r),s=rs(t,n)??_o(t,n);if(s)return s}return _o(t,e)}function Ro(t,e){return rs(t,e)??No(t,e)}function Dr(t,e,r){if(typeof t=="string")return t.replace(/\*/g,e);if(Array.isArray(t)){for(let n of t){let s=Dr(n,e,r);if(s!==void 0)return s}return}if(t&&typeof t=="object"){for(let[n,s]of Object.entries(t)){if(n!=="default"&&!r.includes(n))continue;let i=Dr(s,e,r);if(i!==void 0)return i}return}return t===null?null:void 0}function To(t,e,r){let s=typeof t=="string"||Array.isArray(t)||t&&typeof t=="object"&&!Object.keys(t).some(a=>a.startsWith(".")||a.startsWith("#"))?{".":t}:t;if(!s||typeof s!="object")return;if(Object.prototype.hasOwnProperty.call(s,e)&&!e.includes("*"))return Dr(s[e],"",r);let i;for(let a of Object.keys(s)){let c=a.indexOf("*");if(c>=0){let u=a.slice(0,c),f=a.slice(c+1);e.startsWith(u)&&e.length>=a.length-1&&e.endsWith(f)&&(!i||u.length>i.key.indexOf("*"))&&(i={key:a,match:e.slice(u.length,e.length-f.length)})}else a.endsWith("/")&&e.startsWith(a)&&(!i||a.length>i.key.length)&&(i={key:a,match:""})}if(!i)return;let o=Dr(s[i.key],i.match,r);return o&&i.key.endsWith("/")&&!i.key.includes("*")?o+e.slice(i.key.length):o}function Cl(t,e){let r=new Error(`Package subpath '${e}' is not defined by "exports" in /node_modules/${t}/package.json`);return r.code="ERR_PACKAGE_PATH_NOT_EXPORTED",r}function Do(t,e,r,n,s,i,o){let a=ts(t,e);if(a?.exports!==void 0&&a.exports!==null){let u=n?`.${n}`:".",f=To(a.exports,u,s);if(!f)throw Cl(r,u);let l=k(e,f);if(t.isFile(l))return l;throw Ht(i,o)}let c=Ro(t,k(e,n||"."));if(!c)throw Ht(i,o);return c}function Nr(t,e,r,n){let{conditions:s,from:i}=n;if(e.startsWith("node:")){let l=e.slice(5);if(!n.isBuiltin(l))throw Object.assign(new Error(`No such built-in module: ${e}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});return{builtin:l}}if(n.isBuiltin(e))return{builtin:e};if(e.startsWith("#")){let l=Je(t,r),d=l?.pkg.imports?To(l.pkg.imports,e,s):void 0;if(!d||!l)throw Object.assign(new Error(`Package import specifier "${e}" is not defined${l?` in package ${l.dir}/package.json`:""}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});if(!d.startsWith("./"))return Nr(t,d,l.dir,n);let h=k(l.dir,d);if(t.isFile(h))return{path:h};throw Ht(e,i)}if(e==="."||e===".."||e.startsWith("./")||e.startsWith("../")||e.startsWith("/")){let l=e.startsWith("/")?O(e):k(r,e),d=e.endsWith("/")?No(t,l):Ro(t,l);if(!d)throw Ht(e,i);return{path:d}}let{name:o,subpath:a}=$s(e),c=Je(t,r);if(c?.pkg.name===o&&c.pkg.exports!==void 0)return{path:Do(t,c.dir,o,a,s,e,i)};let u=n.paths??[],f=[];for(let l=O(r);l.endsWith("/node_modules")||f.push(k(l,"node_modules")),l!=="/";l=$(l));for(let l of u)f.push(l.endsWith("node_modules")?l:k(l,"node_modules"));for(let l of f){let d=k(l,o);if(t.isDirectory(d)||t.isFile(d+".js")||t.isFile(d+".json"))return t.isDirectory(d)?{path:Do(t,d,o,a,s,e,i)}:{path:rs(t,d)}}throw Ht(e,i)}function Rr(t){let e=[];for(let r=O(t);;r=$(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules")),r==="/")return e}function Tr(t){let e=t.charCodeAt(0)===65279?t.slice(1):t;return e.startsWith("#!")?"//"+e.slice(2):e}function Lo(t){let{fs:e}=t,r=Object.create(null),n=new WeakMap,s=Object.keys(t.globals),i=s.map(b=>t.globals[b]),o;function a(b,E){let C=kt(b);return C===".mjs"?!0:C===".cjs"?!1:Je(e,$(b))?.pkg.type==="module"?!0:Qo(E)&&ko(E)}function c(b){if(b&&b[Zn])return b;if(typeof b!="object"&&typeof b!="function"||b===null)return{default:b};let E=n.get(b);if(!E){E=Object.create(null);for(let C of Object.keys(b))C!=="default"&&Object.defineProperty(E,C,{enumerable:!0,get:()=>b[C]});Object.defineProperty(E,"default",{enumerable:!0,value:b}),n.set(b,E)}return E}let y=class y{constructor(E="",C=void 0){m(this,"parent");m(this,"id");m(this,"filename");m(this,"path");m(this,"exports",{});m(this,"loaded",!1);m(this,"children",[]);m(this,"paths");m(this,"__tla");this.parent=C,this.id=E,this.filename=E,this.path=$(E||"/"),this.paths=Rr(this.path),C?.children.push(this)}static _resolveFilename(E,C,A,g){let w=C?.filename?$(C.filename):t.globals.process?.cwd()??"/",S=Nr(e,E,w,{conditions:g?.conditions??Or,isBuiltin:t.isBuiltin,from:C?.filename,paths:g?.paths});return"builtin"in S?`node:${S.builtin}`:S.path}static _load(E,C,A=!1){let g=y._resolveFilename(E,C,A);return h(g,C,A).exports}require(E){if(typeof E!="string"||!E)throw new TypeError('The "id" argument must be a non-empty string');return y._load(E,this,!1)}_compile(E,C,A=!1){let g=p(this),w=$(C),S=["exports","require","module","__filename","__dirname"],I=[this.exports,g,this,C,w],v=E,B=[],Q=[];A?(B=["__bfwc_exports","__bfwc_import","__bfwc_dynamic","__bfwc_meta","__bfwc_esm","__bfwc_star","__bfwc_get"],Q=[this.exports,...d(this,C)]):(v=xo(E))!==E&&(B=["__bfwc_dynamic"],Q=[d(this,C)[1]]);let _=`${Tr(v)}
32
32
  //# sourceURL=${encodeURI("file://"+C)}`,[N,L,J,te]=A?[[...s,...S],[...i,...I],B,Q]:[s,i,[...S,...B],[...I,...Q]],G=le=>{let Y=`return ${le?"async ":""}function (${J.join(", ")}) {${_}
33
- }`;return t.scope?new Function("__bfwc_scope",`with (__bfwc_scope) { return function (${N.join(", ")}) { ${Y} }; }`)(t.scope)(...L):new Function(...N,Y)(...L)},j;try{j=G(!1)}catch(le){let Y;if(A&&le instanceof SyntaxError&&/\bawait\b/.test(v))try{Y=G(!0)}catch{}if(!Y)throw le instanceof Error&&(le.message=`${C}: ${le.message}`),le;j=Y}let re=A?l(this,v):[],q=re.length?Promise.all(re).then(()=>j.apply(this.exports,te)):j.apply(this.exports,te);return q instanceof Promise&&(this.__tla=q),q}};m(y,"_cache",r),m(y,"_pathCache",Object.create(null)),m(y,"builtinModules",[]),m(y,"globalPaths",["/usr/local/lib/node"]),m(y,"Module",y),m(y,"_extensions",{".js"(E,C){let A=e.readText(C)??"";a(C,A)?E._compile(Zn(Tr(A)),C,!0):E._compile(A,C)},".cjs"(E,C){E._compile(e.readText(C)??"",C)},".mjs"(E,C){E._compile(Zn(Tr(e.readText(C)??"")),C,!0)},".json"(E,C){try{E.exports=JSON.parse(Tr(e.readText(C)??""))}catch(A){throw A.message=`${C}: ${A.message}`,A}},".node"(E,C){throw Object.assign(new Error(`Native addons cannot run in the browser: ${C}`),{code:"ERR_DLOPEN_FAILED"})}}),m(y,"_nodeModulePaths",Rr),m(y,"isBuiltin",E=>t.isBuiltin(E.replace(/^node:/,""))),m(y,"createRequire",E=>{let C=typeof E=="string"?E.replace(/^file:\/\//,""):decodeURIComponent(E.pathname);return p(new y(C.endsWith("/")?C+"__entry.js":C))}),m(y,"wrap",E=>`(function (exports, require, module, __filename, __dirname) { ${E}
33
+ }`;return t.scope?new Function("__bfwc_scope",`with (__bfwc_scope) { return function (${N.join(", ")}) { ${Y} }; }`)(t.scope)(...L):new Function(...N,Y)(...L)},j;try{j=G(!1)}catch(le){let Y;if(A&&le instanceof SyntaxError&&/\bawait\b/.test(v))try{Y=G(!0)}catch{}if(!Y)throw le instanceof Error&&(le.message=`${C}: ${le.message}`),le;j=Y}let re=A?l(this,v):[],q=re.length?Promise.all(re).then(()=>j.apply(this.exports,te)):j.apply(this.exports,te);return q instanceof Promise&&(this.__tla=q),q}};m(y,"_cache",r),m(y,"_pathCache",Object.create(null)),m(y,"builtinModules",[]),m(y,"globalPaths",["/usr/local/lib/node"]),m(y,"Module",y),m(y,"_extensions",{".js"(E,C){let A=e.readText(C)??"";a(C,A)?E._compile(Xn(Tr(A)),C,!0):E._compile(A,C)},".cjs"(E,C){E._compile(e.readText(C)??"",C)},".mjs"(E,C){E._compile(Xn(Tr(e.readText(C)??"")),C,!0)},".json"(E,C){try{E.exports=JSON.parse(Tr(e.readText(C)??""))}catch(A){throw A.message=`${C}: ${A.message}`,A}},".node"(E,C){throw Object.assign(new Error(`Native addons cannot run in the browser: ${C}`),{code:"ERR_DLOPEN_FAILED"})}}),m(y,"_nodeModulePaths",Rr),m(y,"isBuiltin",E=>t.isBuiltin(E.replace(/^node:/,""))),m(y,"createRequire",E=>{let C=typeof E=="string"?E.replace(/^file:\/\//,""):decodeURIComponent(E.pathname);return p(new y(C.endsWith("/")?C+"__entry.js":C))}),m(y,"wrap",E=>`(function (exports, require, module, __filename, __dirname) { ${E}
34
34
  });`),m(y,"wrapper",["(function (exports, require, module, __filename, __dirname) { ",`
35
- });`]),m(y,"syncBuiltinESMExports",()=>{}),m(y,"register",()=>{}),m(y,"findSourceMap",()=>{}),m(y,"runMain",()=>{});let u=y;function f(b){return E=>{let C=E.startsWith("file:")?decodeURIComponent(new URL(E).pathname):E,A;try{A=u._resolveFilename(C,b,!1,{conditions:Or})}catch(g){if(g.code!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw g;A=u._resolveFilename(C,b,!1,{conditions:Xn})}return h(A,b,!1)}}function l(b,E){let C=f(b),A=[];for(let[,g]of E.matchAll(/__bfwc_import\(("(?:[^"\\]|\\.)*")\)/g))if(g)try{let w=C(JSON.parse(g));w.__tla&&A.push(w.__tla)}catch{}return A}function d(b,E){let C=f(b),A=B=>c(C(B).exports),g={url:"file://"+E,filename:E,dirname:$(E),resolve:B=>{let Q=u._resolveFilename(B,b,!1,{conditions:Xn});return Q.startsWith("node:")?Q:"file://"+Q}};return[A,async B=>{let Q=C(String(B));return Q.__tla&&await Q.__tla,c(Q.exports)},g,(B,Q)=>{Object.defineProperty(B,"__esModule",{value:!0}),Object.defineProperty(B,Vn,{value:!0});for(let[_,N]of Object.entries(Q))Object.defineProperty(B,_,{enumerable:!0,configurable:!0,get:N})},(B,Q)=>{for(let _ of Object.keys(Q))_==="default"||_==="__esModule"||Object.prototype.hasOwnProperty.call(B,_)||Object.defineProperty(B,_,{enumerable:!0,configurable:!0,get:()=>Q[_]})},(B,Q)=>{try{return B[Q]}catch{return}}]}function h(b,E,C){if(b.startsWith("node:")){let w=b.slice(5);return{exports:w==="module"?u:t.builtin(w)}}let A=r[b];if(A)return E&&!E.children.includes(A)&&E.children.push(A),A;let g=new u(b,E??null);C&&(o=g,g.id="."),r[b]=g;try{(u._extensions[Qt(b)]??u._extensions[".js"])(g,b)}catch(w){throw delete r[b],w}return g.loaded=!0,g}function p(b){let E=A=>b.require(A),C=(A,g)=>{let w=u._resolveFilename(A,b,!1,g);return w.startsWith("node:")&&!A.startsWith("node:")?A:w};return C.paths=A=>t.isBuiltin(A)?null:Rr(b.path),E.resolve=C,E.cache=r,E.extensions=u._extensions,Object.defineProperty(E,"main",{get:()=>o,enumerable:!0}),E}return{Module:u,cache:r,runMain(b){return h(b,void 0,!0)},get main(){return o},createRequire:u.createRequire,resolve(b,E){return Nr(e,b,E,{conditions:Or,isBuiltin:t.isBuiltin})}}}var rs=globalThis.setTimeout.bind(globalThis),bl=globalThis.clearTimeout.bind(globalThis),Cl=globalThis.setInterval.bind(globalThis),vl=globalThis.clearInterval.bind(globalThis),Sl=1,ns=class{constructor(e,r,n,s,i){m(this,"loop");m(this,"_onTimeout");m(this,"_idleTimeout");m(this,"args");m(this,"_repeat");m(this,"_id",Sl++);m(this,"_ref",!0);m(this,"_handle");m(this,"_destroyed",!1);this.loop=e,this._onTimeout=r,this._idleTimeout=n,this.args=s,this._repeat=i}ref(){return!this._ref&&!this._destroyed&&this.loop._refChanged(this,!0),this._ref=!0,this}unref(){return this._ref&&!this._destroyed&&this.loop._refChanged(this,!1),this._ref=!1,this}hasRef(){return this._ref}refresh(){return this._destroyed||this.loop._arm(this),this}close(){return this.loop.clear(this),this}[Symbol.toPrimitive](){return this._id}_fire(){this.loop._run(()=>this._onTimeout(...this.args))}},Lr=class{constructor(e){m(this,"options");m(this,"holds",0);m(this,"timers",new Map);m(this,"refTimers",0);m(this,"checkScheduled",!1);m(this,"stopped",!1);m(this,"setTimeout",(e,r,...n)=>this.add(e,r,n,!1));m(this,"setInterval",(e,r,...n)=>this.add(e,r,n,!0));m(this,"setImmediate",(e,...r)=>this.add(e,0,r,!1));m(this,"clearTimeout",e=>this.clear(e));m(this,"clearInterval",e=>this.clear(e));m(this,"clearImmediate",e=>this.clear(e));this.options=e}hold(){if(this.stopped)return()=>{};this.holds++;let e=!1;return()=>{e||(e=!0,this.holds--,this.scheduleCheck())}}_run(e){if(!this.stopped)try{e()}catch(r){this.options.onError(r)}}get alive(){return this.holds>0||this.refTimers>0}clear(e){let r=typeof e=="object"&&e?e._id:Number(e),n=this.timers.get(r);n&&(this.disarm(n),this.timers.delete(r),n._destroyed=!0,n._ref&&(this.refTimers--,this.scheduleCheck()))}scheduleCheck(){this.checkScheduled||this.stopped||(this.checkScheduled=!0,rs(()=>{rs(()=>{this.checkScheduled=!1,!this.alive&&!this.stopped&&this.options.onIdle()},0)},0))}stop(){this.stopped=!0;for(let e of this.timers.values())this.disarm(e);this.timers.clear()}_refChanged(e,r){this.refTimers+=r?1:-1,r||this.scheduleCheck()}_arm(e){this.disarm(e);let r=Math.max(0,e._idleTimeout);e._repeat?e._handle=Cl(()=>e._fire(),Math.max(1,r)):e._handle=rs(()=>{this.timers.delete(e._id),e._destroyed=!0,e._ref&&this.refTimers--,e._fire(),e._ref&&this.scheduleCheck()},r)}add(e,r,n,s){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let i=new ns(this,e,Number.isFinite(r)?Number(r):1,n,s);return this.stopped||(this.timers.set(i._id,i),this.refTimers++,this._arm(i)),i}disarm(e){e._handle!==void 0&&(e._repeat?vl(e._handle):bl(e._handle),e._handle=void 0)}};var Ct="20.18.0";var Bl=100,Mr=class extends ie{constructor(r,n,s){super({decodeStrings:!1});m(this,"sink");m(this,"isTTY");m(this,"fd");m(this,"columns");m(this,"rows");this.sink=n,this.fd=r,this.isTTY=!!s,s&&(this.columns=s.cols,this.rows=s.rows,s.onResize((i,o)=>{this.columns=i,this.rows=o,this.emit("resize")}))}_write(r,n,s){this.sink(r),s()}write(r,n,s){return typeof n=="function"&&(s=n),this.sink(typeof r=="string"||r instanceof Uint8Array?r:String(r)),typeof s=="function"&&T(s),!0}getColorDepth(){return this.isTTY?8:1}hasColors(r=16){return this.isTTY&&r<=256}getWindowSize(){return[this.columns??80,this.rows??24]}cursorTo(r,n,s){return this.write(typeof n=="number"?`\x1B[${n+1};${r+1}H`:`\x1B[${r+1}G`),(typeof n=="function"?n:s)?.(),!0}moveCursor(r,n,s){return this.write((r<0?`\x1B[${-r}D`:r>0?`\x1B[${r}C`:"")+(n<0?`\x1B[${-n}A`:n>0?`\x1B[${n}B`:"")),s?.(),!0}clearLine(r=0,n){return this.write(r<0?"\x1B[1K":r>0?"\x1B[0K":"\x1B[2K"),n?.(),!0}clearScreenDown(r){return this.write("\x1B[0J"),r?.(),!0}},ss=class extends X{constructor(r,n){super();m(this,"io");m(this,"loop");m(this,"isTTY");m(this,"isRaw",!1);m(this,"fd",0);m(this,"subscription");m(this,"release");this.io=r,this.loop=n,this.isTTY=!!r.terminal}_read(){this.listen()}resume(){return this.listen(),super.resume()}pause(){return this.stopListening(),super.pause()}setRawMode(r){return this.isRaw=r,this.io.terminal?.setRawMode(r),this}ref(){return this.subscription&&!this.release&&(this.release=this.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}listen(){this.subscription||(this.release=this.loop.hold(),this.subscription=this.io.onStdin(r=>{r===null?(this.stopListening(),this.push(null)):this.push(D.from(typeof r=="string"?new TextEncoder().encode(r):r))}))}stopListening(){this.subscription?.(),this.subscription=void 0,this.release?.(),this.release=void 0}};function To(t){let{io:e,loop:r,fs:n}=t,s=O(t.cwd),i=!1,o=!1,a=performance.now(),c=new M,u=Bl++,f=h=>{if(!o){if(h!==void 0&&(c.exitCode=h),!i){i=!0;let p=Number(c.exitCode??0)||0;try{c.emit("exit",p)}catch{}o=!0,t.onExit(Number(c.exitCode??p)||0)}throw new He(Number(c.exitCode??0)||0)}},l=h=>{let p=performance.now(),y=Math.floor(p/1e3),b=Math.floor(p%1e3*1e6);return h&&(y-=h[0],b-=h[1],b<0&&(y--,b+=1e9)),[y,b]};l.bigint=()=>BigInt(Math.floor(performance.now()*1e6));let d=()=>({rss:5e7,heapTotal:3e7,heapUsed:2e7,external:1e6,arrayBuffers:1e5});return d.rss=()=>5e7,Object.assign(c,{title:"node",version:`v${Ct}`,versions:{node:Ct,v8:"11.3.244.8-node.23",uv:"1.48.0",zlib:"1.3.0.1",modules:"115",napi:"9",unicode:"15.1",webcontainer:Ct},release:{name:"node",lts:"Iron"},platform:"linux",arch:"x64",pid:u,ppid:u-1,argv:t.argv,argv0:"node",execPath:"/usr/local/bin/node",execArgv:[],env:t.env,exitCode:void 0,config:{variables:{}},features:{inspector:!1,ipv6:!0,tls:!0,typescript:!1},allowedNodeEnvironmentFlags:new Set,stdout:new Mr(1,e.stdout,e.terminal),stderr:new Mr(2,e.stderr,e.terminal),stdin:new ss(e,r),cwd:()=>s,chdir(h){let p=h.startsWith("/")?O(h):k(s,h);if(!n.isDirectory(p))throw R(n.isFile(p)?"ENOTDIR":"ENOENT","chdir",p);s=p},exit:f,reallyExit:f,abort:()=>f(134),kill(h,p="SIGTERM"){if(h!==u)throw Object.assign(new Error("kill ESRCH"),{code:"ESRCH"});return c.listenerCount(String(p))?c.emit(String(p),String(p)):f(143),!0},nextTick(h,...p){queueMicrotask(()=>r._run(()=>h(...p)))},hrtime:l,memoryUsage:d,cpuUsage:()=>({user:Math.floor((performance.now()-a)*1e3),system:0}),resourceUsage:()=>({userCPUTime:0,systemCPUTime:0,maxRSS:5e4}),uptime:()=>(performance.now()-a)/1e3,umask:()=>18,getuid:()=>1e3,geteuid:()=>1e3,getgid:()=>1e3,getegid:()=>1e3,getgroups:()=>[1e3],emitWarning(h,p){let y=typeof p=="string"?p:p?.type??(h instanceof Error?h.name:"Warning"),b=h instanceof Error?h.message:h;c.emit("warning",Object.assign(new Error(b),{name:y})),e.stderr(`(node:${u}) ${y}: ${b}
36
- `)},binding(h){throw new Error(`No such module: ${h}`)},getActiveResourcesInfo:()=>[],setUncaughtExceptionCaptureCallback:()=>{},hasUncaughtExceptionCaptureCallback:()=>!1,setSourceMapsEnabled:()=>{},report:{getReport:()=>({header:{glibcVersionRuntime:"2.36"}})},connected:!1}),c}function Lo(t){let e=c=>(...u)=>t[c].write(Oe(...u)+`
35
+ });`]),m(y,"syncBuiltinESMExports",()=>{}),m(y,"register",()=>{}),m(y,"findSourceMap",()=>{}),m(y,"runMain",()=>{});let u=y;function f(b){return E=>{let C=E.startsWith("file:")?decodeURIComponent(new URL(E).pathname):E,A;try{A=u._resolveFilename(C,b,!1,{conditions:Or})}catch(g){if(g.code!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw g;A=u._resolveFilename(C,b,!1,{conditions:es})}return h(A,b,!1)}}function l(b,E){let C=f(b),A=[];for(let[,g]of E.matchAll(/__bfwc_import\(("(?:[^"\\]|\\.)*")\)/g))if(g)try{let w=C(JSON.parse(g));w.__tla&&A.push(w.__tla)}catch{}return A}function d(b,E){let C=f(b),A=B=>c(C(B).exports),g={url:"file://"+E,filename:E,dirname:$(E),resolve:B=>{let Q=u._resolveFilename(B,b,!1,{conditions:es});return Q.startsWith("node:")?Q:"file://"+Q}};return[A,async B=>{let Q=C(String(B));return Q.__tla&&await Q.__tla,c(Q.exports)},g,(B,Q)=>{Object.defineProperty(B,"__esModule",{value:!0}),Object.defineProperty(B,Zn,{value:!0});for(let[_,N]of Object.entries(Q))Object.defineProperty(B,_,{enumerable:!0,configurable:!0,get:N})},(B,Q)=>{for(let _ of Object.keys(Q))_==="default"||_==="__esModule"||Object.prototype.hasOwnProperty.call(B,_)||Object.defineProperty(B,_,{enumerable:!0,configurable:!0,get:()=>Q[_]})},(B,Q)=>{try{return B[Q]}catch{return}}]}function h(b,E,C){if(b.startsWith("node:")){let w=b.slice(5);return{exports:w==="module"?u:t.builtin(w)}}let A=r[b];if(A)return E&&!E.children.includes(A)&&E.children.push(A),A;let g=new u(b,E??null);C&&(o=g,g.id="."),r[b]=g;try{(u._extensions[kt(b)]??u._extensions[".js"])(g,b)}catch(w){throw delete r[b],w}return g.loaded=!0,g}function p(b){let E=A=>b.require(A),C=(A,g)=>{let w=u._resolveFilename(A,b,!1,g);return w.startsWith("node:")&&!A.startsWith("node:")?A:w};return C.paths=A=>t.isBuiltin(A)?null:Rr(b.path),E.resolve=C,E.cache=r,E.extensions=u._extensions,Object.defineProperty(E,"main",{get:()=>o,enumerable:!0}),E}return{Module:u,cache:r,runMain(b){return h(b,void 0,!0)},get main(){return o},createRequire:u.createRequire,resolve(b,E){return Nr(e,b,E,{conditions:Or,isBuiltin:t.isBuiltin})}}}var ns=globalThis.setTimeout.bind(globalThis),vl=globalThis.clearTimeout.bind(globalThis),Sl=globalThis.setInterval.bind(globalThis),Bl=globalThis.clearInterval.bind(globalThis),Il=1,ss=class{constructor(e,r,n,s,i){m(this,"loop");m(this,"_onTimeout");m(this,"_idleTimeout");m(this,"args");m(this,"_repeat");m(this,"_id",Il++);m(this,"_ref",!0);m(this,"_handle");m(this,"_destroyed",!1);this.loop=e,this._onTimeout=r,this._idleTimeout=n,this.args=s,this._repeat=i}ref(){return!this._ref&&!this._destroyed&&this.loop._refChanged(this,!0),this._ref=!0,this}unref(){return this._ref&&!this._destroyed&&this.loop._refChanged(this,!1),this._ref=!1,this}hasRef(){return this._ref}refresh(){return this._destroyed||this.loop._arm(this),this}close(){return this.loop.clear(this),this}[Symbol.toPrimitive](){return this._id}_fire(){this.loop._run(()=>this._onTimeout(...this.args))}},Lr=class{constructor(e){m(this,"options");m(this,"holds",0);m(this,"timers",new Map);m(this,"refTimers",0);m(this,"checkScheduled",!1);m(this,"stopped",!1);m(this,"setTimeout",(e,r,...n)=>this.add(e,r,n,!1));m(this,"setInterval",(e,r,...n)=>this.add(e,r,n,!0));m(this,"setImmediate",(e,...r)=>this.add(e,0,r,!1));m(this,"clearTimeout",e=>this.clear(e));m(this,"clearInterval",e=>this.clear(e));m(this,"clearImmediate",e=>this.clear(e));this.options=e}hold(){if(this.stopped)return()=>{};this.holds++;let e=!1;return()=>{e||(e=!0,this.holds--,this.scheduleCheck())}}_run(e){if(!this.stopped)try{e()}catch(r){this.options.onError(r)}}get alive(){return this.holds>0||this.refTimers>0}clear(e){let r=typeof e=="object"&&e?e._id:Number(e),n=this.timers.get(r);n&&(this.disarm(n),this.timers.delete(r),n._destroyed=!0,n._ref&&(this.refTimers--,this.scheduleCheck()))}scheduleCheck(){this.checkScheduled||this.stopped||(this.checkScheduled=!0,ns(()=>{ns(()=>{this.checkScheduled=!1,!this.alive&&!this.stopped&&this.options.onIdle()},0)},0))}stop(){this.stopped=!0;for(let e of this.timers.values())this.disarm(e);this.timers.clear()}_refChanged(e,r){this.refTimers+=r?1:-1,r||this.scheduleCheck()}_arm(e){this.disarm(e);let r=Math.max(0,e._idleTimeout);e._repeat?e._handle=Sl(()=>e._fire(),Math.max(1,r)):e._handle=ns(()=>{this.timers.delete(e._id),e._destroyed=!0,e._ref&&this.refTimers--,e._fire(),e._ref&&this.scheduleCheck()},r)}add(e,r,n,s){if(typeof e!="function")throw new TypeError('The "callback" argument must be of type function');let i=new ss(this,e,Number.isFinite(r)?Number(r):1,n,s);return this.stopped||(this.timers.set(i._id,i),this.refTimers++,this._arm(i)),i}disarm(e){e._handle!==void 0&&(e._repeat?Bl(e._handle):vl(e._handle),e._handle=void 0)}};var vt="20.18.0";var Ql=100,Fr=class extends ie{constructor(r,n,s){super({decodeStrings:!1});m(this,"sink");m(this,"isTTY");m(this,"fd");m(this,"columns");m(this,"rows");this.sink=n,this.fd=r,this.isTTY=!!s,s&&(this.columns=s.cols,this.rows=s.rows,s.onResize((i,o)=>{this.columns=i,this.rows=o,this.emit("resize")}))}_write(r,n,s){this.sink(r),s()}write(r,n,s){return typeof n=="function"&&(s=n),this.sink(typeof r=="string"||r instanceof Uint8Array?r:String(r)),typeof s=="function"&&T(s),!0}getColorDepth(){return this.isTTY?8:1}hasColors(r=16){return this.isTTY&&r<=256}getWindowSize(){return[this.columns??80,this.rows??24]}cursorTo(r,n,s){return this.write(typeof n=="number"?`\x1B[${n+1};${r+1}H`:`\x1B[${r+1}G`),(typeof n=="function"?n:s)?.(),!0}moveCursor(r,n,s){return this.write((r<0?`\x1B[${-r}D`:r>0?`\x1B[${r}C`:"")+(n<0?`\x1B[${-n}A`:n>0?`\x1B[${n}B`:"")),s?.(),!0}clearLine(r=0,n){return this.write(r<0?"\x1B[1K":r>0?"\x1B[0K":"\x1B[2K"),n?.(),!0}clearScreenDown(r){return this.write("\x1B[0J"),r?.(),!0}},is=class extends X{constructor(r,n){super();m(this,"io");m(this,"loop");m(this,"isTTY");m(this,"isRaw",!1);m(this,"fd",0);m(this,"subscription");m(this,"release");this.io=r,this.loop=n,this.isTTY=!!r.terminal}_read(){this.listen()}resume(){return this.listen(),super.resume()}pause(){return this.stopListening(),super.pause()}setRawMode(r){return this.isRaw=r,this.io.terminal?.setRawMode(r),this}ref(){return this.subscription&&!this.release&&(this.release=this.loop.hold()),this}unref(){return this.release?.(),this.release=void 0,this}listen(){this.subscription||(this.release=this.loop.hold(),this.subscription=this.io.onStdin(r=>{r===null?(this.stopListening(),this.push(null)):this.push(D.from(typeof r=="string"?new TextEncoder().encode(r):r))}))}stopListening(){this.subscription?.(),this.subscription=void 0,this.release?.(),this.release=void 0}};function Fo(t){let{io:e,loop:r,fs:n}=t,s=O(t.cwd),i=!1,o=!1,a=performance.now(),c=new F,u=Ql++,f=h=>{if(!o){if(h!==void 0&&(c.exitCode=h),!i){i=!0;let p=Number(c.exitCode??0)||0;try{c.emit("exit",p)}catch{}o=!0,t.onExit(Number(c.exitCode??p)||0)}throw new He(Number(c.exitCode??0)||0)}},l=h=>{let p=performance.now(),y=Math.floor(p/1e3),b=Math.floor(p%1e3*1e6);return h&&(y-=h[0],b-=h[1],b<0&&(y--,b+=1e9)),[y,b]};l.bigint=()=>BigInt(Math.floor(performance.now()*1e6));let d=()=>({rss:5e7,heapTotal:3e7,heapUsed:2e7,external:1e6,arrayBuffers:1e5});return d.rss=()=>5e7,Object.assign(c,{title:"node",version:`v${vt}`,versions:{node:vt,v8:"11.3.244.8-node.23",uv:"1.48.0",zlib:"1.3.0.1",modules:"115",napi:"9",unicode:"15.1",webcontainer:vt},release:{name:"node",lts:"Iron"},platform:"linux",arch:"x64",pid:u,ppid:u-1,argv:t.argv,argv0:"node",execPath:"/usr/local/bin/node",execArgv:[],env:t.env,exitCode:void 0,config:{variables:{}},features:{inspector:!1,ipv6:!0,tls:!0,typescript:!1},allowedNodeEnvironmentFlags:new Set,stdout:new Fr(1,e.stdout,e.terminal),stderr:new Fr(2,e.stderr,e.terminal),stdin:new is(e,r),cwd:()=>s,chdir(h){let p=h.startsWith("/")?O(h):k(s,h);if(!n.isDirectory(p))throw R(n.isFile(p)?"ENOTDIR":"ENOENT","chdir",p);s=p},exit:f,reallyExit:f,abort:()=>f(134),kill(h,p="SIGTERM"){if(h!==u)throw Object.assign(new Error("kill ESRCH"),{code:"ESRCH"});return c.listenerCount(String(p))?c.emit(String(p),String(p)):f(143),!0},nextTick(h,...p){queueMicrotask(()=>r._run(()=>h(...p)))},hrtime:l,memoryUsage:d,cpuUsage:()=>({user:Math.floor((performance.now()-a)*1e3),system:0}),resourceUsage:()=>({userCPUTime:0,systemCPUTime:0,maxRSS:5e4}),uptime:()=>(performance.now()-a)/1e3,umask:()=>18,getuid:()=>1e3,geteuid:()=>1e3,getgid:()=>1e3,getegid:()=>1e3,getgroups:()=>[1e3],emitWarning(h,p){let y=typeof p=="string"?p:p?.type??(h instanceof Error?h.name:"Warning"),b=h instanceof Error?h.message:h;c.emit("warning",Object.assign(new Error(b),{name:y})),e.stderr(`(node:${u}) ${y}: ${b}
36
+ `)},binding(h){throw new Error(`No such module: ${h}`)},getActiveResourcesInfo:()=>[],setUncaughtExceptionCaptureCallback:()=>{},hasUncaughtExceptionCaptureCallback:()=>!1,setSourceMapsEnabled:()=>{},report:{getReport:()=>({header:{glibcVersionRuntime:"2.36"}})},connected:!1}),c}function Mo(t){let e=c=>(...u)=>t[c].write(Oe(...u)+`
37
37
  `),r=new Map,n=new Map,s="",i=c=>(...u)=>s?c(s+Oe(...u).replace(/\n/g,`
38
38
  `+s)):c(...u),o=i(e("stdout")),a=i(e("stderr"));return{log:o,info:o,debug:o,warn:a,error:a,trace:(...c)=>a(`Trace: ${Oe(...c)}
39
39
  ${new Error().stack?.split(`
40
40
  `).slice(2).join(`
41
- `)??""}`),dir:c=>o(c),dirxml:o,table:c=>o(c),assert:(c,...u)=>{c||a("Assertion failed"+(u.length?`: ${Oe(...u)}`:""))},count:(c="default")=>{r.set(c,(r.get(c)??0)+1),o(`${c}: ${r.get(c)}`)},countReset:(c="default")=>void r.delete(c),group:(...c)=>{c.length&&o(...c),s+=" "},groupCollapsed:(...c)=>{c.length&&o(...c),s+=" "},groupEnd:()=>void(s=s.slice(2)),time:(c="default")=>void n.set(c,performance.now()),timeLog:(c="default",...u)=>o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`,...u),timeEnd:(c="default")=>{o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`),n.delete(c)},clear:()=>{},profile:()=>{},profileEnd:()=>{},timeStamp:()=>{}}}function Mo(t,e){if(Ql(globalThis,["crypto","performance","navigator"]),e){Object.assign(globalThis,t,{global:globalThis}),t.global=t.globalThis=globalThis;return}let r=Object.assign(Object.create(globalThis),t),n=new Proxy(r,{get:(o,a)=>Object.hasOwn(o,a)?o[a]:Reflect.get(globalThis,a),set:(o,a,c)=>Reflect.defineProperty(o,a,{value:c,writable:!0,enumerable:!0,configurable:!0}),defineProperty:(o,a,c)=>Reflect.defineProperty(o,a,Object.hasOwn(o,a)||"value"in c||c.get||c.set?c:{value:Reflect.get(globalThis,a),...c})}),s=new Proxy(n,{has:(o,a)=>typeof a=="string"&&Object.hasOwn(r,a),get:(o,a)=>a===Symbol.unscopables?void 0:Reflect.get(o,a)}),i=Il(s);return r.global=r.globalThis=n,r.Function=i,t.global=t.globalThis=n,t.Function=i,s}function Il(t){let e=r=>{let n=r.slice(0,-1).map(String).join(", "),s=r.length?String(r[r.length-1]):"";return new Function("__bfwc_scope",`with (__bfwc_scope) { return function anonymous(${n}
41
+ `)??""}`),dir:c=>o(c),dirxml:o,table:c=>o(c),assert:(c,...u)=>{c||a("Assertion failed"+(u.length?`: ${Oe(...u)}`:""))},count:(c="default")=>{r.set(c,(r.get(c)??0)+1),o(`${c}: ${r.get(c)}`)},countReset:(c="default")=>void r.delete(c),group:(...c)=>{c.length&&o(...c),s+=" "},groupCollapsed:(...c)=>{c.length&&o(...c),s+=" "},groupEnd:()=>void(s=s.slice(2)),time:(c="default")=>void n.set(c,performance.now()),timeLog:(c="default",...u)=>o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`,...u),timeEnd:(c="default")=>{o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`),n.delete(c)},clear:()=>{},profile:()=>{},profileEnd:()=>{},timeStamp:()=>{}}}function $o(t,e){if(xl(globalThis,["crypto","performance","navigator"]),e){Object.assign(globalThis,t,{global:globalThis}),t.global=t.globalThis=globalThis;return}let r=Object.assign(Object.create(globalThis),t),n=new Proxy(r,{get:(o,a)=>Object.hasOwn(o,a)?o[a]:Reflect.get(globalThis,a),set:(o,a,c)=>Reflect.defineProperty(o,a,{value:c,writable:!0,enumerable:!0,configurable:!0}),defineProperty:(o,a,c)=>Reflect.defineProperty(o,a,Object.hasOwn(o,a)||"value"in c||c.get||c.set?c:{value:Reflect.get(globalThis,a),...c})}),s=new Proxy(n,{has:(o,a)=>typeof a=="string"&&Object.hasOwn(r,a),get:(o,a)=>a===Symbol.unscopables?void 0:Reflect.get(o,a)}),i=kl(s);return r.global=r.globalThis=n,r.Function=i,t.global=t.globalThis=n,t.Function=i,s}function kl(t){let e=r=>{let n=r.slice(0,-1).map(String).join(", "),s=r.length?String(r[r.length-1]):"";return new Function("__bfwc_scope",`with (__bfwc_scope) { return function anonymous(${n}
42
42
  ) {
43
43
  ${s}
44
- }; }`)(t)};return new Proxy(Function,{apply:(r,n,s)=>e(s),construct:(r,n)=>e(n)})}function Ql(t,e){for(let r of e){let n=t,s;for(;n&&!(s=Object.getOwnPropertyDescriptor(n,r));)n=Object.getPrototypeOf(n);if(!(!s||s.set||"value"in s))try{Object.defineProperty(t,r,{value:Reflect.get(t,r),writable:!0,enumerable:!0,configurable:!0})}catch{}}}var kl={SIGINT:130,SIGTERM:143,SIGKILL:137,SIGHUP:129};async function Fo(t){await So;let{system:e}=t,r={...t.io,stdout:A=>i||t.io.stdout(A),stderr:A=>i||t.io.stderr(A)},n,s=new Promise(A=>n=A),i=!1,o=new Set,a={...e,listen(A,g,w){let S=e.listen(A,g,w),I={port:S.port,close(){o.delete(I),S.close()}};return o.add(I),I}},c=A=>{if(!i){i=!0,l.stop();for(let g of[...o])g.close();n(A)}},u=A=>{if(!(A instanceof He||i)){if(d.listenerCount("uncaughtException"))try{d.emit("uncaughtException",A,"uncaughtException");return}catch(g){A=g}if(t.thread&&t.ipc?.connected)t.ipc.send(ki(A));else{let g=A instanceof Error?A.stack??`${A.name}: ${A.message}`:`Uncaught ${V(A)}`;r.stderr(`${g}
44
+ }; }`)(t)};return new Proxy(Function,{apply:(r,n,s)=>e(s),construct:(r,n)=>e(n)})}function xl(t,e){for(let r of e){let n=t,s;for(;n&&!(s=Object.getOwnPropertyDescriptor(n,r));)n=Object.getPrototypeOf(n);if(!(!s||s.set||"value"in s))try{Object.defineProperty(t,r,{value:Reflect.get(t,r),writable:!0,enumerable:!0,configurable:!0})}catch{}}}var _l={SIGINT:130,SIGTERM:143,SIGKILL:137,SIGHUP:129};async function Uo(t){await Io;let{system:e}=t,r={...t.io,stdout:A=>i||t.io.stdout(A),stderr:A=>i||t.io.stderr(A)},n,s=new Promise(A=>n=A),i=!1,o=new Set,a={...e,listen(A,g,w){let S=e.listen(A,g,w),I={port:S.port,close(){o.delete(I),S.close()}};return o.add(I),I}},c=A=>{if(!i){i=!0,l.stop();for(let g of[...o])g.close();n(A)}},u=A=>{if(!(A instanceof He||i)){if(d.listenerCount("uncaughtException"))try{d.emit("uncaughtException",A,"uncaughtException");return}catch(g){A=g}if(t.thread&&t.ipc?.connected)t.ipc.send(_i(A));else{let g=A instanceof Error?A.stack??`${A.name}: ${A.message}`:`Uncaught ${V(A)}`;r.stderr(`${g}
45
45
 
46
46
  Node.js v${d.versions.node}
47
- `)}f(d.exitCode&&d.exitCode!==0?d.exitCode:1)}},f=A=>{try{d.exit(A)}catch(g){if(!(g instanceof He))throw g}},l=new Lr({onIdle(){if(!i){try{d.emit("beforeExit",Number(d.exitCode??0))}catch(A){u(A)}l.alive||f()}},onError:u}),d=To({argv:["/usr/local/bin/node",...t.argv],env:t.env,cwd:t.cwd,fs:e.fs,io:r,loop:l,onExit:c});t.ipc&&!t.thread&&vi(d,t.ipc,l);let h=Lo(d),p=bo({fs:e.fs,process:d,loop:l,system:a,io:r,console:h,thread:t.thread,ipc:t.ipc}),y={process:d,Buffer:D,console:h,setTimeout:l.setTimeout,setInterval:l.setInterval,setImmediate:l.setImmediate,clearTimeout:l.clearTimeout,clearInterval:l.clearInterval,clearImmediate:l.clearImmediate,fetch:p.fetch},b=Mo(y,!!t.installGlobals),E=Ro({fs:e.fs,isBuiltin:p.isBuiltin,builtin:p.get,globals:y,scope:b});return E.Module.builtinModules=p.names,Object.defineProperty(d,"mainModule",{get:()=>E.main,configurable:!0}),{process:d,modules:E,exit:s,run:A=>{if(!i){try{let g=A();g instanceof Promise&&g.catch(u).finally(()=>l.scheduleCheck())}catch(g){u(g)}l.scheduleCheck()}},kill(A="SIGTERM"){if(!i){if(A!=="SIGKILL"&&d.listenerCount(A)){l._run(()=>d.emit(A,A));return}c(kl[A]??1)}},reportUncaught:u,hold:()=>l.hold()}}var xl=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--input-type","--title","--env-file","--stack-size"]);function _l(t){let e={args:[],preload:[],envFiles:[]};for(let r=0;r<t.length;r++){let n=t[r];if(n==="--"){[e.entry,...e.args]=t.slice(r+1);break}if(!n.startsWith("-")||n==="-"){e.entry=n,e.args=t.slice(r+1);break}let[s,i]=n.includes("=")?[n.slice(0,n.indexOf("=")),n.slice(n.indexOf("=")+1)]:[n,void 0],o=()=>i??t[++r]??"";s==="-v"||s==="--version"?e.version=!0:s==="-h"||s==="--help"?e.help=!0:s==="-e"||s==="--eval"?e.evaluate=o():s==="-p"||s==="--print"?(e.evaluate=o(),e.print=!0):s==="-r"||s==="--require"||s==="--import"?e.preload.push(o()):s==="--env-file"?e.envFiles.push(o()):xl.has(s)&&i===void 0&&r++}return e.evaluate!==void 0&&e.entry!==void 0&&(e.args=[e.entry,...e.args],e.entry=void 0),e}var Dl=`Usage: node [options] [ script.js ] [arguments]
47
+ `)}f(d.exitCode&&d.exitCode!==0?d.exitCode:1)}},f=A=>{try{d.exit(A)}catch(g){if(!(g instanceof He))throw g}},l=new Lr({onIdle(){if(!i){try{d.emit("beforeExit",Number(d.exitCode??0))}catch(A){u(A)}l.alive||f()}},onError:u}),d=Fo({argv:["/usr/local/bin/node",...t.argv],env:t.env,cwd:t.cwd,fs:e.fs,io:r,loop:l,onExit:c});t.ipc&&!t.thread&&Bi(d,t.ipc,l);let h=Mo(d),p=vo({fs:e.fs,process:d,loop:l,system:a,io:r,console:h,thread:t.thread,ipc:t.ipc}),y={process:d,Buffer:D,console:h,setTimeout:l.setTimeout,setInterval:l.setInterval,setImmediate:l.setImmediate,clearTimeout:l.clearTimeout,clearInterval:l.clearInterval,clearImmediate:l.clearImmediate,fetch:p.fetch},b=$o(y,!!t.installGlobals),E=Lo({fs:e.fs,isBuiltin:p.isBuiltin,builtin:p.get,globals:y,scope:b});return E.Module.builtinModules=p.names,Object.defineProperty(d,"mainModule",{get:()=>E.main,configurable:!0}),{process:d,modules:E,exit:s,run:A=>{if(!i){try{let g=A();g instanceof Promise&&g.catch(u).finally(()=>l.scheduleCheck())}catch(g){u(g)}l.scheduleCheck()}},kill(A="SIGTERM"){if(!i){if(A!=="SIGKILL"&&d.listenerCount(A)){l._run(()=>d.emit(A,A));return}c(_l[A]??1)}},reportUncaught:u,hold:()=>l.hold()}}var Dl=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--input-type","--title","--env-file","--stack-size"]);function Ol(t){let e={args:[],preload:[],envFiles:[]};for(let r=0;r<t.length;r++){let n=t[r];if(n==="--"){[e.entry,...e.args]=t.slice(r+1);break}if(!n.startsWith("-")||n==="-"){e.entry=n,e.args=t.slice(r+1);break}let[s,i]=n.includes("=")?[n.slice(0,n.indexOf("=")),n.slice(n.indexOf("=")+1)]:[n,void 0],o=()=>i??t[++r]??"";s==="-v"||s==="--version"?e.version=!0:s==="-h"||s==="--help"?e.help=!0:s==="-e"||s==="--eval"?e.evaluate=o():s==="-p"||s==="--print"?(e.evaluate=o(),e.print=!0):s==="-r"||s==="--require"||s==="--import"?e.preload.push(o()):s==="--env-file"?e.envFiles.push(o()):Dl.has(s)&&i===void 0&&r++}return e.evaluate!==void 0&&e.entry!==void 0&&(e.args=[e.entry,...e.args],e.entry=void 0),e}var Nl=`Usage: node [options] [ script.js ] [arguments]
48
48
  node -e "script" evaluate script
49
49
  node -p "expr" evaluate and print
50
50
  Options: -v, -r <module>, --env-file=<file>. Running in BuilderForce WebContainers.
51
- `;async function Ol(t){let e="";return await new Promise(r=>{let n=t.io.onStdin(ae(s=>{s===null?(n(),r()):e+=s}))}),e}function Nl(t,e){let{io:r}=e,n=$o(t,e.cwd,"[repl]","(function* () { let __r; while (true) { const __line = yield __r; try { __r = { value: eval(__line) }; } catch (e) { __r = { error: e }; } } })()");n.next();let s=t.hold();r.stdout(`Welcome to Node.js v${Ct}.
51
+ `;async function Rl(t){let e="";return await new Promise(r=>{let n=t.io.onStdin(ae(s=>{s===null?(n(),r()):e+=s}))}),e}function Tl(t,e){let{io:r}=e,n=Po(t,e.cwd,"[repl]","(function* () { let __r; while (true) { const __line = yield __r; try { __r = { value: eval(__line) }; } catch (e) { __r = { error: e }; } } })()");n.next();let s=t.hold();r.stdout(`Welcome to Node.js v${vt}.
52
52
  Type ".exit" to leave.
53
53
  > `);let i=()=>{o(),s(),t.run(()=>t.process.exit(0))},o=r.onStdin(ae(a=>{if(a===null)return i();for(let c of a.split(/\r?\n/)){let u=c.trim();if(!u)continue;if(u===".exit")return i();let f=n.next(u.replace(/^(const|let)\s/,"var ")).value;"error"in f?r.stdout(`Uncaught ${f.error instanceof Error?f.error.stack??f.error.message:V(f.error)}
54
54
  `):r.stdout(V(f.value,{colors:!1})+`
55
- `)}r.stdout("> ")}))}function $o(t,e,r,n){let s=k(e,r);return new t.modules.Module(s)._compile(`return eval(${JSON.stringify(n)});`,s)}var Uo=async t=>{let e=_l(t.args);if(e.version)return t.io.stdout(`v${Ct}
56
- `),0;if(e.help)return t.io.stdout(Dl),0;let r={...t.env};for(let f of e.envFiles){let l=t.system.fs.readText(k(t.cwd,f));if(l===void 0)return t.io.stderr(`node: ${f}: not found
57
- `),9;Object.assign(r,Ls(l))}let n;e.entry!==void 0&&e.entry!=="-"&&(n=e.entry.startsWith("/")?e.entry:k(t.cwd,e.entry),n=ir(t.system.fs,n)??n);let s=e.evaluate??(e.entry==="-"||!n&&!t.io.terminal?await Ol(t):void 0),i=n??(s!==void 0?"[eval]":void 0),o=await Fo({system:t.system,io:t.io,cwd:t.cwd,env:r,installGlobals:t.system.ownsRealm,ipc:t.ipc,thread:t.thread,argv:i&&i!=="[eval]"?[i,...e.args]:e.args}),a=()=>o.kill(typeof t.signal.reason=="string"?t.signal.reason:"SIGTERM");t.signal.aborted&&a(),t.signal.addEventListener("abort",a);let c=t.system.trapUncaught?.(f=>o.reportUncaught(f));o.run(()=>{let f=o.modules.createRequire(k(t.cwd,"[eval]"));for(let l of e.preload)f(l.startsWith(".")?k(t.cwd,l):l);if(n){let l;try{l=o.modules.Module._resolveFilename(n,void 0)}catch(d){throw d.code==="MODULE_NOT_FOUND"?Object.assign(new Error(`Cannot find module '${n}'`),{code:"MODULE_NOT_FOUND",requireStack:[]}):d}return o.modules.runMain(l).__tla}if(s!==void 0){let l=$o(o,t.cwd,"[eval]",s);e.print&&o.process.stdout.write(V(l)+`
58
- `);return}Nl(o,t)});let u=await o.exit;return t.signal.removeEventListener("abort",a),c?.(),u};var H=class extends Error{constructor(r,n=!1){super(r);m(this,"incomplete");this.incomplete=n}},Rl=["2>&1",">&2","2>>","<<-","&&","||",";;",">>","<<","2>","&>","|","&",";",">","<","(",")",`
59
- `],Tl=/^[?$#@*!0-9]/,Ll=/[;|&<>()]/;function Ml(t,e){let r=1;for(let n=e;n<t.length;n++){let s=t[n];if(s==="\\")n++;else if(s==="'")n=t.indexOf("'",n+1)<0?t.length:t.indexOf("'",n+1);else if(s==='"')for(n++;n<t.length&&t[n]!=='"';n++)t[n]==="\\"&&n++;else if(s==="(")r++;else if(s===")"&&--r===0)return n}throw new H("unexpected end of input: missing )",!0)}function is(t,e,r){let n=t[e+1];if(n==="("){let i=Ml(t,e+2);return[{kind:"cmd",source:t.slice(e+2,i),quoted:r},i+1]}if(n==="{"){let i=t.indexOf("}",e+2);if(i<0)throw new H("unexpected end of input: missing }",!0);let o=t.slice(e+2,i),a=/^([A-Za-z_][\w]*|[?$#@*!0-9])(?:(:-|-|:=|:\+)(.*))?$/s.exec(o);if(!a)throw new H(`bad substitution: \${${o}}`);let c={kind:"var",name:a[1],quoted:r};return a[2]&&(c.op=a[2],c.arg=Fl(a[3]??"",r)),[c,i+1]}if(n&&Tl.test(n))return[{kind:"var",name:n,quoted:r},e+2];let s=/^[A-Za-z_]\w*/.exec(t.slice(e+1));return s?[{kind:"var",name:s[0],quoted:r},e+1+s[0].length]:[{kind:"text",value:"$",quoted:r},e+1]}function Fl(t,e){let r=Fr(t,!0),n=[];for(let s of r)s.type==="word"&&n.push(...s.word.map(i=>i.kind==="tilde"?i:{...i,quoted:e||"quoted"in i&&i.quoted}));return n}function $l(t){let e=[],r="",n=()=>{r&&e.push({kind:"text",value:r,quoted:!0}),r=""};for(let s=0;s<t.length;){let i=t[s];if(i==="\\"&&/[$`\\\n]/.test(t[s+1]??""))t[s+1]!==`
60
- `&&(r+=t[s+1]),s+=2;else if(i==="$"){n();let[o,a]=is(t,s,!0);e.push(o),s=a}else if(i==="`"){n();let o=t.indexOf("`",s+1);if(o<0)throw new H("unterminated ` in here-document");e.push({kind:"cmd",source:t.slice(s+1,o),quoted:!0}),s=o+1}else r+=i,s++}return n(),e.length?e:[{kind:"text",value:"",quoted:!0}]}function Ul(t,e,r){for(let n of r){let s=[];for(;;){if(e>=t.length)throw new H(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);let o=t.indexOf(`
55
+ `)}r.stdout("> ")}))}function Po(t,e,r,n){let s=k(e,r);return new t.modules.Module(s)._compile(`return eval(${JSON.stringify(n)});`,s)}var jo=async t=>{let e=Ol(t.args);if(e.version)return t.io.stdout(`v${vt}
56
+ `),0;if(e.help)return t.io.stdout(Nl),0;let r={...t.env};for(let f of e.envFiles){let l=t.system.fs.readText(k(t.cwd,f));if(l===void 0)return t.io.stderr(`node: ${f}: not found
57
+ `),9;Object.assign(r,Ms(l))}let n;e.entry!==void 0&&e.entry!=="-"&&(n=e.entry.startsWith("/")?e.entry:k(t.cwd,e.entry),n=ir(t.system.fs,n)??n);let s=e.evaluate??(e.entry==="-"||!n&&!t.io.terminal?await Rl(t):void 0),i=n??(s!==void 0?"[eval]":void 0),o=await Uo({system:t.system,io:t.io,cwd:t.cwd,env:r,installGlobals:t.system.ownsRealm,ipc:t.ipc,thread:t.thread,argv:i&&i!=="[eval]"?[i,...e.args]:e.args}),a=()=>o.kill(typeof t.signal.reason=="string"?t.signal.reason:"SIGTERM");t.signal.aborted&&a(),t.signal.addEventListener("abort",a);let c=t.system.trapUncaught?.(f=>o.reportUncaught(f));o.run(()=>{let f=o.modules.createRequire(k(t.cwd,"[eval]"));for(let l of e.preload)f(l.startsWith(".")?k(t.cwd,l):l);if(n){let l;try{l=o.modules.Module._resolveFilename(n,void 0)}catch(d){throw d.code==="MODULE_NOT_FOUND"?Object.assign(new Error(`Cannot find module '${n}'`),{code:"MODULE_NOT_FOUND",requireStack:[]}):d}return o.modules.runMain(l).__tla}if(s!==void 0){let l=Po(o,t.cwd,"[eval]",s);e.print&&o.process.stdout.write(V(l)+`
58
+ `);return}Tl(o,t)});let u=await o.exit;return t.signal.removeEventListener("abort",a),c?.(),u};var H=class extends Error{constructor(r,n=!1){super(r);m(this,"incomplete");this.incomplete=n}},Ll=["2>&1",">&2","2>>","<<-","&&","||",";;",">>","<<","2>","&>","|","&",";",">","<","(",")",`
59
+ `],Fl=/^[?$#@*!0-9]/,Ml=/[;|&<>()]/;function $l(t,e){let r=1;for(let n=e;n<t.length;n++){let s=t[n];if(s==="\\")n++;else if(s==="'")n=t.indexOf("'",n+1)<0?t.length:t.indexOf("'",n+1);else if(s==='"')for(n++;n<t.length&&t[n]!=='"';n++)t[n]==="\\"&&n++;else if(s==="(")r++;else if(s===")"&&--r===0)return n}throw new H("unexpected end of input: missing )",!0)}function os(t,e,r){let n=t[e+1];if(n==="("){let i=$l(t,e+2);return[{kind:"cmd",source:t.slice(e+2,i),quoted:r},i+1]}if(n==="{"){let i=t.indexOf("}",e+2);if(i<0)throw new H("unexpected end of input: missing }",!0);let o=t.slice(e+2,i),a=/^([A-Za-z_][\w]*|[?$#@*!0-9])(?:(:-|-|:=|:\+)(.*))?$/s.exec(o);if(!a)throw new H(`bad substitution: \${${o}}`);let c={kind:"var",name:a[1],quoted:r};return a[2]&&(c.op=a[2],c.arg=Ul(a[3]??"",r)),[c,i+1]}if(n&&Fl.test(n))return[{kind:"var",name:n,quoted:r},e+2];let s=/^[A-Za-z_]\w*/.exec(t.slice(e+1));return s?[{kind:"var",name:s[0],quoted:r},e+1+s[0].length]:[{kind:"text",value:"$",quoted:r},e+1]}function Ul(t,e){let r=Mr(t,!0),n=[];for(let s of r)s.type==="word"&&n.push(...s.word.map(i=>i.kind==="tilde"?i:{...i,quoted:e||"quoted"in i&&i.quoted}));return n}function Pl(t){let e=[],r="",n=()=>{r&&e.push({kind:"text",value:r,quoted:!0}),r=""};for(let s=0;s<t.length;){let i=t[s];if(i==="\\"&&/[$`\\\n]/.test(t[s+1]??""))t[s+1]!==`
60
+ `&&(r+=t[s+1]),s+=2;else if(i==="$"){n();let[o,a]=os(t,s,!0);e.push(o),s=a}else if(i==="`"){n();let o=t.indexOf("`",s+1);if(o<0)throw new H("unterminated ` in here-document");e.push({kind:"cmd",source:t.slice(s+1,o),quoted:!0}),s=o+1}else r+=i,s++}return n(),e.length?e:[{kind:"text",value:"",quoted:!0}]}function jl(t,e,r){for(let n of r){let s=[];for(;;){if(e>=t.length)throw new H(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);let o=t.indexOf(`
61
61
  `,e),a=t.slice(e,o<0?t.length:o).replace(/\r$/,"");if(e=o<0?t.length:o+1,n.strip&&(a=a.replace(/^\t+/,"")),a===n.delimiter)break;if(o<0)throw new H(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);s.push(a)}let i=s.map(o=>o+`
62
- `).join("");n.token.body=n.quoted?[{kind:"text",value:i,quoted:!0}]:$l(i)}return r.length=0,e}function Fr(t,e=!1){let r=[],n=[],s=0;for(;s<t.length;){let i=t[s];if(i===" "||i===" "||i==="\r"){s++;continue}if(i==="\\"&&t[s+1]===`
62
+ `).join("");n.token.body=n.quoted?[{kind:"text",value:i,quoted:!0}]:Pl(i)}return r.length=0,e}function Mr(t,e=!1){let r=[],n=[],s=0;for(;s<t.length;){let i=t[s];if(i===" "||i===" "||i==="\r"){s++;continue}if(i==="\\"&&t[s+1]===`
63
63
  `){s+=2;continue}if(i==="#"){for(;s<t.length&&t[s]!==`
64
- `;)s++;continue}if(!e){let f=Rl.find(l=>t.startsWith(l,s));if(f){if(r.push({type:"op",op:f}),s+=f.length,f===`
65
- `&&n.length&&(s=Ul(t,s,n)),f==="<<"||f==="<<-"){for(;t[s]===" "||t[s]===" ";)s++;let l=s;for(;s<t.length&&!/[\s;|&<>()]/.test(t[s]);)s++;let d=t.slice(l,s);if(!d)throw new H("syntax error: here-document needs a delimiter");let h={type:"heredoc"};r.push(h),n.push({token:h,delimiter:d.replace(/["'\\]/g,""),strip:f==="<<-",quoted:/["'\\]/.test(d)})}continue}}let o=[],a=s,c="",u=()=>{c&&o.push({kind:"text",value:c,quoted:!1}),c=""};for(t[s]==="~"&&(s+1>=t.length||/[\s/;|&<>()]/.test(t[s+1]))&&(o.push({kind:"tilde"}),s++);s<t.length;){let f=t[s];if(/[\s]/.test(f)&&!e||!e&&Ll.test(f))break;if(f==="\\")c+=t[s+1]??"",s+=2;else if(f==="'"){let l=t.indexOf("'",s+1);if(l<0)throw new H("unexpected end of input: unterminated quote",!0);u(),o.push({kind:"text",value:t.slice(s+1,l),quoted:!0}),s=l+1}else if(f==='"'){u(),s++;let l="",d=()=>{l&&o.push({kind:"text",value:l,quoted:!0}),l=""},h=!1;for(;s<t.length;){let p=t[s];if(p==='"'){h=!0,s++;break}if(p==="\\"&&/["\\$`\n]/.test(t[s+1]??""))l+=t[s+1],s+=2;else if(p==="$"){d();let[y,b]=is(t,s,!0);o.push(y),s=b}else if(p==="`"){d();let y=t.indexOf("`",s+1);if(y<0)throw new H("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,y),quoted:!0}),s=y+1}else l+=p,s++}if(!h)throw new H("unexpected end of input: unterminated quote",!0);d(),(!o.length||o[o.length-1].kind!=="text")&&o.push({kind:"text",value:"",quoted:!0})}else if(f==="$"){u();let[l,d]=is(t,s,!1);o.push(l),s=d}else if(f==="`"){u();let l=t.indexOf("`",s+1);if(l<0)throw new H("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,l),quoted:!1}),s=l+1}else c+=f,s++}u(),r.push({type:"word",word:o,raw:t.slice(a,s)})}if(n.length)throw new H(`unexpected end of input: here-document delimited by ${n[0].delimiter}`,!0);return r}var Pl=/^([A-Za-z_]\w*)=/,Po=/^[A-Za-z_][\w-]*$/,jo=new Set([">",">>","<","2>","2>>","&>","2>&1",">&2","<<","<<-"]),jl=new Set(["then","elif","else","fi","do","done","esac","}"]);function $r(t){let e=Fr(t),r=0,n=()=>e[r],s=v=>{let B=e[r];return B?.type==="op"&&B.op===v},i=(v,B=r)=>{let Q=e[B];return Q?.type==="word"&&Q.raw===v},o=v=>v?v.type==="op"?`\`${v.op.replace(`
64
+ `;)s++;continue}if(!e){let f=Ll.find(l=>t.startsWith(l,s));if(f){if(r.push({type:"op",op:f}),s+=f.length,f===`
65
+ `&&n.length&&(s=jl(t,s,n)),f==="<<"||f==="<<-"){for(;t[s]===" "||t[s]===" ";)s++;let l=s;for(;s<t.length&&!/[\s;|&<>()]/.test(t[s]);)s++;let d=t.slice(l,s);if(!d)throw new H("syntax error: here-document needs a delimiter");let h={type:"heredoc"};r.push(h),n.push({token:h,delimiter:d.replace(/["'\\]/g,""),strip:f==="<<-",quoted:/["'\\]/.test(d)})}continue}}let o=[],a=s,c="",u=()=>{c&&o.push({kind:"text",value:c,quoted:!1}),c=""};for(t[s]==="~"&&(s+1>=t.length||/[\s/;|&<>()]/.test(t[s+1]))&&(o.push({kind:"tilde"}),s++);s<t.length;){let f=t[s];if(/[\s]/.test(f)&&!e||!e&&Ml.test(f))break;if(f==="\\")c+=t[s+1]??"",s+=2;else if(f==="'"){let l=t.indexOf("'",s+1);if(l<0)throw new H("unexpected end of input: unterminated quote",!0);u(),o.push({kind:"text",value:t.slice(s+1,l),quoted:!0}),s=l+1}else if(f==='"'){u(),s++;let l="",d=()=>{l&&o.push({kind:"text",value:l,quoted:!0}),l=""},h=!1;for(;s<t.length;){let p=t[s];if(p==='"'){h=!0,s++;break}if(p==="\\"&&/["\\$`\n]/.test(t[s+1]??""))l+=t[s+1],s+=2;else if(p==="$"){d();let[y,b]=os(t,s,!0);o.push(y),s=b}else if(p==="`"){d();let y=t.indexOf("`",s+1);if(y<0)throw new H("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,y),quoted:!0}),s=y+1}else l+=p,s++}if(!h)throw new H("unexpected end of input: unterminated quote",!0);d(),(!o.length||o[o.length-1].kind!=="text")&&o.push({kind:"text",value:"",quoted:!0})}else if(f==="$"){u();let[l,d]=os(t,s,!1);o.push(l),s=d}else if(f==="`"){u();let l=t.indexOf("`",s+1);if(l<0)throw new H("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,l),quoted:!1}),s=l+1}else c+=f,s++}u(),r.push({type:"word",word:o,raw:t.slice(a,s)})}if(n.length)throw new H(`unexpected end of input: here-document delimited by ${n[0].delimiter}`,!0);return r}var Kl=/^([A-Za-z_]\w*)=/,Ko=/^[A-Za-z_][\w-]*$/,Ho=new Set([">",">>","<","2>","2>>","&>","2>&1",">&2","<<","<<-"]),Hl=new Set(["then","elif","else","fi","do","done","esac","}"]);function $r(t){let e=Mr(t),r=0,n=()=>e[r],s=v=>{let B=e[r];return B?.type==="op"&&B.op===v},i=(v,B=r)=>{let Q=e[B];return Q?.type==="word"&&Q.raw===v},o=v=>v?v.type==="op"?`\`${v.op.replace(`
66
66
  `,"newline")}'`:v.type==="word"?`\`${v.raw}'`:"here-document":"end of input",a=v=>{throw new H(v?`syntax error near unexpected token ${o(v)}`:"unexpected end of input",!v)},c=()=>{for(;s(`
67
67
  `);)r++},u=()=>{for(;s(`
68
- `)||s(";");)r++},f=v=>{u(),i(v)||a(n()),r++},l=v=>{let B=n();if(B?.type!=="op"||!jo.has(B.op))return!1;if(r++,B.op==="2>&1"||B.op===">&2")return v.redirects.push({op:B.op}),!0;let Q=n();return B.op==="<<"||B.op==="<<-"?((Q?.type!=="heredoc"||!Q.body)&&a(Q),r++,v.redirects.push({op:B.op,heredoc:{body:Q.body}}),!0):(Q?.type!=="word"&&a(Q),r++,v.redirects.push({op:B.op,target:Q.word}),!0)},d=()=>{let v={type:"simple",assignments:[],words:[],redirects:[]};for(;;){let B=n();if(!B||B.type==="heredoc")break;if(B.type==="op"){if(!l(v))break;continue}r++;let Q=B.word[0],_=!v.words.length&&Q?.kind==="text"&&!Q.quoted?Pl.exec(Q.value):null;if(_){let N=Q.kind==="text"?Q.value.slice(_[0].length):"";v.assignments.push({name:_[1],value:[...N?[{kind:"text",value:N,quoted:!1}]:[],...B.word.slice(1)]})}else v.words.push(B.word)}return v},h=(v,B=new Set)=>{let Q=[];for(;;){u();let _=n();if(_||a(_),_.type==="word"&&v.has(_.raw)||_.type==="op"&&B.has(_.op))return Q;Q.push(S()),s("&")&&(Q[Q.length-1].background=!0,r++)}},p=()=>{r++;let v=[],B,Q=h(new Set(["then"]));for(f("then"),v.push({condition:Q,body:h(new Set(["elif","else","fi"]))});;)if(i("elif")){r++;let _=h(new Set(["then"]));f("then"),v.push({condition:_,body:h(new Set(["elif","else","fi"]))})}else if(i("else"))r++,B=h(new Set(["fi"]));else break;return f("fi"),{type:"if",clauses:v,otherwise:B,redirects:[]}},y=()=>{f("do");let v=h(new Set(["done"]));return f("done"),v},b=v=>{r++;let B=h(new Set(["do"]));return{type:v,condition:B,body:y(),redirects:[]}},E=()=>{r++;let v=n();(v?.type!=="word"||!Po.test(v.raw))&&a(v);let B=v.raw;r++,c();let Q;if(i("in"))for(r++,Q=[];n()?.type==="word";)Q.push(e[r++].word);return{type:"for",name:B,items:Q,body:y(),redirects:[]}},C=()=>{r++;let v=n();v?.type!=="word"&&a(v),r++,c(),i("in")||a(n()),r++;let B=[];for(;u(),!i("esac");){s("(")&&r++;let Q=[];for(;;){let N=n();if(N?.type!=="word"&&a(N),Q.push(N.word),r++,s("|"))r++;else break}s(")")||a(n()),r++;let _=h(new Set(["esac"]),new Set([";;"]));B.push({patterns:Q,body:_}),s(";;")&&r++}return r++,{type:"case",subject:v.word,arms:B,redirects:[]}},A=()=>{let v;if(i("if"))v=p();else if(i("while"))v=b("while");else if(i("until"))v=b("until");else if(i("for"))v=E();else if(i("case"))v=C();else if(i("{")){r++;let B=h(new Set(["}"]));r++,v={type:"group",body:B,redirects:[]}}else if(s("(")){r++;let B=h(new Set,new Set([")"]));r++,v={type:"subshell",body:B,redirects:[]}}if(v)for(;l(v););return v},g=()=>{let v=n();v?.type==="word"&&jl.has(v.raw)&&a(v);let B=A();if(B)return B;let Q=i("function")?1:0,_=e[r+Q];if(_?.type==="word"&&Po.test(_.raw)){let N=e[r+Q+1]?.type==="op"&&e[r+Q+1].op==="(";if(Q||N){r+=Q+1,N&&(r++,s(")")||a(n()),r++),c();let L=A();return L||a(n()),{type:"function",name:_.raw,body:L,redirects:[]}}}return d()},w=()=>{let v=!1;i("!")&&(v=!0,r++);let B=[g()];for(;s("|");){if(r++,c(),!n())throw new H("unexpected end of input after |",!0);B.push(g())}for(let Q of B)Q.type==="simple"&&!Q.words.length&&!Q.assignments.length&&!Q.redirects.length&&a(n()??{type:"op",op:"|"});return{negate:v,commands:B}},S=()=>{let v=n();v.type==="op"&&!jo.has(v.op)&&v.op!=="("&&a(v);let B={first:w(),rest:[],background:!1};for(;s("&&")||s("||");){let Q=e[r].op;if(r++,c(),!n())throw new H(`unexpected end of input after ${Q}`,!0);B.rest.push({op:Q,pipeline:w()})}return B},I=[];for(;r<e.length;){if(s(";")||s(`
69
- `)){r++;continue}I.push(S()),s("&")&&(I[I.length-1].background=!0,r++)}return I}async function Kl(t,e){let r;switch(t.name){case"?":r=String(e.lastStatus);break;case"$":r=String(e.pid);break;case"#":r=String(e.positional.length);break;case"@":case"*":r=e.positional.join(" ");break;case"!":r="";break;case"0":r="bfsh";break;default:r=/^\d$/.test(t.name)?e.positional[Number(t.name)-1]:e.get(t.name)}if(!t.op)return r??"";let n=async()=>(await vt(t.arg??[],e,{split:!1,glob:!1})).join(" ");switch(t.op){case":-":return r||n();case"-":return r!==void 0?r:n();case":+":return r?n():"";case":=":{if(r)return r;let s=await n();return e.set(t.name,s),s}}}var os=/[*?[]/;function as(t,e={}){let r=e.slash?".":"[^/]",n="";for(let s=0;s<t.length;s++){let i=t[s];if(i==="*")n+=`${r}*`;else if(i==="?")n+=r;else if(i==="["){let o=t.indexOf("]",s+1);o<0?n+="\\[":(n+="["+t.slice(s+1,o).replace(/^!/,"^").replace(/\\/g,"\\\\")+"]",s=o)}else n+=i.replace(/[.+^${}()|\\]/g,"\\$&")}return new RegExp(`^${n}$`,"s")}function cs(t,e,r){let n=r.startsWith("/"),s=r.split("/").filter((o,a)=>o||a===0),i=[n?"/":""];for(let o of n?s.slice(1):s){let a=[];for(let c of i){let u=c?c.startsWith("/")?c:k(e,c):e;if(!os.test(o)){let l=c?c.endsWith("/")?c+o:`${c}/${o}`:o;t.exists(l.startsWith("/")?l:k(e,l))&&a.push(l);continue}let f=as(o);for(let l of t.readdir(O(u)))l.startsWith(".")&&!o.startsWith(".")||f.test(l)&&a.push(c?c.endsWith("/")?c+l:`${c}/${l}`:l)}i=a}return i.sort()}async function vt(t,e,r={}){let n=r.split??!0,s=[""],i=!1,o=!1,a=u=>{s[s.length-1]+=u};for(let u of t){if(u.kind==="tilde"){a(e.get("HOME")??"/home/user"),i=!0;continue}if(u.kind==="text"){a(u.value),(u.quoted||u.value)&&(i=!0),!u.quoted&&os.test(u.value)&&(o=!0);continue}let f=u.kind==="var"?await Kl(u,e):(await e.substitute(u.source)).replace(/\n+$/,"");if(u.quoted||!n){a(f),i=!0;continue}f.split(/[ \t\n]+/).forEach((d,h)=>{h>0&&(s[s.length-1]||i)&&s.push(""),d&&(a(d),i=!0)})}let c=s.filter((u,f)=>u!==""||i&&f===s.length-1&&s.length===1);return!i&&c.every(u=>!u)?[]:r.glob===!1||!o?c:c.flatMap(u=>{if(!os.test(u))return[u];let f=cs(e.fs,e.cwd,u);return f.length?f:[u]})}async function ls(t,e){let r=[];for(let n of t)r.push(...await vt(n,e));return r}function ee(t,e){return e==="~"||e.startsWith("~/")?k(t.env.HOME??"/home/user",e.slice(1)):e.startsWith("/")?O(e):k(t.cwd,e)}function Ae(t,e=[]){let r=new Set,n={},s=[];for(let i=0;i<t.length;i++){let o=t[i];if(o==="--"){s.push(...t.slice(i+1));break}if(o.startsWith("--")&&o.length>2){let[a,c]=o.slice(2).split("=",2);c!==void 0?n[a]=c:e.includes(a)?n[a]=t[++i]??"":r.add(a)}else if(o.startsWith("-")&&o.length>1&&!/^-\d/.test(o))for(let a=1;a<o.length;a++){let c=o[a];if(e.includes(c)){n[c]=o.slice(a+1)||t[++i]||"";break}r.add(c)}else s.push(o)}return{flags:r,values:n,operands:s}}function Ko(t,e){return async r=>{let n=new oe,s=r.io.onStdin(ae(i=>n.push(i)));try{return await t({args:r.args,name:e,cwd:r.cwd,env:r.env,fs:r.system.fs,system:r.system,io:{stdout:r.io.stdout,stderr:r.io.stderr,stdin:n,isTerminal:!!r.io.terminal},signal:r.signal})}finally{s()}}}var Hl=new TextEncoder,Wl=(t,e)=>{let r=t.readFile(e);return r===void 0?4096:typeof r=="string"?Hl.encode(r).length:r.length},Jl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){let e=new Date(t);return`${Jl[e.getMonth()]} ${String(e.getDate()).padStart(2)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}var Ho=async t=>{let{flags:e,operands:r}=Ae(t.args),n=e.has("a")||e.has("A"),s=e.has("l"),i=e.has("1")||!t.io.isTerminal,o=r.length?r:["."],a=0,c=(f,l)=>t.io.isTerminal&&l?`\x1B[1;34m${f}\x1B[0m`:f,u=(f,l)=>{if(s){let h=l.map(p=>{let y=p==="."?f:p===".."?$(f):k(f,p),b=t.fs.isDirectory(y),E=b?4096:Wl(t.fs,y);return`${b?"drwxr-xr-x":"-rw-r--r--"} 1 user user ${String(E).padStart(8)} ${ql(t.fs.mtime(y)??Date.now())} ${c(p,b)}`});return h.length?`total ${l.length}
68
+ `)||s(";");)r++},f=v=>{u(),i(v)||a(n()),r++},l=v=>{let B=n();if(B?.type!=="op"||!Ho.has(B.op))return!1;if(r++,B.op==="2>&1"||B.op===">&2")return v.redirects.push({op:B.op}),!0;let Q=n();return B.op==="<<"||B.op==="<<-"?((Q?.type!=="heredoc"||!Q.body)&&a(Q),r++,v.redirects.push({op:B.op,heredoc:{body:Q.body}}),!0):(Q?.type!=="word"&&a(Q),r++,v.redirects.push({op:B.op,target:Q.word}),!0)},d=()=>{let v={type:"simple",assignments:[],words:[],redirects:[]};for(;;){let B=n();if(!B||B.type==="heredoc")break;if(B.type==="op"){if(!l(v))break;continue}r++;let Q=B.word[0],_=!v.words.length&&Q?.kind==="text"&&!Q.quoted?Kl.exec(Q.value):null;if(_){let N=Q.kind==="text"?Q.value.slice(_[0].length):"";v.assignments.push({name:_[1],value:[...N?[{kind:"text",value:N,quoted:!1}]:[],...B.word.slice(1)]})}else v.words.push(B.word)}return v},h=(v,B=new Set)=>{let Q=[];for(;;){u();let _=n();if(_||a(_),_.type==="word"&&v.has(_.raw)||_.type==="op"&&B.has(_.op))return Q;Q.push(S()),s("&")&&(Q[Q.length-1].background=!0,r++)}},p=()=>{r++;let v=[],B,Q=h(new Set(["then"]));for(f("then"),v.push({condition:Q,body:h(new Set(["elif","else","fi"]))});;)if(i("elif")){r++;let _=h(new Set(["then"]));f("then"),v.push({condition:_,body:h(new Set(["elif","else","fi"]))})}else if(i("else"))r++,B=h(new Set(["fi"]));else break;return f("fi"),{type:"if",clauses:v,otherwise:B,redirects:[]}},y=()=>{f("do");let v=h(new Set(["done"]));return f("done"),v},b=v=>{r++;let B=h(new Set(["do"]));return{type:v,condition:B,body:y(),redirects:[]}},E=()=>{r++;let v=n();(v?.type!=="word"||!Ko.test(v.raw))&&a(v);let B=v.raw;r++,c();let Q;if(i("in"))for(r++,Q=[];n()?.type==="word";)Q.push(e[r++].word);return{type:"for",name:B,items:Q,body:y(),redirects:[]}},C=()=>{r++;let v=n();v?.type!=="word"&&a(v),r++,c(),i("in")||a(n()),r++;let B=[];for(;u(),!i("esac");){s("(")&&r++;let Q=[];for(;;){let N=n();if(N?.type!=="word"&&a(N),Q.push(N.word),r++,s("|"))r++;else break}s(")")||a(n()),r++;let _=h(new Set(["esac"]),new Set([";;"]));B.push({patterns:Q,body:_}),s(";;")&&r++}return r++,{type:"case",subject:v.word,arms:B,redirects:[]}},A=()=>{let v;if(i("if"))v=p();else if(i("while"))v=b("while");else if(i("until"))v=b("until");else if(i("for"))v=E();else if(i("case"))v=C();else if(i("{")){r++;let B=h(new Set(["}"]));r++,v={type:"group",body:B,redirects:[]}}else if(s("(")){r++;let B=h(new Set,new Set([")"]));r++,v={type:"subshell",body:B,redirects:[]}}if(v)for(;l(v););return v},g=()=>{let v=n();v?.type==="word"&&Hl.has(v.raw)&&a(v);let B=A();if(B)return B;let Q=i("function")?1:0,_=e[r+Q];if(_?.type==="word"&&Ko.test(_.raw)){let N=e[r+Q+1]?.type==="op"&&e[r+Q+1].op==="(";if(Q||N){r+=Q+1,N&&(r++,s(")")||a(n()),r++),c();let L=A();return L||a(n()),{type:"function",name:_.raw,body:L,redirects:[]}}}return d()},w=()=>{let v=!1;i("!")&&(v=!0,r++);let B=[g()];for(;s("|");){if(r++,c(),!n())throw new H("unexpected end of input after |",!0);B.push(g())}for(let Q of B)Q.type==="simple"&&!Q.words.length&&!Q.assignments.length&&!Q.redirects.length&&a(n()??{type:"op",op:"|"});return{negate:v,commands:B}},S=()=>{let v=n();v.type==="op"&&!Ho.has(v.op)&&v.op!=="("&&a(v);let B={first:w(),rest:[],background:!1};for(;s("&&")||s("||");){let Q=e[r].op;if(r++,c(),!n())throw new H(`unexpected end of input after ${Q}`,!0);B.rest.push({op:Q,pipeline:w()})}return B},I=[];for(;r<e.length;){if(s(";")||s(`
69
+ `)){r++;continue}I.push(S()),s("&")&&(I[I.length-1].background=!0,r++)}return I}async function Wl(t,e){let r;switch(t.name){case"?":r=String(e.lastStatus);break;case"$":r=String(e.pid);break;case"#":r=String(e.positional.length);break;case"@":case"*":r=e.positional.join(" ");break;case"!":r="";break;case"0":r="bfsh";break;default:r=/^\d$/.test(t.name)?e.positional[Number(t.name)-1]:e.get(t.name)}if(!t.op)return r??"";let n=async()=>(await St(t.arg??[],e,{split:!1,glob:!1})).join(" ");switch(t.op){case":-":return r||n();case"-":return r!==void 0?r:n();case":+":return r?n():"";case":=":{if(r)return r;let s=await n();return e.set(t.name,s),s}}}var as=/[*?[]/;function cs(t,e={}){let r=e.slash?".":"[^/]",n="";for(let s=0;s<t.length;s++){let i=t[s];if(i==="*")n+=`${r}*`;else if(i==="?")n+=r;else if(i==="["){let o=t.indexOf("]",s+1);o<0?n+="\\[":(n+="["+t.slice(s+1,o).replace(/^!/,"^").replace(/\\/g,"\\\\")+"]",s=o)}else n+=i.replace(/[.+^${}()|\\]/g,"\\$&")}return new RegExp(`^${n}$`,"s")}function ls(t,e,r){let n=r.startsWith("/"),s=r.split("/").filter((o,a)=>o||a===0),i=[n?"/":""];for(let o of n?s.slice(1):s){let a=[];for(let c of i){let u=c?c.startsWith("/")?c:k(e,c):e;if(!as.test(o)){let l=c?c.endsWith("/")?c+o:`${c}/${o}`:o;t.exists(l.startsWith("/")?l:k(e,l))&&a.push(l);continue}let f=cs(o);for(let l of t.readdir(O(u)))l.startsWith(".")&&!o.startsWith(".")||f.test(l)&&a.push(c?c.endsWith("/")?c+l:`${c}/${l}`:l)}i=a}return i.sort()}async function St(t,e,r={}){let n=r.split??!0,s=[""],i=!1,o=!1,a=u=>{s[s.length-1]+=u};for(let u of t){if(u.kind==="tilde"){a(e.get("HOME")??"/home/user"),i=!0;continue}if(u.kind==="text"){a(u.value),(u.quoted||u.value)&&(i=!0),!u.quoted&&as.test(u.value)&&(o=!0);continue}let f=u.kind==="var"?await Wl(u,e):(await e.substitute(u.source)).replace(/\n+$/,"");if(u.quoted||!n){a(f),i=!0;continue}f.split(/[ \t\n]+/).forEach((d,h)=>{h>0&&(s[s.length-1]||i)&&s.push(""),d&&(a(d),i=!0)})}let c=s.filter((u,f)=>u!==""||i&&f===s.length-1&&s.length===1);return!i&&c.every(u=>!u)?[]:r.glob===!1||!o?c:c.flatMap(u=>{if(!as.test(u))return[u];let f=ls(e.fs,e.cwd,u);return f.length?f:[u]})}async function fs(t,e){let r=[];for(let n of t)r.push(...await St(n,e));return r}function ee(t,e){return e==="~"||e.startsWith("~/")?k(t.env.HOME??"/home/user",e.slice(1)):e.startsWith("/")?O(e):k(t.cwd,e)}function Ae(t,e=[]){let r=new Set,n={},s=[];for(let i=0;i<t.length;i++){let o=t[i];if(o==="--"){s.push(...t.slice(i+1));break}if(o.startsWith("--")&&o.length>2){let[a,c]=o.slice(2).split("=",2);c!==void 0?n[a]=c:e.includes(a)?n[a]=t[++i]??"":r.add(a)}else if(o.startsWith("-")&&o.length>1&&!/^-\d/.test(o))for(let a=1;a<o.length;a++){let c=o[a];if(e.includes(c)){n[c]=o.slice(a+1)||t[++i]||"";break}r.add(c)}else s.push(o)}return{flags:r,values:n,operands:s}}function Wo(t,e){return async r=>{let n=new oe,s=r.io.onStdin(ae(i=>n.push(i)));try{return await t({args:r.args,name:e,cwd:r.cwd,env:r.env,fs:r.system.fs,system:r.system,io:{stdout:r.io.stdout,stderr:r.io.stderr,stdin:n,isTerminal:!!r.io.terminal},signal:r.signal})}finally{s()}}}var Jl=new TextEncoder,ql=(t,e)=>{let r=t.readFile(e);return r===void 0?4096:typeof r=="string"?Jl.encode(r).length:r.length},zl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Gl(t){let e=new Date(t);return`${zl[e.getMonth()]} ${String(e.getDate()).padStart(2)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}var Jo=async t=>{let{flags:e,operands:r}=Ae(t.args),n=e.has("a")||e.has("A"),s=e.has("l"),i=e.has("1")||!t.io.isTerminal,o=r.length?r:["."],a=0,c=(f,l)=>t.io.isTerminal&&l?`\x1B[1;34m${f}\x1B[0m`:f,u=(f,l)=>{if(s){let h=l.map(p=>{let y=p==="."?f:p===".."?$(f):k(f,p),b=t.fs.isDirectory(y),E=b?4096:ql(t.fs,y);return`${b?"drwxr-xr-x":"-rw-r--r--"} 1 user user ${String(E).padStart(8)} ${Gl(t.fs.mtime(y)??Date.now())} ${c(p,b)}`});return h.length?`total ${l.length}
70
70
  ${h.join(`
71
71
  `)}
72
72
  `:`total 0
@@ -75,46 +75,46 @@ ${h.join(`
75
75
  `:""};for(let[f,l]of o.entries()){let d=ee(t,l);if(t.fs.isFile(d)){t.io.stdout(u($(d),[ze(d)]).replace(ze(d),l));continue}if(!t.fs.isDirectory(d)){t.io.stderr(`ls: cannot access '${l}': No such file or directory
76
76
  `),a=2;continue}let h=t.fs.readdir(d).filter(p=>n||!p.startsWith("."));e.has("a")&&(h=[".","..",...h]),o.length>1&&t.io.stdout(`${f?`
77
77
  `:""}${l}:
78
- `),t.io.stdout(u(d,h))}return a},Wo=async t=>{let{operands:e}=Ae(t.args);if(!e.length||e.length===1&&e[0]==="-")return t.io.stdout(await t.io.stdin.readAll()),0;let r=0;for(let n of e){let s=ee(t,n);t.fs.isDirectory(s)?(t.io.stderr(`cat: ${n}: Is a directory
78
+ `),t.io.stdout(u(d,h))}return a},qo=async t=>{let{operands:e}=Ae(t.args);if(!e.length||e.length===1&&e[0]==="-")return t.io.stdout(await t.io.stdin.readAll()),0;let r=0;for(let n of e){let s=ee(t,n);t.fs.isDirectory(s)?(t.io.stderr(`cat: ${n}: Is a directory
79
79
  `),r=1):t.fs.isFile(s)?t.io.stdout(t.fs.readText(s)??""):(t.io.stderr(`cat: ${n}: No such file or directory
80
- `),r=1)}return r},Jo=async t=>{let{flags:e,operands:r}=Ae(t.args,["m"]);if(!r.length)return t.io.stderr(`mkdir: missing operand
80
+ `),r=1)}return r},zo=async t=>{let{flags:e,operands:r}=Ae(t.args,["m"]);if(!r.length)return t.io.stderr(`mkdir: missing operand
81
81
  `),1;let n=0;for(let s of r){let i=ee(t,s);if(t.fs.exists(i)){if(e.has("p")&&t.fs.isDirectory(i))continue;t.io.stderr(`mkdir: cannot create directory '${s}': File exists
82
82
  `),n=1}else!e.has("p")&&!t.fs.isDirectory($(i))?(t.io.stderr(`mkdir: cannot create directory '${s}': No such file or directory
83
- `),n=1):t.fs.mkdir(i)}return n},qo=async t=>{let{flags:e,operands:r}=Ae(t.args),n=e.has("r")||e.has("R")||e.has("recursive"),s=e.has("f")||e.has("force");if(!r.length&&!s)return t.io.stderr(`rm: missing operand
83
+ `),n=1):t.fs.mkdir(i)}return n},Go=async t=>{let{flags:e,operands:r}=Ae(t.args),n=e.has("r")||e.has("R")||e.has("recursive"),s=e.has("f")||e.has("force");if(!r.length&&!s)return t.io.stderr(`rm: missing operand
84
84
  `),1;let i=0;for(let o of r){let a=ee(t,o);a==="/"?(t.io.stderr(`rm: it is dangerous to operate recursively on '/'
85
85
  `),i=1):t.fs.exists(a)?t.fs.isDirectory(a)&&!n?(t.io.stderr(`rm: cannot remove '${o}': Is a directory
86
86
  `),i=1):t.fs.rm(a):s||(t.io.stderr(`rm: cannot remove '${o}': No such file or directory
87
- `),i=1)}return i};function zo(t,e,r){if(t.isFile(e)){let n=t.readFile(e);t.writeFile(r,typeof n=="string"?n:n.slice());return}t.mkdir(r);for(let n of t.readdir(e))zo(t,k(e,n),k(r,n))}function Go(t){return async e=>{let{flags:r,operands:n}=Ae(e.args);if(n.length<2)return e.io.stderr(`${t}: missing destination file operand
87
+ `),i=1)}return i};function Yo(t,e,r){if(t.isFile(e)){let n=t.readFile(e);t.writeFile(r,typeof n=="string"?n:n.slice());return}t.mkdir(r);for(let n of t.readdir(e))Yo(t,k(e,n),k(r,n))}function Vo(t){return async e=>{let{flags:r,operands:n}=Ae(e.args);if(n.length<2)return e.io.stderr(`${t}: missing destination file operand
88
88
  `),1;let s=ee(e,n[n.length-1]),i=n.slice(0,-1),o=e.fs.isDirectory(s);if(i.length>1&&!o)return e.io.stderr(`${t}: target '${n[n.length-1]}' is not a directory
89
89
  `),1;let a=0;for(let c of i){let u=ee(e,c),f=o?k(s,ze(u)):s;if(!e.fs.exists(u)){e.io.stderr(`${t}: cannot stat '${c}': No such file or directory
90
90
  `),a=1;continue}if(t==="cp"&&e.fs.isDirectory(u)&&!(r.has("r")||r.has("R")||r.has("a"))){e.io.stderr(`cp: -r not specified; omitting directory '${c}'
91
91
  `),a=1;continue}if(f===u||f.startsWith(u+"/")){e.io.stderr(`${t}: cannot ${t==="cp"?"copy":"move"} '${c}' into itself
92
92
  `),a=1;continue}if(e.fs.isFile(f)&&e.fs.isDirectory(u)){e.io.stderr(`${t}: cannot overwrite non-directory '${f}' with directory '${c}'
93
- `),a=1;continue}e.fs.isFile(f)&&e.fs.rm(f),zo(e.fs,u,f),t==="mv"&&e.fs.rm(u)}return a}}var Yo=Go("cp"),Vo=Go("mv"),Zo=async t=>{let{operands:e}=Ae(t.args),r=0;for(let n of e){let s=ee(t,n);t.fs.isDirectory($(s))?t.fs.isDirectory(s)||t.fs.writeFile(s,t.fs.readFile(s)??""):(t.io.stderr(`touch: cannot touch '${n}': No such file or directory
94
- `),r=1)}return r},Xo=async t=>(t.io.stdout(t.cwd+`
95
- `),0);async function fs(t,e,r){if(!e.length||e.length===1&&e[0]==="-")return[{label:"(standard input)",text:await t.io.stdin.readAll()}];let n=[];for(let s of e){let i=ee(t,s);if(!t.fs.isFile(i))return t.io.stderr(`${r}: ${s}: ${t.fs.isDirectory(i)?"Is a directory":"No such file or directory"}
96
- `),1;n.push({label:s,text:t.fs.readText(i)??""})}return n}var ea=t=>{let e=t.split(`
97
- `);return e[e.length-1]===""&&e.pop(),e};function ta(t){return t.replace(/\\(n|t|r|\\|e|a|0)/g,(e,r)=>({n:`
98
- `,t:" ",r:"\r","\\":"\\",e:"\x1B",a:"\x07",0:"\0"})[r]??r)}var ra=async t=>{let e=t.args,r=!0,n=!1;for(;e[0]&&/^-[neE]+$/.test(e[0]);)e[0].includes("n")&&(r=!1),e[0].includes("e")&&(n=!0),e=e.slice(1);let s=e.join(" ");return t.io.stdout((n?ta(s):s)+(r?`
99
- `:"")),0},na=async t=>{let[e="",...r]=t.args,n=0,s=ta(e).replace(/%([sdif%])/g,(i,o)=>{if(o==="%")return"%";let a=r[n++]??"";return o==="s"?a:String(o==="f"?parseFloat(a)||0:parseInt(a,10)||0)});return t.io.stdout(s),0};function sa(t){return async e=>{let r=e.args.find(a=>/^-\d+$/.test(a)),{values:n,operands:s}=Ae(e.args.filter(a=>a!==r),["n"]),i=r?Number(r.slice(1)):n.n!==void 0?Number(n.n):10,o=await fs(e,s,t);return typeof o=="number"?o:(o.forEach((a,c)=>{o.length>1&&e.io.stdout(`${c?`
93
+ `),a=1;continue}e.fs.isFile(f)&&e.fs.rm(f),Yo(e.fs,u,f),t==="mv"&&e.fs.rm(u)}return a}}var Zo=Vo("cp"),Xo=Vo("mv"),ea=async t=>{let{operands:e}=Ae(t.args),r=0;for(let n of e){let s=ee(t,n);t.fs.isDirectory($(s))?t.fs.isDirectory(s)||t.fs.writeFile(s,t.fs.readFile(s)??""):(t.io.stderr(`touch: cannot touch '${n}': No such file or directory
94
+ `),r=1)}return r},ta=async t=>(t.io.stdout(t.cwd+`
95
+ `),0);async function us(t,e,r){if(!e.length||e.length===1&&e[0]==="-")return[{label:"(standard input)",text:await t.io.stdin.readAll()}];let n=[];for(let s of e){let i=ee(t,s);if(!t.fs.isFile(i))return t.io.stderr(`${r}: ${s}: ${t.fs.isDirectory(i)?"Is a directory":"No such file or directory"}
96
+ `),1;n.push({label:s,text:t.fs.readText(i)??""})}return n}var ra=t=>{let e=t.split(`
97
+ `);return e[e.length-1]===""&&e.pop(),e};function na(t){return t.replace(/\\(n|t|r|\\|e|a|0)/g,(e,r)=>({n:`
98
+ `,t:" ",r:"\r","\\":"\\",e:"\x1B",a:"\x07",0:"\0"})[r]??r)}var sa=async t=>{let e=t.args,r=!0,n=!1;for(;e[0]&&/^-[neE]+$/.test(e[0]);)e[0].includes("n")&&(r=!1),e[0].includes("e")&&(n=!0),e=e.slice(1);let s=e.join(" ");return t.io.stdout((n?na(s):s)+(r?`
99
+ `:"")),0},ia=async t=>{let[e="",...r]=t.args,n=0,s=na(e).replace(/%([sdif%])/g,(i,o)=>{if(o==="%")return"%";let a=r[n++]??"";return o==="s"?a:String(o==="f"?parseFloat(a)||0:parseInt(a,10)||0)});return t.io.stdout(s),0};function oa(t){return async e=>{let r=e.args.find(a=>/^-\d+$/.test(a)),{values:n,operands:s}=Ae(e.args.filter(a=>a!==r),["n"]),i=r?Number(r.slice(1)):n.n!==void 0?Number(n.n):10,o=await us(e,s,t);return typeof o=="number"?o:(o.forEach((a,c)=>{o.length>1&&e.io.stdout(`${c?`
100
100
  `:""}==> ${a.label} <==
101
- `);let u=ea(a.text),f=t==="head"?u.slice(0,i):i?u.slice(-i):[];f.length&&e.io.stdout(f.join(`
101
+ `);let u=ra(a.text),f=t==="head"?u.slice(0,i):i?u.slice(-i):[];f.length&&e.io.stdout(f.join(`
102
102
  `)+`
103
- `)}),0)}}var ia=sa("head"),oa=sa("tail"),aa=async t=>{let{flags:e,operands:r}=Ae(t.args),[n,...s]=r;if(n===void 0)return t.io.stderr(`Usage: grep [-ivnrclEF] PATTERN [FILE]...
103
+ `)}),0)}}var aa=oa("head"),ca=oa("tail"),la=async t=>{let{flags:e,operands:r}=Ae(t.args),[n,...s]=r;if(n===void 0)return t.io.stderr(`Usage: grep [-ivnrclEF] PATTERN [FILE]...
104
104
  `),2;let i;try{let f=e.has("F")?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e.has("E")?n:n.replace(/\\([|(){}+?])/g,"$1");i=new RegExp(e.has("w")?`\\b(?:${f})\\b`:f,e.has("i")?"i":"")}catch{return t.io.stderr(`grep: invalid pattern: ${n}
105
- `),2}let o=s;if(e.has("r")||e.has("R")){o=[];let f=(l,d)=>{if(t.fs.isFile(l))o.push(d);else for(let h of t.fs.readdir(l))h!=="node_modules"&&!h.startsWith(".")&&f(k(l,h),d==="."?h:`${d}/${h}`)};for(let l of s.length?s:["."])f(ee(t,l),l)}let a=await fs(t,o,"grep");if(typeof a=="number")return 2;let c=a.length>1,u=0;for(let{label:f,text:l}of a){let d=0;ea(l).forEach((h,p)=>{i.test(h)!==e.has("v")&&(d++,u++,!(e.has("c")||e.has("l")||e.has("q"))&&t.io.stdout(`${c?f+":":""}${e.has("n")?p+1+":":""}${h}
105
+ `),2}let o=s;if(e.has("r")||e.has("R")){o=[];let f=(l,d)=>{if(t.fs.isFile(l))o.push(d);else for(let h of t.fs.readdir(l))h!=="node_modules"&&!h.startsWith(".")&&f(k(l,h),d==="."?h:`${d}/${h}`)};for(let l of s.length?s:["."])f(ee(t,l),l)}let a=await us(t,o,"grep");if(typeof a=="number")return 2;let c=a.length>1,u=0;for(let{label:f,text:l}of a){let d=0;ra(l).forEach((h,p)=>{i.test(h)!==e.has("v")&&(d++,u++,!(e.has("c")||e.has("l")||e.has("q"))&&t.io.stdout(`${c?f+":":""}${e.has("n")?p+1+":":""}${h}
106
106
  `))}),e.has("c")&&t.io.stdout(`${c?f+":":""}${d}
107
107
  `),e.has("l")&&d&&t.io.stdout(f+`
108
- `)}return u?0:1},ca=async t=>{let{flags:e,operands:r}=Ae(t.args),n=await fs(t,r,"wc");if(typeof n=="number")return n;let s=["l","w","c"].filter(i=>e.has(i));for(let{label:i,text:o}of n){let a={l:(o.match(/\n/g)??[]).length,w:o.split(/\s+/).filter(Boolean).length,c:new TextEncoder().encode(o).length},c=(s.length?s:["l","w","c"]).map(u=>String(a[u]).padStart(7)).join(" ");t.io.stdout(`${c}${r.length?" "+i:""}
109
- `)}return 0},la=async t=>(t.io.stdout(Object.entries(t.env).map(([e,r])=>`${e}=${r}`).join(`
108
+ `)}return u?0:1},fa=async t=>{let{flags:e,operands:r}=Ae(t.args),n=await us(t,r,"wc");if(typeof n=="number")return n;let s=["l","w","c"].filter(i=>e.has(i));for(let{label:i,text:o}of n){let a={l:(o.match(/\n/g)??[]).length,w:o.split(/\s+/).filter(Boolean).length,c:new TextEncoder().encode(o).length},c=(s.length?s:["l","w","c"]).map(u=>String(a[u]).padStart(7)).join(" ");t.io.stdout(`${c}${r.length?" "+i:""}
109
+ `)}return 0},ua=async t=>(t.io.stdout(Object.entries(t.env).map(([e,r])=>`${e}=${r}`).join(`
110
110
  `)+`
111
- `),0),fa=async t=>(t.io.stdout("\x1B[2J\x1B[3J\x1B[H"),0),ua=async t=>{let e=Number(t.args[0]??0);return Number.isFinite(e)?(await new Promise(r=>{let n=setTimeout(r,e*1e3);t.signal.addEventListener("abort",()=>{clearTimeout(n),r()})}),t.signal.aborted?130:0):(t.io.stderr(`sleep: invalid time interval '${t.args[0]}'
112
- `),1)},da=async t=>{let[e="",r]=t.args,n=ze(e);return r&&n.endsWith(r)&&n!==r&&(n=n.slice(0,-r.length)),t.io.stdout(n+`
113
- `),0},ha=async t=>{let e=(t.args[0]??".").replace(/(.)\/+$/,"$1"),r=e.lastIndexOf("/");return t.io.stdout((r<0?".":r===0?"/":e.startsWith("/")?$(e):e.slice(0,r))+`
114
- `),0},pa=async()=>0,Aa=async()=>1;var st=class extends Error{},zl=new Set(["-e","-f","-d","-s","-r","-w","-x","-L","-h"]),Gl=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function Yl(t,e){let r=0,n=()=>e[r],s=()=>{if(r>=e.length)throw new st("argument expected");return e[r++]},i=f=>{if(!/^\s*-?\d+\s*$/.test(f))throw new st(`${f}: integer expression expected`);return Number(f)},o=()=>{let f=s();if(f==="!")return!o();if(f==="("){let d=c();if(s()!==")")throw new st("')' expected");return d}let l=n();if(l!==void 0&&(l==="="||l==="=="||l==="!="||Gl.has(l))&&e[r+1]!==void 0){r++;let d=s();if(l==="="||l==="==")return f===d;if(l==="!=")return f!==d;let[h,p]=[i(f),i(d)];return l==="-eq"?h===p:l==="-ne"?h!==p:l==="-lt"?h<p:l==="-le"?h<=p:l==="-gt"?h>p:h>=p}if(f==="-z"&&n()!==void 0)return s().length===0;if(f==="-n"&&n()!==void 0)return s().length>0;if(zl.has(f)&&n()!==void 0){let d=ee(t,s()),h=t.fs;switch(f){case"-f":return h.isFile(d);case"-d":return h.isDirectory(d);case"-s":{let p=h.readFile(d);return p!==void 0&&p.length>0}case"-L":case"-h":return!1;default:return h.exists(d)}}return f.length>0},a=()=>{let f=o();for(;n()==="-a";){r++;let l=o();f=f&&l}return f},c=()=>{let f=a();for(;n()==="-o";){r++;let l=a();f=f||l}return f};if(!e.length)return!1;let u=c();if(r<e.length)throw new st(`${e[r]}: unexpected argument`);return u}function ga(t,e){try{return Yl(t,e)?0:1}catch(r){if(!(r instanceof st))throw r;return t.io.stderr(`${t.name}: ${r.message}
115
- `),2}}var ma=async t=>ga(t,t.args),wa=async t=>t.args[t.args.length-1]!=="]"?(t.io.stderr(`[: missing ']'
116
- `),2):ga(t,t.args.slice(0,-1));var Ur=new WeakMap,ya=new WeakSet;function Ea(t,e){let r=Ur.get(t)??"",n=()=>{let i=r.indexOf(`
117
- `);return i<0?null:(Ur.set(t,r.slice(i+1)),r.slice(0,i))},s=n();return s!==null?Promise.resolve(s):ya.has(t)?(Ur.delete(t),Promise.resolve(r||null)):new Promise(i=>{let o=u=>{c(),e?.removeEventListener("abort",a),i(u)},a=()=>o(null);e?.addEventListener("abort",a);let c=t.subscribe(u=>{if(u===null){ya.add(t),Ur.delete(t),o(r||null);return}r+=u;let f=n();f!==null&&o(f)})})}var qe={ls:Ho,cat:Wo,mkdir:Jo,rm:qo,cp:Yo,mv:Vo,touch:Zo,pwd:Xo,echo:ra,printf:na,head:ia,tail:oa,grep:aa,wc:ca,env:la,clear:fa,sleep:ua,basename:da,dirname:ha,test:ma,"[":wa,true:pa,false:Aa},Pr=["node","npm","npx","pnpm","yarn","bfsh","sh","bash"],Vl=`bfsh \u2014 BuilderForce WebContainers shell
111
+ `),0),da=async t=>(t.io.stdout("\x1B[2J\x1B[3J\x1B[H"),0),ha=async t=>{let e=Number(t.args[0]??0);return Number.isFinite(e)?(await new Promise(r=>{let n=setTimeout(r,e*1e3);t.signal.addEventListener("abort",()=>{clearTimeout(n),r()})}),t.signal.aborted?130:0):(t.io.stderr(`sleep: invalid time interval '${t.args[0]}'
112
+ `),1)},pa=async t=>{let[e="",r]=t.args,n=ze(e);return r&&n.endsWith(r)&&n!==r&&(n=n.slice(0,-r.length)),t.io.stdout(n+`
113
+ `),0},Aa=async t=>{let e=(t.args[0]??".").replace(/(.)\/+$/,"$1"),r=e.lastIndexOf("/");return t.io.stdout((r<0?".":r===0?"/":e.startsWith("/")?$(e):e.slice(0,r))+`
114
+ `),0},ga=async()=>0,ma=async()=>1;var it=class extends Error{},Yl=new Set(["-e","-f","-d","-s","-r","-w","-x","-L","-h"]),Vl=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function Zl(t,e){let r=0,n=()=>e[r],s=()=>{if(r>=e.length)throw new it("argument expected");return e[r++]},i=f=>{if(!/^\s*-?\d+\s*$/.test(f))throw new it(`${f}: integer expression expected`);return Number(f)},o=()=>{let f=s();if(f==="!")return!o();if(f==="("){let d=c();if(s()!==")")throw new it("')' expected");return d}let l=n();if(l!==void 0&&(l==="="||l==="=="||l==="!="||Vl.has(l))&&e[r+1]!==void 0){r++;let d=s();if(l==="="||l==="==")return f===d;if(l==="!=")return f!==d;let[h,p]=[i(f),i(d)];return l==="-eq"?h===p:l==="-ne"?h!==p:l==="-lt"?h<p:l==="-le"?h<=p:l==="-gt"?h>p:h>=p}if(f==="-z"&&n()!==void 0)return s().length===0;if(f==="-n"&&n()!==void 0)return s().length>0;if(Yl.has(f)&&n()!==void 0){let d=ee(t,s()),h=t.fs;switch(f){case"-f":return h.isFile(d);case"-d":return h.isDirectory(d);case"-s":{let p=h.readFile(d);return p!==void 0&&p.length>0}case"-L":case"-h":return!1;default:return h.exists(d)}}return f.length>0},a=()=>{let f=o();for(;n()==="-a";){r++;let l=o();f=f&&l}return f},c=()=>{let f=a();for(;n()==="-o";){r++;let l=a();f=f||l}return f};if(!e.length)return!1;let u=c();if(r<e.length)throw new it(`${e[r]}: unexpected argument`);return u}function wa(t,e){try{return Zl(t,e)?0:1}catch(r){if(!(r instanceof it))throw r;return t.io.stderr(`${t.name}: ${r.message}
115
+ `),2}}var ya=async t=>wa(t,t.args),Ea=async t=>t.args[t.args.length-1]!=="]"?(t.io.stderr(`[: missing ']'
116
+ `),2):wa(t,t.args.slice(0,-1));var Ur=new WeakMap,ba=new WeakSet;function Ca(t,e){let r=Ur.get(t)??"",n=()=>{let i=r.indexOf(`
117
+ `);return i<0?null:(Ur.set(t,r.slice(i+1)),r.slice(0,i))},s=n();return s!==null?Promise.resolve(s):ba.has(t)?(Ur.delete(t),Promise.resolve(r||null)):new Promise(i=>{let o=u=>{c(),e?.removeEventListener("abort",a),i(u)},a=()=>o(null);e?.addEventListener("abort",a);let c=t.subscribe(u=>{if(u===null){ba.add(t),Ur.delete(t),o(r||null);return}r+=u;let f=n();f!==null&&o(f)})})}var qe={ls:Jo,cat:qo,mkdir:zo,rm:Go,cp:Zo,mv:Xo,touch:ea,pwd:ta,echo:sa,printf:ia,head:aa,tail:ca,grep:la,wc:fa,env:ua,clear:da,sleep:ha,basename:pa,dirname:Aa,test:ya,"[":Ea,true:ga,false:ma},Pr=["node","npm","npx","pnpm","yarn","bfsh","sh","bash"],Xl=`bfsh \u2014 BuilderForce WebContainers shell
118
118
 
119
119
  Builtins: cd, pwd, export, unset, exit, source, history, type, which, help,
120
120
  read, local, shift, return, break, continue, jobs, wait
@@ -125,7 +125,7 @@ ${h.join(`
125
125
  if \u2026; then \u2026; elif \u2026; else \u2026; fi while|until \u2026; do \u2026; done for x in \u2026; do \u2026; done
126
126
  case $x in a|b) \u2026;; *) \u2026;; esac name() { \u2026; } { \u2026; } ( \u2026 ) cat <<EOF \u2026 EOF
127
127
 
128
- `,Fe={async cd(t,e){let r=e.env.HOME&&t.fs.isDirectory(e.env.HOME)?e.env.HOME:"/",n=t.args[0]==="-"?e.env.OLDPWD??e.cwd:t.args[0]??r,s=ee(t,n);return t.fs.isDirectory(s)?(e.env.OLDPWD=e.cwd,e.cwd=s,e.env.PWD=s,t.args[0]==="-"&&t.io.stdout(s+`
128
+ `,Me={async cd(t,e){let r=e.env.HOME&&t.fs.isDirectory(e.env.HOME)?e.env.HOME:"/",n=t.args[0]==="-"?e.env.OLDPWD??e.cwd:t.args[0]??r,s=ee(t,n);return t.fs.isDirectory(s)?(e.env.OLDPWD=e.cwd,e.cwd=s,e.env.PWD=s,t.args[0]==="-"&&t.io.stdout(s+`
129
129
  `),0):(t.io.stderr(`cd: ${t.fs.isFile(s)?"not a directory":"no such file or directory"}: ${n}
130
130
  `),1)},async export(t,e){if(!t.args.length)return t.io.stdout(Object.entries(e.env).map(([r,n])=>`export ${r}=${JSON.stringify(n)}`).join(`
131
131
  `)+`
@@ -133,19 +133,19 @@ ${h.join(`
133
133
  `),2;let n=t.fs.readText(ee(t,r));return n===void 0?(t.io.stderr(`source: ${r}: No such file or directory
134
134
  `),1):e.run(n)},async history(t,e){return t.io.stdout(e.history.map((r,n)=>`${String(n+1).padStart(5)} ${r}`).join(`
135
135
  `)+(e.history.length?`
136
- `:"")),0},async help(t){return t.io.stdout(Vl),0},async which(t){let e=0;for(let r of t.args.filter(n=>!n.startsWith("-")))if(r in qe||Pr.includes(r))t.io.stdout(`/usr/local/bin/${r}
137
- `);else if(r in Fe)t.io.stdout(`${r}: shell built-in command
136
+ `:"")),0},async help(t){return t.io.stdout(Xl),0},async which(t){let e=0;for(let r of t.args.filter(n=>!n.startsWith("-")))if(r in qe||Pr.includes(r))t.io.stdout(`/usr/local/bin/${r}
137
+ `);else if(r in Me)t.io.stdout(`${r}: shell built-in command
138
138
  `);else{let n=me(t.fs,r,t.cwd,t.env);n?t.io.stdout(n+`
139
139
  `):(t.io.stderr(`${r} not found
140
140
  `),e=1)}return e},async type(t,e){let r=0;for(let n of t.args)if(e.functions.has(n))t.io.stdout(`${n} is a function
141
- `);else if(n in Fe)t.io.stdout(`${n} is a shell builtin
141
+ `);else if(n in Me)t.io.stdout(`${n} is a shell builtin
142
142
  `);else if(n in qe||Pr.includes(n))t.io.stdout(`${n} is /usr/local/bin/${n}
143
143
  `);else{let s=me(t.fs,n,t.cwd,t.env);s?t.io.stdout(`${n} is ${s}
144
144
  `):(t.io.stderr(`type: ${n}: not found
145
- `),r=1)}return r},async set(){return 0},async break(t,e){return ba(t,e,"break")},async continue(t,e){return ba(t,e,"continue")},async return(t,e){if(!e.localFrames.length)return t.io.stderr("return: can only `return' from a function or sourced script\n"),1;let r=t.args[0]===void 0?e.lastStatus:Number(t.args[0])&255;return e.flow={kind:"return",status:r},r},async local(t,e){let r=e.localFrames[e.localFrames.length-1];if(!r)return t.io.stderr(`local: can only be used in a function
146
- `),1;for(let n of t.args){let s=n.indexOf("="),i=s>0?n.slice(0,s):n;r.has(i)||r.set(i,e.env[i]),e.env[i]=s>0?n.slice(s+1):""}return 0},async shift(t,e){let r=t.args[0]===void 0?1:Number(t.args[0]);return!Number.isInteger(r)||r<0||r>e.positional.length?1:(e.positional=e.positional.slice(r),0)},async read(t,e){let r=t.args.includes("-r"),n=t.args.filter(a=>!a.startsWith("-")),s=await Ea(t.io.stdin,t.signal);if(s===null)return 1;r||(s=s.replace(/\\(.)/g,"$1"));let i=n.length?n:["REPLY"],o=n.length?s.trim().split(/\s+/):[s];return i.forEach((a,c)=>{e.env[a]=c===i.length-1?o.slice(c).join(" "):o[c]??""}),0},async jobs(t,e){for(let r of e.jobs.values())t.io.stdout(`[${r.id}] Running
147
- `);return 0},async wait(t,e){let r=t.args.map(i=>Number(i.replace(/^%/,""))),n=r.length?r.map(i=>e.jobs.get(i)).filter(i=>!!i):[...e.jobs.values()],s=await Promise.all(n.map(i=>i.done));return s.length?s[s.length-1]:0}};function ba(t,e,r){let n=t.args[0]===void 0?1:Number(t.args[0]);return!Number.isInteger(n)||n<1?(t.io.stderr(`${r}: ${t.args[0]}: loop count out of range
148
- `),1):(e.flow={kind:r,levels:n},0)}Fe["."]=Fe.source;Fe[":"]=async()=>0;function Zl(t){let[e,...r]=t,n=r[0]!==void 0&&!r[0].startsWith("-")?r[0]:void 0;if(e==="vite"&&(n===void 0||n==="dev"||n==="serve"))return{tool:"vite",defaultPort:5173};if((e==="react-scripts"||e==="craco")&&n==="start")return{tool:"react-scripts",defaultPort:3e3}}function jr(t,e){let r=Zl(e);return r&&t.system.previewUrl&&!Fs(t.fs)?r:void 0}function Xl(t,e,r){let n=t.findIndex(o=>o==="--port"||o.startsWith("--port=")),s=n<0?r.PORT:t[n].includes("=")?t[n].split("=")[1]:t[n+1],i=Number(s);return Number.isInteger(i)&&i>0?i:e}async function Ca(t,e,r){let n=t.system.previewUrl,s=Xl(e,r.defaultPort,t.env),i=r.tool==="vite"?`
145
+ `),r=1)}return r},async set(){return 0},async break(t,e){return va(t,e,"break")},async continue(t,e){return va(t,e,"continue")},async return(t,e){if(!e.localFrames.length)return t.io.stderr("return: can only `return' from a function or sourced script\n"),1;let r=t.args[0]===void 0?e.lastStatus:Number(t.args[0])&255;return e.flow={kind:"return",status:r},r},async local(t,e){let r=e.localFrames[e.localFrames.length-1];if(!r)return t.io.stderr(`local: can only be used in a function
146
+ `),1;for(let n of t.args){let s=n.indexOf("="),i=s>0?n.slice(0,s):n;r.has(i)||r.set(i,e.env[i]),e.env[i]=s>0?n.slice(s+1):""}return 0},async shift(t,e){let r=t.args[0]===void 0?1:Number(t.args[0]);return!Number.isInteger(r)||r<0||r>e.positional.length?1:(e.positional=e.positional.slice(r),0)},async read(t,e){let r=t.args.includes("-r"),n=t.args.filter(a=>!a.startsWith("-")),s=await Ca(t.io.stdin,t.signal);if(s===null)return 1;r||(s=s.replace(/\\(.)/g,"$1"));let i=n.length?n:["REPLY"],o=n.length?s.trim().split(/\s+/):[s];return i.forEach((a,c)=>{e.env[a]=c===i.length-1?o.slice(c).join(" "):o[c]??""}),0},async jobs(t,e){for(let r of e.jobs.values())t.io.stdout(`[${r.id}] Running
147
+ `);return 0},async wait(t,e){let r=t.args.map(i=>Number(i.replace(/^%/,""))),n=r.length?r.map(i=>e.jobs.get(i)).filter(i=>!!i):[...e.jobs.values()],s=await Promise.all(n.map(i=>i.done));return s.length?s[s.length-1]:0}};function va(t,e,r){let n=t.args[0]===void 0?1:Number(t.args[0]);return!Number.isInteger(n)||n<1?(t.io.stderr(`${r}: ${t.args[0]}: loop count out of range
148
+ `),1):(e.flow={kind:r,levels:n},0)}Me["."]=Me.source;Me[":"]=async()=>0;function ef(t){let[e,...r]=t,n=r[0]!==void 0&&!r[0].startsWith("-")?r[0]:void 0;if(e==="vite"&&(n===void 0||n==="dev"||n==="serve"))return{tool:"vite",defaultPort:5173};if((e==="react-scripts"||e==="craco")&&n==="start")return{tool:"react-scripts",defaultPort:3e3}}function jr(t,e){let r=ef(e);return r&&t.system.previewUrl&&!Us(ms(t.fs,t.cwd))?r:void 0}function tf(t,e,r){let n=t.findIndex(o=>o==="--port"||o.startsWith("--port=")),s=n<0?r.PORT:t[n].includes("=")?t[n].split("=")[1]:t[n+1],i=Number(s);return Number.isInteger(i)&&i>0?i:e}async function Sa(t,e,r){let n=t.system.previewUrl,s=tf(e,r.defaultPort,t.env),i=r.tool==="vite"?`
149
149
  VITE (BuilderForce in-browser dev server) ready
150
150
 
151
151
  \u279C Local: ${n}
@@ -157,60 +157,60 @@ You can now view the app in the browser.
157
157
 
158
158
  Local: ${n}
159
159
 
160
- `;return t.io.stdout(i),t.system.announceServer(s,n),await new Promise(o=>{t.signal.aborted&&o(),t.signal.addEventListener("abort",()=>o())}),130}function us(t){let e=t.flow;return e?e.kind==="return"?!1:e.levels>1?(t.flow={kind:e.kind,levels:e.levels-1},!1):(t.flow=void 0,e.kind==="continue"):!0}async function ds(t,e,r,n,s){switch(t.type){case"group":return e.runScript(t.body,r,n,s);case"subshell":return e.subshell().runScript(t.body,r,n,s);case"if":{for(let i of t.clauses){let o=await e.runScript(i.condition,r,n,s);if(e.flow)return o;if(o===0)return e.runScript(i.body,r,n,s)}return t.otherwise?e.runScript(t.otherwise,r,n,s):0}case"while":case"until":{let i=0;for(;!s.aborted;){let o=await e.runScript(t.condition,r,n,s);if(e.flow&&!us(e)||o===0!=(t.type==="while")||(i=await e.runScript(t.body,r,n,s),!us(e)))break}return i}case"for":{let i=t.items?await e.expandWords(t.items,r,s):[...e.positional],o=0;for(let a of i)if(s.aborted||(e.setVar(t.name,a),o=await e.runScript(t.body,r,n,s),!us(e)))break;return o}case"case":{let i=await e.expandText(t.subject,r,s);for(let o of t.arms)for(let a of o.patterns)if(as(await e.expandText(a,r,s),{slash:!0}).test(i))return e.runScript(o.body,r,n,s);return 0}}}var ef=500,Kr=class t{constructor(e){m(this,"options");m(this,"cwd");m(this,"env");m(this,"lastStatus",0);m(this,"history",[]);m(this,"exitRequested");m(this,"flow");m(this,"positional");m(this,"functions");m(this,"jobs",new Map);m(this,"localFrames",[]);m(this,"pid",ef++);m(this,"system");m(this,"nextJob",1);m(this,"current");this.options=e,this.system=e.system,this.cwd=e.cwd,this.env={...e.env,PWD:e.cwd},this.positional=[...e.positional??[]],this.functions=new Map(e.functions)}fork(e){return new t({...this.options,cwd:e.cwd??this.cwd,env:{...this.env,...e.env},positional:e.positional??this.positional,functions:this.functions})}subshell(){return this.fork({})}async exec(e,r,n,s){let i;try{i=$r(e)}catch(a){if(!(a instanceof H))throw a;return r.stderr(`bfsh: ${a.message}
161
- `),this.lastStatus=2,2}let o=this.current;this.current={io:r,input:n,signal:s};try{await this.runScript(i,r,n,s)}finally{this.current=o,this.localFrames.length||(this.flow=void 0)}return s.aborted&&this.lastStatus===0&&(this.lastStatus=130),this.exitRequested??this.lastStatus}run(e){let r=this.current;if(!r)throw new Error("Shell.run outside a job");return this.exec(e,r.io,r.input,r.signal)}async runScript(e,r,n,s){for(let i of e){if(this.exitRequested!==void 0||s.aborted||this.flow)break;let o=async()=>{let a=await this.runPipeline(i.first,r,n,s);for(let{op:c,pipeline:u}of i.rest){if(this.exitRequested!==void 0||s.aborted||this.flow)break;c==="&&"==(a===0)&&(a=await this.runPipeline(u,r,n,s))}return a};if(i.background){let a=this.nextJob++,c=o();this.jobs.set(a,{id:a,done:c}),c.finally(()=>this.jobs.delete(a)),this.lastStatus=0}else this.lastStatus=await o()}return this.lastStatus}expandWords(e,r,n){return ls(e,this.expandContext(r,n))}async expandText(e,r,n){return(await vt(e,this.expandContext(r,n),{split:!1,glob:!1})).join("")}setVar(e,r){this.env[e]=r}expandContext(e,r){return{fs:this.system.fs,cwd:this.cwd,get:n=>this.env[n],set:(n,s)=>void(this.env[n]=s),positional:this.positional,lastStatus:this.lastStatus,pid:this.pid,substitute:async n=>{let s="";return await this.fork({}).exec(n,{stdout:o=>s+=o,stderr:e.stderr,isTerminal:!1},{queue:tf()},r),s}}}async runPipeline(e,r,n,s){let i=e.commands.length,o=Array.from({length:i-1},()=>new oe),a=await Promise.all(e.commands.map(async(u,f)=>{let l=f===0?n:{queue:o[f-1]},h={stdout:f===i-1?r.stdout:p=>o[f].push(p),stderr:r.stderr,isTerminal:r.isTerminal&&f===i-1};try{return await this.runCommand(u,h,l,s,i===1)}finally{f<i-1&&o[f].push(null)}})),c=a[a.length-1];return e.negate?c===0?1:0:c}async runCommand(e,r,n,s,i){if(e.type==="function")return this.functions.set(e.name,e),0;if(e.type==="simple")return this.runSimple(e,r,n,s,i);let o=await this.applyRedirects(e.redirects,r,n,s);if(typeof o=="number")return o;try{return await ds(e,this,o.io,o.input,s)}finally{o.flush()}}async runSimple(e,r,n,s,i){let o=this.expandContext(r,s),a=await ls(e.words,o),c={};for(let{name:f,value:l}of e.assignments)c[f]=(await vt(l,o,{split:!1,glob:!1})).join("");if(!a.length)return Object.assign(this.env,c),0;let u=await this.applyRedirects(e.redirects,r,n,s);if(typeof u=="number")return u;try{return await this.dispatch(a,c,u.io,u.input,s,i&&u.io.isTerminal)}finally{u.flush()}}async applyRedirects(e,r,n,s){let{stdout:i,stderr:o,isTerminal:a}=r,c=n,u=[],f=l=>{let d=new oe;return d.push(l),d.push(null),{queue:d}};for(let l of e){if(l.op==="2>&1"){o=i;continue}if(l.op===">&2"){i=o;continue}if(l.heredoc){let E=await this.expandText(l.heredoc.body,r,s);c=f(E);continue}let d=(await vt(l.target,this.expandContext(r,s))).join(" "),h=ee(this,d);if(l.op==="<"){let E=this.system.fs.readText(h);if(E===void 0)return r.stderr(`bfsh: ${d}: No such file or directory
160
+ `;return t.io.stdout(i),t.system.announceServer(s,n),await new Promise(o=>{t.signal.aborted&&o(),t.signal.addEventListener("abort",()=>o())}),130}function ds(t){let e=t.flow;return e?e.kind==="return"?!1:e.levels>1?(t.flow={kind:e.kind,levels:e.levels-1},!1):(t.flow=void 0,e.kind==="continue"):!0}async function hs(t,e,r,n,s){switch(t.type){case"group":return e.runScript(t.body,r,n,s);case"subshell":return e.subshell().runScript(t.body,r,n,s);case"if":{for(let i of t.clauses){let o=await e.runScript(i.condition,r,n,s);if(e.flow)return o;if(o===0)return e.runScript(i.body,r,n,s)}return t.otherwise?e.runScript(t.otherwise,r,n,s):0}case"while":case"until":{let i=0;for(;!s.aborted;){let o=await e.runScript(t.condition,r,n,s);if(e.flow&&!ds(e)||o===0!=(t.type==="while")||(i=await e.runScript(t.body,r,n,s),!ds(e)))break}return i}case"for":{let i=t.items?await e.expandWords(t.items,r,s):[...e.positional],o=0;for(let a of i)if(s.aborted||(e.setVar(t.name,a),o=await e.runScript(t.body,r,n,s),!ds(e)))break;return o}case"case":{let i=await e.expandText(t.subject,r,s);for(let o of t.arms)for(let a of o.patterns)if(cs(await e.expandText(a,r,s),{slash:!0}).test(i))return e.runScript(o.body,r,n,s);return 0}}}var rf=500,Kr=class t{constructor(e){m(this,"options");m(this,"cwd");m(this,"env");m(this,"lastStatus",0);m(this,"history",[]);m(this,"exitRequested");m(this,"flow");m(this,"positional");m(this,"functions");m(this,"jobs",new Map);m(this,"localFrames",[]);m(this,"pid",rf++);m(this,"system");m(this,"nextJob",1);m(this,"current");this.options=e,this.system=e.system,this.cwd=e.cwd,this.env={...e.env,PWD:e.cwd},this.positional=[...e.positional??[]],this.functions=new Map(e.functions)}fork(e){return new t({...this.options,cwd:e.cwd??this.cwd,env:{...this.env,...e.env},positional:e.positional??this.positional,functions:this.functions})}subshell(){return this.fork({})}async exec(e,r,n,s){let i;try{i=$r(e)}catch(a){if(!(a instanceof H))throw a;return r.stderr(`bfsh: ${a.message}
161
+ `),this.lastStatus=2,2}let o=this.current;this.current={io:r,input:n,signal:s};try{await this.runScript(i,r,n,s)}finally{this.current=o,this.localFrames.length||(this.flow=void 0)}return s.aborted&&this.lastStatus===0&&(this.lastStatus=130),this.exitRequested??this.lastStatus}run(e){let r=this.current;if(!r)throw new Error("Shell.run outside a job");return this.exec(e,r.io,r.input,r.signal)}async runScript(e,r,n,s){for(let i of e){if(this.exitRequested!==void 0||s.aborted||this.flow)break;let o=async()=>{let a=await this.runPipeline(i.first,r,n,s);for(let{op:c,pipeline:u}of i.rest){if(this.exitRequested!==void 0||s.aborted||this.flow)break;c==="&&"==(a===0)&&(a=await this.runPipeline(u,r,n,s))}return a};if(i.background){let a=this.nextJob++,c=o();this.jobs.set(a,{id:a,done:c}),c.finally(()=>this.jobs.delete(a)),this.lastStatus=0}else this.lastStatus=await o()}return this.lastStatus}expandWords(e,r,n){return fs(e,this.expandContext(r,n))}async expandText(e,r,n){return(await St(e,this.expandContext(r,n),{split:!1,glob:!1})).join("")}setVar(e,r){this.env[e]=r}expandContext(e,r){return{fs:this.system.fs,cwd:this.cwd,get:n=>this.env[n],set:(n,s)=>void(this.env[n]=s),positional:this.positional,lastStatus:this.lastStatus,pid:this.pid,substitute:async n=>{let s="";return await this.fork({}).exec(n,{stdout:o=>s+=o,stderr:e.stderr,isTerminal:!1},{queue:nf()},r),s}}}async runPipeline(e,r,n,s){let i=e.commands.length,o=Array.from({length:i-1},()=>new oe),a=await Promise.all(e.commands.map(async(u,f)=>{let l=f===0?n:{queue:o[f-1]},h={stdout:f===i-1?r.stdout:p=>o[f].push(p),stderr:r.stderr,isTerminal:r.isTerminal&&f===i-1};try{return await this.runCommand(u,h,l,s,i===1)}finally{f<i-1&&o[f].push(null)}})),c=a[a.length-1];return e.negate?c===0?1:0:c}async runCommand(e,r,n,s,i){if(e.type==="function")return this.functions.set(e.name,e),0;if(e.type==="simple")return this.runSimple(e,r,n,s,i);let o=await this.applyRedirects(e.redirects,r,n,s);if(typeof o=="number")return o;try{return await hs(e,this,o.io,o.input,s)}finally{o.flush()}}async runSimple(e,r,n,s,i){let o=this.expandContext(r,s),a=await fs(e.words,o),c={};for(let{name:f,value:l}of e.assignments)c[f]=(await St(l,o,{split:!1,glob:!1})).join("");if(!a.length)return Object.assign(this.env,c),0;let u=await this.applyRedirects(e.redirects,r,n,s);if(typeof u=="number")return u;try{return await this.dispatch(a,c,u.io,u.input,s,i&&u.io.isTerminal)}finally{u.flush()}}async applyRedirects(e,r,n,s){let{stdout:i,stderr:o,isTerminal:a}=r,c=n,u=[],f=l=>{let d=new oe;return d.push(l),d.push(null),{queue:d}};for(let l of e){if(l.op==="2>&1"){o=i;continue}if(l.op===">&2"){i=o;continue}if(l.heredoc){let E=await this.expandText(l.heredoc.body,r,s);c=f(E);continue}let d=(await St(l.target,this.expandContext(r,s))).join(" "),h=ee(this,d);if(l.op==="<"){let E=this.system.fs.readText(h);if(E===void 0)return r.stderr(`bfsh: ${d}: No such file or directory
162
162
  `),1;c=f(E);continue}if(this.system.fs.isDirectory(h))return r.stderr(`bfsh: ${d}: Is a directory
163
- `),1;let y=l.op===">>"||l.op==="2>>"?this.system.fs.readText(h)??"":"";this.system.fs.writeFile(h,y);let b=E=>void(y+=E);u.push(()=>this.system.fs.writeFile(h,y)),l.op==="2>"||l.op==="2>>"?o=b:l.op==="&>"?i=o=b:(i=b,a=!1)}return{io:{stdout:i,stderr:o,isTerminal:a},input:c,flush:()=>u.forEach(l=>l())}}async dispatch(e,r,n,s,i,o){let[a,...c]=e,u=this.functions.get(a);if(u)return this.callFunction(u,c,n,s,i);let f={...this.env,...r},l={args:c,name:a,cwd:this.cwd,env:f,fs:this.system.fs,system:this.system,io:{stdout:n.stdout,stderr:n.stderr,stdin:s.queue,isTerminal:n.isTerminal},signal:i},d=Fe[a];if(d)return d(l,this);let h=this.options.commands?.[a];if(h)return h(l,this,s);let p=jr(l,e);if(p)return Ca(l,e,p);let y=qe[a];return y?y(l):this.spawnExternal(a,c,f,n,s,i,o)}async callFunction(e,r,n,s,i){let o=this.positional;this.positional=r;let a=new Map;this.localFrames.push(a);try{let c=await ds(e.body,this,n,s,i);return this.flow?.kind==="return"&&(c=this.flow.status,this.flow=void 0),c}finally{this.localFrames.pop();for(let[c,u]of a)u===void 0?delete this.env[c]:this.env[c]=u;this.positional=o}}async spawnExternal(e,r,n,s,i,o,a){let c=a?this.options.terminalSize?.():void 0,u;try{u=this.system.spawn(e,r,{cwd:this.cwd,env:n,terminal:c})}catch(d){if(d.code!=="ENOENT")throw d;return s.stderr(`bfsh: command not found: ${e}
164
- `),127}u.onStdout(ae(d=>d!==null&&s.stdout(d))),u.onStderr(ae(d=>d!==null&&s.stderr(d)));let f;c&&i.setRawSink?i.setRawSink(d=>u.write(d)):f=i.queue.subscribe(d=>d===null?u.closeStdin():u.write(d));let l=()=>u.kill(typeof o.reason=="string"?o.reason:"SIGINT");o.aborted&&l(),o.addEventListener("abort",l);try{return await u.exit}finally{o.removeEventListener("abort",l),c&&i.setRawSink&&i.setRawSink(void 0),f?.()}}};function tf(){let t=new oe;return t.push(null),t}var rf=[[/^\x1b\[(?:1;\d)?A/,"up"],[/^\x1b\[(?:1;\d)?B/,"down"],[/^\x1b\[1;[35]C|^\x1bf/,"wordRight"],[/^\x1b\[1;[35]D|^\x1bb/,"wordLeft"],[/^\x1b\[C|^\x1bOC/,"right"],[/^\x1b\[D|^\x1bOD/,"left"],[/^\x1b\[(?:H|1~|7~)|^\x1bOH/,"home"],[/^\x1b\[(?:F|4~|8~)|^\x1bOF/,"end"],[/^\x1b\[3~/,"delete"],[/^\x1b\[[0-9;]*[~A-Za-z]|^\x1bO[A-Za-z]|^\x1b./,"ignore"]];function nf(t){if(!t.length)return"";let e=t[0];for(let r of t)for(;!r.startsWith(e);)e=e.slice(0,-1);return e}var Hr=class{constructor(e){m(this,"options");m(this,"line","");m(this,"cursor",0);m(this,"prompt","");m(this,"historyIndex",-1);m(this,"draft","");this.options=e}begin(e){this.prompt=e,this.line="",this.cursor=0,this.historyIndex=-1,this.options.write(e)}feed(e){let r=0;for(;r<e.length;){let n=e[r];if(n==="\x1B"){let s=e.slice(r),i=rf.find(([a])=>a.test(s)),o=i?i[0].exec(s)[0]:"\x1B";r+=o.length,this.key(i?.[1]??"ignore");continue}switch(r++,n){case"\r":case`
163
+ `),1;let y=l.op===">>"||l.op==="2>>"?this.system.fs.readText(h)??"":"";this.system.fs.writeFile(h,y);let b=E=>void(y+=E);u.push(()=>this.system.fs.writeFile(h,y)),l.op==="2>"||l.op==="2>>"?o=b:l.op==="&>"?i=o=b:(i=b,a=!1)}return{io:{stdout:i,stderr:o,isTerminal:a},input:c,flush:()=>u.forEach(l=>l())}}async dispatch(e,r,n,s,i,o){let[a,...c]=e,u=this.functions.get(a);if(u)return this.callFunction(u,c,n,s,i);let f={...this.env,...r},l={args:c,name:a,cwd:this.cwd,env:f,fs:this.system.fs,system:this.system,io:{stdout:n.stdout,stderr:n.stderr,stdin:s.queue,isTerminal:n.isTerminal},signal:i},d=Me[a];if(d)return d(l,this);let h=this.options.commands?.[a];if(h)return h(l,this,s);let p=jr(l,e);if(p)return Sa(l,e,p);let y=qe[a];return y?y(l):this.spawnExternal(a,c,f,n,s,i,o)}async callFunction(e,r,n,s,i){let o=this.positional;this.positional=r;let a=new Map;this.localFrames.push(a);try{let c=await hs(e.body,this,n,s,i);return this.flow?.kind==="return"&&(c=this.flow.status,this.flow=void 0),c}finally{this.localFrames.pop();for(let[c,u]of a)u===void 0?delete this.env[c]:this.env[c]=u;this.positional=o}}async spawnExternal(e,r,n,s,i,o,a){let c=a?this.options.terminalSize?.():void 0,u;try{u=this.system.spawn(e,r,{cwd:this.cwd,env:n,terminal:c})}catch(d){if(d.code!=="ENOENT")throw d;return s.stderr(`bfsh: command not found: ${e}
164
+ `),127}u.onStdout(ae(d=>d!==null&&s.stdout(d))),u.onStderr(ae(d=>d!==null&&s.stderr(d)));let f;c&&i.setRawSink?i.setRawSink(d=>u.write(d)):f=i.queue.subscribe(d=>d===null?u.closeStdin():u.write(d));let l=()=>u.kill(typeof o.reason=="string"?o.reason:"SIGINT");o.aborted&&l(),o.addEventListener("abort",l);try{return await u.exit}finally{o.removeEventListener("abort",l),c&&i.setRawSink&&i.setRawSink(void 0),f?.()}}};function nf(){let t=new oe;return t.push(null),t}var sf=[[/^\x1b\[(?:1;\d)?A/,"up"],[/^\x1b\[(?:1;\d)?B/,"down"],[/^\x1b\[1;[35]C|^\x1bf/,"wordRight"],[/^\x1b\[1;[35]D|^\x1bb/,"wordLeft"],[/^\x1b\[C|^\x1bOC/,"right"],[/^\x1b\[D|^\x1bOD/,"left"],[/^\x1b\[(?:H|1~|7~)|^\x1bOH/,"home"],[/^\x1b\[(?:F|4~|8~)|^\x1bOF/,"end"],[/^\x1b\[3~/,"delete"],[/^\x1b\[[0-9;]*[~A-Za-z]|^\x1bO[A-Za-z]|^\x1b./,"ignore"]];function of(t){if(!t.length)return"";let e=t[0];for(let r of t)for(;!r.startsWith(e);)e=e.slice(0,-1);return e}var Hr=class{constructor(e){m(this,"options");m(this,"line","");m(this,"cursor",0);m(this,"prompt","");m(this,"historyIndex",-1);m(this,"draft","");this.options=e}begin(e){this.prompt=e,this.line="",this.cursor=0,this.historyIndex=-1,this.options.write(e)}feed(e){let r=0;for(;r<e.length;){let n=e[r];if(n==="\x1B"){let s=e.slice(r),i=sf.find(([a])=>a.test(s)),o=i?i[0].exec(s)[0]:"\x1B";r+=o.length,this.key(i?.[1]??"ignore");continue}switch(r++,n){case"\r":case`
165
165
  `:{n==="\r"&&e[r]===`
166
166
  `&&r++;let s=this.line;return this.options.write(`\r
167
167
  `),s.trim()&&this.options.history[this.options.history.length-1]!==s&&this.options.history.push(s),this.line="",this.cursor=0,{event:{type:"line",line:s},rest:e.slice(r)}}case"":return this.options.write(`^C\r
168
- `),this.line="",this.cursor=0,{event:{type:"interrupt"},rest:e.slice(r)};case"":if(!this.line)return{event:{type:"eof"},rest:e.slice(r)};this.key("delete");break;case"\x7F":case"\b":this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--,this.redraw());break;case"":this.key("home");break;case"":this.key("end");break;case"":this.key("left");break;case"":this.key("right");break;case"":this.key("up");break;case"":this.key("down");break;case"":this.line=this.line.slice(this.cursor),this.cursor=0,this.redraw();break;case"\v":this.line=this.line.slice(0,this.cursor),this.redraw();break;case"":{let s=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"");this.line=s+this.line.slice(this.cursor),this.cursor=s.length,this.redraw();break}case"\f":this.options.write("\x1B[2J\x1B[H"),this.redraw();break;case" ":this.complete();break;default:n>=" "&&this.insert(n)}}return{rest:""}}insert(e){this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor+=e.length,this.cursor===this.line.length?this.options.write(e):this.redraw()}key(e){let r=this.options.history;switch(e){case"left":this.cursor>0&&(this.cursor--,this.options.write("\x1B[D"));return;case"right":this.cursor<this.line.length&&(this.cursor++,this.options.write("\x1B[C"));return;case"wordLeft":return this.cursor=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"").length,this.redraw();case"wordRight":{let n=/^\s*\S+/.exec(this.line.slice(this.cursor));return this.cursor+=n?n[0].length:0,this.redraw()}case"home":return this.cursor=0,this.redraw();case"end":return this.cursor=this.line.length,this.redraw();case"delete":this.cursor<this.line.length&&(this.line=this.line.slice(0,this.cursor)+this.line.slice(this.cursor+1),this.redraw());return;case"up":return r.length?(this.historyIndex===-1?(this.draft=this.line,this.historyIndex=r.length-1):this.historyIndex>0&&this.historyIndex--,this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw()):void 0;case"down":return this.historyIndex===-1?void 0:(this.historyIndex++,this.historyIndex>=r.length?(this.historyIndex=-1,this.line=this.draft):this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw())}}complete(){let e=this.line.slice(0,this.cursor),r=/\S*$/.exec(e)[0],n=this.options.complete?.(e,r)??[];if(!n.length)return;if(n.length===1){let i=n[0];this.insert(i.slice(r.length)+(i.endsWith("/")?"":" "));return}let s=nf(n);if(s.length>r.length){this.insert(s.slice(r.length));return}this.options.write(`\r
168
+ `),this.line="",this.cursor=0,{event:{type:"interrupt"},rest:e.slice(r)};case"":if(!this.line)return{event:{type:"eof"},rest:e.slice(r)};this.key("delete");break;case"\x7F":case"\b":this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--,this.redraw());break;case"":this.key("home");break;case"":this.key("end");break;case"":this.key("left");break;case"":this.key("right");break;case"":this.key("up");break;case"":this.key("down");break;case"":this.line=this.line.slice(this.cursor),this.cursor=0,this.redraw();break;case"\v":this.line=this.line.slice(0,this.cursor),this.redraw();break;case"":{let s=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"");this.line=s+this.line.slice(this.cursor),this.cursor=s.length,this.redraw();break}case"\f":this.options.write("\x1B[2J\x1B[H"),this.redraw();break;case" ":this.complete();break;default:n>=" "&&this.insert(n)}}return{rest:""}}insert(e){this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor+=e.length,this.cursor===this.line.length?this.options.write(e):this.redraw()}key(e){let r=this.options.history;switch(e){case"left":this.cursor>0&&(this.cursor--,this.options.write("\x1B[D"));return;case"right":this.cursor<this.line.length&&(this.cursor++,this.options.write("\x1B[C"));return;case"wordLeft":return this.cursor=this.line.slice(0,this.cursor).replace(/\S+\s*$/,"").length,this.redraw();case"wordRight":{let n=/^\s*\S+/.exec(this.line.slice(this.cursor));return this.cursor+=n?n[0].length:0,this.redraw()}case"home":return this.cursor=0,this.redraw();case"end":return this.cursor=this.line.length,this.redraw();case"delete":this.cursor<this.line.length&&(this.line=this.line.slice(0,this.cursor)+this.line.slice(this.cursor+1),this.redraw());return;case"up":return r.length?(this.historyIndex===-1?(this.draft=this.line,this.historyIndex=r.length-1):this.historyIndex>0&&this.historyIndex--,this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw()):void 0;case"down":return this.historyIndex===-1?void 0:(this.historyIndex++,this.historyIndex>=r.length?(this.historyIndex=-1,this.line=this.draft):this.line=r[this.historyIndex],this.cursor=this.line.length,this.redraw())}}complete(){let e=this.line.slice(0,this.cursor),r=/\S*$/.exec(e)[0],n=this.options.complete?.(e,r)??[];if(!n.length)return;if(n.length===1){let i=n[0];this.insert(i.slice(r.length)+(i.endsWith("/")?"":" "));return}let s=of(n);if(s.length>r.length){this.insert(s.slice(r.length));return}this.options.write(`\r
169
169
  `+n.map(i=>i.slice(i.lastIndexOf("/",i.length-2)+1)).join(" ")+`\r
170
- `),this.redraw()}redraw(){let e=this.line.length-this.cursor;this.options.write(`\r\x1B[K${this.prompt}${this.line}${e?`\x1B[${e}D`:""}`)}};var va="10.8.2",hs=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Jt(t){return Je(t.fs,t.cwd)?.dir??t.cwd}function Wt(t,e){try{return JSON.parse(t.fs.readText(k(e,"package.json"))??"null")??void 0}catch{return}}async function Wr(t,e,r=Jt(t)){let n=performance.now(),s=t.io.isTerminal;try{let i=js(t.fs,[k(t.env.HOME??"/home/user",".npmrc"),k(r,".npmrc")],t.env),o=await mi({fs:t.fs,fetch:(u,f)=>t.system.fetch(u,f),registry:t.env.npm_config_registry??i.registry??t.system.registry,npmrc:i,cache:t.system.packageCache,cwd:r,signal:t.signal,onProgress:s?u=>u.phase==="fetch"&&t.io.stdout(`\r\x1B[Kfetching ${u.done}/${u.total} ${u.package??""}`):void 0,...e});s&&t.io.stdout("\r\x1B[K");for(let u of o.warnings)t.io.stderr(`npm warn ${u}
170
+ `),this.redraw()}redraw(){let e=this.line.length-this.cursor;this.options.write(`\r\x1B[K${this.prompt}${this.line}${e?`\x1B[${e}D`:""}`)}};var Ba="10.8.2",ps=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Jt(t){return Je(t.fs,t.cwd)?.dir??t.cwd}function Wt(t,e){try{return JSON.parse(t.fs.readText(k(e,"package.json"))??"null")??void 0}catch{return}}async function Wr(t,e,r=Jt(t)){let n=performance.now(),s=t.io.isTerminal;try{let i=Hs(t.fs,[k(t.env.HOME??"/home/user",".npmrc"),k(r,".npmrc")],t.env),o=await yi({fs:t.fs,fetch:(u,f)=>t.system.fetch(u,f),registry:t.env.npm_config_registry??i.registry??t.system.registry,npmrc:i,cache:t.system.packageCache,cwd:r,signal:t.signal,onProgress:s?u=>u.phase==="fetch"&&t.io.stdout(`\r\x1B[Kfetching ${u.done}/${u.total} ${u.package??""}`):void 0,...e});s&&t.io.stdout("\r\x1B[K");for(let u of o.warnings)t.io.stderr(`npm warn ${u}
171
171
  `);let a=((performance.now()-n)/1e3).toFixed(1),c=[o.added&&`added ${o.added} package${o.added===1?"":"s"}`,o.removed&&`removed ${o.removed} package${o.removed===1?"":"s"}`].filter(Boolean);return t.io.stdout(`
172
172
  ${c.length?c.join(", "):"up to date"}, audited ${o.total+1} packages in ${a}s
173
173
  `),0}catch(i){return s&&t.io.stdout("\r\x1B[K"),t.signal.aborted?130:(t.io.stderr(`npm error ${i instanceof Error?i.message:String(i)}
174
- `),1)}}async function Sa(t,e,r,n,s){let i=Jt(t),o=Wt(t,i);if(!o)return t.io.stderr(`npm error Could not read package.json in ${i}
174
+ `),1)}}async function Ia(t,e,r,n,s){let i=Jt(t),o=Wt(t,i);if(!o)return t.io.stderr(`npm error Could not read package.json in ${i}
175
175
  `),1;let a={...o.scripts};if(n==="start"&&!a.start&&t.fs.isFile(k(i,"server.js"))&&(a.start="node server.js"),!a[n])return n==="test"?(t.io.stderr(`npm error Missing script: "test"
176
176
  `),1):(t.io.stderr(`npm error Missing script: "${n}"
177
177
 
178
178
  To see a list of scripts, run:
179
179
  npm run
180
- `),1);let c=[...ut(i),t.env.PATH??""].filter(Boolean).join(":");for(let u of[`pre${n}`,n,`post${n}`]){let f=a[u];if(!f)continue;let l=u===n&&s.length?`${f} ${s.map(hs).join(" ")}`:f;t.io.stdout(`
180
+ `),1);let c=[...dt(i),t.env.PATH??""].filter(Boolean).join(":");for(let u of[`pre${n}`,n,`post${n}`]){let f=a[u];if(!f)continue;let l=u===n&&s.length?`${f} ${s.map(ps).join(" ")}`:f;t.io.stdout(`
181
181
  > ${o.name??""}${o.version?"@"+o.version:""} ${u}
182
182
  > ${l}
183
183
 
184
184
  `);let h=await e.fork({cwd:i,env:{PATH:c,npm_lifecycle_event:u,npm_lifecycle_script:f,npm_command:"run-script",npm_package_name:o.name??"",npm_package_version:o.version??"",npm_package_json:k(i,"package.json"),INIT_CWD:t.cwd,NODE:"/usr/local/bin/node"}}).exec(l,{stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal},r,t.signal);if(h!==0)return t.signal.aborted||t.io.stderr(`npm error Lifecycle script \`${u}\` failed with error:
185
185
  npm error code ${h}
186
- `),h}return 0}function sf(t){let e=Wt(t,Jt(t)),r=Object.entries(e?.scripts??{});return r.length&&t.io.stdout(`Scripts available in ${e?.name??"this package"} via \`npm run-script\`:
186
+ `),h}return 0}function af(t){let e=Wt(t,Jt(t)),r=Object.entries(e?.scripts??{});return r.length&&t.io.stdout(`Scripts available in ${e?.name??"this package"} via \`npm run-script\`:
187
187
  ${r.map(([n,s])=>` ${n}
188
188
  ${s}`).join(`
189
189
  `)}
190
- `),0}async function Jr(t,e,r){let[n="help",...s]=t.args,{flags:i,operands:o}=Ae(s,["registry"]),a=i.has("D")||i.has("save-dev"),c=i.has("production")||s.includes("--omit=dev");switch(n){case"-v":case"--version":case"version":return t.io.stdout(`${va}
190
+ `),0}async function Jr(t,e,r){let[n="help",...s]=t.args,{flags:i,operands:o}=Ae(s,["registry"]),a=i.has("D")||i.has("save-dev"),c=i.has("production")||s.includes("--omit=dev");switch(n){case"-v":case"--version":case"version":return t.io.stdout(`${Ba}
191
191
  `),0;case"install":case"i":case"add":case"isntall":return Wr(t,{add:o,saveDev:a,production:c});case"ci":case"clean-install":return Wr(t,{ci:!0,production:c});case"uninstall":case"remove":case"rm":case"un":{let u=Jt(t),f=Wt(t,u);if(!f)return t.io.stderr(`npm error No package.json found
192
192
  `),1;for(let l of["dependencies","devDependencies","optionalDependencies"])for(let d of o)f[l]&&delete f[l][d];return t.fs.writeFile(k(u,"package.json"),JSON.stringify(f,null,2)+`
193
- `),Wr(t,{},u)}case"run":case"run-script":{let u=s.indexOf("--"),[f,...l]=u>=0?[...s.slice(0,u),...s.slice(u+1)]:s;return f?Sa(t,e,r,f,l):sf(t)}case"start":case"test":case"t":case"stop":case"restart":return Sa(t,e,r,n==="t"?"test":n,s.filter(u=>u!=="--"));case"init":{let u=k(t.cwd,"package.json");if(t.fs.isFile(u))return t.io.stderr(`npm error package.json already exists
193
+ `),Wr(t,{},u)}case"run":case"run-script":{let u=s.indexOf("--"),[f,...l]=u>=0?[...s.slice(0,u),...s.slice(u+1)]:s;return f?Ia(t,e,r,f,l):af(t)}case"start":case"test":case"t":case"stop":case"restart":return Ia(t,e,r,n==="t"?"test":n,s.filter(u=>u!=="--"));case"init":{let u=k(t.cwd,"package.json");if(t.fs.isFile(u))return t.io.stderr(`npm error package.json already exists
194
194
  `),1;let l={name:t.cwd.split("/").filter(Boolean).pop()??"project",version:"1.0.0",description:"",main:"index.js",scripts:{test:'echo "Error: no test specified" && exit 1'},keywords:[],author:"",license:"ISC"};return t.fs.writeFile(u,JSON.stringify(l,null,2)+`
195
195
  `),t.io.stdout(`Wrote to ${u}:
196
196
 
197
197
  ${JSON.stringify(l,null,2)}
198
198
  `),0}case"ls":case"list":{let u=Jt(t),f=Wt(t,u),l={...f?.dependencies,...f?.devDependencies};t.io.stdout(`${f?.name??""}@${f?.version??""} ${u}
199
199
  `);let d=Object.keys(l).sort();return d.forEach((h,p)=>{let y=Wt(t,k(u,"node_modules",h))?.version;t.io.stdout(`${p===d.length-1?"\u2514\u2500\u2500":"\u251C\u2500\u2500"} ${h}@${y??`(missing ${l[h]})`}
200
- `)}),0}case"exec":case"x":return qt({...t,args:s.filter(u=>u!=="--")},e,r);case"help":case"-h":case"--help":return t.io.stdout(`npm ${va} (BuilderForce WebContainers)
200
+ `)}),0}case"exec":case"x":return qt({...t,args:s.filter(u=>u!=="--")},e,r);case"help":case"-h":case"--help":return t.io.stdout(`npm ${Ba} (BuilderForce WebContainers)
201
201
 
202
202
  Usage: npm <install|ci|uninstall|run|start|test|init|ls|exec> \u2026
203
203
  `),0;default:return t.io.stderr(`npm error Unknown command: "${n}"
204
204
  `),1}}async function qt(t,e,r){let n=t.args.filter(l=>l!=="-y"&&l!=="--yes"),s=n.findIndex(l=>l==="-p"||l==="--package"),i=s>=0?n.splice(s,2)[1]:void 0,[o,...a]=n;if(!o)return t.io.stderr(`npx: missing command
205
- `),1;let c=o.replace(/^@[^/]+\//,"").replace(/@[^@]*$/,""),u={stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal};if(jr(t,[c,...a]))return e.fork({}).exec([c,...a].map(hs).join(" "),u,r,t.signal);let f=me(t.fs,c,t.cwd,{PATH:""});if(!f){let l=i??o,d=`/tmp/.npx/${l.replace(/[^\w.-]+/g,"_")}`;t.fs.isFile(k(d,"package.json"))||t.fs.writeFile(k(d,"package.json"),`{"private": true}
205
+ `),1;let c=o.replace(/^@[^/]+\//,"").replace(/@[^@]*$/,""),u={stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal};if(jr(t,[c,...a]))return e.fork({}).exec([c,...a].map(ps).join(" "),u,r,t.signal);let f=me(t.fs,c,t.cwd,{PATH:""});if(!f){let l=i??o,d=`/tmp/.npx/${l.replace(/[^\w.-]+/g,"_")}`;t.fs.isFile(k(d,"package.json"))||t.fs.writeFile(k(d,"package.json"),`{"private": true}
206
206
  `),t.io.stderr(`npx: installing ${l}
207
207
  `);let h=await Wr({...t,io:{...t.io,stdout:()=>{}}},{add:[l]},d);if(h!==0)return h;if(f=me(t.fs,c,d,{PATH:""})??me(t.fs,t.fs.readdir(k(d,"node_modules/.bin"))[0]??c,d,{PATH:""}),!f)return t.io.stderr(`npx: ${l} has no executable named ${c}
208
- `),1}return e.fork({}).exec([f,...a].map(hs).join(" "),u,r,t.signal)}var of={pnpm:"9.12.0",yarn:"1.22.22"},af=new Set(["install","i"]),cf=new Set(["remove","rm","uninstall","un"]),lf=new Set(["test","t","start","init","ls","list","run","run-script"]);function ff(t,e){let r=Je(t.fs,t.cwd)?.dir??t.cwd;try{return!!JSON.parse(t.fs.readText(k(r,"package.json"))??"{}").scripts?.[e]}catch{return!1}}function Ba(t){return t.flatMap(e=>e==="--dev"||e==="-D"||e==="--save-dev"?["--save-dev"]:e==="--frozen-lockfile"||e==="--immutable"||e==="--prefer-offline"?[]:[e])}function uf(t,e,r){let[n,...s]=e;return n===void 0?{tool:"npm",args:["install"]}:n==="-v"||n==="--version"?{version:of[t]}:af.has(n)?{tool:"npm",args:["install",...Ba(s)]}:n==="add"?{tool:"npm",args:["install",...Ba(s)]}:cf.has(n)?{tool:"npm",args:["uninstall",...s]}:n==="dlx"||n==="exec"||t==="pnpm"&&n==="x"?{tool:"npx",args:s}:lf.has(n)?{tool:"npm",args:[n,...s]}:ff(r,n)?{tool:"npm",args:["run",n,...s.length?["--",...s]:[]]}:me(r.fs,n,r.cwd,{PATH:""})?{tool:"npx",args:[n,...s]}:{error:`${t}: no script or command named "${n}"`}}function Ia(t){return async(e,r,n)=>{let s=uf(t,e.args,e);if("version"in s)return e.io.stdout(`${s.version}
208
+ `),1}return e.fork({}).exec([f,...a].map(ps).join(" "),u,r,t.signal)}var cf={pnpm:"9.12.0",yarn:"1.22.22"},lf=new Set(["install","i"]),ff=new Set(["remove","rm","uninstall","un"]),uf=new Set(["test","t","start","init","ls","list","run","run-script"]);function df(t,e){let r=Je(t.fs,t.cwd)?.dir??t.cwd;try{return!!JSON.parse(t.fs.readText(k(r,"package.json"))??"{}").scripts?.[e]}catch{return!1}}function Qa(t){return t.flatMap(e=>e==="--dev"||e==="-D"||e==="--save-dev"?["--save-dev"]:e==="--frozen-lockfile"||e==="--immutable"||e==="--prefer-offline"?[]:[e])}function hf(t,e,r){let[n,...s]=e;return n===void 0?{tool:"npm",args:["install"]}:n==="-v"||n==="--version"?{version:cf[t]}:lf.has(n)?{tool:"npm",args:["install",...Qa(s)]}:n==="add"?{tool:"npm",args:["install",...Qa(s)]}:ff.has(n)?{tool:"npm",args:["uninstall",...s]}:n==="dlx"||n==="exec"||t==="pnpm"&&n==="x"?{tool:"npx",args:s}:uf.has(n)?{tool:"npm",args:[n,...s]}:df(r,n)?{tool:"npm",args:["run",n,...s.length?["--",...s]:[]]}:me(r.fs,n,r.cwd,{PATH:""})?{tool:"npx",args:[n,...s]}:{error:`${t}: no script or command named "${n}"`}}function ka(t){return async(e,r,n)=>{let s=hf(t,e.args,e);if("version"in s)return e.io.stdout(`${s.version}
209
209
  `),0;if("error"in s)return e.io.stderr(`${s.error}
210
- `),1;let i={...e,args:s.args,name:s.tool};return s.tool==="npm"?Jr(i,r,n):qt(i,r,n)}}var Qa=Ia("pnpm"),ka=Ia("yarn");var df={npm:Jr,npx:qt,pnpm:Qa,yarn:ka};function qr(t,e=[]){return new Kr({system:t.system,cwd:t.cwd,env:{...t.env,SHELL:"/bin/bfsh"},positional:e,terminalSize:()=>t.io.terminal?{cols:t.io.terminal.cols,rows:t.io.terminal.rows}:void 0,commands:df})}function _a(t,e){let r=new oe,n=t.io.terminal;if(!n){let a=t.io.onStdin(ae(c=>r.push(c)));return{input:{queue:r},stop:a}}n.setRawMode(!0);let s,i=new Ze({echo:a=>t.io.stdout(a),deliver:a=>r.push(a),signal:a=>e?.abort(a)}),o=t.io.onStdin(ae(a=>{a===null?r.push(null):s?s(a):i.input(a)}));return{input:{queue:r,setRawSink:a=>void(s=a)},stop(){o(),n.setRawMode(!1)}}}async function xa(t,e,r){let n=new AbortController,s=()=>n.abort(t.signal.reason);t.signal.addEventListener("abort",s);let{input:i,stop:o}=_a(t,n);try{return await e.exec(r,ps(t),i,n.signal)}finally{o(),t.signal.removeEventListener("abort",s)}}var ps=t=>({stdout:e=>t.io.stdout(e),stderr:e=>t.io.stderr(e),isTerminal:!!t.io.terminal});function hf(t,e){return e&&(t===e||t.startsWith(e+"/"))?"~"+t.slice(e.length):t}function pf(t){return(e,r)=>{let n=!/\S\s/.test(e.trimStart())&&!r.includes("/"),s=t.system.fs,i=r.includes("/")?r.slice(0,r.lastIndexOf("/")+1):"",o=cs(s,t.cwd,`${i}*`).filter(c=>c.slice(i.length).startsWith(r.slice(i.length))||!i).filter(c=>c.startsWith(r)).map(c=>s.isDirectory(c.startsWith("/")?c:k(t.cwd,c))?c+"/":c);if(!n)return o.sort();let a=new Set([...Object.keys(Fe),...Object.keys(qe),...Pr]);for(let c of ut(t.cwd))for(let u of s.readdir(c))a.add(u);return[...[...a].filter(c=>c.startsWith(r)).sort(),...o.filter(c=>c.endsWith("/"))]}}async function Af(t){let e=t.io.terminal,r=qr(t),n=ps(t);e.setRawMode(!0);let s=new Hr({write:b=>t.io.stdout(b),history:r.history,complete:pf(r)}),i=()=>`\x1B[1;36m${hf(r.cwd,r.env.HOME)}\x1B[0m \x1B[1;32m$\x1B[0m `,o,a="",c="",u,f=new Promise(b=>u=b),l=async b=>{let E=new oe,C=new AbortController,A=new Ze({echo:w=>t.io.stdout(w),deliver:w=>E.push(w),signal:w=>C.abort(w)}),g={controller:C,input:{queue:E},discipline:A};g.input.setRawSink=w=>void(g.rawSink=w),o=g;try{await r.exec(b,n,g.input,C.signal)}catch(w){t.io.stderr(`bfsh: ${w instanceof Error?w.message:String(w)}
210
+ `),1;let i={...e,args:s.args,name:s.tool};return s.tool==="npm"?Jr(i,r,n):qt(i,r,n)}}var xa=ka("pnpm"),_a=ka("yarn");var pf={npm:Jr,npx:qt,pnpm:xa,yarn:_a};function qr(t,e=[]){return new Kr({system:t.system,cwd:t.cwd,env:{...t.env,SHELL:"/bin/bfsh"},positional:e,terminalSize:()=>t.io.terminal?{cols:t.io.terminal.cols,rows:t.io.terminal.rows}:void 0,commands:pf})}function Oa(t,e){let r=new oe,n=t.io.terminal;if(!n){let a=t.io.onStdin(ae(c=>r.push(c)));return{input:{queue:r},stop:a}}n.setRawMode(!0);let s,i=new Xe({echo:a=>t.io.stdout(a),deliver:a=>r.push(a),signal:a=>e?.abort(a)}),o=t.io.onStdin(ae(a=>{a===null?r.push(null):s?s(a):i.input(a)}));return{input:{queue:r,setRawSink:a=>void(s=a)},stop(){o(),n.setRawMode(!1)}}}async function Da(t,e,r){let n=new AbortController,s=()=>n.abort(t.signal.reason);t.signal.addEventListener("abort",s);let{input:i,stop:o}=Oa(t,n);try{return await e.exec(r,As(t),i,n.signal)}finally{o(),t.signal.removeEventListener("abort",s)}}var As=t=>({stdout:e=>t.io.stdout(e),stderr:e=>t.io.stderr(e),isTerminal:!!t.io.terminal});function Af(t,e){return e&&(t===e||t.startsWith(e+"/"))?"~"+t.slice(e.length):t}function gf(t){return(e,r)=>{let n=!/\S\s/.test(e.trimStart())&&!r.includes("/"),s=t.system.fs,i=r.includes("/")?r.slice(0,r.lastIndexOf("/")+1):"",o=ls(s,t.cwd,`${i}*`).filter(c=>c.slice(i.length).startsWith(r.slice(i.length))||!i).filter(c=>c.startsWith(r)).map(c=>s.isDirectory(c.startsWith("/")?c:k(t.cwd,c))?c+"/":c);if(!n)return o.sort();let a=new Set([...Object.keys(Me),...Object.keys(qe),...Pr]);for(let c of dt(t.cwd))for(let u of s.readdir(c))a.add(u);return[...[...a].filter(c=>c.startsWith(r)).sort(),...o.filter(c=>c.endsWith("/"))]}}async function mf(t){let e=t.io.terminal,r=qr(t),n=As(t);e.setRawMode(!0);let s=new Hr({write:b=>t.io.stdout(b),history:r.history,complete:gf(r)}),i=()=>`\x1B[1;36m${Af(r.cwd,r.env.HOME)}\x1B[0m \x1B[1;32m$\x1B[0m `,o,a="",c="",u,f=new Promise(b=>u=b),l=async b=>{let E=new oe,C=new AbortController,A=new Xe({echo:w=>t.io.stdout(w),deliver:w=>E.push(w),signal:w=>C.abort(w)}),g={controller:C,input:{queue:E},discipline:A};g.input.setRawSink=w=>void(g.rawSink=w),o=g;try{await r.exec(b,n,g.input,C.signal)}catch(w){t.io.stderr(`bfsh: ${w instanceof Error?w.message:String(w)}
211
211
  `)}if(o=void 0,r.exitRequested!==void 0)return u(r.exitRequested);if(s.begin(i()),c){let w=c;c="",d(w)}},d=b=>{if(o){o.rawSink?o.rawSink(b):o.discipline.input(b);return}let E=b;for(;E&&!o;){let{event:C,rest:A}=s.feed(E);if(E=A,!C)break;if(C.type==="eof")return t.io.stdout(`exit\r
212
212
  `),u(r.lastStatus);if(C.type==="interrupt"){a="",r.lastStatus=130,s.begin(i());continue}let g=a?`${a}
213
- ${C.line}`:C.line;try{$r(g)}catch(w){if(w instanceof H&&w.incomplete){a=g,s.begin("> ");continue}}if(a="",!g.trim()){s.begin(i());continue}c=E,E="",l(g)}},h=t.io.onStdin(ae(b=>b===null?u(r.lastStatus):d(b))),p=()=>{o?.controller.abort("SIGHUP"),u(129)};t.signal.addEventListener("abort",p),s.begin(i());let y=await f;return h(),t.signal.removeEventListener("abort",p),e.setRawMode(!1),y}var zt=async t=>{let e=t.args.filter(a=>a!=="-l"&&a!=="--login"&&a!=="-i");if(e[0]==="-c")return xa(t,qr(t,e.slice(2)),e[1]??"");if(e[0]){let a=e[0].startsWith("/")?e[0]:k(t.cwd,e[0]),c=t.system.fs.readText(a);return c===void 0?(t.io.stderr(`bfsh: ${e[0]}: No such file or directory
214
- `),127):xa(t,qr(t,e.slice(1)),c.replace(/^#!.*\n/,""))}if(t.io.terminal)return Af(t);let{input:r,stop:n}=_a(t),s=await r.queue.readAll();n();let i=qr(t),o=new oe;return o.push(null),i.exec(s,ps(t),{queue:o},t.signal)};var gf=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function zr(t){return e=>zt({...e,args:["-c",[t,...e.args].map(gf).join(" ")]})}function As(){let t={node:Uo,bfsh:zt,sh:zt,bash:zt,npm:zr("npm"),npx:zr("npx"),pnpm:zr("pnpm"),yarn:zr("yarn")};for(let[e,r]of Object.entries(qe))t[e]=Ko(r,e);return t}function Da(t,e){return`${t}__port/${e}/`}var mf=new TextEncoder;function Oa(t,e,r,n){let s=!1,i,o=()=>{s||(s=!0,n?.())};return r.then(a=>{if(s)return void a?.body.cancel().catch(()=>{});if(!a)return t({type:"response-head",reqId:e,head:null}),o();t({type:"response-head",reqId:e,head:vn(a)}),i=Sn(a.body,{chunk:c=>t({type:"response-chunk",reqId:e,data:c}),end:c=>{t(c?{type:"response-end",reqId:e,error:c}:{type:"response-end",reqId:e}),o()}})},a=>{s||(t({type:"response-head",reqId:e,head:{status:500,headers:{"content-type":"text/plain"}}}),t({type:"response-chunk",reqId:e,data:mf.encode(String(a instanceof Error?a.stack:a))}),t({type:"response-end",reqId:e}),o())}),()=>{i?.(),o()}}var Gr=class{constructor(){m(this,"heads",new Map);m(this,"bodies",new Map)}expect(e,r){return new Promise(n=>this.heads.set(e,{resolve:n,cancel:r}))}receive(e){let{reqId:r}=e;if(e.type==="response-head"){let n=this.heads.get(r);if(this.heads.delete(r),!n)return;if(!e.head)return n.resolve(void 0);let s=Lt(()=>{this.bodies.delete(r),n.cancel()});this.bodies.set(r,s),n.resolve({...e.head,body:s.stream})}else if(e.type==="response-chunk")this.bodies.get(r)?.push(e.data);else{let n=this.bodies.get(r);this.bodies.delete(r),e.error?n?.fail(new Error(e.error)):n?.end()}}abort(e,r){for(let{resolve:n}of this.heads.values())n(e());this.heads.clear();for(let n of this.bodies.values())n.fail(new Error(r));this.bodies.clear()}};var wf=49152;function Na(t){let e=new kt,r=new Map,n=new Set,s=new Map,i,o=new Gr,a=new Map,c=new Map,u=1,f=1,l=!1,d=[],h=!1,p,y=As(),b=()=>{if(h=!1,!d.length)return;let g=d;d=[],t.post({type:"fs",ops:g})};e.watch(g=>{l||(g.type==="write"?d.push({op:"write",path:g.path,content:e.readFile(g.path)}):d.push({op:g.type,path:g.path}),h||(h=!0,queueMicrotask(b)))});let E=g=>{l=!0;try{for(let w of g)w.op==="write"?e.writeFile(w.path,w.content):w.op==="mkdir"?e.mkdir(w.path):e.rm(w.path)}finally{l=!1}};function C(g,w,S={}){b();let I=u++,v=new Set,B=new Set,Q,_=new Promise(L=>Q=L),N=S.ipc?cr(L=>t.post({type:"child-ipc",childId:I,data:L}),()=>t.post({type:"child-ipc-disconnect",childId:I})):void 0;return s.set(I,{stdout:v,stderr:B,exit:Q,ipc:N}),t.post({type:"spawn",childId:I,command:g,args:w,cwd:S.cwd,env:S.env,terminal:S.terminal,ipc:S.ipc,thread:S.thread}),{pid:I,onStdout:L=>(v.add(L),()=>v.delete(L)),onStderr:L=>(B.add(L),()=>B.delete(L)),write:L=>t.post({type:"child-stdin",childId:I,data:L}),closeStdin:()=>t.post({type:"child-stdin",childId:I,data:null}),kill:(L="SIGTERM")=>t.post({type:"child-kill",childId:I,signal:L}),resize:(L,J)=>t.post({type:"child-resize",childId:I,cols:L,rows:J}),exit:_,ipc:N?.endpoint}}function A(g){l=!0;for(let I of g.dirs)e.mkdir(I);for(let[I,v]of g.files)e.writeFile(I,v);l=!1;for(let I of g.ports)n.add(I);let w={fs:e,fetch:t.fetch,spawn(I,v,B={}){let Q=B.cwd??g.cwd,_={...g.env,...B.env};if(!ar(e,y,I,v,Q,_))throw In(I);return C(I,v,{...B,cwd:Q,env:_})},listen(I,v,B){let Q=I;if(!Q)for(Q=wf+g.pid%1e3*8;n.has(Q);Q++);if(n.has(Q))throw Object.assign(new Error(`listen EADDRINUSE: address already in use :::${Q}`),{code:"EADDRINUSE",errno:-98,syscall:"listen",port:Q});n.add(Q);let _={handler:v,upgrade:B};return r.set(Q,_),t.post({type:"listen",port:Q}),{port:Q,close(){r.get(Q)===_&&(r.delete(Q),n.delete(Q),t.post({type:"unlisten",port:Q}))}}},loopback(I,v){let B=r.get(I);if(B)return B.handler(v);let Q=f++,_=o.expect(Q,()=>t.post({type:"request-cancel",reqId:Q}));return t.post({type:"loopback",reqId:Q,port:I,request:v}),_},serverUrl:I=>new URL(Da(g.previewBase,I),g.previewOrigin).href,announceServer:(I,v)=>t.post({type:"listening",port:I,url:v}),previewUrl:g.previewUrl,registry:g.registry,packageCache:g.packageCache?t.packageCache?.():void 0,ownsRealm:t.ownsRealm,trapUncaught:t.trapUncaught},S=ar(e,y,g.command,g.args,g.cwd,g.env);if(!S){t.post({type:"stderr",data:`bfsh: command not found: ${g.command}
215
- `}),t.post({type:"exit",code:127});return}g.ipc&&(i=cr(I=>t.post({type:"ipc",data:I}),()=>t.post({type:"ipc-disconnect"}))),p=Qn({program:S.program,args:S.args,system:w,cwd:g.cwd,env:g.env,terminal:g.terminal,pid:g.pid,thread:g.thread,channel:i?.endpoint}),p.onStdout(I=>t.post({type:"stdout",data:I})),p.onStderr(I=>t.post({type:"stderr",data:I})),p.exit.then(I=>{b(),t.post({type:"exit",code:I})})}return{receive(g){switch(g.type){case"start":return A(g);case"stdin":g.data===null?p?.closeStdin():p?.write(g.data);return;case"kill":return p?.kill(g.signal);case"resize":return p?.resize?.(g.cols,g.rows);case"fs":return E(g.ops);case"ports":for(let w of g.open)n.add(w);for(let w of g.closed)r.has(w)||n.delete(w);return;case"child-out":for(let w of s.get(g.childId)?.[g.stream]??[])w(g.data);return;case"child-exit":s.get(g.childId)?.ipc?.closed(),s.get(g.childId)?.exit(g.code),s.delete(g.childId);return;case"child-ipc":return s.get(g.childId)?.ipc?.receive(g.data);case"child-ipc-disconnect":return s.get(g.childId)?.ipc?.closed();case"ipc":return i?.receive(g.data);case"ipc-disconnect":return i?.closed();case"child-error":{let w=s.get(g.childId);for(let S of w?.stderr??[])S(`${g.message}
216
- `);w?.exit(g.code==="ENOENT"?127:1),s.delete(g.childId);return}case"http-request":{let{reqId:w}=g,S=r.get(g.port),I=S?S.handler(g.request):Promise.resolve(Mt(502,`Nothing is listening on port ${g.port}.`));a.set(w,Oa(t.post,w,I,()=>a.delete(w)));return}case"request-cancel":return a.get(g.reqId)?.();case"response-head":case"response-chunk":case"response-end":return o.receive(g);case"socket-open":{let{connId:w}=g,S=r.get(g.port)?.upgrade;if(!S)return t.post({type:"socket-close",connId:w});let[I,v]=Bn();c.set(w,I),I.onData(B=>t.post({type:"socket-data",connId:w,data:B})),I.onClose(()=>{c.delete(w),t.post({type:"socket-close",connId:w})}),S(g.request,v);return}case"socket-data":return c.get(g.connId)?.send(g.data);case"socket-close":c.get(g.connId)?.close(),c.delete(g.connId);return}}}}function Ra(t="bfwc-packages"){let e=globalThis.caches;if(!e)return{get:async()=>{},put:async()=>{}};let r,n=()=>r??(r=e.open(t).catch(()=>{})),s=i=>`https://bfwc-cache.invalid/${encodeURIComponent(i)}`;return{async get(i){let o=await(await n())?.match(s(i)).catch(()=>{});return o?new Uint8Array(await o.arrayBuffer()):void 0},async put(i,o){let a=o.slice().buffer;await(await n())?.put(s(i),new Response(a)).catch(()=>{})}}}var Yr=globalThis,yf=globalThis.fetch.bind(globalThis),Ef,St=new Set;Yr.addEventListener("error",t=>{if(St.size){t.preventDefault();for(let e of St)e(t.error??new Error(t.message))}});Yr.addEventListener("unhandledrejection",t=>{if(St.size){t.preventDefault();for(let e of St)e(t.reason)}});var bf=Na({post:t=>Yr.postMessage(t),fetch:(t,e)=>yf(t,e),packageCache:()=>Ef??(Ef=Ra()),ownsRealm:!0,trapUncaught(t){return St.add(t),()=>St.delete(t)}});Yr.addEventListener("message",t=>bf.receive(t.data));})();
213
+ ${C.line}`:C.line;try{$r(g)}catch(w){if(w instanceof H&&w.incomplete){a=g,s.begin("> ");continue}}if(a="",!g.trim()){s.begin(i());continue}c=E,E="",l(g)}},h=t.io.onStdin(ae(b=>b===null?u(r.lastStatus):d(b))),p=()=>{o?.controller.abort("SIGHUP"),u(129)};t.signal.addEventListener("abort",p),s.begin(i());let y=await f;return h(),t.signal.removeEventListener("abort",p),e.setRawMode(!1),y}var zt=async t=>{let e=t.args.filter(a=>a!=="-l"&&a!=="--login"&&a!=="-i");if(e[0]==="-c")return Da(t,qr(t,e.slice(2)),e[1]??"");if(e[0]){let a=e[0].startsWith("/")?e[0]:k(t.cwd,e[0]),c=t.system.fs.readText(a);return c===void 0?(t.io.stderr(`bfsh: ${e[0]}: No such file or directory
214
+ `),127):Da(t,qr(t,e.slice(1)),c.replace(/^#!.*\n/,""))}if(t.io.terminal)return mf(t);let{input:r,stop:n}=Oa(t),s=await r.queue.readAll();n();let i=qr(t),o=new oe;return o.push(null),i.exec(s,As(t),{queue:o},t.signal)};var wf=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function zr(t){return e=>zt({...e,args:["-c",[t,...e.args].map(wf).join(" ")]})}function gs(){let t={node:jo,bfsh:zt,sh:zt,bash:zt,npm:zr("npm"),npx:zr("npx"),pnpm:zr("pnpm"),yarn:zr("yarn")};for(let[e,r]of Object.entries(qe))t[e]=Wo(r,e);return t}function Na(t,e){return`${t}__port/${e}/`}var yf=new TextEncoder;function Ra(t,e,r,n){let s=!1,i,o=()=>{s||(s=!0,n?.())};return r.then(a=>{if(s)return void a?.body.cancel().catch(()=>{});if(!a)return t({type:"response-head",reqId:e,head:null}),o();t({type:"response-head",reqId:e,head:Sn(a)}),i=Bn(a.body,{chunk:c=>t({type:"response-chunk",reqId:e,data:c}),end:c=>{t(c?{type:"response-end",reqId:e,error:c}:{type:"response-end",reqId:e}),o()}})},a=>{s||(t({type:"response-head",reqId:e,head:{status:500,headers:{"content-type":"text/plain"}}}),t({type:"response-chunk",reqId:e,data:yf.encode(String(a instanceof Error?a.stack:a))}),t({type:"response-end",reqId:e}),o())}),()=>{i?.(),o()}}var Gr=class{constructor(){m(this,"heads",new Map);m(this,"bodies",new Map)}expect(e,r){return new Promise(n=>this.heads.set(e,{resolve:n,cancel:r}))}receive(e){let{reqId:r}=e;if(e.type==="response-head"){let n=this.heads.get(r);if(this.heads.delete(r),!n)return;if(!e.head)return n.resolve(void 0);let s=Lt(()=>{this.bodies.delete(r),n.cancel()});this.bodies.set(r,s),n.resolve({...e.head,body:s.stream})}else if(e.type==="response-chunk")this.bodies.get(r)?.push(e.data);else{let n=this.bodies.get(r);this.bodies.delete(r),e.error?n?.fail(new Error(e.error)):n?.end()}}abort(e,r){for(let{resolve:n}of this.heads.values())n(e());this.heads.clear();for(let n of this.bodies.values())n.fail(new Error(r));this.bodies.clear()}};var Ef=49152;function Ta(t){let e=new Ge,r=new Map,n=new Set,s=new Map,i,o=new Gr,a=new Map,c=new Map,u=1,f=1,l=!1,d=[],h=!1,p,y=gs(),b=()=>{if(h=!1,!d.length)return;let g=d;d=[],t.post({type:"fs",ops:g})};e.watch(g=>{l||(g.type==="write"?d.push({op:"write",path:g.path,content:e.readFile(g.path)}):d.push({op:g.type,path:g.path}),h||(h=!0,queueMicrotask(b)))});let E=g=>{l=!0;try{for(let w of g)w.op==="write"?e.writeFile(w.path,w.content):w.op==="mkdir"?e.mkdir(w.path):e.rm(w.path)}finally{l=!1}};function C(g,w,S={}){b();let I=u++,v=new Set,B=new Set,Q,_=new Promise(L=>Q=L),N=S.ipc?cr(L=>t.post({type:"child-ipc",childId:I,data:L}),()=>t.post({type:"child-ipc-disconnect",childId:I})):void 0;return s.set(I,{stdout:v,stderr:B,exit:Q,ipc:N}),t.post({type:"spawn",childId:I,command:g,args:w,cwd:S.cwd,env:S.env,terminal:S.terminal,ipc:S.ipc,thread:S.thread}),{pid:I,onStdout:L=>(v.add(L),()=>v.delete(L)),onStderr:L=>(B.add(L),()=>B.delete(L)),write:L=>t.post({type:"child-stdin",childId:I,data:L}),closeStdin:()=>t.post({type:"child-stdin",childId:I,data:null}),kill:(L="SIGTERM")=>t.post({type:"child-kill",childId:I,signal:L}),resize:(L,J)=>t.post({type:"child-resize",childId:I,cols:L,rows:J}),exit:_,ipc:N?.endpoint}}function A(g){l=!0;for(let I of g.dirs)e.mkdir(I);for(let[I,v]of g.files)e.writeFile(I,v);l=!1;for(let I of g.ports)n.add(I);let w={fs:e,fetch:t.fetch,spawn(I,v,B={}){let Q=B.cwd??g.cwd,_={...g.env,...B.env};if(!ar(e,y,I,v,Q,_))throw Qn(I);return C(I,v,{...B,cwd:Q,env:_})},listen(I,v,B){let Q=I;if(!Q)for(Q=Ef+g.pid%1e3*8;n.has(Q);Q++);if(n.has(Q))throw Object.assign(new Error(`listen EADDRINUSE: address already in use :::${Q}`),{code:"EADDRINUSE",errno:-98,syscall:"listen",port:Q});n.add(Q);let _={handler:v,upgrade:B};return r.set(Q,_),t.post({type:"listen",port:Q}),{port:Q,close(){r.get(Q)===_&&(r.delete(Q),n.delete(Q),t.post({type:"unlisten",port:Q}))}}},loopback(I,v){let B=r.get(I);if(B)return B.handler(v);let Q=f++,_=o.expect(Q,()=>t.post({type:"request-cancel",reqId:Q}));return t.post({type:"loopback",reqId:Q,port:I,request:v}),_},serverUrl:I=>new URL(Na(g.previewBase,I),g.previewOrigin).href,announceServer:(I,v)=>t.post({type:"listening",port:I,url:v}),previewUrl:g.previewUrl,registry:g.registry,packageCache:g.packageCache?t.packageCache?.():void 0,ownsRealm:t.ownsRealm,trapUncaught:t.trapUncaught},S=ar(e,y,g.command,g.args,g.cwd,g.env);if(!S){t.post({type:"stderr",data:`bfsh: command not found: ${g.command}
215
+ `}),t.post({type:"exit",code:127});return}g.ipc&&(i=cr(I=>t.post({type:"ipc",data:I}),()=>t.post({type:"ipc-disconnect"}))),p=kn({program:S.program,args:S.args,system:w,cwd:g.cwd,env:g.env,terminal:g.terminal,pid:g.pid,thread:g.thread,channel:i?.endpoint}),p.onStdout(I=>t.post({type:"stdout",data:I})),p.onStderr(I=>t.post({type:"stderr",data:I})),p.exit.then(I=>{b(),t.post({type:"exit",code:I})})}return{receive(g){switch(g.type){case"start":return A(g);case"stdin":g.data===null?p?.closeStdin():p?.write(g.data);return;case"kill":return p?.kill(g.signal);case"resize":return p?.resize?.(g.cols,g.rows);case"fs":return E(g.ops);case"ports":for(let w of g.open)n.add(w);for(let w of g.closed)r.has(w)||n.delete(w);return;case"child-out":for(let w of s.get(g.childId)?.[g.stream]??[])w(g.data);return;case"child-exit":s.get(g.childId)?.ipc?.closed(),s.get(g.childId)?.exit(g.code),s.delete(g.childId);return;case"child-ipc":return s.get(g.childId)?.ipc?.receive(g.data);case"child-ipc-disconnect":return s.get(g.childId)?.ipc?.closed();case"ipc":return i?.receive(g.data);case"ipc-disconnect":return i?.closed();case"child-error":{let w=s.get(g.childId);for(let S of w?.stderr??[])S(`${g.message}
216
+ `);w?.exit(g.code==="ENOENT"?127:1),s.delete(g.childId);return}case"http-request":{let{reqId:w}=g,S=r.get(g.port),I=S?S.handler(g.request):Promise.resolve(Ft(502,`Nothing is listening on port ${g.port}.`));a.set(w,Ra(t.post,w,I,()=>a.delete(w)));return}case"request-cancel":return a.get(g.reqId)?.();case"response-head":case"response-chunk":case"response-end":return o.receive(g);case"socket-open":{let{connId:w}=g,S=r.get(g.port)?.upgrade;if(!S)return t.post({type:"socket-close",connId:w});let[I,v]=In();c.set(w,I),I.onData(B=>t.post({type:"socket-data",connId:w,data:B})),I.onClose(()=>{c.delete(w),t.post({type:"socket-close",connId:w})}),S(g.request,v);return}case"socket-data":return c.get(g.connId)?.send(g.data);case"socket-close":c.get(g.connId)?.close(),c.delete(g.connId);return}}}}function La(t="bfwc-packages"){let e=globalThis.caches;if(!e)return{get:async()=>{},put:async()=>{}};let r,n=()=>r??(r=e.open(t).catch(()=>{})),s=i=>`https://bfwc-cache.invalid/${encodeURIComponent(i)}`;return{async get(i){let o=await(await n())?.match(s(i)).catch(()=>{});return o?new Uint8Array(await o.arrayBuffer()):void 0},async put(i,o){let a=o.slice().buffer;await(await n())?.put(s(i),new Response(a)).catch(()=>{})}}}var Yr=globalThis,bf=globalThis.fetch.bind(globalThis),Cf,Bt=new Set;Yr.addEventListener("error",t=>{if(Bt.size){t.preventDefault();for(let e of Bt)e(t.error??new Error(t.message))}});Yr.addEventListener("unhandledrejection",t=>{if(Bt.size){t.preventDefault();for(let e of Bt)e(t.reason)}});var vf=Ta({post:t=>Yr.postMessage(t),fetch:(t,e)=>bf(t,e),packageCache:()=>Cf??(Cf=La()),ownsRealm:!0,trapUncaught(t){return Bt.add(t),()=>Bt.delete(t)}});Yr.addEventListener("message",t=>vf.receive(t.data));})();