// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
///
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;r0&&(r-=1),n=i.toExponential(r)):n=i.toPrecision(t.precision),t.alternate||(n=h.call(n,v,"$1e"),n=h.call(n,w,"e"),n=h.call(n,m,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),t.alternate&&(n=h.call(n,g,"$1."),n=h.call(n,y,"$1.e")),i>=0&&t.sign&&(n=t.sign+n),n=t.specifier===l.call(t.specifier)?l.call(n):s.call(n)}function b(t){var r,e="";for(r=0;r127)throw new Error("invalid character code. Value: "+n.arg);n.arg=T(a)?String(n.arg):_(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":r||(n.precision=6),n.arg=d(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=(c=n.arg,p=n.width,g=n.padRight,y=void 0,(y=p-c.length)<0?c:c=g?c+b(y):b(y)+c)),f+=n.arg||"",s+=1}return f}var R=/%(?:([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 O(t){var r,e,n,i;for(e=[],i=0,n=R.exec(t);n;)(r=t.slice(i,R.lastIndex-n[0].length)).length&&e.push(r),e.push(S(n)),i=R.lastIndex,n=R.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function V(t){var r,e;if("string"!=typeof t)throw new TypeError(V("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[O(t)],e=1;ei&&(n=!1),!n&&!r)return 0;i=o}return n&&r?3:n?1:2}function lt(t,r){return r&&(2===t||3===t)}function ht(t,r){return r&&(1===t||3===t)}function ct(t,r,e){var n,i,o,a,u;for(n=t.length,i=e,o=e,u=0;u0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}function pt(t){return t.re}function gt(t){return t.im}function yt(t){return"string"==typeof t}C(ct,"assign",(function(t,r,e,n){var i,o,a,u,f;for(i=t.length,o=e,a=e,f=0;f0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var mt=String.prototype.valueOf;var wt=Y();function vt(t){return"object"==typeof t&&(t instanceof String||(wt?function(t){try{return mt.call(t),!0}catch(t){return!1}}(t):"[object String]"===$(t)))}function dt(t){return yt(t)||vt(t)}C(dt,"isPrimitive",yt),C(dt,"isObject",vt);var bt=/[-\/\\^$*+?.()|[\]{}]/g;var _t=/./,Et=it(),Tt=Et.document&&Et.document.childNodes,At=Int8Array;function xt(){return/^\s*function\s*([^(]*)/i}var Rt=/^\s*function\s*([^(]*)/i;C(xt,"REGEXP",Rt);var St=Array.isArray?Array.isArray:function(t){return"[object Array]"===$(t)};function Ot(t){return null!==t&&"object"==typeof t}function Vt(t){return Ot(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function It(t){var r,e,n;if(("Object"===(e=$(t).slice(8,-1))||"Error"===e)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(r=Rt.exec(n.toString()))return r[1]}return Vt(t)?"Buffer":e}C(Ot,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError(V("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!St(r))return!1;if(0===(e=r.length))return!1;for(n=0;n=0&&"/"!==t[e];e--);return void 0===e||e<=0?t.replace(bt,"\\$&"):(r=(r=t.substring(1,e)).replace(bt,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!Pt(r))throw new TypeError(V("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!yt(e)&&!Ut(e))throw new TypeError(V("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return Ft(t,r,e)}var Ct={int8:"new Int8Array( [ {{data}} ] )",uint8:"new Uint8Array( [ {{data}} ] )",uint8c:"new Uint8ClampedArray( [ {{data}} ] )",int16:"new Int16Array( [ {{data}} ] )",uint16:"new Uint16Array( [ {{data}} ] )",int32:"new Int32Array( [ {{data}} ] )",uint32:"new Uint32Array( [ {{data}} ] )",float32:"new Float32Array( [ {{data}} ] )",float64:"new Float64Array( [ {{data}} ] )",generic:"[ {{data}} ]",binary:"new Buffer( [ {{data}} ] )",complex64:"new Complex64Array( [ {{data}} ] )",complex128:"new Complex128Array( [ {{data}} ] )"};var Nt="function"==typeof Uint8Array;var kt="function"==typeof Uint8Array?Uint8Array:null;var Yt,Dt="function"==typeof Uint8Array?Uint8Array:void 0;Yt=function(){var t,r,e;if("function"!=typeof kt)return!1;try{r=new kt(r=[1,3.14,-3.14,256,257]),e=r,t=(Nt&&e instanceof Uint8Array||"[object Uint8Array]"===$(e))&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?Dt:function(){throw new Error("not implemented")};var Jt=Yt,Wt="function"==typeof Uint16Array;var Gt="function"==typeof Uint16Array?Uint16Array:null;var zt,$t="function"==typeof Uint16Array?Uint16Array:void 0;zt=function(){var t,r,e;if("function"!=typeof Gt)return!1;try{r=new Gt(r=[1,3.14,-3.14,65536,65537]),e=r,t=(Wt&&e instanceof Uint16Array||"[object Uint16Array]"===$(e))&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?$t:function(){throw new Error("not implemented")};var Xt,Zt=zt,Ht={uint16:Zt,uint8:Jt};(Xt=new Ht.uint16(1))[0]=4660;var qt=52===new Ht.uint8(Xt.buffer)[0],Kt="function"==typeof ArrayBuffer;function Qt(t){return Kt&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===$(t)}var tr="function"==typeof Float64Array;var rr="function"==typeof Float64Array?Float64Array:null;var er,nr="function"==typeof Float64Array?Float64Array:void 0;er=function(){var t,r,e;if("function"!=typeof rr)return!1;try{r=new rr([1,3.14,-3.14,NaN]),e=r,t=(tr&&e instanceof Float64Array||"[object Float64Array]"===$(e))&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}()?nr:function(){throw new Error("not implemented")};var ir=er,or="function"==typeof ArrayBuffer?ArrayBuffer:null;var ar,ur="function"==typeof ArrayBuffer?ArrayBuffer:void 0;ar=function(){var t,r,e;if("function"!=typeof or)return!1;try{(t=Qt(e=new or(16))&&"function"==typeof or.isView)&&((r=new ir(e))[0]=-3.14,r[1]=NaN,t=t&&or.isView(r)&&16===e.byteLength&&-3.14===r[0]&&r[1]!=r[1])}catch(r){t=!1}return t}()?ur:function(){throw new Error("not implemented")};var fr=ar,sr="function"==typeof DataView;var lr="function"==typeof DataView?DataView:null;var hr,cr="function"==typeof DataView?DataView:void 0;hr=function(){var t,r,e,n;if("function"!=typeof lr)return!1;try{e=new fr(24),r=new lr(e,8),n=r,(t=(sr&&n instanceof DataView||"[object DataView]"===$(n))&&"function"==typeof r.getFloat64&&"function"==typeof r.setFloat64)&&(r.setFloat64(0,-3.14),r.setFloat64(8,NaN),t=t&&r.buffer===e&&16===r.byteLength&&8===r.byteOffset&&-3.14===r.getFloat64(0)&&r.getFloat64(8)!=r.getFloat64(8))}catch(r){t=!1}return t}()?cr:function(){throw new Error("not implemented")};var pr=hr,gr="function"==typeof BigInt?BigInt:void 0,yr={all:["binary","bool","complex64","complex128","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["binary","bool","complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],floating_point:["complex64","complex128","float32","float64"],real_floating_point:["float32","float64"],complex_floating_point:["complex64","complex128"],boolean:["bool"],integer:["int16","int32","int8","uint16","uint32","uint8","uint8c"],signed_integer:["int16","int32","int8"],unsigned_integer:["uint16","uint32","uint8","uint8c"],real:["float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],numeric:["complex64","complex128","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"]},mr=/_and_generic$/;function wr(){var t,r,e;return 0===arguments.length?yr.all.slice():(e=!1,t=arguments[0],mr.test(t)&&"all"!==(t=Ft(t,mr,""))&&(e=!0),r=(r=yr[t])?r.slice():[],e&&r.length>0&&r.push("generic"),r)}function vr(){return{bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256}}function dr(t,r,e){M(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function br(t){return Object.keys(Object(t))}var _r=void 0!==Object.keys;function Er(t){return"[object Arguments]"===$(t)}var Tr=function(){return Er(arguments)}();function Ar(t){return"number"==typeof t}var xr=Number,Rr=xr.prototype.toString;var Sr=Y();function Or(t){return"object"==typeof t&&(t instanceof xr||(Sr?function(t){try{return Rr.call(t),!0}catch(t){return!1}}(t):"[object Number]"===$(t)))}function Vr(t){return Ar(t)||Or(t)}function Ir(t){return t!=t}function jr(t){return Ar(t)&&Ir(t)}function Ur(t){return Or(t)&&Ir(t.valueOf())}function Br(t){return jr(t)||Ur(t)}C(Vr,"isPrimitive",Ar),C(Vr,"isObject",Or),C(Br,"isPrimitive",jr),C(Br,"isObject",Ur);var Lr=Number.POSITIVE_INFINITY,Pr=xr.NEGATIVE_INFINITY,Fr=Math.floor;function Mr(t){return Fr(t)===t}function Cr(t){return tPr&&Mr(t)}function Nr(t){return Ar(t)&&Cr(t)}function kr(t){return Or(t)&&Cr(t.valueOf())}function Yr(t){return Nr(t)||kr(t)}C(Yr,"isPrimitive",Nr),C(Yr,"isObject",kr);var Dr=Object.prototype.propertyIsEnumerable;var Jr=!Dr.call("beep","0");function Wr(t,r){var e;return null!=t&&(!(e=Dr.call(t,r))&&Jr&&dt(t)?!jr(r=+r)&&Nr(r)&&r>=0&&r=0&&t.length<=Gr&&W(t,"callee")&&!Wr(t,"callee")},$r=Array.prototype.slice;var Xr=Wr((function(){}),"prototype"),Zr=!Wr({toString:null},"toString"),Hr=9007199254740991;function qr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Mr(t.length)&&t.length>=0&&t.length<=Hr}function Kr(t,r,e){var n,i;if(!qr(t)&&!yt(t))throw new TypeError(V("invalid argument. First argument must be an array-like object. Value: `%s`.",t));if(0===(n=t.length))return-1;if(3===arguments.length){if(!Nr(e))throw new TypeError(V("invalid argument. Third argument must be an integer. Value: `%s`.",e));if(e>=0){if(e>=n)return-1;i=e}else(i=n+e)<0&&(i=0)}else i=0;if(Br(r)){for(;i0&&!W(t,"0"))for(u=0;u>>0,i=Fr(t/we),qt?(de.setUint32(0,o,qt),de.setUint32(4,i,qt)):(de.setUint32(0,i,qt),de.setUint32(4,o,qt)),a=0;a>>0,n=Fr(t/4294967296),e=new pr(r.buffer),qt?(e.setUint32(0,i,qt),e.setUint32(4,n,qt)):(e.setUint32(0,n,qt),e.setUint32(4,i,qt))),r}),"assign",be);var _e={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float32:10,float64:11,complex64:12,complex128:13,binary:14,generic:15,notype:17,userdefined_type:256},Ee=le(),Te={throw:1,clamp:2,wrap:3,normalize:4};function Ae(t,r,e,n,i,o){var a,u,f,s,l;if(!(this instanceof Ae))return new Ae(t,r,e,n,i,o);for(s=1,l=0;l=0;a--)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),C(Ae.prototype,"set",(function(){var t,r;for(t=this._offset,r=0;r=0;u--)t-=a=t%n[u],t/=n[u],o+=a*e[u];return this._accessors?this._buffer.set(r,o):this._buffer[o]=r,this})),C(Ae.prototype,"toString",(function(){var t,r,e,n,i,o;if(r=this._shape.length,e="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o=0;o--)t+=pt(i=this.iget(this._length-1-o))+", "+gt(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=Mt(Ct[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;o=0&&t.length<=xe}function Se(t){return"object"==typeof t&&null!==t&&!St(t)}var Oe,Ve=Object,Ie=Object.getPrototypeOf;Oe=Ut(Object.getPrototypeOf)?Ie:function(t){var r=function(t){return t.__proto__}(t);return r||null===r?r:"[object Function]"===$(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null};var je=Oe;var Ue=Object.prototype;function Be(t){var r;return!!Se(t)&&(r=function(t){return null==t?null:(t=Ve(t),je(t))}(t),!r||!W(t,"constructor")&&W(r,"constructor")&&Ut(r.constructor)&&"[object Function]"===$(r.constructor)&&W(r,"isPrototypeOf")&&Ut(r.isPrototypeOf)&&(r===Ue||function(t){var r;for(r in t)if(!W(t,r))return!1;return!0}(t)))}function Le(t){return null===t}function Pe(t){return void 0===t}function Fe(t){return Nr(t)&&t>=0}function Me(t){return kr(t)&&t.valueOf()>=0}function Ce(t){return Fe(t)||Me(t)}function Ne(t){return Nr(t)||Le(t)||Pe(t)}function ke(){var t,r,e,n;if(0===(t=arguments.length)?(r=null,e=null,n=null):1===t?(r=null,e=arguments[0],n=null):2===t?(r=arguments[0],e=arguments[1],n=null):(r=arguments[0],e=arguments[1],n=arguments[2]),!(this instanceof ke))return new ke(r,e,n);if(!Ne(r))throw new TypeError(V("invalid argument. First argument must be an integer, null, or undefined. Value: `%s`.",r));if(!Ne(e))throw new TypeError(V("invalid argument. Second argument must be an integer, null, or undefined. Value: `%s`.",e));if(!Ne(n))throw new TypeError(V("invalid argument. Third argument must be an integer, null, or undefined. Value: `%s`.",n));if(0===n)throw new RangeError(V("invalid argument. Third argument cannot be zero. Value: `%s`.",n));return this._start=void 0===r?null:r,this._stop=void 0===e?null:e,this._step=void 0===n?null:n,this}function Ye(t){return Nr(t)||Le(t)||Pe(t)||function(t){return t instanceof ke||"Slice"===It(t)}(t)}function De(){var t,r,e,n,i;if(t=arguments.length,!(this instanceof De)){if(1===t)return new De(arguments[0]);if(2===t)return new De(arguments[0],arguments[1]);if(3===t)return new De(arguments[0],arguments[1],arguments[2]);if(4===t)return new De(arguments[0],arguments[1],arguments[2],arguments[3]);if(5===t)return new De(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);for(e=[],i=0;i=r?e?{code:"ERR_SLICE_OUT_OF_BOUNDS"}:new ke(r,r,1):t<0&&(t=r+t)<0?e?{code:"ERR_SLICE_OUT_OF_BOUNDS"}:new ke(0,0,1):new ke(t,t+1,1)}(t,r,e):function(t,r,e){var n,i,o;if(n=t.start,i=t.stop,null===(o=t.step)&&(o=1),null===n)n=o>0?0:r-1;else if(n<0){if((n=r+n)<0){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};n=0}}else if(n>=r){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};n=o<0?r-1:r}if(null===i)i=o>0?r:null;else if(i<0){if((i=r+i)<0)if(o>0){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=0}else{if(e&&i<-1)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=null}}else if(i>r){if(e)return{code:"ERR_SLICE_OUT_OF_BOUNDS"};i=r}return new ke(n,i,o)}(t,r,e)}function $e(t,r,e){var n,i,o,a;for(n=t.data,i=[],a=0;a0&&e>=n||r<0&&e<=n?0:Xe((n-e)/r)}function He(t){var r,e,n;for(r=t.data,e=[],n=0;n=0;i--)e[i]=n,n*=t[i];return e}(t)}C(tn,"assign",(function(t,r,e){return"column-major"===r?function(t,r){var e,n;for(e=1,n=0;n=0;n--)r[n]=e,e*=t[n];return r}(t,e)}));var rn="row-major";var en="row-major",nn="column-major";function on(t){return t.data}var an=[],un=[],fn="undefined"!=typeof Uint8Array?Uint8Array:Array,sn=!1;function ln(){sn=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)an[r]=t[r],un[t.charCodeAt(r)]=r;un["-".charCodeAt(0)]=62,un["_".charCodeAt(0)]=63}function hn(t,r,e){for(var n,i,o=[],a=r;a>18&63]+an[i>>12&63]+an[i>>6&63]+an[63&i]);return o.join("")}function cn(t){var r;sn||ln();for(var e=t.length,n=e%3,i="",o=[],a=16383,u=0,f=e-n;uf?f:u+a));return 1===n?(r=t[e-1],i+=an[r>>2],i+=an[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=an[r>>10],i+=an[r>>4&63],i+=an[r<<2&63],i+="="),o.push(i),o.join("")}function pn(t,r,e,n,i){var o,a,u=8*i-n-1,f=(1<>1,l=-7,h=e?i-1:0,c=e?-1:1,p=t[r+h];for(h+=c,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[r+h],h+=c,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[r+h],h+=c,l-=8);if(0===o)o=1-s;else{if(o===f)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=s}return(p?-1:1)*a*Math.pow(2,o-n)}function gn(t,r,e,n,i,o){var a,u,f,s=8*o-i-1,l=(1<>1,c=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?(u=isNaN(r)?1:0,a=l):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),(r+=a+h>=1?c/f:c*Math.pow(2,1-h))*f>=2&&(a++,f/=2),a+h>=l?(u=0,a=l):a+h>=1?(u=(r*f-1)*Math.pow(2,i),a+=h):(u=r*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[e+p]=255&u,p+=g,u/=256,i-=8);for(a=a<0;t[e+p]=255&a,p+=g,a/=256,s-=8);t[e+p-g]|=128*y}var yn={}.toString,mn=Array.isArray||function(t){return"[object Array]"==yn.call(t)};bn.TYPED_ARRAY_SUPPORT=void 0===rt.TYPED_ARRAY_SUPPORT||rt.TYPED_ARRAY_SUPPORT;var wn=vn();function vn(){return bn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function dn(t,r){if(vn()=vn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vn().toString(16)+" bytes");return 0|t}function Rn(t){return!(null==t||!t._isBuffer)}function Sn(t,r){if(Rn(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 ti(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return ri(t).length;default:if(n)return ti(t).length;r=(""+r).toLowerCase(),n=!0}}function On(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 Jn(this,r,e);case"utf8":case"utf-8":return Nn(this,r,e);case"ascii":return Yn(this,r,e);case"latin1":case"binary":return Dn(this,r,e);case"base64":return Cn(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wn(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function Vn(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function In(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=bn.from(r,n)),Rn(r))return 0===r.length?-1:jn(t,r,e,n,i);if("number"==typeof r)return r&=255,bn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):jn(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function jn(t,r,e,n,i){var o,a=1,u=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;a=2,u/=2,f/=2,e/=2}function s(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(i){var l=-1;for(o=e;ou&&(e=u-f),o=e;o>=0;o--){for(var h=!0,c=0;ci&&(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 a=0;a>8,i=e%256,o.push(i),o.push(n);return o}(r,t.length-e),t,e,n)}function Cn(t,r,e){return 0===r&&e===t.length?cn(t):cn(t.slice(r,e))}function Nn(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i239?4:s>223?3:s>191?2:1;if(i+h<=e)switch(h){case 1:s<128&&(l=s);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&s)<<6|63&o)>127&&(l=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&s)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(l=f);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(f=(15&s)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&f<1114112&&(l=f)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var r=t.length;if(r<=kn)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},bn.prototype.compare=function(t,r,e,n,i){if(!Rn(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),a=(e>>>=0)-(r>>>=0),u=Math.min(o,a),f=this.slice(n,i),s=t.slice(r,e),l=0;li)&&(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 Un(this,t,r,e);case"utf8":case"utf-8":return Bn(this,t,r,e);case"ascii":return Ln(this,t,r,e);case"latin1":case"binary":return Pn(this,t,r,e);case"base64":return Fn(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mn(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},bn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var kn=4096;function Yn(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;in)&&(e=n);for(var i="",o=r;oe)throw new RangeError("Trying to access beyond buffer length")}function zn(t,r,e,n,i,o){if(!Rn(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function $n(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i>>8*(n?i:1-i)}function Xn(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i>>8*(n?i:3-i)&255}function Zn(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 Hn(t,r,e,n,i){return i||Zn(t,0,e,4),gn(t,r,e,n,23,4),e+4}function qn(t,r,e,n,i){return i||Zn(t,0,e,8),gn(t,r,e,n,52,8),e+8}bn.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),r0&&(i*=256);)n+=this[t+--r]*i;return n},bn.prototype.readUInt8=function(t,r){return r||Gn(t,1,this.length),this[t]},bn.prototype.readUInt16LE=function(t,r){return r||Gn(t,2,this.length),this[t]|this[t+1]<<8},bn.prototype.readUInt16BE=function(t,r){return r||Gn(t,2,this.length),this[t]<<8|this[t+1]},bn.prototype.readUInt32LE=function(t,r){return r||Gn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},bn.prototype.readUInt32BE=function(t,r){return r||Gn(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},bn.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||Gn(t,r,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*r)),n},bn.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||Gn(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},bn.prototype.readInt8=function(t,r){return r||Gn(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},bn.prototype.readInt16LE=function(t,r){r||Gn(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},bn.prototype.readInt16BE=function(t,r){r||Gn(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},bn.prototype.readInt32LE=function(t,r){return r||Gn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},bn.prototype.readInt32BE=function(t,r){return r||Gn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},bn.prototype.readFloatLE=function(t,r){return r||Gn(t,4,this.length),pn(this,t,!0,23,4)},bn.prototype.readFloatBE=function(t,r){return r||Gn(t,4,this.length),pn(this,t,!1,23,4)},bn.prototype.readDoubleLE=function(t,r){return r||Gn(t,8,this.length),pn(this,t,!0,52,8)},bn.prototype.readDoubleBE=function(t,r){return r||Gn(t,8,this.length),pn(this,t,!1,52,8)},bn.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||zn(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o=0&&(o*=256);)this[r+i]=t/o&255;return r+e},bn.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,1,255,0),bn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},bn.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,2,65535,0),bn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):$n(this,t,r,!0),r+2},bn.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,2,65535,0),bn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):$n(this,t,r,!1),r+2},bn.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,4,4294967295,0),bn.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Xn(this,t,r,!0),r+4},bn.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,4,4294967295,0),bn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Xn(this,t,r,!1),r+4},bn.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);zn(this,t,r,e,i-1,-i)}var o=0,a=1,u=0;for(this[r]=255&t;++o>0)-u&255;return r+e},bn.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);zn(this,t,r,e,i-1,-i)}var o=e-1,a=1,u=0;for(this[r+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/a>>0)-u&255;return r+e},bn.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,1,127,-128),bn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},bn.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,2,32767,-32768),bn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):$n(this,t,r,!0),r+2},bn.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,2,32767,-32768),bn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):$n(this,t,r,!1),r+2},bn.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,4,2147483647,-2147483648),bn.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Xn(this,t,r,!0),r+4},bn.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||zn(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),bn.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Xn(this,t,r,!1),r+4},bn.prototype.writeFloatLE=function(t,r,e){return Hn(this,t,r,!0,e)},bn.prototype.writeFloatBE=function(t,r,e){return Hn(this,t,r,!1,e)},bn.prototype.writeDoubleLE=function(t,r,e){return qn(this,t,r,!0,e)},bn.prototype.writeDoubleBE=function(t,r,e){return qn(this,t,r,!1,e)},bn.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=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=0;--i)t[i+r]=this[i+e];else if(o<1e3||!bn.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(a+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 ri(t){return function(t){var r,e,n,i,o,a;sn||ln();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[u-2]?2:"="===t[u-1]?1:0,a=new fn(3*u/4-o),n=o>0?u-4:u;var f=0;for(r=0,e=0;r>16&255,a[f++]=i>>8&255,a[f++]=255&i;return 2===o?(i=un[t.charCodeAt(r)]<<2|un[t.charCodeAt(r+1)]>>4,a[f++]=255&i):1===o&&(i=un[t.charCodeAt(r)]<<10|un[t.charCodeAt(r+1)]<<4|un[t.charCodeAt(r+2)]>>2,a[f++]=i>>8&255,a[f++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Kn,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ei(t,r,e,n){for(var i=0;i=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function ni(t){return null!=t&&(!!t._isBuffer||ii(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ii(t.slice(0,0))}(t))}function ii(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var oi=Object.freeze({__proto__:null,Buffer:bn,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),bn.alloc(+t)},isBuffer:ni,kMaxLength:wn}),ai=bn;function ui(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 fi,si=ui(oi).Buffer;fi=function(){var t,r;if("function"!=typeof ai)return!1;try{t=Vt(r="function"==typeof ai.from?ai.from([1,2,3,4]):new ai([1,2,3,4]))&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t}()?si:function(){throw new Error("not implemented")};var li=fi,hi="function"==typeof Float32Array;var ci="function"==typeof Float32Array?Float32Array:null;var pi,gi="function"==typeof Float32Array?Float32Array:void 0;pi=function(){var t,r,e;if("function"!=typeof ci)return!1;try{r=new ci([1,3.14,-3.14,5e40]),e=r,t=(hi&&e instanceof Float32Array||"[object Float32Array]"===$(e))&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===Lr}catch(r){t=!1}return t}()?gi:function(){throw new Error("not implemented")};var yi=pi,mi="function"==typeof Int16Array;var wi="function"==typeof Int16Array?Int16Array:null;var vi,di="function"==typeof Int16Array?Int16Array:void 0;vi=function(){var t,r,e;if("function"!=typeof wi)return!1;try{r=new wi([1,3.14,-3.14,32768]),e=r,t=(mi&&e instanceof Int16Array||"[object Int16Array]"===$(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t}()?di:function(){throw new Error("not implemented")};var bi=vi,_i="function"==typeof Int32Array;var Ei="function"==typeof Int32Array?Int32Array:null;var Ti,Ai="function"==typeof Int32Array?Int32Array:void 0;Ti=function(){var t,r,e;if("function"!=typeof Ei)return!1;try{r=new Ei([1,3.14,-3.14,2147483648]),e=r,t=(_i&&e instanceof Int32Array||"[object Int32Array]"===$(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t}()?Ai:function(){throw new Error("not implemented")};var xi=Ti,Ri="function"==typeof Int8Array;var Si="function"==typeof Int8Array?Int8Array:null;var Oi,Vi="function"==typeof Int8Array?Int8Array:void 0;Oi=function(){var t,r,e;if("function"!=typeof Si)return!1;try{r=new Si([1,3.14,-3.14,128]),e=r,t=(Ri&&e instanceof Int8Array||"[object Int8Array]"===$(e))&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t}()?Vi:function(){throw new Error("not implemented")};var Ii=Oi,ji="function"==typeof Uint32Array;var Ui="function"==typeof Uint32Array?Uint32Array:null;var Bi,Li="function"==typeof Uint32Array?Uint32Array:void 0;Bi=function(){var t,r,e;if("function"!=typeof Ui)return!1;try{r=new Ui(r=[1,3.14,-3.14,4294967296,4294967297]),e=r,t=(ji&&e instanceof Uint32Array||"[object Uint32Array]"===$(e))&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?Li:function(){throw new Error("not implemented")};var Pi=Bi,Fi="function"==typeof Uint8ClampedArray;var Mi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Ci,Ni="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;Ci=function(){var t,r,e;if("function"!=typeof Mi)return!1;try{r=new Mi([-1,0,1,3.14,4.99,255,256]),e=r,t=(Fi&&e instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===$(e))&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t}()?Ni:function(){throw new Error("not implemented")};var ki=Ci;function Yi(t,r){if(!(this instanceof Yi))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(V("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(V("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}C(Yi,"BYTES_PER_ELEMENT",8),C(Yi.prototype,"BYTES_PER_ELEMENT",8),C(Yi.prototype,"byteLength",16),C(Yi.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Yi.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Di="function"==typeof Math.fround?Math.fround:null,Ji=new yi(1);var Wi="function"==typeof Di?Di:function(t){return Ji[0]=t,Ji[0]};function Gi(t,r){if(!(this instanceof Gi))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(V("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(V("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Wi(t)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Wi(r)}),this}function zi(t){return t instanceof Yi||t instanceof Gi||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function $i(t){return Mr(t/2)}C(Gi,"BYTES_PER_ELEMENT",4),C(Gi.prototype,"BYTES_PER_ELEMENT",4),C(Gi.prototype,"byteLength",8),C(Gi.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Gi.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Xi=8;function Zi(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Xi}var Hi=16;function qi(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Hi}function Ki(){return"function"==typeof G&&"symbol"==typeof G("foo")&&W(G,"iterator")&&"symbol"==typeof G.iterator}var Qi=Ki()?Symbol.iterator:null;function to(t,r){if(!(this instanceof to))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(V("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(V("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Wi(t)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Wi(r)}),this}function ro(t){return t.re}function eo(t){return t.im}function no(t,r){return new yi(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function io(t,r){return new ir(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}C(to,"BYTES_PER_ELEMENT",4),C(to.prototype,"BYTES_PER_ELEMENT",4),C(to.prototype,"byteLength",8),C(to.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(to.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var oo={float64:function(t,r){return t[r]},float32:function(t,r){return t[r]},int32:function(t,r){return t[r]},int16:function(t,r){return t[r]},int8:function(t,r){return t[r]},uint32:function(t,r){return t[r]},uint16:function(t,r){return t[r]},uint8:function(t,r){return t[r]},uint8c:function(t,r){return t[r]},generic:function(t,r){return t[r]},default:function(t,r){return t[r]}};function ao(t){var r=oo[t];return"function"==typeof r?r:oo.default}var uo={complex128:function(t,r){return t.get(r)},complex64:function(t,r){return t.get(r)},default:function(t,r){return t.get(r)}};function fo(t){var r=uo[t];return"function"==typeof r?r:uo.default}function so(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(Re(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!zi(n))return new TypeError(V("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(ro(n),eo(n))}return r}var lo=2*yi.BYTES_PER_ELEMENT,ho=Ki();function co(t){return t instanceof yo||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function po(t){return t===yo||"Complex128Array"===t.name}function go(t,r){return new to(t[r*=2],t[r+1])}function yo(){var t,r,e,n;if(r=arguments.length,!(this instanceof yo))return 0===r?new yo:1===r?new yo(arguments[0]):2===r?new yo(arguments[0],arguments[1]):new yo(arguments[0],arguments[1],arguments[2]);if(0===r)e=new yi(0);else if(1===r)if(Fe(arguments[0]))e=new yi(2*arguments[0]);else if(qr(arguments[0]))if((n=(e=arguments[0]).length)&&St(e)&&zi(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.byteLength-t)throw new RangeError(V("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*lo));e=new yi(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}function mo(t,r){if(!(this instanceof mo))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Ar(t))throw new TypeError(V("invalid argument. Real component must be a number. Value: `%s`.",t));if(!Ar(r))throw new TypeError(V("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}function wo(t){return t.re}function vo(t){return t.im}function bo(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(Re(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!zi(n))return new TypeError(V("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(wo(n),vo(n))}return r}C(yo,"BYTES_PER_ELEMENT",lo),C(yo,"name","Complex64Array"),C(yo,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Ut(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!po(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Ut(n=arguments[1]))throw new TypeError(V("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(co(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(qr(t)){if(n){for(f=t.length,u=t.get&&t.set?fo("default"):ao("default"),h=0;h=2))throw new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Se(t)&&ho&&Ut(t[Qi])){if(!Ut((o=t[Qi]()).next))throw new TypeError(V("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Re(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!zi(o))return new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(ro(o),eo(o))}return n}(o,n,r):so(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return go(this._buffer,t)})),at(yo.prototype,"buffer",(function(){return this._buffer.buffer})),at(yo.prototype,"byteLength",(function(){return this._buffer.byteLength})),at(yo.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(yo.prototype,"BYTES_PER_ELEMENT",yo.BYTES_PER_ELEMENT),C(yo.prototype,"copyWithin",(function(t,r){if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*r):this._buffer.copyWithin(2*t,2*r,2*arguments[2]),this})),C(yo.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,t=this._buffer,n=this._length,o=-1,a=-2,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new to(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qi&&C(e,Qi,(function(){return r.entries()})),e})),C(yo.prototype,"every",(function(t,r){var e,n;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Mr(e))throw new TypeError(V("invalid argument. Third argument must be an integer. Value: `%s`.",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else r=0,e=i;for(a=ro(t),u=eo(t),f=r;f=0;n--)if(i=go(e,n),t.call(r,i,n,this))return i})),C(yo.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=go(e,n),t.call(r,i,n,this))return n;return-1})),C(yo.prototype,"forEach",(function(t,r){var e,n,i;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return go(this._buffer,t)})),C(yo.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!zi(t))throw new TypeError(V("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=ro(t),o=eo(t),e=this._buffer,a=r;a1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=ro(t),o=eo(t),e=this._buffer,a=r;a1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=ro(t),o=eo(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),at(yo.prototype,"length",(function(){return this._length})),C(yo.prototype,"map",(function(t,r){var e,n,i,o,a;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=go(e,0),o=1}for(;o1){if(!Fe(e=arguments[1]))throw new TypeError(V("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(zi(t)){if(e>=this._length)throw new RangeError(V("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=ro(t),void(n[e+1]=eo(t))}if(co(t)){if(e+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t._buffer,s=n.byteOffset+e*lo,r.buffer===n.buffer&&r.byteOffsets){for(i=new yi(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*lo,r.buffer===n.buffer&&r.byteOffsets){for(i=new yi(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*lo):(i=r-t,e=n.byteOffset+t*lo),new this.constructor(n.buffer,e,i<0?0:i)})),C(yo.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!co(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i=i)throw new RangeError(V("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!zi(r))throw new TypeError(V("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=ro(r),e[2*t+1]=eo(r),n})),C(mo,"BYTES_PER_ELEMENT",8),C(mo.prototype,"BYTES_PER_ELEMENT",8),C(mo.prototype,"byteLength",16),C(mo.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(mo.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var _o=2*ir.BYTES_PER_ELEMENT,Eo=Ki();function To(t){return t instanceof Ro||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Ao(t){return t===Ro||"Complex64Array"===t.name}function xo(t,r){return new mo(t[r*=2],t[r+1])}function Ro(){var t,r,e,n;if(r=arguments.length,!(this instanceof Ro))return 0===r?new Ro:1===r?new Ro(arguments[0]):2===r?new Ro(arguments[0],arguments[1]):new Ro(arguments[0],arguments[1],arguments[2]);if(0===r)e=new ir(0);else if(1===r)if(Fe(arguments[0]))e=new ir(2*arguments[0]);else if(qr(arguments[0]))if((n=(e=arguments[0]).length)&&St(e)&&zi(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.byteLength-t)throw new RangeError(V("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*_o));e=new ir(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}C(Ro,"BYTES_PER_ELEMENT",_o),C(Ro,"name","Complex128Array"),C(Ro,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Ut(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Ao(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Ut(n=arguments[1]))throw new TypeError(V("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(To(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(qr(t)){if(n){for(f=t.length,u=t.get&&t.set?fo("default"):ao("default"),h=0;h=2))throw new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",l));o[c]=l[0],o[c+1]=l[1]}c+=2}return i}return new this(t)}if(Se(t)&&Eo&&Ut(t[Qi])){if(!Ut((o=t[Qi]()).next))throw new TypeError(V("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(a=n?function(t,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Re(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!zi(o))return new TypeError(V("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(wo(o),vo(o))}return n}(o,n,r):bo(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return xo(this._buffer,t)})),at(Ro.prototype,"buffer",(function(){return this._buffer.buffer})),at(Ro.prototype,"byteLength",(function(){return this._buffer.byteLength})),at(Ro.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Ro.prototype,"BYTES_PER_ELEMENT",Ro.BYTES_PER_ELEMENT),C(Ro.prototype,"copyWithin",(function(t,r){if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*r):this._buffer.copyWithin(2*t,2*r,2*arguments[2]),this})),C(Ro.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,t=this._buffer,n=this._length,o=-1,a=-2,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new mo(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qi&&C(e,Qi,(function(){return r.entries()})),e})),C(Ro.prototype,"every",(function(t,r){var e,n;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Mr(e))throw new TypeError(V("invalid argument. Third argument must be an integer. Value: `%s`.",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else r=0,e=i;for(a=wo(t),u=vo(t),f=r;f=0;n--)if(i=xo(e,n),t.call(r,i,n,this))return i})),C(Ro.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=xo(e,n),t.call(r,i,n,this))return n;return-1})),C(Ro.prototype,"forEach",(function(t,r){var e,n,i;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return xo(this._buffer,t)})),at(Ro.prototype,"length",(function(){return this._length})),C(Ro.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!zi(t))throw new TypeError(V("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=wo(t),o=vo(t),e=this._buffer,a=r;a1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=wo(t),o=vo(t),e=this._buffer,a=r;a1){if(!Mr(r))throw new TypeError(V("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=wo(t),o=vo(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),C(Ro.prototype,"map",(function(t,r){var e,n,i,o,a;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ut(t))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=xo(e,0),o=1}for(;o1){if(!Fe(e=arguments[1]))throw new TypeError(V("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(zi(t)){if(e>=this._length)throw new RangeError(V("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=wo(t),void(n[e+1]=vo(t))}if(To(t)){if(e+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t._buffer,s=n.byteOffset+e*_o,r.buffer===n.buffer&&r.byteOffsets){for(i=new ir(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*_o,r.buffer===n.buffer&&r.byteOffsets){for(i=new ir(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*_o):(i=r-t,e=n.byteOffset+t*_o),new this.constructor(n.buffer,e,i<0?0:i)})),C(Ro.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!To(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i=i)throw new RangeError(V("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!zi(r))throw new TypeError(V("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=wo(r),e[2*t+1]=vo(r),n}));var So={binary:li,float64:ir,float32:yi,generic:Array,int16:bi,int32:xi,int8:Ii,uint16:Zt,uint32:Pi,uint8:Jt,uint8c:ki,complex64:yo,complex128:Ro};var Oo=Ut(li.allocUnsafe)?function(t){if(!Ce(t))throw new TypeError(V("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return li.allocUnsafe(t)}:function(t){if(!Ce(t))throw new TypeError(V("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));return new li(t)};function Vo(t,r){var e=function(t){return So[t]||null}(t);return e?new e(r):null}function Io(t,r){return"generic"===t?function(t){var r,e;for(r=[],e=0;e0&&(c=Ke(c.length))}else c=He(p);return 0===Qe(c)?function(t,r,e,n,i){var o,a;return o=0===(a=e.length)?[0]:Ke(a),new t(r,Io(r,0),e,o,0,n,{readonly:i})}(h,a,qe(c,s),f,!n):(o=function(t,r,e){var n,i,o;for(n=t.data,i=e,o=0;o0)throw new RangeError(Uo("1mxFE",a.join(","),0))}if(Re(r)){if(o=r,n>2)throw new Error(Uo("1mx0m"))}else for(o=[],u=1;u