-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.js
More file actions
4 lines (4 loc) · 114 KB
/
mod.js
File metadata and controls
4 lines (4 loc) · 114 KB
1
2
3
4
// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var t="function"==typeof Object.defineProperty?Object.defineProperty:null;var e=Object.defineProperty;function r(t){return"number"==typeof t}function n(t){var e,r="";for(e=0;e<t;e++)r+="0";return r}function i(t,e,r){var i=!1,o=e-t.length;return o<0||(function(t){return"-"===t[0]}(t)&&(i=!0,t=t.substr(1)),t=r?t+n(o):n(o)+t,i&&(t="-"+t)),t}var o=String.prototype.toLowerCase,a=String.prototype.toUpperCase;function u(t){var e,n,u;switch(t.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(n=t.arg,u=parseInt(n,10),!isFinite(u)){if(!r(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===t.specifier||10!==e)&&(u=4294967295+u+1),u<0?(n=(-u).toString(e),t.precision&&(n=i(n,t.precision,t.padRight)),n="-"+n):(n=u.toString(e),u||t.precision?t.precision&&(n=i(n,t.precision,t.padRight)):n="",t.sign&&(n=t.sign+n)),16===e&&(t.alternate&&(n="0x"+n),n=t.specifier===a.call(t.specifier)?a.call(n):o.call(n)),8===e&&t.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var s=Math.abs,f=String.prototype.toLowerCase,l=String.prototype.toUpperCase,h=String.prototype.replace,c=/e\+(\d)$/,p=/e-(\d)$/,g=/^(\d+)$/,y=/^(\d+)e/,m=/\.0$/,d=/\.0*e/,v=/(\..*[^0])0*e/;function w(t,e){var r,n;switch(e.specifier){case"e":case"E":n=t.toExponential(e.precision);break;case"f":case"F":n=t.toFixed(e.precision);break;case"g":case"G":s(t)<1e-4?((r=e.precision)>0&&(r-=1),n=t.toExponential(r)):n=t.toPrecision(e.precision),e.alternate||(n=h.call(n,v,"$1e"),n=h.call(n,d,"e"),n=h.call(n,m,""));break;default:throw new Error("invalid double notation. Value: "+e.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),e.alternate&&(n=h.call(n,g,"$1."),n=h.call(n,y,"$1.e")),t>=0&&e.sign&&(n=e.sign+n),n=e.specifier===l.call(e.specifier)?l.call(n):f.call(n)}function b(t){var e,r="";for(e=0;e<t;e++)r+=" ";return r}var _=String.fromCharCode,E=Array.isArray;function T(t){return t!=t}function x(t){var e={};return e.specifier=t.specifier,e.precision=void 0===t.precision?1:t.precision,e.width=t.width,e.flags=t.flags||"",e.mapping=t.mapping,e}function V(t){var e,n,o,a,s,f,l,h,c,p,g,y,m,d;if(!E(t))throw new TypeError("invalid argument. First argument must be an array. Value: `"+t+"`.");for(f="",l=1,c=0;c<t.length;c++)if(o=t[c],"string"==typeof o)f+=o;else{if(e=void 0!==o.precision,!(o=x(o)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+c+"`. Value: `"+o+"`.");for(o.mapping&&(l=o.mapping),n=o.flags,p=0;p<n.length;p++)switch(a=n.charAt(p)){case" ":o.sign=" ";break;case"+":o.sign="+";break;case"-":o.padRight=!0,o.padZeros=!1;break;case"0":o.padZeros=n.indexOf("-")<0;break;case"#":o.alternate=!0;break;default:throw new Error("invalid flag: "+a)}if("*"===o.width){if(o.width=parseInt(arguments[l],10),l+=1,T(o.width))throw new TypeError("the argument for * width at position "+l+" is not a number. Value: `"+o.width+"`.");o.width<0&&(o.padRight=!0,o.width=-o.width)}if(e&&"*"===o.precision){if(o.precision=parseInt(arguments[l],10),l+=1,T(o.precision))throw new TypeError("the argument for * precision at position "+l+" is not a number. Value: `"+o.precision+"`.");o.precision<0&&(o.precision=1,e=!1)}switch(o.arg=arguments[l],o.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(o.padZeros=!1),o.arg=u(o);break;case"s":o.maxWidth=e?o.precision:-1,o.arg=String(o.arg);break;case"c":if(!T(o.arg)){if((s=parseInt(o.arg,10))<0||s>127)throw new Error("invalid character code. Value: "+o.arg);o.arg=T(s)?String(o.arg):_(s)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(e||(o.precision=6),h=parseFloat(o.arg),!isFinite(h)){if(!r(o.arg))throw new Error("invalid floating-point number. Value: "+f);h=o.arg,o.padZeros=!1}o.arg=w(h,o);break;default:throw new Error("invalid specifier: "+o.specifier)}o.maxWidth>=0&&o.arg.length>o.maxWidth&&(o.arg=o.arg.substring(0,o.maxWidth)),o.padZeros?o.arg=i(o.arg,o.width||o.precision,o.padRight):o.width&&(o.arg=(g=o.arg,y=o.width,m=o.padRight,d=void 0,(d=y-g.length)<0?g:g=m?g+b(d):b(d)+g)),f+=o.arg||"",l+=1}return f}var A=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function O(t){var e={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]&&(e.precision="1"),e}function j(t){var e,r,n,i;for(r=[],i=0,n=A.exec(t);n;)(e=t.slice(i,A.lastIndex-n[0].length)).length&&r.push(e),"%"===n[6]?r.push("%"):r.push(O(n)),i=A.lastIndex,n=A.exec(t);return(e=t.slice(i)).length&&r.push(e),r}function S(t){var e,r;if("string"!=typeof t)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));for(e=[j(t)],r=1;r<arguments.length;r++)e.push(arguments[r]);return V.apply(null,e)}var F,L=Object.prototype,k=L.toString,I=L.__defineGetter__,R=L.__defineSetter__,M=L.__lookupGetter__,B=L.__lookupSetter__;F=function(){try{return t({},"x",{}),!0}catch(t){return!1}}()?e:function(t,e,r){var n,i,o,a;if("object"!=typeof t||null===t||"[object Array]"===k.call(t))throw new TypeError(S("invalid argument. First argument must be an object. Value: `%s`.",t));if("object"!=typeof r||null===r||"[object Array]"===k.call(r))throw new TypeError(S("invalid argument. Property descriptor must be an object. Value: `%s`.",r));if((i="value"in r)&&(M.call(t,e)||B.call(t,e)?(n=t.__proto__,t.__proto__=L,delete t[e],t[e]=r.value,t.__proto__=n):t[e]=r.value),o="get"in r,a="set"in r,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&&I&&I.call(t,e,r.get),a&&R&&R.call(t,e,r.set),t};var U=F;function N(t,e,r){U(t,e,{configurable:!1,enumerable:!1,writable:!1,value:r})}var C="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function P(){return C&&"symbol"==typeof Symbol.toStringTag}var Y=Object.prototype.toString;var D=Object.prototype.hasOwnProperty;function W(t,e){return null!=t&&D.call(t,e)}var J="function"==typeof Symbol?Symbol:void 0,G="function"==typeof J?J.toStringTag:"";var $=P()?function(t){var e,r,n;if(null==t)return Y.call(t);r=t[G],e=W(t,G);try{t[G]=void 0}catch(e){return Y.call(t)}return n=Y.call(t),e?t[G]=r:delete t[G],n}:function(t){return Y.call(t)};var z=Array.isArray?Array.isArray:function(t){return"[object Array]"===$(t)};function Z(t){return"object"==typeof t&&null!==t&&!z(t)}var X=/./;function q(t){return"boolean"==typeof t}var H=Boolean,K=Boolean.prototype.toString;var Q=P();function tt(t){return"object"==typeof t&&(t instanceof H||(Q?function(t){try{return K.call(t),!0}catch(t){return!1}}(t):"[object Boolean]"===$(t)))}function et(t){return q(t)||tt(t)}N(et,"isPrimitive",q),N(et,"isObject",tt);var rt="object"==typeof self?self:null,nt="object"==typeof window?window:null,it="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ot="object"==typeof it?it:null,at="object"==typeof globalThis?globalThis:null;function ut(t){if(arguments.length){if(!q(t))throw new TypeError(S("invalid argument. Must provide a boolean. Value: `%s`.",t));if(t)return new Function("return this;")()}if(at)return at;if(rt)return rt;if(nt)return nt;if(ot)return ot;throw new Error("unexpected error. Unable to resolve global object.")}var st=ut(),ft=st.document&&st.document.childNodes,lt=Int8Array;function ht(){return/^\s*function\s*([^(]*)/i}var ct=/^\s*function\s*([^(]*)/i;function pt(t){if("function"!=typeof t)throw new TypeError(S("invalid argument. Must provide a function. Value: `%s`.",t));return function(e){var r,n;if(!z(e))return!1;if(0===(r=e.length))return!1;for(n=0;n<r;n++)if(!1===t(e[n]))return!1;return!0}}function gt(t){return null!==t&&"object"==typeof t}function yt(t){return gt(t)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))}function mt(t){var e,r,n;if(("Object"===(r=$(t).slice(8,-1))||"Error"===r)&&t.constructor){if("string"==typeof(n=t.constructor).name)return n.name;if(e=ct.exec(n.toString()))return e[1]}return yt(t)?"Buffer":r}N(ht,"REGEXP",ct),N(gt,"isObjectLikeArray",pt(gt));var dt="function"==typeof X||"object"==typeof lt||"function"==typeof ft?function(t){return mt(t).toLowerCase()}:function(t){var e;return null===t?"null":"object"===(e=typeof t)?mt(t).toLowerCase():e};function vt(t){return"function"===dt(t)}var wt,bt=Object,_t=Object.getPrototypeOf;wt=vt(Object.getPrototypeOf)?_t:function(t){var e=function(t){return t.__proto__}(t);return e||null===e?e:"[object Function]"===$(t.constructor)?t.constructor.prototype:t instanceof bt?bt.prototype:null};var Et=wt;var Tt=Object.prototype;function xt(t){var e;return!!Z(t)&&(e=function(t){return null==t?null:(t=bt(t),Et(t))}(t),!e||!W(t,"constructor")&&W(e,"constructor")&&vt(e.constructor)&&"[object Function]"===$(e.constructor)&&W(e,"isPrototypeOf")&&vt(e.isPrototypeOf)&&(e===Tt||function(t){var e;for(e in t)if(!W(t,e))return!1;return!0}(t)))}function Vt(){var t,e=arguments,r="https://stdlib.io/e/"+e[0]+"?";for(t=1;t<e.length;t++)r+="&arg[]="+encodeURIComponent(e[t]);return r}function At(t,e,r){U(t,e,{configurable:!1,enumerable:!1,get:r})}var Ot=ut();function jt(t){return"string"==typeof t}var St=String.prototype.valueOf;var Ft=P();function Lt(t){return"object"==typeof t&&(t instanceof String||(Ft?function(t){try{return St.call(t),!0}catch(t){return!1}}(t):"[object String]"===$(t)))}function kt(t){return jt(t)||Lt(t)}function It(t){return"number"==typeof t}N(kt,"isPrimitive",jt),N(kt,"isObject",Lt);var Rt=Number,Mt=Rt.prototype.toString;var Bt=P();function Ut(t){return"object"==typeof t&&(t instanceof Rt||(Bt?function(t){try{return Mt.call(t),!0}catch(t){return!1}}(t):"[object Number]"===$(t)))}function Nt(t){return It(t)||Ut(t)}N(Nt,"isPrimitive",It),N(Nt,"isObject",Ut);var Ct=Number.POSITIVE_INFINITY,Pt=Rt.NEGATIVE_INFINITY,Yt=Math.floor;function Dt(t){return Yt(t)===t}function Wt(t){return t<Ct&&t>Pt&&Dt(t)}function Jt(t){return It(t)&&Wt(t)}function Gt(t){return Ut(t)&&Wt(t.valueOf())}function $t(t){return Jt(t)||Gt(t)}function zt(t){return Jt(t)&&t>0}function Zt(t){return Gt(t)&&t.valueOf()>0}function Xt(t){return zt(t)||Zt(t)}function qt(t){return Object.keys(Object(t))}N($t,"isPrimitive",Jt),N($t,"isObject",Gt),N(Xt,"isPrimitive",zt),N(Xt,"isObject",Zt);var Ht=void 0!==Object.keys;function Kt(t){return"[object Arguments]"===$(t)}var Qt=function(){return Kt(arguments)}();function te(t){return t!=t}function ee(t){return It(t)&&te(t)}function re(t){return Ut(t)&&te(t.valueOf())}function ne(t){return ee(t)||re(t)}N(ne,"isPrimitive",ee),N(ne,"isObject",re);var ie=Object.prototype.propertyIsEnumerable;var oe=!ie.call("beep","0");function ae(t,e){var r;return null!=t&&(!(r=ie.call(t,e))&&oe&&kt(t)?!ee(e=+e)&&Jt(e)&&e>=0&&e<t.length:r)}var ue=4294967295;var se=Qt?Kt:function(t){return null!==t&&"object"==typeof t&&!z(t)&&"number"==typeof t.length&&Dt(t.length)&&t.length>=0&&t.length<=ue&&W(t,"callee")&&!ae(t,"callee")},fe=Array.prototype.slice;var le=ae((function(){}),"prototype"),he=!ae({toString:null},"toString"),ce=9007199254740991;function pe(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Dt(t.length)&&t.length>=0&&t.length<=ce}function ge(t,e,r){var n,i;if(!pe(t)&&!jt(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(!Jt(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));if(r>=0){if(r>=n)return-1;i=r}else(i=n+r)<0&&(i=0)}else i=0;if(ne(e)){for(;i<n;i++)if(ne(t[i]))return i}else for(;i<n;i++)if(t[i]===e)return i;return-1}function ye(t){return t.constructor&&t.constructor.prototype===t}var me=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],de="undefined"==typeof window?void 0:window;var ve=function(){var t;if("undefined"===dt(de))return!1;for(t in de)try{-1===ge(me,t)&&W(de,t)&&null!==de[t]&&"object"===dt(de[t])&&ye(de[t])}catch(t){return!0}return!1}(),we="undefined"!=typeof window;var be=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var _e=Ht?function(){return 2!==(qt(arguments)||"").length}(1,2)?function(t){return se(t)?qt(fe.call(t)):qt(t)}:qt:function(t){var e,r,n,i,o,a,u;if(i=[],se(t)){for(u=0;u<t.length;u++)i.push(u.toString());return i}if("string"==typeof t){if(t.length>0&&!W(t,"0"))for(u=0;u<t.length;u++)i.push(u.toString())}else{if(!1==(n="function"==typeof t)&&!gt(t))return i;r=le&&n}for(o in t)r&&"prototype"===o||!W(t,o)||i.push(String(o));if(he)for(e=function(t){if(!1===we&&!ve)return ye(t);try{return ye(t)}catch(t){return!1}}(t),u=0;u<be.length;u++)a=be[u],e&&"constructor"===a||!W(t,a)||i.push(String(a));return i};var Ee=function(t,e){var r,n,i,o,a,u,s,f=!0;if(!gt(t))throw new TypeError(S("invalid argument. First argument must be an object (except null). Value: `%s`.",t));if(arguments.length>1){if(!xt(e))throw new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",e));if(W(e,"duplicates")&&!q(f=e.duplicates))throw new TypeError(S("invalid option. `%s` option must be a boolean. Option: `%s`.","duplicates",f))}if(n=(r=_e(t)).length,a={},f)for(s=0;s<n;s++)W(a,o=t[i=r[s]])?(u=a[o],z(u)?a[o].push(i):a[o]=[u,i]):a[o]=i;else for(s=0;s<n;s++)a[t[i=r[s]]]=i;return a}({bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float16:10,float32:11,float64:12,complex32:13,complex64:14,complex128:15,binary:16,generic:17,notype:18,userdefined_type:256},{duplicates:!1});function Te(t){var e=Ee[t];return jt(e)?e:null}var xe={binary:1,bool:1,complex64:8,complex128:16,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32};function Ve(t){var e;return jt(t)?xe[t]||null:It(t)?xe[Te(t)]||null:t&&zt(e=t.byteLength)?e:null}function Ae(t){return Math.abs(t)}function Oe(t){var e,r,n,i,o,a;if(0===(r=t.length))return 0;for(e=!0,n=!0,i=Ae(t[0]),a=1;a<r;a++){if(o=Ae(t[a]),e&&o<i?e=!1:n&&o>i&&(n=!1),!n&&!e)return 0;i=o}return n&&e?3:n?1:2}var je="function";function Se(t){return typeof t.get===je&&typeof t.set===je}var Fe={float64:function(t,e){return t[e]},float32:function(t,e){return t[e]},int32:function(t,e){return t[e]},int16:function(t,e){return t[e]},int8:function(t,e){return t[e]},uint32:function(t,e){return t[e]},uint16:function(t,e){return t[e]},uint8:function(t,e){return t[e]},uint8c:function(t,e){return t[e]},generic:function(t,e){return t[e]},default:function(t,e){return t[e]}};function Le(t){var e=Fe[t];return"function"==typeof e?e:Fe.default}var ke={float64:function(t,e,r){t[e]=r},float32:function(t,e,r){t[e]=r},int32:function(t,e,r){t[e]=r},int16:function(t,e,r){t[e]=r},int8:function(t,e,r){t[e]=r},uint32:function(t,e,r){t[e]=r},uint16:function(t,e,r){t[e]=r},uint8:function(t,e,r){t[e]=r},uint8c:function(t,e,r){t[e]=r},generic:function(t,e,r){t[e]=r},default:function(t,e,r){t[e]=r}};function Ie(t){var e=ke[t];return"function"==typeof e?e:ke.default}var Re={complex128:function(t,e){return t.get(e)},complex64:function(t,e){return t.get(e)},default:function(t,e){return t.get(e)}};function Me(t){var e=Re[t];return"function"==typeof e?e:Re.default}var Be={complex128:function(t,e,r){t.set(r,e)},complex64:function(t,e,r){t.set(r,e)},default:function(t,e,r){t.set(r,e)}};function Ue(t){var e=Be[t];return"function"==typeof e?e:Be.default}var Ne={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"},Ce="function"==typeof Float64Array;var Pe="function"==typeof Float64Array?Float64Array:null;var Ye,De="function"==typeof Float64Array?Float64Array:void 0;Ye=function(){var t,e,r;if("function"!=typeof Pe)return!1;try{e=new Pe([1,3.14,-3.14,NaN]),r=e,t=(Ce&&r instanceof Float64Array||"[object Float64Array]"===$(r))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){t=!1}return t}()?De:function(){throw new Error("not implemented")};var We=Ye,Je="function"==typeof Float32Array;var Ge="function"==typeof Float32Array?Float32Array:null;var $e,ze="function"==typeof Float32Array?Float32Array:void 0;$e=function(){var t,e,r;if("function"!=typeof Ge)return!1;try{e=new Ge([1,3.14,-3.14,5e40]),r=e,t=(Je&&r instanceof Float32Array||"[object Float32Array]"===$(r))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===Ct}catch(e){t=!1}return t}()?ze:function(){throw new Error("not implemented")};var Ze=$e,Xe="function"==typeof Uint32Array;var qe="function"==typeof Uint32Array?Uint32Array:null;var He,Ke="function"==typeof Uint32Array?Uint32Array:void 0;He=function(){var t,e,r;if("function"!=typeof qe)return!1;try{e=new qe(e=[1,3.14,-3.14,4294967296,4294967297]),r=e,t=(Xe&&r instanceof Uint32Array||"[object Uint32Array]"===$(r))&&1===e[0]&&3===e[1]&&4294967293===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?Ke:function(){throw new Error("not implemented")};var Qe=He,tr="function"==typeof Int32Array;var er="function"==typeof Int32Array?Int32Array:null;var rr,nr="function"==typeof Int32Array?Int32Array:void 0;rr=function(){var t,e,r;if("function"!=typeof er)return!1;try{e=new er([1,3.14,-3.14,2147483648]),r=e,t=(tr&&r instanceof Int32Array||"[object Int32Array]"===$(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-2147483648===e[3]}catch(e){t=!1}return t}()?nr:function(){throw new Error("not implemented")};var ir=rr,or="function"==typeof Uint16Array;var ar="function"==typeof Uint16Array?Uint16Array:null;var ur,sr="function"==typeof Uint16Array?Uint16Array:void 0;ur=function(){var t,e,r;if("function"!=typeof ar)return!1;try{e=new ar(e=[1,3.14,-3.14,65536,65537]),r=e,t=(or&&r instanceof Uint16Array||"[object Uint16Array]"===$(r))&&1===e[0]&&3===e[1]&&65533===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?sr:function(){throw new Error("not implemented")};var fr=ur,lr="function"==typeof Int16Array;var hr="function"==typeof Int16Array?Int16Array:null;var cr,pr="function"==typeof Int16Array?Int16Array:void 0;cr=function(){var t,e,r;if("function"!=typeof hr)return!1;try{e=new hr([1,3.14,-3.14,32768]),r=e,t=(lr&&r instanceof Int16Array||"[object Int16Array]"===$(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-32768===e[3]}catch(e){t=!1}return t}()?pr:function(){throw new Error("not implemented")};var gr=cr,yr="function"==typeof Uint8Array;var mr="function"==typeof Uint8Array?Uint8Array:null;var dr,vr="function"==typeof Uint8Array?Uint8Array:void 0;dr=function(){var t,e,r;if("function"!=typeof mr)return!1;try{e=new mr(e=[1,3.14,-3.14,256,257]),r=e,t=(yr&&r instanceof Uint8Array||"[object Uint8Array]"===$(r))&&1===e[0]&&3===e[1]&&253===e[2]&&0===e[3]&&1===e[4]}catch(e){t=!1}return t}()?vr:function(){throw new Error("not implemented")};var wr=dr,br="function"==typeof Uint8ClampedArray;var _r="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null;var Er,Tr="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0;Er=function(){var t,e,r;if("function"!=typeof _r)return!1;try{e=new _r([-1,0,1,3.14,4.99,255,256]),r=e,t=(br&&r instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===$(r))&&0===e[0]&&0===e[1]&&1===e[2]&&3===e[3]&&5===e[4]&&255===e[5]&&255===e[6]}catch(e){t=!1}return t}()?Tr:function(){throw new Error("not implemented")};var xr=Er,Vr="function"==typeof Int8Array;var Ar="function"==typeof Int8Array?Int8Array:null;var Or,jr="function"==typeof Int8Array?Int8Array:void 0;Or=function(){var t,e,r;if("function"!=typeof Ar)return!1;try{e=new Ar([1,3.14,-3.14,128]),r=e,t=(Vr&&r instanceof Int8Array||"[object Int8Array]"===$(r))&&1===e[0]&&3===e[1]&&-3===e[2]&&-128===e[3]}catch(e){t=!1}return t}()?jr:function(){throw new Error("not implemented")};var Sr=Or;function Fr(t){return Jt(t)&&t>=0}function Lr(t){return Gt(t)&&t.valueOf()>=0}function kr(t){return Fr(t)||Lr(t)}N(kr,"isPrimitive",Fr),N(kr,"isObject",Lr);var Ir=4294967295;function Rr(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&Dt(t.length)&&t.length>=0&&t.length<=Ir}var Mr="function"==typeof ArrayBuffer;function Br(t){return Mr&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===$(t)}var Ur=pt(kt.isPrimitive),Nr=pt(kt.isObject),Cr=pt(kt);function Pr(t,e,r){U(t,e,{configurable:!1,enumerable:!0,writable:!1,value:r})}function Yr(t,e){if(!(this instanceof Yr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!It(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!It(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Pr(this,"re",t),Pr(this,"im",e),this}N(Cr,"primitives",Ur),N(Cr,"objects",Nr),N(Yr,"name","Complex128"),N(Yr,"BYTES_PER_ELEMENT",8),N(Yr.prototype,"BYTES_PER_ELEMENT",8),N(Yr.prototype,"byteLength",16),N(Yr.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(Yr.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var Dr="function"==typeof Math.fround?Math.fround:null,Wr=new Ze(1);var Jr="function"==typeof Dr?Dr:function(t){return Wr[0]=t,Wr[0]};function Gr(t,e){if(!(this instanceof Gr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!It(t))throw new TypeError(S("invalid argument. Real component must be a number. Value: `%s`.",t));if(!It(e))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return Pr(this,"re",Jr(t)),Pr(this,"im",Jr(e)),this}function $r(t){return t instanceof Yr||t instanceof Gr||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function zr(t){return Dt(t/2)}N(Gr,"name","Complex64"),N(Gr,"BYTES_PER_ELEMENT",4),N(Gr.prototype,"BYTES_PER_ELEMENT",4),N(Gr.prototype,"byteLength",8),N(Gr.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),N(Gr.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var Zr=8;function Xr(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===Zr}var qr=16;function Hr(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===qr}function Kr(){return"function"==typeof J&&"symbol"==typeof J("foo")&&W(J,"iterator")&&"symbol"==typeof J.iterator}var Qr=Kr()?Symbol.iterator:null;function tn(t){return t.re}function en(t){return t.im}function rn(t,e){return new Ze(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function nn(t,e){return new We(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*e,2*(t.length-e))}function on(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(Rr(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!$r(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));e.push(tn(n),en(n))}return e}var an=2*Ze.BYTES_PER_ELEMENT,un=Kr();function sn(t){return t instanceof hn||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function fn(t){return t===hn||"Complex128Array"===t.name}function ln(t,e){return new Gr(t[e*=2],t[e+1])}function hn(){var t,e,r,n;if(e=arguments.length,!(this instanceof hn))return 0===e?new hn:1===e?new hn(arguments[0]):2===e?new hn(arguments[0],arguments[1]):new hn(arguments[0],arguments[1],arguments[2]);if(0===e)r=new Ze(0);else if(1===e)if(Fr(arguments[0]))r=new Ze(2*arguments[0]);else if(pe(arguments[0]))if((n=(r=arguments[0]).length)&&z(r)&&$r(r[0])){if(r=function(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!$r(n=e[i]))return null;t[o]=tn(n),t[o+1]=en(n),o+=2}return t}(new Ze(2*n),r),null===r){if(!zr(n))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new Ze(arguments[0])}}else{if(Xr(r))r=rn(r,0);else if(Hr(r))r=nn(r,0);else if(!zr(n))throw new RangeError(S("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new Ze(r)}else if(Br(arguments[0])){if(!Dt((r=arguments[0]).byteLength/an))throw new RangeError(S("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",an,r.byteLength));r=new Ze(r)}else{if(!Z(arguments[0]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(r=arguments[0],!1===un)throw new TypeError(S("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",r));if(!vt(r[Qr]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if(!vt((r=r[Qr]()).next))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if((r=on(r))instanceof Error)throw r;r=new Ze(r)}else{if(!Br(r=arguments[0]))throw new TypeError(S("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",r));if(!Fr(t=arguments[1]))throw new TypeError(S("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Dt(t/an))throw new RangeError(S("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",an,t));if(2===e){if(!Dt((n=r.byteLength-t)/an))throw new RangeError(S("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",an,n));r=new Ze(r,t)}else{if(!Fr(n=arguments[2]))throw new TypeError(S("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*an>r.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*an));r=new Ze(r,t,2*n)}}return N(this,"_buffer",r),N(this,"_length",r.length/2),this}function cn(t){return t.re}function pn(t){return t.im}function gn(t){var e,r,n;for(e=[];!(r=t.next()).done;)if(Rr(n=r.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!$r(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));e.push(cn(n),pn(n))}return e}N(hn,"BYTES_PER_ELEMENT",an),N(hn,"name","Complex64Array"),N(hn,"from",(function(t){var e,r,n,i,o,a,u,s,f,l,h,c;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!fn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!vt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(sn(t)){if(s=t.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h<s;h++){if($r(l=n.call(e,t.get(h),h)))o[c]=tn(l),o[c+1]=en(l);else{if(!(Rr(l)&&l.length>=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(pe(t)){if(n){for(s=t.length,u=t.get&&t.set?Me("default"):Le("default"),h=0;h<s;h++)if(!$r(u(t,h))){f=!0;break}if(f){if(!zr(s))throw new RangeError(S("invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.",2,s));for(o=(i=new this(s/2))._buffer,h=0;h<s;h++)o[h]=n.call(e,u(t,h),h);return i}for(o=(i=new this(s))._buffer,c=0,h=0;h<s;h++){if($r(l=n.call(e,u(t,h),h)))o[c]=tn(l),o[c+1]=en(l);else{if(!(Rr(l)&&l.length>=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(Z(t)&&un&&vt(t[Qr])){if(!vt((o=t[Qr]()).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,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Rr(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!$r(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(tn(o),en(o))}return n}(o,n,e):on(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h<s;h++)o[h]=a[h];return i}throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),N(hn,"of",(function(){var t,e;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!fn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),N(hn.prototype,"at",(function(t){if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return ln(this._buffer,t)})),At(hn.prototype,"buffer",(function(){return this._buffer.buffer})),At(hn.prototype,"byteLength",(function(){return this._buffer.byteLength})),At(hn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(hn.prototype,"BYTES_PER_ELEMENT",hn.BYTES_PER_ELEMENT),N(hn.prototype,"copyWithin",(function(t,e){if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),N(hn.prototype,"entries",(function(){var t,e,r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return t=this,n=this._buffer,r=this._length,o=-1,N(e={},"next",(function(){if(o+=1,i||o>=r)return{done:!0};return{value:[o,ln(n,o)],done:!1}})),N(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return t.entries()})),e})),N(hn.prototype,"every",(function(t,e){var r,n;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(!t.call(e,ln(r,n),n,this))return!1;return!0})),N(hn.prototype,"fill",(function(t,e,r){var n,i,o,a,u,s;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!Dt(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));r<0&&(r+=i)<0&&(r=0),r>i&&(r=i)}else r=i}else e=0,r=i;for(a=tn(t),u=en(t),s=e;s<r;s++)n[o=2*s]=a,n[o+1]=u;return this})),N(hn.prototype,"filter",(function(t,e){var r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=[],i=0;i<this._length;i++)o=ln(r,i),t.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),N(hn.prototype,"find",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(i=ln(r,n),t.call(e,i,n,this))return i})),N(hn.prototype,"findIndex",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(i=ln(r,n),t.call(e,i,n,this))return n;return-1})),N(hn.prototype,"findLast",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=ln(r,n),t.call(e,i,n,this))return i})),N(hn.prototype,"findLastIndex",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=ln(r,n),t.call(e,i,n,this))return n;return-1})),N(hn.prototype,"forEach",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)i=ln(r,n),t.call(e,i,n,this)})),N(hn.prototype,"get",(function(t){if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fr(t))throw new TypeError(S("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return ln(this._buffer,t)})),N(hn.prototype,"includes",(function(t,e){var r,n,i,o,a;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=tn(t),o=en(t),r=this._buffer,a=e;a<this._length;a++)if(i===r[n=2*a]&&o===r[n+1])return!0;return!1})),N(hn.prototype,"indexOf",(function(t,e){var r,n,i,o,a;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=tn(t),o=en(t),r=this._buffer,a=e;a<this._length;a++)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),N(hn.prototype,"join",(function(t){var e,r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!jt(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));n=t}for(e=[],r=this._buffer,i=0;i<this._length;i++)e.push(ln(r,i).toString());return e.join(n)})),N(hn.prototype,"keys",(function(){var t,e,r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return t=this,r=this._length,i=-1,N(e={},"next",(function(){if(i+=1,n||i>=r)return{done:!0};return{value:i,done:!1}})),N(e,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return t.keys()})),e})),N(hn.prototype,"lastIndexOf",(function(t,e){var r,n,i,o,a;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("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=tn(t),o=en(t),r=this._buffer,a=e;a>=0;a--)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),At(hn.prototype,"length",(function(){return this._length})),N(hn.prototype,"map",(function(t,e){var r,n,i,o,a;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,r=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if($r(a=t.call(e,ln(n,o),o,this)))r[2*o]=tn(a),r[2*o+1]=en(a);else{if(!Rr(a)||2!==a.length)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`.",a));r[2*o]=a[0],r[2*o+1]=a[1]}return i})),N(hn.prototype,"reduce",(function(t,e){var r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=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=ln(r,0),o=1}for(;o<i;o++)n=t(n,ln(r,o),o,this);return n})),N(hn.prototype,"reduceRight",(function(t,e){var r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=this._buffer,i=this._length,arguments.length>1)n=e,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=ln(r,i-1),o=i-2}for(;o>=0;o--)n=t(n,ln(r,o),o,this);return n})),N(hn.prototype,"reverse",(function(){var t,e,r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,t=this._buffer,n=Yt(r/2),i=0;i<n;i++)o=r-i-1,e=t[2*i],t[2*i]=t[2*o],t[2*o]=e,e=t[2*i+1],t[2*i+1]=t[2*o+1],t[2*o+1]=e;return this})),N(hn.prototype,"set",(function(t){var e,r,n,i,o,a,u,s,f;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Fr(r=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if($r(t)){if(r>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=tn(t),void(n[r+1]=en(t))}if(sn(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,f=n.byteOffset+r*an,e.buffer===n.buffer&&e.byteOffset<f&&e.byteOffset+e.byteLength>f){for(i=new Ze(e.length),s=0;s<e.length;s++)i[s]=e[s];e=i}for(r*=2,f=0,s=0;s<a;s++)n[r]=e[f],n[r+1]=e[f+1],r+=2,f+=2}else{if(!pe(t))throw new TypeError(S("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",t));for(a=t.length,s=0;s<a;s++)if(!$r(t[s])){o=!0;break}if(o){if(!zr(a))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,f=n.byteOffset+r*an,e.buffer===n.buffer&&e.byteOffset<f&&e.byteOffset+e.byteLength>f){for(i=new Ze(a),s=0;s<a;s++)i[s]=e[s];e=i}for(r*=2,a/=2,f=0,s=0;s<a;s++)n[r]=e[f],n[r+1]=e[f+1],r+=2,f+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,s=0;s<a;s++)u=t[s],n[r]=tn(u),n[r+1]=en(u),r+=2}})),N(hn.prototype,"slice",(function(t,e){var r,n,i,o,a,u,s;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)t=0,e=u;else{if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=u)<0&&(t=0),1===arguments.length)e=u;else{if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(r=t<e?e-t:0,n=(i=new this.constructor(r))._buffer,s=0;s<r;s++)o=2*(s+t),n[2*s]=a[o],n[2*s+1]=a[o+1];return i})),N(hn.prototype,"some",(function(t,e){var r,n;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(t.call(e,ln(r,n),n,this))return!0;return!1})),N(hn.prototype,"sort",(function(t){var e,r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length,e=[],i=0;i<n;i++)e.push(ln(r,i));for(e.sort(t),i=0;i<n;i++)r[o=2*i]=tn(e[i]),r[o+1]=en(e[i]);return this})),N(hn.prototype,"subarray",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)t=0,e=i;else{if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=i)<0&&(t=0),1===arguments.length)e=i;else{if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return t>=i?(i=0,r=n.byteLength):t>=e?(i=0,r=n.byteOffset+t*an):(i=e-t,r=n.byteOffset+t*an),new this.constructor(n.buffer,r,i<0?0:i)})),N(hn.prototype,"toLocaleString",(function(t,e){var r,n,i,o,a;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!jt(t)&&!Ur(t))throw new TypeError(S("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",t));n=t}if(arguments.length<2)r={};else{if(!Z(e))throw new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",e));r=e}for(o=this._buffer,i=[],a=0;a<this._length;a++)i.push(ln(o,a).toLocaleString(n,r));return i.join(",")})),N(hn.prototype,"toReversed",(function(){var t,e,r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,e=new this.constructor(r),n=this._buffer,t=e._buffer,i=0;i<r;i++)o=r-i-1,t[2*i]=n[2*o],t[2*i+1]=n[2*o+1];return e})),N(hn.prototype,"toSorted",(function(t){var e,r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length,e=[],i=0;i<n;i++)e.push(ln(r,i));return e.sort(t),new hn(e)})),N(hn.prototype,"toString",(function(){var t,e,r;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=this._buffer,r=0;r<this._length;r++)t.push(ln(e,r).toString());return t.join(",")})),N(hn.prototype,"values",(function(){var t,e,r,n,i,o;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,i=this._buffer,r=this._length,o=-1,N(t={},"next",(function(){if(o+=1,n||o>=r)return{done:!0};return{value:ln(i,o),done:!1}})),N(t,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(t,Qr,(function(){return e.values()})),t})),N(hn.prototype,"with",(function(t,e){var r,n,i;if(!sn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(i=this._length,t<0&&(t+=i),t<0||t>=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!$r(e))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(r=(n=new this.constructor(this._buffer))._buffer)[2*t]=tn(e),r[2*t+1]=en(e),n}));var yn=2*We.BYTES_PER_ELEMENT,mn=Kr();function dn(t){return t instanceof bn||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function vn(t){return t===bn||"Complex64Array"===t.name}function wn(t,e){return new Yr(t[e*=2],t[e+1])}function bn(){var t,e,r,n;if(e=arguments.length,!(this instanceof bn))return 0===e?new bn:1===e?new bn(arguments[0]):2===e?new bn(arguments[0],arguments[1]):new bn(arguments[0],arguments[1],arguments[2]);if(0===e)r=new We(0);else if(1===e)if(Fr(arguments[0]))r=new We(2*arguments[0]);else if(pe(arguments[0]))if((n=(r=arguments[0]).length)&&z(r)&&$r(r[0])){if(r=function(t,e){var r,n,i,o;for(r=e.length,o=0,i=0;i<r;i++){if(!$r(n=e[i]))return null;t[o]=cn(n),t[o+1]=pn(n),o+=2}return t}(new We(2*n),r),null===r){if(!zr(n))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new We(arguments[0])}}else{if(Xr(r))r=rn(r,0);else if(Hr(r))r=nn(r,0);else if(!zr(n))throw new RangeError(S("invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.",n));r=new We(r)}else if(Br(arguments[0])){if(!Dt((r=arguments[0]).byteLength/yn))throw new RangeError(S("invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.",yn,r.byteLength));r=new We(r)}else{if(!Z(arguments[0]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",arguments[0]));if(r=arguments[0],!1===mn)throw new TypeError(S("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",r));if(!vt(r[Qr]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if(!vt((r=r[Qr]()).next))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",r));if((r=gn(r))instanceof Error)throw r;r=new We(r)}else{if(!Br(r=arguments[0]))throw new TypeError(S("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",r));if(!Fr(t=arguments[1]))throw new TypeError(S("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(!Dt(t/yn))throw new RangeError(S("invalid argument. Byte offset must be a multiple of %u. Value: `%u`.",yn,t));if(2===e){if(!Dt((n=r.byteLength-t)/yn))throw new RangeError(S("invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.",yn,n));r=new We(r,t)}else{if(!Fr(n=arguments[2]))throw new TypeError(S("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*yn>r.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*yn));r=new We(r,t,2*n)}}return N(this,"_buffer",r),N(this,"_length",r.length/2),this}function _n(t){var e,r;for(e=[];!(r=t.next()).done;)e.push(H(r.value));return e}N(bn,"BYTES_PER_ELEMENT",yn),N(bn,"name","Complex128Array"),N(bn,"from",(function(t){var e,r,n,i,o,a,u,s,f,l,h,c;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!vn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((r=arguments.length)>1){if(!vt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(dn(t)){if(s=t.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h<s;h++){if($r(l=n.call(e,t.get(h),h)))o[c]=cn(l),o[c+1]=pn(l);else{if(!(Rr(l)&&l.length>=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(pe(t)){if(n){for(s=t.length,u=t.get&&t.set?Me("default"):Le("default"),h=0;h<s;h++)if(!$r(u(t,h))){f=!0;break}if(f){if(!zr(s))throw new RangeError(S("invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.",s));for(o=(i=new this(s/2))._buffer,h=0;h<s;h++)o[h]=n.call(e,u(t,h),h);return i}for(o=(i=new this(s))._buffer,c=0,h=0;h<s;h++){if($r(l=n.call(e,u(t,h),h)))o[c]=cn(l),o[c+1]=pn(l);else{if(!(Rr(l)&&l.length>=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(Z(t)&&mn&&vt(t[Qr])){if(!vt((o=t[Qr]()).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,e,r){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Rr(o=e.call(r,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!$r(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(cn(o),pn(o))}return n}(o,n,e):gn(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h<s;h++)o[h]=a[h];return i}throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),N(bn,"of",(function(){var t,e;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!vn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),N(bn.prototype,"at",(function(t){if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. Must provide an integer. Value: `%s`.",t));if(t<0&&(t+=this._length),!(t<0||t>=this._length))return wn(this._buffer,t)})),At(bn.prototype,"buffer",(function(){return this._buffer.buffer})),At(bn.prototype,"byteLength",(function(){return this._buffer.byteLength})),At(bn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(bn.prototype,"BYTES_PER_ELEMENT",bn.BYTES_PER_ELEMENT),N(bn.prototype,"copyWithin",(function(t,e){if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*e):this._buffer.copyWithin(2*t,2*e,2*arguments[2]),this})),N(bn.prototype,"entries",(function(){var t,e,r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,t=this._buffer,n=this._length,o=-1,a=-2,N(r={},"next",(function(){var e;if(o+=1,i||o>=n)return{done:!0};return e=new Yr(t[a+=2],t[a+1]),{value:[o,e],done:!1}})),N(r,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(r,Qr,(function(){return e.entries()})),r})),N(bn.prototype,"every",(function(t,e){var r,n;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(!t.call(e,wn(r,n),n,this))return!1;return!0})),N(bn.prototype,"fill",(function(t,e,r){var n,i,o,a,u,s;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!Dt(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));r<0&&(r+=i)<0&&(r=0),r>i&&(r=i)}else r=i}else e=0,r=i;for(a=cn(t),u=pn(t),s=e;s<r;s++)n[o=2*s]=a,n[o+1]=u;return this})),N(bn.prototype,"filter",(function(t,e){var r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=[],i=0;i<this._length;i++)o=wn(r,i),t.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),N(bn.prototype,"find",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(i=wn(r,n),t.call(e,i,n,this))return i})),N(bn.prototype,"findIndex",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(i=wn(r,n),t.call(e,i,n,this))return n;return-1})),N(bn.prototype,"findLast",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=wn(r,n),t.call(e,i,n,this))return i})),N(bn.prototype,"findLastIndex",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length-1;n>=0;n--)if(i=wn(r,n),t.call(e,i,n,this))return n;return-1})),N(bn.prototype,"forEach",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)i=wn(r,n),t.call(e,i,n,this)})),N(bn.prototype,"get",(function(t){if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Fr(t))throw new TypeError(S("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return wn(this._buffer,t)})),At(bn.prototype,"length",(function(){return this._length})),N(bn.prototype,"includes",(function(t,e){var r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=cn(t),o=pn(t),r=this._buffer,a=e;a<this._length;a++)if(i===r[n=2*a]&&o===r[n+1])return!0;return!1})),N(bn.prototype,"indexOf",(function(t,e){var r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(i=cn(t),o=pn(t),r=this._buffer,a=e;a<this._length;a++)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),N(bn.prototype,"join",(function(t){var e,r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=",";else{if(!kt(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));n=t}for(e=[],r=this._buffer,i=0;i<this._length;i++)e.push(wn(r,i).toString());return e.join(n)})),N(bn.prototype,"keys",(function(){var t,e,r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return t=this,r=this._length,i=-1,N(e={},"next",(function(){if(i+=1,n||i>=r)return{done:!0};return{value:i,done:!1}})),N(e,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return t.keys()})),e})),N(bn.prototype,"lastIndexOf",(function(t,e){var r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!$r(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!Dt(e))throw new TypeError(S("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=cn(t),o=pn(t),r=this._buffer,a=e;a>=0;a--)if(i===r[n=2*a]&&o===r[n+1])return a;return-1})),N(bn.prototype,"map",(function(t,e){var r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,r=(i=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)if($r(a=t.call(e,wn(n,o),o,this)))r[2*o]=cn(a),r[2*o+1]=pn(a);else{if(!Rr(a)||2!==a.length)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`.",a));r[2*o]=a[0],r[2*o+1]=a[1]}return i})),N(bn.prototype,"reduce",(function(t,e){var r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=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=wn(r,0),o=1}for(;o<i;o++)n=t(n,wn(r,o),o,this);return n})),N(bn.prototype,"reduceRight",(function(t,e){var r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=this._buffer,i=this._length,arguments.length>1)n=e,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=wn(r,i-1),o=i-2}for(;o>=0;o--)n=t(n,wn(r,o),o,this);return n})),N(bn.prototype,"reverse",(function(){var t,e,r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,t=this._buffer,n=Yt(r/2),i=0;i<n;i++)o=r-i-1,e=t[2*i],t[2*i]=t[2*o],t[2*o]=e,e=t[2*i+1],t[2*i+1]=t[2*o+1],t[2*o+1]=e;return this})),N(bn.prototype,"set",(function(t){var e,r,n,i,o,a,u,s,f;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,arguments.length>1){if(!Fr(r=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if($r(t)){if(r>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));return n[r*=2]=cn(t),void(n[r+1]=pn(t))}if(dn(t)){if(r+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t._buffer,f=n.byteOffset+r*yn,e.buffer===n.buffer&&e.byteOffset<f&&e.byteOffset+e.byteLength>f){for(i=new We(e.length),s=0;s<e.length;s++)i[s]=e[s];e=i}for(r*=2,f=0,s=0;s<a;s++)n[r]=e[f],n[r+1]=e[f+1],r+=2,f+=2}else{if(!pe(t))throw new TypeError(S("invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.",t));for(a=t.length,s=0;s<a;s++)if(!$r(t[s])){o=!0;break}if(o){if(!zr(a))throw new RangeError(S("invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.",a));if(r+a/2>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,f=n.byteOffset+r*yn,e.buffer===n.buffer&&e.byteOffset<f&&e.byteOffset+e.byteLength>f){for(i=new We(a),s=0;s<a;s++)i[s]=e[s];e=i}for(r*=2,a/=2,f=0,s=0;s<a;s++)n[r]=e[f],n[r+1]=e[f+1],r+=2,f+=2;return}if(r+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(r*=2,s=0;s<a;s++)u=t[s],n[r]=cn(u),n[r+1]=pn(u),r+=2}})),N(bn.prototype,"slice",(function(t,e){var r,n,i,o,a,u,s;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(a=this._buffer,u=this._length,0===arguments.length)t=0,e=u;else{if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=u)<0&&(t=0),1===arguments.length)e=u;else{if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(r=t<e?e-t:0,n=(i=new this.constructor(r))._buffer,s=0;s<r;s++)o=2*(s+t),n[2*s]=a[o],n[2*s+1]=a[o+1];return i})),N(bn.prototype,"some",(function(t,e){var r,n;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(t.call(e,wn(r,n),n,this))return!0;return!1})),N(bn.prototype,"sort",(function(t){var e,r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length,e=[],i=0;i<n;i++)e.push(wn(r,i));for(e.sort(t),i=0;i<n;i++)r[o=2*i]=cn(e[i]),r[o+1]=pn(e[i]);return this})),N(bn.prototype,"subarray",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(n=this._buffer,i=this._length,0===arguments.length)t=0,e=i;else{if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=i)<0&&(t=0),1===arguments.length)e=i;else{if(!Dt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return t>=i?(i=0,r=n.byteLength):t>=e?(i=0,r=n.byteOffset+t*yn):(i=e-t,r=n.byteOffset+t*yn),new this.constructor(n.buffer,r,i<0?0:i)})),N(bn.prototype,"toLocaleString",(function(t,e){var r,n,i,o,a;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!kt(t)&&!Ur(t))throw new TypeError(S("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",t));n=t}if(arguments.length<2)r={};else{if(!Z(e))throw new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",e));r=e}for(o=this._buffer,i=[],a=0;a<this._length;a++)i.push(wn(o,a).toLocaleString(n,r));return i.join(",")})),N(bn.prototype,"toReversed",(function(){var t,e,r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(r=this._length,e=new this.constructor(r),n=this._buffer,t=e._buffer,i=0;i<r;i++)o=r-i-1,t[2*i]=n[2*o],t[2*i+1]=n[2*o+1];return e})),N(bn.prototype,"toSorted",(function(t){var e,r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=this._length,e=[],i=0;i<n;i++)e.push(wn(r,i));return e.sort(t),new bn(e)})),N(bn.prototype,"toString",(function(){var t,e,r;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=[],e=this._buffer,r=0;r<this._length;r++)t.push(wn(e,r).toString());return t.join(",")})),N(bn.prototype,"values",(function(){var t,e,r,n,i,o;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,i=this._buffer,r=this._length,o=-1,N(t={},"next",(function(){if(o+=1,n||o>=r)return{done:!0};return{value:wn(i,o),done:!1}})),N(t,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(t,Qr,(function(){return e.values()})),t})),N(bn.prototype,"with",(function(t,e){var r,n,i;if(!dn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Dt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(i=this._length,t<0&&(t+=i),t<0||t>=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!$r(e))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",e));return(r=(n=new this.constructor(this._buffer))._buffer)[2*t]=cn(e),r[2*t+1]=pn(e),n}));var En=wr.BYTES_PER_ELEMENT,Tn=Kr();function xn(t){return"object"==typeof t&&null!==t&&"BooleanArray"===t.constructor.name&&t.BYTES_PER_ELEMENT===En}function Vn(t){return t===An}function An(){var t,e,r,n,i;if(e=arguments.length,!(this instanceof An))return 0===e?new An:1===e?new An(arguments[0]):2===e?new An(arguments[0],arguments[1]):new An(arguments[0],arguments[1],arguments[2]);if(0===e)r=new wr(0);else if(1===e)if(Fr(i=arguments[0]))r=new wr(i);else if(pe(i))r=function(t,e){var r,n;for(r=e.length,n=0;n<r;n++)t[n]=H(e[n]);return t}(new wr(i.length),i);else if(Br(i))r=new wr(i);else{if(!Z(i))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",i));if(!1===Tn)throw new TypeError(S("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",i));if(!vt(i[Qr]))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",i));if(!vt((r=i[Qr]()).next))throw new TypeError(S("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",i));r=new wr(_n(r))}else{if(!Br(r=arguments[0]))throw new TypeError(S("invalid argument. First argument must be an ArrayBuffer. Value: `%s`.",r));if(!Fr(t=arguments[1]))throw new TypeError(S("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",t));if(2===e)r=new wr(r,t);else{if(!Fr(n=arguments[2]))throw new TypeError(S("invalid argument. Length must be a nonnegative integer. Value: `%s`.",n));if(n*En>r.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*En));r=new wr(r,t,n)}}return N(this,"_buffer",r),N(this,"_length",r.length),this}N(An,"BYTES_PER_ELEMENT",En),N(An,"name","BooleanArray"),N(An,"from",(function(t){var e,r,n,i,o,a,u,s,f;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Vn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((r=arguments.length)>1){if(!vt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));r>2&&(e=arguments[2])}if(pe(t)){if(n){for(s=t.length,u=t.get&&t.set?Me("default"):Le("default"),o=(i=new this(s))._buffer,f=0;f<s;f++)o[f]=H(n.call(e,u(t,f),f));return i}return new this(t)}if(Z(t)&&Tn&&vt(t[Qr])){if(!vt((o=t[Qr]()).next))throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));for(a=n?function(t,e,r){var n,i,o;for(n=[],o=-1;!(i=t.next()).done;)o+=1,n.push(H(e.call(r,i.value,o)));return n}(o,n,e):_n(o),o=(i=new this(s=a.length))._buffer,f=0;f<s;f++)o[f]=a[f];return i}throw new TypeError(S("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t))})),N(An,"of",(function(){var t,e;if(!vt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Vn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);return new this(t)})),N(An.prototype,"at",(function(t){var e,r;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Jt(t))throw new TypeError(S("invalid argument. Must provide an integer. Value: `%s`.",t));if(r=this._length,e=this._buffer,t<0&&(t+=r),!(t<0||t>=r))return H(e[t])})),At(An.prototype,"buffer",(function(){return this._buffer.buffer})),At(An.prototype,"byteLength",(function(){return this._buffer.byteLength})),At(An.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),N(An.prototype,"BYTES_PER_ELEMENT",An.BYTES_PER_ELEMENT),N(An.prototype,"copyWithin",(function(t,e){if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return 2===arguments.length?this._buffer.copyWithin(t,e):this._buffer.copyWithin(t,e,arguments[2]),this})),N(An.prototype,"entries",(function(){var t,e,r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return t=this,n=this._buffer,r=this._length,o=-1,N(e={},"next",(function(){if(o+=1,i||o>=r)return{done:!0};return{value:[o,H(n[o])],done:!1}})),N(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return t.entries()})),e})),N(An.prototype,"every",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(!t.call(e,H(r[n]),n,this))return!1;return!0})),N(An.prototype,"fill",(function(t,e,r){var n,i,o,a;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!q(t))throw new TypeError(S("invalid argument. First argument must be a boolean. Value: `%s`.",t));if(n=this._buffer,i=this._length,arguments.length>1){if(!Jt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),arguments.length>2){if(!Jt(r))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",r));r<0&&(r+=i)<0&&(r=0),r>i&&(r=i)}else r=i}else e=0,r=i;for(o=t?1:0,a=e;a<r;a++)n[a]=o;return this})),N(An.prototype,"filter",(function(t,e){var r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=[],i=0;i<this._length;i++)o=H(r[i]),t.call(e,o,i,this)&&n.push(o);return new this.constructor(n)})),N(An.prototype,"find",(function(t,e){var r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,i=0;i<this._length;i++)if(n=H(r[i]),t.call(e,n,i,this))return n})),N(An.prototype,"findIndex",(function(t,e){var r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,i=0;i<this._length;i++)if(n=H(r[i]),t.call(e,n,i,this))return i;return-1})),N(An.prototype,"findLast",(function(t,e){var r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,i=this._length-1;i>=0;i--)if(n=H(r[i]),t.call(e,n,i,this))return n})),N(An.prototype,"findLastIndex",(function(t,e){var r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,i=this._length-1;i>=0;i--)if(n=H(r[i]),t.call(e,n,i,this))return i;return-1})),N(An.prototype,"forEach",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)t.call(e,H(r[n]),n,this)})),N(An.prototype,"get",(function(t){if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Fr(t))throw new TypeError(S("invalid argument. Must provide a nonnegative integer. Value: `%s`.",t));if(!(t>=this._length))return H(this._buffer[t])})),N(An.prototype,"includes",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!q(t))throw new TypeError(S("invalid argument. First argument must be a boolean. Value: `%s`.",t));if(arguments.length>1){if(!Jt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(r=this._buffer,n=e;n<this._length;n++)if(t===H(r[n]))return!0;return!1})),N(An.prototype,"indexOf",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!q(t))throw new TypeError(S("invalid argument. First argument must be a boolean. Value: `%s`.",t));if(arguments.length>1){if(!Jt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(r=this._buffer,n=e;n<this._length;n++)if(t===H(r[n]))return n;return-1})),N(An.prototype,"join",(function(t){var e,r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(arguments.length>0){if(!jt(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t))}else t=",";for(e=this._buffer,r=[],n=0;n<this._length;n++)e[n]?r.push("true"):r.push("false");return r.join(t)})),N(An.prototype,"keys",(function(){var t,e,r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return t=this,r=this._length,i=-1,N(e={},"next",(function(){if(i+=1,n||i>=r)return{done:!0};return{value:i,done:!1}})),N(e,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return t.keys()})),e})),N(An.prototype,"lastIndexOf",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!q(t))throw new TypeError(S("invalid argument. First argument must be a boolean. Value: `%s`.",t));if(arguments.length>1){if(!Jt(e))throw new TypeError(S("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(r=this._buffer,n=e;n>=0;n--)if(t===H(r[n]))return n;return-1})),At(An.prototype,"length",(function(){return this._length})),N(An.prototype,"map",(function(t,e){var r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",t);for(i=this._buffer,r=(n=new this.constructor(this._length))._buffer,o=0;o<this._length;o++)r[o]=H(t.call(e,H(i[o]),o,this));return n})),N(An.prototype,"reduce",(function(t,e){var r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=this._buffer,n=this._length,arguments.length>1)i=e,o=0;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=H(r[0]),o=1}for(;o<n;o++)i=t(i,H(r[o]),o,this);return i})),N(An.prototype,"reduceRight",(function(t,e){var r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));if(r=this._buffer,n=this._length,arguments.length>1)i=e,o=n-1;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=H(r[n-1]),o=n-2}for(;o>=0;o--)i=t(i,H(r[o]),o,this);return i})),N(An.prototype,"reverse",(function(){var t,e,r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(t=this._buffer,r=this._length,n=Yt(r/2),i=0;i<n;i++)o=r-i-1,e=t[i],t[i]=t[o],t[o]=e;return this})),N(An.prototype,"set",(function(t){var e,r,n,i,o,a,u;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(n=this._buffer,arguments.length>1){if(!Fr(r=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",r))}else r=0;if(pe(t)){if(r+(o=t.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=xn(t)?t._buffer:t,u=n.byteOffset+r*En,e.buffer===n.buffer&&e.byteOffset<u&&e.byteOffset+e.byteLength>u){for(i=new wr(e.length),a=0;a<e.length;a++)i[a]=e[a];e=i}for(a=0;a<o;r++,a++)n[r]=e[a]?1:0}else{if(r>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",r));n[r]=t?1:0}})),N(An.prototype,"slice",(function(t,e){var r,n,i,o,a,u;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(o=this._buffer,a=this._length,0===arguments.length)t=0,e=a;else{if(!Jt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=a)<0&&(t=0),1===arguments.length)e=a;else{if(!Jt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=a)<0&&(e=0):e>a&&(e=a)}}for(r=t<e?e-t:0,n=(i=new this.constructor(r))._buffer,u=0;u<r;u++)n[u]=o[u+t];return i})),N(An.prototype,"some",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(r=this._buffer,n=0;n<this._length;n++)if(t.call(e,H(r[n]),n,this))return!0;return!1})),N(An.prototype,"sort",(function(t){var e;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(e=this._buffer,0===arguments.length)return e.sort(),this;if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));return e.sort((function(e,r){return t(H(e),H(r))})),this})),N(An.prototype,"subarray",(function(t,e){var r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(n=this._buffer,i=this._length,0===arguments.length)t=0,e=i;else{if(!Jt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=i)<0&&(t=0),1===arguments.length)e=i;else{if(!Jt(e))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",e));e<0?(e+=i)<0&&(e=0):e>i&&(e=i)}}return t>=i?(i=0,r=n.byteLength):t>=e?(i=0,r=n.byteOffset+t*En):(i=e-t,r=n.byteOffset+t*En),new this.constructor(n.buffer,r,i<0?0:i)})),N(An.prototype,"toLocaleString",(function(t,e){var r,n,i,o,a;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(0===arguments.length)n=[];else{if(!jt(t)&&!Ur(t))throw new TypeError(S("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",t));n=t}if(arguments.length<2)r={};else{if(!Z(e))throw new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",e));r=e}for(o=this._buffer,i=[],a=0;a<this._length;a++)i.push(H(o[a]).toLocaleString(n,r));return i.join(",")})),N(An.prototype,"toReversed",(function(){var t,e,r,n,i;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(r=this._length,e=new this.constructor(r),n=this._buffer,t=e._buffer,i=0;i<r;i++)t[i]=n[r-i-1];return e})),N(An.prototype,"toSorted",(function(t){var e,r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(n=this._length,r=new this.constructor(n),i=this._buffer,e=r._buffer,o=0;o<n;o++)e[o]=i[o];if(0===arguments.length)return e.sort(),r;if(!vt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));return e.sort((function(e,r){return t(H(e),H(r))})),r})),N(An.prototype,"toString",(function(){var t,e,r;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(t=[],e=this._buffer,r=0;r<this._length;r++)e[r]?t.push("true"):t.push("false");return t.join(",")})),N(An.prototype,"values",(function(){var t,e,r,n,i,o;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return e=this,i=this._buffer,r=this._length,o=-1,N(t={},"next",(function(){if(o+=1,n||o>=r)return{done:!0};return{value:H(i[o]),done:!1}})),N(t,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(t,Qr,(function(){return e.values()})),t})),N(An.prototype,"with",(function(t,e){var r,n;if(!xn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Jt(t))throw new TypeError(S("invalid argument. First argument must be an integer. Value: `%s`.",t));if(n=this._length,t<0&&(t+=n),t<0||t>=n)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!q(e))throw new TypeError(S("invalid argument. Second argument must be a boolean. Value: `%s`.",e));return(r=new this.constructor(this._buffer))._buffer[t]=e?1:0,r}));var On=[We,Ze,ir,Qe,gr,fr,Sr,wr,xr,hn,bn,An],jn=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128","bool"],Sn=jn.length;function Fn(t){var e;if(z(t))return"generic";if(yt(t))return null;for(e=0;e<Sn;e++)if(t instanceof On[e])return jn[e];return Ne[mt(t)]||null}var Ln=Array.prototype.slice;function kn(t,e,r){var n;return function(t,e){return"function"==typeof t[e]}(t,"slice")?t.slice(e,r):(n=function(t){var e=Fn(t);return Se(t)?{data:t,dtype:e,accessorProtocol:!0,accessors:[Me(e),Ue(e)]}:{data:t,dtype:e,accessorProtocol:!1,accessors:[Le(e),Ie(e)]}}(t),n.accessorProtocol?function(t,e,r){var n,i,o,a;for(n=t.data,i=t.accessors[0],o=[],a=e;a<r;a++)o.push(i(n,a));return o}(n,e,r):function(t,e,r){return Ln.call(t,e,r)}(t,e,r))}function In(t,e){return e&&(2===t||3===t)}function Rn(t,e){return e&&(1===t||3===t)}function Mn(t,e,r){var n,i,o,a,u;for(n=t.length,i=r,o=r,u=0;u<n;u++){if(0===t[u])return[r,r];(a=e[u])>0?o+=a*(t[u]-1):a<0&&(i+=a*(t[u]-1))}return[i,o]}function Bn(t){return"column-major"===t}N(Mn,"assign",(function(t,e,r,n){var i,o,a,u,s;for(i=t.length,o=r,a=r,s=0;s<i;s++){if(0===t[s])return n[0]=r,n[1]=r,n;(u=e[s])>0?a+=u*(t[s]-1):u<0&&(o+=u*(t[s]-1))}return n[0]=o,n[1]=a,n}));var Un=/[-\/\\^$*+?.()|[\]{}]/g;var Nn=RegExp.prototype.exec;var Cn=P();function Pn(t){return"object"==typeof t&&(t instanceof RegExp||(Cn?function(t){try{return Nn.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===$(t)))}function Yn(t,e,r){return t.replace(e,r)}function Dn(t,e,r){if(!jt(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));if(jt(e))e=new RegExp(function(t){var e,r;if(!jt(t))throw new TypeError(S("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(r=t.length-1;r>=0&&"/"!==t[r];r--);return void 0===r||r<=0?t.replace(Un,"\\$&"):(e=(e=t.substring(1,r)).replace(Un,"\\$&"),t=t[0]+e+t.substring(r))}(e),"g");else if(!Pn(e))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",e));if(!jt(r)&&!vt(r))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",r));return Yn(t,e,r)}var Wn={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}} ] )",bool:"new BooleanArray( [ {{data}} ] )"};var Jn,Gn={uint16:fr,uint8:wr};(Jn=new Gn.uint16(1))[0]=4660;var $n=52===new Gn.uint8(Jn.buffer)[0],zn="function"==typeof ArrayBuffer?ArrayBuffer:null;var Zn,Xn="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Zn=function(){var t,e,r;if("function"!=typeof zn)return!1;try{(t=Br(r=new zn(16))&&"function"==typeof zn.isView)&&((e=new We(r))[0]=-3.14,e[1]=NaN,t=t&&zn.isView(e)&&16===r.byteLength&&-3.14===e[0]&&e[1]!=e[1])}catch(e){t=!1}return t}()?Xn:function(){throw new Error("not implemented")};var qn=Zn,Hn="function"==typeof DataView;var Kn="function"==typeof DataView?DataView:null;var Qn,ti="function"==typeof DataView?DataView:void 0;Qn=function(){var t,e,r,n;if("function"!=typeof Kn)return!1;try{r=new qn(24),e=new Kn(r,8),n=e,(t=(Hn&&n instanceof DataView||"[object DataView]"===$(n))&&"function"==typeof e.getFloat64&&"function"==typeof e.setFloat64)&&(e.setFloat64(0,-3.14),e.setFloat64(8,NaN),t=t&&e.buffer===r&&16===e.byteLength&&8===e.byteOffset&&-3.14===e.getFloat64(0)&&e.getFloat64(8)!=e.getFloat64(8))}catch(e){t=!1}return t}()?ti:function(){throw new Error("not implemented")};var ei=Qn,ri="function"==typeof BigInt?BigInt:void 0,ni=["row-major","column-major"];function ii(){return ni.slice()}var oi=["row-major","column-major"];function ai(){return{"row-major":101,"column-major":102}}N((function(){return oi.slice()}),"enum",ai);var ui={"row-major":101,"column-major":102};function si(){return{"row-major":ui["row-major"],"column-major":ui["column-major"]}}N(ii,"enum",si);var fi=["throw","normalize","clamp","wrap"];function li(){return{throw:1,clamp:2,wrap:3,normalize:4}}N((function(){return fi.slice()}),"enum",li);var hi={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float16:10,float32:11,float64:12,complex32:13,complex64:14,complex128:15,binary:16,generic:17,notype:18,userdefined_type:256},ci=si(),pi={throw:1,clamp:2,wrap:3,normalize:4};var gi=4294967295,yi=4294967296,mi=new wr(8),di=new ei(mi.buffer);function vi(t,e,r,n){var i,o,a;if(0===t){for(a=0;a<mi.length;a++)e[n]=0,n+=r;return e}for(o=(t&gi)>>>0,i=Yt(t/yi),$n?(di.setUint32(0,o,$n),di.setUint32(4,i,$n)):(di.setUint32(0,i,$n),di.setUint32(4,o,$n)),a=0;a<mi.length;a++)e[n]=mi[a],n+=r;return e}N((function(t){var e,r,n,i;return e=new wr(8),0===t||(i=(4294967295&t)>>>0,n=Yt(t/4294967296),r=new ei(e.buffer),$n?(r.setUint32(0,i,$n),r.setUint32(4,n,$n)):(r.setUint32(0,n,$n),r.setUint32(4,i,$n))),e}),"assign",vi);var wi={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float16:10,float32:11,float64:12,complex32:13,complex64:14,complex128:15,binary:16,generic:17,notype:18,userdefined_type:256},bi=si(),_i={throw:1,clamp:2,wrap:3,normalize:4};function Ei(t,e,r,n,i,o){var a,u,s,f,l;if(!(this instanceof Ei))return new Ei(t,e,r,n,i,o);for(f=1,l=0;l<r.length;l++)f*=r[l];return u=e.BYTES_PER_ELEMENT?e.BYTES_PER_ELEMENT*f:null,this._byteLength=u,this._bytesPerElement=Ve(t),this._buffer=e,this._dtype=t,this._length=f,this._ndims=r.length,this._offset=i,this._order=o,this._shape=r,this._strides=n,this._accessors=H(e.get&&e.set),this._iterationOrder=function(t){var e,r;for(e=0,r=0;r<t.length;r++)t[r]<0&&(e+=1);return 0===e?1:e===t.length?-1:0}(n),a=function(t,e,r,n,i){var o;return 0!==t&&0!==i&&t===(o=Mn(e,r,n))[1]-o[0]+1}(f,r,n,i,this._iterationOrder),s=Oe(n),this._flags={ROW_MAJOR_CONTIGUOUS:Rn(s,a),COLUMN_MAJOR_CONTIGUOUS:In(s,a),READONLY:!1},this.__meta_dataview__=null,this}function Ti(t){return t instanceof Ei||null!==t&&"object"==typeof t&&"object"==typeof t.data&&"object"==typeof t.shape&&"object"==typeof t.strides&&"number"==typeof t.offset&&"string"==typeof t.order&&"number"==typeof t.ndims&&t.dtype&&"number"==typeof t.length&&"object"==typeof t.flags&&"function"==typeof t.get&&"function"==typeof t.set}function xi(t){var e,r,n;if(!pe(t))throw new TypeError(S("invalid argument. Must provide an array-like object. Value: `%s`.",t));return n=Fn(t),Se(t)&&(e=Me(n)),r=t.length,void 0===e?function(e){var n;for(n=0;n<r;n++)if(t[n]===e)return!0;return!1}:function(n){var i;for(i=0;i<r;i++)if(e(t,i)===n)return!0;return!1}}N(Ei,"name","ndarray"),At(Ei.prototype,"byteLength",(function(){return this._byteLength})),At(Ei.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),At(Ei.prototype,"data",(function(){return this._buffer})),At(Ei.prototype,"dtype",(function(){return this._dtype})),At(Ei.prototype,"flags",(function(){return function(t){return{ROW_MAJOR_CONTIGUOUS:t.ROW_MAJOR_CONTIGUOUS,COLUMN_MAJOR_CONTIGUOUS:t.COLUMN_MAJOR_CONTIGUOUS,READONLY:t.READONLY}}(this._flags)})),At(Ei.prototype,"length",(function(){return this._length})),At(Ei.prototype,"ndims",(function(){return this._ndims})),At(Ei.prototype,"offset",(function(){return this._offset})),At(Ei.prototype,"order",(function(){return this._order})),At(Ei.prototype,"shape",(function(){return kn(this._shape,0,this._shape.length)})),At(Ei.prototype,"strides",(function(){return kn(this._strides,0,this._strides.length)})),N(Ei.prototype,"get",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.get(t):this._buffer[t]})),N(Ei.prototype,"iget",(function(t){var e,r,n,i,o,a;if(0===(n=this._ndims))return this._accessors?this._buffer.get(this._offset):this._buffer[this._offset];if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.get(this._offset+t):this._buffer[this._offset+t];if(-1===this._iterationOrder)return this._accessors?this._buffer.get(this.offset-t):this._buffer[this._offset-t]}if(r=this._shape,e=this._strides,i=this._offset,Bn(this._order)){for(a=0;a<n;a++)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]}for(a=n-1;a>=0;a--)t-=o=t%r[a],t/=r[a],i+=o*e[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),N(Ei.prototype,"set",(function(){var t,e;for(t=this._offset,e=0;e<arguments.length-1;e++)t+=this._strides[e]*arguments[e];return this._accessors?this._buffer.set(arguments[e],t):this._buffer[t]=arguments[e],this})),N(Ei.prototype,"iset",(function(t,e){var r,n,i,o,a,u;if(0===(i=this._ndims))return this._accessors?this._buffer.set(t,this._offset):this._buffer[this._offset]=t,this;if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(1===this._iterationOrder)return this._accessors?this._buffer.set(e,this._offset+t):this._buffer[this._offset+t]=e,this;if(-1===this._iterationOrder)return this._accessors?this._buffer.set(e,this._offset-t):this._buffer[this._offset-t]=e,this}if(n=this._shape,r=this._strides,o=this._offset,Bn(this._order)){for(u=0;u<i;u++)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this}for(u=i-1;u>=0;u--)t-=a=t%n[u],t/=n[u],o+=a*r[u];return this._accessors?this._buffer.set(e,o):this._buffer[o]=e,this})),N(Ei.prototype,"toString",(function(){var t,e,r,n,i,o;if(e=this._shape.length,r="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o<this._length;o++)t+=cn(i=this.iget(o))+", "+pn(i),o<this._length-1&&(t+=", ");else for(o=0;o<this._length;o++)t+=this.iget(o),o<this._length-1&&(t+=", ");else{if("complex64"===n||"complex128"===n)for(o=0;o<3;o++)t+=cn(i=this.iget(o))+", "+pn(i),o<2&&(t+=", ");else for(o=0;o<3;o++)t+=this.iget(o),o<2&&(t+=", ");if(t+=", ..., ","complex64"===n||"complex128"===n)for(o=2;o>=0;o--)t+=cn(i=this.iget(this._length-1-o))+", "+pn(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(r+=Dn(Wn[this.dtype],"{{data}}",t),r+=", ",r+=0===e?"[]":"[ "+this._shape.join(", ")+" ]",r+=", ",r+="[ ",0===e)r+="0";else for(o=0;o<e;o++)this._strides[o]<0?r+=-this._strides[o]:r+=this._strides[o],o<e-1&&(r+=", ");return r+=" ]",r+=", ",r+="0",r+=", ",r+="'"+this._order+"'",r+=" )"})),N(Ei.prototype,"toJSON",(function(){var t,e,r,n;for(e=this._length,(t={}).type="ndarray",t.dtype=this.dtype,t.flags={READONLY:this._flags.READONLY},t.order=this._order,t.shape=this._shape.slice(),t.strides=this._strides.slice(),n=0;n<t.strides.length;n++)t.strides[n]<0&&(t.strides[n]*=-1);if(t.data=[],"complex64"===t.dtype||"complex128"===t.dtype)for(n=0;n<e;n++)r=this.iget(n),t.data.push(cn(r),pn(r));else for(n=0;n<e;n++)t.data.push(this.iget(n));return t})),N(Ei.prototype,"valueOf",(function(){return 0===this._ndims?this.iget():this})),N(Ei.prototype,"__array_meta_dataview__","function"==typeof Ot.BigInt&&"function"==typeof BigInt&&"bigint"==typeof Ot.BigInt("1")&&"bigint"==typeof BigInt("1")?function(){var t,e,r,n,i,o,a,u,s,f,l,h,c,p;if(s=this._mode||"throw",a=this._submode||[s],r=33+16*(h=this._ndims)+(c=a.length),(u=this.__meta_dataview__)&&u.byteLength===r)return u;for(u=new ei(new qn(r)),i=this._shape,o=this._strides,n=this._dtype,t=this._bytesPerElement,f=0,u.setInt8(f,$n?1:0),f+=1,u.setInt16(f,hi[n],$n),f+=2,u.setBigInt64(f,ri(h),$n),l=8*h,f+=8,p=0;p<h;p++)u.setBigInt64(f,ri(i[p]),$n),u.setBigInt64(f+l,ri(o[p]*t),$n),f+=8;for(f+=l,u.setBigInt64(f,ri(this._offset*t),$n),f+=8,u.setInt8(f,ci[this._order]),f+=1,u.setInt8(f,pi[s]),f+=1,u.setBigInt64(f,ri(c),$n),f+=8,p=0;p<c;p++)u.setInt8(f,pi[a[p]]),f+=1;return e=0,e|=this._flags.READONLY?4:0,u.setInt32(f,e,$n),this.__meta_dataview__=u,u}:function(){var t,e,r,n,i,o,a,u,s,f,l,h,c,p,g;if(f=this._mode||"throw",u=this._submode||[f],n=33+16*(c=this._ndims)+(p=u.length),(s=this.__meta_dataview__)&&s.byteLength===n)return s;for(s=new ei(new qn(n)),e=new wr(s.buffer),o=this._shape,a=this._strides,i=this._dtype,t=this._bytesPerElement,l=0,s.setInt8(l,$n?1:0),l+=1,s.setInt16(l,wi[i],$n),vi(c,e,1,l+=2),h=8*c,l+=8,g=0;g<c;g++)vi(o[g],e,1,l),vi(a[g]*t,e,1,l+h),l+=8;for(l+=h,vi(this._offset*t,e,1,l),l+=8,s.setInt8(l,bi[this._order]),l+=1,s.setInt8(l,_i[f]),vi(p,e,1,l+=1),l+=8,g=0;g<p;g++)s.setInt8(l,_i[u[g]]),l+=1;return r=0,r|=this._flags.READONLY?4:0,s.setInt32(l,r,$n),this.__meta_dataview__=s,s}),N((function(t,e){var r,n,i,o;for(i=Fn(t),n=Se(t)?Me(i):Le(i),r=t.length,o=0;o<r;o++)if(n(t,o)===e)return!0;return!1}),"factory",xi);var Vi={all:["binary","bool","complex32","complex64","complex128","float16","float32","float64","generic","int16","int32","int8","uint16","uint32","uint8","uint8c"],typed:["binary","bool","complex32","complex64","complex128","float16","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],floating_point:["complex32","complex64","complex128","float16","float32","float64"],real_floating_point:["float16","float32","float64"],complex_floating_point:["complex32","complex64","complex128"],boolean:["bool"],integer:["int16","int32","int8","uint16","uint32","uint8","uint8c"],signed_integer:["int16","int32","int8"],unsigned_integer:["uint16","uint32","uint8","uint8c"],real:["float16","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],numeric:["complex32","complex64","complex128","float16","float32","float64","int16","int32","int8","uint16","uint32","uint8","uint8c"],index:["int32","uint8","bool","generic"],integer_index:["int32"],boolean_index:["bool"],mask_index:["uint8"],typed_index:["int32","uint8","bool"]},Ai=/_and_generic$/;function Oi(){var t,e,r;return 0===arguments.length?Vi.all.slice():(r=!1,t=arguments[0],Ai.test(t)&&"all"!==(t=Yn(t,Ai,""))&&"index"!==t&&(r=!0),e=(e=Vi[t])?e.slice():[],r&&e.length>0&&e.push("generic"),e)}var ji=xi(Oi());function Si(t,e){return null!=t&&("symbol"==typeof e?e in Object(t):String(e)in Object(t))}function Fi(t){return vt(t)&&zt(t.alignment)&&zt(t.byteLength)&&vt(t.byteLengthOf)&&vt(t.byteOffsetOf)&&vt(t.bufferOf)&&vt(t.isStruct)&&vt(t.viewOf)&&W(t,"fields")&&W(t,"layout")}var Li,ki,Ii,Ri={bool:0,int8:1,uint8:2,uint8c:3,int16:4,uint16:5,int32:6,uint32:7,int64:8,uint64:9,float16:10,float32:11,float64:12,complex32:13,complex64:14,complex128:15,binary:16,generic:17,notype:18,userdefined_type:256};function Mi(t){var e=Ri[t];return It(e)?e:null}function Bi(t){var e=typeof t;return"string"===e?null===Mi(t)?null:t:"number"===e?Te(t):"object"===e&&t?String(t):Fi(t)?t.layout:null}function Ui(t,e){var r,n,i;if(r=arguments.length,!(this instanceof Ui))return r<2?new Ui(t):new Ui(t,e);if(ji(t))n="builtin";else{if(function(t){return t instanceof Ui||"object"==typeof t&&null!==t&&"DataType"===t.constructor.name&&jt(t.char)&&jt(t.description)&&jt(t.byteOrder)&&Si(t,"value")}(t))return new Ui(t.value,{description:t.description});if(!Fi(t))throw new TypeError(S("invalid argument. First argument must be either a supported data type string, a struct constructor, or another data type instance. Value: `%s`.",t));n="struct"}if(r>1){if(!xt(i=e))throw new TypeError(S("invalid argument. Options argument must be an object. Value: `%s`.",i));if(W(i,"description")&&!jt(i.description))throw new TypeError(S("invalid option. `%s` option must be a string. Option: `%s`.","description",i.description))}else i={};return N(this,"_value",t),N(this,"_description",i.description||function(t){return 0===arguments.length?{binary:"byte",bool:"boolean",complex32:"half-precision floating-point complex number",complex64:"single-precision floating-point complex number",complex128:"double-precision floating-point complex number",float16:"half-precision floating-point number",bfloat16:"brain floating-point number",float32:"single-precision floating-point number",float64:"double-precision floating-point number",float128:"quadruple-precision floating-point number",generic:"generic array value",int8:"signed 8-bit integer",int16:"signed 16-bit integer",int32:"signed 32-bit integer",int64:"signed 64-bit integer",int128:"signed 128-bit integer",int256:"signed 256-bit integer",uint8:"unsigned 8-bit integer",uint8c:"unsigned 8-bit integer (clamped)",uint16:"unsigned 16-bit integer",uint32:"unsigned 32-bit integer",uint64:"unsigned 64-bit integer",uint128:"unsigned 128-bit integer",uint256:"unsigned 256-bit integer"}:(void 0===Li&&(Li={binary:"byte",bool:"boolean",complex32:"half-precision floating-point complex number",complex64:"single-precision floating-point complex number",complex128:"double-precision floating-point complex number",float16:"half-precision floating-point number",bfloat16:"brain floating-point number",float32:"single-precision floating-point number",float64:"double-precision floating-point number",float128:"quadruple-precision floating-point number",generic:"generic array value",int8:"signed 8-bit integer",int16:"signed 16-bit integer",int32:"signed 32-bit integer",int64:"signed 64-bit integer",int128:"signed 128-bit integer",int256:"signed 256-bit integer",uint8:"unsigned 8-bit integer",uint8c:"unsigned 8-bit integer (clamped)",uint16:"unsigned 16-bit integer",uint32:"unsigned 32-bit integer",uint64:"unsigned 64-bit integer",uint128:"unsigned 128-bit integer",uint256:"unsigned 256-bit integer"}),Li[Bi(t)]||null)}(t)||""),N(this,"_char",function(t){return 0===arguments.length?{binary:"r",bool:"x",complex32:"j",complex64:"c",complex128:"z",float16:"h",bfloat16:"e",float32:"f",float64:"d",float128:"g",generic:"o",int8:"s",int16:"k",int32:"i",int64:"l",int128:"m",int256:"n",uint8:"b",uint8c:"a",uint16:"t",uint32:"u",uint64:"v",uint128:"w",uint256:"y"}:(void 0===ki&&(ki={binary:"r",bool:"x",complex32:"j",complex64:"c",complex128:"z",float16:"h",bfloat16:"e",float32:"f",float64:"d",float128:"g",generic:"o",int8:"s",int16:"k",int32:"i",int64:"l",int128:"m",int256:"n",uint8:"b",uint8c:"a",uint16:"t",uint32:"u",uint64:"v",uint128:"w",uint256:"y"}),ki[Bi(t)]||null)}(t)||""),N(this,"_enum",function(t){var e=typeof t;return"number"===e?Te(t)?t:null:"string"===e?Mi(t):"object"===e&&t&&Jt(t.enum)?t.enum:Fi(t)?Mi("userdefined_type"):null}(t)||-1),N(this,"_alignment",function(t){var e;return 0===arguments.length?{binary:1,bool:1,complex32:2,complex64:4,complex128:8,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32}:(void 0===Ii&&(Ii={binary:1,bool:1,complex32:2,complex64:4,complex128:8,float16:2,bfloat16:2,float32:4,float64:8,float128:16,generic:null,int8:1,int16:2,int32:4,int64:8,int128:16,int256:32,uint8:1,uint8c:1,uint16:2,uint32:4,uint64:8,uint128:16,uint256:32}),t?zt(e=t.alignment)?e:Ii[Bi(t)]||null:null)}(t)||-1),N(this,"_byteLength",Ve(t)||-1),N(this,"_byteOrder","host"),N(this,"_type",n),this}function Ni(t){return vt(t)&&zt(t.alignment)&&zt(t.byteLength)&&vt(t.byteLengthOf)&&vt(t.byteOffsetOf)&&vt(t.bufferOf)&&vt(t.viewOf)||function(t){return t instanceof Ui||"object"==typeof t&&null!==t&&Jt(t.alignment)&&Jt(t.byteLength)&&jt(t.byteOrder)&&jt(t.char)&&Jt(t.enum)&&Si(t,"value")}(t)&&Ni(t.value)}function Ci(t){return ji(t)||((e=t)instanceof Ui||"object"==typeof e&&null!==e&&Jt(e.alignment)&&Jt(e.byteLength)&&jt(e.byteOrder)&&jt(e.char)&&Jt(e.enum)&&Si(e,"value"))||Ni(t);var e}function Pi(t){var e;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Ci(e=t.dtype))return e;throw new TypeError(S("invalid argument. Must provide an ndarray having a supported data type. Value: `%s`.",e))}function Yi(t){var e,r,n,i;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!pe(r=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));for(e=[],i=0;i<r.length;i++){if(!Fr(n=r[i]))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));e.push(n)}return e}N(Ui,"name","DataType"),At(Ui.prototype,"alignment",(function(){return this._alignment})),At(Ui.prototype,"byteLength",(function(){return this._byteLength})),At(Ui.prototype,"byteOrder",(function(){return this._byteOrder})),At(Ui.prototype,"char",(function(){return this._char})),At(Ui.prototype,"description",(function(){return this._description})),At(Ui.prototype,"enum",(function(){return this._enum})),At(Ui.prototype,"value",(function(){return this._value})),N(Ui.prototype,"toJSON",(function(){return{type:"DataType",value:this.toString(),byteOrder:this._byteOrder,description:this._description}})),N(Ui.prototype,"toString",(function(){return"struct"===this._type?this._value.layout:String(this._value)})),N(Ui.prototype,"valueOf",(function(){return this.toString()}));var Di=xi(ii());function Wi(t,e){return Bn(e)?function(t){var e,r,n;for(e=[],r=1,n=0;n<t.length;n++)e.push(r),r*=t[n];return e}(t):function(t){var e,r,n,i;for(e=t.length,r=[],i=0;i<e;i++)r.push(0);for(n=1,i=e-1;i>=0;i--)r[i]=n,n*=t[i];return r}(t)}function Ji(t){var e,r,n,i,o,a;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(!pe(i=t.strides)){if(!pe(n=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return 0===n.length?[0]:(r=t.order,Di(r)||(r="row-major"),Wi(n,r))}for(e=[],a=0;a<i.length;a++){if(!Jt(o=i[a]))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));e.push(o)}return e}function Gi(t){var e,r,n;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Fr(n=t.offset))return n;if(!pe(r=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(e=t.strides,0===r.length||!pe(e))return 0;if(n=function(t,e){var r,n,i;for(n=t.length,r=0,i=0;i<n;i++)e[i]<0&&(r-=e[i]*(t[i]-1));return r}(r,e),Fr(n))return n;throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t))}N(Wi,"assign",(function(t,e,r){return Bn(e)?function(t,e){var r,n;for(r=1,n=0;n<t.length;n++)e[n]=r,r*=t[n];return e}(t,r):function(t,e){var r,n;for(r=1,n=t.length-1;n>=0;n--)e[n]=r,r*=t[n];return e}(t,r)}));var $i="row-major",zi="column-major";function Zi(t){var e;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return e=t.order,Di(e)?e:1===(e=Oe(Ji(t)))||3===e?$i:2===e?zi:0===function(t){var e,r;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(Fr(r=t.ndims))return r;if(!pe(e=t.shape))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));return e.length}(t)?$i:null}function Xi(){return{dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32",boolean:"bool",index:"int32",integer_index:"int32",boolean_index:"bool",mask_index:"uint8"},order:"row-major",casting:"safe",index_mode:"throw"}}var qi={dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32",boolean:"bool",index:"int32",integer_index:"int32",boolean_index:"bool",mask_index:"uint8"},order:"row-major",casting:"safe",index_mode:"throw"},Hi={"dtypes.default":qi.dtypes.default,"dtypes.numeric":qi.dtypes.numeric,"dtypes.real":qi.dtypes.real,"dtypes.floating_point":qi.dtypes.floating_point,"dtypes.real_floating_point":qi.dtypes.real_floating_point,"dtypes.complex_floating_point":qi.dtypes.complex_floating_point,"dtypes.integer":qi.dtypes.integer,"dtypes.signed_integer":qi.dtypes.signed_integer,"dtypes.unsigned_integer":qi.dtypes.unsigned_integer,"dtypes.boolean":qi.dtypes.boolean,"dtypes.index":qi.dtypes.index,"dtypes.integer_index":qi.dtypes.integer_index,"dtypes.boolean_index":qi.dtypes.boolean_index,"dtypes.mask_index":qi.dtypes.mask_index,order:qi.order,casting:qi.casting,index_mode:qi.index_mode};N(Xi,"get",(function(t){var e=Hi[t];return void 0===e?null:e}));var Ki={dtypes:{default:"float64",numeric:"float64",real:"float64",floating_point:"float64",real_floating_point:"float64",complex_floating_point:"complex128",integer:"int32",signed_integer:"int32",unsigned_integer:"uint32",boolean:"bool",index:"int32",integer_index:"int32",boolean_index:"bool",mask_index:"uint8"},order:"row-major",casting:"safe",index_mode:"throw"};function Qi(t){return new Ei(Pi(t),function(t){var e;if("object"!=typeof t||null===t)throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(pe(e=t.data))return e;throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t))}(t),Yi(t),Ji(t),Gi(t),Zi(t)||Ki)}var to=xi(Oi("complex_floating_point"));var eo=vt(Object.assign),ro=Object.assign,no=void 0!==Object.getOwnPropertySymbols,io=bt.getOwnPropertySymbols;var oo,ao=no?function(t){return io(bt(t))}:function(){return[]};function uo(t){var e,r,n;for(e=_e(t),r=ao(t),n=0;n<r.length;n++)ae(t,r[n])&&e.push(r[n]);return e}oo=eo?ro:function(t){var e,r,n,i,o,a,u;if(null==t)throw new TypeError(S("invalid argument. First argument must be a non-null object. Value: `%s`.",t));for(o=bt(t),a=1;a<arguments.length;a++)if(null!=(e=arguments[a]))for(i=(r=uo(bt(e))).length,u=0;u<i;u++)o[n=r[u]]=e[n];return o};var so=oo;function fo(t,e){return function(t,e){var r=t.flags;return"object"!=typeof r||null===r?{}:e?so({},r):r}(t,!1)[e]}var lo=Math.ceil;function ho(t){return t<0?lo(t):Yt(t)}function co(t,e,r,n,i,o,a){var u,s,f,l,h;for(u=t.length,s=1,h=0;h<u;h++)s*=t[h];if("clamp"===o)i<0?i=0:i>=s&&(i=s-1);else if("wrap"===o)i<0?(i+=s)<0&&0!==(i%=s)&&(i+=s):i>=s&&(i-=s)>=s&&(i%=s);else if("normalize"===o&&i<0&&(i+=s),i<0||i>=s)throw new RangeError(S("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",s,i));if(0===r){if(Bn(n)){for(h=0;h<u;h++)i-=l=i%t[h],i/=t[h],a[h]=l;return a}for(h=u-1;h>=0;h--)i-=l=i%t[h],i/=t[h],a[h]=l;return a}if(Bn(n)){for(h=u-1;h>=0;h--)(l=e[h])<0?(i-=(f=ho(i/l))*l,a[h]=t[h]-1+f):(i-=(f=ho(i/l))*l,a[h]=f);return a}for(h=0;h<u;h++)(l=e[h])<0?(i-=(f=ho(i/l))*l,a[h]=t[h]-1+f):(i-=(f=ho(i/l))*l,a[h]=f);return a}function po(t,e,r,n,i,o){return co(t,e,r,n,i,o,function(t,e){var r,n;for(r=[],n=0;n<e;n++)r.push(t);return r}(0,t.length))}function go(t){var e,r,n,i,o,a,u,s;if(!Ti(t))throw new TypeError(S("invalid argument. Must provide an ndarray. Value: `%s`.",t));if(function(t,e){return"function"==typeof t[e]}(t,"toJSON"))return t.toJSON();for((e={}).type="ndarray",e.dtype=Pi(t),e.flags={READONLY:(s=t,!0===fo(s,"READONLY"))},e.order=Zi(t),n=Yi(t),e.shape=n,i=Ji(t),e.strides=i.slice(),o=Gi(t),r=function(t){var e,r,n;if(0===(e=t.length))return 0;for(r=1,n=0;n<e;n++)r*=t[n];return r}(e.shape),u=0;u<i.length;u++)e.strides[u]<0&&(e.strides[u]*=-1);if(e.data=[],function(t){return to(String(t))}(e.dtype))for(u=0;u<r;u++)a=t.get.apply(t,po(n,i,o,e.order,u,"throw")),e.data.push(cn(a),pn(a));else for(u=0;u<r;u++)e.data.push(t.get.apply(t,po(n,i,o,e.order,u,"throw")));return e}N(po,"assign",co);var yo=["linear","cartesian"],mo=xi(yo);function vo(t){return U(this,"next",{configurable:!1,enumerable:!0,get:function(){return this._next}}),this.value=t,U(this,"_next",{configurable:!1,enumerable:!1,writable:!0,value:null}),U(this,"_prev",{configurable:!1,enumerable:!1,writable:!0,value:null}),this}function wo(){return this instanceof wo?(this._length=0,this._first=null,this._last=null,this):new wo}N(wo.prototype,"clear",(function(){return this._length=0,this._first=null,this._last=null,this})),N(wo.prototype,"first",(function(){if(this._length)return this._first})),N(wo.prototype,"insert",(function(t,e){var r;if(t===this._last)return this.push(e);for(r=this._first;r!==this._last&&r!==t;)r=r._next;if(r===this._last)throw new Error("invalid argument. The list does not contain the provided list node.");return r=new vo(e),t._next._prev=r,r._next=t._next,t._next=r,r._prev=t,this._length+=1,this})),N(wo.prototype,"iterator",(function(){var t,e,r,n,i;return r=this,i=-1,t=this.toArray(),N(e={},"next",(function(){if(i+=1,n||i>=t.length)return{done:!0};return{value:t[i],done:!1}})),N(e,"return",(function(t){if(n=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),Qr&&N(e,Qr,(function(){return r.iterator()})),e})),N(wo.prototype,"last",(function(){if(this._length)return this._last})),At(wo.prototype,"length",(function(){return this._length})),N(wo.prototype,"pop",(function(){var t;return this._length&&(t=this._last.value,this._last._prev?(this._last=this._last._prev,this._last._next=null):(this._first=null,this._last=null),this._length-=1),t})),N(wo.prototype,"push",(function(t){var e;return e=new vo(t),0===this._length?(this._first=e,this._last=e):(e._prev=this._last,this._last._next=e,this._last=e),this._length+=1,this})),N(wo.prototype,"remove",(function(t){var e,r;if(t===this._first)return this.shift();if(t===this._last)return this.pop();for(e=t.value,r=this._first;r!==this._last&&r!==t;)r=r._next;if(r===this._last)throw new Error("invalid argument. The list does not contain the provided list node.");return t._prev._next=t._next,t._next._prev=t._prev,this._length-=1,e})),N(wo.prototype,"shift",(function(){var t;return this._length&&(t=this._first.value,this._first._next?(this._first=this._first._next,this._first._prev=null):(this._first=null,this._last=null),this._length-=1),t})),N(wo.prototype,"toArray",(function(){var t,e,r;for(e=[],t=this._first,r=0;r<this._length;r++)e.push(t.value),t=t.next;return e})),N(wo.prototype,"toJSON",(function(){var t={type:"linked-list"};return t.data=this.toArray(),t})),N(wo.prototype,"unshift",(function(t){var e;return e=new vo(t),0===this._length?(this._first=e,this._last=e):(e._next=this._first,this._first._prev=e,this._first=e),this._length+=1,this}));var bo=new wo;function _o(t){for(var e=bo.first();e;){if(e.value.id===t)return e;e=e.next}return null}var Eo=-1;function To(t){var e,r,n,i,o,a;if(!(this instanceof To))return arguments.length>1?new To(t,arguments[1]):new To(t);if(!Ti(t))throw new TypeError(Vt("null5t",t));if(e={persist:!1,kind:""},arguments.length>1&&(r=function(t,e){return xt(e)?W(e,"persist")&&(t.persist=e.persist,!q(t.persist))?new TypeError(Vt("null2o","persist",t.persist)):W(e,"kind")&&(t.kind=e.kind,!mo(t.kind)&&""!==t.kind)?new TypeError(Vt("null4S","kind",yo.join('", "'),t.kind)):null:new TypeError(Vt("null2V",e))}(e,arguments[1]),r))throw r;if(i=function(t){return t.dtype}(n=Qi(t)),"generic"===i)if(n.length>0)if(q(a=n.iget(0)))o="bool";else{if(!Jt(a))throw new TypeError("invalid argument. First argument must be a valid index ndarray.");o="int"}else o="int";else if("int64"===i||"int32"===i)o="int";else if("uint8"===i)o="mask";else{if("bool"!==i)throw new TypeError("invalid argument. First argument must be a valid index ndarray.");o="bool"}if("int"!==o&&""!==e.kind)throw new TypeError(Vt('invalid argument. First argument is not compatible with the specified index "kind". Type: %s. Kind: %s.',o,e.kind));return bo.push({id:(Eo+=1).toString(),ref:this,data:n,type:o,kind:e.kind,dtype:i,persist:e.persist}),N(this,"_node",bo.last()),function(t,e,r){U(t,e,{configurable:!0,enumerable:!1,writable:!0,value:r})}(this,"_invalidated",!1),this}function xo(t){var e=function(e){var r,n;if(n={kind:t},arguments.length<2)return new To(e,n);if(r=arguments[1],!xt(r))throw new TypeError(Vt("null2V",r));W(r,"persist")&&(n.persist=r.persist);return new To(e,n)};return N(e,"free",To.free),N(e,"get",To.get),e}N(To,"name","ndindex"),N(To,"free",(function(t){var e,r;return null!==(e=_o(t))&&(N((r=e.value).ref,"_invalidated",!0),bo.remove(e),r.data=null,!0)})),N(To,"get",(function(t){var e,r,n;return null===(e=_o(t))?null:(r={data:(n=e.value).data,type:n.type,kind:n.kind,dtype:n.dtype},n.persist||To.free(t),r)})),At(To.prototype,"data",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return this._node.value.data})),At(To.prototype,"dtype",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return this._node.value.dtype})),At(To.prototype,"id",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return this._node.value.id})),At(To.prototype,"isCached",(function(){return!this._invalidated})),At(To.prototype,"kind",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return this._node.value.kind})),At(To.prototype,"type",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return this._node.value.type})),N(To.prototype,"toString",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return"ndindex<"+this._node.value.id+">"})),N(To.prototype,"toJSON",(function(){if(this._invalidated)throw new Error("invalid operation. This ndarray index instance has already been freed and can no longer be used.");return{type:"ndindex",kind:this._node.value.kind,data:go(this._node.value.data)}}));var Vo=xo("cartesian"),Ao=xo("linear");N(To,"cartesianIndex",Vo),N(To,"linearIndex",Ao);const{free:Oo}=To,{get:jo}=To;export{Vo as cartesianIndex,To as default,Oo as free,jo as get,Ao as linearIndex};
//# sourceMappingURL=mod.js.map