-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 39.4 KB
/
mod.js
1
2
3
4
// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var t="function"==typeof Object.defineProperty?Object.defineProperty:null;var r=Object.defineProperty;function e(t){return"number"==typeof t}function n(t){var r,e="";for(r=0;r<t;r++)e+="0";return e}function i(t,r,e){var i=!1,o=r-t.length;return o<0||(function(t){return"-"===t[0]}(t)&&(i=!0,t=t.substr(1)),t=e?t+n(o):n(o)+t,i&&(t="-"+t)),t}var o=String.prototype.toLowerCase,u=String.prototype.toUpperCase;function a(t){var r,n,a;switch(t.specifier){case"b":r=2;break;case"o":r=8;break;case"x":case"X":r=16;break;default:r=10}if(n=t.arg,a=parseInt(n,10),!isFinite(a)){if(!e(n))throw new Error("invalid integer. Value: "+n);a=0}return a<0&&("u"===t.specifier||10!==r)&&(a=4294967295+a+1),a<0?(n=(-a).toString(r),t.precision&&(n=i(n,t.precision,t.padRight)),n="-"+n):(n=a.toString(r),a||t.precision?t.precision&&(n=i(n,t.precision,t.padRight)):n="",t.sign&&(n=t.sign+n)),16===r&&(t.alternate&&(n="0x"+n),n=t.specifier===u.call(t.specifier)?u.call(n):o.call(n)),8===r&&t.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var f=Math.abs,s=String.prototype.toLowerCase,c=String.prototype.toUpperCase,l=String.prototype.replace,h=/e\+(\d)$/,p=/e-(\d)$/,g=/^(\d+)$/,y=/^(\d+)e/,w=/\.0$/,d=/\.0*e/,v=/(\..*[^0])0*e/;function b(t){var r,n,i=parseFloat(t.arg);if(!isFinite(i)){if(!e(t.arg))throw new Error("invalid floating-point number. Value: "+n);i=t.arg}switch(t.specifier){case"e":case"E":n=i.toExponential(t.precision);break;case"f":case"F":n=i.toFixed(t.precision);break;case"g":case"G":f(i)<1e-4?((r=t.precision)>0&&(r-=1),n=i.toExponential(r)):n=i.toPrecision(t.precision),t.alternate||(n=l.call(n,v,"$1e"),n=l.call(n,d,"e"),n=l.call(n,w,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=l.call(n,h,"e+0$1"),n=l.call(n,p,"e-0$1"),t.alternate&&(n=l.call(n,g,"$1."),n=l.call(n,y,"$1.e")),i>=0&&t.sign&&(n=t.sign+n),n=t.specifier===c.call(t.specifier)?c.call(n):s.call(n)}function m(t){var r,e="";for(r=0;r<t;r++)e+=" ";return e}var E=String.fromCharCode,A=Array.isArray;function _(t){return t!=t}function T(t){var r={};return r.specifier=t.specifier,r.precision=void 0===t.precision?1:t.precision,r.width=t.width,r.flags=t.flags||"",r.mapping=t.mapping,r}function R(t){var r,e,n,o,u,f,s,c,l,h,p,g,y;if(!A(t))throw new TypeError("invalid argument. First argument must be an array. Value: `"+t+"`.");for(f="",s=1,c=0;c<t.length;c++)if(n=t[c],"string"==typeof n)f+=n;else{if(r=void 0!==n.precision,!(n=T(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+c+"`. Value: `"+n+"`.");for(n.mapping&&(s=n.mapping),e=n.flags,l=0;l<e.length;l++)switch(o=e.charAt(l)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=e.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+o)}if("*"===n.width){if(n.width=parseInt(arguments[s],10),s+=1,_(n.width))throw new TypeError("the argument for * width at position "+s+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(r&&"*"===n.precision){if(n.precision=parseInt(arguments[s],10),s+=1,_(n.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,r=!1)}switch(n.arg=arguments[s],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":r&&(n.padZeros=!1),n.arg=a(n);break;case"s":n.maxWidth=r?n.precision:-1,n.arg=String(n.arg);break;case"c":if(!_(n.arg)){if((u=parseInt(n.arg,10))<0||u>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=_(u)?String(n.arg):E(u)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(n.precision=6),n.arg=b(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(h=n.arg,p=n.width,g=n.padRight,y=void 0,(y=p-h.length)<0?h:h=g?h+m(y):m(y)+h)),f+=n.arg||"",s+=1}return f}var P=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function S(t){var r={mapping:t[1]?parseInt(t[1],10):void 0,flags:t[2],width:t[3],precision:t[5],specifier:t[6]};return"."===t[4]&&void 0===t[5]&&(r.precision="1"),r}function B(t){var r,e,n,i;for(e=[],i=0,n=P.exec(t);n;)(r=t.slice(i,P.lastIndex-n[0].length)).length&&e.push(r),e.push(S(n)),i=P.lastIndex,n=P.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function U(t){var r,e;if("string"!=typeof t)throw new TypeError(U("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[B(t)],e=1;e<arguments.length;e++)r.push(arguments[e]);return R.apply(null,r)}var j,O=Object.prototype,I=O.toString,L=O.__defineGetter__,Y=O.__defineSetter__,x=O.__lookupGetter__,M=O.__lookupSetter__;j=function(){try{return t({},"x",{}),!0}catch(t){return!1}}()?r:function(t,r,e){var n,i,o,u;if("object"!=typeof t||null===t||"[object Array]"===I.call(t))throw new TypeError(U("invalid argument. First argument must be an object. Value: `%s`.",t));if("object"!=typeof e||null===e||"[object Array]"===I.call(e))throw new TypeError(U("invalid argument. Property descriptor must be an object. Value: `%s`.",e));if((i="value"in e)&&(x.call(t,r)||M.call(t,r)?(n=t.__proto__,t.__proto__=O,delete t[r],t[r]=e.value,t.__proto__=n):t[r]=e.value),o="get"in e,u="set"in e,i&&(o||u))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&L&&L.call(t,r,e.get),u&&Y&&Y.call(t,r,e.set),t};var k=j;function C(t,r,e){k(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}var V=/./;function D(t,r,e){k(t,r,{configurable:!1,enumerable:!1,writable:!1,value:e})}function N(t){return"boolean"==typeof t}var F="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function z(){return F&&"symbol"==typeof Symbol.toStringTag}var $=Object.prototype.toString;var G=Object.prototype.hasOwnProperty;function Z(t,r){return null!=t&&G.call(t,r)}var W="function"==typeof Symbol?Symbol:void 0,X="function"==typeof W?W.toStringTag:"";var q=z()?function(t){var r,e,n;if(null==t)return $.call(t);e=t[X],r=Z(t,X);try{t[X]=void 0}catch(r){return $.call(t)}return n=$.call(t),r?t[X]=e:delete t[X],n}:function(t){return $.call(t)},J=Boolean,H=Boolean.prototype.toString;var K=z();function Q(t){return"object"==typeof t&&(t instanceof J||(K?function(t){try{return H.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===q(t)))}function tt(t){return N(t)||Q(t)}D(tt,"isPrimitive",N),D(tt,"isObject",Q);var rt="object"==typeof self?self:null,et="object"==typeof window?window:null,nt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},it="object"==typeof nt?nt:null,ot="object"==typeof globalThis?globalThis:null;function ut(t){if(arguments.length){if(!N(t))throw new TypeError(U("invalid argument. Must provide a boolean. Value: `%s`.",t));if(t)return new Function("return this;")()}if(ot)return ot;if(rt)return rt;if(et)return et;if(it)return it;throw new Error("unexpected error. Unable to resolve global object.")}var at=ut(),ft=at.document&&at.document.childNodes,st=Int8Array;function ct(){return/^\s*function\s*([^(]*)/i}var lt,ht=/^\s*function\s*([^(]*)/i;D(ct,"REGEXP",ht),lt=Array.isArray?Array.isArray:function(t){return"[object Array]"===q(t)};var pt=lt;function gt(t){return null!==t&&"object"==typeof t}var yt=function(t){if("function"!=typeof t)throw new TypeError(U("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!pt(r))return!1;if(0===(e=r.length))return!1;for(n=0;n<e;n++)if(!1===t(r[n]))return!1;return!0}}(gt);function wt(t){return gt(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function dt(t){var r,e,n;if(("Object"===(e=q(t).slice(8,-1))||"Error"===e)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(r=ht.exec(n.toString()))return r[1]}return wt(t)?"Buffer":e}D(gt,"isObjectLikeArray",yt);var vt="function"==typeof V||"object"==typeof st||"function"==typeof ft?function(t){return dt(t).toLowerCase()}:function(t){var r;return null===t?"null":"object"===(r=typeof t)?dt(t).toLowerCase():r};function bt(t){return"function"===vt(t)}var mt=[],Et=[],At="undefined"!=typeof Uint8Array?Uint8Array:Array,_t=!1;function Tt(){_t=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)mt[r]=t[r],Et[t.charCodeAt(r)]=r;Et["-".charCodeAt(0)]=62,Et["_".charCodeAt(0)]=63}function Rt(t,r,e){for(var n,i,o=[],u=r;u<e;u+=3)n=(t[u]<<16)+(t[u+1]<<8)+t[u+2],o.push(mt[(i=n)>>18&63]+mt[i>>12&63]+mt[i>>6&63]+mt[63&i]);return o.join("")}function Pt(t){var r;_t||Tt();for(var e=t.length,n=e%3,i="",o=[],u=16383,a=0,f=e-n;a<f;a+=u)o.push(Rt(t,a,a+u>f?f:a+u));return 1===n?(r=t[e-1],i+=mt[r>>2],i+=mt[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=mt[r>>10],i+=mt[r>>4&63],i+=mt[r<<2&63],i+="="),o.push(i),o.join("")}function St(t,r,e,n,i){var o,u,a=8*i-n-1,f=(1<<a)-1,s=f>>1,c=-7,l=e?i-1:0,h=e?-1:1,p=t[r+l];for(l+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+t[r+l],l+=h,c-=8);for(u=o&(1<<-c)-1,o>>=-c,c+=n;c>0;u=256*u+t[r+l],l+=h,c-=8);if(0===o)o=1-s;else{if(o===f)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),o-=s}return(p?-1:1)*u*Math.pow(2,o-n)}function Bt(t,r,e,n,i,o){var u,a,f,s=8*o-i-1,c=(1<<s)-1,l=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=c):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),(r+=u+l>=1?h/f:h*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=c?(a=0,u=c):u+l>=1?(a=(r*f-1)*Math.pow(2,i),u+=l):(a=r*Math.pow(2,l-1)*Math.pow(2,i),u=0));i>=8;t[e+p]=255&a,p+=g,a/=256,i-=8);for(u=u<<i|a,s+=i;s>0;t[e+p]=255&u,p+=g,u/=256,s-=8);t[e+p-g]|=128*y}var Ut={}.toString,jt=Array.isArray||function(t){return"[object Array]"==Ut.call(t)};Yt.TYPED_ARRAY_SUPPORT=void 0===nt.TYPED_ARRAY_SUPPORT||nt.TYPED_ARRAY_SUPPORT;var Ot=It();function It(){return Yt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Lt(t,r){if(It()<r)throw new RangeError("Invalid typed array length");return Yt.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=Yt.prototype:(null===t&&(t=new Yt(r)),t.length=r),t}function Yt(t,r,e){if(!(Yt.TYPED_ARRAY_SUPPORT||this instanceof Yt))return new Yt(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return kt(this,t)}return xt(this,t,r,e)}function xt(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);Yt.TYPED_ARRAY_SUPPORT?(t=r).__proto__=Yt.prototype:t=Ct(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!Yt.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Nt(r,e);t=Lt(t,n);var i=t.write(r,e);i!==n&&(t=t.slice(0,i));return t}(t,r,e):function(t,r){if(Dt(r)){var e=0|Vt(r.length);return 0===(t=Lt(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?Lt(t,0):Ct(t,r);if("Buffer"===r.type&&jt(r.data))return Ct(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function Mt(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function kt(t,r){if(Mt(r),t=Lt(t,r<0?0:0|Vt(r)),!Yt.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function Ct(t,r){var e=r.length<0?0:0|Vt(r.length);t=Lt(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function Vt(t){if(t>=It())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+It().toString(16)+" bytes");return 0|t}function Dt(t){return!(null==t||!t._isBuffer)}function Nt(t,r){if(Dt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return gr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return yr(t).length;default:if(n)return gr(t).length;r=(""+r).toLowerCase(),n=!0}}function Ft(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return nr(this,r,e);case"utf8":case"utf-8":return Qt(this,r,e);case"ascii":return rr(this,r,e);case"latin1":case"binary":return er(this,r,e);case"base64":return Kt(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ir(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function zt(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function $t(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=Yt.from(r,n)),Dt(r))return 0===r.length?-1:Gt(t,r,e,n,i);if("number"==typeof r)return r&=255,Yt.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):Gt(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Gt(t,r,e,n,i){var o,u=1,a=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,a/=2,f/=2,e/=2}function s(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var c=-1;for(o=e;o<a;o++)if(s(t,o)===s(r,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===f)return c*u}else-1!==c&&(o-=o-c),c=-1}else for(e+f>a&&(e=a-f),o=e;o>=0;o--){for(var l=!0,h=0;h<f;h++)if(s(t,o+h)!==s(r,h)){l=!1;break}if(l)return o}return-1}function Zt(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var a=parseInt(r.substr(2*u,2),16);if(isNaN(a))return u;t[e+u]=a}return u}function Wt(t,r,e,n){return wr(gr(r,t.length-e),t,e,n)}function Xt(t,r,e,n){return wr(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function qt(t,r,e,n){return Xt(t,r,e,n)}function Jt(t,r,e,n){return wr(yr(r),t,e,n)}function Ht(t,r,e,n){return wr(function(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=(e=t.charCodeAt(u))>>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function Kt(t,r,e){return 0===r&&e===t.length?Pt(t):Pt(t.slice(r,e))}function Qt(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,a,f,s=t[i],c=null,l=s>239?4:s>223?3:s>191?2:1;if(i+l<=e)switch(l){case 1:s<128&&(c=s);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&s)<<6|63&o)>127&&(c=f);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(f=(15&s)<<12|(63&o)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:o=t[i+1],u=t[i+2],a=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&a)&&(f=(15&s)<<18|(63&o)<<12|(63&u)<<6|63&a)>65535&&f<1114112&&(c=f)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=l}return function(t){var r=t.length;if(r<=tr)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=tr));return e}(n)}Yt.poolSize=8192,Yt._augment=function(t){return t.__proto__=Yt.prototype,t},Yt.from=function(t,r,e){return xt(null,t,r,e)},Yt.TYPED_ARRAY_SUPPORT&&(Yt.prototype.__proto__=Uint8Array.prototype,Yt.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Yt[Symbol.species]),Yt.alloc=function(t,r,e){return function(t,r,e,n){return Mt(r),r<=0?Lt(t,r):void 0!==e?"string"==typeof n?Lt(t,r).fill(e,n):Lt(t,r).fill(e):Lt(t,r)}(null,t,r,e)},Yt.allocUnsafe=function(t){return kt(null,t)},Yt.allocUnsafeSlow=function(t){return kt(null,t)},Yt.isBuffer=dr,Yt.compare=function(t,r){if(!Dt(t)||!Dt(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},Yt.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Yt.concat=function(t,r){if(!jt(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Yt.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=Yt.allocUnsafe(r),i=0;for(e=0;e<t.length;++e){var o=t[e];if(!Dt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Yt.byteLength=Nt,Yt.prototype._isBuffer=!0,Yt.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)zt(this,r,r+1);return this},Yt.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)zt(this,r,r+3),zt(this,r+1,r+2);return this},Yt.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)zt(this,r,r+7),zt(this,r+1,r+6),zt(this,r+2,r+5),zt(this,r+3,r+4);return this},Yt.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Qt(this,0,t):Ft.apply(this,arguments)},Yt.prototype.equals=function(t){if(!Dt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Yt.compare(this,t)},Yt.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Yt.prototype.compare=function(t,r,e,n,i){if(!Dt(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(o,u),f=this.slice(n,i),s=t.slice(r,e),c=0;c<a;++c)if(f[c]!==s[c]){o=f[c],u=s[c];break}return o<u?-1:u<o?1:0},Yt.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},Yt.prototype.indexOf=function(t,r,e){return $t(this,t,r,e,!0)},Yt.prototype.lastIndexOf=function(t,r,e){return $t(this,t,r,e,!1)},Yt.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Zt(this,t,r,e);case"utf8":case"utf-8":return Wt(this,t,r,e);case"ascii":return Xt(this,t,r,e);case"latin1":case"binary":return qt(this,t,r,e);case"base64":return Jt(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ht(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Yt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tr=4096;function rr(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function er(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function nr(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=pr(t[o]);return i}function ir(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function or(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function ur(t,r,e,n,i,o){if(!Dt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function ar(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function fr(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function sr(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function cr(t,r,e,n,i){return i||sr(t,0,e,4),Bt(t,r,e,n,23,4),e+4}function lr(t,r,e,n,i){return i||sr(t,0,e,8),Bt(t,r,e,n,52,8),e+8}Yt.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),Yt.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=Yt.prototype;else{var i=r-t;e=new Yt(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},Yt.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||or(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},Yt.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||or(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},Yt.prototype.readUInt8=function(t,r){return r||or(t,1,this.length),this[t]},Yt.prototype.readUInt16LE=function(t,r){return r||or(t,2,this.length),this[t]|this[t+1]<<8},Yt.prototype.readUInt16BE=function(t,r){return r||or(t,2,this.length),this[t]<<8|this[t+1]},Yt.prototype.readUInt32LE=function(t,r){return r||or(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Yt.prototype.readUInt32BE=function(t,r){return r||or(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Yt.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||or(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},Yt.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||or(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},Yt.prototype.readInt8=function(t,r){return r||or(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Yt.prototype.readInt16LE=function(t,r){r||or(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},Yt.prototype.readInt16BE=function(t,r){r||or(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},Yt.prototype.readInt32LE=function(t,r){return r||or(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Yt.prototype.readInt32BE=function(t,r){return r||or(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Yt.prototype.readFloatLE=function(t,r){return r||or(t,4,this.length),St(this,t,!0,23,4)},Yt.prototype.readFloatBE=function(t,r){return r||or(t,4,this.length),St(this,t,!1,23,4)},Yt.prototype.readDoubleLE=function(t,r){return r||or(t,8,this.length),St(this,t,!0,52,8)},Yt.prototype.readDoubleBE=function(t,r){return r||or(t,8,this.length),St(this,t,!1,52,8)},Yt.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||ur(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},Yt.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||ur(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},Yt.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,1,255,0),Yt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},Yt.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,2,65535,0),Yt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):ar(this,t,r,!0),r+2},Yt.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,2,65535,0),Yt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):ar(this,t,r,!1),r+2},Yt.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,4,4294967295,0),Yt.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):fr(this,t,r,!0),r+4},Yt.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,4,4294967295,0),Yt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):fr(this,t,r,!1),r+4},Yt.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);ur(this,t,r,e,i-1,-i)}var o=0,u=1,a=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===a&&0!==this[r+o-1]&&(a=1),this[r+o]=(t/u>>0)-a&255;return r+e},Yt.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);ur(this,t,r,e,i-1,-i)}var o=e-1,u=1,a=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===a&&0!==this[r+o+1]&&(a=1),this[r+o]=(t/u>>0)-a&255;return r+e},Yt.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,1,127,-128),Yt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},Yt.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,2,32767,-32768),Yt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):ar(this,t,r,!0),r+2},Yt.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,2,32767,-32768),Yt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):ar(this,t,r,!1),r+2},Yt.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,4,2147483647,-2147483648),Yt.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):fr(this,t,r,!0),r+4},Yt.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||ur(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Yt.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):fr(this,t,r,!1),r+4},Yt.prototype.writeFloatLE=function(t,r,e){return cr(this,t,r,!0,e)},Yt.prototype.writeFloatBE=function(t,r,e){return cr(this,t,r,!1,e)},Yt.prototype.writeDoubleLE=function(t,r,e){return lr(this,t,r,!0,e)},Yt.prototype.writeDoubleBE=function(t,r,e){return lr(this,t,r,!1,e)},Yt.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!Yt.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},Yt.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Yt.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var u=Dt(t)?t:gr(new Yt(t,n).toString()),a=u.length;for(o=0;o<e-r;++o)this[o+r]=u[o%a]}return this};var hr=/[^+\/0-9A-Za-z-_]/g;function pr(t){return t<16?"0"+t.toString(16):t.toString(16)}function gr(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function yr(t){return function(t){var r,e,n,i,o,u;_t||Tt();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,u=new At(3*a/4-o),n=o>0?a-4:a;var f=0;for(r=0,e=0;r<n;r+=4,e+=3)i=Et[t.charCodeAt(r)]<<18|Et[t.charCodeAt(r+1)]<<12|Et[t.charCodeAt(r+2)]<<6|Et[t.charCodeAt(r+3)],u[f++]=i>>16&255,u[f++]=i>>8&255,u[f++]=255&i;return 2===o?(i=Et[t.charCodeAt(r)]<<2|Et[t.charCodeAt(r+1)]>>4,u[f++]=255&i):1===o&&(i=Et[t.charCodeAt(r)]<<10|Et[t.charCodeAt(r+1)]<<4|Et[t.charCodeAt(r+2)]>>2,u[f++]=i>>8&255,u[f++]=255&i),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(hr,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function wr(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function dr(t){return null!=t&&(!!t._isBuffer||vr(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&vr(t.slice(0,0))}(t))}function vr(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var br=Object.freeze({__proto__:null,Buffer:Yt,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Yt.alloc(+t)},isBuffer:dr,kMaxLength:Ot}),mr=Yt;function Er(t){if(t.__esModule)return t;var r=t.default;if("function"==typeof r){var e=function t(){return this instanceof t?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var Ar,_r=Er(br).Buffer;Ar=function(){var t,r;if("function"!=typeof mr)return!1;try{t=wt(r="function"==typeof mr.from?mr.from([1,2,3,4]):new mr([1,2,3,4]))&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t}()?_r:function(){throw new Error("not implemented")};var Tr=Ar,Rr=bt(Tr.allocUnsafe);function Pr(t){return"number"==typeof t}var Sr=Number,Br=Sr.prototype.toString;var Ur=z();function jr(t){return"object"==typeof t&&(t instanceof Sr||(Ur?function(t){try{return Br.call(t),!0}catch(t){return!1}}(t):"[object Number]"===q(t)))}function Or(t){return Pr(t)||jr(t)}D(Or,"isPrimitive",Pr),D(Or,"isObject",jr);var Ir=Number.POSITIVE_INFINITY,Lr=Sr.NEGATIVE_INFINITY,Yr=Math.floor;function xr(t){return Yr(t)===t}function Mr(t){return t<Ir&&t>Lr&&xr(t)}function kr(t){return Pr(t)&&Mr(t)}function Cr(t){return jr(t)&&Mr(t.valueOf())}function Vr(t){return kr(t)||Cr(t)}function Dr(t){return kr(t)&&t>=0}function Nr(t){return Cr(t)&&t.valueOf()>=0}function Fr(t){return Dr(t)||Nr(t)}D(Vr,"isPrimitive",kr),D(Vr,"isObject",Cr),D(Fr,"isPrimitive",Dr),D(Fr,"isObject",Nr);var zr=Rr?function(t){if(!Fr(t))throw new TypeError(U("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return Tr.allocUnsafe(t)}:function(t){if(!Fr(t))throw new TypeError(U("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return new Tr(t)},$r=bt(Tr.from),Gr=9007199254740991;function Zr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&xr(t.length)&&t.length>=0&&t.length<=Gr}var Wr=$r?function(t){if(!Zr(t))throw new TypeError(U("invalid argument. Must provide an array-like object. Value: `%s`.",t));return Tr.from(t)}:function(t){if(!Zr(t))throw new TypeError(U("invalid argument. Must provide an array-like object. Value: `%s`.",t));return new Tr(t)};function Xr(){throw new Error("setTimeout has not been defined")}function qr(){throw new Error("clearTimeout has not been defined")}var Jr=Xr,Hr=qr;function Kr(t){if(Jr===setTimeout)return setTimeout(t,0);if((Jr===Xr||!Jr)&&setTimeout)return Jr=setTimeout,setTimeout(t,0);try{return Jr(t,0)}catch(r){try{return Jr.call(null,t,0)}catch(r){return Jr.call(this,t,0)}}}"function"==typeof nt.setTimeout&&(Jr=setTimeout),"function"==typeof nt.clearTimeout&&(Hr=clearTimeout);var Qr,te=[],re=!1,ee=-1;function ne(){re&&Qr&&(re=!1,Qr.length?te=Qr.concat(te):ee=-1,te.length&&ie())}function ie(){if(!re){var t=Kr(ne);re=!0;for(var r=te.length;r;){for(Qr=te,te=[];++ee<r;)Qr&&Qr[ee].run();ee=-1,r=te.length}Qr=null,re=!1,function(t){if(Hr===clearTimeout)return clearTimeout(t);if((Hr===qr||!Hr)&&clearTimeout)return Hr=clearTimeout,clearTimeout(t);try{return Hr(t)}catch(r){try{return Hr.call(null,t)}catch(r){return Hr.call(this,t)}}}(t)}}function oe(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];te.push(new ue(t,r)),1!==te.length||re||Kr(ie)}function ue(t,r){this.fun=t,this.array=r}ue.prototype.run=function(){this.fun.apply(null,this.array)};var ae="browser",fe="browser",se={},ce=[],le={},he={},pe={};function ge(){}var ye=ge,we=ge,de=ge,ve=ge,be=ge,me=ge,Ee=ge;function Ae(t){throw new Error("process.binding is not supported")}function _e(){return"/"}function Te(t){throw new Error("process.chdir is not supported")}function Re(){return 0}var Pe=nt.performance||{},Se=Pe.now||Pe.mozNow||Pe.msNow||Pe.oNow||Pe.webkitNow||function(){return(new Date).getTime()};function Be(t){var r=.001*Se.call(Pe),e=Math.floor(r),n=Math.floor(r%1*1e9);return t&&(e-=t[0],(n-=t[1])<0&&(e--,n+=1e9)),[e,n]}var Ue=new Date;function je(){return(new Date-Ue)/1e3}var Oe={nextTick:oe,title:ae,browser:true,env:se,argv:ce,version:"",versions:le,on:ye,addListener:we,once:de,off:ve,removeListener:be,removeAllListeners:me,emit:Ee,binding:Ae,cwd:_e,chdir:Te,umask:Re,hrtime:Be,platform:fe,release:he,config:pe,uptime:je},Ie=Er(Object.freeze({__proto__:null,addListener:we,argv:ce,binding:Ae,browser:true,chdir:Te,config:pe,cwd:_e,default:Oe,emit:Ee,env:se,hrtime:Be,nextTick:oe,off:ve,on:ye,once:de,platform:fe,release:he,removeAllListeners:me,removeListener:be,title:ae,umask:Re,uptime:je,version:"",versions:le}));var Le,Ye=Object,xe=Object.getPrototypeOf;Le=bt(Object.getPrototypeOf)?xe:function(t){var r=function(t){return t.__proto__}(t);return r||null===r?r:"[object Function]"===q(t.constructor)?t.constructor.prototype:t instanceof Ye?Ye.prototype:null};var Me=Le;var ke=Object.prototype;function Ce(t){var r;return!!function(t){return"object"==typeof t&&null!==t&&!pt(t)}(t)&&(r=function(t){return null==t?null:(t=Ye(t),Me(t))}(t),!r||!Z(t,"constructor")&&Z(r,"constructor")&&bt(r.constructor)&&"[object Function]"===q(r.constructor)&&Z(r,"isPrototypeOf")&&bt(r.isPrototypeOf)&&(r===ke||function(t){var r;for(r in t)if(!Z(t,r))return!1;return!0}(t)))}function Ve(t){return"string"==typeof t}var De=String.prototype.valueOf;var Ne=z();function Fe(t){return"object"==typeof t&&(t instanceof String||(Ne?function(t){try{return De.call(t),!0}catch(t){return!1}}(t):"[object String]"===q(t)))}function ze(t){return Ve(t)||Fe(t)}D(ze,"isPrimitive",Ve),D(ze,"isObject",Fe);var $e=Object.prototype.toString;var Ge=new Function("try {return this === global;} catch ( err ) {return false;}")(),Ze=Ie,We=ut(),Xe=/node|io\.js/;var qe,Je,He="object"==typeof nt&&nt===We&&We===We.global&&("[object global]"===q(We)||"[object Object]"===q(We))&&!0===Ge&&"object"==typeof Ze&&"[object process]"===(qe=Ze,$e.call(qe))&&Ce(Ze.versions)&&Ve(Ze.versions.node)&&(void 0===Ze.release||Ce(Ze.release)&&Ve(Ze.release.name)&&Xe.test(Ze.release.name)),Ke=Ie.versions.node,Qe=(Je=He?Ke:null,Je?parseInt(Je.split(".")[0],10):-1),tn=bt(Tr.from)&&Qe>=5,rn="function"==typeof ArrayBuffer;function en(t){return rn&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===q(t)}var nn="function"==typeof Uint8Array;var on="function"==typeof Uint8Array?Uint8Array:null;var un,an="function"==typeof Uint8Array?Uint8Array:void 0;un=function(){var t,r;if("function"!=typeof on)return!1;try{t=function(t){return nn&&t instanceof Uint8Array||"[object Uint8Array]"===q(t)}(r=new on(r=[1,3.14,-3.14,256,257]))&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?an:function(){throw new Error("not implemented")};var fn=un;var sn=tn?function(t,r,e){var n,i;if(!en(t))throw new TypeError(U("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(arguments.length>1){if(!Dr(r))throw new TypeError(U("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(r>t.byteLength)throw new RangeError(U("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));if(n=r,arguments.length>2){if(!Dr(e))throw new TypeError(U("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",e));if(e>t.byteLength)throw new RangeError(U("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",e));i=e}else i=t.byteLength-n}else n=0,i=t.byteLength;return 0===i&&Qe<6?Tr.from([]):Tr.from(t,n,i)}:function(t,r,e){var n;if(!en(t))throw new TypeError(U("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(arguments.length>1){if(!Dr(r))throw new TypeError(U("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(r>t.byteLength)throw new RangeError(U("invalid argument. Second argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",r));if(arguments.length>2){if(!Dr(e))throw new TypeError(U("invalid argument. Last argument must be a nonnegative integer. Value: `%s`.",e));if(e>t.byteLength)throw new RangeError(U("invalid argument. Last argument must not exceed the number of bytes in the input ArrayBuffer. Value: `%s`.",e));n=e}else n=t.byteLength-r;return Wr(new fn(t,r,n))}return Qe<3?Wr(new fn(t)):0===t.byteLength?new Tr([]):new Tr(t)};var cn=bt(Tr.from)?function(t){if(!wt(t))throw new TypeError(U("invalid argument. Must provide a Buffer. Value: `%s`.",t));return Tr.from(t)}:function(t){if(!wt(t))throw new TypeError(U("invalid argument. Must provide a Buffer. Value: `%s`.",t));return new Tr(t)};var ln=bt(Tr.from)?function(t,r){if(!Ve(t))throw new TypeError(U("invalid argument. First argument must be a string. Value: `%s`.",t));if(arguments.length>1){if(!Ve(r))throw new TypeError(U("invalid argument. Second argument must be a string. Value: `%s`.",r));return Tr.from(t,r)}return Tr.from(t,"utf8")}:function(t,r){if(!Ve(t))throw new TypeError(U("invalid argument. First argument must be a string. Value: `%s`.",t));if(arguments.length>1){if(!Ve(r))throw new TypeError(U("invalid argument. Second argument must be a string. Value: `%s`.",r));return new Tr(t,r)}return new Tr(t,"utf8")};function hn(t,r){return r&&"Buffer"===r.type&&pt(r.data)?Wr(r.data):r}function pn(t){var r,e;if(!wt(t))throw new TypeError(U("invalid argument. Must provide a Buffer. Value: `%s`.",t));for((r={}).type="Buffer",r.data=[],e=0;e<t.length;e++)r.data.push(t[e]);return r}var gn={};C(gn,"allocUnsafe",zr),C(gn,"Buffer",Tr),C(gn,"array2buffer",Wr),C(gn,"arraybuffer2buffer",sn),C(gn,"copyBuffer",cn),C(gn,"string2buffer",ln),C(gn,"reviveBuffer",hn),C(gn,"buffer2json",pn);export{Tr as Buffer,zr as allocUnsafe,Wr as array2buffer,sn as arraybuffer2buffer,pn as buffer2json,cn as copyBuffer,gn as default,hn as reviveBuffer,ln as string2buffer};
//# sourceMappingURL=mod.js.map