// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 var t,r;t=this,r=function(){"use strict";var t="function"==typeof Object.defineProperty?Object.defineProperty:null,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,d,"$1e"),n=h.call(n,w,"e"),n=h.call(n,g,""));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,y,"$1."),n=h.call(n,m,"$1.e")),i>=0&&t.sign&&(n=t.sign+n),n=t.specifier===l.call(t.specifier)?l.call(n):s.call(n)}function v(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=b(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=i(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(c=n.arg,p=n.width,y=n.padRight,m=void 0,(m=p-c.length)<0?c:c=y?c+v(m):v(m)+c)),f+=n.arg||"",s+=1}return f}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(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=V.exec(t);n;)(r=t.slice(i,V.lastIndex-n[0].length)).length&&e.push(r),e.push(j(n)),i=V.lastIndex,n=V.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function S(t){var r,e;if("string"!=typeof t)throw new TypeError(S("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 ft(t,r){return r&&(2===t||3===t)}function st(t,r){return r&&(1===t||3===t)}function lt(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 ht(t){return t.re}function ct(t){return t.im}function pt(t){return"string"==typeof t}N(lt,"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 yt=String.prototype.valueOf,mt=Y();function gt(t){return"object"==typeof t&&(t instanceof String||(mt?function(t){try{return yt.call(t),!0}catch(t){return!1}}(t):"[object String]"===z(t)))}function wt(t){return pt(t)||gt(t)}N(wt,"isPrimitive",pt),N(wt,"isObject",gt);var dt=/[-\/\\^$*+?.()|[\]{}]/g,bt=/./,vt=et(),_t=vt.document&&vt.document.childNodes,Et=Int8Array;function Tt(){return/^\s*function\s*([^(]*)/i}var xt=/^\s*function\s*([^(]*)/i;N(Tt,"REGEXP",xt);var At=Array.isArray?Array.isArray:function(t){return"[object Array]"===z(t)};function Vt(t){return null!==t&&"object"==typeof t}var jt=function(t){if("function"!=typeof t)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",t));return function(r){var e,n;if(!At(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(dt,"\\$&"):(r=(r=t.substring(1,e)).replace(dt,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!Mt(r))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!pt(e)&&!Rt(e))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return Ut(t,r,e)}var kt,Nt={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}} ] )"},Ct="function"==typeof Uint8Array,Pt="function"==typeof Uint8Array?Uint8Array:null,Yt="function"==typeof Uint8Array?Uint8Array:void 0;kt=function(){var t,r,e;if("function"!=typeof Pt)return!1;try{r=new Pt(r=[1,3.14,-3.14,256,257]),e=r,t=(Ct&&e instanceof Uint8Array||"[object Uint8Array]"===z(e))&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}()?Yt:function(){throw new Error("not implemented")};var Wt,Dt=kt,Gt="function"==typeof Uint16Array,Jt="function"==typeof Uint16Array?Uint16Array:null,$t="function"==typeof Uint16Array?Uint16Array:void 0;Wt=function(){var t,r,e;if("function"!=typeof Jt)return!1;try{r=new Jt(r=[1,3.14,-3.14,65536,65537]),e=r,t=(Gt&&e instanceof Uint16Array||"[object Uint16Array]"===z(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 zt,Xt=Wt,Zt={uint16:Xt,uint8:Dt};(zt=new Zt.uint16(1))[0]=4660;var Ht=52===new Zt.uint8(zt.buffer)[0],qt="function"==typeof ArrayBuffer;function Kt(t){return qt&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===z(t)}var Qt,tr="function"==typeof Float64Array,rr="function"==typeof Float64Array?Float64Array:null,er="function"==typeof Float64Array?Float64Array:void 0;Qt=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]"===z(e))&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}()?er:function(){throw new Error("not implemented")};var nr,ir=Qt,or="function"==typeof ArrayBuffer?ArrayBuffer:null,ar="function"==typeof ArrayBuffer?ArrayBuffer:void 0;nr=function(){var t,r,e;if("function"!=typeof or)return!1;try{(t=Kt(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}()?ar:function(){throw new Error("not implemented")};var ur,fr=nr,sr="function"==typeof DataView,lr="function"==typeof DataView?DataView:null,hr="function"==typeof DataView?DataView:void 0;ur=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]"===z(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}()?hr:function(){throw new Error("not implemented")};var cr=ur,pr="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 gr(){var t,r,e;return 0===arguments.length?yr.all.slice():(e=!1,t=arguments[0],mr.test(t)&&"all"!==(t=Ut(t,mr,""))&&(e=!0),r=(r=yr[t])?r.slice():[],e&&r.length>0&&r.push("generic"),r)}function wr(){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){k(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function br(t){return Object.keys(Object(t))}var vr,_r=void 0!==Object.keys;function Er(t){return"[object Arguments]"===z(t)}vr=function(){return Er(arguments)}();var Tr=vr;function xr(t){return"number"==typeof t}var Ar=Number,Vr=Ar.prototype.toString,jr=Y();function Or(t){return"object"==typeof t&&(t instanceof Ar||(jr?function(t){try{return Vr.call(t),!0}catch(t){return!1}}(t):"[object Number]"===z(t)))}function Sr(t){return xr(t)||Or(t)}function Ir(t){return t!=t}function Rr(t){return xr(t)&&Ir(t)}function Lr(t){return Or(t)&&Ir(t.valueOf())}function Fr(t){return Rr(t)||Lr(t)}N(Sr,"isPrimitive",xr),N(Sr,"isObject",Or),N(Fr,"isPrimitive",Rr),N(Fr,"isObject",Lr);var Mr=Number.POSITIVE_INFINITY,Ur=Ar.NEGATIVE_INFINITY,Br=Math.floor;function kr(t){return Br(t)===t}function Nr(t){return tUr&&kr(t)}function Cr(t){return xr(t)&&Nr(t)}function Pr(t){return Or(t)&&Nr(t.valueOf())}function Yr(t){return Cr(t)||Pr(t)}N(Yr,"isPrimitive",Cr),N(Yr,"isObject",Pr);var Wr=Object.prototype.propertyIsEnumerable,Dr=!Wr.call("beep","0");function Gr(t,r){var e;return null!=t&&(!(e=Wr.call(t,r))&&Dr&&wt(t)?!Rr(r=+r)&&Cr(r)&&r>=0&&r=0&&t.length<=Jr&&G(t,"callee")&&!Gr(t,"callee")},zr=Array.prototype.slice,Xr=Gr((function(){}),"prototype"),Zr=!Gr({toString:null},"toString"),Hr=9007199254740991;function qr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&kr(t.length)&&t.length>=0&&t.length<=Hr}function Kr(t,r,e){var n,i;if(!qr(t)&&!pt(t))throw new TypeError(S("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(!Cr(e))throw new TypeError(S("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(Fr(r)){for(;i0&&!G(t,"0"))for(u=0;u>>0,i=Br(t/be),Ht?(_e.setUint32(0,o,Ht),_e.setUint32(4,i,Ht)):(_e.setUint32(0,i,Ht),_e.setUint32(4,o,Ht)),a=0;a>>0,n=Br(t/4294967296),e=new cr(r.buffer),Ht?(e.setUint32(0,i,Ht),e.setUint32(4,n,Ht)):(e.setUint32(0,n,Ht),e.setUint32(4,i,Ht))),r}),"assign",Ee);var Te={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},xe=ce(),Ae={throw:1,clamp:2,wrap:3,normalize:4};function Ve(t,r,e,n,i,o){var a,u,f,s,l;if(!(this instanceof Ve))return new Ve(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]})),N(Ve.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})),N(Ve.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+=ht(i=this.iget(this._length-1-o))+", "+ct(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=Bt(Nt[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;o=0}function mn(t){return Pr(t)&&t.valueOf()>=0}function gn(t){return yn(t)||mn(t)}N(gn,"isPrimitive",yn),N(gn,"isObject",mn);var wn=4294967295;function dn(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&kr(t.length)&&t.length>=0&&t.length<=wn}function bn(t){return"object"==typeof t&&null!==t&&!At(t)}function vn(t,r){if(!(this instanceof vn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!xr(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!xr(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}N(vn,"BYTES_PER_ELEMENT",8),N(vn.prototype,"BYTES_PER_ELEMENT",8),N(vn.prototype,"byteLength",16),N(vn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(vn.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var _n="function"==typeof Math.fround?Math.fround:null,En=new We(1),Tn="function"==typeof _n?_n:function(t){return En[0]=t,En[0]};function xn(t,r){if(!(this instanceof xn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!xr(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!xr(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Tn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Tn(r)}),this}function An(t){return t instanceof vn||t instanceof xn||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function Vn(t){return kr(t/2)}N(xn,"BYTES_PER_ELEMENT",4),N(xn.prototype,"BYTES_PER_ELEMENT",4),N(xn.prototype,"byteLength",8),N(xn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(xn.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var jn=8;function On(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===jn}var Sn=16;function In(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Sn}function Rn(){return"function"==typeof J&&"symbol"==typeof J("foo")&&G(J,"iterator")&&"symbol"==typeof J.iterator}var Ln=Rn()?Symbol.iterator:null;function Fn(t,r){if(!(this instanceof Fn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!xr(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!xr(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Tn(t)}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Tn(r)}),this}function Mn(t){return t.re}function Un(t){return t.im}function Bn(t,r){return new We(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function kn(t,r){return new ir(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function Nn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(dn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!An(n))return new TypeError(S("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(Mn(n),Un(n))}return r}N(Fn,"BYTES_PER_ELEMENT",4),N(Fn.prototype,"BYTES_PER_ELEMENT",4),N(Fn.prototype,"byteLength",8),N(Fn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(Fn.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Cn=2*We.BYTES_PER_ELEMENT,Pn=Rn();function Yn(t){return t instanceof Gn||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Wn(t){return t===Gn||"Complex128Array"===t.name}function Dn(t,r){return new Fn(t[r*=2],t[r+1])}function Gn(){var t,r,e,n;if(r=arguments.length,!(this instanceof Gn))return 0===r?new Gn:1===r?new Gn(arguments[0]):2===r?new Gn(arguments[0],arguments[1]):new Gn(arguments[0],arguments[1],arguments[2]);if(0===r)e=new We(0);else if(1===r)if(yn(arguments[0]))e=new We(2*arguments[0]);else if(qr(arguments[0]))if((n=(e=arguments[0]).length)&&At(e)&&An(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(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Cn));e=new We(e,t,2*n)}}return N(this,"_buffer",e),N(this,"_length",e.length/2),this}function Jn(t,r){if(!(this instanceof Jn))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!xr(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!xr(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return k(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),k(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}function $n(t){return t.re}function zn(t){return t.im}function Xn(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(dn(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!An(n))return new TypeError(S("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($n(n),zn(n))}return r}N(Gn,"BYTES_PER_ELEMENT",Cn),N(Gn,"name","Complex64Array"),N(Gn,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Rt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Wn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Rt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Yn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(S("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?Fe("default"):Se("default"),h=0;h=2))throw new TypeError(S("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(bn(t)&&Pn&&Rt(t[Ln])){if(!Rt((o=t[Ln]()).next))throw new TypeError(S("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,dn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!An(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(Mn(o),Un(o))}return n}(o,n,r):Nn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Dn(this._buffer,t)})),it(Gn.prototype,"buffer",(function(){return this._buffer.buffer})),it(Gn.prototype,"byteLength",(function(){return this._buffer.byteLength})),it(Gn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(Gn.prototype,"BYTES_PER_ELEMENT",Gn.BYTES_PER_ELEMENT),N(Gn.prototype,"copyWithin",(function(t,r){if(!Yn(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})),N(Gn.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Yn(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,N(e={},"next",(function(){var r;return o+=1,i||o>=n?{done:!0}:(r=new Fn(t[a+=2],t[a+1]),{value:[o,r],done:!1})})),N(e,"return",(function(t){return i=!0,arguments.length?{value:t,done:!0}:{done:!0}})),Ln&&N(e,Ln,(function(){return r.entries()})),e})),N(Gn.prototype,"every",(function(t,r){var e,n;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!kr(e))throw new TypeError(S("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=Mn(t),u=Un(t),f=r;f=0;n--)if(i=Dn(e,n),t.call(r,i,n,this))return i})),N(Gn.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Dn(e,n),t.call(r,i,n,this))return n;return-1})),N(Gn.prototype,"forEach",(function(t,r){var e,n,i;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return Dn(this._buffer,t)})),N(Gn.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!An(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Mn(t),o=Un(t),e=this._buffer,a=r;a1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Mn(t),o=Un(t),e=this._buffer,a=r;a1){if(!kr(r))throw new TypeError(S("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=Mn(t),o=Un(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),it(Gn.prototype,"length",(function(){return this._length})),N(Gn.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Yn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("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=Dn(e,0),o=1}for(;o1){if(!yn(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(An(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Mn(t),void(n[e+1]=Un(t))}if(Yn(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*Cn,r.buffer===n.buffer&&r.byteOffsets){for(i=new We(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*Cn,r.buffer===n.buffer&&r.byteOffsets){for(i=new We(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*Cn):(i=r-t,e=n.byteOffset+t*Cn),new this.constructor(n.buffer,e,i<0?0:i)})),N(Gn.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Yn(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(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!An(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=Mn(r),e[2*t+1]=Un(r),n})),N(Jn,"BYTES_PER_ELEMENT",8),N(Jn.prototype,"BYTES_PER_ELEMENT",8),N(Jn.prototype,"byteLength",16),N(Jn.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(Jn.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Zn=2*ir.BYTES_PER_ELEMENT,Hn=Rn();function qn(t){return t instanceof ti||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Kn(t){return t===ti||"Complex64Array"===t.name}function Qn(t,r){return new Jn(t[r*=2],t[r+1])}function ti(){var t,r,e,n;if(r=arguments.length,!(this instanceof ti))return 0===r?new ti:1===r?new ti(arguments[0]):2===r?new ti(arguments[0],arguments[1]):new ti(arguments[0],arguments[1],arguments[2]);if(0===r)e=new ir(0);else if(1===r)if(yn(arguments[0]))e=new ir(2*arguments[0]);else if(qr(arguments[0]))if((n=(e=arguments[0]).length)&&At(e)&&An(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(S("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Zn));e=new ir(e,t,2*n)}}return N(this,"_buffer",e),N(this,"_length",e.length/2),this}N(ti,"BYTES_PER_ELEMENT",Zn),N(ti,"name","Complex128Array"),N(ti,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Rt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Kn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Rt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(qn(t)){if(f=t.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=2))throw new TypeError(S("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?Fe("default"):Se("default"),h=0;h=2))throw new TypeError(S("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(bn(t)&&Hn&&Rt(t[Ln])){if(!Rt((o=t[Ln]()).next))throw new TypeError(S("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,dn(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!An(o))return new TypeError(S("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push($n(o),zn(o))}return n}(o,n,r):Xn(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Qn(this._buffer,t)})),it(ti.prototype,"buffer",(function(){return this._buffer.buffer})),it(ti.prototype,"byteLength",(function(){return this._buffer.byteLength})),it(ti.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(ti.prototype,"BYTES_PER_ELEMENT",ti.BYTES_PER_ELEMENT),N(ti.prototype,"copyWithin",(function(t,r){if(!qn(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})),N(ti.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!qn(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,N(e={},"next",(function(){var r;return o+=1,i||o>=n?{done:!0}:(r=new Jn(t[a+=2],t[a+1]),{value:[o,r],done:!1})})),N(e,"return",(function(t){return i=!0,arguments.length?{value:t,done:!0}:{done:!0}})),Ln&&N(e,Ln,(function(){return r.entries()})),e})),N(ti.prototype,"every",(function(t,r){var e,n;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!kr(e))throw new TypeError(S("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=$n(t),u=zn(t),f=r;f=0;n--)if(i=Qn(e,n),t.call(r,i,n,this))return i})),N(ti.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Qn(e,n),t.call(r,i,n,this))return n;return-1})),N(ti.prototype,"forEach",(function(t,r){var e,n,i;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return Qn(this._buffer,t)})),it(ti.prototype,"length",(function(){return this._length})),N(ti.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!An(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=$n(t),o=zn(t),e=this._buffer,a=r;a1){if(!kr(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=$n(t),o=zn(t),e=this._buffer,a=r;a1){if(!kr(r))throw new TypeError(S("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=$n(t),o=zn(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),N(ti.prototype,"map",(function(t,r){var e,n,i,o,a;if(!qn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Rt(t))throw new TypeError(S("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=Qn(e,0),o=1}for(;o1){if(!yn(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(An(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=$n(t),void(n[e+1]=zn(t))}if(qn(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*Zn,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*Zn,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*Zn):(i=r-t,e=n.byteOffset+t*Zn),new this.constructor(n.buffer,e,i<0?0:i)})),N(ti.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!qn(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(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!An(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=$n(r),e[2*t+1]=zn(r),n}));var ri=[ir,We,Ke,ze,nn,Xt,pn,Dt,sn,Gn,ti],ei=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],ni=ei.length;function ii(t){var r,e=function(t){var r;if(At(t))return"generic";if(Ot(t))return null;for(r=0;r=r.length)return t.accessors[0](t.data,n);for(f=[],s=r[o],a=e[o],l=0;l=0;i--)e[i]=n,n*=t[i];return e}(t)}function hi(t){var r,e,n,i,o,a;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!qr(i=t.strides)){if(!qr(n=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return 0===n.length?[0]:(si(e=t.order)||(e="row-major"),li(n,e))}for(r=[],a=0;a=0;n--)r[n]=e,e*=t[n];return r}(t,e)}));var ci="row-major",pi="column-major";function yi(t){var r;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return si(r=t.order)?r:1===(r=ut(hi(t)))||3===r?ci:2===r?pi:0===function(t){var r,e;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(yn(e=t.ndims))return e;if(!qr(r=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return r.length}(t)?ci:null}return function(t){if(!((r=t)instanceof Ve||null!==r&&"object"==typeof r&&"object"==typeof r.data&&"object"==typeof r.shape&&"object"==typeof r.strides&&"number"==typeof r.offset&&"string"==typeof r.order&&"number"==typeof r.ndims&&"string"==typeof r.dtype&&"number"==typeof r.length&&"object"==typeof r.flags&&"function"==typeof r.get&&"function"==typeof r.set))throw new TypeError(function(){var t,r=arguments,e="https://stdlib.io/e/"+r[0]+"?";for(t=1;t