@seanhogg/builderforce-webcontainers 2026.10.8 → 2026.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/assets.js +3 -3
  2. package/dist/cdnModules.d.ts +16 -0
  3. package/dist/cdnModules.d.ts.map +1 -0
  4. package/dist/cdnModules.js +25 -0
  5. package/dist/cdnModules.js.map +1 -0
  6. package/dist/componentCompilers.d.ts +5 -5
  7. package/dist/componentCompilers.d.ts.map +1 -1
  8. package/dist/componentCompilers.js +5 -23
  9. package/dist/componentCompilers.js.map +1 -1
  10. package/dist/host.d.ts +11 -3
  11. package/dist/host.d.ts.map +1 -1
  12. package/dist/host.js +10 -15
  13. package/dist/host.js.map +1 -1
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/node/childRelay.d.ts +22 -0
  19. package/dist/node/childRelay.d.ts.map +1 -0
  20. package/dist/node/childRelay.js +54 -0
  21. package/dist/node/childRelay.js.map +1 -0
  22. package/dist/node/processHost.d.ts.map +1 -1
  23. package/dist/node/processHost.js +18 -32
  24. package/dist/node/processHost.js.map +1 -1
  25. package/dist/node/protocol.d.ts +30 -7
  26. package/dist/node/protocol.d.ts.map +1 -1
  27. package/dist/node/protocol.js.map +1 -1
  28. package/dist/node/worker.js +135 -132
  29. package/dist/node/workerProcess.d.ts.map +1 -1
  30. package/dist/node/workerProcess.js +31 -4
  31. package/dist/node/workerProcess.js.map +1 -1
  32. package/dist/previewUpdates.d.ts +10 -0
  33. package/dist/previewUpdates.d.ts.map +1 -0
  34. package/dist/previewUpdates.js +27 -0
  35. package/dist/previewUpdates.js.map +1 -0
  36. package/dist/process-worker.js +135 -132
  37. package/dist/protocol.d.ts +2 -2
  38. package/dist/protocol.d.ts.map +1 -1
  39. package/dist/protocol.js +2 -2
  40. package/dist/protocol.js.map +1 -1
  41. package/dist/relay.html +1 -1
  42. package/dist/styleCompilers.d.ts +19 -0
  43. package/dist/styleCompilers.d.ts.map +1 -0
  44. package/dist/styleCompilers.js +22 -0
  45. package/dist/styleCompilers.js.map +1 -0
  46. package/dist/sw.js +1 -1
  47. package/dist/transport.d.ts +3 -2
  48. package/dist/transport.d.ts.map +1 -1
  49. package/dist/transport.js +4 -4
  50. package/dist/transport.js.map +1 -1
  51. package/dist/worker.d.ts +6 -2
  52. package/dist/worker.d.ts.map +1 -1
  53. package/dist/worker.js +5 -5
  54. package/dist/worker.js.map +1 -1
  55. package/package.json +2 -2
  56. package/src/cdnModules.ts +34 -0
  57. package/src/componentCompilers.ts +8 -32
  58. package/src/host.ts +21 -18
  59. package/src/index.ts +3 -0
  60. package/src/node/childRelay.ts +63 -0
  61. package/src/node/processHost.ts +23 -31
  62. package/src/node/protocol.ts +24 -8
  63. package/src/node/workerProcess.ts +36 -7
  64. package/src/previewUpdates.ts +28 -0
  65. package/src/protocol.ts +2 -2
  66. package/src/relay.ts +6 -5
  67. package/src/styleCompilers.ts +45 -0
  68. package/src/transport.ts +7 -6
  69. package/src/worker.ts +5 -5
@@ -1,116 +1,120 @@
1
- "use strict";(()=>{var Vo=Object.defineProperty;var Zo=(t,e,r)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>Zo(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 L(t){let e=O(t),r=e.lastIndexOf("/");return r<=0?"/":e.slice(0,r)}function Ue(t){let e=O(t);return e.slice(e.lastIndexOf("/")+1)}function I(...t){return O(t.join("/"))}function At(t){let e=Ue(t),r=e.lastIndexOf(".");return r<=0?"":e.slice(r).toLowerCase()}var Xo=new TextDecoder,gt=class{constructor(){p(this,"files",new Map);p(this,"versions",new Map);p(this,"mtimes",new Map);p(this,"children",new Map([["/",new Set]]));p(this,"explicit",new Set);p(this,"listeners",new Set);p(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:Xo.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(I(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,f]of o)this.writeFile(s+c.slice(n.length),f)}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=I(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=L(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=L(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 M=Uint8Array,oe=Uint16Array,Kr=Int32Array,Ft=new M([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]),Ut=new M([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]),Fr=new M([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yn=function(t,e){for(var r=new oe(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var s=new Kr(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}},Vn=Yn(Ft,2),Zn=Vn.b,Ur=Vn.r;Zn[28]=258,Ur[258]=28;var Xn=Yn(Ut,0),ea=Xn.b,qn=Xn.r,Pr=new oe(32768);for(_=0;_<32768;++_)Qe=(_&43690)>>1|(_&21845)<<1,Qe=(Qe&52428)>>2|(Qe&13107)<<2,Qe=(Qe&61680)>>4|(Qe&3855)<<4,Pr[_]=((Qe&65280)>>8|(Qe&255)<<8)>>1;var Qe,_,me=function(t,e,r){for(var n=t.length,s=0,i=new oe(e);s<n;++s)t[s]&&++i[t[s]-1];var o=new oe(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var a;if(r){a=new oe(1<<e);var c=15-e;for(s=0;s<n;++s)if(t[s])for(var f=s<<4|t[s],l=e-t[s],u=o[t[s]-1]++<<l,d=u|(1<<l)-1;u<=d;++u)a[Pr[u]>>c]=f}else for(a=new oe(n),s=0;s<n;++s)t[s]&&(a[s]=Pr[o[t[s]-1]++]>>15-t[s]);return a},Re=new M(288);for(_=0;_<144;++_)Re[_]=8;var _;for(_=144;_<256;++_)Re[_]=9;var _;for(_=256;_<280;++_)Re[_]=7;var _;for(_=280;_<288;++_)Re[_]=8;var _,Et=new M(32);for(_=0;_<32;++_)Et[_]=5;var _,ta=me(Re,9,0),ra=me(Re,9,1),na=me(Et,5,0),sa=me(Et,5,1),$r=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},fe=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},Lr=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Pt=function(t){return(t+7)/8|0},yt=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new M(t.subarray(e,r))};var ia=["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"],j=function(t,e,r){var n=new Error(e||ia[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,j),!r)throw n;return n},jt=function(t,e,r,n){var s=t.length,i=n?n.length:0;if(!s||e.f&&!e.l)return r||new M(0);var o=!r,a=o||e.i!=2,c=e.i;o&&(r=new M(s*3));var f=function(ht){var pt=r.length;if(ht>pt){var Ve=new M(Math.max(pt*2,ht));Ve.set(r),r=Ve}},l=e.f||0,u=e.p||0,d=e.b||0,h=e.l,g=e.d,m=e.m,w=e.n,E=s*8;do{if(!h){l=fe(t,u,1);var v=fe(t,u+1,3);if(u+=3,v)if(v==1)h=ra,g=sa,m=9,w=5;else if(v==2){var B=fe(t,u,31)+257,S=fe(t,u+10,15)+4,C=B+fe(t,u+5,31)+1;u+=14;for(var Q=new M(C),k=new M(19),x=0;x<S;++x)k[Fr[x]]=fe(t,u+x*3,7);u+=S*3;for(var R=$r(k),Y=(1<<R)-1,W=me(k,R,1),x=0;x<C;){var te=W[fe(t,u,Y)];u+=te&15;var A=te>>4;if(A<16)Q[x++]=A;else{var q=0,U=0;for(A==16?(U=3+fe(t,u,3),u+=2,q=Q[x-1]):A==17?(U=3+fe(t,u,7),u+=3):A==18&&(U=11+fe(t,u,127),u+=7);U--;)Q[x++]=q}}var re=Q.subarray(0,B),z=Q.subarray(B);m=$r(re),w=$r(z),h=me(re,m,1),g=me(z,w,1)}else j(1);else{var A=Pt(u)+4,b=t[A-4]|t[A-3]<<8,y=A+b;if(y>s){c&&j(0);break}a&&f(d+b),r.set(t.subarray(A,y),d),e.b=d+=b,e.p=u=y*8,e.f=l;continue}if(u>E){c&&j(0);break}}a&&f(d+131072);for(var dt=(1<<m)-1,le=(1<<w)-1,ve=u;;ve=u){var q=h[Lr(t,u)&dt],se=q>>4;if(u+=q&15,u>E){c&&j(0);break}if(q||j(2),se<256)r[d++]=se;else if(se==256){ve=u,h=null;break}else{var ie=se-254;if(se>264){var x=se-257,P=Ft[x];ie=fe(t,u,(1<<P)-1)+Zn[x],u+=P}var Ae=g[Lr(t,u)&le],Ge=Ae>>4;Ae||j(3),u+=Ae&15;var z=ea[Ge];if(Ge>3){var P=Ut[Ge];z+=Lr(t,u)&(1<<P)-1,u+=P}if(u>E){c&&j(0);break}a&&f(d+131072);var Ye=d+ie;if(d<z){var $t=i-z,Lt=Math.min(z,Ye);for($t+d<0&&j(3);d<Lt;++d)r[d]=n[$t+d]}for(;d<Ye;++d)r[d]=r[d-z]}}e.l=h,e.p=ve,e.b=d,e.f=l,h&&(l=1,e.m=m,e.d=g,e.n=w)}while(!l);return d!=r.length&&o?yt(r,0,d):r.subarray(0,d)},Be=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},mt=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},Mr=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:Mt,l:0};if(s==1){var o=new M(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(y,B){return y.f-B.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],f=0,l=1,u=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=s-1;)a=r[r[f].f<r[u].f?f++:u++],c=r[f!=l&&r[f].f<r[u].f?f++:u++],r[l++]={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 oe(d+1),g=jr(r[l-1],h,0);if(g>e){var n=0,m=0,w=g-e,E=1<<w;for(i.sort(function(B,S){return h[S.s]-h[B.s]||B.f-S.f});n<s;++n){var v=i[n].s;if(h[v]>e)m+=E-(1<<g-h[v]),h[v]=e;else break}for(m>>=w;m>0;){var A=i[n].s;h[A]<e?m-=1<<e-h[A]++-1:++n}for(;n>=0&&m;--n){var b=i[n].s;h[b]==e&&(--h[b],++m)}g=e}return{t:new M(h),l:g}},jr=function(t,e,r){return t.s==-1?Math.max(jr(t.l,e,r+1),jr(t.r,e,r+1)):e[t.s]=r},zn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new oe(++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}},wt=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},Hr=function(t,e,r){var n=r.length,s=Pt(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},Gn=function(t,e,r,n,s,i,o,a,c,f,l){Be(e,l++,r),++s[256];for(var u=Mr(s,15),d=u.t,h=u.l,g=Mr(i,15),m=g.t,w=g.l,E=zn(d),v=E.c,A=E.n,b=zn(m),y=b.c,B=b.n,S=new oe(19),C=0;C<v.length;++C)++S[v[C]&31];for(var C=0;C<y.length;++C)++S[y[C]&31];for(var Q=Mr(S,7),k=Q.t,x=Q.l,R=19;R>4&&!k[Fr[R-1]];--R);var Y=f+5<<3,W=wt(s,Re)+wt(i,Et)+o,te=wt(s,d)+wt(i,m)+o+14+3*R+wt(S,k)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&Y<=W&&Y<=te)return Hr(e,l,t.subarray(c,c+f));var q,U,re,z;if(Be(e,l,1+(te<W)),l+=2,te<W){q=me(d,h,0),U=d,re=me(m,w,0),z=m;var dt=me(k,x,0);Be(e,l,A-257),Be(e,l+5,B-1),Be(e,l+10,R-4),l+=14;for(var C=0;C<R;++C)Be(e,l+3*C,k[Fr[C]]);l+=3*R;for(var le=[v,y],ve=0;ve<2;++ve)for(var se=le[ve],C=0;C<se.length;++C){var ie=se[C]&31;Be(e,l,dt[ie]),l+=k[ie],ie>15&&(Be(e,l,se[C]>>5&127),l+=se[C]>>12)}}else q=ta,U=Re,re=na,z=Et;for(var C=0;C<a;++C){var P=n[C];if(P>255){var ie=P>>18&31;mt(e,l,q[ie+257]),l+=U[ie+257],ie>7&&(Be(e,l,P>>23&31),l+=Ft[ie]);var Ae=P&31;mt(e,l,re[Ae]),l+=z[Ae],Ae>3&&(mt(e,l,P>>5&8191),l+=Ut[Ae])}else mt(e,l,q[P]),l+=U[P]}return mt(e,l,q[256]),l+U[256]},oa=new Kr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mt=new M(0),aa=function(t,e,r,n,s,i){var o=i.z||t.length,a=new M(n+o+5*(1+Math.ceil(o/7e3))+s),c=a.subarray(n,a.length-s),f=i.l,l=(i.r||0)&7;if(e){l&&(c[0]=i.r>>3);for(var u=oa[e-1],d=u>>13,h=u&8191,g=(1<<r)-1,m=i.p||new oe(32768),w=i.h||new oe(g+1),E=Math.ceil(r/3),v=2*E,A=function(Tr){return(t[Tr]^t[Tr+1]<<E^t[Tr+2]<<v)&g},b=new Kr(25e3),y=new oe(288),B=new oe(32),S=0,C=0,Q=i.i||0,k=0,x=i.w||0,R=0;Q+2<o;++Q){var Y=A(Q),W=Q&32767,te=w[Y];if(m[W]=te,w[Y]=W,x<=Q){var q=o-Q;if((S>7e3||k>24576)&&(q>423||!f)){l=Gn(t,c,0,b,y,B,C,k,R,Q-R,l),k=S=C=0,R=Q;for(var U=0;U<286;++U)y[U]=0;for(var U=0;U<30;++U)B[U]=0}var re=2,z=0,dt=h,le=W-te&32767;if(q>2&&Y==A(Q-le))for(var ve=Math.min(d,q)-1,se=Math.min(32767,Q),ie=Math.min(258,q);le<=se&&--dt&&W!=te;){if(t[Q+re]==t[Q+re-le]){for(var P=0;P<ie&&t[Q+P]==t[Q+P-le];++P);if(P>re){if(re=P,z=le,P>ve)break;for(var Ae=Math.min(le,P-2),Ge=0,U=0;U<Ae;++U){var Ye=Q-le+U&32767,$t=m[Ye],Lt=Ye-$t&32767;Lt>Ge&&(Ge=Lt,te=Ye)}}}W=te,te=m[W],le+=W-te&32767}if(z){b[k++]=268435456|Ur[re]<<18|qn[z];var ht=Ur[re]&31,pt=qn[z]&31;C+=Ft[ht]+Ut[pt],++y[257+ht],++B[pt],x=Q+re,++S}else b[k++]=t[Q],++y[t[Q]]}}for(Q=Math.max(Q,x);Q<o;++Q)b[k++]=t[Q],++y[t[Q]];l=Gn(t,c,f,b,y,B,C,k,R,Q-R,l),f||(i.r=l&7|c[l/8|0]<<3,l-=7,i.h=w,i.p=m,i.i=Q,i.w=x)}else{for(var Q=i.w||0;Q<o+f;Q+=65535){var Ve=Q+65535;Ve>=o&&(c[l/8|0]=f,Ve=o),l=Hr(c,l+1,t.subarray(Q,Ve))}i.i=o}return yt(a,0,n+Pt(l)+s)},ca=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}(),es=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=ca[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}},Jr=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}}},Ze=function(t,e,r,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new M(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return aa(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 _e=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},ts=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&&_e(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)}},rs=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&j(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)},la=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ns=function(t){return 10+(t.filename?t.filename.length+1:0)},ss=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=Jr();s.p(e.dictionary),_e(t,2,s.d())}},is=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&j(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&j(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function fa(t,e){return typeof t=="function"&&(e=t,t={}),this.ondata=e,t}var Ne=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 M(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(Ze(e,this.o,0,0,this.s),r)},t.prototype.push=function(e,r){this.ondata||j(5),this.s.l&&j(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new M(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=Mt)},t.prototype.flush=function(e){if(this.ondata||j(5),this.s.l&&j(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var r=new M(6);r[0]=this.s.r>>3;var n=Hr(r,this.s.r,Mt);this.s.r=0,this.ondata(r.subarray(0,n>>3),!1)}},t}();function os(t,e){return Ze(t,e||{},0,0)}var ge=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 M(32768),this.p=new M(0),n&&this.o.set(n)}return t.prototype.e=function(e){if(this.ondata||j(5),this.d&&j(4),!this.p.length)this.p=e;else if(e.length){var r=new M(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=jt(this.p,this.s,this.o);this.ondata(yt(n,r,this.s.b),this.d),this.o=yt(n,this.s.b-32768),this.s.b=this.o.length,this.p=yt(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 Wr(t,e){return jt(t,{i:2},e&&e.out,e&&e.dictionary)}var as=function(){function t(e,r){this.c=es(),this.l=0,this.v=1,Ne.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),this.l+=e.length,Ne.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=Ze(e,this.o,this.v&&ns(this.o),r&&8,this.s);this.v&&(ts(n,this.o),this.v=0),r&&(_e(n,n.length-8,this.c.d()),_e(n,n.length-4,this.l)),this.ondata(n,r)},t.prototype.flush=function(e){Ne.prototype.flush.call(this,e)},t}();function cs(t,e){e||(e={});var r=es(),n=t.length;r.p(t);var s=Ze(t,e,ns(e),8),i=s.length;return ts(s,e),_e(s,i-8,r.d()),_e(s,i-4,n),s}var qr=function(){function t(e,r){this.v=1,this.r=0,ge.call(this,e,r)}return t.prototype.push=function(e,r){if(ge.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),s=n.length>3?rs(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}ge.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=Pt(this.s.p)+9,this.s={i:0},this.o=new M(0),this.push(new M(0),r)):r&&ge.prototype.c.call(this,r)},t}();function bt(t,e){var r=rs(t);return r+8>t.length&&j(6,"invalid gzip data"),jt(t.subarray(r,-8),{i:2},e&&e.out||new M(la(t)),e&&e.dictionary)}var ls=function(){function t(e,r){this.c=Jr(),this.v=1,Ne.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),Ne.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=Ze(e,this.o,this.v&&(this.o.dictionary?6:2),r&&4,this.s);this.v&&(ss(n,this.o),this.v=0),r&&_e(n,n.length-4,this.c.d()),this.ondata(n,r)},t.prototype.flush=function(e){Ne.prototype.flush.call(this,e)},t}();function fs(t,e){e||(e={});var r=Jr();r.p(t);var n=Ze(t,e,e.dictionary?6:2,4);return ss(n,e),_e(n,n.length-4,r.d()),n}var zr=function(){function t(e,r){ge.call(this,e,r),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,r){if(ge.prototype.e.call(this,e),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(is(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&j(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),ge.prototype.c.call(this,r)},t}();function Gr(t,e){return jt(t.subarray(is(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var us=function(){function t(e,r){this.o=fa.call(this,e,r)||{},this.G=qr,this.I=ge,this.Z=zr}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||j(5),this.s)this.s.push(e,r);else{if(this.p&&this.p.length){var n=new M(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 ds(t,e){return t[0]==31&&t[1]==139&&t[2]==8?bt(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?Wr(t,e):Gr(t,e)}var ua=typeof TextDecoder<"u"&&new TextDecoder,da=0;try{ua.decode(Mt,{stream:!0}),da=1}catch{}function hs(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 ps(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 As;(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"})(As||(As={}));var pa=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function Kt(t,e="@"){if(!$)return Yr.then(()=>Kt(t));let r=t.length+1,n=($.__heap_base.value||$.__heap_base)+4*r-$.memory.buffer.byteLength;n>0&&$.memory.grow(Math.ceil(n/65536));let s=$.sa(r-1);if((pa?ga:Aa)(t,new Uint16Array($.memory.buffer,s,r)),!$.parse())throw Object.assign(new Error(`Parse error ${e}:${t.slice(0,$.e()).split(`
2
- `).length}:${$.e()-t.lastIndexOf(`
3
- `,$.e()-1)}`),{idx:$.e()});let i=[],o=[];for(;$.ri();){let c=$.is(),f=$.ie(),l=$.it(),u=$.ai(),d=$.id(),h=$.ss(),g=$.se(),m;$.ip()&&(m=a(t.slice(d===-1?c-1:c,d===-1?f+1:f))),i.push({n:m,t:l,s:c,e:f,ss:h,se:g,d,a:u})}for(;$.re();){let c=$.es(),f=$.ee(),l=$.els(),u=$.ele(),d=t.slice(c,f),h=d[0],g=l<0?void 0:t.slice(l,u),m=g?g[0]:"";o.push({s:c,e:f,ls:l,le:u,n:h==='"'||h==="'"?a(d):d,ln:m==='"'||m==="'"?a(g):g})}function a(c){try{return(0,eval)(c)}catch{}}return[i,o,!!$.f(),!!$.ms()]}function Aa(t,e){let r=t.length,n=0;for(;n<r;){let s=t.charCodeAt(n);e[n++]=(255&s)<<8|s>>>8}}function ga(t,e){let r=t.length,n=0;for(;n<r;)e[n]=t.charCodeAt(n++)}var $,ma=()=>{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},Yr=WebAssembly.compile(ma()).then(WebAssembly.instantiate).then(({exports:t})=>{$=t});function ms(){return{scopes:{},tokens:{}}}var gs=t=>t.replace(/\/+$/,"");function wa(t,e={},r=ms()){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,f)=>e[f]??"");o==="registry"?r.registry=gs(a):/^@[^:]+:registry$/.test(o)?r.scopes[o.slice(0,o.indexOf(":"))]=gs(a):o.startsWith("//")&&o.endsWith(":_authToken")&&(r.tokens[o.slice(0,-11).replace(/\/?$/,"/")]=a)}return r}function ws(t,e,r={}){let n=ms();for(let s of e){let i=t.readText(s);i!==void 0&&wa(i,r,n)}return n}function ys(t,e,r){if(e.startsWith("@")){let n=t?.scopes[e.slice(0,e.indexOf("/"))];if(n)return n}return r}function Es(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 ya="https://registry.npmjs.org",Ea="application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",ba=new TextEncoder,bs=new TextDecoder;function Ca(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function va(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function Cs(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&&Ca(await n(a))===i.slice(o+1))return!0}return!1}return e.shasum?va(await n("SHA-1"))===e.shasum:!0}var Ht=class{constructor(e){p(this,"options");p(this,"registry");p(this,"packuments",new Map);this.options=e,this.registry=(e.registry??ya).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 Cs(s,r))return s;let i=await this.get(r.tarball,{});if(!await Cs(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=ys(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 f=JSON.parse(bs.decode(i));if(Date.now()-f.t<s)return f.p}catch{}let o=`${r}/${e.startsWith("@")?"@"+encodeURIComponent(e.slice(1)):encodeURIComponent(e)}`,a=await this.get(o,{accept:Ea},e,r),c=JSON.parse(bs.decode(a));if(!c.versions)throw new Error(`The registry returned no versions for "${e}".`);return await this.options.cache?.put(n,ba.encode(JSON.stringify({t:Date.now(),p:c}))),c}async get(e,r,n,s=this.registry){r={...r,...Es(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 Qa=/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|https?:|workspace:)/;function Vr(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 Zr(r,n)}function Zr(t,e){if(!t||/\s/.test(t))throw new Error(`Invalid package name "${t}".`);if(e.startsWith("npm:")){let r=Vr(e.slice(4));return{name:t,registryName:r.registryName,range:r.range}}if(Qa.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 Jt(t){return Object.fromEntries(Object.entries(t).sort(([e],[r])=>e<r?-1:e>r?1:0))}var Ba=/^\s*[v=]*\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?\s*$/,Sa=/^[v=]*(\d+|[xX*])?(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/;function Xe(t){let e=Ba.exec(t);if(!e)return null;let r=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return ae(Number(e[1]),Number(e[2]),Number(e[3]),r)}function ae(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 en(t){return Xe(t)?.version??null}function Ia(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 Qs(t,e){let r=typeof t=="string"?Xe(t):t,n=typeof e=="string"?Xe(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)||Ia(r,n)}var Wt=t=>t===void 0||t==="x"||t==="X"||t==="*";function Xr(t){let e=/^(~>?|\^|<=|>=|<|>|=)?(.*)$/.exec(t),r=e[1]??"",n=Sa.exec(e[2]);if(!n)return null;let[,s,i,o,a]=n,c=a?a.split(".").map(v=>/^\d+$/.test(v)?Number(v):v):[],f=Wt(s),l=f||Wt(i),u=l||Wt(o),d=f?0:Number(s),h=l?0:Number(i),g=u?0:Number(o),m=v=>({op:">=",version:v}),w=v=>({op:"<",version:v}),E=(v,A,b)=>w(ae(v,A,b,[0]));if(r==="^"){if(f)return[];let v=m(ae(d,h,g,c));return d>0||l?[v,E(d+1,0,0)]:h>0||u?[v,E(0,h+1,0)]:[v,E(0,0,g+1)]}if(r==="~"||r==="~>"){if(f)return[];let v=m(ae(d,h,g,c));return l?[v,E(d+1,0,0)]:[v,E(d,h+1,0)]}return r===""||r==="="?f?[]:l?[m(ae(d,0,0)),E(d+1,0,0)]:u?[m(ae(d,h,0)),E(d,h+1,0)]:[{op:"=",version:ae(d,h,g,c)}]:f?r==="<"||r===">"?[w(ae(0,0,0,[0]))]:[]:u?r===">"?[m(l?ae(d+1,0,0):ae(d,h+1,0))]:r==="<="?[l?E(d+1,0,0):E(d,h+1,0)]:r==="<"?[w(ae(d,h,0,[0]))]:[m(ae(d,h,0))]:[{op:r,version:ae(d,h,g,c)}]}function ka(t){return{parts:t.replace(/^[v=]+/,"").split("-")[0].split("."),full:Xe(t)}}function xa(t,e){let r=Xr(`>=${t}`);if(!r)return null;let{parts:n,full:s}=ka(e);if(s)return[...r,{op:"<=",version:s}];if(Wt(n[0]))return r;let i=Xr(`<=${e}`);return i?[...r,...i]:null}var vs=new Map;function Bs(t){let e=vs.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?xa(i[1],i[2]):s.split(/\s+/).filter(Boolean).reduce((a,c)=>{let f=a&&Xr(c);return f?[...a,...f]:null},[]);if(!o){r=null;break}r.push(o)}return vs.set(t,r),r}function Pe(t){return Bs(t)!==null}function Da(t,e){let r=Qs(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 Oa(t,e,r){return t.every(n=>Da(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 Te(t,e,r={}){let n=typeof t=="string"?Xe(t):t,s=Bs(e);return!n||!s?!1:s.some(i=>Oa(i,n,r.includePrerelease??!1))}function Ss(t,e){let r=null;for(let n of t){let s=Xe(n);s&&Te(s,e)&&(!r||Qs(s,r)>0)&&(r=s)}return r?.version??null}var Ct=(t,e)=>t?`${t}/node_modules/${e}`:`node_modules/${e}`;function je(t){let e=t.lastIndexOf("/node_modules/");return e<0?"":t.slice(0,e)}function*Is(t){let e=t;for(;;){if(yield e,!e)return;e=je(e)}}var ks=(t,e)=>e===""||t===e||t.startsWith(e+"/node_modules/"),xs={os:"linux",cpu:"wasm32"};function Na(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,xs.os)&&e(t.cpu,xs.cpu)}function Ra(t){let e=t.bundleDependencies??t.bundledDependencies;return e===!0?new Set(Object.keys(t.dependencies??{})):new Set(Array.isArray(e)?e:[])}function Ds(t,e,r){let n=new Map,s=(o,a)=>{for(let[c,f]of Object.entries(o??{}))(!n.has(c)||a==="optional")&&n.set(c,{name:c,range:f,type:a})};if(e&&!r&&s(t.devDependencies,"dev"),s(t.dependencies,"prod"),s(t.optionalDependencies,"optional"),!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=Ra(t);return[...n.values()].filter(o=>!i.has(o.name)).sort((o,a)=>o.name<a.name?-1:1)}function Os(t,e){let r=e||"*";return Pe(r)&&Te(t,r)}async function Ns(t){let e=new Map,r=[],n=new Map,s=t.production??!1,i=(l,u)=>{for(let d of Is(l)){let h=Ct(d,u);if(e.has(h))return h}},o=l=>{r.push(l);let u=n.get(l.name)??[];u.push(l),n.set(l.name,u)},a=(l,u)=>(n.get(u)??[]).filter(d=>ks(d.from,l)&&!(ks(je(d.to),l)&&je(d.to)!==l)),c=(l,u,d)=>{let h;for(let g of Is(l)){if(e.has(Ct(g,u))||a(g,u).some(m=>!Os(d,m.range)))break;h=g}return h===void 0?void 0:Ct(h,u)},f=[{location:"",deps:Ds(t.root,!0,s)}];for(;f.length;){let{location:l,deps:u}=f.shift(),d=new Map;for(let h of u)try{let g=Zr(h.name,h.range);d.set(h.name,g),t.prefetch?.(g)}catch(g){if(h.type!=="optional")throw g;t.warn(`skipped optional ${h.name}: ${g.message}`)}for(let h of u){let g=d.get(h.name);if(!g)continue;let m=h.type==="peer"?je(l):l,w=i(m,h.name),E={...h,range:g.range,owner:l,from:m};if(w&&Os(e.get(w).manifest.version,g.range)){o({...E,to:w});continue}if(w&&h.type==="peer"){t.warn(`peer dependency conflict: ${l||"root"} wants ${h.name}@${g.range}, found ${e.get(w).manifest.version}`),o({...E,to:w});continue}let v;try{v=await t.pick(g)}catch(b){if(h.type!=="optional")throw b;t.warn(`skipped optional ${h.name}: ${b.message}`);continue}if(!Na(v)){if(h.type==="optional")continue;t.warn(`${v.name}@${v.version} targets ${[v.os,v.cpu].flat().filter(Boolean).join("/")} and may not work here`)}if(w&&e.get(w).manifest.version===v.version){o({...E,to:w});continue}let A=c(m,h.name,v.version);if(!A){t.warn(`could not place ${h.name}@${v.version} for ${l||"root"}`);continue}for(let b of a(je(A),h.name))b.to=A;e.set(A,{location:A,name:h.name,manifest:v,dev:!1,optional:!1}),o({...E,to:A}),t.onResolved?.({name:h.name,version:v.version}),f.push({location:A,deps:Ds(v,!1,s)})}}return _a(e,r),e}function _a(t,e){let r=i=>{let o=new Set,a=[""];for(;a.length;){let c=a.pop();for(let f of e)f.owner!==c||i(f)||o.has(f.to)||(o.add(f.to),a.push(f.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 Rs(t){if(t)try{let e=JSON.parse(t);return e.lockfileVersion>=2&&e.packages?e:void 0}catch{return}}var Ta=t=>t.slice(t.lastIndexOf("node_modules/")+13);function $a(t,e){if(!(!e.version||!e.resolved))return{name:e.name??Ta(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 _s(t){let e=new Map;for(let[r,n]of Object.entries(t?.packages??{})){if(!r.includes("node_modules/"))continue;let s=$a(r,n);if(!s)continue;let i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}return e}function tn(t,e,r){let n=r||"*";if(!Pe(n))return;let s;for(let i of t.get(e)??[])Te(i.version,n)&&(!s||Te(i.version,`>${s.version}`))&&(s=i);return s}var Ts=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function $s(t,e){let r=t.packages[""]??{};return Ts.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 et=t=>t&&Object.keys(t).length?t:void 0;function Ls(t,e){let r={name:t.name,version:t.version};for(let s of Ts)et(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:et(o.dependencies&&Jt(o.dependencies)),optionalDependencies:et(o.optionalDependencies),peerDependencies:et(o.peerDependencies),peerDependenciesMeta:et(o.peerDependenciesMeta),bin:o.bin,engines:et(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 Us=new TextDecoder;function Ke(t,e,r){let n=t.subarray(e,e+r),s=n.indexOf(0);return Us.decode(s<0?n:n.subarray(0,s))}function Ms(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=Ke(t,e,r).trim();return n?parseInt(n,8):0}function Fs(t){let e={},r=Us.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(`
1
+ "use strict";(()=>{var ma=Object.defineProperty;var wa=(t,e,r)=>e in t?ma(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var g=(t,e,r)=>wa(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 M(t){let e=O(t),r=e.lastIndexOf("/");return r<=0?"/":e.slice(0,r)}function He(t){let e=O(t);return e.slice(e.lastIndexOf("/")+1)}function k(...t){return O(t.join("/"))}function Et(t){let e=He(t),r=e.lastIndexOf(".");return r<=0?"":e.slice(r).toLowerCase()}var ya=new TextDecoder,bt=class{constructor(){g(this,"files",new Map);g(this,"versions",new Map);g(this,"mtimes",new Map);g(this,"children",new Map([["/",new Set]]));g(this,"explicit",new Set);g(this,"listeners",new Set);g(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:ya.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,l]of o)this.writeFile(s+c.slice(n.length),l)}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=M(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=M(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 P=Uint8Array,ue=Uint16Array,zr=Int32Array,Wt=new P([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]),Jt=new P([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]),Hr=new P([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ss=function(t,e){for(var r=new ue(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var s=new zr(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}},is=ss(Wt,2),os=is.b,Wr=is.r;os[28]=258,Wr[258]=28;var as=ss(Jt,0),Ea=as.b,ts=as.r,Jr=new ue(32768);for($=0;$<32768;++$)Ie=($&43690)>>1|($&21845)<<1,Ie=(Ie&52428)>>2|(Ie&13107)<<2,Ie=(Ie&61680)>>4|(Ie&3855)<<4,Jr[$]=((Ie&65280)>>8|(Ie&255)<<8)>>1;var Ie,$,be=function(t,e,r){for(var n=t.length,s=0,i=new ue(e);s<n;++s)t[s]&&++i[t[s]-1];var o=new ue(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var a;if(r){a=new ue(1<<e);var c=15-e;for(s=0;s<n;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],f=o[t[s]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[Jr[f]>>c]=l}else for(a=new ue(n),s=0;s<n;++s)t[s]&&(a[s]=Jr[o[t[s]-1]++]>>15-t[s]);return a},Le=new P(288);for($=0;$<144;++$)Le[$]=8;var $;for($=144;$<256;++$)Le[$]=9;var $;for($=256;$<280;++$)Le[$]=7;var $;for($=280;$<288;++$)Le[$]=8;var $,Qt=new P(32);for($=0;$<32;++$)Qt[$]=5;var $,ba=be(Le,9,0),Ca=be(Le,9,1),va=be(Qt,5,0),Sa=be(Qt,5,1),Pr=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},pe=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},jr=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},qt=function(t){return(t+7)/8|0},St=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new P(t.subarray(e,r))};var Qa=["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"],J=function(t,e,r){var n=new Error(e||Qa[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,J),!r)throw n;return n},zt=function(t,e,r,n){var s=t.length,i=n?n.length:0;if(!s||e.f&&!e.l)return r||new P(0);var o=!r,a=o||e.i!=2,c=e.i;o&&(r=new P(s*3));var l=function(wt){var yt=r.length;if(wt>yt){var tt=new P(Math.max(yt*2,wt));tt.set(r),r=tt}},u=e.f||0,f=e.p||0,d=e.b||0,h=e.l,w=e.d,E=e.m,b=e.n,y=s*8;do{if(!h){u=pe(t,f,1);var C=pe(t,f+1,3);if(f+=3,C)if(C==1)h=Ca,w=Sa,E=9,b=5;else if(C==2){var Q=pe(t,f,31)+257,B=pe(t,f+10,15)+4,v=Q+pe(t,f+5,31)+1;f+=14;for(var S=new P(v),I=new P(19),x=0;x<B;++x)I[Hr[x]]=pe(t,f+x*3,7);f+=B*3;for(var _=Pr(I),T=(1<<_)-1,H=be(I,_,1),x=0;x<v;){var X=H[pe(t,f,T)];f+=X&15;var p=X>>4;if(p<16)S[x++]=p;else{var q=0,U=0;for(p==16?(U=3+pe(t,f,3),f+=2,q=S[x-1]):p==17?(U=3+pe(t,f,7),f+=3):p==18&&(U=11+pe(t,f,127),f+=7);U--;)S[x++]=q}}var ee=S.subarray(0,Q),W=S.subarray(Q);E=Pr(ee),b=Pr(W),h=be(ee,E,1),w=be(W,b,1)}else J(1);else{var p=qt(f)+4,A=t[p-4]|t[p-3]<<8,m=p+A;if(m>s){c&&J(0);break}a&&l(d+A),r.set(t.subarray(p,m),d),e.b=d+=A,e.p=f=m*8,e.f=u;continue}if(f>y){c&&J(0);break}}a&&l(d+131072);for(var ce=(1<<E)-1,z=(1<<b)-1,we=f;;we=f){var q=h[jr(t,f)&ce],le=q>>4;if(f+=q&15,f>y){c&&J(0);break}if(q||J(2),le<256)r[d++]=le;else if(le==256){we=f,h=null;break}else{var fe=le-254;if(le>264){var x=le-257,K=Wt[x];fe=pe(t,f,(1<<K)-1)+os[x],f+=K}var ye=w[jr(t,f)&z],Xe=ye>>4;ye||J(3),f+=ye&15;var W=Ea[Xe];if(Xe>3){var K=Jt[Xe];W+=jr(t,f)&(1<<K)-1,f+=K}if(f>y){c&&J(0);break}a&&l(d+131072);var et=d+fe;if(d<W){var jt=i-W,Kt=Math.min(W,et);for(jt+d<0&&J(3);d<Kt;++d)r[d]=n[jt+d]}for(;d<et;++d)r[d]=r[d-W]}}e.l=h,e.p=we,e.b=d,e.f=u,h&&(u=1,e.m=E,e.d=w,e.n=b)}while(!u);return d!=r.length&&o?St(r,0,d):r.subarray(0,d)},ke=function(t,e,r){r<<=e&7;var n=e/8|0;t[n]|=r,t[n+1]|=r>>8},Ct=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},Kr=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:Ht,l:0};if(s==1){var o=new P(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(m,Q){return m.f-Q.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],l=0,u=1,f=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=s-1;)a=r[r[l].f<r[f].f?l++:f++],c=r[l!=u&&r[l].f<r[f].f?l++:f++],r[u++]={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 ue(d+1),w=qr(r[u-1],h,0);if(w>e){var n=0,E=0,b=w-e,y=1<<b;for(i.sort(function(Q,B){return h[B.s]-h[Q.s]||Q.f-B.f});n<s;++n){var C=i[n].s;if(h[C]>e)E+=y-(1<<w-h[C]),h[C]=e;else break}for(E>>=b;E>0;){var p=i[n].s;h[p]<e?E-=1<<e-h[p]++-1:++n}for(;n>=0&&E;--n){var A=i[n].s;h[A]==e&&(--h[A],++E)}w=e}return{t:new P(h),l:w}},qr=function(t,e,r){return t.s==-1?Math.max(qr(t.l,e,r+1),qr(t.r,e,r+1)):e[t.s]=r},rs=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ue(++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}},vt=function(t,e){for(var r=0,n=0;n<e.length;++n)r+=t[n]*e[n];return r},Gr=function(t,e,r){var n=r.length,s=qt(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},ns=function(t,e,r,n,s,i,o,a,c,l,u){ke(e,u++,r),++s[256];for(var f=Kr(s,15),d=f.t,h=f.l,w=Kr(i,15),E=w.t,b=w.l,y=rs(d),C=y.c,p=y.n,A=rs(E),m=A.c,Q=A.n,B=new ue(19),v=0;v<C.length;++v)++B[C[v]&31];for(var v=0;v<m.length;++v)++B[m[v]&31];for(var S=Kr(B,7),I=S.t,x=S.l,_=19;_>4&&!I[Hr[_-1]];--_);var T=l+5<<3,H=vt(s,Le)+vt(i,Qt)+o,X=vt(s,d)+vt(i,E)+o+14+3*_+vt(B,I)+2*B[16]+3*B[17]+7*B[18];if(c>=0&&T<=H&&T<=X)return Gr(e,u,t.subarray(c,c+l));var q,U,ee,W;if(ke(e,u,1+(X<H)),u+=2,X<H){q=be(d,h,0),U=d,ee=be(E,b,0),W=E;var ce=be(I,x,0);ke(e,u,p-257),ke(e,u+5,Q-1),ke(e,u+10,_-4),u+=14;for(var v=0;v<_;++v)ke(e,u+3*v,I[Hr[v]]);u+=3*_;for(var z=[C,m],we=0;we<2;++we)for(var le=z[we],v=0;v<le.length;++v){var fe=le[v]&31;ke(e,u,ce[fe]),u+=I[fe],fe>15&&(ke(e,u,le[v]>>5&127),u+=le[v]>>12)}}else q=ba,U=Le,ee=va,W=Qt;for(var v=0;v<a;++v){var K=n[v];if(K>255){var fe=K>>18&31;Ct(e,u,q[fe+257]),u+=U[fe+257],fe>7&&(ke(e,u,K>>23&31),u+=Wt[fe]);var ye=K&31;Ct(e,u,ee[ye]),u+=W[ye],ye>3&&(Ct(e,u,K>>5&8191),u+=Jt[ye])}else Ct(e,u,q[K]),u+=U[K]}return Ct(e,u,q[256]),u+U[256]},Ba=new zr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ht=new P(0),Ia=function(t,e,r,n,s,i){var o=i.z||t.length,a=new P(n+o+5*(1+Math.ceil(o/7e3))+s),c=a.subarray(n,a.length-s),l=i.l,u=(i.r||0)&7;if(e){u&&(c[0]=i.r>>3);for(var f=Ba[e-1],d=f>>13,h=f&8191,w=(1<<r)-1,E=i.p||new ue(32768),b=i.h||new ue(w+1),y=Math.ceil(r/3),C=2*y,p=function(Ur){return(t[Ur]^t[Ur+1]<<y^t[Ur+2]<<C)&w},A=new zr(25e3),m=new ue(288),Q=new ue(32),B=0,v=0,S=i.i||0,I=0,x=i.w||0,_=0;S+2<o;++S){var T=p(S),H=S&32767,X=b[T];if(E[H]=X,b[T]=H,x<=S){var q=o-S;if((B>7e3||I>24576)&&(q>423||!l)){u=ns(t,c,0,A,m,Q,v,I,_,S-_,u),I=B=v=0,_=S;for(var U=0;U<286;++U)m[U]=0;for(var U=0;U<30;++U)Q[U]=0}var ee=2,W=0,ce=h,z=H-X&32767;if(q>2&&T==p(S-z))for(var we=Math.min(d,q)-1,le=Math.min(32767,S),fe=Math.min(258,q);z<=le&&--ce&&H!=X;){if(t[S+ee]==t[S+ee-z]){for(var K=0;K<fe&&t[S+K]==t[S+K-z];++K);if(K>ee){if(ee=K,W=z,K>we)break;for(var ye=Math.min(z,K-2),Xe=0,U=0;U<ye;++U){var et=S-z+U&32767,jt=E[et],Kt=et-jt&32767;Kt>Xe&&(Xe=Kt,X=et)}}}H=X,X=E[H],z+=H-X&32767}if(W){A[I++]=268435456|Wr[ee]<<18|ts[W];var wt=Wr[ee]&31,yt=ts[W]&31;v+=Wt[wt]+Jt[yt],++m[257+wt],++Q[yt],x=S+ee,++B}else A[I++]=t[S],++m[t[S]]}}for(S=Math.max(S,x);S<o;++S)A[I++]=t[S],++m[t[S]];u=ns(t,c,l,A,m,Q,v,I,_,S-_,u),l||(i.r=u&7|c[u/8|0]<<3,u-=7,i.h=b,i.p=E,i.i=S,i.w=x)}else{for(var S=i.w||0;S<o+l;S+=65535){var tt=S+65535;tt>=o&&(c[u/8|0]=l,tt=o),u=Gr(c,u+1,t.subarray(S,tt))}i.i=o}return St(a,0,n+qt(u)+s)},ka=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}(),cs=function(){var t=-1;return{p:function(e){for(var r=t,n=0;n<e.length;++n)r=ka[r&255^e[n]]^r>>>8;t=r},d:function(){return~t}}},Yr=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}}},rt=function(t,e,r,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new P(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return Ia(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 $e=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},ls=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&&$e(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)}},fs=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&J(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)},xa=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},us=function(t){return 10+(t.filename?t.filename.length+1:0)},ds=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=Yr();s.p(e.dictionary),$e(t,2,s.d())}},hs=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&J(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&J(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function Da(t,e){return typeof t=="function"&&(e=t,t={}),this.ondata=e,t}var Te=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 P(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(rt(e,this.o,0,0,this.s),r)},t.prototype.push=function(e,r){this.ondata||J(5),this.s.l&&J(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new P(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=Ht)},t.prototype.flush=function(e){if(this.ondata||J(5),this.s.l&&J(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var r=new P(6);r[0]=this.s.r>>3;var n=Gr(r,this.s.r,Ht);this.s.r=0,this.ondata(r.subarray(0,n>>3),!1)}},t}();function ps(t,e){return rt(t,e||{},0,0)}var Ee=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 P(32768),this.p=new P(0),n&&this.o.set(n)}return t.prototype.e=function(e){if(this.ondata||J(5),this.d&&J(4),!this.p.length)this.p=e;else if(e.length){var r=new P(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=zt(this.p,this.s,this.o);this.ondata(St(n,r,this.s.b),this.d),this.o=St(n,this.s.b-32768),this.s.b=this.o.length,this.p=St(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 Vr(t,e){return zt(t,{i:2},e&&e.out,e&&e.dictionary)}var As=function(){function t(e,r){this.c=cs(),this.l=0,this.v=1,Te.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),this.l+=e.length,Te.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=rt(e,this.o,this.v&&us(this.o),r&&8,this.s);this.v&&(ls(n,this.o),this.v=0),r&&($e(n,n.length-8,this.c.d()),$e(n,n.length-4,this.l)),this.ondata(n,r)},t.prototype.flush=function(e){Te.prototype.flush.call(this,e)},t}();function gs(t,e){e||(e={});var r=cs(),n=t.length;r.p(t);var s=rt(t,e,us(e),8),i=s.length;return ls(s,e),$e(s,i-8,r.d()),$e(s,i-4,n),s}var Zr=function(){function t(e,r){this.v=1,this.r=0,Ee.call(this,e,r)}return t.prototype.push=function(e,r){if(Ee.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),s=n.length>3?fs(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}Ee.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=qt(this.s.p)+9,this.s={i:0},this.o=new P(0),this.push(new P(0),r)):r&&Ee.prototype.c.call(this,r)},t}();function Bt(t,e){var r=fs(t);return r+8>t.length&&J(6,"invalid gzip data"),zt(t.subarray(r,-8),{i:2},e&&e.out||new P(xa(t)),e&&e.dictionary)}var ms=function(){function t(e,r){this.c=Yr(),this.v=1,Te.call(this,e,r)}return t.prototype.push=function(e,r){this.c.p(e),Te.prototype.push.call(this,e,r)},t.prototype.p=function(e,r){var n=rt(e,this.o,this.v&&(this.o.dictionary?6:2),r&&4,this.s);this.v&&(ds(n,this.o),this.v=0),r&&$e(n,n.length-4,this.c.d()),this.ondata(n,r)},t.prototype.flush=function(e){Te.prototype.flush.call(this,e)},t}();function ws(t,e){e||(e={});var r=Yr();r.p(t);var n=rt(t,e,e.dictionary?6:2,4);return ds(n,e),$e(n,n.length-4,r.d()),n}var Xr=function(){function t(e,r){Ee.call(this,e,r),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,r){if(Ee.prototype.e.call(this,e),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(hs(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&J(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Ee.prototype.c.call(this,r)},t}();function en(t,e){return zt(t.subarray(hs(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var ys=function(){function t(e,r){this.o=Da.call(this,e,r)||{},this.G=Zr,this.I=Ee,this.Z=Xr}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||J(5),this.s)this.s.push(e,r);else{if(this.p&&this.p.length){var n=new P(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 Es(t,e){return t[0]==31&&t[1]==139&&t[2]==8?Bt(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?Vr(t,e):en(t,e)}var Oa=typeof TextDecoder<"u"&&new TextDecoder,_a=0;try{Oa.decode(Ht,{stream:!0}),_a=1}catch{}function bs(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 Cs(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 Na=[{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 Ta(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 vs(t){let e=Ta(t);return Na.find(r=>e.has(r.dependency))?.reason}var Ss;(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"})(Ss||(Ss={}));var La=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function It(t,e="@"){if(!F)return tn.then(()=>It(t));let r=t.length+1,n=(F.__heap_base.value||F.__heap_base)+4*r-F.memory.buffer.byteLength;n>0&&F.memory.grow(Math.ceil(n/65536));let s=F.sa(r-1);if((La?Ma:$a)(t,new Uint16Array(F.memory.buffer,s,r)),!F.parse())throw Object.assign(new Error(`Parse error ${e}:${t.slice(0,F.e()).split(`
2
+ `).length}:${F.e()-t.lastIndexOf(`
3
+ `,F.e()-1)}`),{idx:F.e()});let i=[],o=[];for(;F.ri();){let c=F.is(),l=F.ie(),u=F.it(),f=F.ai(),d=F.id(),h=F.ss(),w=F.se(),E;F.ip()&&(E=a(t.slice(d===-1?c-1:c,d===-1?l+1:l))),i.push({n:E,t:u,s:c,e:l,ss:h,se:w,d,a:f})}for(;F.re();){let c=F.es(),l=F.ee(),u=F.els(),f=F.ele(),d=t.slice(c,l),h=d[0],w=u<0?void 0:t.slice(u,f),E=w?w[0]:"";o.push({s:c,e:l,ls:u,le:f,n:h==='"'||h==="'"?a(d):d,ln:E==='"'||E==="'"?a(w):w})}function a(c){try{return(0,eval)(c)}catch{}}return[i,o,!!F.f(),!!F.ms()]}function $a(t,e){let r=t.length,n=0;for(;n<r;){let s=t.charCodeAt(n);e[n++]=(255&s)<<8|s>>>8}}function Ma(t,e){let r=t.length,n=0;for(;n<r;)e[n]=t.charCodeAt(n++)}var F,Fa=()=>{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},tn=WebAssembly.compile(Fa()).then(WebAssembly.instantiate).then(({exports:t})=>{F=t});function Bs(){return{scopes:{},tokens:{}}}var Qs=t=>t.replace(/\/+$/,"");function Ua(t,e={},r=Bs()){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,l)=>e[l]??"");o==="registry"?r.registry=Qs(a):/^@[^:]+:registry$/.test(o)?r.scopes[o.slice(0,o.indexOf(":"))]=Qs(a):o.startsWith("//")&&o.endsWith(":_authToken")&&(r.tokens[o.slice(0,-11).replace(/\/?$/,"/")]=a)}return r}function Is(t,e,r={}){let n=Bs();for(let s of e){let i=t.readText(s);i!==void 0&&Ua(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 xs(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 Pa="https://registry.npmjs.org",ja="application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",Ka=new TextEncoder,Ds=new TextDecoder;function Ha(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)}function Wa(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function Os(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&&Ha(await n(a))===i.slice(o+1))return!0}return!1}return e.shasum?Wa(await n("SHA-1"))===e.shasum:!0}var Gt=class{constructor(e){g(this,"options");g(this,"registry");g(this,"packuments",new Map);this.options=e,this.registry=(e.registry??Pa).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 Os(s,r))return s;let i=await this.get(r.tarball,{});if(!await Os(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 l=JSON.parse(Ds.decode(i));if(Date.now()-l.t<s)return l.p}catch{}let o=`${r}/${e.startsWith("@")?"@"+encodeURIComponent(e.slice(1)):encodeURIComponent(e)}`,a=await this.get(o,{accept:ja},e,r),c=JSON.parse(Ds.decode(a));if(!c.versions)throw new Error(`The registry returned no versions for "${e}".`);return await this.options.cache?.put(n,Ka.encode(JSON.stringify({t:Date.now(),p:c}))),c}async get(e,r,n,s=this.registry){r={...r,...xs(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 Ja=/^(?:git\+|git:|github:|gitlab:|bitbucket:|file:|link:|https?:|workspace:)/;function rn(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 nn(r,n)}function nn(t,e){if(!t||/\s/.test(t))throw new Error(`Invalid package name "${t}".`);if(e.startsWith("npm:")){let r=rn(e.slice(4));return{name:t,registryName:r.registryName,range:r.range}}if(Ja.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 Yt(t){return Object.fromEntries(Object.entries(t).sort(([e],[r])=>e<r?-1:e>r?1:0))}var qa=/^\s*[v=]*\s*(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?\s*$/,za=/^[v=]*(\d+|[xX*])?(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-.]+)?$/;function nt(t){let e=qa.exec(t);if(!e)return null;let r=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return de(Number(e[1]),Number(e[2]),Number(e[3]),r)}function de(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 on(t){return nt(t)?.version??null}function Ga(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 Rs(t,e){let r=typeof t=="string"?nt(t):t,n=typeof e=="string"?nt(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)||Ga(r,n)}var Vt=t=>t===void 0||t==="x"||t==="X"||t==="*";function sn(t){let e=/^(~>?|\^|<=|>=|<|>|=)?(.*)$/.exec(t),r=e[1]??"",n=za.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):[],l=Vt(s),u=l||Vt(i),f=u||Vt(o),d=l?0:Number(s),h=u?0:Number(i),w=f?0:Number(o),E=C=>({op:">=",version:C}),b=C=>({op:"<",version:C}),y=(C,p,A)=>b(de(C,p,A,[0]));if(r==="^"){if(l)return[];let C=E(de(d,h,w,c));return d>0||u?[C,y(d+1,0,0)]:h>0||f?[C,y(0,h+1,0)]:[C,y(0,0,w+1)]}if(r==="~"||r==="~>"){if(l)return[];let C=E(de(d,h,w,c));return u?[C,y(d+1,0,0)]:[C,y(d,h+1,0)]}return r===""||r==="="?l?[]:u?[E(de(d,0,0)),y(d+1,0,0)]:f?[E(de(d,h,0)),y(d,h+1,0)]:[{op:"=",version:de(d,h,w,c)}]:l?r==="<"||r===">"?[b(de(0,0,0,[0]))]:[]:f?r===">"?[E(u?de(d+1,0,0):de(d,h+1,0))]:r==="<="?[u?y(d+1,0,0):y(d,h+1,0)]:r==="<"?[b(de(d,h,0,[0]))]:[E(de(d,h,0))]:[{op:r,version:de(d,h,w,c)}]}function Ya(t){return{parts:t.replace(/^[v=]+/,"").split("-")[0].split("."),full:nt(t)}}function Va(t,e){let r=sn(`>=${t}`);if(!r)return null;let{parts:n,full:s}=Ya(e);if(s)return[...r,{op:"<=",version:s}];if(Vt(n[0]))return r;let i=sn(`<=${e}`);return i?[...r,...i]:null}var _s=new Map;function Ns(t){let e=_s.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?Va(i[1],i[2]):s.split(/\s+/).filter(Boolean).reduce((a,c)=>{let l=a&&sn(c);return l?[...a,...l]:null},[]);if(!o){r=null;break}r.push(o)}return _s.set(t,r),r}function We(t){return Ns(t)!==null}function Za(t,e){let r=Rs(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 Xa(t,e,r){return t.every(n=>Za(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 Me(t,e,r={}){let n=typeof t=="string"?nt(t):t,s=Ns(e);return!n||!s?!1:s.some(i=>Xa(i,n,r.includePrerelease??!1))}function Ts(t,e){let r=null;for(let n of t){let s=nt(n);s&&Me(s,e)&&(!r||Rs(s,r)>0)&&(r=s)}return r?.version??null}var ec={esbuild:"esbuild-wasm",rollup:"@rollup/wasm-node"},Zt=/-(?:darwin|linux|win32|android|freebsd|openharmony|sunos|aix)-[a-z0-9_-]+$/;function Ls(t){let e=Object.entries(t??{}).filter(([i])=>Zt.test(i));if(e.length<2)return;let[r,n]=e[0],s=r.replace(Zt,"-wasm32-wasi");return t[s]||e.some(([i])=>i.replace(Zt,"")!==r.replace(Zt,""))?void 0:[s,n]}function $s(t){let e=t.registryName===t.name?ec[t.name]:void 0;return e?{...t,registryName:e}:void 0}var kt=(t,e)=>t?`${t}/node_modules/${e}`:`node_modules/${e}`;function Je(t){let e=t.lastIndexOf("/node_modules/");return e<0?"":t.slice(0,e)}function*Ms(t){let e=t;for(;;){if(yield e,!e)return;e=Je(e)}}var Fs=(t,e)=>e===""||t===e||t.startsWith(e+"/node_modules/"),Us={os:"linux",cpu:"wasm32"};function tc(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,Us.os)&&e(t.cpu,Us.cpu)}function rc(t){let e=t.bundleDependencies??t.bundledDependencies;return e===!0?new Set(Object.keys(t.dependencies??{})):new Set(Array.isArray(e)?e:[])}function Ps(t,e,r){let n=new Map,s=(a,c,l)=>{for(let[u,f]of Object.entries(a??{}))(!n.has(u)||c==="optional")&&n.set(u,{name:u,range:f,type:c,implied:l})};e&&!r&&s(t.devDependencies,"dev"),s(t.dependencies,"prod"),s(t.optionalDependencies,"optional");let i=Ls(t.optionalDependencies);if(i&&s({[i[0]]:i[1]},"optional",!0),!e){let a=t.peerDependenciesMeta??{};for(let[c,l]of Object.entries(t.peerDependencies??{}))!n.has(c)&&!a[c]?.optional&&n.set(c,{name:c,range:l,type:"peer"})}let o=rc(t);return[...n.values()].filter(a=>!o.has(a.name)).sort((a,c)=>a.name<c.name?-1:1)}async function nc(t,e){let r=$s(e);if(r)try{return await t.pick(r)}catch{}return t.pick(e)}function js(t,e){let r=e||"*";return We(r)&&Me(t,r)}async function Ks(t){let e=new Map,r=[],n=new Map,s=t.production??!1,i=(u,f)=>{for(let d of Ms(u)){let h=kt(d,f);if(e.has(h))return h}},o=u=>{r.push(u);let f=n.get(u.name)??[];f.push(u),n.set(u.name,f)},a=(u,f)=>(n.get(f)??[]).filter(d=>Fs(d.from,u)&&!(Fs(Je(d.to),u)&&Je(d.to)!==u)),c=(u,f,d)=>{let h;for(let w of Ms(u)){if(e.has(kt(w,f))||a(w,f).some(E=>!js(d,E.range)))break;h=w}return h===void 0?void 0:kt(h,f)},l=[{location:"",deps:Ps(t.root,!0,s)}];for(;l.length;){let{location:u,deps:f}=l.shift(),d=new Map;for(let h of f)try{let w=nn(h.name,h.range);d.set(h.name,w),t.prefetch?.(w)}catch(w){if(h.type!=="optional")throw w;t.warn(`skipped optional ${h.name}: ${w.message}`)}for(let h of f){let w=d.get(h.name);if(!w)continue;let E=h.type==="peer"?Je(u):u,b=i(E,h.name),y={...h,range:w.range,owner:u,from:E};if(b&&js(e.get(b).manifest.version,w.range)){o({...y,to:b});continue}if(b&&h.type==="peer"){t.warn(`peer dependency conflict: ${u||"root"} wants ${h.name}@${w.range}, found ${e.get(b).manifest.version}`),o({...y,to:b});continue}let C;try{C=await nc(t,w)}catch(A){if(h.type!=="optional")throw A;h.implied||t.warn(`skipped optional ${h.name}: ${A.message}`);continue}if(!tc(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({...y,to:b});continue}let p=c(E,h.name,C.version);if(!p){t.warn(`could not place ${h.name}@${C.version} for ${u||"root"}`);continue}for(let A of a(Je(p),h.name))A.to=p;e.set(p,{location:p,name:h.name,manifest:C,dev:!1,optional:!1}),o({...y,to:p}),t.onResolved?.({name:h.name,version:C.version}),l.push({location:p,deps:Ps(C,!1,s)})}}return sc(e,r),e}function sc(t,e){let r=i=>{let o=new Set,a=[""];for(;a.length;){let c=a.pop();for(let l of e)l.owner!==c||i(l)||o.has(l.to)||(o.add(l.to),a.push(l.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 Hs(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 oc(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 Ws(t){let e=new Map;for(let[r,n]of Object.entries(t?.packages??{})){if(!r.includes("node_modules/"))continue;let s=oc(r,n);if(!s)continue;let i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}return e}function an(t,e,r){let n=r||"*";if(!We(n))return;let s;for(let i of t.get(e)??[])Me(i.version,n)&&(!s||Me(i.version,`>${s.version}`))&&(s=i);return s}var Js=["dependencies","devDependencies","optionalDependencies","peerDependencies"];function qs(t,e){let r=t.packages[""]??{};return Js.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 st=t=>t&&Object.keys(t).length?t:void 0;function zs(t,e){let r={name:t.name,version:t.version};for(let s of Js)st(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:st(o.dependencies&&Yt(o.dependencies)),optionalDependencies:st(o.optionalDependencies),peerDependencies:st(o.peerDependencies),peerDependenciesMeta:st(o.peerDependenciesMeta),bin:o.bin,engines:st(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 Vs=new TextDecoder;function qe(t,e,r){let n=t.subarray(e,e+r),s=n.indexOf(0);return Vs.decode(s<0?n:n.subarray(0,s))}function Gs(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=qe(t,e,r).trim();return n?parseInt(n,8):0}function Ys(t){let e={},r=Vs.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 La(t,e){for(let r=e;r<e+512;r++)if(t[r]!==0)return!1;return!0}function Ps(t){let e=[],r=0,n={},s={},i,o;for(;r+512<=t.length&&!La(t,r);){let a=Ke(t,r,100),c=Ms(t,r+100,8),f=Ms(t,r+124,12),l=String.fromCharCode(t[r+156]||48),u=Ke(t,r+157,100),h=Ke(t,r+257,6).startsWith("ustar")?Ke(t,r+345,155):"",g={...s,...n},m=g.size?Number(g.size):f,w=r+512,E=t.subarray(w,w+m);if(r=w+Math.ceil(m/512)*512,l==="x"){n=Fs(E);continue}if(l==="g"){s={...s,...Fs(E)};continue}if(l==="L"){i=Ke(E,0,E.length);continue}if(l==="K"){o=Ke(E,0,E.length);continue}let v=g.path??i??(h?`${h}/${a}`:a),A=g.linkpath??o??u;n={},i=void 0,o=void 0,l==="0"||l==="\0"||l==="7"?e.push({path:v,type:"file",data:E,mode:c}):l==="5"?e.push({path:v,type:"directory",data:new Uint8Array(0),mode:c}):l==="2"?e.push({path:v,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A}):l==="1"&&e.push({path:v,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:A})}return e}var rn="// @bfwc-bin ";function Ma(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 Fa(t){return`#!/usr/bin/env node
6
- ${rn}${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 ac(t,e){for(let r=e;r<e+512;r++)if(t[r]!==0)return!1;return!0}function Zs(t){let e=[],r=0,n={},s={},i,o;for(;r+512<=t.length&&!ac(t,r);){let a=qe(t,r,100),c=Gs(t,r+100,8),l=Gs(t,r+124,12),u=String.fromCharCode(t[r+156]||48),f=qe(t,r+157,100),h=qe(t,r+257,6).startsWith("ustar")?qe(t,r+345,155):"",w={...s,...n},E=w.size?Number(w.size):l,b=r+512,y=t.subarray(b,b+E);if(r=b+Math.ceil(E/512)*512,u==="x"){n=Ys(y);continue}if(u==="g"){s={...s,...Ys(y)};continue}if(u==="L"){i=qe(y,0,y.length);continue}if(u==="K"){o=qe(y,0,y.length);continue}let C=w.path??i??(h?`${h}/${a}`:a),p=w.linkpath??o??f;n={},i=void 0,o=void 0,u==="0"||u==="\0"||u==="7"?e.push({path:C,type:"file",data:y,mode:c}):u==="5"?e.push({path:C,type:"directory",data:new Uint8Array(0),mode:c}):u==="2"?e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:p}):u==="1"&&e.push({path:C,type:"symlink",data:new Uint8Array(0),mode:c,linkpath:p})}return e}var cn="// @bfwc-bin ";function cc(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 lc(t){return`#!/usr/bin/env node
6
+ ${cn}${t}
7
7
  require(${JSON.stringify(t)});
8
- `}function qt(t,e){let r=t.readText(e);if(!r)return;let n=r.split(`
9
- `).find(s=>s.startsWith(rn));return n?I(L(O(e)),n.slice(rn.length).trim()):void 0}function js(t,e,r){let n={};for(let s of r)for(let[i,o]of Object.entries(Ma(s.name,s.bin))){let a=I(s.dir,o);if(!t.isFile(a))continue;let c=Ua(e,a);t.writeFile(I(e,i),Fa(c)),n[i]=a}return n}function Ua(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 Pa=new TextDecoder("utf-8",{fatal:!0}),ja=/\.(?: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 Ks(t,e){if(ja.test(t)||e.subarray(0,8e3).includes(0))return e.slice();try{return Pa.decode(e)}catch{return e.slice()}}function Js(t,e){let r=t["dist-tags"]??{},n=e||"*";if(!Pe(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]&&Te(s,n))return s;let i=Ss(Object.keys(t.versions),n);if(!i)throw new Error(`No matching version found for ${t.name}@${e}.`);return i}async function Ka(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 nn(t,e){try{let r=t.readText(e);return r===void 0?void 0:JSON.parse(r)}catch{return}}var Hs=(t,e,r)=>t.writeFile(e,JSON.stringify(r,null,2)+`
10
- `);function Ha(t,e){let r=new Map,n=s=>{let i=I(e,s,"node_modules"),o=[];for(let a of t.readdir(i))if(!a.startsWith("."))if(a.startsWith("@"))for(let c of t.readdir(I(i,a)))o.push(`${a}/${c}`);else o.push(a);for(let a of o){let c=Ct(s,a),f=nn(t,I(e,c,"package.json"));r.set(c,`${f?.name??""}@${f?.version??""}`),n(c)}};return n(""),r}async function Ja(t,e,r,n){let s=n?"devDependencies":"dependencies",i=n?"dependencies":"devDependencies";for(let o of r){let a=Vr(o),c=a.range;if(!c||!Pe(c)?c=`^${Js(await t.packument(a.registryName),c||"latest")}`:en(c)&&(c=`^${en(c)}`),a.registryName!==a.name&&(c=`npm:${a.registryName}@${c}`),e[s]=Jt({...e[s]??{},[a.name]:c}),e[i]?.[a.name]){let f={...e[i]};delete f[a.name],e[i]=f}}}async function Ws(t){let{fs:e,signal:r}=t,n=I("/",t.cwd??"/"),s=I(n,"package.json"),i=I(n,"package-lock.json"),o=[],a=new Ht({fetch:t.fetch,registry:t.registry??t.npmrc?.registry,npmrc:t.npmrc,cache:t.cache,signal:r}),c=y=>t.onProgress?.(y),f=nn(e,s);if(!f){if(e.isFile(s))throw new Error(`${s} is not valid JSON.`);if(!t.add?.length)throw new Error(`No package.json in ${n}.`);f={}}t.add?.length&&(await Ja(a,f,t.add,t.saveDev??!1),Hs(e,s,f));let l=Rs(e.readText(i));if(t.ci){if(!l)throw new Error("npm ci needs a package-lock.json (lockfileVersion 2 or 3).");if(!$s(l,f))throw new Error("package.json and package-lock.json are out of sync. Run npm install to update the lockfile.");e.rm(I(n,"node_modules"))}let u=_s(l),d=new Map,h=y=>{let B=`${y.registryName}@${y.range}`,S=d.get(B);if(!S){let C=tn(u,y.registryName,y.range);C?S=Promise.resolve(C):t.ci?S=Promise.reject(new Error(`${B} is missing from package-lock.json. Run npm install to update it.`)):S=a.packument(y.registryName).then(Q=>{let k=Q.versions[Js(Q,y.range)];return{...k,name:k.name??y.registryName}}),S.catch(()=>{}),d.set(B,S)}return S},g=0,m=await Ns({root:f,pick:h,prefetch:y=>void(tn(u,y.registryName,y.range)||t.ci||a.packument(y.registryName).catch(()=>{})),production:t.production,warn:y=>o.push(y),onResolved:({name:y,version:B})=>c({phase:"resolve",package:`${y}@${B}`,done:++g,total:g})});r?.throwIfAborted();let w=0;for(let[y,B]of[...Ha(e,n)].sort(([S],[C])=>S.length-C.length)){let S=I(n,y);if(!e.exists(S))continue;let C=m.get(y);(!C||B!==`${C.manifest.name}@${C.manifest.version}`)&&(e.rm(S),w++)}let E=[...m.values()].filter(y=>!e.isFile(I(n,y.location,"package.json"))),v=0;await Ka(E,t.concurrency??8,async y=>{r?.throwIfAborted(),await Wa(e,I(n,y.location),await a.tarball(y.manifest)),c({phase:"fetch",package:`${y.name}@${y.manifest.version}`,done:++v,total:E.length})});for(let y of m.values())y.manifest.hasInstallScript&&o.push(`skipped install scripts of ${y.name}@${y.manifest.version} (they cannot run in the browser)`),y.manifest.deprecated&&o.push(`deprecated ${y.name}@${y.manifest.version}: ${y.manifest.deprecated}`);let A=qa(e,n,m),b=Ls(f,m);return Hs(e,i,b),c({phase:"done",done:m.size,total:m.size}),{added:E.length,removed:w,total:m.size,bins:A,lockfile:b,warnings:o}}async function Wa(t,e,r){let n=Ps(bt(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(I(e,o),Ks(o,i.data)))}if(!s)throw new Error(`The tarball for ${e} has no package.json.`);t.writeFile(I(e,"package.json"),Ks("package.json",s))}function qa(t,e,r){let n=new Map;for(let i of r.values()){let o=je(i.location);n.set(o,[...n.get(o)??[],i])}t.rm(I(e,"node_modules/.bin"));let s={};for(let[i,o]of n){let a=I(e,i,"node_modules/.bin"),c=js(t,a,o.map(f=>({dir:I(e,f.location),name:f.name,bin:nn(t,I(e,f.location,"package.json"))?.bin??f.manifest.bin})));i===""&&(s=c)}return s}function vt(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 qs(t){return new ReadableStream({start(e){t.byteLength&&e.enqueue(t),e.close()}})}function Qt(t,e){return{status:t,headers:{"content-type":"text/plain; charset=utf-8"},body:qs(new TextEncoder().encode(e))}}function sn(t){return{status:t.status,statusText:t.statusText,headers:t.headers}}function on(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 zt=class{constructor(){p(this,"peer");p(this,"closed",!1);p(this,"data",new Set);p(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 an(){let t=new zt,e=new zt;return t.peer=e,e.peer=t,[t,e]}function tt(t){let e=[];for(let r=O(t);;r=L(r))if(r.endsWith("/node_modules")||e.push(I(r,"node_modules/.bin")),r==="/")return e}function ue(t,e,r,n){if(e.includes("/")){let i=e.startsWith("/")?O(e):I(r,e);return t.isFile(i)?i:void 0}let s=[...(n.PATH??"").split(":").filter(Boolean),...tt(r)];for(let i of s){let o=I(i.startsWith("/")?i:I(r,i),e);if(t.isFile(o))return o}}function zs(t,e){let r=qt(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(At(e))?{name:"bfsh",args:[e]}:{name:"node",args:[e]}}function Gt(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=ue(t,r,s,i);if(!o)return;let{name:a,args:c}=zs(t,o),f=e[a];return f?{name:a,program:f,args:[...c,...n]}:void 0}function cn(t){return Object.assign(new Error(`spawn ${t} ENOENT`),{code:"ENOENT",errno:-2,syscall:`spawn ${t}`,path:t})}var ne=class{constructor(){p(this,"buffered",[]);p(this,"listeners",new Set);p(this,"ended",!1);p(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(s=>{s===null?(n(),e(r)):r+=s})})}get isEnded(){return this.ended}};var He=class{constructor(e){p(this,"options");p(this,"raw",!1);p(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`
8
+ `}function Xt(t,e){let r=t.readText(e);if(!r)return;let n=r.split(`
9
+ `).find(s=>s.startsWith(cn));return n?k(M(O(e)),n.slice(cn.length).trim()):void 0}function Xs(t,e,r){let n={};for(let s of r)for(let[i,o]of Object.entries(cc(s.name,s.bin))){let a=k(s.dir,o);if(!t.isFile(a))continue;let c=fc(e,a);t.writeFile(k(e,i),lc(c)),n[i]=a}return n}function fc(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 uc=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 ei(t,e){if(dc.test(t)||e.subarray(0,8e3).includes(0))return e.slice();try{return uc.decode(e)}catch{return e.slice()}}function ri(t,e){let r=t["dist-tags"]??{},n=e||"*";if(!We(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]&&Me(s,n))return s;let i=Ts(Object.keys(t.versions),n);if(!i)throw new Error(`No matching version found for ${t.name}@${e}.`);return i}async function hc(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 ln(t,e){try{let r=t.readText(e);return r===void 0?void 0:JSON.parse(r)}catch{return}}var ti=(t,e,r)=>t.writeFile(e,JSON.stringify(r,null,2)+`
10
+ `);function pc(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=kt(s,a),l=ln(t,k(e,c,"package.json"));r.set(c,`${l?.name??""}@${l?.version??""}`),n(c)}};return n(""),r}async function Ac(t,e,r,n){let s=n?"devDependencies":"dependencies",i=n?"dependencies":"devDependencies";for(let o of r){let a=rn(o),c=a.range;if(!c||!We(c)?c=`^${ri(await t.packument(a.registryName),c||"latest")}`:on(c)&&(c=`^${on(c)}`),a.registryName!==a.name&&(c=`npm:${a.registryName}@${c}`),e[s]=Yt({...e[s]??{},[a.name]:c}),e[i]?.[a.name]){let l={...e[i]};delete l[a.name],e[i]=l}}}async function ni(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 Gt({fetch:t.fetch,registry:t.registry??t.npmrc?.registry,npmrc:t.npmrc,cache:t.cache,signal:r}),c=m=>t.onProgress?.(m),l=ln(e,s);if(!l){if(e.isFile(s))throw new Error(`${s} is not valid JSON.`);if(!t.add?.length)throw new Error(`No package.json in ${n}.`);l={}}t.add?.length&&(await Ac(a,l,t.add,t.saveDev??!1),ti(e,s,l));let u=Hs(e.readText(i));if(t.ci){if(!u)throw new Error("npm ci needs a package-lock.json (lockfileVersion 2 or 3).");if(!qs(u,l))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 f=Ws(u),d=new Map,h=m=>{let Q=`${m.registryName}@${m.range}`,B=d.get(Q);if(!B){let v=an(f,m.registryName,m.range);v?B=Promise.resolve(v):t.ci?B=Promise.reject(new Error(`${Q} is missing from package-lock.json. Run npm install to update it.`)):B=a.packument(m.registryName).then(S=>{let I=S.versions[ri(S,m.range)];return{...I,name:I.name??m.registryName}}),B.catch(()=>{}),d.set(Q,B)}return B},w=0,E=await Ks({root:l,pick:h,prefetch:m=>void(an(f,m.registryName,m.range)||t.ci||a.packument(m.registryName).catch(()=>{})),production:t.production,warn:m=>o.push(m),onResolved:({name:m,version:Q})=>c({phase:"resolve",package:`${m}@${Q}`,done:++w,total:w})});r?.throwIfAborted();let b=0;for(let[m,Q]of[...pc(e,n)].sort(([B],[v])=>B.length-v.length)){let B=k(n,m);if(!e.exists(B))continue;let v=E.get(m);(!v||Q!==`${v.manifest.name}@${v.manifest.version}`)&&(e.rm(B),b++)}let y=[...E.values()].filter(m=>!e.isFile(k(n,m.location,"package.json"))),C=0;await hc(y,t.concurrency??8,async m=>{r?.throwIfAborted(),await gc(e,k(n,m.location),await a.tarball(m.manifest)),c({phase:"fetch",package:`${m.name}@${m.manifest.version}`,done:++C,total:y.length})});for(let m of E.values())m.manifest.hasInstallScript&&o.push(`skipped install scripts of ${m.name}@${m.manifest.version} (they cannot run in the browser)`),m.manifest.deprecated&&o.push(`deprecated ${m.name}@${m.manifest.version}: ${m.manifest.deprecated}`);let p=mc(e,n,E),A=zs(l,E);return ti(e,i,A),c({phase:"done",done:E.size,total:E.size}),{added:y.length,removed:b,total:E.size,bins:p,lockfile:A,warnings:o}}async function gc(t,e,r){let n=Zs(Bt(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),ei(o,i.data)))}if(!s)throw new Error(`The tarball for ${e} has no package.json.`);t.writeFile(k(e,"package.json"),ei("package.json",s))}function mc(t,e,r){let n=new Map;for(let i of r.values()){let o=Je(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=Xs(t,a,o.map(l=>({dir:k(e,l.location),name:l.name,bin:ln(t,k(e,l.location,"package.json"))?.bin??l.manifest.bin})));i===""&&(s=c)}return s}function xt(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 si(t){return new ReadableStream({start(e){t.byteLength&&e.enqueue(t),e.close()}})}function Dt(t,e){return{status:t,headers:{"content-type":"text/plain; charset=utf-8"},body:si(new TextEncoder().encode(e))}}function fn(t){return{status:t.status,statusText:t.statusText,headers:t.headers}}function un(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 er=class{constructor(){g(this,"peer");g(this,"closed",!1);g(this,"data",new Set);g(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 dn(){let t=new er,e=new er;return t.peer=e,e.peer=t,[t,e]}var wc=["/usr/local/bin","/usr/bin","/bin"];function yc(t,e){if(!e.startsWith("/"))return;let r=O(e);if(!(!wc.includes(M(r))||t.isFile(r)))return r.slice(M(r).length+1)}function it(t){let e=[];for(let r=O(t);;r=M(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules/.bin")),r==="/")return e}function Ae(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),...it(r)];for(let i of s){let o=k(i.startsWith("/")?i:k(r,i),e);if(t.isFile(o))return o}}function ii(t,e){let r=Xt(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(Et(e))?{name:"bfsh",args:[e]}:{name:"node",args:[e]}}function tr(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=yc(t,r);if(o&&Object.prototype.hasOwnProperty.call(e,o))return{name:o,program:e[o],args:n};let a=Ae(t,r,s,i);if(!a)return;let{name:c,args:l}=ii(t,a),u=e[c];return u?{name:c,program:u,args:[...l,...n]}:void 0}function hn(t){return Object.assign(new Error(`spawn ${t} ENOENT`),{code:"ENOENT",errno:-2,syscall:`spawn ${t}`,path:t})}var se=class{constructor(){g(this,"buffered",[]);g(this,"listeners",new Set);g(this,"ended",!1);g(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(ie(s=>{s===null?(n(),e(r)):r+=s}))})}get isEnded(){return this.ended}};function ie(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){g(this,"options");g(this,"raw",!1);g(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 za=1e3;function Ys(){return za++}function Gs(t){let e=new TextDecoder;return r=>{let n=typeof r=="string"?r:e.decode(r,{stream:!0});n&&t(n)}}function ln(t){let e=t.pid??Ys(),r=new ne,n=new Set,s=new Set,i=new Set,o=new AbortController,a=w=>n.forEach(E=>E(w)),c=w=>s.forEach(E=>E(w)),f=!1,l=()=>{},u=(w="SIGTERM")=>{f||(o.signal.aborted?w==="SIGKILL"&&l(137):o.abort(w))},d=t.terminal?{...t.terminal}:void 0,h=d?new He({echo:a,deliver:w=>r.push(w),signal:w=>u(w)}):void 0,g={stdout:Gs(a),stderr:Gs(c),onStdin:w=>r.subscribe(w),terminal:d&&h?{get cols(){return d.cols},get rows(){return d.rows},onResize(w){return i.add(w),()=>i.delete(w)},setRawMode(w){h.raw=w}}:void 0},m=new Promise(w=>{l=E=>{f=!0,w(E)},queueMicrotask(async()=>{let E;try{E=await t.program({args:t.args,cwd:t.cwd,env:t.env,io:g,system:t.system,signal:o.signal})}catch(v){g.stderr(`${v instanceof Error?v.stack??v.message:String(v)}
16
- `),E=1}f=!0,w(E)})});return{pid:e,onStdout(w){return n.add(w),()=>n.delete(w)},onStderr(w){return s.add(w),()=>s.delete(w)},write(w){h?h.input(w):r.push(w)},closeStdin:()=>r.push(null),kill:u,resize(w,E){d&&(d.cols=w,d.rows=E,i.forEach(v=>v(w,E)))},exit:m}}var Yt=(t,e)=>t<<e|t>>>32-e,we=(t,e)=>t>>>e|t<<32-e;function Vt(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),f=s>>>0;return n?(a.setUint32(i-8,f,!0),a.setUint32(i-4,c,!0)):(a.setUint32(i-4,f),a.setUint32(i-8,c)),o}var Ga=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Ya=Array.from({length:64},(t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function Va(t){let e=Vt(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 f=n,l=s,u=i,d=o;for(let h=0;h<64;h++){let g,m;h<16?[g,m]=[l&u|~l&d,h]:h<32?[g,m]=[d&l|~d&u,(5*h+1)%16]:h<48?[g,m]=[l^u^d,(3*h+5)%16]:[g,m]=[u^(l|~d),7*h%16];let w=d;d=u,u=l,l=l+Yt(f+g+Ya[h]+r.getUint32(c+m*4,!0)|0,Ga[(h>>4)*4+h%4])|0,f=w}n=n+f|0,s=s+l|0,i=i+u|0,o=o+d|0}let a=new DataView(new ArrayBuffer(16));return[n,s,i,o].forEach((c,f)=>a.setUint32(f*4,c,!0)),new Uint8Array(a.buffer)}function Za(t){let e=Vt(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]=Yt(s[d-3]^s[d-8]^s[d-14]^s[d-16],1);let[a,c,f,l,u]=n;for(let d=0;d<80;d++){let[h,g]=d<20?[c&f|~c&l,1518500249]:d<40?[c^f^l,1859775393]:d<60?[c&f|c&l|f&l,2400959708]:[c^f^l,3395469782],m=Yt(a,5)+h+u+g+s[d]|0;u=l,l=f,f=Yt(c,30),c=a,a=m}n[0]=n[0]+a|0,n[1]=n[1]+c|0,n[2]=n[2]+f|0,n[3]=n[3]+l|0,n[4]=n[4]+u|0}let i=new DataView(new ArrayBuffer(20));return n.forEach((o,a)=>i.setUint32(a*4,o>>>0)),new Uint8Array(i.buffer)}var Xa=[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 Vs(t,e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=8){let n=Vt(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 v=we(o[E-15],7)^we(o[E-15],18)^o[E-15]>>>3,A=we(o[E-2],17)^we(o[E-2],19)^o[E-2]>>>10;o[E]=o[E-16]+v+o[E-7]+A|0}let[f,l,u,d,h,g,m,w]=i;for(let E=0;E<64;E++){let v=w+(we(h,6)^we(h,11)^we(h,25))+(h&g^~h&m)+Xa[E]+o[E]|0,A=(we(f,2)^we(f,13)^we(f,22))+(f&l^f&u^l&u)|0;w=m,m=g,g=h,h=d+v|0,d=u,u=l,l=f,f=v+A|0}[f,l,u,d,h,g,m,w].forEach((E,v)=>i[v]=i[v]+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 ec=["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)),$e=(1n<<64n)-1n,ye=(t,e)=>(t>>e|t<<64n-e)&$e;function Zs(t,e,r){let n=Vt(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 v=ye(o[E-15],1n)^ye(o[E-15],8n)^o[E-15]>>7n,A=ye(o[E-2],19n)^ye(o[E-2],61n)^o[E-2]>>6n;o[E]=o[E-16]+v+o[E-7]+A&$e}let[f,l,u,d,h,g,m,w]=i;for(let E=0;E<80;E++){let v=w+(ye(h,14n)^ye(h,18n)^ye(h,41n))+(h&g^~h&$e&m)+ec[E]+o[E]&$e,A=(ye(f,28n)^ye(f,34n)^ye(f,39n))+(f&l^f&u^l&u)&$e;w=m,m=g,g=h,h=d+v&$e,d=u,u=l,l=f,f=v+A&$e}[f,l,u,d,h,g,m,w].forEach((E,v)=>i[v]=i[v]+E&$e)}let a=new DataView(new ArrayBuffer(64));return i.forEach((c,f)=>a.setBigUint64(f*8,c)),new Uint8Array(a.buffer).slice(0,r)}var tc=["6a09e667f3bcc908","bb67ae8584caa73b","3c6ef372fe94f82b","a54ff53a5f1d36f1","510e527fade682d1","9b05688c2b3e6c1f","1f83d9abfb41bd6b","5be0cd19137e2179"],rc=["cbbb9d5dc1059ed8","629a292a367cd507","9159015a3070dd17","152fecd8f70e5939","67332667ffc00b31","8eb44a8768581511","db0c2e0d64f98fa7","47b5481dbefa4fa4"],fn={md5:{digest:Va,blockSize:64},sha1:{digest:Za,blockSize:64},sha256:{digest:t=>Vs(t),blockSize:64},sha224:{digest:t=>Vs(t,[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],7),blockSize:64},sha384:{digest:t=>Zs(t,rc,48),blockSize:128},sha512:{digest:t=>Zs(t,tc,64),blockSize:128}};function Bt(t){let e=t.toLowerCase().replace(/^rsa-/,"").replace("-",""),r=fn[e];if(!r)throw new Error(`Digest method not supported: ${t}`);return r}var nc=new TextEncoder,sc=new TextDecoder;function un(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 ic(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 Zt(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return e}function V(t,e){switch(un(e)){case"utf8":return nc.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 ic(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(un(e)){case"utf8":return sc.decode(t);case"hex":return Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");case"base64":return btoa(Zt(t));case"base64url":return btoa(Zt(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");case"ascii":return Zt(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 Zt(t)}}var oc=Uint8Array,G=class G extends oc{constructor(e,r,n){typeof e=="string"?super(V(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 G(V(e,r));if(e instanceof ArrayBuffer)return new G(e,r,n);if(ArrayBuffer.isView(e))return new G(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e&&e.type==="Buffer"&&Array.isArray(e.data))return new G(e.data);if(e&&typeof e=="object"&&typeof e.length=="number")return new G(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 G(e);return r!==void 0&&r!==0&&s.fill(r,0,e,n),s}static allocUnsafe(e){return new G(e)}static allocUnsafeSlow(e){return new G(e)}static isBuffer(e){return e instanceof G}static isEncoding(e){try{return un(e),typeof e=="string"}catch{return!1}}static byteLength(e,r){return typeof e=="string"?V(e,r).length:e.byteLength}static concat(e,r){let n=r??e.reduce((o,a)=>o+a.length,0),s=G.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 G.compare(this,e)===0}compare(e,r=0,n=e.length,s=0,i=this.length){return G.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 G(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=V(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"?V(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"?V(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"?V(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}};p(G,"poolSize",8192);var D=G;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 Xs(){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}}function de(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 rt=class rt{constructor(){ti(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(rt.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??rt.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}};p(rt,"defaultMaxListeners",10),p(rt,"errorMonitor",Symbol("events.errorMonitor"));var T=rt;function ti(t){(!t._events||!(t._events instanceof Map))&&(t._events=new Map)}var ei=de(T,ti);function ri(){let t=ei;return t.EventEmitter=ei,t.once=T.once,t.defaultMaxListeners=T.defaultMaxListeners,t}function ni(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 si(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=ni(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"/"+ni(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 ii=Symbol.for("nodejs.util.inspect.custom"),ac=/^[A-Za-z_$][\w$]*$/;function oi(t){let e=t.includes("'")&&!t.includes('"')?'"':"'";return e+t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(new RegExp(e,"g"),"\\"+e)+e}function Xt(t){return typeof t=="symbol"?`[${t.toString()}]`:ac.test(t)?t:oi(t)}function nt(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 Ec=1e3;function oi(){return Ec++}function pn(t){let e=t.pid??oi(),r=new se,n=new Set,s=new Set,i=new Set,o=new AbortController,a=p=>l||n.forEach(A=>A(p)),c=p=>l||s.forEach(A=>A(p)),l=!1,u=()=>{},f=(p="SIGTERM")=>{l||(o.signal.aborted?p==="SIGKILL"&&u(137):o.abort(p))},d=t.terminal?{...t.terminal}:void 0,h=d?new ze({echo:a,deliver:p=>r.push(p),signal:p=>f(p)}):void 0,w={stdout:a,stderr:c,onStdin:p=>r.subscribe(p),terminal:d&&h?{get cols(){return d.cols},get rows(){return d.rows},onResize(p){return i.add(p),()=>i.delete(p)},setRawMode(p){h.raw=p}}:void 0},E=new Set,b={...t.system,spawn(p,A,m){let Q=t.system.spawn(p,A,m);return m?.detached||(E.add(Q),Q.exit.then(()=>E.delete(Q))),Q}},y=(p,A)=>{t.channel?.disconnect(),l=!0;for(let m of E)m.kill("SIGTERM");p(A)},C=new Promise(p=>{u=A=>y(p,A),queueMicrotask(async()=>{let A;try{A=await t.program({args:t.args,cwd:t.cwd,env:t.env,io:w,system:b,signal:o.signal,ipc:t.channel,thread:t.thread})}catch(m){w.stderr(`${m instanceof Error?m.stack??m.message:String(m)}
16
+ `),A=1}y(p,A)})});return{pid:e,onStdout(p){return n.add(p),()=>n.delete(p)},onStderr(p){return s.add(p),()=>s.delete(p)},write(p){h?h.input(typeof p=="string"?p:new TextDecoder().decode(p)):r.push(p)},closeStdin:()=>r.push(null),kill:f,resize(p,A){d&&(d.cols=p,d.rows=A,i.forEach(m=>m(p,A)))},exit:C}}function rr(t,e=()=>{}){let r=new Set,n=new Set,s=[],i=!0,o=c=>{i&&(i=!1,s=[],c&&e(),queueMicrotask(()=>n.forEach(l=>l())))};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 l=s;s=[],queueMicrotask(()=>l.forEach(u=>c(u)))}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(l=>l(c))):s.push(c))},closed:()=>o(!1)}}var nr=(t,e)=>t<<e|t>>>32-e,Ce=(t,e)=>t>>>e|t<<32-e;function sr(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),l=s>>>0;return n?(a.setUint32(i-8,l,!0),a.setUint32(i-4,c,!0)):(a.setUint32(i-4,l),a.setUint32(i-8,c)),o}var bc=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Cc=Array.from({length:64},(t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function vc(t){let e=sr(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 l=n,u=s,f=i,d=o;for(let h=0;h<64;h++){let w,E;h<16?[w,E]=[u&f|~u&d,h]:h<32?[w,E]=[d&u|~d&f,(5*h+1)%16]:h<48?[w,E]=[u^f^d,(3*h+5)%16]:[w,E]=[f^(u|~d),7*h%16];let b=d;d=f,f=u,u=u+nr(l+w+Cc[h]+r.getUint32(c+E*4,!0)|0,bc[(h>>4)*4+h%4])|0,l=b}n=n+l|0,s=s+u|0,i=i+f|0,o=o+d|0}let a=new DataView(new ArrayBuffer(16));return[n,s,i,o].forEach((c,l)=>a.setUint32(l*4,c,!0)),new Uint8Array(a.buffer)}function Sc(t){let e=sr(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]=nr(s[d-3]^s[d-8]^s[d-14]^s[d-16],1);let[a,c,l,u,f]=n;for(let d=0;d<80;d++){let[h,w]=d<20?[c&l|~c&u,1518500249]:d<40?[c^l^u,1859775393]:d<60?[c&l|c&u|l&u,2400959708]:[c^l^u,3395469782],E=nr(a,5)+h+f+w+s[d]|0;f=u,u=l,l=nr(c,30),c=a,a=E}n[0]=n[0]+a|0,n[1]=n[1]+c|0,n[2]=n[2]+l|0,n[3]=n[3]+u|0,n[4]=n[4]+f|0}let i=new DataView(new ArrayBuffer(20));return n.forEach((o,a)=>i.setUint32(a*4,o>>>0)),new Uint8Array(i.buffer)}var Qc=[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 ai(t,e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r=8){let n=sr(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 y=0;y<16;y++)o[y]=s.getInt32(c+y*4);for(let y=16;y<64;y++){let C=Ce(o[y-15],7)^Ce(o[y-15],18)^o[y-15]>>>3,p=Ce(o[y-2],17)^Ce(o[y-2],19)^o[y-2]>>>10;o[y]=o[y-16]+C+o[y-7]+p|0}let[l,u,f,d,h,w,E,b]=i;for(let y=0;y<64;y++){let C=b+(Ce(h,6)^Ce(h,11)^Ce(h,25))+(h&w^~h&E)+Qc[y]+o[y]|0,p=(Ce(l,2)^Ce(l,13)^Ce(l,22))+(l&u^l&f^u&f)|0;b=E,E=w,w=h,h=d+C|0,d=f,f=u,u=l,l=C+p|0}[l,u,f,d,h,w,E,b].forEach((y,C)=>i[C]=i[C]+y|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 Bc=["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)),Fe=(1n<<64n)-1n,ve=(t,e)=>(t>>e|t<<64n-e)&Fe;function ci(t,e,r){let n=sr(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 y=0;y<16;y++)o[y]=s.getBigUint64(c+y*8);for(let y=16;y<80;y++){let C=ve(o[y-15],1n)^ve(o[y-15],8n)^o[y-15]>>7n,p=ve(o[y-2],19n)^ve(o[y-2],61n)^o[y-2]>>6n;o[y]=o[y-16]+C+o[y-7]+p&Fe}let[l,u,f,d,h,w,E,b]=i;for(let y=0;y<80;y++){let C=b+(ve(h,14n)^ve(h,18n)^ve(h,41n))+(h&w^~h&Fe&E)+Bc[y]+o[y]&Fe,p=(ve(l,28n)^ve(l,34n)^ve(l,39n))+(l&u^l&f^u&f)&Fe;b=E,E=w,w=h,h=d+C&Fe,d=f,f=u,u=l,l=C+p&Fe}[l,u,f,d,h,w,E,b].forEach((y,C)=>i[C]=i[C]+y&Fe)}let a=new DataView(new ArrayBuffer(64));return i.forEach((c,l)=>a.setBigUint64(l*8,c)),new Uint8Array(a.buffer).slice(0,r)}var Ic=["6a09e667f3bcc908","bb67ae8584caa73b","3c6ef372fe94f82b","a54ff53a5f1d36f1","510e527fade682d1","9b05688c2b3e6c1f","1f83d9abfb41bd6b","5be0cd19137e2179"],kc=["cbbb9d5dc1059ed8","629a292a367cd507","9159015a3070dd17","152fecd8f70e5939","67332667ffc00b31","8eb44a8768581511","db0c2e0d64f98fa7","47b5481dbefa4fa4"],An={md5:{digest:vc,blockSize:64},sha1:{digest:Sc,blockSize:64},sha256:{digest:t=>ai(t),blockSize:64},sha224:{digest:t=>ai(t,[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],7),blockSize:64},sha384:{digest:t=>ci(t,kc,48),blockSize:128},sha512:{digest:t=>ci(t,Ic,64),blockSize:128}};function Ot(t){let e=t.toLowerCase().replace(/^rsa-/,"").replace("-",""),r=An[e];if(!r)throw new Error(`Digest method not supported: ${t}`);return r}function gn(t,e,r,n,s){let i,o=!0,a=!1,c=()=>e.some(f=>t.listenerCount(f)>0),l=()=>{!a&&c()&&(a=!0,s());let f=o&&n()&&c();f&&!i?i=r.hold():!f&&i&&(i(),i=void 0)},u=f=>{typeof f=="string"&&e.includes(f)&&queueMicrotask(l)};return t.on("newListener",u),t.on("removeListener",u),{update:l,ref(){o=!0,l()},unref(){o=!1,l()},hasRef:()=>o}}function li(t,e,r){let n=gn(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 oe(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 ot=class ot{constructor(){ui(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(ot.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??ot.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}};g(ot,"defaultMaxListeners",10),g(ot,"errorMonitor",Symbol("events.errorMonitor"));var L=ot;function ui(t){(!t._events||!(t._events instanceof Map))&&(t._events=new Map)}var fi=oe(L,ui);function di(){let t=fi;return t.EventEmitter=fi,t.once=L.once,t.defaultMaxListeners=L.defaultMaxListeners,t}var xc=new TextEncoder,Dc=new TextDecoder;function mn(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 Oc(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 ir(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return e}function re(t,e){switch(mn(e)){case"utf8":return xc.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 Oc(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 wn(t,e){switch(mn(e)){case"utf8":return Dc.decode(t);case"hex":return Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");case"base64":return btoa(ir(t));case"base64url":return btoa(ir(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");case"ascii":return ir(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 ir(t)}}var _c=Uint8Array,te=class te extends _c{constructor(e,r,n){typeof e=="string"?super(re(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 te(re(e,r));if(e instanceof ArrayBuffer)return new te(e,r,n);if(ArrayBuffer.isView(e))return new te(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e&&e.type==="Buffer"&&Array.isArray(e.data))return new te(e.data);if(e&&typeof e=="object"&&typeof e.length=="number")return new te(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 te(e);return r!==void 0&&r!==0&&s.fill(r,0,e,n),s}static allocUnsafe(e){return new te(e)}static allocUnsafeSlow(e){return new te(e)}static isBuffer(e){return e instanceof te}static isEncoding(e){try{return mn(e),typeof e=="string"}catch{return!1}}static byteLength(e,r){return typeof e=="string"?re(e,r).length:e.byteLength}static concat(e,r){let n=r??e.reduce((o,a)=>o+a.length,0),s=te.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 wn(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 te.compare(this,e)===0}compare(e,r=0,n=e.length,s=0,i=this.length){return te.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 te(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=re(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"?re(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"?re(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"?re(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}};g(te,"poolSize",8192);var D=te;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 hi(){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 Ue=class{constructor(e){g(this,"code");this.code=e}};function N(t){queueMicrotask(()=>{try{t()}catch(e){if(!(e instanceof Ue))throw e}})}var ge=N,or=(t,e)=>t.objectMode?1:e.length;function at(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 V=class t extends L{constructor(e){super(),at(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+=or(n,s),this._scheduleFlow()),n.length<n.highWaterMark}unshift(e){let r=this._readableState;r.buffer.unshift(e),r.length+=or(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-=or(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=>{ge(()=>{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,ge(()=>{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-=or(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 pi(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 Rc(t){let e=new Error(t.error.message);return e.name=t.error.name,t.error.stack&&(e.stack=t.error.stack),e}var Nc=1,yn=class extends L{constructor(r,n){super();g(this,"ipc");g(this,"keepAlive");this.ipc=r,this.keepAlive=gn(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 Ai(t){let{loop:e}=t,r=new Map;class n extends L{constructor(a,c={}){super();g(this,"threadId",Nc++);g(this,"resourceLimits",{});g(this,"stdin",null);g(this,"stdout");g(this,"stderr");g(this,"handle");g(this,"release");g(this,"terminated",!1);this.stdout=new V({read(){}}),this.stderr=new V({read(){}});let l=a instanceof URL?decodeURIComponent(a.pathname):String(a),u=c.eval?["-e",l]:[l.startsWith("/")?l:k(t.cwd(),l)],f={},d=typeof c.env=="object"?c.env:t.env();for(let[w,E]of Object.entries(d))E!==void 0&&(f[w]=String(E));this.release=e.hold();try{this.handle=t.system.spawn("node",[...u,...(c.argv??[]).map(String)],{cwd:t.cwd(),env:f,ipc:!0,thread:{threadId:this.threadId,workerData:c.workerData??null}})}catch(w){this.releaseLoop(),queueMicrotask(()=>e._run(()=>this.emit("error",w)));return}let h=this.handle;h.onStdout(w=>c.stdout?this.stdout.push(D.from(w)):t.stdout(w)),h.onStderr(w=>c.stderr?this.stderr.push(D.from(w)):t.stderr(w)),h.ipc?.onMessage(w=>{let E=w;e._run(()=>E.kind==="error"?this.emit("error",Rc(E)):this.emit("message",E.value))}),queueMicrotask(()=>e._run(()=>this.emit("online"))),h.exit.then(w=>{this.stdout.push(null),this.stderr.push(null),e._run(()=>this.emit("exit",this.terminated?1:w)),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 yn(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 gi(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 mi(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=gi(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"/"+gi(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 wi=Symbol.for("nodejs.util.inspect.custom"),Tc=/^[A-Za-z_$][\w$]*$/;function yi(t){let e=t.includes("'")&&!t.includes('"')?'"':"'";return e+t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(new RegExp(e,"g"),"\\"+e)+e}function ar(t){return typeof t=="symbol"?`[${t.toString()}]`:Tc.test(t)?t:yi(t)}function ct(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 St(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 K(t,e={}){let r=e.depth===null?1/0:e.depth??2,n=e.breakLength??80,s=[],i=(o,a,c,f)=>{switch(typeof o){case"string":return f?oi(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 g=o.name?`: ${o.name}`:" (anonymous)",m=/^class\s/.test(Function.prototype.toString.call(o))?"class":"Function",w=Object.keys(o),E=m==="class"?`[class ${o.name||"(anonymous)"}]`:`[${m}${g}]`;return!w.length||a>r?E:nt(`${E} {`,w.map(v=>`${Xt(v)}: ${i(o[v],a+1,c+" ",!0)}`),"}",n,c)}}if(o===null)return"null";let l=o,u=l[ii];if(typeof u=="function"){let g=u.call(l,r-a,{...e,stylize:m=>m},K);return typeof g=="string"?g:i(g,a,c,f)}if(s.includes(l))return"[Circular *1]";if(o instanceof Error){let g=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 G(t,e={}){let r=e.depth===null?1/0:e.depth??2,n=e.breakLength??80,s=[],i=(o,a,c,l)=>{switch(typeof o){case"string":return l?yi(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 w=o.name?`: ${o.name}`:" (anonymous)",E=/^class\s/.test(Function.prototype.toString.call(o))?"class":"Function",b=Object.keys(o),y=E==="class"?`[class ${o.name||"(anonymous)"}]`:`[${E}${w}]`;return!b.length||a>r?y:ct(`${y} {`,b.map(C=>`${ar(C)}: ${i(o[C],a+1,c+" ",!0)}`),"}",n,c)}}if(o===null)return"null";let u=o,f=u[wi];if(typeof f=="function"){let w=f.call(u,r-a,{...e,stylize:E=>E},G);return typeof w=="string"?w:i(w,a,c,l)}if(s.includes(u))return"[Circular *1]";if(o instanceof Error){let w=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
- `):""}`,m=Object.keys(o).filter(E=>E!=="stack"&&E!=="message");if(!m.length||a>r)return g;s.push(l);let w=nt(`${g} {`,m.map(E=>`${Xt(E)}: ${i(l[E],a+1,c+" ",!0)}`),"}",n,c);return s.pop(),w}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 g=o;if(g.constructor.name==="Buffer"){let m=Array.from(g).slice(0,50).map(w=>w.toString(16).padStart(2,"0"));return`<Buffer${m.length?" "+m.join(" "):""}${g.length>50?` ... ${g.length-50} more bytes`:""}>`}return`${g.constructor.name}(${g.length}) [ ${Array.from(g).slice(0,100).join(", ")} ]`}if(a>r)return Array.isArray(o)?"[Array]":`[${St(l)??"Object"}]`;s.push(l);let d=g=>i(g,a+1,c+" ",!0),h;if(Array.isArray(o)){let g=o.slice(0,100).map(d);o.length>100&&g.push(`... ${o.length-100} more items`);for(let w of Object.keys(o))/^\d+$/.test(w)||g.push(`${Xt(w)}: ${d(l[w])}`);let m=St(l)&&St(l)!=="Array"?`${St(l)}(${o.length}) `:"";h=nt(`${m}[`,g,"]",n,c)}else if(o instanceof Map)h=nt(`Map(${o.size}) {`,[...o].map(([g,m])=>`${d(g)} => ${d(m)}`),"}",n,c);else if(o instanceof Set)h=nt(`Set(${o.size}) {`,[...o].map(d),"}",n,c);else{let g=[...Object.keys(l),...Object.getOwnPropertySymbols(l).filter(A=>Object.getOwnPropertyDescriptor(l,A)?.enumerable)];e.sorted&&g.sort();let m=g.map(A=>{let b=Object.getOwnPropertyDescriptor(l,A),y=b&&(b.get||b.set)?b.get&&b.set?"[Getter/Setter]":b.get?"[Getter]":"[Setter]":d(l[A]);return`${Xt(A)}: ${y}`}),w=St(l),E=l[Symbol.toStringTag],v=w?`${w}${E&&E!==w?` [${E}]`:""} `:E?`Object [${E}] `:"";h=m.length||!v?nt(`${v}{`,m,"}",n,c):`${v}{}`}return s.pop(),h};return i(t,0,"",!1)}K.custom=ii;K.defaultOptions={depth:2};function Se(...t){let[e,...r]=t;if(typeof e!="string")return t.map(i=>K(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?K(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 K(a,{depth:o==="o"?4:2})}});for(;n<r.length;n++){let i=r[n];s+=" "+(typeof i=="string"?i:K(i))}return s}var ai=Symbol.for("nodejs.util.promisify.custom");function ci(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');let e=t[ai];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))}ci.custom=ai;function cc(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 Ee(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)||!Ee(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=>Ee(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)&&Ee(t[i],e[i],r))}var Je=t=>Object.prototype.toString.call(t).slice(8,-1),st={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||Je(t)==="SharedArrayBuffer",isArrayBufferView:t=>ArrayBuffer.isView(t),isDataView:t=>t instanceof DataView,isAsyncFunction:t=>Je(t)==="AsyncFunction"||Je(t)==="AsyncGeneratorFunction",isGeneratorFunction:t=>Je(t)==="GeneratorFunction"||Je(t)==="AsyncGeneratorFunction",isGeneratorObject:t=>Je(t)==="Generator",isBoxedPrimitive:t=>t instanceof Number||t instanceof String||t instanceof Boolean,isProxy:()=>!1,isExternal:()=>!1,isModuleNamespaceObject:t=>Je(t)==="Module"};function li(t,e){let r=new Set;return{format:Se,formatWithOptions:(n,...s)=>Se(...s),inspect:K,inherits:cc,promisify:ci,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()}: ${Se(...o)}`);return i.enabled=s,i},isDeepStrictEqual:(n,s)=>Ee(n,s),types:st,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:st.isRegExp,isObject:n=>n!==null&&typeof n=="object",isDate:st.isDate,isError:st.isNativeError,isFunction:n=>typeof n=="function",isPrimitive:n=>n===null||typeof n!="object"&&typeof n!="function",isBuffer:n=>n?.constructor?.name==="Buffer"}}var he=t=>queueMicrotask(t),er=(t,e)=>t.objectMode?1:e.length;function tr(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 Z=class t extends T{constructor(e){super(),tr(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+=er(n,s),this._scheduleFlow()),n.length<n.highWaterMark}unshift(e){let r=this._readableState;r.buffer.unshift(e),r.length+=er(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-=er(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=>{he(()=>{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,he(()=>{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-=er(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 rr(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 X=class extends T{constructor(e){super(),rr(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 he(()=>{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?he(()=>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=>{he(()=>{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?he(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=>he(()=>r(n))):he(()=>r())}};var It=class extends T{pipe(e){return this.on("data",r=>e.write(r)),this.on("end",()=>e.end()),e}};Object.setPrototypeOf(Z.prototype,It.prototype);Object.setPrototypeOf(X.prototype,It.prototype);function gn(t,e={}){tr(t,e),rr(t,e),t.allowHalfOpen=e.allowHalfOpen!==!1,t.allowHalfOpen||t.once("end",()=>t.end())}var Ie=class extends Z{constructor(e){super(e),gn(this,e)}destroy(e){let r=this._writableState;return r&&(r.destroyed=!0),super.destroy(e)}};for(let t of Object.getOwnPropertyNames(X.prototype))t==="constructor"||t==="destroy"||t==="destroyed"||t==="_destroy"||t in Ie.prototype&&Object.getOwnPropertyDescriptor(Ie.prototype,t)||Object.defineProperty(Ie.prototype,t,Object.getOwnPropertyDescriptor(X.prototype,t));function hn(t,e={}){gn(t,e),typeof e.transform=="function"&&(t._transform=e.transform),typeof e.flush=="function"&&(t._flush=e.flush)}var Le=class extends Ie{constructor(e){super(e),hn(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()}},pn=class extends Le{_transform(e,r,n){n(null,e)}};function An(t,e,r){let n=typeof e=="function"?e:r,s=!1,i=u=>{s||(s=!0,l(),n(u??null))},o=u=>i(u),a=()=>i(),c=()=>{let u=t._readableState,d=t._writableState;u&&!u.endEmitted||d&&!d.finished?i(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"})):i()},f=!!t._writableState&&!t._readableState;t.on("error",o),t.on(f?"finish":"end",a),t._readableState&&t._writableState&&t.on("finish",()=>t._readableState.endEmitted&&i()),t.on("close",c);let l=()=>{t.removeListener("error",o),t.removeListener("end",a),t.removeListener("finish",a),t.removeListener("close",c)};return(t._readableState?.endEmitted&&!t._writableState||f&&t._writableState.finished)&&he(()=>i()),l}function fi(...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 An(i,o=>{o?s(o):n||e?.(null)}),i}function ui(){let t=de(It,()=>{}),e={Readable:de(Z,(n,s)=>tr(n,s)),Writable:de(X,(n,s)=>rr(n,s)),Duplex:de(Ie,(n,s)=>gn(n,s)),Transform:de(Le,(n,s)=>hn(n,s)),PassThrough:de(pn,(n,s)=>hn(n,s))};return Object.assign(t,e,{Stream:t,pipeline:fi,finished:An,promises:{pipeline:(...n)=>new Promise((s,i)=>fi(...n,o=>o?i(o):s())),finished:n=>new Promise((s,i)=>An(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 lc={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 N(t,e,r,n){let[s,i]=lc[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 fc(t){let e=5381;for(let r=0;r<t.length;r++)e=(e*33^t.charCodeAt(r))>>>0;return e}var mn=32768,wn=16384,ke=class{constructor(e,r,n,s){p(this,"dev",2049);p(this,"ino");p(this,"mode");p(this,"nlink",1);p(this,"uid",1e3);p(this,"gid",1e3);p(this,"rdev",0);p(this,"size");p(this,"blksize",4096);p(this,"blocks");p(this,"atimeMs");p(this,"mtimeMs");p(this,"ctimeMs");p(this,"birthtimeMs");p(this,"atime");p(this,"mtime");p(this,"ctime");p(this,"birthtime");this.ino=fc(e),this.mode=r==="file"?mn|420:wn|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)===wn}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},it=class{constructor(e,r,n){p(this,"name");p(this,"parentPath");p(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}},be={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:wn,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 nr=t=>typeof t=="string"?t:t?.encoding;function di(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 b=typeof A=="string"?A:new TextDecoder().decode(A);if(typeof b!="string")throw new TypeError('The "path" argument must be of type string, Buffer or URL');return b.startsWith("file://")?O(decodeURIComponent(new URL(b).pathname)):b.startsWith("/")?O(b):I(t.cwd(),b)},i=A=>{let b=e.readFile(A);return typeof b=="string"?V(b):b},o=(A,b)=>{let y=L(A);if(e.isFile(y))throw N("ENOTDIR",b,A);if(!e.isDirectory(y))throw N("ENOENT",b,A)},a=(A,b)=>typeof A=="string"?!b||/^utf-?8$/i.test(b)?A:V(A,b).slice():new Uint8Array(A.buffer,A.byteOffset,A.byteLength).slice(),c=(A,b)=>{let y=s(A);if(e.isFile(y))return new ke(y,"file",i(y).length,e.mtime(y)??Date.now());if(e.isDirectory(y))return new ke(y,"directory",4096,0);if(b?.throwIfNoEntry!==!1)throw N("ENOENT","stat",y)},f=(A,b,y)=>{if(typeof A=="number")return l(A,b);let B=s(A),S=typeof y=="object"&&y?y.flag??"w":"w";if(e.isDirectory(B))throw N("EISDIR","open",B);if(o(B,"open"),S.includes("x")&&e.isFile(B))throw N("EEXIST","open",B);if(S.startsWith("a")&&e.isFile(B)){let C=e.readFile(B),Q=a(b,nr(y));e.writeFile(B,typeof C=="string"&&typeof Q=="string"?C+Q:D.concat([typeof C=="string"?V(C):C,typeof Q=="string"?V(Q):Q]));return}e.writeFile(B,a(b,nr(y)))},l=(A,b,y,B,S)=>{let C=typeof b=="string"?V(b,typeof y=="string"?y:void 0):new Uint8Array(b.buffer,b.byteOffset+(typeof y=="number"?y:0),B??b.byteLength-(typeof y=="number"?y:0));if(A===1||A===2)return(A===1?t.stdout:t.stderr)(C.slice()),C.length;let Q=r.get(A);if(!Q||Q.flags==="r")throw N("EBADF","write");let k=e.isFile(Q.path)?i(Q.path):new Uint8Array,x=Q.flags.startsWith("a")?k.length:S??Q.position,R=new Uint8Array(Math.max(k.length,x+C.length));return R.set(k),R.set(C,x),e.writeFile(Q.path,R),S==null&&(Q.position=x+C.length),C.length},u=(A,b,y="")=>{let B=[];for(let S of e.readdir(A)){let C=I(A,S),Q=e.isDirectory(C)?"directory":"file";B.push({name:y+S,parent:A,kind:Q}),b&&Q==="directory"&&B.push(...u(C,!0,`${y}${S}/`))}return B},d=(A,b)=>{let y=s(A),B=typeof b=="object"&&!!b?.recursive;if(e.isFile(y))throw N("EEXIST","mkdir",y);if(e.isDirectory(y)){if(B)return;throw N("EEXIST","mkdir",y)}B||o(y,"mkdir");let S;for(let C=y;!e.isDirectory(C);C=L(C)){if(e.isFile(C))throw N("ENOTDIR","mkdir",y);S=C}return e.mkdir(y),B?S:void 0},h=(A,b)=>{let y=s(A);if(!e.exists(y)){if(b?.force)return;throw N("ENOENT","rm",y)}if(e.isDirectory(y)&&!b?.recursive)throw Object.assign(N("EISDIR","rm",y),{code:"ERR_FS_EISDIR"});e.rm(y)},g=(A,b,y=0)=>{let B=s(A),S=s(b);if(!e.isFile(B))throw N(e.isDirectory(B)?"EISDIR":"ENOENT","copyfile",B,S);if(y&be.COPYFILE_EXCL&&e.exists(S))throw N("EEXIST","copyfile",B,S);o(S,"copyfile");let C=e.readFile(B);e.writeFile(S,typeof C=="string"?C:C.slice())},m=(A,b)=>{if(e.isFile(A)){let y=e.readFile(A);e.writeFile(b,typeof y=="string"?y:y.slice());return}e.mkdir(b);for(let y of e.readdir(A))m(I(A,y),I(b,y))},w=(A,b="r")=>{let y=s(A),B=typeof b=="number"?b&be.O_APPEND?"a":b&(be.O_WRONLY|be.O_RDWR)?"w":"r":b;if(e.isDirectory(y)&&B!=="r")throw N("EISDIR","open",y);if(B.startsWith("r")){if(!e.exists(y))throw N("ENOENT","open",y)}else{if(B.includes("x")&&e.exists(y))throw N("EEXIST","open",y);o(y,"open"),(B.startsWith("w")||!e.isFile(y))&&e.writeFile(y,"")}let S=n++;return r.set(S,{path:y,flags:B,position:0}),S},E=(A,b)=>{let y=r.get(A);if(!y)throw N("EBADF",b);return y},v={existsSync:A=>{try{return e.exists(s(A))}catch{return!1}},accessSync(A){let b=s(A);if(!e.exists(b))throw N("ENOENT","access",b)},statSync:c,lstatSync:c,fstatSync:A=>c(E(A,"fstat").path),readFileSync(A,b){if(A===0)return D.alloc(0);let y=typeof A=="number"?E(A,"read").path:s(A);if(e.isDirectory(y))throw N("EISDIR","read",y);let B=e.readFile(y);if(B===void 0)throw N("ENOENT","open",y);let S=nr(b);return S?typeof B=="string"&&/^utf-?8$/i.test(S)?B:D.from(typeof B=="string"?V(B):B).toString(S):D.from(typeof B=="string"?V(B):B)},writeFileSync:f,appendFileSync:(A,b,y)=>f(A,b,{...typeof y=="string"?{encoding:y}:y??{},flag:"a"}),mkdirSync:d,mkdtempSync(A){let b=`${A}${Math.random().toString(36).slice(2,8)}`;return d(b),s(b)},readdirSync(A,b){let y=s(A);if(e.isFile(y))throw N("ENOTDIR","scandir",y);if(!e.isDirectory(y))throw N("ENOENT","scandir",y);let B=typeof b=="object"?b:void 0,S=u(y,!!B?.recursive);return B?.withFileTypes?S.map(C=>new it(C.name.slice(C.name.lastIndexOf("/")+1),C.name.includes("/")?I(y,C.name,".."):C.parent,C.kind)):S.map(C=>nr(b)==="buffer"?D.from(C.name):C.name)},rmSync:h,rmdirSync(A,b){let y=s(A);if(e.isFile(y))throw N("ENOTDIR","rmdir",y);if(!e.isDirectory(y))throw N("ENOENT","rmdir",y);if(e.readdir(y).length&&!b?.recursive)throw N("ENOTEMPTY","rmdir",y);e.rm(y)},unlinkSync(A){let b=s(A);if(e.isDirectory(b))throw N("EISDIR","unlink",b);if(!e.isFile(b))throw N("ENOENT","unlink",b);e.rm(b)},renameSync(A,b){let y=s(A),B=s(b);if(!e.exists(y))throw N("ENOENT","rename",y,B);if(y!==B){if(e.isDirectory(B)&&e.isFile(y))throw N("EISDIR","rename",y,B);if(o(B,"rename"),e.isFile(B)&&e.isDirectory(y))throw N("ENOTDIR","rename",y,B);e.rm(B),m(y,B),e.rm(y)}},copyFileSync:g,cpSync(A,b,y){let B=s(A);if(e.isDirectory(B)&&!y?.recursive)throw Object.assign(N("EISDIR","cp",B),{code:"ERR_FS_EISDIR"});if(!e.exists(B))throw N("ENOENT","cp",B);m(B,s(b))},realpathSync:Object.assign(A=>{let b=s(A);if(!e.exists(b))throw N("ENOENT","realpath",b);return b},{native:A=>v.realpathSync(A)}),readlinkSync:A=>{throw N("EINVAL","readlink",s(A))},symlinkSync(A,b){let y=s(b),B=typeof A=="string"&&!A.startsWith("/")?I(L(y),A):s(A);m(B,y)},linkSync:(A,b)=>g(A,b),truncateSync(A,b=0){let y=s(A);if(!e.isFile(y))throw N("ENOENT","open",y);let B=i(y),S=new Uint8Array(b);S.set(B.subarray(0,b)),e.writeFile(y,S)},chmodSync:A=>void v.accessSync(A),lchmodSync:A=>void v.accessSync(A),chownSync:A=>void v.accessSync(A),lchownSync:A=>void v.accessSync(A),utimesSync:A=>void v.accessSync(A),lutimesSync:A=>void v.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,b=0)=>v.truncateSync(E(A,"ftruncate").path,b),openSync:w,closeSync(A){A>2&&E(A,"close"),r.delete(A)},readSync(A,b,y,B,S){let C=typeof y=="object"?y:{offset:y,length:B,position:S},Q=E(A,"read"),k=i(Q.path),x=new Uint8Array(b.buffer,b.byteOffset,b.byteLength),R=C.offset??0,Y=C.position??Q.position,W=k.subarray(Y,Y+Math.min(C.length??x.length-R,x.length-R));return x.set(W,R),(C.position===void 0||C.position===null)&&(Q.position=Y+W.length),W.length},writeSync:l,opendirSync(A){let b=s(A),y=v.readdirSync(b,{withFileTypes:!0}),B=0;return{path:b,readSync:()=>y[B++]??null,read:async()=>y[B++]??null,closeSync:()=>{},close:async()=>{},async*[Symbol.asyncIterator](){for(;B<y.length;)yield y[B++]}}},_resolve:s};return v}var uc=64*1024;function dc(t){return typeof t[t.length-1]=="function"?t.pop():void 0}function hi(t){let e=di(t),r=(h,g=m=>[m])=>(...m)=>{let w=dc(m);queueMicrotask(()=>{let E;try{E=h(...m)}catch(v){w?.(v);return}w?.(null,...g(E,m))})},n=h=>async(...g)=>h(...g);class s extends Z{constructor(m,w={}){let E=typeof w=="string"?{encoding:w}:w;super({highWaterMark:E.highWaterMark??uc,encoding:E.encoding});p(this,"bytesRead",0);p(this,"path");p(this,"fd",null);p(this,"pending",!0);p(this,"data");p(this,"offset");p(this,"endAt");this.path=typeof w=="object"&&E.fd!==void 0?"":e._resolve(m),this.offset=E.start??0,this.endAt=E.end??1/0,queueMicrotask(()=>{try{let v=e.readFileSync(this.path);this.data=v,this.fd=-1,this.pending=!1,this.emit("open",this.fd),this.emit("ready"),this._pull()}catch(v){this.destroy(v)}})}_read(){if(!this.data){this._readableState.reading=!1;return}let m=Math.min(this.data.length,this.endAt+1);if(this.offset>=m){this.push(null);return}let w=this.data.subarray(this.offset,Math.min(m,this.offset+this._readableState.highWaterMark));this.offset+=w.length,this.bytesRead+=w.length,this.push(D.from(w))}close(m){this.destroy(),m&&this.once("close",m)}}class i extends X{constructor(m,w={}){super({decodeStrings:!0});p(this,"options");p(this,"bytesWritten",0);p(this,"path");p(this,"pending",!1);p(this,"started",!1);this.options=w,this.path=e._resolve(m),queueMicrotask(()=>{try{this.open(),this.emit("open",-1),this.emit("ready")}catch(E){this.destroy(E)}})}open(){if(this.started)return;this.started=!0;let m=typeof this.options=="object"?this.options.flags??"w":"w";(!m.startsWith("a")||!t.vfs.isFile(this.path))&&e.writeFileSync(this.path,"",{flag:m.includes("x")?"wx":"w"})}_write(m,w,E){try{this.open(),e.appendFileSync(this.path,m),this.bytesWritten+=m.length,E()}catch(v){E(v)}}close(m){this.end(),m&&this.once("close",m)}}class o extends T{constructor(m,w,E){super();p(this,"release");p(this,"unwatch");let v=O(m);E&&this.on("change",E),this.release=t.hold(),this.unwatch=t.vfs.watch(A=>{let b=A.path;if(!(b===v||b.startsWith(v==="/"?"/":v+"/")))return;let B=b===v?b.slice(b.lastIndexOf("/")+1):b.slice(v.length+(v==="/"?0:1));!w&&B.includes("/")||this.emit("change",A.type==="write"&&!A.created?"change":"rename",B)})}close(){this.unwatch(),this.release(),this.emit("close")}ref(){return this}unref(){return this}}let a=(h,g,m)=>{typeof g=="function"&&([m,g]=[g,void 0]);let w=e._resolve(h);if(!t.vfs.exists(w))throw e.statSync(w);return new o(w,typeof g=="object"&&!!g?.recursive,m)},c=new Map,f=(h,g,m)=>{let w=typeof g=="function"?g:m,E=e._resolve(h),v=c.get(E);if(!v){let A=new o(E,!1),b={watcher:A,listeners:[]},y=e.statSync(E,{throwIfNoEntry:!1})??new ke(E,"file",0,0);A.on("change",()=>{let B=e.statSync(E,{throwIfNoEntry:!1})??new ke(E,"file",0,0);for(let S of b.listeners)S(B,y);y=B}),c.set(E,v=b)}return v.listeners.push(w),v.watcher},l=(h,g)=>{let m=e._resolve(h),w=c.get(m);w&&(w.listeners=g?w.listeners.filter(E=>E!==g):[],w.listeners.length||(w.watcher.close(),c.delete(m)))},u={...e,constants:be,Stats:ke,Dirent:it,ReadStream:s,WriteStream:i,FSWatcher:o,F_OK:0,R_OK:4,W_OK:2,X_OK:1};delete u._resolve;for(let h of Object.keys(e)){if(!h.endsWith("Sync"))continue;let g=h.slice(0,-4),m=e[h];g==="exists"?u.exists=(w,E)=>queueMicrotask(()=>E(e.existsSync(w))):g==="read"?u.read=r(m,(w,E)=>[w,E[1]]):g==="write"?u.write=r(m,(w,E)=>[w,E[1]]):u[g]=r(m)}u.realpath.native=u.realpath,u.createReadStream=(h,g)=>new s(h,g),u.createWriteStream=(h,g)=>new i(h,g),u.watch=a,u.watchFile=f,u.unwatchFile=l;let d={constants:be};for(let h of Object.keys(e))!h.endsWith("Sync")||h==="existsSync"||(d[h.slice(0,-4)]=n(e[h]));return d.open=async(h,g)=>hc(e,e.openSync(h,g),e._resolve(h)),d.watch=(h,g)=>pc(a(h,g),g?.signal),u.promises=d,u}function hc(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}),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*pc(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()}}var ot=(t,e)=>typeof t=="string"?D.from(t,e):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),bn=(t,e)=>e&&e!=="buffer"?D.from(t).toString(e):D.from(t),ir=class t extends Le{constructor(r){super();p(this,"algorithm");p(this,"chunks",[]);p(this,"done",!1);this.algorithm=r,Bt(r)}update(r,n){if(this.done)throw Object.assign(new Error("Digest already called"),{code:"ERR_CRYPTO_HASH_FINALIZED"});return this.chunks.push(ot(r,n).slice()),this}digest(r){return this.done=!0,bn(Bt(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 yn(t,e,r){let{digest:n,blockSize:s}=Bt(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 u=0;u<s;u++)a[u]=i[u]^54,c[u]=i[u]^92;a.set(r,s);let f=n(a),l=new Uint8Array(s+f.length);return l.set(c),l.set(f,s),n(l)}var En=class extends ir{constructor(r,n){super(r);p(this,"hmacAlgorithm");p(this,"hmacKey");p(this,"parts",[]);this.hmacAlgorithm=r,this.hmacKey=ot(n).slice()}update(r,n){return this.parts.push(ot(r,n).slice()),this}digest(r){return bn(yn(this.hmacAlgorithm,this.hmacKey,D.concat(this.parts)),r)}};function pi(t,e,r,n,s="sha1"){let i=ot(t),o=ot(e),a=new Uint8Array(n);for(let c=1,f=0;f<n;c++){let l=new Uint8Array(o.length+4);l.set(o),new DataView(l.buffer).setUint32(o.length,c);let u=yn(s,i,l),d=u.slice();for(let h=1;h<r;h++){u=yn(s,i,u);for(let g=0;g<d.length;g++)d[g]=d[g]^u[g]}a.set(d.subarray(0,n-f),f),f+=d.length}return D.from(a)}function sr(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 Ce=t=>()=>{throw Object.assign(new Error(`crypto.${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Ai(){let t=(e,r)=>{let n=sr(D.alloc(e));return r&&queueMicrotask(()=>r(null,n)),n};return{createHash:e=>new ir(e),createHmac:(e,r)=>new En(e,r),hash:(e,r,n="hex")=>bn(Bt(e).digest(ot(r)),n),getHashes:()=>Object.keys(fn),getCiphers:()=>[],getCurves:()=>[],randomBytes:t,pseudoRandomBytes:t,randomFillSync:(e,r=0,n)=>(sr(new Uint8Array(e.buffer,e.byteOffset+r,n??e.byteLength-r)),e),randomFill:(e,...r)=>{let n=r.pop();sr(e),queueMicrotask(()=>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&&queueMicrotask(()=>n(null,s)),s},getRandomValues:e=>sr(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:pi,pbkdf2(e,r,n,s,i,o){queueMicrotask(()=>{try{o(null,pi(e,r,n,s,i))}catch(a){o(a)}})},webcrypto:globalThis.crypto,subtle:globalThis.crypto?.subtle,constants:{},createCipheriv:Ce("createCipheriv"),createDecipheriv:Ce("createDecipheriv"),createSign:Ce("createSign"),createVerify:Ce("createVerify"),generateKeyPairSync:Ce("generateKeyPairSync"),generateKeyPair:Ce("generateKeyPair"),createPrivateKey:Ce("createPrivateKey"),createPublicKey:Ce("createPublicKey"),scryptSync:Ce("scryptSync"),scrypt:Ce("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 f=Object.create(null);if(typeof i!="string"||!i)return f;let l=c?.decodeURIComponent??e,u=i.split(o),d=c?.maxKeys??1e3;for(let h of d>0?u.slice(0,d):u){if(!h)continue;let g=h.indexOf(a),m=l((g>=0?h.slice(0,g):h).replace(/\+/g," ")),w=g>=0?l(h.slice(g+a.length).replace(/\+/g," ")):"",E=f[m];E===void 0?f[m]=w:Array.isArray(E)?E.push(w):f[m]=[E,w]}return f},s=(i,o="&",a="=",c)=>{let f=c?.encodeURIComponent??t;return!i||typeof i!="object"?"":Object.keys(i).map(l=>{let u=i[l],d=f(r(l))+a;return Array.isArray(u)?u.map(h=>d+f(r(h))).join(o):d+f(r(u))}).filter(Boolean).join(o)};return{parse:n,decode:n,stringify:s,encode:s,escape:t,unescape:e}}function mi(t){function e(s,i=!1,o=!1){let a=s.trim(),c={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:""},f=a.indexOf("#");f>=0&&(c.hash=a.slice(f),a=a.slice(0,f));let l=a.indexOf("?");l>=0?(c.search=a.slice(l),c.query=a.slice(l+1),a=a.slice(0,l)):i&&(c.search="",c.query={});let u=/^([a-z][a-z0-9.+-]*:)/i.exec(a);if(u&&(c.protocol=u[1].toLowerCase(),a=a.slice(u[1].length)),(u||o)&&a.startsWith("//")){c.slashes=!0,a=a.slice(2);let d=a.search(/[/]/),h=d>=0?a.slice(0,d):a;a=d>=0?a.slice(d):"";let g=h.lastIndexOf("@");g>=0&&(c.auth=decodeURIComponent(h.slice(0,g)),h=h.slice(g+1)),c.host=h.toLowerCase();let m=/:(\d*)$/.exec(c.host);m?(c.port=m[1]||null,c.hostname=c.host.slice(0,-m[0].length)):c.hostname=c.host,c.hostname.startsWith("[")&&c.hostname.endsWith("]")&&(c.hostname=c.hostname.slice(1,-1)),!a&&c.protocol&&/^(https?|ftp|wss?|file):$/.test(c.protocol)&&(a="/")}return c.pathname=a||(c.slashes?"/":null),i&&typeof c.query=="string"&&(c.query=t.parse(c.query)),c.path=(c.pathname??"")+(c.search??"")||null,c.href=r(c),c}function r(s){if(typeof s=="string")return r(e(s));if(s instanceof URL)return s.href;let i=s.protocol?s.protocol.endsWith(":")?s.protocol:s.protocol+":":"",o="";s.host?o=(s.auth?encodeURIComponent(s.auth).replace(/%3A/i,":")+"@":"")+s.host:s.hostname&&(o=(s.auth?s.auth+"@":"")+(s.hostname.includes(":")?`[${s.hostname}]`:s.hostname)+(s.port?":"+s.port:""));let a=s.search??"";if(!a&&s.query&&typeof s.query=="object"){let u=t.stringify(s.query);u&&(a="?"+u)}else a&&!a.startsWith("?")&&(a="?"+a);let c=s.slashes||o&&/^(https?|ftp|wss?|file):$/.test(i)?"//":"",f=s.pathname??"";o&&f&&!f.startsWith("/")&&(f="/"+f);let l=s.hash?s.hash.startsWith("#")?s.hash:"#"+s.hash:"";return`${i}${c}${o}${f}${a}${l}`}function n(s,i){let o=new URL(s,"resolve://"),a=new URL(i,o);if(a.protocol==="resolve:"){let{pathname:c,search:f,hash:l}=a;return c+f+l}return a.href}return{URL,URLSearchParams,parse:e,format:r,resolve:n,resolveObject:(s,i)=>e(n(s,i)),fileURLToPath:s=>{let i=typeof s=="string"?new URL(s):s;if(i.protocol!=="file:")throw Object.assign(new TypeError("The URL must be of scheme file"),{code:"ERR_INVALID_URL_SCHEME"});return decodeURIComponent(i.pathname)},pathToFileURL:s=>new URL("file://"+encodeURI(s).replace(/[?#]/g,encodeURIComponent)),domainToASCII:s=>s,domainToUnicode:s=>s,urlToHttpOptions:s=>({protocol:s.protocol,hostname:s.hostname,hash:s.hash,search:s.search,pathname:s.pathname,path:s.pathname+s.search,href:s.href,port:s.port?Number(s.port):void 0}),Url:function(){}}}var or=class extends Error{constructor(r){let n=r.message===void 0;super(n?`${K(r.actual)} ${r.operator??"=="} ${K(r.expected)}`:String(r.message));p(this,"code","ERR_ASSERTION");p(this,"actual");p(this,"expected");p(this,"operator");p(this,"generatedMessage");this.name="AssertionError",this.actual=r.actual,this.expected=r.expected,this.operator=r.operator??"==",this.generatedMessage=n}};function Cn(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=>Cn(t[s],e[s]))}function H(t,e,r,n){throw t instanceof Error?t:new or({message:t,actual:e,expected:r,operator:n})}function wi(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])):Ee(t?.[r],n)):!1}function ar(t=!1){let e=(a,c)=>{a||H(c??"The expression evaluated to a falsy value",a,!0,"==")},r=t?(a,c,f)=>!Object.is(a,c)&&H(f,a,c,"strictEqual"):(a,c,f)=>a!=c&&!(Number.isNaN(a)&&Number.isNaN(c))&&H(f,a,c,"=="),n=t?(a,c,f)=>!Ee(a,c)&&H(f,a,c,"deepStrictEqual"):(a,c,f)=>!Cn(a,c)&&H(f,a,c,"deepEqual"),s=(a,c,f)=>{typeof c=="string"&&([f,c]=[c,void 0]);try{a()}catch(l){if(!wi(l,c))throw l;return}H(f??"Missing expected exception.",void 0,c,"throws")},i=async(a,c,f)=>{typeof c=="string"&&([f,c]=[c,void 0]);try{await(typeof a=="function"?a():a)}catch(l){if(!wi(l,c))throw l;return}H(f??"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,f)=>Object.is(a,c)&&H(f,a,c,"notStrictEqual"):(a,c,f)=>a==c&&H(f,a,c,"!="),strictEqual:(a,c,f)=>!Object.is(a,c)&&H(f,a,c,"strictEqual"),notStrictEqual:(a,c,f)=>Object.is(a,c)&&H(f,a,c,"notStrictEqual"),deepEqual:n,notDeepEqual:(a,c,f)=>(t?Ee(a,c):Cn(a,c))&&H(f,a,c,"notDeepEqual"),deepStrictEqual:(a,c,f)=>!Ee(a,c)&&H(f,a,c,"deepStrictEqual"),notDeepStrictEqual:(a,c,f)=>Ee(a,c)&&H(f,a,c,"notDeepStrictEqual"),throws:s,doesNotThrow:(a,c)=>{try{a()}catch(f){H(c??`Got unwanted exception: ${f?.message??f}`,f,void 0,"doesNotThrow")}},rejects:i,doesNotReject:async(a,c)=>{try{await(typeof a=="function"?a():a)}catch(f){H(c??"Got unwanted rejection.",f,void 0,"doesNotReject")}},match:(a,c,f)=>!c.test(a)&&H(f??`The input did not match the regular expression ${c}. Input: ${K(a)}`,a,c,"match"),doesNotMatch:(a,c,f)=>c.test(a)&&H(f,a,c,"doesNotMatch"),ifError:a=>{if(a!=null)throw a},fail:a=>H(a??"Failed",void 0,void 0,"fail"),AssertionError:or}),o.strict=t?o:ar(!0),o}var vn=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),Ac={gzip:(t,e)=>cs(t,{level:ct(e)}),gunzip:t=>bt(t),deflate:(t,e)=>fs(t,{level:ct(e)}),inflate:t=>Gr(t),deflateRaw:(t,e)=>os(t,{level:ct(e)}),inflateRaw:t=>Wr(t),unzip:t=>ds(t)},yi={Gzip:t=>new as({level:ct(t)}),Gunzip:()=>new qr,Deflate:t=>new ls({level:ct(t)}),Inflate:()=>new zr,DeflateRaw:t=>new Ne({level:ct(t)}),InflateRaw:()=>new ge,Unzip:()=>new us};function cr(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 lr=class extends Le{constructor(r,n){super();p(this,"engine");p(this,"bytesWritten",0);this.engine=yi[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(cr(i))}}_flush(r){try{this.engine.push(new Uint8Array(0),!0),r()}catch(n){r(cr(n))}}flush(r,n){n?.()}params(r,n,s){s?.()}close(r){this.destroy(),r?.()}},at=()=>{throw Object.assign(new Error("Brotli is not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Ei(){let t={constants:{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,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:at,brotliDecompressSync:at,brotliCompress:at,brotliDecompress:at,createBrotliCompress:at,createBrotliDecompress:at,crc32:(e,r=0)=>{let n=~r>>>0;for(let s of vn(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(Ac))t[`${e}Sync`]=(n,s)=>{try{return D.from(r(vn(n),s))}catch(i){throw cr(i)}},t[e]=(n,s,i)=>{let o=typeof s=="function"?s:i;queueMicrotask(()=>{try{o(null,D.from(r(vn(n),typeof s=="object"?s:void 0)))}catch(a){o(cr(a))}})};for(let e of Object.keys(yi))t[`create${e}`]=r=>new lr(e,r),t[e]=class extends lr{constructor(r){super(e,r)}};return t}var pe=class extends T{constructor(r=0){super();p(this,"remoteAddress","127.0.0.1");p(this,"remotePort",5e4+Math.floor(Math.random()*1e4));p(this,"remoteFamily","IPv4");p(this,"localAddress","127.0.0.1");p(this,"localPort");p(this,"encrypted",!1);p(this,"readable",!0);p(this,"writable",!0);p(this,"destroyed",!1);p(this,"bytesRead",0);p(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 gc(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 xe=class extends Z{constructor(r=new pe){super();p(this,"httpVersion","1.1");p(this,"httpVersionMajor",1);p(this,"httpVersionMinor",1);p(this,"method");p(this,"url");p(this,"statusCode");p(this,"statusMessage");p(this,"headers",{});p(this,"rawHeaders",[]);p(this,"trailers",{});p(this,"rawTrailers",[]);p(this,"complete",!1);p(this,"aborted",!1);p(this,"socket");p(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}=gc(r);this.headers=n,this.rawHeaders=s}_complete(){this.push(null),this.complete=!0}},De=class extends X{constructor(){super(...arguments);p(this,"_headers",new Map);p(this,"headersSent",!1);p(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 mc=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]),wc=new Set(["host","connection","content-length","keep-alive","transfer-encoding","upgrade","expect","te","trailer","proxy-connection"]);function yc(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 bi(t){return mc.has(t.toLowerCase())}function Ci(t){let e={};return t.forEach((r,n)=>e[n]=r),e}async function vi(t,e,r,n){if(bi(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[l,u]of Object.entries(a.headers))for(let d of Array.isArray(u)?u:[u])c.append(l,String(d));let f=a.status===204||a.status===304||r.method==="HEAD";return f&&a.body.cancel().catch(()=>{}),new Response(f?null:a.body,{status:a.status,statusText:a.statusText,headers:c})}let s={};for(let[o,a]of Object.entries(r.headers))wc.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 kt=class extends De{constructor(r,n,s,i,o){super({decodeStrings:!0,autoDestroy:!1});p(this,"deps");p(this,"method");p(this,"path");p(this,"host");p(this,"protocol");p(this,"aborted",!1);p(this,"reusedSocket",!1);p(this,"socket",new pe);p(this,"connection",this.socket);p(this,"chunks",[]);p(this,"controller",new AbortController);p(this,"options");this.deps=r,typeof s=="function"&&([i,s]=[s,void 0]),this.options=yc(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[l,u]of Object.entries(this.getHeaders()))o[l]=Array.isArray(u)?u.join(", "):String(u);let a=this.chunks.length?D.concat(this.chunks):null,c=await vi(this.deps.system,i,{method:this.method,url:this.path,headers:o,body:a},this.controller.signal),f=new xe(this.socket);f.statusCode=c.status,f.statusMessage=c.statusText,f._setHeaders(Ci(c.headers)),this.deps.loop._run(()=>{this.emit("response",f)||f.resume()}),await this.streamBody(c,f)}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(!bi(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 vi(t.system,i,{method:s.method,url:i.pathname+i.search,headers:Ci(s.headers),body:o});return Ec(a,()=>t.loop.hold())}finally{n()}}}function Ec(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 fr={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"},Qi=["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 bc=new Set([101,204,304]),We=class extends De{constructor(r,n){super({decodeStrings:!0});p(this,"sink");p(this,"statusCode",200);p(this,"statusMessage","");p(this,"req");p(this,"socket");p(this,"connection");p(this,"chunkedEncoding",!1);p(this,"shouldKeepAlive",!1);p(this,"headWritten",!1);p(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()}writeContinue(){}writeProcessing(){}writeEarlyHints(){}addTrailers(){}assignSocket(){}detachSocket(){}_write(r,n,s){this.sendHead(),!this.hungUp&&this.req.method!=="HEAD"&&!bc.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||fr[this.statusCode]||"",headers:r})}};var ur=class extends Ie{constructor(r,n,s){super({allowHalfOpen:!1});p(this,"channel");p(this,"remoteAddress","127.0.0.1");p(this,"remotePort",5e4+Math.floor(Math.random()*1e4));p(this,"remoteFamily","IPv4");p(this,"localAddress","127.0.0.1");p(this,"localPort");p(this,"encrypted",!1);p(this,"connecting",!1);p(this,"bytesRead",0);p(this,"bytesWritten",0);p(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 xt=class extends T{constructor(r,n,s){super();p(this,"deps");p(this,"listening",!1);p(this,"timeout",0);p(this,"keepAliveTimeout",5e3);p(this,"headersTimeout",6e4);p(this,"requestTimeout",3e5);p(this,"maxHeadersCount",null);p(this,"registration");p(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 queueMicrotask(()=>this.emit("error",o)),this}return this.listening=!0,this.release=this.deps.loop.hold(),queueMicrotask(()=>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),queueMicrotask(()=>this.emit("close")),this):(r&&queueMicrotask(()=>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 xe(n);return o.method=r.method.toUpperCase(),o.url=r.url,o._fill(s,i),o}handle(r){return new Promise(n=>{let s={...r.headers};!Object.keys(s).some(f=>/^(content-length|transfer-encoding)$/i.test(f))&&r.body?.length&&(s["content-length"]=String(r.body.length));let o=this.toIncoming(r,new pe(this.registration?.port??0),s,r.body),a=vt(()=>this.deps.loop._run(()=>c._hangUp())),c=new We(o,{head:f=>n({...f,body:a.stream}),chunk:f=>a.push(f),end:()=>a.end()});this.deps.loop._run(()=>{try{this.emit("request",o,c)}catch(f){throw c.writableEnded||(c.statusCode=500,c.end("Internal Server Error")),f}})})}upgrade(r,n){if(!this.listenerCount("upgrade"))return n.close();let s=new ur(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 dr=class extends T{constructor(r={}){super();p(this,"options");p(this,"maxSockets",1/0);p(this,"maxFreeSockets",256);p(this,"sockets",{});p(this,"requests",{});p(this,"freeSockets",{});this.options=r}destroy(){}};function Bn(t,e){let r=(i,o,a)=>new kt(t,i,o,a,e),n=(i,o,a)=>{let c=r(i,o,a);return c.end(),c},s=new dr;return{createServer:(i,o)=>new xt(t,i,o),request:r,get:n,Server:class extends xt{constructor(i,o){super(t,i,o)}},IncomingMessage:xe,ServerResponse:We,OutgoingMessage:De,ClientRequest:kt,Agent:dr,globalAgent:s,STATUS_CODES:fr,METHODS:Qi,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 Bi=/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/,Si=/^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;function Ii(t){class e extends T{constructor(){super(...arguments);p(this,"reservation");p(this,"release");p(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()=>Qt(502,"Not an HTTP server"))}catch(f){return queueMicrotask(()=>this.emit("error",f)),this}return this.listening=!0,this.release=t.loop.hold(),queueMicrotask(()=>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),queueMicrotask(()=>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:pe,Stream:pe,connect:r,createConnection:r,isIP:n=>Bi.test(n)?4:Si.test(n)?6:0,isIPv4:n=>Bi.test(n),isIPv6:n=>Si.test(n),getDefaultAutoSelectFamily:()=>!0,setDefaultAutoSelectFamily:()=>{}}}var Cc=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,qe=class extends T{constructor(r,n,s,i){super();p(this,"pid");p(this,"exitCode",null);p(this,"signalCode",null);p(this,"killed",!1);p(this,"connected",!1);p(this,"spawnfile");p(this,"spawnargs");p(this,"stdin");p(this,"stdout");p(this,"stderr");p(this,"stdio");p(this,"handle");this.spawnfile=n,this.spawnargs=[n,...s],this.stdout=new Z({read(){}}),this.stderr=new Z({read(){}}),this.stdin=new X({write:(u,d,h)=>{this.handle?.write(typeof u=="string"?u:new TextDecoder().decode(u)),h()},final:u=>{this.handle?.closeStdin(),u()}}),this.stdio=[this.stdin,this.stdout,this.stderr];let o=i.stdio==="inherit"||Array.isArray(i.stdio)&&i.stdio[1]==="inherit",a={};for(let[u,d]of Object.entries(i.env??r.env()))d!==void 0&&(a[u]=String(d));let[c,f]=i.shell?["bfsh",["-c",[n,...s].join(" ")]]:[n,s],l=r.loop.hold();try{this.handle=r.system.spawn(c,f,{cwd:i.cwd??r.cwd(),env:a})}catch(u){l();let d=u.code??"ENOENT",h=Object.assign(new Error(`spawn ${n} ${d}`),{code:d,errno:-2,syscall:`spawn ${n}`,path:n,spawnargs:s});queueMicrotask(()=>{this.emit("error",h),this.emit("close",-2,null)});return}this.pid=this.handle.pid,this.handle.onStdout(u=>o?r.stdout(u):this.stdout.push(u)),this.handle.onStderr(u=>o?r.stderr(u):this.stderr.push(u)),i.signal?.addEventListener("abort",()=>this.kill()),queueMicrotask(()=>this.emit("spawn")),this.handle.exit.then(u=>{this.exitCode=this.killed?null:u,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)}),l()})}kill(r="SIGTERM"){return!this.handle||this.exitCode!==null?!1:(this.killed=!0,this.signalCode=r,this.handle.kill(r),!0)}send(){throw Object.assign(new Error("IPC channels are not supported in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})}disconnect(){}ref(){}unref(){}};function ki(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 Sn=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 xi(t){return{spawn:(r,n,s)=>(Array.isArray(n)||([s,n]=[n,[]]),new qe(t,r,n.map(String),s??{})),exec(r,n,s){return typeof n=="function"&&([s,n]=[n,{}]),ki(new qe(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,{}]),ki(new qe(t,r,n,s??{}),[r,...n].map(Cc).join(" "),i)},fork(r,n,s){return Array.isArray(n)||([s,n]=[n,[]]),new qe(t,"node",[r,...n],s??{})},execSync:Sn("execSync"),execFileSync:Sn("execFileSync"),spawnSync:Sn("spawnSync"),ChildProcess:qe}}var pr=class extends T{constructor(r,n,s={}){super();p(this,"input");p(this,"output");p(this,"line","");p(this,"cursor",0);p(this,"terminal");p(this,"closed",!1);p(this,"buffer","");p(this,"promptText","> ");p(this,"pendingQuestion");p(this,"onData",r=>this.feed(String(r)));p(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)}},hr=(t,e,r)=>(t?.write(e),r?.(),!0);function In(t=!1){let r={createInterface:(n,s)=>{let i="input"in n&&n.input?n:{input:n,output:s},o=new pr(i.input,i.output,i);if(t){let a=o.question.bind(o);o.question=c=>new Promise(f=>a(c,void 0,f))}return o},Interface:pr,clearLine:(n,s,i)=>hr(n,s<0?"\x1B[1K":s>0?"\x1B[0K":"\x1B[2K",i),clearScreenDown:(n,s)=>hr(n,"\x1B[0J",s),cursorTo:(n,s,i,o)=>hr(n,typeof i=="number"?`\x1B[${i+1};${s+1}H`:`\x1B[${s+1}G`,typeof i=="function"?i:o),moveCursor:(n,s,i,o)=>hr(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=In(!0)),r}function Di(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 Oi(t){return{isatty:e=>t&&e>=0&&e<=2,ReadStream:class extends T{},WriteStream:class extends T{}}}function Ni(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 Ri(){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:de(e,t)}}function _i(){class t{constructor(){p(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){p(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:()=>({})}}function Ti(){let t=(r,n={})=>{let s=Object.keys(n).filter(i=>/^[A-Za-z_$][\w$]*$/.test(i));return new Function(...s,`return eval(${JSON.stringify(r)})`)(...s.map(i=>n[i]))};class e{constructor(n){p(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 $i(){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 ee=t=>()=>{throw Object.assign(new Error(`${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Li(){return{perf_hooks:{performance:globalThis.performance,PerformanceObserver:class{observe(){}disconnect(){}},monitorEventLoopDelay:()=>({enable(){},disable(){},percentile:()=>0,mean:0,max:0,min:0}),constants:{}},worker_threads:{isMainThread:!0,parentPort:null,workerData:null,threadId:0,resourceLimits:{},Worker:ee("worker_threads.Worker"),MessageChannel,MessagePort:globalThis.MessagePort,BroadcastChannel:globalThis.BroadcastChannel,markAsUntransferable:()=>{},SHARE_ENV:Symbol("SHARE_ENV")},dns:{lookup:(t,e,r)=>queueMicrotask(()=>(typeof e=="function"?e:r)(null,t==="localhost"?"127.0.0.1":t,4)),resolve:ee("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:ee("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:ee("tls.connect"),createServer:ee("tls.createServer"),createSecureContext:()=>({}),DEFAULT_MIN_VERSION:"TLSv1.2",DEFAULT_MAX_VERSION:"TLSv1.3",rootCertificates:[]},dgram:{createSocket:ee("dgram.createSocket")},http2:{connect:ee("http2.connect"),createServer:ee("http2.createServer"),createSecureServer:ee("http2.createSecureServer"),constants:{}},trace_events:{createTracing:()=>({enable(){},disable(){}}),getEnabledCategories:()=>""},sqlite:{DatabaseSync:ee("sqlite.DatabaseSync")},test:{test:ee("node:test"),describe:ee("node:test"),it:ee("node:test")},wasi:{WASI:ee("wasi.WASI")},repl:{start:ee("repl.start")},domain:{create:()=>Object.assign(new T,{run:t=>t(),add(){},remove(){},bind:t=>t,intercept:t=>t,enter(){},exit(){},dispose(){}})}}}function Mi(t){let{process:e,loop:r,system:n}=t,s=()=>e.env,i=Li(),o={system:n,loop:r},a={assert:()=>ar(!1),"assert/strict":()=>ar(!0),async_hooks:()=>_i(),buffer:()=>Xs(),child_process:()=>xi({system:n,loop:r,cwd:()=>e.cwd(),env:s,stdout:l=>e.stdout.write(l),stderr:l=>e.stderr.write(l)}),console:()=>Object.assign(Object.create(t.console),{Console:function(){return t.console}}),constants:l=>({...be,...l("os").constants.signals}),crypto:()=>Ai(),diagnostics_channel:()=>$i(),"dns/promises":l=>l("dns").promises,events:()=>ri(),fs:()=>hi({vfs:t.fs,cwd:()=>e.cwd(),stdout:t.io.stdout,stderr:t.io.stderr,hold:()=>r.hold()}),"fs/promises":l=>l("fs").promises,http:()=>Bn(o,"http:"),https:()=>Bn(o,"https:"),net:()=>Ii(o),os:()=>Di(s),path:()=>si(()=>e.cwd()),"path/posix":l=>l("path"),"path/win32":l=>l("path"),process:()=>e,querystring:()=>gi(),readline:()=>In(),"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 u="";for await(let d of l)u+=typeof d=="string"?d:new TextDecoder().decode(d);return u},json:async l=>{let u="";for await(let d of l)u+=typeof d=="string"?d:new TextDecoder().decode(d);return JSON.parse(u)}}),string_decoder:()=>Ri(),sys:l=>l("util"),timers:()=>Ni(r),"timers/promises":l=>l("timers").promises,tty:()=>Oi(!!t.io.terminal),url:l=>mi(l("querystring")),util:()=>li(s,l=>e.stderr.write(l+`
28
- `)),"util/types":()=>st,vm:()=>Ti(),zlib:()=>Ei()};for(let[l,u]of Object.entries(i))a[l]??(a[l]=()=>u);let c=new Map,f=l=>{if(c.has(l))return c.get(l);let u=a[l];if(!u)throw Object.assign(new Error(`No such built-in module: ${l}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});let d=u(f);return c.set(l,d),d};return{names:[...Object.keys(a),"module"].sort(),isBuiltin:l=>l==="module"||l in a,get:f,fetch:Qn(o)}}var Pi=Yr,kn=Symbol.for("bfwc.esm"),vc=/^[\p{L}_$][\p{L}\p{N}_$]*$/u;function ji(t){return/(?:^|[\s;})])(?:import\s*[\w{*'"]|export\s+|export\s*[{*])/.test(t)}function Ki(t){try{let[e,r]=Kt(t);return r.length>0||e.some(n=>n.t===1||n.t===3)}catch{return!1}}function Fi(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 Qc=(t,e)=>vc.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;function Bc(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 Ui=t=>!!t&&/[\p{L}\p{N}_$]/u.test(t);function Sc(t,e){for(let r=t.lastIndexOf("export",e-1);r>=0;r=t.lastIndexOf("export",r-1))if(!Ui(t[r-1])&&!Ui(t[r+6]))return r;return-1}function xn(t){let[e,r]=Kt(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),g=`__bfwc_m${a++}`,m=`const ${g} = ${c(d.n)};`;if(h.startsWith("export")){o.add(d.ss);let b=/^export\s*\*\s*as\s+("[^"]*"|'[^']*'|[^\s]+)/.exec(h);if(b)s.set(b[1].replace(/^["']|["']$/g,""),g);else if(/^export\s*\*/.test(h))n.push({start:d.ss,end:d.se,text:`${m} __bfwc_star(exports, ${g});`});else for(let[y,B]of Fi(/\{([^}]*)\}/.exec(h)?.[1]??""))s.set(B,Qc(g,y));n.some(y=>y.start===d.ss)||n.push({start:d.ss,end:d.se,text:m});continue}let w=/^import\s*([\s\S]*?)\s*from\s*["']/.exec(h)?.[1];if(w===void 0){n.push({start:d.ss,end:d.se,text:`${c(d.n)};`});continue}let E=[m],v=/\{([\s\S]*)\}/.exec(w),A=w.replace(/\{[\s\S]*\}/,"").split(",").map(b=>b.trim()).filter(Boolean);for(let b of A){let y=/^\*\s*as\s+(\S+)$/.exec(b);y?E.push(`const ${y[1]} = ${g};`):E.push(`const ${b} = __bfwc_get(${g}, "default");`)}if(v)for(let[b,y]of Fi(v[1]))E.push(`const ${y} = __bfwc_get(${g}, ${JSON.stringify(b)});`);n.push({start:d.ss,end:d.se,text:E.join(" ")})}let f=new Map;for(let d of r){let h=Sc(t,d.s);if(h<0||o.has(h))continue;let g=t.slice(h+6,d.s);if(/^\s*\{/.test(g)){if(!f.has(h)){let w=t.indexOf("}",h)+1,E=/^\s*;/.exec(t.slice(w));E&&(w+=E[0].length),f.set(h,w),n.push({start:h,end:w,text:""})}s.set(d.n,d.ln??d.n);continue}if(d.n==="default"&&t.startsWith("default",d.s)&&!g.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(g)))for(let w of Bc(t,d.e))s.set(w,w);s.set(d.n,d.ln??d.n)}n.sort((d,h)=>h.start-d.start);let l=t;for(let d of n)l=l.slice(0,d.start)+d.text+l.slice(d.end);return`"use strict";__bfwc_esm(exports, { ${[...s].map(([d,h])=>`${JSON.stringify(d)}: () => ${h}`).join(", ")} });${l}`}var gr=["node","require","default"],Dn=["node","import","default"],Wi=[".js",".json",".cjs",".mjs",".node"];function Dt(t,e){let r=new Error(`Cannot find module '${t}'${e?`
23
+ `):""}`,E=Object.keys(o).filter(y=>y!=="stack"&&y!=="message");if(!E.length||a>r)return w;s.push(u);let b=ct(`${w} {`,E.map(y=>`${ar(y)}: ${i(u[y],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 w=o;if(w.constructor.name==="Buffer"){let E=Array.from(w).slice(0,50).map(b=>b.toString(16).padStart(2,"0"));return`<Buffer${E.length?" "+E.join(" "):""}${w.length>50?` ... ${w.length-50} more bytes`:""}>`}return`${w.constructor.name}(${w.length}) [ ${Array.from(w).slice(0,100).join(", ")} ]`}if(a>r)return Array.isArray(o)?"[Array]":`[${_t(u)??"Object"}]`;s.push(u);let d=w=>i(w,a+1,c+" ",!0),h;if(Array.isArray(o)){let w=o.slice(0,100).map(d);o.length>100&&w.push(`... ${o.length-100} more items`);for(let b of Object.keys(o))/^\d+$/.test(b)||w.push(`${ar(b)}: ${d(u[b])}`);let E=_t(u)&&_t(u)!=="Array"?`${_t(u)}(${o.length}) `:"";h=ct(`${E}[`,w,"]",n,c)}else if(o instanceof Map)h=ct(`Map(${o.size}) {`,[...o].map(([w,E])=>`${d(w)} => ${d(E)}`),"}",n,c);else if(o instanceof Set)h=ct(`Set(${o.size}) {`,[...o].map(d),"}",n,c);else{let w=[...Object.keys(u),...Object.getOwnPropertySymbols(u).filter(p=>Object.getOwnPropertyDescriptor(u,p)?.enumerable)];e.sorted&&w.sort();let E=w.map(p=>{let A=Object.getOwnPropertyDescriptor(u,p),m=A&&(A.get||A.set)?A.get&&A.set?"[Getter/Setter]":A.get?"[Getter]":"[Setter]":d(u[p]);return`${ar(p)}: ${m}`}),b=_t(u),y=u[Symbol.toStringTag],C=b?`${b}${y&&y!==b?` [${y}]`:""} `:y?`Object [${y}] `:"";h=E.length||!C?ct(`${C}{`,E,"}",n,c):`${C}{}`}return s.pop(),h};return i(t,0,"",!1)}G.custom=wi;G.defaultOptions={depth:2};function xe(...t){let[e,...r]=t;if(typeof e!="string")return t.map(i=>G(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?G(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 G(a,{depth:o==="o"?4:2})}});for(;n<r.length;n++){let i=r[n];s+=" "+(typeof i=="string"?i:G(i))}return s}var Ei=Symbol.for("nodejs.util.promisify.custom");function bi(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type function');let e=t[Ei];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))}bi.custom=Ei;function Lc(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 Se(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)||!Se(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=>Se(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)&&Se(t[i],e[i],r))}var Ge=t=>Object.prototype.toString.call(t).slice(8,-1),lt={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||Ge(t)==="SharedArrayBuffer",isArrayBufferView:t=>ArrayBuffer.isView(t),isDataView:t=>t instanceof DataView,isAsyncFunction:t=>Ge(t)==="AsyncFunction"||Ge(t)==="AsyncGeneratorFunction",isGeneratorFunction:t=>Ge(t)==="GeneratorFunction"||Ge(t)==="AsyncGeneratorFunction",isGeneratorObject:t=>Ge(t)==="Generator",isBoxedPrimitive:t=>t instanceof Number||t instanceof String||t instanceof Boolean,isProxy:()=>!1,isExternal:()=>!1,isModuleNamespaceObject:t=>Ge(t)==="Module"};function Ci(t,e){let r=new Set;return{format:xe,formatWithOptions:(n,...s)=>xe(...s),inspect:G,inherits:Lc,promisify:bi,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()}: ${xe(...o)}`);return i.enabled=s,i},isDeepStrictEqual:(n,s)=>Se(n,s),types:lt,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:lt.isRegExp,isObject:n=>n!==null&&typeof n=="object",isDate:lt.isDate,isError:lt.isNativeError,isFunction:n=>typeof n=="function",isPrimitive:n=>n===null||typeof n!="object"&&typeof n!="function",isBuffer:n=>n?.constructor?.name==="Buffer"}}function ft(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 ne=class extends L{constructor(e){super(),ft(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 ge(()=>{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?ge(()=>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=>{ge(()=>{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?ge(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=>ge(()=>r(n))):ge(()=>r())}};var Rt=class extends L{pipe(e){return this.on("data",r=>e.write(r)),this.on("end",()=>e.end()),e}};Object.setPrototypeOf(V.prototype,Rt.prototype);Object.setPrototypeOf(ne.prototype,Rt.prototype);function vn(t,e={}){at(t,e),ft(t,e),t.allowHalfOpen=e.allowHalfOpen!==!1,t.allowHalfOpen||t.once("end",()=>t.end())}var De=class extends V{constructor(e){super(e),vn(this,e)}destroy(e){let r=this._writableState;return r&&(r.destroyed=!0),super.destroy(e)}};for(let t of Object.getOwnPropertyNames(ne.prototype))t==="constructor"||t==="destroy"||t==="destroyed"||t==="_destroy"||t in De.prototype&&Object.getOwnPropertyDescriptor(De.prototype,t)||Object.defineProperty(De.prototype,t,Object.getOwnPropertyDescriptor(ne.prototype,t));function En(t,e={}){vn(t,e),typeof e.transform=="function"&&(t._transform=e.transform),typeof e.flush=="function"&&(t._flush=e.flush)}var Pe=class extends De{constructor(e){super(e),En(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()}},bn=class extends Pe{_transform(e,r,n){n(null,e)}};function Cn(t,e,r){let n=typeof e=="function"?e:r,s=!1,i=f=>{s||(s=!0,u(),n(f??null))},o=f=>i(f),a=()=>i(),c=()=>{let f=t._readableState,d=t._writableState;f&&!f.endEmitted||d&&!d.finished?i(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"})):i()},l=!!t._writableState&&!t._readableState;t.on("error",o),t.on(l?"finish":"end",a),t._readableState&&t._writableState&&t.on("finish",()=>t._readableState.endEmitted&&i()),t.on("close",c);let u=()=>{t.removeListener("error",o),t.removeListener("end",a),t.removeListener("finish",a),t.removeListener("close",c)};return(t._readableState?.endEmitted&&!t._writableState||l&&t._writableState.finished)&&ge(()=>i()),u}function vi(...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 Cn(i,o=>{o?s(o):n||e?.(null)}),i}function Si(){let t=oe(Rt,()=>{}),e={Readable:oe(V,(n,s)=>at(n,s)),Writable:oe(ne,(n,s)=>ft(n,s)),Duplex:oe(De,(n,s)=>vn(n,s)),Transform:oe(Pe,(n,s)=>En(n,s)),PassThrough:oe(bn,(n,s)=>En(n,s))};return Object.assign(t,e,{Stream:t,pipeline:vi,finished:Cn,promises:{pipeline:(...n)=>new Promise((s,i)=>vi(...n,o=>o?i(o):s())),finished:n=>new Promise((s,i)=>Cn(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 $c={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]=$c[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 Mc(t){let e=5381;for(let r=0;r<t.length;r++)e=(e*33^t.charCodeAt(r))>>>0;return e}var Sn=32768,Qn=16384,Oe=class{constructor(e,r,n,s){g(this,"dev",2049);g(this,"ino");g(this,"mode");g(this,"nlink",1);g(this,"uid",1e3);g(this,"gid",1e3);g(this,"rdev",0);g(this,"size");g(this,"blksize",4096);g(this,"blocks");g(this,"atimeMs");g(this,"mtimeMs");g(this,"ctimeMs");g(this,"birthtimeMs");g(this,"atime");g(this,"mtime");g(this,"ctime");g(this,"birthtime");this.ino=Mc(e),this.mode=r==="file"?Sn|420:Qn|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)===Sn}isDirectory(){return(this.mode&61440)===Qn}isSymbolicLink(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}isSocket(){return!1}},ut=class{constructor(e,r,n){g(this,"name");g(this,"parentPath");g(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}},Qe={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:Sn,S_IFDIR:Qn,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 cr=t=>typeof t=="string"?t:t?.encoding;function Qi(t){let{vfs:e}=t,r=new Map,n=20,s=p=>{if(p instanceof URL){if(p.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return O(decodeURIComponent(p.pathname))}let A=typeof p=="string"?p:new TextDecoder().decode(p);if(typeof A!="string")throw new TypeError('The "path" argument must be of type string, Buffer or URL');return A.startsWith("file://")?O(decodeURIComponent(new URL(A).pathname)):A.startsWith("/")?O(A):k(t.cwd(),A)},i=p=>{let A=e.readFile(p);return typeof A=="string"?re(A):A},o=(p,A)=>{let m=M(p);if(e.isFile(m))throw R("ENOTDIR",A,p);if(!e.isDirectory(m))throw R("ENOENT",A,p)},a=(p,A)=>typeof p=="string"?!A||/^utf-?8$/i.test(A)?p:re(p,A).slice():new Uint8Array(p.buffer,p.byteOffset,p.byteLength).slice(),c=(p,A)=>{let m=s(p);if(e.isFile(m))return new Oe(m,"file",i(m).length,e.mtime(m)??Date.now());if(e.isDirectory(m))return new Oe(m,"directory",4096,0);if(A?.throwIfNoEntry!==!1)throw R("ENOENT","stat",m)},l=(p,A,m)=>{if(typeof p=="number")return u(p,A);let Q=s(p),B=typeof m=="object"&&m?m.flag??"w":"w";if(e.isDirectory(Q))throw R("EISDIR","open",Q);if(o(Q,"open"),B.includes("x")&&e.isFile(Q))throw R("EEXIST","open",Q);if(B.startsWith("a")&&e.isFile(Q)){let v=e.readFile(Q),S=a(A,cr(m));e.writeFile(Q,typeof v=="string"&&typeof S=="string"?v+S:D.concat([typeof v=="string"?re(v):v,typeof S=="string"?re(S):S]));return}e.writeFile(Q,a(A,cr(m)))},u=(p,A,m,Q,B)=>{let v=typeof A=="string"?re(A,typeof m=="string"?m:void 0):new Uint8Array(A.buffer,A.byteOffset+(typeof m=="number"?m:0),Q??A.byteLength-(typeof m=="number"?m:0));if(p===1||p===2)return(p===1?t.stdout:t.stderr)(v.slice()),v.length;let S=r.get(p);if(!S||S.flags==="r")throw R("EBADF","write");let I=e.isFile(S.path)?i(S.path):new Uint8Array,x=S.flags.startsWith("a")?I.length:B??S.position,_=new Uint8Array(Math.max(I.length,x+v.length));return _.set(I),_.set(v,x),e.writeFile(S.path,_),B==null&&(S.position=x+v.length),v.length},f=(p,A,m="")=>{let Q=[];for(let B of e.readdir(p)){let v=k(p,B),S=e.isDirectory(v)?"directory":"file";Q.push({name:m+B,parent:p,kind:S}),A&&S==="directory"&&Q.push(...f(v,!0,`${m}${B}/`))}return Q},d=(p,A)=>{let m=s(p),Q=typeof A=="object"&&!!A?.recursive;if(e.isFile(m))throw R("EEXIST","mkdir",m);if(e.isDirectory(m)){if(Q)return;throw R("EEXIST","mkdir",m)}Q||o(m,"mkdir");let B;for(let v=m;!e.isDirectory(v);v=M(v)){if(e.isFile(v))throw R("ENOTDIR","mkdir",m);B=v}return e.mkdir(m),Q?B:void 0},h=(p,A)=>{let m=s(p);if(!e.exists(m)){if(A?.force)return;throw R("ENOENT","rm",m)}if(e.isDirectory(m)&&!A?.recursive)throw Object.assign(R("EISDIR","rm",m),{code:"ERR_FS_EISDIR"});e.rm(m)},w=(p,A,m=0)=>{let Q=s(p),B=s(A);if(!e.isFile(Q))throw R(e.isDirectory(Q)?"EISDIR":"ENOENT","copyfile",Q,B);if(m&Qe.COPYFILE_EXCL&&e.exists(B))throw R("EEXIST","copyfile",Q,B);o(B,"copyfile");let v=e.readFile(Q);e.writeFile(B,typeof v=="string"?v:v.slice())},E=(p,A)=>{if(e.isFile(p)){let m=e.readFile(p);e.writeFile(A,typeof m=="string"?m:m.slice());return}e.mkdir(A);for(let m of e.readdir(p))E(k(p,m),k(A,m))},b=(p,A="r")=>{let m=s(p),Q=typeof A=="number"?A&Qe.O_APPEND?"a":A&(Qe.O_WRONLY|Qe.O_RDWR)?"w":"r":A;if(e.isDirectory(m)&&Q!=="r")throw R("EISDIR","open",m);if(Q.startsWith("r")){if(!e.exists(m))throw R("ENOENT","open",m)}else{if(Q.includes("x")&&e.exists(m))throw R("EEXIST","open",m);o(m,"open"),(Q.startsWith("w")||!e.isFile(m))&&e.writeFile(m,"")}let B=n++;return r.set(B,{path:m,flags:Q,position:0}),B},y=(p,A)=>{let m=r.get(p);if(!m)throw R("EBADF",A);return m},C={existsSync:p=>{try{return e.exists(s(p))}catch{return!1}},accessSync(p){let A=s(p);if(!e.exists(A))throw R("ENOENT","access",A)},statSync:c,lstatSync:c,fstatSync:p=>c(y(p,"fstat").path),readFileSync(p,A){if(p===0)return D.alloc(0);let m=typeof p=="number"?y(p,"read").path:s(p);if(e.isDirectory(m))throw R("EISDIR","read",m);let Q=e.readFile(m);if(Q===void 0)throw R("ENOENT","open",m);let B=cr(A);return B?typeof Q=="string"&&/^utf-?8$/i.test(B)?Q:D.from(typeof Q=="string"?re(Q):Q).toString(B):D.from(typeof Q=="string"?re(Q):Q)},writeFileSync:l,appendFileSync:(p,A,m)=>l(p,A,{...typeof m=="string"?{encoding:m}:m??{},flag:"a"}),mkdirSync:d,mkdtempSync(p){let A=`${p}${Math.random().toString(36).slice(2,8)}`;return d(A),s(A)},readdirSync(p,A){let m=s(p);if(e.isFile(m))throw R("ENOTDIR","scandir",m);if(!e.isDirectory(m))throw R("ENOENT","scandir",m);let Q=typeof A=="object"?A:void 0,B=f(m,!!Q?.recursive);return Q?.withFileTypes?B.map(v=>new ut(v.name.slice(v.name.lastIndexOf("/")+1),v.name.includes("/")?k(m,v.name,".."):v.parent,v.kind)):B.map(v=>cr(A)==="buffer"?D.from(v.name):v.name)},rmSync:h,rmdirSync(p,A){let m=s(p);if(e.isFile(m))throw R("ENOTDIR","rmdir",m);if(!e.isDirectory(m))throw R("ENOENT","rmdir",m);if(e.readdir(m).length&&!A?.recursive)throw R("ENOTEMPTY","rmdir",m);e.rm(m)},unlinkSync(p){let A=s(p);if(e.isDirectory(A))throw R("EISDIR","unlink",A);if(!e.isFile(A))throw R("ENOENT","unlink",A);e.rm(A)},renameSync(p,A){let m=s(p),Q=s(A);if(!e.exists(m))throw R("ENOENT","rename",m,Q);if(m!==Q){if(e.isDirectory(Q)&&e.isFile(m))throw R("EISDIR","rename",m,Q);if(o(Q,"rename"),e.isFile(Q)&&e.isDirectory(m))throw R("ENOTDIR","rename",m,Q);e.rm(Q),E(m,Q),e.rm(m)}},copyFileSync:w,cpSync(p,A,m){let Q=s(p);if(e.isDirectory(Q)&&!m?.recursive)throw Object.assign(R("EISDIR","cp",Q),{code:"ERR_FS_EISDIR"});if(!e.exists(Q))throw R("ENOENT","cp",Q);E(Q,s(A))},realpathSync:Object.assign(p=>{let A=s(p);if(!e.exists(A))throw R("ENOENT","realpath",A);return A},{native:p=>C.realpathSync(p)}),readlinkSync:p=>{throw R("EINVAL","readlink",s(p))},symlinkSync(p,A){let m=s(A),Q=typeof p=="string"&&!p.startsWith("/")?k(M(m),p):s(p);E(Q,m)},linkSync:(p,A)=>w(p,A),truncateSync(p,A=0){let m=s(p);if(!e.isFile(m))throw R("ENOENT","open",m);let Q=i(m),B=new Uint8Array(A);B.set(Q.subarray(0,A)),e.writeFile(m,B)},chmodSync:p=>void C.accessSync(p),lchmodSync:p=>void C.accessSync(p),chownSync:p=>void C.accessSync(p),lchownSync:p=>void C.accessSync(p),utimesSync:p=>void C.accessSync(p),lutimesSync:p=>void C.accessSync(p),fchmodSync:p=>void y(p,"fchmod"),fchownSync:p=>void y(p,"fchown"),futimesSync:p=>void y(p,"futimes"),fsyncSync:p=>void y(p,"fsync"),fdatasyncSync:p=>void y(p,"fdatasync"),ftruncateSync:(p,A=0)=>C.truncateSync(y(p,"ftruncate").path,A),openSync:b,closeSync(p){p>2&&y(p,"close"),r.delete(p)},readSync(p,A,m,Q,B){let v=typeof m=="object"?m:{offset:m,length:Q,position:B},S=y(p,"read"),I=i(S.path),x=new Uint8Array(A.buffer,A.byteOffset,A.byteLength),_=v.offset??0,T=v.position??S.position,H=I.subarray(T,T+Math.min(v.length??x.length-_,x.length-_));return x.set(H,_),(v.position===void 0||v.position===null)&&(S.position=T+H.length),H.length},writeSync:u,writevSync(p,A,m){let Q=0;for(let B of A)Q+=u(p,B,0,B.byteLength,m==null?null:m+Q);return Q},readvSync(p,A,m){let Q=0;for(let B of A){let v=C.readSync(p,B,0,B.byteLength,m==null?null:m+Q);if(Q+=v,v<B.byteLength)break}return Q},opendirSync(p){let A=s(p),m=C.readdirSync(A,{withFileTypes:!0}),Q=0;return{path:A,readSync:()=>m[Q++]??null,read:async()=>m[Q++]??null,closeSync:()=>{},close:async()=>{},async*[Symbol.asyncIterator](){for(;Q<m.length;)yield m[Q++]}}},_resolve:s};return C}var Bi=64*1024,lr=t=>typeof t=="string"?{encoding:t}:t??{};function Ii(t,e){class r extends V{constructor(a,c){let l=lr(c);super({highWaterMark:l.highWaterMark??Bi,encoding:l.encoding}),n(this,a,l)}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,N(()=>{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(l){o.destroy(l)}})}class s extends ne{constructor(a,c){super({decodeStrings:!0}),i(this,a,lr(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,l){if(this.fd===null&&this.open!==s.prototype.open){this.once("open",()=>this._write(a,c,l));return}try{this.ensureFile(),t.appendFileSync(this.path,a),this.bytesWritten+=a.length,l()}catch(u){l(u)}}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),N(()=>{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(l){o.destroy(l)}})}return{ReadStream:oe(r,(o,a,c)=>{let l=lr(c);at(o,{highWaterMark:l.highWaterMark??Bi,encoding:l.encoding}),n(o,a,l)}),WriteStream:oe(s,(o,a,c)=>{ft(o,{decodeStrings:!0}),i(o,a,lr(c))})}}function ki(t){return typeof t[t.length-1]=="function"?t.pop():void 0}function xi(t){let e=Qi(t),r=(w,E=b=>[b])=>(...b)=>{let y=ki(b);N(()=>{let C;try{C=w(...b)}catch(p){y?.(p);return}y?.(null,...E(C,b))})},n=w=>async(...E)=>w(...E),{ReadStream:s,WriteStream:i}=Ii(e,t);class o extends L{constructor(b,y,C){super();g(this,"release");g(this,"unwatch");let p=O(b);C&&this.on("change",C),this.release=t.hold(),this.unwatch=t.vfs.watch(A=>{let m=A.path;if(!(m===p||m.startsWith(p==="/"?"/":p+"/")))return;let B=m===p?m.slice(m.lastIndexOf("/")+1):m.slice(p.length+(p==="/"?0:1));!y&&B.includes("/")||this.emit("change",A.type==="write"&&!A.created?"change":"rename",B)})}close(){this.unwatch(),this.release(),this.emit("close")}ref(){return this}unref(){return this}}let a=(w,E,b)=>{typeof E=="function"&&([b,E]=[E,void 0]);let y=e._resolve(w);if(!t.vfs.exists(y))throw e.statSync(y);return new o(y,typeof E=="object"&&!!E?.recursive,b)},c=new Map,l=(w,E,b)=>{let y=typeof E=="function"?E:b,C=e._resolve(w),p=c.get(C);if(!p){let A=new o(C,!1),m={watcher:A,listeners:[]},Q=e.statSync(C,{throwIfNoEntry:!1})??new Oe(C,"file",0,0);A.on("change",()=>{let B=e.statSync(C,{throwIfNoEntry:!1})??new Oe(C,"file",0,0);for(let v of m.listeners)v(B,Q);Q=B}),c.set(C,p=m)}return p.listeners.push(y),p.watcher},u=(w,E)=>{let b=e._resolve(w),y=c.get(b);y&&(y.listeners=E?y.listeners.filter(C=>C!==E):[],y.listeners.length||(y.watcher.close(),c.delete(b)))},f={...e,constants:Qe,Stats:Oe,Dirent:ut,ReadStream:s,WriteStream:i,FSWatcher:o,F_OK:0,R_OK:4,W_OK:2,X_OK:1};delete f._resolve;for(let w of Object.keys(e)){if(!w.endsWith("Sync"))continue;let E=w.slice(0,-4),b=e[w];E==="exists"?f.exists=(y,C)=>N(()=>C(e.existsSync(y))):["read","write","readv","writev"].includes(E)?f[E]=r(b,(y,C)=>[y,C[1]]):f[E]=r(b)}let d=f.read;f.read=(w,...E)=>{if(w!==0||!t.readStdin)return d(w,...E);let b=ki(E),y=E[0]&&!ArrayBuffer.isView(E[0])?E[0]:typeof E[1]=="object"&&E[1]?{buffer:E[0],...E[1]}:{buffer:E[0],offset:E[1],length:E[2]},C=y.buffer,p=Number(y.offset??0),A=Number(y.length??C.byteLength-p);t.readStdin(new Uint8Array(C.buffer,C.byteOffset+p,A)).then(m=>N(()=>b?.(null,m,C)),m=>N(()=>b?.(m,0,C)))},f.realpath.native=f.realpath,f.createReadStream=(w,E)=>new s(w,E),f.createWriteStream=(w,E)=>new i(w,E),f.watch=a,f.watchFile=l,f.unwatchFile=u;let h={constants:Qe};for(let w of Object.keys(e))!w.endsWith("Sync")||w==="existsSync"||(h[w.slice(0,-4)]=n(e[w]));return h.open=async(w,E)=>Fc(e,e.openSync(w,E),e._resolve(w)),h.watch=(w,E)=>Uc(a(w,E),E?.signal),f.promises=h,f}function Fc(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*Uc(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 Di(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 l of c)l()}))};return async a=>{for(o();!r.length&&!n;){let u=e();await new Promise(f=>s.push(f)),u()}let c=r[0];if(!c)return 0;let l=Math.min(c.length,a.length);return a.set(c.subarray(0,l)),l===c.length?r.shift():r[0]=c.subarray(l),l}}var dt=(t,e)=>typeof t=="string"?D.from(t,e):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),kn=(t,e)=>e&&e!=="buffer"?D.from(t).toString(e):D.from(t),ur=class t extends Pe{constructor(r){super();g(this,"algorithm");g(this,"chunks",[]);g(this,"done",!1);this.algorithm=r,Ot(r)}update(r,n){if(this.done)throw Object.assign(new Error("Digest already called"),{code:"ERR_CRYPTO_HASH_FINALIZED"});return this.chunks.push(dt(r,n).slice()),this}digest(r){return this.done=!0,kn(Ot(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 Bn(t,e,r){let{digest:n,blockSize:s}=Ot(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 f=0;f<s;f++)a[f]=i[f]^54,c[f]=i[f]^92;a.set(r,s);let l=n(a),u=new Uint8Array(s+l.length);return u.set(c),u.set(l,s),n(u)}var In=class extends ur{constructor(r,n){super(r);g(this,"hmacAlgorithm");g(this,"hmacKey");g(this,"parts",[]);this.hmacAlgorithm=r,this.hmacKey=dt(n).slice()}update(r,n){return this.parts.push(dt(r,n).slice()),this}digest(r){return kn(Bn(this.hmacAlgorithm,this.hmacKey,D.concat(this.parts)),r)}};function Oi(t,e,r,n,s="sha1"){let i=dt(t),o=dt(e),a=new Uint8Array(n);for(let c=1,l=0;l<n;c++){let u=new Uint8Array(o.length+4);u.set(o),new DataView(u.buffer).setUint32(o.length,c);let f=Bn(s,i,u),d=f.slice();for(let h=1;h<r;h++){f=Bn(s,i,f);for(let w=0;w<d.length;w++)d[w]=d[w]^f[w]}a.set(d.subarray(0,n-l),l),l+=d.length}return D.from(a)}function fr(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 Be=t=>()=>{throw Object.assign(new Error(`crypto.${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function _i(){let t=(e,r)=>{let n=fr(D.alloc(e));return r&&N(()=>r(null,n)),n};return{createHash:e=>new ur(e),createHmac:(e,r)=>new In(e,r),hash:(e,r,n="hex")=>kn(Ot(e).digest(dt(r)),n),getHashes:()=>Object.keys(An),getCiphers:()=>[],getCurves:()=>[],randomBytes:t,pseudoRandomBytes:t,randomFillSync:(e,r=0,n)=>(fr(new Uint8Array(e.buffer,e.byteOffset+r,n??e.byteLength-r)),e),randomFill:(e,...r)=>{let n=r.pop();fr(e),N(()=>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&&N(()=>n(null,s)),s},getRandomValues:e=>fr(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:Oi,pbkdf2(e,r,n,s,i,o){N(()=>{try{o(null,Oi(e,r,n,s,i))}catch(a){o(a)}})},webcrypto:globalThis.crypto,subtle:globalThis.crypto?.subtle,constants:{},createCipheriv:Be("createCipheriv"),createDecipheriv:Be("createDecipheriv"),createSign:Be("createSign"),createVerify:Be("createVerify"),generateKeyPairSync:Be("generateKeyPairSync"),generateKeyPair:Be("generateKeyPair"),createPrivateKey:Be("createPrivateKey"),createPublicKey:Be("createPublicKey"),scryptSync:Be("scryptSync"),scrypt:Be("scrypt")}}function Ri(){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 l=Object.create(null);if(typeof i!="string"||!i)return l;let u=c?.decodeURIComponent??e,f=i.split(o),d=c?.maxKeys??1e3;for(let h of d>0?f.slice(0,d):f){if(!h)continue;let w=h.indexOf(a),E=u((w>=0?h.slice(0,w):h).replace(/\+/g," ")),b=w>=0?u(h.slice(w+a.length).replace(/\+/g," ")):"",y=l[E];y===void 0?l[E]=b:Array.isArray(y)?y.push(b):l[E]=[y,b]}return l},s=(i,o="&",a="=",c)=>{let l=c?.encodeURIComponent??t;return!i||typeof i!="object"?"":Object.keys(i).map(u=>{let f=i[u],d=l(r(u))+a;return Array.isArray(f)?f.map(h=>d+l(r(h))).join(o):d+l(r(f))}).filter(Boolean).join(o)};return{parse:n,decode:n,stringify:s,encode:s,escape:t,unescape:e}}function Ni(t,e){function r(i,o=!1,a=!1){let c=i.trim(),l={protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:""},u=c.indexOf("#");u>=0&&(l.hash=c.slice(u),c=c.slice(0,u));let f=c.indexOf("?");f>=0?(l.search=c.slice(f),l.query=c.slice(f+1),c=c.slice(0,f)):o&&(l.search="",l.query={});let d=/^([a-z][a-z0-9.+-]*:)/i.exec(c);if(d&&(l.protocol=d[1].toLowerCase(),c=c.slice(d[1].length)),(d||a)&&c.startsWith("//")){l.slashes=!0,c=c.slice(2);let h=c.search(/[/]/),w=h>=0?c.slice(0,h):c;c=h>=0?c.slice(h):"";let E=w.lastIndexOf("@");E>=0&&(l.auth=decodeURIComponent(w.slice(0,E)),w=w.slice(E+1)),l.host=w.toLowerCase();let b=/:(\d*)$/.exec(l.host);b?(l.port=b[1]||null,l.hostname=l.host.slice(0,-b[0].length)):l.hostname=l.host,l.hostname.startsWith("[")&&l.hostname.endsWith("]")&&(l.hostname=l.hostname.slice(1,-1)),!c&&l.protocol&&/^(https?|ftp|wss?|file):$/.test(l.protocol)&&(c="/")}return l.pathname=c||(l.slashes?"/":null),o&&typeof l.query=="string"&&(l.query=t.parse(l.query)),l.path=(l.pathname??"")+(l.search??"")||null,l.href=n(l),l}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 l=i.slashes||a&&/^(https?|ftp|wss?|file):$/.test(o)?"//":"",u=i.pathname??"";a&&u&&!u.startsWith("/")&&(u="/"+u);let f=i.hash?i.hash.startsWith("#")?i.hash:"#"+i.hash:"";return`${o}${l}${a}${u}${c}${f}`}function s(i,o){let a=new URL(i,"resolve://"),c=new URL(o,a);if(c.protocol==="resolve:"){let{pathname:l,search:u,hash:f}=c;return l+u+f}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 dr=class extends Error{constructor(r){let n=r.message===void 0;super(n?`${G(r.actual)} ${r.operator??"=="} ${G(r.expected)}`:String(r.message));g(this,"code","ERR_ASSERTION");g(this,"actual");g(this,"expected");g(this,"operator");g(this,"generatedMessage");this.name="AssertionError",this.actual=r.actual,this.expected=r.expected,this.operator=r.operator??"==",this.generatedMessage=n}};function xn(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=>xn(t[s],e[s]))}function Y(t,e,r,n){throw t instanceof Error?t:new dr({message:t,actual:e,expected:r,operator:n})}function Ti(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])):Se(t?.[r],n)):!1}function hr(t=!1){let e=(a,c)=>{a||Y(c??"The expression evaluated to a falsy value",a,!0,"==")},r=t?(a,c,l)=>!Object.is(a,c)&&Y(l,a,c,"strictEqual"):(a,c,l)=>a!=c&&!(Number.isNaN(a)&&Number.isNaN(c))&&Y(l,a,c,"=="),n=t?(a,c,l)=>!Se(a,c)&&Y(l,a,c,"deepStrictEqual"):(a,c,l)=>!xn(a,c)&&Y(l,a,c,"deepEqual"),s=(a,c,l)=>{typeof c=="string"&&([l,c]=[c,void 0]);try{a()}catch(u){if(!Ti(u,c))throw u;return}Y(l??"Missing expected exception.",void 0,c,"throws")},i=async(a,c,l)=>{typeof c=="string"&&([l,c]=[c,void 0]);try{await(typeof a=="function"?a():a)}catch(u){if(!Ti(u,c))throw u;return}Y(l??"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,l)=>Object.is(a,c)&&Y(l,a,c,"notStrictEqual"):(a,c,l)=>a==c&&Y(l,a,c,"!="),strictEqual:(a,c,l)=>!Object.is(a,c)&&Y(l,a,c,"strictEqual"),notStrictEqual:(a,c,l)=>Object.is(a,c)&&Y(l,a,c,"notStrictEqual"),deepEqual:n,notDeepEqual:(a,c,l)=>(t?Se(a,c):xn(a,c))&&Y(l,a,c,"notDeepEqual"),deepStrictEqual:(a,c,l)=>!Se(a,c)&&Y(l,a,c,"deepStrictEqual"),notDeepStrictEqual:(a,c,l)=>Se(a,c)&&Y(l,a,c,"notDeepStrictEqual"),throws:s,doesNotThrow:(a,c)=>{try{a()}catch(l){Y(c??`Got unwanted exception: ${l?.message??l}`,l,void 0,"doesNotThrow")}},rejects:i,doesNotReject:async(a,c)=>{try{await(typeof a=="function"?a():a)}catch(l){Y(c??"Got unwanted rejection.",l,void 0,"doesNotReject")}},match:(a,c,l)=>!c.test(a)&&Y(l??`The input did not match the regular expression ${c}. Input: ${G(a)}`,a,c,"match"),doesNotMatch:(a,c,l)=>c.test(a)&&Y(l,a,c,"doesNotMatch"),ifError:a=>{if(a!=null)throw a},fail:a=>Y(a??"Failed",void 0,void 0,"fail"),AssertionError:dr}),o.strict=t?o:hr(!0),o}var Dn=t=>typeof t=="string"?D.from(t):t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),pt=t=>t?.level===void 0||t.level<0?6:Math.min(9,t.level),Pc={gzip:(t,e)=>gs(t,{level:pt(e)}),gunzip:t=>Bt(t),deflate:(t,e)=>ws(t,{level:pt(e)}),inflate:t=>en(t),deflateRaw:(t,e)=>ps(t,{level:pt(e)}),inflateRaw:t=>Vr(t),unzip:t=>Es(t)},Li={Gzip:t=>new As({level:pt(t)}),Gunzip:()=>new Zr,Deflate:t=>new ms({level:pt(t)}),Inflate:()=>new Xr,DeflateRaw:t=>new Te({level:pt(t)}),InflateRaw:()=>new Ee,Unzip:()=>new ys},$i=4;function Nt(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 pr=class extends Pe{constructor(r,n){super();g(this,"engine");g(this,"bytesWritten",0);g(this,"_handle",{close:()=>{}});this.engine=Li[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(Nt(i))}}_flush(r){try{this.engine.push(new Uint8Array(0),!0),r()}catch(n){r(Nt(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===$i)}catch(o){throw Nt(o)}finally{this.engine.ondata=i}return D.concat(s)}flush(r,n){n?.()}params(r,n,s){s?.()}close(r){this.destroy(),r?.()}},ht=()=>{throw Object.assign(new Error("Brotli is not available in the browser runtime"),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function Mi(){let t={constants:{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:$i,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:ht,brotliDecompressSync:ht,brotliCompress:ht,brotliDecompress:ht,createBrotliCompress:ht,createBrotliDecompress:ht,crc32:(e,r=0)=>{let n=~r>>>0;for(let s of Dn(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(Pc))t[`${e}Sync`]=(n,s)=>{try{return D.from(r(Dn(n),s))}catch(i){throw Nt(i)}},t[e]=(n,s,i)=>{let o=typeof s=="function"?s:i;N(()=>{try{o(null,D.from(r(Dn(n),typeof s=="object"?s:void 0)))}catch(a){o(Nt(a))}})};for(let e of Object.keys(Li))t[`create${e}`]=r=>new pr(e,r),t[e]=class extends pr{constructor(r){super(e,r)}};return t}var me=class extends L{constructor(r=0){super();g(this,"remoteAddress","127.0.0.1");g(this,"remotePort",5e4+Math.floor(Math.random()*1e4));g(this,"remoteFamily","IPv4");g(this,"localAddress","127.0.0.1");g(this,"localPort");g(this,"encrypted",!1);g(this,"readable",!0);g(this,"writable",!0);g(this,"destroyed",!1);g(this,"bytesRead",0);g(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 jc(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 _e=class extends V{constructor(r=new me){super();g(this,"httpVersion","1.1");g(this,"httpVersionMajor",1);g(this,"httpVersionMinor",1);g(this,"method");g(this,"url");g(this,"statusCode");g(this,"statusMessage");g(this,"headers",{});g(this,"rawHeaders",[]);g(this,"trailers",{});g(this,"rawTrailers",[]);g(this,"complete",!1);g(this,"aborted",!1);g(this,"socket");g(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}=jc(r);this.headers=n,this.rawHeaders=s}_complete(){this.push(null),this.complete=!0}},Re=class extends ne{constructor(){super(...arguments);g(this,"_headers",new Map);g(this,"headersSent",!1);g(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 Kc=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]),Hc=new Set(["host","connection","content-length","keep-alive","transfer-encoding","upgrade","expect","te","trailer","proxy-connection"]);function Wc(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 Fi(t){return Kc.has(t.toLowerCase())}function Ui(t){let e={};return t.forEach((r,n)=>e[n]=r),e}async function Pi(t,e,r,n){if(Fi(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[u,f]of Object.entries(a.headers))for(let d of Array.isArray(f)?f:[f])c.append(u,String(d));let l=a.status===204||a.status===304||r.method==="HEAD";return l&&a.body.cancel().catch(()=>{}),new Response(l?null:a.body,{status:a.status,statusText:a.statusText,headers:c})}let s={};for(let[o,a]of Object.entries(r.headers))Hc.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 Tt=class extends Re{constructor(r,n,s,i,o){super({decodeStrings:!0,autoDestroy:!1});g(this,"deps");g(this,"method");g(this,"path");g(this,"host");g(this,"protocol");g(this,"aborted",!1);g(this,"reusedSocket",!1);g(this,"socket",new me);g(this,"connection",this.socket);g(this,"chunks",[]);g(this,"controller",new AbortController);g(this,"options");this.deps=r,typeof s=="function"&&([i,s]=[s,void 0]),this.options=Wc(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[u,f]of Object.entries(this.getHeaders()))o[u]=Array.isArray(f)?f.join(", "):String(f);let a=this.chunks.length?D.concat(this.chunks):null,c=await Pi(this.deps.system,i,{method:this.method,url:this.path,headers:o,body:a},this.controller.signal),l=new _e(this.socket);l.statusCode=c.status,l.statusMessage=c.statusText,l._setHeaders(Ui(c.headers)),this.deps.loop._run(()=>{this.emit("response",l)||l.resume()}),await this.streamBody(c,l)}catch(n){this.aborted||this.deps.loop._run(()=>this.emit("error",n))}finally{r()}}};function On(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(!Fi(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 Pi(t.system,i,{method:s.method,url:i.pathname+i.search,headers:Ui(s.headers),body:o});return Jc(a,()=>t.loop.hold())}finally{n()}}}function Jc(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 Ar={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"},ji=["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 qc=new Set([101,204,304]),Ye=class extends Re{constructor(r,n){super({decodeStrings:!0});g(this,"sink");g(this,"statusCode",200);g(this,"statusMessage","");g(this,"req");g(this,"socket");g(this,"connection");g(this,"chunkedEncoding",!1);g(this,"shouldKeepAlive",!1);g(this,"headWritten",!1);g(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"&&!qc.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||Ar[this.statusCode]||"",headers:r})}};var gr=class extends De{constructor(r,n,s){super({allowHalfOpen:!1});g(this,"channel");g(this,"remoteAddress","127.0.0.1");g(this,"remotePort",5e4+Math.floor(Math.random()*1e4));g(this,"remoteFamily","IPv4");g(this,"localAddress","127.0.0.1");g(this,"localPort");g(this,"encrypted",!1);g(this,"connecting",!1);g(this,"bytesRead",0);g(this,"bytesWritten",0);g(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 Lt=class extends L{constructor(r,n,s){super();g(this,"deps");g(this,"listening",!1);g(this,"timeout",0);g(this,"keepAliveTimeout",5e3);g(this,"headersTimeout",6e4);g(this,"requestTimeout",3e5);g(this,"maxHeadersCount",null);g(this,"registration");g(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 N(()=>this.emit("error",o)),this}return this.listening=!0,this.release=this.deps.loop.hold(),N(()=>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),N(()=>this.emit("close")),this):(r&&N(()=>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 _e(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(l=>/^(content-length|transfer-encoding)$/i.test(l))&&r.body?.length&&(s["content-length"]=String(r.body.length));let o=this.toIncoming(r,new me(this.registration?.port??0),s,r.body),a=xt(()=>this.deps.loop._run(()=>c._hangUp())),c=new Ye(o,{head:l=>n({...l,body:a.stream}),chunk:l=>a.push(l),end:()=>a.end()});this.deps.loop._run(()=>{try{this.emit("request",o,c)}catch(l){throw c.writableEnded||(c.statusCode=500,c.end("Internal Server Error")),l}})})}upgrade(r,n){if(!this.listenerCount("upgrade"))return n.close();let s=new gr(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 mr=class extends L{constructor(r={}){super();g(this,"options");g(this,"maxSockets",1/0);g(this,"maxFreeSockets",256);g(this,"sockets",{});g(this,"requests",{});g(this,"freeSockets",{});this.options=r}destroy(){}};function _n(t,e){let r=(i,o,a)=>new Tt(t,i,o,a,e),n=(i,o,a)=>{let c=r(i,o,a);return c.end(),c},s=new mr;return{createServer:(i,o)=>new Lt(t,i,o),request:r,get:n,Server:class extends Lt{constructor(i,o){super(t,i,o)}},IncomingMessage:_e,ServerResponse:Ye,OutgoingMessage:Re,ClientRequest:Tt,Agent:mr,globalAgent:s,STATUS_CODES:Ar,METHODS:ji,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 Ki=/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/,Hi=/^(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}$/i;function Wi(t){class e extends L{constructor(){super(...arguments);g(this,"reservation");g(this,"release");g(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()=>Dt(502,"Not an HTTP server"))}catch(l){return N(()=>this.emit("error",l)),this}return this.listening=!0,this.release=t.loop.hold(),N(()=>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),N(()=>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:me,Stream:me,connect:r,createConnection:r,isIP:n=>Ki.test(n)?4:Hi.test(n)?6:0,isIPv4:n=>Ki.test(n),isIPv6:n=>Hi.test(n),getDefaultAutoSelectFamily:()=>!0,setDefaultAutoSelectFamily:()=>{}}}var zc=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,Ve=class extends L{constructor(r,n,s,i){super();g(this,"pid");g(this,"exitCode",null);g(this,"signalCode",null);g(this,"killed",!1);g(this,"connected",!1);g(this,"spawnfile");g(this,"spawnargs");g(this,"stdin");g(this,"stdout");g(this,"stderr");g(this,"stdio");g(this,"handle");g(this,"ipc");g(this,"release");g(this,"exited",!1);g(this,"hold");this.spawnfile=n,this.spawnargs=[n,...s],this.stdout=new V({read(){}}),this.stderr=new V({read(){}}),this.stdin=new ne({write:(h,w,E)=>{this.handle?.write(typeof h=="string"?h:new Uint8Array(h)),E()},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)],l={};for(let[h,w]of Object.entries(i.env??r.env()))w!==void 0&&(l[h]=String(w));let[u,f]=i.shell?["bfsh",["-c",[n,...s].join(" ")]]:[n,s];this.hold=()=>r.loop.hold(),this.release=this.hold();try{this.handle=r.system.spawn(u,f,{cwd:i.cwd??r.cwd(),env:l,ipc:i.ipc,detached:i.detached})}catch(h){this.unref();let w=h.code??"ENOENT",E=Object.assign(new Error(`spawn ${n} ${w}`),{code:w,errno:-2,syscall:`spawn ${n}`,path:n,spawnargs:s});N(()=>{this.emit("error",E),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()),N(()=>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?N(()=>s(o)):N(()=>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&&N(()=>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 Ji(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 Rn=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 qi(t){return{spawn:(r,n,s)=>(Array.isArray(n)||([s,n]=[n,[]]),new Ve(t,r,n.map(String),s??{})),exec(r,n,s){return typeof n=="function"&&([s,n]=[n,{}]),Ji(new Ve(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,{}]),Ji(new Ve(t,r,n,s??{}),[r,...n].map(zc).join(" "),i)},fork(r,n,s){Array.isArray(n)||([s,n]=[n,[]]);let i=s??{},o=i.stdio??(i.silent?"pipe":"inherit");return new Ve(t,"node",[...i.execArgv??[],r,...n.map(String)],{...i,stdio:o,ipc:!0})},execSync:Rn("execSync"),execFileSync:Rn("execFileSync"),spawnSync:Rn("spawnSync"),ChildProcess:Ve}}var yr=class extends L{constructor(r,n,s={}){super();g(this,"input");g(this,"output");g(this,"line","");g(this,"cursor",0);g(this,"terminal");g(this,"closed",!1);g(this,"buffer","");g(this,"promptText","> ");g(this,"pendingQuestion");g(this,"onData",r=>this.feed(String(r)));g(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)}},wr=(t,e,r)=>(t?.write(e),r?.(),!0);function Nn(t=!1){let r={createInterface:(n,s)=>{let i="input"in n&&n.input?n:{input:n,output:s},o=new yr(i.input,i.output,i);if(t){let a=o.question.bind(o);o.question=c=>new Promise(l=>a(c,void 0,l))}return o},Interface:yr,clearLine:(n,s,i)=>wr(n,s<0?"\x1B[1K":s>0?"\x1B[0K":"\x1B[2K",i),clearScreenDown:(n,s)=>wr(n,"\x1B[0J",s),cursorTo:(n,s,i,o)=>wr(n,typeof i=="number"?`\x1B[${i+1};${s+1}H`:`\x1B[${s+1}G`,typeof i=="function"?i:o),moveCursor:(n,s,i,o)=>wr(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=Nn(!0)),r}function zi(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 Gi(t){return{isatty:e=>t&&e>=0&&e<=2,ReadStream:class extends L{},WriteStream:class extends L{}}}function Yi(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 Vi(){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}):wn(n,this.encoding)}end(n){return(n===void 0?"":this.write(n))+(this.utf8?this.utf8.decode():"")}}return{StringDecoder:oe(e,t)}}function Zi(){class t{constructor(){g(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){g(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 Tn="__bfwc_vm_code";function Xi(){let t=(r,n={})=>{let s=new Proxy(n,{has:(i,o)=>o!==Tn,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(Tn,`with (this) { return eval(${Tn}); }`).call(s,r)};class e{constructor(n){g(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 eo(){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 ae=t=>()=>{throw Object.assign(new Error(`${t} is not available in the browser runtime`),{code:"ERR_FEATURE_UNAVAILABLE_ON_PLATFORM"})};function to(){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)=>N(()=>(typeof e=="function"?e:r)(null,t==="localhost"?"127.0.0.1":t,4)),resolve:ae("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:ae("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:ae("tls.connect"),createServer:ae("tls.createServer"),createSecureContext:()=>({}),DEFAULT_MIN_VERSION:"TLSv1.2",DEFAULT_MAX_VERSION:"TLSv1.3",rootCertificates:[]},dgram:{createSocket:ae("dgram.createSocket")},http2:{connect:ae("http2.connect"),createServer:ae("http2.createServer"),createSecureServer:ae("http2.createSecureServer"),constants:{}},trace_events:{createTracing:()=>({enable(){},disable(){}}),getEnabledCategories:()=>""},sqlite:{DatabaseSync:ae("sqlite.DatabaseSync")},test:{test:ae("node:test"),describe:ae("node:test"),it:ae("node:test")},wasi:{WASI:ae("wasi.WASI")},repl:{start:ae("repl.start")},domain:{create:()=>Object.assign(new L,{run:t=>t(),add(){},remove(){},bind:t=>t,intercept:t=>t,enter(){},exit(){},dispose(){}})}}}function ro(t){let{process:e,loop:r,system:n}=t,s=()=>e.env,i=to(),o={system:n,loop:r},a={system:n,loop:r,cwd:()=>e.cwd(),env:s,stdout:f=>void e.stdout.write(f),stderr:f=>void e.stderr.write(f)},c={assert:()=>hr(!1),"assert/strict":()=>hr(!0),async_hooks:()=>Zi(),buffer:()=>hi(),child_process:()=>qi(a),worker_threads:()=>Ai({...a,thread:t.thread,ipc:t.ipc}),console:()=>Object.assign(Object.create(t.console),{Console:function(){return t.console}}),constants:f=>({...Qe,...f("os").constants.signals}),crypto:()=>_i(),diagnostics_channel:()=>eo(),"dns/promises":f=>f("dns").promises,events:()=>di(),fs:()=>xi({vfs:t.fs,cwd:()=>e.cwd(),stdout:t.io.stdout,stderr:t.io.stderr,hold:()=>r.hold(),readStdin:Di(t.io,()=>r.hold())}),"fs/promises":f=>f("fs").promises,http:()=>_n(o,"http:"),https:()=>_n(o,"https:"),net:()=>Wi(o),os:()=>zi(s),path:()=>mi(()=>e.cwd()),"path/posix":f=>f("path"),"path/win32":f=>f("path"),process:()=>e,querystring:()=>Ri(),readline:()=>Nn(),"readline/promises":f=>f("readline").promises,stream:()=>Si(),"stream/promises":f=>f("stream").promises,"stream/web":()=>({ReadableStream,WritableStream,TransformStream,TextEncoderStream,TextDecoderStream,ByteLengthQueuingStrategy,CountQueuingStrategy}),"stream/consumers":()=>({text:async f=>{let d="";for await(let h of f)d+=typeof h=="string"?h:new TextDecoder().decode(h);return d},json:async f=>{let d="";for await(let h of f)d+=typeof h=="string"?h:new TextDecoder().decode(h);return JSON.parse(d)}}),string_decoder:()=>Vi(),sys:f=>f("util"),timers:()=>Yi(r),"timers/promises":f=>f("timers").promises,tty:()=>Gi(!!t.io.terminal),url:f=>Ni(f("querystring"),d=>f("path").resolve(d)),util:()=>Ci(s,f=>e.stderr.write(f+`
28
+ `)),"util/types":()=>lt,vm:()=>Xi(),zlib:()=>Mi()};for(let[f,d]of Object.entries(i))c[f]??(c[f]=()=>d);let l=new Map,u=f=>{if(l.has(f))return l.get(f);let d=c[f];if(!d)throw Object.assign(new Error(`No such built-in module: ${f}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});let h=d(u);return l.set(f,h),h};return{names:[...Object.keys(c),"module"].sort(),isBuiltin:f=>f==="module"||f in c,get:u,fetch:On(o)}}var io=tn,Ln=Symbol.for("bfwc.esm"),Gc=/^[\p{L}_$][\p{L}\p{N}_$]*$/u;function oo(t){return/(?:^|[\s;})])(?:import\s*[\w{*'"]|export\s+|export\s*[{*])/.test(t)}function ao(t){try{let[e,r]=It(t);return r.length>0||e.some(n=>n.t===1||n.t===3)}catch{return!1}}function no(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 Yc=(t,e)=>Gc.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;function Vc(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 so=t=>!!t&&/[\p{L}\p{N}_$]/u.test(t);function Zc(t,e){for(let r=t.lastIndexOf("export",e-1);r>=0;r=t.lastIndexOf("export",r-1))if(!so(t[r-1])&&!so(t[r+6]))return r;return-1}function co(t){if(!/\bimport\s*\(/.test(t))return t;let e;try{[e]=It(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 $n(t){let[e,r]=It(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),w=`__bfwc_m${a++}`,E=`const ${w} = ${c(d.n)};`;if(h.startsWith("export")){o.add(d.ss);let A=/^export\s*\*\s*as\s+("[^"]*"|'[^']*'|[^\s]+)/.exec(h);if(A)s.set(A[1].replace(/^["']|["']$/g,""),w);else if(/^export\s*\*/.test(h))n.push({start:d.ss,end:d.se,text:`${E} __bfwc_star(__bfwc_exports, ${w});`});else for(let[m,Q]of no(/\{([^}]*)\}/.exec(h)?.[1]??""))s.set(Q,Yc(w,m));n.some(m=>m.start===d.ss)||n.push({start:d.ss,end:d.se,text:E});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 y=[E],C=/\{([\s\S]*)\}/.exec(b),p=b.replace(/\{[\s\S]*\}/,"").split(",").map(A=>A.trim()).filter(Boolean);for(let A of p){let m=/^\*\s*as\s+(\S+)$/.exec(A);m?y.push(`const ${m[1]} = ${w};`):y.push(`const ${A} = __bfwc_get(${w}, "default");`)}if(C)for(let[A,m]of no(C[1]))y.push(`const ${m} = __bfwc_get(${w}, ${JSON.stringify(A)});`);n.push({start:d.ss,end:d.se,text:y.join(" ")})}let l=new Map;for(let d of r){let h=Zc(t,d.s);if(h<0||o.has(h))continue;let w=t.slice(h+6,d.s);if(/^\s*\{/.test(w)){if(!l.has(h)){let b=t.indexOf("}",h)+1,y=/^\s*;/.exec(t.slice(b));y&&(b+=y[0].length),l.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)&&!w.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(w)))for(let b of Vc(t,d.e))s.set(b,b);s.set(d.n,d.ln??d.n)}n.sort((d,h)=>h.start-d.start);let u=t;for(let d of n)u=u.slice(0,d.start)+d.text+u.slice(d.end);return`"use strict";__bfwc_esm(__bfwc_exports, { ${[...s].map(([d,h])=>`${JSON.stringify(d)}: () => ${h}`).join(", ")} });${u}`}var br=["node","require","default"],Mn=["node","import","default"],uo=[".js",".json",".cjs",".mjs",".node"];function $t(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 On(t,e){let r=t.readText(I(e,"package.json"));if(r!==void 0)try{return JSON.parse(r)}catch{return}}function Me(t,e){for(let r=O(e);;r=L(r)){if(!r.endsWith("/node_modules")){let n=On(t,r);if(n)return{dir:r,pkg:n}}if(r==="/")return}}function Nn(t,e){if(t.isFile(e))return e;for(let r of Wi)if(t.isFile(e+r))return e+r}function Hi(t,e){for(let r of Wi)if(t.isFile(I(e,"index"+r)))return I(e,"index"+r)}function qi(t,e){if(!t.isDirectory(e))return;let r=On(t,e)?.main;if(typeof r=="string"&&r){let n=I(e,r),s=Nn(t,n)??Hi(t,n);if(s)return s}return Hi(t,e)}function zi(t,e){return Nn(t,e)??qi(t,e)}function Ar(t,e,r){if(typeof t=="string")return t.replace(/\*/g,e);if(Array.isArray(t)){for(let n of t){let s=Ar(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=Ar(s,e,r);if(i!==void 0)return i}return}return t===null?null:void 0}function Gi(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 Ar(s[e],"",r);let i;for(let a of Object.keys(s)){let c=a.indexOf("*");if(c>=0){let f=a.slice(0,c),l=a.slice(c+1);e.startsWith(f)&&e.length>=a.length-1&&e.endsWith(l)&&(!i||f.length>i.key.indexOf("*"))&&(i={key:a,match:e.slice(f.length,e.length-l.length)})}else a.endsWith("/")&&e.startsWith(a)&&(!i||a.length>i.key.length)&&(i={key:a,match:""})}if(!i)return;let o=Ar(s[i.key],i.match,r);return o&&i.key.endsWith("/")&&!i.key.includes("*")?o+e.slice(i.key.length):o}function Ic(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 Ji(t,e,r,n,s,i,o){let a=On(t,e);if(a?.exports!==void 0&&a.exports!==null){let f=n?`.${n}`:".",l=Gi(a.exports,f,s);if(!l)throw Ic(r,f);let u=I(e,l);if(t.isFile(u))return u;throw Dt(i,o)}let c=zi(t,I(e,n||"."));if(!c)throw Dt(i,o);return c}function mr(t,e,r,n){let{conditions:s,from:i}=n;if(e.startsWith("node:")){let u=e.slice(5);if(!n.isBuiltin(u))throw Object.assign(new Error(`No such built-in module: ${e}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});return{builtin:u}}if(n.isBuiltin(e))return{builtin:e};if(e.startsWith("#")){let u=Me(t,r),d=u?.pkg.imports?Gi(u.pkg.imports,e,s):void 0;if(!d||!u)throw Object.assign(new Error(`Package import specifier "${e}" is not defined${u?` in package ${u.dir}/package.json`:""}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});if(!d.startsWith("./"))return mr(t,d,u.dir,n);let h=I(u.dir,d);if(t.isFile(h))return{path:h};throw Dt(e,i)}if(e==="."||e===".."||e.startsWith("./")||e.startsWith("../")||e.startsWith("/")){let u=e.startsWith("/")?O(e):I(r,e),d=e.endsWith("/")?qi(t,u):zi(t,u);if(!d)throw Dt(e,i);return{path:d}}let{name:o,subpath:a}=ps(e),c=Me(t,r);if(c?.pkg.name===o&&c.pkg.exports!==void 0)return{path:Ji(t,c.dir,o,a,s,e,i)};let f=n.paths??[],l=[];for(let u=O(r);u.endsWith("/node_modules")||l.push(I(u,"node_modules")),u!=="/";u=L(u));for(let u of f)l.push(u.endsWith("node_modules")?u:I(u,"node_modules"));for(let u of l){let d=I(u,o);if(t.isDirectory(d)||t.isFile(d+".js")||t.isFile(d+".json"))return t.isDirectory(d)?{path:Ji(t,d,o,a,s,e,i)}:{path:Nn(t,d)}}throw Dt(e,i)}function wr(t){let e=[];for(let r=O(t);;r=L(r))if(r.endsWith("/node_modules")||e.push(I(r,"node_modules")),r==="/")return e}var kc=Object.getPrototypeOf(async()=>{}).constructor;function yr(t){let e=t.charCodeAt(0)===65279?t.slice(1):t;return e.startsWith("#!")?"//"+e.slice(2):e}function Yi(t){let{fs:e}=t,r=Object.create(null),n=new WeakMap,s=Object.keys(t.globals),i=s.map(g=>t.globals[g]),o;function a(g,m){let w=At(g);return w===".mjs"?!0:w===".cjs"?!1:Me(e,L(g))?.pkg.type==="module"?!0:ji(m)&&Ki(m)}function c(g){if(g&&g[kn])return g;if(typeof g!="object"&&typeof g!="function"||g===null)return{default:g};let m=n.get(g);if(!m){m=Object.create(null);for(let w of Object.keys(g))w!=="default"&&Object.defineProperty(m,w,{enumerable:!0,get:()=>g[w]});Object.defineProperty(m,"default",{enumerable:!0,value:g}),n.set(g,m)}return m}let h=class h{constructor(m="",w=void 0){p(this,"parent");p(this,"id");p(this,"filename");p(this,"path");p(this,"exports",{});p(this,"loaded",!1);p(this,"children",[]);p(this,"paths");p(this,"__tla");this.parent=w,this.id=m,this.filename=m,this.path=L(m||"/"),this.paths=wr(this.path),w?.children.push(this)}static _resolveFilename(m,w,E,v){let A=w?.filename?L(w.filename):t.globals.process?.cwd()??"/",b=mr(e,m,A,{conditions:v?.conditions??gr,isBuiltin:t.isBuiltin,from:w?.filename,paths:v?.paths});return"builtin"in b?`node:${b.builtin}`:b.path}static _load(m,w,E=!1){let v=h._resolveFilename(m,w,E);return u(v,w,E).exports}require(m){if(typeof m!="string"||!m)throw new TypeError('The "id" argument must be a non-empty string');return h._load(m,this,!1)}_compile(m,w,E=!1){let v=d(this),A=L(w),b=["exports","require","module","__filename","__dirname",...s],y=[this.exports,v,this,w,A,...i];E&&(b.push("__bfwc_import","__bfwc_dynamic","__bfwc_meta","__bfwc_esm","__bfwc_star","__bfwc_get"),y.push(...l(this,w)));let B=`${yr(m)}
32
- //# sourceURL=${encodeURI("file://"+w)}`,S;try{S=new Function(...b,B)}catch(Q){if(E&&Q instanceof SyntaxError&&/await/.test(Q.message))S=new kc(...b,B);else throw Q instanceof Error&&(Q.message=`${w}: ${Q.message}`),Q}let C=S.apply(this.exports,y);return C instanceof Promise&&(this.__tla=C),C}};p(h,"_cache",r),p(h,"_pathCache",Object.create(null)),p(h,"builtinModules",[]),p(h,"globalPaths",["/usr/local/lib/node"]),p(h,"Module",h),p(h,"_extensions",{".js"(m,w){let E=e.readText(w)??"";a(w,E)?m._compile(xn(yr(E)),w,!0):m._compile(E,w)},".cjs"(m,w){m._compile(e.readText(w)??"",w)},".mjs"(m,w){m._compile(xn(yr(e.readText(w)??"")),w,!0)},".json"(m,w){try{m.exports=JSON.parse(yr(e.readText(w)??""))}catch(E){throw E.message=`${w}: ${E.message}`,E}},".node"(m,w){throw Object.assign(new Error(`Native addons cannot run in the browser: ${w}`),{code:"ERR_DLOPEN_FAILED"})}}),p(h,"_nodeModulePaths",wr),p(h,"isBuiltin",m=>t.isBuiltin(m.replace(/^node:/,""))),p(h,"createRequire",m=>{let w=typeof m=="string"?m.replace(/^file:\/\//,""):decodeURIComponent(m.pathname);return d(new h(w.endsWith("/")?w+"__entry.js":w))}),p(h,"wrap",m=>`(function (exports, require, module, __filename, __dirname) { ${m}
33
- });`),p(h,"wrapper",["(function (exports, require, module, __filename, __dirname) { ",`
34
- });`]),p(h,"syncBuiltinESMExports",()=>{}),p(h,"register",()=>{}),p(h,"findSourceMap",()=>{}),p(h,"runMain",()=>{});let f=h;function l(g,m){let w=S=>{let C;try{C=f._resolveFilename(S,g,!1,{conditions:gr})}catch(Q){if(Q.code!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw Q;C=f._resolveFilename(S,g,!1,{conditions:Dn})}return u(C,g,!1)},E=S=>c(w(S).exports),v={url:"file://"+m,filename:m,dirname:L(m),resolve:S=>{let C=f._resolveFilename(S,g,!1,{conditions:Dn});return C.startsWith("node:")?C:"file://"+C}};return[E,async S=>{let C=w(String(S));return C.__tla&&await C.__tla,c(C.exports)},v,(S,C)=>{Object.defineProperty(S,"__esModule",{value:!0}),Object.defineProperty(S,kn,{value:!0});for(let[Q,k]of Object.entries(C))Object.defineProperty(S,Q,{enumerable:!0,configurable:!0,get:k})},(S,C)=>{for(let Q of Object.keys(C))Q==="default"||Q==="__esModule"||Object.prototype.hasOwnProperty.call(S,Q)||Object.defineProperty(S,Q,{enumerable:!0,configurable:!0,get:()=>C[Q]})},(S,C)=>{try{return S[C]}catch{return}}]}function u(g,m,w){if(g.startsWith("node:")){let A=g.slice(5);return{exports:A==="module"?f:t.builtin(A)}}let E=r[g];if(E)return m&&!m.children.includes(E)&&m.children.push(E),E;let v=new f(g,m??null);w&&(o=v,v.id="."),r[g]=v;try{(f._extensions[At(g)]??f._extensions[".js"])(v,g)}catch(A){throw delete r[g],A}return v.loaded=!0,v}function d(g){let m=E=>g.require(E),w=(E,v)=>{let A=f._resolveFilename(E,g,!1,v);return A.startsWith("node:")&&!E.startsWith("node:")?E:A};return w.paths=E=>t.isBuiltin(E)?null:wr(g.path),m.resolve=w,m.cache=r,m.extensions=f._extensions,Object.defineProperty(m,"main",{get:()=>o,enumerable:!0}),m}return{Module:f,cache:r,runMain(g){return u(g,void 0,!0)},get main(){return o},createRequire:f.createRequire,resolve(g,m){return mr(e,g,m,{conditions:gr,isBuiltin:t.isBuiltin})}}}var Rn=globalThis.setTimeout.bind(globalThis),xc=globalThis.clearTimeout.bind(globalThis),Dc=globalThis.setInterval.bind(globalThis),Oc=globalThis.clearInterval.bind(globalThis),Nc=1,_n=class{constructor(e,r,n,s,i){p(this,"loop");p(this,"_onTimeout");p(this,"_idleTimeout");p(this,"args");p(this,"_repeat");p(this,"_id",Nc++);p(this,"_ref",!0);p(this,"_handle");p(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))}},Er=class{constructor(e){p(this,"options");p(this,"holds",0);p(this,"timers",new Map);p(this,"refTimers",0);p(this,"checkScheduled",!1);p(this,"stopped",!1);p(this,"setTimeout",(e,r,...n)=>this.add(e,r,n,!1));p(this,"setInterval",(e,r,...n)=>this.add(e,r,n,!0));p(this,"setImmediate",(e,...r)=>this.add(e,0,r,!1));p(this,"clearTimeout",e=>this.clear(e));p(this,"clearInterval",e=>this.clear(e));p(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,Rn(()=>{Rn(()=>{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=Dc(()=>e._fire(),Math.max(1,r)):e._handle=Rn(()=>{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 _n(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?Oc(e._handle):xc(e._handle),e._handle=void 0)}};var Ot="20.18.0",lt=class{constructor(e){p(this,"code");this.code=e}},Rc=100,br=class extends X{constructor(r,n,s){super({decodeStrings:!1});p(this,"sink");p(this,"isTTY");p(this,"fd");p(this,"columns");p(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"&&queueMicrotask(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}},Tn=class extends Z{constructor(r,n){super({encoding:"utf8"});p(this,"io");p(this,"loop");p(this,"isTTY");p(this,"isRaw",!1);p(this,"fd",0);p(this,"subscription");p(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(r)}))}stopListening(){this.subscription?.(),this.subscription=void 0,this.release?.(),this.release=void 0}};function Vi(t){let{io:e,loop:r,fs:n}=t,s=O(t.cwd),i=!1,o=performance.now(),a=new T,c=Rc++,f=d=>{if(d!==void 0&&(a.exitCode=d),!i){i=!0;let h=Number(a.exitCode??0)||0;try{a.emit("exit",h)}catch{}t.onExit(Number(a.exitCode??h)||0)}throw new lt(Number(a.exitCode??0)||0)},l=d=>{let h=performance.now(),g=Math.floor(h/1e3),m=Math.floor(h%1e3*1e6);return d&&(g-=d[0],m-=d[1],m<0&&(g--,m+=1e9)),[g,m]};l.bigint=()=>BigInt(Math.floor(performance.now()*1e6));let u=()=>({rss:5e7,heapTotal:3e7,heapUsed:2e7,external:1e6,arrayBuffers:1e5});return u.rss=()=>5e7,Object.assign(a,{title:"node",version:`v${Ot}`,versions:{node:Ot,v8:"11.3.244.8-node.23",uv:"1.48.0",zlib:"1.3.0.1",modules:"115",napi:"9",unicode:"15.1"},release:{name:"node",lts:"Iron"},platform:"linux",arch:"x64",pid:c,ppid:c-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 br(1,e.stdout,e.terminal),stderr:new br(2,e.stderr,e.terminal),stdin:new Tn(e,r),cwd:()=>s,chdir(d){let h=d.startsWith("/")?O(d):I(s,d);if(!n.isDirectory(h))throw N(n.isFile(h)?"ENOTDIR":"ENOENT","chdir",h);s=h},exit:f,reallyExit:f,abort:()=>f(134),kill(d,h="SIGTERM"){if(d!==c)throw Object.assign(new Error("kill ESRCH"),{code:"ESRCH"});return a.listenerCount(String(h))?a.emit(String(h),String(h)):f(143),!0},nextTick(d,...h){queueMicrotask(()=>r._run(()=>d(...h)))},hrtime:l,memoryUsage:u,cpuUsage:()=>({user:Math.floor((performance.now()-o)*1e3),system:0}),resourceUsage:()=>({userCPUTime:0,systemCPUTime:0,maxRSS:5e4}),uptime:()=>(performance.now()-o)/1e3,umask:()=>18,getuid:()=>1e3,geteuid:()=>1e3,getgid:()=>1e3,getegid:()=>1e3,getgroups:()=>[1e3],emitWarning(d,h){let g=typeof h=="string"?h:h?.type??(d instanceof Error?d.name:"Warning"),m=d instanceof Error?d.message:d;a.emit("warning",Object.assign(new Error(m),{name:g})),e.stderr(`(node:${c}) ${g}: ${m}
35
- `)},binding(d){throw new Error(`No such module: ${d}`)},getActiveResourcesInfo:()=>[],setUncaughtExceptionCaptureCallback:()=>{},hasUncaughtExceptionCaptureCallback:()=>!1,setSourceMapsEnabled:()=>{},report:{getReport:()=>({header:{glibcVersionRuntime:"2.36"}})},connected:!1}),a}function Zi(t){let e=c=>(...f)=>t[c].write(Se(...f)+`
36
- `),r=new Map,n=new Map,s="",i=c=>(...f)=>s?c(s+Se(...f).replace(/\n/g,`
37
- `+s)):c(...f),o=i(e("stdout")),a=i(e("stderr"));return{log:o,info:o,debug:o,warn:a,error:a,trace:(...c)=>a(`Trace: ${Se(...c)}
31
+ - ${e}`:""}`);return r.code="MODULE_NOT_FOUND",e&&(r.requireStack=[e]),r}function Fn(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=M(r)){if(!r.endsWith("/node_modules")){let n=Fn(t,r);if(n)return{dir:r,pkg:n}}if(r==="/")return}}function Un(t,e){if(t.isFile(e))return e;for(let r of uo)if(t.isFile(e+r))return e+r}function lo(t,e){for(let r of uo)if(t.isFile(k(e,"index"+r)))return k(e,"index"+r)}function ho(t,e){if(!t.isDirectory(e))return;let r=Fn(t,e)?.main;if(typeof r=="string"&&r){let n=k(e,r),s=Un(t,n)??lo(t,n);if(s)return s}return lo(t,e)}function po(t,e){return Un(t,e)??ho(t,e)}function Er(t,e,r){if(typeof t=="string")return t.replace(/\*/g,e);if(Array.isArray(t)){for(let n of t){let s=Er(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=Er(s,e,r);if(i!==void 0)return i}return}return t===null?null:void 0}function Ao(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 Er(s[e],"",r);let i;for(let a of Object.keys(s)){let c=a.indexOf("*");if(c>=0){let l=a.slice(0,c),u=a.slice(c+1);e.startsWith(l)&&e.length>=a.length-1&&e.endsWith(u)&&(!i||l.length>i.key.indexOf("*"))&&(i={key:a,match:e.slice(l.length,e.length-u.length)})}else a.endsWith("/")&&e.startsWith(a)&&(!i||a.length>i.key.length)&&(i={key:a,match:""})}if(!i)return;let o=Er(s[i.key],i.match,r);return o&&i.key.endsWith("/")&&!i.key.includes("*")?o+e.slice(i.key.length):o}function Xc(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 fo(t,e,r,n,s,i,o){let a=Fn(t,e);if(a?.exports!==void 0&&a.exports!==null){let l=n?`.${n}`:".",u=Ao(a.exports,l,s);if(!u)throw Xc(r,l);let f=k(e,u);if(t.isFile(f))return f;throw $t(i,o)}let c=po(t,k(e,n||"."));if(!c)throw $t(i,o);return c}function Cr(t,e,r,n){let{conditions:s,from:i}=n;if(e.startsWith("node:")){let f=e.slice(5);if(!n.isBuiltin(f))throw Object.assign(new Error(`No such built-in module: ${e}`),{code:"ERR_UNKNOWN_BUILTIN_MODULE"});return{builtin:f}}if(n.isBuiltin(e))return{builtin:e};if(e.startsWith("#")){let f=je(t,r),d=f?.pkg.imports?Ao(f.pkg.imports,e,s):void 0;if(!d||!f)throw Object.assign(new Error(`Package import specifier "${e}" is not defined${f?` in package ${f.dir}/package.json`:""}`),{code:"ERR_PACKAGE_IMPORT_NOT_DEFINED"});if(!d.startsWith("./"))return Cr(t,d,f.dir,n);let h=k(f.dir,d);if(t.isFile(h))return{path:h};throw $t(e,i)}if(e==="."||e===".."||e.startsWith("./")||e.startsWith("../")||e.startsWith("/")){let f=e.startsWith("/")?O(e):k(r,e),d=e.endsWith("/")?ho(t,f):po(t,f);if(!d)throw $t(e,i);return{path:d}}let{name:o,subpath:a}=Cs(e),c=je(t,r);if(c?.pkg.name===o&&c.pkg.exports!==void 0)return{path:fo(t,c.dir,o,a,s,e,i)};let l=n.paths??[],u=[];for(let f=O(r);f.endsWith("/node_modules")||u.push(k(f,"node_modules")),f!=="/";f=M(f));for(let f of l)u.push(f.endsWith("node_modules")?f:k(f,"node_modules"));for(let f of u){let d=k(f,o);if(t.isDirectory(d)||t.isFile(d+".js")||t.isFile(d+".json"))return t.isDirectory(d)?{path:fo(t,d,o,a,s,e,i)}:{path:Un(t,d)}}throw $t(e,i)}function vr(t){let e=[];for(let r=O(t);;r=M(r))if(r.endsWith("/node_modules")||e.push(k(r,"node_modules")),r==="/")return e}function Sr(t){let e=t.charCodeAt(0)===65279?t.slice(1):t;return e.startsWith("#!")?"//"+e.slice(2):e}function go(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,y){let C=Et(b);return C===".mjs"?!0:C===".cjs"?!1:je(e,M(b))?.pkg.type==="module"?!0:oo(y)&&ao(y)}function c(b){if(b&&b[Ln])return b;if(typeof b!="object"&&typeof b!="function"||b===null)return{default:b};let y=n.get(b);if(!y){y=Object.create(null);for(let C of Object.keys(b))C!=="default"&&Object.defineProperty(y,C,{enumerable:!0,get:()=>b[C]});Object.defineProperty(y,"default",{enumerable:!0,value:b}),n.set(b,y)}return y}let E=class E{constructor(y="",C=void 0){g(this,"parent");g(this,"id");g(this,"filename");g(this,"path");g(this,"exports",{});g(this,"loaded",!1);g(this,"children",[]);g(this,"paths");g(this,"__tla");this.parent=C,this.id=y,this.filename=y,this.path=M(y||"/"),this.paths=vr(this.path),C?.children.push(this)}static _resolveFilename(y,C,p,A){let m=C?.filename?M(C.filename):t.globals.process?.cwd()??"/",Q=Cr(e,y,m,{conditions:A?.conditions??br,isBuiltin:t.isBuiltin,from:C?.filename,paths:A?.paths});return"builtin"in Q?`node:${Q.builtin}`:Q.path}static _load(y,C,p=!1){let A=E._resolveFilename(y,C,p);return h(A,C,p).exports}require(y){if(typeof y!="string"||!y)throw new TypeError('The "id" argument must be a non-empty string');return E._load(y,this,!1)}_compile(y,C,p=!1){let A=w(this),m=M(C),Q=["exports","require","module","__filename","__dirname"],B=[this.exports,A,this,C,m],v=y,S=[],I=[];p?(S=["__bfwc_exports","__bfwc_import","__bfwc_dynamic","__bfwc_meta","__bfwc_esm","__bfwc_star","__bfwc_get"],I=[this.exports,...d(this,C)]):(v=co(y))!==y&&(S=["__bfwc_dynamic"],I=[d(this,C)[1]]);let x=`${Sr(v)}
32
+ //# sourceURL=${encodeURI("file://"+C)}`,[_,T,H,X]=p?[[...s,...Q],[...i,...B],S,I]:[s,i,[...Q,...S],[...B,...I]],q=ce=>{let z=`return ${ce?"async ":""}function (${H.join(", ")}) {${x}
33
+ }`;return t.scope?new Function("__bfwc_scope",`with (__bfwc_scope) { return function (${_.join(", ")}) { ${z} }; }`)(t.scope)(...T):new Function(..._,z)(...T)},U;try{U=q(!1)}catch(ce){let z;if(p&&ce instanceof SyntaxError&&/\bawait\b/.test(v))try{z=q(!0)}catch{}if(!z)throw ce instanceof Error&&(ce.message=`${C}: ${ce.message}`),ce;U=z}let ee=p?f(this,v):[],W=ee.length?Promise.all(ee).then(()=>U.apply(this.exports,X)):U.apply(this.exports,X);return W instanceof Promise&&(this.__tla=W),W}};g(E,"_cache",r),g(E,"_pathCache",Object.create(null)),g(E,"builtinModules",[]),g(E,"globalPaths",["/usr/local/lib/node"]),g(E,"Module",E),g(E,"_extensions",{".js"(y,C){let p=e.readText(C)??"";a(C,p)?y._compile($n(Sr(p)),C,!0):y._compile(p,C)},".cjs"(y,C){y._compile(e.readText(C)??"",C)},".mjs"(y,C){y._compile($n(Sr(e.readText(C)??"")),C,!0)},".json"(y,C){try{y.exports=JSON.parse(Sr(e.readText(C)??""))}catch(p){throw p.message=`${C}: ${p.message}`,p}},".node"(y,C){throw Object.assign(new Error(`Native addons cannot run in the browser: ${C}`),{code:"ERR_DLOPEN_FAILED"})}}),g(E,"_nodeModulePaths",vr),g(E,"isBuiltin",y=>t.isBuiltin(y.replace(/^node:/,""))),g(E,"createRequire",y=>{let C=typeof y=="string"?y.replace(/^file:\/\//,""):decodeURIComponent(y.pathname);return w(new E(C.endsWith("/")?C+"__entry.js":C))}),g(E,"wrap",y=>`(function (exports, require, module, __filename, __dirname) { ${y}
34
+ });`),g(E,"wrapper",["(function (exports, require, module, __filename, __dirname) { ",`
35
+ });`]),g(E,"syncBuiltinESMExports",()=>{}),g(E,"register",()=>{}),g(E,"findSourceMap",()=>{}),g(E,"runMain",()=>{});let l=E;function u(b){return y=>{let C=y.startsWith("file:")?decodeURIComponent(new URL(y).pathname):y,p;try{p=l._resolveFilename(C,b,!1,{conditions:br})}catch(A){if(A.code!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw A;p=l._resolveFilename(C,b,!1,{conditions:Mn})}return h(p,b,!1)}}function f(b,y){let C=u(b),p=[];for(let[,A]of y.matchAll(/__bfwc_import\(("(?:[^"\\]|\\.)*")\)/g))if(A)try{let m=C(JSON.parse(A));m.__tla&&p.push(m.__tla)}catch{}return p}function d(b,y){let C=u(b),p=S=>c(C(S).exports),A={url:"file://"+y,filename:y,dirname:M(y),resolve:S=>{let I=l._resolveFilename(S,b,!1,{conditions:Mn});return I.startsWith("node:")?I:"file://"+I}};return[p,async S=>{let I=C(String(S));return I.__tla&&await I.__tla,c(I.exports)},A,(S,I)=>{Object.defineProperty(S,"__esModule",{value:!0}),Object.defineProperty(S,Ln,{value:!0});for(let[x,_]of Object.entries(I))Object.defineProperty(S,x,{enumerable:!0,configurable:!0,get:_})},(S,I)=>{for(let x of Object.keys(I))x==="default"||x==="__esModule"||Object.prototype.hasOwnProperty.call(S,x)||Object.defineProperty(S,x,{enumerable:!0,configurable:!0,get:()=>I[x]})},(S,I)=>{try{return S[I]}catch{return}}]}function h(b,y,C){if(b.startsWith("node:")){let m=b.slice(5);return{exports:m==="module"?l:t.builtin(m)}}let p=r[b];if(p)return y&&!y.children.includes(p)&&y.children.push(p),p;let A=new l(b,y??null);C&&(o=A,A.id="."),r[b]=A;try{(l._extensions[Et(b)]??l._extensions[".js"])(A,b)}catch(m){throw delete r[b],m}return A.loaded=!0,A}function w(b){let y=p=>b.require(p),C=(p,A)=>{let m=l._resolveFilename(p,b,!1,A);return m.startsWith("node:")&&!p.startsWith("node:")?p:m};return C.paths=p=>t.isBuiltin(p)?null:vr(b.path),y.resolve=C,y.cache=r,y.extensions=l._extensions,Object.defineProperty(y,"main",{get:()=>o,enumerable:!0}),y}return{Module:l,cache:r,runMain(b){return h(b,void 0,!0)},get main(){return o},createRequire:l.createRequire,resolve(b,y){return Cr(e,b,y,{conditions:br,isBuiltin:t.isBuiltin})}}}var Pn=globalThis.setTimeout.bind(globalThis),el=globalThis.clearTimeout.bind(globalThis),tl=globalThis.setInterval.bind(globalThis),rl=globalThis.clearInterval.bind(globalThis),nl=1,jn=class{constructor(e,r,n,s,i){g(this,"loop");g(this,"_onTimeout");g(this,"_idleTimeout");g(this,"args");g(this,"_repeat");g(this,"_id",nl++);g(this,"_ref",!0);g(this,"_handle");g(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))}},Qr=class{constructor(e){g(this,"options");g(this,"holds",0);g(this,"timers",new Map);g(this,"refTimers",0);g(this,"checkScheduled",!1);g(this,"stopped",!1);g(this,"setTimeout",(e,r,...n)=>this.add(e,r,n,!1));g(this,"setInterval",(e,r,...n)=>this.add(e,r,n,!0));g(this,"setImmediate",(e,...r)=>this.add(e,0,r,!1));g(this,"clearTimeout",e=>this.clear(e));g(this,"clearInterval",e=>this.clear(e));g(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,Pn(()=>{Pn(()=>{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=tl(()=>e._fire(),Math.max(1,r)):e._handle=Pn(()=>{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 jn(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?rl(e._handle):el(e._handle),e._handle=void 0)}};var At="20.18.0";var sl=100,Br=class extends ne{constructor(r,n,s){super({decodeStrings:!1});g(this,"sink");g(this,"isTTY");g(this,"fd");g(this,"columns");g(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"&&N(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}},Kn=class extends V{constructor(r,n){super();g(this,"io");g(this,"loop");g(this,"isTTY");g(this,"isRaw",!1);g(this,"fd",0);g(this,"subscription");g(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 mo(t){let{io:e,loop:r,fs:n}=t,s=O(t.cwd),i=!1,o=!1,a=performance.now(),c=new L,l=sl++,u=h=>{if(!o){if(h!==void 0&&(c.exitCode=h),!i){i=!0;let w=Number(c.exitCode??0)||0;try{c.emit("exit",w)}catch{}o=!0,t.onExit(Number(c.exitCode??w)||0)}throw new Ue(Number(c.exitCode??0)||0)}},f=h=>{let w=performance.now(),E=Math.floor(w/1e3),b=Math.floor(w%1e3*1e6);return h&&(E-=h[0],b-=h[1],b<0&&(E--,b+=1e9)),[E,b]};f.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${At}`,versions:{node:At,v8:"11.3.244.8-node.23",uv:"1.48.0",zlib:"1.3.0.1",modules:"115",napi:"9",unicode:"15.1",webcontainer:At},release:{name:"node",lts:"Iron"},platform:"linux",arch:"x64",pid:l,ppid:l-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 Br(1,e.stdout,e.terminal),stderr:new Br(2,e.stderr,e.terminal),stdin:new Kn(e,r),cwd:()=>s,chdir(h){let w=h.startsWith("/")?O(h):k(s,h);if(!n.isDirectory(w))throw R(n.isFile(w)?"ENOTDIR":"ENOENT","chdir",w);s=w},exit:u,reallyExit:u,abort:()=>u(134),kill(h,w="SIGTERM"){if(h!==l)throw Object.assign(new Error("kill ESRCH"),{code:"ESRCH"});return c.listenerCount(String(w))?c.emit(String(w),String(w)):u(143),!0},nextTick(h,...w){queueMicrotask(()=>r._run(()=>h(...w)))},hrtime:f,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,w){let E=typeof w=="string"?w:w?.type??(h instanceof Error?h.name:"Warning"),b=h instanceof Error?h.message:h;c.emit("warning",Object.assign(new Error(b),{name:E})),e.stderr(`(node:${l}) ${E}: ${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 wo(t){let e=c=>(...l)=>t[c].write(xe(...l)+`
37
+ `),r=new Map,n=new Map,s="",i=c=>(...l)=>s?c(s+xe(...l).replace(/\n/g,`
38
+ `+s)):c(...l),o=i(e("stdout")),a=i(e("stderr"));return{log:o,info:o,debug:o,warn:a,error:a,trace:(...c)=>a(`Trace: ${xe(...c)}
38
39
  ${new Error().stack?.split(`
39
40
  `).slice(2).join(`
40
- `)??""}`),dir:c=>o(c),dirxml:o,table:c=>o(c),assert:(c,...f)=>{c||a("Assertion failed"+(f.length?`: ${Se(...f)}`:""))},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",...f)=>o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`,...f),timeEnd:(c="default")=>{o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`),n.delete(c)},clear:()=>{},profile:()=>{},profileEnd:()=>{},timeStamp:()=>{}}}var _c={SIGINT:130,SIGTERM:143,SIGKILL:137,SIGHUP:129};async function Xi(t){await Pi;let{system:e,io:r}=t,n,s=new Promise(v=>n=v),i=!1,o=new Set,a={...e,listen(v,A,b){let y=e.listen(v,A,b),B={port:y.port,close(){o.delete(B),y.close()}};return o.add(B),B}},c=v=>{if(!i){i=!0,u.stop();for(let A of[...o])A.close();n(v)}},f=v=>{if(v instanceof lt||i)return;if(d.listenerCount("uncaughtException"))try{d.emit("uncaughtException",v,"uncaughtException");return}catch(b){v=b}let A=v instanceof Error?v.stack??`${v.name}: ${v.message}`:`Uncaught ${K(v)}`;r.stderr(`${A}
41
+ `)??""}`),dir:c=>o(c),dirxml:o,table:c=>o(c),assert:(c,...l)=>{c||a("Assertion failed"+(l.length?`: ${xe(...l)}`:""))},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",...l)=>o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`,...l),timeEnd:(c="default")=>{o(`${c}: ${(performance.now()-(n.get(c)??0)).toFixed(3)}ms`),n.delete(c)},clear:()=>{},profile:()=>{},profileEnd:()=>{},timeStamp:()=>{}}}function yo(t,e){if(ol(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}
42
+ ) {
43
+ ${s}
44
+ }; }`)(t)};return new Proxy(Function,{apply:(r,n,s)=>e(s),construct:(r,n)=>e(n)})}function ol(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 al={SIGINT:130,SIGTERM:143,SIGKILL:137,SIGHUP:129};async function Eo(t){await io;let{system:e}=t,r={...t.io,stdout:p=>i||t.io.stdout(p),stderr:p=>i||t.io.stderr(p)},n,s=new Promise(p=>n=p),i=!1,o=new Set,a={...e,listen(p,A,m){let Q=e.listen(p,A,m),B={port:Q.port,close(){o.delete(B),Q.close()}};return o.add(B),B}},c=p=>{if(!i){i=!0,f.stop();for(let A of[...o])A.close();n(p)}},l=p=>{if(!(p instanceof Ue||i)){if(d.listenerCount("uncaughtException"))try{d.emit("uncaughtException",p,"uncaughtException");return}catch(A){p=A}if(t.thread&&t.ipc?.connected)t.ipc.send(pi(p));else{let A=p instanceof Error?p.stack??`${p.name}: ${p.message}`:`Uncaught ${G(p)}`;r.stderr(`${A}
41
45
 
42
46
  Node.js v${d.versions.node}
43
- `),l(d.exitCode&&d.exitCode!==0?d.exitCode:1)},l=v=>{try{d.exit(v)}catch(A){if(!(A instanceof lt))throw A}},u=new Er({onIdle(){if(!i){try{d.emit("beforeExit",Number(d.exitCode??0))}catch(v){f(v)}u.alive||l()}},onError:f}),d=Vi({argv:["/usr/local/bin/node",...t.argv],env:t.env,cwd:t.cwd,fs:e.fs,io:r,loop:u,onExit:c}),h=Zi(d),g=Mi({fs:e.fs,process:d,loop:u,system:a,io:r,console:h}),m={process:d,Buffer:D,console:h,setTimeout:u.setTimeout,setInterval:u.setInterval,setImmediate:u.setImmediate,clearTimeout:u.clearTimeout,clearInterval:u.clearInterval,clearImmediate:u.clearImmediate,fetch:g.fetch};t.installGlobals?(Object.assign(globalThis,m,{global:globalThis}),m.global=globalThis):m.global=Object.assign(Object.create(globalThis),m),m.globalThis=m.global;let w=Yi({fs:e.fs,isBuiltin:g.isBuiltin,builtin:g.get,globals:m});return w.Module.builtinModules=g.names,Object.defineProperty(d,"mainModule",{get:()=>w.main,configurable:!0}),{process:d,modules:w,exit:s,run:v=>{if(!i){try{let A=v();A instanceof Promise&&A.catch(f).finally(()=>u.scheduleCheck())}catch(A){f(A)}u.scheduleCheck()}},kill(v="SIGTERM"){if(!i){if(v!=="SIGKILL"&&d.listenerCount(v)){u._run(()=>d.emit(v,v));return}c(_c[v]??1)}},reportUncaught:f,hold:()=>u.hold()}}var Tc=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--input-type","--title","--env-file","--stack-size"]);function $c(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()):Tc.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 Lc=`Usage: node [options] [ script.js ] [arguments]
47
+ `)}u(d.exitCode&&d.exitCode!==0?d.exitCode:1)}},u=p=>{try{d.exit(p)}catch(A){if(!(A instanceof Ue))throw A}},f=new Qr({onIdle(){if(!i){try{d.emit("beforeExit",Number(d.exitCode??0))}catch(p){l(p)}f.alive||u()}},onError:l}),d=mo({argv:["/usr/local/bin/node",...t.argv],env:t.env,cwd:t.cwd,fs:e.fs,io:r,loop:f,onExit:c});t.ipc&&!t.thread&&li(d,t.ipc,f);let h=wo(d),w=ro({fs:e.fs,process:d,loop:f,system:a,io:r,console:h,thread:t.thread,ipc:t.ipc}),E={process:d,Buffer:D,console:h,setTimeout:f.setTimeout,setInterval:f.setInterval,setImmediate:f.setImmediate,clearTimeout:f.clearTimeout,clearInterval:f.clearInterval,clearImmediate:f.clearImmediate,fetch:w.fetch},b=yo(E,!!t.installGlobals),y=go({fs:e.fs,isBuiltin:w.isBuiltin,builtin:w.get,globals:E,scope:b});return y.Module.builtinModules=w.names,Object.defineProperty(d,"mainModule",{get:()=>y.main,configurable:!0}),{process:d,modules:y,exit:s,run:p=>{if(!i){try{let A=p();A instanceof Promise&&A.catch(l).finally(()=>f.scheduleCheck())}catch(A){l(A)}f.scheduleCheck()}},kill(p="SIGTERM"){if(!i){if(p!=="SIGKILL"&&d.listenerCount(p)){f._run(()=>d.emit(p,p));return}c(al[p]??1)}},reportUncaught:l,hold:()=>f.hold()}}var cl=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--input-type","--title","--env-file","--stack-size"]);function ll(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()):cl.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 fl=`Usage: node [options] [ script.js ] [arguments]
44
48
  node -e "script" evaluate script
45
49
  node -p "expr" evaluate and print
46
50
  Options: -v, -r <module>, --env-file=<file>. Running in BuilderForce WebContainers.
47
- `;async function Mc(t){let e="";return await new Promise(r=>{let n=t.io.onStdin(s=>{s===null?(n(),r()):e+=s})}),e}function Fc(t,e){let{io:r}=e,n=eo(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${Ot}.
51
+ `;async function ul(t){let e="";return await new Promise(r=>{let n=t.io.onStdin(ie(s=>{s===null?(n(),r()):e+=s}))}),e}function dl(t,e){let{io:r}=e,n=bo(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${At}.
48
52
  Type ".exit" to leave.
49
- > `);let i=()=>{o(),s(),t.run(()=>t.process.exit(0))},o=r.onStdin(a=>{if(a===null)return i();for(let c of a.split(/\r?\n/)){let f=c.trim();if(!f)continue;if(f===".exit")return i();let l=n.next(f.replace(/^(const|let)\s/,"var ")).value;"error"in l?r.stdout(`Uncaught ${l.error instanceof Error?l.error.stack??l.error.message:K(l.error)}
50
- `):r.stdout(K(l.value,{colors:!1})+`
51
- `)}r.stdout("> ")})}function eo(t,e,r,n){let s=I(e,r);return new t.modules.Module(s)._compile(`return eval(${JSON.stringify(n)});`,s)}var to=async t=>{let e=$c(t.args);if(e.version)return t.io.stdout(`v${Ot}
52
- `),0;if(e.help)return t.io.stdout(Lc),0;let r={...t.env};for(let l of e.envFiles){let u=t.system.fs.readText(I(t.cwd,l));if(u===void 0)return t.io.stderr(`node: ${l}: not found
53
- `),9;Object.assign(r,hs(u))}let n;e.entry!==void 0&&e.entry!=="-"&&(n=e.entry.startsWith("/")?e.entry:I(t.cwd,e.entry),n=qt(t.system.fs,n)??n);let s=e.evaluate??(e.entry==="-"||!n&&!t.io.terminal?await Mc(t):void 0),i=n??(s!==void 0?"[eval]":void 0),o=await Xi({system:t.system,io:t.io,cwd:t.cwd,env:r,installGlobals:t.system.ownsRealm,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?.(l=>o.reportUncaught(l));o.run(()=>{let l=o.modules.createRequire(I(t.cwd,"[eval]"));for(let u of e.preload)l(u.startsWith(".")?I(t.cwd,u):u);if(n){let u;try{u=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(u).__tla}if(s!==void 0){let u=eo(o,t.cwd,"[eval]",s);e.print&&o.process.stdout.write(K(u)+`
54
- `);return}Fc(o,t)});let f=await o.exit;return t.signal.removeEventListener("abort",a),c?.(),f};var F=class extends Error{constructor(r,n=!1){super(r);p(this,"incomplete");this.incomplete=n}},Uc=["2>&1",">&2","2>>","<<-","&&","||",";;",">>","<<","2>","&>","|","&",";",">","<","(",")",`
55
- `],Pc=/^[?$#@*!0-9]/,jc=/[;|&<>()]/;function Kc(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 F("unexpected end of input: missing )",!0)}function $n(t,e,r){let n=t[e+1];if(n==="("){let i=Kc(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 F("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 F(`bad substitution: \${${o}}`);let c={kind:"var",name:a[1],quoted:r};return a[2]&&(c.op=a[2],c.arg=Hc(a[3]??"",r)),[c,i+1]}if(n&&Pc.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 Hc(t,e){let r=Cr(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 Jc(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]!==`
56
- `&&(r+=t[s+1]),s+=2;else if(i==="$"){n();let[o,a]=$n(t,s,!0);e.push(o),s=a}else if(i==="`"){n();let o=t.indexOf("`",s+1);if(o<0)throw new F("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 Wc(t,e,r){for(let n of r){let s=[];for(;;){if(e>=t.length)throw new F(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);let o=t.indexOf(`
57
- `,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 F(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);s.push(a)}let i=s.map(o=>o+`
58
- `).join("");n.token.body=n.quoted?[{kind:"text",value:i,quoted:!0}]:Jc(i)}return r.length=0,e}function Cr(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]===`
53
+ > `);let i=()=>{o(),s(),t.run(()=>t.process.exit(0))},o=r.onStdin(ie(a=>{if(a===null)return i();for(let c of a.split(/\r?\n/)){let l=c.trim();if(!l)continue;if(l===".exit")return i();let u=n.next(l.replace(/^(const|let)\s/,"var ")).value;"error"in u?r.stdout(`Uncaught ${u.error instanceof Error?u.error.stack??u.error.message:G(u.error)}
54
+ `):r.stdout(G(u.value,{colors:!1})+`
55
+ `)}r.stdout("> ")}))}function bo(t,e,r,n){let s=k(e,r);return new t.modules.Module(s)._compile(`return eval(${JSON.stringify(n)});`,s)}var Co=async t=>{let e=ll(t.args);if(e.version)return t.io.stdout(`v${At}
56
+ `),0;if(e.help)return t.io.stdout(fl),0;let r={...t.env};for(let u of e.envFiles){let f=t.system.fs.readText(k(t.cwd,u));if(f===void 0)return t.io.stderr(`node: ${u}: not found
57
+ `),9;Object.assign(r,bs(f))}let n;e.entry!==void 0&&e.entry!=="-"&&(n=e.entry.startsWith("/")?e.entry:k(t.cwd,e.entry),n=Xt(t.system.fs,n)??n);let s=e.evaluate??(e.entry==="-"||!n&&!t.io.terminal?await ul(t):void 0),i=n??(s!==void 0?"[eval]":void 0),o=await Eo({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?.(u=>o.reportUncaught(u));o.run(()=>{let u=o.modules.createRequire(k(t.cwd,"[eval]"));for(let f of e.preload)u(f.startsWith(".")?k(t.cwd,f):f);if(n){let f;try{f=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(f).__tla}if(s!==void 0){let f=bo(o,t.cwd,"[eval]",s);e.print&&o.process.stdout.write(G(f)+`
58
+ `);return}dl(o,t)});let l=await o.exit;return t.signal.removeEventListener("abort",a),c?.(),l};var j=class extends Error{constructor(r,n=!1){super(r);g(this,"incomplete");this.incomplete=n}},hl=["2>&1",">&2","2>>","<<-","&&","||",";;",">>","<<","2>","&>","|","&",";",">","<","(",")",`
59
+ `],pl=/^[?$#@*!0-9]/,Al=/[;|&<>()]/;function gl(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 j("unexpected end of input: missing )",!0)}function Hn(t,e,r){let n=t[e+1];if(n==="("){let i=gl(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 j("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 j(`bad substitution: \${${o}}`);let c={kind:"var",name:a[1],quoted:r};return a[2]&&(c.op=a[2],c.arg=ml(a[3]??"",r)),[c,i+1]}if(n&&pl.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 ml(t,e){let r=Ir(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 wl(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]=Hn(t,s,!0);e.push(o),s=a}else if(i==="`"){n();let o=t.indexOf("`",s+1);if(o<0)throw new j("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 yl(t,e,r){for(let n of r){let s=[];for(;;){if(e>=t.length)throw new j(`unexpected end of input: here-document delimited by ${n.delimiter}`,!0);let o=t.indexOf(`
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 j(`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}]:wl(i)}return r.length=0,e}function Ir(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]===`
59
63
  `){s+=2;continue}if(i==="#"){for(;s<t.length&&t[s]!==`
60
- `;)s++;continue}if(!e){let l=Uc.find(u=>t.startsWith(u,s));if(l){if(r.push({type:"op",op:l}),s+=l.length,l===`
61
- `&&n.length&&(s=Wc(t,s,n)),l==="<<"||l==="<<-"){for(;t[s]===" "||t[s]===" ";)s++;let u=s;for(;s<t.length&&!/[\s;|&<>()]/.test(t[s]);)s++;let d=t.slice(u,s);if(!d)throw new F("syntax error: here-document needs a delimiter");let h={type:"heredoc"};r.push(h),n.push({token:h,delimiter:d.replace(/["'\\]/g,""),strip:l==="<<-",quoted:/["'\\]/.test(d)})}continue}}let o=[],a=s,c="",f=()=>{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 l=t[s];if(/[\s]/.test(l)&&!e||!e&&jc.test(l))break;if(l==="\\")c+=t[s+1]??"",s+=2;else if(l==="'"){let u=t.indexOf("'",s+1);if(u<0)throw new F("unexpected end of input: unterminated quote",!0);f(),o.push({kind:"text",value:t.slice(s+1,u),quoted:!0}),s=u+1}else if(l==='"'){f(),s++;let u="",d=()=>{u&&o.push({kind:"text",value:u,quoted:!0}),u=""},h=!1;for(;s<t.length;){let g=t[s];if(g==='"'){h=!0,s++;break}if(g==="\\"&&/["\\$`\n]/.test(t[s+1]??""))u+=t[s+1],s+=2;else if(g==="$"){d();let[m,w]=$n(t,s,!0);o.push(m),s=w}else if(g==="`"){d();let m=t.indexOf("`",s+1);if(m<0)throw new F("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,m),quoted:!0}),s=m+1}else u+=g,s++}if(!h)throw new F("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(l==="$"){f();let[u,d]=$n(t,s,!1);o.push(u),s=d}else if(l==="`"){f();let u=t.indexOf("`",s+1);if(u<0)throw new F("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,u),quoted:!1}),s=u+1}else c+=l,s++}f(),r.push({type:"word",word:o,raw:t.slice(a,s)})}if(n.length)throw new F(`unexpected end of input: here-document delimited by ${n[0].delimiter}`,!0);return r}var qc=/^([A-Za-z_]\w*)=/,ro=/^[A-Za-z_][\w-]*$/,no=new Set([">",">>","<","2>","2>>","&>","2>&1",">&2","<<","<<-"]),zc=new Set(["then","elif","else","fi","do","done","esac","}"]);function vr(t){let e=Cr(t),r=0,n=()=>e[r],s=C=>{let Q=e[r];return Q?.type==="op"&&Q.op===C},i=(C,Q=r)=>{let k=e[Q];return k?.type==="word"&&k.raw===C},o=C=>C?C.type==="op"?`\`${C.op.replace(`
62
- `,"newline")}'`:C.type==="word"?`\`${C.raw}'`:"here-document":"end of input",a=C=>{throw new F(C?`syntax error near unexpected token ${o(C)}`:"unexpected end of input",!C)},c=()=>{for(;s(`
63
- `);)r++},f=()=>{for(;s(`
64
- `)||s(";");)r++},l=C=>{f(),i(C)||a(n()),r++},u=C=>{let Q=n();if(Q?.type!=="op"||!no.has(Q.op))return!1;if(r++,Q.op==="2>&1"||Q.op===">&2")return C.redirects.push({op:Q.op}),!0;let k=n();return Q.op==="<<"||Q.op==="<<-"?((k?.type!=="heredoc"||!k.body)&&a(k),r++,C.redirects.push({op:Q.op,heredoc:{body:k.body}}),!0):(k?.type!=="word"&&a(k),r++,C.redirects.push({op:Q.op,target:k.word}),!0)},d=()=>{let C={type:"simple",assignments:[],words:[],redirects:[]};for(;;){let Q=n();if(!Q||Q.type==="heredoc")break;if(Q.type==="op"){if(!u(C))break;continue}r++;let k=Q.word[0],x=!C.words.length&&k?.kind==="text"&&!k.quoted?qc.exec(k.value):null;if(x){let R=k.kind==="text"?k.value.slice(x[0].length):"";C.assignments.push({name:x[1],value:[...R?[{kind:"text",value:R,quoted:!1}]:[],...Q.word.slice(1)]})}else C.words.push(Q.word)}return C},h=(C,Q=new Set)=>{let k=[];for(;;){f();let x=n();if(x||a(x),x.type==="word"&&C.has(x.raw)||x.type==="op"&&Q.has(x.op))return k;k.push(B()),s("&")&&(k[k.length-1].background=!0,r++)}},g=()=>{r++;let C=[],Q,k=h(new Set(["then"]));for(l("then"),C.push({condition:k,body:h(new Set(["elif","else","fi"]))});;)if(i("elif")){r++;let x=h(new Set(["then"]));l("then"),C.push({condition:x,body:h(new Set(["elif","else","fi"]))})}else if(i("else"))r++,Q=h(new Set(["fi"]));else break;return l("fi"),{type:"if",clauses:C,otherwise:Q,redirects:[]}},m=()=>{l("do");let C=h(new Set(["done"]));return l("done"),C},w=C=>{r++;let Q=h(new Set(["do"]));return{type:C,condition:Q,body:m(),redirects:[]}},E=()=>{r++;let C=n();(C?.type!=="word"||!ro.test(C.raw))&&a(C);let Q=C.raw;r++,c();let k;if(i("in"))for(r++,k=[];n()?.type==="word";)k.push(e[r++].word);return{type:"for",name:Q,items:k,body:m(),redirects:[]}},v=()=>{r++;let C=n();C?.type!=="word"&&a(C),r++,c(),i("in")||a(n()),r++;let Q=[];for(;f(),!i("esac");){s("(")&&r++;let k=[];for(;;){let R=n();if(R?.type!=="word"&&a(R),k.push(R.word),r++,s("|"))r++;else break}s(")")||a(n()),r++;let x=h(new Set(["esac"]),new Set([";;"]));Q.push({patterns:k,body:x}),s(";;")&&r++}return r++,{type:"case",subject:C.word,arms:Q,redirects:[]}},A=()=>{let C;if(i("if"))C=g();else if(i("while"))C=w("while");else if(i("until"))C=w("until");else if(i("for"))C=E();else if(i("case"))C=v();else if(i("{")){r++;let Q=h(new Set(["}"]));r++,C={type:"group",body:Q,redirects:[]}}else if(s("(")){r++;let Q=h(new Set,new Set([")"]));r++,C={type:"subshell",body:Q,redirects:[]}}if(C)for(;u(C););return C},b=()=>{let C=n();C?.type==="word"&&zc.has(C.raw)&&a(C);let Q=A();if(Q)return Q;let k=i("function")?1:0,x=e[r+k];if(x?.type==="word"&&ro.test(x.raw)){let R=e[r+k+1]?.type==="op"&&e[r+k+1].op==="(";if(k||R){r+=k+1,R&&(r++,s(")")||a(n()),r++),c();let Y=A();return Y||a(n()),{type:"function",name:x.raw,body:Y,redirects:[]}}}return d()},y=()=>{let C=!1;i("!")&&(C=!0,r++);let Q=[b()];for(;s("|");){if(r++,c(),!n())throw new F("unexpected end of input after |",!0);Q.push(b())}for(let k of Q)k.type==="simple"&&!k.words.length&&!k.assignments.length&&!k.redirects.length&&a(n()??{type:"op",op:"|"});return{negate:C,commands:Q}},B=()=>{let C=n();C.type==="op"&&!no.has(C.op)&&C.op!=="("&&a(C);let Q={first:y(),rest:[],background:!1};for(;s("&&")||s("||");){let k=e[r].op;if(r++,c(),!n())throw new F(`unexpected end of input after ${k}`,!0);Q.rest.push({op:k,pipeline:y()})}return Q},S=[];for(;r<e.length;){if(s(";")||s(`
65
- `)){r++;continue}S.push(B()),s("&")&&(S[S.length-1].background=!0,r++)}return S}async function Gc(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 ft(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 Ln=/[*?[]/;function Mn(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 Fn(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 f=c?c.startsWith("/")?c:I(e,c):e;if(!Ln.test(o)){let u=c?c.endsWith("/")?c+o:`${c}/${o}`:o;t.exists(u.startsWith("/")?u:I(e,u))&&a.push(u);continue}let l=Mn(o);for(let u of t.readdir(O(f)))u.startsWith(".")&&!o.startsWith(".")||l.test(u)&&a.push(c?c.endsWith("/")?c+u:`${c}/${u}`:u)}i=a}return i.sort()}async function ft(t,e,r={}){let n=r.split??!0,s=[""],i=!1,o=!1,a=f=>{s[s.length-1]+=f};for(let f of t){if(f.kind==="tilde"){a(e.get("HOME")??"/home/user"),i=!0;continue}if(f.kind==="text"){a(f.value),(f.quoted||f.value)&&(i=!0),!f.quoted&&Ln.test(f.value)&&(o=!0);continue}let l=f.kind==="var"?await Gc(f,e):(await e.substitute(f.source)).replace(/\n+$/,"");if(f.quoted||!n){a(l),i=!0;continue}l.split(/[ \t\n]+/).forEach((d,h)=>{h>0&&(s[s.length-1]||i)&&s.push(""),d&&(a(d),i=!0)})}let c=s.filter((f,l)=>f!==""||i&&l===s.length-1&&s.length===1);return!i&&c.every(f=>!f)?[]:r.glob===!1||!o?c:c.flatMap(f=>{if(!Ln.test(f))return[f];let l=Fn(e.fs,e.cwd,f);return l.length?l:[f]})}async function Un(t,e){let r=[];for(let n of t)r.push(...await ft(n,e));return r}function J(t,e){return e==="~"||e.startsWith("~/")?I(t.env.HOME??"/home/user",e.slice(1)):e.startsWith("/")?O(e):I(t.cwd,e)}function ce(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 so(t,e){return async r=>{let n=new ne,s=r.io.onStdin(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 Yc=new TextEncoder,Vc=(t,e)=>{let r=t.readFile(e);return r===void 0?4096:typeof r=="string"?Yc.encode(r).length:r.length},Zc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Xc(t){let e=new Date(t);return`${Zc[e.getMonth()]} ${String(e.getDate()).padStart(2)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}var io=async t=>{let{flags:e,operands:r}=ce(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=(l,u)=>t.io.isTerminal&&u?`\x1B[1;34m${l}\x1B[0m`:l,f=(l,u)=>{if(s){let h=u.map(g=>{let m=g==="."?l:g===".."?L(l):I(l,g),w=t.fs.isDirectory(m),E=w?4096:Vc(t.fs,m);return`${w?"drwxr-xr-x":"-rw-r--r--"} 1 user user ${String(E).padStart(8)} ${Xc(t.fs.mtime(m)??Date.now())} ${c(g,w)}`});return h.length?`total ${u.length}
64
+ `;)s++;continue}if(!e){let u=hl.find(f=>t.startsWith(f,s));if(u){if(r.push({type:"op",op:u}),s+=u.length,u===`
65
+ `&&n.length&&(s=yl(t,s,n)),u==="<<"||u==="<<-"){for(;t[s]===" "||t[s]===" ";)s++;let f=s;for(;s<t.length&&!/[\s;|&<>()]/.test(t[s]);)s++;let d=t.slice(f,s);if(!d)throw new j("syntax error: here-document needs a delimiter");let h={type:"heredoc"};r.push(h),n.push({token:h,delimiter:d.replace(/["'\\]/g,""),strip:u==="<<-",quoted:/["'\\]/.test(d)})}continue}}let o=[],a=s,c="",l=()=>{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 u=t[s];if(/[\s]/.test(u)&&!e||!e&&Al.test(u))break;if(u==="\\")c+=t[s+1]??"",s+=2;else if(u==="'"){let f=t.indexOf("'",s+1);if(f<0)throw new j("unexpected end of input: unterminated quote",!0);l(),o.push({kind:"text",value:t.slice(s+1,f),quoted:!0}),s=f+1}else if(u==='"'){l(),s++;let f="",d=()=>{f&&o.push({kind:"text",value:f,quoted:!0}),f=""},h=!1;for(;s<t.length;){let w=t[s];if(w==='"'){h=!0,s++;break}if(w==="\\"&&/["\\$`\n]/.test(t[s+1]??""))f+=t[s+1],s+=2;else if(w==="$"){d();let[E,b]=Hn(t,s,!0);o.push(E),s=b}else if(w==="`"){d();let E=t.indexOf("`",s+1);if(E<0)throw new j("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,E),quoted:!0}),s=E+1}else f+=w,s++}if(!h)throw new j("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(u==="$"){l();let[f,d]=Hn(t,s,!1);o.push(f),s=d}else if(u==="`"){l();let f=t.indexOf("`",s+1);if(f<0)throw new j("unexpected end of input: unterminated `",!0);o.push({kind:"cmd",source:t.slice(s+1,f),quoted:!1}),s=f+1}else c+=u,s++}l(),r.push({type:"word",word:o,raw:t.slice(a,s)})}if(n.length)throw new j(`unexpected end of input: here-document delimited by ${n[0].delimiter}`,!0);return r}var El=/^([A-Za-z_]\w*)=/,vo=/^[A-Za-z_][\w-]*$/,So=new Set([">",">>","<","2>","2>>","&>","2>&1",">&2","<<","<<-"]),bl=new Set(["then","elif","else","fi","do","done","esac","}"]);function kr(t){let e=Ir(t),r=0,n=()=>e[r],s=v=>{let S=e[r];return S?.type==="op"&&S.op===v},i=(v,S=r)=>{let I=e[S];return I?.type==="word"&&I.raw===v},o=v=>v?v.type==="op"?`\`${v.op.replace(`
66
+ `,"newline")}'`:v.type==="word"?`\`${v.raw}'`:"here-document":"end of input",a=v=>{throw new j(v?`syntax error near unexpected token ${o(v)}`:"unexpected end of input",!v)},c=()=>{for(;s(`
67
+ `);)r++},l=()=>{for(;s(`
68
+ `)||s(";");)r++},u=v=>{l(),i(v)||a(n()),r++},f=v=>{let S=n();if(S?.type!=="op"||!So.has(S.op))return!1;if(r++,S.op==="2>&1"||S.op===">&2")return v.redirects.push({op:S.op}),!0;let I=n();return S.op==="<<"||S.op==="<<-"?((I?.type!=="heredoc"||!I.body)&&a(I),r++,v.redirects.push({op:S.op,heredoc:{body:I.body}}),!0):(I?.type!=="word"&&a(I),r++,v.redirects.push({op:S.op,target:I.word}),!0)},d=()=>{let v={type:"simple",assignments:[],words:[],redirects:[]};for(;;){let S=n();if(!S||S.type==="heredoc")break;if(S.type==="op"){if(!f(v))break;continue}r++;let I=S.word[0],x=!v.words.length&&I?.kind==="text"&&!I.quoted?El.exec(I.value):null;if(x){let _=I.kind==="text"?I.value.slice(x[0].length):"";v.assignments.push({name:x[1],value:[..._?[{kind:"text",value:_,quoted:!1}]:[],...S.word.slice(1)]})}else v.words.push(S.word)}return v},h=(v,S=new Set)=>{let I=[];for(;;){l();let x=n();if(x||a(x),x.type==="word"&&v.has(x.raw)||x.type==="op"&&S.has(x.op))return I;I.push(Q()),s("&")&&(I[I.length-1].background=!0,r++)}},w=()=>{r++;let v=[],S,I=h(new Set(["then"]));for(u("then"),v.push({condition:I,body:h(new Set(["elif","else","fi"]))});;)if(i("elif")){r++;let x=h(new Set(["then"]));u("then"),v.push({condition:x,body:h(new Set(["elif","else","fi"]))})}else if(i("else"))r++,S=h(new Set(["fi"]));else break;return u("fi"),{type:"if",clauses:v,otherwise:S,redirects:[]}},E=()=>{u("do");let v=h(new Set(["done"]));return u("done"),v},b=v=>{r++;let S=h(new Set(["do"]));return{type:v,condition:S,body:E(),redirects:[]}},y=()=>{r++;let v=n();(v?.type!=="word"||!vo.test(v.raw))&&a(v);let S=v.raw;r++,c();let I;if(i("in"))for(r++,I=[];n()?.type==="word";)I.push(e[r++].word);return{type:"for",name:S,items:I,body:E(),redirects:[]}},C=()=>{r++;let v=n();v?.type!=="word"&&a(v),r++,c(),i("in")||a(n()),r++;let S=[];for(;l(),!i("esac");){s("(")&&r++;let I=[];for(;;){let _=n();if(_?.type!=="word"&&a(_),I.push(_.word),r++,s("|"))r++;else break}s(")")||a(n()),r++;let x=h(new Set(["esac"]),new Set([";;"]));S.push({patterns:I,body:x}),s(";;")&&r++}return r++,{type:"case",subject:v.word,arms:S,redirects:[]}},p=()=>{let v;if(i("if"))v=w();else if(i("while"))v=b("while");else if(i("until"))v=b("until");else if(i("for"))v=y();else if(i("case"))v=C();else if(i("{")){r++;let S=h(new Set(["}"]));r++,v={type:"group",body:S,redirects:[]}}else if(s("(")){r++;let S=h(new Set,new Set([")"]));r++,v={type:"subshell",body:S,redirects:[]}}if(v)for(;f(v););return v},A=()=>{let v=n();v?.type==="word"&&bl.has(v.raw)&&a(v);let S=p();if(S)return S;let I=i("function")?1:0,x=e[r+I];if(x?.type==="word"&&vo.test(x.raw)){let _=e[r+I+1]?.type==="op"&&e[r+I+1].op==="(";if(I||_){r+=I+1,_&&(r++,s(")")||a(n()),r++),c();let T=p();return T||a(n()),{type:"function",name:x.raw,body:T,redirects:[]}}}return d()},m=()=>{let v=!1;i("!")&&(v=!0,r++);let S=[A()];for(;s("|");){if(r++,c(),!n())throw new j("unexpected end of input after |",!0);S.push(A())}for(let I of S)I.type==="simple"&&!I.words.length&&!I.assignments.length&&!I.redirects.length&&a(n()??{type:"op",op:"|"});return{negate:v,commands:S}},Q=()=>{let v=n();v.type==="op"&&!So.has(v.op)&&v.op!=="("&&a(v);let S={first:m(),rest:[],background:!1};for(;s("&&")||s("||");){let I=e[r].op;if(r++,c(),!n())throw new j(`unexpected end of input after ${I}`,!0);S.rest.push({op:I,pipeline:m()})}return S},B=[];for(;r<e.length;){if(s(";")||s(`
69
+ `)){r++;continue}B.push(Q()),s("&")&&(B[B.length-1].background=!0,r++)}return B}async function Cl(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 gt(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 Wn=/[*?[]/;function Jn(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 qn(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 l=c?c.startsWith("/")?c:k(e,c):e;if(!Wn.test(o)){let f=c?c.endsWith("/")?c+o:`${c}/${o}`:o;t.exists(f.startsWith("/")?f:k(e,f))&&a.push(f);continue}let u=Jn(o);for(let f of t.readdir(O(l)))f.startsWith(".")&&!o.startsWith(".")||u.test(f)&&a.push(c?c.endsWith("/")?c+f:`${c}/${f}`:f)}i=a}return i.sort()}async function gt(t,e,r={}){let n=r.split??!0,s=[""],i=!1,o=!1,a=l=>{s[s.length-1]+=l};for(let l of t){if(l.kind==="tilde"){a(e.get("HOME")??"/home/user"),i=!0;continue}if(l.kind==="text"){a(l.value),(l.quoted||l.value)&&(i=!0),!l.quoted&&Wn.test(l.value)&&(o=!0);continue}let u=l.kind==="var"?await Cl(l,e):(await e.substitute(l.source)).replace(/\n+$/,"");if(l.quoted||!n){a(u),i=!0;continue}u.split(/[ \t\n]+/).forEach((d,h)=>{h>0&&(s[s.length-1]||i)&&s.push(""),d&&(a(d),i=!0)})}let c=s.filter((l,u)=>l!==""||i&&u===s.length-1&&s.length===1);return!i&&c.every(l=>!l)?[]:r.glob===!1||!o?c:c.flatMap(l=>{if(!Wn.test(l))return[l];let u=qn(e.fs,e.cwd,l);return u.length?u:[l]})}async function zn(t,e){let r=[];for(let n of t)r.push(...await gt(n,e));return r}function Z(t,e){return e==="~"||e.startsWith("~/")?k(t.env.HOME??"/home/user",e.slice(1)):e.startsWith("/")?O(e):k(t.cwd,e)}function he(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 Qo(t,e){return async r=>{let n=new se,s=r.io.onStdin(ie(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 vl=new TextEncoder,Sl=(t,e)=>{let r=t.readFile(e);return r===void 0?4096:typeof r=="string"?vl.encode(r).length:r.length},Ql=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Bl(t){let e=new Date(t);return`${Ql[e.getMonth()]} ${String(e.getDate()).padStart(2)} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}var Bo=async t=>{let{flags:e,operands:r}=he(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=(u,f)=>t.io.isTerminal&&f?`\x1B[1;34m${u}\x1B[0m`:u,l=(u,f)=>{if(s){let h=f.map(w=>{let E=w==="."?u:w===".."?M(u):k(u,w),b=t.fs.isDirectory(E),y=b?4096:Sl(t.fs,E);return`${b?"drwxr-xr-x":"-rw-r--r--"} 1 user user ${String(y).padStart(8)} ${Bl(t.fs.mtime(E)??Date.now())} ${c(w,b)}`});return h.length?`total ${f.length}
66
70
  ${h.join(`
67
71
  `)}
68
72
  `:`total 0
69
- `}let d=u.map(h=>c(h,t.fs.isDirectory(I(l,h))));return d.length?d.join(i?`
73
+ `}let d=f.map(h=>c(h,t.fs.isDirectory(k(u,h))));return d.length?d.join(i?`
70
74
  `:" ")+`
71
- `:""};for(let[l,u]of o.entries()){let d=J(t,u);if(t.fs.isFile(d)){t.io.stdout(f(L(d),[Ue(d)]).replace(Ue(d),u));continue}if(!t.fs.isDirectory(d)){t.io.stderr(`ls: cannot access '${u}': No such file or directory
72
- `),a=2;continue}let h=t.fs.readdir(d).filter(g=>n||!g.startsWith("."));e.has("a")&&(h=[".","..",...h]),o.length>1&&t.io.stdout(`${l?`
73
- `:""}${u}:
74
- `),t.io.stdout(f(d,h))}return a},oo=async t=>{let{operands:e}=ce(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=J(t,n);t.fs.isDirectory(s)?(t.io.stderr(`cat: ${n}: Is a directory
75
+ `:""};for(let[u,f]of o.entries()){let d=Z(t,f);if(t.fs.isFile(d)){t.io.stdout(l(M(d),[He(d)]).replace(He(d),f));continue}if(!t.fs.isDirectory(d)){t.io.stderr(`ls: cannot access '${f}': No such file or directory
76
+ `),a=2;continue}let h=t.fs.readdir(d).filter(w=>n||!w.startsWith("."));e.has("a")&&(h=[".","..",...h]),o.length>1&&t.io.stdout(`${u?`
77
+ `:""}${f}:
78
+ `),t.io.stdout(l(d,h))}return a},Io=async t=>{let{operands:e}=he(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=Z(t,n);t.fs.isDirectory(s)?(t.io.stderr(`cat: ${n}: Is a directory
75
79
  `),r=1):t.fs.isFile(s)?t.io.stdout(t.fs.readText(s)??""):(t.io.stderr(`cat: ${n}: No such file or directory
76
- `),r=1)}return r},ao=async t=>{let{flags:e,operands:r}=ce(t.args,["m"]);if(!r.length)return t.io.stderr(`mkdir: missing operand
77
- `),1;let n=0;for(let s of r){let i=J(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
78
- `),n=1}else!e.has("p")&&!t.fs.isDirectory(L(i))?(t.io.stderr(`mkdir: cannot create directory '${s}': No such file or directory
79
- `),n=1):t.fs.mkdir(i)}return n},co=async t=>{let{flags:e,operands:r}=ce(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
80
- `),1;let i=0;for(let o of r){let a=J(t,o);a==="/"?(t.io.stderr(`rm: it is dangerous to operate recursively on '/'
80
+ `),r=1)}return r},ko=async t=>{let{flags:e,operands:r}=he(t.args,["m"]);if(!r.length)return t.io.stderr(`mkdir: missing operand
81
+ `),1;let n=0;for(let s of r){let i=Z(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
+ `),n=1}else!e.has("p")&&!t.fs.isDirectory(M(i))?(t.io.stderr(`mkdir: cannot create directory '${s}': No such file or directory
83
+ `),n=1):t.fs.mkdir(i)}return n},xo=async t=>{let{flags:e,operands:r}=he(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
+ `),1;let i=0;for(let o of r){let a=Z(t,o);a==="/"?(t.io.stderr(`rm: it is dangerous to operate recursively on '/'
81
85
  `),i=1):t.fs.exists(a)?t.fs.isDirectory(a)&&!n?(t.io.stderr(`rm: cannot remove '${o}': Is a directory
82
86
  `),i=1):t.fs.rm(a):s||(t.io.stderr(`rm: cannot remove '${o}': No such file or directory
83
- `),i=1)}return i};function lo(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))lo(t,I(e,n),I(r,n))}function fo(t){return async e=>{let{flags:r,operands:n}=ce(e.args);if(n.length<2)return e.io.stderr(`${t}: missing destination file operand
84
- `),1;let s=J(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
85
- `),1;let a=0;for(let c of i){let f=J(e,c),l=o?I(s,Ue(f)):s;if(!e.fs.exists(f)){e.io.stderr(`${t}: cannot stat '${c}': No such file or directory
86
- `),a=1;continue}if(t==="cp"&&e.fs.isDirectory(f)&&!(r.has("r")||r.has("R")||r.has("a"))){e.io.stderr(`cp: -r not specified; omitting directory '${c}'
87
- `),a=1;continue}if(l===f||l.startsWith(f+"/")){e.io.stderr(`${t}: cannot ${t==="cp"?"copy":"move"} '${c}' into itself
88
- `),a=1;continue}if(e.fs.isFile(l)&&e.fs.isDirectory(f)){e.io.stderr(`${t}: cannot overwrite non-directory '${l}' with directory '${c}'
89
- `),a=1;continue}e.fs.isFile(l)&&e.fs.rm(l),lo(e.fs,f,l),t==="mv"&&e.fs.rm(f)}return a}}var uo=fo("cp"),ho=fo("mv"),po=async t=>{let{operands:e}=ce(t.args),r=0;for(let n of e){let s=J(t,n);t.fs.isDirectory(L(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
90
- `),r=1)}return r},Ao=async t=>(t.io.stdout(t.cwd+`
91
- `),0);async function Pn(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=J(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"}
92
- `),1;n.push({label:s,text:t.fs.readText(i)??""})}return n}var go=t=>{let e=t.split(`
93
- `);return e[e.length-1]===""&&e.pop(),e};function mo(t){return t.replace(/\\(n|t|r|\\|e|a|0)/g,(e,r)=>({n:`
94
- `,t:" ",r:"\r","\\":"\\",e:"\x1B",a:"\x07",0:"\0"})[r]??r)}var wo=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?mo(s):s)+(r?`
95
- `:"")),0},yo=async t=>{let[e="",...r]=t.args,n=0,s=mo(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 Eo(t){return async e=>{let r=e.args.find(a=>/^-\d+$/.test(a)),{values:n,operands:s}=ce(e.args.filter(a=>a!==r),["n"]),i=r?Number(r.slice(1)):n.n!==void 0?Number(n.n):10,o=await Pn(e,s,t);return typeof o=="number"?o:(o.forEach((a,c)=>{o.length>1&&e.io.stdout(`${c?`
87
+ `),i=1)}return i};function Do(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))Do(t,k(e,n),k(r,n))}function Oo(t){return async e=>{let{flags:r,operands:n}=he(e.args);if(n.length<2)return e.io.stderr(`${t}: missing destination file operand
88
+ `),1;let s=Z(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
+ `),1;let a=0;for(let c of i){let l=Z(e,c),u=o?k(s,He(l)):s;if(!e.fs.exists(l)){e.io.stderr(`${t}: cannot stat '${c}': No such file or directory
90
+ `),a=1;continue}if(t==="cp"&&e.fs.isDirectory(l)&&!(r.has("r")||r.has("R")||r.has("a"))){e.io.stderr(`cp: -r not specified; omitting directory '${c}'
91
+ `),a=1;continue}if(u===l||u.startsWith(l+"/")){e.io.stderr(`${t}: cannot ${t==="cp"?"copy":"move"} '${c}' into itself
92
+ `),a=1;continue}if(e.fs.isFile(u)&&e.fs.isDirectory(l)){e.io.stderr(`${t}: cannot overwrite non-directory '${u}' with directory '${c}'
93
+ `),a=1;continue}e.fs.isFile(u)&&e.fs.rm(u),Do(e.fs,l,u),t==="mv"&&e.fs.rm(l)}return a}}var _o=Oo("cp"),Ro=Oo("mv"),No=async t=>{let{operands:e}=he(t.args),r=0;for(let n of e){let s=Z(t,n);t.fs.isDirectory(M(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},To=async t=>(t.io.stdout(t.cwd+`
95
+ `),0);async function Gn(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=Z(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 Lo=t=>{let e=t.split(`
97
+ `);return e[e.length-1]===""&&e.pop(),e};function $o(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 Mo=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?$o(s):s)+(r?`
99
+ `:"")),0},Fo=async t=>{let[e="",...r]=t.args,n=0,s=$o(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 Uo(t){return async e=>{let r=e.args.find(a=>/^-\d+$/.test(a)),{values:n,operands:s}=he(e.args.filter(a=>a!==r),["n"]),i=r?Number(r.slice(1)):n.n!==void 0?Number(n.n):10,o=await Gn(e,s,t);return typeof o=="number"?o:(o.forEach((a,c)=>{o.length>1&&e.io.stdout(`${c?`
96
100
  `:""}==> ${a.label} <==
97
- `);let f=go(a.text),l=t==="head"?f.slice(0,i):i?f.slice(-i):[];l.length&&e.io.stdout(l.join(`
101
+ `);let l=Lo(a.text),u=t==="head"?l.slice(0,i):i?l.slice(-i):[];u.length&&e.io.stdout(u.join(`
98
102
  `)+`
99
- `)}),0)}}var bo=Eo("head"),Co=Eo("tail"),vo=async t=>{let{flags:e,operands:r}=ce(t.args),[n,...s]=r;if(n===void 0)return t.io.stderr(`Usage: grep [-ivnrclEF] PATTERN [FILE]...
100
- `),2;let i;try{let l=e.has("F")?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e.has("E")?n:n.replace(/\\([|(){}+?])/g,"$1");i=new RegExp(e.has("w")?`\\b(?:${l})\\b`:l,e.has("i")?"i":"")}catch{return t.io.stderr(`grep: invalid pattern: ${n}
101
- `),2}let o=s;if(e.has("r")||e.has("R")){o=[];let l=(u,d)=>{if(t.fs.isFile(u))o.push(d);else for(let h of t.fs.readdir(u))h!=="node_modules"&&!h.startsWith(".")&&l(I(u,h),d==="."?h:`${d}/${h}`)};for(let u of s.length?s:["."])l(J(t,u),u)}let a=await Pn(t,o,"grep");if(typeof a=="number")return 2;let c=a.length>1,f=0;for(let{label:l,text:u}of a){let d=0;go(u).forEach((h,g)=>{i.test(h)!==e.has("v")&&(d++,f++,!(e.has("c")||e.has("l")||e.has("q"))&&t.io.stdout(`${c?l+":":""}${e.has("n")?g+1+":":""}${h}
102
- `))}),e.has("c")&&t.io.stdout(`${c?l+":":""}${d}
103
- `),e.has("l")&&d&&t.io.stdout(l+`
104
- `)}return f?0:1},Qo=async t=>{let{flags:e,operands:r}=ce(t.args),n=await Pn(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(f=>String(a[f]).padStart(7)).join(" ");t.io.stdout(`${c}${r.length?" "+i:""}
105
- `)}return 0},Bo=async t=>(t.io.stdout(Object.entries(t.env).map(([e,r])=>`${e}=${r}`).join(`
103
+ `)}),0)}}var Po=Uo("head"),jo=Uo("tail"),Ko=async t=>{let{flags:e,operands:r}=he(t.args),[n,...s]=r;if(n===void 0)return t.io.stderr(`Usage: grep [-ivnrclEF] PATTERN [FILE]...
104
+ `),2;let i;try{let u=e.has("F")?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e.has("E")?n:n.replace(/\\([|(){}+?])/g,"$1");i=new RegExp(e.has("w")?`\\b(?:${u})\\b`:u,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 u=(f,d)=>{if(t.fs.isFile(f))o.push(d);else for(let h of t.fs.readdir(f))h!=="node_modules"&&!h.startsWith(".")&&u(k(f,h),d==="."?h:`${d}/${h}`)};for(let f of s.length?s:["."])u(Z(t,f),f)}let a=await Gn(t,o,"grep");if(typeof a=="number")return 2;let c=a.length>1,l=0;for(let{label:u,text:f}of a){let d=0;Lo(f).forEach((h,w)=>{i.test(h)!==e.has("v")&&(d++,l++,!(e.has("c")||e.has("l")||e.has("q"))&&t.io.stdout(`${c?u+":":""}${e.has("n")?w+1+":":""}${h}
106
+ `))}),e.has("c")&&t.io.stdout(`${c?u+":":""}${d}
107
+ `),e.has("l")&&d&&t.io.stdout(u+`
108
+ `)}return l?0:1},Ho=async t=>{let{flags:e,operands:r}=he(t.args),n=await Gn(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(l=>String(a[l]).padStart(7)).join(" ");t.io.stdout(`${c}${r.length?" "+i:""}
109
+ `)}return 0},Wo=async t=>(t.io.stdout(Object.entries(t.env).map(([e,r])=>`${e}=${r}`).join(`
106
110
  `)+`
107
- `),0),So=async t=>(t.io.stdout("\x1B[2J\x1B[3J\x1B[H"),0),Io=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]}'
108
- `),1)},ko=async t=>{let[e="",r]=t.args,n=Ue(e);return r&&n.endsWith(r)&&n!==r&&(n=n.slice(0,-r.length)),t.io.stdout(n+`
109
- `),0},xo=async t=>{let e=(t.args[0]??".").replace(/(.)\/+$/,"$1"),r=e.lastIndexOf("/");return t.io.stdout((r<0?".":r===0?"/":e.startsWith("/")?L(e):e.slice(0,r))+`
110
- `),0},Do=async()=>0,Oo=async()=>1;var ze=class extends Error{},el=new Set(["-e","-f","-d","-s","-r","-w","-x","-L","-h"]),tl=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function rl(t,e){let r=0,n=()=>e[r],s=()=>{if(r>=e.length)throw new ze("argument expected");return e[r++]},i=l=>{if(!/^\s*-?\d+\s*$/.test(l))throw new ze(`${l}: integer expression expected`);return Number(l)},o=()=>{let l=s();if(l==="!")return!o();if(l==="("){let d=c();if(s()!==")")throw new ze("')' expected");return d}let u=n();if(u!==void 0&&(u==="="||u==="=="||u==="!="||tl.has(u))&&e[r+1]!==void 0){r++;let d=s();if(u==="="||u==="==")return l===d;if(u==="!=")return l!==d;let[h,g]=[i(l),i(d)];return u==="-eq"?h===g:u==="-ne"?h!==g:u==="-lt"?h<g:u==="-le"?h<=g:u==="-gt"?h>g:h>=g}if(l==="-z"&&n()!==void 0)return s().length===0;if(l==="-n"&&n()!==void 0)return s().length>0;if(el.has(l)&&n()!==void 0){let d=J(t,s()),h=t.fs;switch(l){case"-f":return h.isFile(d);case"-d":return h.isDirectory(d);case"-s":{let g=h.readFile(d);return g!==void 0&&g.length>0}case"-L":case"-h":return!1;default:return h.exists(d)}}return l.length>0},a=()=>{let l=o();for(;n()==="-a";){r++;let u=o();l=l&&u}return l},c=()=>{let l=a();for(;n()==="-o";){r++;let u=a();l=l||u}return l};if(!e.length)return!1;let f=c();if(r<e.length)throw new ze(`${e[r]}: unexpected argument`);return f}function No(t,e){try{return rl(t,e)?0:1}catch(r){if(!(r instanceof ze))throw r;return t.io.stderr(`${t.name}: ${r.message}
111
- `),2}}var Ro=async t=>No(t,t.args),_o=async t=>t.args[t.args.length-1]!=="]"?(t.io.stderr(`[: missing ']'
112
- `),2):No(t,t.args.slice(0,-1));var Qr=new WeakMap,To=new WeakSet;function $o(t,e){let r=Qr.get(t)??"",n=()=>{let i=r.indexOf(`
113
- `);return i<0?null:(Qr.set(t,r.slice(i+1)),r.slice(0,i))},s=n();return s!==null?Promise.resolve(s):To.has(t)?(Qr.delete(t),Promise.resolve(r||null)):new Promise(i=>{let o=f=>{c(),e?.removeEventListener("abort",a),i(f)},a=()=>o(null);e?.addEventListener("abort",a);let c=t.subscribe(f=>{if(f===null){To.add(t),Qr.delete(t),o(r||null);return}r+=f;let l=n();l!==null&&o(l)})})}var Fe={ls:io,cat:oo,mkdir:ao,rm:co,cp:uo,mv:ho,touch:po,pwd:Ao,echo:wo,printf:yo,head:bo,tail:Co,grep:vo,wc:Qo,env:Bo,clear:So,sleep:Io,basename:ko,dirname:xo,test:Ro,"[":_o,true:Do,false:Oo},Br=["node","npm","npx","pnpm","yarn","bfsh","sh","bash"],nl=`bfsh \u2014 BuilderForce WebContainers shell
111
+ `),0),Jo=async t=>(t.io.stdout("\x1B[2J\x1B[3J\x1B[H"),0),qo=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)},zo=async t=>{let[e="",r]=t.args,n=He(e);return r&&n.endsWith(r)&&n!==r&&(n=n.slice(0,-r.length)),t.io.stdout(n+`
113
+ `),0},Go=async t=>{let e=(t.args[0]??".").replace(/(.)\/+$/,"$1"),r=e.lastIndexOf("/");return t.io.stdout((r<0?".":r===0?"/":e.startsWith("/")?M(e):e.slice(0,r))+`
114
+ `),0},Yo=async()=>0,Vo=async()=>1;var Ze=class extends Error{},Il=new Set(["-e","-f","-d","-s","-r","-w","-x","-L","-h"]),kl=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function xl(t,e){let r=0,n=()=>e[r],s=()=>{if(r>=e.length)throw new Ze("argument expected");return e[r++]},i=u=>{if(!/^\s*-?\d+\s*$/.test(u))throw new Ze(`${u}: integer expression expected`);return Number(u)},o=()=>{let u=s();if(u==="!")return!o();if(u==="("){let d=c();if(s()!==")")throw new Ze("')' expected");return d}let f=n();if(f!==void 0&&(f==="="||f==="=="||f==="!="||kl.has(f))&&e[r+1]!==void 0){r++;let d=s();if(f==="="||f==="==")return u===d;if(f==="!=")return u!==d;let[h,w]=[i(u),i(d)];return f==="-eq"?h===w:f==="-ne"?h!==w:f==="-lt"?h<w:f==="-le"?h<=w:f==="-gt"?h>w:h>=w}if(u==="-z"&&n()!==void 0)return s().length===0;if(u==="-n"&&n()!==void 0)return s().length>0;if(Il.has(u)&&n()!==void 0){let d=Z(t,s()),h=t.fs;switch(u){case"-f":return h.isFile(d);case"-d":return h.isDirectory(d);case"-s":{let w=h.readFile(d);return w!==void 0&&w.length>0}case"-L":case"-h":return!1;default:return h.exists(d)}}return u.length>0},a=()=>{let u=o();for(;n()==="-a";){r++;let f=o();u=u&&f}return u},c=()=>{let u=a();for(;n()==="-o";){r++;let f=a();u=u||f}return u};if(!e.length)return!1;let l=c();if(r<e.length)throw new Ze(`${e[r]}: unexpected argument`);return l}function Zo(t,e){try{return xl(t,e)?0:1}catch(r){if(!(r instanceof Ze))throw r;return t.io.stderr(`${t.name}: ${r.message}
115
+ `),2}}var Xo=async t=>Zo(t,t.args),ea=async t=>t.args[t.args.length-1]!=="]"?(t.io.stderr(`[: missing ']'
116
+ `),2):Zo(t,t.args.slice(0,-1));var xr=new WeakMap,ta=new WeakSet;function ra(t,e){let r=xr.get(t)??"",n=()=>{let i=r.indexOf(`
117
+ `);return i<0?null:(xr.set(t,r.slice(i+1)),r.slice(0,i))},s=n();return s!==null?Promise.resolve(s):ta.has(t)?(xr.delete(t),Promise.resolve(r||null)):new Promise(i=>{let o=l=>{c(),e?.removeEventListener("abort",a),i(l)},a=()=>o(null);e?.addEventListener("abort",a);let c=t.subscribe(l=>{if(l===null){ta.add(t),xr.delete(t),o(r||null);return}r+=l;let u=n();u!==null&&o(u)})})}var Ke={ls:Bo,cat:Io,mkdir:ko,rm:xo,cp:_o,mv:Ro,touch:No,pwd:To,echo:Mo,printf:Fo,head:Po,tail:jo,grep:Ko,wc:Ho,env:Wo,clear:Jo,sleep:qo,basename:zo,dirname:Go,test:Xo,"[":ea,true:Yo,false:Vo},Dr=["node","npm","npx","pnpm","yarn","bfsh","sh","bash"],Dl=`bfsh \u2014 BuilderForce WebContainers shell
114
118
 
115
119
  Builtins: cd, pwd, export, unset, exit, source, history, type, which, help,
116
120
  read, local, shift, return, break, continue, jobs, wait
@@ -121,28 +125,27 @@ ${h.join(`
121
125
  if \u2026; then \u2026; elif \u2026; else \u2026; fi while|until \u2026; do \u2026; done for x in \u2026; do \u2026; done
122
126
  case $x in a|b) \u2026;; *) \u2026;; esac name() { \u2026; } { \u2026; } ( \u2026 ) cat <<EOF \u2026 EOF
123
127
 
124
- `,Oe={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=J(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
+ `,Ne={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=Z(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+`
125
129
  `),0):(t.io.stderr(`cd: ${t.fs.isFile(s)?"not a directory":"no such file or directory"}: ${n}
126
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(`
127
131
  `)+`
128
132
  `),0;for(let r of t.args){let n=r.indexOf("=");n>0?e.env[r.slice(0,n)]=r.slice(n+1):r in e.env||(e.env[r]="")}return 0},async unset(t,e){for(let r of t.args)delete e.env[r];return 0},async exit(t,e){let r=t.args[0]===void 0?e.lastStatus:Number(t.args[0]);return e.exitRequested=Number.isFinite(r)?r&255:2,e.exitRequested},async source(t,e){let r=t.args[0];if(!r)return t.io.stderr(`source: filename argument required
129
- `),2;let n=t.fs.readText(J(t,r));return n===void 0?(t.io.stderr(`source: ${r}: No such file or directory
133
+ `),2;let n=t.fs.readText(Z(t,r));return n===void 0?(t.io.stderr(`source: ${r}: No such file or directory
130
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(`
131
135
  `)+(e.history.length?`
132
- `:"")),0},async help(t){return t.io.stdout(nl),0},async which(t){let e=0;for(let r of t.args.filter(n=>!n.startsWith("-")))if(r in Fe||Br.includes(r))t.io.stdout(`/usr/local/bin/${r}
133
- `);else if(r in Oe)t.io.stdout(`${r}: shell built-in command
134
- `);else{let n=ue(t.fs,r,t.cwd,t.env);n?t.io.stdout(n+`
136
+ `:"")),0},async help(t){return t.io.stdout(Dl),0},async which(t){let e=0;for(let r of t.args.filter(n=>!n.startsWith("-")))if(r in Ke||Dr.includes(r))t.io.stdout(`/usr/local/bin/${r}
137
+ `);else if(r in Ne)t.io.stdout(`${r}: shell built-in command
138
+ `);else{let n=Ae(t.fs,r,t.cwd,t.env);n?t.io.stdout(n+`
135
139
  `):(t.io.stderr(`${r} not found
136
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
137
- `);else if(n in Oe)t.io.stdout(`${n} is a shell builtin
138
- `);else if(n in Fe||Br.includes(n))t.io.stdout(`${n} is /usr/local/bin/${n}
139
- `);else{let s=ue(t.fs,n,t.cwd,t.env);s?t.io.stdout(`${n} is ${s}
141
+ `);else if(n in Ne)t.io.stdout(`${n} is a shell builtin
142
+ `);else if(n in Ke||Dr.includes(n))t.io.stdout(`${n} is /usr/local/bin/${n}
143
+ `);else{let s=Ae(t.fs,n,t.cwd,t.env);s?t.io.stdout(`${n} is ${s}
140
144
  `):(t.io.stderr(`type: ${n}: not found
141
- `),r=1)}return r},async set(){return 0},async break(t,e){return Lo(t,e,"break")},async continue(t,e){return Lo(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
142
- `),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 $o(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
143
- `);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 Lo(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
144
- `),1):(e.flow={kind:r,levels:n},0)}Oe["."]=Oe.source;Oe[":"]=async()=>0;function Sr(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 sl(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 Mo(t,e,r){let n=t.system.previewUrl;if(!n)return t.io.stderr(`${r.tool}: no in-browser preview is attached to this runtime, so there is nothing to serve.
145
- `),1;let s=sl(e,r.defaultPort,t.env),i=r.tool==="vite"?`
145
+ `),r=1)}return r},async set(){return 0},async break(t,e){return na(t,e,"break")},async continue(t,e){return na(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 ra(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 na(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)}Ne["."]=Ne.source;Ne[":"]=async()=>0;function Ol(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 Or(t,e){let r=Ol(e);return r&&t.system.previewUrl&&!vs(t.fs)?r:void 0}function _l(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=_l(e,r.defaultPort,t.env),i=r.tool==="vite"?`
146
149
  VITE (BuilderForce in-browser dev server) ready
147
150
 
148
151
  \u279C Local: ${n}
@@ -154,60 +157,60 @@ You can now view the app in the browser.
154
157
 
155
158
  Local: ${n}
156
159
 
157
- `;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 jn(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 Kn(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&&!jn(e)||o===0!=(t.type==="while")||(i=await e.runScript(t.body,r,n,s),!jn(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),!jn(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(Mn(await e.expandText(a,r,s),{slash:!0}).test(i))return e.runScript(o.body,r,n,s);return 0}}}var il=500,Ir=class t{constructor(e){p(this,"options");p(this,"cwd");p(this,"env");p(this,"lastStatus",0);p(this,"history",[]);p(this,"exitRequested");p(this,"flow");p(this,"positional");p(this,"functions");p(this,"jobs",new Map);p(this,"localFrames",[]);p(this,"pid",il++);p(this,"system");p(this,"nextJob",1);p(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=vr(e)}catch(a){if(!(a instanceof F))throw a;return r.stderr(`bfsh: ${a.message}
158
- `),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:f}of i.rest){if(this.exitRequested!==void 0||s.aborted||this.flow)break;c==="&&"==(a===0)&&(a=await this.runPipeline(f,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 Un(e,this.expandContext(r,n))}async expandText(e,r,n){return(await ft(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:ol()},r),s}}}async runPipeline(e,r,n,s){let i=e.commands.length,o=Array.from({length:i-1},()=>new ne),a=await Promise.all(e.commands.map(async(f,l)=>{let u=l===0?n:{queue:o[l-1]},h={stdout:l===i-1?r.stdout:g=>o[l].push(g),stderr:r.stderr,isTerminal:r.isTerminal&&l===i-1};try{return await this.runCommand(f,h,u,s,i===1)}finally{l<i-1&&o[l].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 Kn(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 Un(e.words,o),c={};for(let{name:l,value:u}of e.assignments)c[l]=(await ft(u,o,{split:!1,glob:!1})).join("");if(!a.length)return Object.assign(this.env,c),0;let f=await this.applyRedirects(e.redirects,r,n,s);if(typeof f=="number")return f;try{return await this.dispatch(a,c,f.io,f.input,s,i&&f.io.isTerminal)}finally{f.flush()}}async applyRedirects(e,r,n,s){let{stdout:i,stderr:o,isTerminal:a}=r,c=n,f=[],l=u=>{let d=new ne;return d.push(u),d.push(null),{queue:d}};for(let u of e){if(u.op==="2>&1"){o=i;continue}if(u.op===">&2"){i=o;continue}if(u.heredoc){let E=await this.expandText(u.heredoc.body,r,s);c=l(E);continue}let d=(await ft(u.target,this.expandContext(r,s))).join(" "),h=J(this,d);if(u.op==="<"){let E=this.system.fs.readText(h);if(E===void 0)return r.stderr(`bfsh: ${d}: No such file or directory
159
- `),1;c=l(E);continue}if(this.system.fs.isDirectory(h))return r.stderr(`bfsh: ${d}: Is a directory
160
- `),1;let m=u.op===">>"||u.op==="2>>"?this.system.fs.readText(h)??"":"";this.system.fs.writeFile(h,m);let w=E=>void(m+=E);f.push(()=>this.system.fs.writeFile(h,m)),u.op==="2>"||u.op==="2>>"?o=w:u.op==="&>"?i=o=w:(i=w,a=!1)}return{io:{stdout:i,stderr:o,isTerminal:a},input:c,flush:()=>f.forEach(u=>u())}}async dispatch(e,r,n,s,i,o){let[a,...c]=e,f=this.functions.get(a);if(f)return this.callFunction(f,c,n,s,i);let l={...this.env,...r},u={args:c,name:a,cwd:this.cwd,env:l,fs:this.system.fs,system:this.system,io:{stdout:n.stdout,stderr:n.stderr,stdin:s.queue,isTerminal:n.isTerminal},signal:i},d=Oe[a];if(d)return d(u,this);let h=this.options.commands?.[a];if(h)return h(u,this,s);let g=Sr(e);if(g)return Mo(u,e,g);let m=Fe[a];return m?m(u):this.spawnExternal(a,c,l,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 Kn(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,f]of a)f===void 0?delete this.env[c]:this.env[c]=f;this.positional=o}}async spawnExternal(e,r,n,s,i,o,a){let c=a?this.options.terminalSize?.():void 0,f;try{f=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}
161
- `),127}f.onStdout(s.stdout),f.onStderr(s.stderr);let l;c&&i.setRawSink?i.setRawSink(d=>f.write(d)):l=i.queue.subscribe(d=>d===null?f.closeStdin():f.write(d));let u=()=>f.kill(typeof o.reason=="string"?o.reason:"SIGINT");o.aborted&&u(),o.addEventListener("abort",u);try{return await f.exit}finally{o.removeEventListener("abort",u),c&&i.setRawSink&&i.setRawSink(void 0),l?.()}}};function ol(){let t=new ne;return t.push(null),t}var al=[[/^\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 cl(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 kr=class{constructor(e){p(this,"options");p(this,"line","");p(this,"cursor",0);p(this,"prompt","");p(this,"historyIndex",-1);p(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=al.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`
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 Yn(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 Vn(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&&!Yn(e)||o===0!=(t.type==="while")||(i=await e.runScript(t.body,r,n,s),!Yn(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),!Yn(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(Jn(await e.expandText(a,r,s),{slash:!0}).test(i))return e.runScript(o.body,r,n,s);return 0}}}var Rl=500,_r=class t{constructor(e){g(this,"options");g(this,"cwd");g(this,"env");g(this,"lastStatus",0);g(this,"history",[]);g(this,"exitRequested");g(this,"flow");g(this,"positional");g(this,"functions");g(this,"jobs",new Map);g(this,"localFrames",[]);g(this,"pid",Rl++);g(this,"system");g(this,"nextJob",1);g(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=kr(e)}catch(a){if(!(a instanceof j))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:l}of i.rest){if(this.exitRequested!==void 0||s.aborted||this.flow)break;c==="&&"==(a===0)&&(a=await this.runPipeline(l,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 zn(e,this.expandContext(r,n))}async expandText(e,r,n){return(await gt(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:Nl()},r),s}}}async runPipeline(e,r,n,s){let i=e.commands.length,o=Array.from({length:i-1},()=>new se),a=await Promise.all(e.commands.map(async(l,u)=>{let f=u===0?n:{queue:o[u-1]},h={stdout:u===i-1?r.stdout:w=>o[u].push(w),stderr:r.stderr,isTerminal:r.isTerminal&&u===i-1};try{return await this.runCommand(l,h,f,s,i===1)}finally{u<i-1&&o[u].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 Vn(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 zn(e.words,o),c={};for(let{name:u,value:f}of e.assignments)c[u]=(await gt(f,o,{split:!1,glob:!1})).join("");if(!a.length)return Object.assign(this.env,c),0;let l=await this.applyRedirects(e.redirects,r,n,s);if(typeof l=="number")return l;try{return await this.dispatch(a,c,l.io,l.input,s,i&&l.io.isTerminal)}finally{l.flush()}}async applyRedirects(e,r,n,s){let{stdout:i,stderr:o,isTerminal:a}=r,c=n,l=[],u=f=>{let d=new se;return d.push(f),d.push(null),{queue:d}};for(let f of e){if(f.op==="2>&1"){o=i;continue}if(f.op===">&2"){i=o;continue}if(f.heredoc){let y=await this.expandText(f.heredoc.body,r,s);c=u(y);continue}let d=(await gt(f.target,this.expandContext(r,s))).join(" "),h=Z(this,d);if(f.op==="<"){let y=this.system.fs.readText(h);if(y===void 0)return r.stderr(`bfsh: ${d}: No such file or directory
162
+ `),1;c=u(y);continue}if(this.system.fs.isDirectory(h))return r.stderr(`bfsh: ${d}: Is a directory
163
+ `),1;let E=f.op===">>"||f.op==="2>>"?this.system.fs.readText(h)??"":"";this.system.fs.writeFile(h,E);let b=y=>void(E+=y);l.push(()=>this.system.fs.writeFile(h,E)),f.op==="2>"||f.op==="2>>"?o=b:f.op==="&>"?i=o=b:(i=b,a=!1)}return{io:{stdout:i,stderr:o,isTerminal:a},input:c,flush:()=>l.forEach(f=>f())}}async dispatch(e,r,n,s,i,o){let[a,...c]=e,l=this.functions.get(a);if(l)return this.callFunction(l,c,n,s,i);let u={...this.env,...r},f={args:c,name:a,cwd:this.cwd,env:u,fs:this.system.fs,system:this.system,io:{stdout:n.stdout,stderr:n.stderr,stdin:s.queue,isTerminal:n.isTerminal},signal:i},d=Ne[a];if(d)return d(f,this);let h=this.options.commands?.[a];if(h)return h(f,this,s);let w=Or(f,e);if(w)return sa(f,e,w);let E=Ke[a];return E?E(f):this.spawnExternal(a,c,u,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 Vn(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,l]of a)l===void 0?delete this.env[c]:this.env[c]=l;this.positional=o}}async spawnExternal(e,r,n,s,i,o,a){let c=a?this.options.terminalSize?.():void 0,l;try{l=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}l.onStdout(ie(d=>d!==null&&s.stdout(d))),l.onStderr(ie(d=>d!==null&&s.stderr(d)));let u;c&&i.setRawSink?i.setRawSink(d=>l.write(d)):u=i.queue.subscribe(d=>d===null?l.closeStdin():l.write(d));let f=()=>l.kill(typeof o.reason=="string"?o.reason:"SIGINT");o.aborted&&f(),o.addEventListener("abort",f);try{return await l.exit}finally{o.removeEventListener("abort",f),c&&i.setRawSink&&i.setRawSink(void 0),u?.()}}};function Nl(){let t=new se;return t.push(null),t}var Tl=[[/^\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 Ll(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 Rr=class{constructor(e){g(this,"options");g(this,"line","");g(this,"cursor",0);g(this,"prompt","");g(this,"historyIndex",-1);g(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=Tl.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`
162
165
  `:{n==="\r"&&e[r]===`
163
166
  `&&r++;let s=this.line;return this.options.write(`\r
164
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
165
- `),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=cl(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=Ll(n);if(s.length>r.length){this.insert(s.slice(r.length));return}this.options.write(`\r
166
169
  `+n.map(i=>i.slice(i.lastIndexOf("/",i.length-2)+1)).join(" ")+`\r
167
- `),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 Fo="10.8.2",Hn=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Rt(t){return Me(t.fs,t.cwd)?.dir??t.cwd}function Nt(t,e){try{return JSON.parse(t.fs.readText(I(e,"package.json"))??"null")??void 0}catch{return}}async function xr(t,e,r=Rt(t)){let n=performance.now(),s=t.io.isTerminal;try{let i=ws(t.fs,[I(t.env.HOME??"/home/user",".npmrc"),I(r,".npmrc")],t.env),o=await Ws({fs:t.fs,fetch:(f,l)=>t.system.fetch(f,l),registry:t.env.npm_config_registry??i.registry??t.system.registry,npmrc:i,cache:t.system.packageCache,cwd:r,signal:t.signal,onProgress:s?f=>f.phase==="fetch"&&t.io.stdout(`\r\x1B[Kfetching ${f.done}/${f.total} ${f.package??""}`):void 0,...e});s&&t.io.stdout("\r\x1B[K");for(let f of o.warnings)t.io.stderr(`npm warn ${f}
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 ia="10.8.2",Zn=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Ft(t){return je(t.fs,t.cwd)?.dir??t.cwd}function Mt(t,e){try{return JSON.parse(t.fs.readText(k(e,"package.json"))??"null")??void 0}catch{return}}async function Nr(t,e,r=Ft(t)){let n=performance.now(),s=t.io.isTerminal;try{let i=Is(t.fs,[k(t.env.HOME??"/home/user",".npmrc"),k(r,".npmrc")],t.env),o=await ni({fs:t.fs,fetch:(l,u)=>t.system.fetch(l,u),registry:t.env.npm_config_registry??i.registry??t.system.registry,npmrc:i,cache:t.system.packageCache,cwd:r,signal:t.signal,onProgress:s?l=>l.phase==="fetch"&&t.io.stdout(`\r\x1B[Kfetching ${l.done}/${l.total} ${l.package??""}`):void 0,...e});s&&t.io.stdout("\r\x1B[K");for(let l of o.warnings)t.io.stderr(`npm warn ${l}
168
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(`
169
172
  ${c.length?c.join(", "):"up to date"}, audited ${o.total+1} packages in ${a}s
170
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)}
171
- `),1)}}async function Uo(t,e,r,n,s){let i=Rt(t),o=Nt(t,i);if(!o)return t.io.stderr(`npm error Could not read package.json in ${i}
172
- `),1;let a={...o.scripts};if(n==="start"&&!a.start&&t.fs.isFile(I(i,"server.js"))&&(a.start="node server.js"),!a[n])return n==="test"?(t.io.stderr(`npm error Missing script: "test"
174
+ `),1)}}async function oa(t,e,r,n,s){let i=Ft(t),o=Mt(t,i);if(!o)return t.io.stderr(`npm error Could not read package.json in ${i}
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"
173
176
  `),1):(t.io.stderr(`npm error Missing script: "${n}"
174
177
 
175
178
  To see a list of scripts, run:
176
179
  npm run
177
- `),1);let c=[...tt(i),t.env.PATH??""].filter(Boolean).join(":");for(let f of[`pre${n}`,n,`post${n}`]){let l=a[f];if(!l)continue;let u=f===n&&s.length?`${l} ${s.map(Hn).join(" ")}`:l;t.io.stdout(`
178
- > ${o.name??""}${o.version?"@"+o.version:""} ${f}
179
- > ${u}
180
+ `),1);let c=[...it(i),t.env.PATH??""].filter(Boolean).join(":");for(let l of[`pre${n}`,n,`post${n}`]){let u=a[l];if(!u)continue;let f=l===n&&s.length?`${u} ${s.map(Zn).join(" ")}`:u;t.io.stdout(`
181
+ > ${o.name??""}${o.version?"@"+o.version:""} ${l}
182
+ > ${f}
180
183
 
181
- `);let h=await e.fork({cwd:i,env:{PATH:c,npm_lifecycle_event:f,npm_lifecycle_script:l,npm_command:"run-script",npm_package_name:o.name??"",npm_package_version:o.version??"",npm_package_json:I(i,"package.json"),INIT_CWD:t.cwd,NODE:"/usr/local/bin/node"}}).exec(u,{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 \`${f}\` failed with error:
184
+ `);let h=await e.fork({cwd:i,env:{PATH:c,npm_lifecycle_event:l,npm_lifecycle_script:u,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(f,{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 \`${l}\` failed with error:
182
185
  npm error code ${h}
183
- `),h}return 0}function ll(t){let e=Nt(t,Rt(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 $l(t){let e=Mt(t,Ft(t)),r=Object.entries(e?.scripts??{});return r.length&&t.io.stdout(`Scripts available in ${e?.name??"this package"} via \`npm run-script\`:
184
187
  ${r.map(([n,s])=>` ${n}
185
188
  ${s}`).join(`
186
189
  `)}
187
- `),0}async function Dr(t,e,r){let[n="help",...s]=t.args,{flags:i,operands:o}=ce(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(`${Fo}
188
- `),0;case"install":case"i":case"add":case"isntall":return xr(t,{add:o,saveDev:a,production:c});case"ci":case"clean-install":return xr(t,{ci:!0,production:c});case"uninstall":case"remove":case"rm":case"un":{let f=Rt(t),l=Nt(t,f);if(!l)return t.io.stderr(`npm error No package.json found
189
- `),1;for(let u of["dependencies","devDependencies","optionalDependencies"])for(let d of o)l[u]&&delete l[u][d];return t.fs.writeFile(I(f,"package.json"),JSON.stringify(l,null,2)+`
190
- `),xr(t,{},f)}case"run":case"run-script":{let f=s.indexOf("--"),[l,...u]=f>=0?[...s.slice(0,f),...s.slice(f+1)]:s;return l?Uo(t,e,r,l,u):ll(t)}case"start":case"test":case"t":case"stop":case"restart":return Uo(t,e,r,n==="t"?"test":n,s.filter(f=>f!=="--"));case"init":{let f=I(t.cwd,"package.json");if(t.fs.isFile(f))return t.io.stderr(`npm error package.json already exists
191
- `),1;let u={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(f,JSON.stringify(u,null,2)+`
192
- `),t.io.stdout(`Wrote to ${f}:
190
+ `),0}async function Tr(t,e,r){let[n="help",...s]=t.args,{flags:i,operands:o}=he(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(`${ia}
191
+ `),0;case"install":case"i":case"add":case"isntall":return Nr(t,{add:o,saveDev:a,production:c});case"ci":case"clean-install":return Nr(t,{ci:!0,production:c});case"uninstall":case"remove":case"rm":case"un":{let l=Ft(t),u=Mt(t,l);if(!u)return t.io.stderr(`npm error No package.json found
192
+ `),1;for(let f of["dependencies","devDependencies","optionalDependencies"])for(let d of o)u[f]&&delete u[f][d];return t.fs.writeFile(k(l,"package.json"),JSON.stringify(u,null,2)+`
193
+ `),Nr(t,{},l)}case"run":case"run-script":{let l=s.indexOf("--"),[u,...f]=l>=0?[...s.slice(0,l),...s.slice(l+1)]:s;return u?oa(t,e,r,u,f):$l(t)}case"start":case"test":case"t":case"stop":case"restart":return oa(t,e,r,n==="t"?"test":n,s.filter(l=>l!=="--"));case"init":{let l=k(t.cwd,"package.json");if(t.fs.isFile(l))return t.io.stderr(`npm error package.json already exists
194
+ `),1;let f={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(l,JSON.stringify(f,null,2)+`
195
+ `),t.io.stdout(`Wrote to ${l}:
193
196
 
194
- ${JSON.stringify(u,null,2)}
195
- `),0}case"ls":case"list":{let f=Rt(t),l=Nt(t,f),u={...l?.dependencies,...l?.devDependencies};t.io.stdout(`${l?.name??""}@${l?.version??""} ${f}
196
- `);let d=Object.keys(u).sort();return d.forEach((h,g)=>{let m=Nt(t,I(f,"node_modules",h))?.version;t.io.stdout(`${g===d.length-1?"\u2514\u2500\u2500":"\u251C\u2500\u2500"} ${h}@${m??`(missing ${u[h]})`}
197
- `)}),0}case"exec":case"x":return _t({...t,args:s.filter(f=>f!=="--")},e,r);case"help":case"-h":case"--help":return t.io.stdout(`npm ${Fo} (BuilderForce WebContainers)
197
+ ${JSON.stringify(f,null,2)}
198
+ `),0}case"ls":case"list":{let l=Ft(t),u=Mt(t,l),f={...u?.dependencies,...u?.devDependencies};t.io.stdout(`${u?.name??""}@${u?.version??""} ${l}
199
+ `);let d=Object.keys(f).sort();return d.forEach((h,w)=>{let E=Mt(t,k(l,"node_modules",h))?.version;t.io.stdout(`${w===d.length-1?"\u2514\u2500\u2500":"\u251C\u2500\u2500"} ${h}@${E??`(missing ${f[h]})`}
200
+ `)}),0}case"exec":case"x":return Ut({...t,args:s.filter(l=>l!=="--")},e,r);case"help":case"-h":case"--help":return t.io.stdout(`npm ${ia} (BuilderForce WebContainers)
198
201
 
199
202
  Usage: npm <install|ci|uninstall|run|start|test|init|ls|exec> \u2026
200
203
  `),0;default:return t.io.stderr(`npm error Unknown command: "${n}"
201
- `),1}}async function _t(t,e,r){let n=t.args.filter(u=>u!=="-y"&&u!=="--yes"),s=n.findIndex(u=>u==="-p"||u==="--package"),i=s>=0?n.splice(s,2)[1]:void 0,[o,...a]=n;if(!o)return t.io.stderr(`npx: missing command
202
- `),1;let c=o.replace(/^@[^/]+\//,"").replace(/@[^@]*$/,""),f={stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal};if(Sr([c,...a]))return e.fork({}).exec([c,...a].map(Hn).join(" "),f,r,t.signal);let l=ue(t.fs,c,t.cwd,{PATH:""});if(!l){let u=i??o,d=`/tmp/.npx/${u.replace(/[^\w.-]+/g,"_")}`;t.fs.isFile(I(d,"package.json"))||t.fs.writeFile(I(d,"package.json"),`{"private": true}
203
- `),t.io.stderr(`npx: installing ${u}
204
- `);let h=await xr({...t,io:{...t.io,stdout:()=>{}}},{add:[u]},d);if(h!==0)return h;if(l=ue(t.fs,c,d,{PATH:""})??ue(t.fs,t.fs.readdir(I(d,"node_modules/.bin"))[0]??c,d,{PATH:""}),!l)return t.io.stderr(`npx: ${u} has no executable named ${c}
205
- `),1}return e.fork({}).exec([l,...a].map(Hn).join(" "),f,r,t.signal)}var fl={pnpm:"9.12.0",yarn:"1.22.22"},ul=new Set(["install","i"]),dl=new Set(["remove","rm","uninstall","un"]),hl=new Set(["test","t","start","init","ls","list","run","run-script"]);function pl(t,e){let r=Me(t.fs,t.cwd)?.dir??t.cwd;try{return!!JSON.parse(t.fs.readText(I(r,"package.json"))??"{}").scripts?.[e]}catch{return!1}}function Po(t){return t.flatMap(e=>e==="--dev"||e==="-D"||e==="--save-dev"?["--save-dev"]:e==="--frozen-lockfile"||e==="--immutable"||e==="--prefer-offline"?[]:[e])}function Al(t,e,r){let[n,...s]=e;return n===void 0?{tool:"npm",args:["install"]}:n==="-v"||n==="--version"?{version:fl[t]}:ul.has(n)?{tool:"npm",args:["install",...Po(s)]}:n==="add"?{tool:"npm",args:["install",...Po(s)]}:dl.has(n)?{tool:"npm",args:["uninstall",...s]}:n==="dlx"||n==="exec"||t==="pnpm"&&n==="x"?{tool:"npx",args:s}:hl.has(n)?{tool:"npm",args:[n,...s]}:pl(r,n)?{tool:"npm",args:["run",n,...s.length?["--",...s]:[]]}:ue(r.fs,n,r.cwd,{PATH:""})?{tool:"npx",args:[n,...s]}:{error:`${t}: no script or command named "${n}"`}}function jo(t){return async(e,r,n)=>{let s=Al(t,e.args,e);if("version"in s)return e.io.stdout(`${s.version}
204
+ `),1}}async function Ut(t,e,r){let n=t.args.filter(f=>f!=="-y"&&f!=="--yes"),s=n.findIndex(f=>f==="-p"||f==="--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(/@[^@]*$/,""),l={stdout:t.io.stdout,stderr:t.io.stderr,isTerminal:t.io.isTerminal};if(Or(t,[c,...a]))return e.fork({}).exec([c,...a].map(Zn).join(" "),l,r,t.signal);let u=Ae(t.fs,c,t.cwd,{PATH:""});if(!u){let f=i??o,d=`/tmp/.npx/${f.replace(/[^\w.-]+/g,"_")}`;t.fs.isFile(k(d,"package.json"))||t.fs.writeFile(k(d,"package.json"),`{"private": true}
206
+ `),t.io.stderr(`npx: installing ${f}
207
+ `);let h=await Nr({...t,io:{...t.io,stdout:()=>{}}},{add:[f]},d);if(h!==0)return h;if(u=Ae(t.fs,c,d,{PATH:""})??Ae(t.fs,t.fs.readdir(k(d,"node_modules/.bin"))[0]??c,d,{PATH:""}),!u)return t.io.stderr(`npx: ${f} has no executable named ${c}
208
+ `),1}return e.fork({}).exec([u,...a].map(Zn).join(" "),l,r,t.signal)}var Ml={pnpm:"9.12.0",yarn:"1.22.22"},Fl=new Set(["install","i"]),Ul=new Set(["remove","rm","uninstall","un"]),Pl=new Set(["test","t","start","init","ls","list","run","run-script"]);function jl(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 aa(t){return t.flatMap(e=>e==="--dev"||e==="-D"||e==="--save-dev"?["--save-dev"]:e==="--frozen-lockfile"||e==="--immutable"||e==="--prefer-offline"?[]:[e])}function Kl(t,e,r){let[n,...s]=e;return n===void 0?{tool:"npm",args:["install"]}:n==="-v"||n==="--version"?{version:Ml[t]}:Fl.has(n)?{tool:"npm",args:["install",...aa(s)]}:n==="add"?{tool:"npm",args:["install",...aa(s)]}:Ul.has(n)?{tool:"npm",args:["uninstall",...s]}:n==="dlx"||n==="exec"||t==="pnpm"&&n==="x"?{tool:"npx",args:s}:Pl.has(n)?{tool:"npm",args:[n,...s]}:jl(r,n)?{tool:"npm",args:["run",n,...s.length?["--",...s]:[]]}:Ae(r.fs,n,r.cwd,{PATH:""})?{tool:"npx",args:[n,...s]}:{error:`${t}: no script or command named "${n}"`}}function ca(t){return async(e,r,n)=>{let s=Kl(t,e.args,e);if("version"in s)return e.io.stdout(`${s.version}
206
209
  `),0;if("error"in s)return e.io.stderr(`${s.error}
207
- `),1;let i={...e,args:s.args,name:s.tool};return s.tool==="npm"?Dr(i,r,n):_t(i,r,n)}}var Ko=jo("pnpm"),Ho=jo("yarn");var gl={npm:Dr,npx:_t,pnpm:Ko,yarn:Ho};function Or(t,e=[]){return new Ir({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:gl})}function Wo(t,e){let r=new ne,n=t.io.terminal;if(!n){let a=t.io.onStdin(c=>r.push(c));return{input:{queue:r},stop:a}}n.setRawMode(!0);let s,i=new He({echo:a=>t.io.stdout(a),deliver:a=>r.push(a),signal:a=>e?.abort(a)}),o=t.io.onStdin(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 Jo(t,e,r){let n=new AbortController,s=()=>n.abort(t.signal.reason);t.signal.addEventListener("abort",s);let{input:i,stop:o}=Wo(t,n);try{return await e.exec(r,Jn(t),i,n.signal)}finally{o(),t.signal.removeEventListener("abort",s)}}var Jn=t=>({stdout:e=>t.io.stdout(e),stderr:e=>t.io.stderr(e),isTerminal:!!t.io.terminal});function ml(t,e){return e&&(t===e||t.startsWith(e+"/"))?"~"+t.slice(e.length):t}function wl(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=Fn(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:I(t.cwd,c))?c+"/":c);if(!n)return o.sort();let a=new Set([...Object.keys(Oe),...Object.keys(Fe),...Br]);for(let c of tt(t.cwd))for(let f of s.readdir(c))a.add(f);return[...[...a].filter(c=>c.startsWith(r)).sort(),...o.filter(c=>c.endsWith("/"))]}}async function yl(t){let e=t.io.terminal,r=Or(t),n=Jn(t);e.setRawMode(!0);let s=new kr({write:w=>t.io.stdout(w),history:r.history,complete:wl(r)}),i=()=>`\x1B[1;36m${ml(r.cwd,r.env.HOME)}\x1B[0m \x1B[1;32m$\x1B[0m `,o,a="",c="",f,l=new Promise(w=>f=w),u=async w=>{let E=new ne,v=new AbortController,A=new He({echo:y=>t.io.stdout(y),deliver:y=>E.push(y),signal:y=>v.abort(y)}),b={controller:v,input:{queue:E},discipline:A};b.input.setRawSink=y=>void(b.rawSink=y),o=b;try{await r.exec(w,n,b.input,v.signal)}catch(y){t.io.stderr(`bfsh: ${y instanceof Error?y.message:String(y)}
208
- `)}if(o=void 0,r.exitRequested!==void 0)return f(r.exitRequested);if(s.begin(i()),c){let y=c;c="",d(y)}},d=w=>{if(o){o.rawSink?o.rawSink(w):o.discipline.input(w);return}let E=w;for(;E&&!o;){let{event:v,rest:A}=s.feed(E);if(E=A,!v)break;if(v.type==="eof")return t.io.stdout(`exit\r
209
- `),f(r.lastStatus);if(v.type==="interrupt"){a="",r.lastStatus=130,s.begin(i());continue}let b=a?`${a}
210
- ${v.line}`:v.line;try{vr(b)}catch(y){if(y instanceof F&&y.incomplete){a=b,s.begin("> ");continue}}if(a="",!b.trim()){s.begin(i());continue}c=E,E="",u(b)}},h=t.io.onStdin(w=>w===null?f(r.lastStatus):d(w)),g=()=>{o?.controller.abort("SIGHUP"),f(129)};t.signal.addEventListener("abort",g),s.begin(i());let m=await l;return h(),t.signal.removeEventListener("abort",g),e.setRawMode(!1),m}var Tt=async t=>{let e=t.args.filter(a=>a!=="-l"&&a!=="--login"&&a!=="-i");if(e[0]==="-c")return Jo(t,Or(t,e.slice(2)),e[1]??"");if(e[0]){let a=e[0].startsWith("/")?e[0]:I(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
211
- `),127):Jo(t,Or(t,e.slice(1)),c.replace(/^#!.*\n/,""))}if(t.io.terminal)return yl(t);let{input:r,stop:n}=Wo(t),s=await r.queue.readAll();n();let i=Or(t),o=new ne;return o.push(null),i.exec(s,Jn(t),{queue:o},t.signal)};var El=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function Nr(t){return e=>Tt({...e,args:["-c",[t,...e.args].map(El).join(" ")]})}function Wn(){let t={node:to,bfsh:Tt,sh:Tt,bash:Tt,npm:Nr("npm"),npx:Nr("npx"),pnpm:Nr("pnpm"),yarn:Nr("yarn")};for(let[e,r]of Object.entries(Fe))t[e]=so(r,e);return t}function qo(t,e){return`${t}__port/${e}/`}var bl=new TextEncoder;function zo(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=on(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:bl.encode(String(a instanceof Error?a.stack:a))}),t({type:"response-end",reqId:e}),o())}),()=>{i?.(),o()}}var Rr=class{constructor(){p(this,"heads",new Map);p(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=vt(()=>{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 Cl=49152;function Go(t){let e=new gt,r=new Map,n=new Set,s=new Map,i=new Rr,o=new Map,a=new Map,c=1,f=1,l=!1,u=[],d=!1,h,g=Wn(),m=()=>{if(d=!1,!u.length)return;let A=u;u=[],t.post({type:"fs",ops:A})};e.watch(A=>{l||(A.type==="write"?u.push({op:"write",path:A.path,content:e.readFile(A.path)}):u.push({op:A.type,path:A.path}),d||(d=!0,queueMicrotask(m)))});let w=A=>{l=!0;try{for(let b of A)b.op==="write"?e.writeFile(b.path,b.content):b.op==="mkdir"?e.mkdir(b.path):e.rm(b.path)}finally{l=!1}};function E(A,b,y={}){m();let B=c++,S=new Set,C=new Set,Q,k=new Promise(x=>Q=x);return s.set(B,{stdout:S,stderr:C,exit:Q}),t.post({type:"spawn",childId:B,command:A,args:b,cwd:y.cwd,env:y.env,terminal:y.terminal}),{pid:B,onStdout:x=>(S.add(x),()=>S.delete(x)),onStderr:x=>(C.add(x),()=>C.delete(x)),write:x=>t.post({type:"child-stdin",childId:B,data:x}),closeStdin:()=>t.post({type:"child-stdin",childId:B,data:null}),kill:(x="SIGTERM")=>t.post({type:"child-kill",childId:B,signal:x}),resize:(x,R)=>t.post({type:"child-resize",childId:B,cols:x,rows:R}),exit:k}}function v(A){l=!0;for(let B of A.dirs)e.mkdir(B);for(let[B,S]of A.files)e.writeFile(B,S);l=!1;for(let B of A.ports)n.add(B);let b={fs:e,fetch:t.fetch,spawn(B,S,C={}){let Q=C.cwd??A.cwd,k={...A.env,...C.env};if(!Gt(e,g,B,S,Q,k))throw cn(B);return E(B,S,{...C,cwd:Q,env:k})},listen(B,S,C){let Q=B;if(!Q)for(Q=Cl+A.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 k={handler:S,upgrade:C};return r.set(Q,k),t.post({type:"listen",port:Q}),{port:Q,close(){r.get(Q)===k&&(r.delete(Q),n.delete(Q),t.post({type:"unlisten",port:Q}))}}},loopback(B,S){let C=r.get(B);if(C)return C.handler(S);let Q=f++,k=i.expect(Q,()=>t.post({type:"request-cancel",reqId:Q}));return t.post({type:"loopback",reqId:Q,port:B,request:S}),k},serverUrl:B=>new URL(qo(A.previewBase,B),A.previewOrigin).href,announceServer:(B,S)=>t.post({type:"listening",port:B,url:S}),previewUrl:A.previewUrl,registry:A.registry,packageCache:A.packageCache?t.packageCache?.():void 0,ownsRealm:t.ownsRealm,trapUncaught:t.trapUncaught},y=Gt(e,g,A.command,A.args,A.cwd,A.env);if(!y){t.post({type:"stderr",data:`bfsh: command not found: ${A.command}
212
- `}),t.post({type:"exit",code:127});return}h=ln({program:y.program,args:y.args,system:b,cwd:A.cwd,env:A.env,terminal:A.terminal,pid:A.pid}),h.onStdout(B=>t.post({type:"stdout",data:B})),h.onStderr(B=>t.post({type:"stderr",data:B})),h.exit.then(B=>{m(),t.post({type:"exit",code:B})})}return{receive(A){switch(A.type){case"start":return v(A);case"stdin":A.data===null?h?.closeStdin():h?.write(A.data);return;case"kill":return h?.kill(A.signal);case"resize":return h?.resize?.(A.cols,A.rows);case"fs":return w(A.ops);case"ports":for(let b of A.open)n.add(b);for(let b of A.closed)r.has(b)||n.delete(b);return;case"child-out":for(let b of s.get(A.childId)?.[A.stream]??[])b(A.data);return;case"child-exit":s.get(A.childId)?.exit(A.code),s.delete(A.childId);return;case"child-error":{let b=s.get(A.childId);for(let y of b?.stderr??[])y(`${A.message}
213
- `);b?.exit(A.code==="ENOENT"?127:1),s.delete(A.childId);return}case"http-request":{let{reqId:b}=A,y=r.get(A.port),B=y?y.handler(A.request):Promise.resolve(Qt(502,`Nothing is listening on port ${A.port}.`));o.set(b,zo(t.post,b,B,()=>o.delete(b)));return}case"request-cancel":return o.get(A.reqId)?.();case"response-head":case"response-chunk":case"response-end":return i.receive(A);case"socket-open":{let{connId:b}=A,y=r.get(A.port)?.upgrade;if(!y)return t.post({type:"socket-close",connId:b});let[B,S]=an();a.set(b,B),B.onData(C=>t.post({type:"socket-data",connId:b,data:C})),B.onClose(()=>{a.delete(b),t.post({type:"socket-close",connId:b})}),y(A.request,S);return}case"socket-data":return a.get(A.connId)?.send(A.data);case"socket-close":a.get(A.connId)?.close(),a.delete(A.connId);return}}}}function Yo(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 _r=globalThis,vl=globalThis.fetch.bind(globalThis),Ql,ut=new Set;_r.addEventListener("error",t=>{if(ut.size){t.preventDefault();for(let e of ut)e(t.error??new Error(t.message))}});_r.addEventListener("unhandledrejection",t=>{if(ut.size){t.preventDefault();for(let e of ut)e(t.reason)}});var Bl=Go({post:t=>_r.postMessage(t),fetch:(t,e)=>vl(t,e),packageCache:()=>Ql??(Ql=Yo()),ownsRealm:!0,trapUncaught(t){return ut.add(t),()=>ut.delete(t)}});_r.addEventListener("message",t=>Bl.receive(t.data));})();
210
+ `),1;let i={...e,args:s.args,name:s.tool};return s.tool==="npm"?Tr(i,r,n):Ut(i,r,n)}}var la=ca("pnpm"),fa=ca("yarn");var Hl={npm:Tr,npx:Ut,pnpm:la,yarn:fa};function Lr(t,e=[]){return new _r({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:Hl})}function da(t,e){let r=new se,n=t.io.terminal;if(!n){let a=t.io.onStdin(ie(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(ie(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 ua(t,e,r){let n=new AbortController,s=()=>n.abort(t.signal.reason);t.signal.addEventListener("abort",s);let{input:i,stop:o}=da(t,n);try{return await e.exec(r,Xn(t),i,n.signal)}finally{o(),t.signal.removeEventListener("abort",s)}}var Xn=t=>({stdout:e=>t.io.stdout(e),stderr:e=>t.io.stderr(e),isTerminal:!!t.io.terminal});function Wl(t,e){return e&&(t===e||t.startsWith(e+"/"))?"~"+t.slice(e.length):t}function Jl(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=qn(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(Ne),...Object.keys(Ke),...Dr]);for(let c of it(t.cwd))for(let l of s.readdir(c))a.add(l);return[...[...a].filter(c=>c.startsWith(r)).sort(),...o.filter(c=>c.endsWith("/"))]}}async function ql(t){let e=t.io.terminal,r=Lr(t),n=Xn(t);e.setRawMode(!0);let s=new Rr({write:b=>t.io.stdout(b),history:r.history,complete:Jl(r)}),i=()=>`\x1B[1;36m${Wl(r.cwd,r.env.HOME)}\x1B[0m \x1B[1;32m$\x1B[0m `,o,a="",c="",l,u=new Promise(b=>l=b),f=async b=>{let y=new se,C=new AbortController,p=new ze({echo:m=>t.io.stdout(m),deliver:m=>y.push(m),signal:m=>C.abort(m)}),A={controller:C,input:{queue:y},discipline:p};A.input.setRawSink=m=>void(A.rawSink=m),o=A;try{await r.exec(b,n,A.input,C.signal)}catch(m){t.io.stderr(`bfsh: ${m instanceof Error?m.message:String(m)}
211
+ `)}if(o=void 0,r.exitRequested!==void 0)return l(r.exitRequested);if(s.begin(i()),c){let m=c;c="",d(m)}},d=b=>{if(o){o.rawSink?o.rawSink(b):o.discipline.input(b);return}let y=b;for(;y&&!o;){let{event:C,rest:p}=s.feed(y);if(y=p,!C)break;if(C.type==="eof")return t.io.stdout(`exit\r
212
+ `),l(r.lastStatus);if(C.type==="interrupt"){a="",r.lastStatus=130,s.begin(i());continue}let A=a?`${a}
213
+ ${C.line}`:C.line;try{kr(A)}catch(m){if(m instanceof j&&m.incomplete){a=A,s.begin("> ");continue}}if(a="",!A.trim()){s.begin(i());continue}c=y,y="",f(A)}},h=t.io.onStdin(ie(b=>b===null?l(r.lastStatus):d(b))),w=()=>{o?.controller.abort("SIGHUP"),l(129)};t.signal.addEventListener("abort",w),s.begin(i());let E=await u;return h(),t.signal.removeEventListener("abort",w),e.setRawMode(!1),E}var Pt=async t=>{let e=t.args.filter(a=>a!=="-l"&&a!=="--login"&&a!=="-i");if(e[0]==="-c")return ua(t,Lr(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):ua(t,Lr(t,e.slice(1)),c.replace(/^#!.*\n/,""))}if(t.io.terminal)return ql(t);let{input:r,stop:n}=da(t),s=await r.queue.readAll();n();let i=Lr(t),o=new se;return o.push(null),i.exec(s,Xn(t),{queue:o},t.signal)};var zl=t=>/^[\w@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`;function $r(t){return e=>Pt({...e,args:["-c",[t,...e.args].map(zl).join(" ")]})}function es(){let t={node:Co,bfsh:Pt,sh:Pt,bash:Pt,npm:$r("npm"),npx:$r("npx"),pnpm:$r("pnpm"),yarn:$r("yarn")};for(let[e,r]of Object.entries(Ke))t[e]=Qo(r,e);return t}function ha(t,e){return`${t}__port/${e}/`}var Gl=new TextEncoder;function pa(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:fn(a)}),i=un(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:Gl.encode(String(a instanceof Error?a.stack:a))}),t({type:"response-end",reqId:e}),o())}),()=>{i?.(),o()}}var Mr=class{constructor(){g(this,"heads",new Map);g(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=xt(()=>{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 Yl=49152;function Aa(t){let e=new bt,r=new Map,n=new Set,s=new Map,i,o=new Mr,a=new Map,c=new Map,l=1,u=1,f=!1,d=[],h=!1,w,E=es(),b=()=>{if(h=!1,!d.length)return;let A=d;d=[],t.post({type:"fs",ops:A})};e.watch(A=>{f||(A.type==="write"?d.push({op:"write",path:A.path,content:e.readFile(A.path)}):d.push({op:A.type,path:A.path}),h||(h=!0,queueMicrotask(b)))});let y=A=>{f=!0;try{for(let m of A)m.op==="write"?e.writeFile(m.path,m.content):m.op==="mkdir"?e.mkdir(m.path):e.rm(m.path)}finally{f=!1}};function C(A,m,Q={}){b();let B=l++,v=new Set,S=new Set,I,x=new Promise(T=>I=T),_=Q.ipc?rr(T=>t.post({type:"child-ipc",childId:B,data:T}),()=>t.post({type:"child-ipc-disconnect",childId:B})):void 0;return s.set(B,{stdout:v,stderr:S,exit:I,ipc:_}),t.post({type:"spawn",childId:B,command:A,args:m,cwd:Q.cwd,env:Q.env,terminal:Q.terminal,ipc:Q.ipc,thread:Q.thread}),{pid:B,onStdout:T=>(v.add(T),()=>v.delete(T)),onStderr:T=>(S.add(T),()=>S.delete(T)),write:T=>t.post({type:"child-stdin",childId:B,data:T}),closeStdin:()=>t.post({type:"child-stdin",childId:B,data:null}),kill:(T="SIGTERM")=>t.post({type:"child-kill",childId:B,signal:T}),resize:(T,H)=>t.post({type:"child-resize",childId:B,cols:T,rows:H}),exit:x,ipc:_?.endpoint}}function p(A){f=!0;for(let B of A.dirs)e.mkdir(B);for(let[B,v]of A.files)e.writeFile(B,v);f=!1;for(let B of A.ports)n.add(B);let m={fs:e,fetch:t.fetch,spawn(B,v,S={}){let I=S.cwd??A.cwd,x={...A.env,...S.env};if(!tr(e,E,B,v,I,x))throw hn(B);return C(B,v,{...S,cwd:I,env:x})},listen(B,v,S){let I=B;if(!I)for(I=Yl+A.pid%1e3*8;n.has(I);I++);if(n.has(I))throw Object.assign(new Error(`listen EADDRINUSE: address already in use :::${I}`),{code:"EADDRINUSE",errno:-98,syscall:"listen",port:I});n.add(I);let x={handler:v,upgrade:S};return r.set(I,x),t.post({type:"listen",port:I}),{port:I,close(){r.get(I)===x&&(r.delete(I),n.delete(I),t.post({type:"unlisten",port:I}))}}},loopback(B,v){let S=r.get(B);if(S)return S.handler(v);let I=u++,x=o.expect(I,()=>t.post({type:"request-cancel",reqId:I}));return t.post({type:"loopback",reqId:I,port:B,request:v}),x},serverUrl:B=>new URL(ha(A.previewBase,B),A.previewOrigin).href,announceServer:(B,v)=>t.post({type:"listening",port:B,url:v}),previewUrl:A.previewUrl,registry:A.registry,packageCache:A.packageCache?t.packageCache?.():void 0,ownsRealm:t.ownsRealm,trapUncaught:t.trapUncaught},Q=tr(e,E,A.command,A.args,A.cwd,A.env);if(!Q){t.post({type:"stderr",data:`bfsh: command not found: ${A.command}
215
+ `}),t.post({type:"exit",code:127});return}A.ipc&&(i=rr(B=>t.post({type:"ipc",data:B}),()=>t.post({type:"ipc-disconnect"}))),w=pn({program:Q.program,args:Q.args,system:m,cwd:A.cwd,env:A.env,terminal:A.terminal,pid:A.pid,thread:A.thread,channel:i?.endpoint}),w.onStdout(B=>t.post({type:"stdout",data:B})),w.onStderr(B=>t.post({type:"stderr",data:B})),w.exit.then(B=>{b(),t.post({type:"exit",code:B})})}return{receive(A){switch(A.type){case"start":return p(A);case"stdin":A.data===null?w?.closeStdin():w?.write(A.data);return;case"kill":return w?.kill(A.signal);case"resize":return w?.resize?.(A.cols,A.rows);case"fs":return y(A.ops);case"ports":for(let m of A.open)n.add(m);for(let m of A.closed)r.has(m)||n.delete(m);return;case"child-out":for(let m of s.get(A.childId)?.[A.stream]??[])m(A.data);return;case"child-exit":s.get(A.childId)?.ipc?.closed(),s.get(A.childId)?.exit(A.code),s.delete(A.childId);return;case"child-ipc":return s.get(A.childId)?.ipc?.receive(A.data);case"child-ipc-disconnect":return s.get(A.childId)?.ipc?.closed();case"ipc":return i?.receive(A.data);case"ipc-disconnect":return i?.closed();case"child-error":{let m=s.get(A.childId);for(let Q of m?.stderr??[])Q(`${A.message}
216
+ `);m?.exit(A.code==="ENOENT"?127:1),s.delete(A.childId);return}case"http-request":{let{reqId:m}=A,Q=r.get(A.port),B=Q?Q.handler(A.request):Promise.resolve(Dt(502,`Nothing is listening on port ${A.port}.`));a.set(m,pa(t.post,m,B,()=>a.delete(m)));return}case"request-cancel":return a.get(A.reqId)?.();case"response-head":case"response-chunk":case"response-end":return o.receive(A);case"socket-open":{let{connId:m}=A,Q=r.get(A.port)?.upgrade;if(!Q)return t.post({type:"socket-close",connId:m});let[B,v]=dn();c.set(m,B),B.onData(S=>t.post({type:"socket-data",connId:m,data:S})),B.onClose(()=>{c.delete(m),t.post({type:"socket-close",connId:m})}),Q(A.request,v);return}case"socket-data":return c.get(A.connId)?.send(A.data);case"socket-close":c.get(A.connId)?.close(),c.delete(A.connId);return}}}}function ga(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 Fr=globalThis,Vl=globalThis.fetch.bind(globalThis),Zl,mt=new Set;Fr.addEventListener("error",t=>{if(mt.size){t.preventDefault();for(let e of mt)e(t.error??new Error(t.message))}});Fr.addEventListener("unhandledrejection",t=>{if(mt.size){t.preventDefault();for(let e of mt)e(t.reason)}});var Xl=Aa({post:t=>Fr.postMessage(t),fetch:(t,e)=>Vl(t,e),packageCache:()=>Zl??(Zl=ga()),ownsRealm:!0,trapUncaught(t){return mt.add(t),()=>mt.delete(t)}});Fr.addEventListener("message",t=>Xl.receive(t.data));})();