1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-07 17:29:31 +00:00
8bitworkshop/gen/index.esm-5YCYWKYY.js

4 lines
47 KiB
JavaScript

import"./chunk-5XVCUSSZ.js";function Pt(t,e){return Pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Pt(t,e)}function Bt(t,e){function r(){this.constructor=t}Pt(t,e),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function pt(t){var e=typeof Symbol=="function"&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function gt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;t=r.call(t);var n,i=[];try{for(;(e===void 0||0<e--)&&!(n=t.next()).done;)i.push(n.value)}catch(o){var f={error:o}}finally{try{n&&!n.done&&(r=t.return)&&r.call(t)}finally{if(f)throw f.error}}return i}function yt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(gt(arguments[e]));return t}var ke=typeof globalThis!="undefined"?globalThis:typeof global!="undefined"?global:{},g=typeof BigInt!="undefined"?BigInt:ke.BigInt||Number,ct=DataView;ct.prototype.setBigUint64||(ct.prototype.setBigUint64=function(t,e,r){if(e<Math.pow(2,32)){e=Number(e);var n=0}else{n=e.toString(2),e="";for(var i=0;i<64-n.length;i++)e+="0";e+=n,n=parseInt(e.substring(0,32),2),e=parseInt(e.substring(32),2)}this.setUint32(t+(r?0:4),e,r),this.setUint32(t+(r?4:0),n,r)},ct.prototype.getBigUint64=function(t,e){var r=this.getUint32(t+(e?0:4),e);t=this.getUint32(t+(e?4:0),e),r=r.toString(2),t=t.toString(2),e="";for(var n=0;n<32-r.length;n++)e+="0";return g("0b"+t+(e+r))});var ut=typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},Y=[],C=[],Ye=typeof Uint8Array!="undefined"?Uint8Array:Array,Mt=!1;function te(){Mt=!0;for(var t=0;64>t;++t)Y[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t],C["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(t)]=t;C[45]=62,C[95]=63}function xe(t,e,r){for(var n=[],i=e;i<r;i+=3)e=(t[i]<<16)+(t[i+1]<<8)+t[i+2],n.push(Y[e>>18&63]+Y[e>>12&63]+Y[e>>6&63]+Y[e&63]);return n.join("")}function ee(t){Mt||te();for(var e=t.length,r=e%3,n="",i=[],f=0,o=e-r;f<o;f+=16383)i.push(xe(t,f,f+16383>o?o:f+16383));return r===1?(t=t[e-1],n+=Y[t>>2],n+=Y[t<<4&63],n+="=="):r===2&&(t=(t[e-2]<<8)+t[e-1],n+=Y[t>>10],n+=Y[t>>4&63],n+=Y[t<<2&63],n+="="),i.push(n),i.join("")}function at(t,e,r,n,i){var f=8*i-n-1,o=(1<<f)-1,p=o>>1,E=-7;i=r?i-1:0;var w=r?-1:1,U=t[e+i];for(i+=w,r=U&(1<<-E)-1,U>>=-E,E+=f;0<E;r=256*r+t[e+i],i+=w,E-=8);for(f=r&(1<<-E)-1,r>>=-E,E+=n;0<E;f=256*f+t[e+i],i+=w,E-=8);if(r===0)r=1-p;else{if(r===o)return f?NaN:1/0*(U?-1:1);f+=Math.pow(2,n),r-=p}return(U?-1:1)*f*Math.pow(2,r-n)}function mt(t,e,r,n,i,f){var o,p=8*f-i-1,E=(1<<p)-1,w=E>>1,U=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;f=n?0:f-1;var a=n?1:-1,v=0>e||e===0&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(e=isNaN(e)?1:0,n=E):(n=Math.floor(Math.log(e)/Math.LN2),1>e*(o=Math.pow(2,-n))&&(n--,o*=2),e=1<=n+w?e+U/o:e+U*Math.pow(2,1-w),2<=e*o&&(n++,o/=2),n+w>=E?(e=0,n=E):1<=n+w?(e=(e*o-1)*Math.pow(2,i),n+=w):(e=e*Math.pow(2,w-1)*Math.pow(2,i),n=0));8<=i;t[r+f]=e&255,f+=a,e/=256,i-=8);for(n=n<<i|e,p+=i;0<p;t[r+f]=n&255,f+=a,n/=256,p-=8);t[r+f-a]|=128*v}var Fe={}.toString,re=Array.isArray||function(t){return Fe.call(t)=="[object Array]"};h.TYPED_ARRAY_SUPPORT=ut.TYPED_ARRAY_SUPPORT!==void 0?ut.TYPED_ARRAY_SUPPORT:!0;var Ge=h.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function G(t,e){if((h.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<e)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=h.prototype):(t===null&&(t=new h(e)),t.length=e),t}function h(t,e,r){if(!(h.TYPED_ARRAY_SUPPORT||this instanceof h))return new h(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw Error("If encoding is specified then the first argument must be a string");return Nt(this,t)}return ne(this,t,e,r)}h.poolSize=8192;h._augment=function(t){return t.__proto__=h.prototype,t};function ne(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');if(typeof ArrayBuffer!="undefined"&&e instanceof ArrayBuffer){if(e.byteLength,0>r||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=r===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,r):new Uint8Array(e,r,n),h.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=h.prototype):t=Dt(t,e),t}if(typeof e=="string"){if(n=t,t=r,(typeof t!="string"||t==="")&&(t="utf8"),!h.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return r=oe(e,t)|0,n=G(n,r),e=n.write(e,t),e!==r&&(n=n.slice(0,e)),n}return je(t,e)}h.from=function(t,e,r){return ne(null,t,e,r)};h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array);function ie(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(0>t)throw new RangeError('"size" argument must not be negative')}h.alloc=function(t,e,r){return ie(t),t=0>=t?G(null,t):e!==void 0?typeof r=="string"?G(null,t).fill(e,r):G(null,t).fill(e):G(null,t),t};function Nt(t,e){if(ie(e),t=G(t,0>e?0:Ct(e)|0),!h.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}h.allocUnsafe=function(t){return Nt(null,t)};h.allocUnsafeSlow=function(t){return Nt(null,t)};function Dt(t,e){var r=0>e.length?0:Ct(e.length)|0;t=G(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function je(t,e){if(x(e)){var r=Ct(e.length)|0;return t=G(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer!="undefined"&&e.buffer instanceof ArrayBuffer||"length"in e)return(r=typeof e.length!="number")||(r=e.length,r=r!==r),r?G(t,0):Dt(t,e);if(e.type==="Buffer"&&re(e.data))return Dt(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Ct(t){if(t>=(h.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(h.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return t|0}h.isBuffer=ge;function x(t){return!(t==null||!t._isBuffer)}h.compare=function(t,e){if(!x(t)||!x(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,f=Math.min(r,n);i<f;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0};h.isEncoding=function(t){switch(String(t).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}};h.concat=function(t,e){if(!re(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return h.alloc(0);var r;if(e===void 0)for(r=e=0;r<t.length;++r)e+=t[r].length;e=h.allocUnsafe(e);var n=0;for(r=0;r<t.length;++r){var i=t[r];if(!x(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(e,n),n+=i.length}return e};function oe(t,e){if(x(t))return t.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return _t(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return pe(t).length;default:if(n)return _t(t).length;e=(""+e).toLowerCase(),n=!0}}h.byteLength=oe;function We(t,e,r){var n=!1;if((e===void 0||0>e)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),0>=r)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":for(t=e,e=r,r=this.length,(!t||0>t)&&(t=0),(!e||0>e||e>r)&&(e=r),n="",r=t;r<e;++r)t=n,n=this[r],n=16>n?"0"+n.toString(16):n.toString(16),n=t+n;return n;case"utf8":case"utf-8":return ue(this,e,r);case"ascii":for(t="",r=Math.min(this.length,r);e<r;++e)t+=String.fromCharCode(this[e]&127);return t;case"latin1":case"binary":for(t="",r=Math.min(this.length,r);e<r;++e)t+=String.fromCharCode(this[e]);return t;case"base64":return e=e===0&&r===this.length?ee(this):ee(this.slice(e,r)),e;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(e=this.slice(e,r),r="",t=0;t<e.length;t+=2)r+=String.fromCharCode(e[t]+256*e[t+1]);return r;default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}h.prototype._isBuffer=!0;function Q(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}h.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Q(this,e,e+1);return this};h.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Q(this,e,e+3),Q(this,e+1,e+2);return this};h.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Q(this,e,e+7),Q(this,e+1,e+6),Q(this,e+2,e+5),Q(this,e+3,e+4);return this};h.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?ue(this,0,t):We.apply(this,arguments)};h.prototype.equals=function(t){if(!x(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:h.compare(this,t)===0};h.prototype.inspect=function(){var t="";return 0<this.length&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(t+=" ... ")),"<Buffer "+t+">"};h.prototype.compare=function(t,e,r,n,i){if(!x(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),n===void 0&&(n=0),i===void 0&&(i=this.length),0>e||r>t.length||0>n||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;var f=i-n,o=r-e,p=Math.min(f,o);for(n=this.slice(n,i),t=t.slice(e,r),e=0;e<p;++e)if(n[e]!==t[e]){f=n[e],o=t[e];break}return f<o?-1:o<f?1:0};function se(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):2147483647<r?r=2147483647:-2147483648>r&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),0>r&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(0>r)if(i)r=0;else return-1;if(typeof e=="string"&&(e=h.from(e,n)),x(e))return e.length===0?-1:fe(t,e,r,n,i);if(typeof e=="number")return e&=255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):fe(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function fe(t,e,r,n,i){function f(w,U){return o===1?w[U]:w.readUInt16BE(U*o)}var o=1,p=t.length,E=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(2>t.length||2>e.length)return-1;o=2,p/=2,E/=2,r/=2}if(i)for(n=-1;r<p;r++)if(f(t,r)===f(e,n===-1?0:r-n)){if(n===-1&&(n=r),r-n+1===E)return n*o}else n!==-1&&(r-=r-n),n=-1;else for(r+E>p&&(r=p-E);0<=r;r--){for(p=!0,n=0;n<E;n++)if(f(t,r+n)!==f(e,n)){p=!1;break}if(p)return r}return-1}h.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};h.prototype.indexOf=function(t,e,r){return se(this,t,e,r,!0)};h.prototype.lastIndexOf=function(t,e,r){return se(this,t,e,r,!1)};h.prototype.write=function(t,e,r,n){if(e===void 0)n="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")n=e,r=this.length,e=0;else if(isFinite(e))e|=0,isFinite(r)?(r|=0,n===void 0&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-e;if((r===void 0||r>i)&&(r=i),0<t.length&&(0>r||0>e)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");for(n||(n="utf8"),i=!1;;)switch(n){case"hex":t:{if(e=Number(e)||0,n=this.length-e,r?(r=Number(r),r>n&&(r=n)):r=n,n=t.length,n%2!=0)throw new TypeError("Invalid hex string");for(r>n/2&&(r=n/2),n=0;n<r;++n){if(i=parseInt(t.substr(2*n,2),16),isNaN(i)){t=n;break t}this[e+n]=i}t=n}return t;case"utf8":case"utf-8":return ht(_t(t,this.length-e),this,e,r);case"ascii":return ht(le(t),this,e,r);case"latin1":case"binary":return ht(le(t),this,e,r);case"base64":return ht(pe(t),this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=t,i=this.length-e;for(var f=[],o=0;o<n.length&&!(0>(i-=2));++o){var p=n.charCodeAt(o);t=p>>8,p%=256,f.push(p),f.push(t)}return ht(f,this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ue(t,e,r){r=Math.min(t.length,r);for(var n=[];e<r;){var i=t[e],f=null,o=239<i?4:223<i?3:191<i?2:1;if(e+o<=r)switch(o){case 1:128>i&&(f=i);break;case 2:var p=t[e+1];(p&192)==128&&(i=(i&31)<<6|p&63,127<i&&(f=i));break;case 3:p=t[e+1];var E=t[e+2];(p&192)==128&&(E&192)==128&&(i=(i&15)<<12|(p&63)<<6|E&63,2047<i&&(55296>i||57343<i)&&(f=i));break;case 4:p=t[e+1],E=t[e+2];var w=t[e+3];(p&192)==128&&(E&192)==128&&(w&192)==128&&(i=(i&15)<<18|(p&63)<<12|(E&63)<<6|w&63,65535<i&&1114112>i&&(f=i))}f===null?(f=65533,o=1):65535<f&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|f&1023),n.push(f),e+=o}if(t=n.length,t<=he)n=String.fromCharCode.apply(String,n);else{for(r="",e=0;e<t;)r+=String.fromCharCode.apply(String,n.slice(e,e+=he));n=r}return n}var he=4096;h.prototype.slice=function(t,e){var r=this.length;if(t=~~t,e=e===void 0?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),e<t&&(e=t),h.TYPED_ARRAY_SUPPORT)e=this.subarray(t,e),e.__proto__=h.prototype;else{r=e-t,e=new h(r,void 0);for(var n=0;n<r;++n)e[n]=this[n+t]}return e};function N(t,e,r){if(t%1!=0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length),r=this[t];for(var n=1,i=0;++i<e&&(n*=256);)r+=this[t+i]*n;return r};h.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length),r=this[t+--e];for(var n=1;0<e&&(n*=256);)r+=this[t+--e]*n;return r};h.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]};h.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8};h.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]};h.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]};h.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])};h.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length),r=this[t];for(var n=1,i=0;++i<e&&(n*=256);)r+=this[t+i]*n;return r>=128*n&&(r-=Math.pow(2,8*e)),r};h.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||N(t,e,this.length),r=e;for(var n=1,i=this[t+--r];0<r&&(n*=256);)i+=this[t+--r]*n;return i>=128*n&&(i-=Math.pow(2,8*e)),i};h.prototype.readInt8=function(t,e){return e||N(t,1,this.length),this[t]&128?-1*(255-this[t]+1):this[t]};h.prototype.readInt16LE=function(t,e){return e||N(t,2,this.length),t=this[t]|this[t+1]<<8,t&32768?t|4294901760:t};h.prototype.readInt16BE=function(t,e){return e||N(t,2,this.length),t=this[t+1]|this[t]<<8,t&32768?t|4294901760:t};h.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};h.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};h.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),at(this,t,!0,23,4)};h.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),at(this,t,!1,23,4)};h.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),at(this,t,!0,52,8)};h.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),at(this,t,!1,52,8)};function D(t,e,r,n,i,f){if(!x(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<f)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||D(this,t,e,r,Math.pow(2,8*r)-1,0),n=1;var i=0;for(this[e]=t&255;++i<r&&(n*=256);)this[e+i]=t/n&255;return e+r};h.prototype.writeUIntBE=function(t,e,r,n){t=+t,e|=0,r|=0,n||D(this,t,e,r,Math.pow(2,8*r)-1,0),n=r-1;var i=1;for(this[e+n]=t&255;0<=--n&&(i*=256);)this[e+n]=t/i&255;return e+r};h.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};function vt(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,f=Math.min(t.length-r,2);i<f;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):vt(this,t,e,!0),e+2};h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):vt(this,t,e,!1),e+2};function wt(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,f=Math.min(t.length-r,4);i<f;++i)t[r+i]=e>>>8*(n?i:3-i)&255}h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):wt(this,t,e,!0),e+4};h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):wt(this,t,e,!1),e+4};h.prototype.writeIntLE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),D(this,t,e,r,n-1,-n)),n=0;var i=1,f=0;for(this[e]=t&255;++n<r&&(i*=256);)0>t&&f===0&&this[e+n-1]!==0&&(f=1),this[e+n]=(t/i>>0)-f&255;return e+r};h.prototype.writeIntBE=function(t,e,r,n){t=+t,e|=0,n||(n=Math.pow(2,8*r-1),D(this,t,e,r,n-1,-n)),n=r-1;var i=1,f=0;for(this[e+n]=t&255;0<=--n&&(i*=256);)0>t&&f===0&&this[e+n+1]!==0&&(f=1),this[e+n]=(t/i>>0)-f&255;return e+r};h.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=t&255,e+1};h.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):vt(this,t,e,!0),e+2};h.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):vt(this,t,e,!1),e+2};h.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):wt(this,t,e,!0),e+4};h.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):wt(this,t,e,!1),e+4};function Et(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}h.prototype.writeFloatLE=function(t,e,r){return r||Et(this,t,e,4),mt(this,t,e,!0,23,4),e+4};h.prototype.writeFloatBE=function(t,e,r){return r||Et(this,t,e,4),mt(this,t,e,!1,23,4),e+4};h.prototype.writeDoubleLE=function(t,e,r){return r||Et(this,t,e,8),mt(this,t,e,!0,52,8),e+8};h.prototype.writeDoubleBE=function(t,e,r){return r||Et(this,t,e,8),mt(this,t,e,!1,52,8),e+8};h.prototype.copy=function(t,e,r,n){if(r||(r=0),n||n===0||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),0<n&&n<r&&(n=r),n===r||t.length===0||this.length===0)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&r<e&&e<n)for(n=i-1;0<=n;--n)t[n+e]=this[n+r];else if(1e3>i||!h.TYPED_ARRAY_SUPPORT)for(n=0;n<i;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i};h.prototype.fill=function(t,e,r,n){if(typeof t=="string"){if(typeof e=="string"?(n=e,e=0,r=this.length):typeof r=="string"&&(n=r,r=this.length),t.length===1){var i=t.charCodeAt(0);256>i&&(t=i)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof t=="number"&&(t&=255);if(0>e||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t=="number")for(n=e;n<r;++n)this[n]=t;else for(t=x(t)?t:_t(new h(t,n).toString()),i=t.length,n=0;n<r-e;++n)this[n+e]=t[n%i];return this};var ze=/[^+\/0-9A-Za-z-_]/g;function _t(t,e){e=e||1/0;for(var r,n=t.length,i=null,f=[],o=0;o<n;++o){if(r=t.charCodeAt(o),55295<r&&57344>r){if(!i){if(56319<r){-1<(e-=3)&&f.push(239,191,189);continue}else if(o+1===n){-1<(e-=3)&&f.push(239,191,189);continue}i=r;continue}if(56320>r){-1<(e-=3)&&f.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&-1<(e-=3)&&f.push(239,191,189);if(i=null,128>r){if(0>--e)break;f.push(r)}else if(2048>r){if(0>(e-=2))break;f.push(r>>6|192,r&63|128)}else if(65536>r){if(0>(e-=3))break;f.push(r>>12|224,r>>6&63|128,r&63|128)}else if(1114112>r){if(0>(e-=4))break;f.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return f}function le(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function pe(t){if(t=(t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(ze,""),2>t.length)t="";else for(;t.length%4!=0;)t+="=";Mt||te();var e=t.length;if(0<e%4)throw Error("Invalid string. Length must be a multiple of 4");var r=t[e-2]==="="?2:t[e-1]==="="?1:0,n=new Ye(3*e/4-r),i=0<r?e-4:e,f=0;for(e=0;e<i;e+=4){var o=C[t.charCodeAt(e)]<<18|C[t.charCodeAt(e+1)]<<12|C[t.charCodeAt(e+2)]<<6|C[t.charCodeAt(e+3)];n[f++]=o>>16&255,n[f++]=o>>8&255,n[f++]=o&255}return r===2?(o=C[t.charCodeAt(e)]<<2|C[t.charCodeAt(e+1)]>>4,n[f++]=o&255):r===1&&(o=C[t.charCodeAt(e)]<<10|C[t.charCodeAt(e+1)]<<4|C[t.charCodeAt(e+2)]>>2,n[f++]=o>>8&255,n[f++]=o&255),n}function ht(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ge(t){return t!=null&&(!!t._isBuffer||ye(t)||typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ye(t.slice(0,0)))}function ye(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var At=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Ge,Buffer:h,SlowBuffer:function(t){return+t!=t&&(t=0),h.alloc(+t)},isBuffer:ge}),P=h,St=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Lt(t,e){return e={exports:{}},t(e,e.exports),e.exports}function ce(){throw Error("setTimeout has not been defined")}function ae(){throw Error("clearTimeout has not been defined")}var W=ce,z=ae;typeof ut.setTimeout=="function"&&(W=setTimeout);typeof ut.clearTimeout=="function"&&(z=clearTimeout);function me(t){if(W===setTimeout)return setTimeout(t,0);if((W===ce||!W)&&setTimeout)return W=setTimeout,setTimeout(t,0);try{return W(t,0)}catch(e){try{return W.call(null,t,0)}catch(r){return W.call(this,t,0)}}}function Ve(t){if(z===clearTimeout)return clearTimeout(t);if((z===ae||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(t);try{return z(t)}catch(e){try{return z.call(null,t)}catch(r){return z.call(this,t)}}}var j=[],et=!1,Z,Tt=-1;function He(){et&&Z&&(et=!1,Z.length?j=Z.concat(j):Tt=-1,j.length&&ve())}function ve(){if(!et){var t=me(He);et=!0;for(var e=j.length;e;){for(Z=j,j=[];++Tt<e;)Z&&Z[Tt].run();Tt=-1,e=j.length}Z=null,et=!1,Ve(t)}}function we(t){var e=Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];j.push(new Ee(t,e)),j.length!==1||et||me(ve)}function Ee(t,e){this.fun=t,this.array=e}Ee.prototype.run=function(){this.fun.apply(null,this.array)};function J(){}var rt=ut.performance||{},Ke=rt.now||rt.mozNow||rt.msNow||rt.oNow||rt.webkitNow||function(){return new Date().getTime()},Xe=new Date,qe={nextTick:we,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:J,addListener:J,once:J,off:J,removeListener:J,removeAllListeners:J,emit:J,binding:function(){throw Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(){throw Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*Ke.call(rt),r=Math.floor(e);return e=Math.floor(e%1*1e9),t&&(r-=t[0],e-=t[1],0>e&&(r--,e+=1e9)),[r,e]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Xe)/1e3}},_e=Lt(function(t,e){function r(f,o){for(var p in f)o[p]=f[p]}function n(f,o,p){return i(f,o,p)}var i=At.Buffer;i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=At:(r(At,e),e.Buffer=n),n.prototype=Object.create(i.prototype),r(i,n),n.from=function(f,o,p){if(typeof f=="number")throw new TypeError("Argument must not be a number");return i(f,o,p)},n.alloc=function(f,o,p){if(typeof f!="number")throw new TypeError("Argument must be a number");return f=i(f),o!==void 0?typeof p=="string"?f.fill(o,p):f.fill(o):f.fill(0),f},n.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return i(f)},n.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return At.SlowBuffer(f)}}),Qe=Lt(function(t,e){function r(){throw Error(`secure random number generation not supported by this browser
use chrome, FireFox or Internet Explorer 11`)}function n(v,I){if(typeof v!="number"||v!==v)throw new TypeError("offset must be a number");if(v>a||0>v)throw new TypeError("offset must be a uint32");if(v>w||v>I)throw new RangeError("offset out of range")}function i(v,I,B){if(typeof v!="number"||v!==v)throw new TypeError("size must be a number");if(v>a||0>v)throw new TypeError("size must be a uint32");if(v+I>B||v>w)throw new RangeError("buffer too small")}function f(v,I,B,k){if(!(E.isBuffer(v)||v instanceof St.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof I=="function")k=I,I=0,B=v.length;else if(typeof B=="function")k=B,B=v.length-I;else if(typeof k!="function")throw new TypeError('"cb" argument must be a function');return n(I,v.length),i(B,I,v.length),o(v,I,B,k)}function o(v,I,B,k){if(I=new Uint8Array(v.buffer,I,B),U.getRandomValues(I),k)we(function(){k(null,v)});else return v}function p(v,I,B){if(typeof I=="undefined"&&(I=0),!(E.isBuffer(v)||v instanceof St.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return n(I,v.length),B===void 0&&(B=v.length-I),i(B,I,v.length),o(v,I,B)}var E=_e.Buffer,w=_e.kMaxLength,U=St.crypto||St.msCrypto,a=Math.pow(2,32)-1;U&&U.getRandomValues?(e.randomFill=f,e.randomFillSync=p):(e.randomFill=r,e.randomFillSync=r)}),Ze=Lt(function(t){t.exports=Qe}).randomFillSync,Je=Math.floor(.001*(Date.now()-performance.now()));function F(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function Ae(t,e){for(var r="",n=0,i=-1,f=0,o,p=0;p<=t.length;++p){if(p<t.length)o=t.charCodeAt(p);else{if(o===47)break;o=47}if(o===47){if(i!==p-1&&f!==1)if(i!==p-1&&f===2){if(2>r.length||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(2<r.length){if(i=r.lastIndexOf("/"),i!==r.length-1){i===-1?(r="",n=0):(r=r.slice(0,i),n=r.length-1-r.lastIndexOf("/")),i=p,f=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=p,f=0;continue}}e&&(r=0<r.length?r+"/..":"..",n=2)}else r=0<r.length?r+("/"+t.slice(i+1,p)):t.slice(i+1,p),n=p-i-1;i=p,f=0}else o===46&&f!==-1?++f:f=-1}return r}var lt={resolve:function(){for(var t="",e=!1,r,n=arguments.length-1;-1<=n&&!e;n--){if(0<=n)var i=arguments[n];else r===void 0&&(r=qe.cwd()),i=r;F(i),i.length!==0&&(t=i+"/"+t,e=i.charCodeAt(0)===47)}return t=Ae(t,!e),e?0<t.length?"/"+t:"/":0<t.length?t:"."},normalize:function(t){if(F(t),t.length===0)return".";var e=t.charCodeAt(0)===47,r=t.charCodeAt(t.length-1)===47;return t=Ae(t,!e),t.length!==0||e||(t="."),0<t.length&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return F(t),0<t.length&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,e=0;e<arguments.length;++e){var r=arguments[e];F(r),0<r.length&&(t=t===void 0?r:t+("/"+r))}return t===void 0?".":lt.normalize(t)},relative:function(t,e){if(F(t),F(e),t===e||(t=lt.resolve(t),e=lt.resolve(e),t===e))return"";for(var r=1;r<t.length&&t.charCodeAt(r)===47;++r);for(var n=t.length,i=n-r,f=1;f<e.length&&e.charCodeAt(f)===47;++f);for(var o=e.length-f,p=i<o?i:o,E=-1,w=0;w<=p;++w){if(w===p){if(o>p){if(e.charCodeAt(f+w)===47)return e.slice(f+w+1);if(w===0)return e.slice(f+w)}else i>p&&(t.charCodeAt(r+w)===47?E=w:w===0&&(E=0));break}var U=t.charCodeAt(r+w),a=e.charCodeAt(f+w);if(U!==a)break;U===47&&(E=w)}for(i="",w=r+E+1;w<=n;++w)(w===n||t.charCodeAt(w)===47)&&(i=i.length===0?i+"..":i+"/..");return 0<i.length?i+e.slice(f+E):(f+=E,e.charCodeAt(f)===47&&++f,e.slice(f))},_makeLong:function(t){return t},dirname:function(t){if(F(t),t.length===0)return".";for(var e=t.charCodeAt(0),r=e===47,n=-1,i=!0,f=t.length-1;1<=f;--f)if(e=t.charCodeAt(f),e===47){if(!i){n=f;break}}else i=!1;return n===-1?r?"/":".":r&&n===1?"//":t.slice(0,n)},basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');F(t);var r=0,n=-1,i=!0,f;if(e!==void 0&&0<e.length&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var o=e.length-1,p=-1;for(f=t.length-1;0<=f;--f){var E=t.charCodeAt(f);if(E===47){if(!i){r=f+1;break}}else p===-1&&(i=!1,p=f+1),0<=o&&(E===e.charCodeAt(o)?--o==-1&&(n=f):(o=-1,n=p))}return r===n?n=p:n===-1&&(n=t.length),t.slice(r,n)}for(f=t.length-1;0<=f;--f)if(t.charCodeAt(f)===47){if(!i){r=f+1;break}}else n===-1&&(i=!1,n=f+1);return n===-1?"":t.slice(r,n)},extname:function(t){F(t);for(var e=-1,r=0,n=-1,i=!0,f=0,o=t.length-1;0<=o;--o){var p=t.charCodeAt(o);if(p===47){if(!i){r=o+1;break}}else n===-1&&(i=!1,n=o+1),p===46?e===-1?e=o:f!==1&&(f=1):e!==-1&&(f=-1)}return e===-1||n===-1||f===0||f===1&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);var e=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return t=e?e===t.root?e+r:e+"/"+r:r,t},parse:function(t){F(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;var r=t.charCodeAt(0),n=r===47;if(n){e.root="/";var i=1}else i=0;for(var f=-1,o=0,p=-1,E=!0,w=t.length-1,U=0;w>=i;--w)if(r=t.charCodeAt(w),r===47){if(!E){o=w+1;break}}else p===-1&&(E=!1,p=w+1),r===46?f===-1?f=w:U!==1&&(U=1):f!==-1&&(U=-1);return f===-1||p===-1||U===0||U===1&&f===p-1&&f===o+1?p!==-1&&(e.base=o===0&&n?e.name=t.slice(1,p):e.name=t.slice(o,p)):(o===0&&n?(e.name=t.slice(1,f),e.base=t.slice(1,p)):(e.name=t.slice(o,f),e.base=t.slice(o,p)),e.ext=t.slice(f,p)),0<o?e.dir=t.slice(0,o-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null},Se=lt.posix=lt,$e=Object.freeze({__proto__:null,default:Se,__moduleExports:Se}),Te={hrtime:function(t){return function(e){return e=t(e),1e9*e[0]+e[1]}}(function(t){var e=.001*performance.now(),r=Math.floor(e)+Je;return e=Math.floor(e%1*1e9),t&&(r-=t[0],e-=t[1],0>e&&(r--,e+=1e9)),[r,e]}),exit:function(t){throw new ir(t)},kill:function(t){throw new or(t)},randomFillSync:Ze,isTTY:function(){return!0},path:$e,fs:null},d,$=g(1),V=g(2),nt=g(4),it=g(8),H=g(16),kt=g(32),K=g(64),ot=g(128),Ut=g(256),Yt=g(512),xt=g(1024),Ft=g(2048),Gt=g(4096),Rt=g(8192),Ot=g(16384),jt=g(32768),Wt=g(65536),zt=g(131072),Vt=g(262144),Ht=g(524288),Kt=g(1048576),X=g(2097152),It=g(4194304),dt=g(8388608),Xt=g(16777216),qt=g(33554432),Qt=g(67108864),b=g(134217728),Ue=g(268435456),st=$|V|nt|it|H|kt|K|ot|Ut|Yt|xt|Ft|Gt|Rt|Ot|jt|Wt|zt|Vt|Ht|Kt|X|dt|It|Xt|Qt|qt|b|Ue,Re=$|V|nt|it|H|kt|K|ot|Ut|X|It|dt|b,be=g(0),Zt=it|H|ot|Yt|xt|Ft|Gt|Rt|Ot|jt|Wt|zt|Vt|Ht|Kt|X|dt|Xt|Qt|qt|b,Oe=Zt|Re,Ie=V|it|K|X|b|Ue,tr=V|it|K|X|b,er=g(0),rr={E2BIG:1,EACCES:2,EADDRINUSE:3,EADDRNOTAVAIL:4,EAFNOSUPPORT:5,EALREADY:7,EAGAIN:6,EBADF:8,EBADMSG:9,EBUSY:10,ECANCELED:11,ECHILD:12,ECONNABORTED:13,ECONNREFUSED:14,ECONNRESET:15,EDEADLOCK:16,EDESTADDRREQ:17,EDOM:18,EDQUOT:19,EEXIST:20,EFAULT:21,EFBIG:22,EHOSTDOWN:23,EHOSTUNREACH:23,EIDRM:24,EILSEQ:25,EINPROGRESS:26,EINTR:27,EINVAL:28,EIO:29,EISCONN:30,EISDIR:31,ELOOP:32,EMFILE:33,EMLINK:34,EMSGSIZE:35,EMULTIHOP:36,ENAMETOOLONG:37,ENETDOWN:38,ENETRESET:39,ENETUNREACH:40,ENFILE:41,ENOBUFS:42,ENODEV:43,ENOENT:44,ENOEXEC:45,ENOLCK:46,ENOLINK:47,ENOMEM:48,ENOMSG:49,ENOPROTOOPT:50,ENOSPC:51,ENOSYS:52,ENOTCONN:53,ENOTDIR:54,ENOTEMPTY:55,ENOTRECOVERABLE:56,ENOTSOCK:57,ENOTTY:59,ENXIO:60,EOVERFLOW:61,EOWNERDEAD:62,EPERM:63,EPIPE:64,EPROTO:65,EPROTONOSUPPORT:66,EPROTOTYPE:67,ERANGE:68,EROFS:69,ESPIPE:70,ESRCH:71,ESTALE:72,ETIMEDOUT:73,ETXTBSY:74,EXDEV:75},de=(d={},d[6]="SIGHUP",d[8]="SIGINT",d[11]="SIGQUIT",d[7]="SIGILL",d[15]="SIGTRAP",d[0]="SIGABRT",d[2]="SIGBUS",d[5]="SIGFPE",d[9]="SIGKILL",d[20]="SIGUSR1",d[12]="SIGSEGV",d[21]="SIGUSR2",d[10]="SIGPIPE",d[1]="SIGALRM",d[14]="SIGTERM",d[3]="SIGCHLD",d[4]="SIGCONT",d[13]="SIGSTOP",d[16]="SIGTSTP",d[17]="SIGTTIN",d[18]="SIGTTOU",d[19]="SIGURG",d[23]="SIGXCPU",d[24]="SIGXFSZ",d[22]="SIGVTALRM",d),nr=$|V|H|ot|X|b,Pe=$|K|H|ot|X|b;function tt(t){var e=Math.trunc(t);return t=g(Math.round(1e6*(t-e))),g(e)*g(1e6)+t}function ft(t){return typeof t=="number"&&(t=Math.trunc(t)),t=g(t),Number(t/g(1e6))}function R(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return t.apply(void 0,yt(e))}catch(n){if(n&&n.code&&typeof n.code=="string")return rr[n.code]||28;if(n instanceof Jt)return n.errno;throw n}}}function Be(t,e){var r=t.FD_MAP.get(e);if(!r)throw new Jt(8);if(r.filetype===void 0){var n=t.bindings.fs.fstatSync(r.real);t=Me(t,e,n),e=t.rightsBase,n=t.rightsInheriting,r.filetype=t.filetype,r.rights||(r.rights={base:e,inheriting:n})}return r}function Me(t,e,r){switch(!0){case r.isBlockDevice():return{filetype:1,rightsBase:st,rightsInheriting:st};case r.isCharacterDevice():return e!==void 0&&t.bindings.isTTY(e)?{filetype:2,rightsBase:tr,rightsInheriting:er}:{filetype:2,rightsBase:st,rightsInheriting:st};case r.isDirectory():return{filetype:3,rightsBase:Zt,rightsInheriting:Oe};case r.isFIFO():return{filetype:6,rightsBase:Ie,rightsInheriting:st};case r.isFile():return{filetype:4,rightsBase:Re,rightsInheriting:be};case r.isSocket():return{filetype:6,rightsBase:Ie,rightsInheriting:st};case r.isSymbolicLink():return{filetype:7,rightsBase:g(0),rightsInheriting:g(0)};default:return{filetype:0,rightsBase:g(0),rightsInheriting:g(0)}}}var Jt=function(t){function e(r){var n=t.call(this)||this;return n.errno=r,Object.setPrototypeOf(n,e.prototype),n}return Bt(e,t),e}(Error),ir=function(t){function e(r){var n=t.call(this,"WASI Exit error: "+r)||this;return n.code=r,Object.setPrototypeOf(n,e.prototype),n}return Bt(e,t),e}(Error),or=function(t){function e(r){var n=t.call(this,"WASI Kill signal: "+r)||this;return n.signal=r,Object.setPrototypeOf(n,e.prototype),n}return Bt(e,t),e}(Error),sr=function(){function t(e){function r(s){switch(s){case 1:return U.hrtime();case 0:return tt(Date.now());case 2:case 3:return U.hrtime()-Le;default:return null}}function n(s,u){if(s=Be(o,s),u!==g(0)&&(s.rights.base&u)===g(0))throw new Jt(63);return s}function i(s,u){return o.refreshMemory(),Array.from({length:u},function(l,c){return c=s+8*c,l=o.view.getUint32(c,!0),c=o.view.getUint32(c+4,!0),new Uint8Array(o.memory.buffer,l,c)})}var f,o=this,p={};e&&e.preopens?p=e.preopens:e&&e.preopenDirectories&&(p=e.preopenDirectories);var E={};e&&e.env&&(E=e.env);var w=[];e&&e.args&&(w=e.args);var U=Te;e&&e.bindings&&(U=e.bindings),this.view=this.memory=void 0,this.bindings=U,this.FD_MAP=new Map([[0,{real:0,filetype:2,rights:{base:nr,inheriting:g(0)},path:void 0}],[1,{real:1,filetype:2,rights:{base:Pe,inheriting:g(0)},path:void 0}],[2,{real:2,filetype:2,rights:{base:Pe,inheriting:g(0)},path:void 0}]]);var a=this.bindings.fs,v=this.bindings.path;try{for(var I=pt(Object.entries(p)),B=I.next();!B.done;B=I.next()){var k=gt(B.value,2),Ne=k[0],$t=k[1],De=a.openSync($t,a.constants.O_RDONLY),Ce=yt(this.FD_MAP.keys()).reverse()[0]+1;this.FD_MAP.set(Ce,{real:De,filetype:3,rights:{base:Zt,inheriting:Oe},fakePath:Ne,path:$t})}}catch(s){var bt={error:s}}finally{try{B&&!B.done&&(f=I.return)&&f.call(I)}finally{if(bt)throw bt.error}}var Le=U.hrtime();this.wasiImport={args_get:function(s,u){o.refreshMemory();var l=s,c=u;return w.forEach(function(y){o.view.setUint32(l,c,!0),l+=4,c+=P.from(o.memory.buffer).write(y+"\0",c)}),0},args_sizes_get:function(s,u){return o.refreshMemory(),o.view.setUint32(s,w.length,!0),s=w.reduce(function(l,c){return l+P.byteLength(c)+1},0),o.view.setUint32(u,s,!0),0},environ_get:function(s,u){o.refreshMemory();var l=s,c=u;return Object.entries(E).forEach(function(y){var m=gt(y,2);y=m[0],m=m[1],o.view.setUint32(l,c,!0),l+=4,c+=P.from(o.memory.buffer).write(y+"="+m+"\0",c)}),0},environ_sizes_get:function(s,u){o.refreshMemory();var l=Object.entries(E).map(function(y){return y=gt(y,2),y[0]+"="+y[1]+"\0"}),c=l.reduce(function(y,m){return y+P.byteLength(m)},0);return o.view.setUint32(s,l.length,!0),o.view.setUint32(u,c,!0),0},clock_res_get:function(s,u){switch(s){case 1:case 2:case 3:var l=g(1);break;case 0:l=g(1e3)}return o.view.setBigUint64(u,l),0},clock_time_get:function(s,u,l){return o.refreshMemory(),s=r(s),s===null?28:(o.view.setBigUint64(l,g(s),!0),0)},fd_advise:R(function(s){return n(s,ot),52}),fd_allocate:R(function(s){return n(s,Ut),52}),fd_close:R(function(s){var u=n(s,g(0));return a.closeSync(u.real),o.FD_MAP.delete(s),0}),fd_datasync:R(function(s){return s=n(s,$),a.fdatasyncSync(s.real),0}),fd_fdstat_get:R(function(s,u){return s=n(s,g(0)),o.refreshMemory(),o.view.setUint8(u,s.filetype),o.view.setUint16(u+2,0,!0),o.view.setUint16(u+4,0,!0),o.view.setBigUint64(u+8,g(s.rights.base),!0),o.view.setBigUint64(u+8+8,g(s.rights.inheriting),!0),0}),fd_fdstat_set_flags:R(function(s){return n(s,it),52}),fd_fdstat_set_rights:R(function(s,u,l){return s=n(s,g(0)),(s.rights.base|u)>s.rights.base||(s.rights.inheriting|l)>s.rights.inheriting?63:(s.rights.base=u,s.rights.inheriting=l,0)}),fd_filestat_get:R(function(s,u){s=n(s,X);var l=a.fstatSync(s.real);return o.refreshMemory(),o.view.setBigUint64(u,g(l.dev),!0),u+=8,o.view.setBigUint64(u,g(l.ino),!0),u+=8,o.view.setUint8(u,s.filetype),u+=8,o.view.setBigUint64(u,g(l.nlink),!0),u+=8,o.view.setBigUint64(u,g(l.size),!0),u+=8,o.view.setBigUint64(u,tt(l.atimeMs),!0),u+=8,o.view.setBigUint64(u,tt(l.mtimeMs),!0),o.view.setBigUint64(u+8,tt(l.ctimeMs),!0),0}),fd_filestat_set_size:R(function(s,u){return s=n(s,It),a.ftruncateSync(s.real,Number(u)),0}),fd_filestat_set_times:R(function(s,u,l,c){s=n(s,dt);var y=a.fstatSync(s.real),m=y.atime;y=y.mtime;var _=ft(r(0));return(c&3)==3||(c&12)==12?28:((c&1)==1?m=ft(u):(c&2)==2&&(m=_),(c&4)==4?y=ft(l):(c&8)==8&&(y=_),a.futimesSync(s.real,new Date(m),new Date(y)),0)}),fd_prestat_get:R(function(s,u){return s=n(s,g(0)),s.path?(o.refreshMemory(),o.view.setUint8(u,0),o.view.setUint32(u+4,P.byteLength(s.fakePath),!0),0):28}),fd_prestat_dir_name:R(function(s,u,l){return s=n(s,g(0)),s.path?(o.refreshMemory(),P.from(o.memory.buffer).write(s.fakePath,u,l,"utf8"),0):28}),fd_pwrite:R(function(s,u,l,c,y){var m=n(s,K|nt),_=0;return i(u,l).forEach(function(A){for(var S=0;S<A.byteLength;)S+=a.writeSync(m.real,A,S,A.byteLength-S,Number(c)+_+S);_+=S}),o.view.setUint32(y,_,!0),0}),fd_write:R(function(s,u,l,c){var y=n(s,K),m=0;return i(u,l).forEach(function(_){for(var A=0;A<_.byteLength;){var S=a.writeSync(y.real,_,A,_.byteLength-A,y.offset?Number(y.offset):null);y.offset&&(y.offset+=g(S)),A+=S}m+=A}),o.view.setUint32(c,m,!0),0}),fd_pread:R(function(s,u,l,c,y){var m;s=n(s,V|nt);var _=0;try{var A=pt(i(u,l)),S=A.next();t:for(;!S.done;S=A.next()){var T=S.value;for(u=0;u<T.byteLength;){var O=T.byteLength-u,M=a.readSync(s.real,T,u,T.byteLength-u,Number(c)+_+u);if(u+=M,_+=M,M===0||M<O)break t}_+=u}}catch(q){var L={error:q}}finally{try{S&&!S.done&&(m=A.return)&&m.call(A)}finally{if(L)throw L.error}}return o.view.setUint32(y,_,!0),0}),fd_read:R(function(s,u,l,c){var y;s=n(s,V);var m=s.real===0,_=0;try{var A=pt(i(u,l)),S=A.next();t:for(;!S.done;S=A.next()){var T=S.value;for(u=0;u<T.byteLength;){var O=T.byteLength-u,M=a.readSync(s.real,T,u,O,m||s.offset===void 0?null:Number(s.offset));if(m||(s.offset=(s.offset?s.offset:g(0))+g(M)),u+=M,_+=M,M===0||M<O)break t}}}catch(q){var L={error:q}}finally{try{S&&!S.done&&(y=A.return)&&y.call(A)}finally{if(L)throw L.error}}return o.view.setUint32(c,_,!0),0}),fd_readdir:R(function(s,u,l,c,y){s=n(s,Ot),o.refreshMemory();var m=a.readdirSync(s.path,{withFileTypes:!0}),_=u;for(c=Number(c);c<m.length;c+=1){var A=m[c],S=P.byteLength(A.name);if(u-_>l||(o.view.setBigUint64(u,g(c+1),!0),u+=8,u-_>l))break;var T=a.statSync(v.resolve(s.path,A.name));if(o.view.setBigUint64(u,g(T.ino),!0),u+=8,u-_>l||(o.view.setUint32(u,S,!0),u+=4,u-_>l))break;switch(!0){case T.isBlockDevice():T=1;break;case T.isCharacterDevice():T=2;break;case T.isDirectory():T=3;break;case T.isFIFO():T=6;break;case T.isFile():T=4;break;case T.isSocket():T=6;break;case T.isSymbolicLink():T=7;break;default:T=0}if(o.view.setUint8(u,T),u+=1,u+=3,u+S>=_+l)break;P.from(o.memory.buffer).write(A.name,u),u+=S}return o.view.setUint32(y,Math.min(u-_,l),!0),0}),fd_renumber:R(function(s,u){return n(s,g(0)),n(u,g(0)),a.closeSync(o.FD_MAP.get(s).real),o.FD_MAP.set(s,o.FD_MAP.get(u)),o.FD_MAP.delete(u),0}),fd_seek:R(function(s,u,l,c){switch(s=n(s,nt),o.refreshMemory(),l){case 1:s.offset=(s.offset?s.offset:g(0))+g(u);break;case 2:l=a.fstatSync(s.real).size,s.offset=g(l)+g(u);break;case 0:s.offset=g(u)}return o.view.setBigUint64(c,s.offset,!0),0}),fd_tell:R(function(s,u){return s=n(s,kt),o.refreshMemory(),s.offset||(s.offset=g(0)),o.view.setBigUint64(u,s.offset,!0),0}),fd_sync:R(function(s){return s=n(s,H),a.fsyncSync(s.real),0}),path_create_directory:R(function(s,u,l){return s=n(s,Yt),s.path?(o.refreshMemory(),u=P.from(o.memory.buffer,u,l).toString(),a.mkdirSync(v.resolve(s.path,u)),0):28}),path_filestat_get:R(function(s,u,l,c,y){return s=n(s,Vt),s.path?(o.refreshMemory(),l=P.from(o.memory.buffer,l,c).toString(),l=a.statSync(v.resolve(s.path,l)),o.view.setBigUint64(y,g(l.dev),!0),y+=8,o.view.setBigUint64(y,g(l.ino),!0),y+=8,o.view.setUint8(y,Me(o,void 0,l).filetype),y+=8,o.view.setBigUint64(y,g(l.nlink),!0),y+=8,o.view.setBigUint64(y,g(l.size),!0),y+=8,o.view.setBigUint64(y,tt(l.atimeMs),!0),y+=8,o.view.setBigUint64(y,tt(l.mtimeMs),!0),o.view.setBigUint64(y+8,tt(l.ctimeMs),!0),0):28}),path_filestat_set_times:R(function(s,u,l,c,y,m,_){if(s=n(s,Kt),!s.path)return 28;o.refreshMemory();var A=a.fstatSync(s.real);u=A.atime,A=A.mtime;var S=ft(r(0));return(_&3)==3||(_&12)==12?28:((_&1)==1?u=ft(y):(_&2)==2&&(u=S),(_&4)==4?A=ft(m):(_&8)==8&&(A=S),l=P.from(o.memory.buffer,l,c).toString(),a.utimesSync(v.resolve(s.path,l),new Date(u),new Date(A)),0)}),path_link:R(function(s,u,l,c,y,m,_){return s=n(s,Ft),y=n(y,Gt),!s.path||!y.path?28:(o.refreshMemory(),l=P.from(o.memory.buffer,l,c).toString(),m=P.from(o.memory.buffer,m,_).toString(),a.linkSync(v.resolve(s.path,l),v.resolve(y.path,m)),0)}),path_open:R(function(s,u,l,c,y,m,_,A,S){u=n(s,Rt),m=g(m),_=g(_),s=(m&(V|Ot))!==g(0);var T=(m&($|K|Ut|It))!==g(0);if(T&&s)var O=a.constants.O_RDWR;else s?O=a.constants.O_RDONLY:T&&(O=a.constants.O_WRONLY);if(s=m|Rt,m|=_,(y&1)!=0&&(O|=a.constants.O_CREAT,s|=xt),(y&2)!=0&&(O|=a.constants.O_DIRECTORY),(y&4)!=0&&(O|=a.constants.O_EXCL),(y&8)!=0&&(O|=a.constants.O_TRUNC,s|=Ht),(A&1)!=0&&(O|=a.constants.O_APPEND),(A&2)!=0&&(O=a.constants.O_DSYNC?O|a.constants.O_DSYNC:O|a.constants.O_SYNC,m|=$),(A&4)!=0&&(O|=a.constants.O_NONBLOCK),(A&8)!=0&&(O=a.constants.O_RSYNC?O|a.constants.O_RSYNC:O|a.constants.O_SYNC,m|=H),(A&16)!=0&&(O|=a.constants.O_SYNC,m|=H),T&&(O&(a.constants.O_APPEND|a.constants.O_TRUNC))==0&&(m|=nt),o.refreshMemory(),l=P.from(o.memory.buffer,l,c).toString(),l=v.resolve(u.path,l),v.relative(u.path,l).startsWith(".."))return 76;try{var M=a.realpathSync(l);if(v.relative(u.path,M).startsWith(".."))return 76}catch(q){if(q.code==="ENOENT")M=l;else throw q}try{var L=a.statSync(M).isDirectory()}catch(q){}return O=!T&&L?a.openSync(M,a.constants.O_RDONLY):a.openSync(M,O),L=yt(o.FD_MAP.keys()).reverse()[0]+1,o.FD_MAP.set(L,{real:O,filetype:void 0,rights:{base:s,inheriting:m},path:M}),Be(o,L),o.view.setUint32(S,L,!0),0}),path_readlink:R(function(s,u,l,c,y,m){return s=n(s,jt),s.path?(o.refreshMemory(),u=P.from(o.memory.buffer,u,l).toString(),u=v.resolve(s.path,u),u=a.readlinkSync(u),c=P.from(o.memory.buffer).write(u,c,y),o.view.setUint32(m,c,!0),0):28}),path_remove_directory:R(function(s,u,l){return s=n(s,qt),s.path?(o.refreshMemory(),u=P.from(o.memory.buffer,u,l).toString(),a.rmdirSync(v.resolve(s.path,u)),0):28}),path_rename:R(function(s,u,l,c,y,m){return s=n(s,Wt),c=n(c,zt),!s.path||!c.path?28:(o.refreshMemory(),u=P.from(o.memory.buffer,u,l).toString(),y=P.from(o.memory.buffer,y,m).toString(),a.renameSync(v.resolve(s.path,u),v.resolve(c.path,y)),0)}),path_symlink:R(function(s,u,l,c,y){return l=n(l,Xt),l.path?(o.refreshMemory(),s=P.from(o.memory.buffer,s,u).toString(),c=P.from(o.memory.buffer,c,y).toString(),a.symlinkSync(s,v.resolve(l.path,c)),0):28}),path_unlink_file:R(function(s,u,l){return s=n(s,Qt),s.path?(o.refreshMemory(),u=P.from(o.memory.buffer,u,l).toString(),a.unlinkSync(v.resolve(s.path,u)),0):28}),poll_oneoff:function(s,u,l,c){var y=0,m=0;o.refreshMemory();for(var _=0;_<l;_+=1){var A=o.view.getBigUint64(s,!0);s+=8;var S=o.view.getUint8(s);switch(s+=1,S){case 0:s+=7,o.view.getBigUint64(s,!0),s+=8;var T=o.view.getUint32(s,!0);s+=4,s+=4,S=o.view.getBigUint64(s,!0),s+=8,o.view.getBigUint64(s,!0),s+=8;var O=o.view.getUint16(s,!0);s+=2,s+=6;var M=O===1;O=0,T=g(r(T)),T===null?O=28:(S=M?S:T+S,m=S>m?S:m),o.view.setBigUint64(u,A,!0),u+=8,o.view.setUint16(u,O,!0),u+=2,o.view.setUint8(u,0),u+=1,u+=5,y+=1;break;case 1:case 2:s+=3,o.view.getUint32(s,!0),s+=4,o.view.setBigUint64(u,A,!0),u+=8,o.view.setUint16(u,52,!0),u+=2,o.view.setUint8(u,S),u+=1,u+=5,y+=1;break;default:return 28}}for(o.view.setUint32(c,y,!0);U.hrtime()<m;);return 0},proc_exit:function(s){return U.exit(s),0},proc_raise:function(s){return s in de?(U.kill(de[s]),0):28},random_get:function(s,u){return o.refreshMemory(),U.randomFillSync(new Uint8Array(o.memory.buffer),s,u),0},sched_yield:function(){return 0},sock_recv:function(){return 52},sock_send:function(){return 52},sock_shutdown:function(){return 52}},e.traceSyscalls&&Object.keys(this.wasiImport).forEach(function(s){var u=o.wasiImport[s];o.wasiImport[s]=function(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];console.log("WASI: wasiImport called: "+s+" ("+l+")");try{var y=u.apply(void 0,yt(l));return console.log("WASI: => "+y),y}catch(m){throw console.log("Catched error: "+m),m}}})}return t.prototype.refreshMemory=function(){this.view&&this.view.buffer.byteLength!==0||(this.view=new ct(this.memory.buffer))},t.prototype.setMemory=function(e){this.memory=e},t.prototype.start=function(e){if(e=e.exports,e===null||typeof e!="object")throw Error("instance.exports must be an Object. Received "+e+".");var r=e.memory;if(!(r instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+r+".");this.setMemory(r),e._start&&e._start()},t.prototype.getImportNamespace=function(e){var r,n=null;try{for(var i=pt(WebAssembly.Module.imports(e)),f=i.next();!f.done;f=i.next()){var o=f.value;if(o.kind==="function"&&o.module.startsWith("wasi_")){if(!n)n=o.module;else if(n!==o.module)throw Error("Multiple namespaces detected.")}}}catch(E){var p={error:E}}finally{try{f&&!f.done&&(r=i.return)&&r.call(i)}finally{if(p)throw p.error}}return n},t.prototype.getImports=function(e){switch(this.getImportNamespace(e)){case"wasi_unstable":return{wasi_unstable:this.wasiImport};case"wasi_snapshot_preview1":return{wasi_snapshot_preview1:this.wasiImport};default:throw Error("Can't detect a WASI namespace for the WebAssembly Module")}},t.defaultBindings=Te,t}(),fr=sr;export{sr as WASI,Jt as WASIError,ir as WASIExitError,or as WASIKillError,fr as default};
//# sourceMappingURL=index.esm-5YCYWKYY.js.map