@kobakazu0429/wasmer-wasi
Version:
Isomorphic Javascript library for interacting with WASI Modules in Node.js and the Browser. 📚
139 lines (137 loc) • 73.3 kB
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.
**************************************************************************** safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
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 da(a,b,c,d){return new (c||(c=Promise))(function(e,f){function g(a){try{k(d.next(a))}catch(r){f(r)}}function h(a){try{k(d["throw"](a))}catch(r){f(r)}}function k(a){a.done?e(a.value):(new c(function(b){b(a.value)})).then(g,h)}k((d=d.apply(a,b||[])).next())})}
function ea(a,b){function c(a){return function(b){return d([a,b])}}function d(c){if(f)throw new TypeError("Generator is already executing.");for(;e;)try{if(f=1,g&&(h=c[0]&2?g["return"]:c[0]?g["throw"]||((h=g["return"])&&h.call(g),0):g.next)&&!(h=h.call(g,c[1])).done)return h;if(g=0,h)c=[c[0]&2,h.value];switch(c[0]){case 0:case 1:h=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++;g=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(h=e.trys,h=0<h.length&&
h[h.length-1])&&(6===c[0]||2===c[0])){e=0;continue}if(3===c[0]&&(!h||c[1]>h[0]&&c[1]<h[3]))e.label=c[1];else if(6===c[0]&&e.label<h[1])e.label=h[1],h=c;else if(h&&e.label<h[2])e.label=h[2],e.ops.push(c);else{h[2]&&e.ops.pop();e.trys.pop();continue}}c=b.call(a,e)}catch(r){c=[6,r],g=0}finally{f=h=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}var e={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,g,h,k;return k={next:c(0),"throw":c(1),"return":c(2)},"function"===
typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k}function fa(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 ha(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 ia(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(ha(arguments[b]));return a}
function ja(a){function b(b){e[b]=a[b]&&function(d){return new Promise(function(e,g){d=a[b](d);c(e,g,d.done,d.value)})}}function c(a,b,c,d){Promise.resolve(d).then(function(b){a({value:b,done:c})},b)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var d=a[Symbol.asyncIterator],e;return d?d.call(a):(a="function"===typeof fa?fa(a):a[Symbol.iterator](),e={},b("next"),b("throw"),b("return"),e[Symbol.asyncIterator]=function(){return this},e)}
var ka="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof global?global:{},m="undefined"!==typeof BigInt?BigInt:ka.BigInt||Number,la=DataView;
la.prototype.setBigUint64||(la.prototype.setBigUint64=function(a,b,c){if(b<Math.pow(2,32)){b=Number(b);var d=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),b,c);this.setUint32(a+(c?4:0),d,c)},la.prototype.getBigUint64=function(a,b){var c=this.getUint32(a+(b?0:4),b);a=this.getUint32(a+(b?4:0),b);c=c.toString(2);a=a.toString(2);b="";for(var d=0;d<32-c.length;d++)b+="0";return m("0b"+a+(b+c))});
var n="undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},p=[],v=[],ma="undefined"!==typeof Uint8Array?Uint8Array:Array,na=!1;function pa(){na=!0;for(var a=0;64>a;++a)p[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],v["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;v[45]=62;v[95]=63}
function qa(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 ra(a){na||pa();for(var b=a.length,c=b%3,d="",e=[],f=0,g=b-c;f<g;f+=16383)e.push(qa(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 ta(a,b,c,d,e){var f=8*e-d-1;var g=(1<<f)-1,h=g>>1,k=-7;e=c?e-1:0;var l=c?-1:1,r=a[b+e];e+=l;c=r&(1<<-k)-1;r>>=-k;for(k+=f;0<k;c=256*c+a[b+e],e+=l,k-=8);f=c&(1<<-k)-1;c>>=-k;for(k+=d;0<k;f=256*f+a[b+e],e+=l,k-=8);if(0===c)c=1-h;else{if(c===g)return f?NaN:Infinity*(r?-1:1);f+=Math.pow(2,d);c-=h}return(r?-1:1)*f*Math.pow(2,c-d)}
function xa(a,b,c,d,e,f){var g,h=8*f-e-1,k=(1<<h)-1,l=k>>1,r=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=k):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+l?b+r/g:b+r*Math.pow(2,1-l),2<=b*g&&(d++,g/=2),d+l>=k?(b=0,d=k):1<=d+l?(b=(b*g-1)*Math.pow(2,e),d+=l):(b=b*Math.pow(2,l-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 ya={}.toString,za=Array.isArray||function(a){return"[object Array]"==ya.call(a)};w.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:!0;function y(a,b){if((w.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<b)throw new RangeError("Invalid typed array length");w.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(b),a.__proto__=w.prototype):(null===a&&(a=new w(b)),a.length=b);return a}
function w(a,b,c){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(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 Aa(this,a)}return Ba(this,a,b,c)}w.poolSize=8192;w._augment=function(a){a.__proto__=w.prototype;return a};
function Ba(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);w.TYPED_ARRAY_SUPPORT?(a=b,a.__proto__=w.prototype):a=Ca(a,b);return a}if("string"===
typeof b){d=a;a=c;if("string"!==typeof a||""===a)a="utf8";if(!w.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');c=Da(b,a)|0;d=y(d,c);b=d.write(b,a);b!==c&&(d=d.slice(0,b));return d}return Ea(a,b)}w.from=function(a,b,c){return Ba(null,a,b,c)};w.TYPED_ARRAY_SUPPORT&&(w.prototype.__proto__=Uint8Array.prototype,w.__proto__=Uint8Array);
function Fa(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');}w.alloc=function(a,b,c){Fa(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 Aa(a,b){Fa(b);a=y(a,0>b?0:Ga(b)|0);if(!w.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;++c)a[c]=0;return a}w.allocUnsafe=function(a){return Aa(null,a)};w.allocUnsafeSlow=function(a){return Aa(null,a)};
function Ca(a,b){var c=0>b.length?0:Ga(b.length)|0;a=y(a,c);for(var d=0;d<c;d+=1)a[d]=b[d]&255;return a}
function Ea(a,b){if(A(b)){var c=Ga(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):Ca(a,b);if("Buffer"===b.type&&za(b.data))return Ca(a,b.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
function Ga(a){if(a>=(w.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(w.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return a|0}w.isBuffer=Ha;function A(a){return!(null==a||!a._isBuffer)}
w.compare=function(a,b){if(!A(a)||!A(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};w.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}};
w.concat=function(a,b){if(!za(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return w.alloc(0);var c;if(void 0===b)for(c=b=0;c<a.length;++c)b+=a[c].length;b=w.allocUnsafe(b);var d=0;for(c=0;c<a.length;++c){var e=a[c];if(!A(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(b,d);d+=e.length}return b};
function Da(a,b){if(A(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 Ia(a).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return Ja(a).length;
default:if(d)return Ia(a).length;b=(""+b).toLowerCase();d=!0}}w.byteLength=Da;
function Ka(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 La(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?ra(this):ra(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}}w.prototype._isBuffer=!0;function B(a,b,c){var d=a[b];a[b]=a[c];a[c]=d}
w.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)B(this,b,b+1);return this};w.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)B(this,b,b+3),B(this,b+1,b+2);return this};
w.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)B(this,b,b+7),B(this,b+1,b+6),B(this,b+2,b+5),B(this,b+3,b+4);return this};w.prototype.toString=function(){var a=this.length|0;return 0===a?"":0===arguments.length?La(this,0,a):Ka.apply(this,arguments)};w.prototype.equals=function(a){if(!A(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===w.compare(this,a)};
w.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+">"};
w.prototype.compare=function(a,b,c,d,e){if(!A(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 Ma(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=w.from(b,d));if(A(b))return 0===b.length?-1:Na(a,b,c,d,e);if("number"===typeof b)return b&=255,w.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):
Uint8Array.prototype.lastIndexOf.call(a,b,c):Na(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer");}
function Na(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,k=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;k/=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===k)return d*g}else-1!==d&&(c-=c-d),d=-1;else for(c+k>h&&(c=h-k);0<=c;c--){h=!0;for(d=0;d<k;d++)if(f(a,c+d)!==f(b,d)){h=!1;break}if(h)return c}return-1}
w.prototype.includes=function(a,b,c){return-1!==this.indexOf(a,b,c)};w.prototype.indexOf=function(a,b,c){return Ma(this,a,b,c,!0)};w.prototype.lastIndexOf=function(a,b,c){return Ma(this,a,b,c,!1)};
w.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 Oa(Ia(a,this.length-b),this,b,c);case "ascii":return Oa(Pa(a),this,b,c);case "latin1":case "binary":return Oa(Pa(a),this,b,c);case "base64":return Oa(Ja(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 Oa(f,this,b,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0}};w.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
function La(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 k=a[b+2];128===(h&192)&&128===(k&192)&&(e=(e&15)<<12|(h&63)<<6|k&63,2047<e&&(55296>e||57343<e)&&(f=e));break;case 4:h=a[b+1];k=a[b+2];var l=a[b+3];128===(h&192)&&128===(k&192)&&128===(l&192)&&(e=(e&15)<<18|(h&63)<<12|(k&63)<<6|l&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<=Qa)d=String.fromCharCode.apply(String,d);else{c="";for(b=0;b<a;)c+=String.fromCharCode.apply(String,d.slice(b,b+=Qa));d=c}return d}var Qa=4096;
w.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(w.TYPED_ARRAY_SUPPORT)b=this.subarray(a,b),b.__proto__=w.prototype;else{c=b-a;b=new w(c,void 0);for(var d=0;d<c;++d)b[d]=this[d+a]}return b};function D(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");}
w.prototype.readUIntLE=function(a,b,c){a|=0;b|=0;c||D(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;return c};w.prototype.readUIntBE=function(a,b,c){a|=0;b|=0;c||D(a,b,this.length);c=this[a+--b];for(var d=1;0<b&&(d*=256);)c+=this[a+--b]*d;return c};w.prototype.readUInt8=function(a,b){b||D(a,1,this.length);return this[a]};w.prototype.readUInt16LE=function(a,b){b||D(a,2,this.length);return this[a]|this[a+1]<<8};
w.prototype.readUInt16BE=function(a,b){b||D(a,2,this.length);return this[a]<<8|this[a+1]};w.prototype.readUInt32LE=function(a,b){b||D(a,4,this.length);return(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};w.prototype.readUInt32BE=function(a,b){b||D(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};w.prototype.readIntLE=function(a,b,c){a|=0;b|=0;c||D(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};
w.prototype.readIntBE=function(a,b,c){a|=0;b|=0;c||D(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};w.prototype.readInt8=function(a,b){b||D(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};w.prototype.readInt16LE=function(a,b){b||D(a,2,this.length);a=this[a]|this[a+1]<<8;return a&32768?a|4294901760:a};
w.prototype.readInt16BE=function(a,b){b||D(a,2,this.length);a=this[a+1]|this[a]<<8;return a&32768?a|4294901760:a};w.prototype.readInt32LE=function(a,b){b||D(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};w.prototype.readInt32BE=function(a,b){b||D(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};w.prototype.readFloatLE=function(a,b){b||D(a,4,this.length);return ta(this,a,!0,23,4)};
w.prototype.readFloatBE=function(a,b){b||D(a,4,this.length);return ta(this,a,!1,23,4)};w.prototype.readDoubleLE=function(a,b){b||D(a,8,this.length);return ta(this,a,!0,52,8)};w.prototype.readDoubleBE=function(a,b){b||D(a,8,this.length);return ta(this,a,!1,52,8)};function E(a,b,c,d,e,f){if(!A(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");}
w.prototype.writeUIntLE=function(a,b,c,d){a=+a;b|=0;c|=0;d||E(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};w.prototype.writeUIntBE=function(a,b,c,d){a=+a;b|=0;c|=0;d||E(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};w.prototype.writeUInt8=function(a,b,c){a=+a;b|=0;c||E(this,a,b,1,255,0);w.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a&255;return b+1};
function Ra(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)}w.prototype.writeUInt16LE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,2,65535,0);w.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Ra(this,a,b,!0);return b+2};w.prototype.writeUInt16BE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,2,65535,0);w.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Ra(this,a,b,!1);return b+2};
function Sa(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}w.prototype.writeUInt32LE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,4,4294967295,0);w.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a&255):Sa(this,a,b,!0);return b+4};
w.prototype.writeUInt32BE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,4,4294967295,0);w.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Sa(this,a,b,!1);return b+4};w.prototype.writeIntLE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),E(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};
w.prototype.writeIntBE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),E(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};w.prototype.writeInt8=function(a,b,c){a=+a;b|=0;c||E(this,a,b,1,127,-128);w.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a&255;return b+1};
w.prototype.writeInt16LE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,2,32767,-32768);w.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Ra(this,a,b,!0);return b+2};w.prototype.writeInt16BE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,2,32767,-32768);w.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Ra(this,a,b,!1);return b+2};
w.prototype.writeInt32LE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,4,2147483647,-2147483648);w.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):Sa(this,a,b,!0);return b+4};w.prototype.writeInt32BE=function(a,b,c){a=+a;b|=0;c||E(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);w.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Sa(this,a,b,!1);return b+4};
function Ta(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");}w.prototype.writeFloatLE=function(a,b,c){c||Ta(this,a,b,4);xa(this,a,b,!0,23,4);return b+4};w.prototype.writeFloatBE=function(a,b,c){c||Ta(this,a,b,4);xa(this,a,b,!1,23,4);return b+4};w.prototype.writeDoubleLE=function(a,b,c){c||Ta(this,a,b,8);xa(this,a,b,!0,52,8);return b+8};w.prototype.writeDoubleBE=function(a,b,c){c||Ta(this,a,b,8);xa(this,a,b,!1,52,8);return b+8};
w.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||
!w.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};
w.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&&!w.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=A(a)?a:Ia((new w(a,d)).toString()),e=a.length,d=0;d<c-b;++d)this[d+b]=a[d%e];return this};var Ua=/[^+\/0-9A-Za-z-_]/g;
function Ia(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 Pa(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c)&255);return b}
function Ja(a){a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(Ua,"");if(2>a.length)a="";else for(;0!==a.length%4;)a+="=";na||pa();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 ma(3*b/4-c);var e=0<c?b-4:b;var f=0;for(b=0;b<e;b+=4){var g=v[a.charCodeAt(b)]<<18|v[a.charCodeAt(b+1)]<<12|v[a.charCodeAt(b+2)]<<6|v[a.charCodeAt(b+3)];d[f++]=g>>16&255;d[f++]=g>>8&255;d[f++]=g&255}2===c?(g=v[a.charCodeAt(b)]<<2|
v[a.charCodeAt(b+1)]>>4,d[f++]=g&255):1===c&&(g=v[a.charCodeAt(b)]<<10|v[a.charCodeAt(b+1)]<<4|v[a.charCodeAt(b+2)]>>2,d[f++]=g>>8&255,d[f++]=g&255);return d}function Oa(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 Ha(a){return null!=a&&(!!a._isBuffer||Va(a)||"function"===typeof a.readFloatLE&&"function"===typeof a.slice&&Va(a.slice(0,0)))}function Va(a){return!!a.constructor&&"function"===typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}
var F=w,Wa="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};function Xa(a,b){return b={exports:{}},a(b,b.exports),b.exports}function Ya(){throw Error("setTimeout has not been defined");}function Za(){throw Error("clearTimeout has not been defined");}var G=Ya,H=Za;"function"===typeof n.setTimeout&&(G=setTimeout);"function"===typeof n.clearTimeout&&(H=clearTimeout);
function $a(a){if(G===setTimeout)return setTimeout(a,0);if((G===Ya||!G)&&setTimeout)return G=setTimeout,setTimeout(a,0);try{return G(a,0)}catch(b){try{return G.call(null,a,0)}catch(c){return G.call(this,a,0)}}}function ab(a){if(H===clearTimeout)return clearTimeout(a);if((H===Za||!H)&&clearTimeout)return H=clearTimeout,clearTimeout(a);try{return H(a)}catch(b){try{return H.call(null,a)}catch(c){return H.call(this,a)}}}var I=[],bb=!1,J,cb=-1;
function db(){bb&&J&&(bb=!1,J.length?I=J.concat(I):cb=-1,I.length&&eb())}function eb(){if(!bb){var a=$a(db);bb=!0;for(var b=I.length;b;){J=I;for(I=[];++cb<b;)J&&J[cb].run();cb=-1;b=I.length}J=null;bb=!1;ab(a)}}function fb(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];I.push(new gb(a,b));1!==I.length||bb||$a(eb)}function gb(a,b){this.fun=a;this.array=b}gb.prototype.run=function(){this.fun.apply(null,this.array)};function hb(){}
var ib=n.performance||{},jb=ib.now||ib.mozNow||ib.msNow||ib.oNow||ib.webkitNow||function(){return(new Date).getTime()},kb=new Date,lb={nextTick:fb,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:hb,addListener:hb,once:hb,off:hb,removeListener:hb,removeAllListeners:hb,emit:hb,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*jb.call(ib),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-kb)/1E3}},K=[],L=[],mb="undefined"!==typeof Uint8Array?Uint8Array:Array,nb=!1;function ob(){nb=!0;for(var a=0;64>a;++a)K[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a],L["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(a)]=a;L[45]=62;L[95]=63}
function pb(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(K[b>>18&63]+K[b>>12&63]+K[b>>6&63]+K[b&63]);return d.join("")}function qb(a){nb||ob();for(var b=a.length,c=b%3,d="",e=[],f=0,g=b-c;f<g;f+=16383)e.push(pb(a,f,f+16383>g?g:f+16383));1===c?(a=a[b-1],d+=K[a>>2],d+=K[a<<4&63],d+="=="):2===c&&(a=(a[b-2]<<8)+a[b-1],d+=K[a>>10],d+=K[a>>4&63],d+=K[a<<2&63],d+="=");e.push(d);return e.join("")}
function rb(a,b,c,d,e){var f=8*e-d-1;var g=(1<<f)-1,h=g>>1,k=-7;e=c?e-1:0;var l=c?-1:1,r=a[b+e];e+=l;c=r&(1<<-k)-1;r>>=-k;for(k+=f;0<k;c=256*c+a[b+e],e+=l,k-=8);f=c&(1<<-k)-1;c>>=-k;for(k+=d;0<k;f=256*f+a[b+e],e+=l,k-=8);if(0===c)c=1-h;else{if(c===g)return f?NaN:Infinity*(r?-1:1);f+=Math.pow(2,d);c-=h}return(r?-1:1)*f*Math.pow(2,c-d)}
function sb(a,b,c,d,e,f){var g,h=8*f-e-1,k=(1<<h)-1,l=k>>1,r=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=k):(d=Math.floor(Math.log(b)/Math.LN2),1>b*(g=Math.pow(2,-d))&&(d--,g*=2),b=1<=d+l?b+r/g:b+r*Math.pow(2,1-l),2<=b*g&&(d++,g/=2),d+l>=k?(b=0,d=k):1<=d+l?(b=(b*g-1)*Math.pow(2,e),d+=l):(b=b*Math.pow(2,l-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 tb={}.toString,vb=Array.isArray||function(a){return"[object Array]"==tb.call(a)};M.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:!0;var wb=M.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function N(a,b){if((M.TYPED_ARRAY_SUPPORT?2147483647:1073741823)<b)throw new RangeError("Invalid typed array length");M.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(b),a.__proto__=M.prototype):(null===a&&(a=new M(b)),a.length=b);return a}
function M(a,b,c){if(!(M.TYPED_ARRAY_SUPPORT||this instanceof M))return new M(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 xb(this,a)}return yb(this,a,b,c)}M.poolSize=8192;M._augment=function(a){a.__proto__=M.prototype;return a};
function yb(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);M.TYPED_ARRAY_SUPPORT?(a=b,a.__proto__=M.prototype):a=zb(a,b);return a}if("string"===
typeof b){d=a;a=c;if("string"!==typeof a||""===a)a="utf8";if(!M.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');c=Ab(b,a)|0;d=N(d,c);b=d.write(b,a);b!==c&&(d=d.slice(0,b));return d}return Bb(a,b)}M.from=function(a,b,c){return yb(null,a,b,c)};M.TYPED_ARRAY_SUPPORT&&(M.prototype.__proto__=Uint8Array.prototype,M.__proto__=Uint8Array);
function Cb(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');}M.alloc=function(a,b,c){Cb(a);a=0>=a?N(null,a):void 0!==b?"string"===typeof c?N(null,a).fill(b,c):N(null,a).fill(b):N(null,a);return a};function xb(a,b){Cb(b);a=N(a,0>b?0:Db(b)|0);if(!M.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;++c)a[c]=0;return a}M.allocUnsafe=function(a){return xb(null,a)};M.allocUnsafeSlow=function(a){return xb(null,a)};
function zb(a,b){var c=0>b.length?0:Db(b.length)|0;a=N(a,c);for(var d=0;d<c;d+=1)a[d]=b[d]&255;return a}
function Bb(a,b){if(O(b)){var c=Db(b.length)|0;a=N(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?N(a,0):zb(a,b);if("Buffer"===b.type&&vb(b.data))return zb(a,b.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");}
function Db(a){if(a>=(M.TYPED_ARRAY_SUPPORT?2147483647:1073741823))throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+(M.TYPED_ARRAY_SUPPORT?2147483647:1073741823).toString(16)+" bytes");return a|0}M.isBuffer=Eb;function O(a){return!(null==a||!a._isBuffer)}
M.compare=function(a,b){if(!O(a)||!O(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};M.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}};
M.concat=function(a,b){if(!vb(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return M.alloc(0);var c;if(void 0===b)for(c=b=0;c<a.length;++c)b+=a[c].length;b=M.allocUnsafe(b);var d=0;for(c=0;c<a.length;++c){var e=a[c];if(!O(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(b,d);d+=e.length}return b};
function Ab(a,b){if(O(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 Fb(a).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*c;case "hex":return c>>>1;case "base64":return Gb(a).length;
default:if(d)return Fb(a).length;b=(""+b).toLowerCase();d=!0}}M.byteLength=Ab;
function Hb(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 Ib(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?qb(this):qb(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}}M.prototype._isBuffer=!0;function Jb(a,b,c){var d=a[b];a[b]=a[c];a[c]=d}
M.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)Jb(this,b,b+1);return this};M.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)Jb(this,b,b+3),Jb(this,b+1,b+2);return this};
M.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)Jb(this,b,b+7),Jb(this,b+1,b+6),Jb(this,b+2,b+5),Jb(this,b+3,b+4);return this};M.prototype.toString=function(){var a=this.length|0;return 0===a?"":0===arguments.length?Ib(this,0,a):Hb.apply(this,arguments)};M.prototype.equals=function(a){if(!O(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===M.compare(this,a)};
M.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+">"};
M.prototype.compare=function(a,b,c,d,e){if(!O(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 Kb(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=M.from(b,d));if(O(b))return 0===b.length?-1:Lb(a,b,c,d,e);if("number"===typeof b)return b&=255,M.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):
Uint8Array.prototype.lastIndexOf.call(a,b,c):Lb(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer");}
function Lb(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,k=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;k/=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===k)return d*g}else-1!==d&&(c-=c-d),d=-1;else for(c+k>h&&(c=h-k);0<=c;c--){h=!0;for(d=0;d<k;d++)if(f(a,c+d)!==f(b,d)){h=!1;break}if(h)return c}return-1}
M.prototype.includes=function(a,b,c){return-1!==this.indexOf(a,b,c)};M.prototype.indexOf=function(a,b,c){return Kb(this,a,b,c,!0)};M.prototype.lastIndexOf=function(a,b,c){return Kb(this,a,b,c,!1)};
M.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 Mb(Fb(a,this.length-b),this,b,c);case "ascii":return Mb(Nb(a),this,b,c);case "latin1":case "binary":return Mb(Nb(a),this,b,c);case "base64":return Mb(Gb(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 Mb(f,this,b,c);default:if(e)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase();e=!0}};M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};
function Ib(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 k=a[b+2];128===(h&192)&&128===(k&192)&&(e=(e&15)<<12|(h&63)<<6|k&63,2047<e&&(55296>e||57343<e)&&(f=e));break;case 4:h=a[b+1];k=a[b+2];var l=a[b+3];128===(h&192)&&128===(k&192)&&128===(l&192)&&(e=(e&15)<<18|(h&63)<<12|(k&63)<<6|l&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<=Ob)d=String.fromCharCode.apply(String,d);else{c="";for(b=0;b<a;)c+=String.fromCharCode.apply(String,d.slice(b,b+=Ob));d=c}return d}var Ob=4096;
M.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(M.TYPED_ARRAY_SUPPORT)b=this.subarray(a,b),b.__proto__=M.prototype;else{c=b-a;b=new M(c,void 0);for(var d=0;d<c;++d)b[d]=this[d+a]}return b};function P(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");}
M.prototype.readUIntLE=function(a,b,c){a|=0;b|=0;c||P(a,b,this.length);c=this[a];for(var d=1,e=0;++e<b&&(d*=256);)c+=this[a+e]*d;return c};M.prototype.readUIntBE=function(a,b,c){a|=0;b|=0;c||P(a,b,this.length);c=this[a+--b];for(var d=1;0<b&&(d*=256);)c+=this[a+--b]*d;return c};M.prototype.readUInt8=function(a,b){b||P(a,1,this.length);return this[a]};M.prototype.readUInt16LE=function(a,b){b||P(a,2,this.length);return this[a]|this[a+1]<<8};
M.prototype.readUInt16BE=function(a,b){b||P(a,2,this.length);return this[a]<<8|this[a+1]};M.prototype.readUInt32LE=function(a,b){b||P(a,4,this.length);return(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};M.prototype.readUInt32BE=function(a,b){b||P(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};M.prototype.readIntLE=function(a,b,c){a|=0;b|=0;c||P(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};
M.prototype.readIntBE=function(a,b,c){a|=0;b|=0;c||P(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};M.prototype.readInt8=function(a,b){b||P(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};M.prototype.readInt16LE=function(a,b){b||P(a,2,this.length);a=this[a]|this[a+1]<<8;return a&32768?a|4294901760:a};
M.prototype.readInt16BE=function(a,b){b||P(a,2,this.length);a=this[a+1]|this[a]<<8;return a&32768?a|4294901760:a};M.prototype.readInt32LE=function(a,b){b||P(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};M.prototype.readInt32BE=function(a,b){b||P(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};M.prototype.readFloatLE=function(a,b){b||P(a,4,this.length);return rb(this,a,!0,23,4)};
M.prototype.readFloatBE=function(a,b){b||P(a,4,this.length);return rb(this,a,!1,23,4)};M.prototype.readDoubleLE=function(a,b){b||P(a,8,this.length);return rb(this,a,!0,52,8)};M.prototype.readDoubleBE=function(a,b){b||P(a,8,this.length);return rb(this,a,!1,52,8)};function Q(a,b,c,d,e,f){if(!O(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");}
M.prototype.writeUIntLE=function(a,b,c,d){a=+a;b|=0;c|=0;d||Q(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};M.prototype.writeUIntBE=function(a,b,c,d){a=+a;b|=0;c|=0;d||Q(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};M.prototype.writeUInt8=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,1,255,0);M.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a&255;return b+1};
function Pb(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)}M.prototype.writeUInt16LE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,2,65535,0);M.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Pb(this,a,b,!0);return b+2};M.prototype.writeUInt16BE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,2,65535,0);M.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Pb(this,a,b,!1);return b+2};
function Qb(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}M.prototype.writeUInt32LE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,4,4294967295,0);M.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a&255):Qb(this,a,b,!0);return b+4};
M.prototype.writeUInt32BE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,4,4294967295,0);M.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Qb(this,a,b,!1);return b+4};M.prototype.writeIntLE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),Q(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};
M.prototype.writeIntBE=function(a,b,c,d){a=+a;b|=0;d||(d=Math.pow(2,8*c-1),Q(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};M.prototype.writeInt8=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,1,127,-128);M.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a&255;return b+1};
M.prototype.writeInt16LE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,2,32767,-32768);M.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8):Pb(this,a,b,!0);return b+2};M.prototype.writeInt16BE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,2,32767,-32768);M.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a&255):Pb(this,a,b,!1);return b+2};
M.prototype.writeInt32LE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,4,2147483647,-2147483648);M.TYPED_ARRAY_SUPPORT?(this[b]=a&255,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):Qb(this,a,b,!0);return b+4};M.prototype.writeInt32BE=function(a,b,c){a=+a;b|=0;c||Q(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);M.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a&255):Qb(this,a,b,!1);return b+4};
function Rb(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");}M.prototype.writeFloatLE=function(a,b,c){c||Rb(this,a,b,4);sb(this,a,b,!0,23,4);return b+4};M.prototype.writeFloatBE=function(a,b,c){c||Rb(this,a,b,4);sb(this,a,b,!1,23,4);return b+4};M.prototype.writeDoubleLE=function(a,b,c){c||Rb(this,a,b,8);sb(this,a,b,!0,52,8);return b+8};M.prototype.writeDoubleBE=function(a,b,c){c||Rb(this,a,b,8);sb(this,a,b,!1,52,8);return b+8};
M.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||
!M.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};
M.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&&!M.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=O(a)?a:Fb((new M(a,d)).toString()),e=a.length,d=0;d<c-b;++d)this[d+b]=a[d%e];return this};var Sb=/[^+\/0-9A-Za-z-_]/g;
function Fb(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 Nb(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c)&255);return b}
function Gb(a){a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(Sb,"");if(2>a.length)a="";else for(;0!==a.length%4;)a+="=";nb||ob();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 mb(3*b/4-c);var e=0<c?b-4:b;var f=0;for(b=0;b<e;b+=4){var g=L[a.charCodeAt(b)]<<18|L[a.charCodeAt(b+1)]<<12|L[a.charCodeAt(b+2)]<<6|L[a.charCodeAt(b+3)];d[f++]=g>>16&255;d[f++]=g>>8&255;d[f++]=g&255}2===c?(g=L[a.charCodeAt(b)]<<2|
L[a.charCodeAt(b+1)]>>4,d[f++]=g&255):1===c&&(g=L[a.charCodeAt(b)]<<10|L[a.charCodeAt(b+1)]<<4|L[a.charCodeAt(b+2)]>>2,d[f++]=g>>8&255,d[f++]=g&255);return d}function Mb(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 Eb(a){return null!=a&&(!!a._isBuffer||Tb(a)||"function"===typeof a.readFloatLE&&"function"===typeof a.slice&&Tb(a.slice(0,0)))}function Tb(a){return!!a.constructor&&"function"===typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}
var Ub=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:wb,Buffer:M,SlowBuffer:function(a){+a!=a&&(a=0);return M.alloc(+a)},isBuffer:Eb}),Vb=Xa(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=Ub.Buffer;e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?a.exports=Ub:(c(Ub,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 Ub.SlowBuffer(a)}}),Wb=Xa(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>l||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("s