fluz-transactions

download cash balance csv

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         fluz-transactions
// @namespace    http://tampermonkey.net/
// @version      2024-11-25.1
// @description  download cash balance csv
// @author       misc
// @match        https://power.fluz.app/dashboard
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(()=>{var xi=Object.create;var nn=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var Ni=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ni(t))!bi.call(e,o)&&o!==r&&nn(e,o,{get:()=>t[o],enumerable:!(n=yi(t,o))||n.enumerable});return e};var wt=(e,t,r)=>(r=e!=null?xi(Bi(e)):{},Mi(t||!e||!e.__esModule?nn(r,"default",{value:e,enumerable:!0}):r,e));var ur=Pt((or,ir)=>{(function(e,t){typeof or=="object"&&typeof ir<"u"?ir.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e["'typed'"]=t())})(or,function(){"use strict";function e(){return!0}function t(){return!1}function r(){}let n="Argument is not a typed-function.";function o(){function u(m){return typeof m=="object"&&m!==null&&m.constructor===Object}let s=[{name:"number",test:function(m){return typeof m=="number"}},{name:"string",test:function(m){return typeof m=="string"}},{name:"boolean",test:function(m){return typeof m=="boolean"}},{name:"Function",test:function(m){return typeof m=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(m){return m instanceof Date}},{name:"RegExp",test:function(m){return m instanceof RegExp}},{name:"Object",test:u},{name:"null",test:function(m){return m===null}},{name:"undefined",test:function(m){return m===void 0}}],f={name:"any",test:e,isAny:!0},h,a,l=0,p={createCount:0};function D(m){let E=h.get(m);if(E)return E;let w='Unknown type "'+m+'"',B=m.toLowerCase(),I;for(I of a)if(I.toLowerCase()===B){w+='. Did you mean "'+I+'" ?';break}throw new TypeError(w)}function v(m){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",w=E?D(E).index:a.length,B=[];for(let M=0;M<m.length;++M){if(!m[M]||typeof m[M].name!="string"||typeof m[M].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Z=m[M].name;if(h.has(Z))throw new TypeError('Duplicate type name "'+Z+'"');B.push(Z),h.set(Z,{name:Z,test:m[M].test,isAny:m[M].isAny,index:w+M,conversionsTo:[]})}let I=a.slice(w);a=a.slice(0,w).concat(B).concat(I);for(let M=w+B.length;M<a.length;++M)h.get(a[M]).index=M}function c(){h=new Map,a=[],l=0,v([f],!1)}c(),v(s);function d(){let m;for(m of a)h.get(m).conversionsTo=[];l=0}function g(m){let E=a.filter(w=>{let B=h.get(w);return!B.isAny&&B.test(m)});return E.length?E:["any"]}function C(m){return m&&typeof m=="function"&&"_typedFunctionData"in m}function F(m,E,w){if(!C(m))throw new TypeError(n);let B=w&&w.exact,I=Array.isArray(E)?E.join(","):E,M=H(I),Z=_(M);if(!B||Z in m.signatures){let ne=m._typedFunctionData.signatureMap.get(Z);if(ne)return ne}let L=M.length,k;if(B){k=[];let ne;for(ne in m.signatures)k.push(m._typedFunctionData.signatureMap.get(ne))}else k=m._typedFunctionData.signatures;for(let ne=0;ne<L;++ne){let ue=M[ne],pe=[],ye;for(ye of k){let Ae=O(ye.params,ne);if(!(!Ae||ue.restParam&&!Ae.restParam)){if(!Ae.hasAny){let Pe=b(Ae);if(ue.types.some(ze=>!Pe.has(ze.name)))continue}pe.push(ye)}}if(k=pe,k.length===0)break}let q;for(q of k)if(q.params.length<=L)return q;throw new TypeError("Signature not found (signature: "+(m.name||"unnamed")+"("+_(M,", ")+"))")}function y(m,E,w){return F(m,E,w).implementation}function T(m,E){let w=D(E);if(w.test(m))return m;let B=w.conversionsTo;if(B.length===0)throw new Error("There are no conversions to "+E+" defined.");for(let I=0;I<B.length;I++)if(D(B[I].from).test(m))return B[I].convert(m);throw new Error("Cannot convert "+m+" to "+E)}function _(m){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return m.map(w=>w.name).join(E)}function R(m){let E=m.indexOf("...")===0,B=(E?m.length>3?m.slice(3):"any":m).split("|").map(L=>D(L.trim())),I=!1,M=E?"...":"";return{types:B.map(function(L){return I=L.isAny||I,M+=L.name+"|",{name:L.name,typeIndex:L.index,test:L.test,isAny:L.isAny,conversion:null,conversionIndex:-1}}),name:M.slice(0,-1),hasAny:I,hasConversion:!1,restParam:E}}function A(m){let E=m.types.map(Z=>Z.name),w=Fe(E),B=m.hasAny,I=m.name,M=w.map(function(Z){let L=D(Z.from);return B=L.isAny||B,I+="|"+Z.from,{name:Z.from,typeIndex:L.index,test:L.test,isAny:L.isAny,conversion:Z,conversionIndex:Z.index}});return{types:m.types.concat(M),name:I,hasAny:B,hasConversion:M.length>0,restParam:m.restParam}}function b(m){return m.typeSet||(m.typeSet=new Set,m.types.forEach(E=>m.typeSet.add(E.name))),m.typeSet}function H(m){let E=[];if(typeof m!="string")throw new TypeError("Signatures must be strings");let w=m.trim();if(w==="")return E;let B=w.split(",");for(let I=0;I<B.length;++I){let M=R(B[I].trim());if(M.restParam&&I!==B.length-1)throw new SyntaxError('Unexpected rest parameter "'+B[I]+'": only allowed for the last parameter');if(M.types.length===0)return null;E.push(M)}return E}function U(m){let E=ot(m);return E?E.restParam:!1}function P(m){if(!m||m.types.length===0)return e;if(m.types.length===1)return D(m.types[0].name).test;if(m.types.length===2){let E=D(m.types[0].name).test,w=D(m.types[1].name).test;return function(I){return E(I)||w(I)}}else{let E=m.types.map(function(w){return D(w.name).test});return function(B){for(let I=0;I<E.length;I++)if(E[I](B))return!0;return!1}}}function z(m){let E,w,B;if(U(m)){E=Qr(m).map(P);let I=E.length,M=P(ot(m)),Z=function(L){for(let k=I;k<L.length;k++)if(!M(L[k]))return!1;return!0};return function(k){for(let q=0;q<E.length;q++)if(!E[q](k[q]))return!1;return Z(k)&&k.length>=I+1}}else return m.length===0?function(M){return M.length===0}:m.length===1?(w=P(m[0]),function(M){return w(M[0])&&M.length===1}):m.length===2?(w=P(m[0]),B=P(m[1]),function(M){return w(M[0])&&B(M[1])&&M.length===2}):(E=m.map(P),function(M){for(let Z=0;Z<E.length;Z++)if(!E[Z](M[Z]))return!1;return M.length===E.length})}function O(m,E){return E<m.length?m[E]:U(m)?ot(m):null}function $(m,E){let w=O(m,E);return w?b(w):new Set}function N(m){return m.conversion===null||m.conversion===void 0}function W(m,E){let w=new Set;return m.forEach(B=>{let I=$(B.params,E),M;for(M of I)w.add(M)}),w.has("any")?["any"]:Array.from(w)}function j(m,E,w){let B,I,M=m||"unnamed",Z=w,L;for(L=0;L<E.length;L++){let ue=[];if(Z.forEach(pe=>{let ye=O(pe.params,L),Ae=P(ye);(L<pe.params.length||U(pe.params))&&Ae(E[L])&&ue.push(pe)}),ue.length===0){if(I=W(Z,L),I.length>0){let pe=g(E[L]);return B=new TypeError("Unexpected type of argument in function "+M+" (expected: "+I.join(" or ")+", actual: "+pe.join(" | ")+", index: "+L+")"),B.data={category:"wrongType",fn:M,index:L,actual:pe,expected:I},B}}else Z=ue}let k=Z.map(function(ue){return U(ue.params)?1/0:ue.params.length});if(E.length<Math.min.apply(null,k))return I=W(Z,L),B=new TypeError("Too few arguments in function "+M+" (expected: "+I.join(" or ")+", index: "+E.length+")"),B.data={category:"tooFewArgs",fn:M,index:E.length,expected:I},B;let q=Math.max.apply(null,k);if(E.length>q)return B=new TypeError("Too many arguments in function "+M+" (expected: "+q+", actual: "+E.length+")"),B.data={category:"tooManyArgs",fn:M,index:E.length,expectedLength:q},B;let ne=[];for(let ue=0;ue<E.length;++ue)ne.push(g(E[ue]).join("|"));return B=new TypeError('Arguments of type "'+ne.join(", ")+'" do not match any of the defined signatures of function '+M+"."),B.data={category:"mismatch",actual:ne},B}function G(m){let E=a.length+1;for(let w=0;w<m.types.length;w++)N(m.types[w])&&(E=Math.min(E,m.types[w].typeIndex));return E}function X(m){let E=l+1;for(let w=0;w<m.types.length;w++)N(m.types[w])||(E=Math.min(E,m.types[w].conversionIndex));return E}function le(m,E){if(m.hasAny){if(!E.hasAny)return 1}else if(E.hasAny)return-1;if(m.restParam){if(!E.restParam)return 1}else if(E.restParam)return-1;if(m.hasConversion){if(!E.hasConversion)return 1}else if(E.hasConversion)return-1;let w=G(m)-G(E);if(w<0)return-1;if(w>0)return 1;let B=X(m)-X(E);return B<0?-1:B>0?1:0}function De(m,E){let w=m.params,B=E.params,I=ot(w),M=ot(B),Z=U(w),L=U(B);if(Z&&I.hasAny){if(!L||!M.hasAny)return 1}else if(L&&M.hasAny)return-1;let k=0,q=0,ne;for(ne of w)ne.hasAny&&++k,ne.hasConversion&&++q;let ue=0,pe=0;for(ne of B)ne.hasAny&&++ue,ne.hasConversion&&++pe;if(k!==ue)return k-ue;if(Z&&I.hasConversion){if(!L||!M.hasConversion)return 1}else if(L&&M.hasConversion)return-1;if(q!==pe)return q-pe;if(Z){if(!L)return 1}else if(L)return-1;let ye=(w.length-B.length)*(Z?-1:1);if(ye!==0)return ye;let Ae=[],Pe=0;for(let it=0;it<w.length;++it){let Ot=le(w[it],B[it]);Ae.push(Ot),Pe+=Ot}if(Pe!==0)return Pe;let ze;for(ze of Ae)if(ze!==0)return ze;return 0}function Fe(m){if(m.length===0)return[];let E=m.map(D);m.length>1&&E.sort((I,M)=>I.index-M.index);let w=E[0].conversionsTo;if(m.length===1)return w;w=w.concat([]);let B=new Set(m);for(let I=1;I<E.length;++I){let M;for(M of E[I].conversionsTo)B.has(M.from)||(w.push(M),B.add(M.from))}return w}function Oe(m,E){let w=E;if(m.some(I=>I.hasConversion)){let I=U(m),M=m.map(Ie);w=function(){let L=[],k=I?arguments.length-1:arguments.length;for(let q=0;q<k;q++)L[q]=M[q](arguments[q]);return I&&(L[k]=arguments[k].map(M[k])),E.apply(this,L)}}let B=w;if(U(m)){let I=m.length-1;B=function(){return w.apply(this,er(arguments,0,I).concat([er(arguments,I)]))}}return B}function Ie(m){let E,w,B,I,M=[],Z=[];switch(m.types.forEach(function(L){L.conversion&&(M.push(D(L.conversion.from).test),Z.push(L.conversion.convert))}),Z.length){case 0:return function(k){return k};case 1:return E=M[0],B=Z[0],function(k){return E(k)?B(k):k};case 2:return E=M[0],w=M[1],B=Z[0],I=Z[1],function(k){return E(k)?B(k):w(k)?I(k):k};default:return function(k){for(let q=0;q<Z.length;q++)if(M[q](k))return Z[q](k);return k}}}function Le(m){function E(w,B,I){if(B<w.length){let M=w[B],Z=[];if(M.restParam){let L=M.types.filter(N);L.length<M.types.length&&Z.push({types:L,name:"..."+L.map(k=>k.name).join("|"),hasAny:L.some(k=>k.isAny),hasConversion:!1,restParam:!0}),Z.push(M)}else Z=M.types.map(function(L){return{types:[L],name:L.name,hasAny:L.isAny,hasConversion:L.conversion,restParam:!1}});return ko(Z,function(L){return E(w,B+1,I.concat([L]))})}else return[I]}return E(m,0,[])}function ke(m,E){let w=Math.max(m.length,E.length);for(let L=0;L<w;L++){let k=$(m,L),q=$(E,L),ne=!1,ue;for(ue of q)if(k.has(ue)){ne=!0;break}if(!ne)return!1}let B=m.length,I=E.length,M=U(m),Z=U(E);return M?Z?B===I:I>=B:Z?B>=I:B===I}function Ee(m){return m.map(E=>en(E)?Xr(E.referToSelf.callback):Kr(E)?Jr(E.referTo.references,E.referTo.callback):E)}function Ue(m,E,w){let B=[],I;for(I of m){let M=w[I];if(typeof M!="number")throw new TypeError('No definition for referenced signature "'+I+'"');if(M=E[M],typeof M!="function")return!1;B.push(M)}return B}function Ke(m,E,w){let B=Ee(m),I=new Array(B.length).fill(!1),M=!0;for(;M;){M=!1;let Z=!0;for(let L=0;L<B.length;++L){if(I[L])continue;let k=B[L];if(en(k))B[L]=k.referToSelf.callback(w),B[L].referToSelf=k.referToSelf,I[L]=!0,Z=!1;else if(Kr(k)){let q=Ue(k.referTo.references,B,E);q?(B[L]=k.referTo.callback.apply(this,q),B[L].referTo=k.referTo,I[L]=!0,Z=!1):M=!0}}if(Z&&M)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return B}function nt(m){let E=/\bthis(\(|\.signatures\b)/;Object.keys(m).forEach(w=>{let B=m[w];if(E.test(B.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Uo(m,E){if(p.createCount++,Object.keys(E).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&nt(E);let w=[],B=[],I={},M=[],Z;for(Z in E){if(!Object.prototype.hasOwnProperty.call(E,Z))continue;let re=H(Z);if(!re)continue;w.forEach(function(Ct){if(ke(Ct,re))throw new TypeError('Conflicting signatures "'+_(Ct)+'" and "'+_(re)+'".')}),w.push(re);let Ne=B.length;B.push(E[Z]);let wi=re.map(A),It;for(It of Le(wi)){let Ct=_(It);M.push({params:It,name:Ct,fn:Ne}),It.every(Ai=>!Ai.hasConversion)&&(I[Ct]=Ne)}}M.sort(De);let L=Ke(B,I,Et),k;for(k in I)Object.prototype.hasOwnProperty.call(I,k)&&(I[k]=L[I[k]]);let q=[],ne=new Map;for(k of M)ne.has(k.name)||(k.fn=L[k.fn],q.push(k),ne.set(k.name,k));let ue=q[0]&&q[0].params.length<=2&&!U(q[0].params),pe=q[1]&&q[1].params.length<=2&&!U(q[1].params),ye=q[2]&&q[2].params.length<=2&&!U(q[2].params),Ae=q[3]&&q[3].params.length<=2&&!U(q[3].params),Pe=q[4]&&q[4].params.length<=2&&!U(q[4].params),ze=q[5]&&q[5].params.length<=2&&!U(q[5].params),it=ue&&pe&&ye&&Ae&&Pe&&ze;for(let re=0;re<q.length;++re)q[re].test=z(q[re].params);let Ot=ue?P(q[0].params[0]):t,Vo=pe?P(q[1].params[0]):t,Go=ye?P(q[2].params[0]):t,Qo=Ae?P(q[3].params[0]):t,Jo=Pe?P(q[4].params[0]):t,Xo=ze?P(q[5].params[0]):t,Ko=ue?P(q[0].params[1]):t,ei=pe?P(q[1].params[1]):t,ti=ye?P(q[2].params[1]):t,ri=Ae?P(q[3].params[1]):t,ni=Pe?P(q[4].params[1]):t,oi=ze?P(q[5].params[1]):t;for(let re=0;re<q.length;++re)q[re].implementation=Oe(q[re].params,q[re].fn);let ii=ue?q[0].implementation:r,ui=pe?q[1].implementation:r,ai=ye?q[2].implementation:r,si=Ae?q[3].implementation:r,ci=Pe?q[4].implementation:r,fi=ze?q[5].implementation:r,li=ue?q[0].params.length:-1,pi=pe?q[1].params.length:-1,hi=ye?q[2].params.length:-1,Di=Ae?q[3].params.length:-1,mi=Pe?q[4].params.length:-1,di=ze?q[5].params.length:-1,vi=it?6:0,gi=q.length,Fi=q.map(re=>re.test),Ei=q.map(re=>re.implementation),Ci=function(){for(let Ne=vi;Ne<gi;Ne++)if(Fi[Ne](arguments))return Ei[Ne].apply(this,arguments);return p.onMismatch(m,arguments,q)};function Et(re,Ne){return arguments.length===li&&Ot(re)&&Ko(Ne)?ii.apply(this,arguments):arguments.length===pi&&Vo(re)&&ei(Ne)?ui.apply(this,arguments):arguments.length===hi&&Go(re)&&ti(Ne)?ai.apply(this,arguments):arguments.length===Di&&Qo(re)&&ri(Ne)?si.apply(this,arguments):arguments.length===mi&&Jo(re)&&ni(Ne)?ci.apply(this,arguments):arguments.length===di&&Xo(re)&&oi(Ne)?fi.apply(this,arguments):Ci.apply(this,arguments)}try{Object.defineProperty(Et,"name",{value:m})}catch{}return Et.signatures=I,Et._typedFunctionData={signatures:q,signatureMap:ne},Et}function Gr(m,E,w){throw j(m,E,w)}function Qr(m){return er(m,0,m.length-1)}function ot(m){return m[m.length-1]}function er(m,E,w){return Array.prototype.slice.call(m,E,w)}function Zo(m,E){for(let w=0;w<m.length;w++)if(E(m[w]))return m[w]}function ko(m,E){return Array.prototype.concat.apply([],m.map(E))}function Ho(){let m=Qr(arguments).map(w=>_(H(w))),E=ot(arguments);if(typeof E!="function")throw new TypeError("Callback function expected as last argument");return Jr(m,E)}function Jr(m,E){return{referTo:{references:m,callback:E}}}function Xr(m){if(typeof m!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:m}}}function Kr(m){return m&&typeof m.referTo=="object"&&Array.isArray(m.referTo.references)&&typeof m.referTo.callback=="function"}function en(m){return m&&typeof m.referToSelf=="object"&&typeof m.referToSelf.callback=="function"}function tn(m,E){if(!m)return E;if(E&&E!==m){let w=new Error("Function names do not match (expected: "+m+", actual: "+E+")");throw w.data={actual:E,expected:m},w}return m}function Yo(m){let E;for(let w in m)Object.prototype.hasOwnProperty.call(m,w)&&(C(m[w])||typeof m[w].signature=="string")&&(E=tn(E,m[w].name));return E}function Wo(m,E){let w;for(w in E)if(Object.prototype.hasOwnProperty.call(E,w)){if(w in m&&E[w]!==m[w]){let B=new Error('Signature "'+w+'" is defined twice');throw B.data={signature:w,sourceFunction:E[w],destFunction:m[w]},B}m[w]=E[w]}}let jo=p;p=function(m){let E=typeof m=="string",w=E?1:0,B=E?m:"",I={};for(let M=w;M<arguments.length;++M){let Z=arguments[M],L={},k;if(typeof Z=="function"?(k=Z.name,typeof Z.signature=="string"?L[Z.signature]=Z:C(Z)&&(L=Z.signatures)):u(Z)&&(L=Z,E||(k=Yo(Z))),Object.keys(L).length===0){let q=new TypeError("Argument to 'typed' at index "+M+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw q.data={index:M,argument:Z},q}E||(B=tn(B,k)),Wo(I,L)}return Uo(B||"",I)},p.create=o,p.createCount=jo.createCount,p.onMismatch=Gr,p.throwMismatchError=Gr,p.createError=j,p.clear=c,p.clearConversions=d,p.addTypes=v,p._findType=D,p.referTo=Ho,p.referToSelf=Xr,p.convert=T,p.findSignature=F,p.find=y,p.isTypedFunction=C,p.warnAgainstDeprecatedThis=!0,p.addType=function(m,E){let w="any";E!==!1&&h.has("Object")&&(w="Object"),p.addTypes([m],w)};function rn(m){if(!m||typeof m.from!="string"||typeof m.to!="string"||typeof m.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(m.to===m.from)throw new SyntaxError('Illegal to define conversion from "'+m.from+'" to itself.')}return p.addConversion=function(m){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};rn(m);let w=D(m.to),B=w.conversionsTo.find(I=>I.from===m.from);if(B)if(E&&E.override)p.removeConversion({from:B.from,to:m.to,convert:B.convert});else throw new Error('There is already a conversion from "'+m.from+'" to "'+w.name+'"');w.conversionsTo.push({from:m.from,convert:m.convert,index:l++})},p.addConversions=function(m,E){m.forEach(w=>p.addConversion(w,E))},p.removeConversion=function(m){rn(m);let E=D(m.to),w=Zo(E.conversionsTo,I=>I.from===m.from);if(!w)throw new Error("Attempt to remove nonexistent conversion from "+m.from+" to "+m.to);if(w.convert!==m.convert)throw new Error("Conversion to remove does not match existing conversion");let B=E.conversionsTo.indexOf(w);E.conversionsTo.splice(B,1)},p.resolve=function(m,E){if(!C(m))throw new TypeError(n);let w=m._typedFunctionData.signatures;for(let B=0;B<w.length;++B)if(w[B].test(E))return w[B];return null},p}var i=o();return i})});var Po=Pt((Zr,kr)=>{(function(e,t){typeof Zr=="object"&&typeof kr<"u"?kr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(Zr,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",i="minute",u="hour",s="day",f="week",h="month",a="quarter",l="year",p="date",D="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,c=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var z=["th","st","nd","rd"],O=P%100;return"["+P+(z[(O-20)%10]||z[O]||z[0])+"]"}},g=function(P,z,O){var $=String(P);return!$||$.length>=z?P:""+Array(z+1-$.length).join(O)+P},C={s:g,z:function(P){var z=-P.utcOffset(),O=Math.abs(z),$=Math.floor(O/60),N=O%60;return(z<=0?"+":"-")+g($,2,"0")+":"+g(N,2,"0")},m:function P(z,O){if(z.date()<O.date())return-P(O,z);var $=12*(O.year()-z.year())+(O.month()-z.month()),N=z.clone().add($,h),W=O-N<0,j=z.clone().add($+(W?-1:1),h);return+(-($+(O-N)/(W?N-j:j-N))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:h,y:l,w:f,d:s,D:p,h:u,m:i,s:o,ms:n,Q:a}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},F="en",y={};y[F]=d;var T="$isDayjsObject",_=function(P){return P instanceof H||!(!P||!P[T])},R=function P(z,O,$){var N;if(!z)return F;if(typeof z=="string"){var W=z.toLowerCase();y[W]&&(N=W),O&&(y[W]=O,N=W);var j=z.split("-");if(!N&&j.length>1)return P(j[0])}else{var G=z.name;y[G]=z,N=G}return!$&&N&&(F=N),N||!$&&F},A=function(P,z){if(_(P))return P.clone();var O=typeof z=="object"?z:{};return O.date=P,O.args=arguments,new H(O)},b=C;b.l=R,b.i=_,b.w=function(P,z){return A(P,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var H=function(){function P(O){this.$L=R(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[T]=!0}var z=P.prototype;return z.parse=function(O){this.$d=function($){var N=$.date,W=$.utc;if(N===null)return new Date(NaN);if(b.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var j=N.match(v);if(j){var G=j[2]-1||0,X=(j[7]||"0").substring(0,3);return W?new Date(Date.UTC(j[1],G,j[3]||1,j[4]||0,j[5]||0,j[6]||0,X)):new Date(j[1],G,j[3]||1,j[4]||0,j[5]||0,j[6]||0,X)}}return new Date(N)}(O),this.init()},z.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},z.$utils=function(){return b},z.isValid=function(){return this.$d.toString()!==D},z.isSame=function(O,$){var N=A(O);return this.startOf($)<=N&&N<=this.endOf($)},z.isAfter=function(O,$){return A(O)<this.startOf($)},z.isBefore=function(O,$){return this.endOf($)<A(O)},z.$g=function(O,$,N){return b.u(O)?this[$]:this.set(N,O)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function(O,$){var N=this,W=!!b.u($)||$,j=b.p(O),G=function(ke,Ee){var Ue=b.w(N.$u?Date.UTC(N.$y,Ee,ke):new Date(N.$y,Ee,ke),N);return W?Ue:Ue.endOf(s)},X=function(ke,Ee){return b.w(N.toDate()[ke].apply(N.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Ee)),N)},le=this.$W,De=this.$M,Fe=this.$D,Oe="set"+(this.$u?"UTC":"");switch(j){case l:return W?G(1,0):G(31,11);case h:return W?G(1,De):G(0,De+1);case f:var Ie=this.$locale().weekStart||0,Le=(le<Ie?le+7:le)-Ie;return G(W?Fe-Le:Fe+(6-Le),De);case s:case p:return X(Oe+"Hours",0);case u:return X(Oe+"Minutes",1);case i:return X(Oe+"Seconds",2);case o:return X(Oe+"Milliseconds",3);default:return this.clone()}},z.endOf=function(O){return this.startOf(O,!1)},z.$set=function(O,$){var N,W=b.p(O),j="set"+(this.$u?"UTC":""),G=(N={},N[s]=j+"Date",N[p]=j+"Date",N[h]=j+"Month",N[l]=j+"FullYear",N[u]=j+"Hours",N[i]=j+"Minutes",N[o]=j+"Seconds",N[n]=j+"Milliseconds",N)[W],X=W===s?this.$D+($-this.$W):$;if(W===h||W===l){var le=this.clone().set(p,1);le.$d[G](X),le.init(),this.$d=le.set(p,Math.min(this.$D,le.daysInMonth())).$d}else G&&this.$d[G](X);return this.init(),this},z.set=function(O,$){return this.clone().$set(O,$)},z.get=function(O){return this[b.p(O)]()},z.add=function(O,$){var N,W=this;O=Number(O);var j=b.p($),G=function(De){var Fe=A(W);return b.w(Fe.date(Fe.date()+Math.round(De*O)),W)};if(j===h)return this.set(h,this.$M+O);if(j===l)return this.set(l,this.$y+O);if(j===s)return G(1);if(j===f)return G(7);var X=(N={},N[i]=t,N[u]=r,N[o]=e,N)[j]||1,le=this.$d.getTime()+O*X;return b.w(le,this)},z.subtract=function(O,$){return this.add(-1*O,$)},z.format=function(O){var $=this,N=this.$locale();if(!this.isValid())return N.invalidDate||D;var W=O||"YYYY-MM-DDTHH:mm:ssZ",j=b.z(this),G=this.$H,X=this.$m,le=this.$M,De=N.weekdays,Fe=N.months,Oe=N.meridiem,Ie=function(Ee,Ue,Ke,nt){return Ee&&(Ee[Ue]||Ee($,W))||Ke[Ue].slice(0,nt)},Le=function(Ee){return b.s(G%12||12,Ee,"0")},ke=Oe||function(Ee,Ue,Ke){var nt=Ee<12?"AM":"PM";return Ke?nt.toLowerCase():nt};return W.replace(c,function(Ee,Ue){return Ue||function(Ke){switch(Ke){case"YY":return String($.$y).slice(-2);case"YYYY":return b.s($.$y,4,"0");case"M":return le+1;case"MM":return b.s(le+1,2,"0");case"MMM":return Ie(N.monthsShort,le,Fe,3);case"MMMM":return Ie(Fe,le);case"D":return $.$D;case"DD":return b.s($.$D,2,"0");case"d":return String($.$W);case"dd":return Ie(N.weekdaysMin,$.$W,De,2);case"ddd":return Ie(N.weekdaysShort,$.$W,De,3);case"dddd":return De[$.$W];case"H":return String(G);case"HH":return b.s(G,2,"0");case"h":return Le(1);case"hh":return Le(2);case"a":return ke(G,X,!0);case"A":return ke(G,X,!1);case"m":return String(X);case"mm":return b.s(X,2,"0");case"s":return String($.$s);case"ss":return b.s($.$s,2,"0");case"SSS":return b.s($.$ms,3,"0");case"Z":return j}return null}(Ee)||j.replace(":","")})},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function(O,$,N){var W,j=this,G=b.p($),X=A(O),le=(X.utcOffset()-this.utcOffset())*t,De=this-X,Fe=function(){return b.m(j,X)};switch(G){case l:W=Fe()/12;break;case h:W=Fe();break;case a:W=Fe()/3;break;case f:W=(De-le)/6048e5;break;case s:W=(De-le)/864e5;break;case u:W=De/r;break;case i:W=De/t;break;case o:W=De/e;break;default:W=De}return N?W:b.a(W)},z.daysInMonth=function(){return this.endOf(h).$D},z.$locale=function(){return y[this.$L]},z.locale=function(O,$){if(!O)return this.$L;var N=this.clone(),W=R(O,$,!0);return W&&(N.$L=W),N},z.clone=function(){return b.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},P}(),U=H.prototype;return A.prototype=U,[["$ms",n],["$s",o],["$m",i],["$H",u],["$W",s],["$M",h],["$y",l],["$D",p]].forEach(function(P){U[P[1]]=function(z){return this.$g(z,P[0],P[1])}}),A.extend=function(P,z){return P.$i||(P(z,H,A),P.$i=!0),A},A.locale=R,A.isDayjs=_,A.unix=function(P){return A(1e3*P)},A.en=y[F],A.Ls=y,A.p={},A})});var zo=Pt((Hr,Yr)=>{(function(e,t){typeof Hr=="object"&&typeof Yr<"u"?Yr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_utc=t()})(Hr,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,i){var u=o.prototype;i.utc=function(D){var v={date:D,utc:!0,args:arguments};return new o(v)},u.utc=function(D){var v=i(this.toDate(),{locale:this.$L,utc:!0});return D?v.add(this.utcOffset(),e):v},u.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=u.parse;u.parse=function(D){D.utc&&(this.$u=!0),this.$utils().u(D.$offset)||(this.$offset=D.$offset),s.call(this,D)};var f=u.init;u.init=function(){if(this.$u){var D=this.$d;this.$y=D.getUTCFullYear(),this.$M=D.getUTCMonth(),this.$D=D.getUTCDate(),this.$W=D.getUTCDay(),this.$H=D.getUTCHours(),this.$m=D.getUTCMinutes(),this.$s=D.getUTCSeconds(),this.$ms=D.getUTCMilliseconds()}else f.call(this)};var h=u.utcOffset;u.utcOffset=function(D,v){var c=this.$utils().u;if(c(D))return this.$u?0:c(this.$offset)?h.call(this):this.$offset;if(typeof D=="string"&&(D=function(F){F===void 0&&(F="");var y=F.match(t);if(!y)return null;var T=(""+y[0]).match(r)||["-",0,0],_=T[0],R=60*+T[1]+ +T[2];return R===0?0:_==="+"?R:-R}(D),D===null))return this;var d=Math.abs(D)<=16?60*D:D,g=this;if(v)return g.$offset=d,g.$u=D===0,g;if(D!==0){var C=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(g=this.local().add(d+C,e)).$offset=d,g.$x.$localOffset=C}else g=this.utc();return g};var a=u.format;u.format=function(D){var v=D||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return a.call(this,v)},u.valueOf=function(){var D=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*D},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(D){return D==="s"&&this.$offset?i(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var p=u.diff;u.diff=function(D,v,c){if(D&&this.$u===D.$u)return p.call(this,D,v,c);var d=this.local(),g=i(D).local();return p.call(d,g,v,c)}}})});var Ro=Pt((Wr,jr)=>{(function(e,t){typeof Wr=="object"&&typeof jr<"u"?jr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_timezone=t()})(Wr,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var i,u=function(a,l,p){p===void 0&&(p={});var D=new Date(a),v=function(c,d){d===void 0&&(d={});var g=d.timeZoneName||"short",C=c+"|"+g,F=t[C];return F||(F=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:g}),t[C]=F),F}(l,p);return v.formatToParts(D)},s=function(a,l){for(var p=u(a,l),D=[],v=0;v<p.length;v+=1){var c=p[v],d=c.type,g=c.value,C=e[d];C>=0&&(D[C]=parseInt(g,10))}var F=D[3],y=F===24?0:F,T=D[0]+"-"+D[1]+"-"+D[2]+" "+y+":"+D[4]+":"+D[5]+":000",_=+a;return(o.utc(T).valueOf()-(_-=_%1e3))/6e4},f=n.prototype;f.tz=function(a,l){a===void 0&&(a=i);var p,D=this.utcOffset(),v=this.toDate(),c=v.toLocaleString("en-US",{timeZone:a}),d=Math.round((v-new Date(c))/1e3/60),g=15*-Math.round(v.getTimezoneOffset()/15)-d;if(!Number(g))p=this.utcOffset(0,l);else if(p=o(c,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(g,!0),l){var C=p.utcOffset();p=p.add(D-C,"minute")}return p.$x.$timezone=a,p},f.offsetName=function(a){var l=this.$x.$timezone||o.tz.guess(),p=u(this.valueOf(),l,{timeZoneName:a}).find(function(D){return D.type.toLowerCase()==="timezonename"});return p&&p.value};var h=f.startOf;f.startOf=function(a,l){if(!this.$x||!this.$x.$timezone)return h.call(this,a,l);var p=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return h.call(p,a,l).tz(this.$x.$timezone,!0)},o.tz=function(a,l,p){var D=p&&l,v=p||l||i,c=s(+o(),v);if(typeof a!="string")return o(a).tz(v);var d=function(y,T,_){var R=y-60*T*1e3,A=s(R,_);if(T===A)return[R,T];var b=s(R-=60*(A-T)*1e3,_);return A===b?[R,A]:[y-60*Math.min(A,b)*1e3,Math.max(A,b)]}(o.utc(a,D).valueOf(),c,v),g=d[0],C=d[1],F=o(g).utcOffset(C);return F.$x.$timezone=v,F},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(a){i=a}}})});function ut(){return ut=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ut.apply(null,arguments)}var tr={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function on(e,t){if(xt(e,t))return e[t];throw typeof e[t]=="function"&&Si(e,t)?new Error('Cannot access method "'+t+'" as a property'):new Error('No access to property "'+t+'"')}function un(e,t,r){if(xt(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function xt(e,t){return!_i(e)&&!Array.isArray(e)?!1:At(Ti,t)?!0:!(t in Object.prototype||t in Function.prototype)}function Si(e,t){return e==null||typeof e[t]!="function"||At(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:At(Oi,t)?!0:!(t in Object.prototype||t in Function.prototype)}function _i(e){return typeof e=="object"&&e&&e.constructor===Object}var Ti={length:!0,name:!0},Oi={toString:!0,valueOf:!0,toLocaleString:!0};var zt=class{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(t=>this.has(t)).values()}get(t){return on(this.wrappedObject,t)}set(t,r){return un(this.wrappedObject,t,r),this}has(t){return xt(this.wrappedObject,t)&&t in this.wrappedObject}entries(){return Ii(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){xt(this.wrappedObject,t)&&delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}};function Ii(e,t){return{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function K(e){return typeof e=="number"}function ae(e){return!e||typeof e!="object"||typeof e.constructor!="function"?!1:e.isBigNumber===!0&&typeof e.constructor.prototype=="object"&&e.constructor.prototype.isBigNumber===!0||typeof e.constructor.isDecimal=="function"&&e.constructor.isDecimal(e)===!0}function an(e){return typeof e=="bigint"}function rr(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function nr(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function Rt(e){return e&&e.constructor.prototype.isUnit===!0||!1}function xe(e){return typeof e=="string"}var se=Array.isArray;function _e(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function et(e){return Array.isArray(e)||_e(e)}function sn(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function cn(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function fn(e){return e&&e.constructor.prototype.isRange===!0||!1}function at(e){return e&&e.constructor.prototype.isIndex===!0||!1}function ln(e){return typeof e=="boolean"}function pn(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function hn(e){return e&&e.constructor.prototype.isHelp===!0||!1}function Dn(e){return typeof e=="function"}function mn(e){return e instanceof Date}function dn(e){return e instanceof RegExp}function st(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!rr(e)&&!nr(e))}function vn(e){return e?e instanceof Map||e instanceof zt||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}function gn(e){return e===null}function Fn(e){return e===void 0}function En(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function Cn(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function wn(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function An(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function xn(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function yn(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function Nn(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function Bn(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function bn(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function Mn(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function Sn(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function _n(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function Tn(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function On(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function In(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function Pn(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function zn(e){return e&&e.constructor.prototype.isChain===!0||!1}function Re(e){var t=typeof e;return t==="object"?e===null?"null":ae(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function he(e){var t=typeof e;if(t==="number"||t==="bigint"||t==="string"||t==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(r){return he(r)});if(e instanceof Date)return new Date(e.valueOf());if(ae(e))return e;if(st(e))return Pi(e,he);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function Pi(e,t){var r={};for(var n in e)At(e,n)&&(r[n]=t(e[n]));return r}function He(e,t){var r,n,o;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,o=e.length;n<o;n++)if(!He(e[n],t[n]))return!1;return!0}else{if(typeof e=="function")return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!He(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}else return e===t}}function At(e,t){return e&&Object.hasOwnProperty.call(e,t)}function Rn(e,t){for(var r={},n=0;n<t.length;n++){var o=t[n],i=e[o];i!==void 0&&(r[o]=i)}return r}var $n=["Matrix","Array"],qn=["number","BigNumber","Fraction"];var ct=function(t){if(t)throw new Error(`The global config is readonly.
Please create a mathjs instance if you want to change the default configuration.
Example:

  import { create, all } from 'mathjs';
  const mathjs = create(all);
  mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(tr)};ut(ct,tr,{MATRIX_OPTIONS:$n,NUMBER_OPTIONS:qn});var fr=wt(ur(),1);function ee(e,t,r,n){function o(i){var u=Rn(i,t.map($i));return zi(e,t,i),r(u)}return o.isFactory=!0,o.fn=e,o.dependencies=t.slice().sort(),n&&(o.meta=n),o}function zi(e,t,r){var n=t.filter(i=>!Ri(i)).every(i=>r[i]!==void 0);if(!n){var o=t.filter(i=>r[i]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(o.map(i=>'"'.concat(i,'"')).join(", "),"."))}}function Ri(e){return e&&e[0]==="?"}function $i(e){return e&&e[0]==="?"?e.slice(1):e}function te(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var Zn=Math.sign||function(e){return e>0?1:e<0?-1:0},kn=Math.log2||function(t){return Math.log(t)/Math.LN2},Hn=Math.log10||function(t){return Math.log(t)/Math.LN10},Yn=Math.log1p||function(e){return Math.log(e+1)},Wn=Math.cbrt||function(t){if(t===0)return t;var r=t<0,n;return r&&(t=-t),isFinite(t)?(n=Math.exp(Math.log(t)/3),n=(t/(n*n)+2*n)/3):n=t,r?-n:n},jn=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function ar(e,t,r){var n={2:"0b",8:"0o",16:"0x"},o=n[t],i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!te(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!te(e))throw new Error("Value must be an integer");e<0&&(e=e+2**r),i="i".concat(r)}var u="";return e<0&&(e=-e,u="-"),"".concat(u).concat(o).concat(e.toString(t)).concat(i)}function yt(e,t){if(typeof t=="function")return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:o}=sr(t);switch(r){case"fixed":return cr(e,n);case"exponential":return Vn(e,n);case"engineering":return qi(e,n);case"bin":return ar(e,2,o);case"oct":return ar(e,8,o);case"hex":return ar(e,16,o);case"auto":return Li(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var i=arguments[2],u=arguments[4];return i!=="."?i+u:u});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function sr(e){var t="auto",r,n;if(e!==void 0)if(K(e))r=e;else if(ae(e))r=e.toNumber();else if(st(e))e.precision!==void 0&&(r=Ln(e.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),e.wordSize!==void 0&&(n=Ln(e.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(t=e.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:t,precision:r,wordSize:n}}function lt(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],o=parseFloat(t[4]||"0"),i=n.indexOf(".");o+=i!==-1?i-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(s){return o-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return u.length===0&&(u.push(0),o++),{sign:r,coefficients:u,exponent:o}}function qi(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=lt(e),n=$t(r,t),o=n.exponent,i=n.coefficients,u=o%3===0?o:o<0?o-3-o%3:o-o%3;if(K(t))for(;t>i.length||o-u+1>i.length;)i.push(0);else for(var s=Math.abs(o-u)-(i.length-1),f=0;f<s;f++)i.push(0);for(var h=Math.abs(o-u),a=1;h>0;)a++,h--;var l=i.slice(a).join(""),p=K(t)&&l.length||l.match(/[1-9]/)?"."+l:"",D=i.slice(0,a).join("")+p+"e"+(o>=0?"+":"")+u.toString();return n.sign+D}function cr(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=lt(e),n=typeof t=="number"?$t(r,r.exponent+1+t):r,o=n.coefficients,i=n.exponent+1,u=i+(t||0);return o.length<u&&(o=o.concat(ft(u-o.length))),i<0&&(o=ft(-i+1).concat(o),i=1),i<o.length&&o.splice(i,0,i===0?"0.":"."),n.sign+o.join("")}function Vn(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=lt(e),n=t?$t(r,t):r,o=n.coefficients,i=n.exponent;o.length<t&&(o=o.concat(ft(t-o.length)));var u=o.shift();return n.sign+u+(o.length>0?"."+o.join(""):"")+"e"+(i>=0?"+":"")+i}function Li(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=Un(r?.lowerExp,-3),o=Un(r?.upperExp,5),i=lt(e),u=t?$t(i,t):i;if(u.exponent<n||u.exponent>=o)return Vn(e,t);var s=u.coefficients,f=u.exponent;s.length<t&&(s=s.concat(ft(t-s.length))),s=s.concat(ft(f-s.length+1+(s.length<t?t-s.length:0))),s=ft(-f).concat(s);var h=f>0?f:0;return h<s.length-1&&s.splice(h+1,0,"."),u.sign+s.join("")}function $t(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t){var o=n.splice(t,n.length-t);if(o[0]>=5){var i=t-1;for(n[i]++;n[i]===10;)n.pop(),i===0&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}}return r}function ft(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}function Gn(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var Cs=Number.EPSILON||2220446049250313e-31;function Ye(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(e)||isNaN(t)?!1:!isFinite(e)||!isFinite(t)?e===t:e===t?!0:Math.abs(e-t)<=Math.max(r*Math.max(Math.abs(e),Math.abs(t)),n)}function Ln(e,t){if(K(e))return e;if(ae(e))return e.toNumber();t()}function Un(e,t){return K(e)?e:ae(e)?e.toNumber():t}var Qn=function(){return Qn=fr.default.create,fr.default},Ui=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],lr=ee("typed",Ui,function(t){var{BigNumber:r,Complex:n,DenseMatrix:o,Fraction:i}=t,u=Qn();return u.clear(),u.addTypes([{name:"number",test:K},{name:"Complex",test:rr},{name:"BigNumber",test:ae},{name:"bigint",test:an},{name:"Fraction",test:nr},{name:"Unit",test:Rt},{name:"identifier",test:s=>xe&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:xe},{name:"Chain",test:zn},{name:"Array",test:se},{name:"Matrix",test:_e},{name:"DenseMatrix",test:sn},{name:"SparseMatrix",test:cn},{name:"Range",test:fn},{name:"Index",test:at},{name:"boolean",test:ln},{name:"ResultSet",test:pn},{name:"Help",test:hn},{name:"function",test:Dn},{name:"Date",test:mn},{name:"RegExp",test:dn},{name:"null",test:gn},{name:"undefined",test:Fn},{name:"AccessorNode",test:En},{name:"ArrayNode",test:Cn},{name:"AssignmentNode",test:wn},{name:"BlockNode",test:An},{name:"ConditionalNode",test:xn},{name:"ConstantNode",test:yn},{name:"FunctionNode",test:Bn},{name:"FunctionAssignmentNode",test:Nn},{name:"IndexNode",test:bn},{name:"Node",test:Mn},{name:"ObjectNode",test:Sn},{name:"OperatorNode",test:_n},{name:"ParenthesisNode",test:Tn},{name:"RangeNode",test:On},{name:"RelationalNode",test:In},{name:"SymbolNode",test:Pn},{name:"Map",test:vn},{name:"Object",test:st}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(f){if(r||qt(f),Gn(f)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+f+"). Use function bignumber(x) to convert to BigNumber.");return new r(f)}},{from:"number",to:"Complex",convert:function(f){return n||Lt(f),new n(f,0)}},{from:"BigNumber",to:"Complex",convert:function(f){return n||Lt(f),new n(f.toNumber(),0)}},{from:"bigint",to:"number",convert:function(f){if(f>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+f+")");return Number(f)}},{from:"bigint",to:"BigNumber",convert:function(f){return r||qt(f),new r(f.toString())}},{from:"bigint",to:"Fraction",convert:function(f){return i||Ut(f),new i(f.toString())}},{from:"Fraction",to:"BigNumber",convert:function(f){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(f){return n||Lt(f),new n(f.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(f){i||Ut(f);var h=new i(f);if(h.valueOf()!==f)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+f+"). Use function fraction(x) to convert to Fraction.");return h}},{from:"string",to:"number",convert:function(f){var h=Number(f);if(isNaN(h))throw new Error('Cannot convert "'+f+'" to a number');return h}},{from:"string",to:"BigNumber",convert:function(f){r||qt(f);try{return new r(f)}catch{throw new Error('Cannot convert "'+f+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(f){try{return BigInt(f)}catch{throw new Error('Cannot convert "'+f+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(f){i||Ut(f);try{return new i(f)}catch{throw new Error('Cannot convert "'+f+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(f){n||Lt(f);try{return new n(f)}catch{throw new Error('Cannot convert "'+f+'" to Complex')}}},{from:"boolean",to:"number",convert:function(f){return+f}},{from:"boolean",to:"BigNumber",convert:function(f){return r||qt(f),new r(+f)}},{from:"boolean",to:"bigint",convert:function(f){return BigInt(+f)}},{from:"boolean",to:"Fraction",convert:function(f){return i||Ut(f),new i(+f)}},{from:"boolean",to:"string",convert:function(f){return String(f)}},{from:"Array",to:"Matrix",convert:function(f){return o||Zi(),new o(f)}},{from:"Matrix",to:"Array",convert:function(f){return f.valueOf()}}]),u.onMismatch=(s,f,h)=>{var a=u.createError(s,f,h);if(["wrongType","mismatch"].includes(a.data.category)&&f.length===1&&et(f[0])&&h.some(p=>!p.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=a.data,l}throw a},u.onMismatch=(s,f,h)=>{var a=u.createError(s,f,h);if(["wrongType","mismatch"].includes(a.data.category)&&f.length===1&&et(f[0])&&h.some(p=>!p.params.includes(","))){var l=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw l.data=a.data,l}throw a},u});function qt(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Lt(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function Zi(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Ut(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var pt=9e15,Xe=1e9,pr="0123456789abcdef",kt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ht="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",hr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-pt,maxE:pt,crypto:!1},eo,We,J=!0,Wt="[DecimalError] ",Je=Wt+"Invalid argument: ",to=Wt+"Precision limit exceeded",ro=Wt+"crypto unavailable",no="[object Decimal]",Ce=Math.floor,me=Math.pow,ki=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Hi=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Yi=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,oo=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qe=1e7,Q=7,Wi=9007199254740991,ji=kt.length-1,Dr=Ht.length-1,S={toStringTag:no};S.absoluteValue=S.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),V(e)};S.ceil=function(){return V(new this.constructor(this),this.e+1,2)};S.clampedTo=S.clamp=function(e,t){var r,n=this,o=n.constructor;if(e=new o(e),t=new o(t),!e.s||!t.s)return new o(NaN);if(e.gt(t))throw Error(Je+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new o(n)};S.comparedTo=S.cmp=function(e){var t,r,n,o,i=this,u=i.d,s=(e=new i.constructor(e)).d,f=i.s,h=e.s;if(!u||!s)return!f||!h?NaN:f!==h?f:u===s?0:!u^f<0?1:-1;if(!u[0]||!s[0])return u[0]?f:s[0]?-h:0;if(f!==h)return f;if(i.e!==e.e)return i.e>e.e^f<0?1:-1;for(n=u.length,o=s.length,t=0,r=n<o?n:o;t<r;++t)if(u[t]!==s[t])return u[t]>s[t]^f<0?1:-1;return n===o?0:n>o^f<0?1:-1};S.cosine=S.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Q,n.rounding=1,r=Vi(n,co(n,r)),n.precision=e,n.rounding=t,V(We==2||We==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};S.cubeRoot=S.cbrt=function(){var e,t,r,n,o,i,u,s,f,h,a=this,l=a.constructor;if(!a.isFinite()||a.isZero())return new l(a);for(J=!1,i=a.s*me(a.s*a,1/3),!i||Math.abs(i)==1/0?(r=ve(a.d),e=a.e,(i=(e-r.length+1)%3)&&(r+=i==1||i==-2?"0":"00"),i=me(r,1/3),e=Ce((e+1)/3)-(e%3==(e<0?-1:2)),i==1/0?r="5e"+e:(r=i.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new l(r),n.s=a.s):n=new l(i.toString()),u=(e=l.precision)+3;;)if(s=n,f=s.times(s).times(s),h=f.plus(a),n=oe(h.plus(a).times(s),h.plus(f),u+2,1),ve(s.d).slice(0,u)===(r=ve(n.d)).slice(0,u))if(r=r.slice(u-3,u+1),r=="9999"||!o&&r=="4999"){if(!o&&(V(s,e+1,0),s.times(s).times(s).eq(a))){n=s;break}u+=4,o=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(V(n,e+1,1),t=!n.times(n).times(n).eq(a));break}return J=!0,V(n,e,l.rounding,t)};S.decimalPlaces=S.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ce(this.e/Q))*Q,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};S.dividedBy=S.div=function(e){return oe(this,new this.constructor(e))};S.dividedToIntegerBy=S.divToInt=function(e){var t=this,r=t.constructor;return V(oe(t,new r(e),0,1,1),r.precision,r.rounding)};S.equals=S.eq=function(e){return this.cmp(e)===0};S.floor=function(){return V(new this.constructor(this),this.e+1,3)};S.greaterThan=S.gt=function(e){return this.cmp(e)>0};S.greaterThanOrEqualTo=S.gte=function(e){var t=this.cmp(e);return t==1||t===0};S.hyperbolicCosine=S.cosh=function(){var e,t,r,n,o,i=this,u=i.constructor,s=new u(1);if(!i.isFinite())return new u(i.s?1/0:NaN);if(i.isZero())return s;r=u.precision,n=u.rounding,u.precision=r+Math.max(i.e,i.sd())+4,u.rounding=1,o=i.d.length,o<32?(e=Math.ceil(o/3),t=(1/Vt(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),i=ht(u,1,i.times(t),new u(1),!0);for(var f,h=e,a=new u(8);h--;)f=i.times(i),i=s.minus(f.times(a.minus(f.times(a))));return V(i,u.precision=r,u.rounding=n,!0)};S.hyperbolicSine=S.sinh=function(){var e,t,r,n,o=this,i=o.constructor;if(!o.isFinite()||o.isZero())return new i(o);if(t=i.precision,r=i.rounding,i.precision=t+Math.max(o.e,o.sd())+4,i.rounding=1,n=o.d.length,n<3)o=ht(i,2,o,o,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,o=o.times(1/Vt(5,e)),o=ht(i,2,o,o,!0);for(var u,s=new i(5),f=new i(16),h=new i(20);e--;)u=o.times(o),o=o.times(s.plus(u.times(f.times(u).plus(h))))}return i.precision=t,i.rounding=r,V(o,t,r,!0)};S.hyperbolicTangent=S.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,oe(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};S.inverseCosine=S.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),o=r.precision,i=r.rounding;return n!==-1?n===0?t.isNeg()?$e(r,o,i):new r(0):new r(NaN):t.isZero()?$e(r,o+4,i).times(.5):(r.precision=o+6,r.rounding=1,t=t.asin(),e=$e(r,o+4,i).times(.5),r.precision=o,r.rounding=i,e.minus(t))};S.inverseHyperbolicCosine=S.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,J=!1,r=r.times(r).minus(1).sqrt().plus(r),J=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};S.inverseHyperbolicSine=S.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,J=!1,r=r.times(r).plus(1).sqrt().plus(r),J=!0,n.precision=e,n.rounding=t,r.ln())};S.inverseHyperbolicTangent=S.atanh=function(){var e,t,r,n,o=this,i=o.constructor;return o.isFinite()?o.e>=0?new i(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN):(e=i.precision,t=i.rounding,n=o.sd(),Math.max(n,e)<2*-o.e-1?V(new i(o),e,t,!0):(i.precision=r=n-o.e,o=oe(o.plus(1),new i(1).minus(o),r+e,1),i.precision=e+4,i.rounding=1,o=o.ln(),i.precision=e,i.rounding=t,o.times(.5))):new i(NaN)};S.inverseSine=S.asin=function(){var e,t,r,n,o=this,i=o.constructor;return o.isZero()?new i(o):(t=o.abs().cmp(1),r=i.precision,n=i.rounding,t!==-1?t===0?(e=$e(i,r+4,n).times(.5),e.s=o.s,e):new i(NaN):(i.precision=r+6,i.rounding=1,o=o.div(new i(1).minus(o.times(o)).sqrt().plus(1)).atan(),i.precision=r,i.rounding=n,o.times(2)))};S.inverseTangent=S.atan=function(){var e,t,r,n,o,i,u,s,f,h=this,a=h.constructor,l=a.precision,p=a.rounding;if(h.isFinite()){if(h.isZero())return new a(h);if(h.abs().eq(1)&&l+4<=Dr)return u=$e(a,l+4,p).times(.25),u.s=h.s,u}else{if(!h.s)return new a(NaN);if(l+4<=Dr)return u=$e(a,l+4,p).times(.5),u.s=h.s,u}for(a.precision=s=l+10,a.rounding=1,r=Math.min(28,s/Q+2|0),e=r;e;--e)h=h.div(h.times(h).plus(1).sqrt().plus(1));for(J=!1,t=Math.ceil(s/Q),n=1,f=h.times(h),u=new a(h),o=h;e!==-1;)if(o=o.times(f),i=u.minus(o.div(n+=2)),o=o.times(f),u=i.plus(o.div(n+=2)),u.d[t]!==void 0)for(e=t;u.d[e]===i.d[e]&&e--;);return r&&(u=u.times(2<<r-1)),J=!0,V(u,a.precision=l,a.rounding=p,!0)};S.isFinite=function(){return!!this.d};S.isInteger=S.isInt=function(){return!!this.d&&Ce(this.e/Q)>this.d.length-2};S.isNaN=function(){return!this.s};S.isNegative=S.isNeg=function(){return this.s<0};S.isPositive=S.isPos=function(){return this.s>0};S.isZero=function(){return!!this.d&&this.d[0]===0};S.lessThan=S.lt=function(e){return this.cmp(e)<0};S.lessThanOrEqualTo=S.lte=function(e){return this.cmp(e)<1};S.logarithm=S.log=function(e){var t,r,n,o,i,u,s,f,h=this,a=h.constructor,l=a.precision,p=a.rounding,D=5;if(e==null)e=new a(10),t=!0;else{if(e=new a(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new a(NaN);t=e.eq(10)}if(r=h.d,h.s<0||!r||!r[0]||h.eq(1))return new a(r&&!r[0]?-1/0:h.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(o=r[0];o%10===0;)o/=10;i=o!==1}if(J=!1,s=l+D,u=Qe(h,s),n=t?Yt(a,s+10):Qe(e,s),f=oe(u,n,s,1),Nt(f.d,o=l,p))do if(s+=10,u=Qe(h,s),n=t?Yt(a,s+10):Qe(e,s),f=oe(u,n,s,1),!i){+ve(f.d).slice(o+1,o+15)+1==1e14&&(f=V(f,l+1,0));break}while(Nt(f.d,o+=10,p));return J=!0,V(f,l,p)};S.minus=S.sub=function(e){var t,r,n,o,i,u,s,f,h,a,l,p,D=this,v=D.constructor;if(e=new v(e),!D.d||!e.d)return!D.s||!e.s?e=new v(NaN):D.d?e.s=-e.s:e=new v(e.d||D.s!==e.s?D:NaN),e;if(D.s!=e.s)return e.s=-e.s,D.plus(e);if(h=D.d,p=e.d,s=v.precision,f=v.rounding,!h[0]||!p[0]){if(p[0])e.s=-e.s;else if(h[0])e=new v(D);else return new v(f===3?-0:0);return J?V(e,s,f):e}if(r=Ce(e.e/Q),a=Ce(D.e/Q),h=h.slice(),i=a-r,i){for(l=i<0,l?(t=h,i=-i,u=p.length):(t=p,r=a,u=h.length),n=Math.max(Math.ceil(s/Q),u)+2,i>n&&(i=n,t.length=1),t.reverse(),n=i;n--;)t.push(0);t.reverse()}else{for(n=h.length,u=p.length,l=n<u,l&&(u=n),n=0;n<u;n++)if(h[n]!=p[n]){l=h[n]<p[n];break}i=0}for(l&&(t=h,h=p,p=t,e.s=-e.s),u=h.length,n=p.length-u;n>0;--n)h[u++]=0;for(n=p.length;n>i;){if(h[--n]<p[n]){for(o=n;o&&h[--o]===0;)h[o]=qe-1;--h[o],h[n]+=qe}h[n]-=p[n]}for(;h[--u]===0;)h.pop();for(;h[0]===0;h.shift())--r;return h[0]?(e.d=h,e.e=jt(h,r),J?V(e,s,f):e):new v(f===3?-0:0)};S.modulo=S.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?V(new n(r),n.precision,n.rounding):(J=!1,n.modulo==9?(t=oe(r,e.abs(),0,3,1),t.s*=e.s):t=oe(r,e,0,n.modulo,1),t=t.times(e),J=!0,r.minus(t))};S.naturalExponential=S.exp=function(){return mr(this)};S.naturalLogarithm=S.ln=function(){return Qe(this)};S.negated=S.neg=function(){var e=new this.constructor(this);return e.s=-e.s,V(e)};S.plus=S.add=function(e){var t,r,n,o,i,u,s,f,h,a,l=this,p=l.constructor;if(e=new p(e),!l.d||!e.d)return!l.s||!e.s?e=new p(NaN):l.d||(e=new p(e.d||l.s===e.s?l:NaN)),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(h=l.d,a=e.d,s=p.precision,f=p.rounding,!h[0]||!a[0])return a[0]||(e=new p(l)),J?V(e,s,f):e;if(i=Ce(l.e/Q),n=Ce(e.e/Q),h=h.slice(),o=i-n,o){for(o<0?(r=h,o=-o,u=a.length):(r=a,n=i,u=h.length),i=Math.ceil(s/Q),u=i>u?i+1:u+1,o>u&&(o=u,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(u=h.length,o=a.length,u-o<0&&(o=u,r=a,a=h,h=r),t=0;o;)t=(h[--o]=h[o]+a[o]+t)/qe|0,h[o]%=qe;for(t&&(h.unshift(t),++n),u=h.length;h[--u]==0;)h.pop();return e.d=h,e.e=jt(h,n),J?V(e,s,f):e};S.precision=S.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Je+e);return r.d?(t=io(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};S.round=function(){var e=this,t=e.constructor;return V(new t(e),e.e+1,t.rounding)};S.sine=S.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Q,n.rounding=1,r=Qi(n,co(n,r)),n.precision=e,n.rounding=t,V(We>2?r.neg():r,e,t,!0)):new n(NaN)};S.squareRoot=S.sqrt=function(){var e,t,r,n,o,i,u=this,s=u.d,f=u.e,h=u.s,a=u.constructor;if(h!==1||!s||!s[0])return new a(!h||h<0&&(!s||s[0])?NaN:s?u:1/0);for(J=!1,h=Math.sqrt(+u),h==0||h==1/0?(t=ve(s),(t.length+f)%2==0&&(t+="0"),h=Math.sqrt(t),f=Ce((f+1)/2)-(f<0||f%2),h==1/0?t="5e"+f:(t=h.toExponential(),t=t.slice(0,t.indexOf("e")+1)+f),n=new a(t)):n=new a(h.toString()),r=(f=a.precision)+3;;)if(i=n,n=i.plus(oe(u,i,r+2,1)).times(.5),ve(i.d).slice(0,r)===(t=ve(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!o&&t=="4999"){if(!o&&(V(i,f+1,0),i.times(i).eq(u))){n=i;break}r+=4,o=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(V(n,f+1,1),e=!n.times(n).eq(u));break}return J=!0,V(n,f,a.rounding,e)};S.tangent=S.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=oe(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,V(We==2||We==4?r.neg():r,e,t,!0)):new n(NaN)};S.times=S.mul=function(e){var t,r,n,o,i,u,s,f,h,a=this,l=a.constructor,p=a.d,D=(e=new l(e)).d;if(e.s*=a.s,!p||!p[0]||!D||!D[0])return new l(!e.s||p&&!p[0]&&!D||D&&!D[0]&&!p?NaN:!p||!D?e.s/0:e.s*0);for(r=Ce(a.e/Q)+Ce(e.e/Q),f=p.length,h=D.length,f<h&&(i=p,p=D,D=i,u=f,f=h,h=u),i=[],u=f+h,n=u;n--;)i.push(0);for(n=h;--n>=0;){for(t=0,o=f+n;o>n;)s=i[o]+D[n]*p[o-n-1]+t,i[o--]=s%qe|0,t=s/qe|0;i[o]=(i[o]+t)%qe|0}for(;!i[--u];)i.pop();return t?++r:i.shift(),e.d=i,e.e=jt(i,r),J?V(e,l.precision,l.rounding):e};S.toBinary=function(e,t){return vr(this,2,e,t)};S.toDecimalPlaces=S.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Be(e,0,Xe),t===void 0?t=n.rounding:Be(t,0,8),V(r,e+r.e+1,t))};S.toExponential=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=Ze(n,!0):(Be(e,0,Xe),t===void 0?t=o.rounding:Be(t,0,8),n=V(new o(n),e+1,t),r=Ze(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};S.toFixed=function(e,t){var r,n,o=this,i=o.constructor;return e===void 0?r=Ze(o):(Be(e,0,Xe),t===void 0?t=i.rounding:Be(t,0,8),n=V(new i(o),e+o.e+1,t),r=Ze(n,!1,e+n.e+1)),o.isNeg()&&!o.isZero()?"-"+r:r};S.toFraction=function(e){var t,r,n,o,i,u,s,f,h,a,l,p,D=this,v=D.d,c=D.constructor;if(!v)return new c(D);if(h=r=new c(1),n=f=new c(0),t=new c(n),i=t.e=io(v)-D.e-1,u=i%Q,t.d[0]=me(10,u<0?Q+u:u),e==null)e=i>0?t:h;else{if(s=new c(e),!s.isInt()||s.lt(h))throw Error(Je+s);e=s.gt(t)?i>0?t:h:s}for(J=!1,s=new c(ve(v)),a=c.precision,c.precision=i=v.length*Q*2;l=oe(s,t,0,1,1),o=r.plus(l.times(n)),o.cmp(e)!=1;)r=n,n=o,o=h,h=f.plus(l.times(o)),f=o,o=t,t=s.minus(l.times(o)),s=o;return o=oe(e.minus(r),n,0,1,1),f=f.plus(o.times(h)),r=r.plus(o.times(n)),f.s=h.s=D.s,p=oe(h,n,i,1).minus(D).abs().cmp(oe(f,r,i,1).minus(D).abs())<1?[h,n]:[f,r],c.precision=a,J=!0,p};S.toHexadecimal=S.toHex=function(e,t){return vr(this,16,e,t)};S.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Be(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(J=!1,r=oe(r,e,0,t,1).times(e),J=!0,V(r)):(e.s=r.s,r=e),r};S.toNumber=function(){return+this};S.toOctal=function(e,t){return vr(this,8,e,t)};S.toPower=S.pow=function(e){var t,r,n,o,i,u,s=this,f=s.constructor,h=+(e=new f(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new f(me(+s,h));if(s=new f(s),s.eq(1))return s;if(n=f.precision,i=f.rounding,e.eq(1))return V(s,n,i);if(t=Ce(e.e/Q),t>=e.d.length-1&&(r=h<0?-h:h)<=Wi)return o=uo(f,s,r,n),e.s<0?new f(1).div(o):V(o,n,i);if(u=s.s,u<0){if(t<e.d.length-1)return new f(NaN);if(e.d[t]&1||(u=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=u,s}return r=me(+s,h),t=r==0||!isFinite(r)?Ce(h*(Math.log("0."+ve(s.d))/Math.LN10+s.e+1)):new f(r+"").e,t>f.maxE+1||t<f.minE-1?new f(t>0?u/0:0):(J=!1,f.rounding=s.s=1,r=Math.min(12,(t+"").length),o=mr(e.times(Qe(s,n+r)),n),o.d&&(o=V(o,n+5,1),Nt(o.d,n,i)&&(t=n+10,o=V(mr(e.times(Qe(s,t+r)),t),t+5,1),+ve(o.d).slice(n+1,n+15)+1==1e14&&(o=V(o,n+1,0)))),o.s=u,J=!0,f.rounding=i,V(o,n,i))};S.toPrecision=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=Ze(n,n.e<=o.toExpNeg||n.e>=o.toExpPos):(Be(e,1,Xe),t===void 0?t=o.rounding:Be(t,0,8),n=V(new o(n),e,t),r=Ze(n,e<=n.e||n.e<=o.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};S.toSignificantDigits=S.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Be(e,1,Xe),t===void 0?t=n.rounding:Be(t,0,8)),V(new n(r),e,t)};S.toString=function(){var e=this,t=e.constructor,r=Ze(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};S.truncated=S.trunc=function(){return V(new this.constructor(this),this.e+1,1)};S.valueOf=S.toJSON=function(){var e=this,t=e.constructor,r=Ze(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function ve(e){var t,r,n,o=e.length-1,i="",u=e[0];if(o>0){for(i+=u,t=1;t<o;t++)n=e[t]+"",r=Q-n.length,r&&(i+=Ge(r)),i+=n;u=e[t],n=u+"",r=Q-n.length,r&&(i+=Ge(r))}else if(u===0)return"0";for(;u%10===0;)u/=10;return i+u}function Be(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Je+e)}function Nt(e,t,r,n){var o,i,u,s;for(i=e[0];i>=10;i/=10)--t;return--t<0?(t+=Q,o=0):(o=Math.ceil((t+1)/Q),t%=Q),i=me(10,Q-t),s=e[o]%i|0,n==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),u=r<4&&s==99999||r>3&&s==49999||s==5e4||s==0):u=(r<4&&s+1==i||r>3&&s+1==i/2)&&(e[o+1]/i/100|0)==me(10,t-2)-1||(s==i/2||s==0)&&(e[o+1]/i/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),u=(n||r<4)&&s==9999||!n&&r>3&&s==4999):u=((n||r<4)&&s+1==i||!n&&r>3&&s+1==i/2)&&(e[o+1]/i/1e3|0)==me(10,t-3)-1,u}function Zt(e,t,r){for(var n,o=[0],i,u=0,s=e.length;u<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=pr.indexOf(e.charAt(u++)),n=0;n<o.length;n++)o[n]>r-1&&(o[n+1]===void 0&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}function Vi(e,t){var r,n,o;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),o=(1/Vt(4,r)).toString()):(r=16,o="2.3283064365386962890625e-10"),e.precision+=r,t=ht(e,1,t.times(o),new e(1));for(var i=r;i--;){var u=t.times(t);t=u.times(u).minus(u).times(8).plus(1)}return e.precision-=r,t}var oe=function(){function e(n,o,i){var u,s=0,f=n.length;for(n=n.slice();f--;)u=n[f]*o+s,n[f]=u%i|0,s=u/i|0;return s&&n.unshift(s),n}function t(n,o,i,u){var s,f;if(i!=u)f=i>u?1:-1;else for(s=f=0;s<i;s++)if(n[s]!=o[s]){f=n[s]>o[s]?1:-1;break}return f}function r(n,o,i,u){for(var s=0;i--;)n[i]-=s,s=n[i]<o[i]?1:0,n[i]=s*u+n[i]-o[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,i,u,s,f){var h,a,l,p,D,v,c,d,g,C,F,y,T,_,R,A,b,H,U,P,z=n.constructor,O=n.s==o.s?1:-1,$=n.d,N=o.d;if(!$||!$[0]||!N||!N[0])return new z(!n.s||!o.s||($?N&&$[0]==N[0]:!N)?NaN:$&&$[0]==0||!N?O*0:O/0);for(f?(D=1,a=n.e-o.e):(f=qe,D=Q,a=Ce(n.e/D)-Ce(o.e/D)),U=N.length,b=$.length,g=new z(O),C=g.d=[],l=0;N[l]==($[l]||0);l++);if(N[l]>($[l]||0)&&a--,i==null?(_=i=z.precision,u=z.rounding):s?_=i+(n.e-o.e)+1:_=i,_<0)C.push(1),v=!0;else{if(_=_/D+2|0,l=0,U==1){for(p=0,N=N[0],_++;(l<b||p)&&_--;l++)R=p*f+($[l]||0),C[l]=R/N|0,p=R%N|0;v=p||l<b}else{for(p=f/(N[0]+1)|0,p>1&&(N=e(N,p,f),$=e($,p,f),U=N.length,b=$.length),A=U,F=$.slice(0,U),y=F.length;y<U;)F[y++]=0;P=N.slice(),P.unshift(0),H=N[0],N[1]>=f/2&&++H;do p=0,h=t(N,F,U,y),h<0?(T=F[0],U!=y&&(T=T*f+(F[1]||0)),p=T/H|0,p>1?(p>=f&&(p=f-1),c=e(N,p,f),d=c.length,y=F.length,h=t(c,F,d,y),h==1&&(p--,r(c,U<d?P:N,d,f))):(p==0&&(h=p=1),c=N.slice()),d=c.length,d<y&&c.unshift(0),r(F,c,y,f),h==-1&&(y=F.length,h=t(N,F,U,y),h<1&&(p++,r(F,U<y?P:N,y,f))),y=F.length):h===0&&(p++,F=[0]),C[l++]=p,h&&F[0]?F[y++]=$[A]||0:(F=[$[A]],y=1);while((A++<b||F[0]!==void 0)&&_--);v=F[0]!==void 0}C[0]||C.shift()}if(D==1)g.e=a,eo=v;else{for(l=1,p=C[0];p>=10;p/=10)l++;g.e=l+a*D-1,V(g,s?i+g.e+1:i,u,v)}return g}}();function V(e,t,r,n){var o,i,u,s,f,h,a,l,p,D=e.constructor;e:if(t!=null){if(l=e.d,!l)return e;for(o=1,s=l[0];s>=10;s/=10)o++;if(i=t-o,i<0)i+=Q,u=t,a=l[p=0],f=a/me(10,o-u-1)%10|0;else if(p=Math.ceil((i+1)/Q),s=l.length,p>=s)if(n){for(;s++<=p;)l.push(0);a=f=0,o=1,i%=Q,u=i-Q+1}else break e;else{for(a=s=l[p],o=1;s>=10;s/=10)o++;i%=Q,u=i-Q+o,f=u<0?0:a/me(10,o-u-1)%10|0}if(n=n||t<0||l[p+1]!==void 0||(u<0?a:a%me(10,o-u-1)),h=r<4?(f||n)&&(r==0||r==(e.s<0?3:2)):f>5||f==5&&(r==4||n||r==6&&(i>0?u>0?a/me(10,o-u):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,h?(t-=e.e+1,l[0]=me(10,(Q-t%Q)%Q),e.e=-t||0):l[0]=e.e=0,e;if(i==0?(l.length=p,s=1,p--):(l.length=p+1,s=me(10,Q-i),l[p]=u>0?(a/me(10,o-u)%me(10,u)|0)*s:0),h)for(;;)if(p==0){for(i=1,u=l[0];u>=10;u/=10)i++;for(u=l[0]+=s,s=1;u>=10;u/=10)s++;i!=s&&(e.e++,l[0]==qe&&(l[0]=1));break}else{if(l[p]+=s,l[p]!=qe)break;l[p--]=0,s=1}for(i=l.length;l[--i]===0;)l.pop()}return J&&(e.e>D.maxE?(e.d=null,e.e=NaN):e.e<D.minE&&(e.e=0,e.d=[0])),e}function Ze(e,t,r){if(!e.isFinite())return so(e);var n,o=e.e,i=ve(e.d),u=i.length;return t?(r&&(n=r-u)>0?i=i.charAt(0)+"."+i.slice(1)+Ge(n):u>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(e.e<0?"e":"e+")+e.e):o<0?(i="0."+Ge(-o-1)+i,r&&(n=r-u)>0&&(i+=Ge(n))):o>=u?(i+=Ge(o+1-u),r&&(n=r-o-1)>0&&(i=i+"."+Ge(n))):((n=o+1)<u&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-u)>0&&(o+1===u&&(i+="."),i+=Ge(n))),i}function jt(e,t){var r=e[0];for(t*=Q;r>=10;r/=10)t++;return t}function Yt(e,t,r){if(t>ji)throw J=!0,r&&(e.precision=r),Error(to);return V(new e(kt),t,1,!0)}function $e(e,t,r){if(t>Dr)throw Error(to);return V(new e(Ht),t,r,!0)}function io(e){var t=e.length-1,r=t*Q+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Ge(e){for(var t="";e--;)t+="0";return t}function uo(e,t,r,n){var o,i=new e(1),u=Math.ceil(n/Q+4);for(J=!1;;){if(r%2&&(i=i.times(t),Xn(i.d,u)&&(o=!0)),r=Ce(r/2),r===0){r=i.d.length-1,o&&i.d[r]===0&&++i.d[r];break}t=t.times(t),Xn(t.d,u)}return J=!0,i}function Jn(e){return e.d[e.d.length-1]&1}function ao(e,t,r){for(var n,o=new e(t[0]),i=0;++i<t.length;)if(n=new e(t[i]),n.s)o[r](n)&&(o=n);else{o=n;break}return o}function mr(e,t){var r,n,o,i,u,s,f,h=0,a=0,l=0,p=e.constructor,D=p.rounding,v=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(J=!1,f=v):f=t,s=new p(.03125);e.e>-2;)e=e.times(s),l+=5;for(n=Math.log(me(2,l))/Math.LN10*2+5|0,f+=n,r=i=u=new p(1),p.precision=f;;){if(i=V(i.times(e),f,1),r=r.times(++a),s=u.plus(oe(i,r,f,1)),ve(s.d).slice(0,f)===ve(u.d).slice(0,f)){for(o=l;o--;)u=V(u.times(u),f,1);if(t==null)if(h<3&&Nt(u.d,f-n,D,h))p.precision=f+=10,r=i=s=new p(1),a=0,h++;else return V(u,p.precision=v,D,J=!0);else return p.precision=v,u}u=s}}function Qe(e,t){var r,n,o,i,u,s,f,h,a,l,p,D=1,v=10,c=e,d=c.d,g=c.constructor,C=g.rounding,F=g.precision;if(c.s<0||!d||!d[0]||!c.e&&d[0]==1&&d.length==1)return new g(d&&!d[0]?-1/0:c.s!=1?NaN:d?0:c);if(t==null?(J=!1,a=F):a=t,g.precision=a+=v,r=ve(d),n=r.charAt(0),Math.abs(i=c.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)c=c.times(e),r=ve(c.d),n=r.charAt(0),D++;i=c.e,n>1?(c=new g("0."+r),i++):c=new g(n+"."+r.slice(1))}else return h=Yt(g,a+2,F).times(i+""),c=Qe(new g(n+"."+r.slice(1)),a-v).plus(h),g.precision=F,t==null?V(c,F,C,J=!0):c;for(l=c,f=u=c=oe(c.minus(1),c.plus(1),a,1),p=V(c.times(c),a,1),o=3;;){if(u=V(u.times(p),a,1),h=f.plus(oe(u,new g(o),a,1)),ve(h.d).slice(0,a)===ve(f.d).slice(0,a))if(f=f.times(2),i!==0&&(f=f.plus(Yt(g,a+2,F).times(i+""))),f=oe(f,new g(D),a,1),t==null)if(Nt(f.d,a-v,C,s))g.precision=a+=v,h=u=c=oe(l.minus(1),l.plus(1),a,1),p=V(c.times(c),a,1),o=s=1;else return V(f,g.precision=F,C,J=!0);else return g.precision=F,f;f=h,o+=2}}function so(e){return String(e.s*e.s/0)}function dr(e,t){var r,n,o;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(o=t.length;t.charCodeAt(o-1)===48;--o);if(t=t.slice(n,o),t){if(o-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Q,r<0&&(n+=Q),n<o){for(n&&e.d.push(+t.slice(0,n)),o-=Q;n<o;)e.d.push(+t.slice(n,n+=Q));t=t.slice(n),n=Q-t.length}else n-=o;for(;n--;)t+="0";e.d.push(+t),J&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Gi(e,t){var r,n,o,i,u,s,f,h,a;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),oo.test(t))return dr(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Hi.test(t))r=16,t=t.toLowerCase();else if(ki.test(t))r=2;else if(Yi.test(t))r=8;else throw Error(Je+t);for(i=t.search(/p/i),i>0?(f=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),u=i>=0,n=e.constructor,u&&(t=t.replace(".",""),s=t.length,i=s-i,o=uo(n,new n(r),i,i*2)),h=Zt(t,r,qe),a=h.length-1,i=a;h[i]===0;--i)h.pop();return i<0?new n(e.s*0):(e.e=jt(h,a),e.d=h,J=!1,u&&(e=oe(e,o,s*4)),f&&(e=e.times(Math.abs(f)<54?me(2,f):Bt.pow(2,f))),J=!0,e)}function Qi(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:ht(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Vt(5,r)),t=ht(e,2,t,t);for(var o,i=new e(5),u=new e(16),s=new e(20);r--;)o=t.times(t),t=t.times(i.plus(o.times(u.times(o).minus(s))));return t}function ht(e,t,r,n,o){var i,u,s,f,h=1,a=e.precision,l=Math.ceil(a/Q);for(J=!1,f=r.times(r),s=new e(n);;){if(u=oe(s.times(f),new e(t++*t++),a,1),s=o?n.plus(u):n.minus(u),n=oe(u.times(f),new e(t++*t++),a,1),u=s.plus(n),u.d[l]!==void 0){for(i=l;u.d[i]===s.d[i]&&i--;);if(i==-1)break}i=s,s=n,n=u,u=i,h++}return J=!0,u.d.length=l+1,u}function Vt(e,t){for(var r=e;--t;)r*=e;return r}function co(e,t){var r,n=t.s<0,o=$e(e,e.precision,1),i=o.times(.5);if(t=t.abs(),t.lte(i))return We=n?4:1,t;if(r=t.divToInt(o),r.isZero())We=n?3:2;else{if(t=t.minus(r.times(o)),t.lte(i))return We=Jn(r)?n?2:3:n?4:1,t;We=Jn(r)?n?1:4:n?3:2}return t.minus(o).abs()}function vr(e,t,r,n){var o,i,u,s,f,h,a,l,p,D=e.constructor,v=r!==void 0;if(v?(Be(r,1,Xe),n===void 0?n=D.rounding:Be(n,0,8)):(r=D.precision,n=D.rounding),!e.isFinite())a=so(e);else{for(a=Ze(e),u=a.indexOf("."),v?(o=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):o=t,u>=0&&(a=a.replace(".",""),p=new D(1),p.e=a.length-u,p.d=Zt(Ze(p),10,o),p.e=p.d.length),l=Zt(a,10,o),i=f=l.length;l[--f]==0;)l.pop();if(!l[0])a=v?"0p+0":"0";else{if(u<0?i--:(e=new D(e),e.d=l,e.e=i,e=oe(e,p,r,n,0,o),l=e.d,i=e.e,h=eo),u=l[r],s=o/2,h=h||l[r+1]!==void 0,h=n<4?(u!==void 0||h)&&(n===0||n===(e.s<0?3:2)):u>s||u===s&&(n===4||h||n===6&&l[r-1]&1||n===(e.s<0?8:7)),l.length=r,h)for(;++l[--r]>o-1;)l[r]=0,r||(++i,l.unshift(1));for(f=l.length;!l[f-1];--f);for(u=0,a="";u<f;u++)a+=pr.charAt(l[u]);if(v){if(f>1)if(t==16||t==8){for(u=t==16?4:3,--f;f%u;f++)a+="0";for(l=Zt(a,o,t),f=l.length;!l[f-1];--f);for(u=1,a="1.";u<f;u++)a+=pr.charAt(l[u])}else a=a.charAt(0)+"."+a.slice(1);a=a+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)a="0"+a;a="0."+a}else if(++i>f)for(i-=f;i--;)a+="0";else i<f&&(a=a.slice(0,i)+"."+a.slice(i))}a=(t==16?"0x":t==2?"0b":t==8?"0o":"")+a}return e.s<0?"-"+a:a}function Xn(e,t){if(e.length>t)return e.length=t,!0}function Ji(e){return new this(e).abs()}function Xi(e){return new this(e).acos()}function Ki(e){return new this(e).acosh()}function eu(e,t){return new this(e).plus(t)}function tu(e){return new this(e).asin()}function ru(e){return new this(e).asinh()}function nu(e){return new this(e).atan()}function ou(e){return new this(e).atanh()}function iu(e,t){e=new this(e),t=new this(t);var r,n=this.precision,o=this.rounding,i=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=$e(this,i,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?$e(this,n,o):new this(0),r.s=e.s):!e.d||t.isZero()?(r=$e(this,i,1).times(.5),r.s=e.s):t.s<0?(this.precision=i,this.rounding=1,r=this.atan(oe(e,t,i,1)),t=$e(this,i,1),this.precision=n,this.rounding=o,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(oe(e,t,i,1)),r}function uu(e){return new this(e).cbrt()}function au(e){return V(e=new this(e),e.e+1,2)}function su(e,t,r){return new this(e).clamp(t,r)}function cu(e){if(!e||typeof e!="object")throw Error(Wt+"Object expected");var t,r,n,o=e.defaults===!0,i=["precision",1,Xe,"rounding",0,8,"toExpNeg",-pt,0,"toExpPos",0,pt,"maxE",0,pt,"minE",-pt,0,"modulo",0,9];for(t=0;t<i.length;t+=3)if(r=i[t],o&&(this[r]=hr[r]),(n=e[r])!==void 0)if(Ce(n)===n&&n>=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(Je+r+": "+n);if(r="crypto",o&&(this[r]=hr[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(ro);else this[r]=!1;else throw Error(Je+r+": "+n);return this}function fu(e){return new this(e).cos()}function lu(e){return new this(e).cosh()}function fo(e){var t,r,n;function o(i){var u,s,f,h=this;if(!(h instanceof o))return new o(i);if(h.constructor=o,Kn(i)){h.s=i.s,J?!i.d||i.e>o.maxE?(h.e=NaN,h.d=null):i.e<o.minE?(h.e=0,h.d=[0]):(h.e=i.e,h.d=i.d.slice()):(h.e=i.e,h.d=i.d?i.d.slice():i.d);return}if(f=typeof i,f==="number"){if(i===0){h.s=1/i<0?-1:1,h.e=0,h.d=[0];return}if(i<0?(i=-i,h.s=-1):h.s=1,i===~~i&&i<1e7){for(u=0,s=i;s>=10;s/=10)u++;J?u>o.maxE?(h.e=NaN,h.d=null):u<o.minE?(h.e=0,h.d=[0]):(h.e=u,h.d=[i]):(h.e=u,h.d=[i]);return}else if(i*0!==0){i||(h.s=NaN),h.e=NaN,h.d=null;return}return dr(h,i.toString())}else if(f!=="string")throw Error(Je+i);return(s=i.charCodeAt(0))===45?(i=i.slice(1),h.s=-1):(s===43&&(i=i.slice(1)),h.s=1),oo.test(i)?dr(h,i):Gi(h,i)}if(o.prototype=S,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=cu,o.clone=fo,o.isDecimal=Kn,o.abs=Ji,o.acos=Xi,o.acosh=Ki,o.add=eu,o.asin=tu,o.asinh=ru,o.atan=nu,o.atanh=ou,o.atan2=iu,o.cbrt=uu,o.ceil=au,o.clamp=su,o.cos=fu,o.cosh=lu,o.div=pu,o.exp=hu,o.floor=Du,o.hypot=mu,o.ln=du,o.log=vu,o.log10=Fu,o.log2=gu,o.max=Eu,o.min=Cu,o.mod=wu,o.mul=Au,o.pow=xu,o.random=yu,o.round=Nu,o.sign=Bu,o.sin=bu,o.sinh=Mu,o.sqrt=Su,o.sub=_u,o.sum=Tu,o.tan=Ou,o.tanh=Iu,o.trunc=Pu,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return o.config(e),o}function pu(e,t){return new this(e).div(t)}function hu(e){return new this(e).exp()}function Du(e){return V(e=new this(e),e.e+1,3)}function mu(){var e,t,r=new this(0);for(J=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return J=!0,new this(1/0);r=t}return J=!0,r.sqrt()}function Kn(e){return e instanceof Bt||e&&e.toStringTag===no||!1}function du(e){return new this(e).ln()}function vu(e,t){return new this(e).log(t)}function gu(e){return new this(e).log(2)}function Fu(e){return new this(e).log(10)}function Eu(){return ao(this,arguments,"lt")}function Cu(){return ao(this,arguments,"gt")}function wu(e,t){return new this(e).mod(t)}function Au(e,t){return new this(e).mul(t)}function xu(e,t){return new this(e).pow(t)}function yu(e){var t,r,n,o,i=0,u=new this(1),s=[];if(e===void 0?e=this.precision:Be(e,1,Xe),n=Math.ceil(e/Q),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));i<n;)o=t[i],o>=429e7?t[i]=crypto.getRandomValues(new Uint32Array(1))[0]:s[i++]=o%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);i<n;)o=t[i]+(t[i+1]<<8)+(t[i+2]<<16)+((t[i+3]&127)<<24),o>=214e7?crypto.randomBytes(4).copy(t,i):(s.push(o%1e7),i+=4);i=n/4}else throw Error(ro);else for(;i<n;)s[i++]=Math.random()*1e7|0;for(n=s[--i],e%=Q,n&&e&&(o=me(10,Q-e),s[i]=(n/o|0)*o);s[i]===0;i--)s.pop();if(i<0)r=0,s=[0];else{for(r=-1;s[0]===0;r-=Q)s.shift();for(n=1,o=s[0];o>=10;o/=10)n++;n<Q&&(r-=Q-n)}return u.e=r,u.d=s,u}function Nu(e){return V(e=new this(e),e.e+1,this.rounding)}function Bu(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function bu(e){return new this(e).sin()}function Mu(e){return new this(e).sinh()}function Su(e){return new this(e).sqrt()}function _u(e,t){return new this(e).sub(t)}function Tu(){var e=0,t=arguments,r=new this(t[e]);for(J=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return J=!0,V(r,this.precision,this.rounding)}function Ou(e){return new this(e).tan()}function Iu(e){return new this(e).tanh()}function Pu(e){return V(e=new this(e),e.e+1,1)}S[Symbol.for("nodejs.util.inspect.custom")]=S.toString;S[Symbol.toStringTag]="Decimal";var Bt=S.constructor=fo(hr);kt=new Bt(kt);Ht=new Bt(Ht);var gr=Bt;var zu="BigNumber",Ru=["?on","config"],Fr=ee(zu,Ru,e=>{var{on:t,config:r}=e,n=gr.clone({precision:r.precision,modulo:gr.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(o){return new n(o.value)},t&&t("config",function(o,i){o.precision!==i.precision&&n.config({precision:o.precision})}),n},{isClass:!0});var we=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:(Math.exp(e)+Math.exp(-e))*.5},Te=Math.sinh||function(e){return Math.abs(e)<1e-9?e:(Math.exp(e)-Math.exp(-e))*.5},$u=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},Er=function(e,t){return e=Math.abs(e),t=Math.abs(t),e<t&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},Dt=function(){throw SyntaxError("Invalid Param")};function Cr(e,t){let r=Math.abs(e),n=Math.abs(t);return e===0?Math.log(n):t===0?Math.log(r):r<3e3&&n<3e3?Math.log(e*e+t*t)*.5:(e=e*.5,t=t*.5,.5*Math.log(e*e+t*t)+Math.LN2)}var qu={re:0,im:0},tt=function(e,t){let r=qu;if(e==null)r.re=r.im=0;else if(t!==void 0)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return x.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return x.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else e.length===2?(r.re=e[0],r.im=e[1]):Dt();break;case"string":r.im=r.re=0;let n=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),o=1,i=0;n===null&&Dt();for(let u=0;u<n.length;u++){let s=n[u];s===" "||s==="	"||s===`
`||(s==="+"?o++:s==="-"?i++:s==="i"||s==="I"?(o+i===0&&Dt(),n[u+1]!==" "&&!isNaN(n[u+1])?(r.im+=parseFloat((i%2?"-":"")+n[u+1]),u++):r.im+=parseFloat((i%2?"-":"")+"1"),o=i=0):((o+i===0||isNaN(s))&&Dt(),n[u+1]==="i"||n[u+1]==="I"?(r.im+=parseFloat((i%2?"-":"")+s),u++):r.re+=parseFloat((i%2?"-":"")+s),o=i=0))}o+i>0&&Dt();break;case"number":r.im=0,r.re=e;break;default:Dt()}return isNaN(r.re)||isNaN(r.im),r};function x(e,t){if(!(this instanceof x))return new x(e,t);let r=tt(e,t);this.re=r.re,this.im=r.im}x.prototype={re:0,im:0,sign:function(){let e=Er(this.re,this.im);return new x(this.re/e,this.im/e)},add:function(e,t){let r=tt(e,t),n=this.isInfinite(),o=!(isFinite(r.re)&&isFinite(r.im));return n||o?n&&o?x.NAN:x.INFINITY:new x(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=tt(e,t),n=this.isInfinite(),o=!(isFinite(r.re)&&isFinite(r.im));return n||o?n&&o?x.NAN:x.INFINITY:new x(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=tt(e,t),n=this.isInfinite(),o=!(isFinite(r.re)&&isFinite(r.im)),i=this.re===0&&this.im===0,u=r.re===0&&r.im===0;return n&&u||o&&i?x.NAN:n||o?x.INFINITY:r.im===0&&this.im===0?new x(this.re*r.re,0):new x(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=tt(e,t),n=this.isInfinite(),o=!(isFinite(r.re)&&isFinite(r.im)),i=this.re===0&&this.im===0,u=r.re===0&&r.im===0;if(i&&u||n&&o)return x.NAN;if(u||n)return x.INFINITY;if(i||o)return x.ZERO;if(r.im===0)return new x(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,f=r.re*s+r.im;return new x((this.re*s+this.im)/f,(this.im*s-this.re)/f)}else{let s=r.im/r.re,f=r.im*s+r.re;return new x((this.re+this.im*s)/f,(this.im-this.re*s)/f)}},pow:function(e,t){let r=tt(e,t),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return x.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new x(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new x(Math.pow(this.im,r.re),0);case 1:return new x(0,Math.pow(this.im,r.re));case 2:return new x(-Math.pow(this.im,r.re),0);case 3:return new x(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return x.ZERO;let i=Math.atan2(this.im,this.re),u=Cr(this.re,this.im),s=Math.exp(r.re*u-r.im*i),f=r.im*u+r.re*i;return new x(s*Math.cos(f),s*Math.sin(f))},sqrt:function(){let e=this.re,t=this.im;if(t===0)return e>=0?new x(Math.sqrt(e),0):new x(0,Math.sqrt(-e));let r=Er(e,t),n=Math.sqrt(.5*(r+Math.abs(e))),o=Math.abs(t)/(2*n);return e>=0?new x(n,t<0?-o:o):new x(o,t<0?-n:n)},exp:function(){let e=Math.exp(this.re);return this.im===0?new x(e,0):new x(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new x(Math.expm1(e)*Math.cos(t)+$u(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return t===0&&e>0?new x(Math.log(e),0):new x(Cr(e,t),Math.atan2(t,e))},abs:function(){return Er(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new x(Math.sin(e)*we(t),Math.cos(e)*Te(t))},cos:function(){let e=this.re,t=this.im;return new x(Math.cos(e)*we(t),-Math.sin(e)*Te(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+we(t);return new x(Math.sin(e)/r,Te(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-we(t);return new x(-Math.sin(e)/r,Te(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*we(2*t)+.5*Math.cos(2*e);return new x(Math.cos(e)*we(t)/r,Math.sin(e)*Te(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*we(2*t)-.5*Math.cos(2*e);return new x(Math.sin(e)*we(t)/r,-Math.cos(e)*Te(t)/r)},asin:function(){let e=this.re,t=this.im,r=new x(t*t-e*e+1,-2*e*t).sqrt(),n=new x(r.re-t,r.im+e).log();return new x(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new x(t*t-e*e+1,-2*e*t).sqrt(),n=new x(r.re-t,r.im+e).log();return new x(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(e===0){if(t===1)return new x(0,1/0);if(t===-1)return new x(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new x((1-t*t-e*e)/r,-2*e/r).log();return new x(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(t===0)return new x(Math.atan2(1,e),0);let r=e*e+t*t;return r!==0?new x(e/r,-t/r).atan():new x(e!==0?e/0:0,t!==0?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new x(0,1/0);let r=e*e+t*t;return r!==0?new x(e/r,-t/r).acos():new x(e!==0?e/0:0,t!==0?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new x(Math.PI/2,1/0);let r=e*e+t*t;return r!==0?new x(e/r,-t/r).asin():new x(e!==0?e/0:0,t!==0?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new x(Te(e)*Math.cos(t),we(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new x(we(e)*Math.cos(t),Te(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=we(e)+Math.cos(t);return new x(Te(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=we(e)-Math.cos(t);return new x(Te(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-we(2*e);return new x(-2*Te(e)*Math.cos(t)/r,2*we(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+we(2*e);return new x(2*we(e)*Math.cos(t)/r,-2*Te(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,r=e>1&&t===0,n=1-e,o=1+e,i=n*n+t*t,u=i!==0?new x((o*n-t*t)/i,(t*n+o*t)/i):new x(e!==-1?e/0:0,t!==0?t/0:0),s=u.re;return u.re=Cr(u.re,u.im)/2,u.im=Math.atan2(u.im,s)/2,r&&(u.im=-u.im),u},acoth:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new x(0,Math.PI/2);let r=e*e+t*t;return r!==0?new x(e/r,-t/r).atanh():new x(e!==0?e/0:0,t!==0?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(t===0)return new x(e!==0?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return r!==0?new x(e/r,-t/r).asinh():new x(e!==0?e/0:0,t!==0?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return x.INFINITY;let r=e*e+t*t;return r!==0?new x(e/r,-t/r).acosh():new x(e!==0?e/0:0,t!==0?-t/0:0).acosh()},inverse:function(){if(this.isZero())return x.INFINITY;if(this.isInfinite())return x.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new x(e/r,-t/r)},conjugate:function(){return new x(this.re,-this.im)},neg:function(){return new x(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new x(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new x(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new x(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=tt(e,t);return Math.abs(r.re-this.re)<=x.EPSILON&&Math.abs(r.im-this.im)<=x.EPSILON},clone:function(){return new x(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<x.EPSILON&&(e=0),Math.abs(t)<x.EPSILON&&(t=0),t===0?r+e:(e!==0?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),t!==1&&(r+=t),r+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}};x.ZERO=new x(0,0);x.ONE=new x(1,0);x.I=new x(0,1);x.PI=new x(Math.PI,0);x.E=new x(Math.E,0);x.INFINITY=new x(1/0,1/0);x.NAN=new x(NaN,NaN);x.EPSILON=1e-15;var Lu="Complex",Uu=[],wr=ee(Lu,Uu,()=>(Object.defineProperty(x,"name",{value:"Complex"}),x.prototype.constructor=x,x.prototype.type="Complex",x.prototype.isComplex=!0,x.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},x.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},x.prototype.format=function(e){var t="",r=this.im,n=this.re,o=yt(this.re,e),i=yt(this.im,e),u=K(e)?e:e?e.precision:null;if(u!==null){var s=Math.pow(10,-u);Math.abs(n/r)<s&&(n=0),Math.abs(r/n)<s&&(r=0)}return r===0?t=o:n===0?r===1?t="i":r===-1?t="-i":t=i+"i":r<0?r===-1?t=o+" - i":t=o+" - "+i.substring(1)+"i":r===1?t=o+" + i":t=o+" + "+i+"i",t},x.fromPolar=function(e){switch(arguments.length){case 1:{var t=arguments[0];if(typeof t=="object")return x(t);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var r=arguments[0],n=arguments[1];if(K(r)){if(Rt(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),K(n))return new x({r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},x.prototype.valueOf=x.prototype.toString,x.fromJSON=function(e){return new x(e)},x.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},x),{isClass:!0});var Zu=2e3,Y={s:1,n:0,d:1};function je(e,t){if(isNaN(e=parseInt(e,10)))throw Gt();return e*t}function fe(e,t){if(t===0)throw Ar();var r=Object.create(de.prototype);r.s=e<0?-1:1,e=e<0?-e:e;var n=mt(e,t);return r.n=e/n,r.d=t/n,r}function lo(e){for(var t={},r=e,n=2,o=4;o<=r;){for(;r%n===0;)r/=n,t[n]=(t[n]||0)+1;o+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var Me=function(e,t){var r=0,n=1,o=1,i=0,u=0,s=0,f=1,h=1,a=0,l=1,p=1,D=1,v=1e7,c;if(e!=null)if(t!==void 0){if(r=e,n=t,o=r*n,r%1!==0||n%1!==0)throw Wu()}else switch(typeof e){case"object":{if("d"in e&&"n"in e)r=e.n,n=e.d,"s"in e&&(r*=e.s);else if(0 in e)r=e[0],1 in e&&(n=e[1]);else throw Gt();o=r*n;break}case"number":{if(e<0&&(o=e,e=-e),e%1===0)r=e;else if(e>0){for(e>=1&&(h=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=h);l<=v&&D<=v;)if(c=(a+p)/(l+D),e===c){l+D<=v?(r=a+p,n=l+D):D>l?(r=p,n=D):(r=a,n=l);break}else e>c?(a+=p,l+=D):(p+=a,D+=l),l>v?(r=p,n=D):(r=a,n=l);r*=h}else(isNaN(e)||isNaN(t))&&(n=r=NaN);break}case"string":{if(l=e.match(/\d+|./g),l===null)throw Gt();if(l[a]==="-"?(o=-1,a++):l[a]==="+"&&a++,l.length===a+1?u=je(l[a++],o):l[a+1]==="."||l[a]==="."?(l[a]!=="."&&(i=je(l[a++],o)),a++,(a+1===l.length||l[a+1]==="("&&l[a+3]===")"||l[a+1]==="'"&&l[a+3]==="'")&&(u=je(l[a],o),f=Math.pow(10,l[a].length),a++),(l[a]==="("&&l[a+2]===")"||l[a]==="'"&&l[a+2]==="'")&&(s=je(l[a+1],o),h=Math.pow(10,l[a+1].length)-1,a+=3)):l[a+1]==="/"||l[a+1]===":"?(u=je(l[a],o),f=je(l[a+2],1),a+=3):l[a+3]==="/"&&l[a+1]===" "&&(i=je(l[a],o),u=je(l[a+2],o),f=je(l[a+4],1),a+=5),l.length<=a){n=f*h,o=r=s+n*i+h*u;break}}default:throw Gt()}if(n===0)throw Ar();Y.s=o<0?-1:1,Y.n=Math.abs(r),Y.d=Math.abs(n)};function ku(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)t&1&&(n=n*e%r);return n}function Hu(e,t){for(;t%2===0;t/=2);for(;t%5===0;t/=5);if(t===1)return 0;for(var r=10%t,n=1;r!==1;n++)if(r=r*10%t,n>Zu)return 0;return n}function Yu(e,t,r){for(var n=1,o=ku(10,r,t),i=0;i<300;i++){if(n===o)return i;n=n*10%t,o=o*10%t}return 0}function mt(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function de(e,t){if(Me(e,t),this instanceof de)e=mt(Y.d,Y.n),this.s=Y.s,this.n=Y.n/e,this.d=Y.d/e;else return fe(Y.s*Y.n,Y.d)}var Ar=function(){return new Error("Division by Zero")},Gt=function(){return new Error("Invalid argument")},Wu=function(){return new Error("Parameters must be integer")};de.prototype={s:1,n:0,d:1,abs:function(){return fe(this.n,this.d)},neg:function(){return fe(-this.s*this.n,this.d)},add:function(e,t){return Me(e,t),fe(this.s*this.n*Y.d+Y.s*this.d*Y.n,this.d*Y.d)},sub:function(e,t){return Me(e,t),fe(this.s*this.n*Y.d-Y.s*this.d*Y.n,this.d*Y.d)},mul:function(e,t){return Me(e,t),fe(this.s*Y.s*this.n*Y.n,this.d*Y.d)},div:function(e,t){return Me(e,t),fe(this.s*Y.s*this.n*Y.d,this.d*Y.n)},clone:function(){return fe(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new de(NaN);if(e===void 0)return fe(this.s*this.n%this.d,1);if(Me(e,t),Y.n===0&&this.d===0)throw Ar();return fe(this.s*(Y.d*this.n)%(Y.n*this.d),Y.d*this.d)},gcd:function(e,t){return Me(e,t),fe(mt(Y.n,this.n)*mt(Y.d,this.d),Y.d*this.d)},lcm:function(e,t){return Me(e,t),Y.n===0&&this.n===0?fe(0,1):fe(Y.n*this.n,mt(Y.n,this.n)*mt(Y.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new de(NaN):fe(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new de(NaN):fe(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new de(NaN):fe(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return Me(e,t),fe(this.s*Math.round(this.n*Y.d/(this.d*Y.n))*Y.n,Y.d)},inverse:function(){return fe(this.s*this.d,this.n)},pow:function(e,t){if(Me(e,t),Y.d===1)return Y.s<0?fe(Math.pow(this.s*this.d,Y.n),Math.pow(this.n,Y.n)):fe(Math.pow(this.s*this.n,Y.n),Math.pow(this.d,Y.n));if(this.s<0)return null;var r=lo(this.n),n=lo(this.d),o=1,i=1;for(var u in r)if(u!=="1"){if(u==="0"){o=0;break}if(r[u]*=Y.n,r[u]%Y.d===0)r[u]/=Y.d;else return null;o*=Math.pow(u,r[u])}for(var u in n)if(u!=="1"){if(n[u]*=Y.n,n[u]%Y.d===0)n[u]/=Y.d;else return null;i*=Math.pow(u,n[u])}return Y.s<0?fe(i,o):fe(o,i)},equals:function(e,t){return Me(e,t),this.s*this.n*Y.d===Y.s*Y.n*this.d},compare:function(e,t){Me(e,t);var r=this.s*this.n*Y.d-Y.s*Y.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var o=fe(r[n-1],1),i=n-2;i>=0;i--)o=o.inverse().add(r[i]);if(Math.abs(o.sub(t).valueOf())<e)return o.mul(this.s)}return this},divisible:function(e,t){return Me(e,t),!(!(Y.n*this.d)||this.n*Y.d%(Y.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,o=this.d;return this.s<0&&(r+="-"),o===1?r+=n:(e&&(t=Math.floor(n/o))>0&&(r+=t,r+=" ",n%=o),r+=n,r+="/",r+=o),r},toLatex:function(e){var t,r="",n=this.n,o=this.d;return this.s<0&&(r+="-"),o===1?r+=n:(e&&(t=Math.floor(n/o))>0&&(r+=t,n%=o),r+="\\frac{",r+=n,r+="}{",r+=o,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(t!==1);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=Hu(t,r),o=Yu(t,r,n),i=this.s<0?"-":"";if(i+=t/r|0,t%=r,t*=10,t&&(i+="."),n){for(var u=o;u--;)i+=t/r|0,t%=r,t*=10;i+="(";for(var u=n;u--;)i+=t/r|0,t%=r,t*=10;i+=")"}else for(var u=e;t&&u--;)i+=t/r|0,t%=r,t*=10;return i}};var ju="Fraction",Vu=[],xr=ee(ju,Vu,()=>(Object.defineProperty(de,"name",{value:"Fraction"}),de.prototype.constructor=de,de.prototype.type="Fraction",de.prototype.isFraction=!0,de.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},de.fromJSON=function(e){return new de(e)},de),{isClass:!0});var Gu="Matrix",Qu=[],yr=ee(Gu,Qu,()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(t,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(t,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(t,r,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(t,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(t,r){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(t,r){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function Nr(e,t,r){var n=e.constructor,o=new n(2),i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!te(r))throw new Error("size must be an integer");if(e.greaterThan(o.pow(r-1).sub(1))||e.lessThan(o.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(o.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(t," not supported "))}}function Do(e,t){if(typeof t=="function")return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:r,precision:n,wordSize:o}=sr(t);switch(r){case"fixed":return Xu(e,n);case"exponential":return po(e,n);case"engineering":return Ju(e,n);case"bin":return Nr(e,2,o);case"oct":return Nr(e,8,o);case"hex":return Nr(e,16,o);case"auto":{var i=ho(t?.lowerExp,-3),u=ho(t?.upperExp,5);if(e.isZero())return"0";var s,f=e.toSignificantDigits(n),h=f.e;return h>=i&&h<u?s=f.toFixed():s=po(e,n),s.replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],l=arguments[4];return a!=="."?a+l:l})}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ju(e,t){var r=e.e,n=r%3===0?r:r<0?r-3-r%3:r-r%3,o=e.mul(Math.pow(10,-n)),i=o.toPrecision(t);if(i.includes("e")){var u=e.constructor;i=new u(i).toFixed()}return i+"e"+(r>=0?"+":"")+n.toString()}function po(e,t){return t!==void 0?e.toExponential(t-1):e.toExponential()}function Xu(e,t){return e.toFixed(t)}function ho(e,t){return K(e)?e:ae(e)?e.toNumber():t}function ge(e,t){var r=Ku(e,t);return t&&typeof t=="object"&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function Ku(e,t){if(typeof e=="number")return yt(e,t);if(ae(e))return Do(e,t);if(ea(e))return!t||t.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return go(e,t);if(xe(e))return mo(e);if(typeof e=="function")return e.syntax?String(e.syntax):"function";if(e&&typeof e=="object"){if(typeof e.format=="function")return e.format(t);if(e&&e.toString(t)!=={}.toString())return e.toString(t);var r=Object.keys(e).map(n=>mo(n)+": "+ge(e[n],t));return"{"+r.join(", ")+"}"}return String(e)}function mo(e){for(var t=String(e),r="",n=0;n<t.length;){var o=t.charAt(n);r+=o in vo?vo[o]:o,n++}return'"'+r+'"'}var vo={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t"};function go(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,o=0;o<n;o++)o!==0&&(r+=", "),r+=go(e[o],t);return r+="]",r}else return ge(e,t)}function ea(e){return e&&typeof e=="object"&&typeof e.s=="number"&&typeof e.n=="number"&&typeof e.d=="number"||!1}function ie(e,t,r){if(!(this instanceof ie))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=new Error().stack}ie.prototype=new RangeError;ie.prototype.constructor=RangeError;ie.prototype.name="DimensionError";ie.prototype.isDimensionError=!0;function rt(e,t,r){if(!(this instanceof rt))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}rt.prototype=new RangeError;rt.prototype.constructor=RangeError;rt.prototype.name="IndexError";rt.prototype.isIndexError=!0;function Se(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function Fo(e,t,r){var n,o=e.length;if(o!==t[r])throw new ie(o,t[r]);if(r<t.length-1){var i=r+1;for(n=0;n<o;n++){var u=e[n];if(!Array.isArray(u))throw new ie(t.length-1,t.length,"<");Fo(e[n],t,i)}}else for(n=0;n<o;n++)if(Array.isArray(e[n]))throw new ie(t.length+1,t.length,">")}function br(e,t){var r=t.length===0;if(r){if(Array.isArray(e))throw new ie(e.length,0)}else Fo(e,t,0)}function ce(e,t){if(e!==void 0){if(!K(e)||!te(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof t=="number"&&e>=t)throw new rt(e,t)}}function bt(e,t,r){if(!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new Error("Resizing to scalar is not supported");t.forEach(function(o){if(!K(o)||!te(o)||o<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ge(t)+")")}),(K(e)||ae(e))&&(e=[e]);var n=r!==void 0?r:0;return Br(e,t,0,n),e}function Br(e,t,r,n){var o,i,u=e.length,s=t[r],f=Math.min(u,s);if(e.length=s,r<t.length-1){var h=r+1;for(o=0;o<f;o++)i=e[o],Array.isArray(i)||(i=[i],e[o]=i),Br(i,t,h,n);for(o=f;o<s;o++)i=[],e[o]=i,Br(i,t,h,n)}else{for(o=0;o<f;o++)for(;Array.isArray(e[o]);)e[o]=e[o][0];for(o=f;o<s;o++)e[o]=n}}function Mr(e,t){var r=ra(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(t.length===0)throw new ie(0,n,"!=");t=Mt(t,n);var o=Eo(t);if(n!==o)throw new ie(o,n,"!=");try{return ta(r,t)}catch(i){throw i instanceof ie?new ie(o,n,"!="):i}}function Mt(e,t){var r=Eo(e),n=e.slice(),o=-1,i=e.indexOf(o),u=e.indexOf(o,i+1)>=0;if(u)throw new Error("More than one wildcard in sizes");var s=i>=0,f=t%r===0;if(s)if(f)n[i]=-t/r;else throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function Eo(e){return e.reduce((t,r)=>t*r,1)}function ta(e,t){for(var r=e,n,o=t.length-1;o>0;o--){var i=t[o];n=[];for(var u=r.length/i,s=0;s<u;s++)n.push(r.slice(s*i,(s+1)*i));r=n}return r}function Qt(e,t,r,n){var o=n||Se(e);if(r)for(var i=0;i<r;i++)e=[e],o.unshift(1);for(e=Co(e,t,0);o.length<t;)o.push(1);return e}function Co(e,t,r){var n,o;if(Array.isArray(e)){var i=r+1;for(n=0,o=e.length;n<o;n++)e[n]=Co(e[n],t,i)}else for(var u=r;u<t;u++)e=[e];return e}function ra(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function r(n){Array.isArray(n)?n.forEach(r):t.push(n)}),t}function St(e,t){for(var r,n=0,o=0;o<e.length;o++){var i=e[o],u=Array.isArray(i);if(o===0&&u&&(n=i.length),u&&i.length!==n)return;var s=u?St(i,t):t(i);if(r===void 0)r=s;else if(r!==s)return"mixed"}return r}function wo(e,t,r,n){if(n<r){if(e.length!==t.length)throw new ie(e.length,t.length);for(var o=[],i=0;i<e.length;i++)o[i]=wo(e[i],t[i],r,n+1);return o}else return e.concat(t)}function na(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(e.length===1)return e[0];if(e.length>1)return e.slice(1).reduce(function(r,n){return wo(r,n,t,0)},e[0]);throw new Error("Wrong number of arguments in function concat")}function oa(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(p=>p.length),o=Math.max(...n),i=new Array(o).fill(null),u=0;u<t.length;u++)for(var s=t[u],f=n[u],h=0;h<f;h++){var a=o-f+h;s[h]>i[a]&&(i[a]=s[h])}for(var l=0;l<t.length;l++)Ao(t[l],i);return i}function Ao(e,t){for(var r=t.length,n=e.length,o=0;o<n;o++){var i=r-n+o;if(e[o]<t[i]&&e[o]>1||e[o]>t[i])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[o]," to size ").concat(t[i]))}}function Sr(e,t){var r=Se(e);if(He(r,t))return e;Ao(r,t);var n=oa(r,t),o=n.length,i=[...Array(o-r.length).fill(1),...r],u=ua(e);r.length<o&&(u=Mr(u,i),r=Se(u));for(var s=0;s<o;s++)r[s]<n[s]&&(u=ia(u,n[s],s),r=Se(u));return u}function ia(e,t,r){return na(...Array(t).fill(e),r)}function Jt(e,t){if(!Array.isArray(e))throw new Error("Array expected");var r=Se(e);if(t.length!==r.length)throw new ie(t.length,r.length);for(var n=0;n<t.length;n++)ce(t[n],r[n]);return t.reduce((o,i)=>o[i],e)}function ua(e){return ut([],e)}var _r=wt(ur(),1);function dt(e,t,r){if(_r.default.isTypedFunction(e)){var n=(t.isMatrix?t.size():Se(t)).map(()=>0),o=t.isMatrix?t.get(n):Jt(t,n),i=Object.keys(e.signatures).length===1,u=aa(e,o,n,t),s=i?Object.values(e.signatures)[0]:e;return u>=1&&u<=3?function(){for(var f=arguments.length,h=new Array(f),a=0;a<f;a++)h[a]=arguments[a];return xo(s,h.slice(0,u),r,e.name)}:function(){for(var f=arguments.length,h=new Array(f),a=0;a<f;a++)h[a]=arguments[a];return xo(s,h,r,e.name)}}return e}function aa(e,t,r,n){for(var o=[t,r,n],i=3;i>0;i--){var u=o.slice(0,i);if(_r.default.resolve(e,u)!==null)return i}}function xo(e,t,r,n){try{return e(...t)}catch(o){sa(o,t,r,n)}}function sa(e,t,r,n){var o;if(e instanceof TypeError&&((o=e.data)===null||o===void 0?void 0:o.category)==="wrongType"){var i=[];throw i.push("value: ".concat(Re(t[0]))),t.length>=2&&i.push("index: ".concat(Re(t[1]))),t.length>=3&&i.push("array: ".concat(Re(t[2]))),new TypeError("Function ".concat(r," cannot apply callback arguments ")+"".concat(n,"(").concat(i.join(", "),") at index ").concat(JSON.stringify(t[1])))}else throw new TypeError("Function ".concat(r," cannot apply callback arguments ")+"to function ".concat(n,": ").concat(e.message))}var ca="DenseMatrix",fa=["Matrix"],Tr=ee(ca,fa,e=>{var{Matrix:t}=e;function r(a,l){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(l&&!xe(l))throw new Error("Invalid datatype: "+l);if(_e(a))a.type==="DenseMatrix"?(this._data=he(a._data),this._size=he(a._size),this._datatype=l||a._datatype):(this._data=a.toArray(),this._size=a.size(),this._datatype=l||a._datatype);else if(a&&se(a.data)&&se(a.size))this._data=a.data,this._size=a.size,br(this._data,this._size),this._datatype=l||a.datatype;else if(se(a))this._data=h(a),this._size=Se(this._data),br(this._data,this._size),this._datatype=l;else{if(a)throw new TypeError("Unsupported type of data ("+Re(a)+")");this._data=[],this._size=[0],this._datatype=l}}r.prototype=new t,r.prototype.createDenseMatrix=function(a,l){return new r(a,l)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return St(this._data,Re)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(a,l){return new r(a,l)},r.prototype.subset=function(a,l,p){switch(arguments.length){case 1:return n(this,a);case 2:case 3:return i(this,a,l,p);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(a){return Jt(this._data,a)},r.prototype.set=function(a,l,p){if(!se(a))throw new TypeError("Array expected");if(a.length<this._size.length)throw new ie(a.length,this._size.length,"<");var D,v,c,d=a.map(function(C){return C+1});f(this,d,p);var g=this._data;for(D=0,v=a.length-1;D<v;D++)c=a[D],ce(c,g.length),g=g[c];return c=a[a.length-1],ce(c,g.length),g[c]=l,this};function n(a,l){if(!at(l))throw new TypeError("Invalid index");var p=l.isScalar();if(p)return a.get(l.min());var D=l.size();if(D.length!==a._size.length)throw new ie(D.length,a._size.length);for(var v=l.min(),c=l.max(),d=0,g=a._size.length;d<g;d++)ce(v[d],a._size[d]),ce(c[d],a._size[d]);return new r(o(a._data,l,D.length,0),a._datatype)}function o(a,l,p,D){var v=D===p-1,c=l.dimension(D);return v?c.map(function(d){return ce(d,a.length),a[d]}).valueOf():c.map(function(d){ce(d,a.length);var g=a[d];return o(g,l,p,D+1)}).valueOf()}function i(a,l,p,D){if(!l||l.isIndex!==!0)throw new TypeError("Invalid index");var v=l.size(),c=l.isScalar(),d;if(_e(p)?(d=p.size(),p=p.valueOf()):d=Se(p),c){if(d.length!==0)throw new TypeError("Scalar expected");a.set(l.min(),p,D)}else{if(!He(d,v))try{d.length===0?p=Sr([p],v):p=Sr(p,v),d=Se(p)}catch{}if(v.length<a._size.length)throw new ie(v.length,a._size.length,"<");if(d.length<v.length){for(var g=0,C=0;v[g]===1&&d[g]===1;)g++;for(;v[g]===1;)C++,g++;p=Qt(p,v.length,C,d)}if(!He(v,d))throw new ie(v,d,">");var F=l.max().map(function(_){return _+1});f(a,F,D);var y=v.length,T=0;u(a._data,l,p,y,T)}return a}function u(a,l,p,D,v){var c=v===D-1,d=l.dimension(v);c?d.forEach(function(g,C){ce(g),a[g]=p[C[0]]}):d.forEach(function(g,C){ce(g),u(a[g],l,p[C[0]],D,v+1)})}r.prototype.resize=function(a,l,p){if(!et(a))throw new TypeError("Array or Matrix expected");var D=a.valueOf().map(c=>Array.isArray(c)&&c.length===1?c[0]:c),v=p?this.clone():this;return s(v,D,l)};function s(a,l,p){if(l.length===0){for(var D=a._data;se(D);)D=D[0];return D}return a._size=l.slice(0),a._data=bt(a._data,a._size,p),a}r.prototype.reshape=function(a,l){var p=l?this.clone():this;p._data=Mr(p._data,a);var D=p._size.reduce((v,c)=>v*c);return p._size=Mt(a,D),p};function f(a,l,p){for(var D=a._size.slice(0),v=!1;D.length<l.length;)D.push(0),v=!0;for(var c=0,d=l.length;c<d;c++)l[c]>D[c]&&(D[c]=l[c],v=!0);v&&s(a,D,p)}r.prototype.clone=function(){var a=new r({data:he(this._data),size:he(this._size),datatype:this._datatype});return a},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(a){var l=this,p=l.size();if(p.length===1){for(var D=0;D<p[0];D++)a(l._data,D,[D]);return}var v=Array(p.length).fill(0),c=Array(p.length-1),d=c.length-1;c[0]=l._data[0];for(var g=0;g<d;g++)c[g+1]=c[g][0];for(v[d]=-1;;){var C=void 0;for(C=d;C>=0;C--){if(v[C]++,v[C]===p[C]){v[C]=0;continue}c[C]=C===0?l._data[v[C]]:c[C-1][v[C]];for(var F=C;F<d;F++)c[F+1]=c[F][0];for(var y=0;y<p[c.length];y++)v[c.length]=y,a(c[d],y,v.slice(0));break}if(C===-1)break}},r.prototype.map=function(a){var l=this,p=new r(l),D=dt(a,l._data,"map");return p._forEach(function(v,c,d){v[c]=D(v[c],d,l)}),p},r.prototype.forEach=function(a){var l=this,p=dt(a,l._data,"map");l._forEach(function(D,v,c){p(D[v],c,l)})},r.prototype[Symbol.iterator]=function*(){var a=function*(p,D){if(se(p))for(var v=0;v<p.length;v++)yield*a(p[v],D.concat(v));else yield{value:p,index:D}};yield*a(this._data,[])},r.prototype.rows=function(){var a=[],l=this.size();if(l.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var D of p)a.push(new r([D],this._datatype));return a},r.prototype.columns=function(){var a=this,l=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var D=this._data,v=function(g){var C=D.map(F=>[F[g]]);l.push(new r(C,a._datatype))},c=0;c<p[1];c++)v(c);return l},r.prototype.toArray=function(){return he(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(a){return ge(this._data,a)},r.prototype.toString=function(){return ge(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(a){if(a){if(ae(a)&&(a=a.toNumber()),!K(a)||!te(a))throw new TypeError("The parameter k must be an integer number")}else a=0;for(var l=a>0?a:0,p=a<0?-a:0,D=this._size[0],v=this._size[1],c=Math.min(D-p,v-l),d=[],g=0;g<c;g++)d[g]=this._data[g+p][g+l];return new r({data:d,size:[c],datatype:this._datatype})},r.diagonal=function(a,l,p,D){if(!se(a))throw new TypeError("Array expected, size parameter");if(a.length!==2)throw new Error("Only two dimensions matrix are supported");if(a=a.map(function(R){if(ae(R)&&(R=R.toNumber()),!K(R)||!te(R)||R<1)throw new Error("Size values must be positive integers");return R}),p){if(ae(p)&&(p=p.toNumber()),!K(p)||!te(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var v=p>0?p:0,c=p<0?-p:0,d=a[0],g=a[1],C=Math.min(d-c,g-v),F;if(se(l)){if(l.length!==C)throw new Error("Invalid value array length");F=function(A){return l[A]}}else if(_e(l)){var y=l.size();if(y.length!==1||y[0]!==C)throw new Error("Invalid matrix length");F=function(A){return l.get([A])}}else F=function(){return l};D||(D=ae(F(0))?F(0).mul(0):0);var T=[];if(a.length>0){T=bt(T,a,D);for(var _=0;_<C;_++)T[_+c][_+v]=F(_)}return new r({data:T,size:[d,g]})},r.fromJSON=function(a){return new r(a)},r.prototype.swapRows=function(a,l){if(!K(a)||!te(a)||!K(l)||!te(l))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return ce(a,this._size[0]),ce(l,this._size[0]),r._swapRows(a,l,this._data),this},r._swapRows=function(a,l,p){var D=p[a];p[a]=p[l],p[l]=D};function h(a){return _e(a)?h(a.valueOf()):se(a)?a.map(h):a}return r},{isClass:!0});function Xt(e,t,r){return e&&typeof e.map=="function"?e.map(function(n){return Xt(n,t,r)}):t(e)}var be="number",Ve="number, number";function la(e){return Math.abs(e)}la.signature=be;function pa(e,t){return e+t}pa.signature=Ve;function ha(e,t){return e-t}ha.signature=Ve;function Da(e,t){return e*t}Da.signature=Ve;function ma(e,t){return e/t}ma.signature=Ve;function da(e){return-e}da.signature=be;function va(e){return e}va.signature=be;function ga(e){return Wn(e)}ga.signature=be;function Fa(e){return e*e*e}Fa.signature=be;function Ea(e){return Math.exp(e)}Ea.signature=be;function Ca(e){return jn(e)}Ca.signature=be;function wa(e,t){if(!te(e)||!te(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;t!==0;)r=e%t,e=t,t=r;return e<0?-e:e}wa.signature=Ve;function Aa(e,t){if(!te(e)||!te(t))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||t===0)return 0;for(var r,n=e*t;t!==0;)r=t,t=e%r,e=r;return Math.abs(n/e)}Aa.signature=Ve;function xa(e){return Hn(e)}xa.signature=be;function ya(e){return kn(e)}ya.signature=be;function Na(e){return Yn(e)}Na.signature=be;function Ba(e,t){return t===0?e:e-t*Math.floor(e/t)}Ba.signature=Ve;function ba(e){return Zn(e)}ba.signature=be;function Ma(e){return Math.sqrt(e)}Ma.signature=be;function Sa(e){return e*e}Sa.signature=be;function _a(e,t){var r,n,o,i=0,u=1,s=1,f=0;if(!te(e)||!te(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),o=e-n*t,r=i,i=u-n*i,u=r,r=s,s=f-n*s,f=r,e=t,t=o;var h;return e<0?h=[-e,-u,-f]:h=[e,e?u:0,f],h}_a.signature=Ve;function Ta(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}Ta.signature=Ve;function vt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!te(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(cr(e,t))}function Oa(e){return Math.abs(e)}Oa.signature=be;function _t(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return e.isNaN()||t.isNaN()?!1:!e.isFinite()||!t.isFinite()?e.eq(t):e.eq(t)?!0:e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(r),n))}function yo(e,t,r,n){return Ye(e.re,t.re,r,n)&&Ye(e.im,t.im,r,n)}var No=ee("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(r=>(n,o)=>{if(!n.equalBase(o))throw new Error("Cannot compare units with different base");return t.find(r,[n.valueType(),o.valueType()])(n.value,o.value)})}});var Kt="equalScalar",Ia=["typed","config"],Or=ee(Kt,Ia,e=>{var{typed:t,config:r}=e,n=No({typed:t});return t(Kt,{"boolean, boolean":function(i,u){return i===u},"number, number":function(i,u){return Ye(i,u,r.relTol,r.absTol)},"BigNumber, BigNumber":function(i,u){return i.eq(u)||_t(i,u,r.relTol,r.absTol)},"bigint, bigint":function(i,u){return i===u},"Fraction, Fraction":function(i,u){return i.equals(u)},"Complex, Complex":function(i,u){return yo(i,u,r.relTol,r.absTol)}},n)}),_c=ee(Kt,["typed","config"],e=>{var{typed:t,config:r}=e;return t(Kt,{"number, number":function(o,i){return Ye(o,i,r.relTol,r.absTol)}})});var Pa="SparseMatrix",za=["typed","equalScalar","Matrix"],Ir=ee(Pa,za,e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function o(c,d){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(d&&!xe(d))throw new Error("Invalid datatype: "+d);if(_e(c))i(this,c,d);else if(c&&se(c.index)&&se(c.ptr)&&se(c.size))this._values=c.values,this._index=c.index,this._ptr=c.ptr,this._size=c.size,this._datatype=d||c.datatype;else if(se(c))u(this,c,d);else{if(c)throw new TypeError("Unsupported type of data ("+Re(c)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=d}}function i(c,d,g){d.type==="SparseMatrix"?(c._values=d._values?he(d._values):void 0,c._index=he(d._index),c._ptr=he(d._ptr),c._size=he(d._size),c._datatype=g||d._datatype):u(c,d.valueOf(),g||d._datatype)}function u(c,d,g){c._values=[],c._index=[],c._ptr=[],c._datatype=g;var C=d.length,F=0,y=r,T=0;if(xe(g)&&(y=t.find(r,[g,g])||r,T=t.convert(0,g)),C>0){var _=0;do{c._ptr.push(c._index.length);for(var R=0;R<C;R++){var A=d[R];if(se(A)){if(_===0&&F<A.length&&(F=A.length),_<A.length){var b=A[_];y(b,T)||(c._values.push(b),c._index.push(R))}}else _===0&&F<1&&(F=1),y(A,T)||(c._values.push(A),c._index.push(R))}_++}while(_<F)}c._ptr.push(c._index.length),c._size=[C,F]}o.prototype=new n,o.prototype.createSparseMatrix=function(c,d){return new o(c,d)},Object.defineProperty(o,"name",{value:"SparseMatrix"}),o.prototype.constructor=o,o.prototype.type="SparseMatrix",o.prototype.isSparseMatrix=!0,o.prototype.getDataType=function(){return St(this._values,Re)},o.prototype.storage=function(){return"sparse"},o.prototype.datatype=function(){return this._datatype},o.prototype.create=function(c,d){return new o(c,d)},o.prototype.density=function(){var c=this._size[0],d=this._size[1];return c!==0&&d!==0?this._index.length/(c*d):0},o.prototype.subset=function(c,d,g){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return s(this,c);case 2:case 3:return f(this,c,d,g);default:throw new SyntaxError("Wrong number of arguments")}};function s(c,d){if(!at(d))throw new TypeError("Invalid index");var g=d.isScalar();if(g)return c.get(d.min());var C=d.size();if(C.length!==c._size.length)throw new ie(C.length,c._size.length);var F,y,T,_,R=d.min(),A=d.max();for(F=0,y=c._size.length;F<y;F++)ce(R[F],c._size[F]),ce(A[F],c._size[F]);var b=c._values,H=c._index,U=c._ptr,P=d.dimension(0),z=d.dimension(1),O=[],$=[];P.forEach(function(G,X){$[G]=X[0],O[G]=!0});var N=b?[]:void 0,W=[],j=[];return z.forEach(function(G){for(j.push(W.length),T=U[G],_=U[G+1];T<_;T++)F=H[T],O[F]===!0&&(W.push($[F]),N&&N.push(b[T]))}),j.push(W.length),new o({values:N,index:W,ptr:j,size:C,datatype:c._datatype})}function f(c,d,g,C){if(!d||d.isIndex!==!0)throw new TypeError("Invalid index");var F=d.size(),y=d.isScalar(),T;if(_e(g)?(T=g.size(),g=g.toArray()):T=Se(g),y){if(T.length!==0)throw new TypeError("Scalar expected");c.set(d.min(),g,C)}else{if(F.length!==1&&F.length!==2)throw new ie(F.length,c._size.length,"<");if(T.length<F.length){for(var _=0,R=0;F[_]===1&&T[_]===1;)_++;for(;F[_]===1;)R++,_++;g=Qt(g,F.length,R,T)}if(!He(F,T))throw new ie(F,T,">");if(F.length===1){var A=d.dimension(0);A.forEach(function(U,P){ce(U),c.set([U,0],g[P[0]],C)})}else{var b=d.dimension(0),H=d.dimension(1);b.forEach(function(U,P){ce(U),H.forEach(function(z,O){ce(z),c.set([U,z],g[P[0]][O[0]],C)})})}}return c}o.prototype.get=function(c){if(!se(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new ie(c.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var d=c[0],g=c[1];ce(d,this._size[0]),ce(g,this._size[1]);var C=h(d,this._ptr[g],this._ptr[g+1],this._index);return C<this._ptr[g+1]&&this._index[C]===d?this._values[C]:0},o.prototype.set=function(c,d,g){if(!se(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new ie(c.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var C=c[0],F=c[1],y=this._size[0],T=this._size[1],_=r,R=0;xe(this._datatype)&&(_=t.find(r,[this._datatype,this._datatype])||r,R=t.convert(0,this._datatype)),(C>y-1||F>T-1)&&(p(this,Math.max(C+1,y),Math.max(F+1,T),g),y=this._size[0],T=this._size[1]),ce(C,y),ce(F,T);var A=h(C,this._ptr[F],this._ptr[F+1],this._index);return A<this._ptr[F+1]&&this._index[A]===C?_(d,R)?a(A,F,this._values,this._index,this._ptr):this._values[A]=d:_(d,R)||l(A,C,F,d,this._values,this._index,this._ptr),this};function h(c,d,g,C){if(g-d===0)return g;for(var F=d;F<g;F++)if(C[F]===c)return F;return d}function a(c,d,g,C,F){g.splice(c,1),C.splice(c,1);for(var y=d+1;y<F.length;y++)F[y]--}function l(c,d,g,C,F,y,T){F.splice(c,0,C),y.splice(c,0,d);for(var _=g+1;_<T.length;_++)T[_]++}o.prototype.resize=function(c,d,g){if(!et(c))throw new TypeError("Array or Matrix expected");var C=c.valueOf().map(y=>Array.isArray(y)&&y.length===1?y[0]:y);if(C.length!==2)throw new Error("Only two dimensions matrix are supported");C.forEach(function(y){if(!K(y)||!te(y)||y<0)throw new TypeError("Invalid size, must contain positive integers (size: "+ge(C)+")")});var F=g?this.clone():this;return p(F,C[0],C[1],d)};function p(c,d,g,C){var F=C||0,y=r,T=0;xe(c._datatype)&&(y=t.find(r,[c._datatype,c._datatype])||r,T=t.convert(0,c._datatype),F=t.convert(F,c._datatype));var _=!y(F,T),R=c._size[0],A=c._size[1],b,H,U;if(g>A){for(H=A;H<g;H++)if(c._ptr[H]=c._values.length,_)for(b=0;b<R;b++)c._values.push(F),c._index.push(b);c._ptr[g]=c._values.length}else g<A&&(c._ptr.splice(g+1,A-g),c._values.splice(c._ptr[g],c._values.length),c._index.splice(c._ptr[g],c._index.length));if(A=g,d>R){if(_){var P=0;for(H=0;H<A;H++){c._ptr[H]=c._ptr[H]+P,U=c._ptr[H+1]+P;var z=0;for(b=R;b<d;b++,z++)c._values.splice(U+z,0,F),c._index.splice(U+z,0,b),P++}c._ptr[A]=c._values.length}}else if(d<R){var O=0;for(H=0;H<A;H++){c._ptr[H]=c._ptr[H]-O;var $=c._ptr[H],N=c._ptr[H+1]-O;for(U=$;U<N;U++)b=c._index[U],b>d-1&&(c._values.splice(U,1),c._index.splice(U,1),O++)}c._ptr[H]=c._values.length}return c._size[0]=d,c._size[1]=g,c}o.prototype.reshape=function(c,d){if(!se(c))throw new TypeError("Array expected");if(c.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");c.forEach(function(G){if(!K(G)||!te(G)||G<=-2||G===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+ge(c)+")")});var g=this._size[0]*this._size[1];c=Mt(c,g);var C=c[0]*c[1];if(g!==C)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var F=d?this.clone():this;if(this._size[0]===c[0]&&this._size[1]===c[1])return F;for(var y=[],T=0;T<F._ptr.length;T++)for(var _=0;_<F._ptr[T+1]-F._ptr[T];_++)y.push(T);for(var R=F._values.slice(),A=F._index.slice(),b=0;b<F._index.length;b++){var H=A[b],U=y[b],P=H*F._size[1]+U;y[b]=P%c[1],A[b]=Math.floor(P/c[1])}F._values.length=0,F._index.length=0,F._ptr.length=c[1]+1,F._size=c.slice();for(var z=0;z<F._ptr.length;z++)F._ptr[z]=0;for(var O=0;O<R.length;O++){var $=A[O],N=y[O],W=R[O],j=h($,F._ptr[N],F._ptr[N+1],F._index);l(j,$,N,W,F._values,F._index,F._ptr)}return F},o.prototype.clone=function(){var c=new o({values:this._values?he(this._values):void 0,index:he(this._index),ptr:he(this._ptr),size:he(this._size),datatype:this._datatype});return c},o.prototype.size=function(){return this._size.slice(0)},o.prototype.map=function(c,d){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var g=this,C=this._size[0],F=this._size[1],y=dt(c,g,"map"),T=function(R,A,b){return y(R,[A,b],g)};return D(this,0,C-1,0,F-1,T,d)};function D(c,d,g,C,F,y,T){var _=[],R=[],A=[],b=r,H=0;xe(c._datatype)&&(b=t.find(r,[c._datatype,c._datatype])||r,H=t.convert(0,c._datatype));for(var U=function(Fe,Oe,Ie){var Le=y(Fe,Oe,Ie);b(Le,H)||(_.push(Le),R.push(Oe))},P=C;P<=F;P++){A.push(_.length);var z=c._ptr[P],O=c._ptr[P+1];if(T)for(var $=z;$<O;$++){var N=c._index[$];N>=d&&N<=g&&U(c._values[$],N-d,P-C)}else{for(var W={},j=z;j<O;j++){var G=c._index[j];W[G]=c._values[j]}for(var X=d;X<=g;X++){var le=X in W?W[X]:0;U(le,X-d,P-C)}}}return A.push(_.length),new o({values:_,index:R,ptr:A,size:[g-d+1,F-C+1]})}o.prototype.forEach=function(c,d){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var g=this,C=this._size[0],F=this._size[1],y=dt(c,g,"forEach"),T=0;T<F;T++){var _=this._ptr[T],R=this._ptr[T+1];if(d)for(var A=_;A<R;A++){var b=this._index[A];y(this._values[A],[b,T],g)}else{for(var H={},U=_;U<R;U++){var P=this._index[U];H[P]=this._values[U]}for(var z=0;z<C;z++){var O=z in H?H[z]:0;y(O,[z,T],g)}}}},o.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var c=this._size[1],d=0;d<c;d++)for(var g=this._ptr[d],C=this._ptr[d+1],F=g;F<C;F++){var y=this._index[F];yield{value:this._values[F],index:[y,d]}}},o.prototype.toArray=function(){return v(this._values,this._index,this._ptr,this._size,!0)},o.prototype.valueOf=function(){return v(this._values,this._index,this._ptr,this._size,!1)};function v(c,d,g,C,F){var y=C[0],T=C[1],_=[],R,A;for(R=0;R<y;R++)for(_[R]=[],A=0;A<T;A++)_[R][A]=0;for(A=0;A<T;A++)for(var b=g[A],H=g[A+1],U=b;U<H;U++)R=d[U],_[R][A]=c?F?he(c[U]):c[U]:1;return _}return o.prototype.format=function(c){for(var d=this._size[0],g=this._size[1],C=this.density(),F="Sparse Matrix ["+ge(d,c)+" x "+ge(g,c)+"] density: "+ge(C,c)+`
`,y=0;y<g;y++)for(var T=this._ptr[y],_=this._ptr[y+1],R=T;R<_;R++){var A=this._index[R];F+=`
    (`+ge(A,c)+", "+ge(y,c)+") ==> "+(this._values?ge(this._values[R],c):"X")}return F},o.prototype.toString=function(){return ge(this.toArray())},o.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},o.prototype.diagonal=function(c){if(c){if(ae(c)&&(c=c.toNumber()),!K(c)||!te(c))throw new TypeError("The parameter k must be an integer number")}else c=0;var d=c>0?c:0,g=c<0?-c:0,C=this._size[0],F=this._size[1],y=Math.min(C-g,F-d),T=[],_=[],R=[];R[0]=0;for(var A=d;A<F&&T.length<y;A++)for(var b=this._ptr[A],H=this._ptr[A+1],U=b;U<H;U++){var P=this._index[U];if(P===A-d+g){T.push(this._values[U]),_[T.length-1]=P-g;break}}return R.push(T.length),new o({values:T,index:_,ptr:R,size:[y,1]})},o.fromJSON=function(c){return new o(c)},o.diagonal=function(c,d,g,C,F){if(!se(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(G){if(ae(G)&&(G=G.toNumber()),!K(G)||!te(G)||G<1)throw new Error("Size values must be positive integers");return G}),g){if(ae(g)&&(g=g.toNumber()),!K(g)||!te(g))throw new TypeError("The parameter k must be an integer number")}else g=0;var y=r,T=0;xe(F)&&(y=t.find(r,[F,F])||r,T=t.convert(0,F));var _=g>0?g:0,R=g<0?-g:0,A=c[0],b=c[1],H=Math.min(A-R,b-_),U;if(se(d)){if(d.length!==H)throw new Error("Invalid value array length");U=function(X){return d[X]}}else if(_e(d)){var P=d.size();if(P.length!==1||P[0]!==H)throw new Error("Invalid matrix length");U=function(X){return d.get([X])}}else U=function(){return d};for(var z=[],O=[],$=[],N=0;N<b;N++){$.push(z.length);var W=N-_;if(W>=0&&W<H){var j=U(W);y(j,T)||(O.push(W+R),z.push(j))}}return $.push(z.length),new o({values:z,index:O,ptr:$,size:[A,b]})},o.prototype.swapRows=function(c,d){if(!K(c)||!te(c)||!K(d)||!te(d))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return ce(c,this._size[0]),ce(d,this._size[0]),o._swapRows(c,d,this._size[1],this._values,this._index,this._ptr),this},o._forEachRow=function(c,d,g,C,F){for(var y=C[c],T=C[c+1],_=y;_<T;_++)F(g[_],d[_])},o._swapRows=function(c,d,g,C,F,y){for(var T=0;T<g;T++){var _=y[T],R=y[T+1],A=h(c,_,R,F),b=h(d,_,R,F);if(A<R&&b<R&&F[A]===c&&F[b]===d){if(C){var H=C[A];C[A]=C[b],C[b]=H}continue}if(A<R&&F[A]===c&&(b>=R||F[b]!==d)){var U=C?C[A]:void 0;F.splice(b,0,d),C&&C.splice(b,0,U),F.splice(b<=A?A+1:A,1),C&&C.splice(b<=A?A+1:A,1);continue}if(b<R&&F[b]===d&&(A>=R||F[A]!==c)){var P=C?C[b]:void 0;F.splice(A,0,c),C&&C.splice(A,0,P),F.splice(A<=b?b+1:b,1),C&&C.splice(A<=b?b+1:b,1)}}},o},{isClass:!0});var Bo="matrix",Ra=["typed","Matrix","DenseMatrix","SparseMatrix"],Pr=ee(Bo,Ra,e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:o}=e;return t(Bo,{"":function(){return i([])},string:function(s){return i([],s)},"string, string":function(s,f){return i([],s,f)},Array:function(s){return i(s)},Matrix:function(s){return i(s,s.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(u,s,f){if(s==="dense"||s==="default"||s===void 0)return new n(u,f);if(s==="sparse")return new o(u,f);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}});var $a="matAlgo11xS0s",qa=["typed","equalScalar"],bo=ee($a,qa,e=>{var{typed:t,equalScalar:r}=e;return function(o,i,u,s){var f=o._values,h=o._index,a=o._ptr,l=o._size,p=o._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var D=l[0],v=l[1],c,d=r,g=0,C=u;typeof p=="string"&&(c=p,d=t.find(r,[c,c]),g=t.convert(0,c),i=t.convert(i,c),C=t.find(u,[c,c]));for(var F=[],y=[],T=[],_=0;_<v;_++){T[_]=y.length;for(var R=a[_],A=a[_+1],b=R;b<A;b++){var H=h[b],U=s?C(i,f[b]):C(f[b],i);d(U,g)||(y.push(H),F.push(U))}}return T[v]=y.length,o.createSparseMatrix({values:F,index:y,ptr:T,size:[D,v],datatype:c})}});var La="matAlgo12xSfs",Ua=["typed","DenseMatrix"],Mo=ee(La,Ua,e=>{var{typed:t,DenseMatrix:r}=e;return function(o,i,u,s){var f=o._values,h=o._index,a=o._ptr,l=o._size,p=o._datatype;if(!f)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var D=l[0],v=l[1],c,d=u;typeof p=="string"&&(c=p,i=t.convert(i,c),d=t.find(u,[c,c]));for(var g=[],C=[],F=[],y=0;y<v;y++){for(var T=y+1,_=a[y],R=a[y+1],A=_;A<R;A++){var b=h[A];C[b]=f[A],F[b]=T}for(var H=0;H<D;H++)y===0&&(g[H]=[]),F[H]===T?g[H][y]=s?d(i,C[H]):d(C[H],i):g[H][y]=s?d(i,0):d(0,i)}return new r({data:g,size:[D,v],datatype:c})}});var Za="matAlgo14xDs",ka=["typed"],So=ee(Za,ka,e=>{var{typed:t}=e;return function(o,i,u,s){var f=o._data,h=o._size,a=o._datatype,l,p=u;typeof a=="string"&&(l=a,i=t.convert(i,l),p=t.find(u,[l,l]));var D=h.length>0?r(p,0,h,h[0],f,i,s):[];return o.createDenseMatrix({data:D,size:he(h),datatype:l})};function r(n,o,i,u,s,f,h){var a=[];if(o===i.length-1)for(var l=0;l<u;l++)a[l]=h?n(f,s[l]):n(s[l],f);else for(var p=0;p<u;p++)a[p]=r(n,o+1,i,i[o+1],s[p],f,h);return a}});var _o="zeros",Ha=["typed","config","matrix","BigNumber"],zr=ee(_o,Ha,e=>{var{typed:t,config:r,matrix:n,BigNumber:o}=e;return t(_o,{"":function(){return r.matrix==="Array"?i([]):i([],"default")},"...number | BigNumber | string":function(h){var a=h[h.length-1];if(typeof a=="string"){var l=h.pop();return i(h,l)}else return r.matrix==="Array"?i(h):i(h,"default")},Array:i,Matrix:function(h){var a=h.storage();return i(h.valueOf(),a)},"Array | Matrix, string":function(h,a){return i(h.valueOf(),a)}});function i(f,h){var a=u(f),l=a?new o(0):0;if(s(f),h){var p=n(h);return f.length>0?p.resize(f,l):p}else{var D=[];return f.length>0?bt(D,f,l):D}}function u(f){var h=!1;return f.forEach(function(a,l,p){ae(a)&&(h=!0,p[l]=a.toNumber())}),h}function s(f){f.forEach(function(h){if(typeof h!="number"||!te(h)||h<0)throw new Error("Parameters in function zeros must be positive integers")})}});var gt="Number of decimals in function round must be an integer",To="round",Ya=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Rr=ee(To,Ya,e=>{var{typed:t,config:r,matrix:n,equalScalar:o,zeros:i,BigNumber:u,DenseMatrix:s}=e,f=bo({typed:t,equalScalar:o}),h=Mo({typed:t,DenseMatrix:s}),a=So({typed:t});function l(p){return Math.abs(lt(p).exponent)}return t(To,{number:function(D){var v=vt(D,l(r.relTol)),c=Ye(D,v,r.relTol,r.absTol)?v:D;return vt(c)},"number, number":function(D,v){var c=l(r.relTol);if(v>=c)return vt(D,v);var d=vt(D,c),g=Ye(D,d,r.relTol,r.absTol)?d:D;return vt(g,v)},"number, BigNumber":function(D,v){if(!v.isInteger())throw new TypeError(gt);return new u(D).toDecimalPlaces(v.toNumber())},Complex:function(D){return D.round()},"Complex, number":function(D,v){if(v%1)throw new TypeError(gt);return D.round(v)},"Complex, BigNumber":function(D,v){if(!v.isInteger())throw new TypeError(gt);var c=v.toNumber();return D.round(c)},BigNumber:function(D){var v=new u(D).toDecimalPlaces(l(r.relTol)),c=_t(D,v,r.relTol,r.absTol)?v:D;return c.toDecimalPlaces(0)},"BigNumber, BigNumber":function(D,v){if(!v.isInteger())throw new TypeError(gt);var c=l(r.relTol);if(v>=c)return D.toDecimalPlaces(v.toNumber());var d=D.toDecimalPlaces(c),g=_t(D,d,r.relTol,r.absTol)?d:D;return g.toDecimalPlaces(v.toNumber())},Fraction:function(D){return D.round()},"Fraction, number":function(D,v){if(v%1)throw new TypeError(gt);return D.round(v)},"Fraction, BigNumber":function(D,v){if(!v.isInteger())throw new TypeError(gt);return D.round(v.toNumber())},"Unit, number, Unit":t.referToSelf(p=>function(D,v,c){var d=D.toNumeric(c);return c.multiply(p(d,v))}),"Unit, BigNumber, Unit":t.referToSelf(p=>(D,v,c)=>p(D,v.toNumber(),c)),"Unit, Unit":t.referToSelf(p=>(D,v)=>p(D,0,v)),"Array | Matrix, number, Unit":t.referToSelf(p=>(D,v,c)=>Xt(D,d=>p(d,v,c),!0)),"Array | Matrix, BigNumber, Unit":t.referToSelf(p=>(D,v,c)=>p(D,v.toNumber(),c)),"Array | Matrix, Unit":t.referToSelf(p=>(D,v)=>p(D,0,v)),"Array | Matrix":t.referToSelf(p=>D=>Xt(D,p,!0)),"SparseMatrix, number | BigNumber":t.referToSelf(p=>(D,v)=>f(D,v,p,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(p=>(D,v)=>a(D,v,p,!1)),"Array, number | BigNumber":t.referToSelf(p=>(D,v)=>a(n(D),v,p,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(p=>(D,v)=>o(D,0)?i(v.size(),v.storage()):h(v,D,p,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(p=>(D,v)=>o(D,0)?i(v.size(),v.storage()):a(v,D,p,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(p=>(D,v)=>a(n(v),D,p,!0).valueOf())})});var $r=Fr({config:ct}),Wa=wr({});var ja=xr({});var qr=yr({});var Lr=Tr({Matrix:qr});var Tt=lr({BigNumber:$r,Complex:Wa,DenseMatrix:Lr,Fraction:ja});var Oo=Or({config:ct,typed:Tt});var Va=Ir({Matrix:qr,equalScalar:Oo,typed:Tt});var Io=Pr({DenseMatrix:Lr,Matrix:qr,SparseMatrix:Va,typed:Tt});var Ga=zr({BigNumber:$r,config:ct,matrix:Io,typed:Tt});var Ur=Rr({BigNumber:$r,DenseMatrix:Lr,config:ct,equalScalar:Oo,matrix:Io,typed:Tt,zeros:Ga});var Ft=wt(Po(),1),qo=wt(zo(),1),Lo=wt(Ro(),1);Ft.default.extend(qo.default);Ft.default.extend(Lo.default);Ft.default.tz.setDefault();var{accessToken:Vr}=JSON.parse(localStorage.getItem("persist:auth"))||{};Vr=Vr?.replace(/^\"/,"").replace(/\"$/,"");function Qa(e){let t=Object.keys(e[0]),r=e.map(n=>t.map(o=>n[o]||"").join(","));return r.unshift(t.join(",")),console.log(r.length),r.join(`
`)}function Ja(){let e=document.createElement("input");e.type="date",e.className="ml-auto";let t=document.createElement("input");t.type="date",t.className="ml-5";let r=document.createElement("button");r.className="btn btn-submit text-white d-flex align-items-center mx-5",r.textContent="Download";let n=document.querySelector(".fluz-header");n&&(n.appendChild(e),n.appendChild(t),n.appendChild(r)),r.addEventListener("click",async()=>{let{deposit:o,transfer:i}=await Ka();$o("deposit",o),$o("transfer",i)})}function $o(e,t){let r=new Blob([Qa(t)],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(r),o=document.createElement("a");o.setAttribute("href",n),o.setAttribute("download",`${e}.csv`),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)}async function Xa(e,t){let r={limit:1e3};if(e&&t){let s=(0,Ft.default)(e).add(12,"hour").toISOString(),f=(0,Ft.default)(t).add(12,"hour").toISOString();r.created_at=`{"startDate":"${s}","endDate":"${f}"}`}let n="https://power.fluz.app/api/v1/user/cash-balance",o=[],i=1,u=!0;for(;u;){r.page=i;let s=new URLSearchParams(r),h=await(await fetch(`${n}?${s.toString()}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vr}`}})).json(),{count:a,rows:l}=h;o=o.concat(l),o.length<a?i++:u=!1}return o}async function Ka(e,t){let r=await Xa(e,t);console.log(r.length);let n=[],o=[];for(let i of r)i.cash_balance_deposit_id?n.push(es(i)):i.withdraw_id&&o.push(ts(i));return{deposit:n,transfer:o}}function es(e){return{utc:e.created_at,ending:e.payment_method_type==="BANK_CARD"?e.bank_card.last_four_digits:"PAYPAL",amount:Ur(e.deposit_amount,2),fee:Ur(e.deposit_fee,2),deposit_display_id:e.deposit_display_id,cash_balance_deposit_id:e.cash_balance_deposit_id}}function ts(e){return{utc:e.created_at,withdraw_method:e.withdraw_method,withdraw_source:e.withdraw_source,status:e.status,amount:e.amount,purchase_amount:e?.user_purchase?.purchase_amount,purchase_display_id:e?.user_purchase?.purchase_display_id,withdraw_id:e.withdraw_id}}Ja();})();
/*! Bundled license information:

decimal.js/decimal.mjs:
  (*!
   *  decimal.js v10.4.3
   *  An arbitrary-precision Decimal type for JavaScript.
   *  https://github.com/MikeMcl/decimal.js
   *  Copyright (c) 2022 Michael Mclaughlin <[email protected]>
   *  MIT Licence
   *)

fraction.js/fraction.js:
  (**
   * @license Fraction.js v4.3.7 31/08/2023
   * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
   *
   * Copyright (c) 2023, Robert Eisele ([email protected])
   * Dual licensed under the MIT or GPL Version 2 licenses.
   **)
*/