-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.js
4 lines (4 loc) · 28.4 KB
/
mod.js
1
2
3
4
// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
/// <reference types="./mod.d.ts" />
var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var e=Object.defineProperty;function t(r){return"number"==typeof r}function n(r){var e,t="";for(e=0;e<r;e++)t+="0";return t}function o(r,e,t){var o=!1,i=e-r.length;return i<0||(function(r){return"-"===r[0]}(r)&&(o=!0,r=r.substr(1)),r=t?r+n(i):n(i)+r,o&&(r="-"+r)),r}var i=String.prototype.toLowerCase,f=String.prototype.toUpperCase;function u(r){var e,n,u;switch(r.specifier){case"b":e=2;break;case"o":e=8;break;case"x":case"X":e=16;break;default:e=10}if(n=r.arg,u=parseInt(n,10),!isFinite(u)){if(!t(n))throw new Error("invalid integer. Value: "+n);u=0}return u<0&&("u"===r.specifier||10!==e)&&(u=4294967295+u+1),u<0?(n=(-u).toString(e),r.precision&&(n=o(n,r.precision,r.padRight)),n="-"+n):(n=u.toString(e),u||r.precision?r.precision&&(n=o(n,r.precision,r.padRight)):n="",r.sign&&(n=r.sign+n)),16===e&&(r.alternate&&(n="0x"+n),n=r.specifier===f.call(r.specifier)?f.call(n):i.call(n)),8===e&&r.alternate&&"0"!==n.charAt(0)&&(n="0"+n),n}var a=Math.abs,s=String.prototype.toLowerCase,h=String.prototype.toUpperCase,l=String.prototype.replace,c=/e\+(\d)$/,p=/e-(\d)$/,w=/^(\d+)$/,y=/^(\d+)e/,g=/\.0$/,b=/\.0*e/,E=/(\..*[^0])0*e/;function v(r){var e,n,o=parseFloat(r.arg);if(!isFinite(o)){if(!t(r.arg))throw new Error("invalid floating-point number. Value: "+n);o=r.arg}switch(r.specifier){case"e":case"E":n=o.toExponential(r.precision);break;case"f":case"F":n=o.toFixed(r.precision);break;case"g":case"G":a(o)<1e-4?((e=r.precision)>0&&(e-=1),n=o.toExponential(e)):n=o.toPrecision(r.precision),r.alternate||(n=l.call(n,E,"$1e"),n=l.call(n,b,"e"),n=l.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=l.call(n,c,"e+0$1"),n=l.call(n,p,"e-0$1"),r.alternate&&(n=l.call(n,w,"$1."),n=l.call(n,y,"$1.e")),o>=0&&r.sign&&(n=r.sign+n),n=r.specifier===h.call(r.specifier)?h.call(n):s.call(n)}function d(r){var e,t="";for(e=0;e<r;e++)t+=" ";return t}var _=String.fromCharCode,R=Array.isArray;function m(r){return r!=r}function T(r){var e={};return e.specifier=r.specifier,e.precision=void 0===r.precision?1:r.precision,e.width=r.width,e.flags=r.flags||"",e.mapping=r.mapping,e}function j(r){var e,t,n,i,f,a,s,h,l,c,p,w,y;if(!R(r))throw new TypeError("invalid argument. First argument must be an array. Value: `"+r+"`.");for(a="",s=1,h=0;h<r.length;h++)if(n=r[h],"string"==typeof n)a+=n;else{if(e=void 0!==n.precision,!(n=T(n)).specifier)throw new TypeError("invalid argument. Token is missing `specifier` property. Index: `"+h+"`. Value: `"+n+"`.");for(n.mapping&&(s=n.mapping),t=n.flags,l=0;l<t.length;l++)switch(i=t.charAt(l)){case" ":n.sign=" ";break;case"+":n.sign="+";break;case"-":n.padRight=!0,n.padZeros=!1;break;case"0":n.padZeros=t.indexOf("-")<0;break;case"#":n.alternate=!0;break;default:throw new Error("invalid flag: "+i)}if("*"===n.width){if(n.width=parseInt(arguments[s],10),s+=1,m(n.width))throw new TypeError("the argument for * width at position "+s+" is not a number. Value: `"+n.width+"`.");n.width<0&&(n.padRight=!0,n.width=-n.width)}if(e&&"*"===n.precision){if(n.precision=parseInt(arguments[s],10),s+=1,m(n.precision))throw new TypeError("the argument for * precision at position "+s+" is not a number. Value: `"+n.precision+"`.");n.precision<0&&(n.precision=1,e=!1)}switch(n.arg=arguments[s],n.specifier){case"b":case"o":case"x":case"X":case"d":case"i":case"u":e&&(n.padZeros=!1),n.arg=u(n);break;case"s":n.maxWidth=e?n.precision:-1,n.arg=String(n.arg);break;case"c":if(!m(n.arg)){if((f=parseInt(n.arg,10))<0||f>127)throw new Error("invalid character code. Value: "+n.arg);n.arg=m(f)?String(n.arg):_(f)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=v(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=o(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(c=n.arg,p=n.width,w=n.padRight,y=void 0,(y=p-c.length)<0?c:c=w?c+d(y):d(y)+c)),a+=n.arg||"",s+=1}return a}var S=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function A(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function x(r){var e,t,n,o;for(t=[],o=0,n=S.exec(r);n;)(e=r.slice(o,S.lastIndex-n[0].length)).length&&t.push(e),t.push(A(n)),o=S.lastIndex,n=S.exec(r);return(e=r.slice(o)).length&&t.push(e),t}function O(r){var e,t;if("string"!=typeof r)throw new TypeError(O("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[x(r)],t=1;t<arguments.length;t++)e.push(arguments[t]);return j.apply(null,e)}var F,L=Object.prototype,P=L.toString,I=L.__defineGetter__,N=L.__defineSetter__,k=L.__lookupGetter__,B=L.__lookupSetter__;F=function(){try{return r({},"x",{}),!0}catch(r){return!1}}()?e:function(r,e,t){var n,o,i,f;if("object"!=typeof r||null===r||"[object Array]"===P.call(r))throw new TypeError(O("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===P.call(t))throw new TypeError(O("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((o="value"in t)&&(k.call(r,e)||B.call(r,e)?(n=r.__proto__,r.__proto__=L,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),i="get"in t,f="set"in t,o&&(i||f))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return i&&I&&I.call(r,e,t.get),f&&N&&N.call(r,e,t.set),r};var C=F;function V(r,e,t){C(r,e,{configurable:!1,enumerable:!1,writable:!1,value:t})}function M(r){return"number"==typeof r}var Y="function"==typeof Symbol&&"symbol"==typeof Symbol("foo");function G(){return Y&&"symbol"==typeof Symbol.toStringTag}var $=Object.prototype.toString;var W=Object.prototype.hasOwnProperty;function Z(r,e){return null!=r&&W.call(r,e)}var J="function"==typeof Symbol?Symbol:void 0,U="function"==typeof J?J.toStringTag:"";var X=G()?function(r){var e,t,n;if(null==r)return $.call(r);t=r[U],e=Z(r,U);try{r[U]=void 0}catch(e){return $.call(r)}return n=$.call(r),e?r[U]=t:delete r[U],n}:function(r){return $.call(r)},z=Number,H=z.prototype.toString;var K=G();function Q(r){return"object"==typeof r&&(r instanceof z||(K?function(r){try{return H.call(r),!0}catch(r){return!1}}(r):"[object Number]"===X(r)))}function q(r){return M(r)||Q(r)}V(q,"isPrimitive",M),V(q,"isObject",Q);var D=Number.POSITIVE_INFINITY,rr=z.NEGATIVE_INFINITY,er=Math.floor;function tr(r){return er(r)===r}function nr(r){return r<D&&r>rr&&tr(r)}function or(r){return M(r)&&nr(r)}function ir(r){return Q(r)&&nr(r.valueOf())}function fr(r){return or(r)||ir(r)}function ur(r){return or(r)&&r>=0}function ar(r){return ir(r)&&r.valueOf()>=0}function sr(r){return ur(r)||ar(r)}V(fr,"isPrimitive",or),V(fr,"isObject",ir),V(sr,"isPrimitive",ur),V(sr,"isObject",ar);var hr=4294967295;function lr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&tr(r.length)&&r.length>=0&&r.length<=hr}var cr=9007199254740991;function pr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&tr(r.length)&&r.length>=0&&r.length<=cr}var wr="function"==typeof ArrayBuffer;function yr(r){return wr&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===X(r)}var gr=Array.isArray?Array.isArray:function(r){return"[object Array]"===X(r)};function br(r){return"object"==typeof r&&null!==r&&!gr(r)}function Er(r){if("function"!=typeof r)throw new TypeError(O("invalid argument. Must provide a function. Value: `%s`.",r));return function(e){var t,n;if(!gr(e))return!1;if(0===(t=e.length))return!1;for(n=0;n<t;n++)if(!1===r(e[n]))return!1;return!0}}function vr(r){return"string"==typeof r}var dr=String.prototype.valueOf;var _r=G();function Rr(r){return"object"==typeof r&&(r instanceof String||(_r?function(r){try{return dr.call(r),!0}catch(r){return!1}}(r):"[object String]"===X(r)))}function mr(r){return vr(r)||Rr(r)}V(mr,"isPrimitive",vr),V(mr,"isObject",Rr);var Tr=Er(mr.isPrimitive),jr=Er(mr.isObject),Sr=Er(mr);V(Sr,"primitives",Tr),V(Sr,"objects",jr);var Ar=/./;function xr(r){return"boolean"==typeof r}var Or=Boolean,Fr=Boolean.prototype.toString;var Lr=G();function Pr(r){return"object"==typeof r&&(r instanceof Or||(Lr?function(r){try{return Fr.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===X(r)))}function Ir(r){return xr(r)||Pr(r)}V(Ir,"isPrimitive",xr),V(Ir,"isObject",Pr);var Nr="object"==typeof self?self:null,kr="object"==typeof window?window:null,Br="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Cr="object"==typeof Br?Br:null,Vr="object"==typeof globalThis?globalThis:null;var Mr=function(r){if(arguments.length){if(!xr(r))throw new TypeError(O("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(Vr)return Vr;if(Nr)return Nr;if(kr)return kr;if(Cr)return Cr;throw new Error("unexpected error. Unable to resolve global object.")}(),Yr=Mr.document&&Mr.document.childNodes,Gr=Int8Array;function $r(){return/^\s*function\s*([^(]*)/i}var Wr=/^\s*function\s*([^(]*)/i;function Zr(r){return null!==r&&"object"==typeof r}function Jr(r){var e,t,n,o;if(("Object"===(t=X(r).slice(8,-1))||"Error"===t)&&r.constructor){if("string"==typeof(n=r.constructor).name)return n.name;if(e=Wr.exec(n.toString()))return e[1]}return Zr(o=r)&&(o._isBuffer||o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o))?"Buffer":t}V($r,"REGEXP",Wr),V(Zr,"isObjectLikeArray",Er(Zr));var Ur="function"==typeof Ar||"object"==typeof Gr||"function"==typeof Yr?function(r){return Jr(r).toLowerCase()}:function(r){var e;return null===r?"null":"object"===(e=typeof r)?Jr(r).toLowerCase():e};function Xr(r){return"function"===Ur(r)}function zr(r,e){if(!(this instanceof zr))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!M(r))throw new TypeError(O("invalid argument. Real component must be a number. Value: `%s`.",r));if(!M(e))throw new TypeError(O("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:r}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:e}),this}V(zr,"BYTES_PER_ELEMENT",8),V(zr.prototype,"BYTES_PER_ELEMENT",8),V(zr.prototype,"byteLength",16),V(zr.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),V(zr.prototype,"toJSON",(function(){var r={type:"Complex128"};return r.re=this.re,r.im=this.im,r}));var Hr="function"==typeof Math.fround?Math.fround:null,Kr="function"==typeof Float32Array;var Qr="function"==typeof Float32Array?Float32Array:null;var qr="function"==typeof Float32Array?Float32Array:void 0;var Dr=function(){var r,e,t;if("function"!=typeof Qr)return!1;try{e=new Qr([1,3.14,-3.14,5e40]),t=e,r=(Kr&&t instanceof Float32Array||"[object Float32Array]"===X(t))&&1===e[0]&&3.140000104904175===e[1]&&-3.140000104904175===e[2]&&e[3]===D}catch(e){r=!1}return r}()?qr:function(){throw new Error("not implemented")},re=new Dr(1);var ee="function"==typeof Hr?Hr:function(r){return re[0]=r,re[0]};function te(r,e){if(!(this instanceof te))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!M(r))throw new TypeError(O("invalid argument. Real component must be a number. Value: `%s`.",r));if(!M(e))throw new TypeError(O("invalid argument. Imaginary component must be a number. Value: `%s`.",e));return C(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:ee(r)}),C(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:ee(e)}),this}function ne(r){return r instanceof zr||r instanceof te||"object"==typeof r&&null!==r&&"number"==typeof r.re&&"number"==typeof r.im}function oe(r){return tr(r/2)}V(te,"BYTES_PER_ELEMENT",4),V(te.prototype,"BYTES_PER_ELEMENT",4),V(te.prototype,"byteLength",8),V(te.prototype,"toString",(function(){var r=""+this.re;return this.im<0?r+=" - "+-this.im:r+=" + "+this.im,r+="i"})),V(te.prototype,"toJSON",(function(){var r={type:"Complex64"};return r.re=this.re,r.im=this.im,r}));var ie=8;var fe=16;function ue(){return"function"==typeof J&&"symbol"==typeof J("foo")&&Z(J,"iterator")&&"symbol"==typeof J.iterator}var ae=ue()?Symbol.iterator:null;function se(r,e,t){C(r,e,{configurable:!1,enumerable:!1,get:t})}function he(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r<e.length;r++)t+="&arg[]="+encodeURIComponent(e[r]);return t}function le(r){return r.re}function ce(r){return r.im}var pe="function"==typeof Float64Array;var we="function"==typeof Float64Array?Float64Array:null;var ye="function"==typeof Float64Array?Float64Array:void 0;var ge=function(){var r,e,t;if("function"!=typeof we)return!1;try{e=new we([1,3.14,-3.14,NaN]),t=e,r=(pe&&t instanceof Float64Array||"[object Float64Array]"===X(t))&&1===e[0]&&3.14===e[1]&&-3.14===e[2]&&e[3]!=e[3]}catch(e){r=!1}return r}()?ye:function(){throw new Error("not implemented")};var be={float64:function(r,e){return r[e]},float32:function(r,e){return r[e]},int32:function(r,e){return r[e]},int16:function(r,e){return r[e]},int8:function(r,e){return r[e]},uint32:function(r,e){return r[e]},uint16:function(r,e){return r[e]},uint8:function(r,e){return r[e]},uint8c:function(r,e){return r[e]},generic:function(r,e){return r[e]},default:function(r,e){return r[e]}};var Ee={complex128:function(r,e){return r.get(e)},complex64:function(r,e){return r.get(e)},default:function(r,e){return r.get(e)}};function ve(r){var e,t,n;for(e=[];!(t=r.next()).done;)if(lr(n=t.value)&&n.length>=2)e.push(n[0],n[1]);else{if(!ne(n))return new TypeError(he("00R24",n));e.push(le(n),ce(n))}return e}var de=2*Dr.BYTES_PER_ELEMENT,_e=ue();function Re(r){return r instanceof je||"object"==typeof r&&null!==r&&("Complex64Array"===r.constructor.name||"Complex128Array"===r.constructor.name)&&"number"==typeof r._length&&"object"==typeof r._buffer}function me(r){return r===je||"Complex128Array"===r.name}function Te(r,e){return new te(r[e*=2],r[e+1])}function je(){var r,e,t,n,o,i,f;if(e=arguments.length,!(this instanceof je))return 0===e?new je:1===e?new je(arguments[0]):2===e?new je(arguments[0],arguments[1]):new je(arguments[0],arguments[1],arguments[2]);if(0===e)t=new Dr(0);else if(1===e)if(ur(arguments[0]))t=new Dr(2*arguments[0]);else if(pr(arguments[0]))if((n=(t=arguments[0]).length)&&gr(t)&&ne(t[0])){if(t=function(r,e){var t,n,o,i;for(t=e.length,i=0,o=0;o<t;o++){if(!ne(n=e[o]))return null;r[i]=le(n),r[i+1]=ce(n),i+=2}return r}(new Dr(2*n),t),null===t){if(!oe(n))throw new RangeError(he("00R26",n));t=new Dr(arguments[0])}}else{if("object"==typeof(f=t)&&null!==f&&"Complex64Array"===f.constructor.name&&f.BYTES_PER_ELEMENT===ie)i=0,t=new Dr((o=t).buffer,o.byteOffset+o.BYTES_PER_ELEMENT*i,2*(o.length-i));else if(function(r){return"object"==typeof r&&null!==r&&"Complex128Array"===r.constructor.name&&r.BYTES_PER_ELEMENT===fe}(t))t=function(r,e){return new ge(r.buffer,r.byteOffset+r.BYTES_PER_ELEMENT*e,2*(r.length-e))}(t,0);else if(!oe(n))throw new RangeError(he("00R27",n));t=new Dr(t)}else if(yr(arguments[0])){if(!tr((t=arguments[0]).byteLength/de))throw new RangeError(he("00RE9",de,t.byteLength));t=new Dr(t)}else{if(!br(arguments[0]))throw new TypeError(he("00R2A",arguments[0]));if(t=arguments[0],!1===_e)throw new TypeError(he("00R29",t));if(!Xr(t[ae]))throw new TypeError(he("00R2A",t));if(!Xr((t=t[ae]()).next))throw new TypeError(he("00R2A",t));if((t=ve(t))instanceof Error)throw t;t=new Dr(t)}else{if(!yr(t=arguments[0]))throw new TypeError(he("00R2B",t));if(!ur(r=arguments[1]))throw new TypeError(he("00R2C",r));if(!tr(r/de))throw new RangeError(he("00REA",de,r));if(2===e){if(!tr((n=t.byteLength-r)/de))throw new RangeError(he("00R2E",de,n));t=new Dr(t,r)}else{if(!ur(n=arguments[2]))throw new TypeError(he("00R2F",n));if(n*de>t.byteLength-r)throw new RangeError(he("00R2G",n*de));t=new Dr(t,r,2*n)}}return V(this,"_buffer",t),V(this,"_length",t.length/2),this}V(je,"BYTES_PER_ELEMENT",de),V(je,"name","Complex64Array"),V(je,"from",(function(r){var e,t,n,o,i,f,u,a,s,h,l,c;if(!Xr(this))throw new TypeError(he("00R01"));if(!me(this))throw new TypeError(he("00R02"));if((t=arguments.length)>1){if(!Xr(n=arguments[1]))throw new TypeError(he("00R2H",n));t>2&&(e=arguments[2])}if(Re(r)){if(a=r.length,n){for(i=(o=new this(a))._buffer,c=0,l=0;l<a;l++){if(ne(h=n.call(e,r.get(l),l)))i[c]=le(h),i[c+1]=ce(h);else{if(!(lr(h)&&h.length>=2))throw new TypeError(he("00R25",h));i[c]=h[0],i[c+1]=h[1]}c+=2}return o}return new this(r)}if(pr(r)){if(n){for(a=r.length,u=r.get&&r.set?function(r){var e=Ee[r];return"function"==typeof e?e:Ee.default}("default"):function(r){var e=be[r];return"function"==typeof e?e:be.default}("default"),l=0;l<a;l++)if(!ne(u(r,l))){s=!0;break}if(s){if(!oe(a))throw new RangeError(he("00REB",2,a));for(i=(o=new this(a/2))._buffer,l=0;l<a;l++)i[l]=n.call(e,u(r,l),l);return o}for(i=(o=new this(a))._buffer,c=0,l=0;l<a;l++){if(ne(h=n.call(e,u(r,l),l)))i[c]=le(h),i[c+1]=ce(h);else{if(!(lr(h)&&h.length>=2))throw new TypeError(he("00R25",h));i[c]=h[0],i[c+1]=h[1]}c+=2}return o}return new this(r)}if(br(r)&&_e&&Xr(r[ae])){if(!Xr((i=r[ae]()).next))throw new TypeError(he("00R2J",r));if(f=n?function(r,e,t){var n,o,i,f;for(n=[],f=-1;!(o=r.next()).done;)if(f+=1,lr(i=e.call(t,o.value,f))&&i.length>=2)n.push(i[0],i[1]);else{if(!ne(i))return new TypeError(he("00R25",i));n.push(le(i),ce(i))}return n}(i,n,e):ve(i),f instanceof Error)throw f;for(i=(o=new this(a=f.length/2))._buffer,l=0;l<a;l++)i[l]=f[l];return o}throw new TypeError(he("00R2J",r))})),V(je,"of",(function(){var r,e;if(!Xr(this))throw new TypeError(he("00R01"));if(!me(this))throw new TypeError(he("00R02"));for(r=[],e=0;e<arguments.length;e++)r.push(arguments[e]);return new this(r)})),V(je.prototype,"at",(function(r){if(!Re(this))throw new TypeError(he("00R02"));if(!tr(r))throw new TypeError(he("00R8A",r));if(r<0&&(r+=this._length),!(r<0||r>=this._length))return Te(this._buffer,r)})),se(je.prototype,"buffer",(function(){return this._buffer.buffer})),se(je.prototype,"byteLength",(function(){return this._buffer.byteLength})),se(je.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),V(je.prototype,"BYTES_PER_ELEMENT",je.BYTES_PER_ELEMENT),V(je.prototype,"copyWithin",(function(r,e){if(!Re(this))throw new TypeError(he("00R02"));return 2===arguments.length?this._buffer.copyWithin(2*r,2*e):this._buffer.copyWithin(2*r,2*e,2*arguments[2]),this})),V(je.prototype,"entries",(function(){var r,e,t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));return r=this,n=this._buffer,t=this._length,i=-1,V(e={},"next",(function(){if(i+=1,o||i>=t)return{done:!0};return{value:[i,Te(n,i)],done:!1}})),V(e,"return",(function(r){if(o=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),ae&&V(e,ae,(function(){return r.entries()})),e})),V(je.prototype,"every",(function(r,e){var t,n;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(!r.call(e,Te(t,n),n,this))return!1;return!0})),V(je.prototype,"fill",(function(r,e,t){var n,o,i,f,u,a;if(!Re(this))throw new TypeError(he("00R02"));if(!ne(r))throw new TypeError(he("00RFG",r));if(n=this._buffer,o=this._length,arguments.length>1){if(!tr(e))throw new TypeError(he("00R7f",e));if(e<0&&(e+=o)<0&&(e=0),arguments.length>2){if(!tr(t))throw new TypeError(he("00R2z",t));t<0&&(t+=o)<0&&(t=0),t>o&&(t=o)}else t=o}else e=0,t=o;for(f=le(r),u=ce(r),a=e;a<t;a++)n[i=2*a]=f,n[i+1]=u;return this})),V(je.prototype,"filter",(function(r,e){var t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=[],o=0;o<this._length;o++)i=Te(t,o),r.call(e,i,o,this)&&n.push(i);return new this.constructor(n)})),V(je.prototype,"find",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(o=Te(t,n),r.call(e,o,n,this))return o})),V(je.prototype,"findIndex",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(o=Te(t,n),r.call(e,o,n,this))return n;return-1})),V(je.prototype,"findLast",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(o=Te(t,n),r.call(e,o,n,this))return o})),V(je.prototype,"findLastIndex",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=this._length-1;n>=0;n--)if(o=Te(t,n),r.call(e,o,n,this))return n;return-1})),V(je.prototype,"forEach",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)o=Te(t,n),r.call(e,o,n,this)})),V(je.prototype,"get",(function(r){if(!Re(this))throw new TypeError(he("00R02"));if(!ur(r))throw new TypeError(he("00R2K",r));if(!(r>=this._length))return Te(this._buffer,r)})),V(je.prototype,"includes",(function(r,e){var t,n,o,i,f;if(!Re(this))throw new TypeError(he("00R02"));if(!ne(r))throw new TypeError(he("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(he("00R7f",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(o=le(r),i=ce(r),t=this._buffer,f=e;f<this._length;f++)if(o===t[n=2*f]&&i===t[n+1])return!0;return!1})),V(je.prototype,"indexOf",(function(r,e){var t,n,o,i,f;if(!Re(this))throw new TypeError(he("00R02"));if(!ne(r))throw new TypeError(he("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(he("00R7f",e));e<0&&(e+=this._length)<0&&(e=0)}else e=0;for(o=le(r),i=ce(r),t=this._buffer,f=e;f<this._length;f++)if(o===t[n=2*f]&&i===t[n+1])return f;return-1})),V(je.prototype,"join",(function(r){var e,t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(0===arguments.length)n=",";else{if(!vr(r))throw new TypeError(he("00R3F",r));n=r}for(e=[],t=this._buffer,o=0;o<this._length;o++)e.push(Te(t,o).toString());return e.join(n)})),V(je.prototype,"keys",(function(){var r,e,t,n,o;if(!Re(this))throw new TypeError(he("00R02"));return r=this,t=this._length,o=-1,V(e={},"next",(function(){if(o+=1,n||o>=t)return{done:!0};return{value:o,done:!1}})),V(e,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),ae&&V(e,ae,(function(){return r.keys()})),e})),V(je.prototype,"lastIndexOf",(function(r,e){var t,n,o,i,f;if(!Re(this))throw new TypeError(he("00R02"));if(!ne(r))throw new TypeError(he("00RFG",r));if(arguments.length>1){if(!tr(e))throw new TypeError(he("00R7f",e));e>=this._length?e=this._length-1:e<0&&(e+=this._length)}else e=this._length-1;for(o=le(r),i=ce(r),t=this._buffer,f=e;f>=0;f--)if(o===t[n=2*f]&&i===t[n+1])return f;return-1})),se(je.prototype,"length",(function(){return this._length})),V(je.prototype,"map",(function(r,e){var t,n,o,i,f;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(n=this._buffer,t=(o=new this.constructor(this._length))._buffer,i=0;i<this._length;i++)if(ne(f=r.call(e,Te(n,i),i,this)))t[2*i]=le(f),t[2*i+1]=ce(f);else{if(!lr(f)||2!==f.length)throw new TypeError(he("00R25",f));t[2*i]=f[0],t[2*i+1]=f[1]}return o})),V(je.prototype,"reduce",(function(r,e){var t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));if(t=this._buffer,o=this._length,arguments.length>1)n=e,i=0;else{if(0===o)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=Te(t,0),i=1}for(;i<o;i++)n=r(n,Te(t,i),i,this);return n})),V(je.prototype,"reduceRight",(function(r,e){var t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));if(t=this._buffer,o=this._length,arguments.length>1)n=e,i=o-1;else{if(0===o)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=Te(t,o-1),i=o-2}for(;i>=0;i--)n=r(n,Te(t,i),i,this);return n})),V(je.prototype,"reverse",(function(){var r,e,t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));for(t=this._length,r=this._buffer,n=er(t/2),o=0;o<n;o++)i=t-o-1,e=r[2*o],r[2*o]=r[2*i],r[2*i]=e,e=r[2*o+1],r[2*o+1]=r[2*i+1],r[2*i+1]=e;return this})),V(je.prototype,"set",(function(r){var e,t,n,o,i,f,u,a,s;if(!Re(this))throw new TypeError(he("00R02"));if(n=this._buffer,arguments.length>1){if(!ur(t=arguments[1]))throw new TypeError(he("00R2L",t))}else t=0;if(ne(r)){if(t>=this._length)throw new RangeError(he("00R2M",t));return n[t*=2]=le(r),void(n[t+1]=ce(r))}if(Re(r)){if(t+(f=r._length)>this._length)throw new RangeError(he("00R03"));if(e=r._buffer,s=n.byteOffset+t*de,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(o=new Dr(e.length),a=0;a<e.length;a++)o[a]=e[a];e=o}for(t*=2,s=0,a=0;a<f;a++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2}else{if(!pr(r))throw new TypeError(he("00R2N",r));for(f=r.length,a=0;a<f;a++)if(!ne(r[a])){i=!0;break}if(i){if(!oe(f))throw new RangeError(he("00R26",f));if(t+f/2>this._length)throw new RangeError(he("00R03"));if(e=r,s=n.byteOffset+t*de,e.buffer===n.buffer&&e.byteOffset<s&&e.byteOffset+e.byteLength>s){for(o=new Dr(f),a=0;a<f;a++)o[a]=e[a];e=o}for(t*=2,f/=2,s=0,a=0;a<f;a++)n[t]=e[s],n[t+1]=e[s+1],t+=2,s+=2;return}if(t+f>this._length)throw new RangeError(he("00R03"));for(t*=2,a=0;a<f;a++)u=r[a],n[t]=le(u),n[t+1]=ce(u),t+=2}})),V(je.prototype,"slice",(function(r,e){var t,n,o,i,f,u,a;if(!Re(this))throw new TypeError(he("00R02"));if(f=this._buffer,u=this._length,0===arguments.length)r=0,e=u;else{if(!tr(r))throw new TypeError(he("00R7e",r));if(r<0&&(r+=u)<0&&(r=0),1===arguments.length)e=u;else{if(!tr(e))throw new TypeError(he("00R7f",e));e<0?(e+=u)<0&&(e=0):e>u&&(e=u)}}for(t=r<e?e-r:0,n=(o=new this.constructor(t))._buffer,a=0;a<t;a++)i=2*(a+r),n[2*a]=f[i],n[2*a+1]=f[i+1];return o})),V(je.prototype,"some",(function(r,e){var t,n;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=0;n<this._length;n++)if(r.call(e,Te(t,n),n,this))return!0;return!1})),V(je.prototype,"sort",(function(r){var e,t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=this._length,e=[],o=0;o<n;o++)e.push(Te(t,o));for(e.sort(r),o=0;o<n;o++)t[i=2*o]=le(e[o]),t[i+1]=ce(e[o]);return this})),V(je.prototype,"subarray",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(n=this._buffer,o=this._length,0===arguments.length)r=0,e=o;else{if(!tr(r))throw new TypeError(he("00R7e",r));if(r<0&&(r+=o)<0&&(r=0),1===arguments.length)e=o;else{if(!tr(e))throw new TypeError(he("00R7f",e));e<0?(e+=o)<0&&(e=0):e>o&&(e=o)}}return r>=o?(o=0,t=n.byteLength):r>=e?(o=0,t=n.byteOffset+r*de):(o=e-r,t=n.byteOffset+r*de),new this.constructor(n.buffer,t,o<0?0:o)})),V(je.prototype,"toLocaleString",(function(r,e){var t,n,o,i,f;if(!Re(this))throw new TypeError(he("00R02"));if(0===arguments.length)n=[];else{if(!vr(r)&&!Tr(r))throw new TypeError(he("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",r));n=r}if(arguments.length<2)t={};else{if(!br(e))throw new TypeError(he("00R2V",e));t=e}for(i=this._buffer,o=[],f=0;f<this._length;f++)o.push(Te(i,f).toLocaleString(n,t));return o.join(",")})),V(je.prototype,"toReversed",(function(){var r,e,t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));for(t=this._length,e=new this.constructor(t),n=this._buffer,r=e._buffer,o=0;o<t;o++)i=t-o-1,r[2*o]=n[2*i],r[2*o+1]=n[2*i+1];return e})),V(je.prototype,"toSorted",(function(r){var e,t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!Xr(r))throw new TypeError(he("00R3c",r));for(t=this._buffer,n=this._length,e=[],o=0;o<n;o++)e.push(Te(t,o));return e.sort(r),new je(e)})),V(je.prototype,"toString",(function(){var r,e,t;if(!Re(this))throw new TypeError(he("00R02"));for(r=[],e=this._buffer,t=0;t<this._length;t++)r.push(Te(e,t).toString());return r.join(",")})),V(je.prototype,"values",(function(){var r,e,t,n,o,i;if(!Re(this))throw new TypeError(he("00R02"));return e=this,o=this._buffer,t=this._length,i=-1,V(r={},"next",(function(){if(i+=1,n||i>=t)return{done:!0};return{value:Te(o,i),done:!1}})),V(r,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),ae&&V(r,ae,(function(){return e.values()})),r})),V(je.prototype,"with",(function(r,e){var t,n,o;if(!Re(this))throw new TypeError(he("00R02"));if(!tr(r))throw new TypeError(he("00R7e",r));if(o=this._length,r<0&&(r+=o),r<0||r>=o)throw new RangeError(he("00RFP",r));if(!ne(e))throw new TypeError(he("00RFQ",e));return(t=(n=new this.constructor(this._buffer))._buffer)[2*r]=le(e),t[2*r+1]=ce(e),n}));export{je as default};
//# sourceMappingURL=mod.js.map