@zenfs/core 0.4.1 → 0.4.2
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.
- package/dist/backends/backend.d.ts +1 -1
- package/dist/backends/backend.js +1 -1
- package/dist/browser.min.js +3 -3
- package/dist/browser.min.js.map +3 -3
- package/dist/stats.d.ts +16 -0
- package/dist/stats.js +30 -0
- package/license.md +3 -3
- package/package.json +5 -5
- package/readme.md +12 -12
package/dist/browser.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var ZenFS=(()=>{var Kc=Object.create;var It=Object.defineProperty;var Yc=Object.getOwnPropertyDescriptor;var Xc=Object.getOwnPropertyNames;var Jc=Object.getPrototypeOf,Qc=Object.prototype.hasOwnProperty;var Zc=(t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var s=(t,e)=>It(t,"name",{value:e,configurable:!0});var N=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Hi=(t,e)=>{for(var i in e)It(t,i,{get:e[i],enumerable:!0})},os=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xc(e))!Qc.call(t,n)&&n!==i&&It(t,n,{get:()=>e[n],enumerable:!(r=Yc(e,n))||r.enumerable});return t};var eu=(t,e,i)=>(i=t!=null?Kc(Jc(t)):{},os(e||!t||!t.__esModule?It(i,"default",{value:t,enumerable:!0}):i,t)),tu=t=>os(It({},"__esModule",{value:!0}),t);var mi=(t,e,i)=>(Zc(t,typeof e!="symbol"?e+"":e,i),i);var ws=N(dr=>{"use strict";dr.byteLength=Ad;dr.toByteArray=Nd;dr.fromByteArray=Id;var Pe=[],be=[],vd=typeof Uint8Array<"u"?Uint8Array:Array,Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pt=0,bs=Mn.length;pt<bs;++pt)Pe[pt]=Mn[pt],be[Mn.charCodeAt(pt)]=pt;var pt,bs;be["-".charCodeAt(0)]=62;be["_".charCodeAt(0)]=63;function gs(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var r=i===e?0:4-i%4;return[i,r]}s(gs,"getLens");function Ad(t){var e=gs(t),i=e[0],r=e[1];return(i+r)*3/4-r}s(Ad,"byteLength");function kd(t,e,i){return(e+i)*3/4-i}s(kd,"_byteLength");function Nd(t){var e,i=gs(t),r=i[0],n=i[1],o=new vd(kd(t,r,n)),a=0,l=n>0?r-4:r,u;for(u=0;u<l;u+=4)e=be[t.charCodeAt(u)]<<18|be[t.charCodeAt(u+1)]<<12|be[t.charCodeAt(u+2)]<<6|be[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=be[t.charCodeAt(u)]<<2|be[t.charCodeAt(u+1)]>>4,o[a++]=e&255),n===1&&(e=be[t.charCodeAt(u)]<<10|be[t.charCodeAt(u+1)]<<4|be[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}s(Nd,"toByteArray");function Td(t){return Pe[t>>18&63]+Pe[t>>12&63]+Pe[t>>6&63]+Pe[t&63]}s(Td,"tripletToBase64");function Fd(t,e,i){for(var r,n=[],o=e;o<i;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Td(r));return n.join("")}s(Fd,"encodeChunk");function Id(t){for(var e,i=t.length,r=i%3,n=[],o=16383,a=0,l=i-r;a<l;a+=o)n.push(Fd(t,a,a+o>l?l:a+o));return r===1?(e=t[i-1],n.push(Pe[e>>2]+Pe[e<<4&63]+"==")):r===2&&(e=(t[i-2]<<8)+t[i-1],n.push(Pe[e>>10]+Pe[e>>4&63]+Pe[e<<2&63]+"=")),n.join("")}s(Id,"fromByteArray")});var Ss=N(Un=>{Un.read=function(t,e,i,r,n){var o,a,l=n*8-r-1,u=(1<<l)-1,f=u>>1,d=-7,h=i?n-1:0,b=i?-1:1,m=t[e+h];for(h+=b,o=m&(1<<-d)-1,m>>=-d,d+=l;d>0;o=o*256+t[e+h],h+=b,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=a*256+t[e+h],h+=b,d-=8);if(o===0)o=1-f;else{if(o===u)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-f}return(m?-1:1)*a*Math.pow(2,o-r)};Un.write=function(t,e,i,r,n,o){var a,l,u,f=o*8-n-1,d=(1<<f)-1,h=d>>1,b=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:o-1,g=r?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=d):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=b/u:e+=b*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=d?(l=0,a=d):a+h>=1?(l=(e*u-1)*Math.pow(2,n),a=a+h):(l=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[i+m]=l&255,m+=g,l/=256,n-=8);for(a=a<<n|l,f+=n;f>0;t[i+m]=a&255,m+=g,a/=256,f-=8);t[i+m-g]|=y*128}});var $e=N(Qt=>{"use strict";var Wn=ws(),Xt=Ss(),_s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qt.Buffer=p;Qt.SlowBuffer=Bd;Qt.INSPECT_MAX_BYTES=50;var hr=2147483647;Qt.kMaxLength=hr;p.TYPED_ARRAY_SUPPORT=Pd();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Pd(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}s(Pd,"typedArraySupport");Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function je(t){if(t>hr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}s(je,"createBuffer");function p(t,e,i){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return zn(t)}return As(t,e,i)}s(p,"Buffer");p.poolSize=8192;function As(t,e,i){if(typeof t=="string")return Ld(t,e);if(ArrayBuffer.isView(t))return Rd(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ce(t,ArrayBuffer)||t&&Ce(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ce(t,SharedArrayBuffer)||t&&Ce(t.buffer,SharedArrayBuffer)))return jn(t,e,i);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return p.from(r,e,i);let n=Od(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s(As,"from");p.from=function(t,e,i){return As(t,e,i)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function ks(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}s(ks,"assertSize");function Cd(t,e,i){return ks(t),t<=0?je(t):e!==void 0?typeof i=="string"?je(t).fill(e,i):je(t).fill(e):je(t)}s(Cd,"alloc");p.alloc=function(t,e,i){return Cd(t,e,i)};function zn(t){return ks(t),je(t<0?0:Vn(t)|0)}s(zn,"allocUnsafe");p.allocUnsafe=function(t){return zn(t)};p.allocUnsafeSlow=function(t){return zn(t)};function Ld(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let i=Ns(t,e)|0,r=je(i),n=r.write(t,e);return n!==i&&(r=r.slice(0,n)),r}s(Ld,"fromString");function qn(t){let e=t.length<0?0:Vn(t.length)|0,i=je(e);for(let r=0;r<e;r+=1)i[r]=t[r]&255;return i}s(qn,"fromArrayLike");function Rd(t){if(Ce(t,Uint8Array)){let e=new Uint8Array(t);return jn(e.buffer,e.byteOffset,e.byteLength)}return qn(t)}s(Rd,"fromArrayView");function jn(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&i===void 0?r=new Uint8Array(t):i===void 0?r=new Uint8Array(t,e):r=new Uint8Array(t,e,i),Object.setPrototypeOf(r,p.prototype),r}s(jn,"fromArrayBuffer");function Od(t){if(p.isBuffer(t)){let e=Vn(t.length)|0,i=je(e);return i.length===0||t.copy(i,0,0,e),i}if(t.length!==void 0)return typeof t.length!="number"||Hn(t.length)?je(0):qn(t);if(t.type==="Buffer"&&Array.isArray(t.data))return qn(t.data)}s(Od,"fromObject");function Vn(t){if(t>=hr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr.toString(16)+" bytes");return t|0}s(Vn,"checked");function Bd(t){return+t!=t&&(t=0),p.alloc(+t)}s(Bd,"SlowBuffer");p.isBuffer=s(function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype},"isBuffer");p.compare=s(function(e,i){if(Ce(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),Ce(i,Uint8Array)&&(i=p.from(i,i.offset,i.byteLength)),!p.isBuffer(e)||!p.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;let r=e.length,n=i.length;for(let o=0,a=Math.min(r,n);o<a;++o)if(e[o]!==i[o]){r=e[o],n=i[o];break}return r<n?-1:n<r?1:0},"compare");p.isEncoding=s(function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");p.concat=s(function(e,i){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let r;if(i===void 0)for(i=0,r=0;r<e.length;++r)i+=e[r].length;let n=p.allocUnsafe(i),o=0;for(r=0;r<e.length;++r){let a=e[r];if(Ce(a,Uint8Array))o+a.length>n.length?(p.isBuffer(a)||(a=p.from(a)),a.copy(n,o)):Uint8Array.prototype.set.call(n,a,o);else if(p.isBuffer(a))a.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return n},"concat");function Ns(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ce(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let i=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&i===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return $n(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Bs(t).length;default:if(n)return r?-1:$n(t).length;e=(""+e).toLowerCase(),n=!0}}s(Ns,"byteLength");p.byteLength=Ns;function Dd(t,e,i){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,e>>>=0,i<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Hd(this,e,i);case"utf8":case"utf-8":return Fs(this,e,i);case"ascii":return Vd(this,e,i);case"latin1":case"binary":return Gd(this,e,i);case"base64":return $d(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kd(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}s(Dd,"slowToString");p.prototype._isBuffer=!0;function yt(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}s(yt,"swap");p.prototype.swap16=s(function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<e;i+=2)yt(this,i,i+1);return this},"swap16");p.prototype.swap32=s(function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<e;i+=4)yt(this,i,i+3),yt(this,i+1,i+2);return this},"swap32");p.prototype.swap64=s(function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<e;i+=8)yt(this,i,i+7),yt(this,i+1,i+6),yt(this,i+2,i+5),yt(this,i+3,i+4);return this},"swap64");p.prototype.toString=s(function(){let e=this.length;return e===0?"":arguments.length===0?Fs(this,0,e):Dd.apply(this,arguments)},"toString");p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=s(function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0},"equals");p.prototype.inspect=s(function(){let e="",i=Qt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},"inspect");_s&&(p.prototype[_s]=p.prototype.inspect);p.prototype.compare=s(function(e,i,r,n,o){if(Ce(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(i===void 0&&(i=0),r===void 0&&(r=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),i<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&i>=r)return 0;if(n>=o)return-1;if(i>=r)return 1;if(i>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;let a=o-n,l=r-i,u=Math.min(a,l),f=this.slice(n,o),d=e.slice(i,r);for(let h=0;h<u;++h)if(f[h]!==d[h]){a=f[h],l=d[h];break}return a<l?-1:l<a?1:0},"compare");function Ts(t,e,i,r,n){if(t.length===0)return-1;if(typeof i=="string"?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,Hn(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0)if(n)i=0;else return-1;if(typeof e=="string"&&(e=p.from(e,r)),p.isBuffer(e))return e.length===0?-1:Es(t,e,i,r,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):Es(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}s(Ts,"bidirectionalIndexOf");function Es(t,e,i,r,n){let o=1,a=t.length,l=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,i/=2}function u(d,h){return o===1?d[h]:d.readUInt16BE(h*o)}s(u,"read");let f;if(n){let d=-1;for(f=i;f<a;f++)if(u(t,f)===u(e,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===l)return d*o}else d!==-1&&(f-=f-d),d=-1}else for(i+l>a&&(i=a-l),f=i;f>=0;f--){let d=!0;for(let h=0;h<l;h++)if(u(t,f+h)!==u(e,h)){d=!1;break}if(d)return f}return-1}s(Es,"arrayIndexOf");p.prototype.includes=s(function(e,i,r){return this.indexOf(e,i,r)!==-1},"includes");p.prototype.indexOf=s(function(e,i,r){return Ts(this,e,i,r,!0)},"indexOf");p.prototype.lastIndexOf=s(function(e,i,r){return Ts(this,e,i,r,!1)},"lastIndexOf");function Md(t,e,i,r){i=Number(i)||0;let n=t.length-i;r?(r=Number(r),r>n&&(r=n)):r=n;let o=e.length;r>o/2&&(r=o/2);let a;for(a=0;a<r;++a){let l=parseInt(e.substr(a*2,2),16);if(Hn(l))return a;t[i+a]=l}return a}s(Md,"hexWrite");function Ud(t,e,i,r){return pr($n(e,t.length-i),t,i,r)}s(Ud,"utf8Write");function Wd(t,e,i,r){return pr(Qd(e),t,i,r)}s(Wd,"asciiWrite");function qd(t,e,i,r){return pr(Bs(e),t,i,r)}s(qd,"base64Write");function jd(t,e,i,r){return pr(Zd(e,t.length-i),t,i,r)}s(jd,"ucs2Write");p.prototype.write=s(function(e,i,r,n){if(i===void 0)n="utf8",r=this.length,i=0;else if(r===void 0&&typeof i=="string")n=i,r=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(r)?(r=r>>>0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-i;if((r===void 0||r>o)&&(r=o),e.length>0&&(r<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return Md(this,e,i,r);case"utf8":case"utf-8":return Ud(this,e,i,r);case"ascii":case"latin1":case"binary":return Wd(this,e,i,r);case"base64":return qd(this,e,i,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jd(this,e,i,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},"write");p.prototype.toJSON=s(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function $d(t,e,i){return e===0&&i===t.length?Wn.fromByteArray(t):Wn.fromByteArray(t.slice(e,i))}s($d,"base64Slice");function Fs(t,e,i){i=Math.min(t.length,i);let r=[],n=e;for(;n<i;){let o=t[n],a=null,l=o>239?4:o>223?3:o>191?2:1;if(n+l<=i){let u,f,d,h;switch(l){case 1:o<128&&(a=o);break;case 2:u=t[n+1],(u&192)===128&&(h=(o&31)<<6|u&63,h>127&&(a=h));break;case 3:u=t[n+1],f=t[n+2],(u&192)===128&&(f&192)===128&&(h=(o&15)<<12|(u&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:u=t[n+1],f=t[n+2],d=t[n+3],(u&192)===128&&(f&192)===128&&(d&192)===128&&(h=(o&15)<<18|(u&63)<<12|(f&63)<<6|d&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),n+=l}return zd(r)}s(Fs,"utf8Slice");var xs=4096;function zd(t){let e=t.length;if(e<=xs)return String.fromCharCode.apply(String,t);let i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=xs));return i}s(zd,"decodeCodePointsArray");function Vd(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]&127);return r}s(Vd,"asciiSlice");function Gd(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}s(Gd,"latin1Slice");function Hd(t,e,i){let r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);let n="";for(let o=e;o<i;++o)n+=eh[t[o]];return n}s(Hd,"hexSlice");function Kd(t,e,i){let r=t.slice(e,i),n="";for(let o=0;o<r.length-1;o+=2)n+=String.fromCharCode(r[o]+r[o+1]*256);return n}s(Kd,"utf16leSlice");p.prototype.slice=s(function(e,i){let r=this.length;e=~~e,i=i===void 0?r:~~i,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),i<0?(i+=r,i<0&&(i=0)):i>r&&(i=r),i<e&&(i=e);let n=this.subarray(e,i);return Object.setPrototypeOf(n,p.prototype),n},"slice");function K(t,e,i){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}s(K,"checkOffset");p.prototype.readUintLE=p.prototype.readUIntLE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e],o=1,a=0;for(;++a<i&&(o*=256);)n+=this[e+a]*o;return n},"readUIntLE");p.prototype.readUintBE=p.prototype.readUIntBE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e+--i],o=1;for(;i>0&&(o*=256);)n+=this[e+--i]*o;return n},"readUIntBE");p.prototype.readUint8=p.prototype.readUInt8=s(function(e,i){return e=e>>>0,i||K(e,1,this.length),this[e]},"readUInt8");p.prototype.readUint16LE=p.prototype.readUInt16LE=s(function(e,i){return e=e>>>0,i||K(e,2,this.length),this[e]|this[e+1]<<8},"readUInt16LE");p.prototype.readUint16BE=p.prototype.readUInt16BE=s(function(e,i){return e=e>>>0,i||K(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");p.prototype.readUint32LE=p.prototype.readUInt32LE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE");p.prototype.readUint32BE=p.prototype.readUInt32BE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"readUInt32BE");p.prototype.readBigUInt64LE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Pi(e,this.length-8);let n=i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))},"readBigUInt64LE"));p.prototype.readBigUInt64BE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Pi(e,this.length-8);let n=i*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(n)<<BigInt(32))+BigInt(o)},"readBigUInt64BE"));p.prototype.readIntLE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e],o=1,a=0;for(;++a<i&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*i)),n},"readIntLE");p.prototype.readIntBE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=i,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*i)),a},"readIntBE");p.prototype.readInt8=s(function(e,i){return e=e>>>0,i||K(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");p.prototype.readInt16LE=s(function(e,i){e=e>>>0,i||K(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r},"readInt16LE");p.prototype.readInt16BE=s(function(e,i){e=e>>>0,i||K(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r},"readInt16BE");p.prototype.readInt32LE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");p.prototype.readInt32BE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");p.prototype.readBigInt64LE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Pi(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)},"readBigInt64LE"));p.prototype.readBigInt64BE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Pi(e,this.length-8);let n=(i<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r)},"readBigInt64BE"));p.prototype.readFloatLE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),Xt.read(this,e,!0,23,4)},"readFloatLE");p.prototype.readFloatBE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),Xt.read(this,e,!1,23,4)},"readFloatBE");p.prototype.readDoubleLE=s(function(e,i){return e=e>>>0,i||K(e,8,this.length),Xt.read(this,e,!0,52,8)},"readDoubleLE");p.prototype.readDoubleBE=s(function(e,i){return e=e>>>0,i||K(e,8,this.length),Xt.read(this,e,!1,52,8)},"readDoubleBE");function se(t,e,i,r,n,o){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}s(se,"checkInt");p.prototype.writeUintLE=p.prototype.writeUIntLE=s(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;se(this,e,i,r,l,0)}let o=1,a=0;for(this[i]=e&255;++a<r&&(o*=256);)this[i+a]=e/o&255;return i+r},"writeUIntLE");p.prototype.writeUintBE=p.prototype.writeUIntBE=s(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;se(this,e,i,r,l,0)}let o=r-1,a=1;for(this[i+o]=e&255;--o>=0&&(a*=256);)this[i+o]=e/a&255;return i+r},"writeUIntBE");p.prototype.writeUint8=p.prototype.writeUInt8=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,1,255,0),this[i]=e&255,i+1},"writeUInt8");p.prototype.writeUint16LE=p.prototype.writeUInt16LE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,2,65535,0),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeUInt16LE");p.prototype.writeUint16BE=p.prototype.writeUInt16BE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,2,65535,0),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeUInt16BE");p.prototype.writeUint32LE=p.prototype.writeUInt32LE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,4,4294967295,0),this[i+3]=e>>>24,this[i+2]=e>>>16,this[i+1]=e>>>8,this[i]=e&255,i+4},"writeUInt32LE");p.prototype.writeUint32BE=p.prototype.writeUInt32BE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,4,4294967295,0),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeUInt32BE");function Is(t,e,i,r,n){Os(e,r,n,t,i,7);let o=Number(e&BigInt(4294967295));t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,i}s(Is,"wrtBigUInt64LE");function Ps(t,e,i,r,n){Os(e,r,n,t,i,7);let o=Number(e&BigInt(4294967295));t[i+7]=o,o=o>>8,t[i+6]=o,o=o>>8,t[i+5]=o,o=o>>8,t[i+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=a,a=a>>8,t[i+2]=a,a=a>>8,t[i+1]=a,a=a>>8,t[i]=a,i+8}s(Ps,"wrtBigUInt64BE");p.prototype.writeBigUInt64LE=nt(s(function(e,i=0){return Is(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));p.prototype.writeBigUInt64BE=nt(s(function(e,i=0){return Ps(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));p.prototype.writeIntLE=s(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let u=Math.pow(2,8*r-1);se(this,e,i,r,u-1,-u)}let o=0,a=1,l=0;for(this[i]=e&255;++o<r&&(a*=256);)e<0&&l===0&&this[i+o-1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+r},"writeIntLE");p.prototype.writeIntBE=s(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let u=Math.pow(2,8*r-1);se(this,e,i,r,u-1,-u)}let o=r-1,a=1,l=0;for(this[i+o]=e&255;--o>=0&&(a*=256);)e<0&&l===0&&this[i+o+1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+r},"writeIntBE");p.prototype.writeInt8=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,1,127,-128),e<0&&(e=255+e+1),this[i]=e&255,i+1},"writeInt8");p.prototype.writeInt16LE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,2,32767,-32768),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeInt16LE");p.prototype.writeInt16BE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,2,32767,-32768),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeInt16BE");p.prototype.writeInt32LE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,4,2147483647,-2147483648),this[i]=e&255,this[i+1]=e>>>8,this[i+2]=e>>>16,this[i+3]=e>>>24,i+4},"writeInt32LE");p.prototype.writeInt32BE=s(function(e,i,r){return e=+e,i=i>>>0,r||se(this,e,i,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeInt32BE");p.prototype.writeBigInt64LE=nt(s(function(e,i=0){return Is(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));p.prototype.writeBigInt64BE=nt(s(function(e,i=0){return Ps(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Cs(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}s(Cs,"checkIEEE754");function Ls(t,e,i,r,n){return e=+e,i=i>>>0,n||Cs(t,e,i,4,34028234663852886e22,-34028234663852886e22),Xt.write(t,e,i,r,23,4),i+4}s(Ls,"writeFloat");p.prototype.writeFloatLE=s(function(e,i,r){return Ls(this,e,i,!0,r)},"writeFloatLE");p.prototype.writeFloatBE=s(function(e,i,r){return Ls(this,e,i,!1,r)},"writeFloatBE");function Rs(t,e,i,r,n){return e=+e,i=i>>>0,n||Cs(t,e,i,8,17976931348623157e292,-17976931348623157e292),Xt.write(t,e,i,r,52,8),i+8}s(Rs,"writeDouble");p.prototype.writeDoubleLE=s(function(e,i,r){return Rs(this,e,i,!0,r)},"writeDoubleLE");p.prototype.writeDoubleBE=s(function(e,i,r){return Rs(this,e,i,!1,r)},"writeDoubleBE");p.prototype.copy=s(function(e,i,r,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&n!==0&&(n=this.length),i>=e.length&&(i=e.length),i||(i=0),n>0&&n<r&&(n=r),n===r||e.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-i<n-r&&(n=e.length-i+r);let o=n-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),i),o},"copy");p.prototype.fill=s(function(e,i,r,n){if(typeof e=="string"){if(typeof i=="string"?(n=i,i=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(i<0||this.length<i||this.length<r)throw new RangeError("Out of range index");if(r<=i)return this;i=i>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let o;if(typeof e=="number")for(o=i;o<r;++o)this[o]=e;else{let a=p.isBuffer(e)?e:p.from(e,n),l=a.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-i;++o)this[o+i]=a[o%l]}return this},"fill");var Yt={};function Gn(t,e,i){Yt[t]=s(class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}},"NodeError")}s(Gn,"E");Gn("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Gn("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Gn("ERR_OUT_OF_RANGE",function(t,e,i){let r=`The value of "${t}" is out of range.`,n=i;return Number.isInteger(i)&&Math.abs(i)>2**32?n=vs(String(i)):typeof i=="bigint"&&(n=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(n=vs(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r},RangeError);function vs(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(vs,"addNumericalSeparator");function Yd(t,e,i){Jt(e,"offset"),(t[e]===void 0||t[e+i]===void 0)&&Pi(e,t.length-(i+1))}s(Yd,"checkBounds");function Os(t,e,i,r,n,o){if(t>i||t<e){let a=typeof e=="bigint"?"n":"",l;throw o>3?e===0||e===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:l=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:l=`>= ${e}${a} and <= ${i}${a}`,new Yt.ERR_OUT_OF_RANGE("value",l,t)}Yd(r,n,o)}s(Os,"checkIntBI");function Jt(t,e){if(typeof t!="number")throw new Yt.ERR_INVALID_ARG_TYPE(e,"number",t)}s(Jt,"validateNumber");function Pi(t,e,i){throw Math.floor(t)!==t?(Jt(t,i),new Yt.ERR_OUT_OF_RANGE(i||"offset","an integer",t)):e<0?new Yt.ERR_BUFFER_OUT_OF_BOUNDS:new Yt.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}s(Pi,"boundsError");var Xd=/[^+/0-9A-Za-z-_]/g;function Jd(t){if(t=t.split("=")[0],t=t.trim().replace(Xd,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}s(Jd,"base64clean");function $n(t,e){e=e||1/0;let i,r=t.length,n=null,o=[];for(let a=0;a<r;++a){if(i=t.charCodeAt(a),i>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=(n-55296<<10|i-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,i&63|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return o}s($n,"utf8ToBytes");function Qd(t){let e=[];for(let i=0;i<t.length;++i)e.push(t.charCodeAt(i)&255);return e}s(Qd,"asciiToBytes");function Zd(t,e){let i,r,n,o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)i=t.charCodeAt(a),r=i>>8,n=i%256,o.push(n),o.push(r);return o}s(Zd,"utf16leToBytes");function Bs(t){return Wn.toByteArray(Jd(t))}s(Bs,"base64ToBytes");function pr(t,e,i,r){let n;for(n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}s(pr,"blitBuffer");function Ce(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}s(Ce,"isInstance");function Hn(t){return t!==t}s(Hn,"numberIsNaN");var eh=function(){let t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){let r=i*16;for(let n=0;n<16;++n)e[r+n]=t[i]+t[n]}return e}();function nt(t){return typeof BigInt>"u"?th:t}s(nt,"defineBigIntMethod");function th(){throw new Error("BigInt not supported")}s(th,"BufferBigIntNotDefined")});var O=N((r_,Ds)=>{"use strict";Ds.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,i){return t.slice(e,i)},Error,FunctionPrototypeCall(t,e,...i){return t.call(e,...i)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,i){return Object.defineProperty(t,e,i)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,i){return t.then(e,i)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,i){return t.slice(e,i)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,i){return t.set(e,i)},Boolean,Uint8Array}});var Zt=N((n_,yr)=>{"use strict";var{AbortController:Ms,AbortSignal:ih}=typeof self<"u"?self:typeof window<"u"?window:void 0;yr.exports=Ms;yr.exports.AbortSignal=ih;yr.exports.default=Ms});var Ci=N((o_,Kn)=>{"use strict";var ei=typeof Reflect=="object"?Reflect:null,Us=ei&&typeof ei.apply=="function"?ei.apply:s(function(e,i,r){return Function.prototype.apply.call(e,i,r)},"ReflectApply"),mr;ei&&typeof ei.ownKeys=="function"?mr=ei.ownKeys:Object.getOwnPropertySymbols?mr=s(function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):mr=s(function(e){return Object.getOwnPropertyNames(e)},"ReflectOwnKeys");function rh(t){console&&console.warn&&console.warn(t)}s(rh,"ProcessEmitWarning");var qs=Number.isNaN||s(function(e){return e!==e},"NumberIsNaN");function P(){P.init.call(this)}s(P,"EventEmitter");Kn.exports=P;Kn.exports.once=ah;P.EventEmitter=P;P.prototype._events=void 0;P.prototype._eventsCount=0;P.prototype._maxListeners=void 0;var Ws=10;function br(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}s(br,"checkListener");Object.defineProperty(P,"defaultMaxListeners",{enumerable:!0,get:function(){return Ws},set:function(t){if(typeof t!="number"||t<0||qs(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ws=t}});P.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};P.prototype.setMaxListeners=s(function(e){if(typeof e!="number"||e<0||qs(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},"setMaxListeners");function js(t){return t._maxListeners===void 0?P.defaultMaxListeners:t._maxListeners}s(js,"_getMaxListeners");P.prototype.getMaxListeners=s(function(){return js(this)},"getMaxListeners");P.prototype.emit=s(function(e){for(var i=[],r=1;r<arguments.length;r++)i.push(arguments[r]);var n=e==="error",o=this._events;if(o!==void 0)n=n&&o.error===void 0;else if(!n)return!1;if(n){var a;if(i.length>0&&(a=i[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var u=o[e];if(u===void 0)return!1;if(typeof u=="function")Us(u,this,i);else for(var f=u.length,d=Hs(u,f),r=0;r<f;++r)Us(d[r],this,i);return!0},"emit");function $s(t,e,i,r){var n,o,a;if(br(i),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),a=o[e]),a===void 0)a=o[e]=i,++t._eventsCount;else if(typeof a=="function"?a=o[e]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),n=js(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,rh(l)}return t}s($s,"_addListener");P.prototype.addListener=s(function(e,i){return $s(this,e,i,!1)},"addListener");P.prototype.on=P.prototype.addListener;P.prototype.prependListener=s(function(e,i){return $s(this,e,i,!0)},"prependListener");function nh(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}s(nh,"onceWrapper");function zs(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=nh.bind(r);return n.listener=i,r.wrapFn=n,n}s(zs,"_onceWrap");P.prototype.once=s(function(e,i){return br(i),this.on(e,zs(this,e,i)),this},"once");P.prototype.prependOnceListener=s(function(e,i){return br(i),this.prependListener(e,zs(this,e,i)),this},"prependOnceListener");P.prototype.removeListener=s(function(e,i){var r,n,o,a,l;if(br(i),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===i||r.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||i));else if(typeof r!="function"){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===i||r[a].listener===i){l=r[a].listener,o=a;break}if(o<0)return this;o===0?r.shift():oh(r,o),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,l||i)}return this},"removeListener");P.prototype.off=P.prototype.removeListener;P.prototype.removeAllListeners=s(function(e){var i,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),a;for(n=0;n<o.length;++n)a=o[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=r[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(n=i.length-1;n>=0;n--)this.removeListener(e,i[n]);return this},"removeAllListeners");function Vs(t,e,i){var r=t._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?i?[n.listener||n]:[n]:i?sh(n):Hs(n,n.length)}s(Vs,"_listeners");P.prototype.listeners=s(function(e){return Vs(this,e,!0)},"listeners");P.prototype.rawListeners=s(function(e){return Vs(this,e,!1)},"rawListeners");P.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gs.call(t,e)};P.prototype.listenerCount=Gs;function Gs(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}s(Gs,"listenerCount");P.prototype.eventNames=s(function(){return this._eventsCount>0?mr(this._events):[]},"eventNames");function Hs(t,e){for(var i=new Array(e),r=0;r<e;++r)i[r]=t[r];return i}s(Hs,"arrayClone");function oh(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}s(oh,"spliceOne");function sh(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}s(sh,"unwrapListeners");function ah(t,e){return new Promise(function(i,r){function n(a){t.removeListener(e,o),r(a)}s(n,"errorListener");function o(){typeof t.removeListener=="function"&&t.removeListener("error",n),i([].slice.call(arguments))}s(o,"resolver"),Ks(t,e,o,{once:!0}),e!=="error"&&lh(t,n,{once:!0})})}s(ah,"once");function lh(t,e,i){typeof t.on=="function"&&Ks(t,"error",e,i)}s(lh,"addErrorHandlerIfEventEmitter");function Ks(t,e,i,r){if(typeof t.on=="function")r.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,s(function n(o){r.once&&t.removeEventListener(e,n),i(o)},"wrapListener"));else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}s(Ks,"eventTargetAgnosticAddListener")});var ee=N((a_,Yn)=>{"use strict";var ch=$e(),{kResistStopPropagation:uh,SymbolDispose:fh}=O(),dh=globalThis.AbortSignal||Zt().AbortSignal,hh=globalThis.AbortController||Zt().AbortController,ph=Object.getPrototypeOf(async function(){}).constructor,Ys=globalThis.Blob||ch.Blob,yh=s(typeof Ys<"u"?function(e){return e instanceof Ys}:function(e){return!1},"isBlob"),Xs=s((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},"validateAbortSignal"),mh=s((t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},"validateFunction"),gr=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let i="";for(let r=0;r<e.length;r++)i+=` ${e[r].stack}
|
|
2
|
-
`;super(i),this.name="AggregateError",this.errors=e}};s(gr,"AggregateError");Yn.exports={AggregateError:gr,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...i){e||(e=!0,t.apply(this,i))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,i)=>{t((r,...n)=>r?i(r):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[i,r]){let n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof ph},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:yh,deprecate(t,e){return t},addAbortListener:Ci().addAbortListener||s(function(e,i){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Xs(e,"signal"),mh(i,"listener");let r;return e.aborted?queueMicrotask(()=>i()):(e.addEventListener("abort",i,{__proto__:null,once:!0,[uh]:!0}),r=s(()=>{e.removeEventListener("abort",i)},"removeEventListener")),{__proto__:null,[fh](){var n;(n=r)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:dh.any||s(function(e){if(e.length===1)return e[0];let i=new hh,r=s(()=>i.abort(),"abort");return e.forEach(n=>{Xs(n,"signals"),n.addEventListener("abort",r,{once:!0})}),i.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",r))},{once:!0}),i.signal},"AbortSignalAny")};Yn.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ie=N((c_,Zs)=>{"use strict";var{format:bh,inspect:Sr,AggregateError:gh}=ee(),wh=globalThis.AggregateError||gh,Sh=Symbol("kIsNodeError"),_h=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Eh=/^([A-Z][a-z0-9]*)+$/,xh="__node_internal_",_r={};function mt(t,e){if(!t)throw new _r.ERR_INTERNAL_ASSERTION(e)}s(mt,"assert");function Js(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(Js,"addNumericalSeparator");function vh(t,e,i){if(typeof e=="function")return mt(e.length<=i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${e.length}).`),e(...i);let r=(e.match(/%[dfijoOs]/g)||[]).length;return mt(r===i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${r}).`),i.length===0?e:bh(e,...i)}s(vh,"getMessage");function Q(t,e,i){i||(i=Error);class r extends i{constructor(...o){super(vh(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}s(r,"NodeError"),Object.defineProperties(r.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=t,r.prototype[Sh]=!0,_r[t]=r}s(Q,"E");function Qs(t){let e=xh+t.name;return Object.defineProperty(t,"name",{value:e}),t}s(Qs,"hideStackFrames");function Ah(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let i=new wh([e,t],e.message);return i.code=e.code,i}return t||e}s(Ah,"aggregateTwoErrors");var wr=class extends Error{constructor(e="The operation was aborted",i=void 0){if(i!==void 0&&typeof i!="object")throw new _r.ERR_INVALID_ARG_TYPE("options","Object",i);super(e,i),this.code="ABORT_ERR",this.name="AbortError"}};s(wr,"AbortError");Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,i)=>{mt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";t.endsWith(" argument")?r+=`${t} `:r+=`"${t}" ${t.includes(".")?"property":"argument"} `,r+="must be ";let n=[],o=[],a=[];for(let u of e)mt(typeof u=="string","All expected entries have to be of type string"),_h.includes(u)?n.push(u.toLowerCase()):Eh.test(u)?o.push(u):(mt(u!=="object",'The value "object" should be written as "Object"'),a.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:r+=`of type ${n[0]}`;break;case 2:r+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();r+=`one of type ${n.join(", ")}, or ${u}`}}(o.length>0||a.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();r+=`an instance of ${o.join(", ")}, or ${u}`}}a.length>0&&(r+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(r+="an "),r+=`${a[0]}`;break;case 2:r+=`one of ${a[0]} or ${a[1]}`;break;default:{let u=a.pop();r+=`one of ${a.join(", ")}, or ${u}`}}if(i==null)r+=`. Received ${i}`;else if(typeof i=="function"&&i.name)r+=`. Received function ${i.name}`;else if(typeof i=="object"){var l;if((l=i.constructor)!==null&&l!==void 0&&l.name)r+=`. Received an instance of ${i.constructor.name}`;else{let u=Sr(i,{depth:-1});r+=`. Received ${u}`}}else{let u=Sr(i,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),r+=`. Received type ${typeof i} (${u})`}return r},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,i="is invalid")=>{let r=Sr(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${i}. Received ${r}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,i)=>{var r;let n=i!=null&&(r=i.constructor)!==null&&r!==void 0&&r.name?`instance of ${i.constructor.name}`:`type ${typeof i}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{mt(t.length>0,"At least one arg needs to be specified");let e,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map(r=>`"${r}"`).join(" or "),i){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let r=t.pop();e+=`The ${t.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,i)=>{mt(e,'Missing "range" argument');let r;return Number.isInteger(i)&&Math.abs(i)>2**32?r=Js(String(i)):typeof i=="bigint"?(r=String(i),(i>2n**32n||i<-(2n**32n))&&(r=Js(r)),r+="n"):r=Sr(i),`The value of "${t}" is out of range. It must be ${e}. Received ${r}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Zs.exports={AbortError:wr,aggregateTwoErrors:Qs(Ah),hideStackFrames:Qs,codes:_r}});var ii=N((f_,ca)=>{"use strict";var{ArrayIsArray:Jn,ArrayPrototypeIncludes:ra,ArrayPrototypeJoin:na,ArrayPrototypeMap:kh,NumberIsInteger:Qn,NumberIsNaN:Nh,NumberMAX_SAFE_INTEGER:Th,NumberMIN_SAFE_INTEGER:Fh,NumberParseInt:Ih,ObjectPrototypeHasOwnProperty:Ph,RegExpPrototypeExec:oa,String:Ch,StringPrototypeToUpperCase:Lh,StringPrototypeTrim:Rh}=O(),{hideStackFrames:ge,codes:{ERR_SOCKET_BAD_PORT:Oh,ERR_INVALID_ARG_TYPE:te,ERR_INVALID_ARG_VALUE:ti,ERR_OUT_OF_RANGE:bt,ERR_UNKNOWN_SIGNAL:ea}}=ie(),{normalizeEncoding:Bh}=ee(),{isAsyncFunction:Dh,isArrayBufferView:Mh}=ee().types,ta={};function Uh(t){return t===(t|0)}s(Uh,"isInt32");function Wh(t){return t===t>>>0}s(Wh,"isUint32");var qh=/^[0-7]+$/,jh="must be a 32-bit unsigned integer or an octal string";function $h(t,e,i){if(typeof t>"u"&&(t=i),typeof t=="string"){if(oa(qh,t)===null)throw new ti(e,t,jh);t=Ih(t,8)}return sa(t,e),t}s($h,"parseFileMode");var zh=ge((t,e,i=Fh,r=Th)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);if(t<i||t>r)throw new bt(e,`>= ${i} && <= ${r}`,t)}),Vh=ge((t,e,i=-2147483648,r=2147483647)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);if(t<i||t>r)throw new bt(e,`>= ${i} && <= ${r}`,t)}),sa=ge((t,e,i=!1)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);let r=i?1:0,n=4294967295;if(t<r||t>n)throw new bt(e,`>= ${r} && <= ${n}`,t)});function Zn(t,e){if(typeof t!="string")throw new te(e,"string",t)}s(Zn,"validateString");function Gh(t,e,i=void 0,r){if(typeof t!="number")throw new te(e,"number",t);if(i!=null&&t<i||r!=null&&t>r||(i!=null||r!=null)&&Nh(t))throw new bt(e,`${i!=null?`>= ${i}`:""}${i!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,t)}s(Gh,"validateNumber");var Hh=ge((t,e,i)=>{if(!ra(i,t)){let n="must be one of: "+na(kh(i,o=>typeof o=="string"?`'${o}'`:Ch(o)),", ");throw new ti(e,t,n)}});function aa(t,e){if(typeof t!="boolean")throw new te(e,"boolean",t)}s(aa,"validateBoolean");function Xn(t,e,i){return t==null||!Ph(t,e)?i:t[e]}s(Xn,"getOwnPropertyValueOrDefault");var Kh=ge((t,e,i=null)=>{let r=Xn(i,"allowArray",!1),n=Xn(i,"allowFunction",!1);if(!Xn(i,"nullable",!1)&&t===null||!r&&Jn(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new te(e,"Object",t)}),Yh=ge((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new te(e,"a dictionary",t)}),Er=ge((t,e,i=0)=>{if(!Jn(t))throw new te(e,"Array",t);if(t.length<i){let r=`must be longer than ${i}`;throw new ti(e,t,r)}});function Xh(t,e){Er(t,e);for(let i=0;i<t.length;i++)Zn(t[i],`${e}[${i}]`)}s(Xh,"validateStringArray");function Jh(t,e){Er(t,e);for(let i=0;i<t.length;i++)aa(t[i],`${e}[${i}]`)}s(Jh,"validateBooleanArray");function Qh(t,e){Er(t,e);for(let i=0;i<t.length;i++){let r=t[i],n=`${e}[${i}]`;if(r==null)throw new te(n,"AbortSignal",r);la(r,n)}}s(Qh,"validateAbortSignalArray");function Zh(t,e="signal"){if(Zn(t,e),ta[t]===void 0)throw ta[Lh(t)]!==void 0?new ea(t+" (signals must use all capital letters)"):new ea(t)}s(Zh,"validateSignalName");var ep=ge((t,e="buffer")=>{if(!Mh(t))throw new te(e,["Buffer","TypedArray","DataView"],t)});function tp(t,e){let i=Bh(e),r=t.length;if(i==="hex"&&r%2!==0)throw new ti("encoding",e,`is invalid for data of length ${r}`)}s(tp,"validateEncoding");function ip(t,e="Port",i=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Rh(t).length===0||+t!==+t>>>0||t>65535||t===0&&!i)throw new Oh(e,t,i);return t|0}s(ip,"validatePort");var la=ge((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new te(e,"AbortSignal",t)}),rp=ge((t,e)=>{if(typeof t!="function")throw new te(e,"Function",t)}),np=ge((t,e)=>{if(typeof t!="function"||Dh(t))throw new te(e,"Function",t)}),op=ge((t,e)=>{if(t!==void 0)throw new te(e,"undefined",t)});function sp(t,e,i){if(!ra(i,t))throw new te(e,`('${na(i,"|")}')`,t)}s(sp,"validateUnion");var ap=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ia(t,e){if(typeof t>"u"||!oa(ap,t))throw new ti(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(ia,"validateLinkHeaderFormat");function lp(t){if(typeof t=="string")return ia(t,"hints"),t;if(Jn(t)){let e=t.length,i="";if(e===0)return i;for(let r=0;r<e;r++){let n=t[r];ia(n,"hints"),i+=n,r!==e-1&&(i+=", ")}return i}throw new ti("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(lp,"validateLinkHeaderValue");ca.exports={isInt32:Uh,isUint32:Wh,parseFileMode:$h,validateArray:Er,validateStringArray:Xh,validateBooleanArray:Jh,validateAbortSignalArray:Qh,validateBoolean:aa,validateBuffer:ep,validateDictionary:Yh,validateEncoding:tp,validateFunction:rp,validateInt32:Vh,validateInteger:zh,validateNumber:Gh,validateObject:Kh,validateOneOf:Hh,validatePlainFunction:np,validatePort:ip,validateSignalName:Zh,validateString:Zn,validateUint32:sa,validateUndefined:op,validateUnion:sp,validateAbortSignal:la,validateLinkHeaderValue:lp}});var ot=N((h_,ha)=>{var q=ha.exports={},Le,Re;function eo(){throw new Error("setTimeout has not been defined")}s(eo,"defaultSetTimout");function to(){throw new Error("clearTimeout has not been defined")}s(to,"defaultClearTimeout");(function(){try{typeof setTimeout=="function"?Le=setTimeout:Le=eo}catch{Le=eo}try{typeof clearTimeout=="function"?Re=clearTimeout:Re=to}catch{Re=to}})();function ua(t){if(Le===setTimeout)return setTimeout(t,0);if((Le===eo||!Le)&&setTimeout)return Le=setTimeout,setTimeout(t,0);try{return Le(t,0)}catch{try{return Le.call(null,t,0)}catch{return Le.call(this,t,0)}}}s(ua,"runTimeout");function cp(t){if(Re===clearTimeout)return clearTimeout(t);if((Re===to||!Re)&&clearTimeout)return Re=clearTimeout,clearTimeout(t);try{return Re(t)}catch{try{return Re.call(null,t)}catch{return Re.call(this,t)}}}s(cp,"runClearTimeout");var ze=[],ri=!1,gt,xr=-1;function up(){!ri||!gt||(ri=!1,gt.length?ze=gt.concat(ze):xr=-1,ze.length&&fa())}s(up,"cleanUpNextTick");function fa(){if(!ri){var t=ua(up);ri=!0;for(var e=ze.length;e;){for(gt=ze,ze=[];++xr<e;)gt&>[xr].run();xr=-1,e=ze.length}gt=null,ri=!1,cp(t)}}s(fa,"drainQueue");q.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];ze.push(new da(t,e)),ze.length===1&&!ri&&ua(fa)};function da(t,e){this.fun=t,this.array=e}s(da,"Item");da.prototype.run=function(){this.fun.apply(null,this.array)};q.title="browser";q.browser=!0;q.env={};q.argv=[];q.version="";q.versions={};function Ve(){}s(Ve,"noop");q.on=Ve;q.addListener=Ve;q.once=Ve;q.off=Ve;q.removeListener=Ve;q.removeAllListeners=Ve;q.emit=Ve;q.prependListener=Ve;q.prependOnceListener=Ve;q.listeners=function(t){return[]};q.binding=function(t){throw new Error("process.binding is not supported")};q.cwd=function(){return"/"};q.chdir=function(t){throw new Error("process.chdir is not supported")};q.umask=function(){return 0}});var Be=N((y_,Ta)=>{"use strict";var{SymbolAsyncIterator:pa,SymbolIterator:ya,SymbolFor:wt}=O(),ma=wt("nodejs.stream.destroyed"),ba=wt("nodejs.stream.errored"),io=wt("nodejs.stream.readable"),ro=wt("nodejs.stream.writable"),ga=wt("nodejs.stream.disturbed"),fp=wt("nodejs.webstream.isClosedPromise"),dp=wt("nodejs.webstream.controllerErrorFunction");function vr(t,e=!1){var i;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((i=t._readableState)===null||i===void 0?void 0:i.readable)!==!1)&&(!t._writableState||t._readableState))}s(vr,"isReadableNodeStream");function Ar(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}s(Ar,"isWritableNodeStream");function hp(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}s(hp,"isDuplexNodeStream");function Oe(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}s(Oe,"isNodeStream");function wa(t){return!!(t&&!Oe(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}s(wa,"isReadableStream");function Sa(t){return!!(t&&!Oe(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}s(Sa,"isWritableStream");function _a(t){return!!(t&&!Oe(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}s(_a,"isTransformStream");function pp(t){return wa(t)||Sa(t)||_a(t)}s(pp,"isWebStream");function yp(t,e){return t==null?!1:e===!0?typeof t[pa]=="function":e===!1?typeof t[ya]=="function":typeof t[pa]=="function"||typeof t[ya]=="function"}s(yp,"isIterable");function kr(t){if(!Oe(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!!(t.destroyed||t[ma]||r!=null&&r.destroyed)}s(kr,"isDestroyed");function Ea(t){if(!Ar(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(Ea,"isWritableEnded");function mp(t,e){if(!Ar(t))return null;if(t.writableFinished===!0)return!0;let i=t._writableState;return i!=null&&i.errored?!1:typeof i?.finished!="boolean"?null:!!(i.finished||e===!1&&i.ended===!0&&i.length===0)}s(mp,"isWritableFinished");function bp(t){if(!vr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(bp,"isReadableEnded");function xa(t,e){if(!vr(t))return null;let i=t._readableState;return i!=null&&i.errored?!1:typeof i?.endEmitted!="boolean"?null:!!(i.endEmitted||e===!1&&i.ended===!0&&i.length===0)}s(xa,"isReadableFinished");function va(t){return t&&t[io]!=null?t[io]:typeof t?.readable!="boolean"?null:kr(t)?!1:vr(t)&&t.readable&&!xa(t)}s(va,"isReadable");function Aa(t){return t&&t[ro]!=null?t[ro]:typeof t?.writable!="boolean"?null:kr(t)?!1:Ar(t)&&t.writable&&!Ea(t)}s(Aa,"isWritable");function gp(t,e){return Oe(t)?kr(t)?!0:!(e?.readable!==!1&&va(t)||e?.writable!==!1&&Aa(t)):null}s(gp,"isFinished");function wp(t){var e,i;return Oe(t)?t.writableErrored?t.writableErrored:(e=(i=t._writableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(wp,"isWritableErrored");function Sp(t){var e,i;return Oe(t)?t.readableErrored?t.readableErrored:(e=(i=t._readableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(Sp,"isReadableErrored");function _p(t){if(!Oe(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,i=t._readableState;return typeof e?.closed=="boolean"||typeof i?.closed=="boolean"?e?.closed||i?.closed:typeof t._closed=="boolean"&&ka(t)?t._closed:null}s(_p,"isClosed");function ka(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}s(ka,"isOutgoingMessage");function Na(t){return typeof t._sent100=="boolean"&&ka(t)}s(Na,"isServerResponse");function Ep(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}s(Ep,"isServerRequest");function xp(t){if(!Oe(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!r&&Na(t)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}s(xp,"willEmitClose");function vp(t){var e;return!!(t&&((e=t[ga])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}s(vp,"isDisturbed");function Ap(t){var e,i,r,n,o,a,l,u,f,d;return!!(t&&((e=(i=(r=(n=(o=(a=t[ba])!==null&&a!==void 0?a:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&i!==void 0?i:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}s(Ap,"isErrored");Ta.exports={isDestroyed:kr,kIsDestroyed:ma,isDisturbed:vp,kIsDisturbed:ga,isErrored:Ap,kIsErrored:ba,isReadable:va,kIsReadable:io,kIsClosedPromise:fp,kControllerErrorFunction:dp,kIsWritable:ro,isClosed:_p,isDuplexNodeStream:hp,isFinished:gp,isIterable:yp,isReadableNodeStream:vr,isReadableStream:wa,isReadableEnded:bp,isReadableFinished:xa,isReadableErrored:Sp,isNodeStream:Oe,isWebStream:pp,isWritable:Aa,isWritableNodeStream:Ar,isWritableStream:Sa,isWritableEnded:Ea,isWritableFinished:mp,isWritableErrored:wp,isServerRequest:Ep,isServerResponse:Na,willEmitClose:xp,isTransformStream:_a}});var Ge=N((b_,lo)=>{var st=ot(),{AbortError:Da,codes:kp}=ie(),{ERR_INVALID_ARG_TYPE:Np,ERR_STREAM_PREMATURE_CLOSE:Fa}=kp,{kEmptyObject:oo,once:so}=ee(),{validateAbortSignal:Tp,validateFunction:Fp,validateObject:Ip,validateBoolean:Pp}=ii(),{Promise:Cp,PromisePrototypeThen:Lp,SymbolDispose:Ma}=O(),{isClosed:Rp,isReadable:Ia,isReadableNodeStream:no,isReadableStream:Op,isReadableFinished:Pa,isReadableErrored:Ca,isWritable:La,isWritableNodeStream:Ra,isWritableStream:Bp,isWritableFinished:Oa,isWritableErrored:Ba,isNodeStream:Dp,willEmitClose:Mp,kIsClosedPromise:Up}=Be(),ni;function Wp(t){return t.setHeader&&typeof t.abort=="function"}s(Wp,"isRequest");var ao=s(()=>{},"nop");function Ua(t,e,i){var r,n;if(arguments.length===2?(i=e,e=oo):e==null?e=oo:Ip(e,"options"),Fp(i,"callback"),Tp(e.signal,"options.signal"),i=so(i),Op(t)||Bp(t))return qp(t,e,i);if(!Dp(t))throw new Np("stream",["ReadableStream","WritableStream","Stream"],t);let o=(r=e.readable)!==null&&r!==void 0?r:no(t),a=(n=e.writable)!==null&&n!==void 0?n:Ra(t),l=t._writableState,u=t._readableState,f=s(()=>{t.writable||b()},"onlegacyfinish"),d=Mp(t)&&no(t)===o&&Ra(t)===a,h=Oa(t,!1),b=s(()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||m)&&i.call(t)},"onfinish"),m=Pa(t,!1),g=s(()=>{m=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||a))&&(!a||h)&&i.call(t)},"onend"),y=s($=>{i.call(t,$)},"onerror"),k=Rp(t),w=s(()=>{k=!0;let $=Ba(t)||Ca(t);if($&&typeof $!="boolean")return i.call(t,$);if(o&&!m&&no(t,!0)&&!Pa(t,!1))return i.call(t,new Fa);if(a&&!h&&!Oa(t,!1))return i.call(t,new Fa);i.call(t)},"onclose"),F=s(()=>{k=!0;let $=Ba(t)||Ca(t);if($&&typeof $!="boolean")return i.call(t,$);i.call(t)},"onclosed"),D=s(()=>{t.req.on("finish",b)},"onrequest");Wp(t)?(t.on("complete",b),d||t.on("abort",w),t.req?D():t.on("request",D)):a&&!l&&(t.on("end",f),t.on("close",f)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",w),t.on("end",g),t.on("finish",b),e.error!==!1&&t.on("error",y),t.on("close",w),k?st.nextTick(w):l!=null&&l.errorEmitted||u!=null&&u.errorEmitted?d||st.nextTick(F):(!o&&(!d||Ia(t))&&(h||La(t)===!1)||!a&&(!d||La(t))&&(m||Ia(t)===!1)||u&&t.req&&t.aborted)&&st.nextTick(F);let A=s(()=>{i=ao,t.removeListener("aborted",w),t.removeListener("complete",b),t.removeListener("abort",w),t.removeListener("request",D),t.req&&t.req.removeListener("finish",b),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",b),t.removeListener("end",g),t.removeListener("error",y),t.removeListener("close",w)},"cleanup");if(e.signal&&!k){let $=s(()=>{let lt=i;A(),lt.call(t,new Da(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)st.nextTick($);else{ni=ni||ee().addAbortListener;let lt=ni(e.signal,$),fe=i;i=so((...Ft)=>{lt[Ma](),fe.apply(t,Ft)})}}return A}s(Ua,"eos");function qp(t,e,i){let r=!1,n=ao;if(e.signal)if(n=s(()=>{r=!0,i.call(t,new Da(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)st.nextTick(n);else{ni=ni||ee().addAbortListener;let a=ni(e.signal,n),l=i;i=so((...u)=>{a[Ma](),l.apply(t,u)})}let o=s((...a)=>{r||st.nextTick(()=>i.apply(t,a))},"resolverFn");return Lp(t[Up].promise,o,o),ao}s(qp,"eosWeb");function jp(t,e){var i;let r=!1;return e===null&&(e=oo),(i=e)!==null&&i!==void 0&&i.cleanup&&(Pp(e.cleanup,"cleanup"),r=e.cleanup),new Cp((n,o)=>{let a=Ua(t,e,l=>{r&&a(),l?o(l):n()})})}s(jp,"finished");lo.exports=Ua;lo.exports.finished=jp});var St=N((w_,Ha)=>{"use strict";var De=ot(),{aggregateTwoErrors:$p,codes:{ERR_MULTIPLE_CALLBACK:zp},AbortError:Vp}=ie(),{Symbol:ja}=O(),{kIsDestroyed:Gp,isDestroyed:Hp,isFinished:Kp,isServerRequest:Yp}=Be(),$a=ja("kDestroy"),co=ja("kConstruct");function za(t,e,i){t&&(t.stack,e&&!e.errored&&(e.errored=t),i&&!i.errored&&(i.errored=t))}s(za,"checkError");function Xp(t,e){let i=this._readableState,r=this._writableState,n=r||i;return r!=null&&r.destroyed||i!=null&&i.destroyed?(typeof e=="function"&&e(),this):(za(t,r,i),r&&(r.destroyed=!0),i&&(i.destroyed=!0),n.constructed?Wa(this,t,e):this.once($a,function(o){Wa(this,$p(o,t),e)}),this)}s(Xp,"destroy");function Wa(t,e,i){let r=!1;function n(o){if(r)return;r=!0;let a=t._readableState,l=t._writableState;za(o,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof i=="function"&&i(o),o?De.nextTick(Jp,t,o):De.nextTick(Va,t)}s(n,"onDestroy");try{t._destroy(e||null,n)}catch(o){n(o)}}s(Wa,"_destroy");function Jp(t,e){uo(t,e),Va(t)}s(Jp,"emitErrorCloseNT");function Va(t){let e=t._readableState,i=t._writableState;i&&(i.closeEmitted=!0),e&&(e.closeEmitted=!0),(i!=null&&i.emitClose||e!=null&&e.emitClose)&&t.emit("close")}s(Va,"emitCloseNT");function uo(t,e){let i=t._readableState,r=t._writableState;r!=null&&r.errorEmitted||i!=null&&i.errorEmitted||(r&&(r.errorEmitted=!0),i&&(i.errorEmitted=!0),t.emit("error",e))}s(uo,"emitErrorNT");function Qp(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}s(Qp,"undestroy");function fo(t,e,i){let r=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),r&&!r.errored&&(r.errored=e),i?De.nextTick(uo,t,e):uo(t,e))}s(fo,"errorOrDestroy");function Zp(t,e){if(typeof t._construct!="function")return;let i=t._readableState,r=t._writableState;i&&(i.constructed=!1),r&&(r.constructed=!1),t.once(co,e),!(t.listenerCount(co)>1)&&De.nextTick(ey,t)}s(Zp,"construct");function ey(t){let e=!1;function i(r){if(e){fo(t,r??new zp);return}e=!0;let n=t._readableState,o=t._writableState,a=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),a.destroyed?t.emit($a,r):r?fo(t,r,!0):De.nextTick(ty,t)}s(i,"onConstruct");try{t._construct(r=>{De.nextTick(i,r)})}catch(r){De.nextTick(i,r)}}s(ey,"constructNT");function ty(t){t.emit(co)}s(ty,"emitConstructNT");function qa(t){return t?.setHeader&&typeof t.abort=="function"}s(qa,"isRequest");function Ga(t){t.emit("close")}s(Ga,"emitCloseLegacy");function iy(t,e){t.emit("error",e),De.nextTick(Ga,t)}s(iy,"emitErrorCloseLegacy");function ry(t,e){!t||Hp(t)||(!e&&!Kp(t)&&(e=new Vp),Yp(t)?(t.socket=null,t.destroy(e)):qa(t)?t.abort():qa(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?De.nextTick(iy,t,e):De.nextTick(Ga,t),t.destroyed||(t[Gp]=!0))}s(ry,"destroyer");Ha.exports={construct:Zp,destroyer:ry,destroy:Xp,undestroy:Qp,errorOrDestroy:fo}});var Fr=N((__,Ya)=>{"use strict";var{ArrayIsArray:ny,ObjectSetPrototypeOf:Ka}=O(),{EventEmitter:Nr}=Ci();function Tr(t){Nr.call(this,t)}s(Tr,"Stream");Ka(Tr.prototype,Nr.prototype);Ka(Tr,Nr);Tr.prototype.pipe=function(t,e){let i=this;function r(d){t.writable&&t.write(d)===!1&&i.pause&&i.pause()}s(r,"ondata"),i.on("data",r);function n(){i.readable&&i.resume&&i.resume()}s(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(i.on("end",a),i.on("close",l));let o=!1;function a(){o||(o=!0,t.end())}s(a,"onend");function l(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}s(l,"onclose");function u(d){f(),Nr.listenerCount(this,"error")===0&&this.emit("error",d)}s(u,"onerror"),ho(i,"error",u),ho(t,"error",u);function f(){i.removeListener("data",r),t.removeListener("drain",n),i.removeListener("end",a),i.removeListener("close",l),i.removeListener("error",u),t.removeListener("error",u),i.removeListener("end",f),i.removeListener("close",f),t.removeListener("close",f)}return s(f,"cleanup"),i.on("end",f),i.on("close",f),t.on("close",f),t.emit("pipe",i),t};function ho(t,e,i){if(typeof t.prependListener=="function")return t.prependListener(e,i);!t._events||!t._events[e]?t.on(e,i):ny(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]}s(ho,"prependListener");Ya.exports={Stream:Tr,prependListener:ho}});var Li=N((x_,Ir)=>{"use strict";var{SymbolDispose:oy}=O(),{AbortError:Xa,codes:sy}=ie(),{isNodeStream:Ja,isWebStream:ay,kControllerErrorFunction:ly}=Be(),cy=Ge(),{ERR_INVALID_ARG_TYPE:Qa}=sy,po,uy=s((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Qa(e,"AbortSignal",t)},"validateAbortSignal");Ir.exports.addAbortSignal=s(function(e,i){if(uy(e,"signal"),!Ja(i)&&!ay(i))throw new Qa("stream",["ReadableStream","WritableStream","Stream"],i);return Ir.exports.addAbortSignalNoValidate(e,i)},"addAbortSignal");Ir.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let i=Ja(e)?()=>{e.destroy(new Xa(void 0,{cause:t.reason}))}:()=>{e[ly](new Xa(void 0,{cause:t.reason}))};if(t.aborted)i();else{po=po||ee().addAbortListener;let r=po(t,i);cy(e,r[oy])}return e}});var tl=N((k_,el)=>{"use strict";var{StringPrototypeSlice:Za,SymbolIterator:fy,TypedArrayPrototypeSet:Pr,Uint8Array:dy}=O(),{Buffer:yo}=$e(),{inspect:hy}=ee();el.exports=s(class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,r=""+i.data;for(;(i=i.next)!==null;)r+=e+i.data;return r}concat(e){if(this.length===0)return yo.alloc(0);let i=yo.allocUnsafe(e>>>0),r=this.head,n=0;for(;r;)Pr(i,r.data,n),n+=r.data.length,r=r.next;return i}consume(e,i){let r=this.head.data;if(e<r.length){let n=r.slice(0,e);return this.head.data=r.slice(e),n}return e===r.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[fy](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",r=this.head,n=0;do{let o=r.data;if(e>o.length)i+=o,e-=o.length;else{e===o.length?(i+=o,++n,r.next?this.head=r.next:this.head=this.tail=null):(i+=Za(o,0,e),this.head=r,r.data=Za(o,e));break}++n}while((r=r.next)!==null);return this.length-=n,i}_getBuffer(e){let i=yo.allocUnsafe(e),r=e,n=this.head,o=0;do{let a=n.data;if(e>a.length)Pr(i,a,r-e),e-=a.length;else{e===a.length?(Pr(i,a,r-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(Pr(i,new dy(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return hy(this,{...i,depth:0,customInspect:!1})}},"BufferList")});var Ri=N((T_,ol)=>{"use strict";var{MathFloor:py,NumberIsInteger:yy}=O(),{validateInteger:my}=ii(),{ERR_INVALID_ARG_VALUE:by}=ie().codes,il=16*1024,rl=16;function gy(t,e,i){return t.highWaterMark!=null?t.highWaterMark:e?t[i]:null}s(gy,"highWaterMarkFrom");function nl(t){return t?rl:il}s(nl,"getDefaultHighWaterMark");function wy(t,e){my(e,"value",0),t?rl=e:il=e}s(wy,"setDefaultHighWaterMark");function Sy(t,e,i,r){let n=gy(e,r,i);if(n!=null){if(!yy(n)||n<0){let o=r?`options.${i}`:"options.highWaterMark";throw new by(o,n)}return py(n)}return nl(t.objectMode)}s(Sy,"getHighWaterMark");ol.exports={getHighWaterMark:Sy,getDefaultHighWaterMark:nl,setDefaultHighWaterMark:wy}});var ll=N((mo,al)=>{var Cr=$e(),Me=Cr.Buffer;function sl(t,e){for(var i in t)e[i]=t[i]}s(sl,"copyProps");Me.from&&Me.alloc&&Me.allocUnsafe&&Me.allocUnsafeSlow?al.exports=Cr:(sl(Cr,mo),mo.Buffer=_t);function _t(t,e,i){return Me(t,e,i)}s(_t,"SafeBuffer");_t.prototype=Object.create(Me.prototype);sl(Me,_t);_t.from=function(t,e,i){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Me(t,e,i)};_t.alloc=function(t,e,i){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Me(t);return e!==void 0?typeof i=="string"?r.fill(e,i):r.fill(e):r.fill(0),r};_t.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Me(t)};_t.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cr.SlowBuffer(t)}});var fl=N(ul=>{"use strict";var go=ll().Buffer,cl=go.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _y(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}s(_y,"_normalizeEncoding");function Ey(t){var e=_y(t);if(typeof e!="string"&&(go.isEncoding===cl||!cl(t)))throw new Error("Unknown encoding: "+t);return e||t}s(Ey,"normalizeEncoding");ul.StringDecoder=Oi;function Oi(t){this.encoding=Ey(t);var e;switch(this.encoding){case"utf16le":this.text=Ty,this.end=Fy,e=4;break;case"utf8":this.fillLast=Ay,e=4;break;case"base64":this.text=Iy,this.end=Py,e=3;break;default:this.write=Cy,this.end=Ly;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=go.allocUnsafe(e)}s(Oi,"StringDecoder");Oi.prototype.write=function(t){if(t.length===0)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""};Oi.prototype.end=Ny;Oi.prototype.text=ky;Oi.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function bo(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}s(bo,"utf8CheckByte");function xy(t,e,i){var r=e.length-1;if(r<i)return 0;var n=bo(e[r]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--r<i||n===-2?0:(n=bo(e[r]),n>=0?(n>0&&(t.lastNeed=n-2),n):--r<i||n===-2?0:(n=bo(e[r]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}s(xy,"utf8CheckIncomplete");function vy(t,e,i){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}s(vy,"utf8CheckExtraBytes");function Ay(t){var e=this.lastTotal-this.lastNeed,i=vy(this,t,e);if(i!==void 0)return i;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}s(Ay,"utf8FillLast");function ky(t,e){var i=xy(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}s(ky,"utf8Text");function Ny(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}s(Ny,"utf8End");function Ty(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}s(Ty,"utf16Text");function Fy(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}s(Fy,"utf16End");function Iy(t,e){var i=(t.length-e)%3;return i===0?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}s(Iy,"base64Text");function Py(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}s(Py,"base64End");function Cy(t){return t.toString(this.encoding)}s(Cy,"simpleWrite");function Ly(t){return t&&t.length?this.write(t):""}s(Ly,"simpleEnd")});var wo=N((L_,yl)=>{"use strict";var dl=ot(),{PromisePrototypeThen:Ry,SymbolAsyncIterator:hl,SymbolIterator:pl}=O(),{Buffer:Oy}=$e(),{ERR_INVALID_ARG_TYPE:By,ERR_STREAM_NULL_VALUES:Dy}=ie().codes;function My(t,e,i){let r;if(typeof e=="string"||e instanceof Oy)return new t({objectMode:!0,...i,read(){this.push(e),this.push(null)}});let n;if(e&&e[hl])n=!0,r=e[hl]();else if(e&&e[pl])n=!1,r=e[pl]();else throw new By("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...i}),a=!1;o._read=function(){a||(a=!0,u())},o._destroy=function(f,d){Ry(l(f),()=>dl.nextTick(d,f),h=>dl.nextTick(d,h||f))};async function l(f){let d=f!=null,h=typeof r.throw=="function";if(d&&h){let{value:b,done:m}=await r.throw(f);if(await b,m)return}if(typeof r.return=="function"){let{value:b}=await r.return();await b}}s(l,"close");async function u(){for(;;){try{let{value:f,done:d}=n?await r.next():r.next();if(d)o.push(null);else{let h=f&&typeof f.then=="function"?await f:f;if(h===null)throw a=!1,new Dy;if(o.push(h))continue;a=!1}}catch(f){o.destroy(f)}break}}return s(u,"next"),o}s(My,"from");yl.exports=My});var Di=N((O_,Ll)=>{var ve=ot(),{ArrayPrototypeIndexOf:Uy,NumberIsInteger:Wy,NumberIsNaN:qy,NumberParseInt:jy,ObjectDefineProperties:No,ObjectKeys:$y,ObjectSetPrototypeOf:gl,Promise:wl,SafeSet:zy,SymbolAsyncDispose:Vy,SymbolAsyncIterator:Gy,Symbol:Hy}=O();Ll.exports=_;_.ReadableState=Br;var{EventEmitter:Ky}=Ci(),{Stream:at,prependListener:Yy}=Fr(),{Buffer:So}=$e(),{addAbortSignal:Xy}=Li(),Sl=Ge(),x=ee().debuglog("stream",t=>{x=t}),Jy=tl(),ai=St(),{getHighWaterMark:Qy,getDefaultHighWaterMark:Zy}=Ri(),{aggregateTwoErrors:ml,codes:{ERR_INVALID_ARG_TYPE:em,ERR_METHOD_NOT_IMPLEMENTED:tm,ERR_OUT_OF_RANGE:im,ERR_STREAM_PUSH_AFTER_EOF:rm,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:nm},AbortError:om}=ie(),{validateObject:sm}=ii(),Et=Hy("kPaused"),{StringDecoder:_l}=fl(),am=wo();gl(_.prototype,at.prototype);gl(_,at);var _o=s(()=>{},"nop"),{errorOrDestroy:oi}=ai,si=1<<0,lm=1<<1,El=1<<2,Bi=1<<3,xl=1<<4,Lr=1<<5,Rr=1<<6,vl=1<<7,cm=1<<8,um=1<<9,fm=1<<10,Ao=1<<11,ko=1<<12,dm=1<<13,hm=1<<14,pm=1<<15,Al=1<<16,ym=1<<17,mm=1<<18;function V(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}s(V,"makeBitMapDescriptor");No(Br.prototype,{objectMode:V(si),ended:V(lm),endEmitted:V(El),reading:V(Bi),constructed:V(xl),sync:V(Lr),needReadable:V(Rr),emittedReadable:V(vl),readableListening:V(cm),resumeScheduled:V(um),errorEmitted:V(fm),emitClose:V(Ao),autoDestroy:V(ko),destroyed:V(dm),closed:V(hm),closeEmitted:V(pm),multiAwaitDrain:V(Al),readingMore:V(ym),dataEmitted:V(mm)});function Br(t,e,i){typeof i!="boolean"&&(i=e instanceof Ue()),this.state=Ao|ko|xl|Lr,t&&t.objectMode&&(this.state|=si),i&&t&&t.readableObjectMode&&(this.state|=si),this.highWaterMark=t?Qy(this,t,"readableHighWaterMark",i):Zy(!1),this.buffer=new Jy,this.length=0,this.pipes=[],this.flowing=null,this[Et]=null,t&&t.emitClose===!1&&(this.state&=~Ao),t&&t.autoDestroy===!1&&(this.state&=~ko),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new _l(t.encoding),this.encoding=t.encoding)}s(Br,"ReadableState");function _(t){if(!(this instanceof _))return new _(t);let e=this instanceof Ue();this._readableState=new Br(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Xy(t.signal,this)),at.call(this,t),ai.construct(this,()=>{this._readableState.needReadable&&Or(this,this._readableState)})}s(_,"Readable");_.prototype.destroy=ai.destroy;_.prototype._undestroy=ai.undestroy;_.prototype._destroy=function(t,e){e(t)};_.prototype[Ky.captureRejectionSymbol]=function(t){this.destroy(t)};_.prototype[Vy]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new om,this.destroy(t)),new wl((e,i)=>Sl(this,r=>r&&r!==t?i(r):e(null)))};_.prototype.push=function(t,e){return kl(this,t,e,!1)};_.prototype.unshift=function(t,e){return kl(this,t,e,!0)};function kl(t,e,i,r){x("readableAddChunk",e);let n=t._readableState,o;if(n.state&si||(typeof e=="string"?(i=i||n.defaultEncoding,n.encoding!==i&&(r&&n.encoding?e=So.from(e,i).toString(n.encoding):(e=So.from(e,i),i=""))):e instanceof So?i="":at._isUint8Array(e)?(e=at._uint8ArrayToBuffer(e),i=""):e!=null&&(o=new em("chunk",["string","Buffer","Uint8Array"],e))),o)oi(t,o);else if(e===null)n.state&=~Bi,wm(t,n);else if(n.state&si||e&&e.length>0)if(r)if(n.state&El)oi(t,new nm);else{if(n.destroyed||n.errored)return!1;Eo(t,n,e,!0)}else if(n.ended)oi(t,new rm);else{if(n.destroyed||n.errored)return!1;n.state&=~Bi,n.decoder&&!i?(e=n.decoder.write(e),n.objectMode||e.length!==0?Eo(t,n,e,!1):Or(t,n)):Eo(t,n,e,!1)}else r||(n.state&=~Bi,Or(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}s(kl,"readableAddChunk");function Eo(t,e,i,r){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Al?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.state&Rr&&Dr(t)),Or(t,e)}s(Eo,"addChunk");_.prototype.isPaused=function(){let t=this._readableState;return t[Et]===!0||t.flowing===!1};_.prototype.setEncoding=function(t){let e=new _l(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let i=this._readableState.buffer,r="";for(let n of i)r+=e.write(n);return i.clear(),r!==""&&i.push(r),this._readableState.length=r.length,this};var bm=1073741824;function gm(t){if(t>bm)throw new im("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}s(gm,"computeNewHighWaterMark");function bl(t,e){return t<=0||e.length===0&&e.ended?0:e.state&si?1:qy(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}s(bl,"howMuchToRead");_.prototype.read=function(t){x("read",t),t===void 0?t=NaN:Wy(t)||(t=jy(t,10));let e=this._readableState,i=t;if(t>e.highWaterMark&&(e.highWaterMark=gm(t)),t!==0&&(e.state&=~vl),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return x("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?xo(this):Dr(this),null;if(t=bl(t,e),t===0&&e.ended)return e.length===0&&xo(this),null;let r=(e.state&Rr)!==0;if(x("need readable",r),(e.length===0||e.length-t<e.highWaterMark)&&(r=!0,x("length less than watermark",r)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)r=!1,x("reading, ended or constructing",r);else if(r){x("do read"),e.state|=Bi|Lr,e.length===0&&(e.state|=Rr);try{this._read(e.highWaterMark)}catch(o){oi(this,o)}e.state&=~Lr,e.reading||(t=bl(i,e))}let n;return t>0?n=Pl(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&xo(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function wm(t,e){if(x("onEofChunk"),!e.ended){if(e.decoder){let i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?Dr(t):(e.needReadable=!1,e.emittedReadable=!0,Nl(t))}}s(wm,"onEofChunk");function Dr(t){let e=t._readableState;x("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(x("emitReadable",e.flowing),e.emittedReadable=!0,ve.nextTick(Nl,t))}s(Dr,"emitReadable");function Nl(t){let e=t._readableState;x("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Fl(t)}s(Nl,"emitReadable_");function Or(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ve.nextTick(Sm,t,e))}s(Or,"maybeReadMore");function Sm(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let i=e.length;if(x("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}s(Sm,"maybeReadMore_");_.prototype._read=function(t){throw new tm("_read()")};_.prototype.pipe=function(t,e){let i=this,r=this._readableState;r.pipes.length===1&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new zy(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(t),x("pipe count=%d opts=%j",r.pipes.length,e);let o=(!e||e.end!==!1)&&t!==ve.stdout&&t!==ve.stderr?l:k;r.endEmitted?ve.nextTick(o):i.once("end",o),t.on("unpipe",a);function a(w,F){x("onunpipe"),w===i&&F&&F.hasUnpiped===!1&&(F.hasUnpiped=!0,d())}s(a,"onunpipe");function l(){x("onend"),t.end()}s(l,"onend");let u,f=!1;function d(){x("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),u&&t.removeListener("drain",u),t.removeListener("error",m),t.removeListener("unpipe",a),i.removeListener("end",l),i.removeListener("end",k),i.removeListener("data",b),f=!0,u&&r.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}s(d,"cleanup");function h(){f||(r.pipes.length===1&&r.pipes[0]===t?(x("false write response, pause",0),r.awaitDrainWriters=t,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(t)&&(x("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(t)),i.pause()),u||(u=_m(i,t),t.on("drain",u))}s(h,"pause"),i.on("data",b);function b(w){x("ondata");let F=t.write(w);x("dest.write",F),F===!1&&h()}s(b,"ondata");function m(w){if(x("onerror",w),k(),t.removeListener("error",m),t.listenerCount("error")===0){let F=t._writableState||t._readableState;F&&!F.errorEmitted?oi(t,w):t.emit("error",w)}}s(m,"onerror"),Yy(t,"error",m);function g(){t.removeListener("finish",y),k()}s(g,"onclose"),t.once("close",g);function y(){x("onfinish"),t.removeListener("close",g),k()}s(y,"onfinish"),t.once("finish",y);function k(){x("unpipe"),i.unpipe(t)}return s(k,"unpipe"),t.emit("pipe",i),t.writableNeedDrain===!0?h():r.flowing||(x("pipe resume"),i.resume()),t};function _m(t,e){return s(function(){let r=t._readableState;r.awaitDrainWriters===e?(x("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(x("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(e)),(!r.awaitDrainWriters||r.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}s(_m,"pipeOnDrain");_.prototype.unpipe=function(t){let e=this._readableState,i={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let r=Uy(e.pipes,t);return r===-1?this:(e.pipes.splice(r,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,i),this)};_.prototype.on=function(t,e){let i=at.prototype.on.call(this,t,e),r=this._readableState;return t==="data"?(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1&&this.resume()):t==="readable"&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,x("on readable",r.length,r.reading),r.length?Dr(this):r.reading||ve.nextTick(Em,this)),i};_.prototype.addListener=_.prototype.on;_.prototype.removeListener=function(t,e){let i=at.prototype.removeListener.call(this,t,e);return t==="readable"&&ve.nextTick(Tl,this),i};_.prototype.off=_.prototype.removeListener;_.prototype.removeAllListeners=function(t){let e=at.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ve.nextTick(Tl,this),e};function Tl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Et]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}s(Tl,"updateReadableListening");function Em(t){x("readable nexttick read 0"),t.read(0)}s(Em,"nReadingNextTick");_.prototype.resume=function(){let t=this._readableState;return t.flowing||(x("resume"),t.flowing=!t.readableListening,xm(this,t)),t[Et]=!1,this};function xm(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ve.nextTick(vm,t,e))}s(xm,"resume");function vm(t,e){x("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Fl(t),e.flowing&&!e.reading&&t.read(0)}s(vm,"resume_");_.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Et]=!0,this};function Fl(t){let e=t._readableState;for(x("flow",e.flowing);e.flowing&&t.read()!==null;);}s(Fl,"flow");_.prototype.wrap=function(t){let e=!1;t.on("data",r=>{!this.push(r)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",r=>{oi(this,r)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let i=$y(t);for(let r=1;r<i.length;r++){let n=i[r];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};_.prototype[Gy]=function(){return Il(this)};_.prototype.iterator=function(t){return t!==void 0&&sm(t,"options"),Il(this,t)};function Il(t,e){typeof t.read!="function"&&(t=_.wrap(t,{objectMode:!0}));let i=Am(t,e);return i.stream=t,i}s(Il,"streamToAsyncIterator");async function*Am(t,e){let i=_o;function r(a){this===t?(i(),i=_o):i=a}s(r,"next"),t.on("readable",r);let n,o=Sl(t,{writable:!1},a=>{n=a?ml(n,a):null,i(),i=_o});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(n)throw n;if(n===null)return;await new wl(r)}}}catch(a){throw n=ml(n,a),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?ai.destroyer(t,null):(t.off("readable",r),o())}}s(Am,"createAsyncIterator");No(_.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});No(Br.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Et]!==!1},set(t){this[Et]=!!t}}});_._fromList=Pl;function Pl(t,e){if(e.length===0)return null;let i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(e.decoder?i=e.buffer.join(""):e.buffer.length===1?i=e.buffer.first():i=e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i}s(Pl,"fromList");function xo(t){let e=t._readableState;x("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ve.nextTick(km,e,t))}s(xo,"endReadable");function km(t,e){if(x("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)ve.nextTick(Nm,e);else if(t.autoDestroy){let i=e._writableState;(!i||i.autoDestroy&&(i.finished||i.writable===!1))&&e.destroy()}}}s(km,"endReadableNT");function Nm(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}s(Nm,"endWritableNT");_.from=function(t,e){return am(_,t,e)};var vo;function Cl(){return vo===void 0&&(vo={}),vo}s(Cl,"lazyWebStreams");_.fromWeb=function(t,e){return Cl().newStreamReadableFromReadableStream(t,e)};_.toWeb=function(t,e){return Cl().newReadableStreamFromStreamReadable(t,e)};_.wrap=function(t,e){var i,r;return new _({objectMode:(i=(r=t.readableObjectMode)!==null&&r!==void 0?r:t.objectMode)!==null&&i!==void 0?i:!0,...e,destroy(n,o){ai.destroyer(t,n),o(n)}}).wrap(t)}});var jr=N((D_,Vl)=>{var xt=ot(),{ArrayPrototypeSlice:Bl,Error:Tm,FunctionPrototypeSymbolHasInstance:Dl,ObjectDefineProperty:Ml,ObjectDefineProperties:Fm,ObjectSetPrototypeOf:Ul,StringPrototypeToLowerCase:Im,Symbol:Pm,SymbolHasInstance:Cm}=O();Vl.exports=B;B.WritableState=Wi;var{EventEmitter:Lm}=Ci(),Mi=Fr().Stream,{Buffer:Mr}=$e(),qr=St(),{addAbortSignal:Rm}=Li(),{getHighWaterMark:Om,getDefaultHighWaterMark:Bm}=Ri(),{ERR_INVALID_ARG_TYPE:Dm,ERR_METHOD_NOT_IMPLEMENTED:Mm,ERR_MULTIPLE_CALLBACK:Wl,ERR_STREAM_CANNOT_PIPE:Um,ERR_STREAM_DESTROYED:Ui,ERR_STREAM_ALREADY_FINISHED:Wm,ERR_STREAM_NULL_VALUES:qm,ERR_STREAM_WRITE_AFTER_END:jm,ERR_UNKNOWN_ENCODING:ql}=ie().codes,{errorOrDestroy:li}=qr;Ul(B.prototype,Mi.prototype);Ul(B,Mi);function Io(){}s(Io,"nop");var ci=Pm("kOnFinished");function Wi(t,e,i){typeof i!="boolean"&&(i=e instanceof Ue()),this.objectMode=!!(t&&t.objectMode),i&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Om(this,t,"writableHighWaterMark",i):Bm(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(t&&t.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=zm.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Wr(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[ci]=[]}s(Wi,"WritableState");function Wr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}s(Wr,"resetBuffer");Wi.prototype.getBuffer=s(function(){return Bl(this.buffered,this.bufferedIndex)},"getBuffer");Ml(Wi.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function B(t){let e=this instanceof Ue();if(!e&&!Dl(B,this))return new B(t);this._writableState=new Wi(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Rm(t.signal,this)),Mi.call(this,t),qr.construct(this,()=>{let i=this._writableState;i.writing||Co(this,i),Lo(this,i)})}s(B,"Writable");Ml(B,Cm,{__proto__:null,value:function(t){return Dl(this,t)?!0:this!==B?!1:t&&t._writableState instanceof Wi}});B.prototype.pipe=function(){li(this,new Um)};function jl(t,e,i,r){let n=t._writableState;if(typeof i=="function")r=i,i=n.defaultEncoding;else{if(!i)i=n.defaultEncoding;else if(i!=="buffer"&&!Mr.isEncoding(i))throw new ql(i);typeof r!="function"&&(r=Io)}if(e===null)throw new qm;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Mr.from(e,i),i="buffer");else if(e instanceof Mr)i="buffer";else if(Mi._isUint8Array(e))e=Mi._uint8ArrayToBuffer(e),i="buffer";else throw new Dm("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new jm:n.destroyed&&(o=new Ui("write")),o?(xt.nextTick(r,o),li(t,o,!0),o):(n.pendingcb++,$m(t,n,e,i,r))}s(jl,"_write");B.prototype.write=function(t,e,i){return jl(this,t,e,i)===!0};B.prototype.cork=function(){this._writableState.corked++};B.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Co(this,t))};B.prototype.setDefaultEncoding=s(function(e){if(typeof e=="string"&&(e=Im(e)),!Mr.isEncoding(e))throw new ql(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function $m(t,e,i,r,n){let o=e.objectMode?1:i.length;e.length+=o;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:i,encoding:r,callback:n}),e.allBuffers&&r!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Io&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(i,r,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}s($m,"writeOrBuffer");function Rl(t,e,i,r,n,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Ui("write")):i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}s(Rl,"doWrite");function Ol(t,e,i,r){--e.pendingcb,r(i),Po(e),li(t,i)}s(Ol,"onwriteError");function zm(t,e){let i=t._writableState,r=i.sync,n=i.writecb;if(typeof n!="function"){li(t,new Wl);return}i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,e?(e.stack,i.errored||(i.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),r?xt.nextTick(Ol,t,i,e,n):Ol(t,i,e,n)):(i.buffered.length>i.bufferedIndex&&Co(t,i),r?i.afterWriteTickInfo!==null&&i.afterWriteTickInfo.cb===n?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:n,stream:t,state:i},xt.nextTick(Vm,i.afterWriteTickInfo)):$l(t,i,1,n))}s(zm,"onwrite");function Vm({stream:t,state:e,count:i,cb:r}){return e.afterWriteTickInfo=null,$l(t,e,i,r)}s(Vm,"afterWriteTick");function $l(t,e,i,r){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));i-- >0;)e.pendingcb--,r();e.destroyed&&Po(e),Lo(t,e)}s($l,"afterWrite");function Po(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:a}=t.buffered[n],l=t.objectMode?1:o.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new Ui("write"))}let i=t[ci].splice(0);for(let n=0;n<i.length;n++){var r;i[n]((r=t.errored)!==null&&r!==void 0?r:new Ui("end"))}Wr(t)}s(Po,"errorBuffer");function Co(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:i,bufferedIndex:r,objectMode:n}=e,o=i.length-r;if(!o)return;let a=r;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let l=e.allNoop?Io:f=>{for(let d=a;d<i.length;++d)i[d].callback(f)},u=e.allNoop&&a===0?i:Bl(i,a);u.allBuffers=e.allBuffers,Rl(t,e,!0,e.length,u,"",l),Wr(e)}else{do{let{chunk:l,encoding:u,callback:f}=i[a];i[a++]=null;let d=n?1:l.length;Rl(t,e,!1,d,l,u,f)}while(a<i.length&&!e.writing);a===i.length?Wr(e):a>256?(i.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}s(Co,"clearBuffer");B.prototype._write=function(t,e,i){if(this._writev)this._writev([{chunk:t,encoding:e}],i);else throw new Mm("_write()")};B.prototype._writev=null;B.prototype.end=function(t,e,i){let r=this._writableState;typeof t=="function"?(i=t,t=null,e=null):typeof e=="function"&&(i=e,e=null);let n;if(t!=null){let o=jl(this,t,e);o instanceof Tm&&(n=o)}return r.corked&&(r.corked=1,this.uncork()),n||(!r.errored&&!r.ending?(r.ending=!0,Lo(this,r,!0),r.ended=!0):r.finished?n=new Wm("end"):r.destroyed&&(n=new Ui("end"))),typeof i=="function"&&(n||r.finished?xt.nextTick(i,n):r[ci].push(i)),this};function Ur(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}s(Ur,"needFinish");function Gm(t,e){let i=!1;function r(n){if(i){li(t,n??Wl());return}if(i=!0,e.pendingcb--,n){let o=e[ci].splice(0);for(let a=0;a<o.length;a++)o[a](n);li(t,n,e.sync)}else Ur(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,xt.nextTick(Fo,t,e))}s(r,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(r)}catch(n){r(n)}e.sync=!1}s(Gm,"callFinal");function Hm(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Gm(t,e)):(e.prefinished=!0,t.emit("prefinish")))}s(Hm,"prefinish");function Lo(t,e,i){Ur(e)&&(Hm(t,e),e.pendingcb===0&&(i?(e.pendingcb++,xt.nextTick((r,n)=>{Ur(n)?Fo(r,n):n.pendingcb--},t,e)):Ur(e)&&(e.pendingcb++,Fo(t,e))))}s(Lo,"finishMaybe");function Fo(t,e){e.pendingcb--,e.finished=!0;let i=e[ci].splice(0);for(let r=0;r<i.length;r++)i[r]();if(t.emit("finish"),e.autoDestroy){let r=t._readableState;(!r||r.autoDestroy&&(r.endEmitted||r.readable===!1))&&t.destroy()}}s(Fo,"finish");Fm(B.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Km=qr.destroy;B.prototype.destroy=function(t,e){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[ci].length)&&xt.nextTick(Po,i),Km.call(this,t,e),this};B.prototype._undestroy=qr.undestroy;B.prototype._destroy=function(t,e){e(t)};B.prototype[Lm.captureRejectionSymbol]=function(t){this.destroy(t)};var To;function zl(){return To===void 0&&(To={}),To}s(zl,"lazyWebStreams");B.fromWeb=function(t,e){return zl().newStreamWritableFromWritableStream(t,e)};B.toWeb=function(t){return zl().newWritableStreamFromStreamWritable(t)}});var sc=N((U_,oc)=>{var Ro=ot(),Ym=$e(),{isReadable:Xm,isWritable:Jm,isIterable:Gl,isNodeStream:Qm,isReadableNodeStream:Hl,isWritableNodeStream:Kl,isDuplexNodeStream:Zm,isReadableStream:Yl,isWritableStream:Xl}=Be(),Jl=Ge(),{AbortError:rc,codes:{ERR_INVALID_ARG_TYPE:eb,ERR_INVALID_RETURN_VALUE:Ql}}=ie(),{destroyer:fi}=St(),tb=Ue(),nc=Di(),ib=jr(),{createDeferredPromise:Zl}=ee(),ec=wo(),tc=globalThis.Blob||Ym.Blob,rb=s(typeof tc<"u"?function(e){return e instanceof tc}:function(e){return!1},"isBlob"),nb=globalThis.AbortController||Zt().AbortController,{FunctionPrototypeCall:ic}=O(),He=class extends tb{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};s(He,"Duplexify");oc.exports=s(function t(e,i){if(Zm(e))return e;if(Hl(e))return ui({readable:e});if(Kl(e))return ui({writable:e});if(Qm(e))return ui({writable:!1,readable:!1});if(Yl(e))return ui({readable:nc.fromWeb(e)});if(Xl(e))return ui({writable:ib.fromWeb(e)});if(typeof e=="function"){let{value:n,write:o,final:a,destroy:l}=ob(e);if(Gl(n))return ec(He,n,{objectMode:!0,write:o,final:a,destroy:l});let u=n?.then;if(typeof u=="function"){let f,d=ic(u,n,h=>{if(h!=null)throw new Ql("nully","body",h)},h=>{fi(f,h)});return f=new He({objectMode:!0,readable:!1,write:o,final(h){a(async()=>{try{await d,Ro.nextTick(h,null)}catch(b){Ro.nextTick(h,b)}})},destroy:l})}throw new Ql("Iterable, AsyncIterable or AsyncFunction",i,n)}if(rb(e))return t(e.arrayBuffer());if(Gl(e))return ec(He,e,{objectMode:!0,writable:!1});if(Yl(e?.readable)&&Xl(e?.writable))return He.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?Hl(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Kl(e?.writable)?e?.writable:t(e.writable):void 0;return ui({readable:n,writable:o})}let r=e?.then;if(typeof r=="function"){let n;return ic(r,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{fi(n,o)}),n=new He({objectMode:!0,writable:!1,read(){}})}throw new eb(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function ob(t){let{promise:e,resolve:i}=Zl(),r=new nb,n=r.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:u,cb:f}=await a;if(Ro.nextTick(f),u)return;if(n.aborted)throw new rc(void 0,{cause:n.reason});({promise:e,resolve:i}=Zl()),yield l}}(),{signal:n}),write(a,l,u){let f=i;i=null,f({chunk:a,done:!1,cb:u})},final(a){let l=i;i=null,l({done:!0,cb:a})},destroy(a,l){r.abort(),l(a)}}}s(ob,"fromAsyncGen");function ui(t){let e=t.readable&&typeof t.readable.read!="function"?nc.wrap(t.readable):t.readable,i=t.writable,r=!!Xm(e),n=!!Jm(i),o,a,l,u,f;function d(h){let b=u;u=null,b?b(h):h&&f.destroy(h)}return s(d,"onfinished"),f=new He({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(i!=null&&i.writableObjectMode),readable:r,writable:n}),n&&(Jl(i,h=>{n=!1,h&&fi(e,h),d(h)}),f._write=function(h,b,m){i.write(h,b)?m():o=m},f._final=function(h){i.end(),a=h},i.on("drain",function(){if(o){let h=o;o=null,h()}}),i.on("finish",function(){if(a){let h=a;a=null,h()}})),r&&(Jl(e,h=>{r=!1,h&&fi(e,h),d(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let h=e.read();if(h===null){l=f._read;return}if(!f.push(h))return}}),f._destroy=function(h,b){!h&&u!==null&&(h=new rc),l=null,o=null,a=null,u===null?b(h):(u=b,fi(i,h),fi(e,h))},f}s(ui,"_duplexify")});var Ue=N((q_,cc)=>{"use strict";var{ObjectDefineProperties:sb,ObjectGetOwnPropertyDescriptor:Ke,ObjectKeys:ab,ObjectSetPrototypeOf:ac}=O();cc.exports=Ae;var Do=Di(),we=jr();ac(Ae.prototype,Do.prototype);ac(Ae,Do);{let t=ab(we.prototype);for(let e=0;e<t.length;e++){let i=t[e];Ae.prototype[i]||(Ae.prototype[i]=we.prototype[i])}}function Ae(t){if(!(this instanceof Ae))return new Ae(t);Do.call(this,t),we.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}s(Ae,"Duplex");sb(Ae.prototype,{writable:{__proto__:null,...Ke(we.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ke(we.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ke(we.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ke(we.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ke(we.prototype,"writableLength")},writableFinished:{__proto__:null,...Ke(we.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ke(we.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ke(we.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ke(we.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Oo;function lc(){return Oo===void 0&&(Oo={}),Oo}s(lc,"lazyWebStreams");Ae.fromWeb=function(t,e){return lc().newStreamDuplexFromReadableWritablePair(t,e)};Ae.toWeb=function(t){return lc().newReadableWritablePairFromDuplex(t)};var Bo;Ae.from=function(t){return Bo||(Bo=sc()),Bo(t,"body")}});var Wo=N(($_,fc)=>{"use strict";var{ObjectSetPrototypeOf:uc,Symbol:lb}=O();fc.exports=Ye;var{ERR_METHOD_NOT_IMPLEMENTED:cb}=ie().codes,Uo=Ue(),{getHighWaterMark:ub}=Ri();uc(Ye.prototype,Uo.prototype);uc(Ye,Uo);var qi=lb("kCallback");function Ye(t){if(!(this instanceof Ye))return new Ye(t);let e=t?ub(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Uo.call(this,t),this._readableState.sync=!1,this[qi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",fb)}s(Ye,"Transform");function Mo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,i)=>{if(e){t?t(e):this.destroy(e);return}i!=null&&this.push(i),this.push(null),t&&t()}):(this.push(null),t&&t())}s(Mo,"final");function fb(){this._final!==Mo&&Mo.call(this)}s(fb,"prefinish");Ye.prototype._final=Mo;Ye.prototype._transform=function(t,e,i){throw new cb("_transform()")};Ye.prototype._write=function(t,e,i){let r=this._readableState,n=this._writableState,o=r.length;this._transform(t,e,(a,l)=>{if(a){i(a);return}l!=null&&this.push(l),n.ended||o===r.length||r.length<r.highWaterMark?i():this[qi]=i})};Ye.prototype._read=function(){if(this[qi]){let t=this[qi];this[qi]=null,t()}}});var jo=N((V_,hc)=>{"use strict";var{ObjectSetPrototypeOf:dc}=O();hc.exports=di;var qo=Wo();dc(di.prototype,qo.prototype);dc(di,qo);function di(t){if(!(this instanceof di))return new di(t);qo.call(this,t)}s(di,"PassThrough");di.prototype._transform=function(t,e,i){i(null,t)}});var Gr=N((H_,gc)=>{var ji=ot(),{ArrayIsArray:db,Promise:hb,SymbolAsyncIterator:pb,SymbolDispose:yb}=O(),Vr=Ge(),{once:mb}=ee(),bb=St(),pc=Ue(),{aggregateTwoErrors:gb,codes:{ERR_INVALID_ARG_TYPE:Jo,ERR_INVALID_RETURN_VALUE:$o,ERR_MISSING_ARGS:wb,ERR_STREAM_DESTROYED:Sb,ERR_STREAM_PREMATURE_CLOSE:_b},AbortError:Eb}=ie(),{validateFunction:xb,validateAbortSignal:vb}=ii(),{isIterable:vt,isReadable:zo,isReadableNodeStream:zr,isNodeStream:yc,isTransformStream:hi,isWebStream:Ab,isReadableStream:Vo,isReadableFinished:kb}=Be(),Nb=globalThis.AbortController||Zt().AbortController,Go,Ho,Ko;function mc(t,e,i){let r=!1;t.on("close",()=>{r=!0});let n=Vr(t,{readable:e,writable:i},o=>{r=!o});return{destroy:o=>{r||(r=!0,bb.destroyer(t,o||new Sb("pipe")))},cleanup:n}}s(mc,"destroyer");function Tb(t){return xb(t[t.length-1],"streams[stream.length - 1]"),t.pop()}s(Tb,"popCallback");function Yo(t){if(vt(t))return t;if(zr(t))return Fb(t);throw new Jo("val",["Readable","Iterable","AsyncIterable"],t)}s(Yo,"makeAsyncIterable");async function*Fb(t){Ho||(Ho=Di()),yield*Ho.prototype[pb].call(t)}s(Fb,"fromReadable");async function $r(t,e,i,{end:r}){let n,o=null,a=s(f=>{if(f&&(n=f),o){let d=o;o=null,d()}},"resume"),l=s(()=>new hb((f,d)=>{n?d(n):o=s(()=>{n?d(n):f()},"onresolve")}),"wait");e.on("drain",a);let u=Vr(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let f of t)e.write(f)||await l();r&&(e.end(),await l()),i()}catch(f){i(n!==f?gb(n,f):f)}finally{u(),e.off("drain",a)}}s($r,"pumpToNode");async function Xo(t,e,i,{end:r}){hi(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,r&&await n.close(),i()}catch(o){try{await n.abort(o),i(o)}catch(a){i(a)}}}s(Xo,"pumpToWeb");function Ib(...t){return bc(t,mb(Tb(t)))}s(Ib,"pipeline");function bc(t,e,i){if(t.length===1&&db(t[0])&&(t=t[0]),t.length<2)throw new wb("streams");let r=new Nb,n=r.signal,o=i?.signal,a=[];vb(o,"options.signal");function l(){g(new Eb)}s(l,"abort"),Ko=Ko||ee().addAbortListener;let u;o&&(u=Ko(o,l));let f,d,h=[],b=0;function m(D){g(D,--b===0)}s(m,"finish");function g(D,A){var $;if(D&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=D),!(!f&&!A)){for(;h.length;)h.shift()(f);($=u)===null||$===void 0||$[yb](),r.abort(),A&&(f||a.forEach(lt=>lt()),ji.nextTick(e,f,d))}}s(g,"finishImpl");let y;for(let D=0;D<t.length;D++){let A=t[D],$=D<t.length-1,lt=D>0,fe=$||i?.end!==!1,Ft=D===t.length-1;if(yc(A)){let re=function(qe){qe&&qe.name!=="AbortError"&&qe.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(qe)};var F=re;if(s(re,"onError"),fe){let{destroy:qe,cleanup:nn}=mc(A,$,lt);h.push(qe),zo(A)&&Ft&&a.push(nn)}A.on("error",re),zo(A)&&Ft&&a.push(()=>{A.removeListener("error",re)})}if(D===0)if(typeof A=="function"){if(y=A({signal:n}),!vt(y))throw new $o("Iterable, AsyncIterable or Stream","source",y)}else vt(A)||zr(A)||hi(A)?y=A:y=pc.from(A);else if(typeof A=="function"){if(hi(y)){var k;y=Yo((k=y)===null||k===void 0?void 0:k.readable)}else y=Yo(y);if(y=A(y,{signal:n}),$){if(!vt(y,!0))throw new $o("AsyncIterable",`transform[${D-1}]`,y)}else{var w;Go||(Go=jo());let re=new Go({objectMode:!0}),qe=(w=y)===null||w===void 0?void 0:w.then;if(typeof qe=="function")b++,qe.call(y,Qe=>{d=Qe,Qe!=null&&re.write(Qe),fe&&re.end(),ji.nextTick(m)},Qe=>{re.destroy(Qe),ji.nextTick(m,Qe)});else if(vt(y,!0))b++,$r(y,re,m,{end:fe});else if(Vo(y)||hi(y)){let Qe=y.readable||y;b++,$r(Qe,re,m,{end:fe})}else throw new $o("AsyncIterable or Promise","destination",y);y=re;let{destroy:nn,cleanup:Hc}=mc(y,!1,!0);h.push(nn),Ft&&a.push(Hc)}}else if(yc(A)){if(zr(y)){b+=2;let re=Pb(y,A,m,{end:fe});zo(A)&&Ft&&a.push(re)}else if(hi(y)||Vo(y)){let re=y.readable||y;b++,$r(re,A,m,{end:fe})}else if(vt(y))b++,$r(y,A,m,{end:fe});else throw new Jo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else if(Ab(A)){if(zr(y))b++,Xo(Yo(y),A,m,{end:fe});else if(Vo(y)||vt(y))b++,Xo(y,A,m,{end:fe});else if(hi(y))b++,Xo(y.readable,A,m,{end:fe});else throw new Jo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else y=pc.from(A)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&ji.nextTick(l),y}s(bc,"pipelineImpl");function Pb(t,e,i,{end:r}){let n=!1;if(e.on("close",()=>{n||i(new _b)}),t.pipe(e,{end:!1}),r){let a=function(){n=!0,e.end()};var o=a;s(a,"endFn"),kb(t)?ji.nextTick(a):t.once("end",a)}else i();return Vr(t,{readable:!0,writable:!1},a=>{let l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",i).once("error",i):i(a)}),Vr(e,{readable:!1,writable:!0},i)}s(Pb,"pipe");gc.exports={pipelineImpl:bc,pipeline:Ib}});var Zo=N((Y_,vc)=>{"use strict";var{pipeline:Cb}=Gr(),Hr=Ue(),{destroyer:Lb}=St(),{isNodeStream:Kr,isReadable:wc,isWritable:Sc,isWebStream:Qo,isTransformStream:At,isWritableStream:_c,isReadableStream:Ec}=Be(),{AbortError:Rb,codes:{ERR_INVALID_ARG_VALUE:xc,ERR_MISSING_ARGS:Ob}}=ie(),Bb=Ge();vc.exports=s(function(...e){if(e.length===0)throw new Ob("streams");if(e.length===1)return Hr.from(e[0]);let i=[...e];if(typeof e[0]=="function"&&(e[0]=Hr.from(e[0])),typeof e[e.length-1]=="function"){let m=e.length-1;e[m]=Hr.from(e[m])}for(let m=0;m<e.length;++m)if(!(!Kr(e[m])&&!Qo(e[m]))){if(m<e.length-1&&!(wc(e[m])||Ec(e[m])||At(e[m])))throw new xc(`streams[${m}]`,i[m],"must be readable");if(m>0&&!(Sc(e[m])||_c(e[m])||At(e[m])))throw new xc(`streams[${m}]`,i[m],"must be writable")}let r,n,o,a,l;function u(m){let g=a;a=null,g?g(m):m?l.destroy(m):!b&&!h&&l.destroy()}s(u,"onfinished");let f=e[0],d=Cb(e,u),h=!!(Sc(f)||_c(f)||At(f)),b=!!(wc(d)||Ec(d)||At(d));if(l=new Hr({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:b}),h){if(Kr(f))l._write=function(g,y,k){f.write(g,y)?k():r=k},l._final=function(g){f.end(),n=g},f.on("drain",function(){if(r){let g=r;r=null,g()}});else if(Qo(f)){let y=(At(f)?f.writable:f).getWriter();l._write=async function(k,w,F){try{await y.ready,y.write(k).catch(()=>{}),F()}catch(D){F(D)}},l._final=async function(k){try{await y.ready,y.close().catch(()=>{}),n=k}catch(w){k(w)}}}let m=At(d)?d.readable:d;Bb(m,()=>{if(n){let g=n;n=null,g()}})}if(b){if(Kr(d))d.on("readable",function(){if(o){let m=o;o=null,m()}}),d.on("end",function(){l.push(null)}),l._read=function(){for(;;){let m=d.read();if(m===null){o=l._read;return}if(!l.push(m))return}};else if(Qo(d)){let g=(At(d)?d.readable:d).getReader();l._read=async function(){for(;;)try{let{value:y,done:k}=await g.read();if(!l.push(y))return;if(k){l.push(null);return}}catch{return}}}}return l._destroy=function(m,g){!m&&a!==null&&(m=new Rb),o=null,r=null,n=null,a===null?g(m):(a=g,Kr(d)&&Lb(d,m))},l},"compose")});var Rc=N((J_,ts)=>{"use strict";var Db=globalThis.AbortController||Zt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Mb,ERR_INVALID_ARG_TYPE:$i,ERR_MISSING_ARGS:Ub,ERR_OUT_OF_RANGE:Wb},AbortError:We}=ie(),{validateAbortSignal:kt,validateInteger:Ac,validateObject:Nt}=ii(),qb=O().Symbol("kWeak"),jb=O().Symbol("kResistStopPropagation"),{finished:$b}=Ge(),zb=Zo(),{addAbortSignalNoValidate:Vb}=Li(),{isWritable:Gb,isNodeStream:Hb}=Be(),{deprecate:Kb}=ee(),{ArrayPrototypePush:Yb,Boolean:Xb,MathFloor:kc,Number:Jb,NumberIsNaN:Qb,Promise:Nc,PromiseReject:Tc,PromiseResolve:Zb,PromisePrototypeThen:Fc,Symbol:Pc}=O(),Xr=Pc("kEmpty"),Ic=Pc("kEof");function eg(t,e){if(e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),Hb(t)&&!Gb(t))throw new Mb("stream",t,"must be writable");let i=zb(this,t);return e!=null&&e.signal&&Vb(e.signal,i),i}s(eg,"compose");function Jr(t,e){if(typeof t!="function")throw new $i("fn",["Function","AsyncFunction"],t);e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal");let i=1;e?.concurrency!=null&&(i=kc(e.concurrency));let r=i-1;return e?.highWaterMark!=null&&(r=kc(e.highWaterMark)),Ac(i,"options.concurrency",1),Ac(r,"options.highWaterMark",0),r+=i,s(async function*(){let o=ee().AbortSignalAny([e?.signal].filter(Xb)),a=this,l=[],u={signal:o},f,d,h=!1,b=0;function m(){h=!0,g()}s(m,"onCatch");function g(){b-=1,y()}s(g,"afterItemProcessed");function y(){d&&!h&&b<i&&l.length<r&&(d(),d=null)}s(y,"maybeResume");async function k(){try{for await(let w of a){if(h)return;if(o.aborted)throw new We;try{if(w=t(w,u),w===Xr)continue;w=Zb(w)}catch(F){w=Tc(F)}b+=1,Fc(w,g,m),l.push(w),f&&(f(),f=null),!h&&(l.length>=r||b>=i)&&await new Nc(F=>{d=F})}l.push(Ic)}catch(w){let F=Tc(w);Fc(F,g,m),l.push(F)}finally{h=!0,f&&(f(),f=null)}}s(k,"pump"),k();try{for(;;){for(;l.length>0;){let w=await l[0];if(w===Ic)return;if(o.aborted)throw new We;w!==Xr&&(yield w),l.shift(),y()}await new Nc(w=>{f=w})}}finally{h=!0,d&&(d(),d=null)}},"map").call(this)}s(Jr,"map");function tg(t=void 0){return t!=null&&Nt(t,"options"),t?.signal!=null&&kt(t.signal,"options.signal"),s(async function*(){let i=0;for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new We({cause:t.signal.reason});yield[i++,n]}},"asIndexedPairs").call(this)}s(tg,"asIndexedPairs");async function Cc(t,e=void 0){for await(let i of es.call(this,t,e))return!0;return!1}s(Cc,"some");async function ig(t,e=void 0){if(typeof t!="function")throw new $i("fn",["Function","AsyncFunction"],t);return!await Cc.call(this,async(...i)=>!await t(...i),e)}s(ig,"every");async function rg(t,e){for await(let i of es.call(this,t,e))return i}s(rg,"find");async function ng(t,e){if(typeof t!="function")throw new $i("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n),Xr}s(i,"forEachFn");for await(let r of Jr.call(this,i,e));}s(ng,"forEach");function es(t,e){if(typeof t!="function")throw new $i("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n)?r:Xr}return s(i,"filterFn"),Jr.call(this,i,e)}s(es,"filter");var Yr=class extends Ub{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};s(Yr,"ReduceAwareErrMissingArgs");async function og(t,e,i){var r;if(typeof t!="function")throw new $i("reducer",["Function","AsyncFunction"],t);i!=null&&Nt(i,"options"),i?.signal!=null&&kt(i.signal,"options.signal");let n=arguments.length>1;if(i!=null&&(r=i.signal)!==null&&r!==void 0&&r.aborted){let f=new We(void 0,{cause:i.signal.reason});throw this.once("error",()=>{}),await $b(this.destroy(f)),f}let o=new Db,a=o.signal;if(i!=null&&i.signal){let f={once:!0,[qb]:this,[jb]:!0};i.signal.addEventListener("abort",()=>o.abort(),f)}let l=!1;try{for await(let f of this){var u;if(l=!0,i!=null&&(u=i.signal)!==null&&u!==void 0&&u.aborted)throw new We;n?e=await t(e,f,{signal:a}):(e=f,n=!0)}if(!l&&!n)throw new Yr}finally{o.abort()}return e}s(og,"reduce");async function sg(t){t!=null&&Nt(t,"options"),t?.signal!=null&&kt(t.signal,"options.signal");let e=[];for await(let r of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new We(void 0,{cause:t.signal.reason});Yb(e,r)}return e}s(sg,"toArray");function ag(t,e){let i=Jr.call(this,t,e);return s(async function*(){for await(let n of i)yield*n},"flatMap").call(this)}s(ag,"flatMap");function Lc(t){if(t=Jb(t),Qb(t))return 0;if(t<0)throw new Wb("number",">= 0",t);return t}s(Lc,"toIntegerOrInfinity");function lg(t,e=void 0){return e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),t=Lc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new We;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new We;t--<=0&&(yield o)}},"drop").call(this)}s(lg,"drop");function cg(t,e=void 0){return e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),t=Lc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new We;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new We;if(t-- >0&&(yield o),t<=0)return}},"take").call(this)}s(cg,"take");ts.exports.streamReturningOperators={asIndexedPairs:Kb(tg,"readable.asIndexedPairs will be removed in a future version."),drop:lg,filter:es,flatMap:ag,map:Jr,take:cg,compose:eg};ts.exports.promiseReturningOperators={every:ig,forEach:ng,reduce:og,toArray:sg,some:Cc,find:rg}});var is=N((Z_,Oc)=>{"use strict";var{ArrayPrototypePop:ug,Promise:fg}=O(),{isIterable:dg,isNodeStream:hg,isWebStream:pg}=Be(),{pipelineImpl:yg}=Gr(),{finished:mg}=Ge();rs();function bg(...t){return new fg((e,i)=>{let r,n,o=t[t.length-1];if(o&&typeof o=="object"&&!hg(o)&&!dg(o)&&!pg(o)){let a=ug(t);r=a.signal,n=a.end}yg(t,(a,l)=>{a?i(a):e(l)},{signal:r,end:n})})}s(bg,"pipeline");Oc.exports={finished:mg,pipeline:bg}});var rs=N((t0,zc)=>{var{Buffer:gg}=$e(),{ObjectDefineProperty:Xe,ObjectKeys:Mc,ReflectApply:Uc}=O(),{promisify:{custom:Wc}}=ee(),{streamReturningOperators:Bc,promiseReturningOperators:Dc}=Rc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:qc}}=ie(),wg=Zo(),{setDefaultHighWaterMark:Sg,getDefaultHighWaterMark:_g}=Ri(),{pipeline:jc}=Gr(),{destroyer:Eg}=St(),$c=Ge(),ns=is(),zi=Be(),C=zc.exports=Fr().Stream;C.isDestroyed=zi.isDestroyed;C.isDisturbed=zi.isDisturbed;C.isErrored=zi.isErrored;C.isReadable=zi.isReadable;C.isWritable=zi.isWritable;C.Readable=Di();for(let t of Mc(Bc)){let i=function(...r){if(new.target)throw qc();return C.Readable.from(Uc(e,this,r))};vg=i,s(i,"fn");let e=Bc[t];Xe(i,"name",{__proto__:null,value:e.name}),Xe(i,"length",{__proto__:null,value:e.length}),Xe(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var vg;for(let t of Mc(Dc)){let i=function(...n){if(new.target)throw qc();return Uc(e,this,n)};vg=i,s(i,"fn");let e=Dc[t];Xe(i,"name",{__proto__:null,value:e.name}),Xe(i,"length",{__proto__:null,value:e.length}),Xe(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var vg;C.Writable=jr();C.Duplex=Ue();C.Transform=Wo();C.PassThrough=jo();C.pipeline=jc;var{addAbortSignal:xg}=Li();C.addAbortSignal=xg;C.finished=$c;C.destroy=Eg;C.compose=wg;C.setDefaultHighWaterMark=Sg;C.getDefaultHighWaterMark=_g;Xe(C,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return ns}});Xe(jc,Wc,{__proto__:null,enumerable:!0,get(){return ns.pipeline}});Xe($c,Wc,{__proto__:null,enumerable:!0,get(){return ns.finished}});C.Stream=C;C._isUint8Array=s(function(e){return e instanceof Uint8Array},"isUint8Array");C._uint8ArrayToBuffer=s(function(e){return gg.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var Vc=N((r0,j)=>{"use strict";var G=rs(),Ag=is(),kg=G.Readable.destroy;j.exports=G.Readable;j.exports._uint8ArrayToBuffer=G._uint8ArrayToBuffer;j.exports._isUint8Array=G._isUint8Array;j.exports.isDisturbed=G.isDisturbed;j.exports.isErrored=G.isErrored;j.exports.isReadable=G.isReadable;j.exports.Readable=G.Readable;j.exports.Writable=G.Writable;j.exports.Duplex=G.Duplex;j.exports.Transform=G.Transform;j.exports.PassThrough=G.PassThrough;j.exports.addAbortSignal=G.addAbortSignal;j.exports.finished=G.finished;j.exports.destroy=G.destroy;j.exports.destroy=kg;j.exports.pipeline=G.pipeline;j.exports.compose=G.compose;Object.defineProperty(G,"promises",{configurable:!0,enumerable:!0,get(){return Ag}});j.exports.Stream=G.Stream;j.exports.default=j.exports});var Fg={};Hi(Fg,{ActionType:()=>tr,ApiError:()=>c,Async:()=>wi,AsyncFile:()=>Bt,AsyncFileIndexFS:()=>rn,AsyncMirror:()=>Uu,AsyncMirrorFS:()=>ft,AsyncStoreFS:()=>rr,BigIntStats:()=>J,Cred:()=>z,ErrorCode:()=>Y,ErrorStrings:()=>on,File:()=>_i,FileFlag:()=>I,FileIndex:()=>Tt,FileIndexFS:()=>yi,FileSystem:()=>X,FileType:()=>U,InMemory:()=>un,InMemoryStore:()=>vi,IndexDirInode:()=>Je,IndexFileInode:()=>Gi,IndexInode:()=>pi,Inode:()=>pe,LockedFS:()=>Wt,MirrorFile:()=>Ei,Mutex:()=>Ut,NoSyncFile:()=>ut,Overlay:()=>Wu,OverlayFS:()=>jt,OverlayFile:()=>qt,PreloadFile:()=>oe,Readonly:()=>ln,SimpleSyncRWTransaction:()=>Dt,Stats:()=>M,StatsCommon:()=>Rt,Sync:()=>ct,SyncFile:()=>er,SyncFileIndexFS:()=>tn,SyncStoreFS:()=>Mt,SyncStoreFile:()=>xi,UnlockedOverlayFS:()=>Ai,checkOptions:()=>an,configure:()=>Ng,createBackend:()=>su,decode:()=>Z,decodeDirListing:()=>bi,default:()=>Tg,encode:()=>R,encodeDirListing:()=>ae,fs:()=>Vi,initialize:()=>Gc,isBackend:()=>gi,isBackendConfig:()=>cs,levenshtein:()=>sn,mkdirpSync:()=>ls,randomIno:()=>Ot,resolveBackendConfig:()=>Yi,rootIno:()=>ye,setImmediate:()=>ou,size_max:()=>Zi,wait:()=>nu});var Y=(y=>(y[y.EPERM=1]="EPERM",y[y.ENOENT=2]="ENOENT",y[y.EIO=5]="EIO",y[y.EBADF=9]="EBADF",y[y.EACCES=13]="EACCES",y[y.EBUSY=16]="EBUSY",y[y.EEXIST=17]="EEXIST",y[y.ENOTDIR=20]="ENOTDIR",y[y.EISDIR=21]="EISDIR",y[y.EINVAL=22]="EINVAL",y[y.EFBIG=27]="EFBIG",y[y.ENOSPC=28]="ENOSPC",y[y.EROFS=30]="EROFS",y[y.ENOTEMPTY=39]="ENOTEMPTY",y[y.ENOTSUP=95]="ENOTSUP",y))(Y||{}),on={[1]:"Operation not permitted.",[2]:"No such file or directory.",[5]:"Input/output error.",[9]:"Bad file descriptor.",[13]:"Permission denied.",[16]:"Resource busy or locked.",[17]:"File exists.",[20]:"File is not a directory.",[21]:"File is a directory.",[22]:"Invalid argument.",[27]:"File is too big.",[28]:"No space left on disk.",[30]:"Cannot modify a read-only file system.",[39]:"Directory is not empty.",[95]:"Operation is not supported."},c=class extends Error{constructor(i,r=on[i],n){super(r);this.errno=i;this.path=n;this.code=Y[i],this.message=`${this.code}: ${r}${this.path?`, '${this.path}'`:""}`}static fromJSON(i){let r=new c(i.errno,i.message,i.path);return r.code=i.code,r.stack=i.stack,r}static OnPath(i,r){return new c(i,on[i],r)}static EACCES(i){return this.OnPath(13,i)}static ENOENT(i){return this.OnPath(2,i)}static EEXIST(i){return this.OnPath(17,i)}static EISDIR(i){return this.OnPath(21,i)}static ENOTDIR(i){return this.OnPath(20,i)}static EPERM(i){return this.OnPath(1,i)}static ENOTEMPTY(i){return this.OnPath(39,i)}code;syscall="";stack;toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}};s(c,"ApiError");var iu="/",ss="/";function Pt(t,e){if(typeof t!="string")throw new TypeError(`"${e}" is not a string`)}s(Pt,"validateString");function as(t,e){let i="",r=0,n=-1,o=0,a="\0";for(let l=0;l<=t.length;++l){if(l<t.length)a=t[l];else{if(a=="/")break;a="/"}if(a=="/"){if(!(n===l-1||o===1))if(o===2){if(i.length<2||r!==2||i.at(-1)!=="."||i.at(-2)!=="."){if(i.length>2){let u=i.lastIndexOf("/");u===-1?(i="",r=0):(i=i.slice(0,u),r=i.length-1-i.lastIndexOf("/")),n=l,o=0;continue}else if(i.length!==0){i="",r=0,n=l,o=0;continue}}e&&(i+=i.length>0?"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(n+1,l):i=t.slice(n+1,l),r=l-n-1;n=l,o=0}else a==="."&&o!==-1?++o:o=-1}return i}s(as,"normalizeString");function ke(...t){let e="",i=!1;for(let r=t.length-1;r>=-1&&!i;r--){let n=r>=0?t[r]:iu;Pt(n,`paths[${r}]`),n.length!==0&&(e=`${n}/${e}`,i=n[0]==="/")}return e=as(e,!i),i?`/${e}`:e.length>0?e:"."}s(ke,"resolve");function ru(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=t.at(-1)==="/";return t=as(t,!e),t.length===0?e?"/":i?"./":".":(i&&(t+="/"),e?`/${t}`:t)}s(ru,"normalize");function de(...t){if(t.length===0)return".";let e;for(let i=0;i<t.length;++i){let r=t[i];Pt(r,"path"),r.length>0&&(e===void 0?e=r:e+=`/${r}`)}return e===void 0?".":ru(e)}s(de,"join");function E(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=-1,r=!0;for(let n=t.length-1;n>=1;--n)if(t[n]==="/"){if(!r){i=n;break}}else r=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)}s(E,"dirname");function L(t,e){e!==void 0&&Pt(e,"ext"),Pt(t,"path");let i=0,r=-1,n=!0;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(let l=t.length-1;l>=0;--l)if(t[l]==="/"){if(!n){i=l+1;break}}else a===-1&&(n=!1,a=l+1),o>=0&&(t[l]===e[o]?--o===-1&&(r=l):(o=-1,r=a));return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(let o=t.length-1;o>=0;--o)if(t[o]==="/"){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":t.slice(i,r)}s(L,"basename");function ls(t,e,i,r){r.existsSync(t,i)||(ls(E(t),e,i,r),r.mkdirSync(t,e,i))}s(ls,"mkdirpSync");function Ki(t,e,i,r,n){return Math.min(t+1,e+1,i+1,r===n?e:e+1)}s(Ki,"_min");function sn(t,e){if(t===e)return 0;t.length>e.length&&([t,e]=[e,t]);let i=t.length,r=e.length;for(;i>0&&t.charCodeAt(i-1)===e.charCodeAt(r-1);)i--,r--;let n=0;for(;n<i&&t.charCodeAt(n)===e.charCodeAt(n);)n++;if(i-=n,r-=n,i===0||r===1)return r;let o=new Array(i<<1);for(let b=0;b<i;)o[i+b]=t.charCodeAt(n+b),o[b]=++b;let a,l,u,f,d;for(a=0;a+3<r;){let b=e.charCodeAt(n+(l=a)),m=e.charCodeAt(n+(u=a+1)),g=e.charCodeAt(n+(f=a+2)),y=e.charCodeAt(n+(d=a+3)),k=a+=4;for(let w=0;w<i;){let F=o[i+w],D=o[w];l=Ki(D,l,u,b,F),u=Ki(l,u,f,m,F),f=Ki(u,f,d,g,F),k=Ki(f,d,k,y,F),o[w++]=k,d=f,f=u,u=l,l=D}}let h=0;for(;a<r;){let b=e.charCodeAt(n+(l=a));h=++a;for(let m=0;m<i;m++){let g=o[m];o[m]=h=g<l||h<l?g>h?h+1:g+1:b===o[i+m]?l:l+1,l=g}}return h}s(sn,"levenshtein");function nu(t){return new Promise(e=>{setTimeout(e,t)})}s(nu,"wait");var ou=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:t=>setTimeout(t,0);function R(t,e="utf8"){if(typeof t!="string")throw new c(22,"Can not encode a non-string");switch(e){case"ascii":case"latin1":case"binary":return new Uint8Array(Array.from(t).map(r=>r.charCodeAt(0)));case"utf8":case"utf-8":return new Uint8Array(Array.from(t).flatMap(r=>{let n=r.charCodeAt(0);if(n<128)return n;let o=n&63|128;if(n<2048)return[n>>6|192,o];let a=n>>6&63|128;return n<65536?[n>>12|224,a,o]:[n>>18|240,n>>12&63|128,a,o]}));case"base64":return R(atob(t),"utf-8");case"base64url":return R(t.replace("_","/").replace("-","+"),"base64");case"hex":return new Uint8Array(t.match(/.{1,2}/g).map(r=>parseInt(r,16)));case"utf16le":case"ucs2":case"ucs-2":let i=new Uint16Array(new ArrayBuffer(t.length*2));for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return new Uint8Array(i.buffer);default:throw new c(22,"Invalid encoding: "+e)}}s(R,"encode");function Z(t,e="utf8"){if(!(t instanceof Uint8Array))throw new c(22,"Can not decode a non-Uint8Array");switch(e){case"ascii":case"latin1":case"binary":return Array.from(t).map(n=>String.fromCharCode(n)).join("");case"utf8":case"utf-8":let i="";for(let n=0;n<t.length;n++){let o;t[n]<128?o=t[n]:t[n]<224?o=(t[n]&31)<<6|t[++n]&63:t[n]<240?o=(t[n]&15)<<12|(t[++n]&63)<<6|t[++n]&63:o=(t[n]&7)<<18|(t[++n]&63)<<12|(t[++n]&63)<<6|t[++n]&63,i+=String.fromCharCode(o)}return i;case"utf16le":case"ucs2":case"ucs-2":let r="";for(let n=0;n<t.length;n+=2){let o=t[n]|t[n+1]<<8;r+=String.fromCharCode(o)}return r;case"base64":return btoa(Z(t,"utf-8"));case"base64url":return Z(t,"base64").replace("/","_").replace("+","-");case"hex":return Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("");default:throw new c(22,"Invalid encoding: "+e)}}s(Z,"decode");function bi(t){return JSON.parse(Z(t),(e,i)=>e==""?i:BigInt(i))}s(bi,"decodeDirListing");function ae(t){return R(JSON.stringify(t,(e,i)=>e==""?i:i.toString()))}s(ae,"encodeDirListing");function gi(t){return t!=null&&typeof t=="object"&&"isAvailable"in t&&typeof t.isAvailable=="function"&&"create"in t&&typeof t.create=="function"}s(gi,"isBackend");async function an(t,e){if(typeof e!="object"||e===null)throw new c(22,"Invalid options");for(let[i,r]of Object.entries(t.options)){let n=e?.[i];if(n==null){if(!r.required)continue;let a=Object.keys(e).filter(l=>!(l in t.options)).map(l=>({str:l,distance:sn(i,l)})).filter(l=>l.distance<5).sort((l,u)=>l.distance-u.distance);throw new c(22,`${t.name}: Required option '${i}' not provided.${a.length>0?` You provided '${a[0].str}', did you mean '${i}'.`:""}`)}if(!(Array.isArray(r.type)?r.type.indexOf(typeof n)!=-1:typeof n==r.type))throw new c(22,`${t.name}: Value provided for option ${i} is not the proper type. Expected ${Array.isArray(r.type)?`one of {${r.type.join(", ")}}`:r.type}, but received ${typeof n}`);r.validator&&await r.validator(n)}}s(an,"checkOptions");function su(t,e){return an(t,e),t.create(e).ready()}s(su,"createBackend");function cs(t){return t!=null&&typeof t=="object"&&"backend"in t}s(cs,"isBackendConfig");async function Yi(t){if(typeof t!="object"||t==null)throw new c(22,"Invalid options on configuration object.");let{backend:e}=t;if(!gi(e))throw new c(22,"Missing or invalid backend");let i=Object.keys(t).filter(n=>n!="backend");for(let n of i){let o=t[n];gi(o)&&(o={backend:o}),cs(o)&&(t[n]=await Yi(o))}if(!e.isAvailable())throw new c(1,"Backend not available: "+e);an(e,t);let r=e.create(t);return await r.ready(),r}s(Yi,"resolveBackendConfig");var X=class{metadata(){return{name:this.constructor.name,readonly:!1,synchronous:!1,supportsProperties:!1,totalSpace:0,freeSpace:0}}constructor(e){}async exists(e,i){try{return await this.stat(e,i),!0}catch{return!1}}existsSync(e,i){try{return this.statSync(e,i),!0}catch{return!1}}};s(X,"FileSystem");function ct(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!0}}async ready(){return this}async exists(r,n){return this.existsSync(r,n)}async rename(r,n,o){return this.renameSync(r,n,o)}async stat(r,n){return this.statSync(r,n)}async createFile(r,n,o,a){return this.createFileSync(r,n,o,a)}async openFile(r,n,o){return this.openFileSync(r,n,o)}async unlink(r,n){return this.unlinkSync(r,n)}async rmdir(r,n){return this.rmdirSync(r,n)}async mkdir(r,n,o){return this.mkdirSync(r,n,o)}async readdir(r,n){return this.readdirSync(r,n)}async link(r,n,o){return this.linkSync(r,n,o)}async sync(r,n,o){return this.syncSync(r,n,o)}}return s(e,"_SyncFileSystem"),e}s(ct,"Sync");function wi(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!1}}renameSync(r,n,o){throw new c(95)}statSync(r,n){throw new c(95)}createFileSync(r,n,o,a){throw new c(95)}openFileSync(r,n,o){throw new c(95)}unlinkSync(r,n){throw new c(95)}rmdirSync(r,n){throw new c(95)}mkdirSync(r,n,o){throw new c(95)}readdirSync(r,n){throw new c(95)}linkSync(r,n,o){throw new c(95)}syncSync(r,n,o){throw new c(95)}}return s(e,"_AsyncFileSystem"),e}s(wi,"Async");function ln(t){class e extends t{metadata(){return{...super.metadata(),readonly:!0}}async rename(r,n,o){throw new c(30)}renameSync(r,n,o){throw new c(30)}async createFile(r,n,o,a){throw new c(30)}createFileSync(r,n,o,a){throw new c(30)}async unlink(r,n){throw new c(30)}unlinkSync(r,n){throw new c(30)}async rmdir(r,n){throw new c(30)}rmdirSync(r,n){throw new c(30)}async mkdir(r,n,o){throw new c(30)}mkdirSync(r,n,o){throw new c(30)}async link(r,n,o){throw new c(30)}linkSync(r,n,o){throw new c(30)}async sync(r,n,o){throw new c(30)}syncSync(r,n,o){throw new c(30)}}return s(e,"_ReadonlyFileSystem"),e}s(ln,"Readonly");var Si={};Hi(Si,{COPYFILE_EXCL:()=>cu,COPYFILE_FICLONE:()=>uu,COPYFILE_FICLONE_FORCE:()=>fu,F_OK:()=>au,O_APPEND:()=>Ie,O_CREAT:()=>H,O_DIRECT:()=>gu,O_DIRECTORY:()=>hu,O_DSYNC:()=>mu,O_EXCL:()=>Te,O_NOATIME:()=>pu,O_NOCTTY:()=>du,O_NOFOLLOW:()=>yu,O_NONBLOCK:()=>wu,O_RDONLY:()=>Ct,O_RDWR:()=>ne,O_SYMLINK:()=>bu,O_SYNC:()=>Lt,O_TRUNC:()=>Fe,O_WRONLY:()=>Ne,R_OK:()=>Se,S_IFBLK:()=>_u,S_IFCHR:()=>Eu,S_IFDIR:()=>Qi,S_IFIFO:()=>xu,S_IFLNK:()=>Xi,S_IFMT:()=>he,S_IFREG:()=>Ji,S_IFSOCK:()=>Su,S_IRGRP:()=>Cu,S_IROTH:()=>Bu,S_IRUSR:()=>Tu,S_IRWXG:()=>Pu,S_IRWXO:()=>Ou,S_IRWXU:()=>Nu,S_ISGID:()=>Au,S_ISUID:()=>vu,S_ISVTX:()=>ku,S_IWGRP:()=>Lu,S_IWOTH:()=>Du,S_IWUSR:()=>Fu,S_IXGRP:()=>Ru,S_IXOTH:()=>Mu,S_IXUSR:()=>Iu,W_OK:()=>le,X_OK:()=>lu});var au=0,Se=4,le=2,lu=1,cu=1,uu=2,fu=4,Ct=0,Ne=1,ne=2,H=64,Te=128,du=256,Fe=512,Ie=1024,hu=65536,pu=262144,yu=131072,Lt=1052672,mu=4096,bu=32768,gu=16384,wu=2048,he=61440,Su=49152,Xi=40960,Ji=32768,_u=24576,Qi=16384,Eu=8192,xu=4096,vu=2048,Au=1024,ku=512,Nu=448,Tu=256,Fu=128,Iu=64,Pu=56,Cu=32,Lu=16,Ru=8,Ou=7,Bu=4,Du=2,Mu=1;var cn=class{constructor(e,i,r,n,o,a){this.uid=e;this.gid=i;this.suid=r;this.sgid=n;this.euid=o;this.egid=a}},z=cn;s(z,"Cred"),mi(z,"Root",new cn(0,0,0,0,0,0));var U=(r=>(r[r.FILE=32768]="FILE",r[r.DIRECTORY=16384]="DIRECTORY",r[r.SYMLINK=40960]="SYMLINK",r))(U||{}),Rt=class{get _typename(){return this._isBigint?"bigint":"number"}get _typename_inverse(){return this._isBigint?"number":"bigint"}_convert(e){return this._isBigint?BigInt(e):Number(e)}blocks;mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);fileData=null;atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;constructor({atimeMs:e,mtimeMs:i,ctimeMs:r,birthtimeMs:n,uid:o,gid:a,size:l,mode:u}={}){let f=Date.now(),d=s((b,m)=>typeof b==this._typename?b:this._convert(typeof b==this._typename_inverse?b:m),"resolveT");this.atimeMs=d(e,f),this.mtimeMs=d(i,f),this.ctimeMs=d(r,f),this.birthtimeMs=d(n,f),this.uid=d(o,0),this.gid=d(a,0),this.size=this._convert(l);let h=Number(u)&61440||U.FILE;if(u)this.mode=this._convert(u);else switch(h){case U.FILE:this.mode=this._convert(420);break;case U.DIRECTORY:default:this.mode=this._convert(511)}this.blocks=this._convert(Math.ceil(Number(l)/512)),this.mode&61440||(this.mode=this.mode|this._convert(h))}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}hasAccess(e,i){if(i.euid===0||i.egid===0)return!0;let r=this.mode&-61441,n=15,o=15,a=15;if(i.euid==this.uid){let f=(3840&r)>>8;n=(e^f)&e}if(i.egid==this.gid){let f=(240&r)>>4;o=(e^f)&e}let l=15&r;return a=(e^l)&e,!(n&o&a)}getCred(e=Number(this.uid),i=Number(this.gid)){return new z(e,i,Number(this.uid),Number(this.gid),e,i)}chmod(e){this.mode=this._convert(this.mode&61440|e)}chown(e,i){e=Number(e),i=Number(i),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(i)&&0<=i&&i<2**32&&(this.gid=this._convert(i))}};s(Rt,"StatsCommon");var M=class extends Rt{_isBigint=!1;static clone(e){return new M(e)}};s(M,"Stats");var J=class extends Rt{_isBigint=!0;atimeNs;mtimeNs;ctimeNs;birthtimeNs;static clone(e){return new J(e)}};s(J,"BigIntStats");var Zi=2**32-1,ye=0n;function us(){return Math.round(Math.random()*2**32).toString(16)}s(us,"_random");function Ot(){return BigInt("0x"+us()+us())}s(Ot,"randomIno");var pe=class{buffer;get data(){return new Uint8Array(this.buffer)}view;constructor(e){let i=!e;if(e??=new ArrayBuffer(58),e?.byteLength<58)throw new RangeError("Can not create an inode from a buffer less than 58 bytes");if(this.view=new DataView(e),this.buffer=e,!i)return;this.ino=Ot(),this.nlink=1,this.size=4096;let r=Date.now();this.atimeMs=r,this.mtimeMs=r,this.ctimeMs=r,this.birthtimeMs=r}get ino(){return this.view.getBigUint64(0,!0)}set ino(e){this.view.setBigUint64(0,e,!0)}get size(){return this.view.getUint32(8,!0)}set size(e){this.view.setUint32(8,e,!0)}get mode(){return this.view.getUint16(12,!0)}set mode(e){this.view.setUint16(12,e,!0)}get nlink(){return this.view.getUint32(14,!0)}set nlink(e){this.view.setUint32(14,e,!0)}get uid(){return this.view.getUint32(18,!0)}set uid(e){this.view.setUint32(18,e,!0)}get gid(){return this.view.getUint32(22,!0)}set gid(e){this.view.setUint32(22,e,!0)}get atimeMs(){return this.view.getFloat64(26,!0)}set atimeMs(e){this.view.setFloat64(26,e,!0)}get birthtimeMs(){return this.view.getFloat64(34,!0)}set birthtimeMs(e){this.view.setFloat64(34,e,!0)}get mtimeMs(){return this.view.getFloat64(42,!0)}set mtimeMs(e){this.view.setFloat64(42,e,!0)}get ctimeMs(){return this.view.getFloat64(50,!0)}set ctimeMs(e){this.view.setFloat64(50,e,!0)}toStats(){return new M(this)}update(e){let i=!1;return this.size!==e.size&&(this.size=e.size,i=!0),this.mode!==e.mode&&(this.mode=e.mode,i=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.atimeMs!==e.atimeMs&&(this.atimeMs=e.atimeMs,i=!0),this.mtimeMs!==e.mtimeMs&&(this.mtimeMs=e.mtimeMs,i=!0),this.ctimeMs!==e.ctimeMs&&(this.ctimeMs=e.ctimeMs,i=!0),i}};s(pe,"Inode");var tr=(n=>(n[n.NOP=0]="NOP",n[n.THROW=1]="THROW",n[n.TRUNCATE=2]="TRUNCATE",n[n.CREATE=3]="CREATE",n))(tr||{}),Ze=class{static Get(e){return Ze.cache.has(e)||Ze.cache.set(e,new Ze(e)),Ze.cache.get(e)}_flag;constructor(e){if(typeof e=="number"&&(e=Ze.StringOf(e)),!Ze.validStrings.includes(e))throw new c(22,"Invalid flag string: "+e);this._flag=e}static StringOf(e){switch(e){case 0:return"r";case 1052672:return"rs";case 2:return"r+";case 1052674:return"rs+";case 577:return"w";case 705:return"wx";case 578:return"w+";case 706:return"wx+";case 1089:return"a";case 1217:return"ax";case 1090:return"a+";case 1218:return"ax+";default:throw new c(22,"Invalid flag number: "+e)}}static NumberOf(e){switch(e){case"r":return 0;case"rs":return 1052672;case"r+":return 2;case"rs+":return 1052674;case"w":return 577;case"wx":return 705;case"w+":return 578;case"wx+":return 706;case"a":return 1089;case"ax":return 1217;case"a+":return 1090;case"ax+":return 1218;default:throw new c(22,"Invalid flag string: "+e)}}toString(){return this._flag}get mode(){let e=0;return e<<=1,e+=+this.isReadable(),e<<=1,e+=+this.isWriteable(),e<<=1,e}isReadable(){return this._flag.indexOf("r")!=-1||this._flag.indexOf("+")!=-1}isWriteable(){return this._flag.indexOf("w")!=-1||this._flag.indexOf("a")!=-1||this._flag.indexOf("+")!=-1}isTruncating(){return this._flag.indexOf("w")!==-1}isAppendable(){return this._flag.indexOf("a")!==-1}isSynchronous(){return this._flag.indexOf("s")!==-1}isExclusive(){return this._flag.indexOf("x")!==-1}pathExistsAction(){return this.isExclusive()?1:this.isTruncating()?2:0}pathNotExistsAction(){return(this.isWriteable()||this.isAppendable())&&this._flag!="r+"?3:1}},I=Ze;s(I,"FileFlag"),mi(I,"cache",new Map),mi(I,"validStrings",["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"]);var _i=class{datasync(){return this.sync()}datasyncSync(){return this.syncSync()}};s(_i,"File");var oe=class extends _i{constructor(i,r,n,o,a=new Uint8Array(new ArrayBuffer(0,{maxByteLength:Zi}))){super();this.fs=i;this.path=r;this.flag=n;this.stats=o;this._buffer=a;if(this.stats.size!=a.byteLength){if(this.flag.isReadable())throw new Error(`Size mismatch: buffer length ${a.byteLength}, stats size ${this.stats.size}`);this._dirty=!0}}_position=0;_dirty=!1;get buffer(){return this._buffer}get position(){return this.flag.isAppendable()?this.stats.size:this._position}set position(i){this._position=i}async stat(){return new M(this.stats)}statSync(){return new M(this.stats)}truncate(i){if(this.truncateSync(i),this.flag.isSynchronous()&&!this.fs.metadata().synchronous)return this.sync()}truncateSync(i){if(this._dirty=!0,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),i>this._buffer.length){let r=new Uint8Array(i-this._buffer.length);this.writeSync(r,0,r.length,this._buffer.length),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync();return}this.stats.size=i,this._buffer=this._buffer.subarray(0,i),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync()}async write(i,r=0,n=this.stats.size,o=0){return this.writeSync(i,r,n,o)}writeSync(i,r=0,n=this.stats.size,o=0){if(this._dirty=!0,o??=this.position,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");let a=o+n;if(a>this.stats.size&&(this.stats.size=a,a>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=a)this._buffer.buffer.resize(a);else{let u=new Uint8Array(new ArrayBuffer(a,{maxByteLength:Zi}));u.set(this._buffer),this._buffer=u}this._buffer.set(i.slice(r,r+n),o);let l=this._buffer.byteOffset;return this.stats.mtimeMs=Date.now(),this.flag.isSynchronous()?(this.syncSync(),l):(this.position=o+l,l)}async read(i,r=0,n=this.stats.size,o=0){return{bytesRead:this.readSync(i,r,n,o),buffer:i}}readSync(i,r=0,n=this.stats.size,o=0){if(!this.flag.isReadable())throw new c(1,"File not opened with a readable mode.");o??=this.position;let a=o+n;a>this.stats.size&&(a=o+Math.max(this.stats.size-o,0)),this.stats.atimeMs=Date.now(),this._position=a;let l=a-o;return l==0||i.set(this._buffer.slice(o,a),r),l}async chmod(i){this.chmodSync(i)}chmodSync(i){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chmod(i),this.syncSync()}async chown(i,r){this.chownSync(i,r)}chownSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chown(i,r),this.syncSync()}async utimes(i,r){this.utimesSync(i,r)}utimesSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.atime=i,this.stats.mtime=r,this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}_setType(i){return this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.sync()}_setTypeSync(i){this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.syncSync()}};s(oe,"PreloadFile");var er=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(er,"SyncFile");var ut=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){}syncSync(){}async close(){}closeSync(){}};s(ut,"NoSyncFile");var Ei=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(Ei,"MirrorFile");var ft=class extends ct(X){_queue=[];_queueRunning=!1;_sync;_async;_isInitialized=!1;_ready;async ready(){return await this._ready,this}constructor({sync:e,async:i}){super(),this._sync=e,this._async=i,this._ready=this._initialize()}metadata(){return{...super.metadata(),name:ft.name,synchronous:!0,supportsProperties:this._sync.metadata().supportsProperties&&this._async.metadata().supportsProperties}}syncSync(e,i,r){this._sync.syncSync(e,i,r),this.enqueue({apiMethod:"sync",arguments:[e,i,r]})}openFileSync(e,i,r){return this._sync.openFileSync(e,i,r)}createFileSync(e,i,r,n){let o=this._sync.createFileSync(e,i,r,n);this.enqueue({apiMethod:"createFile",arguments:[e,i,r,n]});let a=o.statSync(),l=new Uint8Array(a.size);return o.readSync(l),new Ei(this,e,i,a,l)}linkSync(e,i,r){this._sync.linkSync(e,i,r),this.enqueue({apiMethod:"link",arguments:[e,i,r]})}renameSync(e,i,r){this._sync.renameSync(e,i,r),this.enqueue({apiMethod:"rename",arguments:[e,i,r]})}statSync(e,i){return this._sync.statSync(e,i)}unlinkSync(e,i){this._sync.unlinkSync(e,i),this.enqueue({apiMethod:"unlink",arguments:[e,i]})}rmdirSync(e,i){this._sync.rmdirSync(e,i),this.enqueue({apiMethod:"rmdir",arguments:[e,i]})}mkdirSync(e,i,r){this._sync.mkdirSync(e,i,r),this.enqueue({apiMethod:"mkdir",arguments:[e,i,r]})}readdirSync(e,i){return this._sync.readdirSync(e,i)}existsSync(e,i){return this._sync.existsSync(e,i)}async crossCopyDirectory(e,i){if(e!=="/"){let n=await this._async.stat(e,z.Root);this._sync.mkdirSync(e,i,n.getCred())}let r=await this._async.readdir(e,z.Root);for(let n of r)await this.crossCopy(de(e,n))}async crossCopyFile(e,i){let r=await this._async.openFile(e,I.Get("r"),z.Root),n=this._sync.createFileSync(e,I.Get("w"),i,z.Root);try{let{size:o}=await r.stat(),a=new Uint8Array(o);await r.read(a),n.writeSync(a)}finally{await r.close(),n.closeSync()}}async crossCopy(e){let i=await this._async.stat(e,z.Root);i.isDirectory()?await this.crossCopyDirectory(e,i.mode):await this.crossCopyFile(e,i.mode)}async _initialize(){if(!this._isInitialized)try{await this.crossCopy("/"),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,e}}async _next(){if(this._queue.length==0){this._queueRunning=!1;return}let e=this._queue.shift();try{await this._async[e.apiMethod](...e.arguments)}catch(i){throw new c(5,"AsyncMirror desync: "+i)}await this._next()}enqueue(e){this._queue.push(e),!this._queueRunning&&(this._queueRunning=!0,this._next())}};s(ft,"AsyncMirrorFS");var Uu={name:"AsyncMirror",options:{sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:async t=>{if("metadata"in t&&!t.metadata().synchronous)throw new c(22,'"sync" option must be a file system that supports synchronous operations')}},async:{type:"object",description:"The asynchronous file system to mirror."}},isAvailable(){return!0},create(t){return new ft(t)}};var ir=class{constructor(e){this.limit=e}cache=[];set(e,i){let r=this.cache.findIndex(n=>n.key===e);r!=-1?this.cache.splice(r,1):this.cache.length>=this.limit&&this.cache.shift(),this.cache.push({key:e,value:i})}get(e){let i=this.cache.find(r=>r.key===e);if(i)return this.set(e,i.value),i.value}remove(e){let i=this.cache.findIndex(r=>r.key===e);i!==-1&&this.cache.splice(i,1)}reset(){this.cache=[]}};s(ir,"LRUCache");var Bt=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this.resetDirty())}syncSync(){throw new c(95)}async close(){this.sync()}closeSync(){throw new c(95)}};s(Bt,"AsyncFile");var rr=class extends wi(X){store;_cache;_ready;ready(){return this._ready}metadata(){return{...super.metadata(),name:this.store.name}}constructor({store:e,cacheSize:i}){super(),i>0&&(this._cache=new ir(i)),this._ready=this._initialize(e)}async _initialize(e){return this.store=await e,await this.makeRootDirectory(),this}async empty(){this._cache&&this._cache.reset(),await this.store.clear(),await this.makeRootDirectory()}async rename(e,i,r){let n=this._cache;this._cache&&(this._cache=null,n.reset());try{let o=this.store.beginTransaction("readwrite"),a=E(e),l=L(e),u=E(i),f=L(i),d=await this.findINode(o,a),h=await this.getDirListing(o,d,a);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(!h[l])throw c.ENOENT(e);let b=h[l];if(delete h[l],(u+"/").indexOf(e+"/")===0)throw new c(16,a);let m,g;if(u===a?(m=d,g=h):(m=await this.findINode(o,u),g=await this.getDirListing(o,m,u)),g[f]){let y=await this.getINode(o,g[f],i);if(y.toStats().isFile())try{await o.remove(y.ino),await o.remove(g[f])}catch(k){throw await o.abort(),k}else throw c.EPERM(i)}g[f]=b;try{await o.put(d.ino,ae(h),!0),await o.put(m.ino,ae(g),!0)}catch(y){throw await o.abort(),y}await o.commit()}finally{n&&(this._cache=n)}}async stat(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n)throw c.ENOENT(e);let o=n.toStats();if(!o.hasAccess(4,i))throw c.EACCES(e);return o}async createFile(e,i,r,n){let o=this.store.beginTransaction("readwrite"),a=new Uint8Array(0),l=await this.commitNewFile(o,e,U.FILE,r,n,a);return new Bt(this,e,i,l.toStats(),a)}async openFile(e,i,r){let n=this.store.beginTransaction("readonly"),o=await this.findINode(n,e),a=await n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(!a)throw c.ENOENT(e);return new Bt(this,e,i,o.toStats(),a)}async unlink(e,i){return this.removeEntry(e,!1,i)}async rmdir(e,i){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);await this.removeEntry(e,!0,i)}async mkdir(e,i,r){let n=this.store.beginTransaction("readwrite"),o=R("{}");await this.commitNewFile(n,e,U.DIRECTORY,i,r,o)}async readdir(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(await this.getDirListing(r,n,e))}async sync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=await this._findINode(n,E(e),L(e)),a=await this.getINode(n,o,e),l=a.update(r);try{await n.put(a.ino,i,!0),l&&await n.put(o,a.data,!0)}catch(u){throw await n.abort(),u}await n.commit()}async link(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!(await this.findINode(n,o)).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=await this.findINode(n,l),f=await this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=await this._findINode(n,o,L(e)),h=await this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[L(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,ae(f),!0)}catch(b){throw n.abort(),b}n.commit()}async makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(await e.get(ye)===void 0){let i=new pe;i.mode=511|U.DIRECTORY,await e.put(i.ino,R("{}"),!1),await e.put(ye,i.data,!1),await e.commit()}}async _findINode(e,i,r,n=new Set){let o=de(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),this._cache){let a=this._cache.get(o);if(a)return a}if(i==="/"){if(r==="")return this._cache&&this._cache.set(o,ye),ye;{let a=await this.getINode(e,ye,i),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(ke(i,r))}}else{let a=await this.findINode(e,i,n),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(ke(i,r))}}async findINode(e,i,r=new Set){let n=await this._findINode(e,E(i),L(i),r);return this.getINode(e,n,i)}async getINode(e,i,r){let n=await e.get(i);if(!n)throw c.ENOENT(r);return new pe(n.buffer)}async getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=await e.get(i.ino);if(!n)throw c.ENOENT(r);return bi(n)}async addNewNode(e,i){let r=0,n=s(async()=>{if(++r===5)throw new c(5,"Unable to commit data to key-value store.");{let o=Ot();return await e.put(o,i,!1)?o:n()}},"reroll");return n()}async commitNewFile(e,i,r,n,o,a){let l=E(i),u=L(i),f=await this.findINode(e,l),d=await this.getDirListing(e,f,l);if(!f.toStats().hasAccess(2,o))throw c.EACCES(i);if(i==="/")throw c.EEXIST(i);if(d[u])throw await e.abort(),c.EEXIST(i);try{let h=new pe;return h.ino=await this.addNewNode(e,a),h.mode=n|r,h.uid=o.uid,h.gid=o.gid,h.size=a.length,d[u]=await this.addNewNode(e,h.data),await e.put(f.ino,ae(d),!0),await e.commit(),h}catch(h){throw e.abort(),h}}async removeEntry(e,i,r){this._cache&&this._cache.remove(e);let n=this.store.beginTransaction("readwrite"),o=E(e),a=await this.findINode(n,o),l=await this.getDirListing(n,a,o),u=L(e);if(!l[u])throw c.ENOENT(e);let f=l[u],d=await this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{await n.put(a.ino,ae(l),!0),--d.nlink<1&&(await n.remove(d.ino),await n.remove(f))}catch(h){throw await n.abort(),h}await n.commit()}};s(rr,"AsyncStoreFS");var Dt=class{constructor(e){this.store=e}originalData=new Map;modifiedKeys=new Set;get(e){let i=this.store.get(e);return this.stashOldValue(e,i),i}put(e,i,r){return this.markModified(e),this.store.put(e,i,r)}remove(e){this.markModified(e),this.store.remove(e)}commit(){}abort(){for(let e of this.modifiedKeys){let i=this.originalData.get(e);i?this.store.put(e,i,!0):this.store.remove(e)}}stashOldValue(e,i){this.originalData.has(e)||this.originalData.set(e,i)}markModified(e){this.modifiedKeys.add(e),this.originalData.has(e)||this.originalData.set(e,this.store.get(e))}};s(Dt,"SimpleSyncRWTransaction");var xi=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(xi,"SyncStoreFile");var Mt=class extends ct(X){store;constructor(e){super(),this.store=e.store,this.makeRootDirectory()}metadata(){return{...super.metadata(),name:this.store.name}}empty(){this.store.clear(),this.makeRootDirectory()}renameSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=L(e),l=E(i),u=L(i),f=this.findINode(n,o),d=this.getDirListing(n,f,o);if(!f.toStats().hasAccess(2,r))throw c.EACCES(e);if(!d[a])throw c.ENOENT(e);let h=d[a];if(delete d[a],(l+"/").indexOf(e+"/")==0)throw new c(16,o);let b,m;if(l===o?(b=f,m=d):(b=this.findINode(n,l),m=this.getDirListing(n,b,l)),m[u]){let g=this.getINode(n,m[u],i);if(g.toStats().isFile())try{n.remove(g.ino),n.remove(m[u])}catch(y){throw n.abort(),y}else throw c.EPERM(i)}m[u]=h;try{n.put(f.ino,ae(d),!0),n.put(b.ino,ae(m),!0)}catch(g){throw n.abort(),g}n.commit()}statSync(e,i){let r=this.findINode(this.store.beginTransaction("readonly"),e).toStats();if(!r.hasAccess(4,i))throw c.EACCES(e);return r}createFileSync(e,i,r,n){return this.commitNewFile(e,U.FILE,r,n),this.openFileSync(e,i,n)}openFileSync(e,i,r){let n=this.store.beginTransaction("readonly"),o=this.findINode(n,e),a=n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(a===null)throw c.ENOENT(e);return new xi(this,e,i,o.toStats(),a)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.removeEntry(e,!0,i)}mkdirSync(e,i,r){this.commitNewFile(e,U.DIRECTORY,i,r,R("{}"))}readdirSync(e,i){let r=this.store.beginTransaction("readonly"),n=this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(this.getDirListing(r,n,e))}syncSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=this._findINode(n,E(e),L(e)),a=this.getINode(n,o,e),l=a.update(r);try{n.put(a.ino,i,!0),l&&n.put(o,a.data,!0)}catch(u){throw n.abort(),u}n.commit()}linkSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!this.findINode(n,o).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=this.findINode(n,l),f=this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=this._findINode(n,o,L(e)),h=this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[L(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,ae(f),!0)}catch(b){throw n.abort(),b}n.commit()}makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(e.get(ye))return;let i=new pe;i.mode=511|U.DIRECTORY,e.put(i.ino,R("{}"),!1),e.put(ye,i.data,!1),e.commit()}_findINode(e,i,r,n=new Set){let o=de(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),i!="/"){let a=this._findINode(e,E(i),L(i),n),l=this.getDirListing(e,this.getINode(e,a,i+ss+r),i);if(!(r in l))throw c.ENOENT(ke(i,r));return l[r]}if(r!=""){let a=this.getDirListing(e,this.getINode(e,ye,i),i);if(!(r in a))throw c.ENOENT(ke(i,r));return a[r]}return ye}findINode(e,i){let r=this._findINode(e,E(i),L(i));return this.getINode(e,r,i)}getINode(e,i,r){let n=e.get(i);if(!n)throw c.ENOENT(r);return new pe(n.buffer)}getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=e.get(i.ino);if(!n)throw c.ENOENT(r);return bi(n)}addNewNode(e,i){let n;for(;0<5;)try{return n=Ot(),e.put(n,i,!1),n}catch{}throw new c(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,r,n,o=new Uint8Array){let a=this.store.beginTransaction("readwrite"),l=E(e),u=L(e),f=this.findINode(a,l),d=this.getDirListing(a,f,l);if(!f.toStats().hasAccess(2,n))throw c.EACCES(e);if(e==="/")throw c.EEXIST(e);if(d[u])throw c.EEXIST(e);let h=new pe;try{h.ino=this.addNewNode(a,o),h.size=o.length,h.mode=r|i,h.uid=n.uid,h.gid=n.gid,d[u]=this.addNewNode(a,h.data),a.put(f.ino,ae(d),!0)}catch(b){throw a.abort(),b}return a.commit(),h}removeEntry(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=this.findINode(n,o),l=this.getDirListing(n,a,o),u=L(e),f=l[u];if(!f)throw c.ENOENT(e);let d=this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{n.put(a.ino,ae(l),!0),--d.nlink<1&&(n.remove(d.ino),n.remove(f))}catch(h){throw n.abort(),h}n.commit()}};s(Mt,"SyncStoreFS");var vi=class{constructor(e="tmp"){this.name=e}store=new Map;clear(){this.store.clear()}beginTransaction(){return new Dt(this)}get(e){return this.store.get(e)}put(e,i,r){return!r&&this.store.has(e)?!1:(this.store.set(e,i),!0)}remove(e){this.store.delete(e)}};s(vi,"InMemoryStore");var un={name:"InMemory",isAvailable(){return!0},options:{name:{type:"string",description:"The name of the store"}},create({name:t}){return new Mt({store:new vi(t)})}};var Ut=class{_locks=new Map;lock(e){return new Promise(i=>{this._locks.has(e)?this._locks.get(e).push(i):this._locks.set(e,[])})}unlock(e){if(!this._locks.has(e))throw new Error("unlock of a non-locked mutex");let i=this._locks.get(e).shift();if(i){setTimeout(i,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};s(Ut,"Mutex");var Wt=class{constructor(e){this.fs=e}_mu=new Ut;async ready(){return await this.fs.ready(),this}metadata(){return{...this.fs.metadata(),name:"Locked<"+this.fs.metadata().name+">"}}async rename(e,i,r){await this._mu.lock(e),await this.fs.rename(e,i,r),this._mu.unlock(e)}renameSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.renameSync(e,i,r)}async stat(e,i){await this._mu.lock(e);let r=await this.fs.stat(e,i);return this._mu.unlock(e),r}statSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.statSync(e,i)}async openFile(e,i,r){await this._mu.lock(e);let n=await this.fs.openFile(e,i,r);return this._mu.unlock(e),n}openFileSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.openFileSync(e,i,r)}async createFile(e,i,r,n){await this._mu.lock(e);let o=await this.fs.createFile(e,i,r,n);return this._mu.unlock(e),o}createFileSync(e,i,r,n){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.createFileSync(e,i,r,n)}async unlink(e,i){await this._mu.lock(e),await this.fs.unlink(e,i),this._mu.unlock(e)}unlinkSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.unlinkSync(e,i)}async rmdir(e,i){await this._mu.lock(e),await this.fs.rmdir(e,i),this._mu.unlock(e)}rmdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.rmdirSync(e,i)}async mkdir(e,i,r){await this._mu.lock(e),await this.fs.mkdir(e,i,r),this._mu.unlock(e)}mkdirSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.mkdirSync(e,i,r)}async readdir(e,i){await this._mu.lock(e);let r=await this.fs.readdir(e,i);return this._mu.unlock(e),r}readdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.readdirSync(e,i)}async exists(e,i){await this._mu.lock(e);let r=await this.fs.exists(e,i);return this._mu.unlock(e),r}existsSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.existsSync(e,i)}async link(e,i,r){await this._mu.lock(e),await this.fs.link(e,i,r),this._mu.unlock(e)}linkSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.linkSync(e,i,r)}async sync(e,i,r){await this._mu.lock(e),await this.fs.sync(e,i,r),this._mu.unlock(e)}syncSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.syncSync(e,i,r)}};s(Wt,"LockedFS");var fn="/.deleted",qt=class extends oe{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this.buffer,this.stats),this.resetDirty())}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this.buffer,this.stats),this.resetDirty())}async close(){await this.sync()}closeSync(){this.syncSync()}};s(qt,"OverlayFile");var Ai=class extends X{async ready(){return await this._readable.ready(),await this._writable.ready(),await this._ready,this}_writable;_readable;_isInitialized=!1;_deletedFiles=new Set;_deleteLog="";_deleteLogUpdatePending=!1;_deleteLogUpdateNeeded=!1;_deleteLogError;_ready;constructor({writable:e,readable:i}){if(super(),this._writable=e,this._readable=i,this._writable.metadata().readonly)throw new c(22,"Writable file system must be writable.");this._ready=this._initialize()}metadata(){return{...super.metadata(),name:jt.name,synchronous:this._readable.metadata().synchronous&&this._writable.metadata().synchronous,supportsProperties:this._readable.metadata().supportsProperties&&this._writable.metadata().supportsProperties}}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}async sync(e,i,r){let n=r.getCred(0,0);await this.createParentDirectories(e,n),await this._writable.sync(e,i,r)}syncSync(e,i,r){let n=r.getCred(0,0);this.createParentDirectoriesSync(e,n),this._writable.syncSync(e,i,r)}async _initialize(){if(!this._isInitialized){try{let e=await this._writable.openFile(fn,I.Get("r"),z.Root),{size:i}=await e.stat(),{buffer:r}=await e.read(new Uint8Array(i));this._deleteLog=Z(r)}catch(e){if(e.errno!==2)throw e}this._isInitialized=!0,this._reparseDeletionLog()}}getDeletionLog(){return this._deleteLog}restoreDeletionLog(e,i){this._deleteLog=e,this._reparseDeletionLog(),this.updateLog("",i)}async rename(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{await this._writable.rename(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}renameSync(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{this._writable.renameSync(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}async stat(e,i){this.checkInitialized();try{return this._writable.stat(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=new M(await this._readable.stat(e,i));return n.mode|=146,n}}statSync(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=new M(this._readable.statSync(e,i));return n.mode|=146,n}}async openFile(e,i,r){if(await this._writable.exists(e,r))return this._writable.openFile(e,i,r);let n=await this._readable.openFile(e,I.Get("r"),r),o=new M(await n.stat()),{buffer:a}=await n.read(new Uint8Array(o.size));return new qt(this,e,i,o,a)}openFileSync(e,i,r){if(this._writable.existsSync(e,r))return this._writable.openFileSync(e,i,r);let n=this._readable.openFileSync(e,I.Get("r"),r),o=M.clone(n.statSync()),a=new Uint8Array(o.size);return n.readSync(a),new qt(this,e,i,o,a)}async createFile(e,i,r,n){return this.checkInitialized(),await this._writable.createFile(e,i,r,n),this.openFile(e,i,n)}createFileSync(e,i,r,n){return this.checkInitialized(),this._writable.createFileSync(e,i,r,n),this.openFileSync(e,i,n)}async link(e,i,r){this.checkInitialized(),await this._writable.link(e,i,r)}linkSync(e,i,r){this.checkInitialized(),this._writable.linkSync(e,i,r)}async unlink(e,i){if(this.checkInitialized(),this.checkPath(e),!await this.exists(e,i))throw c.ENOENT(e);await this._writable.exists(e,i)&&await this._writable.unlink(e,i),await this.exists(e,i)&&this.deletePath(e,i)}unlinkSync(e,i){if(this.checkInitialized(),this.checkPath(e),!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)&&this._writable.unlinkSync(e,i),this.existsSync(e,i)&&this.deletePath(e,i)}async rmdir(e,i){if(this.checkInitialized(),!await this.exists(e,i))throw c.ENOENT(e);if(await this._writable.exists(e,i)&&await this._writable.rmdir(e,i),await this.exists(e,i)){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}rmdirSync(e,i){if(this.checkInitialized(),!this.existsSync(e,i))throw c.ENOENT(e);if(this._writable.existsSync(e,i)&&this._writable.rmdirSync(e,i),this.existsSync(e,i)){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}async mkdir(e,i,r){if(this.checkInitialized(),await this.exists(e,r))throw c.EEXIST(e);await this.createParentDirectories(e,r),await this._writable.mkdir(e,i,r)}mkdirSync(e,i,r){if(this.checkInitialized(),this.existsSync(e,r))throw c.EEXIST(e);this.createParentDirectoriesSync(e,r),this._writable.mkdirSync(e,i,r)}async readdir(e,i){if(this.checkInitialized(),!(await this.stat(e,i)).isDirectory())throw c.ENOTDIR(e);let n=[];try{n.push(...await this._writable.readdir(e,i))}catch{}try{n.push(...(await this._readable.readdir(e,i)).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}readdirSync(e,i){if(this.checkInitialized(),!this.statSync(e,i).isDirectory())throw c.ENOTDIR(e);let n=[];try{n=n.concat(this._writable.readdirSync(e,i))}catch{}try{n=n.concat(this._readable.readdirSync(e,i).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}deletePath(e,i){this._deletedFiles.add(e),this.updateLog(`d${e}
|
|
1
|
+
var ZenFS=(()=>{var Kc=Object.create;var It=Object.defineProperty;var Yc=Object.getOwnPropertyDescriptor;var Xc=Object.getOwnPropertyNames;var Jc=Object.getPrototypeOf,Qc=Object.prototype.hasOwnProperty;var Zc=(t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var s=(t,e)=>It(t,"name",{value:e,configurable:!0});var N=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xi=(t,e)=>{for(var i in e)It(t,i,{get:e[i],enumerable:!0})},os=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Xc(e))!Qc.call(t,n)&&n!==i&&It(t,n,{get:()=>e[n],enumerable:!(r=Yc(e,n))||r.enumerable});return t};var eu=(t,e,i)=>(i=t!=null?Kc(Jc(t)):{},os(e||!t||!t.__esModule?It(i,"default",{value:t,enumerable:!0}):i,t)),tu=t=>os(It({},"__esModule",{value:!0}),t);var mi=(t,e,i)=>(Zc(t,typeof e!="symbol"?e+"":e,i),i);var ws=N(dr=>{"use strict";dr.byteLength=Cd;dr.toByteArray=Rd;dr.fromByteArray=Dd;var Pe=[],be=[],Pd=typeof Uint8Array<"u"?Uint8Array:Array,Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pt=0,bs=Mn.length;pt<bs;++pt)Pe[pt]=Mn[pt],be[Mn.charCodeAt(pt)]=pt;var pt,bs;be["-".charCodeAt(0)]=62;be["_".charCodeAt(0)]=63;function gs(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var r=i===e?0:4-i%4;return[i,r]}s(gs,"getLens");function Cd(t){var e=gs(t),i=e[0],r=e[1];return(i+r)*3/4-r}s(Cd,"byteLength");function Ld(t,e,i){return(e+i)*3/4-i}s(Ld,"_byteLength");function Rd(t){var e,i=gs(t),r=i[0],n=i[1],o=new Pd(Ld(t,r,n)),a=0,l=n>0?r-4:r,u;for(u=0;u<l;u+=4)e=be[t.charCodeAt(u)]<<18|be[t.charCodeAt(u+1)]<<12|be[t.charCodeAt(u+2)]<<6|be[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=be[t.charCodeAt(u)]<<2|be[t.charCodeAt(u+1)]>>4,o[a++]=e&255),n===1&&(e=be[t.charCodeAt(u)]<<10|be[t.charCodeAt(u+1)]<<4|be[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}s(Rd,"toByteArray");function Od(t){return Pe[t>>18&63]+Pe[t>>12&63]+Pe[t>>6&63]+Pe[t&63]}s(Od,"tripletToBase64");function Bd(t,e,i){for(var r,n=[],o=e;o<i;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Od(r));return n.join("")}s(Bd,"encodeChunk");function Dd(t){for(var e,i=t.length,r=i%3,n=[],o=16383,a=0,l=i-r;a<l;a+=o)n.push(Bd(t,a,a+o>l?l:a+o));return r===1?(e=t[i-1],n.push(Pe[e>>2]+Pe[e<<4&63]+"==")):r===2&&(e=(t[i-2]<<8)+t[i-1],n.push(Pe[e>>10]+Pe[e>>4&63]+Pe[e<<2&63]+"=")),n.join("")}s(Dd,"fromByteArray")});var Ss=N(Un=>{Un.read=function(t,e,i,r,n){var o,a,l=n*8-r-1,u=(1<<l)-1,f=u>>1,d=-7,h=i?n-1:0,b=i?-1:1,m=t[e+h];for(h+=b,o=m&(1<<-d)-1,m>>=-d,d+=l;d>0;o=o*256+t[e+h],h+=b,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=a*256+t[e+h],h+=b,d-=8);if(o===0)o=1-f;else{if(o===u)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,r),o=o-f}return(m?-1:1)*a*Math.pow(2,o-r)};Un.write=function(t,e,i,r,n,o){var a,l,u,f=o*8-n-1,d=(1<<f)-1,h=d>>1,b=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:o-1,g=r?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=d):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=b/u:e+=b*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=d?(l=0,a=d):a+h>=1?(l=(e*u-1)*Math.pow(2,n),a=a+h):(l=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;t[i+m]=l&255,m+=g,l/=256,n-=8);for(a=a<<n|l,f+=n;f>0;t[i+m]=a&255,m+=g,a/=256,f-=8);t[i+m-g]|=y*128}});var $e=N(Qt=>{"use strict";var Wn=ws(),Xt=Ss(),_s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qt.Buffer=p;Qt.SlowBuffer=$d;Qt.INSPECT_MAX_BYTES=50;var hr=2147483647;Qt.kMaxLength=hr;p.TYPED_ARRAY_SUPPORT=Md();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Md(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}s(Md,"typedArraySupport");Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function je(t){if(t>hr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}s(je,"createBuffer");function p(t,e,i){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return zn(t)}return As(t,e,i)}s(p,"Buffer");p.poolSize=8192;function As(t,e,i){if(typeof t=="string")return Wd(t,e);if(ArrayBuffer.isView(t))return qd(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ce(t,ArrayBuffer)||t&&Ce(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ce(t,SharedArrayBuffer)||t&&Ce(t.buffer,SharedArrayBuffer)))return jn(t,e,i);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return p.from(r,e,i);let n=jd(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s(As,"from");p.from=function(t,e,i){return As(t,e,i)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function ks(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}s(ks,"assertSize");function Ud(t,e,i){return ks(t),t<=0?je(t):e!==void 0?typeof i=="string"?je(t).fill(e,i):je(t).fill(e):je(t)}s(Ud,"alloc");p.alloc=function(t,e,i){return Ud(t,e,i)};function zn(t){return ks(t),je(t<0?0:Vn(t)|0)}s(zn,"allocUnsafe");p.allocUnsafe=function(t){return zn(t)};p.allocUnsafeSlow=function(t){return zn(t)};function Wd(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let i=Ns(t,e)|0,r=je(i),n=r.write(t,e);return n!==i&&(r=r.slice(0,n)),r}s(Wd,"fromString");function qn(t){let e=t.length<0?0:Vn(t.length)|0,i=je(e);for(let r=0;r<e;r+=1)i[r]=t[r]&255;return i}s(qn,"fromArrayLike");function qd(t){if(Ce(t,Uint8Array)){let e=new Uint8Array(t);return jn(e.buffer,e.byteOffset,e.byteLength)}return qn(t)}s(qd,"fromArrayView");function jn(t,e,i){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(i||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&i===void 0?r=new Uint8Array(t):i===void 0?r=new Uint8Array(t,e):r=new Uint8Array(t,e,i),Object.setPrototypeOf(r,p.prototype),r}s(jn,"fromArrayBuffer");function jd(t){if(p.isBuffer(t)){let e=Vn(t.length)|0,i=je(e);return i.length===0||t.copy(i,0,0,e),i}if(t.length!==void 0)return typeof t.length!="number"||Hn(t.length)?je(0):qn(t);if(t.type==="Buffer"&&Array.isArray(t.data))return qn(t.data)}s(jd,"fromObject");function Vn(t){if(t>=hr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr.toString(16)+" bytes");return t|0}s(Vn,"checked");function $d(t){return+t!=t&&(t=0),p.alloc(+t)}s($d,"SlowBuffer");p.isBuffer=s(function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype},"isBuffer");p.compare=s(function(e,i){if(Ce(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),Ce(i,Uint8Array)&&(i=p.from(i,i.offset,i.byteLength)),!p.isBuffer(e)||!p.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;let r=e.length,n=i.length;for(let o=0,a=Math.min(r,n);o<a;++o)if(e[o]!==i[o]){r=e[o],n=i[o];break}return r<n?-1:n<r?1:0},"compare");p.isEncoding=s(function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");p.concat=s(function(e,i){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let r;if(i===void 0)for(i=0,r=0;r<e.length;++r)i+=e[r].length;let n=p.allocUnsafe(i),o=0;for(r=0;r<e.length;++r){let a=e[r];if(Ce(a,Uint8Array))o+a.length>n.length?(p.isBuffer(a)||(a=p.from(a)),a.copy(n,o)):Uint8Array.prototype.set.call(n,a,o);else if(p.isBuffer(a))a.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return n},"concat");function Ns(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ce(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let i=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&i===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return $n(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Bs(t).length;default:if(n)return r?-1:$n(t).length;e=(""+e).toLowerCase(),n=!0}}s(Ns,"byteLength");p.byteLength=Ns;function zd(t,e,i){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,e>>>=0,i<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return eh(this,e,i);case"utf8":case"utf-8":return Fs(this,e,i);case"ascii":return Qd(this,e,i);case"latin1":case"binary":return Zd(this,e,i);case"base64":return Xd(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return th(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}s(zd,"slowToString");p.prototype._isBuffer=!0;function yt(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}s(yt,"swap");p.prototype.swap16=s(function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<e;i+=2)yt(this,i,i+1);return this},"swap16");p.prototype.swap32=s(function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<e;i+=4)yt(this,i,i+3),yt(this,i+1,i+2);return this},"swap32");p.prototype.swap64=s(function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<e;i+=8)yt(this,i,i+7),yt(this,i+1,i+6),yt(this,i+2,i+5),yt(this,i+3,i+4);return this},"swap64");p.prototype.toString=s(function(){let e=this.length;return e===0?"":arguments.length===0?Fs(this,0,e):zd.apply(this,arguments)},"toString");p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=s(function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0},"equals");p.prototype.inspect=s(function(){let e="",i=Qt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(e+=" ... "),"<Buffer "+e+">"},"inspect");_s&&(p.prototype[_s]=p.prototype.inspect);p.prototype.compare=s(function(e,i,r,n,o){if(Ce(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(i===void 0&&(i=0),r===void 0&&(r=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),i<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&i>=r)return 0;if(n>=o)return-1;if(i>=r)return 1;if(i>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;let a=o-n,l=r-i,u=Math.min(a,l),f=this.slice(n,o),d=e.slice(i,r);for(let h=0;h<u;++h)if(f[h]!==d[h]){a=f[h],l=d[h];break}return a<l?-1:l<a?1:0},"compare");function Ts(t,e,i,r,n){if(t.length===0)return-1;if(typeof i=="string"?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,Hn(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0)if(n)i=0;else return-1;if(typeof e=="string"&&(e=p.from(e,r)),p.isBuffer(e))return e.length===0?-1:Es(t,e,i,r,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):Es(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}s(Ts,"bidirectionalIndexOf");function Es(t,e,i,r,n){let o=1,a=t.length,l=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,i/=2}function u(d,h){return o===1?d[h]:d.readUInt16BE(h*o)}s(u,"read");let f;if(n){let d=-1;for(f=i;f<a;f++)if(u(t,f)===u(e,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===l)return d*o}else d!==-1&&(f-=f-d),d=-1}else for(i+l>a&&(i=a-l),f=i;f>=0;f--){let d=!0;for(let h=0;h<l;h++)if(u(t,f+h)!==u(e,h)){d=!1;break}if(d)return f}return-1}s(Es,"arrayIndexOf");p.prototype.includes=s(function(e,i,r){return this.indexOf(e,i,r)!==-1},"includes");p.prototype.indexOf=s(function(e,i,r){return Ts(this,e,i,r,!0)},"indexOf");p.prototype.lastIndexOf=s(function(e,i,r){return Ts(this,e,i,r,!1)},"lastIndexOf");function Vd(t,e,i,r){i=Number(i)||0;let n=t.length-i;r?(r=Number(r),r>n&&(r=n)):r=n;let o=e.length;r>o/2&&(r=o/2);let a;for(a=0;a<r;++a){let l=parseInt(e.substr(a*2,2),16);if(Hn(l))return a;t[i+a]=l}return a}s(Vd,"hexWrite");function Gd(t,e,i,r){return pr($n(e,t.length-i),t,i,r)}s(Gd,"utf8Write");function Hd(t,e,i,r){return pr(oh(e),t,i,r)}s(Hd,"asciiWrite");function Kd(t,e,i,r){return pr(Bs(e),t,i,r)}s(Kd,"base64Write");function Yd(t,e,i,r){return pr(sh(e,t.length-i),t,i,r)}s(Yd,"ucs2Write");p.prototype.write=s(function(e,i,r,n){if(i===void 0)n="utf8",r=this.length,i=0;else if(r===void 0&&typeof i=="string")n=i,r=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(r)?(r=r>>>0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-i;if((r===void 0||r>o)&&(r=o),e.length>0&&(r<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return Vd(this,e,i,r);case"utf8":case"utf-8":return Gd(this,e,i,r);case"ascii":case"latin1":case"binary":return Hd(this,e,i,r);case"base64":return Kd(this,e,i,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yd(this,e,i,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},"write");p.prototype.toJSON=s(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function Xd(t,e,i){return e===0&&i===t.length?Wn.fromByteArray(t):Wn.fromByteArray(t.slice(e,i))}s(Xd,"base64Slice");function Fs(t,e,i){i=Math.min(t.length,i);let r=[],n=e;for(;n<i;){let o=t[n],a=null,l=o>239?4:o>223?3:o>191?2:1;if(n+l<=i){let u,f,d,h;switch(l){case 1:o<128&&(a=o);break;case 2:u=t[n+1],(u&192)===128&&(h=(o&31)<<6|u&63,h>127&&(a=h));break;case 3:u=t[n+1],f=t[n+2],(u&192)===128&&(f&192)===128&&(h=(o&15)<<12|(u&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:u=t[n+1],f=t[n+2],d=t[n+3],(u&192)===128&&(f&192)===128&&(d&192)===128&&(h=(o&15)<<18|(u&63)<<12|(f&63)<<6|d&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),n+=l}return Jd(r)}s(Fs,"utf8Slice");var xs=4096;function Jd(t){let e=t.length;if(e<=xs)return String.fromCharCode.apply(String,t);let i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=xs));return i}s(Jd,"decodeCodePointsArray");function Qd(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]&127);return r}s(Qd,"asciiSlice");function Zd(t,e,i){let r="";i=Math.min(t.length,i);for(let n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}s(Zd,"latin1Slice");function eh(t,e,i){let r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);let n="";for(let o=e;o<i;++o)n+=ah[t[o]];return n}s(eh,"hexSlice");function th(t,e,i){let r=t.slice(e,i),n="";for(let o=0;o<r.length-1;o+=2)n+=String.fromCharCode(r[o]+r[o+1]*256);return n}s(th,"utf16leSlice");p.prototype.slice=s(function(e,i){let r=this.length;e=~~e,i=i===void 0?r:~~i,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),i<0?(i+=r,i<0&&(i=0)):i>r&&(i=r),i<e&&(i=e);let n=this.subarray(e,i);return Object.setPrototypeOf(n,p.prototype),n},"slice");function K(t,e,i){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}s(K,"checkOffset");p.prototype.readUintLE=p.prototype.readUIntLE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e],o=1,a=0;for(;++a<i&&(o*=256);)n+=this[e+a]*o;return n},"readUIntLE");p.prototype.readUintBE=p.prototype.readUIntBE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e+--i],o=1;for(;i>0&&(o*=256);)n+=this[e+--i]*o;return n},"readUIntBE");p.prototype.readUint8=p.prototype.readUInt8=s(function(e,i){return e=e>>>0,i||K(e,1,this.length),this[e]},"readUInt8");p.prototype.readUint16LE=p.prototype.readUInt16LE=s(function(e,i){return e=e>>>0,i||K(e,2,this.length),this[e]|this[e+1]<<8},"readUInt16LE");p.prototype.readUint16BE=p.prototype.readUInt16BE=s(function(e,i){return e=e>>>0,i||K(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");p.prototype.readUint32LE=p.prototype.readUInt32LE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE");p.prototype.readUint32BE=p.prototype.readUInt32BE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"readUInt32BE");p.prototype.readBigUInt64LE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Ri(e,this.length-8);let n=i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))},"readBigUInt64LE"));p.prototype.readBigUInt64BE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Ri(e,this.length-8);let n=i*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(n)<<BigInt(32))+BigInt(o)},"readBigUInt64BE"));p.prototype.readIntLE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=this[e],o=1,a=0;for(;++a<i&&(o*=256);)n+=this[e+a]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*i)),n},"readIntLE");p.prototype.readIntBE=s(function(e,i,r){e=e>>>0,i=i>>>0,r||K(e,i,this.length);let n=i,o=1,a=this[e+--n];for(;n>0&&(o*=256);)a+=this[e+--n]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*i)),a},"readIntBE");p.prototype.readInt8=s(function(e,i){return e=e>>>0,i||K(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");p.prototype.readInt16LE=s(function(e,i){e=e>>>0,i||K(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r},"readInt16LE");p.prototype.readInt16BE=s(function(e,i){e=e>>>0,i||K(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r},"readInt16BE");p.prototype.readInt32LE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");p.prototype.readInt32BE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");p.prototype.readBigInt64LE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Ri(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)},"readBigInt64LE"));p.prototype.readBigInt64BE=nt(s(function(e){e=e>>>0,Jt(e,"offset");let i=this[e],r=this[e+7];(i===void 0||r===void 0)&&Ri(e,this.length-8);let n=(i<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r)},"readBigInt64BE"));p.prototype.readFloatLE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),Xt.read(this,e,!0,23,4)},"readFloatLE");p.prototype.readFloatBE=s(function(e,i){return e=e>>>0,i||K(e,4,this.length),Xt.read(this,e,!1,23,4)},"readFloatBE");p.prototype.readDoubleLE=s(function(e,i){return e=e>>>0,i||K(e,8,this.length),Xt.read(this,e,!0,52,8)},"readDoubleLE");p.prototype.readDoubleBE=s(function(e,i){return e=e>>>0,i||K(e,8,this.length),Xt.read(this,e,!1,52,8)},"readDoubleBE");function ae(t,e,i,r,n,o){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}s(ae,"checkInt");p.prototype.writeUintLE=p.prototype.writeUIntLE=s(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;ae(this,e,i,r,l,0)}let o=1,a=0;for(this[i]=e&255;++a<r&&(o*=256);)this[i+a]=e/o&255;return i+r},"writeUIntLE");p.prototype.writeUintBE=p.prototype.writeUIntBE=s(function(e,i,r,n){if(e=+e,i=i>>>0,r=r>>>0,!n){let l=Math.pow(2,8*r)-1;ae(this,e,i,r,l,0)}let o=r-1,a=1;for(this[i+o]=e&255;--o>=0&&(a*=256);)this[i+o]=e/a&255;return i+r},"writeUIntBE");p.prototype.writeUint8=p.prototype.writeUInt8=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,1,255,0),this[i]=e&255,i+1},"writeUInt8");p.prototype.writeUint16LE=p.prototype.writeUInt16LE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,2,65535,0),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeUInt16LE");p.prototype.writeUint16BE=p.prototype.writeUInt16BE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,2,65535,0),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeUInt16BE");p.prototype.writeUint32LE=p.prototype.writeUInt32LE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,4,4294967295,0),this[i+3]=e>>>24,this[i+2]=e>>>16,this[i+1]=e>>>8,this[i]=e&255,i+4},"writeUInt32LE");p.prototype.writeUint32BE=p.prototype.writeUInt32BE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,4,4294967295,0),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeUInt32BE");function Is(t,e,i,r,n){Os(e,r,n,t,i,7);let o=Number(e&BigInt(4294967295));t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,a=a>>8,t[i++]=a,i}s(Is,"wrtBigUInt64LE");function Ps(t,e,i,r,n){Os(e,r,n,t,i,7);let o=Number(e&BigInt(4294967295));t[i+7]=o,o=o>>8,t[i+6]=o,o=o>>8,t[i+5]=o,o=o>>8,t[i+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=a,a=a>>8,t[i+2]=a,a=a>>8,t[i+1]=a,a=a>>8,t[i]=a,i+8}s(Ps,"wrtBigUInt64BE");p.prototype.writeBigUInt64LE=nt(s(function(e,i=0){return Is(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));p.prototype.writeBigUInt64BE=nt(s(function(e,i=0){return Ps(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));p.prototype.writeIntLE=s(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let u=Math.pow(2,8*r-1);ae(this,e,i,r,u-1,-u)}let o=0,a=1,l=0;for(this[i]=e&255;++o<r&&(a*=256);)e<0&&l===0&&this[i+o-1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+r},"writeIntLE");p.prototype.writeIntBE=s(function(e,i,r,n){if(e=+e,i=i>>>0,!n){let u=Math.pow(2,8*r-1);ae(this,e,i,r,u-1,-u)}let o=r-1,a=1,l=0;for(this[i+o]=e&255;--o>=0&&(a*=256);)e<0&&l===0&&this[i+o+1]!==0&&(l=1),this[i+o]=(e/a>>0)-l&255;return i+r},"writeIntBE");p.prototype.writeInt8=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,1,127,-128),e<0&&(e=255+e+1),this[i]=e&255,i+1},"writeInt8");p.prototype.writeInt16LE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,2,32767,-32768),this[i]=e&255,this[i+1]=e>>>8,i+2},"writeInt16LE");p.prototype.writeInt16BE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,2,32767,-32768),this[i]=e>>>8,this[i+1]=e&255,i+2},"writeInt16BE");p.prototype.writeInt32LE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,4,2147483647,-2147483648),this[i]=e&255,this[i+1]=e>>>8,this[i+2]=e>>>16,this[i+3]=e>>>24,i+4},"writeInt32LE");p.prototype.writeInt32BE=s(function(e,i,r){return e=+e,i=i>>>0,r||ae(this,e,i,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4},"writeInt32BE");p.prototype.writeBigInt64LE=nt(s(function(e,i=0){return Is(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));p.prototype.writeBigInt64BE=nt(s(function(e,i=0){return Ps(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Cs(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}s(Cs,"checkIEEE754");function Ls(t,e,i,r,n){return e=+e,i=i>>>0,n||Cs(t,e,i,4,34028234663852886e22,-34028234663852886e22),Xt.write(t,e,i,r,23,4),i+4}s(Ls,"writeFloat");p.prototype.writeFloatLE=s(function(e,i,r){return Ls(this,e,i,!0,r)},"writeFloatLE");p.prototype.writeFloatBE=s(function(e,i,r){return Ls(this,e,i,!1,r)},"writeFloatBE");function Rs(t,e,i,r,n){return e=+e,i=i>>>0,n||Cs(t,e,i,8,17976931348623157e292,-17976931348623157e292),Xt.write(t,e,i,r,52,8),i+8}s(Rs,"writeDouble");p.prototype.writeDoubleLE=s(function(e,i,r){return Rs(this,e,i,!0,r)},"writeDoubleLE");p.prototype.writeDoubleBE=s(function(e,i,r){return Rs(this,e,i,!1,r)},"writeDoubleBE");p.prototype.copy=s(function(e,i,r,n){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&n!==0&&(n=this.length),i>=e.length&&(i=e.length),i||(i=0),n>0&&n<r&&(n=r),n===r||e.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-i<n-r&&(n=e.length-i+r);let o=n-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),i),o},"copy");p.prototype.fill=s(function(e,i,r,n){if(typeof e=="string"){if(typeof i=="string"?(n=i,i=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!p.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let a=e.charCodeAt(0);(n==="utf8"&&a<128||n==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(i<0||this.length<i||this.length<r)throw new RangeError("Out of range index");if(r<=i)return this;i=i>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let o;if(typeof e=="number")for(o=i;o<r;++o)this[o]=e;else{let a=p.isBuffer(e)?e:p.from(e,n),l=a.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-i;++o)this[o+i]=a[o%l]}return this},"fill");var Yt={};function Gn(t,e,i){Yt[t]=s(class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}},"NodeError")}s(Gn,"E");Gn("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Gn("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Gn("ERR_OUT_OF_RANGE",function(t,e,i){let r=`The value of "${t}" is out of range.`,n=i;return Number.isInteger(i)&&Math.abs(i)>2**32?n=vs(String(i)):typeof i=="bigint"&&(n=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(n=vs(n)),n+="n"),r+=` It must be ${e}. Received ${n}`,r},RangeError);function vs(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(vs,"addNumericalSeparator");function ih(t,e,i){Jt(e,"offset"),(t[e]===void 0||t[e+i]===void 0)&&Ri(e,t.length-(i+1))}s(ih,"checkBounds");function Os(t,e,i,r,n,o){if(t>i||t<e){let a=typeof e=="bigint"?"n":"",l;throw o>3?e===0||e===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:l=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:l=`>= ${e}${a} and <= ${i}${a}`,new Yt.ERR_OUT_OF_RANGE("value",l,t)}ih(r,n,o)}s(Os,"checkIntBI");function Jt(t,e){if(typeof t!="number")throw new Yt.ERR_INVALID_ARG_TYPE(e,"number",t)}s(Jt,"validateNumber");function Ri(t,e,i){throw Math.floor(t)!==t?(Jt(t,i),new Yt.ERR_OUT_OF_RANGE(i||"offset","an integer",t)):e<0?new Yt.ERR_BUFFER_OUT_OF_BOUNDS:new Yt.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}s(Ri,"boundsError");var rh=/[^+/0-9A-Za-z-_]/g;function nh(t){if(t=t.split("=")[0],t=t.trim().replace(rh,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}s(nh,"base64clean");function $n(t,e){e=e||1/0;let i,r=t.length,n=null,o=[];for(let a=0;a<r;++a){if(i=t.charCodeAt(a),i>55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=(n-55296<<10|i-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,i&63|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return o}s($n,"utf8ToBytes");function oh(t){let e=[];for(let i=0;i<t.length;++i)e.push(t.charCodeAt(i)&255);return e}s(oh,"asciiToBytes");function sh(t,e){let i,r,n,o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)i=t.charCodeAt(a),r=i>>8,n=i%256,o.push(n),o.push(r);return o}s(sh,"utf16leToBytes");function Bs(t){return Wn.toByteArray(nh(t))}s(Bs,"base64ToBytes");function pr(t,e,i,r){let n;for(n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}s(pr,"blitBuffer");function Ce(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}s(Ce,"isInstance");function Hn(t){return t!==t}s(Hn,"numberIsNaN");var ah=function(){let t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){let r=i*16;for(let n=0;n<16;++n)e[r+n]=t[i]+t[n]}return e}();function nt(t){return typeof BigInt>"u"?lh:t}s(nt,"defineBigIntMethod");function lh(){throw new Error("BigInt not supported")}s(lh,"BufferBigIntNotDefined")});var O=N((u_,Ds)=>{"use strict";Ds.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,i){return t.slice(e,i)},Error,FunctionPrototypeCall(t,e,...i){return t.call(e,...i)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,i){return Object.defineProperty(t,e,i)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,i){return t.then(e,i)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,i){return t.slice(e,i)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,i){return t.set(e,i)},Boolean,Uint8Array}});var Zt=N((f_,yr)=>{"use strict";var{AbortController:Ms,AbortSignal:ch}=typeof self<"u"?self:typeof window<"u"?window:void 0;yr.exports=Ms;yr.exports.AbortSignal=ch;yr.exports.default=Ms});var Oi=N((d_,Kn)=>{"use strict";var ei=typeof Reflect=="object"?Reflect:null,Us=ei&&typeof ei.apply=="function"?ei.apply:s(function(e,i,r){return Function.prototype.apply.call(e,i,r)},"ReflectApply"),mr;ei&&typeof ei.ownKeys=="function"?mr=ei.ownKeys:Object.getOwnPropertySymbols?mr=s(function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):mr=s(function(e){return Object.getOwnPropertyNames(e)},"ReflectOwnKeys");function uh(t){console&&console.warn&&console.warn(t)}s(uh,"ProcessEmitWarning");var qs=Number.isNaN||s(function(e){return e!==e},"NumberIsNaN");function P(){P.init.call(this)}s(P,"EventEmitter");Kn.exports=P;Kn.exports.once=ph;P.EventEmitter=P;P.prototype._events=void 0;P.prototype._eventsCount=0;P.prototype._maxListeners=void 0;var Ws=10;function br(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}s(br,"checkListener");Object.defineProperty(P,"defaultMaxListeners",{enumerable:!0,get:function(){return Ws},set:function(t){if(typeof t!="number"||t<0||qs(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ws=t}});P.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};P.prototype.setMaxListeners=s(function(e){if(typeof e!="number"||e<0||qs(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},"setMaxListeners");function js(t){return t._maxListeners===void 0?P.defaultMaxListeners:t._maxListeners}s(js,"_getMaxListeners");P.prototype.getMaxListeners=s(function(){return js(this)},"getMaxListeners");P.prototype.emit=s(function(e){for(var i=[],r=1;r<arguments.length;r++)i.push(arguments[r]);var n=e==="error",o=this._events;if(o!==void 0)n=n&&o.error===void 0;else if(!n)return!1;if(n){var a;if(i.length>0&&(a=i[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var u=o[e];if(u===void 0)return!1;if(typeof u=="function")Us(u,this,i);else for(var f=u.length,d=Hs(u,f),r=0;r<f;++r)Us(d[r],this,i);return!0},"emit");function $s(t,e,i,r){var n,o,a;if(br(i),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),a=o[e]),a===void 0)a=o[e]=i,++t._eventsCount;else if(typeof a=="function"?a=o[e]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),n=js(t),n>0&&a.length>n&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,uh(l)}return t}s($s,"_addListener");P.prototype.addListener=s(function(e,i){return $s(this,e,i,!1)},"addListener");P.prototype.on=P.prototype.addListener;P.prototype.prependListener=s(function(e,i){return $s(this,e,i,!0)},"prependListener");function fh(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}s(fh,"onceWrapper");function zs(t,e,i){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},n=fh.bind(r);return n.listener=i,r.wrapFn=n,n}s(zs,"_onceWrap");P.prototype.once=s(function(e,i){return br(i),this.on(e,zs(this,e,i)),this},"once");P.prototype.prependOnceListener=s(function(e,i){return br(i),this.prependListener(e,zs(this,e,i)),this},"prependOnceListener");P.prototype.removeListener=s(function(e,i){var r,n,o,a,l;if(br(i),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===i||r.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||i));else if(typeof r!="function"){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===i||r[a].listener===i){l=r[a].listener,o=a;break}if(o<0)return this;o===0?r.shift():dh(r,o),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,l||i)}return this},"removeListener");P.prototype.off=P.prototype.removeListener;P.prototype.removeAllListeners=s(function(e){var i,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),a;for(n=0;n<o.length;++n)a=o[n],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=r[e],typeof i=="function")this.removeListener(e,i);else if(i!==void 0)for(n=i.length-1;n>=0;n--)this.removeListener(e,i[n]);return this},"removeAllListeners");function Vs(t,e,i){var r=t._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?i?[n.listener||n]:[n]:i?hh(n):Hs(n,n.length)}s(Vs,"_listeners");P.prototype.listeners=s(function(e){return Vs(this,e,!0)},"listeners");P.prototype.rawListeners=s(function(e){return Vs(this,e,!1)},"rawListeners");P.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gs.call(t,e)};P.prototype.listenerCount=Gs;function Gs(t){var e=this._events;if(e!==void 0){var i=e[t];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}s(Gs,"listenerCount");P.prototype.eventNames=s(function(){return this._eventsCount>0?mr(this._events):[]},"eventNames");function Hs(t,e){for(var i=new Array(e),r=0;r<e;++r)i[r]=t[r];return i}s(Hs,"arrayClone");function dh(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}s(dh,"spliceOne");function hh(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}s(hh,"unwrapListeners");function ph(t,e){return new Promise(function(i,r){function n(a){t.removeListener(e,o),r(a)}s(n,"errorListener");function o(){typeof t.removeListener=="function"&&t.removeListener("error",n),i([].slice.call(arguments))}s(o,"resolver"),Ks(t,e,o,{once:!0}),e!=="error"&&yh(t,n,{once:!0})})}s(ph,"once");function yh(t,e,i){typeof t.on=="function"&&Ks(t,"error",e,i)}s(yh,"addErrorHandlerIfEventEmitter");function Ks(t,e,i,r){if(typeof t.on=="function")r.once?t.once(e,i):t.on(e,i);else if(typeof t.addEventListener=="function")t.addEventListener(e,s(function n(o){r.once&&t.removeEventListener(e,n),i(o)},"wrapListener"));else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}s(Ks,"eventTargetAgnosticAddListener")});var ee=N((p_,Yn)=>{"use strict";var mh=$e(),{kResistStopPropagation:bh,SymbolDispose:gh}=O(),wh=globalThis.AbortSignal||Zt().AbortSignal,Sh=globalThis.AbortController||Zt().AbortController,_h=Object.getPrototypeOf(async function(){}).constructor,Ys=globalThis.Blob||mh.Blob,Eh=s(typeof Ys<"u"?function(e){return e instanceof Ys}:function(e){return!1},"isBlob"),Xs=s((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},"validateAbortSignal"),xh=s((t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},"validateFunction"),gr=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let i="";for(let r=0;r<e.length;r++)i+=` ${e[r].stack}
|
|
2
|
+
`;super(i),this.name="AggregateError",this.errors=e}};s(gr,"AggregateError");Yn.exports={AggregateError:gr,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...i){e||(e=!0,t.apply(this,i))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,i)=>{t((r,...n)=>r?i(r):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[i,r]){let n=e.shift();return r==="f"?n.toFixed(6):r==="j"?JSON.stringify(n):r==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof _h},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Eh,deprecate(t,e){return t},addAbortListener:Oi().addAbortListener||s(function(e,i){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Xs(e,"signal"),xh(i,"listener");let r;return e.aborted?queueMicrotask(()=>i()):(e.addEventListener("abort",i,{__proto__:null,once:!0,[bh]:!0}),r=s(()=>{e.removeEventListener("abort",i)},"removeEventListener")),{__proto__:null,[gh](){var n;(n=r)===null||n===void 0||n()}}},"addAbortListener"),AbortSignalAny:wh.any||s(function(e){if(e.length===1)return e[0];let i=new Sh,r=s(()=>i.abort(),"abort");return e.forEach(n=>{Xs(n,"signals"),n.addEventListener("abort",r,{once:!0})}),i.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",r))},{once:!0}),i.signal},"AbortSignalAny")};Yn.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var re=N((m_,Zs)=>{"use strict";var{format:vh,inspect:Sr,AggregateError:Ah}=ee(),kh=globalThis.AggregateError||Ah,Nh=Symbol("kIsNodeError"),Th=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Fh=/^([A-Z][a-z0-9]*)+$/,Ih="__node_internal_",_r={};function mt(t,e){if(!t)throw new _r.ERR_INTERNAL_ASSERTION(e)}s(mt,"assert");function Js(t){let e="",i=t.length,r=t[0]==="-"?1:0;for(;i>=r+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return`${t.slice(0,i)}${e}`}s(Js,"addNumericalSeparator");function Ph(t,e,i){if(typeof e=="function")return mt(e.length<=i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${e.length}).`),e(...i);let r=(e.match(/%[dfijoOs]/g)||[]).length;return mt(r===i.length,`Code: ${t}; The provided arguments length (${i.length}) does not match the required ones (${r}).`),i.length===0?e:vh(e,...i)}s(Ph,"getMessage");function Q(t,e,i){i||(i=Error);class r extends i{constructor(...o){super(Ph(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}s(r,"NodeError"),Object.defineProperties(r.prototype,{name:{value:i.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=t,r.prototype[Nh]=!0,_r[t]=r}s(Q,"E");function Qs(t){let e=Ih+t.name;return Object.defineProperty(t,"name",{value:e}),t}s(Qs,"hideStackFrames");function Ch(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let i=new kh([e,t],e.message);return i.code=e.code,i}return t||e}s(Ch,"aggregateTwoErrors");var wr=class extends Error{constructor(e="The operation was aborted",i=void 0){if(i!==void 0&&typeof i!="object")throw new _r.ERR_INVALID_ARG_TYPE("options","Object",i);super(e,i),this.code="ABORT_ERR",this.name="AbortError"}};s(wr,"AbortError");Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,i)=>{mt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";t.endsWith(" argument")?r+=`${t} `:r+=`"${t}" ${t.includes(".")?"property":"argument"} `,r+="must be ";let n=[],o=[],a=[];for(let u of e)mt(typeof u=="string","All expected entries have to be of type string"),Th.includes(u)?n.push(u.toLowerCase()):Fh.test(u)?o.push(u):(mt(u!=="object",'The value "object" should be written as "Object"'),a.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:r+=`of type ${n[0]}`;break;case 2:r+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();r+=`one of type ${n.join(", ")}, or ${u}`}}(o.length>0||a.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();r+=`an instance of ${o.join(", ")}, or ${u}`}}a.length>0&&(r+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(r+="an "),r+=`${a[0]}`;break;case 2:r+=`one of ${a[0]} or ${a[1]}`;break;default:{let u=a.pop();r+=`one of ${a.join(", ")}, or ${u}`}}if(i==null)r+=`. Received ${i}`;else if(typeof i=="function"&&i.name)r+=`. Received function ${i.name}`;else if(typeof i=="object"){var l;if((l=i.constructor)!==null&&l!==void 0&&l.name)r+=`. Received an instance of ${i.constructor.name}`;else{let u=Sr(i,{depth:-1});r+=`. Received ${u}`}}else{let u=Sr(i,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),r+=`. Received type ${typeof i} (${u})`}return r},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,i="is invalid")=>{let r=Sr(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${i}. Received ${r}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,i)=>{var r;let n=i!=null&&(r=i.constructor)!==null&&r!==void 0&&r.name?`instance of ${i.constructor.name}`:`type ${typeof i}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{mt(t.length>0,"At least one arg needs to be specified");let e,i=t.length;switch(t=(Array.isArray(t)?t:[t]).map(r=>`"${r}"`).join(" or "),i){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let r=t.pop();e+=`The ${t.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,i)=>{mt(e,'Missing "range" argument');let r;return Number.isInteger(i)&&Math.abs(i)>2**32?r=Js(String(i)):typeof i=="bigint"?(r=String(i),(i>2n**32n||i<-(2n**32n))&&(r=Js(r)),r+="n"):r=Sr(i),`The value of "${t}" is out of range. It must be ${e}. Received ${r}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Zs.exports={AbortError:wr,aggregateTwoErrors:Qs(Ch),hideStackFrames:Qs,codes:_r}});var ii=N((g_,ca)=>{"use strict";var{ArrayIsArray:Jn,ArrayPrototypeIncludes:ra,ArrayPrototypeJoin:na,ArrayPrototypeMap:Lh,NumberIsInteger:Qn,NumberIsNaN:Rh,NumberMAX_SAFE_INTEGER:Oh,NumberMIN_SAFE_INTEGER:Bh,NumberParseInt:Dh,ObjectPrototypeHasOwnProperty:Mh,RegExpPrototypeExec:oa,String:Uh,StringPrototypeToUpperCase:Wh,StringPrototypeTrim:qh}=O(),{hideStackFrames:ge,codes:{ERR_SOCKET_BAD_PORT:jh,ERR_INVALID_ARG_TYPE:te,ERR_INVALID_ARG_VALUE:ti,ERR_OUT_OF_RANGE:bt,ERR_UNKNOWN_SIGNAL:ea}}=re(),{normalizeEncoding:$h}=ee(),{isAsyncFunction:zh,isArrayBufferView:Vh}=ee().types,ta={};function Gh(t){return t===(t|0)}s(Gh,"isInt32");function Hh(t){return t===t>>>0}s(Hh,"isUint32");var Kh=/^[0-7]+$/,Yh="must be a 32-bit unsigned integer or an octal string";function Xh(t,e,i){if(typeof t>"u"&&(t=i),typeof t=="string"){if(oa(Kh,t)===null)throw new ti(e,t,Yh);t=Dh(t,8)}return sa(t,e),t}s(Xh,"parseFileMode");var Jh=ge((t,e,i=Bh,r=Oh)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);if(t<i||t>r)throw new bt(e,`>= ${i} && <= ${r}`,t)}),Qh=ge((t,e,i=-2147483648,r=2147483647)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);if(t<i||t>r)throw new bt(e,`>= ${i} && <= ${r}`,t)}),sa=ge((t,e,i=!1)=>{if(typeof t!="number")throw new te(e,"number",t);if(!Qn(t))throw new bt(e,"an integer",t);let r=i?1:0,n=4294967295;if(t<r||t>n)throw new bt(e,`>= ${r} && <= ${n}`,t)});function Zn(t,e){if(typeof t!="string")throw new te(e,"string",t)}s(Zn,"validateString");function Zh(t,e,i=void 0,r){if(typeof t!="number")throw new te(e,"number",t);if(i!=null&&t<i||r!=null&&t>r||(i!=null||r!=null)&&Rh(t))throw new bt(e,`${i!=null?`>= ${i}`:""}${i!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,t)}s(Zh,"validateNumber");var ep=ge((t,e,i)=>{if(!ra(i,t)){let n="must be one of: "+na(Lh(i,o=>typeof o=="string"?`'${o}'`:Uh(o)),", ");throw new ti(e,t,n)}});function aa(t,e){if(typeof t!="boolean")throw new te(e,"boolean",t)}s(aa,"validateBoolean");function Xn(t,e,i){return t==null||!Mh(t,e)?i:t[e]}s(Xn,"getOwnPropertyValueOrDefault");var tp=ge((t,e,i=null)=>{let r=Xn(i,"allowArray",!1),n=Xn(i,"allowFunction",!1);if(!Xn(i,"nullable",!1)&&t===null||!r&&Jn(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new te(e,"Object",t)}),ip=ge((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new te(e,"a dictionary",t)}),Er=ge((t,e,i=0)=>{if(!Jn(t))throw new te(e,"Array",t);if(t.length<i){let r=`must be longer than ${i}`;throw new ti(e,t,r)}});function rp(t,e){Er(t,e);for(let i=0;i<t.length;i++)Zn(t[i],`${e}[${i}]`)}s(rp,"validateStringArray");function np(t,e){Er(t,e);for(let i=0;i<t.length;i++)aa(t[i],`${e}[${i}]`)}s(np,"validateBooleanArray");function op(t,e){Er(t,e);for(let i=0;i<t.length;i++){let r=t[i],n=`${e}[${i}]`;if(r==null)throw new te(n,"AbortSignal",r);la(r,n)}}s(op,"validateAbortSignalArray");function sp(t,e="signal"){if(Zn(t,e),ta[t]===void 0)throw ta[Wh(t)]!==void 0?new ea(t+" (signals must use all capital letters)"):new ea(t)}s(sp,"validateSignalName");var ap=ge((t,e="buffer")=>{if(!Vh(t))throw new te(e,["Buffer","TypedArray","DataView"],t)});function lp(t,e){let i=$h(e),r=t.length;if(i==="hex"&&r%2!==0)throw new ti("encoding",e,`is invalid for data of length ${r}`)}s(lp,"validateEncoding");function cp(t,e="Port",i=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&qh(t).length===0||+t!==+t>>>0||t>65535||t===0&&!i)throw new jh(e,t,i);return t|0}s(cp,"validatePort");var la=ge((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new te(e,"AbortSignal",t)}),up=ge((t,e)=>{if(typeof t!="function")throw new te(e,"Function",t)}),fp=ge((t,e)=>{if(typeof t!="function"||zh(t))throw new te(e,"Function",t)}),dp=ge((t,e)=>{if(t!==void 0)throw new te(e,"undefined",t)});function hp(t,e,i){if(!ra(i,t))throw new te(e,`('${na(i,"|")}')`,t)}s(hp,"validateUnion");var pp=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ia(t,e){if(typeof t>"u"||!oa(pp,t))throw new ti(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(ia,"validateLinkHeaderFormat");function yp(t){if(typeof t=="string")return ia(t,"hints"),t;if(Jn(t)){let e=t.length,i="";if(e===0)return i;for(let r=0;r<e;r++){let n=t[r];ia(n,"hints"),i+=n,r!==e-1&&(i+=", ")}return i}throw new ti("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}s(yp,"validateLinkHeaderValue");ca.exports={isInt32:Gh,isUint32:Hh,parseFileMode:Xh,validateArray:Er,validateStringArray:rp,validateBooleanArray:np,validateAbortSignalArray:op,validateBoolean:aa,validateBuffer:ap,validateDictionary:ip,validateEncoding:lp,validateFunction:up,validateInt32:Qh,validateInteger:Jh,validateNumber:Zh,validateObject:tp,validateOneOf:ep,validatePlainFunction:fp,validatePort:cp,validateSignalName:sp,validateString:Zn,validateUint32:sa,validateUndefined:dp,validateUnion:hp,validateAbortSignal:la,validateLinkHeaderValue:yp}});var ot=N((S_,ha)=>{var q=ha.exports={},Le,Re;function eo(){throw new Error("setTimeout has not been defined")}s(eo,"defaultSetTimout");function to(){throw new Error("clearTimeout has not been defined")}s(to,"defaultClearTimeout");(function(){try{typeof setTimeout=="function"?Le=setTimeout:Le=eo}catch{Le=eo}try{typeof clearTimeout=="function"?Re=clearTimeout:Re=to}catch{Re=to}})();function ua(t){if(Le===setTimeout)return setTimeout(t,0);if((Le===eo||!Le)&&setTimeout)return Le=setTimeout,setTimeout(t,0);try{return Le(t,0)}catch{try{return Le.call(null,t,0)}catch{return Le.call(this,t,0)}}}s(ua,"runTimeout");function mp(t){if(Re===clearTimeout)return clearTimeout(t);if((Re===to||!Re)&&clearTimeout)return Re=clearTimeout,clearTimeout(t);try{return Re(t)}catch{try{return Re.call(null,t)}catch{return Re.call(this,t)}}}s(mp,"runClearTimeout");var ze=[],ri=!1,gt,xr=-1;function bp(){!ri||!gt||(ri=!1,gt.length?ze=gt.concat(ze):xr=-1,ze.length&&fa())}s(bp,"cleanUpNextTick");function fa(){if(!ri){var t=ua(bp);ri=!0;for(var e=ze.length;e;){for(gt=ze,ze=[];++xr<e;)gt&>[xr].run();xr=-1,e=ze.length}gt=null,ri=!1,mp(t)}}s(fa,"drainQueue");q.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];ze.push(new da(t,e)),ze.length===1&&!ri&&ua(fa)};function da(t,e){this.fun=t,this.array=e}s(da,"Item");da.prototype.run=function(){this.fun.apply(null,this.array)};q.title="browser";q.browser=!0;q.env={};q.argv=[];q.version="";q.versions={};function Ve(){}s(Ve,"noop");q.on=Ve;q.addListener=Ve;q.once=Ve;q.off=Ve;q.removeListener=Ve;q.removeAllListeners=Ve;q.emit=Ve;q.prependListener=Ve;q.prependOnceListener=Ve;q.listeners=function(t){return[]};q.binding=function(t){throw new Error("process.binding is not supported")};q.cwd=function(){return"/"};q.chdir=function(t){throw new Error("process.chdir is not supported")};q.umask=function(){return 0}});var Be=N((E_,Ta)=>{"use strict";var{SymbolAsyncIterator:pa,SymbolIterator:ya,SymbolFor:wt}=O(),ma=wt("nodejs.stream.destroyed"),ba=wt("nodejs.stream.errored"),io=wt("nodejs.stream.readable"),ro=wt("nodejs.stream.writable"),ga=wt("nodejs.stream.disturbed"),gp=wt("nodejs.webstream.isClosedPromise"),wp=wt("nodejs.webstream.controllerErrorFunction");function vr(t,e=!1){var i;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((i=t._readableState)===null||i===void 0?void 0:i.readable)!==!1)&&(!t._writableState||t._readableState))}s(vr,"isReadableNodeStream");function Ar(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}s(Ar,"isWritableNodeStream");function Sp(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}s(Sp,"isDuplexNodeStream");function Oe(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}s(Oe,"isNodeStream");function wa(t){return!!(t&&!Oe(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}s(wa,"isReadableStream");function Sa(t){return!!(t&&!Oe(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}s(Sa,"isWritableStream");function _a(t){return!!(t&&!Oe(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}s(_a,"isTransformStream");function _p(t){return wa(t)||Sa(t)||_a(t)}s(_p,"isWebStream");function Ep(t,e){return t==null?!1:e===!0?typeof t[pa]=="function":e===!1?typeof t[ya]=="function":typeof t[pa]=="function"||typeof t[ya]=="function"}s(Ep,"isIterable");function kr(t){if(!Oe(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!!(t.destroyed||t[ma]||r!=null&&r.destroyed)}s(kr,"isDestroyed");function Ea(t){if(!Ar(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(Ea,"isWritableEnded");function xp(t,e){if(!Ar(t))return null;if(t.writableFinished===!0)return!0;let i=t._writableState;return i!=null&&i.errored?!1:typeof i?.finished!="boolean"?null:!!(i.finished||e===!1&&i.ended===!0&&i.length===0)}s(xp,"isWritableFinished");function vp(t){if(!vr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}s(vp,"isReadableEnded");function xa(t,e){if(!vr(t))return null;let i=t._readableState;return i!=null&&i.errored?!1:typeof i?.endEmitted!="boolean"?null:!!(i.endEmitted||e===!1&&i.ended===!0&&i.length===0)}s(xa,"isReadableFinished");function va(t){return t&&t[io]!=null?t[io]:typeof t?.readable!="boolean"?null:kr(t)?!1:vr(t)&&t.readable&&!xa(t)}s(va,"isReadable");function Aa(t){return t&&t[ro]!=null?t[ro]:typeof t?.writable!="boolean"?null:kr(t)?!1:Ar(t)&&t.writable&&!Ea(t)}s(Aa,"isWritable");function Ap(t,e){return Oe(t)?kr(t)?!0:!(e?.readable!==!1&&va(t)||e?.writable!==!1&&Aa(t)):null}s(Ap,"isFinished");function kp(t){var e,i;return Oe(t)?t.writableErrored?t.writableErrored:(e=(i=t._writableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(kp,"isWritableErrored");function Np(t){var e,i;return Oe(t)?t.readableErrored?t.readableErrored:(e=(i=t._readableState)===null||i===void 0?void 0:i.errored)!==null&&e!==void 0?e:null:null}s(Np,"isReadableErrored");function Tp(t){if(!Oe(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,i=t._readableState;return typeof e?.closed=="boolean"||typeof i?.closed=="boolean"?e?.closed||i?.closed:typeof t._closed=="boolean"&&ka(t)?t._closed:null}s(Tp,"isClosed");function ka(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}s(ka,"isOutgoingMessage");function Na(t){return typeof t._sent100=="boolean"&&ka(t)}s(Na,"isServerResponse");function Fp(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}s(Fp,"isServerRequest");function Ip(t){if(!Oe(t))return null;let e=t._writableState,i=t._readableState,r=e||i;return!r&&Na(t)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}s(Ip,"willEmitClose");function Pp(t){var e;return!!(t&&((e=t[ga])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}s(Pp,"isDisturbed");function Cp(t){var e,i,r,n,o,a,l,u,f,d;return!!(t&&((e=(i=(r=(n=(o=(a=t[ba])!==null&&a!==void 0?a:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&i!==void 0?i:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}s(Cp,"isErrored");Ta.exports={isDestroyed:kr,kIsDestroyed:ma,isDisturbed:Pp,kIsDisturbed:ga,isErrored:Cp,kIsErrored:ba,isReadable:va,kIsReadable:io,kIsClosedPromise:gp,kControllerErrorFunction:wp,kIsWritable:ro,isClosed:Tp,isDuplexNodeStream:Sp,isFinished:Ap,isIterable:Ep,isReadableNodeStream:vr,isReadableStream:wa,isReadableEnded:vp,isReadableFinished:xa,isReadableErrored:Np,isNodeStream:Oe,isWebStream:_p,isWritable:Aa,isWritableNodeStream:Ar,isWritableStream:Sa,isWritableEnded:Ea,isWritableFinished:xp,isWritableErrored:kp,isServerRequest:Fp,isServerResponse:Na,willEmitClose:Ip,isTransformStream:_a}});var Ge=N((v_,lo)=>{var st=ot(),{AbortError:Da,codes:Lp}=re(),{ERR_INVALID_ARG_TYPE:Rp,ERR_STREAM_PREMATURE_CLOSE:Fa}=Lp,{kEmptyObject:oo,once:so}=ee(),{validateAbortSignal:Op,validateFunction:Bp,validateObject:Dp,validateBoolean:Mp}=ii(),{Promise:Up,PromisePrototypeThen:Wp,SymbolDispose:Ma}=O(),{isClosed:qp,isReadable:Ia,isReadableNodeStream:no,isReadableStream:jp,isReadableFinished:Pa,isReadableErrored:Ca,isWritable:La,isWritableNodeStream:Ra,isWritableStream:$p,isWritableFinished:Oa,isWritableErrored:Ba,isNodeStream:zp,willEmitClose:Vp,kIsClosedPromise:Gp}=Be(),ni;function Hp(t){return t.setHeader&&typeof t.abort=="function"}s(Hp,"isRequest");var ao=s(()=>{},"nop");function Ua(t,e,i){var r,n;if(arguments.length===2?(i=e,e=oo):e==null?e=oo:Dp(e,"options"),Bp(i,"callback"),Op(e.signal,"options.signal"),i=so(i),jp(t)||$p(t))return Kp(t,e,i);if(!zp(t))throw new Rp("stream",["ReadableStream","WritableStream","Stream"],t);let o=(r=e.readable)!==null&&r!==void 0?r:no(t),a=(n=e.writable)!==null&&n!==void 0?n:Ra(t),l=t._writableState,u=t._readableState,f=s(()=>{t.writable||b()},"onlegacyfinish"),d=Vp(t)&&no(t)===o&&Ra(t)===a,h=Oa(t,!1),b=s(()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||m)&&i.call(t)},"onfinish"),m=Pa(t,!1),g=s(()=>{m=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||a))&&(!a||h)&&i.call(t)},"onend"),y=s($=>{i.call(t,$)},"onerror"),k=qp(t),w=s(()=>{k=!0;let $=Ba(t)||Ca(t);if($&&typeof $!="boolean")return i.call(t,$);if(o&&!m&&no(t,!0)&&!Pa(t,!1))return i.call(t,new Fa);if(a&&!h&&!Oa(t,!1))return i.call(t,new Fa);i.call(t)},"onclose"),F=s(()=>{k=!0;let $=Ba(t)||Ca(t);if($&&typeof $!="boolean")return i.call(t,$);i.call(t)},"onclosed"),D=s(()=>{t.req.on("finish",b)},"onrequest");Hp(t)?(t.on("complete",b),d||t.on("abort",w),t.req?D():t.on("request",D)):a&&!l&&(t.on("end",f),t.on("close",f)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",w),t.on("end",g),t.on("finish",b),e.error!==!1&&t.on("error",y),t.on("close",w),k?st.nextTick(w):l!=null&&l.errorEmitted||u!=null&&u.errorEmitted?d||st.nextTick(F):(!o&&(!d||Ia(t))&&(h||La(t)===!1)||!a&&(!d||La(t))&&(m||Ia(t)===!1)||u&&t.req&&t.aborted)&&st.nextTick(F);let A=s(()=>{i=ao,t.removeListener("aborted",w),t.removeListener("complete",b),t.removeListener("abort",w),t.removeListener("request",D),t.req&&t.req.removeListener("finish",b),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",b),t.removeListener("end",g),t.removeListener("error",y),t.removeListener("close",w)},"cleanup");if(e.signal&&!k){let $=s(()=>{let lt=i;A(),lt.call(t,new Da(void 0,{cause:e.signal.reason}))},"abort");if(e.signal.aborted)st.nextTick($);else{ni=ni||ee().addAbortListener;let lt=ni(e.signal,$),de=i;i=so((...Ft)=>{lt[Ma](),de.apply(t,Ft)})}}return A}s(Ua,"eos");function Kp(t,e,i){let r=!1,n=ao;if(e.signal)if(n=s(()=>{r=!0,i.call(t,new Da(void 0,{cause:e.signal.reason}))},"abort"),e.signal.aborted)st.nextTick(n);else{ni=ni||ee().addAbortListener;let a=ni(e.signal,n),l=i;i=so((...u)=>{a[Ma](),l.apply(t,u)})}let o=s((...a)=>{r||st.nextTick(()=>i.apply(t,a))},"resolverFn");return Wp(t[Gp].promise,o,o),ao}s(Kp,"eosWeb");function Yp(t,e){var i;let r=!1;return e===null&&(e=oo),(i=e)!==null&&i!==void 0&&i.cleanup&&(Mp(e.cleanup,"cleanup"),r=e.cleanup),new Up((n,o)=>{let a=Ua(t,e,l=>{r&&a(),l?o(l):n()})})}s(Yp,"finished");lo.exports=Ua;lo.exports.finished=Yp});var St=N((k_,Ha)=>{"use strict";var De=ot(),{aggregateTwoErrors:Xp,codes:{ERR_MULTIPLE_CALLBACK:Jp},AbortError:Qp}=re(),{Symbol:ja}=O(),{kIsDestroyed:Zp,isDestroyed:ey,isFinished:ty,isServerRequest:iy}=Be(),$a=ja("kDestroy"),co=ja("kConstruct");function za(t,e,i){t&&(t.stack,e&&!e.errored&&(e.errored=t),i&&!i.errored&&(i.errored=t))}s(za,"checkError");function ry(t,e){let i=this._readableState,r=this._writableState,n=r||i;return r!=null&&r.destroyed||i!=null&&i.destroyed?(typeof e=="function"&&e(),this):(za(t,r,i),r&&(r.destroyed=!0),i&&(i.destroyed=!0),n.constructed?Wa(this,t,e):this.once($a,function(o){Wa(this,Xp(o,t),e)}),this)}s(ry,"destroy");function Wa(t,e,i){let r=!1;function n(o){if(r)return;r=!0;let a=t._readableState,l=t._writableState;za(o,l,a),l&&(l.closed=!0),a&&(a.closed=!0),typeof i=="function"&&i(o),o?De.nextTick(ny,t,o):De.nextTick(Va,t)}s(n,"onDestroy");try{t._destroy(e||null,n)}catch(o){n(o)}}s(Wa,"_destroy");function ny(t,e){uo(t,e),Va(t)}s(ny,"emitErrorCloseNT");function Va(t){let e=t._readableState,i=t._writableState;i&&(i.closeEmitted=!0),e&&(e.closeEmitted=!0),(i!=null&&i.emitClose||e!=null&&e.emitClose)&&t.emit("close")}s(Va,"emitCloseNT");function uo(t,e){let i=t._readableState,r=t._writableState;r!=null&&r.errorEmitted||i!=null&&i.errorEmitted||(r&&(r.errorEmitted=!0),i&&(i.errorEmitted=!0),t.emit("error",e))}s(uo,"emitErrorNT");function oy(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}s(oy,"undestroy");function fo(t,e,i){let r=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),r&&!r.errored&&(r.errored=e),i?De.nextTick(uo,t,e):uo(t,e))}s(fo,"errorOrDestroy");function sy(t,e){if(typeof t._construct!="function")return;let i=t._readableState,r=t._writableState;i&&(i.constructed=!1),r&&(r.constructed=!1),t.once(co,e),!(t.listenerCount(co)>1)&&De.nextTick(ay,t)}s(sy,"construct");function ay(t){let e=!1;function i(r){if(e){fo(t,r??new Jp);return}e=!0;let n=t._readableState,o=t._writableState,a=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),a.destroyed?t.emit($a,r):r?fo(t,r,!0):De.nextTick(ly,t)}s(i,"onConstruct");try{t._construct(r=>{De.nextTick(i,r)})}catch(r){De.nextTick(i,r)}}s(ay,"constructNT");function ly(t){t.emit(co)}s(ly,"emitConstructNT");function qa(t){return t?.setHeader&&typeof t.abort=="function"}s(qa,"isRequest");function Ga(t){t.emit("close")}s(Ga,"emitCloseLegacy");function cy(t,e){t.emit("error",e),De.nextTick(Ga,t)}s(cy,"emitErrorCloseLegacy");function uy(t,e){!t||ey(t)||(!e&&!ty(t)&&(e=new Qp),iy(t)?(t.socket=null,t.destroy(e)):qa(t)?t.abort():qa(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?De.nextTick(cy,t,e):De.nextTick(Ga,t),t.destroyed||(t[Zp]=!0))}s(uy,"destroyer");Ha.exports={construct:sy,destroyer:uy,destroy:ry,undestroy:oy,errorOrDestroy:fo}});var Fr=N((T_,Ya)=>{"use strict";var{ArrayIsArray:fy,ObjectSetPrototypeOf:Ka}=O(),{EventEmitter:Nr}=Oi();function Tr(t){Nr.call(this,t)}s(Tr,"Stream");Ka(Tr.prototype,Nr.prototype);Ka(Tr,Nr);Tr.prototype.pipe=function(t,e){let i=this;function r(d){t.writable&&t.write(d)===!1&&i.pause&&i.pause()}s(r,"ondata"),i.on("data",r);function n(){i.readable&&i.resume&&i.resume()}s(n,"ondrain"),t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(i.on("end",a),i.on("close",l));let o=!1;function a(){o||(o=!0,t.end())}s(a,"onend");function l(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}s(l,"onclose");function u(d){f(),Nr.listenerCount(this,"error")===0&&this.emit("error",d)}s(u,"onerror"),ho(i,"error",u),ho(t,"error",u);function f(){i.removeListener("data",r),t.removeListener("drain",n),i.removeListener("end",a),i.removeListener("close",l),i.removeListener("error",u),t.removeListener("error",u),i.removeListener("end",f),i.removeListener("close",f),t.removeListener("close",f)}return s(f,"cleanup"),i.on("end",f),i.on("close",f),t.on("close",f),t.emit("pipe",i),t};function ho(t,e,i){if(typeof t.prependListener=="function")return t.prependListener(e,i);!t._events||!t._events[e]?t.on(e,i):fy(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]}s(ho,"prependListener");Ya.exports={Stream:Tr,prependListener:ho}});var Bi=N((I_,Ir)=>{"use strict";var{SymbolDispose:dy}=O(),{AbortError:Xa,codes:hy}=re(),{isNodeStream:Ja,isWebStream:py,kControllerErrorFunction:yy}=Be(),my=Ge(),{ERR_INVALID_ARG_TYPE:Qa}=hy,po,by=s((t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Qa(e,"AbortSignal",t)},"validateAbortSignal");Ir.exports.addAbortSignal=s(function(e,i){if(by(e,"signal"),!Ja(i)&&!py(i))throw new Qa("stream",["ReadableStream","WritableStream","Stream"],i);return Ir.exports.addAbortSignalNoValidate(e,i)},"addAbortSignal");Ir.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let i=Ja(e)?()=>{e.destroy(new Xa(void 0,{cause:t.reason}))}:()=>{e[yy](new Xa(void 0,{cause:t.reason}))};if(t.aborted)i();else{po=po||ee().addAbortListener;let r=po(t,i);my(e,r[dy])}return e}});var tl=N((L_,el)=>{"use strict";var{StringPrototypeSlice:Za,SymbolIterator:gy,TypedArrayPrototypeSet:Pr,Uint8Array:wy}=O(),{Buffer:yo}=$e(),{inspect:Sy}=ee();el.exports=s(class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let i=this.head,r=""+i.data;for(;(i=i.next)!==null;)r+=e+i.data;return r}concat(e){if(this.length===0)return yo.alloc(0);let i=yo.allocUnsafe(e>>>0),r=this.head,n=0;for(;r;)Pr(i,r.data,n),n+=r.data.length,r=r.next;return i}consume(e,i){let r=this.head.data;if(e<r.length){let n=r.slice(0,e);return this.head.data=r.slice(e),n}return e===r.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[gy](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",r=this.head,n=0;do{let o=r.data;if(e>o.length)i+=o,e-=o.length;else{e===o.length?(i+=o,++n,r.next?this.head=r.next:this.head=this.tail=null):(i+=Za(o,0,e),this.head=r,r.data=Za(o,e));break}++n}while((r=r.next)!==null);return this.length-=n,i}_getBuffer(e){let i=yo.allocUnsafe(e),r=e,n=this.head,o=0;do{let a=n.data;if(e>a.length)Pr(i,a,r-e),e-=a.length;else{e===a.length?(Pr(i,a,r-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(Pr(i,new wy(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return Sy(this,{...i,depth:0,customInspect:!1})}},"BufferList")});var Di=N((O_,ol)=>{"use strict";var{MathFloor:_y,NumberIsInteger:Ey}=O(),{validateInteger:xy}=ii(),{ERR_INVALID_ARG_VALUE:vy}=re().codes,il=16*1024,rl=16;function Ay(t,e,i){return t.highWaterMark!=null?t.highWaterMark:e?t[i]:null}s(Ay,"highWaterMarkFrom");function nl(t){return t?rl:il}s(nl,"getDefaultHighWaterMark");function ky(t,e){xy(e,"value",0),t?rl=e:il=e}s(ky,"setDefaultHighWaterMark");function Ny(t,e,i,r){let n=Ay(e,r,i);if(n!=null){if(!Ey(n)||n<0){let o=r?`options.${i}`:"options.highWaterMark";throw new vy(o,n)}return _y(n)}return nl(t.objectMode)}s(Ny,"getHighWaterMark");ol.exports={getHighWaterMark:Ny,getDefaultHighWaterMark:nl,setDefaultHighWaterMark:ky}});var ll=N((mo,al)=>{var Cr=$e(),Me=Cr.Buffer;function sl(t,e){for(var i in t)e[i]=t[i]}s(sl,"copyProps");Me.from&&Me.alloc&&Me.allocUnsafe&&Me.allocUnsafeSlow?al.exports=Cr:(sl(Cr,mo),mo.Buffer=_t);function _t(t,e,i){return Me(t,e,i)}s(_t,"SafeBuffer");_t.prototype=Object.create(Me.prototype);sl(Me,_t);_t.from=function(t,e,i){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Me(t,e,i)};_t.alloc=function(t,e,i){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Me(t);return e!==void 0?typeof i=="string"?r.fill(e,i):r.fill(e):r.fill(0),r};_t.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Me(t)};_t.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cr.SlowBuffer(t)}});var fl=N(ul=>{"use strict";var go=ll().Buffer,cl=go.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Ty(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}s(Ty,"_normalizeEncoding");function Fy(t){var e=Ty(t);if(typeof e!="string"&&(go.isEncoding===cl||!cl(t)))throw new Error("Unknown encoding: "+t);return e||t}s(Fy,"normalizeEncoding");ul.StringDecoder=Mi;function Mi(t){this.encoding=Fy(t);var e;switch(this.encoding){case"utf16le":this.text=Oy,this.end=By,e=4;break;case"utf8":this.fillLast=Cy,e=4;break;case"base64":this.text=Dy,this.end=My,e=3;break;default:this.write=Uy,this.end=Wy;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=go.allocUnsafe(e)}s(Mi,"StringDecoder");Mi.prototype.write=function(t){if(t.length===0)return"";var e,i;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<t.length?e?e+this.text(t,i):this.text(t,i):e||""};Mi.prototype.end=Ry;Mi.prototype.text=Ly;Mi.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function bo(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}s(bo,"utf8CheckByte");function Iy(t,e,i){var r=e.length-1;if(r<i)return 0;var n=bo(e[r]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--r<i||n===-2?0:(n=bo(e[r]),n>=0?(n>0&&(t.lastNeed=n-2),n):--r<i||n===-2?0:(n=bo(e[r]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}s(Iy,"utf8CheckIncomplete");function Py(t,e,i){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}s(Py,"utf8CheckExtraBytes");function Cy(t){var e=this.lastTotal-this.lastNeed,i=Py(this,t,e);if(i!==void 0)return i;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}s(Cy,"utf8FillLast");function Ly(t,e){var i=Iy(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)}s(Ly,"utf8Text");function Ry(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}s(Ry,"utf8End");function Oy(t,e){if((t.length-e)%2===0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}s(Oy,"utf16Text");function By(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}s(By,"utf16End");function Dy(t,e){var i=(t.length-e)%3;return i===0?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}s(Dy,"base64Text");function My(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}s(My,"base64End");function Uy(t){return t.toString(this.encoding)}s(Uy,"simpleWrite");function Wy(t){return t&&t.length?this.write(t):""}s(Wy,"simpleEnd")});var wo=N((W_,yl)=>{"use strict";var dl=ot(),{PromisePrototypeThen:qy,SymbolAsyncIterator:hl,SymbolIterator:pl}=O(),{Buffer:jy}=$e(),{ERR_INVALID_ARG_TYPE:$y,ERR_STREAM_NULL_VALUES:zy}=re().codes;function Vy(t,e,i){let r;if(typeof e=="string"||e instanceof jy)return new t({objectMode:!0,...i,read(){this.push(e),this.push(null)}});let n;if(e&&e[hl])n=!0,r=e[hl]();else if(e&&e[pl])n=!1,r=e[pl]();else throw new $y("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...i}),a=!1;o._read=function(){a||(a=!0,u())},o._destroy=function(f,d){qy(l(f),()=>dl.nextTick(d,f),h=>dl.nextTick(d,h||f))};async function l(f){let d=f!=null,h=typeof r.throw=="function";if(d&&h){let{value:b,done:m}=await r.throw(f);if(await b,m)return}if(typeof r.return=="function"){let{value:b}=await r.return();await b}}s(l,"close");async function u(){for(;;){try{let{value:f,done:d}=n?await r.next():r.next();if(d)o.push(null);else{let h=f&&typeof f.then=="function"?await f:f;if(h===null)throw a=!1,new zy;if(o.push(h))continue;a=!1}}catch(f){o.destroy(f)}break}}return s(u,"next"),o}s(Vy,"from");yl.exports=Vy});var Wi=N((j_,Ll)=>{var ve=ot(),{ArrayPrototypeIndexOf:Gy,NumberIsInteger:Hy,NumberIsNaN:Ky,NumberParseInt:Yy,ObjectDefineProperties:No,ObjectKeys:Xy,ObjectSetPrototypeOf:gl,Promise:wl,SafeSet:Jy,SymbolAsyncDispose:Qy,SymbolAsyncIterator:Zy,Symbol:em}=O();Ll.exports=_;_.ReadableState=Br;var{EventEmitter:tm}=Oi(),{Stream:at,prependListener:im}=Fr(),{Buffer:So}=$e(),{addAbortSignal:rm}=Bi(),Sl=Ge(),x=ee().debuglog("stream",t=>{x=t}),nm=tl(),ai=St(),{getHighWaterMark:om,getDefaultHighWaterMark:sm}=Di(),{aggregateTwoErrors:ml,codes:{ERR_INVALID_ARG_TYPE:am,ERR_METHOD_NOT_IMPLEMENTED:lm,ERR_OUT_OF_RANGE:cm,ERR_STREAM_PUSH_AFTER_EOF:um,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:fm},AbortError:dm}=re(),{validateObject:hm}=ii(),Et=em("kPaused"),{StringDecoder:_l}=fl(),pm=wo();gl(_.prototype,at.prototype);gl(_,at);var _o=s(()=>{},"nop"),{errorOrDestroy:oi}=ai,si=1<<0,ym=1<<1,El=1<<2,Ui=1<<3,xl=1<<4,Lr=1<<5,Rr=1<<6,vl=1<<7,mm=1<<8,bm=1<<9,gm=1<<10,Ao=1<<11,ko=1<<12,wm=1<<13,Sm=1<<14,_m=1<<15,Al=1<<16,Em=1<<17,xm=1<<18;function V(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}s(V,"makeBitMapDescriptor");No(Br.prototype,{objectMode:V(si),ended:V(ym),endEmitted:V(El),reading:V(Ui),constructed:V(xl),sync:V(Lr),needReadable:V(Rr),emittedReadable:V(vl),readableListening:V(mm),resumeScheduled:V(bm),errorEmitted:V(gm),emitClose:V(Ao),autoDestroy:V(ko),destroyed:V(wm),closed:V(Sm),closeEmitted:V(_m),multiAwaitDrain:V(Al),readingMore:V(Em),dataEmitted:V(xm)});function Br(t,e,i){typeof i!="boolean"&&(i=e instanceof Ue()),this.state=Ao|ko|xl|Lr,t&&t.objectMode&&(this.state|=si),i&&t&&t.readableObjectMode&&(this.state|=si),this.highWaterMark=t?om(this,t,"readableHighWaterMark",i):sm(!1),this.buffer=new nm,this.length=0,this.pipes=[],this.flowing=null,this[Et]=null,t&&t.emitClose===!1&&(this.state&=~Ao),t&&t.autoDestroy===!1&&(this.state&=~ko),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new _l(t.encoding),this.encoding=t.encoding)}s(Br,"ReadableState");function _(t){if(!(this instanceof _))return new _(t);let e=this instanceof Ue();this._readableState=new Br(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&rm(t.signal,this)),at.call(this,t),ai.construct(this,()=>{this._readableState.needReadable&&Or(this,this._readableState)})}s(_,"Readable");_.prototype.destroy=ai.destroy;_.prototype._undestroy=ai.undestroy;_.prototype._destroy=function(t,e){e(t)};_.prototype[tm.captureRejectionSymbol]=function(t){this.destroy(t)};_.prototype[Qy]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new dm,this.destroy(t)),new wl((e,i)=>Sl(this,r=>r&&r!==t?i(r):e(null)))};_.prototype.push=function(t,e){return kl(this,t,e,!1)};_.prototype.unshift=function(t,e){return kl(this,t,e,!0)};function kl(t,e,i,r){x("readableAddChunk",e);let n=t._readableState,o;if(n.state&si||(typeof e=="string"?(i=i||n.defaultEncoding,n.encoding!==i&&(r&&n.encoding?e=So.from(e,i).toString(n.encoding):(e=So.from(e,i),i=""))):e instanceof So?i="":at._isUint8Array(e)?(e=at._uint8ArrayToBuffer(e),i=""):e!=null&&(o=new am("chunk",["string","Buffer","Uint8Array"],e))),o)oi(t,o);else if(e===null)n.state&=~Ui,km(t,n);else if(n.state&si||e&&e.length>0)if(r)if(n.state&El)oi(t,new fm);else{if(n.destroyed||n.errored)return!1;Eo(t,n,e,!0)}else if(n.ended)oi(t,new um);else{if(n.destroyed||n.errored)return!1;n.state&=~Ui,n.decoder&&!i?(e=n.decoder.write(e),n.objectMode||e.length!==0?Eo(t,n,e,!1):Or(t,n)):Eo(t,n,e,!1)}else r||(n.state&=~Ui,Or(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}s(kl,"readableAddChunk");function Eo(t,e,i,r){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Al?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",i)):(e.length+=e.objectMode?1:i.length,r?e.buffer.unshift(i):e.buffer.push(i),e.state&Rr&&Dr(t)),Or(t,e)}s(Eo,"addChunk");_.prototype.isPaused=function(){let t=this._readableState;return t[Et]===!0||t.flowing===!1};_.prototype.setEncoding=function(t){let e=new _l(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let i=this._readableState.buffer,r="";for(let n of i)r+=e.write(n);return i.clear(),r!==""&&i.push(r),this._readableState.length=r.length,this};var vm=1073741824;function Am(t){if(t>vm)throw new cm("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}s(Am,"computeNewHighWaterMark");function bl(t,e){return t<=0||e.length===0&&e.ended?0:e.state&si?1:Ky(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}s(bl,"howMuchToRead");_.prototype.read=function(t){x("read",t),t===void 0?t=NaN:Hy(t)||(t=Yy(t,10));let e=this._readableState,i=t;if(t>e.highWaterMark&&(e.highWaterMark=Am(t)),t!==0&&(e.state&=~vl),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return x("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?xo(this):Dr(this),null;if(t=bl(t,e),t===0&&e.ended)return e.length===0&&xo(this),null;let r=(e.state&Rr)!==0;if(x("need readable",r),(e.length===0||e.length-t<e.highWaterMark)&&(r=!0,x("length less than watermark",r)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)r=!1,x("reading, ended or constructing",r);else if(r){x("do read"),e.state|=Ui|Lr,e.length===0&&(e.state|=Rr);try{this._read(e.highWaterMark)}catch(o){oi(this,o)}e.state&=~Lr,e.reading||(t=bl(i,e))}let n;return t>0?n=Pl(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&xo(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function km(t,e){if(x("onEofChunk"),!e.ended){if(e.decoder){let i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,e.sync?Dr(t):(e.needReadable=!1,e.emittedReadable=!0,Nl(t))}}s(km,"onEofChunk");function Dr(t){let e=t._readableState;x("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(x("emitReadable",e.flowing),e.emittedReadable=!0,ve.nextTick(Nl,t))}s(Dr,"emitReadable");function Nl(t){let e=t._readableState;x("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Fl(t)}s(Nl,"emitReadable_");function Or(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ve.nextTick(Nm,t,e))}s(Or,"maybeReadMore");function Nm(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let i=e.length;if(x("maybeReadMore read 0"),t.read(0),i===e.length)break}e.readingMore=!1}s(Nm,"maybeReadMore_");_.prototype._read=function(t){throw new lm("_read()")};_.prototype.pipe=function(t,e){let i=this,r=this._readableState;r.pipes.length===1&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new Jy(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(t),x("pipe count=%d opts=%j",r.pipes.length,e);let o=(!e||e.end!==!1)&&t!==ve.stdout&&t!==ve.stderr?l:k;r.endEmitted?ve.nextTick(o):i.once("end",o),t.on("unpipe",a);function a(w,F){x("onunpipe"),w===i&&F&&F.hasUnpiped===!1&&(F.hasUnpiped=!0,d())}s(a,"onunpipe");function l(){x("onend"),t.end()}s(l,"onend");let u,f=!1;function d(){x("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),u&&t.removeListener("drain",u),t.removeListener("error",m),t.removeListener("unpipe",a),i.removeListener("end",l),i.removeListener("end",k),i.removeListener("data",b),f=!0,u&&r.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}s(d,"cleanup");function h(){f||(r.pipes.length===1&&r.pipes[0]===t?(x("false write response, pause",0),r.awaitDrainWriters=t,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(t)&&(x("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(t)),i.pause()),u||(u=Tm(i,t),t.on("drain",u))}s(h,"pause"),i.on("data",b);function b(w){x("ondata");let F=t.write(w);x("dest.write",F),F===!1&&h()}s(b,"ondata");function m(w){if(x("onerror",w),k(),t.removeListener("error",m),t.listenerCount("error")===0){let F=t._writableState||t._readableState;F&&!F.errorEmitted?oi(t,w):t.emit("error",w)}}s(m,"onerror"),im(t,"error",m);function g(){t.removeListener("finish",y),k()}s(g,"onclose"),t.once("close",g);function y(){x("onfinish"),t.removeListener("close",g),k()}s(y,"onfinish"),t.once("finish",y);function k(){x("unpipe"),i.unpipe(t)}return s(k,"unpipe"),t.emit("pipe",i),t.writableNeedDrain===!0?h():r.flowing||(x("pipe resume"),i.resume()),t};function Tm(t,e){return s(function(){let r=t._readableState;r.awaitDrainWriters===e?(x("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(x("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(e)),(!r.awaitDrainWriters||r.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()},"pipeOnDrainFunctionResult")}s(Tm,"pipeOnDrain");_.prototype.unpipe=function(t){let e=this._readableState,i={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let r=Gy(e.pipes,t);return r===-1?this:(e.pipes.splice(r,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,i),this)};_.prototype.on=function(t,e){let i=at.prototype.on.call(this,t,e),r=this._readableState;return t==="data"?(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1&&this.resume()):t==="readable"&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,x("on readable",r.length,r.reading),r.length?Dr(this):r.reading||ve.nextTick(Fm,this)),i};_.prototype.addListener=_.prototype.on;_.prototype.removeListener=function(t,e){let i=at.prototype.removeListener.call(this,t,e);return t==="readable"&&ve.nextTick(Tl,this),i};_.prototype.off=_.prototype.removeListener;_.prototype.removeAllListeners=function(t){let e=at.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ve.nextTick(Tl,this),e};function Tl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Et]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}s(Tl,"updateReadableListening");function Fm(t){x("readable nexttick read 0"),t.read(0)}s(Fm,"nReadingNextTick");_.prototype.resume=function(){let t=this._readableState;return t.flowing||(x("resume"),t.flowing=!t.readableListening,Im(this,t)),t[Et]=!1,this};function Im(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ve.nextTick(Pm,t,e))}s(Im,"resume");function Pm(t,e){x("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Fl(t),e.flowing&&!e.reading&&t.read(0)}s(Pm,"resume_");_.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Et]=!0,this};function Fl(t){let e=t._readableState;for(x("flow",e.flowing);e.flowing&&t.read()!==null;);}s(Fl,"flow");_.prototype.wrap=function(t){let e=!1;t.on("data",r=>{!this.push(r)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",r=>{oi(this,r)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let i=Xy(t);for(let r=1;r<i.length;r++){let n=i[r];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};_.prototype[Zy]=function(){return Il(this)};_.prototype.iterator=function(t){return t!==void 0&&hm(t,"options"),Il(this,t)};function Il(t,e){typeof t.read!="function"&&(t=_.wrap(t,{objectMode:!0}));let i=Cm(t,e);return i.stream=t,i}s(Il,"streamToAsyncIterator");async function*Cm(t,e){let i=_o;function r(a){this===t?(i(),i=_o):i=a}s(r,"next"),t.on("readable",r);let n,o=Sl(t,{writable:!1},a=>{n=a?ml(n,a):null,i(),i=_o});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(n)throw n;if(n===null)return;await new wl(r)}}}catch(a){throw n=ml(n,a),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?ai.destroyer(t,null):(t.off("readable",r),o())}}s(Cm,"createAsyncIterator");No(_.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});No(Br.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Et]!==!1},set(t){this[Et]=!!t}}});_._fromList=Pl;function Pl(t,e){if(e.length===0)return null;let i;return e.objectMode?i=e.buffer.shift():!t||t>=e.length?(e.decoder?i=e.buffer.join(""):e.buffer.length===1?i=e.buffer.first():i=e.buffer.concat(e.length),e.buffer.clear()):i=e.buffer.consume(t,e.decoder),i}s(Pl,"fromList");function xo(t){let e=t._readableState;x("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ve.nextTick(Lm,e,t))}s(xo,"endReadable");function Lm(t,e){if(x("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)ve.nextTick(Rm,e);else if(t.autoDestroy){let i=e._writableState;(!i||i.autoDestroy&&(i.finished||i.writable===!1))&&e.destroy()}}}s(Lm,"endReadableNT");function Rm(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}s(Rm,"endWritableNT");_.from=function(t,e){return pm(_,t,e)};var vo;function Cl(){return vo===void 0&&(vo={}),vo}s(Cl,"lazyWebStreams");_.fromWeb=function(t,e){return Cl().newStreamReadableFromReadableStream(t,e)};_.toWeb=function(t,e){return Cl().newReadableStreamFromStreamReadable(t,e)};_.wrap=function(t,e){var i,r;return new _({objectMode:(i=(r=t.readableObjectMode)!==null&&r!==void 0?r:t.objectMode)!==null&&i!==void 0?i:!0,...e,destroy(n,o){ai.destroyer(t,n),o(n)}}).wrap(t)}});var jr=N((z_,Vl)=>{var xt=ot(),{ArrayPrototypeSlice:Bl,Error:Om,FunctionPrototypeSymbolHasInstance:Dl,ObjectDefineProperty:Ml,ObjectDefineProperties:Bm,ObjectSetPrototypeOf:Ul,StringPrototypeToLowerCase:Dm,Symbol:Mm,SymbolHasInstance:Um}=O();Vl.exports=B;B.WritableState=$i;var{EventEmitter:Wm}=Oi(),qi=Fr().Stream,{Buffer:Mr}=$e(),qr=St(),{addAbortSignal:qm}=Bi(),{getHighWaterMark:jm,getDefaultHighWaterMark:$m}=Di(),{ERR_INVALID_ARG_TYPE:zm,ERR_METHOD_NOT_IMPLEMENTED:Vm,ERR_MULTIPLE_CALLBACK:Wl,ERR_STREAM_CANNOT_PIPE:Gm,ERR_STREAM_DESTROYED:ji,ERR_STREAM_ALREADY_FINISHED:Hm,ERR_STREAM_NULL_VALUES:Km,ERR_STREAM_WRITE_AFTER_END:Ym,ERR_UNKNOWN_ENCODING:ql}=re().codes,{errorOrDestroy:li}=qr;Ul(B.prototype,qi.prototype);Ul(B,qi);function Io(){}s(Io,"nop");var ci=Mm("kOnFinished");function $i(t,e,i){typeof i!="boolean"&&(i=e instanceof Ue()),this.objectMode=!!(t&&t.objectMode),i&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?jm(this,t,"writableHighWaterMark",i):$m(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(t&&t.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Jm.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Wr(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[ci]=[]}s($i,"WritableState");function Wr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}s(Wr,"resetBuffer");$i.prototype.getBuffer=s(function(){return Bl(this.buffered,this.bufferedIndex)},"getBuffer");Ml($i.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function B(t){let e=this instanceof Ue();if(!e&&!Dl(B,this))return new B(t);this._writableState=new $i(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&qm(t.signal,this)),qi.call(this,t),qr.construct(this,()=>{let i=this._writableState;i.writing||Co(this,i),Lo(this,i)})}s(B,"Writable");Ml(B,Um,{__proto__:null,value:function(t){return Dl(this,t)?!0:this!==B?!1:t&&t._writableState instanceof $i}});B.prototype.pipe=function(){li(this,new Gm)};function jl(t,e,i,r){let n=t._writableState;if(typeof i=="function")r=i,i=n.defaultEncoding;else{if(!i)i=n.defaultEncoding;else if(i!=="buffer"&&!Mr.isEncoding(i))throw new ql(i);typeof r!="function"&&(r=Io)}if(e===null)throw new Km;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Mr.from(e,i),i="buffer");else if(e instanceof Mr)i="buffer";else if(qi._isUint8Array(e))e=qi._uint8ArrayToBuffer(e),i="buffer";else throw new zm("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new Ym:n.destroyed&&(o=new ji("write")),o?(xt.nextTick(r,o),li(t,o,!0),o):(n.pendingcb++,Xm(t,n,e,i,r))}s(jl,"_write");B.prototype.write=function(t,e,i){return jl(this,t,e,i)===!0};B.prototype.cork=function(){this._writableState.corked++};B.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Co(this,t))};B.prototype.setDefaultEncoding=s(function(e){if(typeof e=="string"&&(e=Dm(e)),!Mr.isEncoding(e))throw new ql(e);return this._writableState.defaultEncoding=e,this},"setDefaultEncoding");function Xm(t,e,i,r,n){let o=e.objectMode?1:i.length;e.length+=o;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:i,encoding:r,callback:n}),e.allBuffers&&r!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Io&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(i,r,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}s(Xm,"writeOrBuffer");function Rl(t,e,i,r,n,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new ji("write")):i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}s(Rl,"doWrite");function Ol(t,e,i,r){--e.pendingcb,r(i),Po(e),li(t,i)}s(Ol,"onwriteError");function Jm(t,e){let i=t._writableState,r=i.sync,n=i.writecb;if(typeof n!="function"){li(t,new Wl);return}i.writing=!1,i.writecb=null,i.length-=i.writelen,i.writelen=0,e?(e.stack,i.errored||(i.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),r?xt.nextTick(Ol,t,i,e,n):Ol(t,i,e,n)):(i.buffered.length>i.bufferedIndex&&Co(t,i),r?i.afterWriteTickInfo!==null&&i.afterWriteTickInfo.cb===n?i.afterWriteTickInfo.count++:(i.afterWriteTickInfo={count:1,cb:n,stream:t,state:i},xt.nextTick(Qm,i.afterWriteTickInfo)):$l(t,i,1,n))}s(Jm,"onwrite");function Qm({stream:t,state:e,count:i,cb:r}){return e.afterWriteTickInfo=null,$l(t,e,i,r)}s(Qm,"afterWriteTick");function $l(t,e,i,r){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));i-- >0;)e.pendingcb--,r();e.destroyed&&Po(e),Lo(t,e)}s($l,"afterWrite");function Po(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:a}=t.buffered[n],l=t.objectMode?1:o.length;t.length-=l,a((e=t.errored)!==null&&e!==void 0?e:new ji("write"))}let i=t[ci].splice(0);for(let n=0;n<i.length;n++){var r;i[n]((r=t.errored)!==null&&r!==void 0?r:new ji("end"))}Wr(t)}s(Po,"errorBuffer");function Co(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:i,bufferedIndex:r,objectMode:n}=e,o=i.length-r;if(!o)return;let a=r;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let l=e.allNoop?Io:f=>{for(let d=a;d<i.length;++d)i[d].callback(f)},u=e.allNoop&&a===0?i:Bl(i,a);u.allBuffers=e.allBuffers,Rl(t,e,!0,e.length,u,"",l),Wr(e)}else{do{let{chunk:l,encoding:u,callback:f}=i[a];i[a++]=null;let d=n?1:l.length;Rl(t,e,!1,d,l,u,f)}while(a<i.length&&!e.writing);a===i.length?Wr(e):a>256?(i.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}s(Co,"clearBuffer");B.prototype._write=function(t,e,i){if(this._writev)this._writev([{chunk:t,encoding:e}],i);else throw new Vm("_write()")};B.prototype._writev=null;B.prototype.end=function(t,e,i){let r=this._writableState;typeof t=="function"?(i=t,t=null,e=null):typeof e=="function"&&(i=e,e=null);let n;if(t!=null){let o=jl(this,t,e);o instanceof Om&&(n=o)}return r.corked&&(r.corked=1,this.uncork()),n||(!r.errored&&!r.ending?(r.ending=!0,Lo(this,r,!0),r.ended=!0):r.finished?n=new Hm("end"):r.destroyed&&(n=new ji("end"))),typeof i=="function"&&(n||r.finished?xt.nextTick(i,n):r[ci].push(i)),this};function Ur(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}s(Ur,"needFinish");function Zm(t,e){let i=!1;function r(n){if(i){li(t,n??Wl());return}if(i=!0,e.pendingcb--,n){let o=e[ci].splice(0);for(let a=0;a<o.length;a++)o[a](n);li(t,n,e.sync)}else Ur(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,xt.nextTick(Fo,t,e))}s(r,"onFinish"),e.sync=!0,e.pendingcb++;try{t._final(r)}catch(n){r(n)}e.sync=!1}s(Zm,"callFinal");function eb(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Zm(t,e)):(e.prefinished=!0,t.emit("prefinish")))}s(eb,"prefinish");function Lo(t,e,i){Ur(e)&&(eb(t,e),e.pendingcb===0&&(i?(e.pendingcb++,xt.nextTick((r,n)=>{Ur(n)?Fo(r,n):n.pendingcb--},t,e)):Ur(e)&&(e.pendingcb++,Fo(t,e))))}s(Lo,"finishMaybe");function Fo(t,e){e.pendingcb--,e.finished=!0;let i=e[ci].splice(0);for(let r=0;r<i.length;r++)i[r]();if(t.emit("finish"),e.autoDestroy){let r=t._readableState;(!r||r.autoDestroy&&(r.endEmitted||r.readable===!1))&&t.destroy()}}s(Fo,"finish");Bm(B.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var tb=qr.destroy;B.prototype.destroy=function(t,e){let i=this._writableState;return!i.destroyed&&(i.bufferedIndex<i.buffered.length||i[ci].length)&&xt.nextTick(Po,i),tb.call(this,t,e),this};B.prototype._undestroy=qr.undestroy;B.prototype._destroy=function(t,e){e(t)};B.prototype[Wm.captureRejectionSymbol]=function(t){this.destroy(t)};var To;function zl(){return To===void 0&&(To={}),To}s(zl,"lazyWebStreams");B.fromWeb=function(t,e){return zl().newStreamWritableFromWritableStream(t,e)};B.toWeb=function(t){return zl().newWritableStreamFromStreamWritable(t)}});var sc=N((G_,oc)=>{var Ro=ot(),ib=$e(),{isReadable:rb,isWritable:nb,isIterable:Gl,isNodeStream:ob,isReadableNodeStream:Hl,isWritableNodeStream:Kl,isDuplexNodeStream:sb,isReadableStream:Yl,isWritableStream:Xl}=Be(),Jl=Ge(),{AbortError:rc,codes:{ERR_INVALID_ARG_TYPE:ab,ERR_INVALID_RETURN_VALUE:Ql}}=re(),{destroyer:fi}=St(),lb=Ue(),nc=Wi(),cb=jr(),{createDeferredPromise:Zl}=ee(),ec=wo(),tc=globalThis.Blob||ib.Blob,ub=s(typeof tc<"u"?function(e){return e instanceof tc}:function(e){return!1},"isBlob"),fb=globalThis.AbortController||Zt().AbortController,{FunctionPrototypeCall:ic}=O(),He=class extends lb{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};s(He,"Duplexify");oc.exports=s(function t(e,i){if(sb(e))return e;if(Hl(e))return ui({readable:e});if(Kl(e))return ui({writable:e});if(ob(e))return ui({writable:!1,readable:!1});if(Yl(e))return ui({readable:nc.fromWeb(e)});if(Xl(e))return ui({writable:cb.fromWeb(e)});if(typeof e=="function"){let{value:n,write:o,final:a,destroy:l}=db(e);if(Gl(n))return ec(He,n,{objectMode:!0,write:o,final:a,destroy:l});let u=n?.then;if(typeof u=="function"){let f,d=ic(u,n,h=>{if(h!=null)throw new Ql("nully","body",h)},h=>{fi(f,h)});return f=new He({objectMode:!0,readable:!1,write:o,final(h){a(async()=>{try{await d,Ro.nextTick(h,null)}catch(b){Ro.nextTick(h,b)}})},destroy:l})}throw new Ql("Iterable, AsyncIterable or AsyncFunction",i,n)}if(ub(e))return t(e.arrayBuffer());if(Gl(e))return ec(He,e,{objectMode:!0,writable:!1});if(Yl(e?.readable)&&Xl(e?.writable))return He.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?Hl(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Kl(e?.writable)?e?.writable:t(e.writable):void 0;return ui({readable:n,writable:o})}let r=e?.then;if(typeof r=="function"){let n;return ic(r,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{fi(n,o)}),n=new He({objectMode:!0,writable:!1,read(){}})}throw new ab(i,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)},"duplexify");function db(t){let{promise:e,resolve:i}=Zl(),r=new fb,n=r.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:l,done:u,cb:f}=await a;if(Ro.nextTick(f),u)return;if(n.aborted)throw new rc(void 0,{cause:n.reason});({promise:e,resolve:i}=Zl()),yield l}}(),{signal:n}),write(a,l,u){let f=i;i=null,f({chunk:a,done:!1,cb:u})},final(a){let l=i;i=null,l({done:!0,cb:a})},destroy(a,l){r.abort(),l(a)}}}s(db,"fromAsyncGen");function ui(t){let e=t.readable&&typeof t.readable.read!="function"?nc.wrap(t.readable):t.readable,i=t.writable,r=!!rb(e),n=!!nb(i),o,a,l,u,f;function d(h){let b=u;u=null,b?b(h):h&&f.destroy(h)}return s(d,"onfinished"),f=new He({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(i!=null&&i.writableObjectMode),readable:r,writable:n}),n&&(Jl(i,h=>{n=!1,h&&fi(e,h),d(h)}),f._write=function(h,b,m){i.write(h,b)?m():o=m},f._final=function(h){i.end(),a=h},i.on("drain",function(){if(o){let h=o;o=null,h()}}),i.on("finish",function(){if(a){let h=a;a=null,h()}})),r&&(Jl(e,h=>{r=!1,h&&fi(e,h),d(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let h=e.read();if(h===null){l=f._read;return}if(!f.push(h))return}}),f._destroy=function(h,b){!h&&u!==null&&(h=new rc),l=null,o=null,a=null,u===null?b(h):(u=b,fi(i,h),fi(e,h))},f}s(ui,"_duplexify")});var Ue=N((K_,cc)=>{"use strict";var{ObjectDefineProperties:hb,ObjectGetOwnPropertyDescriptor:Ke,ObjectKeys:pb,ObjectSetPrototypeOf:ac}=O();cc.exports=Ae;var Do=Wi(),we=jr();ac(Ae.prototype,Do.prototype);ac(Ae,Do);{let t=pb(we.prototype);for(let e=0;e<t.length;e++){let i=t[e];Ae.prototype[i]||(Ae.prototype[i]=we.prototype[i])}}function Ae(t){if(!(this instanceof Ae))return new Ae(t);Do.call(this,t),we.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}s(Ae,"Duplex");hb(Ae.prototype,{writable:{__proto__:null,...Ke(we.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ke(we.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ke(we.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ke(we.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ke(we.prototype,"writableLength")},writableFinished:{__proto__:null,...Ke(we.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ke(we.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ke(we.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ke(we.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Oo;function lc(){return Oo===void 0&&(Oo={}),Oo}s(lc,"lazyWebStreams");Ae.fromWeb=function(t,e){return lc().newStreamDuplexFromReadableWritablePair(t,e)};Ae.toWeb=function(t){return lc().newReadableWritablePairFromDuplex(t)};var Bo;Ae.from=function(t){return Bo||(Bo=sc()),Bo(t,"body")}});var Wo=N((X_,fc)=>{"use strict";var{ObjectSetPrototypeOf:uc,Symbol:yb}=O();fc.exports=Ye;var{ERR_METHOD_NOT_IMPLEMENTED:mb}=re().codes,Uo=Ue(),{getHighWaterMark:bb}=Di();uc(Ye.prototype,Uo.prototype);uc(Ye,Uo);var zi=yb("kCallback");function Ye(t){if(!(this instanceof Ye))return new Ye(t);let e=t?bb(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Uo.call(this,t),this._readableState.sync=!1,this[zi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",gb)}s(Ye,"Transform");function Mo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,i)=>{if(e){t?t(e):this.destroy(e);return}i!=null&&this.push(i),this.push(null),t&&t()}):(this.push(null),t&&t())}s(Mo,"final");function gb(){this._final!==Mo&&Mo.call(this)}s(gb,"prefinish");Ye.prototype._final=Mo;Ye.prototype._transform=function(t,e,i){throw new mb("_transform()")};Ye.prototype._write=function(t,e,i){let r=this._readableState,n=this._writableState,o=r.length;this._transform(t,e,(a,l)=>{if(a){i(a);return}l!=null&&this.push(l),n.ended||o===r.length||r.length<r.highWaterMark?i():this[zi]=i})};Ye.prototype._read=function(){if(this[zi]){let t=this[zi];this[zi]=null,t()}}});var jo=N((Q_,hc)=>{"use strict";var{ObjectSetPrototypeOf:dc}=O();hc.exports=di;var qo=Wo();dc(di.prototype,qo.prototype);dc(di,qo);function di(t){if(!(this instanceof di))return new di(t);qo.call(this,t)}s(di,"PassThrough");di.prototype._transform=function(t,e,i){i(null,t)}});var Gr=N((e0,gc)=>{var Vi=ot(),{ArrayIsArray:wb,Promise:Sb,SymbolAsyncIterator:_b,SymbolDispose:Eb}=O(),Vr=Ge(),{once:xb}=ee(),vb=St(),pc=Ue(),{aggregateTwoErrors:Ab,codes:{ERR_INVALID_ARG_TYPE:Jo,ERR_INVALID_RETURN_VALUE:$o,ERR_MISSING_ARGS:kb,ERR_STREAM_DESTROYED:Nb,ERR_STREAM_PREMATURE_CLOSE:Tb},AbortError:Fb}=re(),{validateFunction:Ib,validateAbortSignal:Pb}=ii(),{isIterable:vt,isReadable:zo,isReadableNodeStream:zr,isNodeStream:yc,isTransformStream:hi,isWebStream:Cb,isReadableStream:Vo,isReadableFinished:Lb}=Be(),Rb=globalThis.AbortController||Zt().AbortController,Go,Ho,Ko;function mc(t,e,i){let r=!1;t.on("close",()=>{r=!0});let n=Vr(t,{readable:e,writable:i},o=>{r=!o});return{destroy:o=>{r||(r=!0,vb.destroyer(t,o||new Nb("pipe")))},cleanup:n}}s(mc,"destroyer");function Ob(t){return Ib(t[t.length-1],"streams[stream.length - 1]"),t.pop()}s(Ob,"popCallback");function Yo(t){if(vt(t))return t;if(zr(t))return Bb(t);throw new Jo("val",["Readable","Iterable","AsyncIterable"],t)}s(Yo,"makeAsyncIterable");async function*Bb(t){Ho||(Ho=Wi()),yield*Ho.prototype[_b].call(t)}s(Bb,"fromReadable");async function $r(t,e,i,{end:r}){let n,o=null,a=s(f=>{if(f&&(n=f),o){let d=o;o=null,d()}},"resume"),l=s(()=>new Sb((f,d)=>{n?d(n):o=s(()=>{n?d(n):f()},"onresolve")}),"wait");e.on("drain",a);let u=Vr(e,{readable:!1},a);try{e.writableNeedDrain&&await l();for await(let f of t)e.write(f)||await l();r&&(e.end(),await l()),i()}catch(f){i(n!==f?Ab(n,f):f)}finally{u(),e.off("drain",a)}}s($r,"pumpToNode");async function Xo(t,e,i,{end:r}){hi(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,r&&await n.close(),i()}catch(o){try{await n.abort(o),i(o)}catch(a){i(a)}}}s(Xo,"pumpToWeb");function Db(...t){return bc(t,xb(Ob(t)))}s(Db,"pipeline");function bc(t,e,i){if(t.length===1&&wb(t[0])&&(t=t[0]),t.length<2)throw new kb("streams");let r=new Rb,n=r.signal,o=i?.signal,a=[];Pb(o,"options.signal");function l(){g(new Fb)}s(l,"abort"),Ko=Ko||ee().addAbortListener;let u;o&&(u=Ko(o,l));let f,d,h=[],b=0;function m(D){g(D,--b===0)}s(m,"finish");function g(D,A){var $;if(D&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=D),!(!f&&!A)){for(;h.length;)h.shift()(f);($=u)===null||$===void 0||$[Eb](),r.abort(),A&&(f||a.forEach(lt=>lt()),Vi.nextTick(e,f,d))}}s(g,"finishImpl");let y;for(let D=0;D<t.length;D++){let A=t[D],$=D<t.length-1,lt=D>0,de=$||i?.end!==!1,Ft=D===t.length-1;if(yc(A)){let ne=function(qe){qe&&qe.name!=="AbortError"&&qe.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(qe)};var F=ne;if(s(ne,"onError"),de){let{destroy:qe,cleanup:nn}=mc(A,$,lt);h.push(qe),zo(A)&&Ft&&a.push(nn)}A.on("error",ne),zo(A)&&Ft&&a.push(()=>{A.removeListener("error",ne)})}if(D===0)if(typeof A=="function"){if(y=A({signal:n}),!vt(y))throw new $o("Iterable, AsyncIterable or Stream","source",y)}else vt(A)||zr(A)||hi(A)?y=A:y=pc.from(A);else if(typeof A=="function"){if(hi(y)){var k;y=Yo((k=y)===null||k===void 0?void 0:k.readable)}else y=Yo(y);if(y=A(y,{signal:n}),$){if(!vt(y,!0))throw new $o("AsyncIterable",`transform[${D-1}]`,y)}else{var w;Go||(Go=jo());let ne=new Go({objectMode:!0}),qe=(w=y)===null||w===void 0?void 0:w.then;if(typeof qe=="function")b++,qe.call(y,Qe=>{d=Qe,Qe!=null&&ne.write(Qe),de&&ne.end(),Vi.nextTick(m)},Qe=>{ne.destroy(Qe),Vi.nextTick(m,Qe)});else if(vt(y,!0))b++,$r(y,ne,m,{end:de});else if(Vo(y)||hi(y)){let Qe=y.readable||y;b++,$r(Qe,ne,m,{end:de})}else throw new $o("AsyncIterable or Promise","destination",y);y=ne;let{destroy:nn,cleanup:Hc}=mc(y,!1,!0);h.push(nn),Ft&&a.push(Hc)}}else if(yc(A)){if(zr(y)){b+=2;let ne=Mb(y,A,m,{end:de});zo(A)&&Ft&&a.push(ne)}else if(hi(y)||Vo(y)){let ne=y.readable||y;b++,$r(ne,A,m,{end:de})}else if(vt(y))b++,$r(y,A,m,{end:de});else throw new Jo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else if(Cb(A)){if(zr(y))b++,Xo(Yo(y),A,m,{end:de});else if(Vo(y)||vt(y))b++,Xo(y,A,m,{end:de});else if(hi(y))b++,Xo(y.readable,A,m,{end:de});else throw new Jo("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=A}else y=pc.from(A)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&Vi.nextTick(l),y}s(bc,"pipelineImpl");function Mb(t,e,i,{end:r}){let n=!1;if(e.on("close",()=>{n||i(new Tb)}),t.pipe(e,{end:!1}),r){let a=function(){n=!0,e.end()};var o=a;s(a,"endFn"),Lb(t)?Vi.nextTick(a):t.once("end",a)}else i();return Vr(t,{readable:!0,writable:!1},a=>{let l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",i).once("error",i):i(a)}),Vr(e,{readable:!1,writable:!0},i)}s(Mb,"pipe");gc.exports={pipelineImpl:bc,pipeline:Db}});var Zo=N((i0,vc)=>{"use strict";var{pipeline:Ub}=Gr(),Hr=Ue(),{destroyer:Wb}=St(),{isNodeStream:Kr,isReadable:wc,isWritable:Sc,isWebStream:Qo,isTransformStream:At,isWritableStream:_c,isReadableStream:Ec}=Be(),{AbortError:qb,codes:{ERR_INVALID_ARG_VALUE:xc,ERR_MISSING_ARGS:jb}}=re(),$b=Ge();vc.exports=s(function(...e){if(e.length===0)throw new jb("streams");if(e.length===1)return Hr.from(e[0]);let i=[...e];if(typeof e[0]=="function"&&(e[0]=Hr.from(e[0])),typeof e[e.length-1]=="function"){let m=e.length-1;e[m]=Hr.from(e[m])}for(let m=0;m<e.length;++m)if(!(!Kr(e[m])&&!Qo(e[m]))){if(m<e.length-1&&!(wc(e[m])||Ec(e[m])||At(e[m])))throw new xc(`streams[${m}]`,i[m],"must be readable");if(m>0&&!(Sc(e[m])||_c(e[m])||At(e[m])))throw new xc(`streams[${m}]`,i[m],"must be writable")}let r,n,o,a,l;function u(m){let g=a;a=null,g?g(m):m?l.destroy(m):!b&&!h&&l.destroy()}s(u,"onfinished");let f=e[0],d=Ub(e,u),h=!!(Sc(f)||_c(f)||At(f)),b=!!(wc(d)||Ec(d)||At(d));if(l=new Hr({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:b}),h){if(Kr(f))l._write=function(g,y,k){f.write(g,y)?k():r=k},l._final=function(g){f.end(),n=g},f.on("drain",function(){if(r){let g=r;r=null,g()}});else if(Qo(f)){let y=(At(f)?f.writable:f).getWriter();l._write=async function(k,w,F){try{await y.ready,y.write(k).catch(()=>{}),F()}catch(D){F(D)}},l._final=async function(k){try{await y.ready,y.close().catch(()=>{}),n=k}catch(w){k(w)}}}let m=At(d)?d.readable:d;$b(m,()=>{if(n){let g=n;n=null,g()}})}if(b){if(Kr(d))d.on("readable",function(){if(o){let m=o;o=null,m()}}),d.on("end",function(){l.push(null)}),l._read=function(){for(;;){let m=d.read();if(m===null){o=l._read;return}if(!l.push(m))return}};else if(Qo(d)){let g=(At(d)?d.readable:d).getReader();l._read=async function(){for(;;)try{let{value:y,done:k}=await g.read();if(!l.push(y))return;if(k){l.push(null);return}}catch{return}}}}return l._destroy=function(m,g){!m&&a!==null&&(m=new qb),o=null,r=null,n=null,a===null?g(m):(a=g,Kr(d)&&Wb(d,m))},l},"compose")});var Rc=N((n0,ts)=>{"use strict";var zb=globalThis.AbortController||Zt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Vb,ERR_INVALID_ARG_TYPE:Gi,ERR_MISSING_ARGS:Gb,ERR_OUT_OF_RANGE:Hb},AbortError:We}=re(),{validateAbortSignal:kt,validateInteger:Ac,validateObject:Nt}=ii(),Kb=O().Symbol("kWeak"),Yb=O().Symbol("kResistStopPropagation"),{finished:Xb}=Ge(),Jb=Zo(),{addAbortSignalNoValidate:Qb}=Bi(),{isWritable:Zb,isNodeStream:eg}=Be(),{deprecate:tg}=ee(),{ArrayPrototypePush:ig,Boolean:rg,MathFloor:kc,Number:ng,NumberIsNaN:og,Promise:Nc,PromiseReject:Tc,PromiseResolve:sg,PromisePrototypeThen:Fc,Symbol:Pc}=O(),Xr=Pc("kEmpty"),Ic=Pc("kEof");function ag(t,e){if(e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),eg(t)&&!Zb(t))throw new Vb("stream",t,"must be writable");let i=Jb(this,t);return e!=null&&e.signal&&Qb(e.signal,i),i}s(ag,"compose");function Jr(t,e){if(typeof t!="function")throw new Gi("fn",["Function","AsyncFunction"],t);e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal");let i=1;e?.concurrency!=null&&(i=kc(e.concurrency));let r=i-1;return e?.highWaterMark!=null&&(r=kc(e.highWaterMark)),Ac(i,"options.concurrency",1),Ac(r,"options.highWaterMark",0),r+=i,s(async function*(){let o=ee().AbortSignalAny([e?.signal].filter(rg)),a=this,l=[],u={signal:o},f,d,h=!1,b=0;function m(){h=!0,g()}s(m,"onCatch");function g(){b-=1,y()}s(g,"afterItemProcessed");function y(){d&&!h&&b<i&&l.length<r&&(d(),d=null)}s(y,"maybeResume");async function k(){try{for await(let w of a){if(h)return;if(o.aborted)throw new We;try{if(w=t(w,u),w===Xr)continue;w=sg(w)}catch(F){w=Tc(F)}b+=1,Fc(w,g,m),l.push(w),f&&(f(),f=null),!h&&(l.length>=r||b>=i)&&await new Nc(F=>{d=F})}l.push(Ic)}catch(w){let F=Tc(w);Fc(F,g,m),l.push(F)}finally{h=!0,f&&(f(),f=null)}}s(k,"pump"),k();try{for(;;){for(;l.length>0;){let w=await l[0];if(w===Ic)return;if(o.aborted)throw new We;w!==Xr&&(yield w),l.shift(),y()}await new Nc(w=>{f=w})}}finally{h=!0,d&&(d(),d=null)}},"map").call(this)}s(Jr,"map");function lg(t=void 0){return t!=null&&Nt(t,"options"),t?.signal!=null&&kt(t.signal,"options.signal"),s(async function*(){let i=0;for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new We({cause:t.signal.reason});yield[i++,n]}},"asIndexedPairs").call(this)}s(lg,"asIndexedPairs");async function Cc(t,e=void 0){for await(let i of es.call(this,t,e))return!0;return!1}s(Cc,"some");async function cg(t,e=void 0){if(typeof t!="function")throw new Gi("fn",["Function","AsyncFunction"],t);return!await Cc.call(this,async(...i)=>!await t(...i),e)}s(cg,"every");async function ug(t,e){for await(let i of es.call(this,t,e))return i}s(ug,"find");async function fg(t,e){if(typeof t!="function")throw new Gi("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n),Xr}s(i,"forEachFn");for await(let r of Jr.call(this,i,e));}s(fg,"forEach");function es(t,e){if(typeof t!="function")throw new Gi("fn",["Function","AsyncFunction"],t);async function i(r,n){return await t(r,n)?r:Xr}return s(i,"filterFn"),Jr.call(this,i,e)}s(es,"filter");var Yr=class extends Gb{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};s(Yr,"ReduceAwareErrMissingArgs");async function dg(t,e,i){var r;if(typeof t!="function")throw new Gi("reducer",["Function","AsyncFunction"],t);i!=null&&Nt(i,"options"),i?.signal!=null&&kt(i.signal,"options.signal");let n=arguments.length>1;if(i!=null&&(r=i.signal)!==null&&r!==void 0&&r.aborted){let f=new We(void 0,{cause:i.signal.reason});throw this.once("error",()=>{}),await Xb(this.destroy(f)),f}let o=new zb,a=o.signal;if(i!=null&&i.signal){let f={once:!0,[Kb]:this,[Yb]:!0};i.signal.addEventListener("abort",()=>o.abort(),f)}let l=!1;try{for await(let f of this){var u;if(l=!0,i!=null&&(u=i.signal)!==null&&u!==void 0&&u.aborted)throw new We;n?e=await t(e,f,{signal:a}):(e=f,n=!0)}if(!l&&!n)throw new Yr}finally{o.abort()}return e}s(dg,"reduce");async function hg(t){t!=null&&Nt(t,"options"),t?.signal!=null&&kt(t.signal,"options.signal");let e=[];for await(let r of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new We(void 0,{cause:t.signal.reason});ig(e,r)}return e}s(hg,"toArray");function pg(t,e){let i=Jr.call(this,t,e);return s(async function*(){for await(let n of i)yield*n},"flatMap").call(this)}s(pg,"flatMap");function Lc(t){if(t=ng(t),og(t))return 0;if(t<0)throw new Hb("number",">= 0",t);return t}s(Lc,"toIntegerOrInfinity");function yg(t,e=void 0){return e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),t=Lc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new We;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new We;t--<=0&&(yield o)}},"drop").call(this)}s(yg,"drop");function mg(t,e=void 0){return e!=null&&Nt(e,"options"),e?.signal!=null&&kt(e.signal,"options.signal"),t=Lc(t),s(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new We;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new We;if(t-- >0&&(yield o),t<=0)return}},"take").call(this)}s(mg,"take");ts.exports.streamReturningOperators={asIndexedPairs:tg(lg,"readable.asIndexedPairs will be removed in a future version."),drop:yg,filter:es,flatMap:pg,map:Jr,take:mg,compose:ag};ts.exports.promiseReturningOperators={every:cg,forEach:fg,reduce:dg,toArray:hg,some:Cc,find:ug}});var is=N((s0,Oc)=>{"use strict";var{ArrayPrototypePop:bg,Promise:gg}=O(),{isIterable:wg,isNodeStream:Sg,isWebStream:_g}=Be(),{pipelineImpl:Eg}=Gr(),{finished:xg}=Ge();rs();function vg(...t){return new gg((e,i)=>{let r,n,o=t[t.length-1];if(o&&typeof o=="object"&&!Sg(o)&&!wg(o)&&!_g(o)){let a=bg(t);r=a.signal,n=a.end}Eg(t,(a,l)=>{a?i(a):e(l)},{signal:r,end:n})})}s(vg,"pipeline");Oc.exports={finished:xg,pipeline:vg}});var rs=N((l0,zc)=>{var{Buffer:Ag}=$e(),{ObjectDefineProperty:Xe,ObjectKeys:Mc,ReflectApply:Uc}=O(),{promisify:{custom:Wc}}=ee(),{streamReturningOperators:Bc,promiseReturningOperators:Dc}=Rc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:qc}}=re(),kg=Zo(),{setDefaultHighWaterMark:Ng,getDefaultHighWaterMark:Tg}=Di(),{pipeline:jc}=Gr(),{destroyer:Fg}=St(),$c=Ge(),ns=is(),Hi=Be(),C=zc.exports=Fr().Stream;C.isDestroyed=Hi.isDestroyed;C.isDisturbed=Hi.isDisturbed;C.isErrored=Hi.isErrored;C.isReadable=Hi.isReadable;C.isWritable=Hi.isWritable;C.Readable=Wi();for(let t of Mc(Bc)){let i=function(...r){if(new.target)throw qc();return C.Readable.from(Uc(e,this,r))};Pg=i,s(i,"fn");let e=Bc[t];Xe(i,"name",{__proto__:null,value:e.name}),Xe(i,"length",{__proto__:null,value:e.length}),Xe(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Pg;for(let t of Mc(Dc)){let i=function(...n){if(new.target)throw qc();return Uc(e,this,n)};Pg=i,s(i,"fn");let e=Dc[t];Xe(i,"name",{__proto__:null,value:e.name}),Xe(i,"length",{__proto__:null,value:e.length}),Xe(C.Readable.prototype,t,{__proto__:null,value:i,enumerable:!1,configurable:!0,writable:!0})}var Pg;C.Writable=jr();C.Duplex=Ue();C.Transform=Wo();C.PassThrough=jo();C.pipeline=jc;var{addAbortSignal:Ig}=Bi();C.addAbortSignal=Ig;C.finished=$c;C.destroy=Fg;C.compose=kg;C.setDefaultHighWaterMark=Ng;C.getDefaultHighWaterMark=Tg;Xe(C,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return ns}});Xe(jc,Wc,{__proto__:null,enumerable:!0,get(){return ns.pipeline}});Xe($c,Wc,{__proto__:null,enumerable:!0,get(){return ns.finished}});C.Stream=C;C._isUint8Array=s(function(e){return e instanceof Uint8Array},"isUint8Array");C._uint8ArrayToBuffer=s(function(e){return Ag.from(e.buffer,e.byteOffset,e.byteLength)},"_uint8ArrayToBuffer")});var Vc=N((u0,j)=>{"use strict";var G=rs(),Cg=is(),Lg=G.Readable.destroy;j.exports=G.Readable;j.exports._uint8ArrayToBuffer=G._uint8ArrayToBuffer;j.exports._isUint8Array=G._isUint8Array;j.exports.isDisturbed=G.isDisturbed;j.exports.isErrored=G.isErrored;j.exports.isReadable=G.isReadable;j.exports.Readable=G.Readable;j.exports.Writable=G.Writable;j.exports.Duplex=G.Duplex;j.exports.Transform=G.Transform;j.exports.PassThrough=G.PassThrough;j.exports.addAbortSignal=G.addAbortSignal;j.exports.finished=G.finished;j.exports.destroy=G.destroy;j.exports.destroy=Lg;j.exports.pipeline=G.pipeline;j.exports.compose=G.compose;Object.defineProperty(G,"promises",{configurable:!0,enumerable:!0,get(){return Cg}});j.exports.Stream=G.Stream;j.exports.default=j.exports});var Bg={};Xi(Bg,{ActionType:()=>tr,ApiError:()=>c,Async:()=>wi,AsyncFile:()=>Bt,AsyncFileIndexFS:()=>rn,AsyncMirror:()=>Gu,AsyncMirrorFS:()=>ft,AsyncStoreFS:()=>rr,BigIntStats:()=>J,Cred:()=>z,ErrorCode:()=>Y,ErrorStrings:()=>on,File:()=>vi,FileFlag:()=>I,FileIndex:()=>Tt,FileIndexFS:()=>yi,FileSystem:()=>X,FileType:()=>U,InMemory:()=>un,InMemoryStore:()=>Ni,IndexDirInode:()=>Je,IndexFileInode:()=>Yi,IndexInode:()=>pi,Inode:()=>pe,LockedFS:()=>Wt,MirrorFile:()=>Ai,Mutex:()=>Ut,NoSyncFile:()=>ut,Overlay:()=>Hu,OverlayFS:()=>jt,OverlayFile:()=>qt,PreloadFile:()=>se,Readonly:()=>ln,SimpleSyncRWTransaction:()=>Dt,Stats:()=>M,StatsCommon:()=>Rt,Sync:()=>ct,SyncFile:()=>er,SyncFileIndexFS:()=>tn,SyncStoreFS:()=>Mt,SyncStoreFile:()=>ki,UnlockedOverlayFS:()=>Ti,checkOptions:()=>an,configure:()=>Rg,createBackend:()=>su,decode:()=>Z,decodeDirListing:()=>bi,default:()=>Og,encode:()=>R,encodeDirListing:()=>le,fs:()=>Ki,initialize:()=>Gc,isBackend:()=>gi,isBackendConfig:()=>cs,isBlockDevice:()=>$u,isCharacterDevice:()=>zu,isDirectory:()=>Wu,isFIFO:()=>Vu,isFile:()=>Uu,isSocket:()=>ju,isSymbolicLink:()=>qu,levenshtein:()=>sn,mkdirpSync:()=>ls,randomIno:()=>Ot,resolveBackendConfig:()=>Qi,rootIno:()=>ye,setImmediate:()=>ou,size_max:()=>Zi,wait:()=>nu});var Y=(y=>(y[y.EPERM=1]="EPERM",y[y.ENOENT=2]="ENOENT",y[y.EIO=5]="EIO",y[y.EBADF=9]="EBADF",y[y.EACCES=13]="EACCES",y[y.EBUSY=16]="EBUSY",y[y.EEXIST=17]="EEXIST",y[y.ENOTDIR=20]="ENOTDIR",y[y.EISDIR=21]="EISDIR",y[y.EINVAL=22]="EINVAL",y[y.EFBIG=27]="EFBIG",y[y.ENOSPC=28]="ENOSPC",y[y.EROFS=30]="EROFS",y[y.ENOTEMPTY=39]="ENOTEMPTY",y[y.ENOTSUP=95]="ENOTSUP",y))(Y||{}),on={[1]:"Operation not permitted.",[2]:"No such file or directory.",[5]:"Input/output error.",[9]:"Bad file descriptor.",[13]:"Permission denied.",[16]:"Resource busy or locked.",[17]:"File exists.",[20]:"File is not a directory.",[21]:"File is a directory.",[22]:"Invalid argument.",[27]:"File is too big.",[28]:"No space left on disk.",[30]:"Cannot modify a read-only file system.",[39]:"Directory is not empty.",[95]:"Operation is not supported."},c=class extends Error{constructor(i,r=on[i],n){super(r);this.errno=i;this.path=n;this.code=Y[i],this.message=`${this.code}: ${r}${this.path?`, '${this.path}'`:""}`}static fromJSON(i){let r=new c(i.errno,i.message,i.path);return r.code=i.code,r.stack=i.stack,r}static OnPath(i,r){return new c(i,on[i],r)}static EACCES(i){return this.OnPath(13,i)}static ENOENT(i){return this.OnPath(2,i)}static EEXIST(i){return this.OnPath(17,i)}static EISDIR(i){return this.OnPath(21,i)}static ENOTDIR(i){return this.OnPath(20,i)}static EPERM(i){return this.OnPath(1,i)}static ENOTEMPTY(i){return this.OnPath(39,i)}code;syscall="";stack;toString(){return this.message}toJSON(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}}bufferSize(){return 4+JSON.stringify(this.toJSON()).length}};s(c,"ApiError");var iu="/",ss="/";function Pt(t,e){if(typeof t!="string")throw new TypeError(`"${e}" is not a string`)}s(Pt,"validateString");function as(t,e){let i="",r=0,n=-1,o=0,a="\0";for(let l=0;l<=t.length;++l){if(l<t.length)a=t[l];else{if(a=="/")break;a="/"}if(a=="/"){if(!(n===l-1||o===1))if(o===2){if(i.length<2||r!==2||i.at(-1)!=="."||i.at(-2)!=="."){if(i.length>2){let u=i.lastIndexOf("/");u===-1?(i="",r=0):(i=i.slice(0,u),r=i.length-1-i.lastIndexOf("/")),n=l,o=0;continue}else if(i.length!==0){i="",r=0,n=l,o=0;continue}}e&&(i+=i.length>0?"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(n+1,l):i=t.slice(n+1,l),r=l-n-1;n=l,o=0}else a==="."&&o!==-1?++o:o=-1}return i}s(as,"normalizeString");function ke(...t){let e="",i=!1;for(let r=t.length-1;r>=-1&&!i;r--){let n=r>=0?t[r]:iu;Pt(n,`paths[${r}]`),n.length!==0&&(e=`${n}/${e}`,i=n[0]==="/")}return e=as(e,!i),i?`/${e}`:e.length>0?e:"."}s(ke,"resolve");function ru(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=t.at(-1)==="/";return t=as(t,!e),t.length===0?e?"/":i?"./":".":(i&&(t+="/"),e?`/${t}`:t)}s(ru,"normalize");function he(...t){if(t.length===0)return".";let e;for(let i=0;i<t.length;++i){let r=t[i];Pt(r,"path"),r.length>0&&(e===void 0?e=r:e+=`/${r}`)}return e===void 0?".":ru(e)}s(he,"join");function E(t){if(Pt(t,"path"),t.length===0)return".";let e=t[0]==="/",i=-1,r=!0;for(let n=t.length-1;n>=1;--n)if(t[n]==="/"){if(!r){i=n;break}}else r=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)}s(E,"dirname");function L(t,e){e!==void 0&&Pt(e,"ext"),Pt(t,"path");let i=0,r=-1,n=!0;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(let l=t.length-1;l>=0;--l)if(t[l]==="/"){if(!n){i=l+1;break}}else a===-1&&(n=!1,a=l+1),o>=0&&(t[l]===e[o]?--o===-1&&(r=l):(o=-1,r=a));return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(let o=t.length-1;o>=0;--o)if(t[o]==="/"){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":t.slice(i,r)}s(L,"basename");function ls(t,e,i,r){r.existsSync(t,i)||(ls(E(t),e,i,r),r.mkdirSync(t,e,i))}s(ls,"mkdirpSync");function Ji(t,e,i,r,n){return Math.min(t+1,e+1,i+1,r===n?e:e+1)}s(Ji,"_min");function sn(t,e){if(t===e)return 0;t.length>e.length&&([t,e]=[e,t]);let i=t.length,r=e.length;for(;i>0&&t.charCodeAt(i-1)===e.charCodeAt(r-1);)i--,r--;let n=0;for(;n<i&&t.charCodeAt(n)===e.charCodeAt(n);)n++;if(i-=n,r-=n,i===0||r===1)return r;let o=new Array(i<<1);for(let b=0;b<i;)o[i+b]=t.charCodeAt(n+b),o[b]=++b;let a,l,u,f,d;for(a=0;a+3<r;){let b=e.charCodeAt(n+(l=a)),m=e.charCodeAt(n+(u=a+1)),g=e.charCodeAt(n+(f=a+2)),y=e.charCodeAt(n+(d=a+3)),k=a+=4;for(let w=0;w<i;){let F=o[i+w],D=o[w];l=Ji(D,l,u,b,F),u=Ji(l,u,f,m,F),f=Ji(u,f,d,g,F),k=Ji(f,d,k,y,F),o[w++]=k,d=f,f=u,u=l,l=D}}let h=0;for(;a<r;){let b=e.charCodeAt(n+(l=a));h=++a;for(let m=0;m<i;m++){let g=o[m];o[m]=h=g<l||h<l?g>h?h+1:g+1:b===o[i+m]?l:l+1,l=g}}return h}s(sn,"levenshtein");function nu(t){return new Promise(e=>{setTimeout(e,t)})}s(nu,"wait");var ou=typeof globalThis.setImmediate=="function"?globalThis.setImmediate:t=>setTimeout(t,0);function R(t,e="utf8"){if(typeof t!="string")throw new c(22,"Can not encode a non-string");switch(e){case"ascii":case"latin1":case"binary":return new Uint8Array(Array.from(t).map(r=>r.charCodeAt(0)));case"utf8":case"utf-8":return new Uint8Array(Array.from(t).flatMap(r=>{let n=r.charCodeAt(0);if(n<128)return n;let o=n&63|128;if(n<2048)return[n>>6|192,o];let a=n>>6&63|128;return n<65536?[n>>12|224,a,o]:[n>>18|240,n>>12&63|128,a,o]}));case"base64":return R(atob(t),"utf-8");case"base64url":return R(t.replace("_","/").replace("-","+"),"base64");case"hex":return new Uint8Array(t.match(/.{1,2}/g).map(r=>parseInt(r,16)));case"utf16le":case"ucs2":case"ucs-2":let i=new Uint16Array(new ArrayBuffer(t.length*2));for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return new Uint8Array(i.buffer);default:throw new c(22,"Invalid encoding: "+e)}}s(R,"encode");function Z(t,e="utf8"){if(!(t instanceof Uint8Array))throw new c(22,"Can not decode a non-Uint8Array");switch(e){case"ascii":case"latin1":case"binary":return Array.from(t).map(n=>String.fromCharCode(n)).join("");case"utf8":case"utf-8":let i="";for(let n=0;n<t.length;n++){let o;t[n]<128?o=t[n]:t[n]<224?o=(t[n]&31)<<6|t[++n]&63:t[n]<240?o=(t[n]&15)<<12|(t[++n]&63)<<6|t[++n]&63:o=(t[n]&7)<<18|(t[++n]&63)<<12|(t[++n]&63)<<6|t[++n]&63,i+=String.fromCharCode(o)}return i;case"utf16le":case"ucs2":case"ucs-2":let r="";for(let n=0;n<t.length;n+=2){let o=t[n]|t[n+1]<<8;r+=String.fromCharCode(o)}return r;case"base64":return btoa(Z(t,"utf-8"));case"base64url":return Z(t,"base64").replace("/","_").replace("+","-");case"hex":return Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("");default:throw new c(22,"Invalid encoding: "+e)}}s(Z,"decode");function bi(t){return JSON.parse(Z(t),(e,i)=>e==""?i:BigInt(i))}s(bi,"decodeDirListing");function le(t){return R(JSON.stringify(t,(e,i)=>e==""?i:i.toString()))}s(le,"encodeDirListing");function gi(t){return t!=null&&typeof t=="object"&&"isAvailable"in t&&typeof t.isAvailable=="function"&&"create"in t&&typeof t.create=="function"}s(gi,"isBackend");async function an(t,e){if(typeof e!="object"||e===null)throw new c(22,"Invalid options");for(let[i,r]of Object.entries(t.options)){let n=e?.[i];if(n==null){if(!r.required)continue;let a=Object.keys(e).filter(l=>!(l in t.options)).map(l=>({str:l,distance:sn(i,l)})).filter(l=>l.distance<5).sort((l,u)=>l.distance-u.distance);throw new c(22,`${t.name}: Required option '${i}' not provided.${a.length>0?` You provided '${a[0].str}', did you mean '${i}'.`:""}`)}if(!(Array.isArray(r.type)?r.type.indexOf(typeof n)!=-1:typeof n==r.type))throw new c(22,`${t.name}: Value provided for option ${i} is not the proper type. Expected ${Array.isArray(r.type)?`one of {${r.type.join(", ")}}`:r.type}, but received ${typeof n}`);r.validator&&await r.validator(n)}}s(an,"checkOptions");function su(t,e){return an(t,e),t.create(e).ready()}s(su,"createBackend");function cs(t){return t!=null&&typeof t=="object"&&"backend"in t}s(cs,"isBackendConfig");async function Qi(t){if(typeof t!="object"||t==null)throw new c(22,"Invalid options on configuration object.");let{backend:e}=t;if(!gi(e))throw new c(22,"Missing or invalid backend");let i=Object.keys(t).filter(n=>n!="backend");for(let n of i){let o=t[n];gi(o)&&(o={backend:o}),cs(o)&&(t[n]=await Qi(o))}if(!await e.isAvailable())throw new c(1,"Backend not available: "+e);an(e,t);let r=e.create(t);return await r.ready(),r}s(Qi,"resolveBackendConfig");var X=class{metadata(){return{name:this.constructor.name,readonly:!1,synchronous:!1,supportsProperties:!1,totalSpace:0,freeSpace:0}}constructor(e){}async exists(e,i){try{return await this.stat(e,i),!0}catch{return!1}}existsSync(e,i){try{return this.statSync(e,i),!0}catch{return!1}}};s(X,"FileSystem");function ct(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!0}}async ready(){return this}async exists(r,n){return this.existsSync(r,n)}async rename(r,n,o){return this.renameSync(r,n,o)}async stat(r,n){return this.statSync(r,n)}async createFile(r,n,o,a){return this.createFileSync(r,n,o,a)}async openFile(r,n,o){return this.openFileSync(r,n,o)}async unlink(r,n){return this.unlinkSync(r,n)}async rmdir(r,n){return this.rmdirSync(r,n)}async mkdir(r,n,o){return this.mkdirSync(r,n,o)}async readdir(r,n){return this.readdirSync(r,n)}async link(r,n,o){return this.linkSync(r,n,o)}async sync(r,n,o){return this.syncSync(r,n,o)}}return s(e,"_SyncFileSystem"),e}s(ct,"Sync");function wi(t){class e extends t{metadata(){return{...super.metadata(),synchronous:!1}}renameSync(r,n,o){throw new c(95)}statSync(r,n){throw new c(95)}createFileSync(r,n,o,a){throw new c(95)}openFileSync(r,n,o){throw new c(95)}unlinkSync(r,n){throw new c(95)}rmdirSync(r,n){throw new c(95)}mkdirSync(r,n,o){throw new c(95)}readdirSync(r,n){throw new c(95)}linkSync(r,n,o){throw new c(95)}syncSync(r,n,o){throw new c(95)}}return s(e,"_AsyncFileSystem"),e}s(wi,"Async");function ln(t){class e extends t{metadata(){return{...super.metadata(),readonly:!0}}async rename(r,n,o){throw new c(30)}renameSync(r,n,o){throw new c(30)}async createFile(r,n,o,a){throw new c(30)}createFileSync(r,n,o,a){throw new c(30)}async unlink(r,n){throw new c(30)}unlinkSync(r,n){throw new c(30)}async rmdir(r,n){throw new c(30)}rmdirSync(r,n){throw new c(30)}async mkdir(r,n,o){throw new c(30)}mkdirSync(r,n,o){throw new c(30)}async link(r,n,o){throw new c(30)}linkSync(r,n,o){throw new c(30)}async sync(r,n,o){throw new c(30)}syncSync(r,n,o){throw new c(30)}}return s(e,"_ReadonlyFileSystem"),e}s(ln,"Readonly");var xi={};Xi(xi,{COPYFILE_EXCL:()=>cu,COPYFILE_FICLONE:()=>uu,COPYFILE_FICLONE_FORCE:()=>fu,F_OK:()=>au,O_APPEND:()=>Ie,O_CREAT:()=>H,O_DIRECT:()=>gu,O_DIRECTORY:()=>hu,O_DSYNC:()=>mu,O_EXCL:()=>Te,O_NOATIME:()=>pu,O_NOCTTY:()=>du,O_NOFOLLOW:()=>yu,O_NONBLOCK:()=>wu,O_RDONLY:()=>Ct,O_RDWR:()=>oe,O_SYMLINK:()=>bu,O_SYNC:()=>Lt,O_TRUNC:()=>Fe,O_WRONLY:()=>Ne,R_OK:()=>Se,S_IFBLK:()=>_u,S_IFCHR:()=>Eu,S_IFDIR:()=>Ei,S_IFIFO:()=>xu,S_IFLNK:()=>Si,S_IFMT:()=>ie,S_IFREG:()=>_i,S_IFSOCK:()=>Su,S_IRGRP:()=>Cu,S_IROTH:()=>Bu,S_IRUSR:()=>Tu,S_IRWXG:()=>Pu,S_IRWXO:()=>Ou,S_IRWXU:()=>Nu,S_ISGID:()=>Au,S_ISUID:()=>vu,S_ISVTX:()=>ku,S_IWGRP:()=>Lu,S_IWOTH:()=>Du,S_IWUSR:()=>Fu,S_IXGRP:()=>Ru,S_IXOTH:()=>Mu,S_IXUSR:()=>Iu,W_OK:()=>ce,X_OK:()=>lu});var au=0,Se=4,ce=2,lu=1,cu=1,uu=2,fu=4,Ct=0,Ne=1,oe=2,H=64,Te=128,du=256,Fe=512,Ie=1024,hu=65536,pu=262144,yu=131072,Lt=1052672,mu=4096,bu=32768,gu=16384,wu=2048,ie=61440,Su=49152,Si=40960,_i=32768,_u=24576,Ei=16384,Eu=8192,xu=4096,vu=2048,Au=1024,ku=512,Nu=448,Tu=256,Fu=128,Iu=64,Pu=56,Cu=32,Lu=16,Ru=8,Ou=7,Bu=4,Du=2,Mu=1;var cn=class{constructor(e,i,r,n,o,a){this.uid=e;this.gid=i;this.suid=r;this.sgid=n;this.euid=o;this.egid=a}},z=cn;s(z,"Cred"),mi(z,"Root",new cn(0,0,0,0,0,0));var U=(r=>(r[r.FILE=32768]="FILE",r[r.DIRECTORY=16384]="DIRECTORY",r[r.SYMLINK=40960]="SYMLINK",r))(U||{}),Rt=class{get _typename(){return this._isBigint?"bigint":"number"}get _typename_inverse(){return this._isBigint?"number":"bigint"}_convert(e){return this._isBigint?BigInt(e):Number(e)}blocks;mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);fileData=null;atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}size;constructor({atimeMs:e,mtimeMs:i,ctimeMs:r,birthtimeMs:n,uid:o,gid:a,size:l,mode:u}={}){let f=Date.now(),d=s((b,m)=>typeof b==this._typename?b:this._convert(typeof b==this._typename_inverse?b:m),"resolveT");this.atimeMs=d(e,f),this.mtimeMs=d(i,f),this.ctimeMs=d(r,f),this.birthtimeMs=d(n,f),this.uid=d(o,0),this.gid=d(a,0),this.size=this._convert(l);let h=Number(u)&61440||U.FILE;if(u)this.mode=this._convert(u);else switch(h){case U.FILE:this.mode=this._convert(420);break;case U.DIRECTORY:default:this.mode=this._convert(511)}this.blocks=this._convert(Math.ceil(Number(l)/512)),this.mode&61440||(this.mode=this.mode|this._convert(h))}isFile(){return(this.mode&61440)===32768}isDirectory(){return(this.mode&61440)===16384}isSymbolicLink(){return(this.mode&61440)===40960}isSocket(){return!1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isFIFO(){return!1}hasAccess(e,i){if(i.euid===0||i.egid===0)return!0;let r=this.mode&-61441,n=15,o=15,a=15;if(i.euid==this.uid){let f=(3840&r)>>8;n=(e^f)&e}if(i.egid==this.gid){let f=(240&r)>>4;o=(e^f)&e}let l=15&r;return a=(e^l)&e,!(n&o&a)}getCred(e=Number(this.uid),i=Number(this.gid)){return new z(e,i,Number(this.uid),Number(this.gid),e,i)}chmod(e){this.mode=this._convert(this.mode&61440|e)}chown(e,i){e=Number(e),i=Number(i),!isNaN(e)&&0<=e&&e<2**32&&(this.uid=this._convert(e)),!isNaN(i)&&0<=i&&i<2**32&&(this.gid=this._convert(i))}};s(Rt,"StatsCommon");var M=class extends Rt{_isBigint=!1;static clone(e){return new M(e)}};s(M,"Stats");var J=class extends Rt{_isBigint=!0;atimeNs;mtimeNs;ctimeNs;birthtimeNs;static clone(e){return new J(e)}};s(J,"BigIntStats");function Uu(t){return(Number(t.mode)&61440)===32768}s(Uu,"isFile");function Wu(t){return(Number(t.mode)&61440)===16384}s(Wu,"isDirectory");function qu(t){return(Number(t.mode)&61440)===40960}s(qu,"isSymbolicLink");function ju(){return!1}s(ju,"isSocket");function $u(){return!1}s($u,"isBlockDevice");function zu(){return!1}s(zu,"isCharacterDevice");function Vu(){return!1}s(Vu,"isFIFO");var Zi=2**32-1,ye=0n;function us(){return Math.round(Math.random()*2**32).toString(16)}s(us,"_random");function Ot(){return BigInt("0x"+us()+us())}s(Ot,"randomIno");var pe=class{buffer;get data(){return new Uint8Array(this.buffer)}view;constructor(e){let i=!e;if(e??=new ArrayBuffer(58),e?.byteLength<58)throw new RangeError("Can not create an inode from a buffer less than 58 bytes");if(this.view=new DataView(e),this.buffer=e,!i)return;this.ino=Ot(),this.nlink=1,this.size=4096;let r=Date.now();this.atimeMs=r,this.mtimeMs=r,this.ctimeMs=r,this.birthtimeMs=r}get ino(){return this.view.getBigUint64(0,!0)}set ino(e){this.view.setBigUint64(0,e,!0)}get size(){return this.view.getUint32(8,!0)}set size(e){this.view.setUint32(8,e,!0)}get mode(){return this.view.getUint16(12,!0)}set mode(e){this.view.setUint16(12,e,!0)}get nlink(){return this.view.getUint32(14,!0)}set nlink(e){this.view.setUint32(14,e,!0)}get uid(){return this.view.getUint32(18,!0)}set uid(e){this.view.setUint32(18,e,!0)}get gid(){return this.view.getUint32(22,!0)}set gid(e){this.view.setUint32(22,e,!0)}get atimeMs(){return this.view.getFloat64(26,!0)}set atimeMs(e){this.view.setFloat64(26,e,!0)}get birthtimeMs(){return this.view.getFloat64(34,!0)}set birthtimeMs(e){this.view.setFloat64(34,e,!0)}get mtimeMs(){return this.view.getFloat64(42,!0)}set mtimeMs(e){this.view.setFloat64(42,e,!0)}get ctimeMs(){return this.view.getFloat64(50,!0)}set ctimeMs(e){this.view.setFloat64(50,e,!0)}toStats(){return new M(this)}update(e){let i=!1;return this.size!==e.size&&(this.size=e.size,i=!0),this.mode!==e.mode&&(this.mode=e.mode,i=!0),this.nlink!==e.nlink&&(this.nlink=e.nlink,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.uid!==e.uid&&(this.uid=e.uid,i=!0),this.atimeMs!==e.atimeMs&&(this.atimeMs=e.atimeMs,i=!0),this.mtimeMs!==e.mtimeMs&&(this.mtimeMs=e.mtimeMs,i=!0),this.ctimeMs!==e.ctimeMs&&(this.ctimeMs=e.ctimeMs,i=!0),i}};s(pe,"Inode");var tr=(n=>(n[n.NOP=0]="NOP",n[n.THROW=1]="THROW",n[n.TRUNCATE=2]="TRUNCATE",n[n.CREATE=3]="CREATE",n))(tr||{}),Ze=class{static Get(e){return Ze.cache.has(e)||Ze.cache.set(e,new Ze(e)),Ze.cache.get(e)}_flag;constructor(e){if(typeof e=="number"&&(e=Ze.StringOf(e)),!Ze.validStrings.includes(e))throw new c(22,"Invalid flag string: "+e);this._flag=e}static StringOf(e){switch(e){case 0:return"r";case 1052672:return"rs";case 2:return"r+";case 1052674:return"rs+";case 577:return"w";case 705:return"wx";case 578:return"w+";case 706:return"wx+";case 1089:return"a";case 1217:return"ax";case 1090:return"a+";case 1218:return"ax+";default:throw new c(22,"Invalid flag number: "+e)}}static NumberOf(e){switch(e){case"r":return 0;case"rs":return 1052672;case"r+":return 2;case"rs+":return 1052674;case"w":return 577;case"wx":return 705;case"w+":return 578;case"wx+":return 706;case"a":return 1089;case"ax":return 1217;case"a+":return 1090;case"ax+":return 1218;default:throw new c(22,"Invalid flag string: "+e)}}toString(){return this._flag}get mode(){let e=0;return e<<=1,e+=+this.isReadable(),e<<=1,e+=+this.isWriteable(),e<<=1,e}isReadable(){return this._flag.indexOf("r")!=-1||this._flag.indexOf("+")!=-1}isWriteable(){return this._flag.indexOf("w")!=-1||this._flag.indexOf("a")!=-1||this._flag.indexOf("+")!=-1}isTruncating(){return this._flag.indexOf("w")!==-1}isAppendable(){return this._flag.indexOf("a")!==-1}isSynchronous(){return this._flag.indexOf("s")!==-1}isExclusive(){return this._flag.indexOf("x")!==-1}pathExistsAction(){return this.isExclusive()?1:this.isTruncating()?2:0}pathNotExistsAction(){return(this.isWriteable()||this.isAppendable())&&this._flag!="r+"?3:1}},I=Ze;s(I,"FileFlag"),mi(I,"cache",new Map),mi(I,"validStrings",["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"]);var vi=class{datasync(){return this.sync()}datasyncSync(){return this.syncSync()}};s(vi,"File");var se=class extends vi{constructor(i,r,n,o,a=new Uint8Array(new ArrayBuffer(0,{maxByteLength:Zi}))){super();this.fs=i;this.path=r;this.flag=n;this.stats=o;this._buffer=a;if(this.stats.size!=a.byteLength){if(this.flag.isReadable())throw new Error(`Size mismatch: buffer length ${a.byteLength}, stats size ${this.stats.size}`);this._dirty=!0}}_position=0;_dirty=!1;get buffer(){return this._buffer}get position(){return this.flag.isAppendable()?this.stats.size:this._position}set position(i){this._position=i}async stat(){return new M(this.stats)}statSync(){return new M(this.stats)}truncate(i){if(this.truncateSync(i),this.flag.isSynchronous()&&!this.fs.metadata().synchronous)return this.sync()}truncateSync(i){if(this._dirty=!0,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");if(this.stats.mtimeMs=Date.now(),i>this._buffer.length){let r=new Uint8Array(i-this._buffer.length);this.writeSync(r,0,r.length,this._buffer.length),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync();return}this.stats.size=i,this._buffer=this._buffer.subarray(0,i),this.flag.isSynchronous()&&this.fs.metadata().synchronous&&this.syncSync()}async write(i,r=0,n=this.stats.size,o=0){return this.writeSync(i,r,n,o)}writeSync(i,r=0,n=this.stats.size,o=0){if(this._dirty=!0,o??=this.position,!this.flag.isWriteable())throw new c(1,"File not opened with a writeable mode.");let a=o+n;if(a>this.stats.size&&(this.stats.size=a,a>this._buffer.byteLength))if(this._buffer.buffer.resizable&&this._buffer.buffer.maxByteLength<=a)this._buffer.buffer.resize(a);else{let u=new Uint8Array(new ArrayBuffer(a,{maxByteLength:Zi}));u.set(this._buffer),this._buffer=u}this._buffer.set(i.slice(r,r+n),o);let l=this._buffer.byteOffset;return this.stats.mtimeMs=Date.now(),this.flag.isSynchronous()?(this.syncSync(),l):(this.position=o+l,l)}async read(i,r=0,n=this.stats.size,o=0){return{bytesRead:this.readSync(i,r,n,o),buffer:i}}readSync(i,r=0,n=this.stats.size,o=0){if(!this.flag.isReadable())throw new c(1,"File not opened with a readable mode.");o??=this.position;let a=o+n;a>this.stats.size&&(a=o+Math.max(this.stats.size-o,0)),this.stats.atimeMs=Date.now(),this._position=a;let l=a-o;return l==0||i.set(this._buffer.slice(o,a),r),l}async chmod(i){this.chmodSync(i)}chmodSync(i){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chmod(i),this.syncSync()}async chown(i,r){this.chownSync(i,r)}chownSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.chown(i,r),this.syncSync()}async utimes(i,r){this.utimesSync(i,r)}utimesSync(i,r){if(!this.fs.metadata().supportsProperties)throw new c(95);this._dirty=!0,this.stats.atime=i,this.stats.mtime=r,this.syncSync()}isDirty(){return this._dirty}resetDirty(){this._dirty=!1}_setType(i){return this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.sync()}_setTypeSync(i){this._dirty=!0,this.stats.mode=this.stats.mode&-61441|i,this.syncSync()}};s(se,"PreloadFile");var er=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(er,"SyncFile");var ut=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){}syncSync(){}async close(){}closeSync(){}};s(ut,"NoSyncFile");var Ai=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(Ai,"MirrorFile");var ft=class extends ct(X){_queue=[];_queueRunning=!1;_sync;_async;_isInitialized=!1;_ready;async ready(){return await this._ready,this}constructor({sync:e,async:i}){super(),this._sync=e,this._async=i,this._ready=this._initialize()}metadata(){return{...super.metadata(),name:ft.name,synchronous:!0,supportsProperties:this._sync.metadata().supportsProperties&&this._async.metadata().supportsProperties}}syncSync(e,i,r){this._sync.syncSync(e,i,r),this.enqueue({apiMethod:"sync",arguments:[e,i,r]})}openFileSync(e,i,r){return this._sync.openFileSync(e,i,r)}createFileSync(e,i,r,n){let o=this._sync.createFileSync(e,i,r,n);this.enqueue({apiMethod:"createFile",arguments:[e,i,r,n]});let a=o.statSync(),l=new Uint8Array(a.size);return o.readSync(l),new Ai(this,e,i,a,l)}linkSync(e,i,r){this._sync.linkSync(e,i,r),this.enqueue({apiMethod:"link",arguments:[e,i,r]})}renameSync(e,i,r){this._sync.renameSync(e,i,r),this.enqueue({apiMethod:"rename",arguments:[e,i,r]})}statSync(e,i){return this._sync.statSync(e,i)}unlinkSync(e,i){this._sync.unlinkSync(e,i),this.enqueue({apiMethod:"unlink",arguments:[e,i]})}rmdirSync(e,i){this._sync.rmdirSync(e,i),this.enqueue({apiMethod:"rmdir",arguments:[e,i]})}mkdirSync(e,i,r){this._sync.mkdirSync(e,i,r),this.enqueue({apiMethod:"mkdir",arguments:[e,i,r]})}readdirSync(e,i){return this._sync.readdirSync(e,i)}existsSync(e,i){return this._sync.existsSync(e,i)}async crossCopyDirectory(e,i){if(e!=="/"){let n=await this._async.stat(e,z.Root);this._sync.mkdirSync(e,i,n.getCred())}let r=await this._async.readdir(e,z.Root);for(let n of r)await this.crossCopy(he(e,n))}async crossCopyFile(e,i){let r=await this._async.openFile(e,I.Get("r"),z.Root),n=this._sync.createFileSync(e,I.Get("w"),i,z.Root);try{let{size:o}=await r.stat(),a=new Uint8Array(o);await r.read(a),n.writeSync(a)}finally{await r.close(),n.closeSync()}}async crossCopy(e){let i=await this._async.stat(e,z.Root);i.isDirectory()?await this.crossCopyDirectory(e,i.mode):await this.crossCopyFile(e,i.mode)}async _initialize(){if(!this._isInitialized)try{await this.crossCopy("/"),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,e}}async _next(){if(this._queue.length==0){this._queueRunning=!1;return}let e=this._queue.shift();try{await this._async[e.apiMethod](...e.arguments)}catch(i){throw new c(5,"AsyncMirror desync: "+i)}await this._next()}enqueue(e){this._queue.push(e),!this._queueRunning&&(this._queueRunning=!0,this._next())}};s(ft,"AsyncMirrorFS");var Gu={name:"AsyncMirror",options:{sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:async t=>{if("metadata"in t&&!t.metadata().synchronous)throw new c(22,'"sync" option must be a file system that supports synchronous operations')}},async:{type:"object",description:"The asynchronous file system to mirror."}},isAvailable(){return!0},create(t){return new ft(t)}};var ir=class{constructor(e){this.limit=e}cache=[];set(e,i){let r=this.cache.findIndex(n=>n.key===e);r!=-1?this.cache.splice(r,1):this.cache.length>=this.limit&&this.cache.shift(),this.cache.push({key:e,value:i})}get(e){let i=this.cache.find(r=>r.key===e);if(i)return this.set(e,i.value),i.value}remove(e){let i=this.cache.findIndex(r=>r.key===e);i!==-1&&this.cache.splice(i,1)}reset(){this.cache=[]}};s(ir,"LRUCache");var Bt=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this._buffer,this.stats),this.resetDirty())}syncSync(){throw new c(95)}async close(){this.sync()}closeSync(){throw new c(95)}};s(Bt,"AsyncFile");var rr=class extends wi(X){store;_cache;_ready;ready(){return this._ready}metadata(){return{...super.metadata(),name:this.store.name}}constructor({store:e,cacheSize:i}){super(),i>0&&(this._cache=new ir(i)),this._ready=this._initialize(e)}async _initialize(e){return this.store=await e,await this.makeRootDirectory(),this}async empty(){this._cache&&this._cache.reset(),await this.store.clear(),await this.makeRootDirectory()}async rename(e,i,r){let n=this._cache;this._cache&&(this._cache=null,n.reset());try{let o=this.store.beginTransaction("readwrite"),a=E(e),l=L(e),u=E(i),f=L(i),d=await this.findINode(o,a),h=await this.getDirListing(o,d,a);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(!h[l])throw c.ENOENT(e);let b=h[l];if(delete h[l],(u+"/").indexOf(e+"/")===0)throw new c(16,a);let m,g;if(u===a?(m=d,g=h):(m=await this.findINode(o,u),g=await this.getDirListing(o,m,u)),g[f]){let y=await this.getINode(o,g[f],i);if(y.toStats().isFile())try{await o.remove(y.ino),await o.remove(g[f])}catch(k){throw await o.abort(),k}else throw c.EPERM(i)}g[f]=b;try{await o.put(d.ino,le(h),!0),await o.put(m.ino,le(g),!0)}catch(y){throw await o.abort(),y}await o.commit()}finally{n&&(this._cache=n)}}async stat(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n)throw c.ENOENT(e);let o=n.toStats();if(!o.hasAccess(4,i))throw c.EACCES(e);return o}async createFile(e,i,r,n){let o=this.store.beginTransaction("readwrite"),a=new Uint8Array(0),l=await this.commitNewFile(o,e,U.FILE,r,n,a);return new Bt(this,e,i,l.toStats(),a)}async openFile(e,i,r){let n=this.store.beginTransaction("readonly"),o=await this.findINode(n,e),a=await n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(!a)throw c.ENOENT(e);return new Bt(this,e,i,o.toStats(),a)}async unlink(e,i){return this.removeEntry(e,!1,i)}async rmdir(e,i){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);await this.removeEntry(e,!0,i)}async mkdir(e,i,r){let n=this.store.beginTransaction("readwrite"),o=R("{}");await this.commitNewFile(n,e,U.DIRECTORY,i,r,o)}async readdir(e,i){let r=this.store.beginTransaction("readonly"),n=await this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(await this.getDirListing(r,n,e))}async sync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=await this._findINode(n,E(e),L(e)),a=await this.getINode(n,o,e),l=a.update(r);try{await n.put(a.ino,i,!0),l&&await n.put(o,a.data,!0)}catch(u){throw await n.abort(),u}await n.commit()}async link(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!(await this.findINode(n,o)).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=await this.findINode(n,l),f=await this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=await this._findINode(n,o,L(e)),h=await this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[L(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,le(f),!0)}catch(b){throw n.abort(),b}n.commit()}async makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(await e.get(ye)===void 0){let i=new pe;i.mode=511|U.DIRECTORY,await e.put(i.ino,R("{}"),!1),await e.put(ye,i.data,!1),await e.commit()}}async _findINode(e,i,r,n=new Set){let o=he(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),this._cache){let a=this._cache.get(o);if(a)return a}if(i==="/"){if(r==="")return this._cache&&this._cache.set(o,ye),ye;{let a=await this.getINode(e,ye,i),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(ke(i,r))}}else{let a=await this.findINode(e,i,n),l=await this.getDirListing(e,a,i);if(l[r]){let u=l[r];return this._cache&&this._cache.set(o,u),u}else throw c.ENOENT(ke(i,r))}}async findINode(e,i,r=new Set){let n=await this._findINode(e,E(i),L(i),r);return this.getINode(e,n,i)}async getINode(e,i,r){let n=await e.get(i);if(!n)throw c.ENOENT(r);return new pe(n.buffer)}async getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=await e.get(i.ino);if(!n)throw c.ENOENT(r);return bi(n)}async addNewNode(e,i){let r=0,n=s(async()=>{if(++r===5)throw new c(5,"Unable to commit data to key-value store.");{let o=Ot();return await e.put(o,i,!1)?o:n()}},"reroll");return n()}async commitNewFile(e,i,r,n,o,a){let l=E(i),u=L(i),f=await this.findINode(e,l),d=await this.getDirListing(e,f,l);if(!f.toStats().hasAccess(2,o))throw c.EACCES(i);if(i==="/")throw c.EEXIST(i);if(d[u])throw await e.abort(),c.EEXIST(i);try{let h=new pe;return h.ino=await this.addNewNode(e,a),h.mode=n|r,h.uid=o.uid,h.gid=o.gid,h.size=a.length,d[u]=await this.addNewNode(e,h.data),await e.put(f.ino,le(d),!0),await e.commit(),h}catch(h){throw e.abort(),h}}async removeEntry(e,i,r){this._cache&&this._cache.remove(e);let n=this.store.beginTransaction("readwrite"),o=E(e),a=await this.findINode(n,o),l=await this.getDirListing(n,a,o),u=L(e);if(!l[u])throw c.ENOENT(e);let f=l[u],d=await this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{await n.put(a.ino,le(l),!0),--d.nlink<1&&(await n.remove(d.ino),await n.remove(f))}catch(h){throw await n.abort(),h}await n.commit()}};s(rr,"AsyncStoreFS");var Dt=class{constructor(e){this.store=e}originalData=new Map;modifiedKeys=new Set;get(e){let i=this.store.get(e);return this.stashOldValue(e,i),i}put(e,i,r){return this.markModified(e),this.store.put(e,i,r)}remove(e){this.markModified(e),this.store.remove(e)}commit(){}abort(){for(let e of this.modifiedKeys){let i=this.originalData.get(e);i?this.store.put(e,i,!0):this.store.remove(e)}}stashOldValue(e,i){this.originalData.has(e)||this.originalData.set(e,i)}markModified(e){this.modifiedKeys.add(e),this.originalData.has(e)||this.originalData.set(e,this.store.get(e))}};s(Dt,"SimpleSyncRWTransaction");var ki=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.syncSync()}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this._buffer,this.stats),this.resetDirty())}async close(){this.closeSync()}closeSync(){this.syncSync()}};s(ki,"SyncStoreFile");var Mt=class extends ct(X){store;constructor(e){super(),this.store=e.store,this.makeRootDirectory()}metadata(){return{...super.metadata(),name:this.store.name}}empty(){this.store.clear(),this.makeRootDirectory()}renameSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=L(e),l=E(i),u=L(i),f=this.findINode(n,o),d=this.getDirListing(n,f,o);if(!f.toStats().hasAccess(2,r))throw c.EACCES(e);if(!d[a])throw c.ENOENT(e);let h=d[a];if(delete d[a],(l+"/").indexOf(e+"/")==0)throw new c(16,o);let b,m;if(l===o?(b=f,m=d):(b=this.findINode(n,l),m=this.getDirListing(n,b,l)),m[u]){let g=this.getINode(n,m[u],i);if(g.toStats().isFile())try{n.remove(g.ino),n.remove(m[u])}catch(y){throw n.abort(),y}else throw c.EPERM(i)}m[u]=h;try{n.put(f.ino,le(d),!0),n.put(b.ino,le(m),!0)}catch(g){throw n.abort(),g}n.commit()}statSync(e,i){let r=this.findINode(this.store.beginTransaction("readonly"),e).toStats();if(!r.hasAccess(4,i))throw c.EACCES(e);return r}createFileSync(e,i,r,n){return this.commitNewFile(e,U.FILE,r,n),this.openFileSync(e,i,n)}openFileSync(e,i,r){let n=this.store.beginTransaction("readonly"),o=this.findINode(n,e),a=n.get(o.ino);if(!o.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(a===null)throw c.ENOENT(e);return new ki(this,e,i,o.toStats(),a)}unlinkSync(e,i){this.removeEntry(e,!1,i)}rmdirSync(e,i){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.removeEntry(e,!0,i)}mkdirSync(e,i,r){this.commitNewFile(e,U.DIRECTORY,i,r,R("{}"))}readdirSync(e,i){let r=this.store.beginTransaction("readonly"),n=this.findINode(r,e);if(!n.toStats().hasAccess(4,i))throw c.EACCES(e);return Object.keys(this.getDirListing(r,n,e))}syncSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=this._findINode(n,E(e),L(e)),a=this.getINode(n,o,e),l=a.update(r);try{n.put(a.ino,i,!0),l&&n.put(o,a.data,!0)}catch(u){throw n.abort(),u}n.commit()}linkSync(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e);if(!this.findINode(n,o).toStats().hasAccess(4,r))throw c.EACCES(o);let l=E(i),u=this.findINode(n,l),f=this.getDirListing(n,u,l);if(!u.toStats().hasAccess(2,r))throw c.EACCES(l);let d=this._findINode(n,o,L(e)),h=this.getINode(n,d,e);if(!h.toStats().hasAccess(2,r))throw c.EACCES(i);h.nlink++,f[L(i)]=d;try{n.put(d,h.data,!0),n.put(u.ino,le(f),!0)}catch(b){throw n.abort(),b}n.commit()}makeRootDirectory(){let e=this.store.beginTransaction("readwrite");if(e.get(ye))return;let i=new pe;i.mode=511|U.DIRECTORY,e.put(i.ino,R("{}"),!1),e.put(ye,i.data,!1),e.commit()}_findINode(e,i,r,n=new Set){let o=he(i,r);if(n.has(o))throw new c(5,"Infinite loop detected while finding inode",o);if(n.add(o),i!="/"){let a=this._findINode(e,E(i),L(i),n),l=this.getDirListing(e,this.getINode(e,a,i+ss+r),i);if(!(r in l))throw c.ENOENT(ke(i,r));return l[r]}if(r!=""){let a=this.getDirListing(e,this.getINode(e,ye,i),i);if(!(r in a))throw c.ENOENT(ke(i,r));return a[r]}return ye}findINode(e,i){let r=this._findINode(e,E(i),L(i));return this.getINode(e,r,i)}getINode(e,i,r){let n=e.get(i);if(!n)throw c.ENOENT(r);return new pe(n.buffer)}getDirListing(e,i,r){if(!i.toStats().isDirectory())throw c.ENOTDIR(r);let n=e.get(i.ino);if(!n)throw c.ENOENT(r);return bi(n)}addNewNode(e,i){let n;for(;0<5;)try{return n=Ot(),e.put(n,i,!1),n}catch{}throw new c(5,"Unable to commit data to key-value store.")}commitNewFile(e,i,r,n,o=new Uint8Array){let a=this.store.beginTransaction("readwrite"),l=E(e),u=L(e),f=this.findINode(a,l),d=this.getDirListing(a,f,l);if(!f.toStats().hasAccess(2,n))throw c.EACCES(e);if(e==="/")throw c.EEXIST(e);if(d[u])throw c.EEXIST(e);let h=new pe;try{h.ino=this.addNewNode(a,o),h.size=o.length,h.mode=r|i,h.uid=n.uid,h.gid=n.gid,d[u]=this.addNewNode(a,h.data),a.put(f.ino,le(d),!0)}catch(b){throw a.abort(),b}return a.commit(),h}removeEntry(e,i,r){let n=this.store.beginTransaction("readwrite"),o=E(e),a=this.findINode(n,o),l=this.getDirListing(n,a,o),u=L(e),f=l[u];if(!f)throw c.ENOENT(e);let d=this.getINode(n,f,e);if(!d.toStats().hasAccess(2,r))throw c.EACCES(e);if(delete l[u],!i&&d.toStats().isDirectory())throw c.EISDIR(e);if(i&&!d.toStats().isDirectory())throw c.ENOTDIR(e);try{n.put(a.ino,le(l),!0),--d.nlink<1&&(n.remove(d.ino),n.remove(f))}catch(h){throw n.abort(),h}n.commit()}};s(Mt,"SyncStoreFS");var Ni=class{constructor(e="tmp"){this.name=e}store=new Map;clear(){this.store.clear()}beginTransaction(){return new Dt(this)}get(e){return this.store.get(e)}put(e,i,r){return!r&&this.store.has(e)?!1:(this.store.set(e,i),!0)}remove(e){this.store.delete(e)}};s(Ni,"InMemoryStore");var un={name:"InMemory",isAvailable(){return!0},options:{name:{type:"string",description:"The name of the store"}},create({name:t}){return new Mt({store:new Ni(t)})}};var Ut=class{_locks=new Map;lock(e){return new Promise(i=>{this._locks.has(e)?this._locks.get(e).push(i):this._locks.set(e,[])})}unlock(e){if(!this._locks.has(e))throw new Error("unlock of a non-locked mutex");let i=this._locks.get(e).shift();if(i){setTimeout(i,0);return}this._locks.delete(e)}tryLock(e){return this._locks.has(e)?!1:(this._locks.set(e,[]),!0)}isLocked(e){return this._locks.has(e)}};s(Ut,"Mutex");var Wt=class{constructor(e){this.fs=e}_mu=new Ut;async ready(){return await this.fs.ready(),this}metadata(){return{...this.fs.metadata(),name:"Locked<"+this.fs.metadata().name+">"}}async rename(e,i,r){await this._mu.lock(e),await this.fs.rename(e,i,r),this._mu.unlock(e)}renameSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.renameSync(e,i,r)}async stat(e,i){await this._mu.lock(e);let r=await this.fs.stat(e,i);return this._mu.unlock(e),r}statSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.statSync(e,i)}async openFile(e,i,r){await this._mu.lock(e);let n=await this.fs.openFile(e,i,r);return this._mu.unlock(e),n}openFileSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.openFileSync(e,i,r)}async createFile(e,i,r,n){await this._mu.lock(e);let o=await this.fs.createFile(e,i,r,n);return this._mu.unlock(e),o}createFileSync(e,i,r,n){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.createFileSync(e,i,r,n)}async unlink(e,i){await this._mu.lock(e),await this.fs.unlink(e,i),this._mu.unlock(e)}unlinkSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.unlinkSync(e,i)}async rmdir(e,i){await this._mu.lock(e),await this.fs.rmdir(e,i),this._mu.unlock(e)}rmdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.rmdirSync(e,i)}async mkdir(e,i,r){await this._mu.lock(e),await this.fs.mkdir(e,i,r),this._mu.unlock(e)}mkdirSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.mkdirSync(e,i,r)}async readdir(e,i){await this._mu.lock(e);let r=await this.fs.readdir(e,i);return this._mu.unlock(e),r}readdirSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.readdirSync(e,i)}async exists(e,i){await this._mu.lock(e);let r=await this.fs.exists(e,i);return this._mu.unlock(e),r}existsSync(e,i){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.existsSync(e,i)}async link(e,i,r){await this._mu.lock(e),await this.fs.link(e,i,r),this._mu.unlock(e)}linkSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.linkSync(e,i,r)}async sync(e,i,r){await this._mu.lock(e),await this.fs.sync(e,i,r),this._mu.unlock(e)}syncSync(e,i,r){if(this._mu.isLocked(e))throw new Error("invalid sync call");return this.fs.syncSync(e,i,r)}};s(Wt,"LockedFS");var fn="/.deleted",qt=class extends se{constructor(e,i,r,n,o){super(e,i,r,n,o)}async sync(){this.isDirty()&&(await this.fs.sync(this.path,this.buffer,this.stats),this.resetDirty())}syncSync(){this.isDirty()&&(this.fs.syncSync(this.path,this.buffer,this.stats),this.resetDirty())}async close(){await this.sync()}closeSync(){this.syncSync()}};s(qt,"OverlayFile");var Ti=class extends X{async ready(){return await this._readable.ready(),await this._writable.ready(),await this._ready,this}_writable;_readable;_isInitialized=!1;_deletedFiles=new Set;_deleteLog="";_deleteLogUpdatePending=!1;_deleteLogUpdateNeeded=!1;_deleteLogError;_ready;constructor({writable:e,readable:i}){if(super(),this._writable=e,this._readable=i,this._writable.metadata().readonly)throw new c(22,"Writable file system must be writable.");this._ready=this._initialize()}metadata(){return{...super.metadata(),name:jt.name,synchronous:this._readable.metadata().synchronous&&this._writable.metadata().synchronous,supportsProperties:this._readable.metadata().supportsProperties&&this._writable.metadata().supportsProperties}}getOverlayedFileSystems(){return{readable:this._readable,writable:this._writable}}async sync(e,i,r){let n=r.getCred(0,0);await this.createParentDirectories(e,n),await this._writable.sync(e,i,r)}syncSync(e,i,r){let n=r.getCred(0,0);this.createParentDirectoriesSync(e,n),this._writable.syncSync(e,i,r)}async _initialize(){if(!this._isInitialized){try{let e=await this._writable.openFile(fn,I.Get("r"),z.Root),{size:i}=await e.stat(),{buffer:r}=await e.read(new Uint8Array(i));this._deleteLog=Z(r)}catch(e){if(e.errno!==2)throw e}this._isInitialized=!0,this._reparseDeletionLog()}}getDeletionLog(){return this._deleteLog}restoreDeletionLog(e,i){this._deleteLog=e,this._reparseDeletionLog(),this.updateLog("",i)}async rename(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{await this._writable.rename(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}renameSync(e,i,r){this.checkInitialized(),this.checkPath(e),this.checkPath(i);try{this._writable.renameSync(e,i,r)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e)}}async stat(e,i){this.checkInitialized();try{return this._writable.stat(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=new M(await this._readable.stat(e,i));return n.mode|=146,n}}statSync(e,i){this.checkInitialized();try{return this._writable.statSync(e,i)}catch{if(this._deletedFiles.has(e))throw c.ENOENT(e);let n=new M(this._readable.statSync(e,i));return n.mode|=146,n}}async openFile(e,i,r){if(await this._writable.exists(e,r))return this._writable.openFile(e,i,r);let n=await this._readable.openFile(e,I.Get("r"),r),o=new M(await n.stat()),{buffer:a}=await n.read(new Uint8Array(o.size));return new qt(this,e,i,o,a)}openFileSync(e,i,r){if(this._writable.existsSync(e,r))return this._writable.openFileSync(e,i,r);let n=this._readable.openFileSync(e,I.Get("r"),r),o=M.clone(n.statSync()),a=new Uint8Array(o.size);return n.readSync(a),new qt(this,e,i,o,a)}async createFile(e,i,r,n){return this.checkInitialized(),await this._writable.createFile(e,i,r,n),this.openFile(e,i,n)}createFileSync(e,i,r,n){return this.checkInitialized(),this._writable.createFileSync(e,i,r,n),this.openFileSync(e,i,n)}async link(e,i,r){this.checkInitialized(),await this._writable.link(e,i,r)}linkSync(e,i,r){this.checkInitialized(),this._writable.linkSync(e,i,r)}async unlink(e,i){if(this.checkInitialized(),this.checkPath(e),!await this.exists(e,i))throw c.ENOENT(e);await this._writable.exists(e,i)&&await this._writable.unlink(e,i),await this.exists(e,i)&&this.deletePath(e,i)}unlinkSync(e,i){if(this.checkInitialized(),this.checkPath(e),!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)&&this._writable.unlinkSync(e,i),this.existsSync(e,i)&&this.deletePath(e,i)}async rmdir(e,i){if(this.checkInitialized(),!await this.exists(e,i))throw c.ENOENT(e);if(await this._writable.exists(e,i)&&await this._writable.rmdir(e,i),await this.exists(e,i)){if((await this.readdir(e,i)).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}rmdirSync(e,i){if(this.checkInitialized(),!this.existsSync(e,i))throw c.ENOENT(e);if(this._writable.existsSync(e,i)&&this._writable.rmdirSync(e,i),this.existsSync(e,i)){if(this.readdirSync(e,i).length>0)throw c.ENOTEMPTY(e);this.deletePath(e,i)}}async mkdir(e,i,r){if(this.checkInitialized(),await this.exists(e,r))throw c.EEXIST(e);await this.createParentDirectories(e,r),await this._writable.mkdir(e,i,r)}mkdirSync(e,i,r){if(this.checkInitialized(),this.existsSync(e,r))throw c.EEXIST(e);this.createParentDirectoriesSync(e,r),this._writable.mkdirSync(e,i,r)}async readdir(e,i){if(this.checkInitialized(),!(await this.stat(e,i)).isDirectory())throw c.ENOTDIR(e);let n=[];try{n.push(...await this._writable.readdir(e,i))}catch{}try{n.push(...(await this._readable.readdir(e,i)).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}readdirSync(e,i){if(this.checkInitialized(),!this.statSync(e,i).isDirectory())throw c.ENOTDIR(e);let n=[];try{n=n.concat(this._writable.readdirSync(e,i))}catch{}try{n=n.concat(this._readable.readdirSync(e,i).filter(a=>!this._deletedFiles.has(`${e}/${a}`)))}catch{}let o={};return n.filter(a=>{let l=!o[a];return o[a]=!0,l})}deletePath(e,i){this._deletedFiles.add(e),this.updateLog(`d${e}
|
|
3
3
|
`,i)}async updateLog(e,i){if(this._deleteLog+=e,this._deleteLogUpdatePending){this._deleteLogUpdateNeeded=!0;return}this._deleteLogUpdatePending=!0;let r=await this._writable.openFile(fn,I.Get("w"),i);try{await r.write(R(this._deleteLog)),this._deleteLogUpdateNeeded&&(this._deleteLogUpdateNeeded=!1,this.updateLog("",i))}catch(n){this._deleteLogError=n}finally{this._deleteLogUpdatePending=!1}}_reparseDeletionLog(){this._deletedFiles.clear();for(let e of this._deleteLog.split(`
|
|
4
|
-
`))e.startsWith("d")&&this._deletedFiles.add(e.slice(1))}checkInitialized(){if(!this._isInitialized)throw new c(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;let e=this._deleteLogError;throw this._deleteLogError=null,e}checkPath(e){if(e==fn)throw c.EPERM(e)}createParentDirectoriesSync(e,i){let r=E(e),n=[];for(;!this._writable.existsSync(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n)this._writable.mkdirSync(o,this.statSync(o,i).mode,i)}async createParentDirectories(e,i){let r=E(e),n=[];for(;!await this._writable.exists(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n){let a=await this.stat(o,i);await this._writable.mkdir(o,a.mode,i)}}operateOnWritable(e,i){if(!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)||this.copyToWritableSync(e,i)}async operateOnWritableAsync(e,i){if(!await this.exists(e,i))throw c.ENOENT(e);if(!await this._writable.exists(e,i))return this.copyToWritable(e,i)}copyToWritableSync(e,i){let r=this.statSync(e,i);if(r.isDirectory()){this._writable.mkdirSync(e,r.mode,i);return}let n=new Uint8Array(r.size),o=this._readable.openFileSync(e,I.Get("r"),i);o.readSync(n),o.closeSync();let a=this._writable.openFileSync(e,I.Get("w"),i);a.writeSync(n),a.closeSync()}async copyToWritable(e,i){let r=await this.stat(e,i);if(r.isDirectory()){await this._writable.mkdir(e,r.mode,i);return}let n=new Uint8Array(r.size),o=await this._readable.openFile(e,I.Get("r"),i);await o.read(n),await o.close();let a=await this._writable.openFile(e,I.Get("w"),i);await a.write(n),await a.close()}};s(Ai,"UnlockedOverlayFS");var jt=class extends Wt{async ready(){return await super.ready(),this}constructor(e){super(new Ai(e))}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}};s(jt,"OverlayFS");var Wu={name:"Overlay",options:{writable:{type:"object",required:!0,description:"The file system to write modified files to."},readable:{type:"object",required:!0,description:"The file system that initially populates this file system."}},isAvailable(){return!0},create(t){return new jt(t)}};var Vi={};Hi(Vi,{BigIntStats:()=>J,Dir:()=>ar,Dirent:()=>rt,ReadStream:()=>Qr,Stats:()=>M,WriteStream:()=>Zr,_toUnixTimestamp:()=>ds,access:()=>dd,accessSync:()=>ff,appendFile:()=>jf,appendFileSync:()=>Hu,chmod:()=>ad,chmodSync:()=>af,chown:()=>od,chownSync:()=>of,close:()=>zf,closeSync:()=>it,constants:()=>Si,copyFile:()=>Sd,copyFileSync:()=>pf,createReadStream:()=>md,createWriteStream:()=>bd,exists:()=>Rf,existsSync:()=>hn,fchmod:()=>Jf,fchmodSync:()=>gn,fchown:()=>Xf,fchownSync:()=>bn,fdatasync:()=>Hf,fdatasyncSync:()=>Xu,fstat:()=>$f,fstatSync:()=>Ku,fsync:()=>Gf,fsyncSync:()=>Yu,ftruncate:()=>Vf,ftruncateSync:()=>ms,futimes:()=>Qf,futimesSync:()=>wn,initialize:()=>or,lchmod:()=>ld,lchmodSync:()=>lf,lchown:()=>sd,lchownSync:()=>sf,link:()=>id,linkSync:()=>tf,lopenSync:()=>sr,lstat:()=>Bf,lstatSync:()=>$u,lutimes:()=>ud,lutimesSync:()=>uf,mkdir:()=>ed,mkdirSync:()=>ef,mkdtemp:()=>wd,mkdtempSync:()=>hf,mount:()=>nr,mounts:()=>_e,open:()=>Uf,openSync:()=>ki,opendir:()=>xd,opendirSync:()=>bf,promises:()=>fr,read:()=>Yf,readFile:()=>Wf,readFileSync:()=>ys,readSync:()=>Qu,readdir:()=>td,readdirSync:()=>Sn,readlink:()=>nd,readlinkSync:()=>nf,readv:()=>_d,readvSync:()=>yf,realpath:()=>fd,realpathSync:()=>_n,rename:()=>Lf,renameSync:()=>ju,rm:()=>gd,rmSync:()=>df,rmdir:()=>Zf,rmdirSync:()=>Zu,stat:()=>Of,statSync:()=>pn,symlink:()=>rd,symlinkSync:()=>rf,truncate:()=>Df,truncateSync:()=>zu,umount:()=>dn,unlink:()=>Mf,unlinkSync:()=>ps,unwatchFile:()=>pd,utimes:()=>cd,utimesSync:()=>cf,watch:()=>yd,watchFile:()=>hd,write:()=>Kf,writeFile:()=>qf,writeFileSync:()=>mn,writeSync:()=>Ju,writev:()=>Ed,writevSync:()=>mf});function ds(t){if(typeof t=="number")return Math.floor(t);if(t instanceof Date)return Math.floor(t.getTime()/1e3);throw new Error("Cannot parse time: "+t)}s(ds,"_toUnixTimestamp");function Ee(t,e){switch(typeof t){case"number":return t;case"string":let i=parseInt(t,8);if(!isNaN(i))return i}if(typeof e=="number")return e;throw new c(22,"Invalid mode: "+t?.toString())}s(Ee,"normalizeMode");function $t(t){if(t instanceof Date)return t;if(typeof t=="number")return new Date(t*1e3);if(typeof t=="string")return new Date(t);throw new c(22,"Invalid time.")}s($t,"normalizeTime");function W(t){if(t.indexOf("\0")>=0)throw new c(22,"Path must be a string without null bytes.");if(t==="")throw new c(22,"Path must not be empty.");return t=t.replaceAll(/\/+/g,"/"),ke(t)}s(W,"normalizePath");function et(t,e,i,r){switch(t===null?"null":typeof t){case"object":return{encoding:typeof t.encoding<"u"?t.encoding:e,flag:typeof t.flag<"u"?t.flag:i,mode:Ee(t.mode,r)};case"string":return{encoding:t,flag:i,mode:r};case"null":case"undefined":case"function":return{encoding:e,flag:i,mode:r};default:throw new TypeError(`"options" must be a string or an object, got ${typeof t} instead.`)}}s(et,"normalizeOptions");function S(){}s(S,"nop");var v=z.Root;function hs(t){v=t}s(hs,"setCred");var dt=new Map,qu=100;function zt(t){let e=qu++;return dt.set(e,t),e}s(zt,"getFdForFile");function T(t){if(!dt.has(t))throw new c(9);return dt.get(t)}s(T,"fd2file");var _e=new Map;nr("/",un.create({name:"root"}));function nr(t,e){if(t[0]!=="/"&&(t="/"+t),t=ke(t),_e.has(t))throw new c(22,"Mount point "+t+" is already in use.");_e.set(t,e)}s(nr,"mount");function dn(t){if(t[0]!=="/"&&(t=`/${t}`),t=ke(t),!_e.has(t))throw new c(22,"Mount point "+t+" is already unmounted.");_e.delete(t)}s(dn,"umount");function me(t){t=W(t);let e=[..._e].sort((i,r)=>i[0].length>r[0].length?-1:1);for(let[i,r]of e)if(i.length<=t.length&&t.startsWith(i))return t=t.slice(i.length>1?i.length:0),t===""&&(t="/"),{fs:r,path:t,mountPoint:i};throw new c(5,"ZenFS not initialized with a file system")}s(me,"resolveFS");function fs(t,e){for(let[i,r]of Object.entries(e))t=t?.replaceAll(i,r);return t}s(fs,"fixPaths");function tt(t,e){return typeof t.stack=="string"&&(t.stack=fs(t.stack,e)),t.message=fs(t.message,e),t}s(tt,"fixError");function or(t){"/"in t&&dn("/");for(let[e,i]of Object.entries(t))nr(e,i)}s(or,"initialize");var fr={};Hi(fr,{FileHandle:()=>ue,access:()=>Dn,appendFile:()=>ur,chmod:()=>Ln,chown:()=>Pn,constants:()=>Si,copyFile:()=>Cf,createReadStream:()=>Tf,createWriteStream:()=>Ff,exists:()=>Ti,fchmod:()=>xf,fchown:()=>Ef,futimes:()=>vf,lchmod:()=>Rn,lchown:()=>Cn,link:()=>Tn,lopen:()=>cr,lstat:()=>xn,lutimes:()=>Bn,mkdir:()=>Nn,mkdtemp:()=>Pf,open:()=>ht,read:()=>_f,readFile:()=>Fi,readdir:()=>Ni,readlink:()=>In,realpath:()=>Ii,rename:()=>En,rm:()=>If,rmdir:()=>kn,stat:()=>Gt,symlink:()=>Fn,truncate:()=>vn,unlink:()=>lr,unwatchFile:()=>kf,utimes:()=>On,watch:()=>Nf,watchFile:()=>Af,write:()=>Sf,writeFile:()=>Kt});function ce(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=me(e&&hn(i)?_n(i):i);try{return n[t](o,...r)}catch(a){throw tt(a,{[o]:i})}}s(ce,"doOp");function ju(t,e){t=W(t),e=W(e);let i=me(t),r=me(e),n={[i.path]:t,[r.path]:e};try{if(i===r)return i.fs.renameSync(i.path,r.path,v);let o=ys(t);mn(e,o),ps(t)}catch(o){throw tt(o,n)}}s(ju,"renameSync");function hn(t){t=W(t);try{let{fs:e,path:i}=me(t);return e.existsSync(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(hn,"existsSync");function pn(t,e){let i=ce("statSync",!0,t,v);return e?.bigint?new J(i):i}s(pn,"statSync");function $u(t,e){let i=ce("statSync",!1,t,v);return e?.bigint?new J(i):i}s($u,"lstatSync");function zu(t,e=0){let i=ki(t,"r+");try{ms(i,e)}finally{it(i)}}s(zu,"truncateSync");function ps(t){return ce("unlinkSync",!1,t,v)}s(ps,"unlinkSync");function Vt(t,e,i,r){let n=W(t),o=Ee(i,420),a=I.Get(e),l;try{l=ce("statSync",r,n,v)}catch{switch(a.pathNotExistsAction()){case 3:if(!ce("statSync",r,E(n),v).isDirectory())throw c.ENOTDIR(E(n));return ce("createFileSync",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid FileFlag object.")}}if(!l.hasAccess(o,v))throw c.EACCES(n);switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:return ce("unlinkSync",r,n,v),ce("createFileSync",r,n,a,l.mode,v);case 0:return ce("openFileSync",r,n,a,v);default:throw new c(22,"Invalid FileFlag object.")}}s(Vt,"_openSync");function ki(t,e,i){return zt(Vt(t,e,i,!0))}s(ki,"openSync");function sr(t,e,i){return zt(Vt(t,e,i,!1))}s(sr,"lopenSync");function yn(t,e,i){let r=Vt(t,e,420,i);try{let n=r.statSync(),o=new Uint8Array(n.size);return r.readSync(o,0,n.size,0),r.closeSync(),o}finally{r.closeSync()}}s(yn,"_readFileSync");function ys(t,e={}){let i=et(e,null,"r",420);if(!I.Get(i.flag).isReadable())throw new c(22,"Flag passed to readFile must allow for reading.");let n=yn(t,i.flag,!0);return i.encoding?Z(n,i.encoding):n}s(ys,"readFileSync");function Vu(t,e,i,r,n){let o=Vt(t,i,r,n);try{o.writeSync(e,0,e.length,0)}finally{o.closeSync()}}s(Vu,"_writeFileSync");function mn(t,e,i){let r=et(i,"utf8","w",420);if(!I.Get(r.flag).isWriteable())throw new c(22,"Flag passed to writeFile must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e,r.encoding):e;if(o===void 0)throw new c(22,"Data not specified");Vu(t,o,r.flag,r.mode,!0)}s(mn,"writeFileSync");function Gu(t,e,i,r,n){let o=Vt(t,i,r,n);try{o.writeSync(e,0,e.length,null)}finally{o.closeSync()}}s(Gu,"_appendFileSync");function Hu(t,e,i){let r=et(i,"utf8","a",420);if(!I.Get(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e):e;Gu(t,o,r.flag,r.mode,!0)}s(Hu,"appendFileSync");function Ku(t,e){let i=T(t).statSync();return e?.bigint?new J(i):i}s(Ku,"fstatSync");function it(t){T(t).closeSync(),dt.delete(t)}s(it,"closeSync");function ms(t,e=0){if(e<0)throw new c(22);T(t).truncateSync(e)}s(ms,"ftruncateSync");function Yu(t){T(t).syncSync()}s(Yu,"fsyncSync");function Xu(t){T(t).datasyncSync()}s(Xu,"fdatasyncSync");function Ju(t,e,i,r,n){let o,a=0,l,u;if(typeof e=="string"){u=typeof i=="number"?i:null;let d=typeof r=="string"?r:"utf8";a=0,o=R(e,d),l=o.length}else o=e,a=i,l=r,u=typeof n=="number"?n:null;let f=T(t);return u==null&&(u=f.position),f.writeSync(o,a,l,u)}s(Ju,"writeSync");function Qu(t,e,i,r,n){let o=T(t),a=i;return typeof i=="object"&&({offset:a,length:r,position:n}=i),isNaN(+n)&&(n=o.position),o.readSync(e,a,r,n)}s(Qu,"readSync");function bn(t,e,i){T(t).chownSync(e,i)}s(bn,"fchownSync");function gn(t,e){let i=Ee(e,-1);if(i<0)throw new c(22,"Invalid mode.");T(t).chmodSync(i)}s(gn,"fchmodSync");function wn(t,e,i){T(t).utimesSync($t(e),$t(i))}s(wn,"futimesSync");function Zu(t){return ce("rmdirSync",!0,t,v)}s(Zu,"rmdirSync");function ef(t,e){let i=typeof e=="number"||typeof e=="string"?e:e?.mode,r=typeof e=="object"&&e?.recursive;ce("mkdirSync",!0,t,Ee(i,511),v)}s(ef,"mkdirSync");function Sn(t,e){t=W(t);let i=ce("readdirSync",!0,t,v);for(let r of _e.keys()){if(!r.startsWith(t))continue;let n=r.slice(t.length);n.includes("/")||n.length==0||i.push(n)}return i.map(r=>typeof e=="object"&&e?.withFileTypes?new rt(r,pn(de(t,r))):e=="buffer"||typeof e=="object"&&e.encoding=="buffer"?R(r):r)}s(Sn,"readdirSync");function tf(t,e){return e=W(e),ce("linkSync",!1,t,e,v)}s(tf,"linkSync");function rf(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid type: "+i);if(hn(e))throw c.EEXIST(e);mn(e,t),Vt(e,"r+",420,!1)._setTypeSync(U.SYMLINK)}s(rf,"symlinkSync");function nf(t,e){let i=yn(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:Z(i,r)}s(nf,"readlinkSync");function of(t,e,i){let r=ki(t,"r+");bn(r,e,i),it(r)}s(of,"chownSync");function sf(t,e,i){let r=sr(t,"r+");bn(r,e,i),it(r)}s(sf,"lchownSync");function af(t,e){let i=ki(t,"r+");gn(i,e),it(i)}s(af,"chmodSync");function lf(t,e){let i=sr(t,"r+");gn(i,e),it(i)}s(lf,"lchmodSync");function cf(t,e,i){let r=ki(t,"r+");wn(r,e,i),it(r)}s(cf,"utimesSync");function uf(t,e,i){let r=sr(t,"r+");wn(r,e,i),it(r)}s(uf,"lutimesSync");function _n(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=me(t);try{if(!i.statSync(r,v).isSymbolicLink())return t;let a=W(n+Z(yn(r,"r+",!1)));return _n(a)}catch(o){throw tt(o,{[r]:t})}}s(_n,"realpathSync");function ff(t,e=384){if(!pn(t).hasAccess(e,v))throw new c(13)}s(ff,"accessSync");function df(t){throw new c(95)}s(df,"rmSync");function hf(t,e){throw new c(95)}s(hf,"mkdtempSync");function pf(t,e,i){throw new c(95)}s(pf,"copyFileSync");function yf(t,e,i){throw new c(95)}s(yf,"readvSync");function mf(t,e,i){throw new c(95)}s(mf,"writevSync");function bf(t,e){throw new c(95)}s(bf,"opendirSync");var rt=class{constructor(e,i){this.name=e;this.stats=i}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}};s(rt,"Dirent");var ar=class{constructor(e){this.path=e}closed=!1;checkClosed(){if(this.closed)throw new c(9,"Can not use closed Dir")}_entries;close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this._entries||(this._entries=await Ni(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}read(e){if(!e)return this._read();this._read().then(i=>e(null,i))}readSync(){return this._entries||(this._entries=Sn(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}[Symbol.asyncIterator](){let e=this;return{[Symbol.asyncIterator]:this[Symbol.asyncIterator],async next(){let i=await e._read();return i!=null?{done:!1,value:i}:(await e.close(),{done:!0,value:void 0})}}}};s(ar,"Dir");var ue=class{constructor(e){this.fd=e}chown(e,i){return T(this.fd).chown(e,i)}chmod(e){let i=Ee(e,-1);if(i<0)throw new c(22,"Invalid mode.");return T(this.fd).chmod(i)}datasync(){return T(this.fd).datasync()}sync(){return T(this.fd).sync()}truncate(e){if(e<0)throw new c(22);return T(this.fd).truncate(e)}utimes(e,i){return T(this.fd).utimes($t(e),$t(i))}appendFile(e,i){return ur(T(this.fd).path,e,i)}read(e,i,r,n){return isNaN(+n)&&(n=T(this.fd).position),T(this.fd).read(e,i,r,n)}readFile(e){return Fi(T(this.fd).path,e)}stat(e){return Gt(T(this.fd).path,e)}async write(e,i,r,n){let o,a=0,l;if(typeof e=="string"){n=typeof i=="number"?i:null;let f=typeof r=="string"?r:"utf8";a=0,o=R(e,f),l=o.length}else o=e,a=i,l=r,n=typeof n=="number"?n:null;n??=T(this.fd).position;let u=await T(this.fd).write(o,a,l,n);return{buffer:o,bytesWritten:u}}writeFile(e,i){return Kt(T(this.fd).path,e,i)}writev(e,i){throw new c(95)}readv(e,i){throw new c(95)}async close(){await T(this.fd).close(),dt.delete(this.fd)}};s(ue,"FileHandle");async function xe(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=me(e&&await Ti(i)?await Ii(i):i);try{return n[t](o,...r)}catch(a){throw tt(a,{[o]:i})}}s(xe,"doOp");async function En(t,e){t=W(t),e=W(e);let{path:i}=me(t),{fs:r,path:n}=me(e);try{let o=await Fi(t);await Kt(e,o),await lr(t)}catch(o){throw tt(o,{[i]:t,[n]:e})}}s(En,"rename");async function Ti(t){try{let{fs:e,path:i}=me(t);return e.exists(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(Ti,"exists");async function Gt(t,e){let i=await xe("stat",!0,t,v);return e?.bigint?new J(i):i}s(Gt,"stat");async function xn(t,e){let i=await xe("stat",!1,t,v);return e?.bigint?new J(i):i}s(xn,"lstat");async function vn(t,e=0){let i=await ht(t,"r+");try{await i.truncate(e)}finally{await i.close()}}s(vn,"truncate");async function lr(t){return xe("unlink",!1,t,v)}s(lr,"unlink");async function Ht(t,e,i=420,r){let n=W(t),o=Ee(i,420),a=I.Get(e);try{switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:let l=await xe("openFile",r,n,a,v);if(!l)throw new c(5,"Impossible code path reached");return await l.truncate(0),await l.sync(),l;case 0:return await xe("openFile",r,n,a,v);default:throw new c(22,"Invalid file flag")}}catch{switch(a.pathNotExistsAction()){case 3:let u=await xe("stat",r,E(n),v);if(u&&!u.isDirectory())throw c.ENOTDIR(E(n));return await xe("createFile",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid file flag")}}}s(Ht,"_open");async function ht(t,e,i=420){let r=await Ht(t,e,i,!0);return new ue(zt(r))}s(ht,"open");async function cr(t,e,i=420){let r=await Ht(t,e,i,!1);return new ue(zt(r))}s(cr,"lopen");async function An(t,e,i){let r=await Ht(W(t),e,420,i);try{let n=await r.stat(),o=new Uint8Array(n.size);return await r.read(o,0,n.size,0),await r.close(),o}finally{await r.close()}}s(An,"_readFile");async function Fi(t,e){let i=et(e,null,"r",null);if(!I.Get(i.flag).isReadable())throw new c(22,"Flag passed must allow for reading.");let n=await An(t,i.flag,!0);return i.encoding?Z(n,i.encoding):n}s(Fi,"readFile");async function gf(t,e,i,r,n){let o=await Ht(t,i,r,n);try{await o.write(e,0,e.length,0)}finally{await o.close()}}s(gf,"_writeFile");async function Kt(t,e,i){let r=et(i,"utf8","w",420);if(!I.Get(r.flag).isWriteable())throw new c(22,"Flag passed must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e,r.encoding):e;await gf(t,o,r.flag,r.mode,!0)}s(Kt,"writeFile");async function wf(t,e,i,r,n){let o=await Ht(t,i,r,n);try{await o.write(e,0,e.length,null)}finally{await o.close()}}s(wf,"_appendFile");async function ur(t,e,i){let r=et(i,"utf8","a",420);if(!I.Get(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e):e;await wf(t,o,r.flag,r.mode,!0)}s(ur,"appendFile");function Sf(t,e,i,r,n){return t.write(e,i,r,n)}s(Sf,"write");function _f(t,e,i,r,n){return t.read(e,i,r,n)}s(_f,"read");function Ef(t,e,i){return t.chown(e,i)}s(Ef,"fchown");function xf(t,e){return t.chmod(e)}s(xf,"fchmod");function vf(t,e,i){return t.utimes(e,i)}s(vf,"futimes");async function kn(t){return xe("rmdir",!0,t,v)}s(kn,"rmdir");async function Nn(t,e){await xe("mkdir",!0,t,Ee(typeof e=="object"?e?.mode:e,511),v)}s(Nn,"mkdir");async function Ni(t,e){t=W(t);let i=await xe("readdir",!0,t,v),r=[..._e.keys()];for(let o of r)if(o.startsWith(t)){let a=o.slice(t.length);if(a.includes("/")||a.length==0)continue;i.push(a)}let n=[];for(let o of i)n.push(typeof e=="object"&&e?.withFileTypes?new rt(o,await Gt(de(t,o))):o);return n}s(Ni,"readdir");async function Tn(t,e){return e=W(e),xe("link",!1,t,e,v)}s(Tn,"link");async function Fn(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid symlink type: "+i);if(await Ti(e))throw c.EEXIST(e);await Kt(e,t),await(await Ht(e,"r+",420,!1))._setType(U.SYMLINK)}s(Fn,"symlink");async function In(t,e){let i=await An(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:Z(i,r)}s(In,"readlink");async function Pn(t,e,i){let r=await ht(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Pn,"chown");async function Cn(t,e,i){let r=await cr(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Cn,"lchown");async function Ln(t,e){let i=await ht(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Ln,"chmod");async function Rn(t,e){let i=await cr(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Rn,"lchmod");async function On(t,e,i){let r=await ht(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(On,"utimes");async function Bn(t,e,i){let r=await cr(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(Bn,"lutimes");async function Ii(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=me(t);try{if(!(await i.stat(r,v)).isSymbolicLink())return t;let a=n+W(Z(await An(r,"r+",!1)));return Ii(a)}catch(o){throw tt(o,{[r]:t})}}s(Ii,"realpath");async function Af(t,e,i=S){throw new c(95)}s(Af,"watchFile");async function kf(t,e=S){throw new c(95)}s(kf,"unwatchFile");async function Nf(t,e,i=S){throw new c(95)}s(Nf,"watch");async function Dn(t,e=384){if(!(await Gt(t)).hasAccess(e,v))throw new c(13)}s(Dn,"access");async function Tf(t,e){throw new c(95)}s(Tf,"createReadStream");async function Ff(t,e){throw new c(95)}s(Ff,"createWriteStream");async function If(t){throw new c(95)}s(If,"rm");async function Pf(t){throw new c(95)}s(Pf,"mkdtemp");async function Cf(t){throw new c(95)}s(Cf,"copyFile");function Lf(t,e,i=S){En(t,e).then(()=>i()).catch(i)}s(Lf,"rename");function Rf(t,e=S){Ti(t).then(e).catch(()=>e(!1))}s(Rf,"exists");function Of(t,e,i=S){i=typeof e=="function"?e:i,Gt(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s(Of,"stat");function Bf(t,e,i=S){i=typeof e=="function"?e:i,xn(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s(Bf,"lstat");function Df(t,e=0,i=S){i=typeof e=="function"?e:i,vn(t,typeof e=="number"?e:0).then(()=>i()).catch(i)}s(Df,"truncate");function Mf(t,e=S){lr(t).then(()=>e()).catch(e)}s(Mf,"unlink");function Uf(t,e,i,r=S){let n=Ee(i,420);r=typeof i=="function"?i:r,ht(t,e,n).then(o=>r(null,o.fd)).catch(r)}s(Uf,"open");function Wf(t,e,i=S){i=typeof e=="function"?e:i,Fi(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(Wf,"readFile");function qf(t,e,i,r=S){r=typeof i=="function"?i:r,Kt(t,e,typeof i!="function"?i:null).then(()=>r(null)).catch(r)}s(qf,"writeFile");function jf(t,e,i,r=S){r=typeof i=="function"?i:r,ur(t,e,typeof i=="function"?null:i)}s(jf,"appendFile");function $f(t,e,i=S){i=typeof e=="function"?e:i,T(t).stat().then(r=>i(null,typeof e=="object"&&e?.bigint?new J(r):r)).catch(i)}s($f,"fstat");function zf(t,e=S){new ue(t).close().then(()=>e()).catch(e)}s(zf,"close");function Vf(t,e,i=S){let r=typeof e=="number"?e:0;i=typeof e=="function"?e:i;let n=T(t);if(r<0)throw new c(22);n.truncate(r).then(()=>i()).catch(i)}s(Vf,"ftruncate");function Gf(t,e=S){T(t).sync().then(()=>e()).catch(e)}s(Gf,"fsync");function Hf(t,e=S){T(t).datasync().then(()=>e()).catch(e)}s(Hf,"fdatasync");function Kf(t,e,i,r,n,o=S){let a,l,u,f=null,d,h=new ue(t);if(typeof e=="string"){switch(d="utf8",typeof i){case"function":o=i;break;case"number":f=i,d=typeof r=="string"?r:"utf8",o=typeof n=="function"?n:o;break;default:o=typeof r=="function"?r:typeof n=="function"?n:o,o(new c(22,"Invalid arguments."));return}a=R(e),l=0,u=a.length;let b=o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,Z(a))).catch(b)}else{a=e,l=i,u=r,f=typeof n=="number"?n:null;let b=typeof n=="function"?n:o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,a)).catch(b)}}s(Kf,"write");function Yf(t,e,i,r,n,o=S){new ue(t).read(e,i,r,n).then(({bytesRead:a,buffer:l})=>o(null,a,l)).catch(o)}s(Yf,"read");function Xf(t,e,i,r=S){new ue(t).chown(e,i).then(()=>r()).catch(r)}s(Xf,"fchown");function Jf(t,e,i){new ue(t).chmod(e).then(()=>i()).catch(i)}s(Jf,"fchmod");function Qf(t,e,i,r=S){new ue(t).utimes(e,i).then(()=>r()).catch(r)}s(Qf,"futimes");function Zf(t,e=S){kn(t).then(()=>e()).catch(e)}s(Zf,"rmdir");function ed(t,e,i=S){Nn(t,e).then(()=>i()).catch(i)}s(ed,"mkdir");function td(t,e,i=S){i=typeof e=="function"?e:i,Ni(t,typeof e!="function"?e:{}).then(n=>i(null,n)).catch(i)}s(td,"readdir");function id(t,e,i=S){Tn(t,e).then(()=>i()).catch(i)}s(id,"link");function rd(t,e,i,r=S){let n=typeof i=="string"?i:"file";r=typeof i=="function"?i:r,Fn(t,e,n).then(()=>r()).catch(r)}s(rd,"symlink");function nd(t,e,i=S){i=typeof e=="function"?e:i,In(t).then(r=>i(null,r)).catch(i)}s(nd,"readlink");function od(t,e,i,r=S){Pn(t,e,i).then(()=>r()).catch(r)}s(od,"chown");function sd(t,e,i,r=S){Cn(t,e,i).then(()=>r()).catch(r)}s(sd,"lchown");function ad(t,e,i=S){Ln(t,e).then(()=>i()).catch(i)}s(ad,"chmod");function ld(t,e,i=S){Rn(t,e).then(()=>i()).catch(i)}s(ld,"lchmod");function cd(t,e,i,r=S){On(t,e,i).then(()=>r()).catch(r)}s(cd,"utimes");function ud(t,e,i,r=S){Bn(t,e,i).then(()=>r()).catch(r)}s(ud,"lutimes");function fd(t,e,i=S){i=typeof e=="function"?e:i,Ii(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(fd,"realpath");function dd(t,e,i=S){let r=typeof e=="number"?e:4;i=typeof e=="function"?e:i,Dn(t,typeof e=="function"?null:e).then(()=>i()).catch(i)}s(dd,"access");function hd(t,e,i=S){throw new c(95)}s(hd,"watchFile");function pd(t,e=S){throw new c(95)}s(pd,"unwatchFile");function yd(t,e,i=S){throw new c(95)}s(yd,"watch");function md(t,e){throw new c(95)}s(md,"createReadStream");function bd(t,e){throw new c(95)}s(bd,"createWriteStream");function gd(t){new c(95)}s(gd,"rm");function wd(t){new c(95)}s(wd,"mkdtemp");function Sd(t,e,i,r){new c(95)}s(Sd,"copyFile");function _d(t){new c(95)}s(_d,"readv");function Ed(t,e,i,r){throw new c(95)}s(Ed,"writev");function xd(t){throw new c(95)}s(xd,"opendir");var en=eu(Vc(),1);var Qr=class extends en.Readable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesRead;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Qr,"ReadStream");var Zr=class extends en.Writable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesWritten;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Zr,"WriteStream");function Gc(t,e=0,i=0){hs(new z(e,i,e,i,e,i)),or(t)}s(Gc,"initialize");async function Ng(t){("backend"in t||t instanceof X)&&(t={"/":t});for(let[e,i]of Object.entries(t))typeof i!="number"&&(i instanceof X||(gi(i)&&(i={backend:i}),t[e]=await Yi(i)));Gc(t)}s(Ng,"configure");var Tt=class{static FromListing(e){let i=new Tt,r=new Je;i._index.set("/",r);let n=[{pwd:"",tree:e,parent:r}];for(;n.length>0;){let o,{tree:a,pwd:l,parent:u}=n.pop();for(let f in a){if(!Object.hasOwn(a,f))continue;let d=a[f];if(d){let h=l+"/"+f;o=new Je,i._index.set(h,o),n.push({pwd:h,tree:d,parent:o})}else o=new Gi(new M({mode:U.FILE|365}));u&&u._listing.set(f,o)}}return i}_index=new Map;constructor(){this.add("/",new Je)}files(){let e=[];for(let i of this._index.values())for(let r of i.listing){let n=i.get(r);n?.isFile()&&e.push(n)}return e}add(e,i){if(!i)throw new Error("Inode must be specified");if(!e.startsWith("/"))throw new Error("Path must be absolute, got: "+e);if(this._index.has(e))return this._index.get(e)===i;let r=E(e),n=this._index.get(r);return!n&&e!="/"&&(n=new Je,!this.add(r,n))||e!="/"&&!n.add(L(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let r=E(e),n=L(e),o=this._index.get(r);return o||(o=new Je,this.addFast(r,o)),o.add(n,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=E(e),r=this._index.get(i);if(!r)return;let n=r.remove(L(e));if(!n)return;if(!n.isDirectory())return n;let o=n.listing;for(let a of o)this.remove(de(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=E(e),r=this._index.get(i);return i==e?r:r?.get(L(e))}};s(Tt,"FileIndex");var pi=class{constructor(e){this.data=e}};s(pi,"IndexInode");var Gi=class extends pi{isFile(){return!0}isDirectory(){return!1}toStats(){return new M({mode:U.FILE|438,size:4096})}};s(Gi,"IndexFileInode");var Je=class extends pi{_listing=new Map;isFile(){return!1}isDirectory(){return!0}get stats(){return new M({mode:U.DIRECTORY|365,size:4096})}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(e){return this._listing.get(e)}add(e,i){return this._listing.has(e)?!1:(this._listing.set(e,i),!0)}remove(e){let i=this._listing.get(e);if(i)return this._listing.delete(e),i}};s(Je,"IndexDirInode");var yi=class extends ln(X){_index;constructor(e){super(),this._index=Tt.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i,e);throw new c(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i,e);throw new c(22,"Invalid inode.")}async openFile(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ut(this,e,i,o,o.fileData)}return this.openFileInode(n,e,i)}openFileSync(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ut(this,e,i,o,o.fileData)}return this.openFileInodeSync(n,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}readdirSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}};s(yi,"FileIndexFS");var tn=class extends ct(yi){async statFileInode(e,i){return this.statFileInodeSync(e,i)}async openFileInode(e,i,r){return this.openFileInodeSync(e,i,r)}};s(tn,"SyncFileIndexFS");var rn=class extends wi(yi){statFileInodeSync(){throw new c(95)}openFileInodeSync(){throw new c(95)}};s(rn,"AsyncFileIndexFS");var Tg=Vi;return tu(Fg);})();
|
|
4
|
+
`))e.startsWith("d")&&this._deletedFiles.add(e.slice(1))}checkInitialized(){if(!this._isInitialized)throw new c(1,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(!this._deleteLogError)return;let e=this._deleteLogError;throw this._deleteLogError=null,e}checkPath(e){if(e==fn)throw c.EPERM(e)}createParentDirectoriesSync(e,i){let r=E(e),n=[];for(;!this._writable.existsSync(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n)this._writable.mkdirSync(o,this.statSync(o,i).mode,i)}async createParentDirectories(e,i){let r=E(e),n=[];for(;!await this._writable.exists(r,i);)n.push(r),r=E(r);n=n.reverse();for(let o of n){let a=await this.stat(o,i);await this._writable.mkdir(o,a.mode,i)}}operateOnWritable(e,i){if(!this.existsSync(e,i))throw c.ENOENT(e);this._writable.existsSync(e,i)||this.copyToWritableSync(e,i)}async operateOnWritableAsync(e,i){if(!await this.exists(e,i))throw c.ENOENT(e);if(!await this._writable.exists(e,i))return this.copyToWritable(e,i)}copyToWritableSync(e,i){let r=this.statSync(e,i);if(r.isDirectory()){this._writable.mkdirSync(e,r.mode,i);return}let n=new Uint8Array(r.size),o=this._readable.openFileSync(e,I.Get("r"),i);o.readSync(n),o.closeSync();let a=this._writable.openFileSync(e,I.Get("w"),i);a.writeSync(n),a.closeSync()}async copyToWritable(e,i){let r=await this.stat(e,i);if(r.isDirectory()){await this._writable.mkdir(e,r.mode,i);return}let n=new Uint8Array(r.size),o=await this._readable.openFile(e,I.Get("r"),i);await o.read(n),await o.close();let a=await this._writable.openFile(e,I.Get("w"),i);await a.write(n),await a.close()}};s(Ti,"UnlockedOverlayFS");var jt=class extends Wt{async ready(){return await super.ready(),this}constructor(e){super(new Ti(e))}getOverlayedFileSystems(){return super.fs.getOverlayedFileSystems()}getDeletionLog(){return super.fs.getDeletionLog()}resDeletionLog(){return super.fs.getDeletionLog()}unwrap(){return super.fs}};s(jt,"OverlayFS");var Hu={name:"Overlay",options:{writable:{type:"object",required:!0,description:"The file system to write modified files to."},readable:{type:"object",required:!0,description:"The file system that initially populates this file system."}},isAvailable(){return!0},create(t){return new jt(t)}};var Ki={};Xi(Ki,{BigIntStats:()=>J,Dir:()=>ar,Dirent:()=>rt,ReadStream:()=>Qr,Stats:()=>M,WriteStream:()=>Zr,_toUnixTimestamp:()=>ds,access:()=>wd,accessSync:()=>gf,appendFile:()=>Yf,appendFileSync:()=>ef,chmod:()=>pd,chmodSync:()=>pf,chown:()=>dd,chownSync:()=>df,close:()=>Jf,closeSync:()=>it,constants:()=>xi,copyFile:()=>Nd,copyFileSync:()=>_f,createReadStream:()=>xd,createWriteStream:()=>vd,exists:()=>qf,existsSync:()=>hn,fchmod:()=>nd,fchmodSync:()=>gn,fchown:()=>rd,fchownSync:()=>bn,fdatasync:()=>ed,fdatasyncSync:()=>nf,fstat:()=>Xf,fstatSync:()=>tf,fsync:()=>Zf,fsyncSync:()=>rf,ftruncate:()=>Qf,ftruncateSync:()=>ms,futimes:()=>od,futimesSync:()=>wn,initialize:()=>or,lchmod:()=>yd,lchmodSync:()=>yf,lchown:()=>hd,lchownSync:()=>hf,link:()=>cd,linkSync:()=>cf,lopenSync:()=>sr,lstat:()=>$f,lstatSync:()=>Xu,lutimes:()=>bd,lutimesSync:()=>bf,mkdir:()=>ad,mkdirSync:()=>lf,mkdtemp:()=>kd,mkdtempSync:()=>Sf,mount:()=>nr,mounts:()=>_e,open:()=>Gf,openSync:()=>Fi,opendir:()=>Id,opendirSync:()=>vf,promises:()=>fr,read:()=>id,readFile:()=>Hf,readFileSync:()=>ys,readSync:()=>sf,readdir:()=>ld,readdirSync:()=>Sn,readlink:()=>fd,readlinkSync:()=>ff,readv:()=>Td,readvSync:()=>Ef,realpath:()=>gd,realpathSync:()=>_n,rename:()=>Wf,renameSync:()=>Yu,rm:()=>Ad,rmSync:()=>wf,rmdir:()=>sd,rmdirSync:()=>af,stat:()=>jf,statSync:()=>pn,symlink:()=>ud,symlinkSync:()=>uf,truncate:()=>zf,truncateSync:()=>Ju,umount:()=>dn,unlink:()=>Vf,unlinkSync:()=>ps,unwatchFile:()=>_d,utimes:()=>md,utimesSync:()=>mf,watch:()=>Ed,watchFile:()=>Sd,write:()=>td,writeFile:()=>Kf,writeFileSync:()=>mn,writeSync:()=>of,writev:()=>Fd,writevSync:()=>xf});function ds(t){if(typeof t=="number")return Math.floor(t);if(t instanceof Date)return Math.floor(t.getTime()/1e3);throw new Error("Cannot parse time: "+t)}s(ds,"_toUnixTimestamp");function Ee(t,e){switch(typeof t){case"number":return t;case"string":let i=parseInt(t,8);if(!isNaN(i))return i}if(typeof e=="number")return e;throw new c(22,"Invalid mode: "+t?.toString())}s(Ee,"normalizeMode");function $t(t){if(t instanceof Date)return t;if(typeof t=="number")return new Date(t*1e3);if(typeof t=="string")return new Date(t);throw new c(22,"Invalid time.")}s($t,"normalizeTime");function W(t){if(t.indexOf("\0")>=0)throw new c(22,"Path must be a string without null bytes.");if(t==="")throw new c(22,"Path must not be empty.");return t=t.replaceAll(/\/+/g,"/"),ke(t)}s(W,"normalizePath");function et(t,e,i,r){switch(t===null?"null":typeof t){case"object":return{encoding:typeof t.encoding<"u"?t.encoding:e,flag:typeof t.flag<"u"?t.flag:i,mode:Ee(t.mode,r)};case"string":return{encoding:t,flag:i,mode:r};case"null":case"undefined":case"function":return{encoding:e,flag:i,mode:r};default:throw new TypeError(`"options" must be a string or an object, got ${typeof t} instead.`)}}s(et,"normalizeOptions");function S(){}s(S,"nop");var v=z.Root;function hs(t){v=t}s(hs,"setCred");var dt=new Map,Ku=100;function zt(t){let e=Ku++;return dt.set(e,t),e}s(zt,"getFdForFile");function T(t){if(!dt.has(t))throw new c(9);return dt.get(t)}s(T,"fd2file");var _e=new Map;nr("/",un.create({name:"root"}));function nr(t,e){if(t[0]!=="/"&&(t="/"+t),t=ke(t),_e.has(t))throw new c(22,"Mount point "+t+" is already in use.");_e.set(t,e)}s(nr,"mount");function dn(t){if(t[0]!=="/"&&(t=`/${t}`),t=ke(t),!_e.has(t))throw new c(22,"Mount point "+t+" is already unmounted.");_e.delete(t)}s(dn,"umount");function me(t){t=W(t);let e=[..._e].sort((i,r)=>i[0].length>r[0].length?-1:1);for(let[i,r]of e)if(i.length<=t.length&&t.startsWith(i))return t=t.slice(i.length>1?i.length:0),t===""&&(t="/"),{fs:r,path:t,mountPoint:i};throw new c(5,"ZenFS not initialized with a file system")}s(me,"resolveFS");function fs(t,e){for(let[i,r]of Object.entries(e))t=t?.replaceAll(i,r);return t}s(fs,"fixPaths");function tt(t,e){return typeof t.stack=="string"&&(t.stack=fs(t.stack,e)),t.message=fs(t.message,e),t}s(tt,"fixError");function or(t){"/"in t&&dn("/");for(let[e,i]of Object.entries(t))nr(e,i)}s(or,"initialize");var fr={};Xi(fr,{FileHandle:()=>fe,access:()=>Dn,appendFile:()=>ur,chmod:()=>Ln,chown:()=>Pn,constants:()=>xi,copyFile:()=>Uf,createReadStream:()=>Of,createWriteStream:()=>Bf,exists:()=>Pi,fchmod:()=>If,fchown:()=>Ff,futimes:()=>Pf,lchmod:()=>Rn,lchown:()=>Cn,link:()=>Tn,lopen:()=>cr,lstat:()=>xn,lutimes:()=>Bn,mkdir:()=>Nn,mkdtemp:()=>Mf,open:()=>ht,read:()=>Tf,readFile:()=>Ci,readdir:()=>Ii,readlink:()=>In,realpath:()=>Li,rename:()=>En,rm:()=>Df,rmdir:()=>kn,stat:()=>Gt,symlink:()=>Fn,truncate:()=>vn,unlink:()=>lr,unwatchFile:()=>Lf,utimes:()=>On,watch:()=>Rf,watchFile:()=>Cf,write:()=>Nf,writeFile:()=>Kt});function ue(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=me(e&&hn(i)?_n(i):i);try{return n[t](o,...r)}catch(a){throw tt(a,{[o]:i})}}s(ue,"doOp");function Yu(t,e){t=W(t),e=W(e);let i=me(t),r=me(e),n={[i.path]:t,[r.path]:e};try{if(i===r)return i.fs.renameSync(i.path,r.path,v);let o=ys(t);mn(e,o),ps(t)}catch(o){throw tt(o,n)}}s(Yu,"renameSync");function hn(t){t=W(t);try{let{fs:e,path:i}=me(t);return e.existsSync(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(hn,"existsSync");function pn(t,e){let i=ue("statSync",!0,t,v);return e?.bigint?new J(i):i}s(pn,"statSync");function Xu(t,e){let i=ue("statSync",!1,t,v);return e?.bigint?new J(i):i}s(Xu,"lstatSync");function Ju(t,e=0){let i=Fi(t,"r+");try{ms(i,e)}finally{it(i)}}s(Ju,"truncateSync");function ps(t){return ue("unlinkSync",!1,t,v)}s(ps,"unlinkSync");function Vt(t,e,i,r){let n=W(t),o=Ee(i,420),a=I.Get(e),l;try{l=ue("statSync",r,n,v)}catch{switch(a.pathNotExistsAction()){case 3:if(!ue("statSync",r,E(n),v).isDirectory())throw c.ENOTDIR(E(n));return ue("createFileSync",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid FileFlag object.")}}if(!l.hasAccess(o,v))throw c.EACCES(n);switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:return ue("unlinkSync",r,n,v),ue("createFileSync",r,n,a,l.mode,v);case 0:return ue("openFileSync",r,n,a,v);default:throw new c(22,"Invalid FileFlag object.")}}s(Vt,"_openSync");function Fi(t,e,i){return zt(Vt(t,e,i,!0))}s(Fi,"openSync");function sr(t,e,i){return zt(Vt(t,e,i,!1))}s(sr,"lopenSync");function yn(t,e,i){let r=Vt(t,e,420,i);try{let n=r.statSync(),o=new Uint8Array(n.size);return r.readSync(o,0,n.size,0),r.closeSync(),o}finally{r.closeSync()}}s(yn,"_readFileSync");function ys(t,e={}){let i=et(e,null,"r",420);if(!I.Get(i.flag).isReadable())throw new c(22,"Flag passed to readFile must allow for reading.");let n=yn(t,i.flag,!0);return i.encoding?Z(n,i.encoding):n}s(ys,"readFileSync");function Qu(t,e,i,r,n){let o=Vt(t,i,r,n);try{o.writeSync(e,0,e.length,0)}finally{o.closeSync()}}s(Qu,"_writeFileSync");function mn(t,e,i){let r=et(i,"utf8","w",420);if(!I.Get(r.flag).isWriteable())throw new c(22,"Flag passed to writeFile must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e,r.encoding):e;if(o===void 0)throw new c(22,"Data not specified");Qu(t,o,r.flag,r.mode,!0)}s(mn,"writeFileSync");function Zu(t,e,i,r,n){let o=Vt(t,i,r,n);try{o.writeSync(e,0,e.length,null)}finally{o.closeSync()}}s(Zu,"_appendFileSync");function ef(t,e,i){let r=et(i,"utf8","a",420);if(!I.Get(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e):e;Zu(t,o,r.flag,r.mode,!0)}s(ef,"appendFileSync");function tf(t,e){let i=T(t).statSync();return e?.bigint?new J(i):i}s(tf,"fstatSync");function it(t){T(t).closeSync(),dt.delete(t)}s(it,"closeSync");function ms(t,e=0){if(e<0)throw new c(22);T(t).truncateSync(e)}s(ms,"ftruncateSync");function rf(t){T(t).syncSync()}s(rf,"fsyncSync");function nf(t){T(t).datasyncSync()}s(nf,"fdatasyncSync");function of(t,e,i,r,n){let o,a=0,l,u;if(typeof e=="string"){u=typeof i=="number"?i:null;let d=typeof r=="string"?r:"utf8";a=0,o=R(e,d),l=o.length}else o=e,a=i,l=r,u=typeof n=="number"?n:null;let f=T(t);return u==null&&(u=f.position),f.writeSync(o,a,l,u)}s(of,"writeSync");function sf(t,e,i,r,n){let o=T(t),a=i;return typeof i=="object"&&({offset:a,length:r,position:n}=i),isNaN(+n)&&(n=o.position),o.readSync(e,a,r,n)}s(sf,"readSync");function bn(t,e,i){T(t).chownSync(e,i)}s(bn,"fchownSync");function gn(t,e){let i=Ee(e,-1);if(i<0)throw new c(22,"Invalid mode.");T(t).chmodSync(i)}s(gn,"fchmodSync");function wn(t,e,i){T(t).utimesSync($t(e),$t(i))}s(wn,"futimesSync");function af(t){return ue("rmdirSync",!0,t,v)}s(af,"rmdirSync");function lf(t,e){let i=typeof e=="number"||typeof e=="string"?e:e?.mode,r=typeof e=="object"&&e?.recursive;ue("mkdirSync",!0,t,Ee(i,511),v)}s(lf,"mkdirSync");function Sn(t,e){t=W(t);let i=ue("readdirSync",!0,t,v);for(let r of _e.keys()){if(!r.startsWith(t))continue;let n=r.slice(t.length);n.includes("/")||n.length==0||i.push(n)}return i.map(r=>typeof e=="object"&&e?.withFileTypes?new rt(r,pn(he(t,r))):e=="buffer"||typeof e=="object"&&e.encoding=="buffer"?R(r):r)}s(Sn,"readdirSync");function cf(t,e){return e=W(e),ue("linkSync",!1,t,e,v)}s(cf,"linkSync");function uf(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid type: "+i);if(hn(e))throw c.EEXIST(e);mn(e,t),Vt(e,"r+",420,!1)._setTypeSync(U.SYMLINK)}s(uf,"symlinkSync");function ff(t,e){let i=yn(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:Z(i,r)}s(ff,"readlinkSync");function df(t,e,i){let r=Fi(t,"r+");bn(r,e,i),it(r)}s(df,"chownSync");function hf(t,e,i){let r=sr(t,"r+");bn(r,e,i),it(r)}s(hf,"lchownSync");function pf(t,e){let i=Fi(t,"r+");gn(i,e),it(i)}s(pf,"chmodSync");function yf(t,e){let i=sr(t,"r+");gn(i,e),it(i)}s(yf,"lchmodSync");function mf(t,e,i){let r=Fi(t,"r+");wn(r,e,i),it(r)}s(mf,"utimesSync");function bf(t,e,i){let r=sr(t,"r+");wn(r,e,i),it(r)}s(bf,"lutimesSync");function _n(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=me(t);try{if(!i.statSync(r,v).isSymbolicLink())return t;let a=W(n+Z(yn(r,"r+",!1)));return _n(a)}catch(o){throw tt(o,{[r]:t})}}s(_n,"realpathSync");function gf(t,e=384){if(!pn(t).hasAccess(e,v))throw new c(13)}s(gf,"accessSync");function wf(t){throw new c(95)}s(wf,"rmSync");function Sf(t,e){throw new c(95)}s(Sf,"mkdtempSync");function _f(t,e,i){throw new c(95)}s(_f,"copyFileSync");function Ef(t,e,i){throw new c(95)}s(Ef,"readvSync");function xf(t,e,i){throw new c(95)}s(xf,"writevSync");function vf(t,e){throw new c(95)}s(vf,"opendirSync");var rt=class{constructor(e,i){this.name=e;this.stats=i}isFile(){return this.stats.isFile()}isDirectory(){return this.stats.isDirectory()}isBlockDevice(){return this.stats.isBlockDevice()}isCharacterDevice(){return this.stats.isCharacterDevice()}isSymbolicLink(){return this.stats.isSymbolicLink()}isFIFO(){return this.stats.isFIFO()}isSocket(){return this.stats.isSocket()}};s(rt,"Dirent");var ar=class{constructor(e){this.path=e}closed=!1;checkClosed(){if(this.closed)throw new c(9,"Can not use closed Dir")}_entries;close(e){if(this.closed=!0,!e)return Promise.resolve();e()}closeSync(){this.closed=!0}async _read(){return this._entries||(this._entries=await Ii(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}read(e){if(!e)return this._read();this._read().then(i=>e(null,i))}readSync(){return this._entries||(this._entries=Sn(this.path,{withFileTypes:!0})),this._entries.length==0?null:this._entries.shift()}[Symbol.asyncIterator](){let e=this;return{[Symbol.asyncIterator]:this[Symbol.asyncIterator],async next(){let i=await e._read();return i!=null?{done:!1,value:i}:(await e.close(),{done:!0,value:void 0})}}}};s(ar,"Dir");var fe=class{constructor(e){this.fd=e}chown(e,i){return T(this.fd).chown(e,i)}chmod(e){let i=Ee(e,-1);if(i<0)throw new c(22,"Invalid mode.");return T(this.fd).chmod(i)}datasync(){return T(this.fd).datasync()}sync(){return T(this.fd).sync()}truncate(e){if(e<0)throw new c(22);return T(this.fd).truncate(e)}utimes(e,i){return T(this.fd).utimes($t(e),$t(i))}appendFile(e,i){return ur(T(this.fd).path,e,i)}read(e,i,r,n){return isNaN(+n)&&(n=T(this.fd).position),T(this.fd).read(e,i,r,n)}readFile(e){return Ci(T(this.fd).path,e)}stat(e){return Gt(T(this.fd).path,e)}async write(e,i,r,n){let o,a=0,l;if(typeof e=="string"){n=typeof i=="number"?i:null;let f=typeof r=="string"?r:"utf8";a=0,o=R(e,f),l=o.length}else o=e,a=i,l=r,n=typeof n=="number"?n:null;n??=T(this.fd).position;let u=await T(this.fd).write(o,a,l,n);return{buffer:o,bytesWritten:u}}writeFile(e,i){return Kt(T(this.fd).path,e,i)}writev(e,i){throw new c(95)}readv(e,i){throw new c(95)}async close(){await T(this.fd).close(),dt.delete(this.fd)}};s(fe,"FileHandle");async function xe(...[t,e,i,...r]){i=W(i);let{fs:n,path:o}=me(e&&await Pi(i)?await Li(i):i);try{return n[t](o,...r)}catch(a){throw tt(a,{[o]:i})}}s(xe,"doOp");async function En(t,e){t=W(t),e=W(e);let{path:i}=me(t),{fs:r,path:n}=me(e);try{let o=await Ci(t);await Kt(e,o),await lr(t)}catch(o){throw tt(o,{[i]:t,[n]:e})}}s(En,"rename");async function Pi(t){try{let{fs:e,path:i}=me(t);return e.exists(i,v)}catch(e){if(e.errno==2)return!1;throw e}}s(Pi,"exists");async function Gt(t,e){let i=await xe("stat",!0,t,v);return e?.bigint?new J(i):i}s(Gt,"stat");async function xn(t,e){let i=await xe("stat",!1,t,v);return e?.bigint?new J(i):i}s(xn,"lstat");async function vn(t,e=0){let i=await ht(t,"r+");try{await i.truncate(e)}finally{await i.close()}}s(vn,"truncate");async function lr(t){return xe("unlink",!1,t,v)}s(lr,"unlink");async function Ht(t,e,i=420,r){let n=W(t),o=Ee(i,420),a=I.Get(e);try{switch(a.pathExistsAction()){case 1:throw c.EEXIST(n);case 2:let l=await xe("openFile",r,n,a,v);if(!l)throw new c(5,"Impossible code path reached");return await l.truncate(0),await l.sync(),l;case 0:return await xe("openFile",r,n,a,v);default:throw new c(22,"Invalid file flag")}}catch{switch(a.pathNotExistsAction()){case 3:let u=await xe("stat",r,E(n),v);if(u&&!u.isDirectory())throw c.ENOTDIR(E(n));return await xe("createFile",r,n,a,o,v);case 1:throw c.ENOENT(n);default:throw new c(22,"Invalid file flag")}}}s(Ht,"_open");async function ht(t,e,i=420){let r=await Ht(t,e,i,!0);return new fe(zt(r))}s(ht,"open");async function cr(t,e,i=420){let r=await Ht(t,e,i,!1);return new fe(zt(r))}s(cr,"lopen");async function An(t,e,i){let r=await Ht(W(t),e,420,i);try{let n=await r.stat(),o=new Uint8Array(n.size);return await r.read(o,0,n.size,0),await r.close(),o}finally{await r.close()}}s(An,"_readFile");async function Ci(t,e){let i=et(e,null,"r",null);if(!I.Get(i.flag).isReadable())throw new c(22,"Flag passed must allow for reading.");let n=await An(t,i.flag,!0);return i.encoding?Z(n,i.encoding):n}s(Ci,"readFile");async function Af(t,e,i,r,n){let o=await Ht(t,i,r,n);try{await o.write(e,0,e.length,0)}finally{await o.close()}}s(Af,"_writeFile");async function Kt(t,e,i){let r=et(i,"utf8","w",420);if(!I.Get(r.flag).isWriteable())throw new c(22,"Flag passed must allow for writing.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e,r.encoding):e;await Af(t,o,r.flag,r.mode,!0)}s(Kt,"writeFile");async function kf(t,e,i,r,n){let o=await Ht(t,i,r,n);try{await o.write(e,0,e.length,null)}finally{await o.close()}}s(kf,"_appendFile");async function ur(t,e,i){let r=et(i,"utf8","a",420);if(!I.Get(r.flag).isAppendable())throw new c(22,"Flag passed to appendFile must allow for appending.");if(typeof e!="string"&&!r.encoding)throw new c(22,"Encoding not specified");let o=typeof e=="string"?R(e):e;await kf(t,o,r.flag,r.mode,!0)}s(ur,"appendFile");function Nf(t,e,i,r,n){return t.write(e,i,r,n)}s(Nf,"write");function Tf(t,e,i,r,n){return t.read(e,i,r,n)}s(Tf,"read");function Ff(t,e,i){return t.chown(e,i)}s(Ff,"fchown");function If(t,e){return t.chmod(e)}s(If,"fchmod");function Pf(t,e,i){return t.utimes(e,i)}s(Pf,"futimes");async function kn(t){return xe("rmdir",!0,t,v)}s(kn,"rmdir");async function Nn(t,e){await xe("mkdir",!0,t,Ee(typeof e=="object"?e?.mode:e,511),v)}s(Nn,"mkdir");async function Ii(t,e){t=W(t);let i=await xe("readdir",!0,t,v),r=[..._e.keys()];for(let o of r)if(o.startsWith(t)){let a=o.slice(t.length);if(a.includes("/")||a.length==0)continue;i.push(a)}let n=[];for(let o of i)n.push(typeof e=="object"&&e?.withFileTypes?new rt(o,await Gt(he(t,o))):o);return n}s(Ii,"readdir");async function Tn(t,e){return e=W(e),xe("link",!1,t,e,v)}s(Tn,"link");async function Fn(t,e,i="file"){if(!["file","dir","junction"].includes(i))throw new c(22,"Invalid symlink type: "+i);if(await Pi(e))throw c.EEXIST(e);await Kt(e,t),await(await Ht(e,"r+",420,!1))._setType(U.SYMLINK)}s(Fn,"symlink");async function In(t,e){let i=await An(t,"r",!1),r=typeof e=="object"?e.encoding:e;return r=="buffer"?i:Z(i,r)}s(In,"readlink");async function Pn(t,e,i){let r=await ht(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Pn,"chown");async function Cn(t,e,i){let r=await cr(t,"r+");try{await r.chown(e,i)}finally{await r.close()}}s(Cn,"lchown");async function Ln(t,e){let i=await ht(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Ln,"chmod");async function Rn(t,e){let i=await cr(t,"r+");try{await i.chmod(e)}finally{await i.close()}}s(Rn,"lchmod");async function On(t,e,i){let r=await ht(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(On,"utimes");async function Bn(t,e,i){let r=await cr(t,"r+");try{await r.utimes(e,i)}finally{await r.close()}}s(Bn,"lutimes");async function Li(t,e){t=W(t);let{fs:i,path:r,mountPoint:n}=me(t);try{if(!(await i.stat(r,v)).isSymbolicLink())return t;let a=n+W(Z(await An(r,"r+",!1)));return Li(a)}catch(o){throw tt(o,{[r]:t})}}s(Li,"realpath");async function Cf(t,e,i=S){throw new c(95)}s(Cf,"watchFile");async function Lf(t,e=S){throw new c(95)}s(Lf,"unwatchFile");async function Rf(t,e,i=S){throw new c(95)}s(Rf,"watch");async function Dn(t,e=384){if(!(await Gt(t)).hasAccess(e,v))throw new c(13)}s(Dn,"access");async function Of(t,e){throw new c(95)}s(Of,"createReadStream");async function Bf(t,e){throw new c(95)}s(Bf,"createWriteStream");async function Df(t){throw new c(95)}s(Df,"rm");async function Mf(t){throw new c(95)}s(Mf,"mkdtemp");async function Uf(t){throw new c(95)}s(Uf,"copyFile");function Wf(t,e,i=S){En(t,e).then(()=>i()).catch(i)}s(Wf,"rename");function qf(t,e=S){Pi(t).then(e).catch(()=>e(!1))}s(qf,"exists");function jf(t,e,i=S){i=typeof e=="function"?e:i,Gt(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s(jf,"stat");function $f(t,e,i=S){i=typeof e=="function"?e:i,xn(t,typeof e!="function"?e:{}).then(r=>i(null,r)).catch(i)}s($f,"lstat");function zf(t,e=0,i=S){i=typeof e=="function"?e:i,vn(t,typeof e=="number"?e:0).then(()=>i()).catch(i)}s(zf,"truncate");function Vf(t,e=S){lr(t).then(()=>e()).catch(e)}s(Vf,"unlink");function Gf(t,e,i,r=S){let n=Ee(i,420);r=typeof i=="function"?i:r,ht(t,e,n).then(o=>r(null,o.fd)).catch(r)}s(Gf,"open");function Hf(t,e,i=S){i=typeof e=="function"?e:i,Ci(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(Hf,"readFile");function Kf(t,e,i,r=S){r=typeof i=="function"?i:r,Kt(t,e,typeof i!="function"?i:null).then(()=>r(null)).catch(r)}s(Kf,"writeFile");function Yf(t,e,i,r=S){r=typeof i=="function"?i:r,ur(t,e,typeof i=="function"?null:i)}s(Yf,"appendFile");function Xf(t,e,i=S){i=typeof e=="function"?e:i,T(t).stat().then(r=>i(null,typeof e=="object"&&e?.bigint?new J(r):r)).catch(i)}s(Xf,"fstat");function Jf(t,e=S){new fe(t).close().then(()=>e()).catch(e)}s(Jf,"close");function Qf(t,e,i=S){let r=typeof e=="number"?e:0;i=typeof e=="function"?e:i;let n=T(t);if(r<0)throw new c(22);n.truncate(r).then(()=>i()).catch(i)}s(Qf,"ftruncate");function Zf(t,e=S){T(t).sync().then(()=>e()).catch(e)}s(Zf,"fsync");function ed(t,e=S){T(t).datasync().then(()=>e()).catch(e)}s(ed,"fdatasync");function td(t,e,i,r,n,o=S){let a,l,u,f=null,d,h=new fe(t);if(typeof e=="string"){switch(d="utf8",typeof i){case"function":o=i;break;case"number":f=i,d=typeof r=="string"?r:"utf8",o=typeof n=="function"?n:o;break;default:o=typeof r=="function"?r:typeof n=="function"?n:o,o(new c(22,"Invalid arguments."));return}a=R(e),l=0,u=a.length;let b=o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,Z(a))).catch(b)}else{a=e,l=i,u=r,f=typeof n=="number"?n:null;let b=typeof n=="function"?n:o;h.write(a,l,u,f).then(({bytesWritten:m})=>b(null,m,a)).catch(b)}}s(td,"write");function id(t,e,i,r,n,o=S){new fe(t).read(e,i,r,n).then(({bytesRead:a,buffer:l})=>o(null,a,l)).catch(o)}s(id,"read");function rd(t,e,i,r=S){new fe(t).chown(e,i).then(()=>r()).catch(r)}s(rd,"fchown");function nd(t,e,i){new fe(t).chmod(e).then(()=>i()).catch(i)}s(nd,"fchmod");function od(t,e,i,r=S){new fe(t).utimes(e,i).then(()=>r()).catch(r)}s(od,"futimes");function sd(t,e=S){kn(t).then(()=>e()).catch(e)}s(sd,"rmdir");function ad(t,e,i=S){Nn(t,e).then(()=>i()).catch(i)}s(ad,"mkdir");function ld(t,e,i=S){i=typeof e=="function"?e:i,Ii(t,typeof e!="function"?e:{}).then(n=>i(null,n)).catch(i)}s(ld,"readdir");function cd(t,e,i=S){Tn(t,e).then(()=>i()).catch(i)}s(cd,"link");function ud(t,e,i,r=S){let n=typeof i=="string"?i:"file";r=typeof i=="function"?i:r,Fn(t,e,n).then(()=>r()).catch(r)}s(ud,"symlink");function fd(t,e,i=S){i=typeof e=="function"?e:i,In(t).then(r=>i(null,r)).catch(i)}s(fd,"readlink");function dd(t,e,i,r=S){Pn(t,e,i).then(()=>r()).catch(r)}s(dd,"chown");function hd(t,e,i,r=S){Cn(t,e,i).then(()=>r()).catch(r)}s(hd,"lchown");function pd(t,e,i=S){Ln(t,e).then(()=>i()).catch(i)}s(pd,"chmod");function yd(t,e,i=S){Rn(t,e).then(()=>i()).catch(i)}s(yd,"lchmod");function md(t,e,i,r=S){On(t,e,i).then(()=>r()).catch(r)}s(md,"utimes");function bd(t,e,i,r=S){Bn(t,e,i).then(()=>r()).catch(r)}s(bd,"lutimes");function gd(t,e,i=S){i=typeof e=="function"?e:i,Li(t,typeof e=="function"?null:e).then(r=>i(null,r)).catch(i)}s(gd,"realpath");function wd(t,e,i=S){let r=typeof e=="number"?e:4;i=typeof e=="function"?e:i,Dn(t,typeof e=="function"?null:e).then(()=>i()).catch(i)}s(wd,"access");function Sd(t,e,i=S){throw new c(95)}s(Sd,"watchFile");function _d(t,e=S){throw new c(95)}s(_d,"unwatchFile");function Ed(t,e,i=S){throw new c(95)}s(Ed,"watch");function xd(t,e){throw new c(95)}s(xd,"createReadStream");function vd(t,e){throw new c(95)}s(vd,"createWriteStream");function Ad(t){new c(95)}s(Ad,"rm");function kd(t){new c(95)}s(kd,"mkdtemp");function Nd(t,e,i,r){new c(95)}s(Nd,"copyFile");function Td(t){new c(95)}s(Td,"readv");function Fd(t,e,i,r){throw new c(95)}s(Fd,"writev");function Id(t){throw new c(95)}s(Id,"opendir");var en=eu(Vc(),1);var Qr=class extends en.Readable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesRead;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Qr,"ReadStream");var Zr=class extends en.Writable{close(e=()=>null){try{super.destroy(),super.emit("close"),e()}catch(i){e(i)}}bytesWritten;path;pending;addListener(e,i){return super.addListener(e,i)}on(e,i){return super.on(e,i)}once(e,i){return super.once(e,i)}prependListener(e,i){return super.prependListener(e,i)}prependOnceListener(e,i){return super.prependOnceListener(e,i)}};s(Zr,"WriteStream");function Gc(t,e=0,i=0){hs(new z(e,i,e,i,e,i)),or(t)}s(Gc,"initialize");async function Rg(t){("backend"in t||t instanceof X)&&(t={"/":t});for(let[e,i]of Object.entries(t))typeof i!="number"&&(i instanceof X||(gi(i)&&(i={backend:i}),t[e]=await Qi(i)));Gc(t)}s(Rg,"configure");var Tt=class{static FromListing(e){let i=new Tt,r=new Je;i._index.set("/",r);let n=[{pwd:"",tree:e,parent:r}];for(;n.length>0;){let o,{tree:a,pwd:l,parent:u}=n.pop();for(let f in a){if(!Object.hasOwn(a,f))continue;let d=a[f];if(d){let h=l+"/"+f;o=new Je,i._index.set(h,o),n.push({pwd:h,tree:d,parent:o})}else o=new Yi(new M({mode:U.FILE|365}));u&&u._listing.set(f,o)}}return i}_index=new Map;constructor(){this.add("/",new Je)}files(){let e=[];for(let i of this._index.values())for(let r of i.listing){let n=i.get(r);n?.isFile()&&e.push(n)}return e}add(e,i){if(!i)throw new Error("Inode must be specified");if(!e.startsWith("/"))throw new Error("Path must be absolute, got: "+e);if(this._index.has(e))return this._index.get(e)===i;let r=E(e),n=this._index.get(r);return!n&&e!="/"&&(n=new Je,!this.add(r,n))||e!="/"&&!n.add(L(e),i)?!1:(i.isDirectory()&&this._index.set(e,i),!0)}addFast(e,i){let r=E(e),n=L(e),o=this._index.get(r);return o||(o=new Je,this.addFast(r,o)),o.add(n,i)?(i.isDirectory()&&this._index.set(e,i),!0):!1}remove(e){let i=E(e),r=this._index.get(i);if(!r)return;let n=r.remove(L(e));if(!n)return;if(!n.isDirectory())return n;let o=n.listing;for(let a of o)this.remove(he(e,a));e!="/"&&this._index.delete(e)}ls(e){return this._index.get(e)?.listing}get(e){let i=E(e),r=this._index.get(i);return i==e?r:r?.get(L(e))}};s(Tt,"FileIndex");var pi=class{constructor(e){this.data=e}};s(pi,"IndexInode");var Yi=class extends pi{isFile(){return!0}isDirectory(){return!1}toStats(){return new M({mode:U.FILE|438,size:4096})}};s(Yi,"IndexFileInode");var Je=class extends pi{_listing=new Map;isFile(){return!1}isDirectory(){return!0}get stats(){return new M({mode:U.DIRECTORY|365,size:4096})}toStats(){return this.stats}get listing(){return[...this._listing.keys()]}get(e){return this._listing.get(e)}add(e,i){return this._listing.has(e)?!1:(this._listing.set(e,i),!0)}remove(e){let i=this._listing.get(e);if(i)return this._listing.delete(e),i}};s(Je,"IndexDirInode");var yi=class extends ln(X){_index;constructor(e){super(),this._index=Tt.FromListing(e)}async stat(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInode(i,e);throw new c(22,"Invalid inode.")}statSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.stats;if(i.isFile())return this.statFileInodeSync(i,e);throw new c(22,"Invalid inode.")}async openFile(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ut(this,e,i,o,o.fileData)}return this.openFileInode(n,e,i)}openFileSync(e,i,r){if(i.isWriteable())throw new c(1,e);let n=this._index.get(e);if(!n)throw c.ENOENT(e);if(!n.toStats().hasAccess(i.mode,r))throw c.EACCES(e);if(n.isDirectory()){let o=n.stats;return new ut(this,e,i,o,o.fileData)}return this.openFileInodeSync(n,e,i)}async readdir(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}readdirSync(e){let i=this._index.get(e);if(!i)throw c.ENOENT(e);if(i.isDirectory())return i.listing;throw c.ENOTDIR(e)}};s(yi,"FileIndexFS");var tn=class extends ct(yi){async statFileInode(e,i){return this.statFileInodeSync(e,i)}async openFileInode(e,i,r){return this.openFileInodeSync(e,i,r)}};s(tn,"SyncFileIndexFS");var rn=class extends wi(yi){statFileInodeSync(){throw new c(95)}openFileInodeSync(){throw new c(95)}};s(rn,"AsyncFileIndexFS");var Og=Ki;return tu(Bg);})();
|
|
5
5
|
/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
ieee754/index.js:
|