342 lines
2.6 MiB
JavaScript
342 lines
2.6 MiB
JavaScript
|
/*
|
||
|
*****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||
|
this file except in compliance with the License. You may obtain a copy of the
|
||
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||
|
|
||
|
See the Apache Version 2.0 License for specific language governing permissions
|
||
|
and limitations under the License.
|
||
|
*****************************************************************************/
|
||
|
function aa(a,b){aa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b;}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);};return aa(a,b)}function ba(a,b){function c(){this.constructor=a;}aa(a,b);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c);}function ca(a){var b="function"===typeof Symbol&&a[Symbol.iterator],c=0;return b?b.call(a):{next:function(){a&&c>=a.length&&(a=void 0);return {value:a&&a[c++],done:!a}}}}
|
||
|
function da(a,b){var c="function"===typeof Symbol&&a[Symbol.iterator];if(!c)return a;a=c.call(a);var d,e=[];try{for(;(void 0===b||0<b--)&&!(d=a.next()).done;)e.push(d.value);}catch(g){var f={error:g};}finally{try{d&&!d.done&&(c=a["return"])&&c.call(a);}finally{if(f)throw f.error;}}return e}function ea(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(da(arguments[b]));return a}
|
||
|
var fa="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof global?global:{},k="undefined"!==typeof BigInt?BigInt:fa.BigInt||Number,ha=DataView;
|
||
|
ha.prototype.setBigUint64||(ha.prototype.setBigUint64=function(a,b,c){if(b<Math.pow(2,32)){var d=b;b=0;}else{d=b.toString(2);b="";for(var e=0;e<64-d.length;e++)b+="0";b+=d;d=parseInt(b.substring(0,32),2);b=parseInt(b.substring(32),2);}this.setUint32(a+(c?0:4),d,c);this.setUint32(a+(c?4:0),b,c);},ha.prototype.getBigUint64=function(a,b){var c=this.getUint32(a+(b?0:4),b);this.setUint32(a+(b?4:0),b);a=c.toString(2);c=c.toString(2);for(b=0;b<32-a.length;b++);return parseInt(c+a)});
|
||
|
var l="undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},p=[],u=[],ja="undefined"!==typeof Uint8Array?Uint8Array:Array,ka=!1;function la(){ka=!0;for(var a=0;64>a;++a)p[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],u["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;u[45]=62;u[95]=63;}
|
||
|
function ma(a,b,c){for(var d=[],e=b;e<c;e+=3)b=(a[e]<<16)+(a[e+1]<<8)+a[e+2],d.push(p[b>>18&63]+p[b>>12&63]+p[b>>6&63]+p[b&63]);return d.join("")}function na(a){ka||la();for(var b=a.length,c=b%3,d="",e=[],f=0,g=b-c;f<g;f+=16383)e.push(ma(a,f,f+16383>g?g:f+16383));1===c?(a=a[b-1],d+=p[a>>2],d+=p[a<<4&63],d+="=="):2===c&&(a=(a[b-2]<<8)+a[b-1],d+=p[a>>10],d+=p[a>>4&63],d+=p[a<<2&63],d+="=");e.push(d);return e.join("")}
|
||
|
function oa(a,b,c,d,e){var f=8*e-d-1;var g=(1<<f)-1,h=g>>1,m=-7;e=c?e-1:0;var n=c?-1:1,t=a[b+e];e+=n;c=t&(1<<-m)-1;t>>=-m;for(m+=f;0<m;c=256*c+a[b+e],e+=n,m-=8);f=c&(1<<-m)-1;c>>=-m;for(m+=d;0<m;f=256*f+a[b+e],e+=n,m-=8);if(0===c)c=1-h;else{if(c===g)return f?NaN:Infinity*(t?-1:1);f+=Math.pow(2,d);c-=h;}return (t?-1:1)*f*Math.pow(2,c-d)}
|
||
|
function pa(a,b,c,d,e,f){var g,h=8*f-e-1,m=(1<<h)-1,n=m>>1,t=23===e?Math.pow(2,-24)-Math.pow(2,-77):0;f=d?0:f-1;var q=d?1:-1,x=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,d=m):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+n?b+t/g:b+t*Math.pow(2,1-n),2<=b*g&&(d++,g/=2),d+n>=m?(b=0,d=m):1<=d+n?(b=(b*g-1)*Math.pow(2,e),d+=n):(b=b*Math.pow(2,n-1)*Math.pow(2,e),d=0));for(;8<=e;a[c+f]=b&255,f+=q,b/=256,e-=8);d=d<<e|b;for(h+=e;0<h;a[c+f]=d&255,
|
||
|
f+=q,d/=256,h-=8);a[c+f-q]|=128*x;}var qa={}.toString,ra=Array.isArray||function(a){return "[object Array]"==qa.call(a)};v.TYPED_ARRAY_SUPPORT=void 0!==l.TYPED_ARRAY_SUPPORT?l.TYPED_ARRAY_SUPPORT:!0;function y(a,b){if((v.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<b)throw new RangeError("Invalid typed array length");v.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(b),a.__proto__=v.prototype):(null===a&&(a=new v(b)),a.length=b);return a}
|
||
|
function v(a,b,c){if(!(v.TYPED_ARRAY_SUPPORT||this instanceof v))return new v(a,b,c);if("number"===typeof a){if("string"===typeof b)throw Error("If encoding is specified then the first argument must be a string");return sa(this,a)}return ta(this,a,b,c)}v.poolSize=8192;v._augment=function(a){a.__proto__=v.prototype;return a};
|
||
|
function ta(a,b,c,d){if("number"===typeof b)throw new TypeError('"value" argument must not be a number');if("undefined"!==typeof ArrayBuffer&&b instanceof ArrayBuffer){b.byteLength;if(0>c||b.byteLength<c)throw new RangeError("'offset' is out of bounds");if(b.byteLength<c+(d||0))throw new RangeError("'length' is out of bounds");b=void 0===c&&void 0===d?new Uint8Array(b):void 0===d?new Uint8Array(b,c):new Uint8Array(b,c,d);v.TYPED_ARRAY_SUPPORT?(a=b,a.__proto__=v.prototype):a=ua(a,b);return a}if("string"===
|
||
|
typeof b){d=a;a=c;if("string"!==typeof a||""===a)a="utf8";if(!v.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');c=va(b,a)|0;d=y(d,c);b=d.write(b,a);b!==c&&(d=d.slice(0,b));return d}return wa(a,b)}v.from=function(a,b,c){return ta(null,a,b,c)};v.TYPED_ARRAY_SUPPORT&&(v.prototype.__proto__=Uint8Array.prototype,v.__proto__=Uint8Array);
|
||
|
function xa(a){if("number"!==typeof a)throw new TypeError('"size" argument must be a number');if(0>a)throw new RangeError('"size" argument must not be negative');}v.alloc=function(a,b,c){xa(a);a=0>=a?y(null,a):void 0!==b?"string"===typeof c?y(null,a).fill(b,c):y(null,a).fill(b):y(null,a);return a};function sa(a,b){xa(b);a=y(a,0>b?0:ya(b)|0);if(!v.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;++c)a[c]=0;return a}v.allocUnsafe=function(a){return sa(null,a)};v.allocUnsafeSlow=function(a){return sa(null,a)};
|
||
|
function ua(a,b){var c=0>b.length?0:ya(b.length)|0;a=y(a,c);for(var d=0;d<c;d+=1)a[d]=b[d]&255;return a}
|
||
|
function wa(a,b){if(z(b)){var c=ya(b.length)|0;a=y(a,c);if(0===a.length)return a;b.copy(a,0,0,c);return a}if(b){if("undefined"!==typeof ArrayBuffer&&b.buffer instanceof ArrayBuffer||"length"in b)return (c="number"!==typeof b.length)||(c=b.length,c=c!==c),c?y(a,0):ua(a,b);if("Buffer"===b.type&&ra(b.data))return ua(a,b.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
|
||
|
function ya(a){if(a>=(v.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(v.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return a|0}v.isBuffer=za;function z(a){return !(null==a||!a._isBuffer)}
|
||
|
v.compare=function(a,b){if(!z(a)||!z(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,f=Math.min(c,d);e<f;++e)if(a[e]!==b[e]){c=a[e];d=b[e];break}return c<d?-1:d<c?1:0};v.isEncoding=function(a){switch(String(a).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}};
|
||
|
v.concat=function(a,b){if(!ra(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return v.alloc(0);var c;if(void 0===b)for(c=b=0;c<a.length;++c)b+=a[c].length;b=v.allocUnsafe(b);var d=0;for(c=0;c<a.length;++c){var e=a[c];if(!z(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(b,d);d+=e.length;}return b};
|
||
|
function va(a,b){if(z(a))return a.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!==typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case "ascii":case "latin1":case "binary":return c;case "utf8":case "utf-8":case void 0:return Aa(a).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return Ba(a).length;
|
||
|
default:if(d)return Aa(a).length;b=(""+b).toLowerCase();d=!0;}}v.byteLength=va;
|
||
|
function Ca(a,b,c){var d=!1;if(void 0===b||0>b)b=0;if(b>this.length)return "";if(void 0===c||c>this.length)c=this.length;if(0>=c)return "";c>>>=0;b>>>=0;if(c<=b)return "";for(a||(a="utf8");;)switch(a){case "hex":a=b;b=c;c=this.length;if(!a||0>a)a=0;if(!b||0>b||b>c)b=c;d="";for(c=a;c<b;++c)a=d,d=this[c],d=16>d?"0"+d.toString(16):d.toString(16),d=a+d;return d;case "utf8":case "utf-8":return Da(this,b,c);case "ascii":a="";for(c=Math.min(this.length,c);b<c;++b)a+=String.fromCharCode(this[b]&127);return a;
|
||
|
case "latin1":case "binary":a="";for(c=Math.min(this.length,c);b<c;++b)a+=String.fromCharCode(this[b]);return a;case "base64":return b=0===b&&c===this.length?na(this):na(this.slice(b,c)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,c);c="";for(a=0;a<b.length;a+=2)c+=String.fromCharCode(b[a]+256*b[a+1]);return c;default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase();d=!0;}}v.prototype._isBuffer=!0;function A(a,b,c){var d=a[b];a[b]=a[c];a[c]=d;}
|
||
|
v.prototype.swap16=function(){var a=this.length;if(0!==a%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<a;b+=2)A(this,b,b+1);return this};v.prototype.swap32=function(){var a=this.length;if(0!==a%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<a;b+=4)A(this,b,b+3),A(this,b+1,b+2);return this};
|
||
|
v.prototype.swap64=function(){var a=this.length;if(0!==a%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<a;b+=8)A(this,b,b+7),A(this,b+1,b+6),A(this,b+2,b+5),A(this,b+3,b+4);return this};v.prototype.toString=function(){var a=this.length|0;return 0===a?"":0===arguments.length?Da(this,0,a):Ca.apply(this,arguments)};v.prototype.equals=function(a){if(!z(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===v.compare(this,a)};
|
||
|
v.prototype.inspect=function(){var a="";0<this.length&&(a=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(a+=" ... "));return "<Buffer "+a+">"};
|
||
|
v.prototype.compare=function(a,b,c,d,e){if(!z(a))throw new TypeError("Argument must be a Buffer");void 0===b&&(b=0);void 0===c&&(c=a?a.length:0);void 0===d&&(d=0);void 0===e&&(e=this.length);if(0>b||c>a.length||0>d||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return -1;if(b>=c)return 1;b>>>=0;c>>>=0;d>>>=0;e>>>=0;if(this===a)return 0;var f=e-d,g=c-b,h=Math.min(f,g);d=this.slice(d,e);a=a.slice(b,c);for(b=0;b<h;++b)if(d[b]!==a[b]){f=d[b];g=a[b];break}return f<
|
||
|
g?-1:g<f?1:0};
|
||
|
function Ea(a,b,c,d,e){if(0===a.length)return -1;"string"===typeof c?(d=c,c=0):2147483647<c?c=2147483647:-2147483648>c&&(c=-2147483648);c=+c;isNaN(c)&&(c=e?0:a.length-1);0>c&&(c=a.length+c);if(c>=a.length){if(e)return -1;c=a.length-1;}else if(0>c)if(e)c=0;else return -1;"string"===typeof b&&(b=v.from(b,d));if(z(b))return 0===b.length?-1:Ga(a,b,c,d,e);if("number"===typeof b)return b&=255,v.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):
|
||
|
Uint8Array.prototype.lastIndexOf.call(a,b,c):Ga(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer");}
|
||
|
function Ga(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,m=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(2>a.length||2>b.length)return -1;g=2;h/=2;m/=2;c/=2;}if(e)for(d=-1;c<h;c++)if(f(a,c)===f(b,-1===d?0:c-d)){if(-1===d&&(d=c),c-d+1===m)return d*g}else-1!==d&&(c-=c-d),d=-1;else for(c+m>h&&(c=h-m);0<=c;c--){h=!0;for(d=0;d<m;d++)if(f(a,c+d)!==f(b,d)){h=!1;break}if(h)return c}return -1}
|
||
|
v.prototype.includes=function(a,b,c){return -1!==this.indexOf(a,b,c)};v.prototype.indexOf=function(a,b,c){return Ea(this,a,b,c,!0)};v.prototype.lastIndexOf=function(a,b,c){return Ea(this,a,b,c,!1)};
|
||
|
v.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"===typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var e=this.length-b;if(void 0===c||c>e)c=e;if(0<a.length&&(0>c||0>b)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(e=!1;;)switch(d){case "hex":a:{b=
|
||
|
Number(b)||0;d=this.length-b;c?(c=Number(c),c>d&&(c=d)):c=d;d=a.length;if(0!==d%2)throw new TypeError("Invalid hex string");c>d/2&&(c=d/2);for(d=0;d<c;++d){e=parseInt(a.substr(2*d,2),16);if(isNaN(e)){a=d;break a}this[b+d]=e;}a=d;}return a;case "utf8":case "utf-8":return Ha(Aa(a,this.length-b),this,b,c);case "ascii":return Ha(Ia(a),this,b,c);case "latin1":case "binary":return Ha(Ia(a),this,b,c);case "base64":return Ha(Ba(a),this,b,c);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":d=a;e=this.length-
|
||
|
b;for(var f=[],g=0;g<d.length&&!(0>(e-=2));++g){var h=d.charCodeAt(g);a=h>>8;h%=256;f.push(h);f.push(a);}return Ha(f,this,b,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0;}};v.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
|
||
|
function Da(a,b,c){c=Math.min(a.length,c);for(var d=[];b<c;){var e=a[b],f=null,g=239<e?4:223<e?3:191<e?2:1;if(b+g<=c)switch(g){case 1:128>e&&(f=e);break;case 2:var h=a[b+1];128===(h&192)&&(e=(e&31)<<6|h&63,127<e&&(f=e));break;case 3:h=a[b+1];var m=a[b+2];128===(h&192)&&128===(m&192)&&(e=(e&15)<<12|(h&63)<<6|m&63,2047<e&&(55296>e||57343<e)&&(f=e));break;case 4:h=a[b+1];m=a[b+2];var n=a[b+3];128===(h&192)&&128===(m&192)&&128===(n&192)&&(e=(e&15)<<18|(h&63)<<12|(m&63)<<6|n&63,65535<e&&1114112>e&&(f=
|
||
|
e));}null===f?(f=65533,g=1):65535<f&&(f-=65536,d.push(f>>>10&1023|55296),f=56320|f&1023);d.push(f);b+=g;}a=d.length;if(a<=Ja)d=String.fromCharCode.apply(String,d);else{c="";for(b=0;b<a;)c+=String.fromCharCode.apply(String,d.slice(b,b+=Ja));d=c;}return d}var Ja=4096;
|
||
|
v.prototype.slice=function(a,b){var c=this.length;a=~~a;b=void 0===b?c:~~b;0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c);0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c);b<a&&(b=a);if(v.TYPED_ARRAY_SUPPORT)b=this.subarray(a,b),b.__proto__=v.prototype;else{c=b-a;b=new v(c,void 0);for(var d=0;d<c;++d)b[d]=this[d+a];}return b};function B(a,b,c){if(0!==a%1||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length");}
|
||
|
v.prototype.readUIntLE=function(a,b,c){a|=0;b|=0;c||B(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;return c};v.prototype.readUIntBE=function(a,b,c){a|=0;b|=0;c||B(a,b,this.length);c=this[a+--b];for(var d=1;0<b&&(d*=256);)c+=this[a+--b]*d;return c};v.prototype.readUInt8=function(a,b){b||B(a,1,this.length);return this[a]};v.prototype.readUInt16LE=function(a,b){b||B(a,2,this.length);return this[a]|this[a+1]<<8};
|
||
|
v.prototype.readUInt16BE=function(a,b){b||B(a,2,this.length);return this[a]<<8|this[a+1]};v.prototype.readUInt32LE=function(a,b){b||B(a,4,this.length);return (this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};v.prototype.readUInt32BE=function(a,b){b||B(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};v.prototype.readIntLE=function(a,b,c){a|=0;b|=0;c||B(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;c>=128*d&&(c-=Math.pow(2,8*b));return c};
|
||
|
v.prototype.readIntBE=function(a,b,c){a|=0;b|=0;c||B(a,b,this.length);c=b;for(var d=1,e=this[a+--c];0<c&&(d*=256);)e+=this[a+--c]*d;e>=128*d&&(e-=Math.pow(2,8*b));return e};v.prototype.readInt8=function(a,b){b||B(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};v.prototype.readInt16LE=function(a,b){b||B(a,2,this.length);a=this[a]|this[a+1]<<8;return a&32768?a|4294901760:a};
|
||
|
v.prototype.readInt16BE=function(a,b){b||B(a,2,this.length);a=this[a+1]|this[a]<<8;return a&32768?a|4294901760:a};v.prototype.readInt32LE=function(a,b){b||B(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};v.prototype.readInt32BE=function(a,b){b||B(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};v.prototype.readFloatLE=function(a,b){b||B(a,4,this.length);return oa(this,a,!0,23,4)};
|
||
|
v.prototype.readFloatBE=function(a,b){b||B(a,4,this.length);return oa(this,a,!1,23,4)};v.prototype.readDoubleLE=function(a,b){b||B(a,8,this.length);return oa(this,a,!0,52,8)};v.prototype.readDoubleBE=function(a,b){b||B(a,8,this.length);return oa(this,a,!1,52,8)};function C(a,b,c,d,e,f){if(!z(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||b<f)throw new RangeError('"value" argument is out of bounds');if(c+d>a.length)throw new RangeError("Index out of range");}
|
||
|
v.prototype.writeUIntLE=function(a,b,c,d){a=+a;b|=0;c|=0;d||C(this,a,b,c,Math.pow(2,8*c)-1,0);d=1;var e=0;for(this[b]=a&255;++e<c&&(d*=256);)this[b+e]=a/d&255;return b+c};v.prototype.writeUIntBE=function(a,b,c,d){a=+a;b|=0;c|=0;d||C(this,a,b,c,Math.pow(2,8*c)-1,0);d=c-1;var e=1;for(this[b+d]=a&255;0<=--d&&(e*=256);)this[b+d]=a/e&255;return b+c};v.prototype.writeUInt8=function(a,b,c){a=+a;b|=0;c||C(this,a,b,1,255,0);v.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a&255;return b+1};
|
||
|
function Ka(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e<f;++e)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e);}v.prototype.writeUInt16LE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,2,65535,0);v.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Ka(this,a,b,!0);return b+2};v.prototype.writeUInt16BE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,2,65535,0);v.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Ka(this,a,b,!1);return b+2};
|
||
|
function La(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e<f;++e)a[c+e]=b>>>8*(d?e:3-e)&255;}v.prototype.writeUInt32LE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,4,4294967295,0);v.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a&255):La(this,a,b,!0);return b+4};
|
||
|
v.prototype.writeUInt32BE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,4,4294967295,0);v.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):La(this,a,b,!1);return b+4};v.prototype.writeIntLE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),C(this,a,b,c,d-1,-d));d=0;var e=1,f=0;for(this[b]=a&255;++d<c&&(e*=256);)0>a&&0===f&&0!==this[b+d-1]&&(f=1),this[b+d]=(a/e>>0)-f&255;return b+c};
|
||
|
v.prototype.writeIntBE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),C(this,a,b,c,d-1,-d));d=c-1;var e=1,f=0;for(this[b+d]=a&255;0<=--d&&(e*=256);)0>a&&0===f&&0!==this[b+d+1]&&(f=1),this[b+d]=(a/e>>0)-f&255;return b+c};v.prototype.writeInt8=function(a,b,c){a=+a;b|=0;c||C(this,a,b,1,127,-128);v.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a&255;return b+1};
|
||
|
v.prototype.writeInt16LE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,2,32767,-32768);v.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Ka(this,a,b,!0);return b+2};v.prototype.writeInt16BE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,2,32767,-32768);v.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Ka(this,a,b,!1);return b+2};
|
||
|
v.prototype.writeInt32LE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,4,2147483647,-2147483648);v.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):La(this,a,b,!0);return b+4};v.prototype.writeInt32BE=function(a,b,c){a=+a;b|=0;c||C(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);v.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):La(this,a,b,!1);return b+4};
|
||
|
function Ma(a,b,c,d){if(c+d>a.length)throw new RangeError("Index out of range");if(0>c)throw new RangeError("Index out of range");}v.prototype.writeFloatLE=function(a,b,c){c||Ma(this,a,b,4);pa(this,a,b,!0,23,4);return b+4};v.prototype.writeFloatBE=function(a,b,c){c||Ma(this,a,b,4);pa(this,a,b,!1,23,4);return b+4};v.prototype.writeDoubleLE=function(a,b,c){c||Ma(this,a,b,8);pa(this,a,b,!0,52,8);return b+8};v.prototype.writeDoubleBE=function(a,b,c){c||Ma(this,a,b,8);pa(this,a,b,!1,52,8);return b+8};
|
||
|
v.prototype.copy=function(a,b,c,d){c||(c=0);d||0===d||(d=this.length);b>=a.length&&(b=a.length);b||(b=0);0<d&&d<c&&(d=c);if(d===c||0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length);a.length-b<d-c&&(d=a.length-b+c);var e=d-c;if(this===a&&c<b&&b<d)for(d=e-1;0<=d;--d)a[d+b]=this[d+c];else if(1E3>e||
|
||
|
!v.TYPED_ARRAY_SUPPORT)for(d=0;d<e;++d)a[d+b]=this[d+c];else Uint8Array.prototype.set.call(a,this.subarray(c,c+e),b);return e};
|
||
|
v.prototype.fill=function(a,b,c,d){if("string"===typeof a){"string"===typeof b?(d=b,b=0,c=this.length):"string"===typeof c&&(d=c,c=this.length);if(1===a.length){var e=a.charCodeAt(0);256>e&&(a=e);}if(void 0!==d&&"string"!==typeof d)throw new TypeError("encoding must be a string");if("string"===typeof d&&!v.isEncoding(d))throw new TypeError("Unknown encoding: "+d);}else"number"===typeof a&&(a&=255);if(0>b||this.length<b||this.length<c)throw new RangeError("Out of range index");if(c<=b)return this;b>>>=
|
||
|
0;c=void 0===c?this.length:c>>>0;a||(a=0);if("number"===typeof a)for(d=b;d<c;++d)this[d]=a;else for(a=z(a)?a:Aa((new v(a,d)).toString()),e=a.length,d=0;d<c-b;++d)this[d+b]=a[d%e];return this};var Na=/[^+\/0-9A-Za-z-_]/g;
|
||
|
function Aa(a,b){b=b||Infinity;for(var c,d=a.length,e=null,f=[],g=0;g<d;++g){c=a.charCodeAt(g);if(55295<c&&57344>c){if(!e){if(56319<c){-1<(b-=3)&&f.push(239,191,189);continue}else if(g+1===d){-1<(b-=3)&&f.push(239,191,189);continue}e=c;continue}if(56320>c){-1<(b-=3)&&f.push(239,191,189);e=c;continue}c=(e-55296<<10|c-56320)+65536;}else e&&-1<(b-=3)&&f.push(239,191,189);e=null;if(128>c){if(0>--b)break;f.push(c);}else if(2048>c){if(0>(b-=2))break;f.push(c>>6|192,c&63|128);}else if(65536>c){if(0>(b-=3))break;
|
||
|
f.push(c>>12|224,c>>6&63|128,c&63|128);}else if(1114112>c){if(0>(b-=4))break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128);}else throw Error("Invalid code point");}return f}function Ia(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c)&255);return b}
|
||
|
function Ba(a){a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(Na,"");if(2>a.length)a="";else for(;0!==a.length%4;)a+="=";ka||la();var b=a.length;if(0<b%4)throw Error("Invalid string. Length must be a multiple of 4");var c="="===a[b-2]?2:"="===a[b-1]?1:0;var d=new ja(3*b/4-c);var e=0<c?b-4:b;var f=0;for(b=0;b<e;b+=4){var g=u[a.charCodeAt(b)]<<18|u[a.charCodeAt(b+1)]<<12|u[a.charCodeAt(b+2)]<<6|u[a.charCodeAt(b+3)];d[f++]=g>>16&255;d[f++]=g>>8&255;d[f++]=g&255;}2===c?(g=u[a.charCodeAt(b)]<<2|
|
||
|
u[a.charCodeAt(b+1)]>>4,d[f++]=g&255):1===c&&(g=u[a.charCodeAt(b)]<<10|u[a.charCodeAt(b+1)]<<4|u[a.charCodeAt(b+2)]>>2,d[f++]=g>>8&255,d[f++]=g&255);return d}function Ha(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function za(a){return null!=a&&(!!a._isBuffer||Oa(a)||"function"===typeof a.readFloatLE&&"function"===typeof a.slice&&Oa(a.slice(0,0)))}function Oa(a){return !!a.constructor&&"function"===typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}
|
||
|
var D=v,Pa="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};function Qa(a,b){return b={exports:{}},a(b,b.exports),b.exports}function Ra(){throw Error("setTimeout has not been defined");}function Sa(){throw Error("clearTimeout has not been defined");}var E=Ra,F=Sa;"function"===typeof l.setTimeout&&(E=setTimeout);"function"===typeof l.clearTimeout&&(F=clearTimeout);
|
||
|
function Ta(a){if(E===setTimeout)return setTimeout(a,0);if((E===Ra||!E)&&setTimeout)return E=setTimeout,setTimeout(a,0);try{return E(a,0)}catch(b){try{return E.call(null,a,0)}catch(c){return E.call(this,a,0)}}}function Ua(a){if(F===clearTimeout)return clearTimeout(a);if((F===Sa||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(a);try{return F(a)}catch(b){try{return F.call(null,a)}catch(c){return F.call(this,a)}}}var G=[],H=!1,I,Va=-1;
|
||
|
function Wa(){H&&I&&(H=!1,I.length?G=I.concat(G):Va=-1,G.length&&Xa());}function Xa(){if(!H){var a=Ta(Wa);H=!0;for(var b=G.length;b;){I=G;for(G=[];++Va<b;)I&&I[Va].run();Va=-1;b=G.length;}I=null;H=!1;Ua(a);}}function Ya(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];G.push(new Za(a,b));1!==G.length||H||Ta(Xa);}function Za(a,b){this.fun=a;this.array=b;}Za.prototype.run=function(){this.fun.apply(null,this.array);};function J(){}
|
||
|
var L=l.performance||{},$a=L.now||L.mozNow||L.msNow||L.oNow||L.webkitNow||function(){return (new Date).getTime()},ab=new Date,bb={nextTick:Ya,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(a){var b=.001*$a.call(L),
|
||
|
c=Math.floor(b);b=Math.floor(b%1*1E9);a&&(c-=a[0],b-=a[1],0>b&&(c--,b+=1E9));return [c,b]},platform:"browser",release:{},config:{},uptime:function(){return (new Date-ab)/1E3}},M=[],N=[],cb="undefined"!==typeof Uint8Array?Uint8Array:Array,db=!1;function eb(){db=!0;for(var a=0;64>a;++a)M[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],N["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;N[45]=62;N[95]=63;}
|
||
|
function fb(a,b,c){for(var d=[],e=b;e<c;e+=3)b=(a[e]<<16)+(a[e+1]<<8)+a[e+2],d.push(M[b>>18&63]+M[b>>12&63]+M[b>>6&63]+M[b&63]);return d.join("")}function gb(a){db||eb();for(var b=a.length,c=b%3,d="",e=[],f=0,g=b-c;f<g;f+=16383)e.push(fb(a,f,f+16383>g?g:f+16383));1===c?(a=a[b-1],d+=M[a>>2],d+=M[a<<4&63],d+="=="):2===c&&(a=(a[b-2]<<8)+a[b-1],d+=M[a>>10],d+=M[a>>4&63],d+=M[a<<2&63],d+="=");e.push(d);return e.join("")}
|
||
|
function hb(a,b,c,d,e){var f=8*e-d-1;var g=(1<<f)-1,h=g>>1,m=-7;e=c?e-1:0;var n=c?-1:1,t=a[b+e];e+=n;c=t&(1<<-m)-1;t>>=-m;for(m+=f;0<m;c=256*c+a[b+e],e+=n,m-=8);f=c&(1<<-m)-1;c>>=-m;for(m+=d;0<m;f=256*f+a[b+e],e+=n,m-=8);if(0===c)c=1-h;else{if(c===g)return f?NaN:Infinity*(t?-1:1);f+=Math.pow(2,d);c-=h;}return (t?-1:1)*f*Math.pow(2,c-d)}
|
||
|
function ib(a,b,c,d,e,f){var g,h=8*f-e-1,m=(1<<h)-1,n=m>>1,t=23===e?Math.pow(2,-24)-Math.pow(2,-77):0;f=d?0:f-1;var q=d?1:-1,x=0>b||0===b&&0>1/b?1:0;b=Math.abs(b);isNaN(b)||Infinity===b?(b=isNaN(b)?1:0,d=m):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+n?b+t/g:b+t*Math.pow(2,1-n),2<=b*g&&(d++,g/=2),d+n>=m?(b=0,d=m):1<=d+n?(b=(b*g-1)*Math.pow(2,e),d+=n):(b=b*Math.pow(2,n-1)*Math.pow(2,e),d=0));for(;8<=e;a[c+f]=b&255,f+=q,b/=256,e-=8);d=d<<e|b;for(h+=e;0<h;a[c+f]=d&255,
|
||
|
f+=q,d/=256,h-=8);a[c+f-q]|=128*x;}var jb={}.toString,mb=Array.isArray||function(a){return "[object Array]"==jb.call(a)};O.TYPED_ARRAY_SUPPORT=void 0!==l.TYPED_ARRAY_SUPPORT?l.TYPED_ARRAY_SUPPORT:!0;var nb=O.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function P(a,b){if((O.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<b)throw new RangeError("Invalid typed array length");O.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(b),a.__proto__=O.prototype):(null===a&&(a=new O(b)),a.length=b);return a}
|
||
|
function O(a,b,c){if(!(O.TYPED_ARRAY_SUPPORT||this instanceof O))return new O(a,b,c);if("number"===typeof a){if("string"===typeof b)throw Error("If encoding is specified then the first argument must be a string");return ob(this,a)}return pb(this,a,b,c)}O.poolSize=8192;O._augment=function(a){a.__proto__=O.prototype;return a};
|
||
|
function pb(a,b,c,d){if("number"===typeof b)throw new TypeError('"value" argument must not be a number');if("undefined"!==typeof ArrayBuffer&&b instanceof ArrayBuffer){b.byteLength;if(0>c||b.byteLength<c)throw new RangeError("'offset' is out of bounds");if(b.byteLength<c+(d||0))throw new RangeError("'length' is out of bounds");b=void 0===c&&void 0===d?new Uint8Array(b):void 0===d?new Uint8Array(b,c):new Uint8Array(b,c,d);O.TYPED_ARRAY_SUPPORT?(a=b,a.__proto__=O.prototype):a=qb(a,b);return a}if("string"===
|
||
|
typeof b){d=a;a=c;if("string"!==typeof a||""===a)a="utf8";if(!O.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');c=rb(b,a)|0;d=P(d,c);b=d.write(b,a);b!==c&&(d=d.slice(0,b));return d}return sb(a,b)}O.from=function(a,b,c){return pb(null,a,b,c)};O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array);
|
||
|
function tb(a){if("number"!==typeof a)throw new TypeError('"size" argument must be a number');if(0>a)throw new RangeError('"size" argument must not be negative');}O.alloc=function(a,b,c){tb(a);a=0>=a?P(null,a):void 0!==b?"string"===typeof c?P(null,a).fill(b,c):P(null,a).fill(b):P(null,a);return a};function ob(a,b){tb(b);a=P(a,0>b?0:ub(b)|0);if(!O.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;++c)a[c]=0;return a}O.allocUnsafe=function(a){return ob(null,a)};O.allocUnsafeSlow=function(a){return ob(null,a)};
|
||
|
function qb(a,b){var c=0>b.length?0:ub(b.length)|0;a=P(a,c);for(var d=0;d<c;d+=1)a[d]=b[d]&255;return a}
|
||
|
function sb(a,b){if(Q(b)){var c=ub(b.length)|0;a=P(a,c);if(0===a.length)return a;b.copy(a,0,0,c);return a}if(b){if("undefined"!==typeof ArrayBuffer&&b.buffer instanceof ArrayBuffer||"length"in b)return (c="number"!==typeof b.length)||(c=b.length,c=c!==c),c?P(a,0):qb(a,b);if("Buffer"===b.type&&mb(b.data))return qb(a,b.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
|
||
|
function ub(a){if(a>=(O.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(O.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return a|0}O.isBuffer=vb;function Q(a){return !(null==a||!a._isBuffer)}
|
||
|
O.compare=function(a,b){if(!Q(a)||!Q(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,f=Math.min(c,d);e<f;++e)if(a[e]!==b[e]){c=a[e];d=b[e];break}return c<d?-1:d<c?1:0};O.isEncoding=function(a){switch(String(a).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}};
|
||
|
O.concat=function(a,b){if(!mb(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return O.alloc(0);var c;if(void 0===b)for(c=b=0;c<a.length;++c)b+=a[c].length;b=O.allocUnsafe(b);var d=0;for(c=0;c<a.length;++c){var e=a[c];if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(b,d);d+=e.length;}return b};
|
||
|
function rb(a,b){if(Q(a))return a.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!==typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case "ascii":case "latin1":case "binary":return c;case "utf8":case "utf-8":case void 0:return wb(a).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return xb(a).length;
|
||
|
default:if(d)return wb(a).length;b=(""+b).toLowerCase();d=!0;}}O.byteLength=rb;
|
||
|
function yb(a,b,c){var d=!1;if(void 0===b||0>b)b=0;if(b>this.length)return "";if(void 0===c||c>this.length)c=this.length;if(0>=c)return "";c>>>=0;b>>>=0;if(c<=b)return "";for(a||(a="utf8");;)switch(a){case "hex":a=b;b=c;c=this.length;if(!a||0>a)a=0;if(!b||0>b||b>c)b=c;d="";for(c=a;c<b;++c)a=d,d=this[c],d=16>d?"0"+d.toString(16):d.toString(16),d=a+d;return d;case "utf8":case "utf-8":return zb(this,b,c);case "ascii":a="";for(c=Math.min(this.length,c);b<c;++b)a+=String.fromCharCode(this[b]&127);return a;
|
||
|
case "latin1":case "binary":a="";for(c=Math.min(this.length,c);b<c;++b)a+=String.fromCharCode(this[b]);return a;case "base64":return b=0===b&&c===this.length?gb(this):gb(this.slice(b,c)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,c);c="";for(a=0;a<b.length;a+=2)c+=String.fromCharCode(b[a]+256*b[a+1]);return c;default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase();d=!0;}}O.prototype._isBuffer=!0;function R(a,b,c){var d=a[b];a[b]=a[c];a[c]=d;}
|
||
|
O.prototype.swap16=function(){var a=this.length;if(0!==a%2)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<a;b+=2)R(this,b,b+1);return this};O.prototype.swap32=function(){var a=this.length;if(0!==a%4)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<a;b+=4)R(this,b,b+3),R(this,b+1,b+2);return this};
|
||
|
O.prototype.swap64=function(){var a=this.length;if(0!==a%8)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<a;b+=8)R(this,b,b+7),R(this,b+1,b+6),R(this,b+2,b+5),R(this,b+3,b+4);return this};O.prototype.toString=function(){var a=this.length|0;return 0===a?"":0===arguments.length?zb(this,0,a):yb.apply(this,arguments)};O.prototype.equals=function(a){if(!Q(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===O.compare(this,a)};
|
||
|
O.prototype.inspect=function(){var a="";0<this.length&&(a=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(a+=" ... "));return "<Buffer "+a+">"};
|
||
|
O.prototype.compare=function(a,b,c,d,e){if(!Q(a))throw new TypeError("Argument must be a Buffer");void 0===b&&(b=0);void 0===c&&(c=a?a.length:0);void 0===d&&(d=0);void 0===e&&(e=this.length);if(0>b||c>a.length||0>d||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return -1;if(b>=c)return 1;b>>>=0;c>>>=0;d>>>=0;e>>>=0;if(this===a)return 0;var f=e-d,g=c-b,h=Math.min(f,g);d=this.slice(d,e);a=a.slice(b,c);for(b=0;b<h;++b)if(d[b]!==a[b]){f=d[b];g=a[b];break}return f<
|
||
|
g?-1:g<f?1:0};
|
||
|
function Ab(a,b,c,d,e){if(0===a.length)return -1;"string"===typeof c?(d=c,c=0):2147483647<c?c=2147483647:-2147483648>c&&(c=-2147483648);c=+c;isNaN(c)&&(c=e?0:a.length-1);0>c&&(c=a.length+c);if(c>=a.length){if(e)return -1;c=a.length-1;}else if(0>c)if(e)c=0;else return -1;"string"===typeof b&&(b=O.from(b,d));if(Q(b))return 0===b.length?-1:Bb(a,b,c,d,e);if("number"===typeof b)return b&=255,O.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):
|
||
|
Uint8Array.prototype.lastIndexOf.call(a,b,c):Bb(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer");}
|
||
|
function Bb(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,m=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(2>a.length||2>b.length)return -1;g=2;h/=2;m/=2;c/=2;}if(e)for(d=-1;c<h;c++)if(f(a,c)===f(b,-1===d?0:c-d)){if(-1===d&&(d=c),c-d+1===m)return d*g}else-1!==d&&(c-=c-d),d=-1;else for(c+m>h&&(c=h-m);0<=c;c--){h=!0;for(d=0;d<m;d++)if(f(a,c+d)!==f(b,d)){h=!1;break}if(h)return c}return -1}
|
||
|
O.prototype.includes=function(a,b,c){return -1!==this.indexOf(a,b,c)};O.prototype.indexOf=function(a,b,c){return Ab(this,a,b,c,!0)};O.prototype.lastIndexOf=function(a,b,c){return Ab(this,a,b,c,!1)};
|
||
|
O.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"===typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var e=this.length-b;if(void 0===c||c>e)c=e;if(0<a.length&&(0>c||0>b)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(e=!1;;)switch(d){case "hex":a:{b=
|
||
|
Number(b)||0;d=this.length-b;c?(c=Number(c),c>d&&(c=d)):c=d;d=a.length;if(0!==d%2)throw new TypeError("Invalid hex string");c>d/2&&(c=d/2);for(d=0;d<c;++d){e=parseInt(a.substr(2*d,2),16);if(isNaN(e)){a=d;break a}this[b+d]=e;}a=d;}return a;case "utf8":case "utf-8":return Cb(wb(a,this.length-b),this,b,c);case "ascii":return Cb(Db(a),this,b,c);case "latin1":case "binary":return Cb(Db(a),this,b,c);case "base64":return Cb(xb(a),this,b,c);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":d=a;e=this.length-
|
||
|
b;for(var f=[],g=0;g<d.length&&!(0>(e-=2));++g){var h=d.charCodeAt(g);a=h>>8;h%=256;f.push(h);f.push(a);}return Cb(f,this,b,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0;}};O.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
|
||
|
function zb(a,b,c){c=Math.min(a.length,c);for(var d=[];b<c;){var e=a[b],f=null,g=239<e?4:223<e?3:191<e?2:1;if(b+g<=c)switch(g){case 1:128>e&&(f=e);break;case 2:var h=a[b+1];128===(h&192)&&(e=(e&31)<<6|h&63,127<e&&(f=e));break;case 3:h=a[b+1];var m=a[b+2];128===(h&192)&&128===(m&192)&&(e=(e&15)<<12|(h&63)<<6|m&63,2047<e&&(55296>e||57343<e)&&(f=e));break;case 4:h=a[b+1];m=a[b+2];var n=a[b+3];128===(h&192)&&128===(m&192)&&128===(n&192)&&(e=(e&15)<<18|(h&63)<<12|(m&63)<<6|n&63,65535<e&&1114112>e&&(f=
|
||
|
e));}null===f?(f=65533,g=1):65535<f&&(f-=65536,d.push(f>>>10&1023|55296),f=56320|f&1023);d.push(f);b+=g;}a=d.length;if(a<=Eb)d=String.fromCharCode.apply(String,d);else{c="";for(b=0;b<a;)c+=String.fromCharCode.apply(String,d.slice(b,b+=Eb));d=c;}return d}var Eb=4096;
|
||
|
O.prototype.slice=function(a,b){var c=this.length;a=~~a;b=void 0===b?c:~~b;0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c);0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c);b<a&&(b=a);if(O.TYPED_ARRAY_SUPPORT)b=this.subarray(a,b),b.__proto__=O.prototype;else{c=b-a;b=new O(c,void 0);for(var d=0;d<c;++d)b[d]=this[d+a];}return b};function S(a,b,c){if(0!==a%1||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length");}
|
||
|
O.prototype.readUIntLE=function(a,b,c){a|=0;b|=0;c||S(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;return c};O.prototype.readUIntBE=function(a,b,c){a|=0;b|=0;c||S(a,b,this.length);c=this[a+--b];for(var d=1;0<b&&(d*=256);)c+=this[a+--b]*d;return c};O.prototype.readUInt8=function(a,b){b||S(a,1,this.length);return this[a]};O.prototype.readUInt16LE=function(a,b){b||S(a,2,this.length);return this[a]|this[a+1]<<8};
|
||
|
O.prototype.readUInt16BE=function(a,b){b||S(a,2,this.length);return this[a]<<8|this[a+1]};O.prototype.readUInt32LE=function(a,b){b||S(a,4,this.length);return (this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};O.prototype.readUInt32BE=function(a,b){b||S(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};O.prototype.readIntLE=function(a,b,c){a|=0;b|=0;c||S(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;c>=128*d&&(c-=Math.pow(2,8*b));return c};
|
||
|
O.prototype.readIntBE=function(a,b,c){a|=0;b|=0;c||S(a,b,this.length);c=b;for(var d=1,e=this[a+--c];0<c&&(d*=256);)e+=this[a+--c]*d;e>=128*d&&(e-=Math.pow(2,8*b));return e};O.prototype.readInt8=function(a,b){b||S(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};O.prototype.readInt16LE=function(a,b){b||S(a,2,this.length);a=this[a]|this[a+1]<<8;return a&32768?a|4294901760:a};
|
||
|
O.prototype.readInt16BE=function(a,b){b||S(a,2,this.length);a=this[a+1]|this[a]<<8;return a&32768?a|4294901760:a};O.prototype.readInt32LE=function(a,b){b||S(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};O.prototype.readInt32BE=function(a,b){b||S(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};O.prototype.readFloatLE=function(a,b){b||S(a,4,this.length);return hb(this,a,!0,23,4)};
|
||
|
O.prototype.readFloatBE=function(a,b){b||S(a,4,this.length);return hb(this,a,!1,23,4)};O.prototype.readDoubleLE=function(a,b){b||S(a,8,this.length);return hb(this,a,!0,52,8)};O.prototype.readDoubleBE=function(a,b){b||S(a,8,this.length);return hb(this,a,!1,52,8)};function T(a,b,c,d,e,f){if(!Q(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||b<f)throw new RangeError('"value" argument is out of bounds');if(c+d>a.length)throw new RangeError("Index out of range");}
|
||
|
O.prototype.writeUIntLE=function(a,b,c,d){a=+a;b|=0;c|=0;d||T(this,a,b,c,Math.pow(2,8*c)-1,0);d=1;var e=0;for(this[b]=a&255;++e<c&&(d*=256);)this[b+e]=a/d&255;return b+c};O.prototype.writeUIntBE=function(a,b,c,d){a=+a;b|=0;c|=0;d||T(this,a,b,c,Math.pow(2,8*c)-1,0);d=c-1;var e=1;for(this[b+d]=a&255;0<=--d&&(e*=256);)this[b+d]=a/e&255;return b+c};O.prototype.writeUInt8=function(a,b,c){a=+a;b|=0;c||T(this,a,b,1,255,0);O.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a&255;return b+1};
|
||
|
function Fb(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e<f;++e)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e);}O.prototype.writeUInt16LE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,2,65535,0);O.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Fb(this,a,b,!0);return b+2};O.prototype.writeUInt16BE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,2,65535,0);O.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Fb(this,a,b,!1);return b+2};
|
||
|
function Gb(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e<f;++e)a[c+e]=b>>>8*(d?e:3-e)&255;}O.prototype.writeUInt32LE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,4,4294967295,0);O.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a&255):Gb(this,a,b,!0);return b+4};
|
||
|
O.prototype.writeUInt32BE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,4,4294967295,0);O.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Gb(this,a,b,!1);return b+4};O.prototype.writeIntLE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),T(this,a,b,c,d-1,-d));d=0;var e=1,f=0;for(this[b]=a&255;++d<c&&(e*=256);)0>a&&0===f&&0!==this[b+d-1]&&(f=1),this[b+d]=(a/e>>0)-f&255;return b+c};
|
||
|
O.prototype.writeIntBE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),T(this,a,b,c,d-1,-d));d=c-1;var e=1,f=0;for(this[b+d]=a&255;0<=--d&&(e*=256);)0>a&&0===f&&0!==this[b+d+1]&&(f=1),this[b+d]=(a/e>>0)-f&255;return b+c};O.prototype.writeInt8=function(a,b,c){a=+a;b|=0;c||T(this,a,b,1,127,-128);O.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a&255;return b+1};
|
||
|
O.prototype.writeInt16LE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,2,32767,-32768);O.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Fb(this,a,b,!0);return b+2};O.prototype.writeInt16BE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,2,32767,-32768);O.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Fb(this,a,b,!1);return b+2};
|
||
|
O.prototype.writeInt32LE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,4,2147483647,-2147483648);O.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):Gb(this,a,b,!0);return b+4};O.prototype.writeInt32BE=function(a,b,c){a=+a;b|=0;c||T(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);O.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Gb(this,a,b,!1);return b+4};
|
||
|
function Hb(a,b,c,d){if(c+d>a.length)throw new RangeError("Index out of range");if(0>c)throw new RangeError("Index out of range");}O.prototype.writeFloatLE=function(a,b,c){c||Hb(this,a,b,4);ib(this,a,b,!0,23,4);return b+4};O.prototype.writeFloatBE=function(a,b,c){c||Hb(this,a,b,4);ib(this,a,b,!1,23,4);return b+4};O.prototype.writeDoubleLE=function(a,b,c){c||Hb(this,a,b,8);ib(this,a,b,!0,52,8);return b+8};O.prototype.writeDoubleBE=function(a,b,c){c||Hb(this,a,b,8);ib(this,a,b,!1,52,8);return b+8};
|
||
|
O.prototype.copy=function(a,b,c,d){c||(c=0);d||0===d||(d=this.length);b>=a.length&&(b=a.length);b||(b=0);0<d&&d<c&&(d=c);if(d===c||0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length);a.length-b<d-c&&(d=a.length-b+c);var e=d-c;if(this===a&&c<b&&b<d)for(d=e-1;0<=d;--d)a[d+b]=this[d+c];else if(1E3>e||
|
||
|
!O.TYPED_ARRAY_SUPPORT)for(d=0;d<e;++d)a[d+b]=this[d+c];else Uint8Array.prototype.set.call(a,this.subarray(c,c+e),b);return e};
|
||
|
O.prototype.fill=function(a,b,c,d){if("string"===typeof a){"string"===typeof b?(d=b,b=0,c=this.length):"string"===typeof c&&(d=c,c=this.length);if(1===a.length){var e=a.charCodeAt(0);256>e&&(a=e);}if(void 0!==d&&"string"!==typeof d)throw new TypeError("encoding must be a string");if("string"===typeof d&&!O.isEncoding(d))throw new TypeError("Unknown encoding: "+d);}else"number"===typeof a&&(a&=255);if(0>b||this.length<b||this.length<c)throw new RangeError("Out of range index");if(c<=b)return this;b>>>=
|
||
|
0;c=void 0===c?this.length:c>>>0;a||(a=0);if("number"===typeof a)for(d=b;d<c;++d)this[d]=a;else for(a=Q(a)?a:wb((new O(a,d)).toString()),e=a.length,d=0;d<c-b;++d)this[d+b]=a[d%e];return this};var Ib=/[^+\/0-9A-Za-z-_]/g;
|
||
|
function wb(a,b){b=b||Infinity;for(var c,d=a.length,e=null,f=[],g=0;g<d;++g){c=a.charCodeAt(g);if(55295<c&&57344>c){if(!e){if(56319<c){-1<(b-=3)&&f.push(239,191,189);continue}else if(g+1===d){-1<(b-=3)&&f.push(239,191,189);continue}e=c;continue}if(56320>c){-1<(b-=3)&&f.push(239,191,189);e=c;continue}c=(e-55296<<10|c-56320)+65536;}else e&&-1<(b-=3)&&f.push(239,191,189);e=null;if(128>c){if(0>--b)break;f.push(c);}else if(2048>c){if(0>(b-=2))break;f.push(c>>6|192,c&63|128);}else if(65536>c){if(0>(b-=3))break;
|
||
|
f.push(c>>12|224,c>>6&63|128,c&63|128);}else if(1114112>c){if(0>(b-=4))break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128);}else throw Error("Invalid code point");}return f}function Db(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c)&255);return b}
|
||
|
function xb(a){a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(Ib,"");if(2>a.length)a="";else for(;0!==a.length%4;)a+="=";db||eb();var b=a.length;if(0<b%4)throw Error("Invalid string. Length must be a multiple of 4");var c="="===a[b-2]?2:"="===a[b-1]?1:0;var d=new cb(3*b/4-c);var e=0<c?b-4:b;var f=0;for(b=0;b<e;b+=4){var g=N[a.charCodeAt(b)]<<18|N[a.charCodeAt(b+1)]<<12|N[a.charCodeAt(b+2)]<<6|N[a.charCodeAt(b+3)];d[f++]=g>>16&255;d[f++]=g>>8&255;d[f++]=g&255;}2===c?(g=N[a.charCodeAt(b)]<<2|
|
||
|
N[a.charCodeAt(b+1)]>>4,d[f++]=g&255):1===c&&(g=N[a.charCodeAt(b)]<<10|N[a.charCodeAt(b+1)]<<4|N[a.charCodeAt(b+2)]>>2,d[f++]=g>>8&255,d[f++]=g&255);return d}function Cb(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function vb(a){return null!=a&&(!!a._isBuffer||Jb(a)||"function"===typeof a.readFloatLE&&"function"===typeof a.slice&&Jb(a.slice(0,0)))}function Jb(a){return !!a.constructor&&"function"===typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}
|
||
|
var Kb=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:nb,Buffer:O,SlowBuffer:function(a){+a!=a&&(a=0);return O.alloc(+a)},isBuffer:vb}),Lb=Qa(function(a,b){function c(a,b){for(var c in a)b[c]=a[c];}function d(a,b,c){return e(a,b,c)}var e=Kb.Buffer;e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?a.exports=Kb:(c(Kb,b),b.Buffer=d);d.prototype=Object.create(e.prototype);c(e,d);d.from=function(a,b,c){if("number"===typeof a)throw new TypeError("Argument must not be a number");return e(a,
|
||
|
b,c)};d.alloc=function(a,b,c){if("number"!==typeof a)throw new TypeError("Argument must be a number");a=e(a);void 0!==b?"string"===typeof c?a.fill(b,c):a.fill(b):a.fill(0);return a};d.allocUnsafe=function(a){if("number"!==typeof a)throw new TypeError("Argument must be a number");return e(a)};d.allocUnsafeSlow=function(a){if("number"!==typeof a)throw new TypeError("Argument must be a number");return Kb.SlowBuffer(a)};}),Mb=Qa(function(a,b){function c(){throw Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11");
|
||
|
}function d(a,b){if("number"!==typeof a||a!==a)throw new TypeError("offset must be a number");if(a>q||0>a)throw new TypeError("offset must be a uint32");if(a>n||a>b)throw new RangeError("offset out of range");}function e(a,b,c){if("number"!==typeof a||a!==a)throw new TypeError("size must be a number");if(a>q||0>a)throw new TypeError("size must be a uint32");if(a+b>c||a>n)throw new RangeError("buffer too small");}function f(a,b,c,f){if(!(m.isBuffer(a)||a instanceof Pa.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
|
||
|
if("function"===typeof b)f=b,b=0,c=a.length;else if("function"===typeof c)f=c,c=a.length-b;else if("function"!==typeof f)throw new TypeError('"cb" argument must be a function');d(b,a.length);e(c,b,a.length);return g(a,b,c,f)}function g(a,b,c,d){b=new Uint8Array(a.buffer,b,c);t.getRandomValues(b);if(d)Ya(function(){d(null,a);});else return a}function h(a,b,c){"undefined"===typeof b&&(b=0);if(!(m.isBuffer(a)||a instanceof Pa.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
|
||
|
d(b,a.length);void 0===c&&(c=a.length-b);e(c,b,a.length);return g(a,b,c)}var m=Lb.Buffer,n=Lb.kMaxLength,t=Pa.crypto||Pa.msCrypto,q=Math.pow(2,32)-1;t&&t.getRandomValues?(b.randomFill=f,b.randomFillSync=h):(b.randomFill=c,b.randomFillSync=c);}),Nb=Qa(function(a){a.exports=Mb;}).randomFillSync;function U(a){if("string"!==typeof a)throw new TypeError("Path must be a string. Received "+JSON.stringify(a));}
|
||
|
function Ob(a,b){for(var c="",d=0,e=-1,f=0,g,h=0;h<=a.length;++h){if(h<a.length)g=a.charCodeAt(h);else if(47===g)break;else g=47;if(47===g){if(e!==h-1&&1!==f)if(e!==h-1&&2===f){if(2>c.length||2!==d||46!==c.charCodeAt(c.length-1)||46!==c.charCodeAt(c.length-2))if(2<c.length){if(e=c.lastIndexOf("/"),e!==c.length-1){-1===e?(c="",d=0):(c=c.slice(0,e),d=c.length-1-c.lastIndexOf("/"));e=h;f=0;continue}}else if(2===c.length||1===c.length){c="";d=0;e=h;f=0;continue}b&&(c=0<c.length?c+"/..":"..",d=2);}else c=
|
||
|
0<c.length?c+("/"+a.slice(e+1,h)):a.slice(e+1,h),d=h-e-1;e=h;f=0;}else 46===g&&-1!==f?++f:f=-1;}return c}
|
||
|
var Pb={resolve:function(){for(var a="",b=!1,c,d=arguments.length-1;-1<=d&&!b;d--){if(0<=d)var e=arguments[d];else void 0===c&&(c=bb.cwd()),e=c;U(e);0!==e.length&&(a=e+"/"+a,b=47===e.charCodeAt(0));}a=Ob(a,!b);return b?0<a.length?"/"+a:"/":0<a.length?a:"."},normalize:function(a){U(a);if(0===a.length)return ".";var b=47===a.charCodeAt(0),c=47===a.charCodeAt(a.length-1);a=Ob(a,!b);0!==a.length||b||(a=".");0<a.length&&c&&(a+="/");return b?"/"+a:a},isAbsolute:function(a){U(a);return 0<a.length&&47===a.charCodeAt(0)},
|
||
|
join:function(){if(0===arguments.length)return ".";for(var a,b=0;b<arguments.length;++b){var c=arguments[b];U(c);0<c.length&&(a=void 0===a?c:a+("/"+c));}return void 0===a?".":Pb.normalize(a)},relative:function(a,b){U(a);U(b);if(a===b)return "";a=Pb.resolve(a);b=Pb.resolve(b);if(a===b)return "";for(var c=1;c<a.length&&47===a.charCodeAt(c);++c);for(var d=a.length,e=d-c,f=1;f<b.length&&47===b.charCodeAt(f);++f);for(var g=b.length-f,h=e<g?e:g,m=-1,n=0;n<=h;++n){if(n===h){if(g>h){if(47===b.charCodeAt(f+n))return b.slice(f+
|
||
|
n+1);if(0===n)return b.slice(f+n)}else e>h&&(47===a.charCodeAt(c+n)?m=n:0===n&&(m=0));break}var t=a.charCodeAt(c+n),q=b.charCodeAt(f+n);if(t!==q)break;else 47===t&&(m=n);}e="";for(n=c+m+1;n<=d;++n)if(n===d||47===a.charCodeAt(n))e=0===e.length?e+"..":e+"/..";if(0<e.length)return e+b.slice(f+m);f+=m;47===b.charCodeAt(f)&&++f;return b.slice(f)},_makeLong:function(a){return a},dirname:function(a){U(a);if(0===a.length)return ".";for(var b=a.charCodeAt(0),c=47===b,d=-1,e=!0,f=a.length-1;1<=f;--f)if(b=a.charCodeAt(f),
|
||
|
47===b){if(!e){d=f;break}}else e=!1;return -1===d?c?"/":".":c&&1===d?"//":a.slice(0,d)},basename:function(a,b){if(void 0!==b&&"string"!==typeof b)throw new TypeError('"ext" argument must be a string');U(a);var c=0,d=-1,e=!0,f;if(void 0!==b&&0<b.length&&b.length<=a.length){if(b.length===a.length&&b===a)return "";var g=b.length-1,h=-1;for(f=a.length-1;0<=f;--f){var m=a.charCodeAt(f);if(47===m){if(!e){c=f+1;break}}else-1===h&&(e=!1,h=f+1),0<=g&&(m===b.charCodeAt(g)?-1===--g&&(d=f):(g=-1,d=h));}c===d?d=
|
||
|
h:-1===d&&(d=a.length);return a.slice(c,d)}for(f=a.length-1;0<=f;--f)if(47===a.charCodeAt(f)){if(!e){c=f+1;break}}else-1===d&&(e=!1,d=f+1);return -1===d?"":a.slice(c,d)},extname:function(a){U(a);for(var b=-1,c=0,d=-1,e=!0,f=0,g=a.length-1;0<=g;--g){var h=a.charCodeAt(g);if(47===h){if(!e){c=g+1;break}}else-1===d&&(e=!1,d=g+1),46===h?-1===b?b=g:1!==f&&(f=1):-1!==b&&(f=-1);}return -1===b||-1===d||0===f||1===f&&b===d-1&&b===c+1?"":a.slice(b,d)},format:function(a){if(null===a||"object"!==typeof a)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+
|
||
|
typeof a);var b=a.dir||a.root,c=a.base||(a.name||"")+(a.ext||"");a=b?b===a.root?b+c:b+"/"+c:c;return a},parse:function(a){U(a);var b={root:"",dir:"",base:"",ext:"",name:""};if(0===a.length)return b;var c=a.charCodeAt(0),d=47===c;if(d){b.root="/";var e=1;}else e=0;for(var f=-1,g=0,h=-1,m=!0,n=a.length-1,t=0;n>=e;--n)if(c=a.charCodeAt(n),47===c){if(!m){g=n+1;break}}else-1===h&&(m=!1,h=n+1),46===c?-1===f?f=n:1!==t&&(t=1):-1!==f&&(t=-1);-1===f||-1===h||0===t||1===t&&f===h-1&&f===g+1?-1!==h&&(b.base=0===
|
||
|
g&&d?b.name=a.slice(1,h):b.name=a.slice(g,h)):(0===g&&d?(b.name=a.slice(1,f),b.base=a.slice(1,h)):(b.name=a.slice(g,f),b.base=a.slice(g,h)),b.ext=a.slice(f,h));0<g?b.dir=a.slice(0,g-1):d&&(b.dir="/");return b},sep:"/",delimiter:":",win32:null,posix:null},Qb=Pb.posix=Pb,Tb={hrtime:function(a){var b=a();return function(c){c=a(c||b);return 1E9*c[0]+c[1]}}(function(a){var b=.001*performance.now(),c=Math.floor(b);b=Math.floor(b%1*1E9);a&&(c-=a[0],b-=a[1],0>b&&(c--,b+=1E9));return [c,b]}),exit:function(a){throw new Rb(a);
|
||
|
},kill:function(a){throw new Sb(a);},randomFillSync:Nb,isTTY:function(){return !0},path:Qb,fs:null},V,Ub=k(1),W=k(2),X=k(4),Vb=k(8),Xb=k(16),Yb=k(32),Y=k(64),Zb=k(128),$b=k(256),ac=k(512),bc=k(1024),cc=k(2048),dc=k(4096),ec=k(8192),fc=k(16384),jc=k(32768),kc=k(65536),lc=k(131072),mc=k(262144),nc=k(524288),oc=k(1048576),pc=k(2097152),qc=k(4194304),rc=k(8388608),sc=k(16777216),tc=k(33554432),uc=k(67108864),vc=k(134217728),wc=k(268435456),xc=Ub|W|X|Vb|Xb|Yb|Y|Zb|$b|ac|bc|cc|dc|ec|fc|jc|kc|lc|mc|nc|oc|
|
||
|
pc|rc|qc|sc|uc|tc|vc|wc,yc=Ub|W|X|Vb|Xb|Yb|Y|Zb|$b|pc|qc|rc|vc,zc=k(0),Ac=Vb|Xb|Zb|ac|bc|cc|dc|ec|fc|jc|kc|lc|mc|nc|oc|pc|rc|sc|uc|tc|vc,Bc=Ac|yc,Cc=W|Vb|Y|pc|vc|wc,Dc=W|Vb|Y|pc|vc,Ec=k(0),Fc={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},Gc=(V={},V[6]="SIGHUP",V[8]="SIGINT",V[11]="SIGQUIT",V[7]="SIGILL",V[15]="SIGTRAP",V[0]="SIGABRT",V[2]="SIGBUS",V[5]="SIGFPE",V[9]="SIGKILL",V[20]="SIGUSR1",V[12]="SIGSEGV",V[21]="SIGUSR2",V[10]="SIGPIPE",V[1]="SIGALRM",V[14]="SIGTERM",V[3]="SIGCHLD",V[4]="SIGCONT",V[13]="SIGSTOP",V[16]="SIGTSTP",V[17]="SIGTTIN",V[18]="SIGTTOU",V[19]="SIGURG",V[23]="SIGXCPU",V[24]="SIGXFSZ",V[22]="SIGVTALRM",V);
|
||
|
function Hc(a){var b=Math.trunc(a);a=k(Math.round(1E3*(a-b)));return k(b)*k(1E3)+a}function Z(a){return function(){for(var b=[],c=0;c<arguments.length;c++)b[c]=arguments[c];try{return a.apply(void 0,ea(b))}catch(d){if("number"===typeof d)return d;if(d&&d.errno)return Fc[d.code]||28;throw d;}}}
|
||
|
function Ic(a,b){var c=a.FD_MAP.get(b);if(!c)throw 8;if(void 0===c.filetype){var d=a.bindings.fs.fstatSync(c.real);a=Jc(a,b,d);b=a.rightsBase;d=a.rightsInheriting;c.filetype=a.filetype;c.rights||(c.rights={base:b,inheriting:d});}return c}
|
||
|
function Jc(a,b,c){switch(!0){case c.isBlockDevice():return {filetype:1,rightsBase:xc,rightsInheriting:xc};case c.isCharacterDevice():return void 0!==b&&a.bindings.isTTY(b)?{filetype:2,rightsBase:Dc,rightsInheriting:Ec}:{filetype:2,rightsBase:xc,rightsInheriting:xc};case c.isDirectory():return {filetype:3,rightsBase:Ac,rightsInheriting:Bc};case c.isFIFO():return {filetype:6,rightsBase:Cc,rightsInheriting:xc};case c.isFile():return {filetype:4,rightsBase:yc,rightsInheriting:zc};case c.isSocket():return {filetype:6,
|
||
|
rightsBase:Cc,rightsInheriting:xc};case c.isSymbolicLink():return {filetype:7,rightsBase:k(0),rightsInheriting:k(0)};default:return {filetype:0,rightsBase:k(0),rightsInheriting:k(0)}}}
|
||
|
var Rb=function(a){function b(b){var c=a.call(this,"WASI Exit error: "+b)||this;c.code=b;return c}ba(b,a);return b}(Error),Sb=function(a){function b(b){var c=a.call(this,"WASI Kill signal: "+b)||this;c.signal=b;return c}ba(b,a);return b}(Error),Kc=function(){function a(a){function b(a){switch(a){case 0:case 2:return t.hrtime();case 1:case 3:return t.hrtime()-Lc;default:return null}}function d(a,b){a=Ic(g,a);if(b!==k(0)&&(a.rights.base&b)===k(0))throw 63;return a}function e(a,b){g.refreshMemory();
|
||
|
return Array.from({length:b},function(b,c){c=a+8*c;b=g.view.getUint32(c,!0);c=g.view.getUint32(c+4,!0);return new Uint8Array(g.memory.buffer,b,c)})}var f,g=this,h={};a&&a.preopenDirectories&&(h=a.preopenDirectories);var m={};a&&a.env&&(m=a.env);var n=[];a&&a.args&&(n=a.args);var t=Tb;a&&a.bindings&&(t=a.bindings);this.view=this.memory=void 0;this.bindings=t;this.FD_MAP=new Map([[0,{real:0,filetype:void 0,rights:{base:yc,inheriting:k(0)},path:void 0}],[1,{real:1,filetype:void 0,rights:{base:yc,inheriting:k(0)},
|
||
|
path:void 0}],[2,{real:2,filetype:void 0,rights:{base:yc,inheriting:k(0)},path:void 0}]]);var q=this.bindings.fs,x=this.bindings.path;try{for(var Fa=ca(Object.entries(h)),ia=Fa.next();!ia.done;ia=Fa.next()){var Wb=da(ia.value,2),Mc=Wb[0],gc=Wb[1],Nc=q.openSync(gc,q.constants.O_RDONLY),Oc=ea(this.FD_MAP.keys()).reverse()[0]+1;this.FD_MAP.set(Oc,{real:Nc,filetype:3,rights:{base:Ac,inheriting:Bc},fakePath:Mc,path:gc});}}catch(w){var hc={error:w};}finally{try{ia&&!ia.done&&(f=Fa.return)&&f.call(Fa);}finally{if(hc)throw hc.error;
|
||
|
}}var Lc=t.hrtime();this.wasiImport={args_get:function(a,b){g.refreshMemory();var c=a,d=b;n.forEach(function(a){g.view.setUint32(c,d,!0);c+=4;d+=D.from(g.memory.buffer).write(a+"\x00",d);});return 0},args_sizes_get:function(a,b){g.refreshMemory();g.view.setUint32(a,n.length,!0);a=n.reduce(function(a,b){return a+D.byteLength(b)+1},0);g.view.setUint32(b,a,!0);return 0},environ_get:function(a,b){g.refreshMemory();var c=a,d=b;Object.entries(m).forEach(function(a){var b=da(a,2);a=b[0];b=b[1];g.view.setUint32(c,
|
||
|
d,!0);c+=4;d+=D.from(g.memory.buffer).write(a+"="+b+"\x00",d);});return 0},environ_sizes_get:function(a,b){g.refreshMemory();var c=Object.entries(m).map(function(a){a=da(a,2);return a[0]+"="+a[1]+"\x00"}),d=c.reduce(function(a,b){return a+D.byteLength(b)},0);g.view.setUint32(a,c.length,!0);g.view.setUint32(b,d,!0);return 0},clock_res_get:function(a,b){g.view.setBigUint64(b,k(0));return 0},clock_time_get:function(a,c,d){g.refreshMemory();a=b(a);if(null===a)return 28;g.view.setBigUint64(d,k(a),!0);return 0},
|
||
|
fd_advise:Z(function(a){d(a,Zb);return 52}),fd_allocate:Z(function(a){d(a,$b);return 52}),fd_close:Z(function(a){var b=d(a,k(0));q.closeSync(b.real);g.FD_MAP.delete(a);return 0}),fd_datasync:function(a){a=d(a,Ub);q.fdatasyncSync(a.real);return 0},fd_fdstat_get:Z(function(a,b){a=d(a,k(0));g.refreshMemory();g.view.setUint8(b,a.filetype);g.view.setUint16(b+2,0,!0);g.view.setUint16(b+4,0,!0);g.view.setBigUint64(b+8,k(a.rights.base),!0);g.view.setBigUint64(b+8+8,k(a.rights.inheriting),!0);return 0}),fd_fdstat_set_flags:Z(function(a){d(a,
|
||
|
Vb);return 52}),fd_fdstat_set_rights:Z(function(a,b,c){a=d(a,k(0));b|=a.rights.base;if(b>a.rights.base)return 63;c|=a.rights.inheriting;if(c>a.rights.inheriting)return 63;a.rights.base=b;a.rights.inheriting=c;return 0}),fd_filestat_get:Z(function(a,b){a=d(a,pc);var c=q.fstatSync(a.real);g.refreshMemory();g.view.setBigUint64(b,k(c.dev),!0);b+=8;g.view.setBigUint64(b,k(c.ino),!0);b+=8;g.view.setUint8(b,a.filetype);b+=4;g.view.setUint32(b,Number(c.nlink),!0);b+=4;g.view.setBigUint64(b,k(c.size),!0);
|
||
|
b+=8;g.view.setBigUint64(b,Hc(c.atimeMs),!0);b+=8;g.view.setBigUint64(b,Hc(c.mtimeMs),!0);g.view.setBigUint64(b+8,Hc(c.ctimeMs),!0);return 0}),fd_filestat_set_size:Z(function(a,b){a=d(a,qc);q.ftruncate(a.real,Number(b));return 0}),fd_filestat_set_times:Z(function(a,c,e,g){a=d(a,rc);var f=b(2);q.futimesSync(a.real,2===(g&2)?f:c,8===(g&8)?f:e);return 0}),fd_prestat_get:Z(function(a,b){a=d(a,k(0));if(!a.path)return 28;g.refreshMemory();g.view.setUint8(b,0);g.view.setUint32(b+4,D.byteLength(a.fakePath),
|
||
|
!0);return 0}),fd_prestat_dir_name:Z(function(a,b,c){a=d(a,k(0));if(!a.path)return 28;g.refreshMemory();D.from(g.memory.buffer).write(a.fakePath,b,c,"utf8");return 0}),fd_pwrite:Z(function(a,b,c,f,h){var w=d(a,Y|X),r=0;e(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=q.writeSync(w.real,a,b,a.byteLength-b,f+r+b);r+=b;});g.view.setUint32(h,r,!0);return 0}),fd_write:Z(function(a,b,c,f){var w=d(a,Y),h=0;e(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=q.writeSync(w.real,a,b,a.byteLength-
|
||
|
b);h+=b;});g.view.setUint32(f,h,!0);return 0}),fd_pread:Z(function(a,b,c,f,h){var w=d(a,W|X),r=0;e(b,c).forEach(function(a){for(var b=0;b<a.byteLength;)b+=q.readSync(w.real,a,b,a.byteLength-b,f+r+b);r+=b;});g.view.setUint32(h,r,!0);return 0}),fd_read:Z(function(a,b,c,f){var w;a=d(a,W);var h=0===a.real,r=0;try{var m=ca(e(b,c)),n=m.next();a:for(;!n.done;n=m.next()){var kb=n.value;for(b=0;b<kb.byteLength;){var t=kb.byteLength-b,K=q.readSync(a.real,kb,b,t,h||void 0===a.offset?null:Number(a.offset));h||
|
||
|
(a.offset=(a.offset?a.offset:k(0))+k(K));b+=K;r+=K;if(0===K||K<t)break a}}}catch(Pc){var x={error:Pc};}finally{try{n&&!n.done&&(w=m.return)&&w.call(m);}finally{if(x)throw x.error;}}g.view.setUint32(f,r,!0);return 0}),fd_readdir:Z(function(a,b,c,e,f){a=d(a,fc);g.refreshMemory();var w=q.readdirSync(a.path,{withFileTypes:!0}),h=b;for(e=Number(e);e<w.length;e+=1){var m=w[e],r=D.byteLength(m.name);if(b+24+r>=h+c)break;g.view.setBigUint64(b,k(e+1),!0);b+=8;var n=q.statSync(x.resolve(a.path,m.name));g.view.setBigUint64(b,
|
||
|
k(n.ino),!0);b+=8;g.view.setUint32(b,r,!0);b+=4;switch(!0){case n.isBlockDevice():r=1;break;case n.isCharacterDevice():r=2;break;case n.isDirectory():r=3;break;case n.isFIFO():r=6;break;case n.isFile():r=4;break;case n.isSocket():r=6;break;case n.isSymbolicLink():r=7;break;default:r=0;}g.view.setUint8(b,r);b+=1;b+=3;D.from(g.memory.buffer).write(m.name,b);b+=D.byteLength(m.name);}g.view.setUint32(f,b-h,!0);return 0}),fd_renumber:Z(function(a,b){d(a,k(0));d(b,k(0));q.closeSync(g.FD_MAP.get(a).real);
|
||
|
g.FD_MAP.set(a,g.FD_MAP.get(b));g.FD_MAP.delete(b);return 0}),fd_seek:Z(function(a,b,c,e){a=d(a,X);g.refreshMemory();switch(c){case 0:a.offset=(a.offset?a.offset:k(0))+k(b);break;case 1:c=q.fstatSync(a.real).size;a.offset=k(c)+k(b);break;case 2:a.offset=k(b);}g.view.setBigUint64(e,a.offset,!0);return 0}),fd_tell:Z(function(a){d(a,Yb);g.refreshMemory();throw Error("fd_tell to be implemented (without binding)");}),fd_sync:Z(function(a){a=d(a,Xb);q.fsyncSync(a.real);return 0}),path_create_directory:Z(function(a,
|
||
|
b,c){a=d(a,ac);if(!a.path)return 28;g.refreshMemory();b=D.from(g.memory.buffer,b,c).toString();q.mkdirSync(x.resolve(a.path,b));return 0}),path_filestat_get:Z(function(a,b,c,e,f){a=d(a,mc);if(!a.path)return 28;g.refreshMemory();c=D.from(g.memory.buffer,c,e).toString();c=q.statSync(x.resolve(a.path,c));g.view.setBigUint64(f,k(c.dev),!0);f+=8;g.view.setBigUint64(f,k(c.ino),!0);f+=8;g.view.setUint8(f,Jc(g,void 0,c).filetype);f+=4;g.view.setUint32(f,Number(c.nlink),!0);f+=4;g.view.setBigUint64(f,k(c.size),
|
||
|
!0);f+=8;g.view.setBigUint64(f,Hc(c.atimeMs),!0);f+=8;g.view.setBigUint64(f,Hc(c.mtimeMs),!0);g.view.setBigUint64(f+8,Hc(c.ctimeMs),!0);return 0}),path_filestat_set_times:Z(function(a,c,e,f,h,m){a=d(a,oc);if(!a.path)return 28;g.refreshMemory();var w=b(2),n=2===(c&2);c=8===(c&8);e=D.from(g.memory.buffer,e,f).toString();q.utimesSync(x.resolve(a.path,e),n?w:h,c?w:m);return 0}),path_link:Z(function(a,b,c,e,f,h,m){a=d(a,cc);f=d(f,dc);if(!a.path||!f.path)return 28;g.refreshMemory();c=D.from(g.memory.buffer,
|
||
|
c,e).toString();h=D.from(g.memory.buffer,h,m).toString();q.linkSync(x.resolve(a.path,c),x.resolve(f.path,h));return 0}),path_open:Z(function(a,b,c,e,f,h,m,n,t){b=d(a,ec);h=k(h);m=k(m);a=(h&(W|fc))!==k(0);var w=(h&(Ub|Y|$b|qc))!==k(0);if(w&&a)var r=q.constants.O_RDWR;else a?r=q.constants.O_RDONLY:w&&(r=q.constants.O_WRONLY);a=h|ec;h|=m;0!==(f&1)&&(r|=q.constants.O_CREAT,a|=bc);0!==(f&2)&&(r|=q.constants.O_DIRECTORY);0!==(f&4)&&(r|=q.constants.O_EXCL);0!==(f&8)&&(r|=q.constants.O_TRUNC,a|=nc);0!==(n&
|
||
|
1)&&(r|=q.constants.O_APPEND);0!==(n&2)&&(r=q.constants.O_DSYNC?r|q.constants.O_DSYNC:r|q.constants.O_SYNC,h|=Ub);0!==(n&4)&&(r|=q.constants.O_NONBLOCK);0!==(n&8)&&(r=q.constants.O_RSYNC?r|q.constants.O_RSYNC:r|q.constants.O_SYNC,h|=Xb);0!==(n&16)&&(r|=q.constants.O_SYNC,h|=Xb);w&&0===(r&(q.constants.O_APPEND|q.constants.O_TRUNC))&&(h|=X);g.refreshMemory();c=D.from(g.memory.buffer,c,e).toString();c=x.resolve(b.path,c);if(x.relative(b.path,c).startsWith(".."))return 76;try{var K=q.realpathSync(c);
|
||
|
if(x.relative(b.path,K).startsWith(".."))return 76}catch(ic){if("ENOENT"===ic.code)K=c;else throw ic;}r=q.openSync(K,r);c=ea(g.FD_MAP.keys()).reverse()[0]+1;g.FD_MAP.set(c,{real:r,filetype:void 0,rights:{base:a,inheriting:h},path:K});Ic(g,c);g.view.setUint32(t,c,!0);return 0}),path_readlink:Z(function(a,b,c,e,f,h){a=d(a,jc);if(!a.path)return 28;g.refreshMemory();b=D.from(g.memory.buffer,b,c).toString();b=x.resolve(a.path,b);b=q.readlinkSync(b);e=D.from(g.memory.buffer).write(b,e,f);g.view.setUint32(h,
|
||
|
e,!0);return 0}),path_remove_directory:Z(function(a,b,c){a=d(a,tc);if(!a.path)return 28;g.refreshMemory();b=D.from(g.memory.buffer,b,c).toString();q.rmdirSync(x.resolve(a.path,b));return 0}),path_rename:Z(function(a,b,c,e,f,h){a=d(a,kc);e=d(e,lc);if(!a.path||!e.path)return 28;g.refreshMemory();b=D.from(g.memory.buffer,b,c).toString();f=D.from(g.memory.buffer,f,h).toString();q.renameSync(x.resolve(a.path,b),x.resolve(e.path,f));return 0}),path_symlink:Z(function(a,b,c,e,f){c=d(c,sc);if(!c.path)return 28;
|
||
|
g.refreshMemory();a=D.from(g.memory.buffer,a,b).toString();e=D.from(g.memory.buffer,e,f).toString();q.symlinkSync(a,x.resolve(c.path,e));return 0}),path_unlink_file:Z(function(a,b,c){a=d(a,uc);if(!a.path)return 28;g.refreshMemory();b=D.from(g.memory.buffer,b,c).toString();q.unlinkSync(x.resolve(a.path,b));return 0}),poll_oneoff:function(a,c,d,e){var f=0,h=0;g.refreshMemory();for(var m=0;m<d;m+=1){var n=g.view.getBigUint64(a,!0);a+=8;var q=g.view.getUint8(a);a+=1;switch(q){case 0:a+=7;g.view.getBigUint64(a,
|
||
|
!0);a+=8;var r=g.view.getUint32(a,!0);a+=4;a+=4;q=g.view.getBigUint64(a,!0);a+=8;g.view.getBigUint64(a,!0);a+=8;var w=g.view.getUint16(a,!0);a+=2;a+=6;var x=1===w;w=0;r=k(b(r));null===r?w=28:(q=x?q:r+q,h=q>h?q:h);g.view.setBigUint64(c,n,!0);c+=8;g.view.setUint16(c,w,!0);c+=2;g.view.setUint8(c,0);c+=1;c+=5;f+=1;break;case 1:case 2:a+=3;g.view.getUint32(a,!0);a+=4;g.view.setBigUint64(c,n,!0);c+=8;g.view.setUint16(c,52,!0);c+=2;g.view.setUint8(c,q);c+=1;c+=5;f+=1;break;default:return 28}}for(g.view.setUint32(e,
|
||
|
f,!0);t.hrtime()<h;);return 0},proc_exit:function(a){t.exit(a);return 0},proc_raise:function(a){if(!(a in Gc))return 28;t.kill(Gc[a]);return 0},random_get:function(a,b){g.refreshMemory();t.randomFillSync(new Uint8Array(g.memory.buffer),a,b);return 0},sched_yield:function(){return 52},sock_recv:function(){return 52},sock_send:function(){return 52},sock_shutdown:function(){return 52}};Object.keys(this.wasiImport).forEach(function(a){var b=g.wasiImport[a];g.wasiImport[a]=function(){for(var a=[],c=0;c<
|
||
|
arguments.length;c++)a[c]=arguments[c];try{return b.apply(void 0,ea(a))}catch(lb){switch(console.log("Catched error: "+lb),lb.code){default:throw lb;case "ENOENT":return 44}}};});}a.prototype.refreshMemory=function(){this.view&&0!==this.view.buffer.byteLength||(this.view=new ha(this.memory.buffer));};a.prototype.setMemory=function(a){this.memory=a;};a.prototype.start=function(a){a=a.exports;if(null===a||"object"!==typeof a)throw Error("instance.exports must be an Object. Received "+a+".");var b=a.memory;
|
||
|
if(!(b instanceof WebAssembly.Memory))throw Error("instance.exports.memory must be a WebAssembly.Memory. Recceived "+b+".");this.setMemory(b);a._start&&a._start();};a.defaultBindings=Tb;return a}();
|
||
|
|
||
|
const isNode = !!(
|
||
|
typeof process !== "undefined" &&
|
||
|
process.versions &&
|
||
|
process.versions.node
|
||
|
);
|
||
|
|
||
|
/**
|
||
|
* ECMAScript Interface to WASM port of OpenSSL (https://www.openssl.org)
|
||
|
* @module OpenSSL
|
||
|
*
|
||
|
* @license Apache-2.0
|
||
|
* @copyright 2019 DIGITALARSENAL.IO, INC.
|
||
|
*/
|
||
|
|
||
|
const run = async args => {
|
||
|
let _filename;
|
||
|
try {
|
||
|
_filename = __filename;
|
||
|
} catch (e) {
|
||
|
|
||
|
}
|
||
|
if (isNode && !_filename) {
|
||
|
const { fileURLToPath } = await import('url'); //SyntaxError: Parenthesized pattern ({fileURLToPath})
|
||
|
_filename = fileURLToPath(import.meta.url);
|
||
|
}
|
||
|
|
||
|
let command = ["openssl"].concat(
|
||
|
args.command.split(/[\s]{1,}/g).filter(Boolean)
|
||
|
);
|
||
|
|
||
|
if (!isNode || (isNode && process.env.WORKER)) {
|
||
|
let { fs, rootDir, env, wasmBinary } = args;
|
||
|
let wasi = new Kc({
|
||
|
args: command,
|
||
|
env: env,
|
||
|
preopenDirectories: {
|
||
|
"/": rootDir
|
||
|
},
|
||
|
bindings: {
|
||
|
...Kc.defaultBindings,
|
||
|
fs
|
||
|
}
|
||
|
});
|
||
|
|
||
|
let { instance } = await WebAssembly.instantiate(wasmBinary, {
|
||
|
wasi_unstable: wasi.wasiImport
|
||
|
});
|
||
|
|
||
|
try {
|
||
|
wasi.start(instance);
|
||
|
} catch (e) { }
|
||
|
} else {
|
||
|
const { wasmBinary, ...envArgs } = args;
|
||
|
const { fork } = await import('child_process');
|
||
|
let cp = fork(_filename, {
|
||
|
silent: false,
|
||
|
env: {
|
||
|
args: JSON.stringify(envArgs),
|
||
|
WORKER: true
|
||
|
}
|
||
|
});
|
||
|
|
||
|
cp.on('error', () => {
|
||
|
console.error('no wasm');
|
||
|
});
|
||
|
|
||
|
cp.send({ wasmBinary: wasmBinary });
|
||
|
return new Promise((resolve, reject) => {
|
||
|
cp.on("exit", code => {
|
||
|
resolve(code);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
if (isNode && process.env.WORKER) {
|
||
|
const args = JSON.parse(process.env.args);
|
||
|
process.on("message", async ipc => {
|
||
|
if (ipc.wasmBinary.type === "Buffer") {
|
||
|
args.wasmBinary = Buffer.from(ipc.wasmBinary.data);
|
||
|
} else {
|
||
|
throw Error(`${new Date().toISOString()} Invalid Wasm Binary Format.`);
|
||
|
}
|
||
|
args.fs = await import('fs'); //In Node
|
||
|
run(args);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* ECMAScript Interface to WASM port of OpenSSL (https://www.openssl.org)
|
||
|
* @module OpenSSL
|
||
|
*
|
||
|
* @license Apache-2.0
|
||
|
* @copyright 2019 DIGITALARSENAL.IO, INC.
|
||
|
*/
|
||
|
|
||
|
/* Default path to the WebAssembly file */
|
||
|
|
||
|
const wasmPath = null;
|
||
|
let wasmBinary;
|
||
|
let wasmb64 = "AGFzbQEAAAAB+wM5YAR/f39/AX9gAn9/AX9gAX8Bf2ADf39/AX9gCH9/f39/f39/AX9gBn9/f39/fwF/YAV/f39/fwF/YAJ/fwBgBH9/f38AYAN/f38AYAF/AGAHf39/f39/fwF/YAl/f39/f39/f38Bf2AAAGAGf39/f39/AGAFf39/f38AYAh/f39/f39/fwBgA39/fAF/YAABf2ADf35/AX5gBX9/f35/AX9gA39+fwF/YAR/fn9/AX9gCX9/f39/fn5/fwF/YBl/f39/f39/f39/f39/f39/f39/f39/f39/AX9gC39/f39/f39/f39/AX9gCn9/f39/f39/f38Bf2AMf39/f39/f39/f39/AX9gD39/f39/f39/f39/f39/fwF/YAJ/fwF8YAJ+fwF/YAJ/fgF/YAd/f39/fn5+AX9gCX9/f39+f39/fwF/YAl/f39/fH9/f38Bf2ABfwF+YAd/f39/f39/AGAJf39/f39/f39/AGAKf39/f35+fn5/fwF/YAN/f34AYAF+AX9gA39/fABgAn9+AGAEf39+fgBgBH9/f34BfmABfAF8YAJ8fAF8YAN/f38BfGACf38BfmADf39/AX5gAnx/AXxgBX9+fn5+AGAGf35+fn5/AGAFf39/f38Bf2ADf39/AX9gBH9/f38Bf2AJf39/f39/f39/AX8CvQUYDXdhc2lfdW5zdGFibGUOZmRfcHJlc3RhdF9nZXQAAQ13YXNpX3Vuc3RhYmxlE2ZkX3ByZXN0YXRfZGlyX25hbWUAAw13YXNpX3Vuc3RhYmxlEWVudmlyb25fc2l6ZXNfZ2V0AAENd2FzaV91bnN0YWJsZQtlbnZpcm9uX2dldAABDXdhc2lfdW5zdGFibGUOYXJnc19zaXplc19nZXQAAQ13YXNpX3Vuc3RhYmxlCGFyZ3NfZ2V0AAENd2FzaV91bnN0YWJsZQpmZF9yZWFkZGlyADUNd2FzaV91bnN0YWJsZQ5jbG9ja190aW1lX2dldAA2DXdhc2lfdW5zdGFibGUJcHJvY19leGl0AAoNd2FzaV91bnN0YWJsZQtwb2xsX29uZW9mZgAADXdhc2lfdW5zdGFibGUPZmRfZmlsZXN0YXRfZ2V0AAENd2FzaV91bnN0YWJsZQdmZF9zZWVrADcNd2FzaV91bnN0YWJsZQhmZF93cml0ZQAADXdhc2lfdW5zdGFibGUIZmRfY2xvc2UAAg13YXNpX3Vuc3RhYmxlDWZkX2Zkc3RhdF9nZXQAAQ13YXNpX3Vuc3RhYmxlB2ZkX3JlYWQAAA13YXNpX3Vuc3RhYmxlCXBhdGhfb3BlbgA4DXdhc2lfdW5zdGFibGURcGF0aF9maWxlc3RhdF9nZXQABg13YXNpX3Vuc3RhYmxlC3BhdGhfcmVuYW1lAAUNd2FzaV91bnN0YWJsZRBwYXRoX3VubGlua19maWxlAAMNd2FzaV91bnN0YWJsZQ1wYXRoX3JlYWRsaW5rAAUNd2FzaV91bnN0YWJsZQxwYXRoX3N5bWxpbmsABg13YXNpX3Vuc3RhYmxlCnJhbmRvbV9nZXQAAQ13YXNpX3Vuc3RhYmxlE2ZkX2Zkc3RhdF9zZXRfZmxhZ3MAAQP+IfwhDQ0SEhISEgEBAwEBARgYAAYBAQECCgEBARkBAwEBAwEBAQcDAQkDBwEBAQACAQMBAQEBAgEDCg0BBwgIAQEaAwELCgsDAQEBAQEMBQEBAQEFCgECAQYCBAAKAAABAQEBAQIBCgIDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBAQgLARsIAQUcAQEBAQUBAQEHDQIBAQIDEgEIEgIBAQINEgAAAQECAAMCAgIDDgIBBQUGBQYBAQMPCAABCgEDAQADAQECAgECAgEDAwoDAwEKBw8KAQIdAQICAg0DCgAKEgICAAABAwADAhIDAQMBAQMBAQEBAQESEhISEgoCDQECAQMSCw0SDQoBEh4NDQ0NAgMBEgoCAwABAQEOAwMJCQ4SAQADAgEWAQMDAgEBAwADHwEfAQIBAwEBAgEAFQADAQMDChIBAgEGCwEGAQEBAQADBgAAAwMLAQYCBgEGAQ0KEgoBAxYCAQEBAAECCQMBAwECARYBAwMSAgEBAwoFAgMBAwMBAQABAwMBAwACAgYPAgMBAwISCgkCBwoBAgILBgYCAwEAAwEAAwESCgAKBgASCgoFBgAKIAsDARIKCwYCBgABAgAMBAsEGQsGAwAGAwYGAQAHCQcJBwIDAQcDBgQGBgMBEgoDARIKAxIKEgoSChIKEgoSChIDARIKAwEBAQMDBwcAAAEDAwEDARIKAQIACAcBAQcFAAYBBRIKAQcHBQAGAQcHBQAGAQcFAAYSCgMBEgoJCQMBEgoSDQUBEg0NDRIKAxIIBwcOCQYDAwAGAwMLBiEiABIDAwEDAAICAwUCAgcCBwIKBwEHBwcCAwAAAwAAAQMDAAADAQIBAgoKIyMNAQoAAQABAQEBAQEBAQIDAwEDAAICARIBAwMBAwACAhISAQMDAQMAAgECAhICAgIKAQoKEhIBAgEBAgEDCgMAAQMDAQEBAQEBBwMACAEBAgECAgAJEgoHCQISEgoKCgIAAAkDAAAJCQcHAwMDAwYGAAYAAAAABgADAAAABgYGAwAAABIKAwEABiQPJAAABgUFBgUGAwUGBgACAgEBAQESAAYAAwEFCgoDBgYBAQMDAwMDAwgIAQEBAQECEgoBAQkOAwgIAwkJBwcOCQIKEgoBBgMDAAAAAAAAAgAAAgIBAwYGAgECAgICAwIAAQEDDAMBAQICAwYAAgYKAQYBDwEBAhIDAwMAAwEDAAICAwMAAAAABgMFBgQDAgoBAQkBCgEBAQEAAAAAAQMCBQEBAgMFAAESAwMBAwACAgMDEgoAAhIBAgIBAQIBAgMCAQECAgEBAQEDCwMCAgMBBgICAwICAgMPAQICAQMDAQAAAwUGBQYGBgADBgMFAAMSDQICAQEDAwICAQoHCgESAgICAgMBAAEHAQEDAwMBAQMAAQEKAgoDAwADEgoNAw0CBg0BCg0HCQMSAgMDAwEBAwEDARIKCgMCAgIBAQICEgIJCQgIDhASCAEDCAoHAwIKAgAGAwEAAQEBAAEBAAICAgMBAgEBAAoCAgADAQMBAAECAQEDAAIDAxICAwsCAhICCgICAggAAgMSEhIBAQEAAAEBAAICAgMBAgEBAAYKAAMBAxIKCQMBAwECBQUACxoZAhICCgICAgIIAAkDAgQSAwUAAAICAwEDABISAgABAAEDARIBAQEDAQAAAQEAAgICAwECAQEACgADAQICAgMCAQECAgMBAwEBAwMBAwESCgkDAgECAQICARISEhISAAAAAAACAwMDAwYACAYABgYAAAIKCgEGBgIBAgoKAQEGBgYAAwEDAAMABgAGEgsABgYGAAASAgoBAgICAgICAgICAQICAgcCBwcBAgcHAAADAwMBAhICBgIKCgoKCgECAQICAgACAwICAwIHAgcCBwIDAgIGBgIBAwABBQYDBgEGAAMDAAsFAQIAAwIKBgsBBgUGBgUGBgYAAAQABQYFAAYFAAUDEgIKCgEGBgAAAAADEgEGBgADAAYFBgIKCgEGBgIBAgoKAQEFBQYGBgADAQMAAwAAAwYGBgYKBwcJBwkJBwAHBwcJBwMHCQkHCQoJAgAJAQEJCQgJCQEJCgkHBwkJAQkHCQcKAQMHCAkDBwMBBAsLBQEBBQEBAAABAQACAgIBCgADAwMDAgAFBQMCBQMBAwADAAYGBgYGBQABAQMSAgECAg0SCgECCgoNCgMBAQEBAQEBAQECAhISAgINAgIBAAAFAgEKCgEJBwINAgIBCgMDCAINAgIBAgECDQISAgECDQICAQIBAg0CEgIBAg0CEgIBAg0CAgECCgINAhICAQINAhICAQ0SDQIBAg0PEg0KDRIFABISCQICDQcHEhISCgcKChIDAwEAAgIDEgMDAAICAxIDAwMAAgIDAhIKAQMDAwMDAQUSEhISEhISEhISEhISEhISEhISEhISEhISEhISEh
|
||
|
if(isNode){
|
||
|
wasmBinary = Buffer.from(wasmb64, 'base64');
|
||
|
}else{
|
||
|
let raw = window.atob(wasmb64);
|
||
|
let rawLength = raw.length;
|
||
|
let array = new Uint8Array(new ArrayBuffer(rawLength));
|
||
|
for(let i = 0; i < rawLength; i++) {
|
||
|
array[i] = raw.charCodeAt(i);
|
||
|
}
|
||
|
wasmBinary = array;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/** Class representing an OpenSSL session */
|
||
|
class OpenSSL {
|
||
|
/**
|
||
|
* Create an OpenSSL instance
|
||
|
* @param {Object} args
|
||
|
* @param {Object} fs - The file system object to use
|
||
|
* @param {string} rootDir - The file system root path to use
|
||
|
*/
|
||
|
constructor(args) {
|
||
|
if (!args) throw Error("Arguments Not Defined");
|
||
|
|
||
|
if (!args.fs) throw Error("FileSystem Not Defined.");
|
||
|
|
||
|
if (!args.rootDir) args.rootDir = "/";
|
||
|
|
||
|
Object.assign(this, { ...args }, { wasmBinaryPath: wasmPath });
|
||
|
|
||
|
const { readFileSync, mkdirSync, existsSync } = this.fs;
|
||
|
|
||
|
this.runCommand = async command => {
|
||
|
if (!existsSync(this.rootDir)) mkdirSync(this.rootDir);
|
||
|
|
||
|
if (isNode) {
|
||
|
const { fileURLToPath } = await import('url');
|
||
|
const { dirname, resolve } = await import('path');
|
||
|
const _filename = fileURLToPath(import.meta.url);
|
||
|
const _dirname = dirname(_filename);
|
||
|
|
||
|
return run({ command, wasmBinary, ...this });
|
||
|
} else {
|
||
|
let response;
|
||
|
let responseArrayBuffer;
|
||
|
if (args.wasmBinaryPath) {
|
||
|
response = await fetch(args.wasmBinaryPath);
|
||
|
}
|
||
|
if (response && response.arrayBuffer) {
|
||
|
responseArrayBuffer = await response.arrayBuffer();
|
||
|
}
|
||
|
|
||
|
if (wasmBinary.length) {
|
||
|
return run({ command, wasmBinary, ...this });
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export { OpenSSL };
|