-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser.js
3 lines (3 loc) · 57.3 KB
/
browser.js
1
2
3
// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
var r,e;r=this,e=function(){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null,e=Object.defineProperty;function t(r){return"number"==typeof r}function n(r){var e,t="";for(e=0;e<r;e++)t+="0";return t}function i(r,e,t){var i=!1,o=e-r.length;return o<0||(function(r){return"-"===r[0]}(r)&&(i=!0,r=r.substr(1)),r=t?r+n(o):n(o)+r,i&&(r="-"+r)),r}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function u(r){var e,n,u;switch(r.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(n=r.arg,u=parseInt(n,10),!isFinite(u)){if(!t(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===r.specifier||10!==e)&&(u=4294967295+u+1),u<0?(n=(-u).toString(e),r.precision&&(n=i(n,r.precision,r.padRight)),n="-"+n):(n=u.toString(e),u||r.precision?r.precision&&(n=i(n,r.precision,r.padRight)):n="",r.sign&&(n=r.sign+n)),16===e&&(r.alternate&&(n="0x"+n),n=r.specifier===a.call(r.specifier)?a.call(n):o.call(n)),8===e&&r.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var f=Math.abs,l=String.prototype.toLowerCase,s=String.prototype.toUpperCase,c=String.prototype.replace,h=/e\+(\d)$/,p=/e-(\d)$/,m=/^(\d+)$/,y=/^(\d+)e/,g=/\.0$/,w=/\.0*e/,b=/(\..*[^0])0*e/;function v(r){var e,n,i=parseFloat(r.arg);if(!isFinite(i)){if(!t(r.arg))throw new Error("invalid floating-point number. Value: "+n);i=r.arg}switch(r.specifier){case"e":case"E":n=i.toExponential(r.precision);break;case"f":case"F":n=i.toFixed(r.precision);break;case"g":case"G":f(i)<1e-4?((e=r.precision)>0&&(e-=1),n=i.toExponential(e)):n=i.toPrecision(r.precision),r.alternate||(n=c.call(n,b,"$1e"),n=c.call(n,w,"e"),n=c.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=c.call(n,h,"e+0$1"),n=c.call(n,p,"e-0$1"),r.alternate&&(n=c.call(n,m,"$1."),n=c.call(n,y,"$1.e")),i>=0&&r.sign&&(n=r.sign+n),n=r.specifier===s.call(r.specifier)?s.call(n):l.call(n)}function d(r){var e,t="";for(e=0;e<r;e++)t+=" ";return t}var E=String.fromCharCode,_=Array.isArray;function T(r){return r!=r}function x(r){var e={};return e.specifier=r.specifier,e.precision=void 0===r.precision?1:r.precision,e.width=r.width,e.flags=r.flags||"",e.mapping=r.mapping,e}function A(r){var e,t,n,o,a,f,l,s,c,h,p,m,y;if(!_(r))throw new TypeError("invalid argument. First argument must be an array. Value: `"+r+"`.");for(f="",l=1,s=0;s<r.length;s++)if("string"==typeof(n=r[s]))f+=n;else{if(e=void 0!==n.precision,!(n=x(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+s+"`. Value: `"+n+"`.");for(n.mapping&&(l=n.mapping),t=n.flags,c=0;c<t.length;c++)switch(o=t.charAt(c)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=t.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+o)}if("*"===n.width){if(n.width=parseInt(arguments[l],10),l+=1,T(n.width))throw new TypeError("the argument for * width at position "+l+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(e&&"*"===n.precision){if(n.precision=parseInt(arguments[l],10),l+=1,T(n.precision))throw new TypeError("the argument for * precision at position "+l+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,e=!1)}switch(n.arg=arguments[l],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=u(n);break;case"s":n.maxWidth=e?n.precision:-1,n.arg=String(n.arg);break;case"c":if(!T(n.arg)){if((a=parseInt(n.arg,10))<0||a>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=T(a)?String(n.arg):E(a)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=v(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,m=n.padRight,y=void 0,(y=p-h.length)<0?h:h=m?h+d(y):d(y)+h)),f+=n.arg||"",l+=1}return f}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function S(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function j(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push(S(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function F(r){var e,t;if("string"!=typeof r)throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[j(r)],t=1;t<arguments.length;t++)e.push(arguments[t]);return A.apply(null,e)}var k,L=Object.prototype,I=L.toString,R=L.__defineGetter__,B=L.__defineSetter__,O=L.__lookupGetter__,C=L.__lookupSetter__;k=function(){try{return r({},"x",{}),!0}catch(r){return!1}}()?e:function(r,e,t){var n,i,o,a;if("object"!=typeof r||null===r||"[object Array]"===I.call(r))throw new TypeError(F("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===I.call(t))throw new TypeError(F("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(O.call(r,e)||C.call(r,e)?(n=r.__proto__,r.__proto__=L,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),o="get"in t,a="set"in t,i&&(o||a))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return o&&R&&R.call(r,e,t.get),a&&B&&B.call(r,e,t.set),r};var M=k;function P(r,e,t){M(r,e,{configurable:!1,enumerable:!1,writable:!1,value:t})}var N="function",U={float64:function(r,e){return r[e]},float32:function(r,e){return r[e]},int32:function(r,e){return r[e]},int16:function(r,e){return r[e]},int8:function(r,e){return r[e]},uint32:function(r,e){return r[e]},uint16:function(r,e){return r[e]},uint8:function(r,e){return r[e]},uint8c:function(r,e){return r[e]},generic:function(r,e){return r[e]},default:function(r,e){return r[e]}};function Y(r){var e=U[r];return"function"==typeof e?e:U.default}var W={float64:function(r,e,t){r[e]=t},float32:function(r,e,t){r[e]=t},int32:function(r,e,t){r[e]=t},int16:function(r,e,t){r[e]=t},int8:function(r,e,t){r[e]=t},uint32:function(r,e,t){r[e]=t},uint16:function(r,e,t){r[e]=t},uint8:function(r,e,t){r[e]=t},uint8c:function(r,e,t){r[e]=t},generic:function(r,e,t){r[e]=t},default:function(r,e,t){r[e]=t}};function $(r){var e=W[r];return"function"==typeof e?e:W.default}var G={complex128:function(r,e){return r.get(e)},complex64:function(r,e){return r.get(e)},default:function(r,e){return r.get(e)}};function Z(r){var e=G[r];return"function"==typeof e?e:G.default}var J={complex128:function(r,e,t){r.set(t,e)},complex64:function(r,e,t){r.set(t,e)},default:function(r,e,t){r.set(t,e)}};function X(r){var e=J[r];return"function"==typeof e?e:J.default}var z="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function q(){return z&&"symbol"==typeof Symbol.toStringTag}var D=Object.prototype.toString,H=Object.prototype.hasOwnProperty;function K(r,e){return null!=r&&H.call(r,e)}var Q="function"==typeof Symbol?Symbol:void 0,rr="function"==typeof Q?Q.toStringTag:"",er=q()?function(r){var e,t,n;if(null==r)return D.call(r);t=r[rr],e=K(r,rr);try{r[rr]=void 0}catch(e){return D.call(r)}return n=D.call(r),e?r[rr]=t:delete r[rr],n}:function(r){return D.call(r)},tr=Array.isArray?Array.isArray:function(r){return"[object Array]"===er(r)};function nr(r){return null!==r&&"object"==typeof r}function ir(r){return nr(r)&&(r._isBuffer||r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))}function or(){return/^\s*function\s*([^(]*)/i}P(nr,"isObjectLikeArray",function(r){if("function"!=typeof r)throw new TypeError(F("invalid argument. Must provide a function. Value: `%s`.",r));return function(e){var t,n;if(!tr(e))return!1;if(0===(t=e.length))return!1;for(n=0;n<t;n++)if(!1===r(e[n]))return!1;return!0}}(nr));var ar=/^\s*function\s*([^(]*)/i;function ur(r){var e,t,n;if(("Object"===(t=er(r).slice(8,-1))||"Error"===t)&&r.constructor){if("string"==typeof(n=r.constructor).name)return n.name;if(e=ar.exec(n.toString()))return e[1]}return ir(r)?"Buffer":t}P(or,"REGEXP",ar);var fr={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128"},lr="function"==typeof Float64Array,sr="function"==typeof Float64Array?Float64Array:null,cr="function"==typeof Float64Array?Float64Array:void 0,hr=function(){var r,e,t;if("function"!=typeof sr)return!1;try{e=new sr([1,3.14,-3.14,NaN]),t=e,r=(lr&&t instanceof Float64Array||"[object Float64Array]"===er(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}()?cr:function(){throw new Error("not implemented")},pr="function"==typeof Float32Array,mr=Number.POSITIVE_INFINITY,yr="function"==typeof Float32Array?Float32Array:null,gr="function"==typeof Float32Array?Float32Array:void 0,wr=function(){var r,e,t;if("function"!=typeof yr)return!1;try{e=new yr([1,3.14,-3.14,5e40]),t=e,r=(pr&&t instanceof Float32Array||"[object Float32Array]"===er(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===mr}catch(e){r=!1}return r}()?gr:function(){throw new Error("not implemented")},br="function"==typeof Uint32Array,vr="function"==typeof Uint32Array?Uint32Array:null,dr="function"==typeof Uint32Array?Uint32Array:void 0,Er=function(){var r,e,t;if("function"!=typeof vr)return!1;try{e=new vr(e=[1,3.14,-3.14,4294967296,4294967297]),t=e,r=(br&&t instanceof Uint32Array||"[object Uint32Array]"===er(t))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?dr:function(){throw new Error("not implemented")},_r="function"==typeof Int32Array,Tr="function"==typeof Int32Array?Int32Array:null,xr="function"==typeof Int32Array?Int32Array:void 0,Ar=function(){var r,e,t;if("function"!=typeof Tr)return!1;try{e=new Tr([1,3.14,-3.14,2147483648]),t=e,r=(_r&&t instanceof Int32Array||"[object Int32Array]"===er(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){r=!1}return r}()?xr:function(){throw new Error("not implemented")},Vr="function"==typeof Uint16Array,Sr="function"==typeof Uint16Array?Uint16Array:null,jr="function"==typeof Uint16Array?Uint16Array:void 0,Fr=function(){var r,e,t;if("function"!=typeof Sr)return!1;try{e=new Sr(e=[1,3.14,-3.14,65536,65537]),t=e,r=(Vr&&t instanceof Uint16Array||"[object Uint16Array]"===er(t))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?jr:function(){throw new Error("not implemented")},kr="function"==typeof Int16Array,Lr="function"==typeof Int16Array?Int16Array:null,Ir="function"==typeof Int16Array?Int16Array:void 0,Rr=function(){var r,e,t;if("function"!=typeof Lr)return!1;try{e=new Lr([1,3.14,-3.14,32768]),t=e,r=(kr&&t instanceof Int16Array||"[object Int16Array]"===er(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){r=!1}return r}()?Ir:function(){throw new Error("not implemented")},Br="function"==typeof Uint8Array,Or="function"==typeof Uint8Array?Uint8Array:null,Cr="function"==typeof Uint8Array?Uint8Array:void 0,Mr=function(){var r,e,t;if("function"!=typeof Or)return!1;try{e=new Or(e=[1,3.14,-3.14,256,257]),t=e,r=(Br&&t instanceof Uint8Array||"[object Uint8Array]"===er(t))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?Cr:function(){throw new Error("not implemented")},Pr="function"==typeof Uint8ClampedArray,Nr="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,Ur="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,Yr=function(){var r,e,t;if("function"!=typeof Nr)return!1;try{e=new Nr([-1,0,1,3.14,4.99,255,256]),t=e,r=(Pr&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===er(t))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){r=!1}return r}()?Ur:function(){throw new Error("not implemented")},Wr="function"==typeof Int8Array,$r="function"==typeof Int8Array?Int8Array:null,Gr="function"==typeof Int8Array?Int8Array:void 0,Zr=function(){var r,e,t;if("function"!=typeof $r)return!1;try{e=new $r([1,3.14,-3.14,128]),t=e,r=(Wr&&t instanceof Int8Array||"[object Int8Array]"===er(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){r=!1}return r}()?Gr:function(){throw new Error("not implemented")};function Jr(r){return"number"==typeof r}var Xr=Number,zr=Xr.prototype.toString,qr=q();function Dr(r){return"object"==typeof r&&(r instanceof Xr||(qr?function(r){try{return zr.call(r),!0}catch(r){return!1}}(r):"[object Number]"===er(r)))}function Hr(r){return Jr(r)||Dr(r)}P(Hr,"isPrimitive",Jr),P(Hr,"isObject",Dr);var Kr=Xr.NEGATIVE_INFINITY,Qr=Math.floor;function re(r){return Qr(r)===r}function ee(r){return r<mr&&r>Kr&&re(r)}function te(r){return Jr(r)&&ee(r)}function ne(r){return Dr(r)&&ee(r.valueOf())}function ie(r){return te(r)||ne(r)}function oe(r){return te(r)&&r>=0}function ae(r){return ne(r)&&r.valueOf()>=0}function ue(r){return oe(r)||ae(r)}P(ie,"isPrimitive",te),P(ie,"isObject",ne),P(ue,"isPrimitive",oe),P(ue,"isObject",ae);var fe=4294967295;function le(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&re(r.length)&&r.length>=0&&r.length<=fe}var se=9007199254740991;function ce(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&re(r.length)&&r.length>=0&&r.length<=se}var he="function"==typeof ArrayBuffer;function pe(r){return he&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===er(r)}function me(r){return"object"==typeof r&&null!==r&&!tr(r)}function ye(r){return"string"==typeof r}var ge=String.prototype.valueOf,we=q();function be(r){return"object"==typeof r&&(r instanceof String||(we?function(r){try{return ge.call(r),!0}catch(r){return!1}}(r):"[object String]"===er(r)))}function ve(r){return ye(r)||be(r)}P(ve,"isPrimitive",ye),P(ve,"isObject",be);var de=/./;function Ee(r){return"boolean"==typeof r}var _e=Boolean,Te=Boolean.prototype.toString,xe=q();function Ae(r){return"object"==typeof r&&(r instanceof _e||(xe?function(r){try{return Te.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===er(r)))}function Ve(r){return Ee(r)||Ae(r)}P(Ve,"isPrimitive",Ee),P(Ve,"isObject",Ae);var Se="object"==typeof self?self:null,je="object"==typeof window?window:null,Fe="object"==typeof globalThis?globalThis:null,ke=function(r){if(arguments.length){if(!Ee(r))throw new TypeError(F("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(Fe)return Fe;if(Se)return Se;if(je)return je;throw new Error("unexpected error. Unable to resolve global object.")}(),Le=ke.document&&ke.document.childNodes,Ie=Int8Array,Re="function"==typeof de||"object"==typeof Ie||"function"==typeof Le?function(r){return ur(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"==(e=typeof r)?ur(r).toLowerCase():e};function Be(r){return"function"===Re(r)}function Oe(r,e){if(!(this instanceof Oe))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Jr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Jr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}P(Oe,"BYTES_PER_ELEMENT",8),P(Oe.prototype,"BYTES_PER_ELEMENT",8),P(Oe.prototype,"byteLength",16),P(Oe.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(Oe.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Ce="function"==typeof Math.fround?Math.fround:null,Me=new wr(1),Pe="function"==typeof Ce?Ce:function(r){return Me[0]=r,Me[0]};function Ne(r,e){if(!(this instanceof Ne))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Jr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Jr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Pe(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Pe(e)}),this}function Ue(r){return r instanceof Oe||r instanceof Ne||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function Ye(r){return re(r/2)}P(Ne,"BYTES_PER_ELEMENT",4),P(Ne.prototype,"BYTES_PER_ELEMENT",4),P(Ne.prototype,"byteLength",8),P(Ne.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(Ne.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var We=8;function $e(r){return"object"==typeof r&&null!==r&&"Complex64Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===We}var Ge=16;function Ze(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===Ge}function Je(){return"function"==typeof Q&&"symbol"==typeof Q("foo")&&K(Q,"iterator")&&"symbol"==typeof Q.iterator}var Xe=Je()?Symbol.iterator:null;function ze(r,e,t){M(r,e,{configurable:!1,enumerable:!1,get:t})}function qe(r,e){if(!(this instanceof qe))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Jr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Jr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Pe(r)}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Pe(e)}),this}function De(r){return r.re}function He(r){return r.im}function Ke(r,e){return new wr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function Qe(r,e){return new hr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function rt(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(le(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Ue(n))return new TypeError(F("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(De(n),He(n))}return e}P(qe,"BYTES_PER_ELEMENT",4),P(qe.prototype,"BYTES_PER_ELEMENT",4),P(qe.prototype,"byteLength",8),P(qe.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(qe.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var et=2*wr.BYTES_PER_ELEMENT,tt=Je();function nt(r){return r instanceof at||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function it(r){return r===at||"Complex128Array"===r.name}function ot(r,e){return new qe(r[e*=2],r[e+1])}function at(){var r,e,t,n;if(e=arguments.length,!(this instanceof at))return 0===e?new at:1===e?new at(arguments[0]):2===e?new at(arguments[0],arguments[1]):new at(arguments[0],arguments[1],arguments[2]);if(0===e)t=new wr(0);else if(1===e)if(oe(arguments[0]))t=new wr(2*arguments[0]);else if(ce(arguments[0]))if((n=(t=arguments[0]).length)&&tr(t)&&Ue(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!Ue(n=e[i]))return null;r[o]=De(n),r[o+1]=He(n),o+=2}return r}(new wr(2*n),t),null===t){if(!Ye(n))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new wr(arguments[0])}}else{if($e(t))t=Ke(t,0);else if(Ze(t))t=Qe(t,0);else if(!Ye(n))throw new RangeError(F("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new wr(t)}else if(pe(arguments[0])){if(!re((t=arguments[0]).byteLength/et))throw new RangeError(F("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",et,t.byteLength));t=new wr(t)}else{if(!me(arguments[0]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===tt)throw new TypeError(F("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!Be(t[Xe]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!Be((t=t[Xe]()).next))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=rt(t))instanceof Error)throw t;t=new wr(t)}else{if(!pe(t=arguments[0]))throw new TypeError(F("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!oe(r=arguments[1]))throw new TypeError(F("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!re(r/et))throw new RangeError(F("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",et,r));if(2===e){if(!re((n=t.byteLength-r)/et))throw new RangeError(F("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",et,n));t=new wr(t,r)}else{if(!oe(n=arguments[2]))throw new TypeError(F("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*et>t.byteLength-r)throw new RangeError(F("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*et));t=new wr(t,r,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}function ut(r,e){if(!(this instanceof ut))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!Jr(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!Jr(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return M(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),M(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}function ft(r){return r.re}function lt(r){return r.im}function st(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(le(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Ue(n))return new TypeError(F("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));e.push(ft(n),lt(n))}return e}P(at,"BYTES_PER_ELEMENT",et),P(at,"name","Complex64Array"),P(at,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,c,h;if(!Be(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!it(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Be(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(nt(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Ue(s=n.call(e,r.get(c),c)))o[h]=De(s),o[h+1]=He(s);else{if(!(le(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(ce(r)){if(n){for(f=r.length,u=r.get&&r.set?Z("default"):Y("default"),c=0;c<f;c++)if(!Ue(u(r,c))){l=!0;break}if(l){if(!Ye(f))throw new RangeError(F("invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.",2,f));for(o=(i=new this(f/2))._buffer,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Ue(s=n.call(e,u(r,c),c)))o[h]=De(s),o[h+1]=He(s);else{if(!(le(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(me(r)&&tt&&Be(r[Xe])){if(!Be((o=r[Xe]()).next))throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,le(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Ue(o))return new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(De(o),He(o))}return n}(o,n,e):rt(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),P(at,"of",(function(){var r,e;if(!Be(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!it(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),P(at.prototype,"at",(function(r){if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!re(r))throw new TypeError(F("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return ot(this._buffer,r)})),ze(at.prototype,"buffer",(function(){return this._buffer.buffer})),ze(at.prototype,"byteLength",(function(){return this._buffer.byteLength})),ze(at.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(at.prototype,"BYTES_PER_ELEMENT",at.BYTES_PER_ELEMENT),P(at.prototype,"copyWithin",(function(r,e){if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),P(at.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,P(t={},"next",(function(){var e;return o+=1,i||o>=n?{done:!0}:(e=new qe(r[a+=2],r[a+1]),{value:[o,e],done:!1})})),P(t,"return",(function(r){return i=!0,arguments.length?{value:r,done:!0}:{done:!0}})),Xe&&P(t,Xe,(function(){return e.entries()})),t})),P(at.prototype,"every",(function(r,e){var t,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,ot(t,n),n,this))return!1;return!0})),P(at.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!re(t))throw new TypeError(F("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=De(r),u=He(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),P(at.prototype,"filter",(function(r,e){var t,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=ot(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),P(at.prototype,"find",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=ot(t,n),r.call(e,i,n,this))return i})),P(at.prototype,"findIndex",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=ot(t,n),r.call(e,i,n,this))return n;return-1})),P(at.prototype,"findLast",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=ot(t,n),r.call(e,i,n,this))return i})),P(at.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=ot(t,n),r.call(e,i,n,this))return n;return-1})),P(at.prototype,"forEach",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=ot(t,n),r.call(e,i,n,this)})),P(at.prototype,"get",(function(r){if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!oe(r))throw new TypeError(F("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return ot(this._buffer,r)})),P(at.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=De(r),o=He(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),P(at.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=De(r),o=He(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(at.prototype,"join",(function(r){var e,t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!ye(r))throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(ot(t,i).toString());return e.join(n)})),P(at.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=De(r),o=He(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),ze(at.prototype,"length",(function(){return this._length})),P(at.prototype,"map",(function(r,e){var t,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Ue(a=r.call(e,ot(n,o),o,this)))t[2*o]=De(a),t[2*o+1]=He(a);else{if(!le(a)||2!==a.length)throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),P(at.prototype,"reduce",(function(r,e){var t,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,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=ot(t,0),o=1}for(;o<i;o++)n=r(n,ot(t,o),o,this);return n})),P(at.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=Qr(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),P(at.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,l;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!oe(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Ue(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=De(r),void(n[t+1]=He(r))}if(nt(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,l=n.byteOffset+t*et,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new wr(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2}else{if(!ce(r))throw new TypeError(F("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!Ue(r[f])){o=!0;break}if(o){if(!Ye(a))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*et,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new wr(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=De(u),n[t+1]=He(u),t+=2}})),P(at.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),P(at.prototype,"some",(function(r,e){var t,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,ot(t,n),n,this))return!0;return!1})),P(at.prototype,"subarray",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*et):(i=e-r,t=n.byteOffset+r*et),new this.constructor(n.buffer,t,i<0?0:i)})),P(at.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),P(at.prototype,"toString",(function(){var r,e,t;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(ot(e,t).toString());return r.join(",")})),P(at.prototype,"with",(function(r,e){var t,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Ue(e))throw new TypeError(F("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=De(e),t[2*r+1]=He(e),n})),P(ut,"BYTES_PER_ELEMENT",8),P(ut.prototype,"BYTES_PER_ELEMENT",8),P(ut.prototype,"byteLength",16),P(ut.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),P(ut.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var ct=2*hr.BYTES_PER_ELEMENT,ht=Je();function pt(r){return r instanceof gt||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function mt(r){return r===gt||"Complex64Array"===r.name}function yt(r,e){return new ut(r[e*=2],r[e+1])}function gt(){var r,e,t,n;if(e=arguments.length,!(this instanceof gt))return 0===e?new gt:1===e?new gt(arguments[0]):2===e?new gt(arguments[0],arguments[1]):new gt(arguments[0],arguments[1],arguments[2]);if(0===e)t=new hr(0);else if(1===e)if(oe(arguments[0]))t=new hr(2*arguments[0]);else if(ce(arguments[0]))if((n=(t=arguments[0]).length)&&tr(t)&&Ue(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;i<t;i++){if(!Ue(n=e[i]))return null;r[o]=ft(n),r[o+1]=lt(n),o+=2}return r}(new hr(2*n),t),null===t){if(!Ye(n))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new hr(arguments[0])}}else{if($e(t))t=Ke(t,0);else if(Ze(t))t=Qe(t,0);else if(!Ye(n))throw new RangeError(F("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));t=new hr(t)}else if(pe(arguments[0])){if(!re((t=arguments[0]).byteLength/ct))throw new RangeError(F("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",ct,t.byteLength));t=new hr(t)}else{if(!me(arguments[0]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(t=arguments[0],!1===ht)throw new TypeError(F("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",t));if(!Be(t[Xe]))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if(!Be((t=t[Xe]()).next))throw new TypeError(F("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",t));if((t=st(t))instanceof Error)throw t;t=new hr(t)}else{if(!pe(t=arguments[0]))throw new TypeError(F("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",t));if(!oe(r=arguments[1]))throw new TypeError(F("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",r));if(!re(r/ct))throw new RangeError(F("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",ct,r));if(2===e){if(!re((n=t.byteLength-r)/ct))throw new RangeError(F("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",ct,n));t=new hr(t,r)}else{if(!oe(n=arguments[2]))throw new TypeError(F("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*ct>t.byteLength-r)throw new RangeError(F("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*ct));t=new hr(t,r,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}P(gt,"BYTES_PER_ELEMENT",ct),P(gt,"name","Complex128Array"),P(gt,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,c,h;if(!Be(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Be(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(pt(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Ue(s=n.call(e,r.get(c),c)))o[h]=ft(s),o[h+1]=lt(s);else{if(!(le(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(ce(r)){if(n){for(f=r.length,u=r.get&&r.set?Z("default"):Y("default"),c=0;c<f;c++)if(!Ue(u(r,c))){l=!0;break}if(l){if(!Ye(f))throw new RangeError(F("invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.",f));for(o=(i=new this(f/2))._buffer,c=0;c<f;c++)o[c]=n.call(e,u(r,c),c);return i}for(o=(i=new this(f))._buffer,h=0,c=0;c<f;c++){if(Ue(s=n.call(e,u(r,c),c)))o[h]=ft(s),o[h+1]=lt(s);else{if(!(le(s)&&s.length>=2))throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",s));o[h]=s[0],o[h+1]=s[1]}h+=2}return i}return new this(r)}if(me(r)&&ht&&Be(r[Xe])){if(!Be((o=r[Xe]()).next))throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(a=n?function(r,e,t){var n,i,o,a;for(n=[],a=-1;!(i=r.next()).done;)if(a+=1,le(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Ue(o))return new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(ft(o),lt(o))}return n}(o,n,e):st(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,c=0;c<f;c++)o[c]=a[c];return i}throw new TypeError(F("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))})),P(gt,"of",(function(){var r,e;if(!Be(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!mt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),P(gt.prototype,"at",(function(r){if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!re(r))throw new TypeError(F("invalid argument. Must provide an integer. Value: `%s`.",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return yt(this._buffer,r)})),ze(gt.prototype,"buffer",(function(){return this._buffer.buffer})),ze(gt.prototype,"byteLength",(function(){return this._buffer.byteLength})),ze(gt.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(gt.prototype,"BYTES_PER_ELEMENT",gt.BYTES_PER_ELEMENT),P(gt.prototype,"copyWithin",(function(r,e){if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),P(gt.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,r=this._buffer,n=this._length,o=-1,a=-2,P(t={},"next",(function(){var e;return o+=1,i||o>=n?{done:!0}:(e=new ut(r[a+=2],r[a+1]),{value:[o,e],done:!1})})),P(t,"return",(function(r){return i=!0,arguments.length?{value:r,done:!0}:{done:!0}})),Xe&&P(t,Xe,(function(){return e.entries()})),t})),P(gt.prototype,"every",(function(r,e){var t,n;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,yt(t,n),n,this))return!1;return!0})),P(gt.prototype,"fill",(function(r,e,t){var n,i,o,a,u,f;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(n=this._buffer,i=this._length,arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!re(t))throw new TypeError(F("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else e=0,t=i;for(a=ft(r),u=lt(r),f=e;f<t;f++)n[o=2*f]=a,n[o+1]=u;return this})),P(gt.prototype,"filter",(function(r,e){var t,n,i,o;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=[],i=0;i<this._length;i++)o=yt(t,i),r.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),P(gt.prototype,"find",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=yt(t,n),r.call(e,i,n,this))return i})),P(gt.prototype,"findIndex",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(i=yt(t,n),r.call(e,i,n,this))return n;return-1})),P(gt.prototype,"findLast",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=yt(t,n),r.call(e,i,n,this))return i})),P(gt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=yt(t,n),r.call(e,i,n,this))return n;return-1})),P(gt.prototype,"forEach",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)i=yt(t,n),r.call(e,i,n,this)})),P(gt.prototype,"get",(function(r){if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!oe(r))throw new TypeError(F("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return yt(this._buffer,r)})),ze(gt.prototype,"length",(function(){return this._length})),P(gt.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=ft(r),o=lt(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return!0;return!1})),P(gt.prototype,"indexOf",(function(r,e){var t,n,i,o,a;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=ft(r),o=lt(r),t=this._buffer,a=e;a<this._length;a++)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(gt.prototype,"join",(function(r){var e,t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!ve(r))throw new TypeError(F("invalid argument. First argument must be a string. Value: `%s`.",r));n=r}for(e=[],t=this._buffer,i=0;i<this._length;i++)e.push(yt(t,i).toString());return e.join(n)})),P(gt.prototype,"lastIndexOf",(function(r,e){var t,n,i,o,a;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ue(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(i=ft(r),o=lt(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(gt.prototype,"map",(function(r,e){var t,n,i,o,a;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if(Ue(a=r.call(e,yt(n,o),o,this)))t[2*o]=ft(a),t[2*o+1]=lt(a);else{if(!le(a)||2!==a.length)throw new TypeError(F("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",a));t[2*o]=a[0],t[2*o+1]=a[1]}return i})),P(gt.prototype,"reduce",(function(r,e){var t,n,i,o;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));if(t=this._buffer,i=this._length,arguments.length>1)n=e,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=yt(t,0),o=1}for(;o<i;o++)n=r(n,yt(t,o),o,this);return n})),P(gt.prototype,"reverse",(function(){var r,e,t,n,i,o;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,r=this._buffer,n=Qr(t/2),i=0;i<n;i++)o=t-i-1,e=r[2*i],r[2*i]=r[2*o],r[2*o]=e,e=r[2*i+1],r[2*i+1]=r[2*o+1],r[2*o+1]=e;return this})),P(gt.prototype,"set",(function(r){var e,t,n,i,o,a,u,f,l;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!oe(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Ue(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=ft(r),void(n[t+1]=lt(r))}if(pt(r)){if(t+(a=r._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r._buffer,l=n.byteOffset+t*ct,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new hr(e.length),f=0;f<e.length;f++)i[f]=e[f];e=i}for(t*=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2}else{if(!ce(r))throw new TypeError(F("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",r));for(a=r.length,f=0;f<a;f++)if(!Ue(r[f])){o=!0;break}if(o){if(!Ye(a))throw new RangeError(F("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(t+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*ct,e.buffer===n.buffer&&e.byteOffset<l&&e.byteOffset+e.byteLength>l){for(i=new hr(a),f=0;f<a;f++)i[f]=e[f];e=i}for(t*=2,a/=2,l=0,f=0;f<a;f++)n[t]=e[l],n[t+1]=e[l+1],t+=2,l+=2;return}if(t+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;f<a;f++)u=r[f],n[t]=ft(u),n[t+1]=lt(u),t+=2}})),P(gt.prototype,"slice",(function(r,e){var t,n,i,o,a,u,f;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(i=new this.constructor(t))._buffer,f=0;f<t;f++)o=2*(f+r),n[2*f]=a[o],n[2*f+1]=a[o+1];return i})),P(gt.prototype,"some",(function(r,e){var t,n;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Be(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,yt(t,n),n,this))return!0;return!1})),P(gt.prototype,"subarray",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)r=0,e=i;else{if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),1===arguments.length)e=i;else{if(!re(e))throw new TypeError(F("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*ct):(i=e-r,t=n.byteOffset+r*ct),new this.constructor(n.buffer,t,i<0?0:i)})),P(gt.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;i<t;i++)o=t-i-1,r[2*i]=n[2*o],r[2*i+1]=n[2*o+1];return e})),P(gt.prototype,"toString",(function(){var r,e,t;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(yt(e,t).toString());return r.join(",")})),P(gt.prototype,"with",(function(r,e){var t,n,i;if(!pt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!re(r))throw new TypeError(F("invalid argument. First argument must be an integer. Value: `%s`.",r));if(i=this._length,r<0&&(r+=i),r<0||r>=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Ue(e))throw new TypeError(F("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=ft(e),t[2*r+1]=lt(e),n}));var wt=[hr,wr,Ar,Er,Rr,Fr,Zr,Mr,Yr,at,gt],bt=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],vt=bt.length;function dt(r){var e,t=function(r){var e;if(tr(r))return"generic";if(ir(r))return null;for(e=0;e<vt;e++)if(r instanceof wt[e])return bt[e];return fr[ur(r)]||null}(r);return typeof(e=r).get===N&&typeof e.set===N?{data:r,dtype:t,accessorProtocol:!0,accessors:[Z(t),X(t)]}:{data:r,dtype:t,accessorProtocol:!1,accessors:[Y(t),$(t)]}}function Et(r,e,t,n,i,o,a){var u,f,l,s,c,h,p,m;for(u=e.data,f=i.data,s=e.accessors[0],l=i.accessors[1],h=n,p=a,m=0;m<r;m++)c=s(u,h),l(u,h,s(f,p)),l(f,p,c),h+=t,p+=o;return e}function _t(r,e,t,n,i){var o,a,u,f,l,s,c,h;if(r<=0)return n;if(f=dt(e),l=dt(n),f.accessorProtocol||l.accessorProtocol)return Et(r,f,t,a=t<0?(1-r)*t:0,l,i,u=i<0?(1-r)*i:0),l.data;if(1===t&&1===i){if((s=r%3)>0)for(c=0;c<s;c++)o=e[c],e[c]=n[c],n[c]=o;if(r<3)return n;for(c=s;c<r;c+=3)o=e[c],e[c]=n[c],n[c]=o,o=e[h=c+1],e[h]=n[h],n[h]=o,o=e[h+=1],e[h]=n[h],n[h]=o;return n}for(a=t<0?(1-r)*t:0,u=i<0?(1-r)*i:0,c=0;c<r;c++)o=e[a],e[a]=n[u],n[u]=o,a+=t,u+=i;return n}return P(_t,"ndarray",(function(r,e,t,n,i,o,a){var u,f,l,s,c,h,p;if(r<=0)return i;if(s=dt(e),c=dt(i),s.accessorProtocol||c.accessorProtocol)return Et(r,s,t,n,c,o,a),c.data;if(f=n,l=a,1===t&&1===o){if((h=r%3)>0)for(p=0;p<h;p++)u=e[f],e[f]=i[l],i[l]=u,f+=t,l+=o;if(r<3)return i;for(p=h;p<r;p+=3)u=e[f],e[f]=i[l],i[l]=u,u=e[f+1],e[f+1]=i[l+1],i[l+1]=u,u=e[f+2],e[f+2]=i[l+2],i[l+2]=u,f+=3,l+=3;return i}for(p=0;p<r;p++)u=e[f],e[f]=i[l],i[l]=u,f+=t,l+=o;return i})),_t},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).gswap=e();
//# sourceMappingURL=browser.js.map