mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
71 lines
609 KiB
JavaScript
71 lines
609 KiB
JavaScript
import{g as Xn,e as Vt,b as Sp}from"./chunk-a740628f.js";import{_ as Cp}from"./chunk-6deddc2e.js";import{w as Mp}from"./chunk-4d6daddf.js";import{r as Fp}from"./chunk-44692048.js";import{d as Bp,r as Tp,c as Op,j as qo,D as $p,m as _p,q as hi,S as Ip,k as Rp,l as qp,z as zp,M as Pp,L as Up}from"./chunk-449c23a2.js";import"./chunk-9a43cce8.js";import"./chunk-340feaf0.js";function wr(){return wr=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},wr.apply(this,arguments)}var tf={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function Ve(e){return typeof e=="number"}function ke(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 wt(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isComplex===!0||!1}function Jn(e){return e&&typeof e=="object"&&Object.getPrototypeOf(e).isFraction===!0||!1}function Zr(e){return e&&e.constructor.prototype.isUnit===!0||!1}function Br(e){return typeof e=="string"}var je=Array.isArray;function Be(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function st(e){return Array.isArray(e)||Be(e)}function Ma(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function kt(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function ki(e){return e&&e.constructor.prototype.isRange===!0||!1}function Wa(e){return e&&e.constructor.prototype.isIndex===!0||!1}function Lp(e){return typeof e=="boolean"}function kp(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function nf(e){return e&&e.constructor.prototype.isHelp===!0||!1}function Hp(e){return typeof e=="function"}function Gp(e){return e instanceof Date}function Vp(e){return e instanceof RegExp}function Hi(e){return!!(e&&typeof e=="object"&&e.constructor===Object&&!wt(e)&&!Jn(e))}function Zp(e){return e===null}function Yp(e){return e===void 0}function Gt(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function Vr(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function Wp(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function Xp(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function Jp(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function We(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function Si(e){return We(e)||mr(e)&&e.args.length===1&&We(e.args[0])&&"-+~".includes(e.op)}function Qn(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function Ot(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function An(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function er(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function Xa(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function mr(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function Dt(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function Qp(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function Kp(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function yr(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function af(e){return e&&e.constructor.prototype.isChain===!0||!1}function nr(e){var r=typeof e;return r==="object"?e===null?"null":ke(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function $e(e){var r=typeof e;if(r==="number"||r==="string"||r==="boolean"||e===null||e===void 0)return e;if(typeof e.clone=="function")return e.clone();if(Array.isArray(e))return e.map(function(i){return $e(i)});if(e instanceof Date)return new Date(e.valueOf());if(ke(e))return e;if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);return jp(e,$e)}function jp(e,r){var i={};for(var a in e)Ee(e,a)&&(i[a]=r(e[a]));return i}function of(e,r){for(var i in r)Ee(r,i)&&(e[i]=r[i]);return e}function Gn(e,r){var i,a,t;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(a=0,t=e.length;a<t;a++)if(!Gn(e[a],r[a]))return!1;return!0}else{if(typeof e=="function")return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(i in e)if(!(i in r)||!Gn(e[i],r[i]))return!1;for(i in r)if(!(i in e))return!1;return!0}else return e===r}}function ed(e,r,i){var a=!0,t;Object.defineProperty(e,r,{get:function(){return a&&(t=i(),a=!1),t},set:function(u){t=u,a=!1},configurable:!0,enumerable:!0})}function Ee(e,r){return e&&Object.hasOwnProperty.call(e,r)}function rd(e,r){for(var i={},a=0;a<r.length;a++){var t=r[a],n=e[t];n!==void 0&&(i[t]=n)}return i}var td=["Matrix","Array"],nd=["number","BigNumber","Fraction"],me=function(r){if(r)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(tf)};wr(me,tf,{MATRIX_OPTIONS:td,NUMBER_OPTIONS:nd});function Xr(e,r){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=ad(e))||r&&e&&typeof e.length=="number"){i&&(e=i);var a=0,t=function(){};return{s:t,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(l){throw l},f:t}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,u=!1,f;return{s:function(){i=i.call(e)},n:function(){var l=i.next();return n=l.done,l},e:function(l){u=!0,f=l},f:function(){try{!n&&i.return!=null&&i.return()}finally{if(u)throw f}}}}function ad(e,r){if(e){if(typeof e=="string")return zo(e,r);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set")return Array.from(e);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return zo(e,r)}}function zo(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,a=new Array(r);i<r;i++)a[i]=e[i];return a}function fn(e){"@babel/helpers - typeof";return fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fn(e)}function Po(){return!0}function Gr(){return!1}function un(){}var Uo="Argument is not a typed-function.";function uf(){function e(R){return fn(R)==="object"&&R!==null&&R.constructor===Object}var r=[{name:"number",test:function(z){return typeof z=="number"}},{name:"string",test:function(z){return typeof z=="string"}},{name:"boolean",test:function(z){return typeof z=="boolean"}},{name:"Function",test:function(z){return typeof z=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(z){return z instanceof Date}},{name:"RegExp",test:function(z){return z instanceof RegExp}},{name:"Object",test:e},{name:"null",test:function(z){return z===null}},{name:"undefined",test:function(z){return z===void 0}}],i={name:"any",test:Po,isAny:!0},a,t,n=0,u={createCount:0};function f(R){var z=a.get(R);if(z)return z;var Q='Unknown type "'+R+'"',ae=R.toLowerCase(),le,ve=Xr(t),de;try{for(ve.s();!(de=ve.n()).done;)if(le=de.value,le.toLowerCase()===ae){Q+='. Did you mean "'+le+'" ?';break}}catch(ce){ve.e(ce)}finally{ve.f()}throw new TypeError(Q)}function c(R){for(var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",Q=z?f(z).index:t.length,ae=[],le=0;le<R.length;++le){if(!R[le]||typeof R[le].name!="string"||typeof R[le].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");var ve=R[le].name;if(a.has(ve))throw new TypeError('Duplicate type name "'+ve+'"');ae.push(ve),a.set(ve,{name:ve,test:R[le].test,isAny:R[le].isAny,index:Q+le,conversionsTo:[]})}var de=t.slice(Q);t=t.slice(0,Q).concat(ae).concat(de);for(var ce=Q+ae.length;ce<t.length;++ce)a.get(t[ce]).index=ce}function l(){a=new Map,t=[],n=0,c([i],!1)}l(),c(r);function o(){var R,z=Xr(t),Q;try{for(z.s();!(Q=z.n()).done;)R=Q.value,a.get(R).conversionsTo=[]}catch(ae){z.e(ae)}finally{z.f()}n=0}function s(R){var z=t.filter(function(Q){var ae=a.get(Q);return!ae.isAny&&ae.test(R)});return z.length?z:["any"]}function m(R){return R&&typeof R=="function"&&"_typedFunctionData"in R}function v(R,z,Q){if(!m(R))throw new TypeError(Uo);var ae=Q&&Q.exact,le=Array.isArray(z)?z.join(","):z,ve=w(le),de=h(ve);if(!ae||de in R.signatures){var ce=R._typedFunctionData.signatureMap.get(de);if(ce)return ce}var ge=ve.length,Se;if(ae){Se=[];var Ie;for(Ie in R.signatures)Se.push(R._typedFunctionData.signatureMap.get(Ie))}else Se=R._typedFunctionData.signatures;for(var De=0;De<ge;++De){var Je=ve[De],ze=[],ir=void 0,M=Xr(Se),Z;try{for(M.s();!(Z=M.n()).done;){ir=Z.value;var ne=D(ir.params,De);if(!(!ne||Je.restParam&&!ne.restParam)){if(!ne.hasAny){var ye=function(){var Ar=g(ne);if(Je.types.some(function(Lt){return!Ar.has(Lt.name)}))return"continue"}();if(ye==="continue")continue}ze.push(ir)}}}catch(Ar){M.e(Ar)}finally{M.f()}if(Se=ze,Se.length===0)break}var Me,Te=Xr(Se),pr;try{for(Te.s();!(pr=Te.n()).done;)if(Me=pr.value,Me.params.length<=ge)return Me}catch(Ar){Te.e(Ar)}finally{Te.f()}throw new TypeError("Signature not found (signature: "+(R.name||"unnamed")+"("+h(ve,", ")+"))")}function d(R,z,Q){return v(R,z,Q).implementation}function p(R,z){var Q=f(z);if(Q.test(R))return R;var ae=Q.conversionsTo;if(ae.length===0)throw new Error("There are no conversions to "+z+" defined.");for(var le=0;le<ae.length;le++){var ve=f(ae[le].from);if(ve.test(R))return ae[le].convert(R)}throw new Error("Cannot convert "+R+" to "+z)}function h(R){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return R.map(function(Q){return Q.name}).join(z)}function y(R){var z=R.indexOf("...")===0,Q=z?R.length>3?R.slice(3):"any":R,ae=Q.split("|").map(function(ce){return f(ce.trim())}),le=!1,ve=z?"...":"",de=ae.map(function(ce){return le=ce.isAny||le,ve+=ce.name+"|",{name:ce.name,typeIndex:ce.index,test:ce.test,isAny:ce.isAny,conversion:null,conversionIndex:-1}});return{types:de,name:ve.slice(0,-1),hasAny:le,hasConversion:!1,restParam:z}}function E(R){var z=R.types.map(function(de){return de.name}),Q=T(z),ae=R.hasAny,le=R.name,ve=Q.map(function(de){var ce=f(de.from);return ae=ce.isAny||ae,le+="|"+de.from,{name:de.from,typeIndex:ce.index,test:ce.test,isAny:ce.isAny,conversion:de,conversionIndex:de.index}});return{types:R.types.concat(ve),name:le,hasAny:ae,hasConversion:ve.length>0,restParam:R.restParam}}function g(R){return R.typeSet||(R.typeSet=new Set,R.types.forEach(function(z){return R.typeSet.add(z.name)})),R.typeSet}function w(R){var z=[];if(typeof R!="string")throw new TypeError("Signatures must be strings");var Q=R.trim();if(Q==="")return z;for(var ae=Q.split(","),le=0;le<ae.length;++le){var ve=y(ae[le].trim());if(ve.restParam&&le!==ae.length-1)throw new SyntaxError('Unexpected rest parameter "'+ae[le]+'": only allowed for the last parameter');if(ve.types.length===0)return null;z.push(ve)}return z}function x(R){var z=ie(R);return z?z.restParam:!1}function b(R){if(!R||R.types.length===0)return Po;if(R.types.length===1)return f(R.types[0].name).test;if(R.types.length===2){var z=f(R.types[0].name).test,Q=f(R.types[1].name).test;return function(ve){return z(ve)||Q(ve)}}else{var ae=R.types.map(function(le){return f(le.name).test});return function(ve){for(var de=0;de<ae.length;de++)if(ae[de](ve))return!0;return!1}}}function A(R){var z,Q,ae;if(x(R)){z=se(R).map(b);var le=z.length,ve=b(ie(R)),de=function(ge){for(var Se=le;Se<ge.length;Se++)if(!ve(ge[Se]))return!1;return!0};return function(ge){for(var Se=0;Se<z.length;Se++)if(!z[Se](ge[Se]))return!1;return de(ge)&&ge.length>=le+1}}else return R.length===0?function(ge){return ge.length===0}:R.length===1?(Q=b(R[0]),function(ge){return Q(ge[0])&&ge.length===1}):R.length===2?(Q=b(R[0]),ae=b(R[1]),function(ge){return Q(ge[0])&&ae(ge[1])&&ge.length===2}):(z=R.map(b),function(ge){for(var Se=0;Se<z.length;Se++)if(!z[Se](ge[Se]))return!1;return ge.length===z.length})}function D(R,z){return z<R.length?R[z]:x(R)?ie(R):null}function S(R,z){var Q=D(R,z);return Q?g(Q):new Set}function N(R){return R.conversion===null||R.conversion===void 0}function B(R,z){var Q=new Set;return R.forEach(function(ae){var le=S(ae.params,z),ve,de=Xr(le),ce;try{for(de.s();!(ce=de.n()).done;)ve=ce.value,Q.add(ve)}catch(ge){de.e(ge)}finally{de.f()}}),Q.has("any")?["any"]:Array.from(Q)}function F(R,z,Q){var ae,le,ve=R||"unnamed",de=Q,ce,ge=function(){var M=[];if(de.forEach(function(ne){var ye=D(ne.params,ce),Me=b(ye);(ce<ne.params.length||x(ne.params))&&Me(z[ce])&&M.push(ne)}),M.length===0){if(le=B(de,ce),le.length>0){var Z=s(z[ce]);return ae=new TypeError("Unexpected type of argument in function "+ve+" (expected: "+le.join(" or ")+", actual: "+Z.join(" | ")+", index: "+ce+")"),ae.data={category:"wrongType",fn:ve,index:ce,actual:Z,expected:le},{v:ae}}}else de=M};for(ce=0;ce<z.length;ce++){var Se=ge();if(fn(Se)==="object")return Se.v}var Ie=de.map(function(ir){return x(ir.params)?1/0:ir.params.length});if(z.length<Math.min.apply(null,Ie))return le=B(de,ce),ae=new TypeError("Too few arguments in function "+ve+" (expected: "+le.join(" or ")+", index: "+z.length+")"),ae.data={category:"tooFewArgs",fn:ve,index:z.length,expected:le},ae;var De=Math.max.apply(null,Ie);if(z.length>De)return ae=new TypeError("Too many arguments in function "+ve+" (expected: "+De+", actual: "+z.length+")"),ae.data={category:"tooManyArgs",fn:ve,index:z.length,expectedLength:De},ae;for(var Je=[],ze=0;ze<z.length;++ze)Je.push(s(z[ze]).join("|"));return ae=new TypeError('Arguments of type "'+Je.join(", ")+'" do not match any of the defined signatures of function '+ve+"."),ae.data={category:"mismatch",actual:Je},ae}function $(R){for(var z=t.length+1,Q=0;Q<R.types.length;Q++)N(R.types[Q])&&(z=Math.min(z,R.types[Q].typeIndex));return z}function q(R){for(var z=n+1,Q=0;Q<R.types.length;Q++)N(R.types[Q])||(z=Math.min(z,R.types[Q].conversionIndex));return z}function _(R,z){if(R.hasAny){if(!z.hasAny)return 1}else if(z.hasAny)return-1;if(R.restParam){if(!z.restParam)return 1}else if(z.restParam)return-1;if(R.hasConversion){if(!z.hasConversion)return 1}else if(z.hasConversion)return-1;var Q=$(R)-$(z);if(Q<0)return-1;if(Q>0)return 1;var ae=q(R)-q(z);return ae<0?-1:ae>0?1:0}function C(R,z){var Q=R.params,ae=z.params,le=ie(Q),ve=ie(ae),de=x(Q),ce=x(ae);if(de&&le.hasAny){if(!ce||!ve.hasAny)return 1}else if(ce&&ve.hasAny)return-1;var ge=0,Se=0,Ie,De=Xr(Q),Je;try{for(De.s();!(Je=De.n()).done;)Ie=Je.value,Ie.hasAny&&++ge,Ie.hasConversion&&++Se}catch(zn){De.e(zn)}finally{De.f()}var ze=0,ir=0,M=Xr(ae),Z;try{for(M.s();!(Z=M.n()).done;)Ie=Z.value,Ie.hasAny&&++ze,Ie.hasConversion&&++ir}catch(zn){M.e(zn)}finally{M.f()}if(ge!==ze)return ge-ze;if(de&&le.hasConversion){if(!ce||!ve.hasConversion)return 1}else if(ce&&ve.hasConversion)return-1;if(Se!==ir)return Se-ir;if(de){if(!ce)return 1}else if(ce)return-1;var ne=(Q.length-ae.length)*(de?-1:1);if(ne!==0)return ne;for(var ye=[],Me=0,Te=0;Te<Q.length;++Te){var pr=_(Q[Te],ae[Te]);ye.push(pr),Me+=pr}if(Me!==0)return Me;for(var Ar,Lt=0,ia=ye;Lt<ia.length;Lt++)if(Ar=ia[Lt],Ar!==0)return Ar;return 0}function T(R){if(R.length===0)return[];var z=R.map(f);R.length>1&&z.sort(function(ge,Se){return ge.index-Se.index});var Q=z[0].conversionsTo;if(R.length===1)return Q;Q=Q.concat([]);for(var ae=new Set(R),le=1;le<z.length;++le){var ve=void 0,de=Xr(z[le].conversionsTo),ce;try{for(de.s();!(ce=de.n()).done;)ve=ce.value,ae.has(ve.from)||(Q.push(ve),ae.add(ve.from))}catch(ge){de.e(ge)}finally{de.f()}}return Q}function H(R,z){var Q=z;if(R.some(function(ce){return ce.hasConversion})){var ae=x(R),le=R.map(O);Q=function(){for(var ge=[],Se=ae?arguments.length-1:arguments.length,Ie=0;Ie<Se;Ie++)ge[Ie]=le[Ie](arguments[Ie]);return ae&&(ge[Se]=arguments[Se].map(le[Se])),z.apply(this,ge)}}var ve=Q;if(x(R)){var de=R.length-1;ve=function(){return Q.apply(this,re(arguments,0,de).concat([re(arguments,de)]))}}return ve}function O(R){var z,Q,ae,le,ve=[],de=[];switch(R.types.forEach(function(ce){ce.conversion&&(ve.push(f(ce.conversion.from).test),de.push(ce.conversion.convert))}),de.length){case 0:return function(ge){return ge};case 1:return z=ve[0],ae=de[0],function(ge){return z(ge)?ae(ge):ge};case 2:return z=ve[0],Q=ve[1],ae=de[0],le=de[1],function(ge){return z(ge)?ae(ge):Q(ge)?le(ge):ge};default:return function(ge){for(var Se=0;Se<de.length;Se++)if(ve[Se](ge))return de[Se](ge);return ge}}}function L(R){function z(Q,ae,le){if(ae<Q.length){var ve=Q[ae],de=[];if(ve.restParam){var ce=ve.types.filter(N);ce.length<ve.types.length&&de.push({types:ce,name:"..."+ce.map(function(ge){return ge.name}).join("|"),hasAny:ce.some(function(ge){return ge.isAny}),hasConversion:!1,restParam:!0}),de.push(ve)}else de=ve.types.map(function(ge){return{types:[ge],name:ge.name,hasAny:ge.isAny,hasConversion:ge.conversion,restParam:!1}});return Ae(de,function(ge){return z(Q,ae+1,le.concat([ge]))})}else return[le]}return z(R,0,[])}function W(R,z){for(var Q=Math.max(R.length,z.length),ae=0;ae<Q;ae++){var le=S(R,ae),ve=S(z,ae),de=!1,ce=void 0,ge=Xr(ve),Se;try{for(ge.s();!(Se=ge.n()).done;)if(ce=Se.value,le.has(ce)){de=!0;break}}catch(ir){ge.e(ir)}finally{ge.f()}if(!de)return!1}var Ie=R.length,De=z.length,Je=x(R),ze=x(z);return Je?ze?Ie===De:De>=Ie:ze?Ie>=De:Ie===De}function X(R){return R.map(function(z){return te(z)?U(z.referToSelf.callback):G(z)?Ne(z.referTo.references,z.referTo.callback):z})}function P(R,z,Q){var ae=[],le,ve=Xr(R),de;try{for(ve.s();!(de=ve.n()).done;){le=de.value;var ce=Q[le];if(typeof ce!="number")throw new TypeError('No definition for referenced signature "'+le+'"');if(ce=z[ce],typeof ce!="function")return!1;ae.push(ce)}}catch(ge){ve.e(ge)}finally{ve.f()}return ae}function J(R,z,Q){for(var ae=X(R),le=new Array(ae.length).fill(!1),ve=!0;ve;){ve=!1;for(var de=!0,ce=0;ce<ae.length;++ce)if(!le[ce]){var ge=ae[ce];if(te(ge))ae[ce]=ge.referToSelf.callback(Q),ae[ce].referToSelf=ge.referToSelf,le[ce]=!0,de=!1;else if(G(ge)){var Se=P(ge.referTo.references,ae,z);Se?(ae[ce]=ge.referTo.callback.apply(this,Se),ae[ce].referTo=ge.referTo,le[ce]=!0,de=!1):ve=!0}}if(de&&ve)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return ae}function ee(R){var z=/\bthis(\(|\.signatures\b)/;Object.keys(R).forEach(function(Q){var ae=R[Q];if(z.test(ae.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 K(R,z){if(u.createCount++,Object.keys(z).length===0)throw new SyntaxError("No signatures provided");u.warnAgainstDeprecatedThis&&ee(z);var Q=[],ae=[],le={},ve=[],de,ce=function(){if(!Object.prototype.hasOwnProperty.call(z,de))return"continue";var br=w(de);if(!br)return"continue";Q.forEach(function(on){if(W(on,br))throw new TypeError('Conflicting signatures "'+h(on)+'" and "'+h(br)+'".')}),Q.push(br);var _o=ae.length;ae.push(z[de]);var Ep=br.map(E),oa=void 0,ua=Xr(L(Ep)),Io;try{for(ua.s();!(Io=ua.n()).done;){oa=Io.value;var Ro=h(oa);ve.push({params:oa,name:Ro,fn:_o}),oa.every(function(on){return!on.hasConversion})&&(le[Ro]=_o)}}catch(on){ua.e(on)}finally{ua.f()}};for(de in z)var ge=ce();ve.sort(C);var Se=J(ae,le,Un),Ie;for(Ie in le)Object.prototype.hasOwnProperty.call(le,Ie)&&(le[Ie]=Se[le[Ie]]);for(var De=[],Je=new Map,ze=0,ir=ve;ze<ir.length;ze++)Ie=ir[ze],Je.has(Ie.name)||(Ie.fn=Se[Ie.fn],De.push(Ie),Je.set(Ie.name,Ie));for(var M=De[0]&&De[0].params.length<=2&&!x(De[0].params),Z=De[1]&&De[1].params.length<=2&&!x(De[1].params),ne=De[2]&&De[2].params.length<=2&&!x(De[2].params),ye=De[3]&&De[3].params.length<=2&&!x(De[3].params),Me=De[4]&&De[4].params.length<=2&&!x(De[4].params),Te=De[5]&&De[5].params.length<=2&&!x(De[5].params),pr=M&&Z&&ne&&ye&&Me&&Te,Ar=0;Ar<De.length;++Ar)De[Ar].test=A(De[Ar].params);for(var Lt=M?b(De[0].params[0]):Gr,ia=Z?b(De[1].params[0]):Gr,zn=ne?b(De[2].params[0]):Gr,jv=ye?b(De[3].params[0]):Gr,ep=Me?b(De[4].params[0]):Gr,rp=Te?b(De[5].params[0]):Gr,tp=M?b(De[0].params[1]):Gr,np=Z?b(De[1].params[1]):Gr,ap=ne?b(De[2].params[1]):Gr,ip=ye?b(De[3].params[1]):Gr,op=Me?b(De[4].params[1]):Gr,up=Te?b(De[5].params[1]):Gr,Pn=0;Pn<De.length;++Pn)De[Pn].implementation=H(De[Pn].params,De[Pn].fn);var sp=M?De[0].implementation:un,lp=Z?De[1].implementation:un,cp=ne?De[2].implementation:un,fp=ye?De[3].implementation:un,mp=Me?De[4].implementation:un,vp=Te?De[5].implementation:un,pp=M?De[0].params.length:-1,dp=Z?De[1].params.length:-1,hp=ne?De[2].params.length:-1,gp=ye?De[3].params.length:-1,yp=Me?De[4].params.length:-1,bp=Te?De[5].params.length:-1,xp=pr?6:0,wp=De.length,Np=De.map(function(zr){return zr.test}),Dp=De.map(function(zr){return zr.implementation}),Ap=function(){for(var br=xp;br<wp;br++)if(Np[br](arguments))return Dp[br].apply(this,arguments);return u.onMismatch(R,arguments,De)};function Un(zr,br){return arguments.length===pp&&Lt(zr)&&tp(br)?sp.apply(this,arguments):arguments.length===dp&&ia(zr)&&np(br)?lp.apply(this,arguments):arguments.length===hp&&zn(zr)&&ap(br)?cp.apply(this,arguments):arguments.length===gp&&jv(zr)&&ip(br)?fp.apply(this,arguments):arguments.length===yp&&ep(zr)&&op(br)?mp.apply(this,arguments):arguments.length===bp&&rp(zr)&&up(br)?vp.apply(this,arguments):Ap.apply(this,arguments)}try{Object.defineProperty(Un,"name",{value:R})}catch{}return Un.signatures=le,Un._typedFunctionData={signatures:De,signatureMap:Je},Un}function oe(R,z,Q){throw F(R,z,Q)}function se(R){return re(R,0,R.length-1)}function ie(R){return R[R.length-1]}function re(R,z,Q){return Array.prototype.slice.call(R,z,Q)}function pe(R,z){for(var Q=0;Q<R.length;Q++)if(z(R[Q]))return R[Q]}function Ae(R,z){return Array.prototype.concat.apply([],R.map(z))}function be(){var R=se(arguments).map(function(Q){return h(w(Q))}),z=ie(arguments);if(typeof z!="function")throw new TypeError("Callback function expected as last argument");return Ne(R,z)}function Ne(R,z){return{referTo:{references:R,callback:z}}}function U(R){if(typeof R!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:R}}}function G(R){return R&&fn(R.referTo)==="object"&&Array.isArray(R.referTo.references)&&typeof R.referTo.callback=="function"}function te(R){return R&&fn(R.referToSelf)==="object"&&typeof R.referToSelf.callback=="function"}function k(R,z){if(!R)return z;if(z&&z!==R){var Q=new Error("Function names do not match (expected: "+R+", actual: "+z+")");throw Q.data={actual:z,expected:R},Q}return R}function Y(R){var z;for(var Q in R)Object.prototype.hasOwnProperty.call(R,Q)&&(m(R[Q])||typeof R[Q].signature=="string")&&(z=k(z,R[Q].name));return z}function j(R,z){var Q;for(Q in z)if(Object.prototype.hasOwnProperty.call(z,Q)){if(Q in R&&z[Q]!==R[Q]){var ae=new Error('Signature "'+Q+'" is defined twice');throw ae.data={signature:Q,sourceFunction:z[Q],destFunction:R[Q]},ae}R[Q]=z[Q]}}var fe=u;u=function(z){for(var Q=typeof z=="string",ae=Q?1:0,le=Q?z:"",ve={},de=ae;de<arguments.length;++de){var ce=arguments[de],ge={},Se=void 0;if(typeof ce=="function"?(Se=ce.name,typeof ce.signature=="string"?ge[ce.signature]=ce:m(ce)&&(ge=ce.signatures)):e(ce)&&(ge=ce,Q||(Se=Y(ce))),Object.keys(ge).length===0){var Ie=new TypeError("Argument to 'typed' at index "+de+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw Ie.data={index:de,argument:ce},Ie}Q||(le=k(le,Se)),j(ve,ge)}return K(le||"",ve)},u.create=uf,u.createCount=fe.createCount,u.onMismatch=oe,u.throwMismatchError=oe,u.createError=F,u.clear=l,u.clearConversions=o,u.addTypes=c,u._findType=f,u.referTo=be,u.referToSelf=U,u.convert=p,u.findSignature=v,u.find=d,u.isTypedFunction=m,u.warnAgainstDeprecatedThis=!0,u.addType=function(R,z){var Q="any";z!==!1&&a.has("Object")&&(Q="Object"),u.addTypes([R],Q)};function ue(R){if(!R||typeof R.from!="string"||typeof R.to!="string"||typeof R.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(R.to===R.from)throw new SyntaxError('Illegal to define conversion from "'+R.from+'" to itself.')}return u.addConversion=function(R){ue(R);var z=f(R.to);if(z.conversionsTo.every(function(Q){return Q.from!==R.from}))z.conversionsTo.push({from:R.from,convert:R.convert,index:n++});else throw new Error('There is already a conversion from "'+R.from+'" to "'+z.name+'"')},u.addConversions=function(R){R.forEach(u.addConversion)},u.removeConversion=function(R){ue(R);var z=f(R.to),Q=pe(z.conversionsTo,function(le){return le.from===R.from});if(!Q)throw new Error("Attempt to remove nonexistent conversion from "+R.from+" to "+R.to);if(Q.convert!==R.convert)throw new Error("Conversion to remove does not match existing conversion");var ae=z.conversionsTo.indexOf(Q);z.conversionsTo.splice(ae,1)},u.resolve=function(R,z){if(!m(R))throw new TypeError(Uo);for(var Q=R._typedFunctionData.signatures,ae=0;ae<Q.length;++ae)if(Q[ae].test(z))return Q[ae];return null},u}const mn=uf();function Ce(e){return typeof e=="boolean"?!0:isFinite(e)?e===Math.round(e):!1}var Bt=Math.sign||function(e){return e>0?1:e<0?-1:0},id=Math.log2||function(r){return Math.log(r)/Math.LN2},od=Math.log10||function(r){return Math.log(r)/Math.LN10},ud=Math.log1p||function(e){return Math.log(e+1)},sd=Math.cbrt||function(r){if(r===0)return r;var i=r<0,a;return i&&(r=-r),isFinite(r)?(a=Math.exp(Math.log(r)/3),a=(r/(a*a)+2*a)/3):a=r,i?-a:a},ld=Math.expm1||function(r){return r>=2e-4||r<=-2e-4?Math.exp(r)-1:r+r*r/2+r*r*r/6};function gi(e,r,i){var a={2:"0b",8:"0o",16:"0x"},t=a[r],n="";if(i){if(i<1)throw new Error("size must be in greater than 0");if(!Ce(i))throw new Error("size must be an integer");if(e>2**(i-1)-1||e<-(2**(i-1)))throw new Error("Value must be in range [-2^".concat(i-1,", 2^").concat(i-1,"-1]"));if(!Ce(e))throw new Error("Value must be an integer");e<0&&(e=e+2**i),n="i".concat(i)}var u="";return e<0&&(e=-e,u="-"),"".concat(u).concat(t).concat(e.toString(r)).concat(n)}function Ht(e,r){if(typeof r=="function")return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var i="auto",a,t;if(r&&(r.notation&&(i=r.notation),Ve(r)?a=r:Ve(r.precision)&&(a=r.precision),r.wordSize&&(t=r.wordSize,typeof t!="number")))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return sf(e,a);case"exponential":return lf(e,a);case"engineering":return cd(e,a);case"bin":return gi(e,2,t);case"oct":return gi(e,8,t);case"hex":return gi(e,16,t);case"auto":return fd(e,a,r&&r).replace(/((\.\d*?)(0+))($|e)/,function(){var n=arguments[2],u=arguments[4];return n!=="."?n+u:u});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ja(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var i=r[1],a=r[2],t=parseFloat(r[4]||"0"),n=a.indexOf(".");t+=n!==-1?n-1:a.length-1;var u=a.replace(".","").replace(/^0*/,function(f){return t-=f.length,""}).replace(/0*$/,"").split("").map(function(f){return parseInt(f)});return u.length===0&&(u.push(0),t++),{sign:i,coefficients:u,exponent:t}}function cd(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=Ja(e),a=Qa(i,r),t=a.exponent,n=a.coefficients,u=t%3===0?t:t<0?t-3-t%3:t-t%3;if(Ve(r))for(;r>n.length||t-u+1>n.length;)n.push(0);else for(var f=Math.abs(t-u)-(n.length-1),c=0;c<f;c++)n.push(0);for(var l=Math.abs(t-u),o=1;l>0;)o++,l--;var s=n.slice(o).join(""),m=Ve(r)&&s.length||s.match(/[1-9]/)?"."+s:"",v=n.slice(0,o).join("")+m+"e"+(t>=0?"+":"")+u.toString();return a.sign+v}function sf(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=Ja(e),a=typeof r=="number"?Qa(i,i.exponent+1+r):i,t=a.coefficients,n=a.exponent+1,u=n+(r||0);return t.length<u&&(t=t.concat(pn(u-t.length))),n<0&&(t=pn(-n+1).concat(t),n=1),n<t.length&&t.splice(n,0,n===0?"0.":"."),a.sign+t.join("")}function lf(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=Ja(e),a=r?Qa(i,r):i,t=a.coefficients,n=a.exponent;t.length<r&&(t=t.concat(pn(r-t.length)));var u=t.shift();return a.sign+u+(t.length>0?"."+t.join(""):"")+"e"+(n>=0?"+":"")+n}function fd(e,r,i){if(isNaN(e)||!isFinite(e))return String(e);var a=i&&i.lowerExp!==void 0?i.lowerExp:-3,t=i&&i.upperExp!==void 0?i.upperExp:5,n=Ja(e),u=r?Qa(n,r):n;if(u.exponent<a||u.exponent>=t)return lf(e,r);var f=u.coefficients,c=u.exponent;f.length<r&&(f=f.concat(pn(r-f.length))),f=f.concat(pn(c-f.length+1+(f.length<r?r-f.length:0))),f=pn(-c).concat(f);var l=c>0?c:0;return l<f.length-1&&f.splice(l+1,0,"."),u.sign+f.join("")}function Qa(e,r){for(var i={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},a=i.coefficients;r<=0;)a.unshift(0),i.exponent++,r++;if(a.length>r){var t=a.splice(r,a.length-r);if(t[0]>=5){var n=r-1;for(a[n]++;a[n]===10;)a.pop(),n===0&&(a.unshift(0),i.exponent++,n++),n--,a[n]++}}return i}function pn(e){for(var r=[],i=0;i<e;i++)r.push(0);return r}function md(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var vd=Number.EPSILON||2220446049250313e-31;function Pr(e,r,i){if(i==null)return e===r;if(e===r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var a=Math.abs(e-r);return a<vd?!0:a<=Math.max(Math.abs(e),Math.abs(r))*i}return!1}var pd=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},dd=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},hd=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},gd=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},yd=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},bd=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function xd(e,r){var i=e>0?!0:e<0?!1:1/e===1/0,a=r>0?!0:r<0?!1:1/r===1/0;return i^a?-e:e}function yi(e,r,i){var a=e.constructor,t=new a(2),n="";if(i){if(i<1)throw new Error("size must be in greater than 0");if(!Ce(i))throw new Error("size must be an integer");if(e.greaterThan(t.pow(i-1).sub(1))||e.lessThan(t.pow(i-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(i-1,", 2^").concat(i-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(t.pow(i))),n="i".concat(i)}switch(r){case 2:return"".concat(e.toBinary()).concat(n);case 8:return"".concat(e.toOctal()).concat(n);case 16:return"".concat(e.toHexadecimal()).concat(n);default:throw new Error("Base ".concat(r," not supported "))}}function wd(e,r){if(typeof r=="function")return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var i="auto",a,t;if(r!==void 0&&(r.notation&&(i=r.notation),typeof r=="number"?a=r:r.precision!==void 0&&(a=r.precision),r.wordSize&&(t=r.wordSize,typeof t!="number")))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return Dd(e,a);case"exponential":return Lo(e,a);case"engineering":return Nd(e,a);case"bin":return yi(e,2,t);case"oct":return yi(e,8,t);case"hex":return yi(e,16,t);case"auto":{var n=r&&r.lowerExp!==void 0?r.lowerExp:-3,u=r&&r.upperExp!==void 0?r.upperExp:5;if(e.isZero())return"0";var f,c=e.toSignificantDigits(a),l=c.e;return l>=n&&l<u?f=c.toFixed():f=Lo(e,a),f.replace(/((\.\d*?)(0+))($|e)/,function(){var o=arguments[2],s=arguments[4];return o!=="."?o+s:s})}default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Nd(e,r){var i=e.e,a=i%3===0?i:i<0?i-3-i%3:i-i%3,t=e.mul(Math.pow(10,-a)),n=t.toPrecision(r);if(n.indexOf("e")!==-1){var u=e.constructor;n=new u(n).toFixed()}return n+"e"+(i>=0?"+":"")+a.toString()}function Lo(e,r){return r!==void 0?e.toExponential(r-1):e.toExponential()}function Dd(e,r){return e.toFixed(r)}function Ad(e,r){var i=e.length-r.length,a=e.length;return e.substring(i,a)===r}function Pe(e,r){var i=Ed(e,r);return r&&typeof r=="object"&&"truncate"in r&&i.length>r.truncate?i.substring(0,r.truncate-3)+"...":i}function Ed(e,r){if(typeof e=="number")return Ht(e,r);if(ke(e))return wd(e,r);if(Sd(e))return!r||r.fraction!=="decimal"?e.s*e.n+"/"+e.d:e.toString();if(Array.isArray(e))return cf(e,r);if(Br(e))return'"'+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(r);if(e&&e.toString(r)!=={}.toString())return e.toString(r);var i=Object.keys(e).map(a=>'"'+a+'": '+Pe(e[a],r));return"{"+i.join(", ")+"}"}return String(e)}function sa(e){for(var r=String(e),i="",a=0;a<r.length;){var t=r.charAt(a);t==="\\"?(i+=t,a++,t=r.charAt(a),(t===""||'"\\/bfnrtu'.indexOf(t)===-1)&&(i+="\\"),i+=t):t==='"'?i+='\\"':i+=t,a++}return'"'+i+'"'}function Yr(e){var r=String(e);return r=r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),r}function cf(e,r){if(Array.isArray(e)){for(var i="[",a=e.length,t=0;t<a;t++)t!==0&&(i+=", "),i+=cf(e[t],r);return i+="]",i}else return Pe(e,r)}function Sd(e){return e&&typeof e=="object"&&typeof e.s=="number"&&typeof e.n=="number"&&typeof e.d=="number"||!1}function Ci(e,r){if(!Br(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(e)+", index: 0)");if(!Br(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+nr(r)+", index: 1)");return e===r?0:e>r?1:-1}function Le(e,r,i){if(!(this instanceof Le))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=i,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=new Error().stack}Le.prototype=new RangeError;Le.prototype.constructor=RangeError;Le.prototype.name="DimensionError";Le.prototype.isDimensionError=!0;function rt(e,r,i){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=r):(this.min=r,this.max=i),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 Ge(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function ff(e,r,i){var a,t=e.length;if(t!==r[i])throw new Le(t,r[i]);if(i<r.length-1){var n=i+1;for(a=0;a<t;a++){var u=e[a];if(!Array.isArray(u))throw new Le(r.length-1,r.length,"<");ff(e[a],r,n)}}else for(a=0;a<t;a++)if(Array.isArray(e[a]))throw new Le(r.length+1,r.length,">")}function ko(e,r){var i=r.length===0;if(i){if(Array.isArray(e))throw new Le(e.length,0)}else ff(e,r,0)}function rr(e,r){if(!Ve(e)||!Ce(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||typeof r=="number"&&e>=r)throw new rt(e,r)}function gn(e,r,i){if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(r.length===0)throw new Error("Resizing to scalar is not supported");r.forEach(function(t){if(!Ve(t)||!Ce(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Pe(r)+")")});var a=i!==void 0?i:0;return Mi(e,r,0,a),e}function Mi(e,r,i,a){var t,n,u=e.length,f=r[i],c=Math.min(u,f);if(e.length=f,i<r.length-1){var l=i+1;for(t=0;t<c;t++)n=e[t],Array.isArray(n)||(n=[n],e[t]=n),Mi(n,r,l,a);for(t=c;t<f;t++)n=[],e[t]=n,Mi(n,r,l,a)}else{for(t=0;t<c;t++)for(;Array.isArray(e[t]);)e[t]=e[t][0];for(t=c;t<f;t++)e[t]=a}}function mf(e,r){var i=Xe(e),a=i.length;if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(r.length===0)throw new Le(0,a,"!=");r=Gi(r,a);var t=vf(r);if(a!==t)throw new Le(t,a,"!=");try{return Cd(i,r)}catch(n){throw n instanceof Le?new Le(t,a,"!="):n}}function Gi(e,r){var i=vf(e),a=e.slice(),t=-1,n=e.indexOf(t),u=e.indexOf(t,n+1)>=0;if(u)throw new Error("More than one wildcard in sizes");var f=n>=0,c=r%i===0;if(f)if(c)a[n]=-r/i;else throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-i);return a}function vf(e){return e.reduce((r,i)=>r*i,1)}function Cd(e,r){for(var i=e,a,t=r.length-1;t>0;t--){var n=r[t];a=[];for(var u=i.length/n,f=0;f<u;f++)a.push(i.slice(f*n,(f+1)*n));i=a}return i}function Fa(e,r){for(var i=r||Ge(e);Array.isArray(e)&&e.length===1;)e=e[0],i.shift();for(var a=i.length;i[a-1]===1;)a--;return a<i.length&&(e=pf(e,a,0),i.length=a),e}function pf(e,r,i){var a,t;if(i<r){var n=i+1;for(a=0,t=e.length;a<t;a++)e[a]=pf(e[a],r,n)}else for(;Array.isArray(e);)e=e[0];return e}function df(e,r,i,a){var t=a||Ge(e);if(i)for(var n=0;n<i;n++)e=[e],t.unshift(1);for(e=hf(e,r,0);t.length<r;)t.push(1);return e}function hf(e,r,i){var a,t;if(Array.isArray(e)){var n=i+1;for(a=0,t=e.length;a<t;a++)e[a]=hf(e[a],r,n)}else for(var u=i;u<r;u++)e=[e];return e}function Xe(e){if(!Array.isArray(e))return e;var r=[];return e.forEach(function i(a){Array.isArray(a)?a.forEach(i):r.push(a)}),r}function Nt(e,r){return Array.prototype.map.call(e,r)}function Ka(e,r){Array.prototype.forEach.call(e,r)}function gf(e,r){if(Ge(e).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,r)}function Ba(e,r){if(Ge(e).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,i=>r.test(i))}function Ho(e,r){return Array.prototype.join.call(e,r)}function yn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;var r=[],i=0;r[0]={value:e[0],identifier:0};for(var a=1;a<e.length;a++)e[a]===e[a-1]?i++:i=0,r.push({value:e[a],identifier:i});return r}function Ta(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(e.length===0)return e;for(var r=[],i=0;i<e.length;i++)r.push(e[i].value);return r}function Vn(e,r){for(var i,a=0,t=0;t<e.length;t++){var n=e[t],u=Array.isArray(n);if(t===0&&u&&(a=n.length),u&&n.length!==a)return;var f=u?Vn(n,r):r(n);if(i===void 0)i=f;else if(i!==f)return"mixed"}return i}function I(e,r,i,a){function t(n){var u=rd(n,r.map(Bd));return Md(e,r,n),i(u)}return t.isFactory=!0,t.fn=e,t.dependencies=r.slice().sort(),a&&(t.meta=a),t}function Md(e,r,i){var a=r.filter(n=>!Fd(n)).every(n=>i[n]!==void 0);if(!a){var t=r.filter(n=>i[n]===void 0);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(t.map(n=>'"'.concat(n,'"')).join(", "),"."))}}function Fd(e){return e&&e[0]==="?"}function Bd(e){return e&&e[0]==="?"?e.slice(1):e}function Tr(e,r){if(bf(e)&&yf(e,r))return e[r];throw typeof e[r]=="function"&&Vi(e,r)?new Error('Cannot access method "'+r+'" as a property'):new Error('No access to property "'+r+'"')}function bn(e,r,i){if(bf(e)&&yf(e,r))return e[r]=i,i;throw new Error('No access to property "'+r+'"')}function Td(e,r){return r in e}function yf(e,r){return!e||typeof e!="object"?!1:Ee($d,r)?!0:!(r in Object.prototype||r in Function.prototype)}function Od(e,r){if(!Vi(e,r))throw new Error('No access to method "'+r+'"');return e[r]}function Vi(e,r){return e==null||typeof e[r]!="function"||Ee(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e)?!1:Ee(_d,r)?!0:!(r in Object.prototype||r in Function.prototype)}function bf(e){return typeof e=="object"&&e&&e.constructor===Object}var $d={length:!0,name:!0},_d={toString:!0,valueOf:!0,toLocaleString:!0};class Zi{constructor(r){this.wrappedObject=r}keys(){return Object.keys(this.wrappedObject)}get(r){return Tr(this.wrappedObject,r)}set(r,i){return bn(this.wrappedObject,r,i),this}has(r){return Td(this.wrappedObject,r)}}function xn(){return new Map}function dn(e){if(!e)return xn();if(Yi(e))return e;if(Hi(e))return new Zi(e);throw new Error("createMap can create maps from objects or Maps")}function Id(e){if(e instanceof Zi)return e.wrappedObject;var r={};for(var i of e.keys()){var a=e.get(i);bn(r,i,a)}return r}function Yi(e){return e?e instanceof Map||e instanceof Zi||typeof e.set=="function"&&typeof e.get=="function"&&typeof e.keys=="function"&&typeof e.has=="function":!1}function Go(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];for(var t of i)if(t){if(Yi(t))for(var n of t.keys())e.set(n,t.get(n));else if(Hi(t))for(var u of Object.keys(t))e.set(u,t[u])}return e}var xf=function(){return xf=mn.create,mn},Rd=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],qd=I("typed",Rd,function(r){var{BigNumber:i,Complex:a,DenseMatrix:t,Fraction:n}=r,u=xf();return u.clear(),u.addTypes([{name:"number",test:Ve},{name:"Complex",test:wt},{name:"BigNumber",test:ke},{name:"Fraction",test:Jn},{name:"Unit",test:Zr},{name:"identifier",test:f=>Br&&/^(?:[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-\u1C88\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-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\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\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\uDE80-\uDEA9\uDEB0\uDEB1\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]|\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]|\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\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\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\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]|\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-\u1C88\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-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\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\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\uDE80-\uDEA9\uDEB0\uDEB1\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]|\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]|\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\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\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\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]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(f)},{name:"string",test:Br},{name:"Chain",test:af},{name:"Array",test:je},{name:"Matrix",test:Be},{name:"DenseMatrix",test:Ma},{name:"SparseMatrix",test:kt},{name:"Range",test:ki},{name:"Index",test:Wa},{name:"boolean",test:Lp},{name:"ResultSet",test:kp},{name:"Help",test:nf},{name:"function",test:Hp},{name:"Date",test:Gp},{name:"RegExp",test:Vp},{name:"null",test:Zp},{name:"undefined",test:Yp},{name:"AccessorNode",test:Gt},{name:"ArrayNode",test:Vr},{name:"AssignmentNode",test:Wp},{name:"BlockNode",test:Xp},{name:"ConditionalNode",test:Jp},{name:"ConstantNode",test:We},{name:"FunctionNode",test:Ot},{name:"FunctionAssignmentNode",test:Qn},{name:"IndexNode",test:An},{name:"Node",test:er},{name:"ObjectNode",test:Xa},{name:"OperatorNode",test:mr},{name:"ParenthesisNode",test:Dt},{name:"RangeNode",test:Qp},{name:"RelationalNode",test:Kp},{name:"SymbolNode",test:yr},{name:"Map",test:Yi},{name:"Object",test:Hi}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(c){if(i||bi(c),md(c)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+c+"). Use function bignumber(x) to convert to BigNumber.");return new i(c)}},{from:"number",to:"Complex",convert:function(c){return a||la(c),new a(c,0)}},{from:"BigNumber",to:"Complex",convert:function(c){return a||la(c),new a(c.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(c){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(c){return a||la(c),new a(c.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(c){n||xi(c);var l=new n(c);if(l.valueOf()!==c)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+c+"). Use function fraction(x) to convert to Fraction.");return l}},{from:"string",to:"number",convert:function(c){var l=Number(c);if(isNaN(l))throw new Error('Cannot convert "'+c+'" to a number');return l}},{from:"string",to:"BigNumber",convert:function(c){i||bi(c);try{return new i(c)}catch{throw new Error('Cannot convert "'+c+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(c){n||xi(c);try{return new n(c)}catch{throw new Error('Cannot convert "'+c+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(c){a||la(c);try{return new a(c)}catch{throw new Error('Cannot convert "'+c+'" to Complex')}}},{from:"boolean",to:"number",convert:function(c){return+c}},{from:"boolean",to:"BigNumber",convert:function(c){return i||bi(c),new i(+c)}},{from:"boolean",to:"Fraction",convert:function(c){return n||xi(c),new n(+c)}},{from:"boolean",to:"string",convert:function(c){return String(c)}},{from:"Array",to:"Matrix",convert:function(c){return t||zd(),new t(c)}},{from:"Matrix",to:"Array",convert:function(c){return c.valueOf()}}]),u.onMismatch=(f,c,l)=>{var o=u.createError(f,c,l);if(["wrongType","mismatch"].includes(o.data.category)&&c.length===1&&st(c[0])&&l.some(m=>!m.params.includes(","))){var s=new TypeError("Function '".concat(f,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(f,")'."));throw s.data=o.data,s}throw o},u.onMismatch=(f,c,l)=>{var o=u.createError(f,c,l);if(["wrongType","mismatch"].includes(o.data.category)&&c.length===1&&st(c[0])&&l.some(m=>!m.params.includes(","))){var s=new TypeError("Function '".concat(f,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(f,")'."));throw s.data=o.data,s}throw o},u});function bi(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function la(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function zd(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function xi(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var Pd="ResultSet",Ud=[],Ld=I(Pd,Ud,()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e},{isClass:!0});/*!
|
||
* decimal.js v10.4.3
|
||
* An arbitrary-precision Decimal type for JavaScript.
|
||
* https://github.com/MikeMcl/decimal.js
|
||
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
||
* MIT Licence
|
||
*/var vn=9e15,It=1e9,Fi="0123456789abcdef",Oa="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$a="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Bi={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-vn,maxE:vn,crypto:!1},wf,bt,Re=!0,ja="[DecimalError] ",$t=ja+"Invalid argument: ",Nf=ja+"Precision limit exceeded",Df=ja+"crypto unavailable",Af="[object Decimal]",Sr=Math.floor,dr=Math.pow,kd=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Hd=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Gd=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ef=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kr=1e7,Oe=7,Vd=9007199254740991,Zd=Oa.length-1,Ti=$a.length-1,he={toStringTag:Af};he.absoluteValue=he.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Fe(e)};he.ceil=function(){return Fe(new this.constructor(this),this.e+1,2)};he.clampedTo=he.clamp=function(e,r){var i,a=this,t=a.constructor;if(e=new t(e),r=new t(r),!e.s||!r.s)return new t(NaN);if(e.gt(r))throw Error($t+r);return i=a.cmp(e),i<0?e:a.cmp(r)>0?r:new t(a)};he.comparedTo=he.cmp=function(e){var r,i,a,t,n=this,u=n.d,f=(e=new n.constructor(e)).d,c=n.s,l=e.s;if(!u||!f)return!c||!l?NaN:c!==l?c:u===f?0:!u^c<0?1:-1;if(!u[0]||!f[0])return u[0]?c:f[0]?-l:0;if(c!==l)return c;if(n.e!==e.e)return n.e>e.e^c<0?1:-1;for(a=u.length,t=f.length,r=0,i=a<t?a:t;r<i;++r)if(u[r]!==f[r])return u[r]>f[r]^c<0?1:-1;return a===t?0:a>t^c<0?1:-1};he.cosine=he.cos=function(){var e,r,i=this,a=i.constructor;return i.d?i.d[0]?(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+Oe,a.rounding=1,i=Yd(a,Bf(a,i)),a.precision=e,a.rounding=r,Fe(bt==2||bt==3?i.neg():i,e,r,!0)):new a(1):new a(NaN)};he.cubeRoot=he.cbrt=function(){var e,r,i,a,t,n,u,f,c,l,o=this,s=o.constructor;if(!o.isFinite()||o.isZero())return new s(o);for(Re=!1,n=o.s*dr(o.s*o,1/3),!n||Math.abs(n)==1/0?(i=Nr(o.d),e=o.e,(n=(e-i.length+1)%3)&&(i+=n==1||n==-2?"0":"00"),n=dr(i,1/3),e=Sr((e+1)/3)-(e%3==(e<0?-1:2)),n==1/0?i="5e"+e:(i=n.toExponential(),i=i.slice(0,i.indexOf("e")+1)+e),a=new s(i),a.s=o.s):a=new s(n.toString()),u=(e=s.precision)+3;;)if(f=a,c=f.times(f).times(f),l=c.plus(o),a=lr(l.plus(o).times(f),l.plus(c),u+2,1),Nr(f.d).slice(0,u)===(i=Nr(a.d)).slice(0,u))if(i=i.slice(u-3,u+1),i=="9999"||!t&&i=="4999"){if(!t&&(Fe(f,e+1,0),f.times(f).times(f).eq(o))){a=f;break}u+=4,t=1}else{(!+i||!+i.slice(1)&&i.charAt(0)=="5")&&(Fe(a,e+1,1),r=!a.times(a).times(a).eq(o));break}return Re=!0,Fe(a,e,s.rounding,r)};he.decimalPlaces=he.dp=function(){var e,r=this.d,i=NaN;if(r){if(e=r.length-1,i=(e-Sr(this.e/Oe))*Oe,e=r[e],e)for(;e%10==0;e/=10)i--;i<0&&(i=0)}return i};he.dividedBy=he.div=function(e){return lr(this,new this.constructor(e))};he.dividedToIntegerBy=he.divToInt=function(e){var r=this,i=r.constructor;return Fe(lr(r,new i(e),0,1,1),i.precision,i.rounding)};he.equals=he.eq=function(e){return this.cmp(e)===0};he.floor=function(){return Fe(new this.constructor(this),this.e+1,3)};he.greaterThan=he.gt=function(e){return this.cmp(e)>0};he.greaterThanOrEqualTo=he.gte=function(e){var r=this.cmp(e);return r==1||r===0};he.hyperbolicCosine=he.cosh=function(){var e,r,i,a,t,n=this,u=n.constructor,f=new u(1);if(!n.isFinite())return new u(n.s?1/0:NaN);if(n.isZero())return f;i=u.precision,a=u.rounding,u.precision=i+Math.max(n.e,n.sd())+4,u.rounding=1,t=n.d.length,t<32?(e=Math.ceil(t/3),r=(1/ri(4,e)).toString()):(e=16,r="2.3283064365386962890625e-10"),n=wn(u,1,n.times(r),new u(1),!0);for(var c,l=e,o=new u(8);l--;)c=n.times(n),n=f.minus(c.times(o.minus(c.times(o))));return Fe(n,u.precision=i,u.rounding=a,!0)};he.hyperbolicSine=he.sinh=function(){var e,r,i,a,t=this,n=t.constructor;if(!t.isFinite()||t.isZero())return new n(t);if(r=n.precision,i=n.rounding,n.precision=r+Math.max(t.e,t.sd())+4,n.rounding=1,a=t.d.length,a<3)t=wn(n,2,t,t,!0);else{e=1.4*Math.sqrt(a),e=e>16?16:e|0,t=t.times(1/ri(5,e)),t=wn(n,2,t,t,!0);for(var u,f=new n(5),c=new n(16),l=new n(20);e--;)u=t.times(t),t=t.times(f.plus(u.times(c.times(u).plus(l))))}return n.precision=r,n.rounding=i,Fe(t,r,i,!0)};he.hyperbolicTangent=he.tanh=function(){var e,r,i=this,a=i.constructor;return i.isFinite()?i.isZero()?new a(i):(e=a.precision,r=a.rounding,a.precision=e+7,a.rounding=1,lr(i.sinh(),i.cosh(),a.precision=e,a.rounding=r)):new a(i.s)};he.inverseCosine=he.acos=function(){var e,r=this,i=r.constructor,a=r.abs().cmp(1),t=i.precision,n=i.rounding;return a!==-1?a===0?r.isNeg()?Qr(i,t,n):new i(0):new i(NaN):r.isZero()?Qr(i,t+4,n).times(.5):(i.precision=t+6,i.rounding=1,r=r.asin(),e=Qr(i,t+4,n).times(.5),i.precision=t,i.rounding=n,e.minus(r))};he.inverseHyperbolicCosine=he.acosh=function(){var e,r,i=this,a=i.constructor;return i.lte(1)?new a(i.eq(1)?0:NaN):i.isFinite()?(e=a.precision,r=a.rounding,a.precision=e+Math.max(Math.abs(i.e),i.sd())+4,a.rounding=1,Re=!1,i=i.times(i).minus(1).sqrt().plus(i),Re=!0,a.precision=e,a.rounding=r,i.ln()):new a(i)};he.inverseHyperbolicSine=he.asinh=function(){var e,r,i=this,a=i.constructor;return!i.isFinite()||i.isZero()?new a(i):(e=a.precision,r=a.rounding,a.precision=e+2*Math.max(Math.abs(i.e),i.sd())+6,a.rounding=1,Re=!1,i=i.times(i).plus(1).sqrt().plus(i),Re=!0,a.precision=e,a.rounding=r,i.ln())};he.inverseHyperbolicTangent=he.atanh=function(){var e,r,i,a,t=this,n=t.constructor;return t.isFinite()?t.e>=0?new n(t.abs().eq(1)?t.s/0:t.isZero()?t:NaN):(e=n.precision,r=n.rounding,a=t.sd(),Math.max(a,e)<2*-t.e-1?Fe(new n(t),e,r,!0):(n.precision=i=a-t.e,t=lr(t.plus(1),new n(1).minus(t),i+e,1),n.precision=e+4,n.rounding=1,t=t.ln(),n.precision=e,n.rounding=r,t.times(.5))):new n(NaN)};he.inverseSine=he.asin=function(){var e,r,i,a,t=this,n=t.constructor;return t.isZero()?new n(t):(r=t.abs().cmp(1),i=n.precision,a=n.rounding,r!==-1?r===0?(e=Qr(n,i+4,a).times(.5),e.s=t.s,e):new n(NaN):(n.precision=i+6,n.rounding=1,t=t.div(new n(1).minus(t.times(t)).sqrt().plus(1)).atan(),n.precision=i,n.rounding=a,t.times(2)))};he.inverseTangent=he.atan=function(){var e,r,i,a,t,n,u,f,c,l=this,o=l.constructor,s=o.precision,m=o.rounding;if(l.isFinite()){if(l.isZero())return new o(l);if(l.abs().eq(1)&&s+4<=Ti)return u=Qr(o,s+4,m).times(.25),u.s=l.s,u}else{if(!l.s)return new o(NaN);if(s+4<=Ti)return u=Qr(o,s+4,m).times(.5),u.s=l.s,u}for(o.precision=f=s+10,o.rounding=1,i=Math.min(28,f/Oe+2|0),e=i;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(Re=!1,r=Math.ceil(f/Oe),a=1,c=l.times(l),u=new o(l),t=l;e!==-1;)if(t=t.times(c),n=u.minus(t.div(a+=2)),t=t.times(c),u=n.plus(t.div(a+=2)),u.d[r]!==void 0)for(e=r;u.d[e]===n.d[e]&&e--;);return i&&(u=u.times(2<<i-1)),Re=!0,Fe(u,o.precision=s,o.rounding=m,!0)};he.isFinite=function(){return!!this.d};he.isInteger=he.isInt=function(){return!!this.d&&Sr(this.e/Oe)>this.d.length-2};he.isNaN=function(){return!this.s};he.isNegative=he.isNeg=function(){return this.s<0};he.isPositive=he.isPos=function(){return this.s>0};he.isZero=function(){return!!this.d&&this.d[0]===0};he.lessThan=he.lt=function(e){return this.cmp(e)<0};he.lessThanOrEqualTo=he.lte=function(e){return this.cmp(e)<1};he.logarithm=he.log=function(e){var r,i,a,t,n,u,f,c,l=this,o=l.constructor,s=o.precision,m=o.rounding,v=5;if(e==null)e=new o(10),r=!0;else{if(e=new o(e),i=e.d,e.s<0||!i||!i[0]||e.eq(1))return new o(NaN);r=e.eq(10)}if(i=l.d,l.s<0||!i||!i[0]||l.eq(1))return new o(i&&!i[0]?-1/0:l.s!=1?NaN:i?0:1/0);if(r)if(i.length>1)n=!0;else{for(t=i[0];t%10===0;)t/=10;n=t!==1}if(Re=!1,f=s+v,u=Tt(l,f),a=r?_a(o,f+10):Tt(e,f),c=lr(u,a,f,1),Zn(c.d,t=s,m))do if(f+=10,u=Tt(l,f),a=r?_a(o,f+10):Tt(e,f),c=lr(u,a,f,1),!n){+Nr(c.d).slice(t+1,t+15)+1==1e14&&(c=Fe(c,s+1,0));break}while(Zn(c.d,t+=10,m));return Re=!0,Fe(c,s,m)};he.minus=he.sub=function(e){var r,i,a,t,n,u,f,c,l,o,s,m,v=this,d=v.constructor;if(e=new d(e),!v.d||!e.d)return!v.s||!e.s?e=new d(NaN):v.d?e.s=-e.s:e=new d(e.d||v.s!==e.s?v:NaN),e;if(v.s!=e.s)return e.s=-e.s,v.plus(e);if(l=v.d,m=e.d,f=d.precision,c=d.rounding,!l[0]||!m[0]){if(m[0])e.s=-e.s;else if(l[0])e=new d(v);else return new d(c===3?-0:0);return Re?Fe(e,f,c):e}if(i=Sr(e.e/Oe),o=Sr(v.e/Oe),l=l.slice(),n=o-i,n){for(s=n<0,s?(r=l,n=-n,u=m.length):(r=m,i=o,u=l.length),a=Math.max(Math.ceil(f/Oe),u)+2,n>a&&(n=a,r.length=1),r.reverse(),a=n;a--;)r.push(0);r.reverse()}else{for(a=l.length,u=m.length,s=a<u,s&&(u=a),a=0;a<u;a++)if(l[a]!=m[a]){s=l[a]<m[a];break}n=0}for(s&&(r=l,l=m,m=r,e.s=-e.s),u=l.length,a=m.length-u;a>0;--a)l[u++]=0;for(a=m.length;a>n;){if(l[--a]<m[a]){for(t=a;t&&l[--t]===0;)l[t]=Kr-1;--l[t],l[a]+=Kr}l[a]-=m[a]}for(;l[--u]===0;)l.pop();for(;l[0]===0;l.shift())--i;return l[0]?(e.d=l,e.e=ei(l,i),Re?Fe(e,f,c):e):new d(c===3?-0:0)};he.modulo=he.mod=function(e){var r,i=this,a=i.constructor;return e=new a(e),!i.d||!e.s||e.d&&!e.d[0]?new a(NaN):!e.d||i.d&&!i.d[0]?Fe(new a(i),a.precision,a.rounding):(Re=!1,a.modulo==9?(r=lr(i,e.abs(),0,3,1),r.s*=e.s):r=lr(i,e,0,a.modulo,1),r=r.times(e),Re=!0,i.minus(r))};he.naturalExponential=he.exp=function(){return Oi(this)};he.naturalLogarithm=he.ln=function(){return Tt(this)};he.negated=he.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Fe(e)};he.plus=he.add=function(e){var r,i,a,t,n,u,f,c,l,o,s=this,m=s.constructor;if(e=new m(e),!s.d||!e.d)return!s.s||!e.s?e=new m(NaN):s.d||(e=new m(e.d||s.s===e.s?s:NaN)),e;if(s.s!=e.s)return e.s=-e.s,s.minus(e);if(l=s.d,o=e.d,f=m.precision,c=m.rounding,!l[0]||!o[0])return o[0]||(e=new m(s)),Re?Fe(e,f,c):e;if(n=Sr(s.e/Oe),a=Sr(e.e/Oe),l=l.slice(),t=n-a,t){for(t<0?(i=l,t=-t,u=o.length):(i=o,a=n,u=l.length),n=Math.ceil(f/Oe),u=n>u?n+1:u+1,t>u&&(t=u,i.length=1),i.reverse();t--;)i.push(0);i.reverse()}for(u=l.length,t=o.length,u-t<0&&(t=u,i=o,o=l,l=i),r=0;t;)r=(l[--t]=l[t]+o[t]+r)/Kr|0,l[t]%=Kr;for(r&&(l.unshift(r),++a),u=l.length;l[--u]==0;)l.pop();return e.d=l,e.e=ei(l,a),Re?Fe(e,f,c):e};he.precision=he.sd=function(e){var r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error($t+e);return i.d?(r=Sf(i.d),e&&i.e+1>r&&(r=i.e+1)):r=NaN,r};he.round=function(){var e=this,r=e.constructor;return Fe(new r(e),e.e+1,r.rounding)};he.sine=he.sin=function(){var e,r,i=this,a=i.constructor;return i.isFinite()?i.isZero()?new a(i):(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+Oe,a.rounding=1,i=Xd(a,Bf(a,i)),a.precision=e,a.rounding=r,Fe(bt>2?i.neg():i,e,r,!0)):new a(NaN)};he.squareRoot=he.sqrt=function(){var e,r,i,a,t,n,u=this,f=u.d,c=u.e,l=u.s,o=u.constructor;if(l!==1||!f||!f[0])return new o(!l||l<0&&(!f||f[0])?NaN:f?u:1/0);for(Re=!1,l=Math.sqrt(+u),l==0||l==1/0?(r=Nr(f),(r.length+c)%2==0&&(r+="0"),l=Math.sqrt(r),c=Sr((c+1)/2)-(c<0||c%2),l==1/0?r="5e"+c:(r=l.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),a=new o(r)):a=new o(l.toString()),i=(c=o.precision)+3;;)if(n=a,a=n.plus(lr(u,n,i+2,1)).times(.5),Nr(n.d).slice(0,i)===(r=Nr(a.d)).slice(0,i))if(r=r.slice(i-3,i+1),r=="9999"||!t&&r=="4999"){if(!t&&(Fe(n,c+1,0),n.times(n).eq(u))){a=n;break}i+=4,t=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Fe(a,c+1,1),e=!a.times(a).eq(u));break}return Re=!0,Fe(a,c,o.rounding,e)};he.tangent=he.tan=function(){var e,r,i=this,a=i.constructor;return i.isFinite()?i.isZero()?new a(i):(e=a.precision,r=a.rounding,a.precision=e+10,a.rounding=1,i=i.sin(),i.s=1,i=lr(i,new a(1).minus(i.times(i)).sqrt(),e+10,0),a.precision=e,a.rounding=r,Fe(bt==2||bt==4?i.neg():i,e,r,!0)):new a(NaN)};he.times=he.mul=function(e){var r,i,a,t,n,u,f,c,l,o=this,s=o.constructor,m=o.d,v=(e=new s(e)).d;if(e.s*=o.s,!m||!m[0]||!v||!v[0])return new s(!e.s||m&&!m[0]&&!v||v&&!v[0]&&!m?NaN:!m||!v?e.s/0:e.s*0);for(i=Sr(o.e/Oe)+Sr(e.e/Oe),c=m.length,l=v.length,c<l&&(n=m,m=v,v=n,u=c,c=l,l=u),n=[],u=c+l,a=u;a--;)n.push(0);for(a=l;--a>=0;){for(r=0,t=c+a;t>a;)f=n[t]+v[a]*m[t-a-1]+r,n[t--]=f%Kr|0,r=f/Kr|0;n[t]=(n[t]+r)%Kr|0}for(;!n[--u];)n.pop();return r?++i:n.shift(),e.d=n,e.e=ei(n,i),Re?Fe(e,s.precision,s.rounding):e};he.toBinary=function(e,r){return Wi(this,2,e,r)};he.toDecimalPlaces=he.toDP=function(e,r){var i=this,a=i.constructor;return i=new a(i),e===void 0?i:(Rr(e,0,It),r===void 0?r=a.rounding:Rr(r,0,8),Fe(i,e+i.e+1,r))};he.toExponential=function(e,r){var i,a=this,t=a.constructor;return e===void 0?i=lt(a,!0):(Rr(e,0,It),r===void 0?r=t.rounding:Rr(r,0,8),a=Fe(new t(a),e+1,r),i=lt(a,!0,e+1)),a.isNeg()&&!a.isZero()?"-"+i:i};he.toFixed=function(e,r){var i,a,t=this,n=t.constructor;return e===void 0?i=lt(t):(Rr(e,0,It),r===void 0?r=n.rounding:Rr(r,0,8),a=Fe(new n(t),e+t.e+1,r),i=lt(a,!1,e+a.e+1)),t.isNeg()&&!t.isZero()?"-"+i:i};he.toFraction=function(e){var r,i,a,t,n,u,f,c,l,o,s,m,v=this,d=v.d,p=v.constructor;if(!d)return new p(v);if(l=i=new p(1),a=c=new p(0),r=new p(a),n=r.e=Sf(d)-v.e-1,u=n%Oe,r.d[0]=dr(10,u<0?Oe+u:u),e==null)e=n>0?r:l;else{if(f=new p(e),!f.isInt()||f.lt(l))throw Error($t+f);e=f.gt(r)?n>0?r:l:f}for(Re=!1,f=new p(Nr(d)),o=p.precision,p.precision=n=d.length*Oe*2;s=lr(f,r,0,1,1),t=i.plus(s.times(a)),t.cmp(e)!=1;)i=a,a=t,t=l,l=c.plus(s.times(t)),c=t,t=r,r=f.minus(s.times(t)),f=t;return t=lr(e.minus(i),a,0,1,1),c=c.plus(t.times(l)),i=i.plus(t.times(a)),c.s=l.s=v.s,m=lr(l,a,n,1).minus(v).abs().cmp(lr(c,i,n,1).minus(v).abs())<1?[l,a]:[c,i],p.precision=o,Re=!0,m};he.toHexadecimal=he.toHex=function(e,r){return Wi(this,16,e,r)};he.toNearest=function(e,r){var i=this,a=i.constructor;if(i=new a(i),e==null){if(!i.d)return i;e=new a(1),r=a.rounding}else{if(e=new a(e),r===void 0?r=a.rounding:Rr(r,0,8),!i.d)return e.s?i:e;if(!e.d)return e.s&&(e.s=i.s),e}return e.d[0]?(Re=!1,i=lr(i,e,0,r,1).times(e),Re=!0,Fe(i)):(e.s=i.s,i=e),i};he.toNumber=function(){return+this};he.toOctal=function(e,r){return Wi(this,8,e,r)};he.toPower=he.pow=function(e){var r,i,a,t,n,u,f=this,c=f.constructor,l=+(e=new c(e));if(!f.d||!e.d||!f.d[0]||!e.d[0])return new c(dr(+f,l));if(f=new c(f),f.eq(1))return f;if(a=c.precision,n=c.rounding,e.eq(1))return Fe(f,a,n);if(r=Sr(e.e/Oe),r>=e.d.length-1&&(i=l<0?-l:l)<=Vd)return t=Cf(c,f,i,a),e.s<0?new c(1).div(t):Fe(t,a,n);if(u=f.s,u<0){if(r<e.d.length-1)return new c(NaN);if(e.d[r]&1||(u=1),f.e==0&&f.d[0]==1&&f.d.length==1)return f.s=u,f}return i=dr(+f,l),r=i==0||!isFinite(i)?Sr(l*(Math.log("0."+Nr(f.d))/Math.LN10+f.e+1)):new c(i+"").e,r>c.maxE+1||r<c.minE-1?new c(r>0?u/0:0):(Re=!1,c.rounding=f.s=1,i=Math.min(12,(r+"").length),t=Oi(e.times(Tt(f,a+i)),a),t.d&&(t=Fe(t,a+5,1),Zn(t.d,a,n)&&(r=a+10,t=Fe(Oi(e.times(Tt(f,r+i)),r),r+5,1),+Nr(t.d).slice(a+1,a+15)+1==1e14&&(t=Fe(t,a+1,0)))),t.s=u,Re=!0,c.rounding=n,Fe(t,a,n))};he.toPrecision=function(e,r){var i,a=this,t=a.constructor;return e===void 0?i=lt(a,a.e<=t.toExpNeg||a.e>=t.toExpPos):(Rr(e,1,It),r===void 0?r=t.rounding:Rr(r,0,8),a=Fe(new t(a),e,r),i=lt(a,e<=a.e||a.e<=t.toExpNeg,e)),a.isNeg()&&!a.isZero()?"-"+i:i};he.toSignificantDigits=he.toSD=function(e,r){var i=this,a=i.constructor;return e===void 0?(e=a.precision,r=a.rounding):(Rr(e,1,It),r===void 0?r=a.rounding:Rr(r,0,8)),Fe(new a(i),e,r)};he.toString=function(){var e=this,r=e.constructor,i=lt(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+i:i};he.truncated=he.trunc=function(){return Fe(new this.constructor(this),this.e+1,1)};he.valueOf=he.toJSON=function(){var e=this,r=e.constructor,i=lt(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+i:i};function Nr(e){var r,i,a,t=e.length-1,n="",u=e[0];if(t>0){for(n+=u,r=1;r<t;r++)a=e[r]+"",i=Oe-a.length,i&&(n+=Mt(i)),n+=a;u=e[r],a=u+"",i=Oe-a.length,i&&(n+=Mt(i))}else if(u===0)return"0";for(;u%10===0;)u/=10;return n+u}function Rr(e,r,i){if(e!==~~e||e<r||e>i)throw Error($t+e)}function Zn(e,r,i,a){var t,n,u,f;for(n=e[0];n>=10;n/=10)--r;return--r<0?(r+=Oe,t=0):(t=Math.ceil((r+1)/Oe),r%=Oe),n=dr(10,Oe-r),f=e[t]%n|0,a==null?r<3?(r==0?f=f/100|0:r==1&&(f=f/10|0),u=i<4&&f==99999||i>3&&f==49999||f==5e4||f==0):u=(i<4&&f+1==n||i>3&&f+1==n/2)&&(e[t+1]/n/100|0)==dr(10,r-2)-1||(f==n/2||f==0)&&(e[t+1]/n/100|0)==0:r<4?(r==0?f=f/1e3|0:r==1?f=f/100|0:r==2&&(f=f/10|0),u=(a||i<4)&&f==9999||!a&&i>3&&f==4999):u=((a||i<4)&&f+1==n||!a&&i>3&&f+1==n/2)&&(e[t+1]/n/1e3|0)==dr(10,r-3)-1,u}function Ca(e,r,i){for(var a,t=[0],n,u=0,f=e.length;u<f;){for(n=t.length;n--;)t[n]*=r;for(t[0]+=Fi.indexOf(e.charAt(u++)),a=0;a<t.length;a++)t[a]>i-1&&(t[a+1]===void 0&&(t[a+1]=0),t[a+1]+=t[a]/i|0,t[a]%=i)}return t.reverse()}function Yd(e,r){var i,a,t;if(r.isZero())return r;a=r.d.length,a<32?(i=Math.ceil(a/3),t=(1/ri(4,i)).toString()):(i=16,t="2.3283064365386962890625e-10"),e.precision+=i,r=wn(e,1,r.times(t),new e(1));for(var n=i;n--;){var u=r.times(r);r=u.times(u).minus(u).times(8).plus(1)}return e.precision-=i,r}var lr=function(){function e(a,t,n){var u,f=0,c=a.length;for(a=a.slice();c--;)u=a[c]*t+f,a[c]=u%n|0,f=u/n|0;return f&&a.unshift(f),a}function r(a,t,n,u){var f,c;if(n!=u)c=n>u?1:-1;else for(f=c=0;f<n;f++)if(a[f]!=t[f]){c=a[f]>t[f]?1:-1;break}return c}function i(a,t,n,u){for(var f=0;n--;)a[n]-=f,f=a[n]<t[n]?1:0,a[n]=f*u+a[n]-t[n];for(;!a[0]&&a.length>1;)a.shift()}return function(a,t,n,u,f,c){var l,o,s,m,v,d,p,h,y,E,g,w,x,b,A,D,S,N,B,F,$=a.constructor,q=a.s==t.s?1:-1,_=a.d,C=t.d;if(!_||!_[0]||!C||!C[0])return new $(!a.s||!t.s||(_?C&&_[0]==C[0]:!C)?NaN:_&&_[0]==0||!C?q*0:q/0);for(c?(v=1,o=a.e-t.e):(c=Kr,v=Oe,o=Sr(a.e/v)-Sr(t.e/v)),B=C.length,S=_.length,y=new $(q),E=y.d=[],s=0;C[s]==(_[s]||0);s++);if(C[s]>(_[s]||0)&&o--,n==null?(b=n=$.precision,u=$.rounding):f?b=n+(a.e-t.e)+1:b=n,b<0)E.push(1),d=!0;else{if(b=b/v+2|0,s=0,B==1){for(m=0,C=C[0],b++;(s<S||m)&&b--;s++)A=m*c+(_[s]||0),E[s]=A/C|0,m=A%C|0;d=m||s<S}else{for(m=c/(C[0]+1)|0,m>1&&(C=e(C,m,c),_=e(_,m,c),B=C.length,S=_.length),D=B,g=_.slice(0,B),w=g.length;w<B;)g[w++]=0;F=C.slice(),F.unshift(0),N=C[0],C[1]>=c/2&&++N;do m=0,l=r(C,g,B,w),l<0?(x=g[0],B!=w&&(x=x*c+(g[1]||0)),m=x/N|0,m>1?(m>=c&&(m=c-1),p=e(C,m,c),h=p.length,w=g.length,l=r(p,g,h,w),l==1&&(m--,i(p,B<h?F:C,h,c))):(m==0&&(l=m=1),p=C.slice()),h=p.length,h<w&&p.unshift(0),i(g,p,w,c),l==-1&&(w=g.length,l=r(C,g,B,w),l<1&&(m++,i(g,B<w?F:C,w,c))),w=g.length):l===0&&(m++,g=[0]),E[s++]=m,l&&g[0]?g[w++]=_[D]||0:(g=[_[D]],w=1);while((D++<S||g[0]!==void 0)&&b--);d=g[0]!==void 0}E[0]||E.shift()}if(v==1)y.e=o,wf=d;else{for(s=1,m=E[0];m>=10;m/=10)s++;y.e=s+o*v-1,Fe(y,f?n+y.e+1:n,u,d)}return y}}();function Fe(e,r,i,a){var t,n,u,f,c,l,o,s,m,v=e.constructor;e:if(r!=null){if(s=e.d,!s)return e;for(t=1,f=s[0];f>=10;f/=10)t++;if(n=r-t,n<0)n+=Oe,u=r,o=s[m=0],c=o/dr(10,t-u-1)%10|0;else if(m=Math.ceil((n+1)/Oe),f=s.length,m>=f)if(a){for(;f++<=m;)s.push(0);o=c=0,t=1,n%=Oe,u=n-Oe+1}else break e;else{for(o=f=s[m],t=1;f>=10;f/=10)t++;n%=Oe,u=n-Oe+t,c=u<0?0:o/dr(10,t-u-1)%10|0}if(a=a||r<0||s[m+1]!==void 0||(u<0?o:o%dr(10,t-u-1)),l=i<4?(c||a)&&(i==0||i==(e.s<0?3:2)):c>5||c==5&&(i==4||a||i==6&&(n>0?u>0?o/dr(10,t-u):0:s[m-1])%10&1||i==(e.s<0?8:7)),r<1||!s[0])return s.length=0,l?(r-=e.e+1,s[0]=dr(10,(Oe-r%Oe)%Oe),e.e=-r||0):s[0]=e.e=0,e;if(n==0?(s.length=m,f=1,m--):(s.length=m+1,f=dr(10,Oe-n),s[m]=u>0?(o/dr(10,t-u)%dr(10,u)|0)*f:0),l)for(;;)if(m==0){for(n=1,u=s[0];u>=10;u/=10)n++;for(u=s[0]+=f,f=1;u>=10;u/=10)f++;n!=f&&(e.e++,s[0]==Kr&&(s[0]=1));break}else{if(s[m]+=f,s[m]!=Kr)break;s[m--]=0,f=1}for(n=s.length;s[--n]===0;)s.pop()}return Re&&(e.e>v.maxE?(e.d=null,e.e=NaN):e.e<v.minE&&(e.e=0,e.d=[0])),e}function lt(e,r,i){if(!e.isFinite())return Ff(e);var a,t=e.e,n=Nr(e.d),u=n.length;return r?(i&&(a=i-u)>0?n=n.charAt(0)+"."+n.slice(1)+Mt(a):u>1&&(n=n.charAt(0)+"."+n.slice(1)),n=n+(e.e<0?"e":"e+")+e.e):t<0?(n="0."+Mt(-t-1)+n,i&&(a=i-u)>0&&(n+=Mt(a))):t>=u?(n+=Mt(t+1-u),i&&(a=i-t-1)>0&&(n=n+"."+Mt(a))):((a=t+1)<u&&(n=n.slice(0,a)+"."+n.slice(a)),i&&(a=i-u)>0&&(t+1===u&&(n+="."),n+=Mt(a))),n}function ei(e,r){var i=e[0];for(r*=Oe;i>=10;i/=10)r++;return r}function _a(e,r,i){if(r>Zd)throw Re=!0,i&&(e.precision=i),Error(Nf);return Fe(new e(Oa),r,1,!0)}function Qr(e,r,i){if(r>Ti)throw Error(Nf);return Fe(new e($a),r,i,!0)}function Sf(e){var r=e.length-1,i=r*Oe+1;if(r=e[r],r){for(;r%10==0;r/=10)i--;for(r=e[0];r>=10;r/=10)i++}return i}function Mt(e){for(var r="";e--;)r+="0";return r}function Cf(e,r,i,a){var t,n=new e(1),u=Math.ceil(a/Oe+4);for(Re=!1;;){if(i%2&&(n=n.times(r),Zo(n.d,u)&&(t=!0)),i=Sr(i/2),i===0){i=n.d.length-1,t&&n.d[i]===0&&++n.d[i];break}r=r.times(r),Zo(r.d,u)}return Re=!0,n}function Vo(e){return e.d[e.d.length-1]&1}function Mf(e,r,i){for(var a,t=new e(r[0]),n=0;++n<r.length;)if(a=new e(r[n]),a.s)t[i](a)&&(t=a);else{t=a;break}return t}function Oi(e,r){var i,a,t,n,u,f,c,l=0,o=0,s=0,m=e.constructor,v=m.rounding,d=m.precision;if(!e.d||!e.d[0]||e.e>17)return new m(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(r==null?(Re=!1,c=d):c=r,f=new m(.03125);e.e>-2;)e=e.times(f),s+=5;for(a=Math.log(dr(2,s))/Math.LN10*2+5|0,c+=a,i=n=u=new m(1),m.precision=c;;){if(n=Fe(n.times(e),c,1),i=i.times(++o),f=u.plus(lr(n,i,c,1)),Nr(f.d).slice(0,c)===Nr(u.d).slice(0,c)){for(t=s;t--;)u=Fe(u.times(u),c,1);if(r==null)if(l<3&&Zn(u.d,c-a,v,l))m.precision=c+=10,i=n=f=new m(1),o=0,l++;else return Fe(u,m.precision=d,v,Re=!0);else return m.precision=d,u}u=f}}function Tt(e,r){var i,a,t,n,u,f,c,l,o,s,m,v=1,d=10,p=e,h=p.d,y=p.constructor,E=y.rounding,g=y.precision;if(p.s<0||!h||!h[0]||!p.e&&h[0]==1&&h.length==1)return new y(h&&!h[0]?-1/0:p.s!=1?NaN:h?0:p);if(r==null?(Re=!1,o=g):o=r,y.precision=o+=d,i=Nr(h),a=i.charAt(0),Math.abs(n=p.e)<15e14){for(;a<7&&a!=1||a==1&&i.charAt(1)>3;)p=p.times(e),i=Nr(p.d),a=i.charAt(0),v++;n=p.e,a>1?(p=new y("0."+i),n++):p=new y(a+"."+i.slice(1))}else return l=_a(y,o+2,g).times(n+""),p=Tt(new y(a+"."+i.slice(1)),o-d).plus(l),y.precision=g,r==null?Fe(p,g,E,Re=!0):p;for(s=p,c=u=p=lr(p.minus(1),p.plus(1),o,1),m=Fe(p.times(p),o,1),t=3;;){if(u=Fe(u.times(m),o,1),l=c.plus(lr(u,new y(t),o,1)),Nr(l.d).slice(0,o)===Nr(c.d).slice(0,o))if(c=c.times(2),n!==0&&(c=c.plus(_a(y,o+2,g).times(n+""))),c=lr(c,new y(v),o,1),r==null)if(Zn(c.d,o-d,E,f))y.precision=o+=d,l=u=p=lr(s.minus(1),s.plus(1),o,1),m=Fe(p.times(p),o,1),t=f=1;else return Fe(c,y.precision=g,E,Re=!0);else return y.precision=g,c;c=l,t+=2}}function Ff(e){return String(e.s*e.s/0)}function $i(e,r){var i,a,t;for((i=r.indexOf("."))>-1&&(r=r.replace(".","")),(a=r.search(/e/i))>0?(i<0&&(i=a),i+=+r.slice(a+1),r=r.substring(0,a)):i<0&&(i=r.length),a=0;r.charCodeAt(a)===48;a++);for(t=r.length;r.charCodeAt(t-1)===48;--t);if(r=r.slice(a,t),r){if(t-=a,e.e=i=i-a-1,e.d=[],a=(i+1)%Oe,i<0&&(a+=Oe),a<t){for(a&&e.d.push(+r.slice(0,a)),t-=Oe;a<t;)e.d.push(+r.slice(a,a+=Oe));r=r.slice(a),a=Oe-r.length}else a-=t;for(;a--;)r+="0";e.d.push(+r),Re&&(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 Wd(e,r){var i,a,t,n,u,f,c,l,o;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),Ef.test(r))return $i(e,r)}else if(r==="Infinity"||r==="NaN")return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(Hd.test(r))i=16,r=r.toLowerCase();else if(kd.test(r))i=2;else if(Gd.test(r))i=8;else throw Error($t+r);for(n=r.search(/p/i),n>0?(c=+r.slice(n+1),r=r.substring(2,n)):r=r.slice(2),n=r.indexOf("."),u=n>=0,a=e.constructor,u&&(r=r.replace(".",""),f=r.length,n=f-n,t=Cf(a,new a(i),n,n*2)),l=Ca(r,i,Kr),o=l.length-1,n=o;l[n]===0;--n)l.pop();return n<0?new a(e.s*0):(e.e=ei(l,o),e.d=l,Re=!1,u&&(e=lr(e,t,f*4)),c&&(e=e.times(Math.abs(c)<54?dr(2,c):_t.pow(2,c))),Re=!0,e)}function Xd(e,r){var i,a=r.d.length;if(a<3)return r.isZero()?r:wn(e,2,r,r);i=1.4*Math.sqrt(a),i=i>16?16:i|0,r=r.times(1/ri(5,i)),r=wn(e,2,r,r);for(var t,n=new e(5),u=new e(16),f=new e(20);i--;)t=r.times(r),r=r.times(n.plus(t.times(u.times(t).minus(f))));return r}function wn(e,r,i,a,t){var n,u,f,c,l=e.precision,o=Math.ceil(l/Oe);for(Re=!1,c=i.times(i),f=new e(a);;){if(u=lr(f.times(c),new e(r++*r++),l,1),f=t?a.plus(u):a.minus(u),a=lr(u.times(c),new e(r++*r++),l,1),u=f.plus(a),u.d[o]!==void 0){for(n=o;u.d[n]===f.d[n]&&n--;);if(n==-1)break}n=f,f=a,a=u,u=n}return Re=!0,u.d.length=o+1,u}function ri(e,r){for(var i=e;--r;)i*=e;return i}function Bf(e,r){var i,a=r.s<0,t=Qr(e,e.precision,1),n=t.times(.5);if(r=r.abs(),r.lte(n))return bt=a?4:1,r;if(i=r.divToInt(t),i.isZero())bt=a?3:2;else{if(r=r.minus(i.times(t)),r.lte(n))return bt=Vo(i)?a?2:3:a?4:1,r;bt=Vo(i)?a?1:4:a?3:2}return r.minus(t).abs()}function Wi(e,r,i,a){var t,n,u,f,c,l,o,s,m,v=e.constructor,d=i!==void 0;if(d?(Rr(i,1,It),a===void 0?a=v.rounding:Rr(a,0,8)):(i=v.precision,a=v.rounding),!e.isFinite())o=Ff(e);else{for(o=lt(e),u=o.indexOf("."),d?(t=2,r==16?i=i*4-3:r==8&&(i=i*3-2)):t=r,u>=0&&(o=o.replace(".",""),m=new v(1),m.e=o.length-u,m.d=Ca(lt(m),10,t),m.e=m.d.length),s=Ca(o,10,t),n=c=s.length;s[--c]==0;)s.pop();if(!s[0])o=d?"0p+0":"0";else{if(u<0?n--:(e=new v(e),e.d=s,e.e=n,e=lr(e,m,i,a,0,t),s=e.d,n=e.e,l=wf),u=s[i],f=t/2,l=l||s[i+1]!==void 0,l=a<4?(u!==void 0||l)&&(a===0||a===(e.s<0?3:2)):u>f||u===f&&(a===4||l||a===6&&s[i-1]&1||a===(e.s<0?8:7)),s.length=i,l)for(;++s[--i]>t-1;)s[i]=0,i||(++n,s.unshift(1));for(c=s.length;!s[c-1];--c);for(u=0,o="";u<c;u++)o+=Fi.charAt(s[u]);if(d){if(c>1)if(r==16||r==8){for(u=r==16?4:3,--c;c%u;c++)o+="0";for(s=Ca(o,t,r),c=s.length;!s[c-1];--c);for(u=1,o="1.";u<c;u++)o+=Fi.charAt(s[u])}else o=o.charAt(0)+"."+o.slice(1);o=o+(n<0?"p":"p+")+n}else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(++n>c)for(n-=c;n--;)o+="0";else n<c&&(o=o.slice(0,n)+"."+o.slice(n))}o=(r==16?"0x":r==2?"0b":r==8?"0o":"")+o}return e.s<0?"-"+o:o}function Zo(e,r){if(e.length>r)return e.length=r,!0}function Jd(e){return new this(e).abs()}function Qd(e){return new this(e).acos()}function Kd(e){return new this(e).acosh()}function jd(e,r){return new this(e).plus(r)}function eh(e){return new this(e).asin()}function rh(e){return new this(e).asinh()}function th(e){return new this(e).atan()}function nh(e){return new this(e).atanh()}function ah(e,r){e=new this(e),r=new this(r);var i,a=this.precision,t=this.rounding,n=a+4;return!e.s||!r.s?i=new this(NaN):!e.d&&!r.d?(i=Qr(this,n,1).times(r.s>0?.25:.75),i.s=e.s):!r.d||e.isZero()?(i=r.s<0?Qr(this,a,t):new this(0),i.s=e.s):!e.d||r.isZero()?(i=Qr(this,n,1).times(.5),i.s=e.s):r.s<0?(this.precision=n,this.rounding=1,i=this.atan(lr(e,r,n,1)),r=Qr(this,n,1),this.precision=a,this.rounding=t,i=e.s<0?i.minus(r):i.plus(r)):i=this.atan(lr(e,r,n,1)),i}function ih(e){return new this(e).cbrt()}function oh(e){return Fe(e=new this(e),e.e+1,2)}function uh(e,r,i){return new this(e).clamp(r,i)}function sh(e){if(!e||typeof e!="object")throw Error(ja+"Object expected");var r,i,a,t=e.defaults===!0,n=["precision",1,It,"rounding",0,8,"toExpNeg",-vn,0,"toExpPos",0,vn,"maxE",0,vn,"minE",-vn,0,"modulo",0,9];for(r=0;r<n.length;r+=3)if(i=n[r],t&&(this[i]=Bi[i]),(a=e[i])!==void 0)if(Sr(a)===a&&a>=n[r+1]&&a<=n[r+2])this[i]=a;else throw Error($t+i+": "+a);if(i="crypto",t&&(this[i]=Bi[i]),(a=e[i])!==void 0)if(a===!0||a===!1||a===0||a===1)if(a)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[i]=!0;else throw Error(Df);else this[i]=!1;else throw Error($t+i+": "+a);return this}function lh(e){return new this(e).cos()}function ch(e){return new this(e).cosh()}function Tf(e){var r,i,a;function t(n){var u,f,c,l=this;if(!(l instanceof t))return new t(n);if(l.constructor=t,Yo(n)){l.s=n.s,Re?!n.d||n.e>t.maxE?(l.e=NaN,l.d=null):n.e<t.minE?(l.e=0,l.d=[0]):(l.e=n.e,l.d=n.d.slice()):(l.e=n.e,l.d=n.d?n.d.slice():n.d);return}if(c=typeof n,c==="number"){if(n===0){l.s=1/n<0?-1:1,l.e=0,l.d=[0];return}if(n<0?(n=-n,l.s=-1):l.s=1,n===~~n&&n<1e7){for(u=0,f=n;f>=10;f/=10)u++;Re?u>t.maxE?(l.e=NaN,l.d=null):u<t.minE?(l.e=0,l.d=[0]):(l.e=u,l.d=[n]):(l.e=u,l.d=[n]);return}else if(n*0!==0){n||(l.s=NaN),l.e=NaN,l.d=null;return}return $i(l,n.toString())}else if(c!=="string")throw Error($t+n);return(f=n.charCodeAt(0))===45?(n=n.slice(1),l.s=-1):(f===43&&(n=n.slice(1)),l.s=1),Ef.test(n)?$i(l,n):Wd(l,n)}if(t.prototype=he,t.ROUND_UP=0,t.ROUND_DOWN=1,t.ROUND_CEIL=2,t.ROUND_FLOOR=3,t.ROUND_HALF_UP=4,t.ROUND_HALF_DOWN=5,t.ROUND_HALF_EVEN=6,t.ROUND_HALF_CEIL=7,t.ROUND_HALF_FLOOR=8,t.EUCLID=9,t.config=t.set=sh,t.clone=Tf,t.isDecimal=Yo,t.abs=Jd,t.acos=Qd,t.acosh=Kd,t.add=jd,t.asin=eh,t.asinh=rh,t.atan=th,t.atanh=nh,t.atan2=ah,t.cbrt=ih,t.ceil=oh,t.clamp=uh,t.cos=lh,t.cosh=ch,t.div=fh,t.exp=mh,t.floor=vh,t.hypot=ph,t.ln=dh,t.log=hh,t.log10=yh,t.log2=gh,t.max=bh,t.min=xh,t.mod=wh,t.mul=Nh,t.pow=Dh,t.random=Ah,t.round=Eh,t.sign=Sh,t.sin=Ch,t.sinh=Mh,t.sqrt=Fh,t.sub=Bh,t.sum=Th,t.tan=Oh,t.tanh=$h,t.trunc=_h,e===void 0&&(e={}),e&&e.defaults!==!0)for(a=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<a.length;)e.hasOwnProperty(i=a[r++])||(e[i]=this[i]);return t.config(e),t}function fh(e,r){return new this(e).div(r)}function mh(e){return new this(e).exp()}function vh(e){return Fe(e=new this(e),e.e+1,3)}function ph(){var e,r,i=new this(0);for(Re=!1,e=0;e<arguments.length;)if(r=new this(arguments[e++]),r.d)i.d&&(i=i.plus(r.times(r)));else{if(r.s)return Re=!0,new this(1/0);i=r}return Re=!0,i.sqrt()}function Yo(e){return e instanceof _t||e&&e.toStringTag===Af||!1}function dh(e){return new this(e).ln()}function hh(e,r){return new this(e).log(r)}function gh(e){return new this(e).log(2)}function yh(e){return new this(e).log(10)}function bh(){return Mf(this,arguments,"lt")}function xh(){return Mf(this,arguments,"gt")}function wh(e,r){return new this(e).mod(r)}function Nh(e,r){return new this(e).mul(r)}function Dh(e,r){return new this(e).pow(r)}function Ah(e){var r,i,a,t,n=0,u=new this(1),f=[];if(e===void 0?e=this.precision:Rr(e,1,It),a=Math.ceil(e/Oe),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(a));n<a;)t=r[n],t>=429e7?r[n]=crypto.getRandomValues(new Uint32Array(1))[0]:f[n++]=t%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(a*=4);n<a;)t=r[n]+(r[n+1]<<8)+(r[n+2]<<16)+((r[n+3]&127)<<24),t>=214e7?crypto.randomBytes(4).copy(r,n):(f.push(t%1e7),n+=4);n=a/4}else throw Error(Df);else for(;n<a;)f[n++]=Math.random()*1e7|0;for(a=f[--n],e%=Oe,a&&e&&(t=dr(10,Oe-e),f[n]=(a/t|0)*t);f[n]===0;n--)f.pop();if(n<0)i=0,f=[0];else{for(i=-1;f[0]===0;i-=Oe)f.shift();for(a=1,t=f[0];t>=10;t/=10)a++;a<Oe&&(i-=Oe-a)}return u.e=i,u.d=f,u}function Eh(e){return Fe(e=new this(e),e.e+1,this.rounding)}function Sh(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Ch(e){return new this(e).sin()}function Mh(e){return new this(e).sinh()}function Fh(e){return new this(e).sqrt()}function Bh(e,r){return new this(e).sub(r)}function Th(){var e=0,r=arguments,i=new this(r[e]);for(Re=!1;i.s&&++e<r.length;)i=i.plus(r[e]);return Re=!0,Fe(i,this.precision,this.rounding)}function Oh(e){return new this(e).tan()}function $h(e){return new this(e).tanh()}function _h(e){return Fe(e=new this(e),e.e+1,1)}he[Symbol.for("nodejs.util.inspect.custom")]=he.toString;he[Symbol.toStringTag]="Decimal";var _t=he.constructor=Tf(Bi);Oa=new _t(Oa);$a=new _t($a);var Ih="BigNumber",Rh=["?on","config"],qh=I(Ih,Rh,e=>{var{on:r,config:i}=e,a=_t.clone({precision:i.precision,modulo:_t.EUCLID});return a.prototype=Object.create(a.prototype),a.prototype.type="BigNumber",a.prototype.isBigNumber=!0,a.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},a.fromJSON=function(t){return new a(t.value)},r&&r("config",function(t,n){t.precision!==n.precision&&a.config({precision:t.precision})}),a},{isClass:!0}),Of={exports:{}};/**
|
||
* @license Complex.js v2.1.1 12/05/2020
|
||
*
|
||
* Copyright (c) 2020, Robert Eisele (robert@xarg.org)
|
||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||
**/(function(e,r){(function(i){var a=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},n=function(s){var m=Math.PI/4;if(-m>s||s>m)return Math.cos(s)-1;var v=s*s;return v*(v*(v*(v*(v*(v*(v*(v/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},u=function(s,m){var v=Math.abs(s),d=Math.abs(m);return v<3e3&&d<3e3?Math.sqrt(v*v+d*d):(v<d?(v=d,d=s/m):d=m/s,v*Math.sqrt(1+d*d))},f=function(){throw SyntaxError("Invalid Param")};function c(s,m){var v=Math.abs(s),d=Math.abs(m);return s===0?Math.log(d):m===0?Math.log(v):v<3e3&&d<3e3?Math.log(s*s+m*m)*.5:(s=s/2,m=m/2,.5*Math.log(s*s+m*m)+Math.LN2)}var l=function(s,m){var v={re:0,im:0};if(s==null)v.re=v.im=0;else if(m!==void 0)v.re=s,v.im=m;else switch(typeof s){case"object":if("im"in s&&"re"in s)v.re=s.re,v.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return o.INFINITY;v.re=s.abs*Math.cos(s.arg),v.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return o.INFINITY;v.re=s.r*Math.cos(s.phi),v.im=s.r*Math.sin(s.phi)}else s.length===2?(v.re=s[0],v.im=s[1]):f();break;case"string":v.im=v.re=0;var d=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),p=1,h=0;d===null&&f();for(var y=0;y<d.length;y++){var E=d[y];E===" "||E===" "||E===`
|
||
`||(E==="+"?p++:E==="-"?h++:E==="i"||E==="I"?(p+h===0&&f(),d[y+1]!==" "&&!isNaN(d[y+1])?(v.im+=parseFloat((h%2?"-":"")+d[y+1]),y++):v.im+=parseFloat((h%2?"-":"")+"1"),p=h=0):((p+h===0||isNaN(E))&&f(),d[y+1]==="i"||d[y+1]==="I"?(v.im+=parseFloat((h%2?"-":"")+E),y++):v.re+=parseFloat((h%2?"-":"")+E),p=h=0))}p+h>0&&f();break;case"number":v.im=0,v.re=s;break;default:f()}return isNaN(v.re)||isNaN(v.im),v};function o(s,m){if(!(this instanceof o))return new o(s,m);var v=l(s,m);this.re=v.re,this.im=v.im}o.prototype={re:0,im:0,sign:function(){var s=this.abs();return new o(this.re/s,this.im/s)},add:function(s,m){var v=new o(s,m);return this.isInfinite()&&v.isInfinite()?o.NAN:this.isInfinite()||v.isInfinite()?o.INFINITY:new o(this.re+v.re,this.im+v.im)},sub:function(s,m){var v=new o(s,m);return this.isInfinite()&&v.isInfinite()?o.NAN:this.isInfinite()||v.isInfinite()?o.INFINITY:new o(this.re-v.re,this.im-v.im)},mul:function(s,m){var v=new o(s,m);return this.isInfinite()&&v.isZero()||this.isZero()&&v.isInfinite()?o.NAN:this.isInfinite()||v.isInfinite()?o.INFINITY:v.im===0&&this.im===0?new o(this.re*v.re,0):new o(this.re*v.re-this.im*v.im,this.re*v.im+this.im*v.re)},div:function(s,m){var v=new o(s,m);if(this.isZero()&&v.isZero()||this.isInfinite()&&v.isInfinite())return o.NAN;if(this.isInfinite()||v.isZero())return o.INFINITY;if(this.isZero()||v.isInfinite())return o.ZERO;s=this.re,m=this.im;var d=v.re,p=v.im,h,y;return p===0?new o(s/d,m/d):Math.abs(d)<Math.abs(p)?(y=d/p,h=d*y+p,new o((s*y+m)/h,(m*y-s)/h)):(y=p/d,h=p*y+d,new o((s+m*y)/h,(m-s*y)/h))},pow:function(s,m){var v=new o(s,m);if(s=this.re,m=this.im,v.isZero())return o.ONE;if(v.im===0){if(m===0&&s>0)return new o(Math.pow(s,v.re),0);if(s===0)switch((v.re%4+4)%4){case 0:return new o(Math.pow(m,v.re),0);case 1:return new o(0,Math.pow(m,v.re));case 2:return new o(-Math.pow(m,v.re),0);case 3:return new o(0,-Math.pow(m,v.re))}}if(s===0&&m===0&&v.re>0&&v.im>=0)return o.ZERO;var d=Math.atan2(m,s),p=c(s,m);return s=Math.exp(v.re*p-v.im*d),m=v.im*p+v.re*d,new o(s*Math.cos(m),s*Math.sin(m))},sqrt:function(){var s=this.re,m=this.im,v=this.abs(),d,p;if(s>=0){if(m===0)return new o(Math.sqrt(s),0);d=.5*Math.sqrt(2*(v+s))}else d=Math.abs(m)/Math.sqrt(2*(v-s));return s<=0?p=.5*Math.sqrt(2*(v-s)):p=Math.abs(m)/Math.sqrt(2*(v+s)),new o(d,m<0?-p:p)},exp:function(){var s=Math.exp(this.re);return this.im,new o(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,m=this.im;return new o(Math.expm1(s)*Math.cos(m)+n(m),Math.exp(s)*Math.sin(m))},log:function(){var s=this.re,m=this.im;return new o(c(s,m),Math.atan2(m,s))},abs:function(){return u(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,m=this.im;return new o(Math.sin(s)*a(m),Math.cos(s)*t(m))},cos:function(){var s=this.re,m=this.im;return new o(Math.cos(s)*a(m),-Math.sin(s)*t(m))},tan:function(){var s=2*this.re,m=2*this.im,v=Math.cos(s)+a(m);return new o(Math.sin(s)/v,t(m)/v)},cot:function(){var s=2*this.re,m=2*this.im,v=Math.cos(s)-a(m);return new o(-Math.sin(s)/v,t(m)/v)},sec:function(){var s=this.re,m=this.im,v=.5*a(2*m)+.5*Math.cos(2*s);return new o(Math.cos(s)*a(m)/v,Math.sin(s)*t(m)/v)},csc:function(){var s=this.re,m=this.im,v=.5*a(2*m)-.5*Math.cos(2*s);return new o(Math.sin(s)*a(m)/v,-Math.cos(s)*t(m)/v)},asin:function(){var s=this.re,m=this.im,v=new o(m*m-s*s+1,-2*s*m).sqrt(),d=new o(v.re-m,v.im+s).log();return new o(d.im,-d.re)},acos:function(){var s=this.re,m=this.im,v=new o(m*m-s*s+1,-2*s*m).sqrt(),d=new o(v.re-m,v.im+s).log();return new o(Math.PI/2-d.im,d.re)},atan:function(){var s=this.re,m=this.im;if(s===0){if(m===1)return new o(0,1/0);if(m===-1)return new o(0,-1/0)}var v=s*s+(1-m)*(1-m),d=new o((1-m*m-s*s)/v,-2*s/v).log();return new o(-.5*d.im,.5*d.re)},acot:function(){var s=this.re,m=this.im;if(m===0)return new o(Math.atan2(1,s),0);var v=s*s+m*m;return v!==0?new o(s/v,-m/v).atan():new o(s!==0?s/0:0,m!==0?-m/0:0).atan()},asec:function(){var s=this.re,m=this.im;if(s===0&&m===0)return new o(0,1/0);var v=s*s+m*m;return v!==0?new o(s/v,-m/v).acos():new o(s!==0?s/0:0,m!==0?-m/0:0).acos()},acsc:function(){var s=this.re,m=this.im;if(s===0&&m===0)return new o(Math.PI/2,1/0);var v=s*s+m*m;return v!==0?new o(s/v,-m/v).asin():new o(s!==0?s/0:0,m!==0?-m/0:0).asin()},sinh:function(){var s=this.re,m=this.im;return new o(t(s)*Math.cos(m),a(s)*Math.sin(m))},cosh:function(){var s=this.re,m=this.im;return new o(a(s)*Math.cos(m),t(s)*Math.sin(m))},tanh:function(){var s=2*this.re,m=2*this.im,v=a(s)+Math.cos(m);return new o(t(s)/v,Math.sin(m)/v)},coth:function(){var s=2*this.re,m=2*this.im,v=a(s)-Math.cos(m);return new o(t(s)/v,-Math.sin(m)/v)},csch:function(){var s=this.re,m=this.im,v=Math.cos(2*m)-a(2*s);return new o(-2*t(s)*Math.cos(m)/v,2*a(s)*Math.sin(m)/v)},sech:function(){var s=this.re,m=this.im,v=Math.cos(2*m)+a(2*s);return new o(2*a(s)*Math.cos(m)/v,-2*t(s)*Math.sin(m)/v)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var m=this.asin();return this.re=-this.im,this.im=s,s=m.re,m.re=-m.im,m.im=s,m},acosh:function(){var s=this.acos();if(s.im<=0){var m=s.re;s.re=-s.im,s.im=m}else{var m=s.im;s.im=-s.re,s.re=m}return s},atanh:function(){var s=this.re,m=this.im,v=s>1&&m===0,d=1-s,p=1+s,h=d*d+m*m,y=h!==0?new o((p*d-m*m)/h,(m*d+p*m)/h):new o(s!==-1?s/0:0,m!==0?m/0:0),E=y.re;return y.re=c(y.re,y.im)/2,y.im=Math.atan2(y.im,E)/2,v&&(y.im=-y.im),y},acoth:function(){var s=this.re,m=this.im;if(s===0&&m===0)return new o(0,Math.PI/2);var v=s*s+m*m;return v!==0?new o(s/v,-m/v).atanh():new o(s!==0?s/0:0,m!==0?-m/0:0).atanh()},acsch:function(){var s=this.re,m=this.im;if(m===0)return new o(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var v=s*s+m*m;return v!==0?new o(s/v,-m/v).asinh():new o(s!==0?s/0:0,m!==0?-m/0:0).asinh()},asech:function(){var s=this.re,m=this.im;if(this.isZero())return o.INFINITY;var v=s*s+m*m;return v!==0?new o(s/v,-m/v).acosh():new o(s!==0?s/0:0,m!==0?-m/0:0).acosh()},inverse:function(){if(this.isZero())return o.INFINITY;if(this.isInfinite())return o.ZERO;var s=this.re,m=this.im,v=s*s+m*m;return new o(s/v,-m/v)},conjugate:function(){return new o(this.re,-this.im)},neg:function(){return new o(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new o(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new o(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new o(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,m){var v=new o(s,m);return Math.abs(v.re-this.re)<=o.EPSILON&&Math.abs(v.im-this.im)<=o.EPSILON},clone:function(){return new o(this.re,this.im)},toString:function(){var s=this.re,m=this.im,v="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<o.EPSILON&&(s=0),Math.abs(m)<o.EPSILON&&(m=0),m===0?v+s:(s!==0?(v+=s,v+=" ",m<0?(m=-m,v+="-"):v+="+",v+=" "):m<0&&(m=-m,v+="-"),m!==1&&(v+=m),v+"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.isNaN()||this.isFinite())}},o.ZERO=new o(0,0),o.ONE=new o(1,0),o.I=new o(0,1),o.PI=new o(Math.PI,0),o.E=new o(Math.E,0),o.INFINITY=new o(1/0,1/0),o.NAN=new o(NaN,NaN),o.EPSILON=1e-15,Object.defineProperty(o,"__esModule",{value:!0}),o.default=o,o.Complex=o,e.exports=o})()})(Of);var zh=Of.exports;const xr=Xn(zh);var Ph="Complex",Uh=[],Lh=I(Ph,Uh,()=>(Object.defineProperty(xr,"name",{value:"Complex"}),xr.prototype.constructor=xr,xr.prototype.type="Complex",xr.prototype.isComplex=!0,xr.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},xr.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},xr.prototype.format=function(e){var r="",i=this.im,a=this.re,t=Ht(this.re,e),n=Ht(this.im,e),u=Ve(e)?e:e?e.precision:null;if(u!==null){var f=Math.pow(10,-u);Math.abs(a/i)<f&&(a=0),Math.abs(i/a)<f&&(i=0)}return i===0?r=t:a===0?i===1?r="i":i===-1?r="-i":r=n+"i":i<0?i===-1?r=t+" - i":r=t+" - "+n.substring(1)+"i":i===1?r=t+" + i":r=t+" + "+n+"i",r},xr.fromPolar=function(e){switch(arguments.length){case 1:{var r=arguments[0];if(typeof r=="object")return xr(r);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var i=arguments[0],a=arguments[1];if(Ve(i)){if(Zr(a)&&a.hasBase("ANGLE")&&(a=a.toNumber("rad")),Ve(a))return new xr({r:i,phi:a});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")}},xr.prototype.valueOf=xr.prototype.toString,xr.fromJSON=function(e){return new xr(e)},xr.compare=function(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0},xr),{isClass:!0}),$f={exports:{}};/**
|
||
* @license Fraction.js v4.2.0 05/03/2022
|
||
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
|
||
*
|
||
* Copyright (c) 2021, Robert Eisele (robert@xarg.org)
|
||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||
**/(function(e,r){(function(i){var a=2e3,t={s:1,n:0,d:1};function n(d,p){if(isNaN(d=parseInt(d,10)))throw v.InvalidParameter;return d*p}function u(d,p){if(p===0)throw v.DivisionByZero;var h=Object.create(v.prototype);h.s=d<0?-1:1,d=d<0?-d:d;var y=m(d,p);return h.n=d/y,h.d=p/y,h}function f(d){for(var p={},h=d,y=2,E=4;E<=h;){for(;h%y===0;)h/=y,p[y]=(p[y]||0)+1;E+=1+2*y++}return h!==d?h>1&&(p[h]=(p[h]||0)+1):p[d]=(p[d]||0)+1,p}var c=function(d,p){var h=0,y=1,E=1,g=0,w=0,x=0,b=1,A=1,D=0,S=1,N=1,B=1,F=1e7,$;if(d!=null)if(p!==void 0){if(h=d,y=p,E=h*y,h%1!==0||y%1!==0)throw v.NonIntegerParameter}else switch(typeof d){case"object":{if("d"in d&&"n"in d)h=d.n,y=d.d,"s"in d&&(h*=d.s);else if(0 in d)h=d[0],1 in d&&(y=d[1]);else throw v.InvalidParameter;E=h*y;break}case"number":{if(d<0&&(E=d,d=-d),d%1===0)h=d;else if(d>0){for(d>=1&&(A=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=A);S<=F&&B<=F;)if($=(D+N)/(S+B),d===$){S+B<=F?(h=D+N,y=S+B):B>S?(h=N,y=B):(h=D,y=S);break}else d>$?(D+=N,S+=B):(N+=D,B+=S),S>F?(h=N,y=B):(h=D,y=S);h*=A}else(isNaN(d)||isNaN(p))&&(y=h=NaN);break}case"string":{if(S=d.match(/\d+|./g),S===null)throw v.InvalidParameter;if(S[D]==="-"?(E=-1,D++):S[D]==="+"&&D++,S.length===D+1?w=n(S[D++],E):S[D+1]==="."||S[D]==="."?(S[D]!=="."&&(g=n(S[D++],E)),D++,(D+1===S.length||S[D+1]==="("&&S[D+3]===")"||S[D+1]==="'"&&S[D+3]==="'")&&(w=n(S[D],E),b=Math.pow(10,S[D].length),D++),(S[D]==="("&&S[D+2]===")"||S[D]==="'"&&S[D+2]==="'")&&(x=n(S[D+1],E),A=Math.pow(10,S[D+1].length)-1,D+=3)):S[D+1]==="/"||S[D+1]===":"?(w=n(S[D],E),b=n(S[D+2],1),D+=3):S[D+3]==="/"&&S[D+1]===" "&&(g=n(S[D],E),w=n(S[D+2],E),b=n(S[D+4],1),D+=5),S.length<=D){y=b*A,E=h=x+y*g+A*w;break}}default:throw v.InvalidParameter}if(y===0)throw v.DivisionByZero;t.s=E<0?-1:1,t.n=Math.abs(h),t.d=Math.abs(y)};function l(d,p,h){for(var y=1;p>0;d=d*d%h,p>>=1)p&1&&(y=y*d%h);return y}function o(d,p){for(;p%2===0;p/=2);for(;p%5===0;p/=5);if(p===1)return 0;for(var h=10%p,y=1;h!==1;y++)if(h=h*10%p,y>a)return 0;return y}function s(d,p,h){for(var y=1,E=l(10,h,p),g=0;g<300;g++){if(y===E)return g;y=y*10%p,E=E*10%p}return 0}function m(d,p){if(!d)return p;if(!p)return d;for(;;){if(d%=p,!d)return p;if(p%=d,!p)return d}}function v(d,p){if(c(d,p),this instanceof v)d=m(t.d,t.n),this.s=t.s,this.n=t.n/d,this.d=t.d/d;else return u(t.s*t.n,t.d)}v.DivisionByZero=new Error("Division by Zero"),v.InvalidParameter=new Error("Invalid argument"),v.NonIntegerParameter=new Error("Parameters must be integer"),v.prototype={s:1,n:0,d:1,abs:function(){return u(this.n,this.d)},neg:function(){return u(-this.s*this.n,this.d)},add:function(d,p){return c(d,p),u(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(d,p){return c(d,p),u(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(d,p){return c(d,p),u(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(d,p){return c(d,p),u(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return u(this.s*this.n,this.d)},mod:function(d,p){if(isNaN(this.n)||isNaN(this.d))return new v(NaN);if(d===void 0)return u(this.s*this.n%this.d,1);if(c(d,p),t.n===0&&this.d===0)throw v.DivisionByZero;return u(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(d,p){return c(d,p),u(m(t.n,this.n)*m(t.d,this.d),t.d*this.d)},lcm:function(d,p){return c(d,p),t.n===0&&this.n===0?u(0,1):u(t.n*this.n,m(t.n,this.n)*m(t.d,this.d))},ceil:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):u(Math.ceil(d*this.s*this.n/this.d),d)},floor:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):u(Math.floor(d*this.s*this.n/this.d),d)},round:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new v(NaN):u(Math.round(d*this.s*this.n/this.d),d)},inverse:function(){return u(this.s*this.d,this.n)},pow:function(d,p){if(c(d,p),t.d===1)return t.s<0?u(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):u(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var h=f(this.n),y=f(this.d),E=1,g=1;for(var w in h)if(w!=="1"){if(w==="0"){E=0;break}if(h[w]*=t.n,h[w]%t.d===0)h[w]/=t.d;else return null;E*=Math.pow(w,h[w])}for(var w in y)if(w!=="1"){if(y[w]*=t.n,y[w]%t.d===0)y[w]/=t.d;else return null;g*=Math.pow(w,y[w])}return t.s<0?u(g,E):u(E,g)},equals:function(d,p){return c(d,p),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(d,p){c(d,p);var h=this.s*this.n*t.d-t.s*t.n*this.d;return(0<h)-(h<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var p=this.abs(),h=p.toContinued(),y=1;y<h.length;y++){for(var E=u(h[y-1],1),g=y-2;g>=0;g--)E=E.inverse().add(h[g]);if(E.sub(p).abs().valueOf()<d)return E.mul(this.s)}return this},divisible:function(d,p){return c(d,p),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(d){var p,h="",y=this.n,E=this.d;return this.s<0&&(h+="-"),E===1?h+=y:(d&&(p=Math.floor(y/E))>0&&(h+=p,h+=" ",y%=E),h+=y,h+="/",h+=E),h},toLatex:function(d){var p,h="",y=this.n,E=this.d;return this.s<0&&(h+="-"),E===1?h+=y:(d&&(p=Math.floor(y/E))>0&&(h+=p,y%=E),h+="\\frac{",h+=y,h+="}{",h+=E,h+="}"),h},toContinued:function(){var d,p=this.n,h=this.d,y=[];if(isNaN(p)||isNaN(h))return y;do y.push(Math.floor(p/h)),d=p%h,p=h,h=d;while(p!==1);return y},toString:function(d){var p=this.n,h=this.d;if(isNaN(p)||isNaN(h))return"NaN";d=d||15;var y=o(p,h),E=s(p,h,y),g=this.s<0?"-":"";if(g+=p/h|0,p%=h,p*=10,p&&(g+="."),y){for(var w=E;w--;)g+=p/h|0,p%=h,p*=10;g+="(";for(var w=y;w--;)g+=p/h|0,p%=h,p*=10;g+=")"}else for(var w=d;p&&w--;)g+=p/h|0,p%=h,p*=10;return g}},Object.defineProperty(v,"__esModule",{value:!0}),v.default=v,v.Fraction=v,e.exports=v})()})($f);var kh=$f.exports;const gt=Xn(kh);var Hh="Fraction",Gh=[],Vh=I(Hh,Gh,()=>(Object.defineProperty(gt,"name",{value:"Fraction"}),gt.prototype.constructor=gt,gt.prototype.type="Fraction",gt.prototype.isFraction=!0,gt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},gt.fromJSON=function(e){return new gt(e)},gt),{isClass:!0}),Zh="Range",Yh=[],Wh=I(Zh,Yh,()=>{function e(r,i,a){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var t=r!=null,n=i!=null,u=a!=null;if(t){if(ke(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter start must be a number")}if(n){if(ke(i))i=i.toNumber();else if(typeof i!="number")throw new TypeError("Parameter end must be a number")}if(u){if(ke(a))a=a.toNumber();else if(typeof a!="number")throw new TypeError("Parameter step must be a number")}this.start=t?parseFloat(r):0,this.end=n?parseFloat(i):0,this.step=u?parseFloat(a):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if(typeof r!="string")return null;var i=r.split(":"),a=i.map(function(n){return parseFloat(n)}),t=a.some(function(n){return isNaN(n)});if(t)return null;switch(a.length){case 2:return new e(a[0],a[1]);case 3:return new e(a[0],a[2],a[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var r=0,i=this.start,a=this.step,t=this.end,n=t-i;return Bt(a)===Bt(n)?r=Math.ceil(n/a):n===0&&(r=0),isNaN(r)&&(r=0),[r]},e.prototype.min=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start:this.start+(r-1)*this.step},e.prototype.max=function(){var r=this.size()[0];if(r>0)return this.step>0?this.start+(r-1)*this.step:this.start},e.prototype.forEach=function(r){var i=this.start,a=this.step,t=this.end,n=0;if(a>0)for(;i<t;)r(i,[n],this),i+=a,n++;else if(a<0)for(;i>t;)r(i,[n],this),i+=a,n++},e.prototype.map=function(r){var i=[];return this.forEach(function(a,t,n){i[t[0]]=r(a,t,n)}),i},e.prototype.toArray=function(){var r=[];return this.forEach(function(i,a){r[a[0]]=i}),r},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(r){var i=Ht(this.start,r);return this.step!==1&&(i+=":"+Ht(this.step,r)),i+=":"+Ht(this.end,r),i},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e},{isClass:!0}),Xh="Matrix",Jh=[],Qh=I(Xh,Jh,()=>{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(r,i){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(r,i,a){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(r){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(r,i,a){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(r,i){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(r,i){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(r,i){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(r){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(r){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 Kh(e){var r=0,i=1,a=Object.create(null),t=Object.create(null),n=0,u=function(c){var l=t[c];if(l&&(delete a[l],delete t[c],--r,i===l)){if(!r){n=0,i=1;return}for(;!hasOwnProperty.call(a,++i););}};return e=Math.abs(e),{hit:function(c){var l=t[c],o=++n;if(a[o]=c,t[c]=o,!l)return++r,r<=e?void 0:(c=a[i],u(c),c);if(delete a[l],i===l)for(;!hasOwnProperty.call(a,++i););},delete:u,clear:function(){r=n=0,i=1,a=Object.create(null),t=Object.create(null)}}}function Kn(e){var{hasher:r,limit:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=i??Number.POSITIVE_INFINITY,r=r??JSON.stringify,function a(){typeof a.cache!="object"&&(a.cache={values:new Map,lru:Kh(i||Number.POSITIVE_INFINITY)});for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var u=r(t);if(a.cache.values.has(u))return a.cache.lru.hit(u),a.cache.values.get(u);var f=e.apply(e,t);return a.cache.values.set(u,f),a.cache.values.delete(a.cache.lru.hit(u)),f}}function _f(e){return Object.keys(e.signatures||{}).reduce(function(r,i){var a=(i.match(/,/g)||[]).length+1;return Math.max(r,a)},-1)}var jh="DenseMatrix",e0=["Matrix"],r0=I(jh,e0,e=>{var{Matrix:r}=e;function i(o,s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(s&&!Br(s))throw new Error("Invalid datatype: "+s);if(Be(o))o.type==="DenseMatrix"?(this._data=$e(o._data),this._size=$e(o._size),this._datatype=s||o._datatype):(this._data=o.toArray(),this._size=o.size(),this._datatype=s||o._datatype);else if(o&&je(o.data)&&je(o.size))this._data=o.data,this._size=o.size,ko(this._data,this._size),this._datatype=s||o.datatype;else if(je(o))this._data=l(o),this._size=Ge(this._data),ko(this._data,this._size),this._datatype=s;else{if(o)throw new TypeError("Unsupported type of data ("+nr(o)+")");this._data=[],this._size=[0],this._datatype=s}}i.prototype=new r,i.prototype.createDenseMatrix=function(o,s){return new i(o,s)},Object.defineProperty(i,"name",{value:"DenseMatrix"}),i.prototype.constructor=i,i.prototype.type="DenseMatrix",i.prototype.isDenseMatrix=!0,i.prototype.getDataType=function(){return Vn(this._data,nr)},i.prototype.storage=function(){return"dense"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(o,s){return new i(o,s)},i.prototype.subset=function(o,s,m){switch(arguments.length){case 1:return a(this,o);case 2:case 3:return n(this,o,s,m);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(o){if(!je(o))throw new TypeError("Array expected");if(o.length!==this._size.length)throw new Le(o.length,this._size.length);for(var s=0;s<o.length;s++)rr(o[s],this._size[s]);for(var m=this._data,v=0,d=o.length;v<d;v++){var p=o[v];rr(p,m.length),m=m[p]}return m},i.prototype.set=function(o,s,m){if(!je(o))throw new TypeError("Array expected");if(o.length<this._size.length)throw new Le(o.length,this._size.length,"<");var v,d,p,h=o.map(function(E){return E+1});c(this,h,m);var y=this._data;for(v=0,d=o.length-1;v<d;v++)p=o[v],rr(p,y.length),y=y[p];return p=o[o.length-1],rr(p,y.length),y[p]=s,this};function a(o,s){if(!Wa(s))throw new TypeError("Invalid index");var m=s.isScalar();if(m)return o.get(s.min());var v=s.size();if(v.length!==o._size.length)throw new Le(v.length,o._size.length);for(var d=s.min(),p=s.max(),h=0,y=o._size.length;h<y;h++)rr(d[h],o._size[h]),rr(p[h],o._size[h]);return new i(t(o._data,s,v.length,0),o._datatype)}function t(o,s,m,v){var d=v===m-1,p=s.dimension(v);return d?p.map(function(h){return rr(h,o.length),o[h]}).valueOf():p.map(function(h){rr(h,o.length);var y=o[h];return t(y,s,m,v+1)}).valueOf()}function n(o,s,m,v){if(!s||s.isIndex!==!0)throw new TypeError("Invalid index");var d=s.size(),p=s.isScalar(),h;if(Be(m)?(h=m.size(),m=m.valueOf()):h=Ge(m),p){if(h.length!==0)throw new TypeError("Scalar expected");o.set(s.min(),m,v)}else{if(d.length<o._size.length)throw new Le(d.length,o._size.length,"<");if(h.length<d.length){for(var y=0,E=0;d[y]===1&&h[y]===1;)y++;for(;d[y]===1;)E++,y++;m=df(m,d.length,E,h)}if(!Gn(d,h))throw new Le(d,h,">");var g=s.max().map(function(b){return b+1});c(o,g,v);var w=d.length,x=0;u(o._data,s,m,w,x)}return o}function u(o,s,m,v,d){var p=d===v-1,h=s.dimension(d);p?h.forEach(function(y,E){rr(y),o[y]=m[E[0]]}):h.forEach(function(y,E){rr(y),u(o[y],s,m[E[0]],v,d+1)})}i.prototype.resize=function(o,s,m){if(!st(o))throw new TypeError("Array or Matrix expected");var v=o.valueOf().map(p=>Array.isArray(p)&&p.length===1?p[0]:p),d=m?this.clone():this;return f(d,v,s)};function f(o,s,m){if(s.length===0){for(var v=o._data;je(v);)v=v[0];return v}return o._size=s.slice(0),o._data=gn(o._data,o._size,m),o}i.prototype.reshape=function(o,s){var m=s?this.clone():this;m._data=mf(m._data,o);var v=m._size.reduce((d,p)=>d*p);return m._size=Gi(o,v),m};function c(o,s,m){for(var v=o._size.slice(0),d=!1;v.length<s.length;)v.push(0),d=!0;for(var p=0,h=s.length;p<h;p++)s[p]>v[p]&&(v[p]=s[p],d=!0);d&&f(o,v,m)}i.prototype.clone=function(){var o=new i({data:$e(this._data),size:$e(this._size),datatype:this._datatype});return o},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(o){var s=this,m=_f(o),v=function h(y,E){return je(y)?y.map(function(g,w){return h(g,E.concat(w))}):m===1?o(y):m===2?o(y,E):o(y,E,s)},d=v(this._data,[]),p=this._datatype!==void 0?Vn(d,nr):void 0;return new i(d,p)},i.prototype.forEach=function(o){var s=this,m=function v(d,p){je(d)?d.forEach(function(h,y){v(h,p.concat(y))}):o(d,p,s)};m(this._data,[])},i.prototype[Symbol.iterator]=function*(){var o=function*s(m,v){if(je(m))for(var d=0;d<m.length;d++)yield*s(m[d],v.concat(d));else yield{value:m,index:v}};yield*o(this._data,[])},i.prototype.rows=function(){var o=[],s=this.size();if(s.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var m=this._data;for(var v of m)o.push(new i([v],this._datatype));return o},i.prototype.columns=function(){var o=this,s=[],m=this.size();if(m.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var v=this._data,d=function(y){var E=v.map(g=>[g[y]]);s.push(new i(E,o._datatype))},p=0;p<m[1];p++)d(p);return s},i.prototype.toArray=function(){return $e(this._data)},i.prototype.valueOf=function(){return this._data},i.prototype.format=function(o){return Pe(this._data,o)},i.prototype.toString=function(){return Pe(this._data)},i.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(o){if(o){if(ke(o)&&(o=o.toNumber()),!Ve(o)||!Ce(o))throw new TypeError("The parameter k must be an integer number")}else o=0;for(var s=o>0?o:0,m=o<0?-o:0,v=this._size[0],d=this._size[1],p=Math.min(v-m,d-s),h=[],y=0;y<p;y++)h[y]=this._data[y+m][y+s];return new i({data:h,size:[p],datatype:this._datatype})},i.diagonal=function(o,s,m,v){if(!je(o))throw new TypeError("Array expected, size parameter");if(o.length!==2)throw new Error("Only two dimensions matrix are supported");if(o=o.map(function(A){if(ke(A)&&(A=A.toNumber()),!Ve(A)||!Ce(A)||A<1)throw new Error("Size values must be positive integers");return A}),m){if(ke(m)&&(m=m.toNumber()),!Ve(m)||!Ce(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var d=m>0?m:0,p=m<0?-m:0,h=o[0],y=o[1],E=Math.min(h-p,y-d),g;if(je(s)){if(s.length!==E)throw new Error("Invalid value array length");g=function(D){return s[D]}}else if(Be(s)){var w=s.size();if(w.length!==1||w[0]!==E)throw new Error("Invalid matrix length");g=function(D){return s.get([D])}}else g=function(){return s};v||(v=ke(g(0))?g(0).mul(0):0);var x=[];if(o.length>0){x=gn(x,o,v);for(var b=0;b<E;b++)x[b+p][b+d]=g(b)}return new i({data:x,size:[h,y]})},i.fromJSON=function(o){return new i(o)},i.prototype.swapRows=function(o,s){if(!Ve(o)||!Ce(o)||!Ve(s)||!Ce(s))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return rr(o,this._size[0]),rr(s,this._size[0]),i._swapRows(o,s,this._data),this},i._swapRows=function(o,s,m){var v=m[o];m[o]=m[s],m[s]=v};function l(o){for(var s=0,m=o.length;s<m;s++){var v=o[s];je(v)?o[s]=l(v):v&&v.isMatrix===!0&&(o[s]=l(v.valueOf()))}return o}return i},{isClass:!0}),Wo="clone",t0=["typed"],n0=I(Wo,t0,e=>{var{typed:r}=e;return r(Wo,{any:$e})});function If(e){var r=e.length,i=e[0].length,a,t,n=[];for(t=0;t<i;t++){var u=[];for(a=0;a<r;a++)u.push(e[a][t]);n.push(u)}return n}function En(e){for(var r=0;r<e.length;r++)if(st(e[r]))return!0;return!1}function At(e,r){Be(e)&&(e=e.valueOf());for(var i=0,a=e.length;i<a;i++){var t=e[i];Array.isArray(t)?At(t,r):r(t)}}function He(e,r,i){return e&&typeof e.map=="function"?e.map(function(a){return He(a,r)}):r(e)}function ti(e,r,i){var a=Array.isArray(e)?Ge(e):e.size();if(r<0||r>=a.length)throw new rt(r,a.length);return Be(e)?e.create(Ia(e.valueOf(),r,i)):Ia(e,r,i)}function Ia(e,r,i){var a,t,n,u;if(r<=0)if(Array.isArray(e[0])){for(u=If(e),t=[],a=0;a<u.length;a++)t[a]=Ia(u[a],r-1,i);return t}else{for(n=e[0],a=1;a<e.length;a++)n=i(n,e[a]);return n}else{for(t=[],a=0;a<e.length;a++)t[a]=Ia(e[a],r-1,i);return t}}function Xo(e,r,i,a,t,n,u,f,c,l,o){var s=e._values,m=e._index,v=e._ptr,d,p,h,y;if(a)for(p=v[r],h=v[r+1],d=p;d<h;d++)y=m[d],i[y]!==n?(i[y]=n,u.push(y),l?(a[y]=c?f(s[d],o):f(o,s[d]),t[y]=n):a[y]=s[d]):(a[y]=c?f(s[d],a[y]):f(a[y],s[d]),t[y]=n);else for(p=v[r],h=v[r+1],d=p;d<h;d++)y=m[d],i[y]!==n?(i[y]=n,u.push(y)):t[y]=n}var Jo="isInteger",a0=["typed"],i0=I(Jo,a0,e=>{var{typed:r}=e;return r(Jo,{number:Ce,BigNumber:function(a){return a.isInt()},Fraction:function(a){return a.d===1&&isFinite(a.n)},"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),tt="number",Zt="number, number";function Rf(e){return Math.abs(e)}Rf.signature=tt;function qf(e,r){return e+r}qf.signature=Zt;function zf(e,r){return e*r}zf.signature=Zt;function Pf(e){return-e}Pf.signature=tt;function Uf(e){return e}Uf.signature=tt;function kn(e){return sd(e)}kn.signature=tt;function Lf(e){return e*e*e}Lf.signature=tt;function kf(e){return Math.exp(e)}kf.signature=tt;function Hf(e){return ld(e)}Hf.signature=tt;function Gf(e,r){if(!Ce(e)||!Ce(r))throw new Error("Parameters in function gcd must be integer numbers");for(var i;r!==0;)i=e%r,e=r,r=i;return e<0?-e:e}Gf.signature=Zt;function Vf(e,r){if(!Ce(e)||!Ce(r))throw new Error("Parameters in function lcm must be integer numbers");if(e===0||r===0)return 0;for(var i,a=e*r;r!==0;)i=r,r=e%i,e=i;return Math.abs(a/e)}Vf.signature=Zt;function o0(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}function Zf(e){return od(e)}Zf.signature=tt;function Yf(e){return id(e)}Yf.signature=tt;function Wf(e,r){if(r>0)return e-r*Math.floor(e/r);if(r===0)return e;throw new Error("Cannot calculate mod for a negative divisor")}Wf.signature=Zt;function Qo(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,i=r<0;if(i&&(r=-r),r===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return i?1/0:0;if(!isFinite(e))return i?0:e;var a=Math.pow(Math.abs(e),1/r);return a=e<0?-a:a,i?1/a:a}function _i(e){return Bt(e)}_i.signature=tt;function Xf(e){return e*e}Xf.signature=tt;function Jf(e,r){var i,a,t,n=0,u=1,f=1,c=0;if(!Ce(e)||!Ce(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)a=Math.floor(e/r),t=e-a*r,i=n,n=u-a*n,u=i,i=f,f=c-a*f,c=i,e=r,r=t;var l;return e<0?l=[-e,-u,-c]:l=[e,e?u:0,c],l}Jf.signature=Zt;function Qf(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}Qf.signature=Zt;function Ko(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Ce(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(sf(e,r))}var u0="number",Sn="number, number";function Kf(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function bitAnd");return e&r}Kf.signature=Sn;function jf(e){if(!Ce(e))throw new Error("Integer expected in function bitNot");return~e}jf.signature=u0;function em(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function bitOr");return e|r}em.signature=Sn;function rm(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function bitXor");return e^r}rm.signature=Sn;function tm(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function leftShift");return e<<r}tm.signature=Sn;function nm(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function rightArithShift");return e>>r}nm.signature=Sn;function am(e,r){if(!Ce(e)||!Ce(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}am.signature=Sn;function xt(e,r){if(r<e)return 1;if(r===e)return r;var i=r+e>>1;return xt(e,i)*xt(i+1,r)}function im(e,r){if(!Ce(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!Ce(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var i=e-r,a=1,t=r<i?i+1:r+1,n=2,u=r<i?r:i,f=t;f<=e;++f)for(a*=f;n<=u&&a%n===0;)a/=n,++n;return n<=u&&(a/=xt(n,u)),a}im.signature="number, number";var s0=Math.PI,l0=2*Math.PI,c0=Math.E,f0=1.618033988749895,m0="number",Xi="number, number";function om(e){return!e}om.signature=m0;function um(e,r){return!!(e||r)}um.signature=Xi;function sm(e,r){return!!e!=!!r}sm.signature=Xi;function lm(e,r){return!!(e&&r)}lm.signature=Xi;function Ra(e){var r;if(Ce(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:xt(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Ra(1-e));if(e>=171.35)return 1/0;if(e>85){var i=e*e,a=i*e,t=a*e,n=t*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*i)-139/(51840*a)-571/(2488320*t)+163879/(209018880*n)+5246819/(75246796800*n*e))}--e,r=hn[0];for(var u=1;u<hn.length;++u)r+=hn[u]/(e+u);var f=e+cm+.5;return Math.sqrt(2*Math.PI)*Math.pow(f,e+.5)*Math.exp(-f)*r}Ra.signature="number";var cm=4.7421875,hn=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],fm=.9189385332046728,v0=5,p0=7,jo=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function qa(e){if(e<0)return NaN;if(e===0)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-qa(1-e);e=e-1;for(var r=e+v0+.5,i=jo[0],a=p0-1;a>=1;a--)i+=jo[a]/(e+a);return fm+(e+.5)*Math.log(r)-r+Math.log(i)}qa.signature="number";var Cr="number";function mm(e){return pd(e)}mm.signature=Cr;function vm(e){return Math.atan(1/e)}vm.signature=Cr;function pm(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}pm.signature=Cr;function dm(e){return Math.asin(1/e)}dm.signature=Cr;function hm(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}hm.signature=Cr;function gm(e){return Math.acos(1/e)}gm.signature=Cr;function ym(e){var r=1/e,i=Math.sqrt(r*r-1);return Math.log(i+r)}ym.signature=Cr;function bm(e){return dd(e)}bm.signature=Cr;function xm(e){return hd(e)}xm.signature=Cr;function wm(e){return 1/Math.tan(e)}wm.signature=Cr;function Nm(e){var r=Math.exp(2*e);return(r+1)/(r-1)}Nm.signature=Cr;function Dm(e){return 1/Math.sin(e)}Dm.signature=Cr;function Am(e){return e===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Bt(e)}Am.signature=Cr;function Em(e){return 1/Math.cos(e)}Em.signature=Cr;function Sm(e){return 2/(Math.exp(e)+Math.exp(-e))}Sm.signature=Cr;function Cm(e){return yd(e)}Cm.signature=Cr;var ni="number";function Mm(e){return e<0}Mm.signature=ni;function Fm(e){return e>0}Fm.signature=ni;function Bm(e){return e===0}Bm.signature=ni;function Tm(e){return Number.isNaN(e)}Tm.signature=ni;var eu="isNegative",d0=["typed"],h0=I(eu,d0,e=>{var{typed:r}=e;return r(eu,{number:Mm,BigNumber:function(a){return a.isNeg()&&!a.isZero()&&!a.isNaN()},Fraction:function(a){return a.s<0},Unit:r.referToSelf(i=>a=>r.find(i,a.valueType())(a.value)),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),ru="isNumeric",g0=["typed"],y0=I(ru,g0,e=>{var{typed:r}=e;return r(ru,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),tu="hasNumericValue",b0=["typed","isNumeric"],x0=I(tu,b0,e=>{var{typed:r,isNumeric:i}=e;return r(tu,{boolean:()=>!0,string:function(t){return t.trim().length>0&&!isNaN(Number(t))},any:function(t){return i(t)}})}),nu="isPositive",w0=["typed"],N0=I(nu,w0,e=>{var{typed:r}=e;return r(nu,{number:Fm,BigNumber:function(a){return!a.isNeg()&&!a.isZero()&&!a.isNaN()},Fraction:function(a){return a.s>0&&a.n>0},Unit:r.referToSelf(i=>a=>r.find(i,a.valueType())(a.value)),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),au="isZero",D0=["typed"],A0=I(au,D0,e=>{var{typed:r}=e;return r(au,{number:Bm,BigNumber:function(a){return a.isZero()},Complex:function(a){return a.re===0&&a.im===0},Fraction:function(a){return a.d===1&&a.n===0},Unit:r.referToSelf(i=>a=>r.find(i,a.valueType())(a.value)),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),iu="isNaN",E0=["typed"],S0=I(iu,E0,e=>{var{typed:r}=e;return r(iu,{number:Tm,BigNumber:function(a){return a.isNaN()},Fraction:function(a){return!1},Complex:function(a){return a.isNaN()},Unit:function(a){return Number.isNaN(a.value)},"Array | Matrix":function(a){return He(a,Number.isNaN)}})}),ou="typeOf",C0=["typed"],M0=I(ou,C0,e=>{var{typed:r}=e;return r(ou,{any:nr})});function ct(e,r,i){if(i==null)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var a=e.minus(r).abs();if(a.isZero())return!0;var t=e.constructor.max(e.abs(),r.abs());return a.lte(t.times(i))}return!1}function F0(e,r,i){return Pr(e.re,r.re,i)&&Pr(e.im,r.im,i)}var Cn=I("compareUnits",["typed"],e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf(i=>(a,t)=>{if(!a.equalBase(t))throw new Error("Cannot compare units with different base");return r.find(i,[a.valueType(),t.valueType()])(a.value,t.value)})}}),za="equalScalar",B0=["typed","config"],T0=I(za,B0,e=>{var{typed:r,config:i}=e,a=Cn({typed:r});return r(za,{"boolean, boolean":function(n,u){return n===u},"number, number":function(n,u){return Pr(n,u,i.epsilon)},"BigNumber, BigNumber":function(n,u){return n.eq(u)||ct(n,u,i.epsilon)},"Fraction, Fraction":function(n,u){return n.equals(u)},"Complex, Complex":function(n,u){return F0(n,u,i.epsilon)}},a)});I(za,["typed","config"],e=>{var{typed:r,config:i}=e;return r(za,{"number, number":function(t,n){return Pr(t,n,i.epsilon)}})});var O0="SparseMatrix",$0=["typed","equalScalar","Matrix"],_0=I(O0,$0,e=>{var{typed:r,equalScalar:i,Matrix:a}=e;function t(p,h){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(h&&!Br(h))throw new Error("Invalid datatype: "+h);if(Be(p))n(this,p,h);else if(p&&je(p.index)&&je(p.ptr)&&je(p.size))this._values=p.values,this._index=p.index,this._ptr=p.ptr,this._size=p.size,this._datatype=h||p.datatype;else if(je(p))u(this,p,h);else{if(p)throw new TypeError("Unsupported type of data ("+nr(p)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=h}}function n(p,h,y){h.type==="SparseMatrix"?(p._values=h._values?$e(h._values):void 0,p._index=$e(h._index),p._ptr=$e(h._ptr),p._size=$e(h._size),p._datatype=y||h._datatype):u(p,h.valueOf(),y||h._datatype)}function u(p,h,y){p._values=[],p._index=[],p._ptr=[],p._datatype=y;var E=h.length,g=0,w=i,x=0;if(Br(y)&&(w=r.find(i,[y,y])||i,x=r.convert(0,y)),E>0){var b=0;do{p._ptr.push(p._index.length);for(var A=0;A<E;A++){var D=h[A];if(je(D)){if(b===0&&g<D.length&&(g=D.length),b<D.length){var S=D[b];w(S,x)||(p._values.push(S),p._index.push(A))}}else b===0&&g<1&&(g=1),w(D,x)||(p._values.push(D),p._index.push(A))}b++}while(b<g)}p._ptr.push(p._index.length),p._size=[E,g]}t.prototype=new a,t.prototype.createSparseMatrix=function(p,h){return new t(p,h)},Object.defineProperty(t,"name",{value:"SparseMatrix"}),t.prototype.constructor=t,t.prototype.type="SparseMatrix",t.prototype.isSparseMatrix=!0,t.prototype.getDataType=function(){return Vn(this._values,nr)},t.prototype.storage=function(){return"sparse"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(p,h){return new t(p,h)},t.prototype.density=function(){var p=this._size[0],h=this._size[1];return p!==0&&h!==0?this._index.length/(p*h):0},t.prototype.subset=function(p,h,y){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return f(this,p);case 2:case 3:return c(this,p,h,y);default:throw new SyntaxError("Wrong number of arguments")}};function f(p,h){if(!Wa(h))throw new TypeError("Invalid index");var y=h.isScalar();if(y)return p.get(h.min());var E=h.size();if(E.length!==p._size.length)throw new Le(E.length,p._size.length);var g,w,x,b,A=h.min(),D=h.max();for(g=0,w=p._size.length;g<w;g++)rr(A[g],p._size[g]),rr(D[g],p._size[g]);var S=p._values,N=p._index,B=p._ptr,F=h.dimension(0),$=h.dimension(1),q=[],_=[];F.forEach(function(O,L){_[O]=L[0],q[O]=!0});var C=S?[]:void 0,T=[],H=[];return $.forEach(function(O){for(H.push(T.length),x=B[O],b=B[O+1];x<b;x++)g=N[x],q[g]===!0&&(T.push(_[g]),C&&C.push(S[x]))}),H.push(T.length),new t({values:C,index:T,ptr:H,size:E,datatype:p._datatype})}function c(p,h,y,E){if(!h||h.isIndex!==!0)throw new TypeError("Invalid index");var g=h.size(),w=h.isScalar(),x;if(Be(y)?(x=y.size(),y=y.toArray()):x=Ge(y),w){if(x.length!==0)throw new TypeError("Scalar expected");p.set(h.min(),y,E)}else{if(g.length!==1&&g.length!==2)throw new Le(g.length,p._size.length,"<");if(x.length<g.length){for(var b=0,A=0;g[b]===1&&x[b]===1;)b++;for(;g[b]===1;)A++,b++;y=df(y,g.length,A,x)}if(!Gn(g,x))throw new Le(g,x,">");if(g.length===1){var D=h.dimension(0);D.forEach(function(B,F){rr(B),p.set([B,0],y[F[0]],E)})}else{var S=h.dimension(0),N=h.dimension(1);S.forEach(function(B,F){rr(B),N.forEach(function($,q){rr($),p.set([B,$],y[F[0]][q[0]],E)})})}}return p}t.prototype.get=function(p){if(!je(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Le(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var h=p[0],y=p[1];rr(h,this._size[0]),rr(y,this._size[1]);var E=l(h,this._ptr[y],this._ptr[y+1],this._index);return E<this._ptr[y+1]&&this._index[E]===h?this._values[E]:0},t.prototype.set=function(p,h,y){if(!je(p))throw new TypeError("Array expected");if(p.length!==this._size.length)throw new Le(p.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var E=p[0],g=p[1],w=this._size[0],x=this._size[1],b=i,A=0;Br(this._datatype)&&(b=r.find(i,[this._datatype,this._datatype])||i,A=r.convert(0,this._datatype)),(E>w-1||g>x-1)&&(m(this,Math.max(E+1,w),Math.max(g+1,x),y),w=this._size[0],x=this._size[1]),rr(E,w),rr(g,x);var D=l(E,this._ptr[g],this._ptr[g+1],this._index);return D<this._ptr[g+1]&&this._index[D]===E?b(h,A)?o(D,g,this._values,this._index,this._ptr):this._values[D]=h:b(h,A)||s(D,E,g,h,this._values,this._index,this._ptr),this};function l(p,h,y,E){if(y-h===0)return y;for(var g=h;g<y;g++)if(E[g]===p)return g;return h}function o(p,h,y,E,g){y.splice(p,1),E.splice(p,1);for(var w=h+1;w<g.length;w++)g[w]--}function s(p,h,y,E,g,w,x){g.splice(p,0,E),w.splice(p,0,h);for(var b=y+1;b<x.length;b++)x[b]++}t.prototype.resize=function(p,h,y){if(!st(p))throw new TypeError("Array or Matrix expected");var E=p.valueOf().map(w=>Array.isArray(w)&&w.length===1?w[0]:w);if(E.length!==2)throw new Error("Only two dimensions matrix are supported");E.forEach(function(w){if(!Ve(w)||!Ce(w)||w<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Pe(E)+")")});var g=y?this.clone():this;return m(g,E[0],E[1],h)};function m(p,h,y,E){var g=E||0,w=i,x=0;Br(p._datatype)&&(w=r.find(i,[p._datatype,p._datatype])||i,x=r.convert(0,p._datatype),g=r.convert(g,p._datatype));var b=!w(g,x),A=p._size[0],D=p._size[1],S,N,B;if(y>D){for(N=D;N<y;N++)if(p._ptr[N]=p._values.length,b)for(S=0;S<A;S++)p._values.push(g),p._index.push(S);p._ptr[y]=p._values.length}else y<D&&(p._ptr.splice(y+1,D-y),p._values.splice(p._ptr[y],p._values.length),p._index.splice(p._ptr[y],p._index.length));if(D=y,h>A){if(b){var F=0;for(N=0;N<D;N++){p._ptr[N]=p._ptr[N]+F,B=p._ptr[N+1]+F;var $=0;for(S=A;S<h;S++,$++)p._values.splice(B+$,0,g),p._index.splice(B+$,0,S),F++}p._ptr[D]=p._values.length}}else if(h<A){var q=0;for(N=0;N<D;N++){p._ptr[N]=p._ptr[N]-q;var _=p._ptr[N],C=p._ptr[N+1]-q;for(B=_;B<C;B++)S=p._index[B],S>h-1&&(p._values.splice(B,1),p._index.splice(B,1),q++)}p._ptr[N]=p._values.length}return p._size[0]=h,p._size[1]=y,p}t.prototype.reshape=function(p,h){if(!je(p))throw new TypeError("Array expected");if(p.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");p.forEach(function(O){if(!Ve(O)||!Ce(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Pe(p)+")")});var y=this._size[0]*this._size[1];p=Gi(p,y);var E=p[0]*p[1];if(y!==E)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var g=h?this.clone():this;if(this._size[0]===p[0]&&this._size[1]===p[1])return g;for(var w=[],x=0;x<g._ptr.length;x++)for(var b=0;b<g._ptr[x+1]-g._ptr[x];b++)w.push(x);for(var A=g._values.slice(),D=g._index.slice(),S=0;S<g._index.length;S++){var N=D[S],B=w[S],F=N*g._size[1]+B;w[S]=F%p[1],D[S]=Math.floor(F/p[1])}g._values.length=0,g._index.length=0,g._ptr.length=p[1]+1,g._size=p.slice();for(var $=0;$<g._ptr.length;$++)g._ptr[$]=0;for(var q=0;q<A.length;q++){var _=D[q],C=w[q],T=A[q],H=l(_,g._ptr[C],g._ptr[C+1],g._index);s(H,_,C,T,g._values,g._index,g._ptr)}return g},t.prototype.clone=function(){var p=new t({values:this._values?$e(this._values):void 0,index:$e(this._index),ptr:$e(this._ptr),size:$e(this._size),datatype:this._datatype});return p},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(p,h){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var y=this,E=this._size[0],g=this._size[1],w=_f(p),x=function(A,D,S){return w===1?p(A):w===2?p(A,[D,S]):p(A,[D,S],y)};return v(this,0,E-1,0,g-1,x,h)};function v(p,h,y,E,g,w,x){var b=[],A=[],D=[],S=i,N=0;Br(p._datatype)&&(S=r.find(i,[p._datatype,p._datatype])||i,N=r.convert(0,p._datatype));for(var B=function(P,J,ee){P=w(P,J,ee),S(P,N)||(b.push(P),A.push(J))},F=E;F<=g;F++){D.push(b.length);var $=p._ptr[F],q=p._ptr[F+1];if(x)for(var _=$;_<q;_++){var C=p._index[_];C>=h&&C<=y&&B(p._values[_],C-h,F-E)}else{for(var T={},H=$;H<q;H++){var O=p._index[H];T[O]=p._values[H]}for(var L=h;L<=y;L++){var W=L in T?T[L]:0;B(W,L-h,F-E)}}}return D.push(b.length),new t({values:b,index:A,ptr:D,size:[y-h+1,g-E+1]})}t.prototype.forEach=function(p,h){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var y=this,E=this._size[0],g=this._size[1],w=0;w<g;w++){var x=this._ptr[w],b=this._ptr[w+1];if(h)for(var A=x;A<b;A++){var D=this._index[A];p(this._values[A],[D,w],y)}else{for(var S={},N=x;N<b;N++){var B=this._index[N];S[B]=this._values[N]}for(var F=0;F<E;F++){var $=F in S?S[F]:0;p($,[F,w],y)}}}},t.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var p=this._size[1],h=0;h<p;h++)for(var y=this._ptr[h],E=this._ptr[h+1],g=y;g<E;g++){var w=this._index[g];yield{value:this._values[g],index:[w,h]}}},t.prototype.toArray=function(){return d(this._values,this._index,this._ptr,this._size,!0)},t.prototype.valueOf=function(){return d(this._values,this._index,this._ptr,this._size,!1)};function d(p,h,y,E,g){var w=E[0],x=E[1],b=[],A,D;for(A=0;A<w;A++)for(b[A]=[],D=0;D<x;D++)b[A][D]=0;for(D=0;D<x;D++)for(var S=y[D],N=y[D+1],B=S;B<N;B++)A=h[B],b[A][D]=p?g?$e(p[B]):p[B]:1;return b}return t.prototype.format=function(p){for(var h=this._size[0],y=this._size[1],E=this.density(),g="Sparse Matrix ["+Pe(h,p)+" x "+Pe(y,p)+"] density: "+Pe(E,p)+`
|
||
`,w=0;w<y;w++)for(var x=this._ptr[w],b=this._ptr[w+1],A=x;A<b;A++){var D=this._index[A];g+=`
|
||
(`+Pe(D,p)+", "+Pe(w,p)+") ==> "+(this._values?Pe(this._values[A],p):"X")}return g},t.prototype.toString=function(){return Pe(this.toArray())},t.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(p){if(p){if(ke(p)&&(p=p.toNumber()),!Ve(p)||!Ce(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var h=p>0?p:0,y=p<0?-p:0,E=this._size[0],g=this._size[1],w=Math.min(E-y,g-h),x=[],b=[],A=[];A[0]=0;for(var D=h;D<g&&x.length<w;D++)for(var S=this._ptr[D],N=this._ptr[D+1],B=S;B<N;B++){var F=this._index[B];if(F===D-h+y){x.push(this._values[B]),b[x.length-1]=F-y;break}}return A.push(x.length),new t({values:x,index:b,ptr:A,size:[w,1]})},t.fromJSON=function(p){return new t(p)},t.diagonal=function(p,h,y,E,g){if(!je(p))throw new TypeError("Array expected, size parameter");if(p.length!==2)throw new Error("Only two dimensions matrix are supported");if(p=p.map(function(O){if(ke(O)&&(O=O.toNumber()),!Ve(O)||!Ce(O)||O<1)throw new Error("Size values must be positive integers");return O}),y){if(ke(y)&&(y=y.toNumber()),!Ve(y)||!Ce(y))throw new TypeError("The parameter k must be an integer number")}else y=0;var w=i,x=0;Br(g)&&(w=r.find(i,[g,g])||i,x=r.convert(0,g));var b=y>0?y:0,A=y<0?-y:0,D=p[0],S=p[1],N=Math.min(D-A,S-b),B;if(je(h)){if(h.length!==N)throw new Error("Invalid value array length");B=function(L){return h[L]}}else if(Be(h)){var F=h.size();if(F.length!==1||F[0]!==N)throw new Error("Invalid matrix length");B=function(L){return h.get([L])}}else B=function(){return h};for(var $=[],q=[],_=[],C=0;C<S;C++){_.push($.length);var T=C-b;if(T>=0&&T<N){var H=B(T);w(H,x)||(q.push(T+A),$.push(H))}}return _.push($.length),new t({values:$,index:q,ptr:_,size:[D,S]})},t.prototype.swapRows=function(p,h){if(!Ve(p)||!Ce(p)||!Ve(h)||!Ce(h))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return rr(p,this._size[0]),rr(h,this._size[0]),t._swapRows(p,h,this._size[1],this._values,this._index,this._ptr),this},t._forEachRow=function(p,h,y,E,g){for(var w=E[p],x=E[p+1],b=w;b<x;b++)g(y[b],h[b])},t._swapRows=function(p,h,y,E,g,w){for(var x=0;x<y;x++){var b=w[x],A=w[x+1],D=l(p,b,A,g),S=l(h,b,A,g);if(D<A&&S<A&&g[D]===p&&g[S]===h){if(E){var N=E[D];E[D]=E[S],E[S]=N}continue}if(D<A&&g[D]===p&&(S>=A||g[S]!==h)){var B=E?E[D]:void 0;g.splice(S,0,h),E&&E.splice(S,0,B),g.splice(S<=D?D+1:D,1),E&&E.splice(S<=D?D+1:D,1);continue}if(S<A&&g[S]===h&&(D>=A||g[D]!==p)){var F=E?E[S]:void 0;g.splice(D,0,p),E&&E.splice(D,0,F),g.splice(D<=S?S+1:S,1),E&&E.splice(D<=S?S+1:S,1)}}},t},{isClass:!0}),I0="number",R0=["typed"];function q0(e){var r=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(r){var i={"0b":2,"0o":8,"0x":16}[r[1]],a=r[2],t=r[3];return{input:e,radix:i,integerPart:a,fractionalPart:t}}else return null}function z0(e){for(var r=parseInt(e.integerPart,e.radix),i=0,a=0;a<e.fractionalPart.length;a++){var t=parseInt(e.fractionalPart[a],e.radix);i+=t/Math.pow(e.radix,a+1)}var n=r+i;if(isNaN(n))throw new SyntaxError('String "'+e.input+'" is no valid number');return n}var P0=I(I0,R0,e=>{var{typed:r}=e,i=r("number",{"":function(){return 0},number:function(t){return t},string:function(t){if(t==="NaN")return NaN;var n=q0(t);if(n)return z0(n);var u=0,f=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);f&&(u=Number(f[2]),t=f[1]);var c=Number(t);if(isNaN(c))throw new SyntaxError('String "'+t+'" is no valid number');if(f){if(c>2**u-1)throw new SyntaxError('String "'.concat(t,'" is out of range'));c>=2**(u-1)&&(c=c-2**u)}return c},BigNumber:function(t){return t.toNumber()},Fraction:function(t){return t.valueOf()},Unit:r.referToSelf(a=>t=>{var n=t.clone();return n.value=a(t.value),n}),null:function(t){return 0},"Unit, string | Unit":function(t,n){return t.toNumber(n)},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))});return i.fromJSON=function(a){return parseFloat(a.value)},i}),uu="string",U0=["typed"],L0=I(uu,U0,e=>{var{typed:r}=e;return r(uu,{"":function(){return""},number:Ht,null:function(a){return"null"},boolean:function(a){return a+""},string:function(a){return a},"Array | Matrix":r.referToSelf(i=>a=>He(a,i)),any:function(a){return String(a)}})}),su="boolean",k0=["typed"],H0=I(su,k0,e=>{var{typed:r}=e;return r(su,{"":function(){return!1},boolean:function(a){return a},number:function(a){return!!a},null:function(a){return!1},BigNumber:function(a){return!a.isZero()},string:function(a){var t=a.toLowerCase();if(t==="true")return!0;if(t==="false")return!1;var n=Number(a);if(a!==""&&!isNaN(n))return!!n;throw new Error('Cannot convert "'+a+'" to a boolean')},"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),G0="bignumber",V0=["typed","BigNumber"],Z0=I(G0,V0,e=>{var{typed:r,BigNumber:i}=e;return r("bignumber",{"":function(){return new i(0)},number:function(t){return new i(t+"")},string:function(t){var n=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(n){var u=n[2],f=i(n[1]),c=new i(2).pow(Number(u));if(f.gt(c.sub(1)))throw new SyntaxError('String "'.concat(t,'" is out of range'));var l=new i(2).pow(Number(u)-1);return f.gte(l)?f.sub(c):f}return new i(t)},BigNumber:function(t){return t},Unit:r.referToSelf(a=>t=>{var n=t.clone();return n.value=a(t.value),n}),Fraction:function(t){return new i(t.n).div(t.d).times(t.s)},null:function(t){return new i(0)},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))})}),Y0="complex",W0=["typed","Complex"],X0=I(Y0,W0,e=>{var{typed:r,Complex:i}=e;return r("complex",{"":function(){return i.ZERO},number:function(t){return new i(t,0)},"number, number":function(t,n){return new i(t,n)},"BigNumber, BigNumber":function(t,n){return new i(t.toNumber(),n.toNumber())},Fraction:function(t){return new i(t.valueOf(),0)},Complex:function(t){return t.clone()},string:function(t){return i(t)},null:function(t){return i(0)},Object:function(t){if("re"in t&&"im"in t)return new i(t.re,t.im);if("r"in t&&"phi"in t||"abs"in t&&"arg"in t)return new i(t);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))})}),J0="fraction",Q0=["typed","Fraction"],K0=I(J0,Q0,e=>{var{typed:r,Fraction:i}=e;return r("fraction",{number:function(t){if(!isFinite(t)||isNaN(t))throw new Error(t+" cannot be represented as a fraction");return new i(t)},string:function(t){return new i(t)},"number, number":function(t,n){return new i(t,n)},null:function(t){return new i(0)},BigNumber:function(t){return new i(t.toString())},Fraction:function(t){return t},Unit:r.referToSelf(a=>t=>{var n=t.clone();return n.value=a(t.value),n}),Object:function(t){return new i(t)},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))})}),lu="matrix",j0=["typed","Matrix","DenseMatrix","SparseMatrix"],eg=I(lu,j0,e=>{var{typed:r,Matrix:i,DenseMatrix:a,SparseMatrix:t}=e;return r(lu,{"":function(){return n([])},string:function(f){return n([],f)},"string, string":function(f,c){return n([],f,c)},Array:function(f){return n(f)},Matrix:function(f){return n(f,f.storage())},"Array | Matrix, string":n,"Array | Matrix, string, string":n});function n(u,f,c){if(f==="dense"||f==="default"||f===void 0)return new a(u,c);if(f==="sparse")return new t(u,c);throw new TypeError("Unknown matrix type "+JSON.stringify(f)+".")}}),cu="matrixFromFunction",rg=["typed","matrix","isZero"],tg=I(cu,rg,e=>{var{typed:r,matrix:i,isZero:a}=e;return r(cu,{"Array | Matrix, function, string, string":function(u,f,c,l){return t(u,f,c,l)},"Array | Matrix, function, string":function(u,f,c){return t(u,f,c)},"Matrix, function":function(u,f){return t(u,f,"dense")},"Array, function":function(u,f){return t(u,f,"dense").toArray()},"Array | Matrix, string, function":function(u,f,c){return t(u,c,f)},"Array | Matrix, string, string, function":function(u,f,c,l){return t(u,l,f,c)}});function t(n,u,f,c){var l;return c!==void 0?l=i(f,c):l=i(f),l.resize(n),l.forEach(function(o,s){var m=u(s);a(m)||l.set(s,m)}),l}}),fu="matrixFromRows",ng=["typed","matrix","flatten","size"],ag=I(fu,ng,e=>{var{typed:r,matrix:i,flatten:a,size:t}=e;return r(fu,{"...Array":function(c){return n(c)},"...Matrix":function(c){return i(n(c.map(l=>l.toArray())))}});function n(f){if(f.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var c=u(f[0]),l=[];for(var o of f){var s=u(o);if(s!==c)throw new TypeError("The vectors had different length: "+(c|0)+" ≠ "+(s|0));l.push(a(o))}return l}function u(f){var c=t(f);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),mu="matrixFromColumns",ig=["typed","matrix","flatten","size"],og=I(mu,ig,e=>{var{typed:r,matrix:i,flatten:a,size:t}=e;return r(mu,{"...Array":function(c){return n(c)},"...Matrix":function(c){return i(n(c.map(l=>l.toArray())))}});function n(f){if(f.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var c=u(f[0]),l=[],o=0;o<c;o++)l[o]=[];for(var s of f){var m=u(s);if(m!==c)throw new TypeError("The vectors had different length: "+(c|0)+" ≠ "+(m|0));for(var v=a(s),d=0;d<c;d++)l[d].push(v[d])}return l}function u(f){var c=t(f);if(c.length===1)return c[0];if(c.length===2){if(c[0]===1)return c[1];if(c[1]===1)return c[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}}),vu="splitUnit",ug=["typed"],sg=I(vu,ug,e=>{var{typed:r}=e;return r(vu,{"Unit, Array":function(a,t){return a.splitUnit(t)}})}),pu="unaryMinus",lg=["typed"],cg=I(pu,lg,e=>{var{typed:r}=e;return r(pu,{number:Pf,"Complex | BigNumber | Fraction":i=>i.neg(),Unit:r.referToSelf(i=>a=>{var t=a.clone();return t.value=r.find(i,t.valueType())(a.value),t}),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),du="unaryPlus",fg=["typed","config","BigNumber"],mg=I(du,fg,e=>{var{typed:r,config:i,BigNumber:a}=e;return r(du,{number:Uf,Complex:function(n){return n},BigNumber:function(n){return n},Fraction:function(n){return n},Unit:function(n){return n.clone()},"Array | Matrix":r.referToSelf(t=>n=>He(n,t)),"boolean | string":function(n){return i.number==="BigNumber"?new a(+n):+n}})}),hu="abs",vg=["typed"],pg=I(hu,vg,e=>{var{typed:r}=e;return r(hu,{number:Rf,"Complex | BigNumber | Fraction | Unit":i=>i.abs(),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),gu="apply",dg=["typed","isInteger"],Om=I(gu,dg,e=>{var{typed:r,isInteger:i}=e;return r(gu,{"Array | Matrix, number | BigNumber, function":function(t,n,u){if(!i(n))throw new TypeError("Integer number expected for dimension");var f=Array.isArray(t)?Ge(t):t.size();if(n<0||n>=f.length)throw new rt(n,f.length);return Be(t)?t.create(Pa(t.valueOf(),n,u)):Pa(t,n,u)}})});function Pa(e,r,i){var a,t,n;if(r<=0)if(Array.isArray(e[0])){for(n=hg(e),t=[],a=0;a<n.length;a++)t[a]=Pa(n[a],r-1,i);return t}else return i(e);else{for(t=[],a=0;a<e.length;a++)t[a]=Pa(e[a],r-1,i);return t}}function hg(e){var r=e.length,i=e[0].length,a,t,n=[];for(t=0;t<i;t++){var u=[];for(a=0;a<r;a++)u.push(e[a][t]);n.push(u)}return n}var yu="addScalar",gg=["typed"],yg=I(yu,gg,e=>{var{typed:r}=e;return r(yu,{"number, number":qf,"Complex, Complex":function(a,t){return a.add(t)},"BigNumber, BigNumber":function(a,t){return a.plus(t)},"Fraction, Fraction":function(a,t){return a.add(t)},"Unit, Unit":r.referToSelf(i=>(a,t)=>{if(a.value===null||a.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(t.value===null||t.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!a.equalBase(t))throw new Error("Units do not match");var n=a.clone();return n.value=r.find(i,[n.valueType(),t.valueType()])(n.value,t.value),n.fixPrefix=!1,n})})}),bu="cbrt",bg=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],xg=I(bu,bg,e=>{var{config:r,typed:i,isNegative:a,unaryMinus:t,matrix:n,Complex:u,BigNumber:f,Fraction:c}=e;return i(bu,{number:kn,Complex:l,"Complex, boolean":l,BigNumber:function(m){return m.cbrt()},Unit:o});function l(s,m){var v=s.arg()/3,d=s.abs(),p=new u(kn(d),0).mul(new u(0,v).exp());if(m){var h=[p,new u(kn(d),0).mul(new u(0,v+Math.PI*2/3).exp()),new u(kn(d),0).mul(new u(0,v-Math.PI*2/3).exp())];return r.matrix==="Array"?h:n(h)}else return p}function o(s){if(s.value&&wt(s.value)){var m=s.clone();return m.value=1,m=m.pow(1/3),m.value=l(s.value),m}else{var v=a(s.value);v&&(s.value=t(s.value));var d;ke(s.value)?d=new f(1).div(3):Jn(s.value)?d=new c(1,3):d=1/3;var p=s.pow(d);return v&&(p.value=t(p.value)),p}}}),wg="matAlgo11xS0s",Ng=["typed","equalScalar"],Dr=I(wg,Ng,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u,f){var c=t._values,l=t._index,o=t._ptr,s=t._size,m=t._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=s[0],d=s[1],p,h=i,y=0,E=u;typeof m=="string"&&(p=m,h=r.find(i,[p,p]),y=r.convert(0,p),n=r.convert(n,p),E=r.find(u,[p,p]));for(var g=[],w=[],x=[],b=0;b<d;b++){x[b]=w.length;for(var A=o[b],D=o[b+1],S=A;S<D;S++){var N=l[S],B=f?E(n,c[S]):E(c[S],n);h(B,y)||(w.push(N),g.push(B))}}return x[d]=w.length,t.createSparseMatrix({values:g,index:w,ptr:x,size:[v,d],datatype:p})}}),Dg="matAlgo12xSfs",Ag=["typed","DenseMatrix"],gr=I(Dg,Ag,e=>{var{typed:r,DenseMatrix:i}=e;return function(t,n,u,f){var c=t._values,l=t._index,o=t._ptr,s=t._size,m=t._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=s[0],d=s[1],p,h=u;typeof m=="string"&&(p=m,n=r.convert(n,p),h=r.find(u,[p,p]));for(var y=[],E=[],g=[],w=0;w<d;w++){for(var x=w+1,b=o[w],A=o[w+1],D=b;D<A;D++){var S=l[D];E[S]=c[D],g[S]=x}for(var N=0;N<v;N++)w===0&&(y[N]=[]),g[N]===x?y[N][w]=f?h(n,E[N]):h(E[N],n):y[N][w]=f?h(n,0):h(0,n)}return new i({data:y,size:[v,d],datatype:p})}}),Eg="matAlgo14xDs",Sg=["typed"],nt=I(Eg,Sg,e=>{var{typed:r}=e;return function(t,n,u,f){var c=t._data,l=t._size,o=t._datatype,s,m=u;typeof o=="string"&&(s=o,n=r.convert(n,s),m=r.find(u,[s,s]));var v=l.length>0?i(m,0,l,l[0],c,n,f):[];return t.createDenseMatrix({data:v,size:$e(l),datatype:s})};function i(a,t,n,u,f,c,l){var o=[];if(t===n.length-1)for(var s=0;s<u;s++)o[s]=l?a(c,f[s]):a(f[s],c);else for(var m=0;m<u;m++)o[m]=i(a,t+1,n,n[t+1],f[m],c,l);return o}}),Ii="ceil",Cg=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Mg=I(Ii,["typed","config","round"],e=>{var{typed:r,config:i,round:a}=e;return r(Ii,{number:function(n){return Pr(n,a(n),i.epsilon)?a(n):Math.ceil(n)},"number, number":function(n,u){if(Pr(n,a(n,u),i.epsilon))return a(n,u);var[f,c]="".concat(n,"e").split("e"),l=Math.ceil(Number("".concat(f,"e").concat(Number(c)+u)));return[f,c]="".concat(l,"e").split("e"),Number("".concat(f,"e").concat(Number(c)-u))}})}),Fg=I(Ii,Cg,e=>{var{typed:r,config:i,round:a,matrix:t,equalScalar:n,zeros:u,DenseMatrix:f}=e,c=Dr({typed:r,equalScalar:n}),l=gr({typed:r,DenseMatrix:f}),o=nt({typed:r}),s=Mg({typed:r,config:i,round:a});return r("ceil",{number:s.signatures.number,"number,number":s.signatures["number,number"],Complex:function(v){return v.ceil()},"Complex, number":function(v,d){return v.ceil(d)},"Complex, BigNumber":function(v,d){return v.ceil(d.toNumber())},BigNumber:function(v){return ct(v,a(v),i.epsilon)?a(v):v.ceil()},"BigNumber, BigNumber":function(v,d){return ct(v,a(v,d),i.epsilon)?a(v,d):v.toDecimalPlaces(d.toNumber(),_t.ROUND_CEIL)},Fraction:function(v){return v.ceil()},"Fraction, number":function(v,d){return v.ceil(d)},"Fraction, BigNumber":function(v,d){return v.ceil(d.toNumber())},"Array | Matrix":r.referToSelf(m=>v=>He(v,m)),"Array, number | BigNumber":r.referToSelf(m=>(v,d)=>He(v,p=>m(p,d))),"SparseMatrix, number | BigNumber":r.referToSelf(m=>(v,d)=>c(v,d,m,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(m=>(v,d)=>o(v,d,m,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(m=>(v,d)=>o(t(d),v,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(m=>(v,d)=>n(v,0)?u(d.size(),d.storage()):d.storage()==="dense"?o(d,v,m,!0):l(d,v,m,!0))})}),xu="cube",Bg=["typed"],Tg=I(xu,Bg,e=>{var{typed:r}=e;return r(xu,{number:Lf,Complex:function(a){return a.mul(a).mul(a)},BigNumber:function(a){return a.times(a).times(a)},Fraction:function(a){return a.pow(3)},Unit:function(a){return a.pow(3)}})}),wu="exp",Og=["typed"],$g=I(wu,Og,e=>{var{typed:r}=e;return r(wu,{number:kf,Complex:function(a){return a.exp()},BigNumber:function(a){return a.exp()}})}),Nu="expm1",_g=["typed","Complex"],Ig=I(Nu,_g,e=>{var{typed:r,Complex:i}=e;return r(Nu,{number:Hf,Complex:function(t){var n=Math.exp(t.re);return new i(n*Math.cos(t.im)-1,n*Math.sin(t.im))},BigNumber:function(t){return t.exp().minus(1)}})}),Ri="fix",Rg=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],qg=I(Ri,["typed","ceil","floor"],e=>{var{typed:r,ceil:i,floor:a}=e;return r(Ri,{number:function(n){return n>0?a(n):i(n)},"number, number":function(n,u){return n>0?a(n,u):i(n,u)}})}),zg=I(Ri,Rg,e=>{var{typed:r,Complex:i,matrix:a,ceil:t,floor:n,equalScalar:u,zeros:f,DenseMatrix:c}=e,l=gr({typed:r,DenseMatrix:c}),o=nt({typed:r}),s=qg({typed:r,ceil:t,floor:n});return r("fix",{number:s.signatures.number,"number, number | BigNumber":s.signatures["number,number"],Complex:function(v){return new i(v.re>0?Math.floor(v.re):Math.ceil(v.re),v.im>0?Math.floor(v.im):Math.ceil(v.im))},"Complex, number":function(v,d){return new i(v.re>0?n(v.re,d):t(v.re,d),v.im>0?n(v.im,d):t(v.im,d))},"Complex, BigNumber":function(v,d){var p=d.toNumber();return new i(v.re>0?n(v.re,p):t(v.re,p),v.im>0?n(v.im,p):t(v.im,p))},BigNumber:function(v){return v.isNegative()?t(v):n(v)},"BigNumber, number | BigNumber":function(v,d){return v.isNegative()?t(v,d):n(v,d)},Fraction:function(v){return v.s<0?v.ceil():v.floor()},"Fraction, number | BigNumber":function(v,d){return v.s<0?t(v,d):n(v,d)},"Array | Matrix":r.referToSelf(m=>v=>He(v,m)),"Array | Matrix, number | BigNumber":r.referToSelf(m=>(v,d)=>He(v,p=>m(p,d))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(m=>(v,d)=>o(a(d),v,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(m=>(v,d)=>u(v,0)?f(d.size(),d.storage()):d.storage()==="dense"?o(d,v,m,!0):l(d,v,m,!0))})}),qi="floor",Pg=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Ug=I(qi,["typed","config","round"],e=>{var{typed:r,config:i,round:a}=e;return r(qi,{number:function(n){return Pr(n,a(n),i.epsilon)?a(n):Math.floor(n)},"number, number":function(n,u){if(Pr(n,a(n,u),i.epsilon))return a(n,u);var[f,c]="".concat(n,"e").split("e"),l=Math.floor(Number("".concat(f,"e").concat(Number(c)+u)));return[f,c]="".concat(l,"e").split("e"),Number("".concat(f,"e").concat(Number(c)-u))}})}),Lg=I(qi,Pg,e=>{var{typed:r,config:i,round:a,matrix:t,equalScalar:n,zeros:u,DenseMatrix:f}=e,c=Dr({typed:r,equalScalar:n}),l=gr({typed:r,DenseMatrix:f}),o=nt({typed:r}),s=Ug({typed:r,config:i,round:a});return r("floor",{number:s.signatures.number,"number,number":s.signatures["number,number"],Complex:function(v){return v.floor()},"Complex, number":function(v,d){return v.floor(d)},"Complex, BigNumber":function(v,d){return v.floor(d.toNumber())},BigNumber:function(v){return ct(v,a(v),i.epsilon)?a(v):v.floor()},"BigNumber, BigNumber":function(v,d){return ct(v,a(v,d),i.epsilon)?a(v,d):v.toDecimalPlaces(d.toNumber(),_t.ROUND_FLOOR)},Fraction:function(v){return v.floor()},"Fraction, number":function(v,d){return v.floor(d)},"Fraction, BigNumber":function(v,d){return v.floor(d.toNumber())},"Array | Matrix":r.referToSelf(m=>v=>He(v,m)),"Array, number | BigNumber":r.referToSelf(m=>(v,d)=>He(v,p=>m(p,d))),"SparseMatrix, number | BigNumber":r.referToSelf(m=>(v,d)=>c(v,d,m,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(m=>(v,d)=>o(v,d,m,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(m=>(v,d)=>o(t(d),v,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(m=>(v,d)=>n(v,0)?u(d.size(),d.storage()):d.storage()==="dense"?o(d,v,m,!0):l(d,v,m,!0))})}),kg="matAlgo01xDSid",Hg=["typed"],Rt=I(kg,Hg,e=>{var{typed:r}=e;return function(a,t,n,u){var f=a._data,c=a._size,l=a._datatype,o=t._values,s=t._index,m=t._ptr,v=t._size,d=t._datatype;if(c.length!==v.length)throw new Le(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");if(!o)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=c[0],h=c[1],y=typeof l=="string"&&l===d?l:void 0,E=y?r.find(n,[y,y]):n,g,w,x=[];for(g=0;g<p;g++)x[g]=[];var b=[],A=[];for(w=0;w<h;w++){for(var D=w+1,S=m[w],N=m[w+1],B=S;B<N;B++)g=s[B],b[g]=u?E(o[B],f[g][w]):E(f[g][w],o[B]),A[g]=D;for(g=0;g<p;g++)A[g]===D?x[g][w]=b[g]:x[g][w]=f[g][w]}return a.createDenseMatrix({data:x,size:[p,h],datatype:y})}}),Gg="matAlgo04xSidSid",Vg=["typed","equalScalar"],Ji=I(Gg,Vg,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u){var f=t._values,c=t._index,l=t._ptr,o=t._size,s=t._datatype,m=n._values,v=n._index,d=n._ptr,p=n._size,h=n._datatype;if(o.length!==p.length)throw new Le(o.length,p.length);if(o[0]!==p[0]||o[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+p+")");var y=o[0],E=o[1],g,w=i,x=0,b=u;typeof s=="string"&&s===h&&(g=s,w=r.find(i,[g,g]),x=r.convert(0,g),b=r.find(u,[g,g]));var A=f&&m?[]:void 0,D=[],S=[],N=f&&m?[]:void 0,B=f&&m?[]:void 0,F=[],$=[],q,_,C,T,H;for(_=0;_<E;_++){S[_]=D.length;var O=_+1;for(T=l[_],H=l[_+1],C=T;C<H;C++)q=c[C],D.push(q),F[q]=O,N&&(N[q]=f[C]);for(T=d[_],H=d[_+1],C=T;C<H;C++)if(q=v[C],F[q]===O){if(N){var L=b(N[q],m[C]);w(L,x)?F[q]=null:N[q]=L}}else D.push(q),$[q]=O,B&&(B[q]=m[C]);if(N&&B)for(C=S[_];C<D.length;)q=D[C],F[q]===O?(A[C]=N[q],C++):$[q]===O?(A[C]=B[q],C++):D.splice(C,1)}return S[E]=D.length,t.createSparseMatrix({values:A,index:D,ptr:S,size:[y,E],datatype:g})}}),Zg="matAlgo10xSids",Yg=["typed","DenseMatrix"],Yt=I(Zg,Yg,e=>{var{typed:r,DenseMatrix:i}=e;return function(t,n,u,f){var c=t._values,l=t._index,o=t._ptr,s=t._size,m=t._datatype;if(!c)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v=s[0],d=s[1],p,h=u;typeof m=="string"&&(p=m,n=r.convert(n,p),h=r.find(u,[p,p]));for(var y=[],E=[],g=[],w=0;w<d;w++){for(var x=w+1,b=o[w],A=o[w+1],D=b;D<A;D++){var S=l[D];E[S]=c[D],g[S]=x}for(var N=0;N<v;N++)w===0&&(y[N]=[]),g[N]===x?y[N][w]=f?h(n,E[N]):h(E[N],n):y[N][w]=n}return new i({data:y,size:[v,d],datatype:p})}}),Wg="matAlgo13xDD",Xg=["typed"],Jg=I(Wg,Xg,e=>{var{typed:r}=e;return function(t,n,u){var f=t._data,c=t._size,l=t._datatype,o=n._data,s=n._size,m=n._datatype,v=[];if(c.length!==s.length)throw new Le(c.length,s.length);for(var d=0;d<c.length;d++){if(c[d]!==s[d])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+s+")");v[d]=c[d]}var p,h=u;typeof l=="string"&&l===m&&(p=l,h=r.find(u,[p,p]));var y=v.length>0?i(h,0,v,v[0],f,o):[];return t.createDenseMatrix({data:y,size:v,datatype:p})};function i(a,t,n,u,f,c){var l=[];if(t===n.length-1)for(var o=0;o<u;o++)l[o]=a(f[o],c[o]);else for(var s=0;s<u;s++)l[s]=i(a,t+1,n,n[t+1],f[s],c[s]);return l}}),Qg="broadcast",Kg=["concat"],jg=I(Qg,Kg,e=>{var{concat:r}=e;return function(n,u){var f=Math.max(n._size.length,u._size.length);if(n._size.length===u._size.length&&n._size.every((h,y)=>h===u._size[y]))return[n,u];for(var c=i(n._size,f,0),l=i(u._size,f,0),o=[],s=0;s<f;s++)o[s]=Math.max(c[s],l[s]);for(var m=0;m<f;m++)t(c,o,m),t(l,o,m);var v=n.clone(),d=u.clone();v._size.length<f?v.reshape(i(v._size,f,1)):d._size.length<f&&d.reshape(i(d._size,f,1));for(var p=0;p<f;p++)v._size[p]<o[p]&&(v=a(v,o[p],p)),d._size[p]<o[p]&&(d=a(d,o[p],p));return[v,d]};function i(n,u,f){return[...Array(u-n.length).fill(f),...n]}function a(n,u,f){return r(...Array(u).fill(n),f)}function t(n,u,f){if(n[f]<u[f]&n[f]>1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(n,") not possible to broadcast dimension ").concat(f," with size ").concat(n[f]," to size ").concat(u[f]))}}),e1="matrixAlgorithmSuite",r1=["typed","matrix","concat"],ur=I(e1,r1,e=>{var{typed:r,matrix:i,concat:a}=e,t=Jg({typed:r}),n=nt({typed:r}),u=jg({concat:a});return function(c){var l=c.elop,o=c.SD||c.DS,s;l?(s={"DenseMatrix, DenseMatrix":(p,h)=>t(...u(p,h),l),"Array, Array":(p,h)=>t(...u(i(p),i(h)),l).valueOf(),"Array, DenseMatrix":(p,h)=>t(...u(i(p),h),l),"DenseMatrix, Array":(p,h)=>t(...u(p,i(h)),l)},c.SS&&(s["SparseMatrix, SparseMatrix"]=(p,h)=>c.SS(...u(p,h),l,!1)),c.DS&&(s["DenseMatrix, SparseMatrix"]=(p,h)=>c.DS(...u(p,h),l,!1),s["Array, SparseMatrix"]=(p,h)=>c.DS(...u(i(p),h),l,!1)),o&&(s["SparseMatrix, DenseMatrix"]=(p,h)=>o(...u(h,p),l,!0),s["SparseMatrix, Array"]=(p,h)=>o(...u(i(h),p),l,!0))):(s={"DenseMatrix, DenseMatrix":r.referToSelf(p=>(h,y)=>t(...u(h,y),p)),"Array, Array":r.referToSelf(p=>(h,y)=>t(...u(i(h),i(y)),p).valueOf()),"Array, DenseMatrix":r.referToSelf(p=>(h,y)=>t(...u(i(h),y),p)),"DenseMatrix, Array":r.referToSelf(p=>(h,y)=>t(...u(h,i(y)),p))},c.SS&&(s["SparseMatrix, SparseMatrix"]=r.referToSelf(p=>(h,y)=>c.SS(...u(h,y),p,!1))),c.DS&&(s["DenseMatrix, SparseMatrix"]=r.referToSelf(p=>(h,y)=>c.DS(...u(h,y),p,!1)),s["Array, SparseMatrix"]=r.referToSelf(p=>(h,y)=>c.DS(...u(i(h),y),p,!1))),o&&(s["SparseMatrix, DenseMatrix"]=r.referToSelf(p=>(h,y)=>o(...u(y,h),p,!0)),s["SparseMatrix, Array"]=r.referToSelf(p=>(h,y)=>o(...u(i(y),h),p,!0))));var m=c.scalar||"any",v=c.Ds||c.Ss;v&&(l?(s["DenseMatrix,"+m]=(p,h)=>n(p,h,l,!1),s[m+", DenseMatrix"]=(p,h)=>n(h,p,l,!0),s["Array,"+m]=(p,h)=>n(i(p),h,l,!1).valueOf(),s[m+", Array"]=(p,h)=>n(i(h),p,l,!0).valueOf()):(s["DenseMatrix,"+m]=r.referToSelf(p=>(h,y)=>n(h,y,p,!1)),s[m+", DenseMatrix"]=r.referToSelf(p=>(h,y)=>n(y,h,p,!0)),s["Array,"+m]=r.referToSelf(p=>(h,y)=>n(i(h),y,p,!1).valueOf()),s[m+", Array"]=r.referToSelf(p=>(h,y)=>n(i(y),h,p,!0).valueOf())));var d=c.sS!==void 0?c.sS:c.Ss;return l?(c.Ss&&(s["SparseMatrix,"+m]=(p,h)=>c.Ss(p,h,l,!1)),d&&(s[m+", SparseMatrix"]=(p,h)=>d(h,p,l,!0))):(c.Ss&&(s["SparseMatrix,"+m]=r.referToSelf(p=>(h,y)=>c.Ss(h,y,p,!1))),d&&(s[m+", SparseMatrix"]=r.referToSelf(p=>(h,y)=>d(y,h,p,!0)))),l&&l.signatures&&of(s,l.signatures),s}});function Wt(e,r,i,a){if(!(this instanceof Wt))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=r,this.min=i,this.max=a,this.message="Wrong number of arguments in function "+e+" ("+r+" provided, "+i+(a!=null?"-"+a:"")+" expected)",this.stack=new Error().stack}Wt.prototype=new Error;Wt.prototype.constructor=Error;Wt.prototype.name="ArgumentsError";Wt.prototype.isArgumentsError=!0;var Du="gcd",t1=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],wi="number | BigNumber | Fraction | Matrix | Array",n1="".concat(wi,", ").concat(wi,", ...").concat(wi);function Au(e){return!e.some(r=>Array.isArray(r))}var a1=I(Du,t1,e=>{var{typed:r,matrix:i,equalScalar:a,BigNumber:t,DenseMatrix:n,concat:u}=e,f=Rt({typed:r}),c=Ji({typed:r,equalScalar:a}),l=Yt({typed:r,DenseMatrix:n}),o=ur({typed:r,matrix:i,concat:u});return r(Du,{"number, number":Gf,"BigNumber, BigNumber":s,"Fraction, Fraction":(m,v)=>m.gcd(v)},o({SS:c,DS:f,Ss:l}),{[n1]:r.referToSelf(m=>(v,d,p)=>{for(var h=m(v,d),y=0;y<p.length;y++)h=m(h,p[y]);return h}),Array:r.referToSelf(m=>v=>{if(v.length===1&&Array.isArray(v[0])&&Au(v[0]))return m(...v[0]);if(Au(v))return m(...v);throw new Wt("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(m=>v=>m(v.toArray()))});function s(m,v){if(!m.isInt()||!v.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var d=new t(0);!v.isZero();){var p=m.mod(v);m=v,v=p}return m.lt(d)?m.neg():m}}),i1="matAlgo02xDS0",o1=["typed","equalScalar"],at=I(i1,o1,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u,f){var c=t._data,l=t._size,o=t._datatype,s=n._values,m=n._index,v=n._ptr,d=n._size,p=n._datatype;if(l.length!==d.length)throw new Le(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=l[0],y=l[1],E,g=i,w=0,x=u;typeof o=="string"&&o===p&&(E=o,g=r.find(i,[E,E]),w=r.convert(0,E),x=r.find(u,[E,E]));for(var b=[],A=[],D=[],S=0;S<y;S++){D[S]=A.length;for(var N=v[S],B=v[S+1],F=N;F<B;F++){var $=m[F],q=f?x(s[F],c[$][S]):x(c[$][S],s[F]);g(q,w)||(A.push($),b.push(q))}}return D[y]=A.length,n.createSparseMatrix({values:b,index:A,ptr:D,size:[h,y],datatype:E})}}),u1="matAlgo06xS0S0",s1=["typed","equalScalar"],ai=I(u1,s1,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u){var f=t._values,c=t._size,l=t._datatype,o=n._values,s=n._size,m=n._datatype;if(c.length!==s.length)throw new Le(c.length,s.length);if(c[0]!==s[0]||c[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+s+")");var v=c[0],d=c[1],p,h=i,y=0,E=u;typeof l=="string"&&l===m&&(p=l,h=r.find(i,[p,p]),y=r.convert(0,p),E=r.find(u,[p,p]));for(var g=f&&o?[]:void 0,w=[],x=[],b=g?[]:void 0,A=[],D=[],S=0;S<d;S++){x[S]=w.length;var N=S+1;if(Xo(t,S,A,b,D,N,w,E),Xo(n,S,A,b,D,N,w,E),b)for(var B=x[S];B<w.length;){var F=w[B];if(D[F]===N){var $=b[F];h($,y)?w.splice(B,1):(g.push($),B++)}else w.splice(B,1)}else for(var q=x[S];q<w.length;){var _=w[q];D[_]!==N?w.splice(q,1):q++}}return x[d]=w.length,t.createSparseMatrix({values:g,index:w,ptr:x,size:[v,d],datatype:p})}}),Eu="lcm",l1=["typed","matrix","equalScalar","concat"],c1=I(Eu,l1,e=>{var{typed:r,matrix:i,equalScalar:a,concat:t}=e,n=at({typed:r,equalScalar:a}),u=ai({typed:r,equalScalar:a}),f=Dr({typed:r,equalScalar:a}),c=ur({typed:r,matrix:i,concat:t}),l="number | BigNumber | Fraction | Matrix | Array",o={};return o["".concat(l,", ").concat(l,", ...").concat(l)]=r.referToSelf(m=>(v,d,p)=>{for(var h=m(v,d),y=0;y<p.length;y++)h=m(h,p[y]);return h}),r(Eu,{"number, number":Vf,"BigNumber, BigNumber":s,"Fraction, Fraction":(m,v)=>m.lcm(v)},c({SS:u,DS:n,Ss:f}),o);function s(m,v){if(!m.isInt()||!v.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(m.isZero())return m;if(v.isZero())return v;for(var d=m.times(v);!v.isZero();){var p=v;v=m.mod(p),m=p}return d.div(m).abs()}}),Su="log10",f1=["typed","config","Complex"],m1=I(Su,f1,e=>{var{typed:r,config:i,Complex:a}=e;return r(Su,{number:function(n){return n>=0||i.predictable?Zf(n):new a(n,0).log().div(Math.LN10)},Complex:function(n){return new a(n).log().div(Math.LN10)},BigNumber:function(n){return!n.isNegative()||i.predictable?n.log():new a(n.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf(t=>n=>He(n,t))})}),Cu="log2",v1=["typed","config","Complex"],p1=I(Cu,v1,e=>{var{typed:r,config:i,Complex:a}=e;return r(Cu,{number:function(u){return u>=0||i.predictable?Yf(u):t(new a(u,0))},Complex:t,BigNumber:function(u){return!u.isNegative()||i.predictable?u.log(2):t(new a(u.toNumber(),0))},"Array | Matrix":r.referToSelf(n=>u=>He(u,n))});function t(n){var u=Math.sqrt(n.re*n.re+n.im*n.im);return new a(Math.log2?Math.log2(u):Math.log(u)/Math.LN2,Math.atan2(n.im,n.re)/Math.LN2)}}),d1="matAlgo03xDSf",h1=["typed"],$r=I(d1,h1,e=>{var{typed:r}=e;return function(a,t,n,u){var f=a._data,c=a._size,l=a._datatype,o=t._values,s=t._index,m=t._ptr,v=t._size,d=t._datatype;if(c.length!==v.length)throw new Le(c.length,v.length);if(c[0]!==v[0]||c[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+v+")");if(!o)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p=c[0],h=c[1],y,E=0,g=n;typeof l=="string"&&l===d&&(y=l,E=r.convert(0,y),g=r.find(n,[y,y]));for(var w=[],x=0;x<p;x++)w[x]=[];for(var b=[],A=[],D=0;D<h;D++){for(var S=D+1,N=m[D],B=m[D+1],F=N;F<B;F++){var $=s[F];b[$]=u?g(o[F],f[$][D]):g(f[$][D],o[F]),A[$]=S}for(var q=0;q<p;q++)A[q]===S?w[q][D]=b[q]:w[q][D]=u?g(E,f[q][D]):g(f[q][D],E)}return a.createDenseMatrix({data:w,size:[p,h],datatype:y})}}),g1="matAlgo05xSfSf",y1=["typed","equalScalar"],ii=I(g1,y1,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u){var f=t._values,c=t._index,l=t._ptr,o=t._size,s=t._datatype,m=n._values,v=n._index,d=n._ptr,p=n._size,h=n._datatype;if(o.length!==p.length)throw new Le(o.length,p.length);if(o[0]!==p[0]||o[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+p+")");var y=o[0],E=o[1],g,w=i,x=0,b=u;typeof s=="string"&&s===h&&(g=s,w=r.find(i,[g,g]),x=r.convert(0,g),b=r.find(u,[g,g]));var A=f&&m?[]:void 0,D=[],S=[],N=A?[]:void 0,B=A?[]:void 0,F=[],$=[],q,_,C,T;for(_=0;_<E;_++){S[_]=D.length;var H=_+1;for(C=l[_],T=l[_+1];C<T;C++)q=c[C],D.push(q),F[q]=H,N&&(N[q]=f[C]);for(C=d[_],T=d[_+1];C<T;C++)q=v[C],F[q]!==H&&D.push(q),$[q]=H,B&&(B[q]=m[C]);if(A)for(C=S[_];C<D.length;){q=D[C];var O=F[q],L=$[q];if(O===H||L===H){var W=O===H?N[q]:x,X=L===H?B[q]:x,P=b(W,X);w(P,x)?D.splice(C,1):(A.push(P),C++)}}}return S[E]=D.length,t.createSparseMatrix({values:A,index:D,ptr:S,size:[y,E],datatype:g})}}),Mu="mod",b1=["typed","matrix","equalScalar","DenseMatrix","concat"],x1=I(Mu,b1,e=>{var{typed:r,matrix:i,equalScalar:a,DenseMatrix:t,concat:n}=e,u=at({typed:r,equalScalar:a}),f=$r({typed:r}),c=ii({typed:r,equalScalar:a}),l=Dr({typed:r,equalScalar:a}),o=gr({typed:r,DenseMatrix:t}),s=ur({typed:r,matrix:i,concat:n});return r(Mu,{"number, number":Wf,"BigNumber, BigNumber":function(v,d){if(d.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return d.isZero()?v:v.mod(d)},"Fraction, Fraction":function(v,d){if(d.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return v.compare(0)>=0?v.mod(d):v.mod(d).add(d).mod(d)}},s({SS:c,DS:f,SD:u,Ss:l,sS:o}))}),w1="multiplyScalar",N1=["typed"],D1=I(w1,N1,e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":zf,"Complex, Complex":function(a,t){return a.mul(t)},"BigNumber, BigNumber":function(a,t){return a.times(t)},"Fraction, Fraction":function(a,t){return a.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(i,a)=>a.multiply(i),"Unit, number | Fraction | BigNumber | Complex | Unit":(i,a)=>i.multiply(a)})}),Fu="multiply",A1=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],E1=I(Fu,A1,e=>{var{typed:r,matrix:i,addScalar:a,multiplyScalar:t,equalScalar:n,dot:u}=e,f=Dr({typed:r,equalScalar:n}),c=nt({typed:r});function l(x,b){switch(x.length){case 1:switch(b.length){case 1:if(x[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(x[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+x[0]+") must match Matrix rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;case 2:switch(b.length){case 1:if(x[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+x[1]+") must match Vector length ("+b[0]+")");break;case 2:if(x[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+x[1]+") must match Matrix B rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+x.length+" dimensions)")}}function o(x,b,A){if(A===0)throw new Error("Cannot multiply two empty vectors");return u(x,b)}function s(x,b){if(b.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return m(x,b)}function m(x,b){var A=x._data,D=x._size,S=x._datatype,N=b._data,B=b._size,F=b._datatype,$=D[0],q=B[1],_,C=a,T=t;S&&F&&S===F&&typeof S=="string"&&(_=S,C=r.find(a,[_,_]),T=r.find(t,[_,_]));for(var H=[],O=0;O<q;O++){for(var L=T(A[0],N[0][O]),W=1;W<$;W++)L=C(L,T(A[W],N[W][O]));H[O]=L}return x.createDenseMatrix({data:H,size:[q],datatype:_})}var v=r("_multiplyMatrixVector",{"DenseMatrix, any":p,"SparseMatrix, any":E}),d=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":h,"DenseMatrix, SparseMatrix":y,"SparseMatrix, DenseMatrix":g,"SparseMatrix, SparseMatrix":w});function p(x,b){var A=x._data,D=x._size,S=x._datatype,N=b._data,B=b._datatype,F=D[0],$=D[1],q,_=a,C=t;S&&B&&S===B&&typeof S=="string"&&(q=S,_=r.find(a,[q,q]),C=r.find(t,[q,q]));for(var T=[],H=0;H<F;H++){for(var O=A[H],L=C(O[0],N[0]),W=1;W<$;W++)L=_(L,C(O[W],N[W]));T[H]=L}return x.createDenseMatrix({data:T,size:[F],datatype:q})}function h(x,b){var A=x._data,D=x._size,S=x._datatype,N=b._data,B=b._size,F=b._datatype,$=D[0],q=D[1],_=B[1],C,T=a,H=t;S&&F&&S===F&&typeof S=="string"&&(C=S,T=r.find(a,[C,C]),H=r.find(t,[C,C]));for(var O=[],L=0;L<$;L++){var W=A[L];O[L]=[];for(var X=0;X<_;X++){for(var P=H(W[0],N[0][X]),J=1;J<q;J++)P=T(P,H(W[J],N[J][X]));O[L][X]=P}}return x.createDenseMatrix({data:O,size:[$,_],datatype:C})}function y(x,b){var A=x._data,D=x._size,S=x._datatype,N=b._values,B=b._index,F=b._ptr,$=b._size,q=b._datatype;if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var _=D[0],C=$[1],T,H=a,O=t,L=n,W=0;S&&q&&S===q&&typeof S=="string"&&(T=S,H=r.find(a,[T,T]),O=r.find(t,[T,T]),L=r.find(n,[T,T]),W=r.convert(0,T));for(var X=[],P=[],J=[],ee=b.createSparseMatrix({values:X,index:P,ptr:J,size:[_,C],datatype:T}),K=0;K<C;K++){J[K]=P.length;var oe=F[K],se=F[K+1];if(se>oe)for(var ie=0,re=0;re<_;re++){for(var pe=re+1,Ae=void 0,be=oe;be<se;be++){var Ne=B[be];ie!==pe?(Ae=O(A[re][Ne],N[be]),ie=pe):Ae=H(Ae,O(A[re][Ne],N[be]))}ie===pe&&!L(Ae,W)&&(P.push(re),X.push(Ae))}}return J[C]=P.length,ee}function E(x,b){var A=x._values,D=x._index,S=x._ptr,N=x._datatype;if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var B=b._data,F=b._datatype,$=x._size[0],q=b._size[0],_=[],C=[],T=[],H,O=a,L=t,W=n,X=0;N&&F&&N===F&&typeof N=="string"&&(H=N,O=r.find(a,[H,H]),L=r.find(t,[H,H]),W=r.find(n,[H,H]),X=r.convert(0,H));var P=[],J=[];T[0]=0;for(var ee=0;ee<q;ee++){var K=B[ee];if(!W(K,X))for(var oe=S[ee],se=S[ee+1],ie=oe;ie<se;ie++){var re=D[ie];J[re]?P[re]=O(P[re],L(K,A[ie])):(J[re]=!0,C.push(re),P[re]=L(K,A[ie]))}}for(var pe=C.length,Ae=0;Ae<pe;Ae++){var be=C[Ae];_[Ae]=P[be]}return T[1]=C.length,x.createSparseMatrix({values:_,index:C,ptr:T,size:[$,1],datatype:H})}function g(x,b){var A=x._values,D=x._index,S=x._ptr,N=x._datatype;if(!A)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var B=b._data,F=b._datatype,$=x._size[0],q=b._size[0],_=b._size[1],C,T=a,H=t,O=n,L=0;N&&F&&N===F&&typeof N=="string"&&(C=N,T=r.find(a,[C,C]),H=r.find(t,[C,C]),O=r.find(n,[C,C]),L=r.convert(0,C));for(var W=[],X=[],P=[],J=x.createSparseMatrix({values:W,index:X,ptr:P,size:[$,_],datatype:C}),ee=[],K=[],oe=0;oe<_;oe++){P[oe]=X.length;for(var se=oe+1,ie=0;ie<q;ie++){var re=B[ie][oe];if(!O(re,L))for(var pe=S[ie],Ae=S[ie+1],be=pe;be<Ae;be++){var Ne=D[be];K[Ne]!==se?(K[Ne]=se,X.push(Ne),ee[Ne]=H(re,A[be])):ee[Ne]=T(ee[Ne],H(re,A[be]))}}for(var U=P[oe],G=X.length,te=U;te<G;te++){var k=X[te];W[te]=ee[k]}}return P[_]=X.length,J}function w(x,b){var A=x._values,D=x._index,S=x._ptr,N=x._datatype,B=b._values,F=b._index,$=b._ptr,q=b._datatype,_=x._size[0],C=b._size[1],T=A&&B,H,O=a,L=t;N&&q&&N===q&&typeof N=="string"&&(H=N,O=r.find(a,[H,H]),L=r.find(t,[H,H]));for(var W=T?[]:void 0,X=[],P=[],J=x.createSparseMatrix({values:W,index:X,ptr:P,size:[_,C],datatype:H}),ee=T?[]:void 0,K=[],oe,se,ie,re,pe,Ae,be,Ne,U=0;U<C;U++){P[U]=X.length;var G=U+1;for(pe=$[U],Ae=$[U+1],re=pe;re<Ae;re++)if(Ne=F[re],T)for(se=S[Ne],ie=S[Ne+1],oe=se;oe<ie;oe++)be=D[oe],K[be]!==G?(K[be]=G,X.push(be),ee[be]=L(B[re],A[oe])):ee[be]=O(ee[be],L(B[re],A[oe]));else for(se=S[Ne],ie=S[Ne+1],oe=se;oe<ie;oe++)be=D[oe],K[be]!==G&&(K[be]=G,X.push(be));if(T)for(var te=P[U],k=X.length,Y=te;Y<k;Y++){var j=X[Y];W[Y]=ee[j]}}return P[C]=X.length,J}return r(Fu,t,{"Array, Array":r.referTo("Matrix, Matrix",x=>(b,A)=>{l(Ge(b),Ge(A));var D=x(i(b),i(A));return Be(D)?D.valueOf():D}),"Matrix, Matrix":function(b,A){var D=b.size(),S=A.size();return l(D,S),D.length===1?S.length===1?o(b,A,D[0]):s(b,A):S.length===1?v(b,A):d(b,A)},"Matrix, Array":r.referTo("Matrix,Matrix",x=>(b,A)=>x(b,i(A))),"Array, Matrix":r.referToSelf(x=>(b,A)=>x(i(b,A.storage()),A)),"SparseMatrix, any":function(b,A){return f(b,A,t,!1)},"DenseMatrix, any":function(b,A){return c(b,A,t,!1)},"any, SparseMatrix":function(b,A){return f(A,b,t,!0)},"any, DenseMatrix":function(b,A){return c(A,b,t,!0)},"Array, any":function(b,A){return c(i(b),A,t,!1).valueOf()},"any, Array":function(b,A){return c(i(A),b,t,!0).valueOf()},"any, any":t,"any, any, ...any":r.referToSelf(x=>(b,A,D)=>{for(var S=x(b,A),N=0;N<D.length;N++)S=x(S,D[N]);return S})})}),Bu="nthRoot",S1=["typed","matrix","equalScalar","BigNumber","concat"],C1=I(Bu,S1,e=>{var{typed:r,matrix:i,equalScalar:a,BigNumber:t,concat:n}=e,u=Rt({typed:r}),f=at({typed:r,equalScalar:a}),c=ai({typed:r,equalScalar:a}),l=Dr({typed:r,equalScalar:a}),o=ur({typed:r,matrix:i,concat:n});function s(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(Bu,{number:Qo,"number, number":Qo,BigNumber:v=>m(v,new t(2)),"BigNumber, BigNumber":m,Complex:s,"Complex, number":s,Array:r.referTo("DenseMatrix,number",v=>d=>v(i(d),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",v=>d=>v(d,2)),SparseMatrix:r.referTo("SparseMatrix,number",v=>d=>v(d,2)),"SparseMatrix, SparseMatrix":r.referToSelf(v=>(d,p)=>{if(p.density()===1)return c(d,p,v);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(v=>(d,p)=>{if(p.density()===1)return u(d,p,v,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",v=>(d,p)=>v(i(d),p)),"number | BigNumber, SparseMatrix":r.referToSelf(v=>(d,p)=>{if(p.density()===1)return l(p,d,v,!0);throw new Error("Root must be non-zero")})},o({scalar:"number | BigNumber",SD:f,Ss:l,sS:!1}));function m(v,d){var p=t.precision,h=t.clone({precision:p+2}),y=new t(0),E=new h(1),g=d.isNegative();if(g&&(d=d.neg()),d.isZero())throw new Error("Root must be non-zero");if(v.isNegative()&&!d.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(v.isZero())return g?new h(1/0):0;if(!v.isFinite())return g?y:v;var w=v.abs().pow(E.div(d));return w=v.isNeg()?w.neg():w,new t((g?E.div(w):w).toPrecision(p))}}),Tu="sign",M1=["typed","BigNumber","Fraction","complex"],F1=I(Tu,M1,e=>{var{typed:r,BigNumber:i,complex:a,Fraction:t}=e;return r(Tu,{number:_i,Complex:function(u){return u.im===0?a(_i(u.re)):u.sign()},BigNumber:function(u){return new i(u.cmp(0))},Fraction:function(u){return new t(u.s,1)},"Array | Matrix":r.referToSelf(n=>u=>He(u,n)),Unit:r.referToSelf(n=>u=>{if(!u._isDerived()&&u.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return r.find(n,u.valueType())(u.value)})})}),B1="sqrt",T1=["config","typed","Complex"],O1=I(B1,T1,e=>{var{config:r,typed:i,Complex:a}=e;return i("sqrt",{number:t,Complex:function(u){return u.sqrt()},BigNumber:function(u){return!u.isNegative()||r.predictable?u.sqrt():t(u.toNumber())},Unit:function(u){return u.pow(.5)}});function t(n){return isNaN(n)?NaN:n>=0||r.predictable?Math.sqrt(n):new a(n,0).sqrt()}}),Ou="square",$1=["typed"],_1=I(Ou,$1,e=>{var{typed:r}=e;return r(Ou,{number:Xf,Complex:function(a){return a.mul(a)},BigNumber:function(a){return a.times(a)},Fraction:function(a){return a.mul(a)},Unit:function(a){return a.pow(2)}})}),$u="subtract",I1=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],R1=I($u,I1,e=>{var{typed:r,matrix:i,equalScalar:a,addScalar:t,unaryMinus:n,DenseMatrix:u,concat:f}=e,c=Rt({typed:r}),l=$r({typed:r}),o=ii({typed:r,equalScalar:a}),s=Yt({typed:r,DenseMatrix:u}),m=gr({typed:r,DenseMatrix:u}),v=ur({typed:r,matrix:i,concat:f});return r($u,{"number, number":(d,p)=>d-p,"Complex, Complex":(d,p)=>d.sub(p),"BigNumber, BigNumber":(d,p)=>d.minus(p),"Fraction, Fraction":(d,p)=>d.sub(p),"Unit, Unit":r.referToSelf(d=>(p,h)=>{if(p.value===null)throw new Error("Parameter x contains a unit with undefined value");if(h.value===null)throw new Error("Parameter y contains a unit with undefined value");if(!p.equalBase(h))throw new Error("Units do not match");var y=p.clone();return y.value=r.find(d,[y.valueType(),h.valueType()])(y.value,h.value),y.fixPrefix=!1,y})},v({SS:o,DS:c,SD:l,Ss:m,sS:s}))}),_u="xgcd",q1=["typed","config","matrix","BigNumber"],z1=I(_u,q1,e=>{var{typed:r,config:i,matrix:a,BigNumber:t}=e;return r(_u,{"number, number":function(f,c){var l=Jf(f,c);return i.matrix==="Array"?l:a(l)},"BigNumber, BigNumber":n});function n(u,f){var c,l,o,s=new t(0),m=new t(1),v=s,d=m,p=m,h=s;if(!u.isInt()||!f.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!f.isZero();)l=u.div(f).floor(),o=u.mod(f),c=v,v=d.minus(l.times(v)),d=c,c=p,p=h.minus(l.times(p)),h=c,u=f,f=o;var y;return u.lt(s)?y=[u.neg(),d.neg(),h.neg()]:y=[u,u.isZero()?0:d,h],i.matrix==="Array"?y:a(y)}}),Iu="invmod",P1=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],U1=I(Iu,P1,e=>{var{typed:r,config:i,BigNumber:a,xgcd:t,equal:n,smaller:u,mod:f,add:c,isInteger:l}=e;return r(Iu,{"number, number":o,"BigNumber, BigNumber":o});function o(s,m){if(!l(s)||!l(m))throw new Error("Parameters in function invmod must be integer numbers");if(s=f(s,m),n(m,0))throw new Error("Divisor must be non zero");var v=t(s,m);v=v.valueOf();var[d,p]=v;return n(d,a(1))?(p=f(p,m),u(p,a(0))&&(p=c(p,m)),p):NaN}}),L1="matAlgo09xS0Sf",k1=["typed","equalScalar"],$m=I(L1,k1,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u){var f=t._values,c=t._index,l=t._ptr,o=t._size,s=t._datatype,m=n._values,v=n._index,d=n._ptr,p=n._size,h=n._datatype;if(o.length!==p.length)throw new Le(o.length,p.length);if(o[0]!==p[0]||o[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+p+")");var y=o[0],E=o[1],g,w=i,x=0,b=u;typeof s=="string"&&s===h&&(g=s,w=r.find(i,[g,g]),x=r.convert(0,g),b=r.find(u,[g,g]));var A=f&&m?[]:void 0,D=[],S=[],N=A?[]:void 0,B=[],F,$,q,_,C;for($=0;$<E;$++){S[$]=D.length;var T=$+1;if(N)for(_=d[$],C=d[$+1],q=_;q<C;q++)F=v[q],B[F]=T,N[F]=m[q];for(_=l[$],C=l[$+1],q=_;q<C;q++)if(F=c[q],N){var H=B[F]===T?N[F]:x,O=b(f[q],H);w(O,x)||(D.push(F),A.push(O))}else D.push(F)}return S[E]=D.length,t.createSparseMatrix({values:A,index:D,ptr:S,size:[y,E],datatype:g})}}),Ru="dotMultiply",H1=["typed","matrix","equalScalar","multiplyScalar","concat"],G1=I(Ru,H1,e=>{var{typed:r,matrix:i,equalScalar:a,multiplyScalar:t,concat:n}=e,u=at({typed:r,equalScalar:a}),f=$m({typed:r,equalScalar:a}),c=Dr({typed:r,equalScalar:a}),l=ur({typed:r,matrix:i,concat:n});return r(Ru,l({elop:t,SS:f,DS:u,Ss:c}))});function V1(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var i=e.constructor;if(e.isNaN()||r.isNaN())return new i(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new i(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new i(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new i(0):e}return Qi(e,r,function(a,t){return a&t})}function Yn(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,i=r.precision;r.config({precision:1e9});var a=e.plus(new r(1));return a.s=-a.s||null,r.config({precision:i}),a}function Z1(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var i=e.constructor;if(e.isNaN()||r.isNaN())return new i(NaN);var a=new i(-1);return e.isZero()||r.eq(a)||e.eq(r)?r:r.isZero()||e.eq(a)?e:!e.isFinite()||!r.isFinite()?!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?a:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e:Qi(e,r,function(t,n){return t|n})}function Qi(e,r,i){var a=e.constructor,t,n,u=+(e.s<0),f=+(r.s<0);if(u){t=ca(Yn(e));for(var c=0;c<t.length;++c)t[c]^=1}else t=ca(e);if(f){n=ca(Yn(r));for(var l=0;l<n.length;++l)n[l]^=1}else n=ca(r);var o,s,m;t.length<=n.length?(o=t,s=n,m=u):(o=n,s=t,m=f);var v=o.length,d=s.length,p=i(u,f)^1,h=new a(p^1),y=new a(1),E=new a(2),g=a.precision;for(a.config({precision:1e9});v>0;)i(o[--v],s[--d])===p&&(h=h.plus(y)),y=y.times(E);for(;d>0;)i(m,s[--d])===p&&(h=h.plus(y)),y=y.times(E);return a.config({precision:g}),p===0&&(h.s=-h.s),h}function ca(e){for(var r=e.d,i=r[0]+"",a=1;a<r.length;++a){for(var t=r[a]+"",n=7-t.length;n--;)t="0"+t;i+=t}for(var u=i.length;i.charAt(u)==="0";)u--;var f=e.e,c=i.slice(0,u+1||1),l=c.length;if(f>0)if(++f>l)for(f-=l;f--;)c+="0";else f<l&&(c=c.slice(0,f)+"."+c.slice(f));for(var o=[0],s=0;s<c.length;){for(var m=o.length;m--;)o[m]*=10;o[0]+=parseInt(c.charAt(s++));for(var v=0;v<o.length;++v)o[v]>1&&((o[v+1]===null||o[v+1]===void 0)&&(o[v+1]=0),o[v+1]+=o[v]>>1,o[v]&=1)}return o.reverse()}function Y1(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var i=e.constructor;if(e.isNaN()||r.isNaN())return new i(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new i(0);var a=new i(-1);return e.eq(a)?Yn(r):r.eq(a)?Yn(e):!e.isFinite()||!r.isFinite()?!e.isFinite()&&!r.isFinite()?a:new i(e.isNegative()===r.isNegative()?1/0:-1/0):Qi(e,r,function(t,n){return t^n})}function W1(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var i=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new i(NaN):e.isZero()||r.isZero()?e:!e.isFinite()&&!r.isFinite()?new i(NaN):r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new i(2).pow(r))}function X1(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var i=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new i(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new i(2).pow(r)).floor():e.isNegative()?new i(-1):e.isFinite()?new i(0):new i(NaN)}var qu="bitAnd",J1=["typed","matrix","equalScalar","concat"],Q1=I(qu,J1,e=>{var{typed:r,matrix:i,equalScalar:a,concat:t}=e,n=at({typed:r,equalScalar:a}),u=ai({typed:r,equalScalar:a}),f=Dr({typed:r,equalScalar:a}),c=ur({typed:r,matrix:i,concat:t});return r(qu,{"number, number":Kf,"BigNumber, BigNumber":V1},c({SS:u,DS:n,Ss:f}))}),zu="bitNot",K1=["typed"],j1=I(zu,K1,e=>{var{typed:r}=e;return r(zu,{number:jf,BigNumber:Yn,"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),Pu="bitOr",ey=["typed","matrix","equalScalar","DenseMatrix","concat"],ry=I(Pu,ey,e=>{var{typed:r,matrix:i,equalScalar:a,DenseMatrix:t,concat:n}=e,u=Rt({typed:r}),f=Ji({typed:r,equalScalar:a}),c=Yt({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:i,concat:n});return r(Pu,{"number, number":em,"BigNumber, BigNumber":Z1},l({SS:f,DS:u,Ss:c}))}),ty="matAlgo07xSSf",ny=["typed","DenseMatrix"],ft=I(ty,ny,e=>{var{typed:r,DenseMatrix:i}=e;return function(n,u,f){var c=n._size,l=n._datatype,o=u._size,s=u._datatype;if(c.length!==o.length)throw new Le(c.length,o.length);if(c[0]!==o[0]||c[1]!==o[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+o+")");var m=c[0],v=c[1],d,p=0,h=f;typeof l=="string"&&l===s&&(d=l,p=r.convert(0,d),h=r.find(f,[d,d]));var y,E,g=[];for(y=0;y<m;y++)g[y]=[];var w=[],x=[],b=[],A=[];for(E=0;E<v;E++){var D=E+1;for(a(n,E,b,w,D),a(u,E,A,x,D),y=0;y<m;y++){var S=b[y]===D?w[y]:p,N=A[y]===D?x[y]:p;g[y][E]=h(S,N)}}return new i({data:g,size:[m,v],datatype:d})};function a(t,n,u,f,c){for(var l=t._values,o=t._index,s=t._ptr,m=s[n],v=s[n+1];m<v;m++){var d=o[m];u[d]=c,f[d]=l[m]}}}),Uu="bitXor",ay=["typed","matrix","DenseMatrix","concat"],iy=I(Uu,ay,e=>{var{typed:r,matrix:i,DenseMatrix:a,concat:t}=e,n=$r({typed:r}),u=ft({typed:r,DenseMatrix:a}),f=gr({typed:r,DenseMatrix:a}),c=ur({typed:r,matrix:i,concat:t});return r(Uu,{"number, number":rm,"BigNumber, BigNumber":Y1},c({SS:u,DS:n,Ss:f}))}),Lu="arg",oy=["typed"],uy=I(Lu,oy,e=>{var{typed:r}=e;return r(Lu,{number:function(a){return Math.atan2(0,a)},BigNumber:function(a){return a.constructor.atan2(0,a)},Complex:function(a){return a.arg()},"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),ku="conj",sy=["typed"],ly=I(ku,sy,e=>{var{typed:r}=e;return r(ku,{"number | BigNumber | Fraction":i=>i,Complex:i=>i.conjugate(),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),Hu="im",cy=["typed"],fy=I(Hu,cy,e=>{var{typed:r}=e;return r(Hu,{number:()=>0,"BigNumber | Fraction":i=>i.mul(0),Complex:i=>i.im,"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),Gu="re",my=["typed"],vy=I(Gu,my,e=>{var{typed:r}=e;return r(Gu,{"number | BigNumber | Fraction":i=>i,Complex:i=>i.re,"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),Vu="not",py=["typed"],dy=I(Vu,py,e=>{var{typed:r}=e;return r(Vu,{"null | undefined":()=>!0,number:om,Complex:function(a){return a.re===0&&a.im===0},BigNumber:function(a){return a.isZero()||a.isNaN()},Unit:r.referToSelf(i=>a=>r.find(i,a.valueType())(a.value)),"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),Zu="or",hy=["typed","matrix","equalScalar","DenseMatrix","concat"],gy=I(Zu,hy,e=>{var{typed:r,matrix:i,equalScalar:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ii({typed:r,equalScalar:a}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:i,concat:n});return r(Zu,{"number, number":um,"Complex, Complex":function(s,m){return s.re!==0||s.im!==0||m.re!==0||m.im!==0},"BigNumber, BigNumber":function(s,m){return!s.isZero()&&!s.isNaN()||!m.isZero()&&!m.isNaN()},"Unit, Unit":r.referToSelf(o=>(s,m)=>o(s.value||0,m.value||0))},l({SS:f,DS:u,Ss:c}))}),Yu="xor",yy=["typed","matrix","DenseMatrix","concat"],by=I(Yu,yy,e=>{var{typed:r,matrix:i,DenseMatrix:a,concat:t}=e,n=$r({typed:r}),u=ft({typed:r,DenseMatrix:a}),f=gr({typed:r,DenseMatrix:a}),c=ur({typed:r,matrix:i,concat:t});return r(Yu,{"number, number":sm,"Complex, Complex":function(o,s){return(o.re!==0||o.im!==0)!=(s.re!==0||s.im!==0)},"BigNumber, BigNumber":function(o,s){return(!o.isZero()&&!o.isNaN())!=(!s.isZero()&&!s.isNaN())},"Unit, Unit":r.referToSelf(l=>(o,s)=>l(o.value||0,s.value||0))},c({SS:u,DS:n,Ss:f}))}),Wu="concat",xy=["typed","matrix","isInteger"],_m=I(Wu,xy,e=>{var{typed:r,matrix:i,isInteger:a}=e;return r(Wu,{"...Array | Matrix | number | BigNumber":function(n){var u,f=n.length,c=-1,l,o=!1,s=[];for(u=0;u<f;u++){var m=n[u];if(Be(m)&&(o=!0),Ve(m)||ke(m)){if(u!==f-1)throw new Error("Dimension must be specified as last argument");if(l=c,c=m.valueOf(),!a(c))throw new TypeError("Integer number expected for dimension");if(c<0||u>0&&c>l)throw new rt(c,l+1)}else{var v=$e(m).valueOf(),d=Ge(v);if(s[u]=v,l=c,c=d.length-1,u>0&&c!==l)throw new Le(l+1,c+1)}}if(s.length===0)throw new SyntaxError("At least one matrix expected");for(var p=s.shift();s.length;)p=Im(p,s.shift(),c,0);return o?i(p):p},"...string":function(n){return n.join("")}})});function Im(e,r,i,a){if(a<i){if(e.length!==r.length)throw new Le(e.length,r.length);for(var t=[],n=0;n<e.length;n++)t[n]=Im(e[n],r[n],i,a+1);return t}else return e.concat(r)}var Xu="column",wy=["typed","Index","matrix","range"],Rm=I(Xu,wy,e=>{var{typed:r,Index:i,matrix:a,range:t}=e;return r(Xu,{"Matrix, number":n,"Array, number":function(f,c){return n(a($e(f)),c).valueOf()}});function n(u,f){if(u.size().length!==2)throw new Error("Only two dimensional matrix is supported");rr(f,u.size()[1]);var c=t(0,u.size()[0]),l=new i(c,f),o=u.subset(l);return Be(o)?o:a([[o]])}}),Ju="count",Ny=["typed","size","prod"],Dy=I(Ju,Ny,e=>{var{typed:r,size:i,prod:a}=e;return r(Ju,{string:function(n){return n.length},"Matrix | Array":function(n){return a(i(n))}})}),Qu="cross",Ay=["typed","matrix","subtract","multiply"],Ey=I(Qu,Ay,e=>{var{typed:r,matrix:i,subtract:a,multiply:t}=e;return r(Qu,{"Matrix, Matrix":function(f,c){return i(n(f.toArray(),c.toArray()))},"Matrix, Array":function(f,c){return i(n(f.toArray(),c))},"Array, Matrix":function(f,c){return i(n(f,c.toArray()))},"Array, Array":n});function n(u,f){var c=Math.max(Ge(u).length,Ge(f).length);u=Fa(u),f=Fa(f);var l=Ge(u),o=Ge(f);if(l.length!==1||o.length!==1||l[0]!==3||o[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+l.join(", ")+"], B = ["+o.join(", ")+"])");var s=[a(t(u[1],f[2]),t(u[2],f[1])),a(t(u[2],f[0]),t(u[0],f[2])),a(t(u[0],f[1]),t(u[1],f[0]))];return c>1?[s]:s}}),Ku="diag",Sy=["typed","matrix","DenseMatrix","SparseMatrix"],Cy=I(Ku,Sy,e=>{var{typed:r,matrix:i,DenseMatrix:a,SparseMatrix:t}=e;return r(Ku,{Array:function(l){return n(l,0,Ge(l),null)},"Array, number":function(l,o){return n(l,o,Ge(l),null)},"Array, BigNumber":function(l,o){return n(l,o.toNumber(),Ge(l),null)},"Array, string":function(l,o){return n(l,0,Ge(l),o)},"Array, number, string":function(l,o,s){return n(l,o,Ge(l),s)},"Array, BigNumber, string":function(l,o,s){return n(l,o.toNumber(),Ge(l),s)},Matrix:function(l){return n(l,0,l.size(),l.storage())},"Matrix, number":function(l,o){return n(l,o,l.size(),l.storage())},"Matrix, BigNumber":function(l,o){return n(l,o.toNumber(),l.size(),l.storage())},"Matrix, string":function(l,o){return n(l,0,l.size(),o)},"Matrix, number, string":function(l,o,s){return n(l,o,l.size(),s)},"Matrix, BigNumber, string":function(l,o,s){return n(l,o.toNumber(),l.size(),s)}});function n(c,l,o,s){if(!Ce(l))throw new TypeError("Second parameter in function diag must be an integer");var m=l>0?l:0,v=l<0?-l:0;switch(o.length){case 1:return u(c,l,s,o[0],v,m);case 2:return f(c,l,s,o,v,m)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function u(c,l,o,s,m,v){var d=[s+m,s+v];if(o&&o!=="sparse"&&o!=="dense")throw new TypeError("Unknown matrix type ".concat(o,'"'));var p=o==="sparse"?t.diagonal(d,c,l):a.diagonal(d,c,l);return o!==null?p:p.valueOf()}function f(c,l,o,s,m,v){if(Be(c)){var d=c.diagonal(l);return o!==null?o!==d.storage()?i(d,o):d:d.valueOf()}for(var p=Math.min(s[0]-m,s[1]-v),h=[],y=0;y<p;y++)h[y]=c[y+m][y+v];return o!==null?i(h):h}});function Mn(e,r,i,a,t){if(mn.isTypedFunction(e)){var n=[r,i,a],u=mn.resolve(e,n);if(u)return s(u.implementation,n);var f=[r,i],c=mn.resolve(e,f);if(c)return s(c.implementation,f);var l=[r],o=mn.resolve(e,l);return o?s(o.implementation,l):s(e,n)}else return e(r,i,a);function s(m,v){try{return m.apply(m,v)}catch(h){var d;if(h instanceof TypeError&&((d=h.data)===null||d===void 0?void 0:d.category)==="wrongType"){var p=[];throw p.push("value: ".concat(nr(r))),v.length>=2&&p.push("index: ".concat(nr(i))),v.length>=3&&p.push("array: ".concat(nr(a))),new TypeError("Function ".concat(t," cannot apply callback arguments ")+"".concat(e.name,"(").concat(p.join(", "),") at index ").concat(JSON.stringify(i)))}else throw new TypeError("Function ".concat(t," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(h.message))}}}var My="filter",Fy=["typed"],By=I(My,Fy,e=>{var{typed:r}=e;return r("filter",{"Array, function":ju,"Matrix, function":function(a,t){return a.create(ju(a.toArray(),t))},"Array, RegExp":Ba,"Matrix, RegExp":function(a,t){return a.create(Ba(a.toArray(),t))}})});function ju(e,r){return gf(e,function(i,a,t){return Mn(r,i,[a],t,"filter")})}var es="flatten",Ty=["typed","matrix"],Oy=I(es,Ty,e=>{var{typed:r,matrix:i}=e;return r(es,{Array:function(t){return Xe(t)},Matrix:function(t){var n=Xe(t.toArray());return i(n)}})}),rs="forEach",$y=["typed"],_y=I(rs,$y,e=>{var{typed:r}=e;return r(rs,{"Array, function":Iy,"Matrix, function":function(a,t){a.forEach(t)}})});function Iy(e,r){var i=function a(t,n){if(Array.isArray(t))Ka(t,function(u,f){a(u,n.concat(f))});else return Mn(r,t,n,e,"forEach")};i(e,[])}var ts="getMatrixDataType",Ry=["typed"],qy=I(ts,Ry,e=>{var{typed:r}=e;return r(ts,{Array:function(a){return Vn(a,nr)},Matrix:function(a){return a.getDataType()}})}),ns="identity",zy=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Py=I(ns,zy,e=>{var{typed:r,config:i,matrix:a,BigNumber:t,DenseMatrix:n,SparseMatrix:u}=e;return r(ns,{"":function(){return i.matrix==="Matrix"?a([]):[]},string:function(o){return a(o)},"number | BigNumber":function(o){return c(o,o,i.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(o,s){return c(o,o,s)},"number | BigNumber, number | BigNumber":function(o,s){return c(o,s,i.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(o,s,m){return c(o,s,m)},Array:function(o){return f(o)},"Array, string":function(o,s){return f(o,s)},Matrix:function(o){return f(o.valueOf(),o.storage())},"Matrix, string":function(o,s){return f(o.valueOf(),s)}});function f(l,o){switch(l.length){case 0:return o?a(o):[];case 1:return c(l[0],l[0],o);case 2:return c(l[0],l[1],o);default:throw new Error("Vector containing two values expected")}}function c(l,o,s){var m=ke(l)||ke(o)?t:null;if(ke(l)&&(l=l.toNumber()),ke(o)&&(o=o.toNumber()),!Ce(l)||l<1)throw new Error("Parameters in function identity must be positive integers");if(!Ce(o)||o<1)throw new Error("Parameters in function identity must be positive integers");var v=m?new t(1):1,d=m?new m(0):0,p=[l,o];if(s){if(s==="sparse")return u.diagonal(p,v,0,d);if(s==="dense")return n.diagonal(p,v,0,d);throw new TypeError('Unknown matrix type "'.concat(s,'"'))}for(var h=gn([],p,d),y=l<o?l:o,E=0;E<y;E++)h[E][E]=v;return h}}),as="kron",Uy=["typed","matrix","multiplyScalar"],Ly=I(as,Uy,e=>{var{typed:r,matrix:i,multiplyScalar:a}=e;return r(as,{"Matrix, Matrix":function(u,f){return i(t(u.toArray(),f.toArray()))},"Matrix, Array":function(u,f){return i(t(u.toArray(),f))},"Array, Matrix":function(u,f){return i(t(u,f.toArray()))},"Array, Array":t});function t(n,u){if(Ge(n).length===1&&(n=[n]),Ge(u).length===1&&(u=[u]),Ge(n).length>2||Ge(u).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(n.length)+", y = "+JSON.stringify(u.length)+")");var f=[],c=[];return n.map(function(l){return u.map(function(o){return c=[],f.push(c),l.map(function(s){return o.map(function(m){return c.push(a(s,m))})})})})&&f}}),is="map",ky=["typed"],Hy=I(is,ky,e=>{var{typed:r}=e;return r(is,{"Array, function":Gy,"Matrix, function":function(a,t){return a.map(t)}})});function Gy(e,r){var i=function a(t,n){return Array.isArray(t)?t.map(function(u,f){return a(u,n.concat(f))}):Mn(r,t,n,e,"map")};return i(e,[])}var os="diff",Vy=["typed","matrix","subtract","number"],qm=I(os,Vy,e=>{var{typed:r,matrix:i,subtract:a,number:t}=e;return r(os,{"Array | Matrix":function(o){return Be(o)?i(u(o.toArray())):u(o)},"Array | Matrix, number":function(o,s){if(!Ce(s))throw new RangeError("Dimension must be a whole number");return Be(o)?i(n(o.toArray(),s)):n(o,s)},"Array, BigNumber":r.referTo("Array,number",l=>(o,s)=>l(o,t(s))),"Matrix, BigNumber":r.referTo("Matrix,number",l=>(o,s)=>l(o,t(s)))});function n(l,o){if(Be(l)&&(l=l.toArray()),!Array.isArray(l))throw RangeError("Array/Matrix does not have that many dimensions");if(o>0){var s=[];return l.forEach(m=>{s.push(n(m,o-1))}),s}else{if(o===0)return u(l);throw RangeError("Cannot have negative dimension")}}function u(l){for(var o=[],s=l.length,m=1;m<s;m++)o.push(f(l[m-1],l[m]));return o}function f(l,o){Be(l)&&(l=l.toArray()),Be(o)&&(o=o.toArray());var s=Array.isArray(l),m=Array.isArray(o);if(s&&m)return c(l,o);if(!s&&!m)return a(o,l);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function c(l,o){if(l.length!==o.length)throw RangeError("Not all sub-arrays have the same length");for(var s=[],m=l.length,v=0;v<m;v++)s.push(f(l[v],o[v]));return s}}),Zy="ones",Yy=["typed","config","matrix","BigNumber"],Wy=I(Zy,Yy,e=>{var{typed:r,config:i,matrix:a,BigNumber:t}=e;return r("ones",{"":function(){return i.matrix==="Array"?n([]):n([],"default")},"...number | BigNumber | string":function(l){var o=l[l.length-1];if(typeof o=="string"){var s=l.pop();return n(l,s)}else return i.matrix==="Array"?n(l):n(l,"default")},Array:n,Matrix:function(l){var o=l.storage();return n(l.valueOf(),o)},"Array | Matrix, string":function(l,o){return n(l.valueOf(),o)}});function n(c,l){var o=u(c),s=o?new t(1):1;if(f(c),l){var m=a(l);return c.length>0?m.resize(c,s):m}else{var v=[];return c.length>0?gn(v,c,s):v}}function u(c){var l=!1;return c.forEach(function(o,s,m){ke(o)&&(l=!0,m[s]=o.toNumber())}),l}function f(c){c.forEach(function(l){if(typeof l!="number"||!Ce(l)||l<0)throw new Error("Parameters in function ones must be positive integers")})}});function Ki(){throw new Error('No "bignumber" implementation available')}function zm(){throw new Error('No "fraction" implementation available')}function Pm(){throw new Error('No "matrix" implementation available')}var us="range",Xy=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Um=I(us,Xy,e=>{var{typed:r,config:i,matrix:a,bignumber:t,smaller:n,smallerEq:u,larger:f,largerEq:c,add:l,isPositive:o}=e;return r(us,{string:m,"string, boolean":m,"number, number":function(h,y){return s(v(h,y,1,!1))},"number, number, number":function(h,y,E){return s(v(h,y,E,!1))},"number, number, boolean":function(h,y,E){return s(v(h,y,1,E))},"number, number, number, boolean":function(h,y,E,g){return s(v(h,y,E,g))},"BigNumber, BigNumber":function(h,y){var E=h.constructor;return s(v(h,y,new E(1),!1))},"BigNumber, BigNumber, BigNumber":function(h,y,E){return s(v(h,y,E,!1))},"BigNumber, BigNumber, boolean":function(h,y,E){var g=h.constructor;return s(v(h,y,new g(1),E))},"BigNumber, BigNumber, BigNumber, boolean":function(h,y,E,g){return s(v(h,y,E,g))},"Unit, Unit, Unit":function(h,y,E){return s(v(h,y,E,!1))},"Unit, Unit, Unit, boolean":function(h,y,E,g){return s(v(h,y,E,g))}});function s(p){return i.matrix==="Matrix"?a?a(p):Pm():p}function m(p,h){var y=d(p);if(!y)throw new SyntaxError('String "'+p+'" is no valid range');return i.number==="BigNumber"?(t===void 0&&Ki(),s(v(t(y.start),t(y.end),t(y.step)))):s(v(y.start,y.end,y.step,h))}function v(p,h,y,E){for(var g=[],w=o(y)?E?u:n:E?c:f,x=p;w(x,h);)g.push(x),x=l(x,y);return g}function d(p){var h=p.split(":"),y=h.map(function(g){return Number(g)}),E=y.some(function(g){return isNaN(g)});if(E)return null;switch(y.length){case 2:return{start:y[0],end:y[1],step:1};case 3:return{start:y[0],end:y[2],step:y[1]};default:return null}}}),ss="reshape",Jy=["typed","isInteger","matrix"],Qy=I(ss,Jy,e=>{var{typed:r,isInteger:i}=e;return r(ss,{"Matrix, Array":function(t,n){return t.reshape(n,!0)},"Array, Array":function(t,n){return n.forEach(function(u){if(!i(u))throw new TypeError("Invalid size for dimension: "+u)}),mf(t,n)}})}),Ky="resize",jy=["config","matrix"],eb=I(Ky,jy,e=>{var{config:r,matrix:i}=e;return function(n,u,f){if(arguments.length!==2&&arguments.length!==3)throw new Wt("resize",arguments.length,2,3);if(Be(u)&&(u=u.valueOf()),ke(u[0])&&(u=u.map(function(o){return ke(o)?o.toNumber():o})),Be(n))return n.resize(u,f,!0);if(typeof n=="string")return a(n,u,f);var c=Array.isArray(n)?!1:r.matrix!=="Array";if(u.length===0){for(;Array.isArray(n);)n=n[0];return $e(n)}else{Array.isArray(n)||(n=[n]),n=$e(n);var l=gn(n,u,f);return c?i(l):l}};function a(t,n,u){if(u!==void 0){if(typeof u!="string"||u.length!==1)throw new TypeError("Single character expected as defaultValue")}else u=" ";if(n.length!==1)throw new Le(n.length,1);var f=n[0];if(typeof f!="number"||!Ce(f))throw new TypeError("Invalid size, must contain positive integers (size: "+Pe(n)+")");if(t.length>f)return t.substring(0,f);if(t.length<f){for(var c=t,l=0,o=f-t.length;l<o;l++)c+=u;return c}else return t}}),ls="rotate",rb=["typed","multiply","rotationMatrix"],tb=I(ls,rb,e=>{var{typed:r,multiply:i,rotationMatrix:a}=e;return r(ls,{"Array , number | BigNumber | Complex | Unit":function(u,f){t(u,2);var c=i(a(f),u);return c.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(u,f){return t(u,2),i(a(f),u)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(u,f,c){t(u,3);var l=i(a(f,c),u);return l},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(u,f,c){return t(u,3),i(a(f,c),u)}});function t(n,u){var f=Array.isArray(n)?Ge(n):n.size();if(f.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(u));if(f.length===2&&f[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(u));if(f[0]!==u)throw new RangeError("Vector must be of dimensions 1x".concat(u))}}),cs="rotationMatrix",nb=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],ab=I(cs,nb,e=>{var{typed:r,config:i,multiplyScalar:a,addScalar:t,unaryMinus:n,norm:u,BigNumber:f,matrix:c,DenseMatrix:l,SparseMatrix:o,cos:s,sin:m}=e;return r(cs,{"":function(){return i.matrix==="Matrix"?c([]):[]},string:function(g){return c(g)},"number | BigNumber | Complex | Unit":function(g){return v(g,i.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(g,w){return v(g,w)},"number | BigNumber | Complex | Unit, Array":function(g,w){var x=c(w);return d(x),y(g,x,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(g,w){d(w);var x=w.storage()||(i.matrix==="Matrix"?"dense":void 0);return y(g,w,x)},"number | BigNumber | Complex | Unit, Array, string":function(g,w,x){var b=c(w);return d(b),y(g,b,x)},"number | BigNumber | Complex | Unit, Matrix, string":function(g,w,x){return d(w),y(g,w,x)}});function v(E,g){var w=ke(E),x=w?new f(-1):-1,b=s(E),A=m(E),D=[[b,a(x,A)],[A,b]];return h(D,g)}function d(E){var g=E.size();if(g.length<1||g[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function p(E){return E.reduce((g,w)=>a(g,w))}function h(E,g){if(g){if(g==="sparse")return new o(E);if(g==="dense")return new l(E);throw new TypeError('Unknown matrix type "'.concat(g,'"'))}return E}function y(E,g,w){var x=u(g);if(x===0)throw new RangeError("Rotation around zero vector");var b=ke(E)?f:null,A=b?new b(1):1,D=b?new b(-1):-1,S=b?new b(g.get([0])/x):g.get([0])/x,N=b?new b(g.get([1])/x):g.get([1])/x,B=b?new b(g.get([2])/x):g.get([2])/x,F=s(E),$=t(A,n(F)),q=m(E),_=t(F,p([S,S,$])),C=t(p([S,N,$]),p([D,B,q])),T=t(p([S,B,$]),p([N,q])),H=t(p([S,N,$]),p([B,q])),O=t(F,p([N,N,$])),L=t(p([N,B,$]),p([D,S,q])),W=t(p([S,B,$]),p([D,N,q])),X=t(p([N,B,$]),p([S,q])),P=t(F,p([B,B,$])),J=[[_,C,T],[H,O,L],[W,X,P]];return h(J,w)}}),fs="row",ib=["typed","Index","matrix","range"],Lm=I(fs,ib,e=>{var{typed:r,Index:i,matrix:a,range:t}=e;return r(fs,{"Matrix, number":n,"Array, number":function(f,c){return n(a($e(f)),c).valueOf()}});function n(u,f){if(u.size().length!==2)throw new Error("Only two dimensional matrix is supported");rr(f,u.size()[0]);var c=t(0,u.size()[1]),l=new i(f,c),o=u.subset(l);return Be(o)?o:a([[o]])}}),ms="size",ob=["typed","config","?matrix"],ub=I(ms,ob,e=>{var{typed:r,config:i,matrix:a}=e;return r(ms,{Matrix:function(n){return n.create(n.size())},Array:Ge,string:function(n){return i.matrix==="Array"?[n.length]:a([n.length])},"number | Complex | BigNumber | Unit | boolean | null":function(n){return i.matrix==="Array"?[]:a?a([]):Pm()}})}),vs="squeeze",sb=["typed","matrix"],lb=I(vs,sb,e=>{var{typed:r,matrix:i}=e;return r(vs,{Array:function(t){return Fa($e(t))},Matrix:function(t){var n=Fa(t.toArray());return Array.isArray(n)?i(n):n},any:function(t){return $e(t)}})}),ps="subset",cb=["typed","matrix"],km=I(ps,cb,e=>{var{typed:r,matrix:i}=e;return r(ps,{"Array, Index":function(t,n){var u=i(t),f=u.subset(n);return n.isScalar()?f:f.valueOf()},"Matrix, Index":function(t,n){return t.subset(n)},"Object, Index":mb,"string, Index":fb,"Array, Index, any":function(t,n,u){return i($e(t)).subset(n,u,void 0).valueOf()},"Array, Index, any, any":function(t,n,u,f){return i($e(t)).subset(n,u,f).valueOf()},"Matrix, Index, any":function(t,n,u){return t.clone().subset(n,u)},"Matrix, Index, any, any":function(t,n,u,f){return t.clone().subset(n,u,f)},"string, Index, string":ds,"string, Index, string, string":ds,"Object, Index, any":vb})});function fb(e,r){if(!Wa(r))throw new TypeError("Index expected");if(r.size().length!==1)throw new Le(r.size().length,1);var i=e.length;rr(r.min()[0],i),rr(r.max()[0],i);var a=r.dimension(0),t="";return a.forEach(function(n){t+=e.charAt(n)}),t}function ds(e,r,i,a){if(!r||r.isIndex!==!0)throw new TypeError("Index expected");if(r.size().length!==1)throw new Le(r.size().length,1);if(a!==void 0){if(typeof a!="string"||a.length!==1)throw new TypeError("Single character expected as defaultValue")}else a=" ";var t=r.dimension(0),n=t.size()[0];if(n!==i.length)throw new Le(t.size()[0],i.length);var u=e.length;rr(r.min()[0]),rr(r.max()[0]);for(var f=[],c=0;c<u;c++)f[c]=e.charAt(c);if(t.forEach(function(s,m){f[s]=i.charAt(m[0])}),f.length>u)for(var l=u-1,o=f.length;l<o;l++)f[l]||(f[l]=a);return f.join("")}function mb(e,r){if(r.size().length!==1)throw new Le(r.size(),1);var i=r.dimension(0);if(typeof i!="string")throw new TypeError("String expected as index to retrieve an object property");return Tr(e,i)}function vb(e,r,i){if(r.size().length!==1)throw new Le(r.size(),1);var a=r.dimension(0);if(typeof a!="string")throw new TypeError("String expected as index to retrieve an object property");var t=$e(e);return bn(t,a,i),t}var hs="transpose",pb=["typed","matrix"],db=I(hs,pb,e=>{var{typed:r,matrix:i}=e;return r(hs,{Array:u=>a(i(u)).valueOf(),Matrix:a,any:$e});function a(u){var f=u.size(),c;switch(f.length){case 1:c=u.clone();break;case 2:{var l=f[0],o=f[1];if(o===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Pe(f)+")");switch(u.storage()){case"dense":c=t(u,l,o);break;case"sparse":c=n(u,l,o);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Pe(f)+")")}return c}function t(u,f,c){for(var l=u._data,o=[],s,m=0;m<c;m++){s=o[m]=[];for(var v=0;v<f;v++)s[v]=$e(l[v][m])}return u.createDenseMatrix({data:o,size:[c,f],datatype:u._datatype})}function n(u,f,c){for(var l=u._values,o=u._index,s=u._ptr,m=l?[]:void 0,v=[],d=[],p=[],h=0;h<f;h++)p[h]=0;var y,E,g;for(y=0,E=o.length;y<E;y++)p[o[y]]++;for(var w=0,x=0;x<f;x++)d.push(w),w+=p[x],p[x]=d[x];for(d.push(w),g=0;g<c;g++)for(var b=s[g],A=s[g+1],D=b;D<A;D++){var S=p[o[D]]++;v[S]=g,l&&(m[S]=$e(l[D]))}return u.createSparseMatrix({values:m,index:v,ptr:d,size:[c,f],datatype:u._datatype})}}),gs="ctranspose",hb=["typed","transpose","conj"],gb=I(gs,hb,e=>{var{typed:r,transpose:i,conj:a}=e;return r(gs,{any:function(n){return a(i(n))}})}),ys="zeros",yb=["typed","config","matrix","BigNumber"],bb=I(ys,yb,e=>{var{typed:r,config:i,matrix:a,BigNumber:t}=e;return r(ys,{"":function(){return i.matrix==="Array"?n([]):n([],"default")},"...number | BigNumber | string":function(l){var o=l[l.length-1];if(typeof o=="string"){var s=l.pop();return n(l,s)}else return i.matrix==="Array"?n(l):n(l,"default")},Array:n,Matrix:function(l){var o=l.storage();return n(l.valueOf(),o)},"Array | Matrix, string":function(l,o){return n(l.valueOf(),o)}});function n(c,l){var o=u(c),s=o?new t(0):0;if(f(c),l){var m=a(l);return c.length>0?m.resize(c,s):m}else{var v=[];return c.length>0?gn(v,c,s):v}}function u(c){var l=!1;return c.forEach(function(o,s,m){ke(o)&&(l=!0,m[s]=o.toNumber())}),l}function f(c){c.forEach(function(l){if(typeof l!="number"||!Ce(l)||l<0)throw new Error("Parameters in function zeros must be positive integers")})}}),bs="fft",xb=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],wb=I(bs,xb,e=>{var{typed:r,matrix:i,addScalar:a,multiplyScalar:t,divideScalar:n,exp:u,tau:f,i:c,dotDivide:l,conj:o,pow:s,ceil:m,log2:v}=e;return r(bs,{Array:d,Matrix:function(g){return g.create(d(g.toArray()))}});function d(E){var g=Ge(E);return g.length===1?y(E,g[0]):p(E.map(w=>d(w,g.slice(1))),0)}function p(E,g){var w=Ge(E);if(g!==0)return new Array(w[0]).fill(0).map((b,A)=>p(E[A],g-1));if(w.length===1)return y(E);function x(b){var A=Ge(b);return new Array(A[1]).fill(0).map((D,S)=>new Array(A[0]).fill(0).map((N,B)=>b[B][S]))}return x(p(x(E),1))}function h(E){for(var g=E.length,w=u(n(t(-1,t(c,f)),g)),x=[],b=1-g;b<g;b++)x.push(s(w,n(s(b,2),2)));for(var A=s(2,m(v(g+g-1))),D=[...new Array(g).fill(0).map((C,T)=>t(E[T],x[g-1+T])),...new Array(A-g).fill(0)],S=[...new Array(g+g-1).fill(0).map((C,T)=>n(1,x[T])),...new Array(A-(g+g-1)).fill(0)],N=y(D),B=y(S),F=new Array(A).fill(0).map((C,T)=>t(N[T],B[T])),$=l(o(d(o(F))),A),q=[],_=g-1;_<g+g-1;_++)q.push(t($[_],x[_]));return q}function y(E){var g=E.length;if(g===1)return[E[0]];if(g%2===0){for(var w=[...y(E.filter((D,S)=>S%2===0)),...y(E.filter((D,S)=>S%2===1))],x=0;x<g/2;x++){var b=w[x],A=t(w[x+g/2],u(t(t(f,c),n(-x,g))));w[x]=a(b,A),w[x+g/2]=a(b,t(-1,A))}return w}else return h(E)}}),xs="ifft",Nb=["typed","fft","dotDivide","conj"],Db=I(xs,Nb,e=>{var{typed:r,fft:i,dotDivide:a,conj:t}=e;return r(xs,{"Array | Matrix":function(u){var f=Be(u)?u.size():Ge(u);return a(t(i(t(u))),f.reduce((c,l)=>c*l,1))}})});function Wn(e){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Wn(e)}function Ab(e,r){if(Wn(e)!=="object"||e===null)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var a=i.call(e,r||"default");if(Wn(a)!=="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Eb(e){var r=Ab(e,"string");return Wn(r)==="symbol"?r:String(r)}function hr(e,r,i){return r=Eb(r),r in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function ws(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function Sb(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?ws(Object(i),!0).forEach(function(a){hr(e,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ws(Object(i)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(i,a))})}return e}var Cb="solveODE",Mb=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],Fb=I(Cb,Mb,e=>{var{typed:r,add:i,subtract:a,multiply:t,divide:n,max:u,map:f,abs:c,isPositive:l,isNegative:o,larger:s,smaller:m,matrix:v,bignumber:d,unaryMinus:p}=e;function h(D){return function(S,N,B,F){var $=!(N.length===2&&(N.every(b)||N.every(Zr)));if($)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var q=N[0],_=N[1],C=s(_,q),T=F.firstStep;if(T!==void 0&&!l(T))throw new Error('"firstStep" must be positive');var H=F.maxStep;if(H!==void 0&&!l(H))throw new Error('"maxStep" must be positive');var O=F.minStep;if(O&&o(O))throw new Error('"minStep" must be positive or zero');var L=[q,_,T,O,H].filter(R=>R!==void 0);if(!(L.every(b)||L.every(Zr)))throw new Error('Inconsistent type of "t" dependant variables');for(var W=1,X=F.tol?F.tol:1e-4,P=F.minDelta?F.minDelta:.2,J=F.maxDelta?F.maxDelta:5,ee=F.maxIter?F.maxIter:1e4,K=[q,_,...B,H,O].some(ke),[oe,se,ie,re]=K?[d(D.a),d(D.c),d(D.b),d(D.bp)]:[D.a,D.c,D.b,D.bp],pe=T?C?T:p(T):n(a(_,q),W),Ae=[q],be=[B],Ne=a(ie,re),U=0,G=0,te=w(C),k=x(C);te(Ae[U],_);){var Y=[];pe=k(Ae[U],_,pe),Y.push(S(Ae[U],be[U]));for(var j=1;j<se.length;++j)Y.push(S(i(Ae[U],t(se[j],pe)),i(be[U],t(pe,oe[j],Y))));var fe=u(c(f(t(Ne,Y),R=>Zr(R)?R.value:R)));fe<X&&X/fe>1/4&&(Ae.push(i(Ae[U],pe)),be.push(i(be[U],t(pe,ie,Y))),U++);var ue=.84*(X/fe)**(1/5);if(m(ue,P)?ue=P:s(ue,J)&&(ue=J),ue=K?d(ue):ue,pe=t(pe,ue),H&&s(c(pe),H)?pe=C?H:p(H):O&&m(c(pe),O)&&(pe=C?O:p(O)),G++,G>ee)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ae,y:be}}}function y(D,S,N,B){var F=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],$=[null,1/2,3/4,1],q=[2/9,1/3,4/9,0],_=[7/24,1/4,1/3,1/8],C={a:F,c:$,b:q,bp:_};return h(C)(D,S,N,B)}function E(D,S,N,B){var F=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],$=[null,1/5,3/10,4/5,8/9,1,1],q=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],_=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],C={a:F,c:$,b:q,bp:_};return h(C)(D,S,N,B)}function g(D,S,N,B){var F=B.method?B.method:"RK45",$={RK23:y,RK45:E};if(F.toUpperCase()in $){var q=Sb({},B);return delete q.method,$[F.toUpperCase()](D,S,N,q)}else{var _=Object.keys($).map(T=>'"'.concat(T,'"')),C="".concat(_.slice(0,-1).join(", ")," and ").concat(_.slice(-1));throw new Error('Unavailable method "'.concat(F,'". Available methods are ').concat(C))}}function w(D){return D?m:s}function x(D){var S=D?s:m;return function(N,B,F){var $=i(N,F);return S($,B)?a(B,N):F}}function b(D){return ke(D)||Ve(D)}function A(D,S,N,B){var F=g(D,S.toArray(),N.toArray(),B);return{t:v(F.t),y:v(F.y)}}return r("solveODE",{"function, Array, Array, Object":g,"function, Matrix, Matrix, Object":A,"function, Array, Array":(D,S,N)=>g(D,S,N,{}),"function, Matrix, Matrix":(D,S,N)=>A(D,S,N,{}),"function, Array, number | BigNumber | Unit":(D,S,N)=>{var B=g(D,S,[N],{});return{t:B.t,y:B.y.map(F=>F[0])}},"function, Matrix, number | BigNumber | Unit":(D,S,N)=>{var B=g(D,S.toArray(),[N],{});return{t:v(B.t),y:v(B.y.map(F=>F[0]))}},"function, Array, number | BigNumber | Unit, Object":(D,S,N,B)=>{var F=g(D,S,[N],B);return{t:F.t,y:F.y.map($=>$[0])}},"function, Matrix, number | BigNumber | Unit, Object":(D,S,N,B)=>{var F=g(D,S.toArray(),[N],B);return{t:v(F.t),y:v(F.y.map($=>$[0]))}}})}),Bb="erf",Tb=["typed"],Ob=I(Bb,Tb,e=>{var{typed:r}=e;return r("name",{number:function(u){var f=Math.abs(u);return f>=Ib?Bt(u):f<=$b?Bt(u)*i(f):f<=4?Bt(u)*(1-a(f)):Bt(u)*(1-t(f))},"Array | Matrix":r.referToSelf(n=>u=>He(u,n))});function i(n){var u=n*n,f=yt[0][4]*u,c=u,l;for(l=0;l<3;l+=1)f=(f+yt[0][l])*u,c=(c+sn[0][l])*u;return n*(f+yt[0][3])/(c+sn[0][3])}function a(n){var u=yt[1][8]*n,f=n,c;for(c=0;c<7;c+=1)u=(u+yt[1][c])*n,f=(f+sn[1][c])*n;var l=(u+yt[1][7])/(f+sn[1][7]),o=parseInt(n*16)/16,s=(n-o)*(n+o);return Math.exp(-o*o)*Math.exp(-s)*l}function t(n){var u=1/(n*n),f=yt[2][5]*u,c=u,l;for(l=0;l<4;l+=1)f=(f+yt[2][l])*u,c=(c+sn[2][l])*u;var o=u*(f+yt[2][4])/(c+sn[2][4]);o=(_b-o)/n,u=parseInt(n*16)/16;var s=(n-u)*(n+u);return Math.exp(-u*u)*Math.exp(-s)*o}}),$b=.46875,_b=.5641895835477563,yt=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],sn=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],Ib=Math.pow(2,53),Ns="mode",Rb=["typed","isNaN","isNumeric"],qb=I(Ns,Rb,e=>{var{typed:r,isNaN:i,isNumeric:a}=e;return r(Ns,{"Array | Matrix":t,"...":function(u){return t(u)}});function t(n){n=Xe(n.valueOf());var u=n.length;if(u===0)throw new Error("Cannot calculate mode of an empty array");for(var f={},c=[],l=0,o=0;o<n.length;o++){var s=n[o];if(a(s)&&i(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in f||(f[s]=0),f[s]++,f[s]===l?c.push(s):f[s]>l&&(l=f[s],c=[s])}return c}});function Or(e,r,i){var a;return String(e).indexOf("Unexpected type")!==-1?(a=arguments.length>2?" (type: "+nr(i)+", value: "+JSON.stringify(i)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+a)):String(e).indexOf("complex numbers")!==-1?(a=arguments.length>2?" (type: "+nr(i)+", value: "+JSON.stringify(i)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+a)):e}var Ds="prod",zb=["typed","config","multiplyScalar","numeric"],Pb=I(Ds,zb,e=>{var{typed:r,config:i,multiplyScalar:a,numeric:t}=e;return r(Ds,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":function(f,c){throw new Error("prod(A, dim) is not yet supported")},"...":function(f){return n(f)}});function n(u){var f;if(At(u,function(c){try{f=f===void 0?c:a(f,c)}catch(l){throw Or(l,"prod",c)}}),typeof f=="string"&&(f=t(f,i.number)),f===void 0)throw new Error("Cannot calculate prod of an empty array");return f}}),As="format",Ub=["typed"],Lb=I(As,Ub,e=>{var{typed:r}=e;return r(As,{any:Pe,"any, Object | function | number":Pe})}),Es="bin",kb=["typed","format"],Hb=I(Es,kb,e=>{var{typed:r,format:i}=e;return r(Es,{"number | BigNumber":function(t){return i(t,{notation:"bin"})},"number | BigNumber, number":function(t,n){return i(t,{notation:"bin",wordSize:n})}})}),Ss="oct",Gb=["typed","format"],Vb=I(Ss,Gb,e=>{var{typed:r,format:i}=e;return r(Ss,{"number | BigNumber":function(t){return i(t,{notation:"oct"})},"number | BigNumber, number":function(t,n){return i(t,{notation:"oct",wordSize:n})}})}),Cs="hex",Zb=["typed","format"],Yb=I(Cs,Zb,e=>{var{typed:r,format:i}=e;return r(Cs,{"number | BigNumber":function(t){return i(t,{notation:"hex"})},"number | BigNumber, number":function(t,n){return i(t,{notation:"hex",wordSize:n})}})}),Ms="print",Wb=["typed"],Xb=I(Ms,Wb,e=>{var{typed:r}=e;return r(Ms,{"string, Object | Array":Fs,"string, Object | Array, number | Object":Fs})});function Fs(e,r,i){return e.replace(/\$([\w.]+)/g,function(a,t){for(var n=t.split("."),u=r[n.shift()];n.length&&u!==void 0;){var f=n.shift();u=f?u[f]:u+"."}return u!==void 0?Br(u)?u:Pe(u,i):a})}var Bs="to",Jb=["typed","matrix","concat"],Qb=I(Bs,Jb,e=>{var{typed:r,matrix:i,concat:a}=e,t=ur({typed:r,matrix:i,concat:a});return r(Bs,{"Unit, Unit | string":(n,u)=>n.to(u)},t({Ds:!0}))}),Ts="isPrime",Kb=["typed"],jb=I(Ts,Kb,e=>{var{typed:r}=e;return r(Ts,{number:function(a){if(a*0!==0)return!1;if(a<=3)return a>1;if(a%2===0||a%3===0)return!1;for(var t=5;t*t<=a;t+=6)if(a%t===0||a%(t+2)===0)return!1;return!0},BigNumber:function(a){if(a.toNumber()*0!==0)return!1;if(a.lte(3))return a.gt(1);if(a.mod(2).eq(0)||a.mod(3).eq(0))return!1;if(a.lt(Math.pow(2,32))){for(var t=a.toNumber(),n=5;n*n<=t;n+=6)if(t%n===0||t%(n+2)===0)return!1;return!0}function u(E,g,w){for(var x=1;!g.eq(0);)g.mod(2).eq(0)?(g=g.div(2),E=E.mul(E).mod(w)):(g=g.sub(1),x=E.mul(x).mod(w));return x}var f=a.constructor.clone({precision:a.toFixed(0).length*2});a=new f(a);for(var c=0,l=a.sub(1);l.mod(2).eq(0);)l=l.div(2),c+=1;var o=null;if(a.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(E=>E<a);else{var s=Math.min(a.toNumber()-2,Math.floor(2*Math.pow(a.toFixed(0).length*Math.log(10),2)));o=[];for(var m=2;m<=s;m+=1)o.push(s)}for(var v=0;v<o.length;v+=1){var d=o[v],p=u(a.sub(a).add(d),l,a);if(!p.eq(1)){for(var h=0,y=p;!y.eq(a.sub(1));h+=1,y=y.mul(y).mod(a))if(h===c-1)return!1}}return!0},"Array | Matrix":r.referToSelf(i=>a=>He(a,i))})}),ex="numeric",rx=["number","?bignumber","?fraction"],tx=I(ex,rx,e=>{var{number:r,bignumber:i,fraction:a}=e,t={string:!0,number:!0,BigNumber:!0,Fraction:!0},n={number:u=>r(u),BigNumber:i?u=>i(u):Ki,Fraction:a?u=>a(u):zm};return function(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",l=arguments.length>2?arguments[2]:void 0;if(l!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var o=nr(f);if(!(o in t))throw new TypeError("Cannot convert "+f+' of type "'+o+'"; valid input types are '+Object.keys(t).join(", "));if(!(c in n))throw new TypeError("Cannot convert "+f+' to type "'+c+'"; valid output types are '+Object.keys(n).join(", "));return c===o?f:n[c](f)}}),Os="divideScalar",nx=["typed","numeric"],ax=I(Os,nx,e=>{var{typed:r,numeric:i}=e;return r(Os,{"number, number":function(t,n){return t/n},"Complex, Complex":function(t,n){return t.div(n)},"BigNumber, BigNumber":function(t,n){return t.div(n)},"Fraction, Fraction":function(t,n){return t.div(n)},"Unit, number | Complex | Fraction | BigNumber | Unit":(a,t)=>a.divide(t),"number | Fraction | Complex | BigNumber, Unit":(a,t)=>t.divideInto(a)})}),$s="pow",ix=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],ox=I($s,ix,e=>{var{typed:r,config:i,identity:a,multiply:t,matrix:n,inv:u,number:f,fraction:c,Complex:l}=e;return r($s,{"number, number":o,"Complex, Complex":function(d,p){return d.pow(p)},"BigNumber, BigNumber":function(d,p){return p.isInteger()||d>=0||i.predictable?d.pow(p):new l(d.toNumber(),0).pow(p.toNumber(),0)},"Fraction, Fraction":function(d,p){var h=d.pow(p);if(h!=null)return h;if(i.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return o(d.valueOf(),p.valueOf())},"Array, number":s,"Array, BigNumber":function(d,p){return s(d,p.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(d,p){return m(d,p.toNumber())},"Unit, number | BigNumber":function(d,p){return d.pow(p)}});function o(v,d){if(i.predictable&&!Ce(d)&&v<0)try{var p=c(d),h=f(p);if((d===h||Math.abs((d-h)/d)<1e-14)&&p.d%2===1)return(p.n%2===0?1:-1)*Math.pow(-v,d)}catch{}return i.predictable&&(v<-1&&d===1/0||v>-1&&v<0&&d===-1/0)?NaN:Ce(d)||v>=0||i.predictable?Qf(v,d):v*v<1&&d===1/0||v*v>1&&d===-1/0?0:new l(v,0).pow(d,0)}function s(v,d){if(!Ce(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var p=Ge(v);if(p.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+p.length+" dimensions)");if(p[0]!==p[1])throw new Error("For A^b, A must be square (size is "+p[0]+"x"+p[1]+")");if(d<0)try{return s(u(v),-d)}catch(E){throw E.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+d+")"):E}for(var h=a(p[0]).valueOf(),y=v;d>=1;)(d&1)===1&&(h=t(y,h)),d>>=1,y=t(y,y);return h}function m(v,d){return n(s(v.valueOf(),d))}}),ln="Number of decimals in function round must be an integer",_s="round",ux=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],sx=I(_s,ux,e=>{var{typed:r,matrix:i,equalScalar:a,zeros:t,BigNumber:n,DenseMatrix:u}=e,f=Dr({typed:r,equalScalar:a}),c=gr({typed:r,DenseMatrix:u}),l=nt({typed:r});return r(_s,{number:Ko,"number, number":Ko,"number, BigNumber":function(s,m){if(!m.isInteger())throw new TypeError(ln);return new n(s).toDecimalPlaces(m.toNumber())},Complex:function(s){return s.round()},"Complex, number":function(s,m){if(m%1)throw new TypeError(ln);return s.round(m)},"Complex, BigNumber":function(s,m){if(!m.isInteger())throw new TypeError(ln);var v=m.toNumber();return s.round(v)},BigNumber:function(s){return s.toDecimalPlaces(0)},"BigNumber, BigNumber":function(s,m){if(!m.isInteger())throw new TypeError(ln);return s.toDecimalPlaces(m.toNumber())},Fraction:function(s){return s.round()},"Fraction, number":function(s,m){if(m%1)throw new TypeError(ln);return s.round(m)},"Fraction, BigNumber":function(s,m){if(!m.isInteger())throw new TypeError(ln);return s.round(m.toNumber())},"Array | Matrix":r.referToSelf(o=>s=>He(s,o)),"SparseMatrix, number | BigNumber":r.referToSelf(o=>(s,m)=>f(s,m,o,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(o=>(s,m)=>l(s,m,o,!1)),"Array, number | BigNumber":r.referToSelf(o=>(s,m)=>l(i(s),m,o,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(o=>(s,m)=>a(s,0)?t(m.size(),m.storage()):c(m,s,o,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(o=>(s,m)=>a(s,0)?t(m.size(),m.storage()):l(m,s,o,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(o=>(s,m)=>l(i(m),s,o,!0).valueOf())})}),Is="log",lx=["config","typed","divideScalar","Complex"],cx=I(Is,lx,e=>{var{typed:r,config:i,divideScalar:a,Complex:t}=e;return r(Is,{number:function(u){return u>=0||i.predictable?o0(u):new t(u,0).log()},Complex:function(u){return u.log()},BigNumber:function(u){return!u.isNegative()||i.predictable?u.ln():new t(u.toNumber(),0).log()},"any, any":r.referToSelf(n=>(u,f)=>a(n(u),n(f)))})}),Rs="log1p",fx=["typed","config","divideScalar","log","Complex"],mx=I(Rs,fx,e=>{var{typed:r,config:i,divideScalar:a,log:t,Complex:n}=e;return r(Rs,{number:function(c){return c>=-1||i.predictable?ud(c):u(new n(c,0))},Complex:u,BigNumber:function(c){var l=c.plus(1);return!l.isNegative()||i.predictable?l.ln():u(new n(c.toNumber(),0))},"Array | Matrix":r.referToSelf(f=>c=>He(c,f)),"any, any":r.referToSelf(f=>(c,l)=>a(f(c),t(l)))});function u(f){var c=f.re+1;return new n(Math.log(Math.sqrt(c*c+f.im*f.im)),Math.atan2(f.im,c))}}),qs="nthRoots",vx=["config","typed","divideScalar","Complex"],px=I(qs,vx,e=>{var{typed:r,config:i,divideScalar:a,Complex:t}=e,n=[function(c){return new t(c,0)},function(c){return new t(0,c)},function(c){return new t(-c,0)},function(c){return new t(0,-c)}];function u(f,c){if(c<0)throw new Error("Root must be greater than zero");if(c===0)throw new Error("Root must be non-zero");if(c%1!==0)throw new Error("Root must be an integer");if(f===0||f.abs()===0)return[new t(0,0)];var l=typeof f=="number",o;(l||f.re===0||f.im===0)&&(l?o=2*+(f<0):f.im===0?o=2*+(f.re<0):o=2*+(f.im<0)+1);for(var s=f.arg(),m=f.abs(),v=[],d=Math.pow(m,1/c),p=0;p<c;p++){var h=(o+4*p)/c;if(h===Math.round(h)){v.push(n[h%4](d));continue}v.push(new t({r:d,phi:(s+2*Math.PI*p)/c}))}return v}return r(qs,{Complex:function(c){return u(c,2)},"Complex, number":u})}),zs="dotPow",dx=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],hx=I(zs,dx,e=>{var{typed:r,equalScalar:i,matrix:a,pow:t,DenseMatrix:n,concat:u}=e,f=$r({typed:r}),c=ft({typed:r,DenseMatrix:n}),l=Dr({typed:r,equalScalar:i}),o=gr({typed:r,DenseMatrix:n}),s=ur({typed:r,matrix:a,concat:u}),m={};for(var v in t.signatures)Object.prototype.hasOwnProperty.call(t.signatures,v)&&!v.includes("Matrix")&&!v.includes("Array")&&(m[v]=t.signatures[v]);var d=r(m);return r(zs,s({elop:d,SS:c,DS:f,Ss:l,sS:o}))}),Ps="dotDivide",gx=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],yx=I(Ps,gx,e=>{var{typed:r,matrix:i,equalScalar:a,divideScalar:t,DenseMatrix:n,concat:u}=e,f=at({typed:r,equalScalar:a}),c=$r({typed:r}),l=ft({typed:r,DenseMatrix:n}),o=Dr({typed:r,equalScalar:a}),s=gr({typed:r,DenseMatrix:n}),m=ur({typed:r,matrix:i,concat:u});return r(Ps,m({elop:t,SS:l,DS:c,SD:f,Ss:o,sS:s}))});function jn(e){var{DenseMatrix:r}=e;return function(a,t,n){var u=a.size();if(u.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Pe(u)+")");var f=u[0],c=u[1];if(f!==c)throw new RangeError("Matrix must be square (size: "+Pe(u)+")");var l=[];if(Be(t)){var o=t.size(),s=t._data;if(o.length===1){if(o[0]!==f)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var m=0;m<f;m++)l[m]=[s[m]];return new r({data:l,size:[f,1],datatype:t._datatype})}if(o.length===2){if(o[0]!==f||o[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Ma(t)){if(n){l=[];for(var v=0;v<f;v++)l[v]=[s[v][0]];return new r({data:l,size:[f,1],datatype:t._datatype})}return t}if(kt(t)){for(var d=0;d<f;d++)l[d]=[0];for(var p=t._values,h=t._index,y=t._ptr,E=y[1],g=y[0];g<E;g++){var w=h[g];l[w][0]=p[g]}return new r({data:l,size:[f,1],datatype:t._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(je(t)){var x=Ge(t);if(x.length===1){if(x[0]!==f)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<f;b++)l[b]=[t[b]];return new r({data:l,size:[f,1]})}if(x.length===2){if(x[0]!==f||x[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var A=0;A<f;A++)l[A]=[t[A][0]];return new r({data:l,size:[f,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var Us="lsolve",bx=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],xx=I(Us,bx,e=>{var{typed:r,matrix:i,divideScalar:a,multiplyScalar:t,subtract:n,equalScalar:u,DenseMatrix:f}=e,c=jn({DenseMatrix:f});return r(Us,{"SparseMatrix, Array | Matrix":function(m,v){return o(m,v)},"DenseMatrix, Array | Matrix":function(m,v){return l(m,v)},"Array, Array | Matrix":function(m,v){var d=i(m),p=l(d,v);return p.valueOf()}});function l(s,m){m=c(s,m,!0);for(var v=m._data,d=s._size[0],p=s._size[1],h=[],y=s._data,E=0;E<p;E++){var g=v[E][0]||0,w=void 0;if(u(g,0))w=0;else{var x=y[E][E];if(u(x,0))throw new Error("Linear system cannot be solved since matrix is singular");w=a(g,x);for(var b=E+1;b<d;b++)v[b]=[n(v[b][0]||0,t(w,y[b][E]))]}h[E]=[w]}return new f({data:h,size:[d,1]})}function o(s,m){m=c(s,m,!0);for(var v=m._data,d=s._size[0],p=s._size[1],h=s._values,y=s._index,E=s._ptr,g=[],w=0;w<p;w++){var x=v[w][0]||0;if(u(x,0))g[w]=[0];else{for(var b=0,A=[],D=[],S=E[w],N=E[w+1],B=S;B<N;B++){var F=y[B];F===w?b=h[B]:F>w&&(A.push(h[B]),D.push(F))}if(u(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var $=a(x,b),q=0,_=D.length;q<_;q++){var C=D[q];v[C]=[n(v[C][0]||0,t($,A[q]))]}g[w]=[$]}}return new f({data:g,size:[d,1]})}}),Ls="usolve",wx=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Nx=I(Ls,wx,e=>{var{typed:r,matrix:i,divideScalar:a,multiplyScalar:t,subtract:n,equalScalar:u,DenseMatrix:f}=e,c=jn({DenseMatrix:f});return r(Ls,{"SparseMatrix, Array | Matrix":function(m,v){return o(m,v)},"DenseMatrix, Array | Matrix":function(m,v){return l(m,v)},"Array, Array | Matrix":function(m,v){var d=i(m),p=l(d,v);return p.valueOf()}});function l(s,m){m=c(s,m,!0);for(var v=m._data,d=s._size[0],p=s._size[1],h=[],y=s._data,E=p-1;E>=0;E--){var g=v[E][0]||0,w=void 0;if(u(g,0))w=0;else{var x=y[E][E];if(u(x,0))throw new Error("Linear system cannot be solved since matrix is singular");w=a(g,x);for(var b=E-1;b>=0;b--)v[b]=[n(v[b][0]||0,t(w,y[b][E]))]}h[E]=[w]}return new f({data:h,size:[d,1]})}function o(s,m){m=c(s,m,!0);for(var v=m._data,d=s._size[0],p=s._size[1],h=s._values,y=s._index,E=s._ptr,g=[],w=p-1;w>=0;w--){var x=v[w][0]||0;if(u(x,0))g[w]=[0];else{for(var b=0,A=[],D=[],S=E[w],N=E[w+1],B=N-1;B>=S;B--){var F=y[B];F===w?b=h[B]:F<w&&(A.push(h[B]),D.push(F))}if(u(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var $=a(x,b),q=0,_=D.length;q<_;q++){var C=D[q];v[C]=[n(v[C][0],t($,A[q]))]}g[w]=[$]}}return new f({data:g,size:[d,1]})}}),ks="lsolveAll",Dx=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Ax=I(ks,Dx,e=>{var{typed:r,matrix:i,divideScalar:a,multiplyScalar:t,subtract:n,equalScalar:u,DenseMatrix:f}=e,c=jn({DenseMatrix:f});return r(ks,{"SparseMatrix, Array | Matrix":function(m,v){return o(m,v)},"DenseMatrix, Array | Matrix":function(m,v){return l(m,v)},"Array, Array | Matrix":function(m,v){var d=i(m),p=l(d,v);return p.map(h=>h.valueOf())}});function l(s,m){for(var v=[c(s,m,!0)._data.map(D=>D[0])],d=s._data,p=s._size[0],h=s._size[1],y=0;y<h;y++)for(var E=v.length,g=0;g<E;g++){var w=v[g];if(u(d[y][y],0))if(u(w[y],0)){if(g===0){var b=[...w];b[y]=1;for(var A=y+1;A<h;A++)b[A]=n(b[A],d[A][y]);v.push(b)}}else{if(g===0)return[];v.splice(g,1),g-=1,E-=1}else{w[y]=a(w[y],d[y][y]);for(var x=y+1;x<h;x++)w[x]=n(w[x],t(w[y],d[x][y]))}}return v.map(D=>new f({data:D.map(S=>[S]),size:[p,1]}))}function o(s,m){for(var v=[c(s,m,!0)._data.map(W=>W[0])],d=s._size[0],p=s._size[1],h=s._values,y=s._index,E=s._ptr,g=0;g<p;g++)for(var w=v.length,x=0;x<w;x++){for(var b=v[x],A=[],D=[],S=E[g],N=E[g+1],B=0,F=S;F<N;F++){var $=y[F];$===g?B=h[F]:$>g&&(A.push(h[F]),D.push($))}if(u(B,0))if(u(b[g],0)){if(x===0){var T=[...b];T[g]=1;for(var H=0,O=D.length;H<O;H++){var L=D[H];T[L]=n(T[L],A[H])}v.push(T)}}else{if(x===0)return[];v.splice(x,1),x-=1,w-=1}else{b[g]=a(b[g],B);for(var q=0,_=D.length;q<_;q++){var C=D[q];b[C]=n(b[C],t(b[g],A[q]))}}}return v.map(W=>new f({data:W.map(X=>[X]),size:[d,1]}))}}),Hs="usolveAll",Ex=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],Sx=I(Hs,Ex,e=>{var{typed:r,matrix:i,divideScalar:a,multiplyScalar:t,subtract:n,equalScalar:u,DenseMatrix:f}=e,c=jn({DenseMatrix:f});return r(Hs,{"SparseMatrix, Array | Matrix":function(m,v){return o(m,v)},"DenseMatrix, Array | Matrix":function(m,v){return l(m,v)},"Array, Array | Matrix":function(m,v){var d=i(m),p=l(d,v);return p.map(h=>h.valueOf())}});function l(s,m){for(var v=[c(s,m,!0)._data.map(D=>D[0])],d=s._data,p=s._size[0],h=s._size[1],y=h-1;y>=0;y--)for(var E=v.length,g=0;g<E;g++){var w=v[g];if(u(d[y][y],0))if(u(w[y],0)){if(g===0){var b=[...w];b[y]=1;for(var A=y-1;A>=0;A--)b[A]=n(b[A],d[A][y]);v.push(b)}}else{if(g===0)return[];v.splice(g,1),g-=1,E-=1}else{w[y]=a(w[y],d[y][y]);for(var x=y-1;x>=0;x--)w[x]=n(w[x],t(w[y],d[x][y]))}}return v.map(D=>new f({data:D.map(S=>[S]),size:[p,1]}))}function o(s,m){for(var v=[c(s,m,!0)._data.map(W=>W[0])],d=s._size[0],p=s._size[1],h=s._values,y=s._index,E=s._ptr,g=p-1;g>=0;g--)for(var w=v.length,x=0;x<w;x++){for(var b=v[x],A=[],D=[],S=E[g],N=E[g+1],B=0,F=N-1;F>=S;F--){var $=y[F];$===g?B=h[F]:$<g&&(A.push(h[F]),D.push($))}if(u(B,0))if(u(b[g],0)){if(x===0){var T=[...b];T[g]=1;for(var H=0,O=D.length;H<O;H++){var L=D[H];T[L]=n(T[L],A[H])}v.push(T)}}else{if(x===0)return[];v.splice(x,1),x-=1,w-=1}else{b[g]=a(b[g],B);for(var q=0,_=D.length;q<_;q++){var C=D[q];b[C]=n(b[C],t(b[g],A[q]))}}}return v.map(W=>new f({data:W.map(X=>[X]),size:[d,1]}))}}),Cx="matAlgo08xS0Sid",Mx=["typed","equalScalar"],ji=I(Cx,Mx,e=>{var{typed:r,equalScalar:i}=e;return function(t,n,u){var f=t._values,c=t._index,l=t._ptr,o=t._size,s=t._datatype,m=n._values,v=n._index,d=n._ptr,p=n._size,h=n._datatype;if(o.length!==p.length)throw new Le(o.length,p.length);if(o[0]!==p[0]||o[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+p+")");if(!f||!m)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var y=o[0],E=o[1],g,w=i,x=0,b=u;typeof s=="string"&&s===h&&(g=s,w=r.find(i,[g,g]),x=r.convert(0,g),b=r.find(u,[g,g]));for(var A=[],D=[],S=[],N=[],B=[],F,$,q,_,C=0;C<E;C++){S[C]=D.length;var T=C+1;for($=l[C],q=l[C+1],F=$;F<q;F++)_=c[F],B[_]=T,N[_]=f[F],D.push(_);for($=d[C],q=d[C+1],F=$;F<q;F++)_=v[F],B[_]===T&&(N[_]=b(N[_],m[F]));for(F=S[C];F<D.length;){_=D[F];var H=N[_];w(H,x)?D.splice(F,1):(A.push(H),F++)}}return S[E]=D.length,t.createSparseMatrix({values:A,index:D,ptr:S,size:[y,E],datatype:g})}}),eo=I("useMatrixForArrayScalar",["typed","matrix"],e=>{var{typed:r,matrix:i}=e;return{"Array, number":r.referTo("DenseMatrix, number",a=>(t,n)=>a(i(t),n).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",a=>(t,n)=>a(i(t),n).valueOf()),"number, Array":r.referTo("number, DenseMatrix",a=>(t,n)=>a(t,i(n)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",a=>(t,n)=>a(t,i(n)).valueOf())}}),Gs="leftShift",Fx=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Bx=I(Gs,Fx,e=>{var{typed:r,matrix:i,equalScalar:a,zeros:t,DenseMatrix:n,concat:u}=e,f=Rt({typed:r}),c=at({typed:r,equalScalar:a}),l=ji({typed:r,equalScalar:a}),o=Yt({typed:r,DenseMatrix:n}),s=Dr({typed:r,equalScalar:a}),m=nt({typed:r}),v=ur({typed:r,matrix:i,concat:u}),d=eo({typed:r,matrix:i});return r(Gs,{"number, number":tm,"BigNumber, BigNumber":W1,"SparseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():s(h,y,p,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():m(h,y,p,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):o(y,h,p,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):m(y,h,p,!0))},d,v({SS:l,DS:f,SD:c}))}),Vs="rightArithShift",Tx=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],Ox=I(Vs,Tx,e=>{var{typed:r,matrix:i,equalScalar:a,zeros:t,DenseMatrix:n,concat:u}=e,f=Rt({typed:r}),c=at({typed:r,equalScalar:a}),l=ji({typed:r,equalScalar:a}),o=Yt({typed:r,DenseMatrix:n}),s=Dr({typed:r,equalScalar:a}),m=nt({typed:r}),v=ur({typed:r,matrix:i,concat:u}),d=eo({typed:r,matrix:i});return r(Vs,{"number, number":nm,"BigNumber, BigNumber":X1,"SparseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():s(h,y,p,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():m(h,y,p,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):o(y,h,p,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):m(y,h,p,!0))},d,v({SS:l,DS:f,SD:c}))}),Zs="rightLogShift",$x=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],_x=I(Zs,$x,e=>{var{typed:r,matrix:i,equalScalar:a,zeros:t,DenseMatrix:n,concat:u}=e,f=Rt({typed:r}),c=at({typed:r,equalScalar:a}),l=ji({typed:r,equalScalar:a}),o=Yt({typed:r,DenseMatrix:n}),s=Dr({typed:r,equalScalar:a}),m=nt({typed:r}),v=ur({typed:r,matrix:i,concat:u}),d=eo({typed:r,matrix:i});return r(Zs,{"number, number":am,"SparseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():s(h,y,p,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(p=>(h,y)=>a(y,0)?h.clone():m(h,y,p,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):o(y,h,p,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(p=>(h,y)=>a(h,0)?t(y.size(),y.storage()):m(y,h,p,!0))},d,v({SS:l,DS:f,SD:c}))}),Ys="and",Ix=["typed","matrix","equalScalar","zeros","not","concat"],Rx=I(Ys,Ix,e=>{var{typed:r,matrix:i,equalScalar:a,zeros:t,not:n,concat:u}=e,f=at({typed:r,equalScalar:a}),c=ai({typed:r,equalScalar:a}),l=Dr({typed:r,equalScalar:a}),o=nt({typed:r}),s=ur({typed:r,matrix:i,concat:u});return r(Ys,{"number, number":lm,"Complex, Complex":function(v,d){return(v.re!==0||v.im!==0)&&(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(v,d){return!v.isZero()&&!d.isZero()&&!v.isNaN()&&!d.isNaN()},"Unit, Unit":r.referToSelf(m=>(v,d)=>m(v.value||0,d.value||0)),"SparseMatrix, any":r.referToSelf(m=>(v,d)=>n(d)?t(v.size(),v.storage()):l(v,d,m,!1)),"DenseMatrix, any":r.referToSelf(m=>(v,d)=>n(d)?t(v.size(),v.storage()):o(v,d,m,!1)),"any, SparseMatrix":r.referToSelf(m=>(v,d)=>n(v)?t(v.size(),v.storage()):l(d,v,m,!0)),"any, DenseMatrix":r.referToSelf(m=>(v,d)=>n(v)?t(v.size(),v.storage()):o(d,v,m,!0)),"Array, any":r.referToSelf(m=>(v,d)=>m(i(v),d).valueOf()),"any, Array":r.referToSelf(m=>(v,d)=>m(v,i(d)).valueOf())},s({SS:c,DS:f}))}),Ua="compare",qx=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],zx=I(Ua,qx,e=>{var{typed:r,config:i,equalScalar:a,matrix:t,BigNumber:n,Fraction:u,DenseMatrix:f,concat:c}=e,l=$r({typed:r}),o=ii({typed:r,equalScalar:a}),s=gr({typed:r,DenseMatrix:f}),m=ur({typed:r,matrix:t,concat:c}),v=Cn({typed:r});return r(Ua,Px({typed:r,config:i}),{"boolean, boolean":function(p,h){return p===h?0:p>h?1:-1},"BigNumber, BigNumber":function(p,h){return ct(p,h,i.epsilon)?new n(0):new n(p.cmp(h))},"Fraction, Fraction":function(p,h){return new u(p.compare(h))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},v,m({SS:o,DS:l,Ss:s}))}),Px=I(Ua,["typed","config"],e=>{var{typed:r,config:i}=e;return r(Ua,{"number, number":function(t,n){return Pr(t,n,i.epsilon)?0:t>n?1:-1}})}),Ux=function e(r,i){var a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,t=/(^[ ]*|[ ]*$)/g,n=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,f=/^0/,c=function(g){return e.insensitive&&(""+g).toLowerCase()||""+g},l=c(r).replace(t,"")||"",o=c(i).replace(t,"")||"",s=l.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=o.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),v=parseInt(l.match(u),16)||s.length!==1&&l.match(n)&&Date.parse(l),d=parseInt(o.match(u),16)||v&&o.match(n)&&Date.parse(o)||null,p,h;if(d){if(v<d)return-1;if(v>d)return 1}for(var y=0,E=Math.max(s.length,m.length);y<E;y++){if(p=!(s[y]||"").match(f)&&parseFloat(s[y])||s[y]||0,h=!(m[y]||"").match(f)&&parseFloat(m[y])||m[y]||0,isNaN(p)!==isNaN(h))return isNaN(p)?1:-1;if(typeof p!=typeof h&&(p+="",h+=""),p<h)return-1;if(p>h)return 1}return 0};const cn=Xn(Ux);var Ws="compareNatural",Lx=["typed","compare"],kx=I(Ws,Lx,e=>{var{typed:r,compare:i}=e,a=i.signatures["boolean,boolean"];return r(Ws,{"any, any":t});function t(c,l){var o=nr(c),s=nr(l),m;if((o==="number"||o==="BigNumber"||o==="Fraction")&&(s==="number"||s==="BigNumber"||s==="Fraction"))return m=i(c,l),m.toString()!=="0"?m>0?1:-1:cn(o,s);var v=["Array","DenseMatrix","SparseMatrix"];if(v.includes(o)||v.includes(s))return m=n(t,c,l),m!==0?m:cn(o,s);if(o!==s)return cn(o,s);if(o==="Complex")return Hx(c,l);if(o==="Unit")return c.equalBase(l)?t(c.value,l.value):u(t,c.formatUnits(),l.formatUnits());if(o==="boolean")return a(c,l);if(o==="string")return cn(c,l);if(o==="Object")return f(t,c,l);if(o==="null"||o==="undefined")return 0;throw new TypeError('Unsupported type of value "'+o+'"')}function n(c,l,o){return kt(l)&&kt(o)?u(c,l.toJSON().values,o.toJSON().values):kt(l)?n(c,l.toArray(),o):kt(o)?n(c,l,o.toArray()):Ma(l)?n(c,l.toJSON().data,o):Ma(o)?n(c,l,o.toJSON().data):Array.isArray(l)?Array.isArray(o)?u(c,l,o):n(c,l,[o]):n(c,[l],o)}function u(c,l,o){for(var s=0,m=Math.min(l.length,o.length);s<m;s++){var v=c(l[s],o[s]);if(v!==0)return v}return l.length>o.length?1:l.length<o.length?-1:0}function f(c,l,o){var s=Object.keys(l),m=Object.keys(o);s.sort(cn),m.sort(cn);var v=u(c,s,m);if(v!==0)return v;for(var d=0;d<s.length;d++){var p=c(l[s[d]],o[m[d]]);if(p!==0)return p}return 0}});function Hx(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0}var Xs="compareText",Gx=["typed","matrix","concat"];Ci.signature="any, any";var Vx=I(Xs,Gx,e=>{var{typed:r,matrix:i,concat:a}=e,t=ur({typed:r,matrix:i,concat:a});return r(Xs,Ci,t({elop:Ci,Ds:!0}))}),La="equal",Zx=["typed","matrix","equalScalar","DenseMatrix","concat"],Yx=I(La,Zx,e=>{var{typed:r,matrix:i,equalScalar:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ft({typed:r,DenseMatrix:t}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:i,concat:n});return r(La,Wx({typed:r,equalScalar:a}),l({elop:a,SS:f,DS:u,Ss:c}))}),Wx=I(La,["typed","equalScalar"],e=>{var{typed:r,equalScalar:i}=e;return r(La,{"any, any":function(t,n){return t===null?n===null:n===null?t===null:t===void 0?n===void 0:n===void 0?t===void 0:i(t,n)}})}),Js="equalText",Xx=["typed","compareText","isZero"],Jx=I(Js,Xx,e=>{var{typed:r,compareText:i,isZero:a}=e;return r(Js,{"any, any":function(n,u){return a(i(n,u))}})}),ka="smaller",Qx=["typed","config","matrix","DenseMatrix","concat"],Kx=I(ka,Qx,e=>{var{typed:r,config:i,matrix:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ft({typed:r,DenseMatrix:t}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:a,concat:n}),o=Cn({typed:r});return r(ka,jx({typed:r,config:i}),{"boolean, boolean":(s,m)=>s<m,"BigNumber, BigNumber":function(m,v){return m.lt(v)&&!ct(m,v,i.epsilon)},"Fraction, Fraction":(s,m)=>s.compare(m)===-1,"Complex, Complex":function(m,v){throw new TypeError("No ordering relation is defined for complex numbers")}},o,l({SS:f,DS:u,Ss:c}))}),jx=I(ka,["typed","config"],e=>{var{typed:r,config:i}=e;return r(ka,{"number, number":function(t,n){return t<n&&!Pr(t,n,i.epsilon)}})}),Ha="smallerEq",ew=["typed","config","matrix","DenseMatrix","concat"],rw=I(Ha,ew,e=>{var{typed:r,config:i,matrix:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ft({typed:r,DenseMatrix:t}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:a,concat:n}),o=Cn({typed:r});return r(Ha,tw({typed:r,config:i}),{"boolean, boolean":(s,m)=>s<=m,"BigNumber, BigNumber":function(m,v){return m.lte(v)||ct(m,v,i.epsilon)},"Fraction, Fraction":(s,m)=>s.compare(m)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},o,l({SS:f,DS:u,Ss:c}))}),tw=I(Ha,["typed","config"],e=>{var{typed:r,config:i}=e;return r(Ha,{"number, number":function(t,n){return t<=n||Pr(t,n,i.epsilon)}})}),Ga="larger",nw=["typed","config","matrix","DenseMatrix","concat"],aw=I(Ga,nw,e=>{var{typed:r,config:i,matrix:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ft({typed:r,DenseMatrix:t}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:a,concat:n}),o=Cn({typed:r});return r(Ga,iw({typed:r,config:i}),{"boolean, boolean":(s,m)=>s>m,"BigNumber, BigNumber":function(m,v){return m.gt(v)&&!ct(m,v,i.epsilon)},"Fraction, Fraction":(s,m)=>s.compare(m)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},o,l({SS:f,DS:u,Ss:c}))}),iw=I(Ga,["typed","config"],e=>{var{typed:r,config:i}=e;return r(Ga,{"number, number":function(t,n){return t>n&&!Pr(t,n,i.epsilon)}})}),Va="largerEq",ow=["typed","config","matrix","DenseMatrix","concat"],uw=I(Va,ow,e=>{var{typed:r,config:i,matrix:a,DenseMatrix:t,concat:n}=e,u=$r({typed:r}),f=ft({typed:r,DenseMatrix:t}),c=gr({typed:r,DenseMatrix:t}),l=ur({typed:r,matrix:a,concat:n}),o=Cn({typed:r});return r(Va,sw({typed:r,config:i}),{"boolean, boolean":(s,m)=>s>=m,"BigNumber, BigNumber":function(m,v){return m.gte(v)||ct(m,v,i.epsilon)},"Fraction, Fraction":(s,m)=>s.compare(m)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},o,l({SS:f,DS:u,Ss:c}))}),sw=I(Va,["typed","config"],e=>{var{typed:r,config:i}=e;return r(Va,{"number, number":function(t,n){return t>=n||Pr(t,n,i.epsilon)}})}),Qs="deepEqual",lw=["typed","equal"],cw=I(Qs,lw,e=>{var{typed:r,equal:i}=e;return r(Qs,{"any, any":function(n,u){return a(n.valueOf(),u.valueOf())}});function a(t,n){if(Array.isArray(t))if(Array.isArray(n)){var u=t.length;if(u!==n.length)return!1;for(var f=0;f<u;f++)if(!a(t[f],n[f]))return!1;return!0}else return!1;else return Array.isArray(n)?!1:i(t,n)}}),Za="unequal",fw=["typed","config","equalScalar","matrix","DenseMatrix","concat"],mw=I(Za,fw,e=>{var{typed:r,config:i,equalScalar:a,matrix:t,DenseMatrix:n,concat:u}=e,f=$r({typed:r}),c=ft({typed:r,DenseMatrix:n}),l=gr({typed:r,DenseMatrix:n}),o=ur({typed:r,matrix:t,concat:u});return r(Za,vw({typed:r,equalScalar:a}),o({elop:s,SS:c,DS:f,Ss:l}));function s(m,v){return!a(m,v)}}),vw=I(Za,["typed","equalScalar"],e=>{var{typed:r,equalScalar:i}=e;return r(Za,{"any, any":function(t,n){return t===null?n!==null:n===null?t!==null:t===void 0?n!==void 0:n===void 0?t!==void 0:!i(t,n)}})}),Ks="partitionSelect",pw=["typed","isNumeric","isNaN","compare"],dw=I(Ks,pw,e=>{var{typed:r,isNumeric:i,isNaN:a,compare:t}=e,n=t,u=(l,o)=>-t(l,o);return r(Ks,{"Array | Matrix, number":function(o,s){return f(o,s,n)},"Array | Matrix, number, string":function(o,s,m){if(m==="asc")return f(o,s,n);if(m==="desc")return f(o,s,u);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":f});function f(l,o,s){if(!Ce(o)||o<0)throw new Error("k must be a non-negative integer");if(Be(l)){var m=l.size();if(m.length>1)throw new Error("Only one dimensional matrices supported");return c(l.valueOf(),o,s)}if(Array.isArray(l))return c(l,o,s)}function c(l,o,s){if(o>=l.length)throw new Error("k out of bounds");for(var m=0;m<l.length;m++)if(i(l[m])&&a(l[m]))return l[m];for(var v=0,d=l.length-1;v<d;){for(var p=v,h=d,y=l[Math.floor(Math.random()*(d-v+1))+v];p<h;)if(s(l[p],y)>=0){var E=l[h];l[h]=l[p],l[p]=E,--h}else++p;s(l[p],y)>0&&--p,o<=p?d=p:v=p+1}return l[o]}}),js="sort",hw=["typed","matrix","compare","compareNatural"],gw=I(js,hw,e=>{var{typed:r,matrix:i,compare:a,compareNatural:t}=e,n=a,u=(o,s)=>-a(o,s);return r(js,{Array:function(s){return c(s),s.sort(n)},Matrix:function(s){return l(s),i(s.toArray().sort(n),s.storage())},"Array, function":function(s,m){return c(s),s.sort(m)},"Matrix, function":function(s,m){return l(s),i(s.toArray().sort(m),s.storage())},"Array, string":function(s,m){return c(s),s.sort(f(m))},"Matrix, string":function(s,m){return l(s),i(s.toArray().sort(f(m)),s.storage())}});function f(o){if(o==="asc")return n;if(o==="desc")return u;if(o==="natural")return t;throw new Error('String "asc", "desc", or "natural" expected')}function c(o){if(Ge(o).length!==1)throw new Error("One dimensional array expected")}function l(o){if(o.size().length!==1)throw new Error("One dimensional matrix expected")}}),el="max",yw=["typed","config","numeric","larger"],Hm=I(el,yw,e=>{var{typed:r,config:i,numeric:a,larger:t}=e;return r(el,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(c,l){return ti(c,l.valueOf(),n)},"...":function(c){if(En(c))throw new TypeError("Scalar values expected in function max");return u(c)}});function n(f,c){try{return t(f,c)?f:c}catch(l){throw Or(l,"max",c)}}function u(f){var c;if(At(f,function(l){try{isNaN(l)&&typeof l=="number"?c=NaN:(c===void 0||t(l,c))&&(c=l)}catch(o){throw Or(o,"max",l)}}),c===void 0)throw new Error("Cannot calculate max of an empty array");return typeof c=="string"&&(c=a(c,i.number)),c}}),rl="min",bw=["typed","config","numeric","smaller"],Gm=I(rl,bw,e=>{var{typed:r,config:i,numeric:a,smaller:t}=e;return r(rl,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(c,l){return ti(c,l.valueOf(),n)},"...":function(c){if(En(c))throw new TypeError("Scalar values expected in function min");return u(c)}});function n(f,c){try{return t(f,c)?f:c}catch(l){throw Or(l,"min",c)}}function u(f){var c;if(At(f,function(l){try{isNaN(l)&&typeof l=="number"?c=NaN:(c===void 0||t(l,c))&&(c=l)}catch(o){throw Or(o,"min",l)}}),c===void 0)throw new Error("Cannot calculate min of an empty array");return typeof c=="string"&&(c=a(c,i.number)),c}}),xw="ImmutableDenseMatrix",ww=["smaller","DenseMatrix"],Nw=I(xw,ww,e=>{var{smaller:r,DenseMatrix:i}=e;function a(t,n){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(n&&!Br(n))throw new Error("Invalid datatype: "+n);if(Be(t)||je(t)){var u=new i(t,n);this._data=u._data,this._size=u._size,this._datatype=u._datatype,this._min=null,this._max=null}else if(t&&je(t.data)&&je(t.size))this._data=t.data,this._size=t.size,this._datatype=t.datatype,this._min=typeof t.min<"u"?t.min:null,this._max=typeof t.max<"u"?t.max:null;else{if(t)throw new TypeError("Unsupported type of data ("+nr(t)+")");this._data=[],this._size=[0],this._datatype=n,this._min=null,this._max=null}}return a.prototype=new i,a.prototype.type="ImmutableDenseMatrix",a.prototype.isImmutableDenseMatrix=!0,a.prototype.subset=function(t){switch(arguments.length){case 1:{var n=i.prototype.subset.call(this,t);return Be(n)?new a({data:n._data,size:n._size,datatype:n._datatype}):n}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},a.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},a.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},a.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},a.prototype.clone=function(){return new a({data:$e(this._data),size:$e(this._size),datatype:this._datatype})},a.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},a.fromJSON=function(t){return new a(t)},a.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},a.prototype.min=function(){if(this._min===null){var t=null;this.forEach(function(n){(t===null||r(n,t))&&(t=n)}),this._min=t!==null?t:void 0}return this._min},a.prototype.max=function(){if(this._max===null){var t=null;this.forEach(function(n){(t===null||r(t,n))&&(t=n)}),this._max=t!==null?t:void 0}return this._max},a},{isClass:!0}),Dw="Index",Aw=["ImmutableDenseMatrix"],Ew=I(Dw,Aw,e=>{var{ImmutableDenseMatrix:r}=e;function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var n=0,u=arguments.length;n<u;n++){var f=arguments[n];if(ki(f))this._dimensions.push(f),this._isScalar=!1;else if(Array.isArray(f)||Be(f)){var c=a(f.valueOf());this._dimensions.push(c);var l=c.size();(l.length!==1||l[0]!==1)&&(this._isScalar=!1)}else if(typeof f=="number")this._dimensions.push(a([f]));else if(typeof f=="string")this._dimensions.push(f);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range")}}i.prototype.type="Index",i.prototype.isIndex=!0;function a(t){for(var n=0,u=t.length;n<u;n++)if(typeof t[n]!="number"||!Ce(t[n]))throw new TypeError("Index parameters must be positive integer numbers");return new r(t)}return i.prototype.clone=function(){var t=new i;return t._dimensions=$e(this._dimensions),t._isScalar=this._isScalar,t},i.create=function(t){var n=new i;return i.apply(n,t),n},i.prototype.size=function(){for(var t=[],n=0,u=this._dimensions.length;n<u;n++){var f=this._dimensions[n];t[n]=typeof f=="string"?1:f.size()[0]}return t},i.prototype.max=function(){for(var t=[],n=0,u=this._dimensions.length;n<u;n++){var f=this._dimensions[n];t[n]=typeof f=="string"?f:f.max()}return t},i.prototype.min=function(){for(var t=[],n=0,u=this._dimensions.length;n<u;n++){var f=this._dimensions[n];t[n]=typeof f=="string"?f:f.min()}return t},i.prototype.forEach=function(t){for(var n=0,u=this._dimensions.length;n<u;n++)t(this._dimensions[n],n,this)},i.prototype.dimension=function(t){return this._dimensions[t]||null},i.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},i.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},i.prototype.isScalar=function(){return this._isScalar},i.prototype.toArray=function(){for(var t=[],n=0,u=this._dimensions.length;n<u;n++){var f=this._dimensions[n];t.push(typeof f=="string"?f:f.toArray())}return t},i.prototype.valueOf=i.prototype.toArray,i.prototype.toString=function(){for(var t=[],n=0,u=this._dimensions.length;n<u;n++){var f=this._dimensions[n];typeof f=="string"?t.push(JSON.stringify(f)):t.push(f.toString())}return"["+t.join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},i.fromJSON=function(t){return i.create(t.dimensions)},i},{isClass:!0}),Sw="FibonacciHeap",Cw=["smaller","larger"],Mw=I(Sw,Cw,e=>{var{smaller:r,larger:i}=e,a=1/Math.log((1+Math.sqrt(5))/2);function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}t.prototype.type="FibonacciHeap",t.prototype.isFibonacciHeap=!0,t.prototype.insert=function(o,s){var m={key:o,value:s,degree:0};if(this._minimum){var v=this._minimum;m.left=v,m.right=v.right,v.right=m,m.right.left=m,r(o,v.key)&&(this._minimum=m)}else m.left=m,m.right=m,this._minimum=m;return this._size++,m},t.prototype.size=function(){return this._size},t.prototype.clear=function(){this._minimum=null,this._size=0},t.prototype.isEmpty=function(){return this._size===0},t.prototype.extractMinimum=function(){var o=this._minimum;if(o===null)return o;for(var s=this._minimum,m=o.degree,v=o.child;m>0;){var d=v.right;v.left.right=v.right,v.right.left=v.left,v.left=s,v.right=s.right,s.right=v,v.right.left=v,v.parent=null,v=d,m--}return o.left.right=o.right,o.right.left=o.left,o===o.right?s=null:(s=o.right,s=l(s,this._size)),this._size--,this._minimum=s,o},t.prototype.remove=function(o){this._minimum=n(this._minimum,o,-1),this.extractMinimum()};function n(o,s,m){s.key=m;var v=s.parent;return v&&r(s.key,v.key)&&(u(o,s,v),f(o,v)),r(s.key,o.key)&&(o=s),o}function u(o,s,m){s.left.right=s.right,s.right.left=s.left,m.degree--,m.child===s&&(m.child=s.right),m.degree===0&&(m.child=null),s.left=o,s.right=o.right,o.right=s,s.right.left=s,s.parent=null,s.mark=!1}function f(o,s){var m=s.parent;m&&(s.mark?(u(o,s,m),f(m)):s.mark=!0)}var c=function(s,m){s.left.right=s.right,s.right.left=s.left,s.parent=m,m.child?(s.left=m.child,s.right=m.child.right,m.child.right=s,s.right.left=s):(m.child=s,s.right=s,s.left=s),m.degree++,s.mark=!1};function l(o,s){var m=Math.floor(Math.log(s)*a)+1,v=new Array(m),d=0,p=o;if(p)for(d++,p=p.right;p!==o;)d++,p=p.right;for(var h;d>0;){for(var y=p.degree,E=p.right;h=v[y],!!h;){if(i(p.key,h.key)){var g=h;h=p,p=g}c(h,p),v[y]=null,y++}v[y]=p,p=E,d--}o=null;for(var w=0;w<m;w++)h=v[w],h&&(o?(h.left.right=h.right,h.right.left=h.left,h.left=o,h.right=o.right,o.right=h,h.right.left=h,r(h.key,o.key)&&(o=h)):o=h);return o}return t},{isClass:!0}),Fw="Spa",Bw=["addScalar","equalScalar","FibonacciHeap"],Tw=I(Fw,Bw,e=>{var{addScalar:r,equalScalar:i,FibonacciHeap:a}=e;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new a}return t.prototype.type="Spa",t.prototype.isSpa=!0,t.prototype.set=function(n,u){if(this._values[n])this._values[n].value=u;else{var f=this._heap.insert(n,u);this._values[n]=f}},t.prototype.get=function(n){var u=this._values[n];return u?u.value:0},t.prototype.accumulate=function(n,u){var f=this._values[n];f?f.value=r(f.value,u):(f=this._heap.insert(n,u),this._values[n]=f)},t.prototype.forEach=function(n,u,f){var c=this._heap,l=this._values,o=[],s=c.extractMinimum();for(s&&o.push(s);s&&s.key<=u;)s.key>=n&&(i(s.value,0)||f(s.key,s.value,this)),s=c.extractMinimum(),s&&o.push(s);for(var m=0;m<o.length;m++){var v=o[m];s=c.insert(v.key,v.value),l[s.key]=s}},t.prototype.swap=function(n,u){var f=this._values[n],c=this._values[u];if(!f&&c)f=this._heap.insert(n,c.value),this._heap.remove(c),this._values[n]=f,this._values[u]=void 0;else if(f&&!c)c=this._heap.insert(u,f.value),this._heap.remove(f),this._values[u]=c,this._values[n]=void 0;else if(f&&c){var l=f.value;f.value=c.value,c.value=l}},t},{isClass:!0}),Ow=Kn(function(e){return new e(1).exp()},{hasher:oi}),$w=Kn(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:oi}),ro=Kn(function(e){return e.acos(-1)},{hasher:oi}),_w=Kn(function(e){return ro(e).times(2)},{hasher:oi});function oi(e){return e[0].precision}function tl(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function Ni(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?tl(Object(i),!0).forEach(function(a){hr(e,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):tl(Object(i)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(i,a))})}return e}var Iw="Unit",Rw=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],qw=I(Iw,Rw,e=>{var{on:r,config:i,addScalar:a,subtract:t,multiplyScalar:n,divideScalar:u,pow:f,abs:c,fix:l,round:o,equal:s,isNumeric:m,format:v,number:d,Complex:p,BigNumber:h,Fraction:y}=e,E=d;function g(U,G){if(!(this instanceof g))throw new Error("Constructor must be called with the new operator");if(!(U==null||m(U)||wt(U)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,G===void 0)this.units=[],this.dimensions=H.map(k=>0);else if(typeof G=="string"){var te=g.parse(G);this.units=te.units,this.dimensions=te.dimensions}else if(Zr(G)&&G.value===null)this.fixPrefix=G.fixPrefix,this.skipAutomaticSimplification=G.skipAutomaticSimplification,this.dimensions=G.dimensions.slice(0),this.units=G.units.map(k=>wr({},k));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(U)}Object.defineProperty(g,"name",{value:"Unit"}),g.prototype.constructor=g,g.prototype.type="Unit",g.prototype.isUnit=!0;var w,x,b;function A(){for(;b===" "||b===" ";)N()}function D(U){return U>="0"&&U<="9"||U==="."}function S(U){return U>="0"&&U<="9"}function N(){x++,b=w.charAt(x)}function B(U){x=U,b=w.charAt(x)}function F(){var U="",G=x;if(b==="+"?N():b==="-"&&(U+=b,N()),!D(b))return B(G),null;if(b==="."){if(U+=b,N(),!S(b))return B(G),null}else{for(;S(b);)U+=b,N();b==="."&&(U+=b,N())}for(;S(b);)U+=b,N();if(b==="E"||b==="e"){var te="",k=x;if(te+=b,N(),(b==="+"||b==="-")&&(te+=b,N()),!S(b))return B(k),U;for(U=U+te;S(b);)U+=b,N()}return U}function $(){for(var U="";S(b)||g.isValidAlpha(b);)U+=b,N();var G=U.charAt(0);return g.isValidAlpha(G)?U:null}function q(U){return b===U?(N(),U):null}g.parse=function(U,G){if(G=G||{},w=U,x=-1,b="",typeof w!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var te=new g;te.units=[];var k=1,Y=!1;N(),A();var j=F(),fe=null;if(j){if(i.number==="BigNumber")fe=new h(j);else if(i.number==="Fraction")try{fe=new y(j)}catch{fe=parseFloat(j)}else fe=parseFloat(j);A(),q("*")?(k=1,Y=!0):q("/")&&(k=-1,Y=!0)}for(var ue=[],R=1;;){for(A();b==="(";)ue.push(k),R*=k,k=1,N(),A();var z=void 0;if(b){var Q=b;if(z=$(),z===null)throw new SyntaxError('Unexpected "'+Q+'" in "'+w+'" at index '+x.toString())}else break;var ae=_(z);if(ae===null)throw new SyntaxError('Unit "'+z+'" not found.');var le=k*R;if(A(),q("^")){A();var ve=F();if(ve===null)throw new SyntaxError('In "'+U+'", "^" must be followed by a floating-point number');le*=ve}te.units.push({unit:ae.unit,prefix:ae.prefix,power:le});for(var de=0;de<H.length;de++)te.dimensions[de]+=(ae.unit.dimensions[de]||0)*le;for(A();b===")";){if(ue.length===0)throw new SyntaxError('Unmatched ")" in "'+w+'" at index '+x.toString());R/=ue.pop(),N(),A()}if(Y=!1,q("*")?(k=1,Y=!0):q("/")?(k=-1,Y=!0):k=1,ae.unit.base){var ce=ae.unit.base.key;K.auto[ce]={unit:ae.unit,prefix:ae.prefix}}}if(A(),b)throw new SyntaxError('Could not parse: "'+U+'"');if(Y)throw new SyntaxError('Trailing characters: "'+U+'"');if(ue.length!==0)throw new SyntaxError('Unmatched "(" in "'+w+'"');if(te.units.length===0&&!G.allowNoUnits)throw new SyntaxError('"'+U+'" contains no units');return te.value=fe!==void 0?te._normalize(fe):null,te},g.prototype.clone=function(){var U=new g;U.fixPrefix=this.fixPrefix,U.skipAutomaticSimplification=this.skipAutomaticSimplification,U.value=$e(this.value),U.dimensions=this.dimensions.slice(0),U.units=[];for(var G=0;G<this.units.length;G++){U.units[G]={};for(var te in this.units[G])Ee(this.units[G],te)&&(U.units[G][te]=this.units[G][te])}return U},g.prototype.valueType=function(){return nr(this.value)},g.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},g.prototype._normalize=function(U){if(U==null||this.units.length===0)return U;for(var G=U,te=g._getNumberConverter(nr(U)),k=0;k<this.units.length;k++){var Y=te(this.units[k].unit.value),j=te(this.units[k].prefix.value),fe=te(this.units[k].power);G=n(G,f(n(Y,j),fe))}return G},g.prototype._denormalize=function(U,G){if(U==null||this.units.length===0)return U;for(var te=U,k=g._getNumberConverter(nr(U)),Y=0;Y<this.units.length;Y++){var j=k(this.units[Y].unit.value),fe=k(this.units[Y].prefix.value),ue=k(this.units[Y].power);te=u(te,f(n(j,fe),ue))}return te};var _=Kn(U=>{if(Ee(P,U)){var G=P[U],te=G.prefixes[""];return{unit:G,prefix:te}}for(var k in P)if(Ee(P,k)&&Ad(U,k)){var Y=P[k],j=U.length-k.length,fe=U.substring(0,j),ue=Ee(Y.prefixes,fe)?Y.prefixes[fe]:void 0;if(ue!==void 0)return{unit:Y,prefix:ue}}return null},{hasher:U=>U[0],limit:100});g.isValuelessUnit=function(U){return _(U)!==null},g.prototype.hasBase=function(U){if(typeof U=="string"&&(U=O[U]),!U)return!1;for(var G=0;G<H.length;G++)if(Math.abs((this.dimensions[G]||0)-(U.dimensions[G]||0))>1e-12)return!1;return!0},g.prototype.equalBase=function(U){for(var G=0;G<H.length;G++)if(Math.abs((this.dimensions[G]||0)-(U.dimensions[G]||0))>1e-12)return!1;return!0},g.prototype.equals=function(U){return this.equalBase(U)&&s(this.value,U.value)},g.prototype.multiply=function(U){for(var G=this.clone(),te=Zr(U)?U:new g(U),k=0;k<H.length;k++)G.dimensions[k]=(this.dimensions[k]||0)+(te.dimensions[k]||0);for(var Y=0;Y<te.units.length;Y++){var j=Ni({},te.units[Y]);G.units.push(j)}if(this.value!==null||te.value!==null){var fe=this.value===null?this._normalize(1):this.value,ue=te.value===null?te._normalize(1):te.value;G.value=n(fe,ue)}else G.value=null;return Zr(U)&&(G.skipAutomaticSimplification=!1),C(G)},g.prototype.divideInto=function(U){return new g(U).divide(this)},g.prototype.divide=function(U){for(var G=this.clone(),te=Zr(U)?U:new g(U),k=0;k<H.length;k++)G.dimensions[k]=(this.dimensions[k]||0)-(te.dimensions[k]||0);for(var Y=0;Y<te.units.length;Y++){var j=Ni(Ni({},te.units[Y]),{},{power:-te.units[Y].power});G.units.push(j)}if(this.value!==null||te.value!==null){var fe=this.value===null?this._normalize(1):this.value,ue=te.value===null?te._normalize(1):te.value;G.value=u(fe,ue)}else G.value=null;return Zr(U)&&(G.skipAutomaticSimplification=!1),C(G)},g.prototype.pow=function(U){for(var G=this.clone(),te=0;te<H.length;te++)G.dimensions[te]=(this.dimensions[te]||0)*U;for(var k=0;k<G.units.length;k++)G.units[k].power*=U;return G.value!==null?G.value=f(G.value,U):G.value=null,G.skipAutomaticSimplification=!1,C(G)};function C(U){return U.equalBase(O.NONE)&&U.value!==null&&!i.predictable?U.value:U}g.prototype.abs=function(){var U=this.clone();if(U.value!==null)if(U._isDerived()||U.units[0].unit.offset===0)U.value=c(U.value);else{var G=U._numberConverter(),te=G(U.units[0].unit.value),k=G(U.units[0].unit.offset),Y=n(te,k);U.value=t(c(a(U.value,Y)),Y)}for(var j in U.units)(U.units[j].unit.name==="VA"||U.units[j].unit.name==="VAR")&&(U.units[j].unit=P.W);return U},g.prototype.to=function(U){var G=this.value===null?this._normalize(1):this.value,te;if(typeof U=="string")te=g.parse(U);else if(Zr(U))te=U.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(te))throw new Error("Units do not match ('".concat(te.toString(),"' != '").concat(this.toString(),"')"));if(te.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units[0].unit.offset===te.units[0].unit.offset)te.value=$e(G);else{var k=g._getNumberConverter(nr(G)),Y=this.units[0].unit.value,j=this.units[0].unit.offset,fe=n(Y,j),ue=te.units[0].unit.value,R=te.units[0].unit.offset,z=n(ue,R);te.value=a(G,k(t(fe,z)))}return te.fixPrefix=!0,te.skipAutomaticSimplification=!0,te},g.prototype.toNumber=function(U){return E(this.toNumeric(U))},g.prototype.toNumeric=function(U){var G;return U?G=this.to(U):G=this.clone(),G._isDerived()||G.units.length===0?G._denormalize(G.value):G._denormalize(G.value,G.units[0].prefix.value)},g.prototype.toString=function(){return this.format()},g.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},g.fromJSON=function(U){var G=new g(U.value,U.unit);return G.fixPrefix=U.fixPrefix||!1,G},g.prototype.valueOf=g.prototype.toString,g.prototype.simplify=function(){var U=this.clone(),G=[],te;for(var k in oe)if(Ee(oe,k)&&U.hasBase(O[k])){te=k;break}if(te==="NONE")U.units=[];else{var Y;if(te&&Ee(oe,te)&&(Y=oe[te]),Y)U.units=[{unit:Y.unit,prefix:Y.prefix,power:1}];else{for(var j=!1,fe=0;fe<H.length;fe++){var ue=H[fe];Math.abs(U.dimensions[fe]||0)>1e-12&&(Ee(oe,ue)?G.push({unit:oe[ue].unit,prefix:oe[ue].prefix,power:U.dimensions[fe]||0}):j=!0)}G.length<U.units.length&&!j&&(U.units=G)}}return U},g.prototype.toSI=function(){for(var U=this.clone(),G=[],te=0;te<H.length;te++){var k=H[te];if(Math.abs(U.dimensions[te]||0)>1e-12)if(Ee(K.si,k))G.push({unit:K.si[k].unit,prefix:K.si[k].prefix,power:U.dimensions[te]||0});else throw new Error("Cannot express custom unit "+k+" in SI units")}return U.units=G,U.fixPrefix=!0,U.skipAutomaticSimplification=!0,U},g.prototype.formatUnits=function(){for(var U="",G="",te=0,k=0,Y=0;Y<this.units.length;Y++)this.units[Y].power>0?(te++,U+=" "+this.units[Y].prefix.name+this.units[Y].unit.name,Math.abs(this.units[Y].power-1)>1e-15&&(U+="^"+this.units[Y].power)):this.units[Y].power<0&&k++;if(k>0)for(var j=0;j<this.units.length;j++)this.units[j].power<0&&(te>0?(G+=" "+this.units[j].prefix.name+this.units[j].unit.name,Math.abs(this.units[j].power+1)>1e-15&&(G+="^"+-this.units[j].power)):(G+=" "+this.units[j].prefix.name+this.units[j].unit.name,G+="^"+this.units[j].power));U=U.substr(1),G=G.substr(1),te>1&&k>0&&(U="("+U+")"),k>1&&te>0&&(G="("+G+")");var fe=U;return te>0&&k>0&&(fe+=" / "),fe+=G,fe},g.prototype.format=function(U){var G=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),te=!1;typeof G.value<"u"&&G.value!==null&&wt(G.value)&&(te=Math.abs(G.value.re)<1e-14);for(var k in G.units)Ee(G.units,k)&&G.units[k].unit&&(G.units[k].unit.name==="VA"&&te?G.units[k].unit=P.VAR:G.units[k].unit.name==="VAR"&&!te&&(G.units[k].unit=P.VA));G.units.length===1&&!G.fixPrefix&&Math.abs(G.units[0].power-Math.round(G.units[0].power))<1e-14&&(G.units[0].prefix=G._bestPrefix());var Y=G._denormalize(G.value),j=G.value!==null?v(Y,U||{}):"",fe=G.formatUnits();return G.value&&wt(G.value)&&(j="("+j+")"),fe.length>0&&j.length>0&&(j+=" "),j+=fe,j},g.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var U=this.value!==null?c(this.value):0,G=c(this.units[0].unit.value),te=this.units[0].prefix;if(U===0)return te;var k=this.units[0].power,Y=Math.log(U/Math.pow(te.value*G,k))/Math.LN10-1.2;if(Y>-2.200001&&Y<1.800001)return te;Y=Math.abs(Y);var j=this.units[0].unit.prefixes;for(var fe in j)if(Ee(j,fe)){var ue=j[fe];if(ue.scientific){var R=Math.abs(Math.log(U/Math.pow(ue.value*G,k))/Math.LN10-1.2);(R<Y||R===Y&&ue.name.length<te.name.length)&&(te=ue,Y=R)}}return te},g.prototype.splitUnit=function(U){for(var G=this.clone(),te=[],k=0;k<U.length&&(G=G.to(U[k]),k!==U.length-1);k++){var Y=G.toNumeric(),j=o(Y),fe=void 0,ue=s(j,Y);ue?fe=j:fe=l(G.toNumeric());var R=new g(fe,U[k].toString());te.push(R),G=t(G,R)}for(var z=0,Q=0;Q<te.length;Q++)z=a(z,te[Q].value);return s(z,this.value)&&(G.value=0),te.push(G),te};var T={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};T.SHORTLONG=wr({},T.SHORT,T.LONG),T.BINARY_SHORT=wr({},T.BINARY_SHORT_SI,T.BINARY_SHORT_IEC),T.BINARY_LONG=wr({},T.BINARY_LONG_SI,T.BINARY_LONG_IEC);var H=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],O={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var L in O)Ee(O,L)&&(O[L].key=L);var W={},X={name:"",base:W,value:1,offset:0,dimensions:H.map(U=>0)},P={meter:{name:"meter",base:O.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:O.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:O.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:O.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:O.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:O.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:O.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:O.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:O.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:O.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:O.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:T.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:T.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:T.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:T.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:T.SHORT,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:T.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:T.SHORT,value:p.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},J={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function ee(U){if(U.number==="BigNumber"){var G=ro(h);P.rad.value=new h(1),P.deg.value=G.div(180),P.grad.value=G.div(200),P.cycle.value=G.times(2),P.arcsec.value=G.div(648e3),P.arcmin.value=G.div(10800)}else P.rad.value=1,P.deg.value=Math.PI/180,P.grad.value=Math.PI/200,P.cycle.value=Math.PI*2,P.arcsec.value=Math.PI/648e3,P.arcmin.value=Math.PI/10800;P.radian.value=P.rad.value,P.degree.value=P.deg.value,P.gradian.value=P.grad.value}ee(i),r&&r("config",function(U,G){U.number!==G.number&&ee(U)});var K={si:{NONE:{unit:X,prefix:T.NONE[""]},LENGTH:{unit:P.m,prefix:T.SHORT[""]},MASS:{unit:P.g,prefix:T.SHORT.k},TIME:{unit:P.s,prefix:T.SHORT[""]},CURRENT:{unit:P.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:P.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:P.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:P.mol,prefix:T.SHORT[""]},ANGLE:{unit:P.rad,prefix:T.SHORT[""]},BIT:{unit:P.bits,prefix:T.SHORT[""]},FORCE:{unit:P.N,prefix:T.SHORT[""]},ENERGY:{unit:P.J,prefix:T.SHORT[""]},POWER:{unit:P.W,prefix:T.SHORT[""]},PRESSURE:{unit:P.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:P.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:P.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:P.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:P.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:P.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:P.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:P.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:P.T,prefix:T.SHORT[""]},FREQUENCY:{unit:P.Hz,prefix:T.SHORT[""]}}};K.cgs=JSON.parse(JSON.stringify(K.si)),K.cgs.LENGTH={unit:P.m,prefix:T.SHORT.c},K.cgs.MASS={unit:P.g,prefix:T.SHORT[""]},K.cgs.FORCE={unit:P.dyn,prefix:T.SHORT[""]},K.cgs.ENERGY={unit:P.erg,prefix:T.NONE[""]},K.us=JSON.parse(JSON.stringify(K.si)),K.us.LENGTH={unit:P.ft,prefix:T.NONE[""]},K.us.MASS={unit:P.lbm,prefix:T.NONE[""]},K.us.TEMPERATURE={unit:P.degF,prefix:T.NONE[""]},K.us.FORCE={unit:P.lbf,prefix:T.NONE[""]},K.us.ENERGY={unit:P.BTU,prefix:T.BTU[""]},K.us.POWER={unit:P.hp,prefix:T.NONE[""]},K.us.PRESSURE={unit:P.psi,prefix:T.NONE[""]},K.auto=JSON.parse(JSON.stringify(K.si));var oe=K.auto;g.setUnitSystem=function(U){if(Ee(K,U))oe=K[U];else throw new Error("Unit system "+U+" does not exist. Choices are: "+Object.keys(K).join(", "))},g.getUnitSystem=function(){for(var U in K)if(Ee(K,U)&&K[U]===oe)return U},g.typeConverters={BigNumber:function(G){return G!=null&&G.isFraction?new h(G.n).div(G.d).times(G.s):new h(G+"")},Fraction:function(G){return new y(G)},Complex:function(G){return G},number:function(G){return G!=null&&G.isFraction?d(G):G}},g.prototype._numberConverter=function(){var U=g.typeConverters[this.valueType()];if(U)return U;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},g._getNumberConverter=function(U){if(!g.typeConverters[U])throw new TypeError('Unsupported type "'+U+'"');return g.typeConverters[U]};for(var se in P)if(Ee(P,se)){var ie=P[se];ie.dimensions=ie.base.dimensions}for(var re in J)if(Ee(J,re)){var pe=P[J[re]],Ae={};for(var be in pe)Ee(pe,be)&&(Ae[be]=pe[be]);Ae.name=re,P[re]=Ae}g.isValidAlpha=function(G){return/^[a-zA-Z]$/.test(G)};function Ne(U){for(var G=0;G<U.length;G++){if(b=U.charAt(G),G===0&&!g.isValidAlpha(b))throw new Error('Invalid unit name (must begin with alpha character): "'+U+'"');if(G>0&&!(g.isValidAlpha(b)||S(b)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+U+'"')}}return g.createUnit=function(U,G){if(typeof U!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(G&&G.override){for(var te in U)if(Ee(U,te)&&g.deleteUnit(te),U[te].aliases)for(var k=0;k<U[te].aliases.length;k++)g.deleteUnit(U[te].aliases[k])}var Y;for(var j in U)Ee(U,j)&&(Y=g.createUnitSingle(j,U[j]));return Y},g.createUnitSingle=function(U,G){if((typeof G>"u"||G===null)&&(G={}),typeof U!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Ee(P,U))throw new Error('Cannot create unit "'+U+'": a unit with that name already exists');Ne(U);var te=null,k=[],Y=0,j,fe,ue;if(G&&G.type==="Unit")te=G.clone();else if(typeof G=="string")G!==""&&(j=G);else if(typeof G=="object")j=G.definition,fe=G.prefixes,Y=G.offset,ue=G.baseName,G.aliases&&(k=G.aliases.valueOf());else throw new TypeError('Cannot create unit "'+U+'" from "'+G.toString()+'": expecting "string" or "Unit" or "Object"');if(k){for(var R=0;R<k.length;R++)if(Ee(P,k[R]))throw new Error('Cannot create alias "'+k[R]+'": a unit with that name already exists')}if(j&&typeof j=="string"&&!te)try{te=g.parse(j,{allowNoUnits:!0})}catch(ir){throw ir.message='Could not create unit "'+U+'" from "'+j+'": '+ir.message,ir}else j&&j.type==="Unit"&&(te=j.clone());k=k||[],Y=Y||0,fe&&fe.toUpperCase?fe=T[fe.toUpperCase()]||T.NONE:fe=T.NONE;var z={};if(te){z={name:U,value:te.value,dimensions:te.dimensions.slice(0),prefixes:fe,offset:Y};var ve=!1;for(var de in O)if(Ee(O,de)){for(var ce=!0,ge=0;ge<H.length;ge++)if(Math.abs((z.dimensions[ge]||0)-(O[de].dimensions[ge]||0))>1e-12){ce=!1;break}if(ce){ve=!0,z.base=O[de];break}}if(!ve){ue=ue||U+"_STUFF";var Se={dimensions:te.dimensions.slice(0)};Se.key=ue,O[ue]=Se,oe[ue]={unit:z,prefix:T.NONE[""]},z.base=O[ue]}}else{if(ue=ue||U+"_STUFF",H.indexOf(ue)>=0)throw new Error('Cannot create new base unit "'+U+'": a base unit with that name already exists (and cannot be overridden)');H.push(ue);for(var Q in O)Ee(O,Q)&&(O[Q].dimensions[H.length-1]=0);for(var ae={dimensions:[]},le=0;le<H.length;le++)ae.dimensions[le]=0;ae.dimensions[H.length-1]=1,ae.key=ue,O[ue]=ae,z={name:U,value:1,dimensions:O[ue].dimensions.slice(0),prefixes:fe,offset:Y,base:O[ue]},oe[ue]={unit:z,prefix:T.NONE[""]}}g.UNITS[U]=z;for(var Ie=0;Ie<k.length;Ie++){var De=k[Ie],Je={};for(var ze in z)Ee(z,ze)&&(Je[ze]=z[ze]);Je.name=De,g.UNITS[De]=Je}return delete _.cache,new g(null,U)},g.deleteUnit=function(U){delete g.UNITS[U]},g.PREFIXES=T,g.BASE_DIMENSIONS=H,g.BASE_UNITS=O,g.UNIT_SYSTEMS=K,g.UNITS=P,g},{isClass:!0}),nl="unit",zw=["typed","Unit"],Pw=I(nl,zw,e=>{var{typed:r,Unit:i}=e;return r(nl,{Unit:function(t){return t.clone()},string:function(t){return i.isValuelessUnit(t)?new i(null,t):i.parse(t,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(t,n){return new i(t,n)},"number | BigNumber | Fraction":function(t){return new i(t)},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))})}),al="sparse",Uw=["typed","SparseMatrix"],Lw=I(al,Uw,e=>{var{typed:r,SparseMatrix:i}=e;return r(al,{"":function(){return new i([])},string:function(t){return new i([],t)},"Array | Matrix":function(t){return new i(t)},"Array | Matrix, string":function(t,n){return new i(t,n)}})}),il="createUnit",kw=["typed","Unit"],Hw=I(il,kw,e=>{var{typed:r,Unit:i}=e;return r(il,{"Object, Object":function(t,n){return i.createUnit(t,n)},Object:function(t){return i.createUnit(t,{})},"string, Unit | string | Object, Object":function(t,n,u){var f={};return f[t]=n,i.createUnit(f,u)},"string, Unit | string | Object":function(t,n){var u={};return u[t]=n,i.createUnit(u,{})},string:function(t){var n={};return n[t]={},i.createUnit(n,{})}})}),ol="acos",Gw=["typed","config","Complex"],Vw=I(ol,Gw,e=>{var{typed:r,config:i,Complex:a}=e;return r(ol,{number:function(n){return n>=-1&&n<=1||i.predictable?Math.acos(n):new a(n,0).acos()},Complex:function(n){return n.acos()},BigNumber:function(n){return n.acos()}})}),ul="acosh",Zw=["typed","config","Complex"],Yw=I(ul,Zw,e=>{var{typed:r,config:i,Complex:a}=e;return r(ul,{number:function(n){return n>=1||i.predictable?mm(n):n<=-1?new a(Math.log(Math.sqrt(n*n-1)-n),Math.PI):new a(n,0).acosh()},Complex:function(n){return n.acosh()},BigNumber:function(n){return n.acosh()}})}),sl="acot",Ww=["typed","BigNumber"],Xw=I(sl,Ww,e=>{var{typed:r,BigNumber:i}=e;return r(sl,{number:vm,Complex:function(t){return t.acot()},BigNumber:function(t){return new i(1).div(t).atan()}})}),ll="acoth",Jw=["typed","config","Complex","BigNumber"],Qw=I(ll,Jw,e=>{var{typed:r,config:i,Complex:a,BigNumber:t}=e;return r(ll,{number:function(u){return u>=1||u<=-1||i.predictable?pm(u):new a(u,0).acoth()},Complex:function(u){return u.acoth()},BigNumber:function(u){return new t(1).div(u).atanh()}})}),cl="acsc",Kw=["typed","config","Complex","BigNumber"],jw=I(cl,Kw,e=>{var{typed:r,config:i,Complex:a,BigNumber:t}=e;return r(cl,{number:function(u){return u<=-1||u>=1||i.predictable?dm(u):new a(u,0).acsc()},Complex:function(u){return u.acsc()},BigNumber:function(u){return new t(1).div(u).asin()}})}),fl="acsch",eN=["typed","BigNumber"],rN=I(fl,eN,e=>{var{typed:r,BigNumber:i}=e;return r(fl,{number:hm,Complex:function(t){return t.acsch()},BigNumber:function(t){return new i(1).div(t).asinh()}})}),ml="asec",tN=["typed","config","Complex","BigNumber"],nN=I(ml,tN,e=>{var{typed:r,config:i,Complex:a,BigNumber:t}=e;return r(ml,{number:function(u){return u<=-1||u>=1||i.predictable?gm(u):new a(u,0).asec()},Complex:function(u){return u.asec()},BigNumber:function(u){return new t(1).div(u).acos()}})}),vl="asech",aN=["typed","config","Complex","BigNumber"],iN=I(vl,aN,e=>{var{typed:r,config:i,Complex:a,BigNumber:t}=e;return r(vl,{number:function(u){if(u<=1&&u>=-1||i.predictable){var f=1/u;if(f>0||i.predictable)return ym(u);var c=Math.sqrt(f*f-1);return new a(Math.log(c-f),Math.PI)}return new a(u,0).asech()},Complex:function(u){return u.asech()},BigNumber:function(u){return new t(1).div(u).acosh()}})}),pl="asin",oN=["typed","config","Complex"],uN=I(pl,oN,e=>{var{typed:r,config:i,Complex:a}=e;return r(pl,{number:function(n){return n>=-1&&n<=1||i.predictable?Math.asin(n):new a(n,0).asin()},Complex:function(n){return n.asin()},BigNumber:function(n){return n.asin()}})}),sN="asinh",lN=["typed"],cN=I(sN,lN,e=>{var{typed:r}=e;return r("asinh",{number:bm,Complex:function(a){return a.asinh()},BigNumber:function(a){return a.asinh()}})}),fN="atan",mN=["typed"],vN=I(fN,mN,e=>{var{typed:r}=e;return r("atan",{number:function(a){return Math.atan(a)},Complex:function(a){return a.atan()},BigNumber:function(a){return a.atan()}})}),dl="atan2",pN=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],dN=I(dl,pN,e=>{var{typed:r,matrix:i,equalScalar:a,BigNumber:t,DenseMatrix:n,concat:u}=e,f=at({typed:r,equalScalar:a}),c=$r({typed:r}),l=$m({typed:r,equalScalar:a}),o=Dr({typed:r,equalScalar:a}),s=gr({typed:r,DenseMatrix:n}),m=ur({typed:r,matrix:i,concat:u});return r(dl,{"number, number":Math.atan2,"BigNumber, BigNumber":(v,d)=>t.atan2(v,d)},m({scalar:"number | BigNumber",SS:l,DS:c,SD:f,Ss:o,sS:s}))}),hl="atanh",hN=["typed","config","Complex"],gN=I(hl,hN,e=>{var{typed:r,config:i,Complex:a}=e;return r(hl,{number:function(n){return n<=1&&n>=-1||i.predictable?xm(n):new a(n,0).atanh()},Complex:function(n){return n.atanh()},BigNumber:function(n){return n.atanh()}})}),Fn=I("trigUnit",["typed"],e=>{var{typed:r}=e;return{Unit:r.referToSelf(i=>a=>{if(!a.hasBase(a.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(i,a.valueType())(a.value)})}}),gl="cos",yN=["typed"],bN=I(gl,yN,e=>{var{typed:r}=e,i=Fn({typed:r});return r(gl,{number:Math.cos,"Complex | BigNumber":a=>a.cos()},i)}),yl="cosh",xN=["typed"],wN=I(yl,xN,e=>{var{typed:r}=e;return r(yl,{number:gd,"Complex | BigNumber":i=>i.cosh()})}),bl="cot",NN=["typed","BigNumber"],DN=I(bl,NN,e=>{var{typed:r,BigNumber:i}=e,a=Fn({typed:r});return r(bl,{number:wm,Complex:t=>t.cot(),BigNumber:t=>new i(1).div(t.tan())},a)}),xl="coth",AN=["typed","BigNumber"],EN=I(xl,AN,e=>{var{typed:r,BigNumber:i}=e;return r(xl,{number:Nm,Complex:a=>a.coth(),BigNumber:a=>new i(1).div(a.tanh())})}),wl="csc",SN=["typed","BigNumber"],CN=I(wl,SN,e=>{var{typed:r,BigNumber:i}=e,a=Fn({typed:r});return r(wl,{number:Dm,Complex:t=>t.csc(),BigNumber:t=>new i(1).div(t.sin())},a)}),Nl="csch",MN=["typed","BigNumber"],FN=I(Nl,MN,e=>{var{typed:r,BigNumber:i}=e;return r(Nl,{number:Am,Complex:a=>a.csch(),BigNumber:a=>new i(1).div(a.sinh())})}),Dl="sec",BN=["typed","BigNumber"],TN=I(Dl,BN,e=>{var{typed:r,BigNumber:i}=e,a=Fn({typed:r});return r(Dl,{number:Em,Complex:t=>t.sec(),BigNumber:t=>new i(1).div(t.cos())},a)}),Al="sech",ON=["typed","BigNumber"],$N=I(Al,ON,e=>{var{typed:r,BigNumber:i}=e;return r(Al,{number:Sm,Complex:a=>a.sech(),BigNumber:a=>new i(1).div(a.cosh())})}),El="sin",_N=["typed"],IN=I(El,_N,e=>{var{typed:r}=e,i=Fn({typed:r});return r(El,{number:Math.sin,"Complex | BigNumber":a=>a.sin()},i)}),Sl="sinh",RN=["typed"],qN=I(Sl,RN,e=>{var{typed:r}=e;return r(Sl,{number:Cm,"Complex | BigNumber":i=>i.sinh()})}),Cl="tan",zN=["typed"],PN=I(Cl,zN,e=>{var{typed:r}=e,i=Fn({typed:r});return r(Cl,{number:Math.tan,"Complex | BigNumber":a=>a.tan()},i)}),UN="tanh",LN=["typed"],kN=I(UN,LN,e=>{var{typed:r}=e;return r("tanh",{number:bd,"Complex | BigNumber":i=>i.tanh()})}),Ml="setCartesian",HN=["typed","size","subset","compareNatural","Index","DenseMatrix"],GN=I(Ml,HN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n,DenseMatrix:u}=e;return r(Ml,{"Array | Matrix, Array | Matrix":function(c,l){var o=[];if(a(i(c),new n(0))!==0&&a(i(l),new n(0))!==0){var s=Xe(Array.isArray(c)?c:c.toArray()).sort(t),m=Xe(Array.isArray(l)?l:l.toArray()).sort(t);o=[];for(var v=0;v<s.length;v++)for(var d=0;d<m.length;d++)o.push([s[v],m[d]])}return Array.isArray(c)&&Array.isArray(l)?o:new u(o)}})}),Fl="setDifference",VN=["typed","size","subset","compareNatural","Index","DenseMatrix"],ZN=I(Fl,VN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n,DenseMatrix:u}=e;return r(Fl,{"Array | Matrix, Array | Matrix":function(c,l){var o;if(a(i(c),new n(0))===0)o=[];else{if(a(i(l),new n(0))===0)return Xe(c.toArray());var s=yn(Xe(Array.isArray(c)?c:c.toArray()).sort(t)),m=yn(Xe(Array.isArray(l)?l:l.toArray()).sort(t));o=[];for(var v,d=0;d<s.length;d++){v=!1;for(var p=0;p<m.length;p++)if(t(s[d].value,m[p].value)===0&&s[d].identifier===m[p].identifier){v=!0;break}v||o.push(s[d])}}return Array.isArray(c)&&Array.isArray(l)?Ta(o):new u(Ta(o))}})}),Bl="setDistinct",YN=["typed","size","subset","compareNatural","Index","DenseMatrix"],WN=I(Bl,YN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n,DenseMatrix:u}=e;return r(Bl,{"Array | Matrix":function(c){var l;if(a(i(c),new n(0))===0)l=[];else{var o=Xe(Array.isArray(c)?c:c.toArray()).sort(t);l=[],l.push(o[0]);for(var s=1;s<o.length;s++)t(o[s],o[s-1])!==0&&l.push(o[s])}return Array.isArray(c)?l:new u(l)}})}),Tl="setIntersect",XN=["typed","size","subset","compareNatural","Index","DenseMatrix"],JN=I(Tl,XN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n,DenseMatrix:u}=e;return r(Tl,{"Array | Matrix, Array | Matrix":function(c,l){var o;if(a(i(c),new n(0))===0||a(i(l),new n(0))===0)o=[];else{var s=yn(Xe(Array.isArray(c)?c:c.toArray()).sort(t)),m=yn(Xe(Array.isArray(l)?l:l.toArray()).sort(t));o=[];for(var v=0;v<s.length;v++)for(var d=0;d<m.length;d++)if(t(s[v].value,m[d].value)===0&&s[v].identifier===m[d].identifier){o.push(s[v]);break}}return Array.isArray(c)&&Array.isArray(l)?Ta(o):new u(Ta(o))}})}),Ol="setIsSubset",QN=["typed","size","subset","compareNatural","Index"],KN=I(Ol,QN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n}=e;return r(Ol,{"Array | Matrix, Array | Matrix":function(f,c){if(a(i(f),new n(0))===0)return!0;if(a(i(c),new n(0))===0)return!1;for(var l=yn(Xe(Array.isArray(f)?f:f.toArray()).sort(t)),o=yn(Xe(Array.isArray(c)?c:c.toArray()).sort(t)),s,m=0;m<l.length;m++){s=!1;for(var v=0;v<o.length;v++)if(t(l[m].value,o[v].value)===0&&l[m].identifier===o[v].identifier){s=!0;break}if(s===!1)return!1}return!0}})}),$l="setMultiplicity",jN=["typed","size","subset","compareNatural","Index"],e2=I($l,jN,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n}=e;return r($l,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(f,c){if(a(i(c),new n(0))===0)return 0;for(var l=Xe(Array.isArray(c)?c:c.toArray()),o=0,s=0;s<l.length;s++)t(l[s],f)===0&&o++;return o}})}),_l="setPowerset",r2=["typed","size","subset","compareNatural","Index"],t2=I(_l,r2,e=>{var{typed:r,size:i,subset:a,compareNatural:t,Index:n}=e;return r(_l,{"Array | Matrix":function(l){if(a(i(l),new n(0))===0)return[];for(var o=Xe(Array.isArray(l)?l:l.toArray()).sort(t),s=[],m=0;m.toString(2).length<=o.length;)s.push(u(o,m.toString(2).split("").reverse())),m++;return f(s)}});function u(c,l){for(var o=[],s=0;s<l.length;s++)l[s]==="1"&&o.push(c[s]);return o}function f(c){for(var l=[],o=c.length-1;o>0;o--)for(var s=0;s<o;s++)c[s].length>c[s+1].length&&(l=c[s],c[s]=c[s+1],c[s+1]=l);return c}}),Il="setSize",n2=["typed","compareNatural"],a2=I(Il,n2,e=>{var{typed:r,compareNatural:i}=e;return r(Il,{"Array | Matrix":function(t){return Array.isArray(t)?Xe(t).length:Xe(t.toArray()).length},"Array | Matrix, boolean":function(t,n){if(n===!1||t.length===0)return Array.isArray(t)?Xe(t).length:Xe(t.toArray()).length;for(var u=Xe(Array.isArray(t)?t:t.toArray()).sort(i),f=1,c=1;c<u.length;c++)i(u[c],u[c-1])!==0&&f++;return f}})}),Rl="setSymDifference",i2=["typed","size","concat","subset","setDifference","Index"],o2=I(Rl,i2,e=>{var{typed:r,size:i,concat:a,subset:t,setDifference:n,Index:u}=e;return r(Rl,{"Array | Matrix, Array | Matrix":function(c,l){if(t(i(c),new u(0))===0)return Xe(l);if(t(i(l),new u(0))===0)return Xe(c);var o=Xe(c),s=Xe(l);return a(n(o,s),n(s,o))}})}),ql="setUnion",u2=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],s2=I(ql,u2,e=>{var{typed:r,size:i,concat:a,subset:t,setIntersect:n,setSymDifference:u,Index:f}=e;return r(ql,{"Array | Matrix, Array | Matrix":function(l,o){if(t(i(l),new f(0))===0)return Xe(o);if(t(i(o),new f(0))===0)return Xe(l);var s=Xe(l),m=Xe(o);return a(u(s,m),n(s,m))}})}),zl="add",l2=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],c2=I(zl,l2,e=>{var{typed:r,matrix:i,addScalar:a,equalScalar:t,DenseMatrix:n,SparseMatrix:u,concat:f}=e,c=Rt({typed:r}),l=Ji({typed:r,equalScalar:t}),o=Yt({typed:r,DenseMatrix:n}),s=ur({typed:r,matrix:i,concat:f});return r(zl,{"any, any":a,"any, any, ...any":r.referToSelf(m=>(v,d,p)=>{for(var h=m(v,d),y=0;y<p.length;y++)h=m(h,p[y]);return h})},s({elop:a,DS:c,SS:l,Ss:o}))}),Pl="hypot",f2=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],m2=I(Pl,f2,e=>{var{typed:r,abs:i,addScalar:a,divideScalar:t,multiplyScalar:n,sqrt:u,smaller:f,isPositive:c}=e;return r(Pl,{"... number | BigNumber":l,Array:l,Matrix:o=>l(Xe(o.toArray()))});function l(o){for(var s=0,m=0,v=0;v<o.length;v++){if(wt(o[v]))throw new TypeError("Unexpected type of argument to hypot");var d=i(o[v]);f(m,d)?(s=n(s,n(t(m,d),t(m,d))),s=a(s,1),m=d):s=a(s,c(d)?n(t(d,m),t(d,m)):d)}return n(m,u(s))}}),Ul="norm",v2=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],p2=I(Ul,v2,e=>{var{typed:r,abs:i,add:a,pow:t,conj:n,sqrt:u,multiply:f,equalScalar:c,larger:l,smaller:o,matrix:s,ctranspose:m,eigs:v}=e;return r(Ul,{number:Math.abs,Complex:function(D){return D.abs()},BigNumber:function(D){return D.abs()},boolean:function(D){return Math.abs(D)},Array:function(D){return b(s(D),2)},Matrix:function(D){return b(D,2)},"Array, number | BigNumber | string":function(D,S){return b(s(D),S)},"Matrix, number | BigNumber | string":function(D,S){return b(D,S)}});function d(A){var D=0;return A.forEach(function(S){var N=i(S);l(N,D)&&(D=N)},!0),D}function p(A){var D;return A.forEach(function(S){var N=i(S);(!D||o(N,D))&&(D=N)},!0),D||0}function h(A,D){if(D===Number.POSITIVE_INFINITY||D==="inf")return d(A);if(D===Number.NEGATIVE_INFINITY||D==="-inf")return p(A);if(D==="fro")return b(A,2);if(typeof D=="number"&&!isNaN(D)){if(!c(D,0)){var S=0;return A.forEach(function(N){S=a(t(i(N),D),S)},!0),t(S,1/D)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function y(A){var D=0;return A.forEach(function(S,N){D=a(D,f(S,n(S)))}),i(u(D))}function E(A){var D=[],S=0;return A.forEach(function(N,B){var F=B[1],$=a(D[F]||0,i(N));l($,S)&&(S=$),D[F]=$},!0),S}function g(A){var D=A.size();if(D[0]!==D[1])throw new RangeError("Invalid matrix dimensions");var S=m(A),N=f(S,A),B=v(N).values.toArray(),F=B[B.length-1];return i(u(F))}function w(A){var D=[],S=0;return A.forEach(function(N,B){var F=B[0],$=a(D[F]||0,i(N));l($,S)&&(S=$),D[F]=$},!0),S}function x(A,D){if(D===1)return E(A);if(D===Number.POSITIVE_INFINITY||D==="inf")return w(A);if(D==="fro")return y(A);if(D===2)return g(A);throw new Error("Unsupported parameter value "+D)}function b(A,D){var S=A.size();if(S.length===1)return h(A,D);if(S.length===2){if(S[0]&&S[1])return x(A,D);throw new RangeError("Invalid matrix dimensions")}}}),Ll="dot",d2=["typed","addScalar","multiplyScalar","conj","size"],h2=I(Ll,d2,e=>{var{typed:r,addScalar:i,multiplyScalar:a,conj:t,size:n}=e;return r(Ll,{"Array | DenseMatrix, Array | DenseMatrix":f,"SparseMatrix, SparseMatrix":c});function u(o,s){var m=l(o),v=l(s),d,p;if(m.length===1)d=m[0];else if(m.length===2&&m[1]===1)d=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.join(", ")+")");if(v.length===1)p=v[0];else if(v.length===2&&v[1]===1)p=v[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+v.join(", ")+")");if(d!==p)throw new RangeError("Vectors must have equal length ("+d+" != "+p+")");if(d===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return d}function f(o,s){var m=u(o,s),v=Be(o)?o._data:o,d=Be(o)?o._datatype:void 0,p=Be(s)?s._data:s,h=Be(s)?s._datatype:void 0,y=l(o).length===2,E=l(s).length===2,g=i,w=a;if(d&&h&&d===h&&typeof d=="string"){var x=d;g=r.find(i,[x,x]),w=r.find(a,[x,x])}if(!y&&!E){for(var b=w(t(v[0]),p[0]),A=1;A<m;A++)b=g(b,w(t(v[A]),p[A]));return b}if(!y&&E){for(var D=w(t(v[0]),p[0][0]),S=1;S<m;S++)D=g(D,w(t(v[S]),p[S][0]));return D}if(y&&!E){for(var N=w(t(v[0][0]),p[0]),B=1;B<m;B++)N=g(N,w(t(v[B][0]),p[B]));return N}if(y&&E){for(var F=w(t(v[0][0]),p[0][0]),$=1;$<m;$++)F=g(F,w(t(v[$][0]),p[$][0]));return F}}function c(o,s){u(o,s);for(var m=o._index,v=o._values,d=s._index,p=s._values,h=0,y=i,E=a,g=0,w=0;g<m.length&&w<d.length;){var x=m[g],b=d[w];if(x<b){g++;continue}if(x>b){w++;continue}x===b&&(h=y(h,E(v[g],p[w])),g++,w++)}return h}function l(o){return Be(o)?o.size():n(o)}}),g2="trace",y2=["typed","matrix","add"],b2=I(g2,y2,e=>{var{typed:r,matrix:i,add:a}=e;return r("trace",{Array:function(f){return t(i(f))},SparseMatrix:n,DenseMatrix:t,any:$e});function t(u){var f=u._size,c=u._data;switch(f.length){case 1:if(f[0]===1)return $e(c[0]);throw new RangeError("Matrix must be square (size: "+Pe(f)+")");case 2:{var l=f[0],o=f[1];if(l===o){for(var s=0,m=0;m<l;m++)s=a(s,c[m][m]);return s}else throw new RangeError("Matrix must be square (size: "+Pe(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pe(f)+")")}}function n(u){var f=u._values,c=u._index,l=u._ptr,o=u._size,s=o[0],m=o[1];if(s===m){var v=0;if(f.length>0)for(var d=0;d<m;d++)for(var p=l[d],h=l[d+1],y=p;y<h;y++){var E=c[y];if(E===d){v=a(v,f[y]);break}if(E>d)break}return v}throw new RangeError("Matrix must be square (size: "+Pe(o)+")")}}),kl="index",x2=["typed","Index"],w2=I(kl,x2,e=>{var{typed:r,Index:i}=e;return r(kl,{"...number | string | BigNumber | Range | Array | Matrix":function(t){var n=t.map(function(f){return ke(f)?f.toNumber():Array.isArray(f)||Be(f)?f.map(function(c){return ke(c)?c.toNumber():c}):f}),u=new i;return i.apply(u,n),u}})}),Vm=new Set(["end"]),N2="Node",D2=["mathWithTransform"],A2=I(N2,D2,e=>{var{mathWithTransform:r}=e;function i(t){for(var n of[...Vm])if(t.has(n))throw new Error('Scope contains an illegal symbol, "'+n+'" is a reserved keyword')}class a{get type(){return"Node"}get isNode(){return!0}evaluate(n){return this.compile().evaluate(n)}compile(){var n=this._compile(r,{}),u={},f=null;function c(l){var o=dn(l);return i(o),n(o,u,f)}return{evaluate:c}}_compile(n,u){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(n){throw new Error("Cannot run forEach on a Node interface")}map(n){throw new Error("Cannot run map on a Node interface")}_ifNode(n){if(!er(n))throw new TypeError("Callback function must return a Node");return n}traverse(n){n(this,null,null);function u(f,c){f.forEach(function(l,o,s){c(l,o,s),u(l,c)})}u(this,n)}transform(n){function u(f,c,l){var o=n(f,c,l);return o!==f?o:f.map(u)}return u(this,null,null)}filter(n){var u=[];return this.traverse(function(f,c,l){n(f,c,l)&&u.push(f)}),u}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(n){return n.cloneDeep()})}equals(n){return n?this.type===n.type&&Gn(this,n):!1}toString(n){var u=this._getCustomString(n);return typeof u<"u"?u:this._toString(n)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(n){var u=this._getCustomString(n);return typeof u<"u"?u:this.toHTML(n)}_toString(){throw new Error("_toString not implemented for "+this.type)}toTex(n){var u=this._getCustomString(n);return typeof u<"u"?u:this._toTex(n)}_toTex(n){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(n){if(n&&typeof n=="object")switch(typeof n.handler){case"object":case"undefined":return;case"function":return n.handler(this,n);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return a},{isClass:!0,isNode:!0});function _r(e){return e&&e.isIndexError?new rt(e.index+1,e.min+1,e.max!==void 0?e.max+1:void 0):e}function Zm(e){var{subset:r}=e;return function(a,t){try{if(Array.isArray(a))return r(a,t);if(a&&typeof a.subset=="function")return a.subset(t);if(typeof a=="string")return r(a,t);if(typeof a=="object"){if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Tr(a,t.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(n){throw _r(n)}}}var fa="AccessorNode",E2=["subset","Node"],S2=I(fa,E2,e=>{var{subset:r,Node:i}=e,a=Zm({subset:r});function t(u){return!(Gt(u)||Vr(u)||We(u)||Ot(u)||Xa(u)||Dt(u)||yr(u))}class n extends i{constructor(f,c){if(super(),!er(f))throw new TypeError('Node expected for parameter "object"');if(!An(c))throw new TypeError('IndexNode expected for parameter "index"');this.object=f,this.index=c}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return fa}get isAccessorNode(){return!0}_compile(f,c){var l=this.object._compile(f,c),o=this.index._compile(f,c);if(this.index.isObjectProperty()){var s=this.index.getObjectProperty();return function(v,d,p){return Tr(l(v,d,p),s)}}else return function(v,d,p){var h=l(v,d,p),y=o(v,d,h);return a(h,y)}}forEach(f){f(this.object,"object",this),f(this.index,"index",this)}map(f){return new n(this._ifNode(f(this.object,"object",this)),this._ifNode(f(this.index,"index",this)))}clone(){return new n(this.object,this.index)}_toString(f){var c=this.object.toString(f);return t(this.object)&&(c="("+c+")"),c+this.index.toString(f)}toHTML(f){var c=this.object.toHTML(f);return t(this.object)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+this.index.toHTML(f)}_toTex(f){var c=this.object.toTex(f);return t(this.object)&&(c="\\left(' + object + '\\right)"),c+this.index.toTex(f)}toJSON(){return{mathjs:fa,object:this.object,index:this.index}}static fromJSON(f){return new n(f.object,f.index)}}return hr(n,"name",fa),n},{isClass:!0,isNode:!0}),ma="ArrayNode",C2=["Node"],M2=I(ma,C2,e=>{var{Node:r}=e;class i extends r{constructor(t){if(super(),this.items=t||[],!Array.isArray(this.items)||!this.items.every(er))throw new TypeError("Array containing Nodes expected")}get type(){return ma}get isArrayNode(){return!0}_compile(t,n){var u=Nt(this.items,function(l){return l._compile(t,n)}),f=t.config.matrix!=="Array";if(f){var c=t.matrix;return function(o,s,m){return c(Nt(u,function(v){return v(o,s,m)}))}}else return function(o,s,m){return Nt(u,function(v){return v(o,s,m)})}}forEach(t){for(var n=0;n<this.items.length;n++){var u=this.items[n];t(u,"items["+n+"]",this)}}map(t){for(var n=[],u=0;u<this.items.length;u++)n[u]=this._ifNode(t(this.items[u],"items["+u+"]",this));return new i(n)}clone(){return new i(this.items.slice(0))}_toString(t){var n=this.items.map(function(u){return u.toString(t)});return"["+n.join(", ")+"]"}toJSON(){return{mathjs:ma,items:this.items}}static fromJSON(t){return new i(t.items)}toHTML(t){var n=this.items.map(function(u){return u.toHTML(t)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+n.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(t){function n(u,f){var c=u.some(Vr)&&!u.every(Vr),l=f||c,o=l?"&":"\\\\",s=u.map(function(m){return m.items?n(m.items,!f):m.toTex(t)}).join(o);return c||!l||l&&!f?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}return n(this.items,!1)}}return hr(i,"name",ma),i},{isClass:!0,isNode:!0});function F2(e){var{subset:r,matrix:i}=e;return function(t,n,u){try{if(Array.isArray(t))return i(t).subset(n,u).valueOf();if(t&&typeof t.subset=="function")return t.subset(n,u);if(typeof t=="string")return r(t,n,u);if(typeof t=="object"){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return bn(t,n.getObjectProperty(),u),t}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(f){throw _r(f)}}}var Jr=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function va(e,r){if(!r||r!=="auto")return e;for(var i=e;Dt(i);)i=i.content;return i}function tr(e,r,i,a){var t=e;r!=="keep"&&(t=e.getContent());for(var n=t.getIdentifier(),u=null,f=0;f<Jr.length;f++)if(n in Jr[f]){u=f;break}if(n==="OperatorNode:multiply"&&t.implicit&&i!=="show"){var c=va(t.args[0],r);!(We(c)&&a&&a.getIdentifier()==="OperatorNode:divide"&&Si(va(a.args[0],r)))&&!(c.getIdentifier()==="OperatorNode:divide"&&Si(va(c.args[0],r))&&We(va(c.args[1])))&&(u+=1)}return u}function Ln(e,r){var i=e;r!=="keep"&&(i=e.getContent());var a=i.getIdentifier(),t=tr(i,r);if(t===null)return null;var n=Jr[t][a];if(Ee(n,"associativity")){if(n.associativity==="left")return"left";if(n.associativity==="right")return"right";throw Error("'"+a+"' has the invalid associativity '"+n.associativity+"'.")}return null}function Di(e,r,i){var a=i!=="keep"?e.getContent():e,t=i!=="keep"?e.getContent():r,n=a.getIdentifier(),u=t.getIdentifier(),f=tr(a,i);if(f===null)return null;var c=Jr[f][n];if(Ee(c,"associativeWith")&&c.associativeWith instanceof Array){for(var l=0;l<c.associativeWith.length;l++)if(c.associativeWith[l]===u)return!0;return!1}return null}function B2(e){var r="OperatorNode:"+e;for(var i of Jr)if(r in i)return i[r].op;return null}var pa="AssignmentNode",T2=["subset","?matrix","Node"],O2=I(pa,T2,e=>{var{subset:r,matrix:i,Node:a}=e,t=Zm({subset:r}),n=F2({subset:r,matrix:i});function u(c,l,o){l||(l="keep");var s=tr(c,l,o),m=tr(c.value,l,o);return l==="all"||m!==null&&m<=s}class f extends a{constructor(l,o,s){if(super(),this.object=l,this.index=s?o:null,this.value=s||o,!yr(l)&&!Gt(l))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(yr(l)&&l.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!An(this.index))throw new TypeError('IndexNode expected as "index"');if(!er(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return pa}get isAssignmentNode(){return!0}_compile(l,o){var s=this.object._compile(l,o),m=this.index?this.index._compile(l,o):null,v=this.value._compile(l,o),d=this.object.name;if(this.index)if(this.index.isObjectProperty()){var p=this.index.getObjectProperty();return function(w,x,b){var A=s(w,x,b),D=v(w,x,b);return bn(A,p,D),D}}else{if(yr(this.object))return function(w,x,b){var A=s(w,x,b),D=v(w,x,b),S=m(w,x,A);return w.set(d,n(A,S,D)),D};var h=this.object.object._compile(l,o);if(this.object.index.isObjectProperty()){var y=this.object.index.getObjectProperty();return function(w,x,b){var A=h(w,x,b),D=Tr(A,y),S=m(w,x,D),N=v(w,x,b);return bn(A,y,n(D,S,N)),N}}else{var E=this.object.index._compile(l,o);return function(w,x,b){var A=h(w,x,b),D=E(w,x,A),S=t(A,D),N=m(w,x,S),B=v(w,x,b);return n(A,D,n(S,N,B)),B}}}else{if(!yr(this.object))throw new TypeError("SymbolNode expected as object");return function(w,x,b){var A=v(w,x,b);return w.set(d,A),A}}}forEach(l){l(this.object,"object",this),this.index&&l(this.index,"index",this),l(this.value,"value",this)}map(l){var o=this._ifNode(l(this.object,"object",this)),s=this.index?this._ifNode(l(this.index,"index",this)):null,m=this._ifNode(l(this.value,"value",this));return new f(o,s,m)}clone(){return new f(this.object,this.index,this.value)}_toString(l){var o=this.object.toString(l),s=this.index?this.index.toString(l):"",m=this.value.toString(l);return u(this,l&&l.parenthesis,l&&l.implicit)&&(m="("+m+")"),o+s+" = "+m}toJSON(){return{mathjs:pa,object:this.object,index:this.index,value:this.value}}static fromJSON(l){return new f(l.object,l.index,l.value)}toHTML(l){var o=this.object.toHTML(l),s=this.index?this.index.toHTML(l):"",m=this.value.toHTML(l);return u(this,l&&l.parenthesis,l&&l.implicit)&&(m='<span class="math-paranthesis math-round-parenthesis">(</span>'+m+'<span class="math-paranthesis math-round-parenthesis">)</span>'),o+s+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+m}_toTex(l){var o=this.object.toTex(l),s=this.index?this.index.toTex(l):"",m=this.value.toTex(l);return u(this,l&&l.parenthesis,l&&l.implicit)&&(m="\\left(".concat(m,"\\right)")),o+s+":="+m}}return hr(f,"name",pa),f},{isClass:!0,isNode:!0}),da="BlockNode",$2=["ResultSet","Node"],_2=I(da,$2,e=>{var{ResultSet:r,Node:i}=e;class a extends i{constructor(n){if(super(),!Array.isArray(n))throw new Error("Array expected");this.blocks=n.map(function(u){var f=u&&u.node,c=u&&u.visible!==void 0?u.visible:!0;if(!er(f))throw new TypeError('Property "node" must be a Node');if(typeof c!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:f,visible:c}})}get type(){return da}get isBlockNode(){return!0}_compile(n,u){var f=Nt(this.blocks,function(c){return{evaluate:c.node._compile(n,u),visible:c.visible}});return function(l,o,s){var m=[];return Ka(f,function(d){var p=d.evaluate(l,o,s);d.visible&&m.push(p)}),new r(m)}}forEach(n){for(var u=0;u<this.blocks.length;u++)n(this.blocks[u].node,"blocks["+u+"].node",this)}map(n){for(var u=[],f=0;f<this.blocks.length;f++){var c=this.blocks[f],l=this._ifNode(n(c.node,"blocks["+f+"].node",this));u[f]={node:l,visible:c.visible}}return new a(u)}clone(){var n=this.blocks.map(function(u){return{node:u.node,visible:u.visible}});return new a(n)}_toString(n){return this.blocks.map(function(u){return u.node.toString(n)+(u.visible?"":";")}).join(`
|
||
`)}toJSON(){return{mathjs:da,blocks:this.blocks}}static fromJSON(n){return new a(n.blocks)}toHTML(n){return this.blocks.map(function(u){return u.node.toHTML(n)+(u.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(n){return this.blocks.map(function(u){return u.node.toTex(n)+(u.visible?"":";")}).join(`\\;\\;
|
||
`)}}return hr(a,"name",da),a},{isClass:!0,isNode:!0}),ha="ConditionalNode",I2=["Node"],R2=I(ha,I2,e=>{var{Node:r}=e;function i(t){if(typeof t=="number"||typeof t=="boolean"||typeof t=="string")return!!t;if(t){if(ke(t))return!t.isZero();if(wt(t))return!!(t.re||t.im);if(Zr(t))return!!t.value}if(t==null)return!1;throw new TypeError('Unsupported type of condition "'+nr(t)+'"')}class a extends r{constructor(n,u,f){if(super(),!er(n))throw new TypeError("Parameter condition must be a Node");if(!er(u))throw new TypeError("Parameter trueExpr must be a Node");if(!er(f))throw new TypeError("Parameter falseExpr must be a Node");this.condition=n,this.trueExpr=u,this.falseExpr=f}get type(){return ha}get isConditionalNode(){return!0}_compile(n,u){var f=this.condition._compile(n,u),c=this.trueExpr._compile(n,u),l=this.falseExpr._compile(n,u);return function(s,m,v){return i(f(s,m,v))?c(s,m,v):l(s,m,v)}}forEach(n){n(this.condition,"condition",this),n(this.trueExpr,"trueExpr",this),n(this.falseExpr,"falseExpr",this)}map(n){return new a(this._ifNode(n(this.condition,"condition",this)),this._ifNode(n(this.trueExpr,"trueExpr",this)),this._ifNode(n(this.falseExpr,"falseExpr",this)))}clone(){return new a(this.condition,this.trueExpr,this.falseExpr)}_toString(n){var u=n&&n.parenthesis?n.parenthesis:"keep",f=tr(this,u,n&&n.implicit),c=this.condition.toString(n),l=tr(this.condition,u,n&&n.implicit);(u==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=f)&&(c="("+c+")");var o=this.trueExpr.toString(n),s=tr(this.trueExpr,u,n&&n.implicit);(u==="all"||this.trueExpr.type==="OperatorNode"||s!==null&&s<=f)&&(o="("+o+")");var m=this.falseExpr.toString(n),v=tr(this.falseExpr,u,n&&n.implicit);return(u==="all"||this.falseExpr.type==="OperatorNode"||v!==null&&v<=f)&&(m="("+m+")"),c+" ? "+o+" : "+m}toJSON(){return{mathjs:ha,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(n){return new a(n.condition,n.trueExpr,n.falseExpr)}toHTML(n){var u=n&&n.parenthesis?n.parenthesis:"keep",f=tr(this,u,n&&n.implicit),c=this.condition.toHTML(n),l=tr(this.condition,u,n&&n.implicit);(u==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=f)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var o=this.trueExpr.toHTML(n),s=tr(this.trueExpr,u,n&&n.implicit);(u==="all"||this.trueExpr.type==="OperatorNode"||s!==null&&s<=f)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(n),v=tr(this.falseExpr,u,n&&n.implicit);return(u==="all"||this.falseExpr.type==="OperatorNode"||v!==null&&v<=f)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+'<span class="math-operator math-conditional-operator">?</span>'+o+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(n){return"\\begin{cases} {"+this.trueExpr.toTex(n)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(n)+"}\\\\{"+this.falseExpr.toTex(n)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return hr(a,"name",ha),a},{isClass:!0,isNode:!0}),zi=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},q2={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},z2={"–":"\\--","—":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},P2=function(r,i){return zi({},r,i)},U2=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.preserveFormatting,a=i===void 0?!1:i,t=r.escapeMapFn,n=t===void 0?P2:t,u=String(e),f="",c=n(zi({},q2),a?zi({},z2):{}),l=Object.keys(c),o=function(){var m=!1;l.forEach(function(v,d){m||u.length>=v.length&&u.slice(0,v.length)===v&&(f+=c[l[d]],u=u.slice(v.length,u.length),m=!0)}),m||(f+=u.slice(0,1),u=u.slice(1,u.length))};u;)o();return f};const L2=Xn(U2);var Pi={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Ye={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},Hl={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Ye.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Ye.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Ye.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Ye.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Ye.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Ye.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Ye.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Ye.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Ye.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Ye.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Ye.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Ye.bitAnd,"${args[1]}\\right)")},bitNot:{1:Ye.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Ye.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Ye.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Ye.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Ye.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Ye.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Ye.and,"${args[1]}\\right)")},not:{1:Ye.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Ye.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Ye.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Ye.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Ye.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Ye.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Ye.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Ye.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Ye.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Ye.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Ye.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Ye.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Ye.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Ye.to,"${args[1]}\\right)")},numeric:function(r,i){return r.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Pi.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},k2="\\mathrm{${name}}\\left(${args}\\right)",Gl={deg:"^\\circ"};function Ui(e){return L2(e,{preserveFormatting:!0})}function Ym(e,r){return r=typeof r>"u"?!1:r,r?Ee(Gl,e)?Gl[e]:"\\mathrm{"+Ui(e)+"}":Ee(Pi,e)?Pi[e]:Ui(e)}var ga="ConstantNode",H2=["Node"],G2=I(ga,H2,e=>{var{Node:r}=e;class i extends r{constructor(t){super(),this.value=t}get type(){return ga}get isConstantNode(){return!0}_compile(t,n){var u=this.value;return function(){return u}}forEach(t){}map(t){return this.clone()}clone(){return new i(this.value)}_toString(t){return Pe(this.value,t)}toHTML(t){var n=this._toString(t);switch(nr(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+n+"</span>";case"string":return'<span class="math-string">'+n+"</span>";case"boolean":return'<span class="math-boolean">'+n+"</span>";case"null":return'<span class="math-null-symbol">'+n+"</span>";case"undefined":return'<span class="math-undefined">'+n+"</span>";default:return'<span class="math-symbol">'+n+"</span>"}}toJSON(){return{mathjs:ga,value:this.value}}static fromJSON(t){return new i(t.value)}_toTex(t){var n=this._toString(t);switch(nr(this.value)){case"string":return"\\mathtt{"+Ui(n)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var u=n.toLowerCase().indexOf("e");if(u!==-1)return n.substring(0,u)+"\\cdot10^{"+n.substring(u+1)+"}"}return n;case"Fraction":return this.value.toLatex();default:return n}}}return hr(i,"name",ga),i},{isClass:!0,isNode:!0}),ya="FunctionAssignmentNode",V2=["typed","Node"],Z2=I(ya,V2,e=>{var{typed:r,Node:i}=e;function a(n,u,f){var c=tr(n,u,f),l=tr(n.expr,u,f);return u==="all"||l!==null&&l<=c}class t extends i{constructor(u,f,c){if(super(),typeof u!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(f))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!er(c))throw new TypeError('Node expected for parameter "expr"');if(Vm.has(u))throw new Error('Illegal function name, "'+u+'" is a reserved keyword');var l=new Set;for(var o of f){var s=typeof o=="string"?o:o.name;if(l.has(s))throw new Error('Duplicate parameter name "'.concat(s,'"'));l.add(s)}this.name=u,this.params=f.map(function(m){return m&&m.name||m}),this.types=f.map(function(m){return m&&m.type||"any"}),this.expr=c}get type(){return ya}get isFunctionAssignmentNode(){return!0}_compile(u,f){var c=Object.create(f);Ka(this.params,function(d){c[d]=!0});var l=this.expr._compile(u,c),o=this.name,s=this.params,m=Ho(this.types,","),v=o+"("+Ho(this.params,", ")+")";return function(p,h,y){var E={};E[m]=function(){for(var w=Object.create(h),x=0;x<s.length;x++)w[s[x]]=arguments[x];return l(p,w,y)};var g=r(o,E);return g.syntax=v,p.set(o,g),g}}forEach(u){u(this.expr,"expr",this)}map(u){var f=this._ifNode(u(this.expr,"expr",this));return new t(this.name,this.params.slice(0),f)}clone(){return new t(this.name,this.params.slice(0),this.expr)}_toString(u){var f=u&&u.parenthesis?u.parenthesis:"keep",c=this.expr.toString(u);return a(this,f,u&&u.implicit)&&(c="("+c+")"),this.name+"("+this.params.join(", ")+") = "+c}toJSON(){var u=this.types;return{mathjs:ya,name:this.name,params:this.params.map(function(f,c){return{name:f,type:u[c]}}),expr:this.expr}}static fromJSON(u){return new t(u.name,u.params,u.expr)}toHTML(u){for(var f=u&&u.parenthesis?u.parenthesis:"keep",c=[],l=0;l<this.params.length;l++)c.push('<span class="math-symbol math-parameter">'+Yr(this.params[l])+"</span>");var o=this.expr.toHTML(u);return a(this,f,u&&u.implicit)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Yr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+o}_toTex(u){var f=u&&u.parenthesis?u.parenthesis:"keep",c=this.expr.toTex(u);return a(this,f,u&&u.implicit)&&(c="\\left(".concat(c,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Ym).join(",")+"\\right):="+c}}return hr(t,"name",ya),t},{isClass:!0,isNode:!0}),ba="IndexNode",Y2=["Node","size"],W2=I(ba,Y2,e=>{var{Node:r,size:i}=e;class a extends r{constructor(n,u){if(super(),this.dimensions=n,this.dotNotation=u||!1,!Array.isArray(n)||!n.every(er))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return ba}get isIndexNode(){return!0}_compile(n,u){var f=Nt(this.dimensions,function(l,o){var s=l.filter(d=>d.isSymbolNode&&d.name==="end").length>0;if(s){var m=Object.create(u);m.end=!0;var v=l._compile(n,m);return function(p,h,y){if(!Be(y)&&!je(y)&&!Br(y))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+nr(y));var E=i(y).valueOf(),g=Object.create(h);return g.end=E[o],v(p,g,y)}}else return l._compile(n,u)}),c=Tr(n,"index");return function(o,s,m){var v=Nt(f,function(d){return d(o,s,m)});return c(...v)}}forEach(n){for(var u=0;u<this.dimensions.length;u++)n(this.dimensions[u],"dimensions["+u+"]",this)}map(n){for(var u=[],f=0;f<this.dimensions.length;f++)u[f]=this._ifNode(n(this.dimensions[f],"dimensions["+f+"]",this));return new a(u,this.dotNotation)}clone(){return new a(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&We(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(n){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:ba,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(n){return new a(n.dimensions,n.dotNotation)}toHTML(n){for(var u=[],f=0;f<this.dimensions.length;f++)u[f]=this.dimensions[f].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Yr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+u.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(n){var u=this.dimensions.map(function(f){return f.toTex(n)});return this.dotNotation?"."+this.getObjectProperty():"_{"+u.join(",")+"}"}}return hr(a,"name",ba),a},{isClass:!0,isNode:!0}),xa="ObjectNode",X2=["Node"],J2=I(xa,X2,e=>{var{Node:r}=e;class i extends r{constructor(t){if(super(),this.properties=t||{},t&&(typeof t!="object"||!Object.keys(t).every(function(n){return er(t[n])})))throw new TypeError("Object containing Nodes expected")}get type(){return xa}get isObjectNode(){return!0}_compile(t,n){var u={};for(var f in this.properties)if(Ee(this.properties,f)){var c=sa(f),l=JSON.parse(c),o=Tr(this.properties,f);u[l]=o._compile(t,n)}return function(m,v,d){var p={};for(var h in u)Ee(u,h)&&(p[h]=u[h](m,v,d));return p}}forEach(t){for(var n in this.properties)Ee(this.properties,n)&&t(this.properties[n],"properties["+sa(n)+"]",this)}map(t){var n={};for(var u in this.properties)Ee(this.properties,u)&&(n[u]=this._ifNode(t(this.properties[u],"properties["+sa(u)+"]",this)));return new i(n)}clone(){var t={};for(var n in this.properties)Ee(this.properties,n)&&(t[n]=this.properties[n]);return new i(t)}_toString(t){var n=[];for(var u in this.properties)Ee(this.properties,u)&&n.push(sa(u)+": "+this.properties[u].toString(t));return"{"+n.join(", ")+"}"}toJSON(){return{mathjs:xa,properties:this.properties}}static fromJSON(t){return new i(t.properties)}toHTML(t){var n=[];for(var u in this.properties)Ee(this.properties,u)&&n.push('<span class="math-symbol math-property">'+Yr(u)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[u].toHTML(t));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+n.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(t){var n=[];for(var u in this.properties)Ee(this.properties,u)&&n.push("\\mathbf{"+u+":} & "+this.properties[u].toTex(t)+"\\\\");var f="\\left\\{\\begin{array}{ll}"+n.join(`
|
||
`)+"\\end{array}\\right\\}";return f}}return hr(i,"name",xa),i},{isClass:!0,isNode:!0}),wa="OperatorNode",Q2=["Node"],K2=I(wa,Q2,e=>{var{Node:r}=e;function i(n,u){var f=n;if(u==="auto")for(;Dt(f);)f=f.content;return We(f)?!0:mr(f)?i(f.args[0],u):!1}function a(n,u,f,c,l){var o=tr(n,u,f),s=Ln(n,u);if(u==="all"||c.length>2&&n.getIdentifier()!=="OperatorNode:add"&&n.getIdentifier()!=="OperatorNode:multiply")return c.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(c.length){case 0:m=[];break;case 1:{var v=tr(c[0],u,f,n);if(l&&v!==null){var d,p;if(u==="keep"?(d=c[0].getIdentifier(),p=n.getIdentifier()):(d=c[0].getContent().getIdentifier(),p=n.getContent().getIdentifier()),Jr[o][p].latexLeftParens===!1){m=[!1];break}if(Jr[v][d].latexParens===!1){m=[!1];break}}if(v===null){m=[!1];break}if(v<=o){m=[!0];break}m=[!1]}break;case 2:{var h,y=tr(c[0],u,f,n),E=Di(n,c[0],u);y===null?h=!1:y===o&&s==="right"&&!E||y<o?h=!0:h=!1;var g,w=tr(c[1],u,f,n),x=Di(n,c[1],u);if(w===null?g=!1:w===o&&s==="left"&&!x||w<o?g=!0:g=!1,l){var b,A,D;u==="keep"?(b=n.getIdentifier(),A=n.args[0].getIdentifier(),D=n.args[1].getIdentifier()):(b=n.getContent().getIdentifier(),A=n.args[0].getContent().getIdentifier(),D=n.args[1].getContent().getIdentifier()),y!==null&&(Jr[o][b].latexLeftParens===!1&&(h=!1),Jr[y][A].latexParens===!1&&(h=!1)),w!==null&&(Jr[o][b].latexRightParens===!1&&(g=!1),Jr[w][D].latexParens===!1&&(g=!1))}m=[h,g]}break;default:(n.getIdentifier()==="OperatorNode:add"||n.getIdentifier()==="OperatorNode:multiply")&&(m=c.map(function(N){var B=tr(N,u,f,n),F=Di(n,N,u),$=Ln(N,u);return B===null?!1:o===B&&s===$&&!F?!0:B<o}));break}if(c.length>=2&&n.getIdentifier()==="OperatorNode:multiply"&&n.implicit&&u!=="all"&&f==="hide")for(var S=1;S<m.length;++S)i(c[S],u)&&!m[S-1]&&(u!=="keep"||!Dt(c[S-1]))&&(m[S]=!0);return m}class t extends r{constructor(u,f,c,l,o){if(super(),typeof u!="string")throw new TypeError('string expected for parameter "op"');if(typeof f!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(c)||!c.every(er))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=l===!0,this.isPercentage=o===!0,this.op=u,this.fn=f,this.args=c||[]}get type(){return wa}get isOperatorNode(){return!0}_compile(u,f){if(typeof this.fn!="string"||!Vi(u,this.fn))throw u[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var c=Tr(u,this.fn),l=Nt(this.args,function(v){return v._compile(u,f)});if(l.length===1){var o=l[0];return function(d,p,h){return c(o(d,p,h))}}else if(l.length===2){var s=l[0],m=l[1];return function(d,p,h){return c(s(d,p,h),m(d,p,h))}}else return function(d,p,h){return c.apply(null,Nt(l,function(y){return y(d,p,h)}))}}forEach(u){for(var f=0;f<this.args.length;f++)u(this.args[f],"args["+f+"]",this)}map(u){for(var f=[],c=0;c<this.args.length;c++)f[c]=this._ifNode(u(this.args[c],"args["+c+"]",this));return new t(this.op,this.fn,f,this.implicit,this.isPercentage)}clone(){return new t(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(u){var f=u&&u.parenthesis?u.parenthesis:"keep",c=u&&u.implicit?u.implicit:"hide",l=this.args,o=a(this,f,c,l,!1);if(l.length===1){var s=Ln(this,f),m=l[0].toString(u);o[0]&&(m="("+m+")");var v=/[a-zA-Z]+/.test(this.op);return s==="right"?this.op+(v?" ":"")+m:s==="left"?m+(v?" ":"")+this.op:m+this.op}else if(l.length===2){var d=l[0].toString(u),p=l[1].toString(u);return o[0]&&(d="("+d+")"),o[1]&&(p="("+p+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?d+" "+p:d+" "+this.op+" "+p}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var h=l.map(function(y,E){return y=y.toString(u),o[E]&&(y="("+y+")"),y});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?h.join(" "):h.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:wa,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(u){return new t(u.op,u.fn,u.args,u.implicit,u.isPercentage)}toHTML(u){var f=u&&u.parenthesis?u.parenthesis:"keep",c=u&&u.implicit?u.implicit:"hide",l=this.args,o=a(this,f,c,l,!1);if(l.length===1){var s=Ln(this,f),m=l[0].toHTML(u);return o[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Yr(this.op)+"</span>"+m:m+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Yr(this.op)+"</span>"}else if(l.length===2){var v=l[0].toHTML(u),d=l[1].toHTML(u);return o[0]&&(v='<span class="math-parenthesis math-round-parenthesis">(</span>'+v+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?v+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+d:v+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(this.op)+"</span>"+d}else{var p=l.map(function(h,y){return h=h.toHTML(u),o[y]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),h});return l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&c==="hide"?p.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):p.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(this.op)+"</span>"):'<span class="math-function">'+Yr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+p.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(u){var f=u&&u.parenthesis?u.parenthesis:"keep",c=u&&u.implicit?u.implicit:"hide",l=this.args,o=a(this,f,c,l,!0),s=Ye[this.fn];if(s=typeof s>"u"?this.op:s,l.length===1){var m=Ln(this,f),v=l[0].toTex(u);return o[0]&&(v="\\left(".concat(v,"\\right)")),m==="right"?s+v:v+s}else if(l.length===2){var d=l[0],p=d.toTex(u);o[0]&&(p="\\left(".concat(p,"\\right)"));var h=l[1],y=h.toTex(u);o[1]&&(y="\\left(".concat(y,"\\right)"));var E;switch(f==="keep"?E=d.getIdentifier():E=d.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return s+"{"+p+"}{"+y+"}";case"OperatorNode:pow":switch(p="{"+p+"}",y="{"+y+"}",E){case"ConditionalNode":case"OperatorNode:divide":p="\\left(".concat(p,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&c==="hide")return p+"~"+y}return p+s+y}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=l.map(function(w,x){return w=w.toTex(u),o[x]&&(w="\\left(".concat(w,"\\right)")),w});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&c==="hide"?g.join("~"):g.join(s)}else return"\\mathrm{"+this.fn+"}\\left("+l.map(function(w){return w.toTex(u)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return hr(t,"name",wa),t},{isClass:!0,isNode:!0}),Na="ParenthesisNode",j2=["Node"],eD=I(Na,j2,e=>{var{Node:r}=e;class i extends r{constructor(t){if(super(),!er(t))throw new TypeError('Node expected for parameter "content"');this.content=t}get type(){return Na}get isParenthesisNode(){return!0}_compile(t,n){return this.content._compile(t,n)}getContent(){return this.content.getContent()}forEach(t){t(this.content,"content",this)}map(t){var n=t(this.content,"content",this);return new i(n)}clone(){return new i(this.content)}_toString(t){return!t||t&&!t.parenthesis||t&&t.parenthesis==="keep"?"("+this.content.toString(t)+")":this.content.toString(t)}toJSON(){return{mathjs:Na,content:this.content}}static fromJSON(t){return new i(t.content)}toHTML(t){return!t||t&&!t.parenthesis||t&&t.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(t)}_toTex(t){return!t||t&&!t.parenthesis||t&&t.parenthesis==="keep"?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)}}return hr(i,"name",Na),i},{isClass:!0,isNode:!0}),Da="RangeNode",rD=["Node"],tD=I(Da,rD,e=>{var{Node:r}=e;function i(t,n,u){var f=tr(t,n,u),c={},l=tr(t.start,n,u);if(c.start=l!==null&&l<=f||n==="all",t.step){var o=tr(t.step,n,u);c.step=o!==null&&o<=f||n==="all"}var s=tr(t.end,n,u);return c.end=s!==null&&s<=f||n==="all",c}class a extends r{constructor(n,u,f){if(super(),!er(n))throw new TypeError("Node expected");if(!er(u))throw new TypeError("Node expected");if(f&&!er(f))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=n,this.end=u,this.step=f||null}get type(){return Da}get isRangeNode(){return!0}needsEnd(){var n=this.filter(function(u){return yr(u)&&u.name==="end"});return n.length>0}_compile(n,u){var f=n.range,c=this.start._compile(n,u),l=this.end._compile(n,u);if(this.step){var o=this.step._compile(n,u);return function(m,v,d){return f(c(m,v,d),l(m,v,d),o(m,v,d))}}else return function(m,v,d){return f(c(m,v,d),l(m,v,d))}}forEach(n){n(this.start,"start",this),n(this.end,"end",this),this.step&&n(this.step,"step",this)}map(n){return new a(this._ifNode(n(this.start,"start",this)),this._ifNode(n(this.end,"end",this)),this.step&&this._ifNode(n(this.step,"step",this)))}clone(){return new a(this.start,this.end,this.step&&this.step)}_toString(n){var u=n&&n.parenthesis?n.parenthesis:"keep",f=i(this,u,n&&n.implicit),c,l=this.start.toString(n);if(f.start&&(l="("+l+")"),c=l,this.step){var o=this.step.toString(n);f.step&&(o="("+o+")"),c+=":"+o}var s=this.end.toString(n);return f.end&&(s="("+s+")"),c+=":"+s,c}toJSON(){return{mathjs:Da,start:this.start,end:this.end,step:this.step}}static fromJSON(n){return new a(n.start,n.end,n.step)}toHTML(n){var u=n&&n.parenthesis?n.parenthesis:"keep",f=i(this,u,n&&n.implicit),c,l=this.start.toHTML(n);if(f.start&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c=l,this.step){var o=this.step.toHTML(n);f.step&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+o}var s=this.end.toHTML(n);return f.end&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c+='<span class="math-operator math-range-operator">:</span>'+s,c}_toTex(n){var u=n&&n.parenthesis?n.parenthesis:"keep",f=i(this,u,n&&n.implicit),c=this.start.toTex(n);if(f.start&&(c="\\left(".concat(c,"\\right)")),this.step){var l=this.step.toTex(n);f.step&&(l="\\left(".concat(l,"\\right)")),c+=":"+l}var o=this.end.toTex(n);return f.end&&(o="\\left(".concat(o,"\\right)")),c+=":"+o,c}}return hr(a,"name",Da),a},{isClass:!0,isNode:!0}),Aa="RelationalNode",nD=["Node"],aD=I(Aa,nD,e=>{var{Node:r}=e,i={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class a extends r{constructor(n,u){if(super(),!Array.isArray(n))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(u))throw new TypeError("Parameter params must be an array");if(n.length!==u.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=n,this.params=u}get type(){return Aa}get isRelationalNode(){return!0}_compile(n,u){var f=this,c=this.params.map(l=>l._compile(n,u));return function(o,s,m){for(var v,d=c[0](o,s,m),p=0;p<f.conditionals.length;p++){v=d,d=c[p+1](o,s,m);var h=Tr(n,f.conditionals[p]);if(!h(v,d))return!1}return!0}}forEach(n){this.params.forEach((u,f)=>n(u,"params["+f+"]",this),this)}map(n){return new a(this.conditionals.slice(),this.params.map((u,f)=>this._ifNode(n(u,"params["+f+"]",this)),this))}clone(){return new a(this.conditionals,this.params)}_toString(n){for(var u=n&&n.parenthesis?n.parenthesis:"keep",f=tr(this,u,n&&n.implicit),c=this.params.map(function(s,m){var v=tr(s,u,n&&n.implicit);return u==="all"||v!==null&&v<=f?"("+s.toString(n)+")":s.toString(n)}),l=c[0],o=0;o<this.conditionals.length;o++)l+=" "+i[this.conditionals[o]],l+=" "+c[o+1];return l}toJSON(){return{mathjs:Aa,conditionals:this.conditionals,params:this.params}}static fromJSON(n){return new a(n.conditionals,n.params)}toHTML(n){for(var u=n&&n.parenthesis?n.parenthesis:"keep",f=tr(this,u,n&&n.implicit),c=this.params.map(function(s,m){var v=tr(s,u,n&&n.implicit);return u==="all"||v!==null&&v<=f?'<span class="math-parenthesis math-round-parenthesis">(</span>'+s.toHTML(n)+'<span class="math-parenthesis math-round-parenthesis">)</span>':s.toHTML(n)}),l=c[0],o=0;o<this.conditionals.length;o++)l+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(i[this.conditionals[o]])+"</span>"+c[o+1];return l}_toTex(n){for(var u=n&&n.parenthesis?n.parenthesis:"keep",f=tr(this,u,n&&n.implicit),c=this.params.map(function(s,m){var v=tr(s,u,n&&n.implicit);return u==="all"||v!==null&&v<=f?"\\left("+s.toTex(n)+"\right)":s.toTex(n)}),l=c[0],o=0;o<this.conditionals.length;o++)l+=Ye[this.conditionals[o]]+c[o+1];return l}}return hr(a,"name",Aa),a},{isClass:!0,isNode:!0}),iD="SymbolNode",oD=["math","?Unit","Node"],uD=I(iD,oD,e=>{var{math:r,Unit:i,Node:a}=e;function t(u){return i?i.isValuelessUnit(u):!1}class n extends a{constructor(f){if(super(),typeof f!="string")throw new TypeError('String expected for parameter "name"');this.name=f}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(f,c){var l=this.name;if(c[l]===!0)return function(s,m,v){return Tr(m,l)};if(l in f)return function(s,m,v){return s.has(l)?s.get(l):Tr(f,l)};var o=t(l);return function(s,m,v){return s.has(l)?s.get(l):o?new i(null,l):n.onUndefinedSymbol(l)}}forEach(f){}map(f){return this.clone()}static onUndefinedSymbol(f){throw new Error("Undefined symbol "+f)}clone(){return new n(this.name)}_toString(f){return this.name}toHTML(f){var c=Yr(this.name);return c==="true"||c==="false"?'<span class="math-symbol math-boolean">'+c+"</span>":c==="i"?'<span class="math-symbol math-imaginary-symbol">'+c+"</span>":c==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+c+"</span>":c==="NaN"?'<span class="math-symbol math-nan-symbol">'+c+"</span>":c==="null"?'<span class="math-symbol math-null-symbol">'+c+"</span>":c==="undefined"?'<span class="math-symbol math-undefined-symbol">'+c+"</span>":'<span class="math-symbol">'+c+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(f){return new n(f.name)}_toTex(f){var c=!1;typeof r[this.name]>"u"&&t(this.name)&&(c=!0);var l=Ym(this.name,c);return l[0]==="\\"?l:" "+l}}return n},{isClass:!0,isNode:!0});function Hn(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];return typeof e.createSubScope=="function"?Go(e.createSubScope(),...i):Go(xn(),e,...i)}var Ea="FunctionNode",sD=["math","Node","SymbolNode"],lD=I(Ea,sD,e=>{var{math:r,Node:i,SymbolNode:a}=e,t=f=>Pe(f,{truncate:78});function n(f,c,l){for(var o="",s=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,v;(v=s.exec(f))!==null;)if(o+=f.substring(m,v.index),m=v.index,v[0]==="$$")o+="$",m++;else{m+=v[0].length;var d=c[v[1]];if(!d)throw new ReferenceError("Template: Property "+v[1]+" does not exist.");if(v[2]===void 0)switch(typeof d){case"string":o+=d;break;case"object":if(er(d))o+=d.toTex(l);else if(Array.isArray(d))o+=d.map(function(p,h){if(er(p))return p.toTex(l);throw new TypeError("Template: "+v[1]+"["+h+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+v[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+v[1]+" has to be a Node, String or array of Nodes")}else if(er(d[v[2]]&&d[v[2]]))o+=d[v[2]].toTex(l);else throw new TypeError("Template: "+v[1]+"["+v[2]+"] is not a Node.")}return o+=f.slice(m),o}class u extends i{constructor(c,l){if(super(),typeof c=="string"&&(c=new a(c)),!er(c))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(l)||!l.every(er))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=c,this.args=l||[]}get name(){return this.fn.name||""}get type(){return Ea}get isFunctionNode(){return!0}_compile(c,l){var o=this.args.map(A=>A._compile(c,l));if(yr(this.fn)){var s=this.fn.name;if(l[s]){var h=this.args;return function(D,S,N){var B=Tr(S,s);if(typeof B!="function")throw new TypeError("Argument '".concat(s,"' was not a function; received: ").concat(t(B)));if(B.rawArgs)return B(h,c,Hn(D,S),D);var F=o.map($=>$(D,S,N));return B.apply(B,F)}}else{var m=s in c?Tr(c,s):void 0,v=typeof m=="function"&&m.rawArgs===!0,d=A=>{var D;if(A.has(s))D=A.get(s);else if(s in c)D=Tr(c,s);else return u.onUndefinedFunction(s);if(typeof D=="function")return D;throw new TypeError("'".concat(s,`' is not a function; its value is:
|
||
`).concat(t(D)))};if(v){var p=this.args;return function(D,S,N){var B=d(D);return B(p,c,Hn(D,S),D)}}else switch(o.length){case 0:return function(D,S,N){var B=d(D);return B()};case 1:return function(D,S,N){var B=d(D),F=o[0];return B(F(D,S,N))};case 2:return function(D,S,N){var B=d(D),F=o[0],$=o[1];return B(F(D,S,N),$(D,S,N))};default:return function(D,S,N){var B=d(D),F=o.map($=>$(D,S,N));return B(...F)}}}}else if(Gt(this.fn)&&An(this.fn.index)&&this.fn.index.isObjectProperty()){var y=this.fn.object._compile(c,l),E=this.fn.index.getObjectProperty(),g=this.args;return function(D,S,N){var B=y(D,S,N),F=Od(B,E);if(F!=null&&F.rawArgs)return F(g,c,Hn(D,S),D);var $=o.map(q=>q(D,S,N));return F.apply(B,$)}}else{var w=this.fn.toString(),x=this.fn._compile(c,l),b=this.args;return function(D,S,N){var B=x(D,S,N);if(typeof B!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
|
||
`.concat(t(B)));if(B.rawArgs)return B(b,c,Hn(D,S),D);var F=o.map($=>$(D,S,N));return B.apply(B,F)}}}forEach(c){c(this.fn,"fn",this);for(var l=0;l<this.args.length;l++)c(this.args[l],"args["+l+"]",this)}map(c){for(var l=this._ifNode(c(this.fn,"fn",this)),o=[],s=0;s<this.args.length;s++)o[s]=this._ifNode(c(this.args[s],"args["+s+"]",this));return new u(l,o)}clone(){return new u(this.fn,this.args.slice(0))}toString(c){var l,o=this.fn.toString(c);return c&&typeof c.handler=="object"&&Ee(c.handler,o)&&(l=c.handler[o](this,c)),typeof l<"u"?l:super.toString(c)}_toString(c){var l=this.args.map(function(s){return s.toString(c)}),o=Qn(this.fn)?"("+this.fn.toString(c)+")":this.fn.toString(c);return o+"("+l.join(", ")+")"}toJSON(){return{mathjs:Ea,fn:this.fn,args:this.args}}toHTML(c){var l=this.args.map(function(o){return o.toHTML(c)});return'<span class="math-function">'+Yr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(c){var l;return c&&typeof c.handler=="object"&&Ee(c.handler,this.name)&&(l=c.handler[this.name](this,c)),typeof l<"u"?l:super.toTex(c)}_toTex(c){var l=this.args.map(function(m){return m.toTex(c)}),o;Hl[this.name]&&(o=Hl[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(o=r[this.name].toTex);var s;switch(typeof o){case"function":s=o(this,c);break;case"string":s=n(o,this,c);break;case"object":switch(typeof o[l.length]){case"function":s=o[l.length](this,c);break;case"string":s=n(o[l.length],this,c);break}}return typeof s<"u"?s:n(k2,this,c)}getIdentifier(){return this.type+":"+this.name}}return hr(u,"name",Ea),hr(u,"onUndefinedFunction",function(f){throw new Error("Undefined function "+f)}),hr(u,"fromJSON",function(f){return new u(f.fn,f.args)}),u},{isClass:!0,isNode:!0}),Vl="parse",cD=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],fD=I(Vl,cD,e=>{var{typed:r,numeric:i,config:a,AccessorNode:t,ArrayNode:n,AssignmentNode:u,BlockNode:f,ConditionalNode:c,ConstantNode:l,FunctionAssignmentNode:o,FunctionNode:s,IndexNode:m,ObjectNode:v,OperatorNode:d,ParenthesisNode:p,RangeNode:h,RelationalNode:y,SymbolNode:E}=e,g=r(Vl,{string:function(Z){return L(Z,{})},"Array | Matrix":function(Z){return w(Z,{})},"string, Object":function(Z,ne){var ye=ne.nodes!==void 0?ne.nodes:{};return L(Z,ye)},"Array | Matrix, Object":w});function w(M){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=Z.nodes!==void 0?Z.nodes:{};return He(M,function(ye){if(typeof ye!="string")throw new TypeError("String expected");return L(ye,ne)})}var x={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},b={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},A={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},D={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"];function N(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:x.NULL,nestingLevel:0,conditionalLevel:null}}function B(M,Z){return M.expression.substr(M.index,Z)}function F(M){return B(M,1)}function $(M){M.index++}function q(M){return M.expression.charAt(M.index-1)}function _(M){return M.expression.charAt(M.index+1)}function C(M){for(M.tokenType=x.NULL,M.token="",M.comment="";;){if(F(M)==="#")for(;F(M)!==`
|
||
`&&F(M)!=="";)M.comment+=F(M),$(M);if(g.isWhitespace(F(M),M.nestingLevel))$(M);else break}if(F(M)===""){M.tokenType=x.DELIMITER;return}if(F(M)===`
|
||
`&&!M.nestingLevel){M.tokenType=x.DELIMITER,M.token=F(M),$(M);return}var Z=F(M),ne=B(M,2),ye=B(M,3);if(ye.length===3&&b[ye]){M.tokenType=x.DELIMITER,M.token=ye,$(M),$(M),$(M);return}if(ne.length===2&&b[ne]){M.tokenType=x.DELIMITER,M.token=ne,$(M),$(M);return}if(b[Z]){M.tokenType=x.DELIMITER,M.token=Z,$(M);return}if(g.isDigitDot(Z)){M.tokenType=x.NUMBER;var Me=B(M,2);if(Me==="0b"||Me==="0o"||Me==="0x"){for(M.token+=F(M),$(M),M.token+=F(M),$(M);g.isHexDigit(F(M));)M.token+=F(M),$(M);if(F(M)===".")for(M.token+=".",$(M);g.isHexDigit(F(M));)M.token+=F(M),$(M);else if(F(M)==="i")for(M.token+="i",$(M);g.isDigit(F(M));)M.token+=F(M),$(M);return}if(F(M)==="."){if(M.token+=F(M),$(M),!g.isDigit(F(M))){M.tokenType=x.DELIMITER;return}}else{for(;g.isDigit(F(M));)M.token+=F(M),$(M);g.isDecimalMark(F(M),_(M))&&(M.token+=F(M),$(M))}for(;g.isDigit(F(M));)M.token+=F(M),$(M);if(F(M)==="E"||F(M)==="e"){if(g.isDigit(_(M))||_(M)==="-"||_(M)==="+"){if(M.token+=F(M),$(M),(F(M)==="+"||F(M)==="-")&&(M.token+=F(M),$(M)),!g.isDigit(F(M)))throw ze(M,'Digit expected, got "'+F(M)+'"');for(;g.isDigit(F(M));)M.token+=F(M),$(M);if(g.isDecimalMark(F(M),_(M)))throw ze(M,'Digit expected, got "'+F(M)+'"')}else if(_(M)===".")throw $(M),ze(M,'Digit expected, got "'+F(M)+'"')}return}if(g.isAlpha(F(M),q(M),_(M))){for(;g.isAlpha(F(M),q(M),_(M))||g.isDigit(F(M));)M.token+=F(M),$(M);Ee(A,M.token)?M.tokenType=x.DELIMITER:M.tokenType=x.SYMBOL;return}for(M.tokenType=x.UNKNOWN;F(M)!=="";)M.token+=F(M),$(M);throw ze(M,'Syntax error in part "'+M.token+'"')}function T(M){do C(M);while(M.token===`
|
||
`)}function H(M){M.nestingLevel++}function O(M){M.nestingLevel--}g.isAlpha=function(Z,ne,ye){return g.isValidLatinOrGreek(Z)||g.isValidMathSymbol(Z,ye)||g.isValidMathSymbol(ne,Z)},g.isValidLatinOrGreek=function(Z){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Z)},g.isValidMathSymbol=function(Z,ne){return/^[\uD835]$/.test(Z)&&/^[\uDC00-\uDFFF]$/.test(ne)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(ne)},g.isWhitespace=function(Z,ne){return Z===" "||Z===" "||Z===`
|
||
`&&ne>0},g.isDecimalMark=function(Z,ne){return Z==="."&&ne!=="/"&&ne!=="*"&&ne!=="^"},g.isDigitDot=function(Z){return Z>="0"&&Z<="9"||Z==="."},g.isDigit=function(Z){return Z>="0"&&Z<="9"},g.isHexDigit=function(Z){return Z>="0"&&Z<="9"||Z>="a"&&Z<="f"||Z>="A"&&Z<="F"};function L(M,Z){var ne=N();wr(ne,{expression:M,extraNodes:Z}),C(ne);var ye=W(ne);if(ne.token!=="")throw ne.tokenType===x.DELIMITER?ir(ne,"Unexpected operator "+ne.token):ze(ne,'Unexpected part "'+ne.token+'"');return ye}function W(M){var Z,ne=[],ye;for(M.token!==""&&M.token!==`
|
||
`&&M.token!==";"&&(Z=X(M),M.comment&&(Z.comment=M.comment));M.token===`
|
||
`||M.token===";";)ne.length===0&&Z&&(ye=M.token!==";",ne.push({node:Z,visible:ye})),C(M),M.token!==`
|
||
`&&M.token!==";"&&M.token!==""&&(Z=X(M),M.comment&&(Z.comment=M.comment),ye=M.token!==";",ne.push({node:Z,visible:ye}));return ne.length>0?new f(ne):(Z||(Z=new l(void 0),M.comment&&(Z.comment=M.comment)),Z)}function X(M){var Z,ne,ye,Me,Te=P(M);if(M.token==="="){if(yr(Te))return Z=Te.name,T(M),ye=X(M),new u(new E(Z),ye);if(Gt(Te))return T(M),ye=X(M),new u(Te.object,Te.index,ye);if(Ot(Te)&&yr(Te.fn)&&(Me=!0,ne=[],Z=Te.name,Te.args.forEach(function(pr,Ar){yr(pr)?ne[Ar]=pr.name:Me=!1}),Me))return T(M),ye=X(M),new o(Z,ne,ye);throw ze(M,"Invalid left hand side of assignment operator =")}return Te}function P(M){for(var Z=J(M);M.token==="?";){var ne=M.conditionalLevel;M.conditionalLevel=M.nestingLevel,T(M);var ye=Z,Me=X(M);if(M.token!==":")throw ze(M,"False part of conditional expression expected");M.conditionalLevel=null,T(M);var Te=X(M);Z=new c(ye,Me,Te),M.conditionalLevel=ne}return Z}function J(M){for(var Z=ee(M);M.token==="or";)T(M),Z=new d("or","or",[Z,ee(M)]);return Z}function ee(M){for(var Z=K(M);M.token==="xor";)T(M),Z=new d("xor","xor",[Z,K(M)]);return Z}function K(M){for(var Z=oe(M);M.token==="and";)T(M),Z=new d("and","and",[Z,oe(M)]);return Z}function oe(M){for(var Z=se(M);M.token==="|";)T(M),Z=new d("|","bitOr",[Z,se(M)]);return Z}function se(M){for(var Z=ie(M);M.token==="^|";)T(M),Z=new d("^|","bitXor",[Z,ie(M)]);return Z}function ie(M){for(var Z=re(M);M.token==="&";)T(M),Z=new d("&","bitAnd",[Z,re(M)]);return Z}function re(M){for(var Z=[pe(M)],ne=[],ye={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ee(ye,M.token);){var Me={name:M.token,fn:ye[M.token]};ne.push(Me),T(M),Z.push(pe(M))}return Z.length===1?Z[0]:Z.length===2?new d(ne[0].name,ne[0].fn,Z):new y(ne.map(Te=>Te.fn),Z)}function pe(M){var Z,ne,ye,Me;Z=Ae(M);for(var Te={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ee(Te,M.token);)ne=M.token,ye=Te[ne],T(M),Me=[Z,Ae(M)],Z=new d(ne,ye,Me);return Z}function Ae(M){var Z,ne,ye,Me;Z=be(M);for(var Te={to:"to",in:"to"};Ee(Te,M.token);)ne=M.token,ye=Te[ne],T(M),ne==="in"&&M.token===""?Z=new d("*","multiply",[Z,new E("in")],!0):(Me=[Z,be(M)],Z=new d(ne,ye,Me));return Z}function be(M){var Z,ne=[];if(M.token===":"?Z=new l(1):Z=Ne(M),M.token===":"&&M.conditionalLevel!==M.nestingLevel){for(ne.push(Z);M.token===":"&&ne.length<3;)T(M),M.token===")"||M.token==="]"||M.token===","||M.token===""?ne.push(new E("end")):ne.push(Ne(M));ne.length===3?Z=new h(ne[0],ne[2],ne[1]):Z=new h(ne[0],ne[1])}return Z}function Ne(M){var Z,ne,ye,Me;Z=U(M);for(var Te={"+":"add","-":"subtract"};Ee(Te,M.token);){ne=M.token,ye=Te[ne],T(M);var pr=U(M);pr.isPercentage?Me=[Z,new d("*","multiply",[Z,pr])]:Me=[Z,pr],Z=new d(ne,ye,Me)}return Z}function U(M){var Z,ne,ye,Me;Z=G(M),ne=Z;for(var Te={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Ee(Te,M.token);)ye=M.token,Me=Te[ye],T(M),ne=G(M),Z=new d(ye,Me,[Z,ne]);return Z}function G(M){var Z,ne;for(Z=te(M),ne=Z;M.tokenType===x.SYMBOL||M.token==="in"&&We(Z)||M.tokenType===x.NUMBER&&!We(ne)&&(!mr(ne)||ne.op==="!")||M.token==="(";)ne=te(M),Z=new d("*","multiply",[Z,ne],!0);return Z}function te(M){for(var Z=k(M),ne=Z,ye=[];M.token==="/"&&Si(ne);)if(ye.push(wr({},M)),T(M),M.tokenType===x.NUMBER)if(ye.push(wr({},M)),T(M),M.tokenType===x.SYMBOL||M.token==="(")wr(M,ye.pop()),ye.pop(),ne=k(M),Z=new d("/","divide",[Z,ne]);else{ye.pop(),wr(M,ye.pop());break}else{wr(M,ye.pop());break}return Z}function k(M){var Z,ne,ye,Me;Z=Y(M);for(var Te={"%":"mod",mod:"mod"};Ee(Te,M.token);)ne=M.token,ye=Te[ne],T(M),ne==="%"&&M.tokenType===x.DELIMITER&&M.token!=="("?Z=new d("/","divide",[Z,new l(100)],!1,!0):(Me=[Z,Y(M)],Z=new d(ne,ye,Me));return Z}function Y(M){var Z,ne,ye,Me={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ee(Me,M.token)?(ye=Me[M.token],Z=M.token,T(M),ne=[Y(M)],new d(Z,ye,ne)):j(M)}function j(M){var Z,ne,ye,Me;return Z=fe(M),(M.token==="^"||M.token===".^")&&(ne=M.token,ye=ne==="^"?"pow":"dotPow",T(M),Me=[Z,Y(M)],Z=new d(ne,ye,Me)),Z}function fe(M){var Z,ne,ye,Me;Z=ue(M);for(var Te={"!":"factorial","'":"ctranspose"};Ee(Te,M.token);)ne=M.token,ye=Te[ne],C(M),Me=[Z],Z=new d(ne,ye,Me),Z=z(M,Z);return Z}function ue(M){var Z=[];if(M.tokenType===x.SYMBOL&&Ee(M.extraNodes,M.token)){var ne=M.extraNodes[M.token];if(C(M),M.token==="("){if(Z=[],H(M),C(M),M.token!==")")for(Z.push(X(M));M.token===",";)C(M),Z.push(X(M));if(M.token!==")")throw ze(M,"Parenthesis ) expected");O(M),C(M)}return new ne(Z)}return R(M)}function R(M){var Z,ne;return M.tokenType===x.SYMBOL||M.tokenType===x.DELIMITER&&M.token in A?(ne=M.token,C(M),Ee(D,ne)?Z=new l(D[ne]):S.indexOf(ne)!==-1?Z=new l(i(ne,"number")):Z=new E(ne),Z=z(M,Z),Z):Q(M)}function z(M,Z,ne){for(var ye;(M.token==="("||M.token==="["||M.token===".")&&(!ne||ne.indexOf(M.token)!==-1);)if(ye=[],M.token==="(")if(yr(Z)||Gt(Z)){if(H(M),C(M),M.token!==")")for(ye.push(X(M));M.token===",";)C(M),ye.push(X(M));if(M.token!==")")throw ze(M,"Parenthesis ) expected");O(M),C(M),Z=new s(Z,ye)}else return Z;else if(M.token==="["){if(H(M),C(M),M.token!=="]")for(ye.push(X(M));M.token===",";)C(M),ye.push(X(M));if(M.token!=="]")throw ze(M,"Parenthesis ] expected");O(M),C(M),Z=new t(Z,new m(ye))}else{if(C(M),M.tokenType!==x.SYMBOL)throw ze(M,"Property name expected after dot");ye.push(new l(M.token)),C(M);var Me=!0;Z=new t(Z,new m(ye,Me))}return Z}function Q(M){var Z,ne;return M.token==='"'?(ne=ae(M),Z=new l(ne),Z=z(M,Z),Z):le(M)}function ae(M){for(var Z="";F(M)!==""&&F(M)!=='"';)F(M)==="\\"&&(Z+=F(M),$(M)),Z+=F(M),$(M);if(C(M),M.token!=='"')throw ze(M,'End of string " expected');return C(M),JSON.parse('"'+Z+'"')}function le(M){var Z,ne;return M.token==="'"?(ne=ve(M),Z=new l(ne),Z=z(M,Z),Z):de(M)}function ve(M){for(var Z="";F(M)!==""&&F(M)!=="'";)F(M)==="\\"&&(Z+=F(M),$(M)),Z+=F(M),$(M);if(C(M),M.token!=="'")throw ze(M,"End of string ' expected");return C(M),JSON.parse('"'+Z+'"')}function de(M){var Z,ne,ye,Me;if(M.token==="["){if(H(M),C(M),M.token!=="]"){var Te=ce(M);if(M.token===";"){for(ye=1,ne=[Te];M.token===";";)C(M),ne[ye]=ce(M),ye++;if(M.token!=="]")throw ze(M,"End of matrix ] expected");O(M),C(M),Me=ne[0].items.length;for(var pr=1;pr<ye;pr++)if(ne[pr].items.length!==Me)throw ir(M,"Column dimensions mismatch ("+ne[pr].items.length+" !== "+Me+")");Z=new n(ne)}else{if(M.token!=="]")throw ze(M,"End of matrix ] expected");O(M),C(M),Z=Te}}else O(M),C(M),Z=new n([]);return z(M,Z)}return ge(M)}function ce(M){for(var Z=[X(M)],ne=1;M.token===",";)C(M),Z[ne]=X(M),ne++;return new n(Z)}function ge(M){if(M.token==="{"){H(M);var Z,ne={};do if(C(M),M.token!=="}"){if(M.token==='"')Z=ae(M);else if(M.token==="'")Z=ve(M);else if(M.tokenType===x.SYMBOL||M.tokenType===x.DELIMITER&&M.token in A)Z=M.token,C(M);else throw ze(M,"Symbol or string expected as object key");if(M.token!==":")throw ze(M,"Colon : expected after object key");C(M),ne[Z]=X(M)}while(M.token===",");if(M.token!=="}")throw ze(M,"Comma , or bracket } expected after object value");O(M),C(M);var ye=new v(ne);return ye=z(M,ye),ye}return Se(M)}function Se(M){var Z;return M.tokenType===x.NUMBER?(Z=M.token,C(M),new l(i(Z,a.number))):Ie(M)}function Ie(M){var Z;if(M.token==="("){if(H(M),C(M),Z=X(M),M.token!==")")throw ze(M,"Parenthesis ) expected");return O(M),C(M),Z=new p(Z),Z=z(M,Z),Z}return De(M)}function De(M){throw M.token===""?ze(M,"Unexpected end of expression"):ze(M,"Value expected")}function Je(M){return M.index-M.token.length+1}function ze(M,Z){var ne=Je(M),ye=new SyntaxError(Z+" (char "+ne+")");return ye.char=ne,ye}function ir(M,Z){var ne=Je(M),ye=new SyntaxError(Z+" (char "+ne+")");return ye.char=ne,ye}return r.addConversion({from:"string",to:"Node",convert:g}),g}),Zl="compile",mD=["typed","parse"],vD=I(Zl,mD,e=>{var{typed:r,parse:i}=e;return r(Zl,{string:function(t){return i(t).compile()},"Array | Matrix":function(t){return He(t,function(n){return i(n).compile()})}})}),Yl="evaluate",pD=["typed","parse"],dD=I(Yl,pD,e=>{var{typed:r,parse:i}=e;return r(Yl,{string:function(t){var n=xn();return i(t).compile().evaluate(n)},"string, Map | Object":function(t,n){return i(t).compile().evaluate(n)},"Array | Matrix":function(t){var n=xn();return He(t,function(u){return i(u).compile().evaluate(n)})},"Array | Matrix, Map | Object":function(t,n){return He(t,function(u){return i(u).compile().evaluate(n)})}})}),hD="Parser",gD=["evaluate"],yD=I(hD,gD,e=>{var{evaluate:r}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:xn(),writable:!1})}return i.prototype.type="Parser",i.prototype.isParser=!0,i.prototype.evaluate=function(a){return r(a,this.scope)},i.prototype.get=function(a){if(this.scope.has(a))return this.scope.get(a)},i.prototype.getAll=function(){return Id(this.scope)},i.prototype.getAllAsMap=function(){return this.scope},i.prototype.set=function(a,t){return this.scope.set(a,t),t},i.prototype.remove=function(a){this.scope.delete(a)},i.prototype.clear=function(){this.scope.clear()},i},{isClass:!0}),Wl="parser",bD=["typed","Parser"],xD=I(Wl,bD,e=>{var{typed:r,Parser:i}=e;return r(Wl,{"":function(){return new i}})}),Xl="lup",wD=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],ND=I(Xl,wD,e=>{var{typed:r,matrix:i,abs:a,addScalar:t,divideScalar:n,multiplyScalar:u,subtract:f,larger:c,equalScalar:l,unaryMinus:o,DenseMatrix:s,SparseMatrix:m,Spa:v}=e;return r(Xl,{DenseMatrix:function(y){return d(y)},SparseMatrix:function(y){return p(y)},Array:function(y){var E=i(y),g=d(E);return{L:g.L.valueOf(),U:g.U.valueOf(),p:g.p}}});function d(h){var y=h._size[0],E=h._size[1],g=Math.min(y,E),w=$e(h._data),x=[],b=[y,g],A=[],D=[g,E],S,N,B,F=[];for(S=0;S<y;S++)F[S]=S;for(N=0;N<E;N++){if(N>0)for(S=0;S<y;S++){var $=Math.min(S,N),q=0;for(B=0;B<$;B++)q=t(q,u(w[S][B],w[B][N]));w[S][N]=f(w[S][N],q)}var _=N,C=0,T=0;for(S=N;S<y;S++){var H=w[S][N],O=a(H);c(O,C)&&(_=S,C=O,T=H)}if(N!==_&&(F[N]=[F[_],F[_]=F[N]][0],s._swapRows(N,_,w)),N<y)for(S=N+1;S<y;S++){var L=w[S][N];l(L,0)||(w[S][N]=n(w[S][N],T))}}for(N=0;N<E;N++)for(S=0;S<y;S++){if(N===0&&(S<E&&(A[S]=[]),x[S]=[]),S<N){S<E&&(A[S][N]=w[S][N]),N<y&&(x[S][N]=0);continue}if(S===N){S<E&&(A[S][N]=w[S][N]),N<y&&(x[S][N]=1);continue}S<E&&(A[S][N]=0),N<y&&(x[S][N]=w[S][N])}var W=new s({data:x,size:b}),X=new s({data:A,size:D}),P=[];for(S=0,g=F.length;S<g;S++)P[F[S]]=S;return{L:W,U:X,p:P,toString:function(){return"L: "+this.L.toString()+`
|
||
U: `+this.U.toString()+`
|
||
P: `+this.p}}}function p(h){var y=h._size[0],E=h._size[1],g=Math.min(y,E),w=h._values,x=h._index,b=h._ptr,A=[],D=[],S=[],N=[y,g],B=[],F=[],$=[],q=[g,E],_,C,T,H=[],O=[];for(_=0;_<y;_++)H[_]=_,O[_]=_;var L=function(P,J){var ee=O[P],K=O[J];H[ee]=J,H[K]=P,O[P]=K,O[J]=ee},W=function(){var P=new v;C<y&&(S.push(A.length),A.push(1),D.push(C)),$.push(B.length);var J=b[C],ee=b[C+1];for(T=J;T<ee;T++)_=x[T],P.set(H[_],w[T]);C>0&&P.forEach(0,C-1,function(ie,re){m._forEachRow(ie,A,D,S,function(pe,Ae){pe>ie&&P.accumulate(pe,o(u(Ae,re)))})});var K=C,oe=P.get(C),se=a(oe);P.forEach(C+1,y-1,function(ie,re){var pe=a(re);c(pe,se)&&(K=ie,se=pe,oe=re)}),C!==K&&(m._swapRows(C,K,N[1],A,D,S),m._swapRows(C,K,q[1],B,F,$),P.swap(C,K),L(C,K)),P.forEach(0,y-1,function(ie,re){ie<=C?(B.push(re),F.push(ie)):(re=n(re,oe),l(re,0)||(A.push(re),D.push(ie)))})};for(C=0;C<E;C++)W();return $.push(B.length),S.push(A.length),{L:new m({values:A,index:D,ptr:S,size:N}),U:new m({values:B,index:F,ptr:$,size:q}),p:H,toString:function(){return"L: "+this.L.toString()+`
|
||
U: `+this.U.toString()+`
|
||
P: `+this.p}}}}),Jl="qr",DD=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],AD=I(Jl,DD,e=>{var{typed:r,matrix:i,zeros:a,identity:t,isZero:n,equal:u,sign:f,sqrt:c,conj:l,unaryMinus:o,addScalar:s,divideScalar:m,multiplyScalar:v,subtract:d,complex:p}=e;return wr(r(Jl,{DenseMatrix:function(w){return y(w)},SparseMatrix:function(w){return E()},Array:function(w){var x=i(w),b=y(x);return{Q:b.Q.valueOf(),R:b.R.valueOf()}}}),{_denseQRimpl:h});function h(g){var w=g._size[0],x=g._size[1],b=t([w],"dense"),A=b._data,D=g.clone(),S=D._data,N,B,F,$=a([w],"");for(F=0;F<Math.min(x,w);++F){var q=S[F][F],_=o(u(q,0)?1:f(q)),C=l(_),T=0;for(N=F;N<w;N++)T=s(T,v(S[N][F],l(S[N][F])));var H=v(_,c(T));if(!n(H)){var O=d(q,H);for($[F]=1,N=F+1;N<w;N++)$[N]=m(S[N][F],O);var L=o(l(m(O,H))),W=void 0;for(B=F;B<x;B++){for(W=0,N=F;N<w;N++)W=s(W,v(l($[N]),S[N][B]));for(W=v(W,L),N=F;N<w;N++)S[N][B]=v(d(S[N][B],v($[N],W)),C)}for(N=0;N<w;N++){for(W=0,B=F;B<w;B++)W=s(W,v(A[N][B],$[B]));for(W=v(W,L),B=F;B<w;++B)A[N][B]=m(d(A[N][B],v(W,l($[B]))),C)}}}return{Q:b,R:D,toString:function(){return"Q: "+this.Q.toString()+`
|
||
R: `+this.R.toString()}}}function y(g){var w=h(g),x=w.R._data;if(g._data.length>0)for(var b=x[0][0].type==="Complex"?p(0):0,A=0;A<x.length;++A)for(var D=0;D<A&&D<(x[0]||[]).length;++D)x[A][D]=b;return w}function E(g){throw new Error("qr not implemented for sparse matrices yet")}});function ED(e,r,i,a){for(var t=e._values,n=e._index,u=e._ptr,f=e._size,c=e._datatype,l=f[0],o=f[1],s=a&&e._values?[]:null,m=[],v=[],d=0,p=0;p<o;p++){v[p]=d;for(var h=i?i[p]:p,y=u[h],E=u[h+1],g=y;g<E;g++){var w=r?r[n[g]]:n[g];m[d]=w,s&&(s[d]=t[g]),d++}}return v[o]=d,e.createSparseMatrix({values:s,index:m,ptr:v,size:[l,o],datatype:c})}function Wm(e,r,i,a,t,n,u){var f=0;for(i[u]=e;f>=0;){var c=i[u+f],l=i[a+c];l===-1?(f--,n[r++]=c):(i[a+c]=i[t+l],++f,i[u+f]=l)}return r}function SD(e,r){if(!e)return null;var i=0,a,t=[],n=[],u=0,f=r,c=2*r;for(a=0;a<r;a++)n[u+a]=-1;for(a=r-1;a>=0;a--)e[a]!==-1&&(n[f+a]=n[u+e[a]],n[u+e[a]]=a);for(a=0;a<r;a++)e[a]===-1&&(i=Wm(a,i,n,u,f,t,c));return t}function CD(e,r){if(!e)return null;var i=e._index,a=e._ptr,t=e._size,n=t[0],u=t[1],f=[],c=[],l=0,o=u,s,m;if(r)for(s=0;s<n;s++)c[o+s]=-1;for(var v=0;v<u;v++){f[v]=-1,c[l+v]=-1;for(var d=a[v],p=a[v+1],h=d;h<p;h++){var y=i[h];for(s=r?c[o+y]:y;s!==-1&&s<v;s=m)m=c[l+s],c[l+s]=v,m===-1&&(f[s]=v);r&&(c[o+y]=v)}}return f}function MD(e,r,i){for(var a=e._values,t=e._index,n=e._ptr,u=e._size,f=u[1],c=0,l=0;l<f;l++){var o=n[l];for(n[l]=c;o<n[l+1];o++)r(t[o],l,a?a[o]:1,i)&&(t[c]=t[o],a&&(a[c]=a[o]),c++)}return n[f]=c,t.splice(c,t.length-c),a&&a.splice(c,a.length-c),c}function Ft(e){return-e-2}var FD="csAmd",BD=["add","multiply","transpose"],TD=I(FD,BD,e=>{var{add:r,multiply:i,transpose:a}=e;return function(o,s){if(!s||o<=0||o>3)return null;var m=s._size,v=m[0],d=m[1],p=0,h=Math.max(16,10*Math.sqrt(d));h=Math.min(d-2,h);var y=t(o,s,v,d,h);MD(y,c,null);for(var E=y._index,g=y._ptr,w=g[d],x=[],b=[],A=0,D=d+1,S=2*(d+1),N=3*(d+1),B=4*(d+1),F=5*(d+1),$=6*(d+1),q=7*(d+1),_=x,C=n(d,g,b,A,N,_,S,q,D,$,B,F),T=u(d,g,b,F,B,$,h,D,N,_,S),H=0,O,L,W,X,P,J,ee,K,oe,se,ie,re,pe,Ae,be,Ne;T<d;){for(W=-1;H<d&&(W=b[N+H])===-1;H++);b[S+W]!==-1&&(_[b[S+W]]=-1),b[N+H]=b[S+W];var U=b[B+W],G=b[D+W];T+=G;var te=0;b[D+W]=-G;var k=g[W],Y=U===0?k:w,j=Y;for(X=1;X<=U+1;X++){for(X>U?(J=W,ee=k,K=b[A+W]-U):(J=E[k++],ee=g[J],K=b[A+J]),P=1;P<=K;P++)O=E[ee++],!((oe=b[D+O])<=0)&&(te+=oe,b[D+O]=-oe,E[j++]=O,b[S+O]!==-1&&(_[b[S+O]]=_[O]),_[O]!==-1?b[S+_[O]]=b[S+O]:b[N+b[F+O]]=b[S+O]);J!==W&&(g[J]=Ft(W),b[$+J]=0)}for(U!==0&&(w=j),b[F+W]=te,g[W]=Y,b[A+W]=j-Y,b[B+W]=-2,C=f(C,p,b,$,d),se=Y;se<j;se++)if(O=E[se],!((ie=b[B+O])<=0)){oe=-b[D+O];var fe=C-oe;for(k=g[O],re=g[O]+ie-1;k<=re;k++)J=E[k],b[$+J]>=C?b[$+J]-=oe:b[$+J]!==0&&(b[$+J]=b[F+J]+fe)}for(se=Y;se<j;se++){for(O=E[se],re=g[O],pe=re+b[B+O]-1,Ae=re,be=0,Ne=0,k=re;k<=pe;k++)if(J=E[k],b[$+J]!==0){var ue=b[$+J]-C;ue>0?(Ne+=ue,E[Ae++]=J,be+=J):(g[J]=Ft(W),b[$+J]=0)}b[B+O]=Ae-re+1;var R=Ae,z=re+b[A+O];for(k=pe+1;k<z;k++){L=E[k];var Q=b[D+L];Q<=0||(Ne+=Q,E[Ae++]=L,be+=L)}Ne===0?(g[O]=Ft(W),oe=-b[D+O],te-=oe,G+=oe,T+=oe,b[D+O]=0,b[B+O]=-1):(b[F+O]=Math.min(b[F+O],Ne),E[Ae]=E[R],E[R]=E[re],E[re]=W,b[A+O]=Ae-re+1,be=(be<0?-be:be)%d,b[S+O]=b[q+be],b[q+be]=O,_[O]=be)}for(b[F+W]=te,p=Math.max(p,te),C=f(C+p,p,b,$,d),se=Y;se<j;se++)if(O=E[se],!(b[D+O]>=0))for(be=_[O],O=b[q+be],b[q+be]=-1;O!==-1&&b[S+O]!==-1;O=b[S+O],C++){for(K=b[A+O],ie=b[B+O],k=g[O]+1;k<=g[O]+K-1;k++)b[$+E[k]]=C;var ae=O;for(L=b[S+O];L!==-1;){var le=b[A+L]===K&&b[B+L]===ie;for(k=g[L]+1;le&&k<=g[L]+K-1;k++)b[$+E[k]]!==C&&(le=0);le?(g[L]=Ft(O),b[D+O]+=b[D+L],b[D+L]=0,b[B+L]=-1,L=b[S+L],b[S+ae]=L):(ae=L,L=b[S+L])}}for(k=Y,se=Y;se<j;se++)O=E[se],!((oe=-b[D+O])<=0)&&(b[D+O]=oe,Ne=b[F+O]+te-oe,Ne=Math.min(Ne,d-T-oe),b[N+Ne]!==-1&&(_[b[N+Ne]]=O),b[S+O]=b[N+Ne],_[O]=-1,b[N+Ne]=O,H=Math.min(H,Ne),b[F+O]=Ne,E[k++]=O);b[D+W]=G,(b[A+W]=k-Y)===0&&(g[W]=-1,b[$+W]=0),U!==0&&(w=k)}for(O=0;O<d;O++)g[O]=Ft(g[O]);for(L=0;L<=d;L++)b[N+L]=-1;for(L=d;L>=0;L--)b[D+L]>0||(b[S+L]=b[N+g[L]],b[N+g[L]]=L);for(J=d;J>=0;J--)b[D+J]<=0||g[J]!==-1&&(b[S+J]=b[N+g[J]],b[N+g[J]]=J);for(W=0,O=0;O<=d;O++)g[O]===-1&&(W=Wm(O,W,b,N,S,x,$));return x.splice(x.length-1,1),x};function t(l,o,s,m,v){var d=a(o);if(l===1&&m===s)return r(o,d);if(l===2){for(var p=d._index,h=d._ptr,y=0,E=0;E<s;E++){var g=h[E];if(h[E]=y,!(h[E+1]-g>v))for(var w=h[E+1];g<w;g++)p[y++]=p[g]}return h[s]=y,o=a(d),i(d,o)}return i(d,o)}function n(l,o,s,m,v,d,p,h,y,E,g,w){for(var x=0;x<l;x++)s[m+x]=o[x+1]-o[x];s[m+l]=0;for(var b=0;b<=l;b++)s[v+b]=-1,d[b]=-1,s[p+b]=-1,s[h+b]=-1,s[y+b]=1,s[E+b]=1,s[g+b]=0,s[w+b]=s[m+b];var A=f(0,0,s,E,l);return s[g+l]=-2,o[l]=-1,s[E+l]=0,A}function u(l,o,s,m,v,d,p,h,y,E,g){for(var w=0,x=0;x<l;x++){var b=s[m+x];if(b===0)s[v+x]=-2,w++,o[x]=-1,s[d+x]=0;else if(b>p)s[h+x]=0,s[v+x]=-1,w++,o[x]=Ft(l),s[h+l]++;else{var A=s[y+b];A!==-1&&(E[A]=x),s[g+x]=s[y+b],s[y+b]=x}}return w}function f(l,o,s,m,v){if(l<2||l+o<0){for(var d=0;d<v;d++)s[m+d]!==0&&(s[m+d]=1);l=2}return l}function c(l,o){return l!==o}});function OD(e,r,i,a,t,n,u){var f,c,l=0,o;if(e<=r||i[a+r]<=i[t+e])return-1;i[t+e]=i[a+r];var s=i[n+e];if(i[n+e]=r,s===-1)l=1,o=e;else{for(l=2,o=s;o!==i[u+o];o=i[u+o]);for(f=s;f!==o;f=c)c=i[u+f],i[u+f]=o}return{jleaf:l,q:o}}var $D="csCounts",_D=["transpose"],ID=I($D,_D,e=>{var{transpose:r}=e;return function(i,a,t,n){if(!i||!a||!t)return null;var u=i._size,f=u[0],c=u[1],l,o,s,m,v,d,p,h=4*c+(n?c+f+1:0),y=[],E=0,g=c,w=2*c,x=3*c,b=4*c,A=5*c+1;for(s=0;s<h;s++)y[s]=-1;var D=[],S=r(i),N=S._index,B=S._ptr;for(s=0;s<c;s++)for(o=t[s],D[o]=y[x+o]===-1?1:0;o!==-1&&y[x+o]===-1;o=a[o])y[x+o]=s;if(n){for(s=0;s<c;s++)y[t[s]]=s;for(l=0;l<f;l++){for(s=c,d=B[l],p=B[l+1],v=d;v<p;v++)s=Math.min(s,y[N[v]]);y[A+l]=y[b+s],y[b+s]=l}}for(l=0;l<c;l++)y[E+l]=l;for(s=0;s<c;s++){for(o=t[s],a[o]!==-1&&D[a[o]]--,m=n?y[b+s]:o;m!==-1;m=n?y[A+m]:-1)for(v=B[m];v<B[m+1];v++){l=N[v];var F=OD(l,o,y,x,g,w,E);F.jleaf>=1&&D[o]++,F.jleaf===2&&D[F.q]--}a[o]!==-1&&(y[E+o]=a[o])}for(o=0;o<c;o++)a[o]!==-1&&(D[a[o]]+=D[o]);return D}}),RD="csSqr",qD=["add","multiply","transpose"],zD=I(RD,qD,e=>{var{add:r,multiply:i,transpose:a}=e,t=TD({add:r,multiply:i,transpose:a}),n=ID({transpose:a});return function(c,l,o){var s=l._ptr,m=l._size,v=m[1],d,p={};if(p.q=t(c,l),c&&!p.q)return null;if(o){var h=c?ED(l,null,p.q,0):l;p.parent=CD(h,1);var y=SD(p.parent,v);if(p.cp=n(h,p.parent,y,1),h&&p.parent&&p.cp&&u(h,p))for(p.unz=0,d=0;d<v;d++)p.unz+=p.cp[d]}else p.unz=4*s[v]+v,p.lnz=p.unz;return p};function u(f,c){var l=f._ptr,o=f._index,s=f._size,m=s[0],v=s[1];c.pinv=[],c.leftmost=[];var d=c.parent,p=c.pinv,h=c.leftmost,y=[],E=0,g=m,w=m+v,x=m+2*v,b,A,D,S,N;for(A=0;A<v;A++)y[g+A]=-1,y[w+A]=-1,y[x+A]=0;for(b=0;b<m;b++)h[b]=-1;for(A=v-1;A>=0;A--)for(S=l[A],N=l[A+1],D=S;D<N;D++)h[o[D]]=A;for(b=m-1;b>=0;b--)p[b]=-1,A=h[b],A!==-1&&(y[x+A]++===0&&(y[w+A]=b),y[E+b]=y[g+A],y[g+A]=b);for(c.lnz=0,c.m2=m,A=0;A<v;A++)if(b=y[g+A],c.lnz++,b<0&&(b=c.m2++),p[b]=A,!(--x[A]<=0)){c.lnz+=y[x+A];var B=d[A];B!==-1&&(y[x+B]===0&&(y[w+B]=y[w+A]),y[E+y[w+A]]=y[g+B],y[g+B]=y[E+b],y[x+B]+=y[x+A])}for(b=0;b<m;b++)p[b]<0&&(p[b]=A++);return!0}});function Li(e,r){return e[r]<0}function Xm(e,r){e[r]=Ft(e[r])}function Ql(e){return e<0?Ft(e):e}function PD(e,r,i,a,t){var n=r._index,u=r._ptr,f=r._size,c=f[1],l,o,s,m=0;for(a[0]=e;m>=0;){e=a[m];var v=t?t[e]:e;Li(u,e)||(Xm(u,e),a[c+m]=v<0?0:Ql(u[v]));var d=1;for(o=a[c+m],s=v<0?0:Ql(u[v+1]);o<s;o++)if(l=n[o],!Li(u,l)){a[c+m]=o,a[++m]=l,d=0;break}d&&(m--,a[--i]=e)}return i}function UD(e,r,i,a,t){var n=e._ptr,u=e._size,f=r._index,c=r._ptr,l=u[1],o,s,m,v=l;for(s=c[i],m=c[i+1],o=s;o<m;o++){var d=f[o];Li(n,d)||(v=PD(d,e,v,a,t))}for(o=v;o<l;o++)Xm(n,a[o]);return v}var LD="csSpsolve",kD=["divideScalar","multiply","subtract"],HD=I(LD,kD,e=>{var{divideScalar:r,multiply:i,subtract:a}=e;return function(n,u,f,c,l,o,s){var m=n._values,v=n._index,d=n._ptr,p=n._size,h=p[1],y=u._values,E=u._index,g=u._ptr,w,x,b,A,D=UD(n,u,f,c,o);for(w=D;w<h;w++)l[c[w]]=0;for(x=g[f],b=g[f+1],w=x;w<b;w++)l[E[w]]=y[w];for(var S=D;S<h;S++){var N=c[S],B=o?o[N]:N;if(!(B<0))for(x=d[B],b=d[B+1],l[N]=r(l[N],m[s?x:b-1]),w=s?x+1:x,A=s?b:b-1;w<A;w++){var F=v[w];l[F]=a(l[F],i(m[w],l[N]))}}return D}}),GD="csLu",VD=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],ZD=I(GD,VD,e=>{var{abs:r,divideScalar:i,multiply:a,subtract:t,larger:n,largerEq:u,SparseMatrix:f}=e,c=HD({divideScalar:i,multiply:a,subtract:t});return function(o,s,m){if(!o)return null;var v=o._size,d=v[1],p,h=100,y=100;s&&(p=s.q,h=s.lnz||h,y=s.unz||y);var E=[],g=[],w=[],x=new f({values:E,index:g,ptr:w,size:[d,d]}),b=[],A=[],D=[],S=new f({values:b,index:A,ptr:D,size:[d,d]}),N=[],B,F,$=[],q=[];for(B=0;B<d;B++)$[B]=0,N[B]=-1,w[B+1]=0;h=0,y=0;for(var _=0;_<d;_++){w[_]=h,D[_]=y;var C=p?p[_]:_,T=c(x,o,C,q,$,N,1),H=-1,O=-1;for(F=T;F<d;F++)if(B=q[F],N[B]<0){var L=r($[B]);n(L,O)&&(O=L,H=B)}else A[y]=N[B],b[y++]=$[B];if(H===-1||O<=0)return null;N[C]<0&&u(r($[C]),a(O,m))&&(H=C);var W=$[H];for(A[y]=_,b[y++]=W,N[H]=_,g[h]=H,E[h++]=1,F=T;F<d;F++)B=q[F],N[B]<0&&(g[h]=B,E[h++]=i($[B],W)),$[B]=0}for(w[d]=h,D[d]=y,F=0;F<h;F++)g[F]=N[g[F]];return E.splice(h,E.length-h),g.splice(h,g.length-h),b.splice(y,b.length-y),A.splice(y,A.length-y),{L:x,U:S,pinv:N}}}),Kl="slu",YD=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],WD=I(Kl,YD,e=>{var{typed:r,abs:i,add:a,multiply:t,transpose:n,divideScalar:u,subtract:f,larger:c,largerEq:l,SparseMatrix:o}=e,s=zD({add:a,multiply:t,transpose:n}),m=ZD({abs:i,divideScalar:u,multiply:t,subtract:f,larger:c,largerEq:l,SparseMatrix:o});return r(Kl,{"SparseMatrix, number, number":function(d,p,h){if(!Ce(p)||p<0||p>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(h<0||h>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var y=s(p,d,!1),E=m(d,y,h);return{L:E.L,U:E.U,p:E.pinv,q:y.q,toString:function(){return"L: "+this.L.toString()+`
|
||
U: `+this.U.toString()+`
|
||
p: `+this.p.toString()+(this.q?`
|
||
q: `+this.q.toString():"")+`
|
||
`}}}})});function jl(e,r){var i,a=r.length,t=[];if(e)for(i=0;i<a;i++)t[e[i]]=r[i];else for(i=0;i<a;i++)t[i]=r[i];return t}var ec="lusolve",XD=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],JD=I(ec,XD,e=>{var{typed:r,matrix:i,lup:a,slu:t,usolve:n,lsolve:u,DenseMatrix:f}=e,c=jn({DenseMatrix:f});return r(ec,{"Array, Array | Matrix":function(m,v){m=i(m);var d=a(m),p=o(d.L,d.U,d.p,null,v);return p.valueOf()},"DenseMatrix, Array | Matrix":function(m,v){var d=a(m);return o(d.L,d.U,d.p,null,v)},"SparseMatrix, Array | Matrix":function(m,v){var d=a(m);return o(d.L,d.U,d.p,null,v)},"SparseMatrix, Array | Matrix, number, number":function(m,v,d,p){var h=t(m,d,p);return o(h.L,h.U,h.p,h.q,v)},"Object, Array | Matrix":function(m,v){return o(m.L,m.U,m.p,m.q,v)}});function l(s){if(Be(s))return s;if(je(s))return i(s);throw new TypeError("Invalid Matrix LU decomposition")}function o(s,m,v,d,p){s=l(s),m=l(m),v&&(p=c(s,p,!0),p._data=jl(v,p._data));var h=u(s,p),y=n(m,h);return d&&(y._data=jl(d,y._data)),y}}),rc="polynomialRoot",QD=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],KD=I(rc,QD,e=>{var{typed:r,isZero:i,equalScalar:a,add:t,subtract:n,multiply:u,divide:f,sqrt:c,unaryMinus:l,cbrt:o,typeOf:s,im:m,re:v}=e;return r(rc,{"number|Complex, ...number|Complex":(d,p)=>{for(var h=[d,...p];h.length>0&&i(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(p,"] must have a non-zero non-constant coefficient"));switch(h.length){case 2:return[l(f(h[0],h[1]))];case 3:{var[y,E,g]=h,w=u(2,g),x=u(E,E),b=u(4,g,y);if(a(x,b))return[f(l(E),w)];var A=c(n(x,b));return[f(n(A,E),w),f(n(l(A),E),w)]}case 4:{var[D,S,N,B]=h,F=l(u(3,B)),$=u(N,N),q=u(3,B,S),_=t(u(2,N,N,N),u(27,B,B,D)),C=u(9,B,N,S);if(a($,q)&&a(_,C))return[f(N,F)];var T=n($,q),H=n(_,C),O=t(u(18,B,N,S,D),u(N,N,S,S)),L=t(u(4,N,N,N,D),u(4,B,S,S,S),u(27,B,B,D,D));if(a(O,L))return[f(n(u(4,B,N,S),t(u(9,B,B,D),u(N,N,N))),u(B,T)),f(n(u(9,B,D),u(N,S)),u(2,T))];var W;a($,q)?W=H:W=f(t(H,c(n(u(H,H),u(4,T,T,T)))),2);var X=!0,P=o(W,X).toArray().map(J=>f(t(N,J,f(T,J)),F));return P.map(J=>s(J)==="Complex"&&a(v(J),v(J)+m(J))?v(J):J)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(h))}}})}),jD="Help",eA=["parse"],rA=I(jD,eA,e=>{var{parse:r}=e;function i(a){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!a)throw new Error('Argument "doc" missing');this.doc=a}return i.prototype.type="Help",i.prototype.isHelp=!0,i.prototype.toString=function(){var a=this.doc||{},t=`
|
||
`;if(a.name&&(t+="Name: "+a.name+`
|
||
|
||
`),a.category&&(t+="Category: "+a.category+`
|
||
|
||
`),a.description&&(t+=`Description:
|
||
`+a.description+`
|
||
|
||
`),a.syntax&&(t+=`Syntax:
|
||
`+a.syntax.join(`
|
||
`)+`
|
||
|
||
`),a.examples){t+=`Examples:
|
||
`;for(var n={},u=0;u<a.examples.length;u++){var f=a.examples[u];t+=" "+f+`
|
||
`;var c=void 0;try{c=r(f).compile().evaluate(n)}catch(l){c=l}c!==void 0&&!nf(c)&&(t+=" "+Pe(c,{precision:14})+`
|
||
`)}t+=`
|
||
`}return a.mayThrow&&a.mayThrow.length&&(t+="Throws: "+a.mayThrow.join(", ")+`
|
||
|
||
`),a.seealso&&a.seealso.length&&(t+="See also: "+a.seealso.join(", ")+`
|
||
`),t},i.prototype.toJSON=function(){var a=$e(this.doc);return a.mathjs="Help",a},i.fromJSON=function(a){var t={};return Object.keys(a).filter(n=>n!=="mathjs").forEach(n=>{t[n]=a[n]}),new i(t)},i.prototype.valueOf=i.prototype.toString,i},{isClass:!0}),tA="Chain",nA=["?on","math","typed"],aA=I(tA,nA,e=>{var{on:r,math:i,typed:a}=e;function t(l){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");af(l)?this.value=l.value:this.value=l}t.prototype.type="Chain",t.prototype.isChain=!0,t.prototype.done=function(){return this.value},t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return Pe(this.value)},t.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},t.fromJSON=function(l){return new t(l.value)};function n(l,o){typeof o=="function"&&(t.prototype[l]=f(o))}function u(l,o){ed(t.prototype,l,function(){var m=o();if(typeof m=="function")return f(m)})}function f(l){return function(){if(arguments.length===0)return new t(l(this.value));for(var o=[this.value],s=0;s<arguments.length;s++)o[s+1]=arguments[s];if(a.isTypedFunction(l)){var m=a.resolve(l,o);if(m.params.length===1)throw new Error("chain function "+l.name+" cannot match rest parameter between chain value and additional arguments.");return new t(m.implementation.apply(l,o))}return new t(l.apply(l,o))}}t.createProxy=function(l,o){if(typeof l=="string")n(l,o);else{var s=function(d){Ee(l,d)&&c[d]===void 0&&u(d,()=>l[d])};for(var m in l)s(m)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return t.createProxy(i),r&&r("import",function(l,o,s){s||u(l,o)}),t},{isClass:!0}),tc={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},iA={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},oA={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},uA={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},sA={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},lA={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},cA={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},fA={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},mA={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},vA={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pA={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},nc={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},dA={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},hA={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},gA={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},yA={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},bA={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},xA={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},wA={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},NA={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},DA={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},AA={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},EA={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},SA={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},CA={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},MA={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},FA={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},BA={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},TA={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},OA={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},$A={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},_A={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},IA={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},RA={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},qA={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},zA={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},PA={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},UA={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},LA={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},kA={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},HA={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},GA={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},VA={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},ZA={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},YA={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},WA={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},XA={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},JA={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},QA={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},KA={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},jA={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},eE={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},rE={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},tE={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},nE={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},aE={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},iE={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},oE={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},uE={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},sE={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},lE={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},cE={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},fE={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},mE={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},vE={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},pE={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},dE={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},hE={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},gE={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},yE={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},bE={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},xE={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},wE={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},NE={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},DE={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},AE={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},EE={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},SE={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},CE={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},ME={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]},FE={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},BE={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},TE={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},OE={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},$E={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},_E={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},IE={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},RE={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},qE={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]},zE={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},PE={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},UE={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},LE={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},kE={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},HE={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},GE={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},VE={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},ZE={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},YE={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},WE={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},XE={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},JE={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},QE={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},KE={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},jE={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]},eS={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},rS={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},tS={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},nS={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},aS={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},iS={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},oS={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},uS={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},sS={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},lS={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},cS={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},fS={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},mS={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},vS={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pS={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dS={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},hS={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],seealso:["inv"]},gS={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},yS={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},bS={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},xS={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},wS={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},NS={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},DS={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},AS={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},ES={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},SS={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},CS={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},MS={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},FS={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},BS={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},TS={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},OS={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},$S={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},_S={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},IS={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},RS={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},qS={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},zS={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},PS={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},US={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},LS={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},kS={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},HS={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},GS={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},VS={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},ZS={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},YS={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},WS={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},XS={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},JS={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},QS={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},KS={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},jS={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},eC={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},rC={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},tC={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},nC={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},aC={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},iC={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},oC={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},uC={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},sC={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},lC={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},cC={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},fC={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},mC={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},vC={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},pC={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},dC={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},hC={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},gC={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},yC={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},bC={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},xC={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},wC={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},NC={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},DC={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},AC={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},EC={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},SC={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},CC={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},MC={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},FC={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},BC={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},TC={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},OC={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},$C={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},_C={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
|
||
|
||
In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},IC={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},RC={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},qC={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},zC={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},PC={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},UC={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},LC={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},kC={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},HC={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},GC={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},VC={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},ZC={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},YC={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},WC={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},XC={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},JC={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},QC={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},KC={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},jC={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},eM={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},rM={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},tM={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},nM={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},aM={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},iM={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},oM={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},uM={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},sM={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},lM={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},cM={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},fM={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},mM={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},vM={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},pM={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},dM={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},hM={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},gM={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},yM={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},bM={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},xM={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},wM={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},NM={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},DM={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]},AM={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},EM={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $0, $1, $2", [6, 9, 4])'],seealso:["format"]},SM={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},CM={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},MM={bignumber:xA,boolean:wA,complex:NA,createUnit:DA,fraction:AA,index:EA,matrix:SA,number:CA,sparse:MA,splitUnit:FA,string:BA,unit:TA,e:tc,E:tc,false:iA,i:oA,Infinity:uA,LN2:lA,LN10:sA,LOG2E:fA,LOG10E:cA,NaN:mA,null:vA,pi:nc,PI:nc,phi:pA,SQRT1_2:dA,SQRT2:hA,tau:gA,true:yA,version:bA,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:IA,lsolve:qA,lsolveAll:zA,lup:PA,lusolve:UA,leafCount:RA,polynomialRoot:LA,resolve:GA,simplify:VA,simplifyConstant:ZA,simplifyCore:YA,symbolicEqual:XA,rationalize:HA,slu:WA,usolve:JA,usolveAll:QA,qr:kA,abs:KA,add:jA,cbrt:eE,ceil:rE,cube:tE,divide:nE,dotDivide:aE,dotMultiply:iE,dotPow:oE,exp:uE,expm:sE,expm1:lE,fix:cE,floor:fE,gcd:mE,hypot:vE,lcm:dE,log:hE,log2:bE,log1p:yE,log10:gE,mod:xE,multiply:wE,norm:NE,nthRoot:DE,nthRoots:AE,pow:EE,round:SE,sign:CE,sqrt:ME,sqrtm:FE,square:$E,subtract:_E,unaryMinus:IE,unaryPlus:RE,xgcd:qE,invmod:pE,bitAnd:zE,bitNot:PE,bitOr:UE,bitXor:LE,leftShift:kE,rightArithShift:HE,rightLogShift:GE,bellNumbers:VE,catalan:ZE,composition:YE,stirlingS2:WE,config:OA,import:$A,typed:_A,arg:XE,conj:JE,re:KE,im:QE,evaluate:jE,help:eS,distance:rS,intersect:tS,and:nS,not:aS,or:iS,xor:oS,concat:sS,count:lS,cross:cS,column:uS,ctranspose:fS,det:mS,diag:vS,diff:pS,dot:dS,getMatrixDataType:xS,identity:wS,filter:gS,flatten:yS,forEach:bS,inv:NS,pinv:DS,eigs:hS,kron:AS,matrixFromFunction:CS,matrixFromRows:MS,matrixFromColumns:SS,map:ES,ones:FS,partitionSelect:BS,range:TS,resize:$S,reshape:OS,rotate:_S,rotationMatrix:IS,row:RS,size:qS,sort:zS,squeeze:PS,subset:US,trace:LS,transpose:kS,zeros:HS,fft:GS,ifft:VS,sylvester:BE,schur:TE,lyap:OE,solveODE:CM,combinations:ZS,combinationsWithRep:YS,factorial:WS,gamma:XS,kldivergence:QS,lgamma:JS,multinomial:KS,permutations:jS,pickRandom:eC,random:rC,randomInt:tC,compare:nC,compareNatural:aC,compareText:iC,deepEqual:oC,equal:uC,equalText:sC,larger:lC,largerEq:cC,smaller:fC,smallerEq:mC,unequal:vC,setCartesian:pC,setDifference:dC,setDistinct:hC,setIntersect:gC,setIsSubset:yC,setMultiplicity:bC,setPowerset:xC,setSize:wC,setSymDifference:NC,setUnion:DC,zpk2tf:AC,freqz:EC,erf:SC,cumsum:RC,mad:CC,max:MC,mean:FC,median:BC,min:TC,mode:OC,prod:$C,quantileSeq:_C,std:IC,sum:qC,variance:zC,acos:PC,acosh:UC,acot:LC,acoth:kC,acsc:HC,acsch:GC,asec:VC,asech:ZC,asin:YC,asinh:WC,atan:XC,atanh:QC,atan2:JC,cos:KC,cosh:jC,cot:eM,coth:rM,csc:tM,csch:nM,sec:aM,sech:iM,sin:oM,sinh:uM,tan:sM,tanh:lM,to:cM,clone:mM,format:vM,bin:fM,oct:AM,hex:dM,isNaN:gM,isInteger:hM,isNegative:yM,isNumeric:bM,hasNumericValue:pM,isPositive:xM,isPrime:wM,isZero:NM,print:EM,typeOf:SM,numeric:DM},ac="help",FM=["typed","mathWithTransform","Help"],BM=I(ac,FM,e=>{var{typed:r,mathWithTransform:i,Help:a}=e;return r(ac,{any:function(n){var u,f=n;if(typeof n!="string"){for(u in i)if(Ee(i,u)&&n===i[u]){f=u;break}}var c=Tr(MM,f);if(!c){var l=typeof f=="function"?f.name:f;throw new Error('No documentation found on "'+l+'"')}return new a(c)}})}),ic="chain",TM=["typed","Chain"],OM=I(ic,TM,e=>{var{typed:r,Chain:i}=e;return r(ic,{"":function(){return new i},any:function(t){return new i(t)}})}),oc="det",$M=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],_M=I(oc,$M,e=>{var{typed:r,matrix:i,subtract:a,multiply:t,divideScalar:n,isZero:u,unaryMinus:f}=e;return r(oc,{any:function(o){return $e(o)},"Array | Matrix":function(o){var s;switch(Be(o)?s=o.size():Array.isArray(o)?(o=i(o),s=o.size()):s=[],s.length){case 0:return $e(o);case 1:if(s[0]===1)return $e(o.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Pe(s)+")");case 2:{var m=s[0],v=s[1];if(m===v)return c(o.clone().valueOf(),m);if(v===0)return 1;throw new RangeError("Matrix must be square (size: "+Pe(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pe(s)+")")}}});function c(l,o,s){if(o===1)return $e(l[0][0]);if(o===2)return a(t(l[0][0],l[1][1]),t(l[1][0],l[0][1]));for(var m=!1,v=new Array(o).fill(0).map((A,D)=>D),d=0;d<o;d++){var p=v[d];if(u(l[p][d])){var h=void 0;for(h=d+1;h<o;h++)if(!u(l[v[h]][d])){p=v[h],v[h]=v[d],v[d]=p,m=!m;break}if(h===o)return l[p][d]}for(var y=l[p][d],E=d===0?1:l[v[d-1]][d-1],g=d+1;g<o;g++)for(var w=v[g],x=d+1;x<o;x++)l[w][x]=n(a(t(l[w][x],y),t(l[w][d],l[p][x])),E)}var b=l[v[o-1]][o-1];return m?f(b):b}}),uc="inv",IM=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],RM=I(uc,IM,e=>{var{typed:r,matrix:i,divideScalar:a,addScalar:t,multiply:n,unaryMinus:u,det:f,identity:c,abs:l}=e;return r(uc,{"Array | Matrix":function(m){var v=Be(m)?m.size():Ge(m);switch(v.length){case 1:if(v[0]===1)return Be(m)?i([a(1,m.valueOf()[0])]):[a(1,m[0])];throw new RangeError("Matrix must be square (size: "+Pe(v)+")");case 2:{var d=v[0],p=v[1];if(d===p)return Be(m)?i(o(m.valueOf(),d,p),m.storage()):o(m,d,p);throw new RangeError("Matrix must be square (size: "+Pe(v)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Pe(v)+")")}},any:function(m){return a(1,m)}});function o(s,m,v){var d,p,h,y,E;if(m===1){if(y=s[0][0],y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[a(1,y)]]}else if(m===2){var g=f(s);if(g===0)throw Error("Cannot calculate inverse, determinant is zero");return[[a(s[1][1],g),a(u(s[0][1]),g)],[a(u(s[1][0]),g),a(s[0][0],g)]]}else{var w=s.concat();for(d=0;d<m;d++)w[d]=w[d].concat();for(var x=c(m).valueOf(),b=0;b<v;b++){var A=l(w[b][b]),D=b;for(d=b+1;d<m;)l(w[d][b])>A&&(A=l(w[d][b]),D=d),d++;if(A===0)throw Error("Cannot calculate inverse, determinant is zero");d=D,d!==b&&(E=w[b],w[b]=w[d],w[d]=E,E=x[b],x[b]=x[d],x[d]=E);var S=w[b],N=x[b];for(d=0;d<m;d++){var B=w[d],F=x[d];if(d!==b){if(B[b]!==0){for(h=a(u(B[b]),S[b]),p=b;p<v;p++)B[p]=t(B[p],n(h,S[p]));for(p=0;p<v;p++)F[p]=t(F[p],n(h,N[p]))}}else{for(h=S[b],p=b;p<v;p++)B[p]=a(B[p],h);for(p=0;p<v;p++)F[p]=a(F[p],h)}}}return x}}}),sc="pinv",qM=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],zM=I(sc,qM,e=>{var{typed:r,matrix:i,inv:a,deepEqual:t,equal:n,dotDivide:u,dot:f,ctranspose:c,divideScalar:l,multiply:o,add:s,Complex:m}=e;return r(sc,{"Array | Matrix":function(g){var w=Be(g)?g.size():Ge(g);switch(w.length){case 1:return y(g)?c(g):w[0]===1?a(g):u(c(g),f(g,g));case 2:{if(y(g))return c(g);var x=w[0],b=w[1];if(x===b)try{return a(g)}catch(A){if(!(A instanceof Error&&A.message.match(/Cannot calculate inverse, determinant is zero/)))throw A}return Be(g)?i(v(g.valueOf(),x,b),g.storage()):v(g,x,b)}default:throw new RangeError("Matrix must be two dimensional (size: "+Pe(w)+")")}},any:function(g){return n(g,0)?$e(g):l(1,g)}});function v(E,g,w){var{C:x,F:b}=p(E,g,w),A=o(a(o(c(x),x)),c(x)),D=o(c(b),a(o(b,c(b))));return o(D,A)}function d(E,g,w){for(var x=$e(E),b=0,A=0;A<g;A++){if(w<=b)return x;for(var D=A;h(x[D][b]);)if(D++,g===D&&(D=A,b++,w===b))return x;[x[D],x[A]]=[x[A],x[D]];for(var S=x[A][b],N=0;N<w;N++)x[A][N]=u(x[A][N],S);for(var B=0;B<g;B++)if(B!==A){S=x[B][b];for(var F=0;F<w;F++)x[B][F]=s(x[B][F],o(-1,o(S,x[A][F])))}b++}return x}function p(E,g,w){var x=d(E,g,w),b=E.map((D,S)=>D.filter((N,B)=>B<g&&!h(f(x[B],x[B])))),A=x.filter((D,S)=>!h(f(x[S],x[S])));return{C:b,F:A}}function h(E){return n(s(E,m(1,1)),s(0,m(1,1)))}function y(E){return t(s(E,m(1,1)),s(o(E,0),m(1,1)))}});function PM(e){var{addScalar:r,subtract:i,flatten:a,multiply:t,multiplyScalar:n,divideScalar:u,sqrt:f,abs:c,bignumber:l,diag:o,inv:s,qr:m,usolve:v,usolveAll:d,equal:p,complex:h,larger:y,smaller:E,matrixFromColumns:g,dot:w}=e;function x(L,W,X,P,J){J===void 0&&(J=!0);var ee=b(L,W,X,P,J);A(L,W,X,P,J,ee);var{values:K,C:oe}=D(L,W,X,P,J),se;return J&&(se=S(L,W,oe,ee,K,X,P),se=g(...se)),{values:K,vectors:se}}function b(L,W,X,P,J){var ee=P==="BigNumber",K=P==="Complex",oe=ee?l(0):0,se=ee?l(1):K?h(1):1,ie=ee?l(1):1,re=ee?l(10):2,pe=n(re,re),Ae;J&&(Ae=Array(W).fill(se));for(var be=!1;!be;){be=!0;for(var Ne=0;Ne<W;Ne++){for(var U=oe,G=oe,te=0;te<W;te++)if(Ne!==te){var k=c(L[Ne][te]);U=r(U,k),G=r(G,k)}if(!p(U,0)&&!p(G,0)){for(var Y=ie,j=U,fe=u(G,re),ue=n(G,re);E(j,fe);)j=n(j,pe),Y=n(Y,re);for(;y(j,ue);)j=u(j,pe),Y=u(Y,re);var R=E(u(r(j,G),Y),n(r(U,G),.95));if(R){be=!1;for(var z=u(1,Y),Q=0;Q<W;Q++)Ne!==Q&&(L[Ne][Q]=n(L[Ne][Q],Y),L[Q][Ne]=n(L[Q][Ne],z));J&&(Ae[Ne]=n(Ae[Ne],Y))}}}}return o(Ae)}function A(L,W,X,P,J,ee){var K=P==="BigNumber",oe=P==="Complex",se=K?l(0):oe?h(0):0;K&&(X=l(X));for(var ie=0;ie<W-2;ie++){for(var re=0,pe=se,Ae=ie+1;Ae<W;Ae++){var be=L[Ae][ie];E(c(pe),c(be))&&(pe=be,re=Ae)}if(!E(c(pe),X)){if(re!==ie+1){var Ne=L[re];L[re]=L[ie+1],L[ie+1]=Ne;for(var U=0;U<W;U++){var G=L[U][re];L[U][re]=L[U][ie+1],L[U][ie+1]=G}if(J){var te=ee[re];ee[re]=ee[ie+1],ee[ie+1]=te}}for(var k=ie+2;k<W;k++){var Y=u(L[k][ie],pe);if(Y!==0){for(var j=0;j<W;j++)L[k][j]=i(L[k][j],n(Y,L[ie+1][j]));for(var fe=0;fe<W;fe++)L[fe][ie+1]=r(L[fe][ie+1],n(Y,L[fe][k]));if(J)for(var ue=0;ue<W;ue++)ee[k][ue]=i(ee[k][ue],n(Y,ee[ie+1][ue]))}}}}return ee}function D(L,W,X,P,J){var ee=P==="BigNumber",K=P==="Complex",oe=ee?l(1):K?h(1):1;ee&&(X=l(X));for(var se=$e(L),ie=[],re=W,pe=[],Ae=J?o(Array(W).fill(oe)):void 0,be=J?o(Array(re).fill(oe)):void 0,Ne=0;Ne<=100;){Ne+=1;for(var U=0,G=0;G<re;G++)se[G][G]=i(se[G][G],U);var{Q:te,R:k}=m(se);se=t(k,te);for(var Y=0;Y<re;Y++)se[Y][Y]=r(se[Y][Y],U);if(J&&(be=t(be,te)),re===1||E(c(se[re-1][re-2]),X)){Ne=0,ie.push(se[re-1][re-1]),J&&(pe.unshift([[1]]),F(be,W),Ae=t(Ae,be),re>1&&(be=o(Array(re-1).fill(oe)))),re-=1,se.pop();for(var j=0;j<re;j++)se[j].pop()}else if(re===2||E(c(se[re-2][re-3]),X)){Ne=0;var fe=N(se[re-2][re-2],se[re-2][re-1],se[re-1][re-2],se[re-1][re-1]);ie.push(...fe),J&&(pe.unshift(B(se[re-2][re-2],se[re-2][re-1],se[re-1][re-2],se[re-1][re-1],fe[0],fe[1],X,P)),F(be,W),Ae=t(Ae,be),re>2&&(be=o(Array(re-2).fill(oe)))),re-=2,se.pop(),se.pop();for(var ue=0;ue<re;ue++)se[ue].pop(),se[ue].pop()}if(re===0)break}if(ie.sort((Q,ae)=>+i(c(Q),c(ae))),Ne>100){var R=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+ie.join(", "));throw R.values=ie,R.vectors=[],R}var z=J?t(Ae,$(pe,W)):void 0;return{values:ie,C:z}}function S(L,W,X,P,J,ee,K){var oe=s(X),se=t(oe,L,X),ie=K==="BigNumber",re=K==="Complex",pe=ie?l(0):re?h(0):0,Ae=ie?l(1):re?h(1):1,be=[],Ne=[];for(var U of J){var G=q(be,U,p);G===-1?(be.push(U),Ne.push(1)):Ne[G]+=1}for(var te=[],k=be.length,Y=Array(W).fill(pe),j=o(Array(W).fill(Ae)),fe=[],ue=function(){var ae=be[R],le=i(se,t(ae,j)),ve=d(le,Y);for(ve.shift();ve.length<Ne[R];){var de=_(le,W,ve,ee,K);if(de==null){fe.push(ae);break}ve.push(de)}var ce=t(s(P),X);ve=ve.map(ge=>t(ce,ge)),te.push(...ve.map(ge=>a(ge)))},R=0;R<k;R++)ue();if(fe.length!==0){var z=new Error("Failed to find eigenvectors for the following eigenvalues: "+fe.join(", "));throw z.values=J,z.vectors=te,z}return te}function N(L,W,X,P){var J=r(L,P),ee=i(n(L,P),n(W,X)),K=n(J,.5),oe=n(f(i(n(J,J),n(4,ee))),.5);return[r(K,oe),i(K,oe)]}function B(L,W,X,P,J,ee,K,oe){var se=oe==="BigNumber",ie=oe==="Complex",re=se?l(0):ie?h(0):0,pe=se?l(1):ie?h(1):1;if(E(c(X),K))return[[pe,re],[re,pe]];if(y(c(i(J,ee)),K))return[[i(J,P),i(ee,P)],[X,X]];var Ae=i(L,J),be=i(W,J),Ne=i(X,J),U=i(P,J);return E(c(be),K)?[[Ae,pe],[Ne,re]]:[[be,re],[U,pe]]}function F(L,W){for(var X=0;X<L.length;X++)L[X].push(...Array(W-L[X].length).fill(0));for(var P=L.length;P<W;P++)L.push(Array(W).fill(0)),L[P][P]=1;return L}function $(L,W){for(var X=[],P=0;P<W;P++)X[P]=Array(W).fill(0);var J=0;for(var ee of L){for(var K=ee.length,oe=0;oe<K;oe++)for(var se=0;se<K;se++)X[J+oe][J+se]=ee[oe][se];J+=K}return X}function q(L,W,X){for(var P=0;P<L.length;P++)if(X(L[P],W))return P;return-1}function _(L,W,X,P,J){for(var ee=J==="BigNumber"?l(1e3):1e3,K,oe=0;K=C(W,X,J),K=v(L,K),!y(H(K),ee);)if(++oe>=5)return null;for(oe=0;;){var se=v(L,K);if(E(H(T(K,[se])),P))break;if(++oe>=10)return null;K=O(se)}return K}function C(L,W,X){var P=X==="BigNumber",J=X==="Complex",ee=Array(L).fill(0).map(K=>2*Math.random()-1);return P&&(ee=ee.map(K=>l(K))),J&&(ee=ee.map(K=>h(K))),ee=T(ee,W),O(ee,X)}function T(L,W){for(var X of W)L=i(L,t(u(w(X,L),w(X,X)),X));return L}function H(L){return c(f(w(L,L)))}function O(L,W){var X=W==="BigNumber",P=W==="Complex",J=X?l(1):P?h(1):1;return t(u(J,H(L)),L)}return x}function UM(e){var{config:r,addScalar:i,subtract:a,abs:t,atan:n,cos:u,sin:f,multiplyScalar:c,inv:l,bignumber:o,multiply:s,add:m}=e;function v(N,B){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.epsilon,$=arguments.length>3?arguments[3]:void 0;if($==="number")return d(N,F);if($==="BigNumber")return p(N,F);throw TypeError("Unsupported data type: "+$)}function d(N,B){for(var F=N.length,$=Math.abs(B/F),q,_=new Array(F),C=0;C<F;C++)_[C]=S(F,0),_[C][C]=1;for(var T=b(N);Math.abs(T[1])>=Math.abs($);){var H=T[0][0],O=T[0][1];q=h(N[H][H],N[O][O],N[H][O]),N=x(N,q,H,O),_=E(_,q,H,O),T=b(N)}for(var L=S(F,0),W=0;W<F;W++)L[W]=N[W][W];return D($e(L),$e(_))}function p(N,B){for(var F=N.length,$=t(B/F),q,_=new Array(F),C=0;C<F;C++)_[C]=S(F,0),_[C][C]=1;for(var T=A(N);t(T[1])>=t($);){var H=T[0][0],O=T[0][1];q=y(N[H][H],N[O][O],N[H][O]),N=w(N,q,H,O),_=g(_,q,H,O),T=A(N)}for(var L=S(F,0),W=0;W<F;W++)L[W]=N[W][W];return D($e(L),$e(_))}function h(N,B,F){var $=B-N;return Math.abs($)<=r.epsilon?Math.PI/4:.5*Math.atan(2*F/(B-N))}function y(N,B,F){var $=a(B,N);return t($)<=r.epsilon?o(-1).acos().div(4):c(.5,n(s(2,F,l($))))}function E(N,B,F,$){for(var q=N.length,_=Math.cos(B),C=Math.sin(B),T=S(q,0),H=S(q,0),O=0;O<q;O++)T[O]=_*N[O][F]-C*N[O][$],H[O]=C*N[O][F]+_*N[O][$];for(var L=0;L<q;L++)N[L][F]=T[L],N[L][$]=H[L];return N}function g(N,B,F,$){for(var q=N.length,_=u(B),C=f(B),T=S(q,o(0)),H=S(q,o(0)),O=0;O<q;O++)T[O]=a(c(_,N[O][F]),c(C,N[O][$])),H[O]=i(c(C,N[O][F]),c(_,N[O][$]));for(var L=0;L<q;L++)N[L][F]=T[L],N[L][$]=H[L];return N}function w(N,B,F,$){for(var q=N.length,_=o(u(B)),C=o(f(B)),T=c(_,_),H=c(C,C),O=S(q,o(0)),L=S(q,o(0)),W=s(o(2),_,C,N[F][$]),X=i(a(c(T,N[F][F]),W),c(H,N[$][$])),P=m(c(H,N[F][F]),W,c(T,N[$][$])),J=0;J<q;J++)O[J]=a(c(_,N[F][J]),c(C,N[$][J])),L[J]=i(c(C,N[F][J]),c(_,N[$][J]));N[F][F]=X,N[$][$]=P,N[F][$]=o(0),N[$][F]=o(0);for(var ee=0;ee<q;ee++)ee!==F&&ee!==$&&(N[F][ee]=O[ee],N[ee][F]=O[ee],N[$][ee]=L[ee],N[ee][$]=L[ee]);return N}function x(N,B,F,$){for(var q=N.length,_=Math.cos(B),C=Math.sin(B),T=_*_,H=C*C,O=S(q,0),L=S(q,0),W=T*N[F][F]-2*_*C*N[F][$]+H*N[$][$],X=H*N[F][F]+2*_*C*N[F][$]+T*N[$][$],P=0;P<q;P++)O[P]=_*N[F][P]-C*N[$][P],L[P]=C*N[F][P]+_*N[$][P];N[F][F]=W,N[$][$]=X,N[F][$]=0,N[$][F]=0;for(var J=0;J<q;J++)J!==F&&J!==$&&(N[F][J]=O[J],N[J][F]=O[J],N[$][J]=L[J],N[J][$]=L[J]);return N}function b(N){for(var B=N.length,F=0,$=[0,1],q=0;q<B;q++)for(var _=q+1;_<B;_++)Math.abs(F)<Math.abs(N[q][_])&&(F=Math.abs(N[q][_]),$=[q,_]);return[$,F]}function A(N){for(var B=N.length,F=0,$=[0,1],q=0;q<B;q++)for(var _=q+1;_<B;_++)t(F)<t(N[q][_])&&(F=t(N[q][_]),$=[q,_]);return[$,F]}function D(N,B){for(var F=N.length,$=Array(F),q=Array(F),_=0;_<F;_++)q[_]=Array(F);for(var C=0;C<F;C++){for(var T=0,H=N[0],O=0;O<N.length;O++)t(N[O])<t(H)&&(T=O,H=N[T]);$[C]=N.splice(T,1)[0];for(var L=0;L<F;L++)q[L][C]=B[L][T],B[L].splice(T,1)}return{values:$,vectors:q}}function S(N,B){for(var F=new Array(N),$=0;$<N;$++)F[$]=B;return F}return v}var LM="eigs",kM=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],HM=I(LM,kM,e=>{var{config:r,typed:i,matrix:a,addScalar:t,subtract:n,equal:u,abs:f,atan:c,cos:l,sin:o,multiplyScalar:s,divideScalar:m,inv:v,bignumber:d,multiply:p,add:h,larger:y,column:E,flatten:g,number:w,complex:x,sqrt:b,diag:A,qr:D,usolve:S,usolveAll:N,im:B,re:F,smaller:$,matrixFromColumns:q,dot:_}=e,C=UM({config:r,addScalar:t,subtract:n,column:E,flatten:g,equal:u,abs:f,atan:c,cos:l,sin:o,multiplyScalar:s,inv:v,bignumber:d,complex:x,multiply:p,add:h}),T=PM({config:r,addScalar:t,subtract:n,multiply:p,multiplyScalar:s,flatten:g,divideScalar:m,sqrt:b,abs:f,bignumber:d,diag:A,qr:D,inv:v,usolve:S,usolveAll:N,equal:u,complex:x,larger:y,smaller:$,matrixFromColumns:q,dot:_});return i("eigs",{Array:function(J){var ee=a(J);return H(ee)},"Array, number|BigNumber":function(J,ee){var K=a(J);return H(K,ee)},Matrix:function(J){var{values:ee,vectors:K}=H(J);return{values:a(ee),vectors:a(K)}},"Matrix, number|BigNumber":function(J,ee){var{values:K,vectors:oe}=H(J,ee);return{values:a(K),vectors:a(oe)}}});function H(P,J){J===void 0&&(J=r.epsilon);var ee=P.size();if(ee.length!==2||ee[0]!==ee[1])throw new RangeError("Matrix must be square (size: "+Pe(ee)+")");var K=P.toArray(),oe=ee[0];if(L(K,oe,J)&&(W(K,oe),O(K,oe,J))){var se=X(P,K,oe);return C(K,oe,J,se)}var ie=X(P,K,oe);return T(K,oe,J,ie)}function O(P,J,ee){for(var K=0;K<J;K++)for(var oe=K;oe<J;oe++)if(y(d(f(n(P[K][oe],P[oe][K]))),ee))return!1;return!0}function L(P,J,ee){for(var K=0;K<J;K++)for(var oe=0;oe<J;oe++)if(y(d(f(B(P[K][oe]))),ee))return!1;return!0}function W(P,J){for(var ee=0;ee<J;ee++)for(var K=0;K<J;K++)P[ee][K]=F(P[ee][K])}function X(P,J,ee){var K=P.datatype();if(K==="number"||K==="BigNumber"||K==="Complex")return K;for(var oe=!1,se=!1,ie=!1,re=0;re<ee;re++)for(var pe=0;pe<ee;pe++){var Ae=J[re][pe];if(Ve(Ae)||Jn(Ae))oe=!0;else if(ke(Ae))se=!0;else if(wt(Ae))ie=!0;else throw TypeError("Unsupported type in Matrix: "+nr(Ae))}if(se&&ie&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),ie){for(var be=0;be<ee;be++)for(var Ne=0;Ne<ee;Ne++)J[be][Ne]=x(J[be][Ne]);return"Complex"}if(se){for(var U=0;U<ee;U++)for(var G=0;G<ee;G++)J[U][G]=d(J[U][G]);return"BigNumber"}if(oe){for(var te=0;te<ee;te++)for(var k=0;k<ee;k++)J[te][k]=w(J[te][k]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),lc="expm",GM=["typed","abs","add","identity","inv","multiply"],VM=I(lc,GM,e=>{var{typed:r,abs:i,add:a,identity:t,inv:n,multiply:u}=e;return r(lc,{Matrix:function(s){var m=s.size();if(m.length!==2||m[0]!==m[1])throw new RangeError("Matrix must be square (size: "+Pe(m)+")");for(var v=m[0],d=1e-15,p=f(s),h=c(p,d),y=h.q,E=h.j,g=u(s,Math.pow(2,-E)),w=t(v),x=t(v),b=1,A=g,D=-1,S=1;S<=y;S++)S>1&&(A=u(A,g),D=-D),b=b*(y-S+1)/((2*y-S+1)*S),w=a(w,u(b,A)),x=a(x,u(b*D,A));for(var N=u(n(x),w),B=0;B<E;B++)N=u(N,N);return kt(s)?s.createSparseMatrix(N):N}});function f(o){for(var s=o.size()[0],m=0,v=0;v<s;v++){for(var d=0,p=0;p<s;p++)d+=i(o.get([v,p]));m=Math.max(d,m)}return m}function c(o,s){for(var m=30,v=0;v<m;v++)for(var d=0;d<=v;d++){var p=v-d;if(l(o,d,p)<s)return{q:d,j:p}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function l(o,s,m){for(var v=1,d=2;d<=s;d++)v*=d;for(var p=v,h=s+1;h<=2*s;h++)p*=h;var y=p*(2*s+1);return 8*Math.pow(o/Math.pow(2,m),2*s)*v*v/(p*y)}}),cc="sqrtm",ZM=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],YM=I(cc,ZM,e=>{var{typed:r,abs:i,add:a,multiply:t,map:n,sqrt:u,subtract:f,inv:c,size:l,max:o,identity:s}=e,m=1e3,v=1e-6;function d(p){var h,y=0,E=p,g=s(l(p));do{var w=E;if(E=t(.5,a(w,c(g))),g=t(.5,a(g,c(w))),h=o(i(f(E,w))),h>v&&++y>m)throw new Error("computing square root of matrix: iterative method could not converge")}while(h>v);return E}return r(cc,{"Array | Matrix":function(h){var y=Be(h)?h.size():Ge(h);switch(y.length){case 1:if(y[0]===1)return n(h,u);throw new RangeError("Matrix must be square (size: "+Pe(y)+")");case 2:{var E=y[0],g=y[1];if(E===g)return d(h);throw new RangeError("Matrix must be square (size: "+Pe(y)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Pe(y)+")")}}})}),fc="sylvester",WM=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],XM=I(fc,WM,e=>{var{typed:r,schur:i,matrixFromColumns:a,matrix:t,multiply:n,range:u,concat:f,transpose:c,index:l,subset:o,add:s,subtract:m,identity:v,lusolve:d,abs:p}=e;return r(fc,{"Matrix, Matrix, Matrix":h,"Array, Matrix, Matrix":function(E,g,w){return h(t(E),g,w)},"Array, Array, Matrix":function(E,g,w){return h(t(E),t(g),w)},"Array, Matrix, Array":function(E,g,w){return h(t(E),g,t(w))},"Matrix, Array, Matrix":function(E,g,w){return h(E,t(g),w)},"Matrix, Array, Array":function(E,g,w){return h(E,t(g),t(w))},"Matrix, Matrix, Array":function(E,g,w){return h(E,g,t(w))},"Array, Array, Array":function(E,g,w){return h(t(E),t(g),t(w)).toArray()}});function h(y,E,g){for(var w=E.size()[0],x=y.size()[0],b=i(y),A=b.T,D=b.U,S=i(n(-1,E)),N=S.T,B=S.U,F=n(n(c(D),g),B),$=u(0,x),q=[],_=(Ae,be)=>f(Ae,be,1),C=(Ae,be)=>f(Ae,be,0),T=0;T<w;T++)if(T<w-1&&p(o(N,l(T+1,T)))>1e-5){for(var H=C(o(F,l($,T)),o(F,l($,T+1))),O=0;O<T;O++)H=s(H,C(n(q[O],o(N,l(O,T))),n(q[O],o(N,l(O,T+1)))));var L=n(v(x),n(-1,o(N,l(T,T)))),W=n(v(x),n(-1,o(N,l(T+1,T)))),X=n(v(x),n(-1,o(N,l(T,T+1)))),P=n(v(x),n(-1,o(N,l(T+1,T+1)))),J=C(_(s(A,L),W),_(X,s(A,P))),ee=d(J,H);q[T]=ee.subset(l(u(0,x),0)),q[T+1]=ee.subset(l(u(x,2*x),0)),T++}else{for(var K=o(F,l($,T)),oe=0;oe<T;oe++)K=s(K,n(q[oe],o(N,l(oe,T))));var se=o(N,l(T,T)),ie=m(A,n(se,v(x)));q[T]=d(ie,K)}var re=t(a(...q)),pe=n(D,n(re,c(B)));return pe}}),mc="schur",JM=["typed","matrix","identity","multiply","qr","norm","subtract"],QM=I(mc,JM,e=>{var{typed:r,matrix:i,identity:a,multiply:t,qr:n,norm:u,subtract:f}=e;return r(mc,{Array:function(o){var s=c(i(o));return{U:s.U.valueOf(),T:s.T.valueOf()}},Matrix:function(o){return c(o)}});function c(l){var o=l.size()[0],s=l,m=a(o),v=0,d;do{d=s;var p=n(s),h=p.Q,y=p.R;if(s=t(y,h),m=t(m,h),v++>100)break}while(u(f(s,d))>1e-4);return{U:m,T:s}}}),vc="lyap",KM=["typed","matrix","sylvester","multiply","transpose"],jM=I(vc,KM,e=>{var{typed:r,matrix:i,sylvester:a,multiply:t,transpose:n}=e;return r(vc,{"Matrix, Matrix":function(f,c){return a(f,n(f),t(-1,c))},"Array, Matrix":function(f,c){return a(i(f),n(i(f)),t(-1,c))},"Matrix, Array":function(f,c){return a(f,n(i(f)),i(t(-1,c)))},"Array, Array":function(f,c){return a(i(f),n(i(f)),i(t(-1,c))).toArray()}})}),e3="divide",r3=["typed","matrix","multiply","equalScalar","divideScalar","inv"],t3=I(e3,r3,e=>{var{typed:r,matrix:i,multiply:a,equalScalar:t,divideScalar:n,inv:u}=e,f=Dr({typed:r,equalScalar:t}),c=nt({typed:r});return r("divide",of({"Array | Matrix, Array | Matrix":function(o,s){return a(o,u(s))},"DenseMatrix, any":function(o,s){return c(o,s,n,!1)},"SparseMatrix, any":function(o,s){return f(o,s,n,!1)},"Array, any":function(o,s){return c(i(o),s,n,!1).valueOf()},"any, Array | Matrix":function(o,s){return a(o,u(s))}},n.signatures))}),pc="distance",n3=["typed","addScalar","subtract","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],a3=I(pc,n3,e=>{var{typed:r,addScalar:i,subtract:a,multiplyScalar:t,divideScalar:n,deepEqual:u,sqrt:f,abs:c}=e;return r(pc,{"Array, Array, Array":function(x,b,A){if(x.length===2&&b.length===2&&A.length===2){if(!o(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!o(b))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!o(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(b,A))throw new TypeError("LinePoint1 should not be same with LinePoint2");var D=a(A[1],b[1]),S=a(b[0],A[0]),N=a(t(A[0],b[1]),t(b[0],A[1]));return h(x[0],x[1],D,S,N)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(x,b,A){if(Object.keys(x).length===2&&Object.keys(b).length===2&&Object.keys(A).length===2){if(!o(x))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!o(b))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!o(A))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(d(b),d(A)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in x&&"pointY"in x&&"lineOnePtX"in b&&"lineOnePtY"in b&&"lineTwoPtX"in A&&"lineTwoPtY"in A){var D=a(A.lineTwoPtY,b.lineOnePtY),S=a(b.lineOnePtX,A.lineTwoPtX),N=a(t(A.lineTwoPtX,b.lineOnePtY),t(b.lineOnePtX,A.lineTwoPtY));return h(x.pointX,x.pointY,D,S,N)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(x,b){if(x.length===2&&b.length===3){if(!o(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return h(x[0],x[1],b[0],b[1],b[2])}else if(x.length===3&&b.length===6){if(!s(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(b))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(x[0],x[1],x[2],b[0],b[1],b[2],b[3],b[4],b[5])}else if(x.length===b.length&&x.length>0){if(!m(x))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(b))throw new TypeError("All values of an array should be numbers or BigNumbers");return E(x,b)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(x,b){if(Object.keys(x).length===2&&Object.keys(b).length===3){if(!o(x))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(b))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in x&&"pointY"in x&&"xCoeffLine"in b&&"yCoeffLine"in b&&"constant"in b)return h(x.pointX,x.pointY,b.xCoeffLine,b.yCoeffLine,b.constant);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===3&&Object.keys(b).length===6){if(!s(x))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!v(b))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in x&&"pointY"in x&&"x0"in b&&"y0"in b&&"z0"in b&&"a"in b&&"b"in b&&"c"in b)return y(x.pointX,x.pointY,x.pointZ,b.x0,b.y0,b.z0,b.a,b.b,b.c);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===2&&Object.keys(b).length===2){if(!o(x))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!o(b))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in x&&"pointOneY"in x&&"pointTwoX"in b&&"pointTwoY"in b)return E([x.pointOneX,x.pointOneY],[b.pointTwoX,b.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(x).length===3&&Object.keys(b).length===3){if(!s(x))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!s(b))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in x&&"pointOneY"in x&&"pointOneZ"in x&&"pointTwoX"in b&&"pointTwoY"in b&&"pointTwoZ"in b)return E([x.pointOneX,x.pointOneY,x.pointOneZ],[b.pointTwoX,b.pointTwoY,b.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(x){if(!p(x))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return g(x)}});function l(w){return typeof w=="number"||ke(w)}function o(w){return w.constructor!==Array&&(w=d(w)),l(w[0])&&l(w[1])}function s(w){return w.constructor!==Array&&(w=d(w)),l(w[0])&&l(w[1])&&l(w[2])}function m(w){return Array.isArray(w)||(w=d(w)),w.every(l)}function v(w){return w.constructor!==Array&&(w=d(w)),l(w[0])&&l(w[1])&&l(w[2])&&l(w[3])&&l(w[4])&&l(w[5])}function d(w){for(var x=Object.keys(w),b=[],A=0;A<x.length;A++)b.push(w[x[A]]);return b}function p(w){if(w[0].length===2&&l(w[0][0])&&l(w[0][1])){if(w.some(x=>x.length!==2||!l(x[0])||!l(x[1])))return!1}else if(w[0].length===3&&l(w[0][0])&&l(w[0][1])&&l(w[0][2])){if(w.some(x=>x.length!==3||!l(x[0])||!l(x[1])||!l(x[2])))return!1}else return!1;return!0}function h(w,x,b,A,D){var S=c(i(i(t(b,w),t(A,x)),D)),N=f(i(t(b,b),t(A,A)));return n(S,N)}function y(w,x,b,A,D,S,N,B,F){var $=[a(t(a(D,x),F),t(a(S,b),B)),a(t(a(S,b),N),t(a(A,w),F)),a(t(a(A,w),B),t(a(D,x),N))];$=f(i(i(t($[0],$[0]),t($[1],$[1])),t($[2],$[2])));var q=f(i(i(t(N,N),t(B,B)),t(F,F)));return n($,q)}function E(w,x){for(var b=w.length,A=0,D=0,S=0;S<b;S++)D=a(w[S],x[S]),A=i(t(D,D),A);return f(A)}function g(w){for(var x=[],b=[],A=[],D=0;D<w.length-1;D++)for(var S=D+1;S<w.length;S++)w[0].length===2?(b=[w[D][0],w[D][1]],A=[w[S][0],w[S][1]]):w[0].length===3&&(b=[w[D][0],w[D][1],w[D][2]],A=[w[S][0],w[S][1],w[S][2]]),x.push(E(b,A));return x}}),i3="intersect",o3=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],u3=I(i3,o3,e=>{var{typed:r,config:i,abs:a,add:t,addScalar:n,matrix:u,multiply:f,multiplyScalar:c,divideScalar:l,subtract:o,smaller:s,equalScalar:m,flatten:v,isZero:d,isNumeric:p}=e;return r("intersect",{"Array, Array, Array":h,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(B,F,$){var q=h(B.valueOf(),F.valueOf(),$.valueOf());return q===null?null:u(q)},"Matrix, Matrix, Matrix, Matrix":function(B,F,$,q){var _=y(B.valueOf(),F.valueOf(),$.valueOf(),q.valueOf());return _===null?null:u(_)}});function h(N,B,F){if(N=E(N),B=E(B),F=E(F),!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(F))throw new TypeError("Array with 4 numbers expected as third argument");return S(N[0],N[1],N[2],B[0],B[1],B[2],F[0],F[1],F[2],F[3])}function y(N,B,F,$){if(N=E(N),B=E(B),F=E(F),$=E($),N.length===2){if(!g(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!g(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!g(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!g($))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return b(N,B,F,$)}else if(N.length===3){if(!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!w($))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return D(N[0],N[1],N[2],B[0],B[1],B[2],F[0],F[1],F[2],$[0],$[1],$[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function E(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(B=>Array.isArray(B)&&B.length===1)?v(N):N}function g(N){return N.length===2&&p(N[0])&&p(N[1])}function w(N){return N.length===3&&p(N[0])&&p(N[1])&&p(N[2])}function x(N){return N.length===4&&p(N[0])&&p(N[1])&&p(N[2])&&p(N[3])}function b(N,B,F,$){var q=N,_=F,C=o(q,B),T=o(_,$),H=o(c(C[0],T[1]),c(T[0],C[1]));if(d(H)||s(a(H),i.epsilon))return null;var O=c(T[0],q[1]),L=c(T[1],q[0]),W=c(T[0],_[1]),X=c(T[1],_[0]),P=l(n(o(o(O,L),W),X),H);return t(f(C,P),q)}function A(N,B,F,$,q,_,C,T,H,O,L,W){var X=c(o(N,B),o(F,$)),P=c(o(q,_),o(C,T)),J=c(o(H,O),o(L,W));return n(n(X,P),J)}function D(N,B,F,$,q,_,C,T,H,O,L,W){var X=A(N,C,O,C,B,T,L,T,F,H,W,H),P=A(O,C,$,N,L,T,q,B,W,H,_,F),J=A(N,C,$,N,B,T,q,B,F,H,_,F),ee=A(O,C,O,C,L,T,L,T,W,H,W,H),K=A($,N,$,N,q,B,q,B,_,F,_,F),oe=o(c(X,P),c(J,ee)),se=o(c(K,ee),c(P,P));if(d(se))return null;var ie=l(oe,se),re=l(n(X,c(ie,P)),ee),pe=n(N,c(ie,o($,N))),Ae=n(B,c(ie,o(q,B))),be=n(F,c(ie,o(_,F))),Ne=n(C,c(re,o(O,C))),U=n(T,c(re,o(L,T))),G=n(H,c(re,o(W,H)));return m(pe,Ne)&&m(Ae,U)&&m(be,G)?[pe,Ae,be]:null}function S(N,B,F,$,q,_,C,T,H,O){var L=c(N,C),W=c($,C),X=c(B,T),P=c(q,T),J=c(F,H),ee=c(_,H),K=o(o(o(O,L),X),J),oe=o(o(o(n(n(W,P),ee),L),X),J),se=l(K,oe),ie=n(N,c(se,o($,N))),re=n(B,c(se,o(q,B))),pe=n(F,c(se,o(_,F)));return[ie,re,pe]}}),dc="sum",s3=["typed","config","add","numeric"],Jm=I(dc,s3,e=>{var{typed:r,config:i,add:a,numeric:t}=e;return r(dc,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":u,"...":function(c){if(En(c))throw new TypeError("Scalar values expected in function sum");return n(c)}});function n(f){var c;return At(f,function(l){try{c=c===void 0?l:a(c,l)}catch(o){throw Or(o,"sum",l)}}),c===void 0&&(c=t(0,i.number)),typeof c=="string"&&(c=t(c,i.number)),c}function u(f,c){try{var l=ti(f,c,a);return l}catch(o){throw Or(o,"sum")}}}),Sa="cumsum",l3=["typed","add","unaryPlus"],Qm=I(Sa,l3,e=>{var{typed:r,add:i,unaryPlus:a}=e;return r(Sa,{Array:t,Matrix:function(l){return l.create(t(l.valueOf()))},"Array, number | BigNumber":u,"Matrix, number | BigNumber":function(l,o){return l.create(u(l.valueOf(),o))},"...":function(l){if(En(l))throw new TypeError("All values expected to be scalar in function cumsum");return t(l)}});function t(c){try{return n(c)}catch(l){throw Or(l,Sa)}}function n(c){if(c.length===0)return[];for(var l=[a(c[0])],o=1;o<c.length;++o)l.push(i(l[o-1],c[o]));return l}function u(c,l){var o=Ge(c);if(l<0||l>=o.length)throw new rt(l,o.length);try{return f(c,l)}catch(s){throw Or(s,Sa)}}function f(c,l){var o,s,m;if(l<=0){var v=c[0][0];if(Array.isArray(v)){for(m=If(c),s=[],o=0;o<m.length;o++)s[o]=f(m[o],l-1);return s}else return n(c)}else{for(s=[],o=0;o<c.length;o++)s[o]=f(c[o],l-1);return s}}}),hc="mean",c3=["typed","add","divide"],Km=I(hc,c3,e=>{var{typed:r,add:i,divide:a}=e;return r(hc,{"Array | Matrix":n,"Array | Matrix, number | BigNumber":t,"...":function(f){if(En(f))throw new TypeError("Scalar values expected in function mean");return n(f)}});function t(u,f){try{var c=ti(u,f,i),l=Array.isArray(u)?Ge(u):u.size();return a(c,l[f])}catch(o){throw Or(o,"mean")}}function n(u){var f,c=0;if(At(u,function(l){try{f=f===void 0?l:i(f,l),c++}catch(o){throw Or(o,"mean",l)}}),c===0)throw new Error("Cannot calculate the mean of an empty array");return a(f,c)}}),gc="median",f3=["typed","add","divide","compare","partitionSelect"],m3=I(gc,f3,e=>{var{typed:r,add:i,divide:a,compare:t,partitionSelect:n}=e;function u(l){try{l=Xe(l.valueOf());var o=l.length;if(o===0)throw new Error("Cannot calculate median of an empty array");if(o%2===0){for(var s=o/2-1,m=n(l,s+1),v=l[s],d=0;d<s;++d)t(l[d],v)>0&&(v=l[d]);return c(v,m)}else{var p=n(l,(o-1)/2);return f(p)}}catch(h){throw Or(h,"median")}}var f=r({"number | BigNumber | Complex | Unit":function(o){return o}}),c=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(o,s){return a(i(o,s),2)}});return r(gc,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(o,s){throw new Error("median(A, dim) is not yet supported")},"...":function(o){if(En(o))throw new TypeError("Scalar values expected in function median");return u(o)}})}),yc="mad",v3=["typed","abs","map","median","subtract"],p3=I(yc,v3,e=>{var{typed:r,abs:i,map:a,median:t,subtract:n}=e;return r(yc,{"Array | Matrix":u,"...":function(c){return u(c)}});function u(f){if(f=Xe(f.valueOf()),f.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var c=t(f);return t(a(f,function(l){return i(n(l,c))}))}catch(l){throw l instanceof TypeError&&l.message.indexOf("median")!==-1?new TypeError(l.message.replace("median","mad")):Or(l,"mad")}}}),Ai="unbiased",bc="variance",d3=["typed","add","subtract","multiply","divide","apply","isNaN"],jm=I(bc,d3,e=>{var{typed:r,add:i,subtract:a,multiply:t,divide:n,apply:u,isNaN:f}=e;return r(bc,{"Array | Matrix":function(s){return c(s,Ai)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(s,m){return l(s,m,Ai)},"Array | Matrix, number | BigNumber, string":l,"...":function(s){return c(s,Ai)}});function c(o,s){var m,v=0;if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(At(o,function(h){try{m=m===void 0?h:i(m,h),v++}catch(y){throw Or(y,"variance",h)}}),v===0)throw new Error("Cannot calculate variance of an empty array");var d=n(m,v);if(m=void 0,At(o,function(h){var y=a(h,d);m=m===void 0?t(y,y):i(m,t(y,y))}),f(m))return m;switch(s){case"uncorrected":return n(m,v);case"biased":return n(m,v+1);case"unbiased":{var p=ke(m)?m.mul(0):0;return v===1?p:n(m,v-1)}default:throw new Error('Unknown normalization "'+s+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function l(o,s,m){try{if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(o,s,v=>c(v,m))}catch(v){throw Or(v,"variance")}}}),h3="quantileSeq",g3=["typed","add","multiply","partitionSelect","compare"],y3=I(h3,g3,e=>{var{typed:r,add:i,multiply:a,partitionSelect:t,compare:n}=e;function u(l,o,s){var m,v,d;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(st(l)){if(s=s||!1,typeof s=="boolean"){if(v=l.valueOf(),Ve(o)){if(o<0)throw new Error("N/prob must be non-negative");if(o<=1)return f(v,o,s);if(o>1){if(!Ce(o))throw new Error("N must be a positive integer");var p=o+1;m=new Array(o);for(var h=0;h<o;)m[h]=f(v,++h/p,s);return m}}if(ke(o)){var y=o.constructor;if(o.isNegative())throw new Error("N/prob must be non-negative");if(d=new y(1),o.lte(d))return new y(f(v,o,s));if(o.gt(d)){if(!o.isInteger())throw new Error("N must be a positive integer");var E=o.toNumber();if(E>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var g=new y(E+1);m=new Array(E);for(var w=0;w<E;)m[w]=new y(f(v,new y(++w).div(g),s));return m}}if(st(o)){var x=o.valueOf();m=new Array(x.length);for(var b=0;b<m.length;++b){var A=x[b];if(Ve(A)){if(A<0||A>1)throw new Error("Probability must be between 0 and 1, inclusive")}else if(ke(A)){if(d=new A.constructor(1),A.isNegative()||A.gt(d))throw new Error("Probability must be between 0 and 1, inclusive")}else throw new TypeError("Unexpected type of argument in function quantileSeq");m[b]=f(v,A,s)}return m}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function f(l,o,s){var m=Xe(l),v=m.length;if(v===0)throw new Error("Cannot calculate quantile of an empty sequence");if(Ve(o)){var d=o*(v-1),p=d%1;if(p===0){var h=s?m[d]:t(m,d);return c(h),h}var y=Math.floor(d),E,g;if(s)E=m[y],g=m[y+1];else{g=t(m,y+1),E=m[y];for(var w=0;w<y;++w)n(m[w],E)>0&&(E=m[w])}return c(E),c(g),i(a(E,1-p),a(g,p))}var x=o.times(v-1);if(x.isInteger()){x=x.toNumber();var b=s?m[x]:t(m,x);return c(b),b}var A=x.floor(),D=x.minus(A),S=A.toNumber(),N,B;if(s)N=m[S],B=m[S+1];else{B=t(m,S+1),N=m[S];for(var F=0;F<S;++F)n(m[F],N)>0&&(N=m[F])}c(N),c(B);var $=new D.constructor(1);return i(a(N,$.minus(D)),a(B,D))}var c=r({"number | BigNumber | Unit":function(o){return o}});return u}),xc="std",b3=["typed","map","sqrt","variance"],ev=I(xc,b3,e=>{var{typed:r,map:i,sqrt:a,variance:t}=e;return r(xc,{"Array | Matrix":n,"Array | Matrix, string":n,"Array | Matrix, number | BigNumber":n,"Array | Matrix, number | BigNumber, string":n,"...":function(f){return n(f)}});function n(u,f){if(u.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var c=t.apply(null,arguments);return st(c)?i(c,a):a(c)}catch(l){throw l instanceof TypeError&&l.message.indexOf(" variance")!==-1?new TypeError(l.message.replace(" variance"," std")):l}}}),wc="combinations",x3=["typed"],w3=I(wc,x3,e=>{var{typed:r}=e;return r(wc,{"number, number":im,"BigNumber, BigNumber":function(a,t){var n=a.constructor,u,f,c=a.minus(t),l=new n(1);if(!Nc(a)||!Nc(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(a))throw new TypeError("k must be less than n in function combinations");if(u=l,t.lt(c))for(f=l;f.lte(c);f=f.plus(l))u=u.times(t.plus(f)).dividedBy(f);else for(f=l;f.lte(t);f=f.plus(l))u=u.times(c.plus(f)).dividedBy(f);return u}})});function Nc(e){return e.isInteger()&&e.gte(0)}var Dc="combinationsWithRep",N3=["typed"],D3=I(Dc,N3,e=>{var{typed:r}=e;return r(Dc,{"number, number":function(a,t){if(!Ce(a)||a<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Ce(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(a<1)throw new TypeError("k must be less than or equal to n + k - 1");if(t<a-1){var n=xt(a,a+t-1);return n/xt(1,t)}var u=xt(t+1,a+t-1);return u/xt(1,a-1)},"BigNumber, BigNumber":function(a,t){var n=a.constructor,u,f,c=new n(1),l=a.minus(c);if(!Ac(a)||!Ac(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(a.lt(c))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(u=c,t.lt(l))for(f=c;f.lte(l);f=f.plus(c))u=u.times(t.plus(f)).dividedBy(f);else for(f=c;f.lte(t);f=f.plus(c))u=u.times(l.plus(f)).dividedBy(f);return u}})});function Ac(e){return e.isInteger()&&e.gte(0)}var Ec="gamma",A3=["typed","config","multiplyScalar","pow","BigNumber","Complex"],E3=I(Ec,A3,e=>{var{typed:r,config:i,multiplyScalar:a,pow:t,BigNumber:n,Complex:u}=e;function f(l){if(l.im===0)return Ra(l.re);if(l.re<.5){var o=new u(1-l.re,-l.im),s=new u(Math.PI*l.re,Math.PI*l.im);return new u(Math.PI).div(s.sin()).div(f(o))}l=new u(l.re-1,l.im);for(var m=new u(hn[0],0),v=1;v<hn.length;++v){var d=new u(hn[v],0);m=m.add(d.div(l.add(v)))}var p=new u(l.re+cm+.5,l.im),h=Math.sqrt(2*Math.PI),y=p.pow(l.add(.5)),E=p.neg().exp();return m.mul(h).mul(y).mul(E)}return r(Ec,{number:Ra,Complex:f,BigNumber:function(o){if(o.isInteger())return o.isNegative()||o.isZero()?new n(1/0):c(o.minus(1));if(!o.isFinite())return new n(o.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function c(l){if(l<8)return new n([1,1,2,6,24,120,720,5040][l]);var o=i.precision+(Math.log(l.toNumber())|0),s=n.clone({precision:o});if(l%2===1)return l.times(c(new n(l-1)));for(var m=l,v=new s(l),d=l.toNumber();m>2;)m-=2,d+=m,v=v.times(d);return new n(v.toPrecision(n.precision))}}),Sc="lgamma",S3=["Complex","typed"],C3=I(Sc,S3,e=>{var{Complex:r,typed:i}=e,a=7,t=7,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return i(Sc,{number:qa,Complex:u,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function u(l){var o=6.283185307179586,s=1.1447298858494002,m=.1;if(l.isNaN())return new r(NaN,NaN);if(l.im===0)return new r(qa(l.re),0);if(l.re>=a||Math.abs(l.im)>=t)return f(l);if(l.re<=m){var v=xd(o,l.im)*Math.floor(.5*l.re+.25),d=l.mul(Math.PI).sin().log(),p=u(new r(1-l.re,-l.im));return new r(s,v).sub(d).sub(p)}else return l.im>=0?c(l):c(l.conjugate()).conjugate()}function f(l){for(var o=l.sub(.5).mul(l.log()).sub(l).add(fm),s=new r(1,0).div(l),m=s.div(l),v=n[0],d=n[1],p=2*m.re,h=m.re*m.re+m.im*m.im,y=2;y<8;y++){var E=d;d=-h*v+n[y],v=p*v+E}var g=s.mul(m.mul(v).add(d));return o.add(g)}function c(l){var o=0,s=0,m=l;for(l=l.add(1);l.re<=a;){m=m.mul(l);var v=m.im<0?1:0;v!==0&&s===0&&o++,s=v,l=l.add(1)}return f(l).sub(m.log()).sub(new r(0,o*2*Math.PI*1))}}),Cc="factorial",M3=["typed","gamma"],F3=I(Cc,M3,e=>{var{typed:r,gamma:i}=e;return r(Cc,{number:function(t){if(t<0)throw new Error("Value must be non-negative");return i(t+1)},BigNumber:function(t){if(t.isNegative())throw new Error("Value must be non-negative");return i(t.plus(1))},"Array | Matrix":r.referToSelf(a=>t=>He(t,a))})}),Mc="kldivergence",B3=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],T3=I(Mc,B3,e=>{var{typed:r,matrix:i,divide:a,sum:t,multiply:n,map:u,dotDivide:f,log:c,isNumeric:l}=e;return r(Mc,{"Array, Array":function(m,v){return o(i(m),i(v))},"Matrix, Array":function(m,v){return o(m,i(v))},"Array, Matrix":function(m,v){return o(i(m),v)},"Matrix, Matrix":function(m,v){return o(m,v)}});function o(s,m){var v=m.size().length,d=s.size().length;if(v>1)throw new Error("first object must be one dimensional");if(d>1)throw new Error("second object must be one dimensional");if(v!==d)throw new Error("Length of two vectors must be equal");var p=t(s);if(p===0)throw new Error("Sum of elements in first object must be non zero");var h=t(m);if(h===0)throw new Error("Sum of elements in second object must be non zero");var y=a(s,t(s)),E=a(m,t(m)),g=t(n(y,u(f(y,E),w=>c(w))));return l(g)?g:Number.NaN}}),Fc="multinomial",O3=["typed","add","divide","multiply","factorial","isInteger","isPositive"],$3=I(Fc,O3,e=>{var{typed:r,add:i,divide:a,multiply:t,factorial:n,isInteger:u,isPositive:f}=e;return r(Fc,{"Array | Matrix":function(l){var o=0,s=1;return At(l,function(m){if(!u(m)||!f(m))throw new TypeError("Positive integer value expected in function multinomial");o=i(o,m),s=t(s,n(m))}),a(n(o),s)}})}),Bc="permutations",_3=["typed","factorial"],I3=I(Bc,_3,e=>{var{typed:r,factorial:i}=e;return r(Bc,{"number | BigNumber":i,"number, number":function(t,n){if(!Ce(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(!Ce(n)||n<0)throw new TypeError("Positive integer value expected in function permutations");if(n>t)throw new TypeError("second argument k must be less than or equal to first argument n");return xt(t-n+1,t)},"BigNumber, BigNumber":function(t,n){var u,f;if(!Tc(t)||!Tc(n))throw new TypeError("Positive integer value expected in function permutations");if(n.gt(t))throw new TypeError("second argument k must be less than or equal to first argument n");var c=t.mul(0).add(1);for(u=c,f=t.minus(n).plus(1);f.lte(t);f=f.plus(1))u=u.times(f);return u}})});function Tc(e){return e.isInteger()&&e.gte(0)}var to={exports:{}};to.exports;(function(e){(function(r,i,a){function t(c){var l=this,o=f();l.next=function(){var s=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=s-(l.c=s|0)},l.c=1,l.s0=o(" "),l.s1=o(" "),l.s2=o(" "),l.s0-=o(c),l.s0<0&&(l.s0+=1),l.s1-=o(c),l.s1<0&&(l.s1+=1),l.s2-=o(c),l.s2<0&&(l.s2+=1),o=null}function n(c,l){return l.c=c.c,l.s0=c.s0,l.s1=c.s1,l.s2=c.s2,l}function u(c,l){var o=new t(c),s=l&&l.state,m=o.next;return m.int32=function(){return o.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,s&&(typeof s=="object"&&n(s,o),m.state=function(){return n(o,{})}),m}function f(){var c=4022871197,l=function(o){o=String(o);for(var s=0;s<o.length;s++){c+=o.charCodeAt(s);var m=.02519603282416938*c;c=m>>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return l}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.alea=u})(Vt,e,!1)})(to);var R3=to.exports,no={exports:{}};no.exports;(function(e){(function(r,i,a){function t(f){var c=this,l="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var s=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^s^s>>>8},f===(f|0)?c.x=f:l+=f;for(var o=0;o<l.length+64;o++)c.x^=l.charCodeAt(o)|0,c.next()}function n(f,c){return c.x=f.x,c.y=f.y,c.z=f.z,c.w=f.w,c}function u(f,c){var l=new t(f),o=c&&c.state,s=function(){return(l.next()>>>0)/4294967296};return s.double=function(){do var m=l.next()>>>11,v=(l.next()>>>0)/4294967296,d=(m+v)/(1<<21);while(d===0);return d},s.int32=l.next,s.quick=s,o&&(typeof o=="object"&&n(o,l),s.state=function(){return n(l,{})}),s}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.xor128=u})(Vt,e,!1)})(no);var q3=no.exports,ao={exports:{}};ao.exports;(function(e){(function(r,i,a){function t(f){var c=this,l="";c.next=function(){var s=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(s^s<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,f===(f|0)?c.x=f:l+=f;for(var o=0;o<l.length+64;o++)c.x^=l.charCodeAt(o)|0,o==l.length&&(c.d=c.x<<10^c.x>>>4),c.next()}function n(f,c){return c.x=f.x,c.y=f.y,c.z=f.z,c.w=f.w,c.v=f.v,c.d=f.d,c}function u(f,c){var l=new t(f),o=c&&c.state,s=function(){return(l.next()>>>0)/4294967296};return s.double=function(){do var m=l.next()>>>11,v=(l.next()>>>0)/4294967296,d=(m+v)/(1<<21);while(d===0);return d},s.int32=l.next,s.quick=s,o&&(typeof o=="object"&&n(o,l),s.state=function(){return n(l,{})}),s}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.xorwow=u})(Vt,e,!1)})(ao);var z3=ao.exports,io={exports:{}};io.exports;(function(e){(function(r,i,a){function t(f){var c=this;c.next=function(){var o=c.x,s=c.i,m,v;return m=o[s],m^=m>>>7,v=m^m<<24,m=o[s+1&7],v^=m^m>>>10,m=o[s+3&7],v^=m^m>>>3,m=o[s+4&7],v^=m^m<<7,m=o[s+7&7],m=m^m<<13,v^=m^m<<9,o[s]=v,c.i=s+1&7,v};function l(o,s){var m,v=[];if(s===(s|0))v[0]=s;else for(s=""+s,m=0;m<s.length;++m)v[m&7]=v[m&7]<<15^s.charCodeAt(m)+v[m+1&7]<<13;for(;v.length<8;)v.push(0);for(m=0;m<8&&v[m]===0;++m);for(m==8?v[7]=-1:v[m],o.x=v,o.i=0,m=256;m>0;--m)o.next()}l(c,f)}function n(f,c){return c.x=f.x.slice(),c.i=f.i,c}function u(f,c){f==null&&(f=+new Date);var l=new t(f),o=c&&c.state,s=function(){return(l.next()>>>0)/4294967296};return s.double=function(){do var m=l.next()>>>11,v=(l.next()>>>0)/4294967296,d=(m+v)/(1<<21);while(d===0);return d},s.int32=l.next,s.quick=s,o&&(o.x&&n(o,l),s.state=function(){return n(l,{})}),s}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.xorshift7=u})(Vt,e,!1)})(io);var P3=io.exports,oo={exports:{}};oo.exports;(function(e){(function(r,i,a){function t(f){var c=this;c.next=function(){var o=c.w,s=c.X,m=c.i,v,d;return c.w=o=o+1640531527|0,d=s[m+34&127],v=s[m=m+1&127],d^=d<<13,v^=v<<17,d^=d>>>15,v^=v>>>12,d=s[m]=d^v,c.i=m,d+(o^o>>>16)|0};function l(o,s){var m,v,d,p,h,y=[],E=128;for(s===(s|0)?(v=s,s=null):(s=s+"\0",v=0,E=Math.max(E,s.length)),d=0,p=-32;p<E;++p)s&&(v^=s.charCodeAt((p+32)%s.length)),p===0&&(h=v),v^=v<<10,v^=v>>>15,v^=v<<4,v^=v>>>13,p>=0&&(h=h+1640531527|0,m=y[p&127]^=v+h,d=m==0?d+1:0);for(d>=128&&(y[(s&&s.length||0)&127]=-1),d=127,p=4*128;p>0;--p)v=y[d+34&127],m=y[d=d+1&127],v^=v<<13,m^=m<<17,v^=v>>>15,m^=m>>>12,y[d]=v^m;o.w=h,o.X=y,o.i=d}l(c,f)}function n(f,c){return c.i=f.i,c.w=f.w,c.X=f.X.slice(),c}function u(f,c){f==null&&(f=+new Date);var l=new t(f),o=c&&c.state,s=function(){return(l.next()>>>0)/4294967296};return s.double=function(){do var m=l.next()>>>11,v=(l.next()>>>0)/4294967296,d=(m+v)/(1<<21);while(d===0);return d},s.int32=l.next,s.quick=s,o&&(o.X&&n(o,l),s.state=function(){return n(l,{})}),s}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.xor4096=u})(Vt,e,!1)})(oo);var U3=oo.exports,uo={exports:{}};uo.exports;(function(e){(function(r,i,a){function t(f){var c=this,l="";c.next=function(){var s=c.b,m=c.c,v=c.d,d=c.a;return s=s<<25^s>>>7^m,m=m-v|0,v=v<<24^v>>>8^d,d=d-s|0,c.b=s=s<<20^s>>>12^m,c.c=m=m-v|0,c.d=v<<16^m>>>16^d,c.a=d-s|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,f===Math.floor(f)?(c.a=f/4294967296|0,c.b=f|0):l+=f;for(var o=0;o<l.length+20;o++)c.b^=l.charCodeAt(o)|0,c.next()}function n(f,c){return c.a=f.a,c.b=f.b,c.c=f.c,c.d=f.d,c}function u(f,c){var l=new t(f),o=c&&c.state,s=function(){return(l.next()>>>0)/4294967296};return s.double=function(){do var m=l.next()>>>11,v=(l.next()>>>0)/4294967296,d=(m+v)/(1<<21);while(d===0);return d},s.int32=l.next,s.quick=s,o&&(typeof o=="object"&&n(o,l),s.state=function(){return n(l,{})}),s}i&&i.exports?i.exports=u:a&&a.amd?a(function(){return u}):this.tychei=u})(Vt,e,!1)})(uo);var L3=uo.exports,rv={exports:{}};(function(e){(function(r,i,a){var t=256,n=6,u=52,f="random",c=a.pow(t,n),l=a.pow(2,u),o=l*2,s=t-1,m;function v(w,x,b){var A=[];x=x==!0?{entropy:!0}:x||{};var D=y(h(x.entropy?[w,g(i)]:w??E(),3),A),S=new d(A),N=function(){for(var B=S.g(n),F=c,$=0;B<l;)B=(B+$)*t,F*=t,$=S.g(1);for(;B>=o;)B/=2,F/=2,$>>>=1;return(B+$)/F};return N.int32=function(){return S.g(4)|0},N.quick=function(){return S.g(4)/4294967296},N.double=N,y(g(S.S),i),(x.pass||b||function(B,F,$,q){return q&&(q.S&&p(q,S),B.state=function(){return p(S,{})}),$?(a[f]=B,F):B})(N,D,"global"in x?x.global:this==a,x.state)}function d(w){var x,b=w.length,A=this,D=0,S=A.i=A.j=0,N=A.S=[];for(b||(w=[b++]);D<t;)N[D]=D++;for(D=0;D<t;D++)N[D]=N[S=s&S+w[D%b]+(x=N[D])],N[S]=x;(A.g=function(B){for(var F,$=0,q=A.i,_=A.j,C=A.S;B--;)F=C[q=s&q+1],$=$*t+C[s&(C[q]=C[_=s&_+F])+(C[_]=F)];return A.i=q,A.j=_,$})(t)}function p(w,x){return x.i=w.i,x.j=w.j,x.S=w.S.slice(),x}function h(w,x){var b=[],A=typeof w,D;if(x&&A=="object")for(D in w)try{b.push(h(w[D],x-1))}catch{}return b.length?b:A=="string"?w:w+"\0"}function y(w,x){for(var b=w+"",A,D=0;D<b.length;)x[s&D]=s&(A^=x[s&D]*19)+b.charCodeAt(D++);return g(x)}function E(){try{var w;return m&&(w=m.randomBytes)?w=w(t):(w=new Uint8Array(t),(r.crypto||r.msCrypto).getRandomValues(w)),g(w)}catch{var x=r.navigator,b=x&&x.plugins;return[+new Date,r,b,r.screen,g(i)]}}function g(w){return String.fromCharCode.apply(0,w)}if(y(a.random(),i),e.exports){e.exports=v;try{m=Fp}catch{}}else a["seed"+f]=v})(typeof self<"u"?self:Vt,[],Math)})(rv);var k3=rv.exports,H3=R3,G3=q3,V3=z3,Z3=P3,Y3=U3,W3=L3,Xt=k3;Xt.alea=H3;Xt.xor128=G3;Xt.xorwow=V3;Xt.xorshift7=Z3;Xt.xor4096=Y3;Xt.tychei=W3;var X3=Xt;const tv=Xn(X3);var J3=tv(Date.now());function Nn(e){var r;function i(t){r=t===null?J3:tv(String(t))}i(e);function a(){return r()}return a}var Oc="pickRandom",Q3=["typed","config","?on"],K3=I(Oc,Q3,e=>{var{typed:r,config:i,on:a}=e,t=Nn(i.randomSeed);return a&&a("config",function(u,f){u.randomSeed!==f.randomSeed&&(t=Nn(u.randomSeed))}),r(Oc,{"Array | Matrix":function(f){return n(f,{})},"Array | Matrix, Object":function(f,c){return n(f,c)},"Array | Matrix, number":function(f,c){return n(f,{number:c})},"Array | Matrix, Array | Matrix":function(f,c){return n(f,{weights:c})},"Array | Matrix, Array | Matrix, number":function(f,c,l){return n(f,{number:l,weights:c})},"Array | Matrix, number, Array | Matrix":function(f,c,l){return n(f,{number:c,weights:l})}});function n(u,f){var{number:c,weights:l,elementWise:o=!0}=f,s=typeof c>"u";s&&(c=1);var m=Be(u)?u.create:Be(l)?l.create:null;u=u.valueOf(),l&&(l=l.valueOf()),o===!0&&(u=Xe(u),l=Xe(l));var v=0;if(typeof l<"u"){if(l.length!==u.length)throw new Error("Weights must have the same length as possibles");for(var d=0,p=l.length;d<p;d++){if(!Ve(l[d])||l[d]<0)throw new Error("Weights must be an array of positive numbers");v+=l[d]}}for(var h=u.length,y=[],E;y.length<c;){if(typeof l>"u")E=u[Math.floor(t()*h)];else for(var g=t()*v,w=0,x=u.length;w<x;w++)if(g-=l[w],g<0){E=u[w];break}y.push(E)}return s?y[0]:m?m(y):y}});function so(e,r){var i=[];if(e=e.slice(0),e.length>1)for(var a=0,t=e.shift();a<t;a++)i.push(so(e,r));else for(var n=0,u=e.shift();n<u;n++)i.push(r());return i}var $c="random",j3=["typed","config","?on"],eF=I($c,j3,e=>{var{typed:r,config:i,on:a}=e,t=Nn(i.randomSeed);return a&&a("config",function(f,c){f.randomSeed!==c.randomSeed&&(t=Nn(f.randomSeed))}),r($c,{"":()=>u(0,1),number:f=>u(0,f),"number, number":(f,c)=>u(f,c),"Array | Matrix":f=>n(f,0,1),"Array | Matrix, number":(f,c)=>n(f,0,c),"Array | Matrix, number, number":(f,c,l)=>n(f,c,l)});function n(f,c,l){var o=so(f.valueOf(),()=>u(c,l));return Be(f)?f.create(o):o}function u(f,c){return f+t()*(c-f)}}),_c="randomInt",rF=["typed","config","?on"],tF=I(_c,rF,e=>{var{typed:r,config:i,on:a}=e,t=Nn(i.randomSeed);return a&&a("config",function(f,c){f.randomSeed!==c.randomSeed&&(t=Nn(f.randomSeed))}),r(_c,{"":()=>u(0,1),number:f=>u(0,f),"number, number":(f,c)=>u(f,c),"Array | Matrix":f=>n(f,0,1),"Array | Matrix, number":(f,c)=>n(f,0,c),"Array | Matrix, number, number":(f,c,l)=>n(f,c,l)});function n(f,c,l){var o=so(f.valueOf(),()=>u(c,l));return Be(f)?f.create(o):o}function u(f,c){return Math.floor(f+t()*(c-f))}}),Ic="stirlingS2",nF=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],aF=I(Ic,nF,e=>{var{typed:r,addScalar:i,subtract:a,multiplyScalar:t,divideScalar:n,pow:u,factorial:f,combinations:c,isNegative:l,isInteger:o,number:s,bignumber:m,larger:v}=e,d=[],p=[];return r(Ic,{"number | BigNumber, number | BigNumber":function(y,E){if(!o(y)||l(y)||!o(E)||l(E))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(v(E,y))throw new TypeError("k must be less than or equal to n in function stirlingS2");var g=!(Ve(y)&&Ve(E)),w=g?p:d,x=g?m:s,b=s(y),A=s(E);if(w[b]&&w[b].length>A)return w[b][A];for(var D=0;D<=b;++D)if(w[D]||(w[D]=[x(D===0?1:0)]),D!==0)for(var S=w[D],N=w[D-1],B=S.length;B<=D&&B<=A;++B)B===D?S[B]=1:S[B]=i(t(x(B),N[B]),N[B-1]);return w[b][A]}})}),Rc="bellNumbers",iF=["typed","addScalar","isNegative","isInteger","stirlingS2"],oF=I(Rc,iF,e=>{var{typed:r,addScalar:i,isNegative:a,isInteger:t,stirlingS2:n}=e;return r(Rc,{"number | BigNumber":function(f){if(!t(f)||a(f))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var c=0,l=0;l<=f;l++)c=i(c,n(f,l));return c}})}),qc="catalan",uF=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],sF=I(qc,uF,e=>{var{typed:r,addScalar:i,divideScalar:a,multiplyScalar:t,combinations:n,isNegative:u,isInteger:f}=e;return r(qc,{"number | BigNumber":function(l){if(!f(l)||u(l))throw new TypeError("Non-negative integer value expected in function catalan");return a(n(t(l,2),l),i(l,1))}})}),zc="composition",lF=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],cF=I(zc,lF,e=>{var{typed:r,addScalar:i,combinations:a,isPositive:t,isNegative:n,isInteger:u,larger:f}=e;return r(zc,{"number | BigNumber, number | BigNumber":function(l,o){if(!u(l)||!t(l)||!u(o)||!t(o))throw new TypeError("Positive integer value expected in function composition");if(f(o,l))throw new TypeError("k must be less than or equal to n in function composition");return a(i(l,-1),i(o,-1))}})}),Pc="leafCount",fF=["parse","typed"],mF=I(Pc,fF,e=>{var{parse:r,typed:i}=e;function a(t){var n=0;return t.forEach(u=>{n+=a(u)}),n||1}return i(Pc,{Node:function(n){return a(n)}})});function Uc(e){return We(e)||mr(e)&&e.isUnary()&&We(e.args[0])}function Ya(e){return!!(We(e)||(Ot(e)||mr(e))&&e.args.every(Ya)||Dt(e)&&Ya(e.content))}function Lc(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,a)}return i}function Ei(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Lc(Object(i),!0).forEach(function(a){hr(e,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Lc(Object(i)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(i,a))})}return e}var vF="simplifyUtil",pF=["FunctionNode","OperatorNode","SymbolNode"],lo=I(vF,pF,e=>{var{FunctionNode:r,OperatorNode:i,SymbolNode:a}=e,t=!0,n=!1,u="defaultF",f={add:{trivial:t,total:t,commutative:t,associative:t},unaryPlus:{trivial:t,total:t,commutative:t,associative:t},subtract:{trivial:n,total:t,commutative:n,associative:n},multiply:{trivial:t,total:t,commutative:t,associative:t},divide:{trivial:n,total:t,commutative:n,associative:n},paren:{trivial:t,total:t,commutative:t,associative:n},defaultF:{trivial:n,total:t,commutative:n,associative:n}},c={divide:{total:n},log:{total:n}},l={subtract:{total:n},abs:{trivial:t},log:{total:t}};function o(g,w){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f,b=u;if(typeof g=="string"?b=g:mr(g)?b=g.fn.toString():Ot(g)?b=g.name:Dt(g)&&(b="paren"),Ee(x,b)){var A=x[b];if(Ee(A,w))return A[w];if(Ee(f,b))return f[b][w]}if(Ee(x,u)){var D=x[u];return Ee(D,w)?D[w]:f[u][w]}if(Ee(f,b)){var S=f[b];if(Ee(S,w))return S[w]}return f[u][w]}function s(g){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;return o(g,"commutative",w)}function m(g){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;return o(g,"associative",w)}function v(g,w){var x=Ei({},g);for(var b in w)Ee(g,b)?x[b]=Ei(Ei({},w[b]),g[b]):x[b]=w[b];return x}function d(g,w){if(!g.args||g.args.length===0)return g;g.args=p(g,w);for(var x=0;x<g.args.length;x++)d(g.args[x],w)}function p(g,w){var x,b=[],A=function D(S){for(var N=0;N<S.args.length;N++){var B=S.args[N];mr(B)&&x===B.op?D(B):b.push(B)}};return m(g,w)?(x=g.op,A(g),b):g.args}function h(g,w){if(!(!g.args||g.args.length===0)){for(var x=E(g),b=g.args.length,A=0;A<b;A++)h(g.args[A],w);if(b>2&&m(g,w)){for(var D=g.args.pop();g.args.length>0;)D=x([g.args.pop(),D]);g.args=D.args}}}function y(g,w){if(!(!g.args||g.args.length===0)){for(var x=E(g),b=g.args.length,A=0;A<b;A++)y(g.args[A],w);if(b>2&&m(g,w)){for(var D=g.args.shift();g.args.length>0;)D=x([D,g.args.shift()]);g.args=D.args}}}function E(g){return mr(g)?function(w){try{return new i(g.op,g.fn,w,g.implicit)}catch(x){return console.error(x),[]}}:function(w){return new r(new a(g.name),w)}}return{createMakeNodeFunction:E,hasProperty:o,isCommutative:s,isAssociative:m,mergeContext:v,flatten:d,allChildren:p,unflattenr:h,unflattenl:y,defaultContext:f,realContext:c,positiveContext:l}}),dF="simplify",hF=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],gF=I(dF,hF,e=>{var{config:r,typed:i,parse:a,add:t,subtract:n,multiply:u,divide:f,pow:c,isZero:l,equal:o,resolve:s,simplifyConstant:m,simplifyCore:v,fraction:d,bignumber:p,mathWithTransform:h,matrix:y,AccessorNode:E,ArrayNode:g,ConstantNode:w,FunctionNode:x,IndexNode:b,ObjectNode:A,OperatorNode:D,ParenthesisNode:S,SymbolNode:N}=e,{hasProperty:B,isCommutative:F,isAssociative:$,mergeContext:q,flatten:_,unflattenr:C,unflattenl:T,createMakeNodeFunction:H,defaultContext:O,realContext:L,positiveContext:W}=lo({FunctionNode:x,OperatorNode:D,SymbolNode:N});i.addConversion({from:"Object",to:"Map",convert:dn});var X=i("simplify",{Node:ie,"Node, Map":(k,Y)=>ie(k,!1,Y),"Node, Map, Object":(k,Y,j)=>ie(k,!1,Y,j),"Node, Array":ie,"Node, Array, Map":ie,"Node, Array, Map, Object":ie});i.removeConversion({from:"Object",to:"Map",convert:dn}),X.defaultContext=O,X.realContext=L,X.positiveContext=W;function P(k){return k.transform(function(Y,j,fe){return Dt(Y)?P(Y.content):Y})}var J={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};X.rules=[v,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},m,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},m,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function ee(k,Y){var j={};if(k.s){var fe=k.s.split("->");if(fe.length===2)j.l=fe[0],j.r=fe[1];else throw SyntaxError("Could not parse rule: "+k.s)}else j.l=k.l,j.r=k.r;j.l=P(a(j.l)),j.r=P(a(j.r));for(var ue of["imposeContext","repeat","assuming"])ue in k&&(j[ue]=k[ue]);if(k.evaluate&&(j.evaluate=a(k.evaluate)),$(j.l,Y)){var R=!F(j.l,Y),z;R&&(z=se());var Q=H(j.l),ae=se();j.expanded={},j.expanded.l=Q([j.l,ae]),_(j.expanded.l,Y),C(j.expanded.l,Y),j.expanded.r=Q([j.r,ae]),R&&(j.expandedNC1={},j.expandedNC1.l=Q([z,j.l]),j.expandedNC1.r=Q([z,j.r]),j.expandedNC2={},j.expandedNC2.l=Q([z,j.expanded.l]),j.expandedNC2.r=Q([z,j.expanded.r]))}return j}function K(k,Y){for(var j=[],fe=0;fe<k.length;fe++){var ue=k[fe],R=void 0,z=typeof ue;switch(z){case"string":ue={s:ue};case"object":R=ee(ue,Y);break;case"function":R=ue;break;default:throw TypeError("Unsupported type of rule: "+z)}j.push(R)}return j}var oe=0;function se(){return new N("_p"+oe++)}function ie(k,Y){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xn(),fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},ue=fe.consoleDebug;Y=K(Y||X.rules,fe.context);var R=s(k,j);R=P(R);for(var z={},Q=R.toString({parenthesis:"all"});!z[Q];){z[Q]=!0,oe=0;var ae=Q;ue&&console.log("Working on: ",Q);for(var le=0;le<Y.length;le++){var ve="";if(typeof Y[le]=="function"?(R=Y[le](R,fe),ue&&(ve=Y[le].name)):(_(R,fe.context),R=pe(R,Y[le],fe.context),ue&&(ve="".concat(Y[le].l.toString()," -> ").concat(Y[le].r.toString()))),ue){var de=R.toString({parenthesis:"all"});de!==ae&&(console.log("Applying",ve,"produced",de),ae=de)}T(R,fe.context)}Q=R.toString({parenthesis:"all"})}return R}function re(k,Y,j){var fe=k;if(k)for(var ue=0;ue<k.length;++ue){var R=pe(k[ue],Y,j);R!==k[ue]&&(fe===k&&(fe=k.slice()),fe[ue]=R)}return fe}function pe(k,Y,j){if(Y.assuming){for(var fe in Y.assuming)for(var ue in Y.assuming[fe])if(B(fe,ue,j)!==Y.assuming[fe][ue])return k}var R=q(Y.imposeContext,j),z=k;if(z instanceof D||z instanceof x){var Q=re(z.args,Y,j);Q!==z.args&&(z=z.clone(),z.args=Q)}else if(z instanceof S){if(z.content){var ae=pe(z.content,Y,j);ae!==z.content&&(z=new S(ae))}}else if(z instanceof g){var le=re(z.items,Y,j);le!==z.items&&(z=new g(le))}else if(z instanceof E){var ve=z.object;z.object&&(ve=pe(z.object,Y,j));var de=z.index;z.index&&(de=pe(z.index,Y,j)),(ve!==z.object||de!==z.index)&&(z=new E(ve,de))}else if(z instanceof b){var ce=re(z.dimensions,Y,j);ce!==z.dimensions&&(z=new b(ce))}else if(z instanceof A){var ge=!1,Se={};for(var Ie in z.properties)Se[Ie]=pe(z.properties[Ie],Y,j),Se[Ie]!==z.properties[Ie]&&(ge=!0);ge&&(z=new A(Se))}var De=Y.r,Je=G(Y.l,z,R)[0];if(!Je&&Y.expanded&&(De=Y.expanded.r,Je=G(Y.expanded.l,z,R)[0]),!Je&&Y.expandedNC1&&(De=Y.expandedNC1.r,Je=G(Y.expandedNC1.l,z,R)[0],Je||(De=Y.expandedNC2.r,Je=G(Y.expandedNC2.l,z,R)[0])),Je){var ze=z.implicit;z=De.clone(),ze&&"implicit"in De&&(z.implicit=!0),z=z.transform(function(ir){return ir.isSymbolNode&&Ee(Je.placeholders,ir.name)?Je.placeholders[ir.name].clone():ir})}return Y.repeat&&z!==k&&(z=pe(z,Y,j)),z}function Ae(k,Y){var j=[],fe,ue,R=H(k);if(F(k,Y))for(var z=0;z<k.args.length;z++)ue=k.args.slice(0),ue.splice(z,1),fe=ue.length===1?ue[0]:R(ue),j.push(R([k.args[z],fe]));else for(var Q=1;Q<k.args.length;Q++){var ae=k.args[0];Q>1&&(ae=R(k.args.slice(0,Q))),ue=k.args.slice(Q),fe=ue.length===1?ue[0]:R(ue),j.push(R([ae,fe]))}return j}function be(k,Y){var j={placeholders:{}};if(!k.placeholders&&!Y.placeholders)return j;if(k.placeholders){if(!Y.placeholders)return k}else return Y;for(var fe in k.placeholders)if(Ee(k.placeholders,fe)&&(j.placeholders[fe]=k.placeholders[fe],Ee(Y.placeholders,fe)&&!te(k.placeholders[fe],Y.placeholders[fe])))return null;for(var ue in Y.placeholders)Ee(Y.placeholders,ue)&&(j.placeholders[ue]=Y.placeholders[ue]);return j}function Ne(k,Y){var j=[];if(k.length===0||Y.length===0)return j;for(var fe,ue=0;ue<k.length;ue++)for(var R=0;R<Y.length;R++)fe=be(k[ue],Y[R]),fe&&j.push(fe);return j}function U(k){if(k.length===0)return k;for(var Y=k.reduce(Ne),j=[],fe={},ue=0;ue<Y.length;ue++){var R=JSON.stringify(Y[ue]);fe[R]||(fe[R]=!0,j.push(Y[ue]))}return j}function G(k,Y,j,fe){var ue=[{placeholders:{}}];if(k instanceof D&&Y instanceof D||k instanceof x&&Y instanceof x){if(k instanceof D){if(k.op!==Y.op||k.fn!==Y.fn)return[]}else if(k instanceof x&&k.name!==Y.name)return[];if(Y.args.length===1&&k.args.length===1||!$(Y,j)&&Y.args.length===k.args.length||fe){for(var R=[],z=0;z<k.args.length;z++){var Q=G(k.args[z],Y.args[z],j);if(Q.length===0)break;R.push(Q)}if(R.length!==k.args.length){if(!F(Y,j)||k.args.length===1)return[];if(k.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var ae=G(k.args[0],Y.args[1],j);if(ae.length===0)return[];var le=G(k.args[1],Y.args[0],j);if(le.length===0)return[];R=[ae,le]}ue=U(R)}else if(Y.args.length>=2&&k.args.length===2){for(var ve=Ae(Y,j),de=[],ce=0;ce<ve.length;ce++){var ge=G(k,ve[ce],j,!0);de=de.concat(ge)}return de}else{if(k.args.length>2)throw Error("Unexpected non-binary associative function: "+k.toString());return[]}}else if(k instanceof N){if(k.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(J[k.name]){if(k.name!==Y.name)return[]}else switch(k.name[1]>="a"&&k.name[1]<="z"?k.name.substring(0,2):k.name[0]){case"n":case"_p":ue[0].placeholders[k.name]=Y;break;case"c":case"cl":if(We(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"v":if(!We(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"vl":if(yr(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"cd":if(Uc(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"vd":if(!Uc(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"ce":if(Ya(Y))ue[0].placeholders[k.name]=Y;else return[];break;case"ve":if(!Ya(Y))ue[0].placeholders[k.name]=Y;else return[];break;default:throw new Error("Invalid symbol in rule: "+k.name)}}else if(k instanceof w){if(!o(k.value,Y.value))return[]}else return[];return ue}function te(k,Y){if(k instanceof w&&Y instanceof w){if(!o(k.value,Y.value))return!1}else if(k instanceof N&&Y instanceof N){if(k.name!==Y.name)return!1}else if(k instanceof D&&Y instanceof D||k instanceof x&&Y instanceof x){if(k instanceof D){if(k.op!==Y.op||k.fn!==Y.fn)return!1}else if(k instanceof x&&k.name!==Y.name)return!1;if(k.args.length!==Y.args.length)return!1;for(var j=0;j<k.args.length;j++)if(!te(k.args[j],Y.args[j]))return!1}else return!1;return!0}return X}),yF="simplifyConstant",bF=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],xF=I(yF,bF,e=>{var{typed:r,config:i,mathWithTransform:a,matrix:t,fraction:n,bignumber:u,AccessorNode:f,ArrayNode:c,ConstantNode:l,FunctionNode:o,IndexNode:s,ObjectNode:m,OperatorNode:v,SymbolNode:d}=e,{isCommutative:p,isAssociative:h,allChildren:y,createMakeNodeFunction:E}=lo({FunctionNode:o,OperatorNode:v,SymbolNode:d}),g=r("simplifyConstant",{Node:_=>A(q(_,{})),"Node, Object":function(C,T){return A(q(C,T))}});function w(_){return Jn(_)?_.valueOf():_ instanceof Array?_.map(w):Be(_)?t(w(_.valueOf())):_}function x(_,C,T){try{return a[_].apply(null,C)}catch{return C=C.map(w),S(a[_].apply(null,C),T)}}var b=r({Fraction:B,number:function(C){return C<0?N(new l(-C)):new l(C)},BigNumber:function(C){return C<0?N(new l(-C)):new l(C)},Complex:function(C){throw new Error("Cannot convert Complex number to Node")},string:function(C){return new l(C)},Matrix:function(C){return new c(C.valueOf().map(T=>b(T)))}});function A(_){return er(_)?_:b(_)}function D(_,C){var T=C&&C.exactFractions!==!1;if(T&&isFinite(_)&&n){var H=n(_),O=C&&typeof C.fractionsLimit=="number"?C.fractionsLimit:1/0;if(H.valueOf()===_&&H.n<O&&H.d<O)return H}return _}var S=r({"string, Object":function(C,T){if(i.number==="BigNumber")return u===void 0&&Ki(),u(C);if(i.number==="Fraction")return n===void 0&&zm(),n(C);var H=parseFloat(C);return D(H,T)},"Fraction, Object":function(C,T){return C},"BigNumber, Object":function(C,T){return C},"number, Object":function(C,T){return D(C,T)},"Complex, Object":function(C,T){return C.im!==0?C:D(C.re,T)},"Matrix, Object":function(C,T){return t(D(C.valueOf()))},"Array, Object":function(C,T){return C.map(D)}});function N(_){return new v("-","unaryMinus",[_])}function B(_){var C,T=_.s*_.n;return T<0?C=new v("-","unaryMinus",[new l(-T)]):C=new l(T),_.d===1?C:new v("/","divide",[C,new l(_.d)])}function F(_,C,T){if(!An(C))return new f(A(_),A(C));if(Vr(_)||Be(_)){for(var H=Array.from(C.dimensions);H.length>0;)if(We(H[0])&&typeof H[0].value!="string"){var O=S(H.shift().value,T);Vr(_)?_=_.items[O-1]:(_=_.valueOf()[O-1],_ instanceof Array&&(_=t(_)))}else if(H.length>1&&We(H[1])&&typeof H[1].value!="string"){var L=S(H[1].value,T),W=[],X=Vr(_)?_.items:_.valueOf();for(var P of X)if(Vr(P))W.push(P.items[L-1]);else if(Be(_))W.push(P[L-1]);else break;if(W.length===X.length)Vr(_)?_=new c(W):_=t(W),H.splice(1,1);else break}else break;return H.length===C.dimensions.length?new f(A(_),C):H.length>0?(C=new s(H),new f(A(_),C)):_}if(Xa(_)&&C.dimensions.length===1&&We(C.dimensions[0])){var J=C.dimensions[0].value;return J in _.properties?_.properties[J]:new l}return new f(A(_),C)}function $(_,C,T,H){var O=C.shift(),L=C.reduce((W,X)=>{if(!er(X)){var P=W.pop();if(er(P))return[P,X];try{return W.push(x(_,[P,X],H)),W}catch{W.push(P)}}W.push(A(W.pop()));var J=W.length===1?W[0]:T(W);return[T([J,A(X)])]},[O]);return L.length===1?L[0]:T([L[0],b(L[1])])}function q(_,C){switch(_.type){case"SymbolNode":return _;case"ConstantNode":switch(typeof _.value){case"number":return S(_.value,C);case"string":return _.value;default:if(!isNaN(_.value))return S(_.value,C)}return _;case"FunctionNode":if(a[_.name]&&a[_.name].rawArgs)return _;{var T=["add","multiply"];if(T.indexOf(_.name)===-1){var H=_.args.map(pe=>q(pe,C));if(!H.some(er))try{return x(_.name,H,C)}catch{}if(_.name==="size"&&H.length===1&&Vr(H[0])){for(var O=[],L=H[0];Vr(L);)O.push(L.items.length),L=L.items[0];return t(O)}return new o(_.name,H.map(A))}}case"OperatorNode":{var W=_.fn.toString(),X,P,J=E(_);if(mr(_)&&_.isUnary())X=[q(_.args[0],C)],er(X[0])?P=J(X):P=x(W,X,C);else if(h(_,C.context))if(X=y(_,C.context),X=X.map(pe=>q(pe,C)),p(W,C.context)){for(var ee=[],K=[],oe=0;oe<X.length;oe++)er(X[oe])?K.push(X[oe]):ee.push(X[oe]);ee.length>1?(P=$(W,ee,J,C),K.unshift(P),P=$(W,K,J,C)):P=$(W,X,J,C)}else P=$(W,X,J,C);else X=_.args.map(pe=>q(pe,C)),P=$(W,X,J,C);return P}case"ParenthesisNode":return q(_.content,C);case"AccessorNode":return F(q(_.object,C),q(_.index,C),C);case"ArrayNode":{var se=_.items.map(pe=>q(pe,C));return se.some(er)?new c(se.map(A)):t(se)}case"IndexNode":return new s(_.dimensions.map(pe=>g(pe,C)));case"ObjectNode":{var ie={};for(var re in _.properties)ie[re]=g(_.properties[re],C);return new m(ie)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(_.type))}}return g}),kc="simplifyCore",wF=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],NF=I(kc,wF,e=>{var{typed:r,parse:i,equal:a,isZero:t,add:n,subtract:u,multiply:f,divide:c,pow:l,AccessorNode:o,ArrayNode:s,ConstantNode:m,FunctionNode:v,IndexNode:d,ObjectNode:p,OperatorNode:h,ParenthesisNode:y,SymbolNode:E}=e,g=new m(0),w=new m(1),x=new m(!0),b=new m(!1);function A(B){return mr(B)&&["and","not","or"].includes(B.op)}var{hasProperty:D,isCommutative:S}=lo({FunctionNode:v,OperatorNode:h,SymbolNode:E});function N(B){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=F?F.context:void 0;if(D(B,"trivial",$)){if(Ot(B)&&B.args.length===1)return N(B.args[0],F);var q=!1,_=0;if(B.forEach(K=>{++_,_===1&&(q=N(K,F))}),_===1)return q}var C=B;if(Ot(C)){var T=B2(C.name);if(T){if(C.args.length>2&&D(C,"associative",$))for(;C.args.length>2;){var H=C.args.pop(),O=C.args.pop();C.args.push(new h(T,C.name,[H,O]))}C=new h(T,C.name,C.args)}else return new v(N(C.fn),C.args.map(K=>N(K,F)))}if(mr(C)&&C.isUnary()){var L=N(C.args[0],F);if(C.op==="~"&&mr(L)&&L.isUnary()&&L.op==="~"||C.op==="not"&&mr(L)&&L.isUnary()&&L.op==="not"&&A(L.args[0]))return L.args[0];var W=!0;if(C.op==="-"&&mr(L)&&(L.isBinary()&&L.fn==="subtract"&&(C=new h("-","subtract",[L.args[1],L.args[0]]),W=!1),L.isUnary()&&L.op==="-"))return L.args[0];if(W)return new h(C.op,C.fn,[L])}if(mr(C)&&C.isBinary()){var X=N(C.args[0],F),P=N(C.args[1],F);if(C.op==="+"){if(We(X)&&t(X.value))return P;if(We(P)&&t(P.value))return X;mr(P)&&P.isUnary()&&P.op==="-"&&(P=P.args[0],C=new h("-","subtract",[X,P]))}if(C.op==="-")return mr(P)&&P.isUnary()&&P.op==="-"?N(new h("+","add",[X,P.args[0]]),F):We(X)&&t(X.value)?N(new h("-","unaryMinus",[P])):We(P)&&t(P.value)?X:new h(C.op,C.fn,[X,P]);if(C.op==="*"){if(We(X)){if(t(X.value))return g;if(a(X.value,1))return P}if(We(P)){if(t(P.value))return g;if(a(P.value,1))return X;if(S(C,$))return new h(C.op,C.fn,[P,X],C.implicit)}return new h(C.op,C.fn,[X,P],C.implicit)}if(C.op==="/")return We(X)&&t(X.value)?g:We(P)&&a(P.value,1)?X:new h(C.op,C.fn,[X,P]);if(C.op==="^"&&We(P)){if(t(P.value))return w;if(a(P.value,1))return X}if(C.op==="and"){if(We(X))if(X.value){if(A(P))return P}else return b;if(We(P))if(P.value){if(A(X))return X}else return b}if(C.op==="or"){if(We(X)){if(X.value)return x;if(A(P))return P}if(We(P)){if(P.value)return x;if(A(X))return X}}return new h(C.op,C.fn,[X,P])}if(mr(C))return new h(C.op,C.fn,C.args.map(K=>N(K,F)));if(Vr(C))return new s(C.items.map(K=>N(K,F)));if(Gt(C))return new o(N(C.object,F),N(C.index,F));if(An(C))return new d(C.dimensions.map(K=>N(K,F)));if(Xa(C)){var J={};for(var ee in C.properties)J[ee]=N(C.properties[ee],F);return new p(J)}return C}return r(kc,{Node:N,"Node,Object":N})}),DF="resolve",AF=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],EF=I(DF,AF,e=>{var{typed:r,parse:i,ConstantNode:a,FunctionNode:t,OperatorNode:n,ParenthesisNode:u}=e;function f(c,l){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!l)return c;if(yr(c)){if(o.has(c.name)){var s=Array.from(o).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(s,"}"))}var m=l.get(c.name);if(er(m)){var v=new Set(o);return v.add(c.name),f(m,l,v)}else return typeof m=="number"?i(String(m)):m!==void 0?new a(m):c}else if(mr(c)){var d=c.args.map(function(h){return f(h,l,o)});return new n(c.op,c.fn,d,c.implicit)}else{if(Dt(c))return new u(f(c.content,l,o));if(Ot(c)){var p=c.args.map(function(h){return f(h,l,o)});return new t(c.name,p)}}return c.map(h=>f(h,l,o))}return r("resolve",{Node:f,"Node, Map | null | undefined":f,"Node, Object":(c,l)=>f(c,dn(l)),"Array | Matrix":r.referToSelf(c=>l=>l.map(o=>c(o))),"Array | Matrix, null | undefined":r.referToSelf(c=>l=>l.map(o=>c(o))),"Array, Object":r.referTo("Array,Map",c=>(l,o)=>c(l,dn(o))),"Matrix, Object":r.referTo("Matrix,Map",c=>(l,o)=>c(l,dn(o))),"Array | Matrix, Map":r.referToSelf(c=>(l,o)=>l.map(s=>c(s,o)))})}),Hc="symbolicEqual",SF=["parse","simplify","typed","OperatorNode"],CF=I(Hc,SF,e=>{var{parse:r,simplify:i,typed:a,OperatorNode:t}=e;function n(u,f){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=new t("-","subtract",[u,f]),o=i(l,{},c);return We(o)&&!o.value}return a(Hc,{"Node, Node":n,"Node, Node, Object":n})}),Gc="derivative",MF=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],FF=I(Gc,MF,e=>{var{typed:r,config:i,parse:a,simplify:t,equal:n,isZero:u,numeric:f,ConstantNode:c,FunctionNode:l,OperatorNode:o,ParenthesisNode:s,SymbolNode:m}=e;function v(w,x){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},A={};h(A,w,x.name);var D=y(w,A);return b.simplify?t(D):D}r.addConversion({from:"identifier",to:"SymbolNode",convert:a});var d=r(Gc,{"Node, SymbolNode":v,"Node, SymbolNode, Object":v});r.removeConversion({from:"identifier",to:"SymbolNode",convert:a}),d._simplify=!0,d.toTex=function(w){return p.apply(null,w.args)};var p=r("_derivTex",{"Node, SymbolNode":function(x,b){return We(x)&&nr(x.value)==="string"?p(a(x.value).toString(),b.toString(),1):p(x.toTex(),b.toString(),1)},"Node, ConstantNode":function(x,b){if(nr(b.value)==="string")return p(x,a(b.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(x,b,A){return p(x.toString(),b.name,A.value)},"string, string, number":function(x,b,A){var D;return A===1?D="{d\\over d"+b+"}":D="{d^{"+A+"}\\over d"+b+"^{"+A+"}}",D+"\\left[".concat(x,"\\right]")}}),h=r("constTag",{"Object, ConstantNode, string":function(x,b){return x[b]=!0,!0},"Object, SymbolNode, string":function(x,b,A){return b.name!==A?(x[b]=!0,!0):!1},"Object, ParenthesisNode, string":function(x,b,A){return h(x,b.content,A)},"Object, FunctionAssignmentNode, string":function(x,b,A){return b.params.indexOf(A)===-1?(x[b]=!0,!0):h(x,b.expr,A)},"Object, FunctionNode | OperatorNode, string":function(x,b,A){if(b.args.length>0){for(var D=h(x,b.args[0],A),S=1;S<b.args.length;++S)D=h(x,b.args[S],A)&&D;if(D)return x[b]=!0,!0}return!1}}),y=r("_derivative",{"ConstantNode, Object":function(x){return g(0)},"SymbolNode, Object":function(x,b){return b[x]!==void 0?g(0):g(1)},"ParenthesisNode, Object":function(x,b){return new s(y(x.content,b))},"FunctionAssignmentNode, Object":function(x,b){return b[x]!==void 0?g(0):y(x.expr,b)},"FunctionNode, Object":function(x,b){if(x.args.length!==1&&E(x),b[x]!==void 0)return g(0);var A=x.args[0],D,S=!1,N=!1,B;switch(x.name){case"cbrt":S=!0,B=new o("*","multiply",[g(3),new o("^","pow",[A,new o("/","divide",[g(2),g(3)])])]);break;case"sqrt":case"nthRoot":if(x.args.length===1)S=!0,B=new o("*","multiply",[g(2),new l("sqrt",[A])]);else if(x.args.length===2)return D=new o("/","divide",[g(1),x.args[1]]),b[D]=b[x.args[1]],y(new o("^","pow",[A,D]),b);break;case"log10":D=g(10);case"log":if(!D&&x.args.length===1)B=A.clone(),S=!0;else if(x.args.length===1&&D||x.args.length===2&&b[x.args[1]]!==void 0)B=new o("*","multiply",[A.clone(),new l("log",[D||x.args[1]])]),S=!0;else if(x.args.length===2)return y(new o("/","divide",[new l("log",[A]),new l("log",[x.args[1]])]),b);break;case"pow":return b[D]=b[x.args[1]],y(new o("^","pow",[A,x.args[1]]),b);case"exp":B=new l("exp",[A.clone()]);break;case"sin":B=new l("cos",[A.clone()]);break;case"cos":B=new o("-","unaryMinus",[new l("sin",[A.clone()])]);break;case"tan":B=new o("^","pow",[new l("sec",[A.clone()]),g(2)]);break;case"sec":B=new o("*","multiply",[x,new l("tan",[A.clone()])]);break;case"csc":N=!0,B=new o("*","multiply",[x,new l("cot",[A.clone()])]);break;case"cot":N=!0,B=new o("^","pow",[new l("csc",[A.clone()]),g(2)]);break;case"asin":S=!0,B=new l("sqrt",[new o("-","subtract",[g(1),new o("^","pow",[A.clone(),g(2)])])]);break;case"acos":S=!0,N=!0,B=new l("sqrt",[new o("-","subtract",[g(1),new o("^","pow",[A.clone(),g(2)])])]);break;case"atan":S=!0,B=new o("+","add",[new o("^","pow",[A.clone(),g(2)]),g(1)]);break;case"asec":S=!0,B=new o("*","multiply",[new l("abs",[A.clone()]),new l("sqrt",[new o("-","subtract",[new o("^","pow",[A.clone(),g(2)]),g(1)])])]);break;case"acsc":S=!0,N=!0,B=new o("*","multiply",[new l("abs",[A.clone()]),new l("sqrt",[new o("-","subtract",[new o("^","pow",[A.clone(),g(2)]),g(1)])])]);break;case"acot":S=!0,N=!0,B=new o("+","add",[new o("^","pow",[A.clone(),g(2)]),g(1)]);break;case"sinh":B=new l("cosh",[A.clone()]);break;case"cosh":B=new l("sinh",[A.clone()]);break;case"tanh":B=new o("^","pow",[new l("sech",[A.clone()]),g(2)]);break;case"sech":N=!0,B=new o("*","multiply",[x,new l("tanh",[A.clone()])]);break;case"csch":N=!0,B=new o("*","multiply",[x,new l("coth",[A.clone()])]);break;case"coth":N=!0,B=new o("^","pow",[new l("csch",[A.clone()]),g(2)]);break;case"asinh":S=!0,B=new l("sqrt",[new o("+","add",[new o("^","pow",[A.clone(),g(2)]),g(1)])]);break;case"acosh":S=!0,B=new l("sqrt",[new o("-","subtract",[new o("^","pow",[A.clone(),g(2)]),g(1)])]);break;case"atanh":S=!0,B=new o("-","subtract",[g(1),new o("^","pow",[A.clone(),g(2)])]);break;case"asech":S=!0,N=!0,B=new o("*","multiply",[A.clone(),new l("sqrt",[new o("-","subtract",[g(1),new o("^","pow",[A.clone(),g(2)])])])]);break;case"acsch":S=!0,N=!0,B=new o("*","multiply",[new l("abs",[A.clone()]),new l("sqrt",[new o("+","add",[new o("^","pow",[A.clone(),g(2)]),g(1)])])]);break;case"acoth":S=!0,N=!0,B=new o("-","subtract",[g(1),new o("^","pow",[A.clone(),g(2)])]);break;case"abs":B=new o("/","divide",[new l(new m("abs"),[A.clone()]),A.clone()]);break;case"gamma":default:throw new Error('Function "'+x.name+'" is not supported by derivative, or a wrong number of arguments is passed')}var F,$;S?(F="/",$="divide"):(F="*",$="multiply");var q=y(A,b);return N&&(q=new o("-","unaryMinus",[q])),new o(F,$,[q,B])},"OperatorNode, Object":function(x,b){if(b[x]!==void 0)return g(0);if(x.op==="+")return new o(x.op,x.fn,x.args.map(function(C){return y(C,b)}));if(x.op==="-"){if(x.isUnary())return new o(x.op,x.fn,[y(x.args[0],b)]);if(x.isBinary())return new o(x.op,x.fn,[y(x.args[0],b),y(x.args[1],b)])}if(x.op==="*"){var A=x.args.filter(function(C){return b[C]!==void 0});if(A.length>0){var D=x.args.filter(function(C){return b[C]===void 0}),S=D.length===1?D[0]:new o("*","multiply",D),N=A.concat(y(S,b));return new o("*","multiply",N)}return new o("+","add",x.args.map(function(C){return new o("*","multiply",x.args.map(function(T){return T===C?y(T,b):T.clone()}))}))}if(x.op==="/"&&x.isBinary()){var B=x.args[0],F=x.args[1];return b[F]!==void 0?new o("/","divide",[y(B,b),F]):b[B]!==void 0?new o("*","multiply",[new o("-","unaryMinus",[B]),new o("/","divide",[y(F,b),new o("^","pow",[F.clone(),g(2)])])]):new o("/","divide",[new o("-","subtract",[new o("*","multiply",[y(B,b),F.clone()]),new o("*","multiply",[B.clone(),y(F,b)])]),new o("^","pow",[F.clone(),g(2)])])}if(x.op==="^"&&x.isBinary()){var $=x.args[0],q=x.args[1];if(b[$]!==void 0)return We($)&&(u($.value)||n($.value,1))?g(0):new o("*","multiply",[x,new o("*","multiply",[new l("log",[$.clone()]),y(q.clone(),b)])]);if(b[q]!==void 0){if(We(q)){if(u(q.value))return g(0);if(n(q.value,1))return y($,b)}var _=new o("^","pow",[$.clone(),new o("-","subtract",[q,g(1)])]);return new o("*","multiply",[q.clone(),new o("*","multiply",[y($,b),_])])}return new o("*","multiply",[new o("^","pow",[$.clone(),q.clone()]),new o("+","add",[new o("*","multiply",[y($,b),new o("/","divide",[q.clone(),$.clone()])]),new o("*","multiply",[y(q,b),new l("log",[$.clone()])])])])}throw new Error('Operator "'+x.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function E(w){if(!((w.name==="log"||w.name==="nthRoot"||w.name==="pow")&&w.args.length===2)){for(var x=0;x<w.args.length;++x)w.args[x]=g(0);throw w.compile().evaluate(),new Error("Expected TypeError, but none found")}}function g(w,x){return new c(f(w,x||i.number))}return d}),Vc="rationalize",BF=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],TF=I(Vc,BF,e=>{var{config:r,typed:i,equal:a,isZero:t,add:n,subtract:u,multiply:f,divide:c,pow:l,parse:o,simplifyConstant:s,simplifyCore:m,simplify:v,fraction:d,bignumber:p,mathWithTransform:h,matrix:y,AccessorNode:E,ArrayNode:g,ConstantNode:w,FunctionNode:x,IndexNode:b,ObjectNode:A,OperatorNode:D,SymbolNode:S,ParenthesisNode:N}=e;function B(C){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=$(),L=F(C,T,!0,O.firstRules),W=L.variables.length,X={exactFractions:!1},P={exactFractions:!0};if(C=L.expression,W>=1){C=q(C);var J,ee,K=!0,oe=!1;C=v(C,O.firstRules,{},X);for(var se;ee=K?O.distrDivRules:O.sucDivRules,C=v(C,ee,{},P),K=!K,se=C.toString(),se!==J;)oe=!0,J=se;oe&&(C=v(C,O.firstRulesAgain,{},X)),C=v(C,O.finalRules,{},X)}var ie=[],re={};return C.type==="OperatorNode"&&C.isBinary()&&C.op==="/"?(W===1&&(C.args[0]=_(C.args[0],ie),C.args[1]=_(C.args[1])),H&&(re.numerator=C.args[0],re.denominator=C.args[1])):(W===1&&(C=_(C,ie)),H&&(re.numerator=C,re.denominator=null)),H?(re.coefficients=ie,re.variables=L.variables,re.expression=C,re):C}return i(Vc,{Node:B,"Node, boolean":(C,T)=>B(C,{},T),"Node, Object":B,"Node, Object, boolean":B});function F(C,T,H,O){var L=[],W=v(C,O,T,{exactFractions:!1});H=!!H;var X="+-*"+(H?"/":"");J(W);var P={};return P.expression=W,P.variables=L,P;function J(ee){var K=ee.type;if(K==="FunctionNode")throw new Error("There is an unsolved function call");if(K==="OperatorNode")if(ee.op==="^"){if(ee.args[1].type!=="ConstantNode"||!Ce(parseFloat(ee.args[1].value)))throw new Error("There is a non-integer exponent");J(ee.args[0])}else{if(X.indexOf(ee.op)===-1)throw new Error("Operator "+ee.op+" invalid in polynomial expression");for(var oe=0;oe<ee.args.length;oe++)J(ee.args[oe])}else if(K==="SymbolNode"){var se=ee.name,ie=L.indexOf(se);ie===-1&&L.push(se)}else if(K==="ParenthesisNode")J(ee.content);else if(K!=="ConstantNode")throw new Error("type "+K+" is not allowed in polynomial expression")}}function $(){var C=[m,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},s,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],T=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],H=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],O=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],L={};return L.firstRules=C.concat(T,O),L.distrDivRules=H,L.sucDivRules=O,L.firstRulesAgain=C.concat(T),L.finalRules=[m,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},s,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],L}function q(C,T,H){var O=C.type,L=arguments.length>1;if(O==="OperatorNode"&&C.isBinary()){var W=!1,X;if(C.op==="^"&&(C.args[0].type==="ParenthesisNode"||C.args[0].type==="OperatorNode")&&C.args[1].type==="ConstantNode"&&(X=parseFloat(C.args[1].value),W=X>=2&&Ce(X)),W){if(X>2){var P=C.args[0],J=new D("^","pow",[C.args[0].cloneDeep(),new w(X-1)]);C=new D("*","multiply",[P,J])}else C=new D("*","multiply",[C.args[0],C.args[0].cloneDeep()]);L&&(H==="content"?T.content=C:T.args[H]=C)}}if(O==="ParenthesisNode")q(C.content,C,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var ee=0;ee<C.args.length;ee++)q(C.args[ee],C,ee);if(!L)return C}function _(C,T){T===void 0&&(T=[]),T[0]=0;var H={};H.cte=1,H.oper="+",H.fire="";var O=0,L="";se(C,null,H),O=T.length-1;for(var W=!0,X,P=O;P>=0;P--)if(T[P]!==0){var J=new w(W?T[P]:Math.abs(T[P])),ee=T[P]<0?"-":"+";if(P>0){var K=new S(L);if(P>1){var oe=new w(P);K=new D("^","pow",[K,oe])}T[P]===-1&&W?J=new D("-","unaryMinus",[K]):Math.abs(T[P])===1?J=K:J=new D("*","multiply",[J,K])}W?X=J:ee==="+"?X=new D("+","add",[X,J]):X=new D("-","subtract",[X,J]),W=!1}if(W)return new w(0);return X;function se(ie,re,pe){var Ae=ie.type;if(Ae==="FunctionNode")throw new Error("There is an unsolved function call");if(Ae==="OperatorNode"){if("+-*^".indexOf(ie.op)===-1)throw new Error("Operator "+ie.op+" invalid");if(re!==null){if((ie.fn==="unaryMinus"||ie.fn==="pow")&&re.fn!=="add"&&re.fn!=="subtract"&&re.fn!=="multiply")throw new Error("Invalid "+ie.op+" placing");if((ie.fn==="subtract"||ie.fn==="add"||ie.fn==="multiply")&&re.fn!=="add"&&re.fn!=="subtract")throw new Error("Invalid "+ie.op+" placing");if((ie.fn==="subtract"||ie.fn==="add"||ie.fn==="unaryMinus")&&pe.noFil!==0)throw new Error("Invalid "+ie.op+" placing")}(ie.op==="^"||ie.op==="*")&&(pe.fire=ie.op);for(var be=0;be<ie.args.length;be++)ie.fn==="unaryMinus"&&(pe.oper="-"),(ie.op==="+"||ie.fn==="subtract")&&(pe.fire="",pe.cte=1,pe.oper=be===0?"+":ie.op),pe.noFil=be,se(ie.args[be],ie,pe)}else if(Ae==="SymbolNode"){if(ie.name!==L&&L!=="")throw new Error("There is more than one variable");if(L=ie.name,re===null){T[1]=1;return}if(re.op==="^"&&pe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(re.op==="*"&&pe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(pe.fire===""||pe.fire==="*")&&(O<1&&(T[1]=0),T[1]+=pe.cte*(pe.oper==="+"?1:-1),O=Math.max(1,O))}else if(Ae==="ConstantNode"){var Ne=parseFloat(ie.value);if(re===null){T[0]=Ne;return}if(re.op==="^"){if(pe.noFil!==1)throw new Error("Constant cannot be powered");if(!Ce(Ne)||Ne<=0)throw new Error("Non-integer exponent is not allowed");for(var U=O+1;U<Ne;U++)T[U]=0;Ne>O&&(T[Ne]=0),T[Ne]+=pe.cte*(pe.oper==="+"?1:-1),O=Math.max(Ne,O);return}pe.cte=Ne,pe.fire===""&&(T[0]+=pe.cte*(pe.oper==="+"?1:-1))}else throw new Error("Type "+Ae+" is not allowed")}}}),Zc="zpk2tf",OF=["typed","add","multiply","Complex","number"],$F=I(Zc,OF,e=>{var{typed:r,add:i,multiply:a,Complex:t,number:n}=e;return r(Zc,{"Array,Array,number":function(l,o,s){return u(l,o,s)},"Array,Array":function(l,o){return u(l,o,1)},"Matrix,Matrix,number":function(l,o,s){return u(l.valueOf(),o.valueOf(),s)},"Matrix,Matrix":function(l,o){return u(l.valueOf(),o.valueOf(),1)}});function u(c,l,o){c.some(E=>E.type==="BigNumber")&&(c=c.map(E=>n(E))),l.some(E=>E.type==="BigNumber")&&(l=l.map(E=>n(E)));for(var s=[t(1,0)],m=[t(1,0)],v=0;v<c.length;v++){var d=c[v];typeof d=="number"&&(d=t(d,0)),s=f(s,[t(1,0),t(-d.re,-d.im)])}for(var p=0;p<l.length;p++){var h=l[p];typeof h=="number"&&(h=t(h,0)),m=f(m,[t(1,0),t(-h.re,-h.im)])}for(var y=0;y<s.length;y++)s[y]=a(s[y],o);return[s,m]}function f(c,l){for(var o=[],s=0;s<c.length+l.length-1;s++){o[s]=t(0,0);for(var m=0;m<c.length;m++)s-m>=0&&s-m<l.length&&(o[s]=i(o[s],a(c[m],l[s-m])))}return o}}),Yc="freqz",_F=["typed","add","multiply","Complex","divide","matrix"],IF=I(Yc,_F,e=>{var{typed:r,add:i,multiply:a,Complex:t,divide:n,matrix:u}=e;return r(Yc,{"Array, Array":function(o,s){var m=c(512);return f(o,s,m)},"Array, Array, Array":function(o,s,m){return f(o,s,m)},"Array, Array, number":function(o,s,m){if(m<0)throw new Error("w must be a positive number");var v=c(m);return f(o,s,v)},"Matrix, Matrix":function(o,s){var m=c(512),{w:v,h:d}=f(o.valueOf(),s.valueOf(),m);return{w:u(v),h:u(d)}},"Matrix, Matrix, Matrix":function(o,s,m){var{h:v}=f(o.valueOf(),s.valueOf(),m.valueOf());return{h:u(v),w:u(m)}},"Matrix, Matrix, number":function(o,s,m){if(m<0)throw new Error("w must be a positive number");var v=c(m),{h:d}=f(o.valueOf(),s.valueOf(),v);return{h:u(d),w:u(v)}}});function f(l,o,s){for(var m=[],v=[],d=0;d<s.length;d++){for(var p=t(0,0),h=t(0,0),y=0;y<l.length;y++)p=i(p,a(l[y],t(Math.cos(-y*s[d]),Math.sin(-y*s[d]))));for(var E=0;E<o.length;E++)h=i(h,a(o[E],t(Math.cos(-E*s[d]),Math.sin(-E*s[d]))));m.push(p),v.push(h)}for(var g=[],w=0;w<m.length;w++)g.push(n(m[w],v[w]));return{h:g,w:s}}function c(l){for(var o=[],s=0;s<l;s++)o.push(s/l*Math.PI);return o}}),RF="reviver",qF=["classes"],zF=I(RF,qF,e=>{var{classes:r}=e;return function(a,t){var n=r[t&&t.mathjs];return n&&typeof n.fromJSON=="function"?n.fromJSON(t):t}}),PF="replacer",UF=[],LF=I(PF,UF,()=>function(r,i){return typeof i=="number"&&(!isFinite(i)||isNaN(i))?{mathjs:"number",value:String(i)}:i}),kF="11.9.1",HF=I("true",[],()=>!0),GF=I("false",[],()=>!1),VF=I("null",[],()=>null),ZF=kr("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(1/0):1/0}),YF=kr("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(NaN):NaN}),WF=kr("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?ro(i):s0}),XF=kr("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?_w(i):l0}),JF=kr("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?Ow(i):c0}),QF=kr("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?$w(i):f0}),KF=kr("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(2).ln():Math.LN2}),jF=kr("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(10).ln():Math.LN10}),e4=kr("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(1).div(new i(2).ln()):Math.LOG2E}),r4=kr("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(1).div(new i(10).ln()):Math.LOG10E}),t4=kr("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i("0.5").sqrt():Math.SQRT1_2}),n4=kr("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:i}=e;return r.number==="BigNumber"?new i(2).sqrt():Math.SQRT2}),a4=kr("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),i4=I("version",[],()=>kF);function kr(e,r,i){return I(e,r,i,{recreateOnConfigChange:!0})}var o4=qe("speedOfLight","299792458","m s^-1"),u4=qe("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),s4=qe("planckConstant","6.62607015e-34","J s"),l4=qe("reducedPlanckConstant","1.0545718176461565e-34","J s"),c4=qe("magneticConstant","1.25663706212e-6","N A^-2"),f4=qe("electricConstant","8.8541878128e-12","F m^-1"),m4=qe("vacuumImpedance","376.730313667","ohm"),v4=qe("coulomb","8.987551792261171e9","N m^2 C^-2"),p4=qe("elementaryCharge","1.602176634e-19","C"),d4=qe("bohrMagneton","9.2740100783e-24","J T^-1"),h4=qe("conductanceQuantum","7.748091729863649e-5","S"),g4=qe("inverseConductanceQuantum","12906.403729652257","ohm"),y4=qe("magneticFluxQuantum","2.0678338484619295e-15","Wb"),b4=qe("nuclearMagneton","5.0507837461e-27","J T^-1"),x4=qe("klitzing","25812.807459304513","ohm"),w4=qe("bohrRadius","5.29177210903e-11","m"),N4=qe("classicalElectronRadius","2.8179403262e-15","m"),D4=qe("electronMass","9.1093837015e-31","kg"),A4=qe("fermiCoupling","1.1663787e-5","GeV^-2"),E4=ui("fineStructure",.0072973525693),S4=qe("hartreeEnergy","4.3597447222071e-18","J"),C4=qe("protonMass","1.67262192369e-27","kg"),M4=qe("deuteronMass","3.3435830926e-27","kg"),F4=qe("neutronMass","1.6749271613e-27","kg"),B4=qe("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),T4=qe("rydberg","10973731.568160","m^-1"),O4=qe("thomsonCrossSection","6.6524587321e-29","m^2"),$4=ui("weakMixingAngle",.2229),_4=ui("efimovFactor",22.7),I4=qe("atomicMass","1.66053906660e-27","kg"),R4=qe("avogadro","6.02214076e23","mol^-1"),q4=qe("boltzmann","1.380649e-23","J K^-1"),z4=qe("faraday","96485.33212331001","C mol^-1"),P4=qe("firstRadiation","3.7417718521927573e-16","W m^2"),U4=qe("loschmidt","2.686780111798444e25","m^-3"),L4=qe("gasConstant","8.31446261815324","J K^-1 mol^-1"),k4=qe("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),H4=qe("molarVolume","0.022413969545014137","m^3 mol^-1"),G4=ui("sackurTetrode",-1.16487052358),V4=qe("secondRadiation","0.014387768775039337","m K"),Z4=qe("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Y4=qe("wienDisplacement","2.897771955e-3","m K"),W4=qe("molarMass","0.99999999965e-3","kg mol^-1"),X4=qe("molarMassC12","11.9999999958e-3","kg mol^-1"),J4=qe("gravity","9.80665","m s^-2"),Q4=qe("planckLength","1.616255e-35","m"),K4=qe("planckMass","2.176435e-8","kg"),j4=qe("planckTime","5.391245e-44","s"),eB=qe("planckCharge","1.87554603778e-18","C"),rB=qe("planckTemperature","1.416785e+32","K");function qe(e,r,i){var a=["config","Unit","BigNumber"];return I(e,a,t=>{var{config:n,Unit:u,BigNumber:f}=t,c=n.number==="BigNumber"?new f(r):parseFloat(r),l=new u(c,i);return l.fixPrefix=!0,l})}function ui(e,r){var i=["config","BigNumber"];return I(e,i,a=>{var{config:t,BigNumber:n}=a;return t.number==="BigNumber"?new n(r):r})}var tB="apply",nB=["typed","isInteger"],aB=I(tB,nB,e=>{var{typed:r,isInteger:i}=e,a=Om({typed:r,isInteger:i});return r("apply",{"...any":function(n){var u=n[1];Ve(u)?n[1]=u-1:ke(u)&&(n[1]=u.minus(1));try{return a.apply(null,n)}catch(f){throw _r(f)}}})},{isTransformFunction:!0}),iB="column",oB=["typed","Index","matrix","range"],uB=I(iB,oB,e=>{var{typed:r,Index:i,matrix:a,range:t}=e,n=Rm({typed:r,Index:i,matrix:a,range:t});return r("column",{"...any":function(f){var c=f.length-1,l=f[c];Ve(l)&&(f[c]=l-1);try{return n.apply(null,f)}catch(o){throw _r(o)}}})},{isTransformFunction:!0});function co(e,r,i){var a=e.filter(function(f){return yr(f)&&!(f.name in r)&&!i.has(f.name)})[0];if(!a)throw new Error('No undefined variable found in inline expression "'+e+'"');var t=a.name,n=Hn(i),u=e.compile();return function(c){return n.set(t,c),u.evaluate(n)}}var sB="filter",lB=["typed"],cB=I(sB,lB,e=>{var{typed:r}=e;function i(t,n,u){var f,c;return t[0]&&(f=t[0].compile().evaluate(u)),t[1]&&(yr(t[1])||Qn(t[1])?c=t[1].compile().evaluate(u):c=co(t[1],n,u)),a(f,c)}i.rawArgs=!0;var a=r("filter",{"Array, function":Wc,"Matrix, function":function(n,u){return n.create(Wc(n.toArray(),u))},"Array, RegExp":Ba,"Matrix, RegExp":function(n,u){return n.create(Ba(n.toArray(),u))}});return i},{isTransformFunction:!0});function Wc(e,r){return gf(e,function(i,a,t){return Mn(r,i,[a+1],t,"filter")})}var fB="forEach",mB=["typed"],vB=I(fB,mB,e=>{var{typed:r}=e;function i(t,n,u){var f,c;return t[0]&&(f=t[0].compile().evaluate(u)),t[1]&&(yr(t[1])||Qn(t[1])?c=t[1].compile().evaluate(u):c=co(t[1],n,u)),a(f,c)}i.rawArgs=!0;var a=r("forEach",{"Array | Matrix, function":function(n,u){var f=function c(l,o){if(Array.isArray(l))Ka(l,function(s,m){c(s,o.concat(m+1))});else return Mn(u,l,o,n,"forEach")};f(n.valueOf(),[])}});return i},{isTransformFunction:!0}),pB="index",dB=["Index"],hB=I(pB,dB,e=>{var{Index:r}=e;return function(){for(var a=[],t=0,n=arguments.length;t<n;t++){var u=arguments[t];if(ki(u))u.start--,u.end-=u.step>0?0:2;else if(u&&u.isSet===!0)u=u.map(function(c){return c-1});else if(je(u)||Be(u))u=u.map(function(c){return c-1});else if(Ve(u))u--;else if(ke(u))u=u.toNumber()-1;else if(typeof u!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");a[t]=u}var f=new r;return r.apply(f,a),f}},{isTransformFunction:!0}),gB="map",yB=["typed"],bB=I(gB,yB,e=>{var{typed:r}=e;function i(t,n,u){var f,c;return t[0]&&(f=t[0].compile().evaluate(u)),t[1]&&(yr(t[1])||Qn(t[1])?c=t[1].compile().evaluate(u):c=co(t[1],n,u)),a(f,c)}i.rawArgs=!0;var a=r("map",{"Array, function":function(n,u){return Xc(n,u,n)},"Matrix, function":function(n,u){return n.create(Xc(n.valueOf(),u,n))}});return i},{isTransformFunction:!0});function Xc(e,r,i){function a(t,n){return Array.isArray(t)?Nt(t,function(u,f){return a(u,n.concat(f+1))}):Mn(r,t,n,i,"map")}return a(e,[])}function Jt(e){if(e.length===2&&st(e[0])){e=e.slice();var r=e[1];Ve(r)?e[1]=r-1:ke(r)&&(e[1]=r.minus(1))}return e}var xB="max",wB=["typed","config","numeric","larger"],NB=I(xB,wB,e=>{var{typed:r,config:i,numeric:a,larger:t}=e,n=Hm({typed:r,config:i,numeric:a,larger:t});return r("max",{"...any":function(f){f=Jt(f);try{return n.apply(null,f)}catch(c){throw _r(c)}}})},{isTransformFunction:!0}),DB="mean",AB=["typed","add","divide"],EB=I(DB,AB,e=>{var{typed:r,add:i,divide:a}=e,t=Km({typed:r,add:i,divide:a});return r("mean",{"...any":function(u){u=Jt(u);try{return t.apply(null,u)}catch(f){throw _r(f)}}})},{isTransformFunction:!0}),SB="min",CB=["typed","config","numeric","smaller"],MB=I(SB,CB,e=>{var{typed:r,config:i,numeric:a,smaller:t}=e,n=Gm({typed:r,config:i,numeric:a,smaller:t});return r("min",{"...any":function(f){f=Jt(f);try{return n.apply(null,f)}catch(c){throw _r(c)}}})},{isTransformFunction:!0}),FB="range",BB=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],TB=I(FB,BB,e=>{var{typed:r,config:i,matrix:a,bignumber:t,smaller:n,smallerEq:u,larger:f,largerEq:c,add:l,isPositive:o}=e,s=Um({typed:r,config:i,matrix:a,bignumber:t,smaller:n,smallerEq:u,larger:f,largerEq:c,add:l,isPositive:o});return r("range",{"...any":function(v){var d=v.length-1,p=v[d];return typeof p!="boolean"&&v.push(!0),s.apply(null,v)}})},{isTransformFunction:!0}),OB="row",$B=["typed","Index","matrix","range"],_B=I(OB,$B,e=>{var{typed:r,Index:i,matrix:a,range:t}=e,n=Lm({typed:r,Index:i,matrix:a,range:t});return r("row",{"...any":function(f){var c=f.length-1,l=f[c];Ve(l)&&(f[c]=l-1);try{return n.apply(null,f)}catch(o){throw _r(o)}}})},{isTransformFunction:!0}),IB="subset",RB=["typed","matrix"],qB=I(IB,RB,e=>{var{typed:r,matrix:i}=e,a=km({typed:r,matrix:i});return r("subset",{"...any":function(n){try{return a.apply(null,n)}catch(u){throw _r(u)}}})},{isTransformFunction:!0}),zB="concat",PB=["typed","matrix","isInteger"],UB=I(zB,PB,e=>{var{typed:r,matrix:i,isInteger:a}=e,t=_m({typed:r,matrix:i,isInteger:a});return r("concat",{"...any":function(u){var f=u.length-1,c=u[f];Ve(c)?u[f]=c-1:ke(c)&&(u[f]=c.minus(1));try{return t.apply(null,u)}catch(l){throw _r(l)}}})},{isTransformFunction:!0}),Jc="diff",LB=["typed","matrix","subtract","number","bignumber"],kB=I(Jc,LB,e=>{var{typed:r,matrix:i,subtract:a,number:t,bignumber:n}=e,u=qm({typed:r,matrix:i,subtract:a,number:t,bignumber:n});return r(Jc,{"...any":function(c){c=Jt(c);try{return u.apply(null,c)}catch(l){throw _r(l)}}})},{isTransformFunction:!0}),HB="std",GB=["typed","map","sqrt","variance"],VB=I(HB,GB,e=>{var{typed:r,map:i,sqrt:a,variance:t}=e,n=ev({typed:r,map:i,sqrt:a,variance:t});return r("std",{"...any":function(f){f=Jt(f);try{return n.apply(null,f)}catch(c){throw _r(c)}}})},{isTransformFunction:!0}),Qc="sum",ZB=["typed","config","add","numeric"],YB=I(Qc,ZB,e=>{var{typed:r,config:i,add:a,numeric:t}=e,n=Jm({typed:r,config:i,add:a,numeric:t});return r(Qc,{"...any":function(f){f=Jt(f);try{return n.apply(null,f)}catch(c){throw _r(c)}}})},{isTransformFunction:!0}),Kc="cumsum",WB=["typed","add","unaryPlus"],XB=I(Kc,WB,e=>{var{typed:r,add:i,unaryPlus:a}=e,t=Qm({typed:r,add:i,unaryPlus:a});return r(Kc,{"...any":function(u){if(u.length===2&&st(u[0])){var f=u[1];Ve(f)?u[1]=f-1:ke(f)&&(u[1]=f.minus(1))}try{return t.apply(null,u)}catch(c){throw _r(c)}}})},{isTransformFunction:!0}),jc="variance",JB=["typed","add","subtract","multiply","divide","apply","isNaN"],QB=I(jc,JB,e=>{var{typed:r,add:i,subtract:a,multiply:t,divide:n,apply:u,isNaN:f}=e,c=jm({typed:r,add:i,subtract:a,multiply:t,divide:n,apply:u,isNaN:f});return r(jc,{"...any":function(o){o=Jt(o);try{return c.apply(null,o)}catch(s){throw _r(s)}}})},{isTransformFunction:!0}),xe=qh({config:me}),sr=Lh({}),ef=JF({BigNumber:xe,config:me}),KB=GF({}),jB=E4({BigNumber:xe,config:me}),Qt=Vh({}),nv=a4({Complex:sr}),eT=ZF({BigNumber:xe,config:me}),rT=jF({BigNumber:xe,config:me}),tT=r4({BigNumber:xe,config:me}),si=Qh({}),nT=YF({BigNumber:xe,config:me}),aT=VF({}),iT=QF({BigNumber:xe,config:me}),oT=Wh({}),av=Ld({}),uT=t4({BigNumber:xe,config:me}),sT=G4({BigNumber:xe,config:me}),iv=XF({BigNumber:xe,config:me}),lT=HF({}),cT=i4({}),Ue=r0({Matrix:si}),fT=_4({BigNumber:xe,config:me}),mT=KF({BigNumber:xe,config:me}),rf=WF({BigNumber:xe,config:me}),vT=LF({}),pT=n4({BigNumber:xe,config:me}),V=qd({BigNumber:xe,Complex:sr,DenseMatrix:Ue,Fraction:Qt}),fo=mg({BigNumber:xe,config:me,typed:V}),dT=$4({BigNumber:xe,config:me}),Ir=pg({typed:V}),hT=Vw({Complex:sr,config:me,typed:V}),gT=Xw({BigNumber:xe,typed:V}),yT=jw({BigNumber:xe,Complex:sr,config:me,typed:V}),vr=yg({typed:V}),bT=uy({typed:V}),xT=iN({BigNumber:xe,Complex:sr,config:me,typed:V}),wT=cN({typed:V}),ov=vN({typed:V}),NT=gN({Complex:sr,config:me,typed:V}),et=Z0({BigNumber:xe,typed:V}),DT=j1({typed:V}),AT=H0({typed:V}),ET=n0({typed:V}),li=w3({typed:V}),ci=X0({Complex:sr,typed:V}),Kt=ly({typed:V}),ST=wN({typed:V}),CT=EN({BigNumber:xe,typed:V}),MT=CN({BigNumber:xe,typed:V}),FT=Tg({typed:V}),Ze=T0({config:me,typed:V}),BT=Ob({typed:V}),uv=$g({typed:V}),TT=Ig({Complex:sr,typed:V}),OT=By({typed:V}),$T=_y({typed:V}),ea=Lb({typed:V}),_T=qy({typed:V}),IT=Yb({format:ea,typed:V}),mo=fy({typed:V}),Wr=i0({typed:V}),jt=h0({typed:V}),en=N0({typed:V}),it=A0({typed:V}),RT=e4({BigNumber:xe,config:me}),qT=C3({Complex:sr,typed:V}),zT=m1({Complex:sr,config:me,typed:V}),sv=p1({Complex:sr,config:me,typed:V}),rn=Hy({typed:V}),fr=D1({typed:V}),lv=dy({typed:V}),Et=P0({typed:V}),PT=Vb({format:ea,typed:V}),UT=K3({config:me,typed:V}),LT=Xb({typed:V}),kT=eF({config:me,typed:V}),vo=vy({typed:V}),HT=TN({BigNumber:xe,typed:V}),cv=F1({BigNumber:xe,Fraction:Qt,complex:ci,typed:V}),po=IN({typed:V}),St=_0({Matrix:si,equalScalar:Ze,typed:V}),GT=sg({typed:V}),VT=_1({typed:V}),ZT=L0({typed:V}),YT=PN({typed:V}),fv=M0({typed:V}),WT=Yw({Complex:sr,config:me,typed:V}),XT=rN({BigNumber:xe,typed:V}),ho=Om({isInteger:Wr,typed:V}),JT=nN({BigNumber:xe,Complex:sr,config:me,typed:V}),QT=Hb({format:ea,typed:V}),KT=D3({typed:V}),go=bN({typed:V}),jT=FN({BigNumber:xe,typed:V}),ra=S0({typed:V}),eO=jb({typed:V}),rO=tF({config:me,typed:V}),tO=$N({BigNumber:xe,typed:V}),nO=qN({typed:V}),aO=Lw({SparseMatrix:St,typed:V}),mt=O1({Complex:sr,config:me,typed:V}),iO=kN({typed:V}),vt=cg({typed:V}),oO=Qw({BigNumber:xe,Complex:sr,config:me,typed:V}),uO=DN({BigNumber:xe,typed:V}),Bn=K0({Fraction:Qt,typed:V}),tn=y0({typed:V}),we=eg({DenseMatrix:Ue,Matrix:si,SparseMatrix:St,typed:V}),sO=tg({isZero:it,matrix:we,typed:V}),lO=qb({isNaN:ra,isNumeric:tn,typed:V}),jr=tx({bignumber:et,fraction:Bn,number:Et}),mv=Pb({config:me,multiplyScalar:fr,numeric:jr,typed:V}),cO=Qy({isInteger:Wr,matrix:we,typed:V}),Mr=ub({matrix:we,config:me,typed:V}),fO=lb({matrix:we,typed:V}),Hr=km({matrix:we,typed:V}),ta=db({matrix:we,typed:V}),vv=z1({BigNumber:xe,config:me,matrix:we,typed:V}),pt=bb({BigNumber:xe,config:me,matrix:we,typed:V}),mO=uN({Complex:sr,config:me,typed:V}),pv=xg({BigNumber:xe,Complex:sr,Fraction:Qt,config:me,isNegative:jt,matrix:we,typed:V,unaryMinus:vt}),Qe=_m({isInteger:Wr,matrix:we,typed:V}),vO=Dy({prod:mv,size:Mr,typed:V}),yo=gb({conj:Kt,transpose:ta,typed:V}),dv=Cy({DenseMatrix:Ue,SparseMatrix:St,matrix:we,typed:V}),cr=ax({numeric:jr,typed:V}),na=yx({DenseMatrix:Ue,concat:Qe,divideScalar:cr,equalScalar:Ze,matrix:we,typed:V}),ot=Yx({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),aa=Oy({matrix:we,typed:V}),pO=a1({BigNumber:xe,DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),dO=x0({isNumeric:tn,typed:V}),qt=Py({BigNumber:xe,DenseMatrix:Ue,SparseMatrix:St,config:me,matrix:we,typed:V}),hO=Ly({matrix:we,multiplyScalar:fr,typed:V}),fi=uw({DenseMatrix:Ue,concat:Qe,config:me,matrix:we,typed:V}),gO=Bx({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V,zeros:pt}),bo=og({flatten:aa,matrix:we,size:Mr,typed:V}),hv=x1({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),yO=C1({BigNumber:xe,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),bO=Wy({BigNumber:xe,config:me,matrix:we,typed:V}),xO=eb({config:me,matrix:we}),wO=Ox({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V,zeros:pt}),mi=sx({BigNumber:xe,DenseMatrix:Ue,equalScalar:Ze,matrix:we,typed:V,zeros:pt}),Ur=Kx({DenseMatrix:Ue,concat:Qe,config:me,matrix:we,typed:V}),NO=Qb({concat:Qe,matrix:we,typed:V}),DO=mw({DenseMatrix:Ue,concat:Qe,config:me,equalScalar:Ze,matrix:we,typed:V}),AO=by({DenseMatrix:Ue,concat:Qe,matrix:we,typed:V}),Ke=c2({DenseMatrix:Ue,SparseMatrix:St,addScalar:vr,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),EO=Q1({concat:Qe,equalScalar:Ze,matrix:we,typed:V}),SO=iy({DenseMatrix:Ue,concat:Qe,matrix:we,typed:V}),CO=sF({addScalar:vr,combinations:li,divideScalar:cr,isInteger:Wr,isNegative:jt,multiplyScalar:fr,typed:V}),Tn=zx({BigNumber:xe,DenseMatrix:Ue,Fraction:Qt,concat:Qe,config:me,equalScalar:Ze,matrix:we,typed:V}),gv=Vx({concat:Qe,matrix:we,typed:V}),MO=Qm({add:Ke,typed:V,unaryPlus:fo}),xo=cw({equal:ot,typed:V}),vi=h2({addScalar:vr,conj:Kt,multiplyScalar:fr,size:Mr,typed:V}),FO=Jx({compareText:gv,isZero:it,typed:V}),yv=Lg({DenseMatrix:Ue,config:me,equalScalar:Ze,matrix:we,round:mi,typed:V,zeros:pt}),BO=m2({abs:Ir,addScalar:vr,divideScalar:cr,isPositive:en,multiplyScalar:fr,smaller:Ur,sqrt:mt,typed:V}),bv=Nw({DenseMatrix:Ue,smaller:Ur}),Er=Ew({ImmutableDenseMatrix:bv}),TO=U1({BigNumber:xe,add:Ke,config:me,equal:ot,isInteger:Wr,mod:hv,smaller:Ur,typed:V,xgcd:vv}),Lr=aw({DenseMatrix:Ue,concat:Qe,config:me,matrix:we,typed:V}),wo=cx({Complex:sr,config:me,divideScalar:cr,typed:V}),OO=ag({flatten:aa,matrix:we,size:Mr,typed:V}),$O=Gm({config:me,numeric:jr,smaller:Ur,typed:V}),ar=E1({addScalar:vr,dot:vi,equalScalar:Ze,matrix:we,multiplyScalar:fr,typed:V}),_O=px({Complex:sr,config:me,divideScalar:cr,typed:V}),IO=gy({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),No=dw({compare:Tn,isNaN:ra,isNumeric:tn,typed:V}),RO=y3({add:Ke,compare:Tn,multiply:ar,partitionSelect:No,typed:V}),qO=_x({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V,zeros:pt}),Do=rw({DenseMatrix:Ue,concat:Qe,config:me,matrix:we,typed:V}),or=R1({DenseMatrix:Ue,addScalar:vr,concat:Qe,equalScalar:Ze,matrix:we,typed:V,unaryMinus:vt}),zO=b2({add:Ke,matrix:we,typed:V}),Ao=Nx({DenseMatrix:Ue,divideScalar:cr,equalScalar:Ze,matrix:we,multiplyScalar:fr,subtract:or,typed:V}),PO=$F({Complex:sr,add:Ke,multiply:ar,number:Et,typed:V}),UO=Rx({concat:Qe,equalScalar:Ze,matrix:we,not:lv,typed:V,zeros:pt}),LO=ry({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),Eo=Fg({DenseMatrix:Ue,config:me,equalScalar:Ze,matrix:we,round:mi,typed:V,zeros:pt}),dt=kx({compare:Tn,typed:V}),kO=cF({addScalar:vr,combinations:li,isInteger:Wr,isNegative:jt,isPositive:en,larger:Lr,typed:V}),HO=Ey({matrix:we,multiply:ar,subtract:or,typed:V}),xv=_M({divideScalar:cr,isZero:it,matrix:we,multiply:ar,subtract:or,typed:V,unaryMinus:vt}),GO=qm({matrix:we,number:Et,subtract:or,typed:V}),VO=a3({abs:Ir,addScalar:vr,deepEqual:xo,divideScalar:cr,multiplyScalar:fr,sqrt:mt,subtract:or,typed:V}),ZO=G1({concat:Qe,equalScalar:Ze,matrix:we,multiplyScalar:fr,typed:V}),wv=Mw({larger:Lr,smaller:Ur}),Nv=zg({Complex:sr,DenseMatrix:Ue,ceil:Eo,equalScalar:Ze,floor:yv,matrix:we,typed:V,zeros:pt}),Dv=w2({Index:Er,typed:V}),YO=u3({abs:Ir,add:Ke,addScalar:vr,config:me,divideScalar:cr,equalScalar:Ze,flatten:aa,isNumeric:tn,isZero:it,matrix:we,multiply:ar,multiplyScalar:fr,smaller:Ur,subtract:or,typed:V}),WO=c1({concat:Qe,equalScalar:Ze,matrix:we,typed:V}),XO=mx({Complex:sr,config:me,divideScalar:cr,log:wo,typed:V}),Av=xx({DenseMatrix:Ue,divideScalar:cr,equalScalar:Ze,matrix:we,multiplyScalar:fr,subtract:or,typed:V}),So=Hm({config:me,larger:Lr,numeric:jr,typed:V}),Co=AD({addScalar:vr,complex:ci,conj:Kt,divideScalar:cr,equal:ot,identity:qt,isZero:it,matrix:we,multiplyScalar:fr,sign:cv,sqrt:mt,subtract:or,typed:V,unaryMinus:vt,zeros:pt}),Dn=Um({bignumber:et,matrix:we,add:Ke,config:me,isPositive:en,larger:Lr,largerEq:fi,smaller:Ur,smallerEq:Do,typed:V}),JO=Lm({Index:Er,matrix:we,range:Dn,typed:V}),QO=GN({DenseMatrix:Ue,Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),KO=WN({DenseMatrix:Ue,Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),jO=KN({Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),e5=t2({Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),Ev=WD({SparseMatrix:St,abs:Ir,add:Ke,divideScalar:cr,larger:Lr,largerEq:fi,multiply:ar,subtract:or,transpose:ta,typed:V}),r5=gw({compare:Tn,compareNatural:dt,matrix:we,typed:V}),Sv=Jm({add:Ke,config:me,numeric:jr,typed:V}),Cv=Sx({DenseMatrix:Ue,divideScalar:cr,equalScalar:Ze,matrix:we,multiplyScalar:fr,subtract:or,typed:V}),t5=dN({BigNumber:xe,DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,typed:V}),Mv=Rm({Index:Er,matrix:we,range:Dn,typed:V}),n5=Ax({DenseMatrix:Ue,divideScalar:cr,equalScalar:Ze,matrix:we,multiplyScalar:fr,subtract:or,typed:V}),Fv=ZN({DenseMatrix:Ue,Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),a5=e2({Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),Bv=o2({Index:Er,concat:Qe,setDifference:Fv,size:Mr,subset:Hr,typed:V}),Tv=Tw({FibonacciHeap:wv,addScalar:vr,equalScalar:Ze}),nn=RM({abs:Ir,addScalar:vr,det:xv,divideScalar:cr,identity:qt,matrix:we,multiply:ar,typed:V,unaryMinus:vt}),Ov=ND({DenseMatrix:Ue,Spa:Tv,SparseMatrix:St,abs:Ir,addScalar:vr,divideScalar:cr,equalScalar:Ze,larger:Lr,matrix:we,multiplyScalar:fr,subtract:or,typed:V,unaryMinus:vt}),i5=zM({Complex:sr,add:Ke,ctranspose:yo,deepEqual:xo,divideScalar:cr,dot:vi,dotDivide:na,equal:ot,inv:nn,matrix:we,multiply:ar,typed:V}),ht=ox({Complex:sr,config:me,fraction:Bn,identity:qt,inv:nn,matrix:we,multiply:ar,number:Et,typed:V}),$v=JN({DenseMatrix:Ue,Index:Er,compareNatural:dt,size:Mr,subset:Hr,typed:V}),o5=s2({Index:Er,concat:Qe,setIntersect:$v,setSymDifference:Bv,size:Mr,subset:Hr,typed:V}),u5=YM({abs:Ir,add:Ke,identity:qt,inv:nn,map:rn,max:So,multiply:ar,size:Mr,sqrt:mt,subtract:or,typed:V}),_e=qw({BigNumber:xe,Complex:sr,Fraction:Qt,abs:Ir,addScalar:vr,config:me,divideScalar:cr,equal:ot,fix:Nv,format:ea,isNumeric:tn,multiplyScalar:fr,number:Et,pow:ht,round:mi,subtract:or}),s5=m4({BigNumber:xe,Unit:_e,config:me}),l5=Y4({BigNumber:xe,Unit:_e,config:me}),c5=I4({BigNumber:xe,Unit:_e,config:me}),f5=d4({BigNumber:xe,Unit:_e,config:me}),m5=q4({BigNumber:xe,Unit:_e,config:me}),v5=h4({BigNumber:xe,Unit:_e,config:me}),p5=Hw({Unit:_e,typed:V}),d5=M4({BigNumber:xe,Unit:_e,config:me}),h5=hx({DenseMatrix:Ue,concat:Qe,equalScalar:Ze,matrix:we,pow:ht,typed:V}),g5=f4({BigNumber:xe,Unit:_e,config:me}),y5=p4({BigNumber:xe,Unit:_e,config:me}),b5=VM({abs:Ir,add:Ke,identity:qt,inv:nn,multiply:ar,typed:V}),x5=z4({BigNumber:xe,Unit:_e,config:me}),_v=wb({addScalar:vr,ceil:Eo,conj:Kt,divideScalar:cr,dotDivide:na,exp:uv,i:nv,log2:sv,matrix:we,multiplyScalar:fr,pow:ht,tau:iv,typed:V}),Iv=E3({BigNumber:xe,Complex:sr,config:me,multiplyScalar:fr,pow:ht,typed:V}),w5=u4({BigNumber:xe,Unit:_e,config:me}),N5=S4({BigNumber:xe,Unit:_e,config:me}),D5=Db({conj:Kt,dotDivide:na,fft:_v,typed:V}),A5=x4({BigNumber:xe,Unit:_e,config:me}),E5=U4({BigNumber:xe,Unit:_e,config:me}),S5=c4({BigNumber:xe,Unit:_e,config:me}),C5=W4({BigNumber:xe,Unit:_e,config:me}),M5=k4({BigNumber:xe,Unit:_e,config:me}),F5=F4({BigNumber:xe,Unit:_e,config:me}),B5=b4({BigNumber:xe,Unit:_e,config:me}),T5=eB({BigNumber:xe,Unit:_e,config:me}),O5=Q4({BigNumber:xe,Unit:_e,config:me}),$5=rB({BigNumber:xe,Unit:_e,config:me}),_5=C4({BigNumber:xe,Unit:_e,config:me}),I5=l4({BigNumber:xe,Unit:_e,config:me}),R5=T4({BigNumber:xe,Unit:_e,config:me}),q5=V4({BigNumber:xe,Unit:_e,config:me}),z5=o4({BigNumber:xe,Unit:_e,config:me}),P5=Z4({BigNumber:xe,Unit:_e,config:me}),U5=O4({BigNumber:xe,Unit:_e,config:me}),L5=R4({BigNumber:xe,Unit:_e,config:me}),k5=w4({BigNumber:xe,Unit:_e,config:me}),H5=v4({BigNumber:xe,Unit:_e,config:me}),qr=t3({divideScalar:cr,equalScalar:Ze,inv:nn,matrix:we,multiply:ar,typed:V}),G5=D4({BigNumber:xe,Unit:_e,config:me}),pi=F3({gamma:Iv,typed:V}),V5=P4({BigNumber:xe,Unit:_e,config:me}),Z5=J4({BigNumber:xe,Unit:_e,config:me}),Y5=g4({BigNumber:xe,Unit:_e,config:me}),Rv=JD({DenseMatrix:Ue,lsolve:Av,lup:Ov,matrix:we,slu:Ev,typed:V,usolve:Ao}),W5=y4({BigNumber:xe,Unit:_e,config:me}),X5=X4({BigNumber:xe,Unit:_e,config:me}),J5=$3({add:Ke,divide:qr,factorial:pi,isInteger:Wr,isPositive:en,multiply:ar,typed:V}),Q5=I3({factorial:pi,typed:V}),K5=K4({BigNumber:xe,Unit:_e,config:me}),j5=KD({add:Ke,cbrt:pv,divide:qr,equalScalar:Ze,im:mo,isZero:it,multiply:ar,re:vo,sqrt:mt,subtract:or,typeOf:fv,typed:V,unaryMinus:vt}),e8=a2({compareNatural:dt,typed:V}),r8=Fb({abs:Ir,add:Ke,bignumber:et,divide:qr,isNegative:jt,isPositive:en,larger:Lr,map:rn,matrix:we,max:So,multiply:ar,smaller:Ur,subtract:or,typed:V,unaryMinus:vt}),qv=aF({bignumber:et,addScalar:vr,combinations:li,divideScalar:cr,factorial:pi,isInteger:Wr,isNegative:jt,larger:Lr,multiplyScalar:fr,number:Et,pow:ht,subtract:or,typed:V}),t8=Pw({Unit:_e,typed:V}),n8=oF({addScalar:vr,isInteger:Wr,isNegative:jt,stirlingS2:qv,typed:V}),zv=HM({abs:Ir,add:Ke,addScalar:vr,atan:ov,bignumber:et,column:Mv,complex:ci,config:me,cos:go,diag:dv,divideScalar:cr,dot:vi,equal:ot,flatten:aa,im:mo,inv:nn,larger:Lr,matrix:we,matrixFromColumns:bo,multiply:ar,multiplyScalar:fr,number:Et,qr:Co,re:vo,sin:po,smaller:Ur,sqrt:mt,subtract:or,typed:V,usolve:Ao,usolveAll:Cv}),a8=A4({BigNumber:xe,Unit:_e,config:me}),i8=L4({BigNumber:xe,Unit:_e,config:me}),o8=Km({add:Ke,divide:qr,typed:V}),u8=H4({BigNumber:xe,Unit:_e,config:me}),s8=s4({BigNumber:xe,Unit:_e,config:me}),l8=B4({BigNumber:xe,Unit:_e,config:me}),Mo=jm({add:Ke,apply:ho,divide:qr,isNaN:ra,multiply:ar,subtract:or,typed:V}),c8=N4({BigNumber:xe,Unit:_e,config:me}),Pv=m3({add:Ke,compare:Tn,divide:qr,partitionSelect:No,typed:V}),f8=T3({divide:qr,dotDivide:na,isNumeric:tn,log:wo,map:rn,matrix:we,multiply:ar,sum:Sv,typed:V}),m8=p3({abs:Ir,map:rn,median:Pv,subtract:or,typed:V}),v8=ev({map:rn,sqrt:mt,typed:V,variance:Mo}),p8=IF({Complex:sr,add:Ke,divide:qr,matrix:we,multiply:ar,typed:V}),Fo=p2({abs:Ir,add:Ke,conj:Kt,ctranspose:yo,eigs:zv,equalScalar:Ze,larger:Lr,matrix:we,multiply:ar,pow:ht,smaller:Ur,sqrt:mt,typed:V}),Uv=ab({BigNumber:xe,DenseMatrix:Ue,SparseMatrix:St,addScalar:vr,config:me,cos:go,matrix:we,multiplyScalar:fr,norm:Fo,sin:po,typed:V,unaryMinus:vt}),d8=j4({BigNumber:xe,Unit:_e,config:me}),Lv=QM({identity:qt,matrix:we,multiply:ar,norm:Fo,qr:Co,subtract:or,typed:V}),h8=tb({multiply:ar,rotationMatrix:Uv,typed:V}),kv=XM({abs:Ir,add:Ke,concat:Qe,identity:qt,index:Dv,lusolve:Rv,matrix:we,matrixFromColumns:bo,multiply:ar,range:Dn,schur:Lv,subset:Hr,subtract:or,transpose:ta,typed:V}),g8=jM({matrix:we,multiply:ar,sylvester:kv,transpose:ta,typed:V}),On={},$n={},Hv={},Fr=A2({mathWithTransform:$n}),_n=J2({Node:Fr}),Ct=K2({Node:Fr}),an=eD({Node:Fr}),Gv=aD({Node:Fr}),In=M2({Node:Fr}),Vv=_2({Node:Fr,ResultSet:av}),Zv=R2({Node:Fr}),zt=G2({Node:Fr}),Yv=tD({Node:Fr}),y8=zF({classes:Hv}),Bo=aA({math:On,typed:V}),Wv=Z2({Node:Fr,typed:V}),b8=OM({Chain:Bo,typed:V}),Rn=S2({Node:Fr,subset:Hr}),qn=W2({Node:Fr,size:Mr}),Xv=O2({matrix:we,Node:Fr,subset:Hr}),Pt=uD({Unit:_e,Node:Fr,math:On}),Ut=lD({Node:Fr,SymbolNode:Pt,math:On}),ut=fD({AccessorNode:Rn,ArrayNode:In,AssignmentNode:Xv,BlockNode:Vv,ConditionalNode:Zv,ConstantNode:zt,FunctionAssignmentNode:Wv,FunctionNode:Ut,IndexNode:qn,ObjectNode:_n,OperatorNode:Ct,ParenthesisNode:an,RangeNode:Yv,RelationalNode:Gv,SymbolNode:Pt,config:me,numeric:jr,typed:V}),Jv=EF({ConstantNode:zt,FunctionNode:Ut,OperatorNode:Ct,ParenthesisNode:an,parse:ut,typed:V}),To=xF({bignumber:et,fraction:Bn,AccessorNode:Rn,ArrayNode:In,ConstantNode:zt,FunctionNode:Ut,IndexNode:qn,ObjectNode:_n,OperatorNode:Ct,SymbolNode:Pt,config:me,mathWithTransform:$n,matrix:we,typed:V}),x8=vD({parse:ut,typed:V}),Qv=rA({parse:ut}),w8=mF({parse:ut,typed:V}),Oo=NF({AccessorNode:Rn,ArrayNode:In,ConstantNode:zt,FunctionNode:Ut,IndexNode:qn,ObjectNode:_n,OperatorNode:Ct,ParenthesisNode:an,SymbolNode:Pt,add:Ke,divide:qr,equal:ot,isZero:it,multiply:ar,parse:ut,pow:ht,subtract:or,typed:V}),$o=dD({parse:ut,typed:V}),N8=BM({Help:Qv,mathWithTransform:$n,typed:V}),Kv=yD({evaluate:$o}),di=gF({bignumber:et,fraction:Bn,AccessorNode:Rn,ArrayNode:In,ConstantNode:zt,FunctionNode:Ut,IndexNode:qn,ObjectNode:_n,OperatorNode:Ct,ParenthesisNode:an,SymbolNode:Pt,add:Ke,config:me,divide:qr,equal:ot,isZero:it,mathWithTransform:$n,matrix:we,multiply:ar,parse:ut,pow:ht,resolve:Jv,simplifyConstant:To,simplifyCore:Oo,subtract:or,typed:V}),D8=CF({OperatorNode:Ct,parse:ut,simplify:di,typed:V}),A8=FF({ConstantNode:zt,FunctionNode:Ut,OperatorNode:Ct,ParenthesisNode:an,SymbolNode:Pt,config:me,equal:ot,isZero:it,numeric:jr,parse:ut,simplify:di,typed:V}),E8=xD({Parser:Kv,typed:V}),S8=TF({bignumber:et,fraction:Bn,AccessorNode:Rn,ArrayNode:In,ConstantNode:zt,FunctionNode:Ut,IndexNode:qn,ObjectNode:_n,OperatorNode:Ct,ParenthesisNode:an,SymbolNode:Pt,add:Ke,config:me,divide:qr,equal:ot,isZero:it,mathWithTransform:$n,matrix:we,multiply:ar,parse:ut,pow:ht,simplify:di,simplifyConstant:To,simplifyCore:Oo,subtract:or,typed:V});wr(On,{e:ef,false:KB,fineStructure:jB,i:nv,Infinity:eT,LN10:rT,LOG10E:tT,NaN:nT,null:aT,phi:iT,SQRT1_2:uT,sackurTetrode:sT,tau:iv,true:lT,E:ef,version:cT,efimovFactor:fT,LN2:mT,pi:rf,replacer:vT,reviver:y8,SQRT2:pT,typed:V,unaryPlus:fo,PI:rf,weakMixingAngle:dT,abs:Ir,acos:hT,acot:gT,acsc:yT,addScalar:vr,arg:bT,asech:xT,asinh:wT,atan:ov,atanh:NT,bignumber:et,bitNot:DT,boolean:AT,clone:ET,combinations:li,complex:ci,conj:Kt,cosh:ST,coth:CT,csc:MT,cube:FT,equalScalar:Ze,erf:BT,exp:uv,expm1:TT,filter:OT,forEach:$T,format:ea,getMatrixDataType:_T,hex:IT,im:mo,isInteger:Wr,isNegative:jt,isPositive:en,isZero:it,LOG2E:RT,lgamma:qT,log10:zT,log2:sv,map:rn,multiplyScalar:fr,not:lv,number:Et,oct:PT,pickRandom:UT,print:LT,random:kT,re:vo,sec:HT,sign:cv,sin:po,splitUnit:GT,square:VT,string:ZT,tan:YT,typeOf:fv,acosh:WT,acsch:XT,apply:ho,asec:JT,bin:QT,chain:b8,combinationsWithRep:KT,cos:go,csch:jT,isNaN:ra,isPrime:eO,randomInt:rO,sech:tO,sinh:nO,sparse:aO,sqrt:mt,tanh:iO,unaryMinus:vt,acoth:oO,cot:uO,fraction:Bn,isNumeric:tn,matrix:we,matrixFromFunction:sO,mode:lO,numeric:jr,prod:mv,reshape:cO,size:Mr,squeeze:fO,subset:Hr,transpose:ta,xgcd:vv,zeros:pt,asin:mO,cbrt:pv,concat:Qe,count:vO,ctranspose:yo,diag:dv,divideScalar:cr,dotDivide:na,equal:ot,flatten:aa,gcd:pO,hasNumericValue:dO,identity:qt,kron:hO,largerEq:fi,leftShift:gO,matrixFromColumns:bo,mod:hv,nthRoot:yO,ones:bO,resize:xO,rightArithShift:wO,round:mi,smaller:Ur,to:NO,unequal:DO,xor:AO,add:Ke,bitAnd:EO,bitXor:SO,catalan:CO,compare:Tn,compareText:gv,cumsum:MO,deepEqual:xo,dot:vi,equalText:FO,floor:yv,hypot:BO,invmod:TO,larger:Lr,log:wo,matrixFromRows:OO,min:$O,multiply:ar,nthRoots:_O,or:IO,partitionSelect:No,quantileSeq:RO,rightLogShift:qO,smallerEq:Do,subtract:or,trace:zO,usolve:Ao,zpk2tf:PO,and:UO,bitOr:LO,ceil:Eo,compareNatural:dt,composition:kO,cross:HO,det:xv,diff:GO,distance:VO,dotMultiply:ZO,fix:Nv,index:Dv,intersect:YO,lcm:WO,log1p:XO,lsolve:Av,max:So,qr:Co,range:Dn,row:JO,setCartesian:QO,setDistinct:KO,setIsSubset:jO,setPowerset:e5,slu:Ev,sort:r5,sum:Sv,usolveAll:Cv,atan2:t5,column:Mv,lsolveAll:n5,setDifference:Fv,setMultiplicity:a5,setSymDifference:Bv,inv:nn,lup:Ov,pinv:i5,pow:ht,setIntersect:$v,setUnion:o5,sqrtm:u5,vacuumImpedance:s5,wienDisplacement:l5,atomicMass:c5,bohrMagneton:f5,boltzmann:m5,conductanceQuantum:v5,createUnit:p5,deuteronMass:d5,dotPow:h5,electricConstant:g5,elementaryCharge:y5,expm:b5,faraday:x5,fft:_v,gamma:Iv,gravitationConstant:w5,hartreeEnergy:N5,ifft:D5,klitzing:A5,loschmidt:E5,magneticConstant:S5,molarMass:C5,molarPlanckConstant:M5,neutronMass:F5,nuclearMagneton:B5,planckCharge:T5,planckLength:O5,planckTemperature:$5,protonMass:_5,reducedPlanckConstant:I5,rydberg:R5,secondRadiation:q5,speedOfLight:z5,stefanBoltzmann:P5,thomsonCrossSection:U5,avogadro:L5,bohrRadius:k5,coulomb:H5,divide:qr,electronMass:G5,factorial:pi,firstRadiation:V5,gravity:Z5,inverseConductanceQuantum:Y5,lusolve:Rv,magneticFluxQuantum:W5,molarMassC12:X5,multinomial:J5,parse:ut,permutations:Q5,planckMass:K5,polynomialRoot:j5,resolve:Jv,setSize:e8,simplifyConstant:To,solveODE:r8,stirlingS2:qv,unit:t8,bellNumbers:n8,compile:x8,eigs:zv,fermiCoupling:a8,gasConstant:i8,leafCount:w8,mean:o8,molarVolume:u8,planckConstant:s8,quantumOfCirculation:l8,simplifyCore:Oo,variance:Mo,classicalElectronRadius:c8,evaluate:$o,help:N8,median:Pv,simplify:di,symbolicEqual:D8,derivative:A8,kldivergence:f8,mad:m8,parser:E8,rationalize:S8,std:v8,freqz:p8,norm:Fo,rotationMatrix:Uv,planckTime:d8,schur:Lv,rotate:h8,sylvester:kv,lyap:g8,config:me});wr($n,On,{filter:cB({typed:V}),forEach:vB({typed:V}),map:bB({typed:V}),apply:aB({isInteger:Wr,typed:V}),subset:qB({matrix:we,typed:V}),concat:UB({isInteger:Wr,matrix:we,typed:V}),max:NB({config:me,larger:Lr,numeric:jr,typed:V}),sum:YB({add:Ke,config:me,numeric:jr,typed:V}),min:MB({config:me,numeric:jr,smaller:Ur,typed:V}),cumsum:XB({add:Ke,typed:V,unaryPlus:fo}),diff:kB({bignumber:et,matrix:we,number:Et,subtract:or,typed:V}),index:hB({Index:Er}),range:TB({bignumber:et,matrix:we,add:Ke,config:me,isPositive:en,larger:Lr,largerEq:fi,smaller:Ur,smallerEq:Do,typed:V}),row:_B({Index:Er,matrix:we,range:Dn,typed:V}),column:uB({Index:Er,matrix:we,range:Dn,typed:V}),mean:EB({add:Ke,divide:qr,typed:V}),variance:QB({add:Ke,apply:ho,divide:qr,isNaN:ra,multiply:ar,subtract:or,typed:V}),std:VB({map:rn,sqrt:mt,typed:V,variance:Mo})});wr(Hv,{BigNumber:xe,Complex:sr,Fraction:Qt,Matrix:si,Node:Fr,ObjectNode:_n,OperatorNode:Ct,ParenthesisNode:an,Range:oT,RelationalNode:Gv,ResultSet:av,ArrayNode:In,BlockNode:Vv,ConditionalNode:Zv,ConstantNode:zt,DenseMatrix:Ue,RangeNode:Yv,Chain:Bo,FunctionAssignmentNode:Wv,SparseMatrix:St,AccessorNode:Rn,IndexNode:qn,AssignmentNode:Xv,ImmutableDenseMatrix:bv,Index:Er,FibonacciHeap:wv,Spa:Tv,Unit:_e,SymbolNode:Pt,FunctionNode:Ut,Help:Qv,Parser:Kv});Bo.createProxy(On);const _8=Bp({__name:"math-evaluator",setup(e){const r=Tp(""),i=Op(()=>Mp(()=>$o(r.value)??"",""));return(a,t)=>{const n=Cp,u=Sp;return qo(),$p("div",null,[_p(n,{value:hi(r),"onUpdate:value":t[0]||(t[0]=f=>Ip(r)?r.value=f:null),rows:"1",multiline:"",placeholder:"Your math expression (ex: 2*sqrt(6) )...","raw-text":"",monospace:"",autofocus:"",autosize:""},null,8,["value"]),hi(i)!==""?(qo(),Rp(u,{key:0,title:"Result ","mt-5":""},{default:qp(()=>[zp(Pp(hi(i)),1)]),_:1})):Up("",!0)])}}});export{_8 as default};
|