// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 !function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).arrayview2iteratorRight=e()}(this,(function(){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var e=Object.defineProperty;function t(r){return"number"==typeof r}function n(r){var e,t="";for(e=0;e0&&(e-=1),n=i.toExponential(e)):n=i.toPrecision(r.precision),r.alternate||(n=h.call(n,v,"$1e"),n=h.call(n,w,"e"),n=h.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),r.alternate&&(n=h.call(n,y,"$1."),n=h.call(n,m,"$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;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=_(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=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+d(m):d(m)+c)),f+=n.arg||"",l+=1}return f}var A=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function j(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 S(r){var e,t,n,i;for(t=[],i=0,n=A.exec(r);n;)(e=r.slice(i,A.lastIndex-n[0].length)).length&&t.push(e),t.push(j(n)),i=A.lastIndex,n=A.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=[S(r)],t=1;t=0&&r.length<=wr}function br(r){return"number"==typeof r}var dr=Number,Er=dr.prototype.toString;var Tr=W();function _r(r){return"object"==typeof r&&(r instanceof dr||(Tr?function(r){try{return Er.call(r),!0}catch(r){return!1}}(r):"[object Number]"===z(r)))}function xr(r){return br(r)||_r(r)}N(xr,"isPrimitive",br),N(xr,"isObject",_r);var Vr=Number.POSITIVE_INFINITY,Ar=dr.NEGATIVE_INFINITY;function jr(r){return rAr&&gr(r)}function Sr(r){return br(r)&&jr(r)}function Fr(r){return _r(r)&&jr(r.valueOf())}function Lr(r){return Sr(r)||Fr(r)}N(Lr,"isPrimitive",Sr),N(Lr,"isObject",Fr);var kr="function";function Rr(){return"function"==typeof J&&"symbol"==typeof J("foo")&&Z(J,"iterator")&&"symbol"==typeof J.iterator}var Br=Rr()?Symbol.iterator:null,Ir={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 Or(r){var e=Ir[r];return"function"==typeof e?e:Ir.default}var Mr={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 Cr(r){var e=Mr[r];return"function"==typeof e?e:Mr.default}var Nr={Float32Array:"float32",Float64Array:"float64",Array:"generic",Int16Array:"int16",Int32Array:"int32",Int8Array:"int8",Uint16Array:"uint16",Uint32Array:"uint32",Uint8Array:"uint8",Uint8ClampedArray:"uint8c",Complex64Array:"complex64",Complex128Array:"complex128",BooleanArray:"bool"},Pr="function"==typeof Float64Array;var Ur="function"==typeof Float64Array?Float64Array:null;var Yr="function"==typeof Float64Array?Float64Array:void 0;var Wr=function(){var r,e,t;if("function"!=typeof Ur)return!1;try{e=new Ur([1,3.14,-3.14,NaN]),t=e,r=(Pr&&t instanceof Float64Array||"[object Float64Array]"===z(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}()?Yr:function(){throw new Error("not implemented")},$r="function"==typeof Float32Array;var Gr="function"==typeof Float32Array?Float32Array:null;var Zr="function"==typeof Float32Array?Float32Array:void 0;var Jr=function(){var r,e,t;if("function"!=typeof Gr)return!1;try{e=new Gr([1,3.14,-3.14,5e40]),t=e,r=($r&&t instanceof Float32Array||"[object Float32Array]"===z(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===Vr}catch(e){r=!1}return r}()?Zr:function(){throw new Error("not implemented")},Xr="function"==typeof Uint32Array;var zr="function"==typeof Uint32Array?Uint32Array:null;var qr="function"==typeof Uint32Array?Uint32Array:void 0;var Dr=function(){var r,e,t;if("function"!=typeof zr)return!1;try{e=new zr(e=[1,3.14,-3.14,4294967296,4294967297]),t=e,r=(Xr&&t instanceof Uint32Array||"[object Uint32Array]"===z(t))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?qr:function(){throw new Error("not implemented")},Hr="function"==typeof Int32Array;var Kr="function"==typeof Int32Array?Int32Array:null;var Qr="function"==typeof Int32Array?Int32Array:void 0;var re=function(){var r,e,t;if("function"!=typeof Kr)return!1;try{e=new Kr([1,3.14,-3.14,2147483648]),t=e,r=(Hr&&t instanceof Int32Array||"[object Int32Array]"===z(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){r=!1}return r}()?Qr:function(){throw new Error("not implemented")},ee="function"==typeof Uint16Array;var te="function"==typeof Uint16Array?Uint16Array:null;var ne="function"==typeof Uint16Array?Uint16Array:void 0;var ie=function(){var r,e,t;if("function"!=typeof te)return!1;try{e=new te(e=[1,3.14,-3.14,65536,65537]),t=e,r=(ee&&t instanceof Uint16Array||"[object Uint16Array]"===z(t))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?ne:function(){throw new Error("not implemented")},oe="function"==typeof Int16Array;var ae="function"==typeof Int16Array?Int16Array:null;var ue="function"==typeof Int16Array?Int16Array:void 0;var fe=function(){var r,e,t;if("function"!=typeof ae)return!1;try{e=new ae([1,3.14,-3.14,32768]),t=e,r=(oe&&t instanceof Int16Array||"[object Int16Array]"===z(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){r=!1}return r}()?ue:function(){throw new Error("not implemented")},le="function"==typeof Uint8Array;var se="function"==typeof Uint8Array?Uint8Array:null;var he="function"==typeof Uint8Array?Uint8Array:void 0;var ce=function(){var r,e,t;if("function"!=typeof se)return!1;try{e=new se(e=[1,3.14,-3.14,256,257]),t=e,r=(le&&t instanceof Uint8Array||"[object Uint8Array]"===z(t))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){r=!1}return r}()?he:function(){throw new Error("not implemented")},pe="function"==typeof Uint8ClampedArray;var ye="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var me="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;var ge=function(){var r,e,t;if("function"!=typeof ye)return!1;try{e=new ye([-1,0,1,3.14,4.99,255,256]),t=e,r=(pe&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===z(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}()?me:function(){throw new Error("not implemented")},we="function"==typeof Int8Array;var ve="function"==typeof Int8Array?Int8Array:null;var be="function"==typeof Int8Array?Int8Array:void 0;var de=function(){var r,e,t;if("function"!=typeof ve)return!1;try{e=new ve([1,3.14,-3.14,128]),t=e,r=(we&&t instanceof Int8Array||"[object Int8Array]"===z(t))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){r=!1}return r}()?be:function(){throw new Error("not implemented")};function Ee(r){return Sr(r)&&r>=0}function Te(r){return Fr(r)&&r.valueOf()>=0}function _e(r){return Ee(r)||Te(r)}N(_e,"isPrimitive",Ee),N(_e,"isObject",Te);var xe=4294967295;function Ve(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&gr(r.length)&&r.length>=0&&r.length<=xe}var Ae="function"==typeof ArrayBuffer;function je(r){return Ae&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===z(r)}function Se(r){return"object"==typeof r&&null!==r&&!lr(r)}function Fe(r){return"string"==typeof r}var Le=String.prototype.valueOf;var ke=W();function Re(r){return"object"==typeof r&&(r instanceof String||(ke?function(r){try{return Le.call(r),!0}catch(r){return!1}}(r):"[object String]"===z(r)))}function Be(r){return Fe(r)||Re(r)}function Ie(r,e){if(!(this instanceof Ie))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!br(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!br(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}N(Be,"isPrimitive",Fe),N(Be,"isObject",Re),N(Ie,"BYTES_PER_ELEMENT",8),N(Ie.prototype,"BYTES_PER_ELEMENT",8),N(Ie.prototype,"byteLength",16),N(Ie.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),N(Ie.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Oe="function"==typeof Math.fround?Math.fround:null,Me=new Jr(1);var Ce="function"==typeof Oe?Oe: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(!br(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!br(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ce(r)}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ce(e)}),this}function Pe(r){return r instanceof Ie||r instanceof Ne||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function Ue(r){return gr(r/2)}N(Ne,"BYTES_PER_ELEMENT",4),N(Ne.prototype,"BYTES_PER_ELEMENT",4),N(Ne.prototype,"byteLength",8),N(Ne.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),N(Ne.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var Ye=8;function We(r){return"object"==typeof r&&null!==r&&"Complex64Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===Ye}var $e=16;function Ge(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===$e}function Ze(r,e,t){C(r,e,{configurable:!1,enumerable:!1,get:t})}function Je(r,e){if(!(this instanceof Je))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!br(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!br(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:Ce(r)}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:Ce(e)}),this}function Xe(r){return r.re}function ze(r){return r.im}function qe(r,e){return new Jr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function De(r,e){return new Wr(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}function He(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(Ve(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Pe(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(Xe(n),ze(n))}return e}N(Je,"BYTES_PER_ELEMENT",4),N(Je.prototype,"BYTES_PER_ELEMENT",4),N(Je.prototype,"byteLength",8),N(Je.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),N(Je.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var Ke=2*Jr.BYTES_PER_ELEMENT,Qe=Rr();function rt(r){return r instanceof nt||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function et(r){return r===nt||"Complex128Array"===r.name}function tt(r,e){return new Je(r[e*=2],r[e+1])}function nt(){var r,e,t,n;if(e=arguments.length,!(this instanceof nt))return 0===e?new nt:1===e?new nt(arguments[0]):2===e?new nt(arguments[0],arguments[1]):new nt(arguments[0],arguments[1],arguments[2]);if(0===e)t=new Jr(0);else if(1===e)if(Ee(arguments[0]))t=new Jr(2*arguments[0]);else if(vr(arguments[0]))if((n=(t=arguments[0]).length)&&lr(t)&&Pe(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;it.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*Ke));t=new Jr(t,r,2*n)}}return N(this,"_buffer",t),N(this,"_length",t.length/2),this}function it(r,e){if(!(this instanceof it))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!br(r))throw new TypeError(F("invalid argument. Real component must be a number. Value: `%s`.",r));if(!br(e))throw new TypeError(F("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}function ot(r){return r.re}function at(r){return r.im}function ut(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(Ve(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!Pe(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(ot(n),at(n))}return e}N(nt,"BYTES_PER_ELEMENT",Ke),N(nt,"name","Complex64Array"),N(nt,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,h,c;if(!yr(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!et(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!yr(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(rt(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=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[c]=s[0],o[c+1]=s[1]}c+=2}return i}return new this(r)}if(vr(r)){if(n){for(f=r.length,u=r.get&&r.set?Or("default"):Cr("default"),h=0;h=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[c]=s[0],o[c+1]=s[1]}c+=2}return i}return new this(r)}if(Se(r)&&Qe&&yr(r[Br])){if(!yr((o=r[Br]()).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,Ve(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Pe(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(Xe(o),ze(o))}return n}(o,n,e):He(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return tt(this._buffer,r)})),Ze(nt.prototype,"buffer",(function(){return this._buffer.buffer})),Ze(nt.prototype,"byteLength",(function(){return this._buffer.byteLength})),Ze(nt.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(nt.prototype,"BYTES_PER_ELEMENT",nt.BYTES_PER_ELEMENT),N(nt.prototype,"copyWithin",(function(r,e){if(!rt(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})),N(nt.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!rt(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,N(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new Je(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),N(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),Br&&N(t,Br,(function(){return e.entries()})),t})),N(nt.prototype,"every",(function(r,e){var t,n;if(!rt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n1){if(!gr(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(!gr(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=Xe(r),u=ze(r),f=e;f=0;n--)if(i=tt(t,n),r.call(e,i,n,this))return i})),N(nt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!rt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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=tt(t,n),r.call(e,i,n,this))return n;return-1})),N(nt.prototype,"forEach",(function(r,e){var t,n,i;if(!rt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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))return tt(this._buffer,r)})),N(nt.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!rt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pe(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!gr(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=Xe(r),o=ze(r),t=this._buffer,a=e;a1){if(!gr(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=Xe(r),o=ze(r),t=this._buffer,a=e;a1){if(!gr(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=Xe(r),o=ze(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),Ze(nt.prototype,"length",(function(){return this._length})),N(nt.prototype,"map",(function(r,e){var t,n,i,o,a;if(!rt(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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;o1)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=tt(t,0),o=1}for(;o1){if(!Ee(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Pe(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=Xe(r),void(n[t+1]=ze(r))}if(rt(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*Ke,e.buffer===n.buffer&&e.byteOffsetl){for(i=new Jr(e.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*Ke,e.buffer===n.buffer&&e.byteOffsetl){for(i=new Jr(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;fu&&(e=u)}}for(t=ri&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*Ke):(i=e-r,t=n.byteOffset+r*Ke),new this.constructor(n.buffer,t,i<0?0:i)})),N(nt.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!rt(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=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Pe(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]=Xe(e),t[2*r+1]=ze(e),n})),N(it,"BYTES_PER_ELEMENT",8),N(it.prototype,"BYTES_PER_ELEMENT",8),N(it.prototype,"byteLength",16),N(it.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),N(it.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var ft=2*Wr.BYTES_PER_ELEMENT,lt=Rr();function st(r){return r instanceof pt||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function ht(r){return r===pt||"Complex64Array"===r.name}function ct(r,e){return new it(r[e*=2],r[e+1])}function pt(){var r,e,t,n;if(e=arguments.length,!(this instanceof pt))return 0===e?new pt:1===e?new pt(arguments[0]):2===e?new pt(arguments[0],arguments[1]):new pt(arguments[0],arguments[1],arguments[2]);if(0===e)t=new Wr(0);else if(1===e)if(Ee(arguments[0]))t=new Wr(2*arguments[0]);else if(vr(arguments[0]))if((n=(t=arguments[0]).length)&&lr(t)&&Pe(t[0])){if(t=function(r,e){var t,n,i,o;for(t=e.length,o=0,i=0;it.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*ft));t=new Wr(t,r,2*n)}}return N(this,"_buffer",t),N(this,"_length",t.length/2),this}function yt(r){var e,t;for(e=[];!(t=r.next()).done;)e.push(q(t.value));return e}N(pt,"BYTES_PER_ELEMENT",ft),N(pt,"name","Complex128Array"),N(pt,"from",(function(r){var e,t,n,i,o,a,u,f,l,s,h,c;if(!yr(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!ht(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!yr(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(st(r)){if(f=r.length,n){for(o=(i=new this(f))._buffer,c=0,h=0;h=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[c]=s[0],o[c+1]=s[1]}c+=2}return i}return new this(r)}if(vr(r)){if(n){for(f=r.length,u=r.get&&r.set?Or("default"):Cr("default"),h=0;h=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[c]=s[0],o[c+1]=s[1]}c+=2}return i}return new this(r)}if(Se(r)&<&&yr(r[Br])){if(!yr((o=r[Br]()).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,Ve(o=e.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Pe(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(ot(o),at(o))}return n}(o,n,e):ut(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return ct(this._buffer,r)})),Ze(pt.prototype,"buffer",(function(){return this._buffer.buffer})),Ze(pt.prototype,"byteLength",(function(){return this._buffer.byteLength})),Ze(pt.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(pt.prototype,"BYTES_PER_ELEMENT",pt.BYTES_PER_ELEMENT),N(pt.prototype,"copyWithin",(function(r,e){if(!st(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})),N(pt.prototype,"entries",(function(){var r,e,t,n,i,o,a;if(!st(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,N(t={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new it(r[a+=2],r[a+1]),{value:[o,e],done:!1}})),N(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),Br&&N(t,Br,(function(){return e.entries()})),t})),N(pt.prototype,"every",(function(r,e){var t,n;if(!st(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,n=0;n1){if(!gr(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(!gr(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=ot(r),u=at(r),f=e;f=0;n--)if(i=ct(t,n),r.call(e,i,n,this))return i})),N(pt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!st(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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=ct(t,n),r.call(e,i,n,this))return n;return-1})),N(pt.prototype,"forEach",(function(r,e){var t,n,i;if(!st(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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))return ct(this._buffer,r)})),Ze(pt.prototype,"length",(function(){return this._length})),N(pt.prototype,"includes",(function(r,e){var t,n,i,o,a;if(!st(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Pe(r))throw new TypeError(F("invalid argument. First argument must be a complex number. Value: `%s`.",r));if(arguments.length>1){if(!gr(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=ot(r),o=at(r),t=this._buffer,a=e;a1){if(!gr(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=ot(r),o=at(r),t=this._buffer,a=e;a1){if(!gr(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=ot(r),o=at(r),t=this._buffer,a=e;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),N(pt.prototype,"map",(function(r,e){var t,n,i,o,a;if(!st(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!yr(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;o1)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=ct(t,0),o=1}for(;o1){if(!Ee(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Pe(r)){if(t>=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=ot(r),void(n[t+1]=at(r))}if(st(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*ft,e.buffer===n.buffer&&e.byteOffsetl){for(i=new Wr(e.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=r,l=n.byteOffset+t*ft,e.buffer===n.buffer&&e.byteOffsetl){for(i=new Wr(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,f=0;fu&&(e=u)}}for(t=ri&&(e=i)}}return r>=i?(i=0,t=n.byteLength):r>=e?(i=0,t=n.byteOffset+r*ft):(i=e-r,t=n.byteOffset+r*ft),new this.constructor(n.buffer,t,i<0?0:i)})),N(pt.prototype,"toReversed",(function(){var r,e,t,n,i,o;if(!st(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=i)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!Pe(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]=ot(e),t[2*r+1]=at(e),n}));var mt=ce.BYTES_PER_ELEMENT,gt=Rr();function wt(r){return"object"==typeof r&&null!==r&&"BooleanArray"===r.constructor.name&&r.BYTES_PER_ELEMENT===mt}function vt(r){return r===bt}function bt(){var r,e,t,n,i;if(e=arguments.length,!(this instanceof bt))return 0===e?new bt:1===e?new bt(arguments[0]):2===e?new bt(arguments[0],arguments[1]):new bt(arguments[0],arguments[1],arguments[2]);if(0===e)t=new ce(0);else if(1===e)if(Ee(i=arguments[0]))t=new ce(i);else if(vr(i))t=function(r,e){var t,n;for(t=e.length,n=0;nt.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*mt));t=new ce(t,r,n)}}return N(this,"_buffer",t),N(this,"_length",t.length),this}N(bt,"BYTES_PER_ELEMENT",mt),N(bt,"name","BooleanArray"),N(bt,"from",(function(r){var e,t,n,i,o,a,u,f,l;if(!yr(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!vt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((t=arguments.length)>1){if(!yr(n=arguments[1]))throw new TypeError(F("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(e=arguments[2])}if(vr(r)){if(n){for(f=r.length,u=r.get&&r.set?Or("default"):Cr("default"),o=(i=new this(f))._buffer,l=0;l=0;i--)if(n=q(t[i]),r.call(e,n,i,this))return n})),N(bt.prototype,"findLastIndex",(function(r,e){var t,n,i;if(!wt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!yr(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));for(t=this._buffer,i=this._length-1;i>=0;i--)if(n=q(t[i]),r.call(e,n,i,this))return i;return-1})),N(bt.prototype,"get",(function(r){if(!wt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ee(r))throw new TypeError(F("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(!(r>=this._length))return q(this._buffer[r])})),Ze(bt.prototype,"length",(function(){return this._length})),N(bt.prototype,"map",(function(r,e){var t,n,i,o;if(!wt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!yr(r))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",r);for(i=this._buffer,t=(n=new this.constructor(this._length))._buffer,o=0;o1){if(!Ee(t=arguments[1]))throw new TypeError(F("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(vr(r)){if(t+(o=r.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=wt(r)?r._buffer:r,u=n.byteOffset+t*mt,e.buffer===n.buffer&&e.byteOffsetu){for(i=new ce(e.length),a=0;a=this._length)throw new RangeError(F("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));n[t]=r?1:0}})),N(bt.prototype,"sort",(function(r){var e;if(!wt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(e=this._buffer,0===arguments.length)return e.sort(),this;if(!yr(r))throw new TypeError(F("invalid argument. First argument must be a function. Value: `%s`.",r));return e.sort((function(e,t){return r(q(e),q(t))})),this})),N(bt.prototype,"toReversed",(function(){var r,e,t,n,i;if(!wt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,i=0;ie.length&&(f=e.length),n<0&&(n=e.length+n)<0&&(n=0),h=f,N(o={},"next",u?function(){if(h-=1,a||h