PageSourceSearch

https://cdn.holded.com/frontend-next-gen/vendor-mathjs.rDku6ehY.js

js holded.com collected 2026-09-24 09:10:30 UTC 678,733 bytes, 54 lines download raw bytes

1import{o as e,r as t,t as n}from"./rolldown-runtime.DAXXjFlN.js";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(null,arguments)}var i={relTol:1e-12,absTol:1e-15,matrix:`Matrix`,number:`number`,numberFallback:`number`,precision:64,predictable:!1,randomSeed:null,legacySubset:!1};function a(e,t){if(s(e,t)||c(e,t))return e[t];throw d(e,t)?Error(`Cannot access method "${t}" as a property`):e==null?TypeError(`Cannot access property "${t}": object is ${e}`):Error(`No access to property "`+t+`"`)}function o(e,t,n){if(s(e,t)||c(e,t))return e[t]=n,n;throw Error(`No access to property "${t}"`)}function s(e,t){return f(e)?!(t in Object.prototype):!1}function c(e,t){return Array.isArray(e)?typeof t==`number`||typeof t==`string`&&l(t)||t===`length`:!1}function l(e){return/^\d+$/.test(e)}function u(e,t){if(!d(e,t))throw Error(`No access to method "`+t+`"`);return e[t]}function d(e,t){return e==null||typeof e[t]!=`function`||H(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)?!1:p.has(t)?!0:!(t in Object.prototype||t in Function.prototype)}function f(e){return typeof e==`object`&&e&&e.constructor===Object}var p=new Set([`toString`,`valueOf`,`toLocaleString`]),m=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return a(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return s(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return g(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){s(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},h=class{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return g(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function g(e,t){return{next:()=>{var n=e.next();return n.done?n:{value:t(n.value),done:!1}}}}function _(){return new Map}function v(e){if(!e)return _();if(ae(e))return e;if(ie(e))return new m(e);throw Error(`createMap can create maps from objects or Maps`)}function y(e){if(e instanceof m)return e.wrappedObject;var t={};for(var n of e.keys())o(t,n,e.get(n));return t}function b(e){return typeof e==`number`}function x(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 S(e){return typeof e==`bigint`}function C(e){return e&&typeof e==`object`&&Object.getPrototypeOf(e).isComplex===!0||!1}function w(e){return e&&typeof e==`object`&&Object.getPrototypeOf(e).isFraction===!0||!1}function T(e){return e&&e.constructor.prototype.isUnit===!0||!1}function E(e){return typeof e==`string`}var D=Array.isArray;function O(e){return e&&e.constructor.prototype.isMatrix===!0||!1}function k(e){return Array.isArray(e)||O(e)}function A(e){return e&&e.isDenseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function j(e){return e&&e.isSparseMatrix&&e.constructor.prototype.isMatrix===!0||!1}function M(e){return e&&e.constructor.prototype.isRange===!0||!1}function N(e){return e&&e.constructor.prototype.isIndex===!0||!1}function P(e){return typeof e==`boolean`}function F(e){return e&&e.constructor.prototype.isResultSet===!0||!1}function ee(e){return e&&e.constructor.prototype.isHelp===!0||!1}function te(e){return typeof e==`function`}function ne(e){return e instanceof Date}function re(e){return e instanceof RegExp}function ie(e){return!!(e&&typeof e==`object`&&e.constructor===Object&&!C(e)&&!w(e))}function ae(e){return e?e instanceof Map||e instanceof m||typeof e.set==`function`&&typeof e.get==`function`&&typeof e.keys==`function`&&typeof e.has==`function`:!1}function I(e){return ae(e)&&ae(e.a)&&ae(e.b)}function oe(e){return ae(e)&&ie(e.wrappedObject)}function L(e){return e===null}function se(e){return e===void 0}function ce(e){return e&&e.isAccessorNode===!0&&e.constructor.prototype.isNode===!0||!1}function R(e){return e&&e.isArrayNode===!0&&e.constructor.prototype.isNode===!0||!1}function le(e){return e&&e.isAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function ue(e){return e&&e.isBlockNode===!0&&e.constructor.prototype.isNode===!0||!1}function z(e){return e&&e.isConditionalNode===!0&&e.constructor.prototype.isNode===!0||!1}function B(e){return e&&e.isConstantNode===!0&&e.constructor.prototype.isNode===!0||!1}function de(e){return B(e)||_e(e)&&e.args.length===1&&B(e.args[0])&&`-+~`.includes(e.op)}function fe(e){return e&&e.isFunctionAssignmentNode===!0&&e.constructor.prototype.isNode===!0||!1}function pe(e){return e&&e.isFunctionNode===!0&&e.constructor.prototype.isNode===!0||!1}function me(e){return e&&e.isIndexNode===!0&&e.constructor.prototype.isNode===!0||!1}function he(e){return e&&e.isNode===!0&&e.constructor.prototype.isNode===!0||!1}function ge(e){return e&&e.isObjectNode===!0&&e.constructor.prototype.isNode===!0||!1}function _e(e){return e&&e.isOperatorNode===!0&&e.constructor.prototype.isNode===!0||!1}function ve(e){return e&&e.isParenthesisNode===!0&&e.constructor.prototype.isNode===!0||!1}function ye(e){return e&&e.isRangeNode===!0&&e.constructor.prototype.isNode===!0||!1}function be(e){return e&&e.isRelationalNode===!0&&e.constructor.prototype.isNode===!0||!1}function xe(e){return e&&e.isSymbolNode===!0&&e.constructor.prototype.isNode===!0||!1}function Se(e){return e&&e.constructor.prototype.isChain===!0||!1}function Ce(e){var t=typeof e;return t===`object`?e===null?`null`:x(e)?`BigNumber`:e.constructor&&e.constructor.name?e.constructor.name:`Object`:t}function V(e){var t=typeof e;if(t===`number`||t===`bigint`||t===`string`||t===`boolean`||e==null)return e;if(typeof e.clone==`function`)return e.clone();if(Array.isArray(e))return e.map(function(e){return V(e)});if(e instanceof Date)return new Date(e.valueOf());if(x(e))return e;if(ie(e))return we(e,V);if(t===`function`)return e;throw TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function we(e,t){var n={};for(var r in e)H(e,r)&&(n[r]=t(e[r]));return n}
1function Te(e,t){for(var n in t)H(t,n)&&(e[n]=t[n]);return e}function Ee(e,t){if(Array.isArray(t))throw TypeError(`Arrays are not supported by deepExtend`);for(var n in t)if(H(t,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(t[n]&&t[n].constructor===Object)e[n]===void 0&&(e[n]={}),e[n]&&e[n].constructor===Object?Ee(e[n],t[n]):e[n]=t[n];else if(Array.isArray(t[n]))throw TypeError(`Arrays are not supported by deepExtend`);else e[n]=t[n];return e}function De(e,t){var n,r,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!De(e[r],t[r]))return!1;return!0}else if(typeof e==`function`)return e===t;else if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!De(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}else return e===t}function Oe(e){var t={};return ke(e,t),t}function ke(e,t){for(var n in e)if(H(e,n)){var r=e[n];typeof r==`object`&&r?ke(r,t):t[n]=r}}function Ae(e,t,n){var r=!0,i;Object.defineProperty(e,t,{get:function(){return r&&=(i=n(),!1),i},set:function(e){i=e,r=!1},configurable:!0,enumerable:!0})}function H(e,t){return e&&Object.hasOwnProperty.call(e,t)}function je(e){return e&&typeof e.factory==`function`}function Me(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],a=e[i];a!==void 0&&(n[i]=a)}return n}var Ne=[`Matrix`,`Array`],Pe=[`number`,`BigNumber`,`bigint`,`Fraction`];function Fe(e,t){function n(r){if(r){if(r.epsilon!==void 0){console.warn(`Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.`);var i=V(r);return i.relTol=r.epsilon,i.absTol=r.epsilon*.001,delete i.epsilon,n(i)}r.legacySubset===!0&&console.warn(`Warning: The configuration option "legacySubset" is for compatibility only and might be deprecated 
1in the future.`);var a=V(e);Ie(r,`matrix`,Ne),Ie(r,`number`,Pe),Ee(e,r);var o=V(e);return t(`config`,o,a,V(r)),o}else return V(e)}return n.MATRIX_OPTIONS=Ne,n.NUMBER_OPTIONS=Pe,Object.keys(i).forEach(t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),n}function Ie(e,t,n){e[t]!==void 0&&!n.includes(e[t])&&console.warn(`Warning: Unknown value "`+e[t]+`" for configuration option "`+t+`". Available options: `+n.map(e=>JSON.stringify(e)).join(`, `)+`.`)}var U=function(e){if(e)throw Error(`The global config is readonly. 
2Please create a mathjs instance if you want to change the default configuration. 
3Example:
4
5  import { create, all } from 'mathjs';
6  const mathjs = create(all);
7  mathjs.config({ number: 'BigNumber' });
8`);return Object.freeze(i)};r(U,i,{MATRIX_OPTIONS:Ne,NUMBER_OPTIONS:Pe});var Le=e(n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n[`'typed'`]=r())})(e,(function(){function e(){return!0}function t(){return!1}function n(){}let r=`Argument is not a typed-function.`;function i(){function a(e){return typeof e==`object`&&!!e&&e.constructor===Object}let o=[{name:`number`,test:function(e){return typeof e==`number`}},{name:`string`,test:function(e){return typeof e==`string`}},{name:`boolean`,test:function(e){return typeof e==`boolean`}},{name:`Function`,test:function(e){return typeof e==`function`}},{name:`Array`,test:Array.isArray},{name:`Date`,test:function(e){return e instanceof Date}},{name:`RegExp`,test:function(e){return e instanceof RegExp}},{name:`Object`,test:a},{name:`null`,test:function(e){return e===null}},{name:`undefined`,test:function(e){return e===void 0}}],s={name:`any`,test:e,isAny:!0},c,l,u=0,d={createCount:0};function f(e){let t=c.get(e);if(t)return t;let n=`Unknown type "`+e+`"`,r=e.toLowerCase(),i;for(i of l)if(i.toLowerCase()===r){n+=`. Did you mean "`+i+`" ?`;break}throw TypeError(n)}function p(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`any`,n=t?f(t).index:l.length,r=[];for(let t=0;t<e.length;++t){if(!e[t]||typeof e[t].name!=`string`||typeof e[t].test!=`function`)throw TypeError(`Object with properties {name: string, test: function} expected`);let i=e[t].name;if(c.has(i))throw TypeError(`Duplicate type name "`+i+`"`);r.push(i),c.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:n+t,conversionsTo:[]})}let i=l.slice(n);l=l.slice(0,n).concat(r).concat(i);for(let e=n+r.length;e<l.length;++e)c.get(l[e]).index=e}function m(){c=new Map,l=[],u=0,p([s],!1)}m(),p(o);function h(){let e;for(e of l)c.get(e).conversionsTo=[];u=0}function g(e){let t=l.filter(t=>{let n=c.get(t);return!n.isAny&&n.test(e)});return t.length?t:[`any`]}function _(e){return e&&typeof e==`function`&&`_typedFunctionData`in e}function v(e,t,n){if(!_(e))throw TypeError(r);let i=n&&n.exact,a=T(Array.isArray(t)?t.join(`,`):t),o=x(a);if(!i||o in e.signatures){let t=e._typedFunctionData.signatureMap.get(o);if(t)return t}let s=a.length,c;if(i){c=[];let t;for(t in e.signatures)c.push(e._typedFunctionData.signatureMap.get(t))}else c=e._typedFunctionData.signatures;for(let e=0;e<s;++e){let t=a[e],n=[],r;for(r of c){let i=k(r.params,e);if(!(!i||t.restParam&&!i.restParam)){if(!i.hasAny){let e=w(i);if(t.types.some(t=>!e.has(t.name)))continue}n.push(r)}}if(c=n,c.length===0)break}let l;for(l of c)if(l.params.length<=s)return l;throw TypeError(`Signature not found (signature: `+(e.name||`unnamed`)+`(`+x(a,`, `)+`))`)}function y(e,t,n){return v(e,t,n).implementation}function b(e,t){let n=f(t);if(n.test(e))return e;let r=n.conversionsTo;if(r.length===0)throw Error(`There are no conversions to `+t+` defined.`);for(let t=0;t<r.length;t++)if(f(r[t].from).test(e))return r[t].convert(e);throw Error(`Cannot convert `+e+` to `+t)}function x(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`,`;return e.map(e=>e.name).join(t)}function S(e){let t=e.indexOf(`...`)===0,n=(t?e.length>3?e.slice(3):`any`:e).split(`|`).map(e=>f(e.trim())),r=!1,i=t?`...`:``;return{types:n.map(function(e){return r=e.isAny||r,i+=e.name+`|`,{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:r,hasConversion:!1,restParam:t}}function C(e){let t=ne(e.types.map(e=>e.name)),n=e.hasAny,r=e.name,i=t.map(function(e){let t=f(e.from);return n=t.isAny||n,r+=`|`+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:r,hasAny:n,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEac
8h(t=>e.typeSet.add(t.name))),e.typeSet}function T(e){let t=[];if(typeof e!=`string`)throw TypeError(`Signatures must be strings`);let n=e.trim();if(n===``)return t;let r=n.split(`,`);for(let e=0;e<r.length;++e){let n=S(r[e].trim());if(n.restParam&&e!==r.length-1)throw SyntaxError(`Unexpected rest parameter "`+r[e]+`": only allowed for the last parameter`);if(n.types.length===0)return null;t.push(n)}return t}function E(e){let t=z(e);return t?t.restParam:!1}function D(t){if(!t||t.types.length===0)return e;if(t.types.length===1)return f(t.types[0].name).test;if(t.types.length===2){let e=f(t.types[0].name).test,n=f(t.types[1].name).test;return function(t){return e(t)||n(t)}}else{let e=t.types.map(function(e){return f(e.name).test});return function(t){for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1}}}function O(e){let t,n,r;if(E(e)){t=ue(e).map(D);let n=t.length,r=D(z(e)),i=function(e){for(let t=n;t<e.length;t++)if(!r(e[t]))return!1;return!0};return function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return i(e)&&e.length>=n+1}}else if(e.length===0)return function(e){return e.length===0};else if(e.length===1)return n=D(e[0]),function(e){return n(e[0])&&e.length===1};else if(e.length===2)return n=D(e[0]),r=D(e[1]),function(e){return n(e[0])&&r(e[1])&&e.length===2};else return t=e.map(D),function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length}}function k(e,t){return t<e.length?e[t]:E(e)?z(e):null}function A(e,t){let n=k(e,t);return n?w(n):new Set}function j(e){return e.conversion===null||e.conversion===void 0}function M(e,t){let n=new Set;return e.forEach(e=>{let r=A(e.params,t),i;for(i of r)n.add(i)}),n.has(`any`)?[`any`]:Array.from(n)}function N(e,t,n){let r,i,a=e||`unnamed`,o=n,s;for(s=0;s<t.length;s++){let e=[];
8if(o.forEach(n=>{let r=D(k(n.params,s));(s<n.params.length||E(n.params))&&r(t[s])&&e.push(n)}),e.length===0){if(i=M(o,s),i.length>0){let e=g(t[s]);return r=TypeError(`Unexpected type of argument in function `+a+` (expected: `+i.join(` or `)+`, actual: `+e.join(` | `)+`, index: `+s+`)`),r.data={category:`wrongType`,fn:a,index:s,actual:e,expected:i},r}}else o=e}let c=o.map(function(e){return E(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,c))return i=M(o,s),r=TypeError(`Too few arguments in function `+a+` (expected: `+i.join(` or `)+`, index: `+t.length+`)`),r.data={category:`tooFewArgs`,fn:a,index:t.length,expected:i},r;let l=Math.max.apply(null,c);if(t.length>l)return r=TypeError(`Too many arguments in function `+a+` (expected: `+l+`, actual: `+t.length+`)`),r.data={category:`tooManyArgs`,fn:a,index:t.length,expectedLength:l},r;let u=[];for(let e=0;e<t.length;++e)u.push(g(t[e]).join(`|`));return r=TypeError(`Arguments of type "`+u.join(`, `)+`" do not match any of the defined signatures of function `+a+`.`),r.data={category:`mismatch`,actual:u},r}function P(e){let t=l.length+1;for(let n=0;n<e.types.length;n++)j(e.types[n])&&(t=Math.min(t,e.types[n].typeIndex));return t}function F(e){let t=u+1;for(let n=0;n<e.types.length;n++)j(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function ee(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;let n=P(e)-P(t);if(n<0)return-1;if(n>0)return 1;let r=F(e)-F(t);return r<0?-1:+(r>0)}function te(e,t){let n=e.params,r=t.params,i=z(n),a=z(r),o=E(n),s=E(r);if(o&&i.hasAny){if(!s||!a.hasAny)return 1}else if(s&&a.hasAny)return-1;let c=0,l=0,u;for(u of n)u.hasAny&&++c,u.hasConversion&&++l;let d=0,f=0;for(u of r)u.hasAny&&++d,u.hasConversion&&++f;if(c!==d)return c-d;if(o&&i.hasConversion){if(!s||!a.hasConversion)return 1}else if(s&&a.hasConversion)return-1;if(l!==f)return l-f;if(o){if(!s)return 1}else if(s)return-1;let p=(n.length-r.length)*(o?-1:1);if(p!==0)return p;let m=[],h=0;for(let e=0;e<n.length;++e){let t=ee(n[e],r[e]);m.push(t),h+=t}if(h!==0)return h;let g;for(g of m)if(g!==0)return g;return 0}function ne(e){if(e.length===0)return[];let t=e.map(f);e.length>1&&t.sort((e,t)=>e.index-t.index);let n=t[0].conversionsTo;if(e.length===1)return n;n=n.concat([]);let r=new Set(e);for(let e=1;e<t.length;++e){let i;for(i of t[e].conversionsTo)r.has(i.from)||(n.push(i),r.add(i.from))}return n}function re(e,t){let n=t;if(e.some(e=>e.hasConversion)){let r=E(e),i=e.map(ie);n=function(){let e=[],n=r?arguments.length-1:arguments.length;for(let t=0;t<n;t++)e[t]=i[t](arguments[t]);return r&&(e[n]=arguments[n].map(i[n])),t.apply(this,e)}}let r=n;if(E(e)){let t=e.length-1;r=function(){return n.apply(this,B(arguments,0,t).concat([B(arguments,t)]))}}return r}function ie(e){let t,n,r,i,a=[],o=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(f(e.conversion.from).test),o.push(e.conversion.convert))}),o.length){case 0:return function(e){return e};case 1:return t=a[0],r=o[0],function(e){return t(e)?r(e):e};case 2:return t=a[0],n=a[1],r=o[0],i=o[1],function(e){return t(e)?r(e):n(e)?i(e):e};default:return function(e){for(let t=0;t<o.length;t++)if(a[t](e))return o[t](e);return e}}}function ae(e){function t(e,n,r){if(n<e.length){let i=e[n],a=[];if(i.restParam){let e=i.types.filter(j);e.length<i.types.length&&a.push({types:e,name:`...`+e.map(e=>e.name).join(`|`),hasAny:e.some(e=>e.isAny),hasConversion:!1,restParam:!0}),a.push(i)}else a=i.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return fe(a,function(i){return t(e,n+1,r.concat([i]))})}else return[r]}return t(e,0,[])}function I(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=A(e,r),i=A(t,r),a=!1,o;for(o of i)if(n.has(o)){a=!0;break}if(!a)return!1}let r=e.length,i=t.length,a=E(e),o=E(t);return a?o?r===i:i>=r:o?r>=i:r===i}function oe(e){return e.map(e=>_e(e)?he(e.referToSelf.callback):ge(e)?me(e.referTo.references,e.referTo.callback):e)}function L(e,t,n){let r=[],i;for(i of e){let e=n[i];if(typeof e!=`number`)throw TypeError(`No definition for referenced signature "`+i+`"`);if(e=t[e],typeof e!=`function`)return!1;r.push(e)}return r}function se(e,t,n){let r=oe(e),i=Array(r.length).fill(!1),a=!0;for(;a;){a=!1;let e=!0;for(let o=0;o<r.length;++o){if(i[o])continue;let s=r[o];if(_e(s))r[o]=s.referToSelf.callback(n),r[o].referToSelf=s.referToSelf,i[o]=!0,e=!1;else if(ge(s)){let n=L(s.referTo.references,r,t);n?(r[o]=s.referTo.callback.apply(this,n),r[o].referTo=s.referTo,i[o]=!0,e=!1):a=!0}}if(e&&a)throw SyntaxError(`Circular reference detected in resolving typed.referTo`)}return r}function ce(e){let t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach(n=>{let r=e[n];if(t.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function R(e,r){if(d.createCount++,Object.keys(r).length===0)throw SyntaxError(`No signatures provided`);d.warnAgainstDeprecatedThis&&ce(r);let i=[],a=[],o={},s=[],c;for(c in r){if(!Object.prototype.hasOwnProperty.call(r,c))continue;let e=T(c);if(!e)continue;
8i.forEach(function(t){if(I(t,e))throw TypeError(`Conflicting signatures "`+x(t)+`" and "`+x(e)+`".`)}),i.push(e);let t=a.length;a.push(r[c]);let n=e.map(C),l;for(l of ae(n)){let e=x(l);s.push({params:l,name:e,fn:t}),l.every(e=>!e.hasConversion)&&(o[e]=t)}}s.sort(te);let l=se(a,o,xe),u;for(u in o)Object.prototype.hasOwnProperty.call(o,u)&&(o[u]=l[o[u]]);let f=[],p=new Map;for(u of s)p.has(u.name)||(u.fn=l[u.fn],f.push(u),p.set(u.name,u));let m=f[0]&&f[0].params.length<=2&&!E(f[0].params),h=f[1]&&f[1].params.length<=2&&!E(f[1].params),g=f[2]&&f[2].params.length<=2&&!E(f[2].params),_=f[3]&&f[3].params.length<=2&&!E(f[3].params),v=f[4]&&f[4].params.length<=2&&!E(f[4].params),y=f[5]&&f[5].params.length<=2&&!E(f[5].params),b=m&&h&&g&&_&&v&&y;for(let e=0;e<f.length;++e)f[e].test=O(f[e].params);let S=m?D(f[0].params[0]):t,w=h?D(f[1].params[0]):t,k=g?D(f[2].params[0]):t,A=_?D(f[3].params[0]):t,j=v?D(f[4].params[0]):t,M=y?D(f[5].params[0]):t,N=m?D(f[0].params[1]):t,P=h?D(f[1].params[1]):t,F=g?D(f[2].params[1]):t,ee=_?D(f[3].params[1]):t,ne=v?D(f[4].params[1]):t,ie=y?D(f[5].params[1]):t;for(let e=0;e<f.length;++e)f[e].implementation=re(f[e].params,f[e].fn);let oe=m?f[0].implementation:n,L=h?f[1].implementation:n,R=g?f[2].implementation:n,le=_?f[3].implementation:n,ue=v?f[4].implementation:n,z=y?f[5].implementation:n,B=m?f[0].params.length:-1,de=h?f[1].params.length:-1,fe=g?f[2].params.length:-1,pe=_?f[3].params.length:-1,me=v?f[4].params.length:-1,he=y?f[5].params.length:-1,ge=b?6:0,_e=f.length,ve=f.map(e=>e.test),ye=f.map(e=>e.implementation),be=function(){for(let e=ge;e<_e;e++)if(ve[e](arguments))return ye[e].apply(this,arguments);return d.onMismatch(e,arguments,f)};function xe(e,t){return arguments.length===B&&S(e)&&N(t)?oe.apply(this,arguments):arguments.length===de&&w(e)&&P(t)?L.apply(this,arguments):arguments.length===fe&&k(e)&&F(t)?R.apply(this,arguments):arguments.length===pe&&A(e)&&ee(t)?le.apply(this,arguments):arguments.length===me&&j(e)&&ne(t)?ue.apply(this,arguments):arguments.length===he&&M(e)&&ie(t)?z.apply(this,arguments):be.apply(this,arguments)}try{Object.defineProperty(xe,"name",{value:e})}catch{}return xe.signatures=o,xe._typedFunctionData={signatures:f,signatureMap:p},xe}function le(e,t,n){throw N(e,t,n)}function ue(e){return B(e,0,e.length-1)}function z(e){return e[e.length-1]}function B(e,t,n){return Array.prototype.slice.call(e,t,n)}function de(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n]}function fe(e,t){return Array.prototype.concat.apply([],e.map(t))}function pe(){let e=ue(arguments).map(e=>x(T(e))),t=z(arguments);if(typeof t!=`function`)throw TypeError(`Callback function expected as last argument`);return me(e,t)}function me(e,t){return{referTo:{references:e,callback:t}}}function he(e){if(typeof e!=`function`)throw TypeError(`Callback function expected as first argument`);return{referToSelf:{callback:e}}}function ge(e){return e&&typeof e.referTo==`object`&&Array.isArray(e.referTo.references)&&typeof e.referTo.callback==`function`}function _e(e){return e&&typeof e.referToSelf==`object`&&typeof e.referToSelf.callback==`function`}function ve(e,t){if(!e)return t;if(t&&t!==e){let n=Error(`Function names do not match (expected: `+e+`, actual: `+t+`)`);throw n.data={actual:t,expected:e},n}return e}function ye(e){let t;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(_(e[n])||typeof e[n].signature==`string`)&&(t=ve(t,e[n].name));return t}function be(e,t){let n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(n in e&&t[n]!==e[n]){let r=Error(`Signature "`+n+`" is defined twice`);throw r.data={signature:n,sourceFunction:t[n],destFunction:e[n]},r}e[n]=t[n]}}let xe=d;d=function(e){let t=typeof e==`string`,n=+!!t,r=t?e:``,i={};for(let e=n;e<arguments.length;++e){let n=arguments[e],o={},s;if(typeof n==`function`?(s=n.name,typeof n.signature==`string`?o[n.signature]=n:_(n)&&(o=n.signatures)):a(n)&&(o=n,t||(s=ye(n))),Object.keys(o).length===0){let t=TypeError(`Argument to 'typed' at index `+e+` is not a (typed) function, nor an object with signatures as keys and functions as values.`);throw t.data={index:e,argument:n},t}t||(r=ve(r,s)),be(i,o)}return R(r||``,i)},d.create=i,d.createCount=xe.createCount,d.onMismatch=le,d.throwMismatchError=le,d.createError=N,d.clear=m,d.clearConversions=h,d.addTypes=p,d._findType=f,d.referTo=pe,d.referToSelf=he,d.convert=b,d.findSignature=v,d.find=y,d.isTypedFunction=_,d.warnAgainstDeprecatedThis=!0,d.addType=function(e,t){let n=`any`;t!==!1&&c.has(`Object`)&&(n=`Object`),d.addTypes([e],n)};function Se(e){if(!e||typeof e.from!=`string`||typeof e.to!=`string`||typeof e.convert!=`function`)throw TypeError(`Object with properties {from: string, to: string, convert: function} expected`);if(e.to===e.from)throw SyntaxError(`Illegal to define conversion from "`+e.from+`" to itself.`)}return d.addConversion=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};Se(e);let n=f(e.to),r=n.conversionsTo.find(t=>t.from===e.from);if(r)if(t&&t.override)d.removeConversion({from:r.from,to:e.to,convert:r.convert});else throw Error(`There is already a conversion from "`+e.from+`" to "`+n.name+`"`);n.conversionsTo.push({from:e.from,convert:e.convert,index:u++})}
8,d.addConversions=function(e,t){e.forEach(e=>d.addConversion(e,t))},d.removeConversion=function(e){Se(e);let t=f(e.to),n=de(t.conversionsTo,t=>t.from===e.from);if(!n)throw Error(`Attempt to remove nonexistent conversion from `+e.from+` to `+e.to);if(n.convert!==e.convert)throw Error(`Conversion to remove does not match existing conversion`);let r=t.conversionsTo.indexOf(n);t.conversionsTo.splice(r,1)},d.resolve=function(e,t){if(!_(e))throw TypeError(r);let n=e._typedFunctionData.signatures;for(let e=0;e<n.length;++e)if(n[e].test(t))return n[e];return null},d}return i()}))}))(),1);function W(e,t,n,r){function i(r){var i=Me(r,t.map(Ve));return ze(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function Re(e){return typeof e==`function`&&typeof e.fn==`string`&&Array.isArray(e.dependencies)}function ze(e,t,n){if(!t.filter(e=>!Be(e)).every(e=>n[e]!==void 0)){var r=t.filter(e=>n[e]===void 0);throw Error(`Cannot create function "${e}", some dependencies are missing: ${r.map(e=>`"${e}"`).join(`, `)}.`)}}function Be(e){return e&&e[0]===`?`}function Ve(e){return e&&e[0]===`?`?e.slice(1):e}function G(e){return typeof e==`boolean`?!0:Number.isFinite(e)?e===Math.round(e):!1}function He(e,t){if(t.number===`bigint`)try{BigInt(e)}catch{return t.numberFallback}return t.number}var Ue=Math.sign||function(e){return e>0?1:e<0?-1:0},We=Math.log2||function(e){return Math.log(e)/Math.LN2},Ge=Math.log10||function(e){return Math.log(e)/Math.LN10},Ke=Math.log1p||function(e){return Math.log(e+1)},qe=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),Number.isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Je=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Ye(e,t,n){var r={2:`0b`,8:`0o`,16:`0x`}[t],i=``;if(n){if(n<1)throw Error(`size must be in greater than 0`);if(!G(n))throw Error(`size must be an integer`);if(e>2**(n-1)-1||e<-(2**(n-1)))throw Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!G(e))throw Error(`Value must be an integer`);e<0&&(e+=2**n),i=`i${n}`}var a=``;return e<0&&(e=-e,a=`-`),`${a}${r}${e.toString(t)}${i}`}function Xe(e,t){if(typeof t==`function`)return t(e);if(e===1/0)return`Infinity`;if(e===-1/0)return`-Infinity`;if(isNaN(e))return`NaN`;var{notation:n,precision:r,wordSize:i}=Ze(t);switch(n){case`fixed`:return et(e,r);case`exponential`:return tt(e,r);case`engineering`:return $e(e,r);case`bin`:return Ye(e,2,i);case`oct`:return Ye(e,8,i);case`hex`:return Ye(e,16,i);case`auto`:return nt(e,r,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e===`.`?t:e+t});default:throw Error(`Unknown notation "`+n+`". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.`)}}function Ze(e){var t=`auto`,n,r;if(e!==void 0)if(b(e))n=e;else if(x(e))n=e.toNumber();else if(ie(e))e.precision!==void 0&&(n=mt(e.precision,()=>{throw Error(`Option "precision" must be a number or BigNumber`)})),e.wordSize!==void 0&&(r=mt(e.wordSize,()=>{throw Error(`Option "wordSize" must be a number or BigNumber`)})),e.notation&&(t=e.notation);else throw Error(`Unsupported type of options, number, BigNumber, or object expected`);return{notation:t,precision:n,wordSize:r}}function Qe(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError(`Invalid number `+e);var n=t[1],r=t[2],i=parseFloat(t[4]||`0`),a=r.indexOf(`.`);i+=a===-1?r.length-1:a-1;var o=r.replace(`.`,``).replace(/^0*/,function(e){return i-=e.length,``}).replace(/0*$/,``).split(``).map(function(e){return parseInt(e)});return o.length===0&&(o.push(0),i++),{sign:n,coefficients:o,exponent:i}}function $e(e,t){if(isNaN(e)||!Number.isFinite(e))return String(e);var n=rt(Qe(e),t),r=n.exponent,i=n.coefficients,a=r%3==0?r:r<0?r-3-r%3:r-r%3;if(b(t))for(;t>i.length||r-a+1>i.length;)i.push(0);else for(var o=Math.abs(r-a)-(i.length-1),s=0;s<o;s++)i.push(0);for(var c=Math.abs(r-a),l=1;c>0;)l++,c--;var u=i.slice(l).join(``),d=b(t)&&u.length||u.match(/[1-9]/)?`.`+u:``,f=i.slice(0,l).join(``)+d+`e`+(r>=0?`+`:``)+a.toString();return n.sign+f}function et(e,t){if(isNaN(e)||!Number.isFinite(e))return String(e);var n=Qe(e),r=typeof t==`number`?rt(n,n.exponent+1+t):n,i=r.coefficients,a=r.exponent+1,o=a+(t||0);return i.length<o&&(i=i.concat(it(o-i.length))),a<0&&(i=it(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?`0.`:`.`),r.sign+i.join(``)}function tt(e,t){if(isNaN(e)||!Number.isFinite(Number(e)))return String(e);var n=Qe(e),r=t?rt(n,t):n,i=r.coefficients,a=r.exponent;i.length<t&&(i=i.concat(it(t-i.length)));var o=i.shift();return r.sign+o+(i.length>0?`.`+i.join(``):``)+`e`+(a>=0?`+`:``)+a}function nt(e,t,n){if(isNaN(e)||!Number.isFinite(e))return String(e);var r=ht(n?.lowerExp,-3),i=ht(n?.upperExp,5),a=Qe(e),o=t?rt(a,t):a;if(o.exponent<r||o.exponent>=i)return tt(e,t);var s=o.coefficients,c=o.exponent;s.length<t&&(s=s.concat(it(t-s.length))),s=s.concat(it(c-s.length+1+(s.length<t?t-s.length:0))),s=it(-c).concat(s);var l=c>0?c:0;return l<s.length-1&&s.splice(l+1,0,`.`),o.sign+s.join(``)}function rt(e,t){for(var n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){var i=t-1;for(r[i]++;r[i]===10;)r.pop(),i===0&&(r.unshift(0),n.exponent++,i++),i--,r[i]++}return n}function it(e){for(var t=[],n=0;n<e;n++)t.push(0);return t}function at(e){return e.toExponential().replace(/e.*$/,``).replace(/^0\.?0*|\./,``).length}function ot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;
8if(n<=0)throw Error(`Relative tolerance must be greater than 0`);if(r<0)throw Error(`Absolute tolerance must be at least 0`);return isNaN(e)||isNaN(t)?!1:!Number.isFinite(e)||!Number.isFinite(t)?e===t:e===t?!0:Math.abs(e-t)<=Math.max(n*Math.max(Math.abs(e),Math.abs(t)),r)}var st=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ct=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},lt=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},ut=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},dt=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},ft=Math.tanh||function(e){var t=Math.exp(2*e);return(t-1)/(t+1)};function pt(e,t){return(e>0?!0:e<0?!1:1/e==1/0)^(t>0?!0:t<0?!1:1/t==1/0)?-e:e}function mt(e,t){if(b(e))return e;if(x(e))return e.toNumber();t()}function ht(e,t){return b(e)?e:x(e)?e.toNumber():t}var gt=function(){return gt=Le.default.create,Le.default},_t=W(`typed`,[`?BigNumber`,`?Complex`,`?DenseMatrix`,`?Fraction`],function(e){var{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e,a=gt();return a.clear(),a.addTypes([{name:`number`,test:b},{name:`Complex`,test:C},{name:`BigNumber`,test:x},{name:`bigint`,test:S},{name:`Fraction`,test:w},{name:`Unit`,test:T},{name:`identifier`,test:e=>E&&/^(?:[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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\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\uFB
8D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\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]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])(?:[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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\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\u
80EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
80-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\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]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])*$/.test(e)},{name:`string`,test:E},{name:`Chain`,test:Se},{name:`Array`,test:D},{name:`Matrix`,test:O},{name:`DenseMatrix`,test:A},{name:`SparseMatrix`,test:j},{name:`Range`,test:M},{name:`Index`,test:N},{name:`boolean`,test:P},{name:`ResultSet`,test:F},{name:`Help`,test:ee},{name:`function`,test:te},{name:`Date`,test:ne},{name:`RegExp`,test:re},{name:`null`,test:L},{name:`undefined`,test:se},{name:`AccessorNode`,test:ce},{name:`ArrayNode`,test:R},{name:`AssignmentNode`,test:le},{name:`BlockNode`,test:ue},{name:`ConditionalNode`,test:z},{name:`ConstantNode`,test:B},{name:`FunctionNode`,test:pe},{name:`FunctionAssignmentNode`,test:fe},{name:`IndexNode`,test:me},{name:`Node`,test:he},{name:`ObjectNode`,test:ge},{name:`OperatorNode`,test:_e},{name:`ParenthesisNode`,test:ve},{name:`RangeNode`,test:ye},{name:`RelationalNode`,test:be},{name:`SymbolNode`,test:xe},{name:`Map`,test:ae},{name:`Object`,test:ie}]),a.addConversions([{from:`number`,to:`BigNumber`,convert:function(e){if(t||vt(e),at(e)>15)throw TypeError(`Cannot implicitly convert a number with >15 significant digits to BigNumber (value: `+e+`). Use function bignumber(x) to convert to BigNumber.`);return new t(e)}},{from:`number`,to:`Complex`,convert:function(e){return n||yt(e),new n(e,0)}},{from:`BigNumber`,to:`Complex`,convert:function(e){return n||yt(e),new n(e.toNumber(),0)}},{from:`bigint`,to:`number`,convert:function(e){if(e>2**53-1)throw TypeError(`Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: `+e+`)`);return Number(e)}},{from:`bigint`,to:`BigNumber`,convert:function(e){return t||vt(e),new t(e.toString())}},{from:`bigint`,to:`Fraction`,convert:function(e){return i||xt(e),new i(e)}},{from:`Fraction`,to:`BigNumber`,convert:function(e){throw 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(e){return n||yt(e),new n(e.valueOf(),0)}},{from:`number`,to:`Fraction`,convert:function(e){i||xt(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError(`Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: `+e+`). Use function fraction(x) to convert to Fraction.`);return t}},{from:`string`,to:`number`,convert:function(e){var t=Number(e);if(isNaN(t))throw Error(`Cannot convert "`+e+`" to a number`);return t}},{from:`string`,to:`BigNumber`,convert:function(e){t||vt(e);try{return new t(e)}catch{throw Error(`Cannot convert "`+e+`" to BigNumber`)}}},{from:`string`,to:`bigint`,convert:function(e){try{return BigInt(e)}catch{throw Error(`Cannot convert "`+e+`" to BigInt`)}}},{from:`string`,to:`Fraction`,convert:function(e){i||xt(e);try{return new i(e)}catch{throw Error(`Cannot convert "`+e+`" to Fraction`)}}},{from:`string`,to:`Complex`,convert:function(e){n||yt(e);try{return new n(e)}catch{throw Error(`Cannot convert "`+e+`" to Complex`)}}},{from:`boolean`,to:`number`,convert:function(e){return+e}},{from:`boolean`,to:`BigNumber`,convert:function(e){return t||vt(e),new t(+e)}},{from:`boolean`,to:`bigint`,convert:function(e){return BigInt(+e)}},{from:`boolean`,to:`Fraction`,convert:function(e){return i||xt(e),new i(+e)}},{from:`boolean`,to:`string`,convert:function(e){return String(e)}}
8,{from:`Array`,to:`Matrix`,convert:function(e){return r||bt(),new r(e)}},{from:`Matrix`,to:`Array`,convert:function(e){return e.valueOf()}}]),a.onMismatch=(e,t,n)=>{var r=a.createError(e,t,n);if([`wrongType`,`mismatch`].includes(r.data.category)&&t.length===1&&k(t[0])&&n.some(e=>!e.params.includes(`,`))){var i=TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw i.data=r.data,i}throw r},a.onMismatch=(e,t,n)=>{var r=a.createError(e,t,n);if([`wrongType`,`mismatch`].includes(r.data.category)&&t.length===1&&k(t[0])&&n.some(e=>!e.params.includes(`,`))){var i=TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw i.data=r.data,i}throw r},a});function vt(e){throw Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function yt(e){throw Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function bt(){throw Error(`Cannot convert array into a Matrix: no class 'DenseMatrix' provided`)}function xt(e){throw Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}var St=W(`ResultSet`,[],()=>{function e(t){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`);this.entries=t||[]}return e.prototype.type=`ResultSet`,e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return`[`+this.entries.map(String).join(`, `)+`]`},e.prototype.toJSON=function(){return{mathjs:`ResultSet`,entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e},{isClass:!0}),Ct=9e15,wt=1e9,Tt=`0123456789abcdef`,Et=`2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058`,Dt=`3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789`,Ot={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ct,maxE:Ct,crypto:!1},kt,At,jt=!0,Mt=`[DecimalError] `,Nt=Mt+`Invalid argument: `,Pt=Mt+`Precision limit exceeded`,Ft=Mt+`crypto unavailable`,It=`[object Decimal]`,Lt=Math.floor,Rt=Math.pow,zt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Bt=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Vt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ht=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ut=1e7,Wt=7,Gt=9007199254740991,Kt=Et.length-1,qt=Dt.length-1,K={toStringTag:It};K.absoluteValue=K.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),q(e)},K.ceil=function(){return q(new this.constructor(this),this.e+1,2)},K.clampedTo=K.clamp=function(e,t){var n,r=this,i=r.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Nt+t);return n=r.cmp(e),n<0?e:r.cmp(t)>0?t:new i(r)},K.comparedTo=K.cmp=function(e){var t,n,r,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,c=a.s,l=e.s;if(!o||!s)return!c||!l?NaN:c===l?o===s?0:!o^c<0?1:-1:c;if(!o[0]||!s[0])return o[0]?c:s[0]?-l:0;if(c!==l)return c;if(a.e!==e.e)return a.e>e.e^c<0?1:-1;for(r=o.length,i=s.length,t=0,n=r<i?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},K.cosine=K.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Wt,r.rounding=1,n=Qt(r,vn(r,n)),r.precision=e,r.rounding=t,q(At==2||At==3?n.neg():n,e,t,!0)):new r(1):new r(NaN)},K.cubeRoot=K.cbrt=function(){var e,t,n,r,i,a,o,s,c,l,u=this,d=u.constructor;if(!u.isFinite()||u.isZero())return new d(u);for(jt=!1,a=u.s*Rt(u.s*u,1/3),!a||Math.abs(a)==1/0?(n=Jt(u.d),e=u.e,(a=(e-n.length+1)%3)&&(n+=a==1||a==-2?`0`:`00`),a=Rt(n,1/3),e=Lt((e+1)/3)-(e%3==(e<0?-1:2)),a==1/0?n=`5e`+e:(n=a.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+e),r=new d(n),r.s=u.s):r=new d(a.toString()),o=(e=d.precision)+3;;)if(s=r,c=s.times(s).times(s),l=c.plus(u),r=$t(l.plus(u).times(s),l.plus(c),o+2,1),Jt(s.d).slice(0,o)===(n=Jt(r.d)).slice(0,o))if(n=n.slice(o-3,o+1),n==`9999`||!i&&n==`4999`){if(!i&&(q(s,e+1,0),s.times(s).times(s).eq(u))){r=s;break}o+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(q(r,e+1,1),t=!r.times(r).times(r).eq(u));break}return jt=!0,q(r,e,d.rounding,t)},K.decimalPlaces=K.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-Lt(this.e/Wt))*Wt,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},K.dividedBy=K.div=function(e){return $t(this,new this.constructor(e))},K.dividedToIntegerBy=K.divToInt=function(e){var t=this,n=t.constructor;
8return q($t(t,new n(e),0,1,1),n.precision,n.rounding)},K.equals=K.eq=function(e){return this.cmp(e)===0},K.floor=function(){return q(new this.constructor(this),this.e+1,3)},K.greaterThan=K.gt=function(e){return this.cmp(e)>0},K.greaterThanOrEqualTo=K.gte=function(e){var t=this.cmp(e);return t==1||t===0},K.hyperbolicCosine=K.cosh=function(){var e,t,n,r,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;n=o.precision,r=o.rounding,o.precision=n+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=(1/_n(4,e)).toString()):(e=16,t=`2.3283064365386962890625e-10`),a=gn(o,1,a.times(t),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=a.times(a),a=s.minus(c.times(u.minus(c.times(u))));return q(a,o.precision=n,o.rounding=r,!0)},K.hyperbolicSine=K.sinh=function(){var e,t,n,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=gn(a,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:e|0,i=i.times(1/_n(5,e)),i=gn(a,2,i,i,!0);for(var o,s=new a(5),c=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(c.times(o).plus(l))))}return a.precision=t,a.rounding=n,q(i,t,n,!0)},K.hyperbolicTangent=K.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,$t(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},K.inverseCosine=K.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,a=n.rounding;return r===-1?t.isZero()?rn(n,i+4,a).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=rn(n,i+4,a).times(.5),n.precision=i,n.roun
8ding=a,e.minus(t)):r===0?t.isNeg()?rn(n,i,a):new n(0):new n(NaN)},K.inverseHyperbolicCosine=K.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,jt=!1,n=n.times(n).minus(1).sqrt().plus(n),jt=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},K.inverseHyperbolicSine=K.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,jt=!1,n=n.times(n).plus(1).sqrt().plus(n),jt=!0,r.precision=e,r.rounding=t,n.ln())},K.inverseHyperbolicTangent=K.atanh=function(){var e,t,n,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?q(new a(i),e,t,!0):(a.precision=n=r-i.e,i=$t(i.plus(1),new a(1).minus(i),n+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},K.inverseSine=K.asin=function(){var e,t,n,r,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),n=a.precision,r=a.rounding,t===-1?(a.precision=n+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=n,a.rounding=r,i.times(2)):t===0?(e=rn(a,n+4,r).times(.5),e.s=i.s,e):new a(NaN))},K.inverseTangent=K.atan=function(){var e,t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding;if(!l.isFinite()){if(!l.s)return new u(NaN);if(d+4<=qt)return o=rn(u,d+4,f).times(.5),o.s=l.s,o}else if(l.isZero())return new u(l);else if(l.abs().eq(1)&&d+4<=qt)return o=rn(u,d+4,f).times(.25),o.s=l.s,o;for(u.precision=s=d+10,u.rounding=1,n=Math.min(28,s/Wt+2|0),e=n;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(jt=!1,t=Math.ceil(s/Wt),r=1,c=l.times(l),o=new u(l),i=l;e!==-1;)if(i=i.times(c),a=o.minus(i.div(r+=2)),i=i.times(c),o=a.plus(i.div(r+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===a.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),jt=!0,q(o,u.precision=d,u.rounding=f,!0)},K.isFinite=function(){return!!this.d},K.isInteger=K.isInt=function(){return!!this.d&&Lt(this.e/Wt)>this.d.length-2},K.isNaN=function(){return!this.s},K.isNegative=K.isNeg=function(){return this.s<0},K.isPositive=K.isPos=function(){return this.s>0},K.isZero=function(){return!!this.d&&this.d[0]===0},K.lessThan=K.lt=function(e){return this.cmp(e)<0},K.lessThanOrEqualTo=K.lte=function(e){return this.cmp(e)<1},K.logarithm=K.log=function(e){var t,n,r,i,a,o,s,c,l=this,u=l.constructor,d=u.precision,f=u.rounding,p=5;if(e==null)e=new u(10),t=!0;else{if(e=new u(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=l.d,l.s<0||!n||!n[0]||l.eq(1))return new u(n&&!n[0]?-1/0:l.s==1?n?0:1/0:NaN);if(t)if(n.length>1)a=!0;else{for(i=n[0];i%10==0;)i/=10;a=i!==1}if(jt=!1,s=d+p,o=dn(l,s),r=t?nn(u,s+10):dn(e,s),c=$t(o,r,s,1),Xt(c.d,i=d,f))do if(s+=10,o=dn(l,s),r=t?nn(u,s+10):dn(e,s),c=$t(o,r,s,1),!a){+Jt(c.d).slice(i+1,i+15)+1==0x5af3107a4000&&(c=q(c,d+1,0));break}while(Xt(c.d,i+=10,f));return jt=!0,q(c,d,f)},K.minus=K.sub=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.constructor;if(e=new m(e),!p.d||!e.d)return!p.s||!e.s?e=new m(NaN):p.d?e.s=-e.s:e=new m(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(l=p.d,f=e.d,s=m.precision,c=m.rounding,!l[0]||!f[0]){if(f[0])e.s=-e.s;else if(l[0])e=new m(p);else return new m(c===3?-0:0);return jt?q(e,s,c):e}if(n=Lt(e.e/Wt),u=Lt(p.e/Wt),l=l.slice(),a=u-n,a){for(d=a<0,d?(t=l,a=-a,o=f.length):(t=f,n=u,o=l.length),r=Math.max(Math.ceil(s/Wt),o)+2,a>r&&(a=r,t.length=1),t.reverse(),r=a;r--;)t.push(0);t.reverse()}else{for(r=l.length,o=f.length,d=r<o,d&&(o=r),r=0;r<o;r++)if(l[r]!=f[r]){d=l[r]<f[r];break}a=0}for(d&&(t=l,l=f,f=t,e.s=-e.s),o=l.length,r=f.length-o;r>0;--r)l[o++]=0;for(r=f.length;r>a;){if(l[--r]<f[r]){for(i=r;i&&l[--i]===0;)l[i]=Ut-1;--l[i],l[r]+=Ut}l[r]-=f[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--n;return l[0]?(e.d=l,e.e=tn(l,n),jt?q(e,s,c):e):new m(c===3?-0:0)},K.modulo=K.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?q(new r(n),r.precision,r.rounding):(jt=!1,r.modulo==9?(t=$t(n,e.abs(),0,3,1),t.s*=e.s):t=$t(n,e,0,r.modulo,1),t=t.times(e),jt=!0,n.minus(t))},K.naturalExponential=K.exp=function(){return un(this)},K.naturalLogarithm=K.ln=function(){return dn(this)},K.negated=K.neg=function(){var e=new this.constructor(this);return e.s=-e.s,q(e)},K.plus=K.add=function(e){var t,n,r,i,a,o,s,c,l,u,d=this,f=d.constructor;if(e=new f(e),!d.d||!e.d)return!d.s||!e.s?e=new f(NaN):d.d||(e=new f(e.d||d.s===e.s?d:NaN)),e;if(d.s!=e.s)return e.s=-e.s,d.minus(e);if(l=d.d,u=e.d,s=f.precision,c=f.rounding,!l[0]||!u[0])return u[0]||(e=new f(d)),jt?q(e,s,c):e;if(a=Lt(d.e/Wt),r=Lt(e.e/Wt),l=l.slice(),i=a-r,i){for(i<0?(n=l,i=-i,o=u.length):(n=u,r=a,o=l.length),a=Math.ceil(s/Wt),o=a>o?a+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=l.length,i=u.length,o-i<0&&(i=o,n=u,u=l,l=n),t=0;i;)t=(l[--i]=l[i]+u[i]+t)/Ut|0,l[i]%=Ut;for(t&&(l.unshift(t),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=tn(l,r),jt?q(e,s,c):e},K.precision=K.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Nt+e);return n.d?(t=an(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},K.round=function(){var e=this,t=e.constructor;return q(new t(e),e.e+1,t.rounding)},K.sine=K.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Wt,r.rounding=1,n=hn(r,vn(r,n)),r.precision=e,r.rounding=t,q(At>2?n.neg():n,e,t,!0)):new r(NaN)},K.squareRoot=K.sqrt=function(){var e,t,n,r,i,a,o=this,s=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(jt=!1,l=Math.sqrt(+o),l==0||l==1/0?(t=Jt(s),(t.length+c)%2==0&&(t+=`0`),l=Math.sqrt(t),c=Lt((c+1)/2)-(c<0||c%2),l==1/0?t=`5e`+c:(t=l.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+c),r=new u(t)):r=new u(l.toString()),n=(c=u.precision)+3;;)if(a=r,r=a.plus($t(o,a,n+2,1)).times(.5),Jt(a.d).slice(0,n)===(t=Jt(r.d)).slice(0,n))if(t=t.slice(n-3,n+1),t==`9999`||!i&&t==`4999`){if(!i&&(q(a,c+1,0),a.times(a).eq(o))){r=a;break}n+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)==`5`)&&(q(r,c+1,1),e=!r.times(r).eq(o));break}return jt=!0,q(r,c,u.rounding,e)},K.tangent=K.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=$t(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,q(At==2||At==4?n.neg():n,e,t,!0)):new r(NaN)},K.times=K.mul=function(e){var t,n,r,i,a,o,s,c,l,u=this,d=u.constructor,f=u.d,p=(e=new d(e)).d;if(e.s*=u.s,!f||!f[0]||!p||!p[0])return new d(!e.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?e.s/0:e.s*0);for(n=Lt(u.e/Wt)+Lt(e.e/Wt),c=f.length,l=p.length,c<l&&(a=f,f=p,p=a,o=c,c=l,l=o),a=[],o=c+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(t=0,i=c+r;i>r;)s=a[i]+p[r]*f[i-r-1]+t,a[i--]=s%Ut|0,t=s/Ut|0;a[i]=(a[i]+t)%Ut|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=tn(a,n),jt?q(e,d.precision,d.rounding):e},K.toBinary=function(e,t){return yn(this,2,e,t)},K.toDecimalPlaces=K.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Yt(e,0,wt),t===void 0?t=r.rounding:Yt(t,0,8),q(n,e+n.e+1,t))},K.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=en(r,!0):(Yt(e,0,wt),t===void 0?t=i.rounding:Yt(t,0,8),r=q(new i(r),e+1,t),n=en(r,!0,e+1)),r.isNeg()&&!r.isZero()?`-`+n:n},K.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?n=en(i):(Yt(e,0,wt),t===void 0?t=a.rounding:Yt(t,0,8),r=q(new a(i),e+i.e+1,t),n=en(r,!1,e+r.e+1)),i.isNeg()&&!i.isZero()?`-`+n:n},K.toFraction=function(e){var t,n,r,i,a,o,s,c,l,u,d,f,p=this,m=p.d,h=p.constructor;if(!m)return new h(p);if(l=n=new h(1),r=c=new h(0),t=new h(r),a=t.e=an(m)-p.e-1,o=a%Wt,t.d[0]=Rt(10,o<0?Wt+o:o),e==null)e=a>0?t:l;else{if(s=new h(e),!s.isInt()||s.lt(l))throw Error(Nt+s);e=s.gt(t)?a>0?t:l:s}for(jt=!1,s=new h(Jt(m)),u=h.precision,h.precision=a=m.length*Wt*2;d=$t(s,t,0,1,1),i=n.plus(d.times(r)),i.cmp(e)!=1;)n=r,r=i,i=l,l=c.plus(d.times(i)),c=i,i=t,t=s.minus(d.times(i)),s=i;return i=$t(e.minus(n),r,0,1,1),c=c.plus(i.times(l)),n=n.plus(i.times(r)),c.s=l.s=p.s,f=$t(l,r,a,1).minus(p).abs().cmp($t(c,n,a,1).minus(p).abs())<1?[l,r]:[c,n],h.precision=u,jt=!0,f},K.toHexadecimal=K.toHex=function(e,t){return yn(this,16,e,t)},K.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),e==null){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),t===void 0?t=r.rounding:Yt(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&=n.s,e}return e.d[0]?(jt=!1,n=$t(n,e,0,t,1).times(e),jt=!0,q(n)):(e.s=n.s,n=e),n},K.toNumber=function(){return+this},K.toOctal=function(e,t){return yn(this,8,e,t)},K.toPower=K.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,l=+(e=new c(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new c(Rt(+s,l));if(s=new c(s),s.eq(1))return s;if(r=c.precision,a=c.rounding,e.eq(1))return q(s,r,a);if(t=Lt(e.e/Wt),t>=e.d.length-1&&(n=l<0?-l:l)<=Gt)return i=sn(c,s,n,r),e.s<0?new c(1).div(i):q(i,r,a);if(o=s.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return n=Rt(+s,l),t=n==0||!isFinite(n)?Lt(l*(Math.log(`0.`+Jt(s.d))/Math.LN10+s.e+1)):new c(n+``).e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(jt=!1,c.rounding=s.s=1,n=Math.min(12,(t+``).length),i=un(e.times(dn(s,r+n)),r),i.d&&(i=q(i,r+5,1),Xt(i.d,r,a)&&(t=r
8+10,i=q(un(e.times(dn(s,t+n)),t),t+5,1),+Jt(i.d).slice(r+1,r+15)+1==0x5af3107a4000&&(i=q(i,r+1,0)))),i.s=o,jt=!0,c.rounding=a,q(i,r,a))},K.toPrecision=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=en(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(Yt(e,1,wt),t===void 0?t=i.rounding:Yt(t,0,8),r=q(new i(r),e,t),n=en(r,e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?`-`+n:n},K.toSignificantDigits=K.toSD=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Yt(e,1,wt),t===void 0?t=r.rounding:Yt(t,0,8)),q(new r(n),e,t)},K.toString=function(){var e=this,t=e.constructor,n=en(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?`-`+n:n},K.truncated=K.trunc=function(){return q(new this.constructor(this),this.e+1,1)},K.valueOf=K.toJSON=function(){var e=this,t=e.constructor,n=en(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?`-`+n:n};function Jt(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=Wt-r.length,n&&(a+=on(n)),a+=r;o=e[t],r=o+``,n=Wt-r.length,n&&(a+=on(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}function Yt(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Nt+e)}function Xt(e,t,n,r){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=Wt,i=0):(i=Math.ceil((t+1)/Wt),t%=Wt),a=Rt(10,Wt-t),s=e[i]%a|0,r==null?t<3?(t==0?s=s/100|0:t==1&&(s=s/10|0),o=n<4&&s==99999||n>3&&s==49999||s==5e4||s==0):o=(n<4&&s+1==a||n>3&&s+1==a/2)&&(e[i+1]/a/100|0)==Rt(10,t-2)-1||(s==a/2||s==0)&&(e[i+1]/a/100|0)==0:t<4?(t==0?s=s/1e3|0:t==1?s=s/100|0:t==2&&(s=s/10|0),o=(r||n<4)&&s==9999||!r&&n>3&&s==4999):o=((r||n<4)&&s+1==a||!r&&n>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==Rt(10,t-3)-1,o}function Zt(e,t,n){for(var r,i=[0],a,o=0,s=e.length;o<s;){for(a=i.length;a--;)i[a]*=t;for(i[0]+=Tt.indexOf(e.charAt(o++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Qt(e,t){var n,r,i;if(t.isZero())return t;r=t.d.length,r<32?(n=Math.ceil(r/3),i=(1/_n(4,n)).toString()):(n=16,i=`2.3283064365386962890625e-10`),e.precision+=n,t=gn(e,1,t.times(i),new e(1));for(var a=n;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var $t=(function(){function e(e,t,n){var r,i=0,a=e.length;for(e=e.slice();a--;)r=e[a]*t+i,e[a]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,o,s,c){var l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k=r.constructor,A=r.s==i.s?1:-1,j=r.d,M=i.d;if(!j||!j[0]||!M||!M[0])return new k(!r.s||!i.s||(j?M&&j[0]==M[0]:!M)?NaN:j&&j[0]==0||!M?A*0:A/0);for(c?(p=1,u=r.e-i.e):(c=Ut,p=Wt,u=Lt(r.e/p)-Lt(i.e/p)),D=M.length,T=j.length,_=new k(A),v=_.d=[],d=0;M[d]==(j[d]||0);d++);if(M[d]>(j[d]||0)&&u--,a==null?(S=a=k.precision,o=k.rounding):S=s?a+(r.e-i.e)+1:a,S<0)v.push(1),m=!0;else{if(S=S/p+2|0,d=0,D==1){for(f=0,M=M[0],S++;(d<T||f)&&S--;d++)C=f*c+(j[d]||0),v[d]=C/M|0,f=C%M|0;m=f||d<T}else{for(f=c/(M[0]+1)|0,f>1&&(M=e(M,f,c),j=e(j,f,c),D=M.length,T=j.length),w=D,y=j.slice(0,D),b=y.length;b<D;)y[b++]=0;O=M.slice(),O.unshift(0),E=M[0],M[1]>=c/2&&++E;do f=0,l=t(M,y,D,b),l<0?(x=y[0],D!=b&&(x=x*c+(y[1]||0)),f=x/E|0,f>1?(f>=c&&(f=c-1),h=e(M,f,c),g=h.length,b=y.length,l=t(h,y,g,b),l==1&&(f--,n(h,D<g?O:M,g,c))):(f==0&&(l=f=1),h=M.slice()),g=h.length,g<b&&h.unshift(0),n(y,h,b,c),l==-1&&(b=y.length,l=t(M,y,D,b),l<1&&(f++,n(y,D<b?O:M,b,c))),b=y.length):l===0&&(f++,y=[0]),v[d++]=f,l&&y[0]?y[b++]=j[w]||0:(y=[j[w]],b=1);while((w++<T||y[0]!==void 0)&&S--);m=y[0]!==void 0}v[0]||v.shift()}if(p==1)_.e=u,kt=m;else{for(d=1,f=v[0];f>=10;f/=10)d++;_.e=d+u*p-1,q(_,s?a+_.e+1:a,o,m)}return _}})();function q(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor;out:if(t!=null){if(d=e.d,!d)return e;for(i=1,s=d[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=Wt,o=t,u=d[f=0],c=u/Rt(10,i-o-1)%10|0;else if(f=Math.ceil((a+1)/Wt),s=d.length,f>=s)if(r){for(;s++<=f;)d.push(0);u=c=0,i=1,a%=Wt,o=a-Wt+1}else break out;else{for(u=s=d[f],i=1;s>=10;s/=10)i++;a%=Wt,o=a-Wt+i,c=o<0?0:u/Rt(10,i-o-1)%10|0}if(r=r||t<0||d[f+1]!==void 0||(o<0?u:u%Rt(10,i-o-1)),l=n<4?(c||r)&&(n==0||n==(e.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(a>0?o>0?u/Rt(10,i-o):0:d[f-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,l?(t-=e.e+1,d[0]=Rt(10,(Wt-t%Wt)%Wt),e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=f,s=1,f--):(d.length=f+1,s=Rt(10,Wt-a),d[f]=o>0?(u/Rt(10,i-o)%Rt(10,o)|0)*s:0),l)for(;;)if(f==0){for(a=1,o=d[0];o>=10;o/=10)a++;for(o=d[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,d[0]==Ut&&(d[0]=1));break}else{if(d[f]+=s,d[f]!=Ut)break;d[f--]=0,s=1}for(a=d.length;d[--a]===0;)d.pop()}return jt&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}
8function en(e,t,n){if(!e.isFinite())return fn(e);var r,i=e.e,a=Jt(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+on(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(e.e<0?`e`:`e+`)+e.e):i<0?(a=`0.`+on(-i-1)+a,n&&(r=n-o)>0&&(a+=on(r))):i>=o?(a+=on(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+on(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=on(r))),a}function tn(e,t){var n=e[0];for(t*=Wt;n>=10;n/=10)t++;return t}function nn(e,t,n){if(t>Kt)throw jt=!0,n&&(e.precision=n),Error(Pt);return q(new e(Et),t,1,!0)}function rn(e,t,n){if(t>qt)throw Error(Pt);return q(new e(Dt),t,n,!0)}function an(e){var t=e.length-1,n=t*Wt+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function on(e){for(var t=``;e--;)t+=`0`;return t}function sn(e,t,n,r){var i,a=new e(1),o=Math.ceil(r/Wt+4);for(jt=!1;;){if(n%2&&(a=a.times(t),bn(a.d,o)&&(i=!0)),n=Lt(n/2),n===0){n=a.d.length-1,i&&a.d[n]===0&&++a.d[n];break}t=t.times(t),bn(t.d,o)}return jt=!0,a}function cn(e){return e.d[e.d.length-1]&1}
8function ln(e,t,n){for(var r,i=new e(t[0]),a=0;++a<t.length;)if(r=new e(t[a]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function un(e,t){var n,r,i,a,o,s,c,l=0,u=0,d=0,f=e.constructor,p=f.rounding,m=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(jt=!1,c=m):c=t,s=new f(.03125);e.e>-2;)e=e.times(s),d+=5;for(r=Math.log(Rt(2,d))/Math.LN10*2+5|0,c+=r,n=a=o=new f(1),f.precision=c;;){if(a=q(a.times(e),c,1),n=n.times(++u),s=o.plus($t(a,n,c,1)),Jt(s.d).slice(0,c)===Jt(o.d).slice(0,c)){for(i=d;i--;)o=q(o.times(o),c,1);if(t==null)if(l<3&&Xt(o.d,c-r,p,l))f.precision=c+=10,n=a=s=new f(1),u=0,l++;else return q(o,f.precision=m,p,jt=!0);else return f.precision=m,o}o=s}}function dn(e,t){var n,r,i,a,o,s,c,l,u,d,f,p=1,m=10,h=e,g=h.d,_=h.constructor,v=_.rounding,y=_.precision;if(h.s<0||!g||!g[0]||!h.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:h.s==1?g?0:h:NaN);if(t==null?(jt=!1,u=y):u=t,_.precision=u+=m,n=Jt(g),r=n.charAt(0),Math.abs(a=h.e)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Jt(h.d),r=n.charAt(0),p++;a=h.e,r>1?(h=new _(`0.`+n),a++):h=new _(r+`.`+n.slice(1))}else return l=nn(_,u+2,y).times(a+``),h=dn(new _(r+`.`+n.slice(1)),u-m).plus(l),_.precision=y,t==null?q(h,y,v,jt=!0):h;for(d=h,c=o=h=$t(h.minus(1),h.plus(1),u,1),f=q(h.times(h),u,1),i=3;;){if(o=q(o.times(f),u,1),l=c.plus($t(o,new _(i),u,1)),Jt(l.d).slice(0,u)===Jt(c.d).slice(0,u))if(c=c.times(2),a!==0&&(c=c.plus(nn(_,u+2,y).times(a+``))),c=$t(c,new _(p),u,1),t==null)if(Xt(c.d,u-m,v,s))_.precision=u+=m,l=o=h=$t(d.minus(1),d.plus(1),u,1),f=q(h.times(h),u,1),i=s=1;else return q(c,_.precision=y,v,jt=!0);else return _.precision=y,c;c=l,i+=2}}function fn(e){return String(e.s*e.s/0)}function pn(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(r,i),t){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Wt,n<0&&(r+=Wt),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=Wt;r<i;)e.d.push(+t.slice(r,r+=Wt));t=t.slice(r),r=Wt-t.length}else r-=i;for(;r--;)t+=`0`;e.d.push(+t),jt&&(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 mn(e,t){var n,r,i,a,o,s,c,l,u;if(t.indexOf(`_`)>-1){if(t=t.replace(/(\d)_(?=\d)/g,`$1`),Ht.test(t))return pn(e,t)}else if(t===`Infinity`||t===`NaN`)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Bt.test(t))n=16,t=t.toLowerCase();else if(zt.test(t))n=2;else if(Vt.test(t))n=8;else throw Error(Nt+t);for(a=t.search(/p/i),a>0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf(`.`),o=a>=0,r=e.constructor,o&&(t=t.replace(`.`,``),s=t.length,a=s-a,i=sn(r,new r(n),a,a*2)),l=Zt(t,n,Ut),u=l.length-1,a=u;l[a]===0;--a)l.pop();return a<0?new r(e.s*0):(e.e=tn(l,u),e.d=l,jt=!1,o&&(e=$t(e,i,s*4)),c&&(e=e.times(Math.abs(c)<54?Rt(2,c):cr.pow(2,c))),jt=!0,e)}function hn(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:gn(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:n|0,t=t.times(1/_n(5,n)),t=gn(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function gn(e,t,n,r,i){var a,o,s,c,l=1,u=e.precision,d=Math.ceil(u/Wt);for(jt=!1,c=n.times(n),s=new e(r);;){if(o=$t(s.times(c),new e(t++*t++),u,1),s=i?r.plus(o):r.minus(o),r=$t(o.times(c),new e(t++*t++),u,1),o=s.plus(r),o.d[d]!==void 0){for(a=d;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=r,r=o,o=a,l++}return jt=!0,o.d.length=d+1,o}function _n(e,t){for(var n=e;--t;)n*=e;return n}function vn(e,t){var n,r=t.s<0,i=rn(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return At=r?4:1,t;if(n=t.divToInt(i),n.isZero())At=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(a))return At=cn(n)?r?2:3:r?4:1,t;At=cn(n)?r?1:4:r?3:2}return t.minus(i).abs()}function yn(e,t,n,r){var i,a,o,s,c,l,u,d,f,p=e.constructor,m=n!==void 0;if(m?(Yt(n,1,wt),r===void 0?r=p.rounding:Yt(r,0,8)):(n=p.precision,r=p.rounding),!e.isFinite())u=fn(e);else{for(u=en(e),o=u.indexOf(`.`),m?(i=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):i=t,o>=0&&(u=u.replace(`.`,``),f=new p(1),f.e=u.length-o,f.d=Zt(en(f),10,i),f.e=f.d.length),d=Zt(u,10,i),a=c=d.length;d[--c]==0;)d.pop();if(!d[0])u=m?`0p+0`:`0`;else{if(o<0?a--:(e=new p(e),e.d=d,e.e=a,e=$t(e,f,n,r,0,i),d=e.d,a=e.e,l=kt),o=d[n],s=i/2,l||=d[n+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(e.s<0?3:2)):o>s||o===s&&(r===4||l||r===6&&d[n-1]&1||r===(e.s<0?8:7)),d.length=n,l)for(;++d[--n]>i-1;)d[n]=0,n||(++a,d.unshift(1));for(c=d.length;
8!d[c-1];--c);for(o=0,u=``;o<c;o++)u+=Tt.charAt(d[o]);if(m){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)u+=`0`;for(d=Zt(u,i,t),c=d.length;!d[c-1];--c);for(o=1,u=`1.`;o<c;o++)u+=Tt.charAt(d[o])}else u=u.charAt(0)+`.`+u.slice(1);u=u+(a<0?`p`:`p+`)+a}else if(a<0){for(;++a;)u=`0`+u;u=`0.`+u}else if(++a>c)for(a-=c;a--;)u+=`0`;else a<c&&(u=u.slice(0,a)+`.`+u.slice(a))}u=(t==16?`0x`:t==2?`0b`:t==8?`0o`:``)+u}return e.s<0?`-`+u:u}function bn(e,t){if(e.length>t)return e.length=t,!0}function xn(e){return new this(e).abs()}function Sn(e){return new this(e).acos()}function Cn(e){return new this(e).acosh()}function wn(e,t){return new this(e).plus(t)}function Tn(e){return new this(e).asin()}function En(e){return new this(e).asinh()}function Dn(e){return new this(e).atan()}function On(e){return new this(e).atanh()}function kn(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,a=r+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=rn(this,a,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?rn(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=rn(this,a,1).times(.5),n.s=e.s):t.s<0?(this.precision=a,this.rounding=1,n=this.atan($t(e,t,a,1)),t=rn(this,a,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan($t(e,t,a,1)),n}function An(e){return new this(e).cbrt()}function jn(e){return q(e=new this(e),e.e+1,2)}function Mn(e,t,n){return new this(e).clamp(t,n)}function Nn(e){if(!e||typeof e!=`object`)throw Error(Mt+`Object expected`);var t,n,r,i=e.defaults===!0,a=[`precision`,1,wt,`rounding`,0,8,`toExpNeg`,-Ct,0,`toExpPos`,0,Ct,`maxE`,0,Ct,`minE`,-Ct,0,`modulo`,0,9];for(t=0;t<a.length;t+=3)if(n=a[t],i&&(this[n]=Ot[n]),(r=e[n])!==void 0)if(Lt(r)===r&&r>=a[t+1]&&r<=a[t+2])this[n]=r;else throw Error(Nt+n+`: `+r);if(n=`crypto`,i&&(this[n]=Ot[n]),(r=e[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Ft);else this[n]=!1;else throw Error(Nt+n+`: `+r);return this}function Pn(e){return new this(e).cos()}function Fn(e){return new this(e).cosh()}function In(e){var t,n,r;function i(e){var t,n,r,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,Vn(e)){a.s=e.s,jt?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d);return}if(r=typeof e,r===`number`){if(e===0){a.s=1/e<0?-1:1,a.e=0,a.d=[0];return}if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;jt?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]);return}else if(e*0!=0){e||(a.s=NaN),a.e=NaN,a.d=null;return}return pn(a,e.toString())}else if(r!==`string`)throw Error(Nt+e);return(n=e.charCodeAt(0))===45?(e=e.slice(1),a.s=-1):(n===43&&(e=e.slice(1)),a.s=1),Ht.test(e)?pn(a,e):mn(a,e)}if(i.prototype=K,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Nn,i.clone=In,i.isDecimal=Vn,i.abs=xn,i.acos=Sn,i.acosh=Cn,i.add=wn,i.asin=Tn,i.asinh=En,i.atan=Dn,i.atanh=On,i.atan2=kn,i.cbrt=An,i.ceil=jn,i.clamp=Mn,i.cos=Pn,i.cosh=Fn,i.div=Ln,i.exp=Rn,i.floor=zn,i.hypot=Bn,i.ln=Hn,i.log=Un,i.log10=Gn,i.log2=Wn,i.max=Kn,i.min=qn,i.mod=Jn,i.mul=Yn,i.pow=Xn,i.random=Zn,i.roun
8d=Qn,i.sign=$n,i.sin=er,i.sinh=tr,i.sqrt=nr,i.sub=rr,i.sum=ir,i.tan=ar,i.tanh=or,i.trunc=sr,e===void 0&&(e={}),e&&e.defaults!==!0)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`maxE`,`minE`,`modulo`,`crypto`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function Ln(e,t){return new this(e).div(t)}function Rn(e){return new this(e).exp()}function zn(e){return q(e=new this(e),e.e+1,3)}function Bn(){var e,t,n=new this(0);for(jt=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return jt=!0,new this(1/0);n=t}return jt=!0,n.sqrt()}function Vn(e){return e instanceof cr||e&&e.toStringTag===It||!1}function Hn(e){return new this(e).ln()}function Un(e,t){return new this(e).log(t)}function Wn(e){return new this(e).log(2)}function Gn(e){return new this(e).log(10)}function Kn(){return ln(this,arguments,`lt`)}function qn(){return ln(this,arguments,`gt`)}function Jn(e,t){return new this(e).mod(t)}function Yn(e,t){return new this(e).mul(t)}function Xn(e,t){return new this(e).pow(t)}function Zn(e){var t,n,r,i,a=0,o=new this(1),s=[];if(e===void 0?e=this.precision:Yt(e,1,wt),r=Math.ceil(e/Wt),!this.crypto)for(;a<r;)s[a++]=Math.random()*1e7|0;else if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));a<r;)i=t[a],i>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);a<r;)i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((t[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=r/4}else throw Error(Ft);for(r=s[--a],e%=Wt,r&&e&&(i=Rt(10,Wt-e),s[a]=(r/i|0)*i);s[a]===0;a--)s.pop();if(a<0)n=0,s=[0];else{for(n=-1;s[0]===0;n-=Wt)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<Wt&&(n-=Wt-r)}return o.e=n,o.d=s,o}function Qn(e){return q(e=new this(e),e.e+1,this.rounding)}function $n(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function er(e){return new this(e).sin()}function tr(e){return new this(e).sinh()}function nr(e){return new this(e).sqrt()}function rr(e,t){return new this(e).sub(t)}function ir(){var e=0,t=arguments,n=new this(t[e]);for(jt=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return jt=!0,q(n,this.precision,this.rounding)}function ar(e){return new this(e).tan()}function or(e){return new this(e).tanh()}function sr(e){return q(e=new this(e),e.e+1,1)}K[Symbol.for(`nodejs.util.inspect.custom`)]=K.toString,K[Symbol.toStringTag]=`Decimal`;var cr=K.constructor=In(Ot);Et=new cr(Et),Dt=new cr(Dt);var lr=W(`BigNumber`,[`?on`,`config`],e=>{var{on:t,config:n}=e,r=cr.clone({precision:n.precision,modulo:cr.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type=`BigNumber`,r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:`BigNumber`,value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t(`config`,function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})}),r},{isClass:!0}),ur=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:(Math.exp(e)+Math.exp(-e))*.5},dr=Math.sinh||function(e){return Math.abs(e)<1e-9?e:(Math.exp(e)-Math.exp(-e))*.5},fr=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let n=e*e;return n*(n*(n*(n*(n*(n*(n*(n/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},pr=function(e,t){return e=Math.abs(e),t=Math.abs(t),e<t&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},mr=function(){throw SyntaxError(`Invalid Param`)};function hr(e,t){let n=Math.abs(e),r=Math.abs(t);return e===0?Math.log(r):t===0?Math.log(n):n<3e3&&r<3e3?Math.log(e*e+t*t)*.5:(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}var gr={re:0,im:0},_r=function(e,t){let n=gr;if(e==null)n.re=n.im=0;else if(t!==void 0)n.re=e,n.im=t;else switch(typeof e){case`object`:if(`im`in e&&`re`in e)n.re=e.re,n.im=e.im;else if(`abs`in e&&`arg`in e){if(!isFinite(e.abs)&&isFinite(e.arg))return J.INFINITY;n.re=e.abs*Math.cos(e.arg),n.im=e.abs*Math.sin(e.arg)}else if(`r`in e&&`phi`in e){if(!isFinite(e.r)&&isFinite(e.phi))return J.INFINITY;n.re=e.r*Math.cos(e.phi),n.im=e.r*Math.sin(e.phi)}else e.length===2?(n.re=e[0],n.im=e[1]):mr();break;case`string`:n.im=n.re=0;let t=e.replace(/_/g,``).match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),r=1,i=0;t===null&&mr();for(let e=0;e<t.length;e++){let a=t[e];a===` `||a===`	`||a===`
9`||(a===`+`?r++:a===`-`?i++:a===`i`||a===`I`?(r+i===0&&mr(),t[e+1]!==` `&&!isNaN(t[e+1])?(n.im+=parseFloat((i%2?`-`:``)+t[e+1]),e++):n.im+=parseFloat((i%2?`-`:``)+`1`),r=i=0):((r+i===0||isNaN(a))&&mr(),t[e+1]===`i`||t[e+1]===`I`?
9(n.im+=parseFloat((i%2?`-`:``)+a),e++):n.re+=parseFloat((i%2?`-`:``)+a),r=i=0))}r+i>0&&mr();break;case`number`:n.im=0,n.re=e;break;default:mr()}return isNaN(n.re)||isNaN(n.im),n};function J(e,t){if(!(this instanceof J))return new J(e,t);let n=_r(e,t);this.re=n.re,this.im=n.im}J.prototype={re:0,im:0,sign:function(){let e=pr(this.re,this.im);return new J(this.re/e,this.im/e)},add:function(e,t){let n=_r(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?J.NAN:J.INFINITY:new J(this.re+n.re,this.im+n.im)},sub:function(e,t){let n=_r(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?J.NAN:J.INFINITY:new J(this.re-n.re,this.im-n.im)},mul:function(e,t){let n=_r(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),a=this.re===0&&this.im===0,o=n.re===0&&n.im===0;return r&&o||i&&a?J.NAN:r||i?J.INFINITY:n.im===0&&this.im===0?new J(this.re*n.re,0):new J(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){let n=_r(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),a=this.re===0&&this.im===0,o=n.re===0&&n.im===0;if(a&&o||r&&i)return J.NAN;if(o||r)return J.INFINITY;if(a||i)return J.ZERO;if(n.im===0)return new J(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){let e=n.re/n.im,t=n.re*e+n.im;return new J((this.re*e+this.im)/t,(this.im*e-this.re)/t)}else{let e=n.im/n.re,t=n.im*e+n.re;return new J((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let n=_r(e,t),r=this.re===0&&this.im===0;if(n.re===0&&n.im===0)return J.ONE;if(n.im===0){if(this.im===0&&this.re>0)return new J(this.re**+n.re,0);if(this.re===0)switch((n.re%4+4)%4){case 0:return new J(this.im**+n.re,0);case 1:return new J(0,this.im**+n.re);case 2:return new J(-(this.im**+n.re),0);case 3:return new J(0,-(this.im**+n.re))}}if(r&&n.re>0)return J.ZERO;let i=Math.atan2(this.im,this.re),a=hr(this.re,this.im),o=Math.exp(n.re*a-n.im*i),s=n.im*a+n.re*i;return new J(o*Math.cos(s),o*Math.sin(s))},sqrt:function(){let e=this.re,t=this.im;if(t===0)return e>=0?new J(Math.sqrt(e),0):new J(0,Math.sqrt(-e));let n=pr(e,t),r=Math.sqrt(.5*(n+Math.abs(e))),i=Math.abs(t)/(2*r);return e>=0?new J(r,t<0?-i:i):new J(i,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return this.im===0?new J(e,0):new J(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new J(Math.expm1(e)*Math.cos(t)+fr(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return t===0&&e>0?new J(Math.log(e),0):new J(hr(e,t),Math.atan2(t,e))},abs:function(){return pr(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new J(Math.sin(e)*ur(t),Math.cos(e)*dr(t))},cos:function(){let e=this.re,t=this.im;return new J(Math.cos(e)*ur(t),-Math.sin(e)*dr(t))},tan:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)+ur(t);return new J(Math.sin(e)/n,dr(t)/n)},cot:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)-ur(t);return new J(-Math.sin(e)/n,dr(t)/n)},sec:function(){let e=this.re,t=this.im,n=.5*ur(2*t)+.5*Math.cos(2*e);return new J(Math.cos(e)*ur(t)/n,Math.sin(e)*dr(t)/n)},csc:function(){let e=this.re,t=this.im,n=.5*ur(2*t)-.5*Math.cos(2*e);return new J(Math.sin(e)*ur(t)/n,-Math.cos(e)*dr(t)/n)},asin:function(){let e=this.re,t=this.im,n=new J(t*t-e*e+1,-2*e*t).sqrt(),r=new J(n.re-t,n.im+e).log();return new J(r.im,-r.re)},acos:function(){let e=this.re,t=this.im,n=new J(t*t-e*e+1,-2*e*t).sqrt(),r=new J(n.re-t,n.im+e).log();return new J(Math.PI/2-r.im,r.re)},atan:function(){let e=this.re,t=this.im;if(e===0){if(t===1)return new J(0,1/0);if(t===-1)return new J(0,-1/0)}let n=e*e+(1-t)*(1-t),r=new J((1-t*t-e*e)/n,-2*e/n).log();return new J(-.5*r.im,.5*r.re)},acot:function(){let e=this.re,t=this.im;if(t===0)return new J(Math.atan2(1,e),0);let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).atan():new J(e/n,-t/n).atan()},asec:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new J(0,1/0);let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).acos():new J(e/n,-t/n).acos()},acsc:function(){let e=this.re,t=this.im;
9if(e===0&&t===0)return new J(Math.PI/2,1/0);let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).asin():new J(e/n,-t/n).asin()},sinh:function(){let e=this.re,t=this.im;return new J(dr(e)*Math.cos(t),ur(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new J(ur(e)*Math.cos(t),dr(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,n=ur(e)+Math.cos(t);return new J(dr(e)/n,Math.sin(t)/n)},coth:function(){let e=2*this.re,t=2*this.im,n=ur(e)-Math.cos(t);return new J(dr(e)/n,-Math.sin(t)/n)},csch:function(){let e=this.re,t=this.im,n=Math.cos(2*t)-ur(2*e);return new J(-2*dr(e)*Math.cos(t)/n,2*ur(e)*Math.sin(t)/n)},sech:function(){let e=this.re,t=this.im,n=Math.cos(2*t)+ur(2*e);return new J(2*ur(e)*Math.cos(t)/n,-2*dr(e)*Math.sin(t)/n)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,n=e>1&&t===0,r=1-e,i=1+e,a=r*r+t*t,o=a===0?new J(e===-1?0:e/0,t===0?0:t/0):new J((i*r-t*t)/a,(t*r+i*t)/a),s=o.re;return o.re=hr(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,n&&(o.im=-o.im),o},acoth:function(){let e=this.re,t=this.im;if(e===0&&t===0)return new J(0,Math.PI/2);let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).atanh():new J(e/n,-t/n).atanh()},acsch:function(){let e=this.re,t=this.im;if(t===0)return new J(e===0?1/0:Math.log(e+Math.sqrt(e*e+1)),0);let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).asinh():new J(e/n,-t/n).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return J.INFINITY;let n=e*e+t*t;return n===0?new J(e===0?0:e/0,t===0?0:-t/0).acosh():new J(e/n,-t/n).acosh()},inverse:function(){if(this.isZero())return J.INFINITY;if(this.isInfinite())return J.ZERO;let e=this.re,t=this.im,n=e*e+t*t;return new J(e/n,-t/n)},conjugate:function(){return new J(this.re,-this.im)},neg:function(){return new J(-this.re,-this.im)},ceil:function(e){return e=10**(e||0),new J(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=10**(e||0),new J(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=10**(e||0),new J(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let n=_r(e,t);return Math.abs(n.re-this.re)<=J.EPSILON&&Math.abs(n.im-this.im)<=J.EPSILON},clone:function(){return new J(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n=``;return this.isNaN()?`NaN`:this.isInfinite()?`Infinity`:(Math.abs(e)<J.EPSILON&&(e=0),Math.abs(t)<J.EPSILON&&(t=0),t===0?n+e:(e===0?t<0&&(t=-t,n+=`-`):(n+=e,n+=` `,t<0?(t=-t,n+=`-`):n+=`+`,n+=` `),t!==1&&(n+=t),n+`i`))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}}
9,J.ZERO=new J(0,0),J.ONE=new J(1,0),J.I=new J(0,1),J.PI=new J(Math.PI,0),J.E=new J(Math.E,0),J.INFINITY=new J(1/0,1/0),J.NAN=new J(NaN,NaN),J.EPSILON=1e-15;var vr=W(`Complex`,[],()=>(Object.defineProperty(J,"name",{value:`Complex`}),J.prototype.constructor=J,J.prototype.type=`Complex`,J.prototype.isComplex=!0,J.prototype.toJSON=function(){return{mathjs:`Complex`,re:this.re,im:this.im}},J.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},J.prototype.format=function(e){var t=``,n=this.im,r=this.re,i=Xe(this.re,e),a=Xe(this.im,e),o=b(e)?e:e?e.precision:null;if(o!==null){var s=10**-o;Math.abs(r/n)<s&&(r=0),Math.abs(n/r)<s&&(n=0)}return t=n===0?i:r===0?n===1?`i`:n===-1?`-i`:a+`i`:n<0?n===-1?i+` - i`:i+` - `+a.substring(1)+`i`:n===1?i+` + i`:i+` + `+a+`i`,t},J.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if(typeof t==`object`)return J(t);throw TypeError(`Input has to be an object with r and phi keys.`);case 2:var n=arguments[0],r=arguments[1];if(b(n)){if(T(r)&&r.hasBase(`ANGLE`)&&(r=r.toNumber(`rad`)),b(r))return new J({r:n,phi:r});throw TypeError(`Phi is not a number nor an angle unit.`)}else throw TypeError(`Radius r is not a number.`);default:throw SyntaxError(`Wrong number of arguments in function fromPolar`)}},J.prototype.valueOf=J.prototype.toString,J.fromJSON=function(e){return new J(e)},J.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},J),{isClass:!0});typeof BigInt>`u`&&(BigInt=function(e){if(isNaN(e))throw Error(``);return e});var Y=BigInt(0),yr=BigInt(1),br=BigInt(2),xr=BigInt(5),Sr=BigInt(10),Cr=2e3,X={s:yr,n:Y,d:yr};function wr(e,t){try{e=BigInt(e)}catch{throw Fr()}return e*t}function Tr(e){return typeof e==`bigint`?e:Math.floor(e)}function Er(e,t){if(t===Y)throw Pr();let n=Object.create(Nr.prototype);n.s=e<Y?-yr:yr,e=e<Y?-e:e;let r=Mr(e,t);return n.n=e/r,n.d=t/r,n}function Dr(e){let t={},n=e,r=br,i=xr-yr;for(;i<=n;){for(;n%r===Y;)n/=r,t[r]=(t[r]||Y)+yr;i+=yr+br*r++}return n===e?t[e]=(t[e]||Y)+yr:n>1&&(t[n]=(t[n]||Y)+yr),t}var Or=function(e,t){let n=Y,r=yr,i=yr;if(e!=null)if(t!==void 0){if(typeof e==`bigint`)n=e;else if(isNaN(e))throw Fr();else if(e%1!=0)throw Ir();else n=BigInt(e);if(typeof t==`bigint`)r=t;else if(isNaN(t))throw Fr();else if(t%1!=0)throw Ir();else r=BigInt(t);i=n*r}else if(typeof e==`object`){if(`d`in e&&`n`in e)n=BigInt(e.n),r=BigInt(e.d),`s`in e&&(n*=BigInt(e.s));else if(0 in e)n=BigInt(e[0]),1 in e&&(r=BigInt(e[1]));else if(typeof e==`bigint`)n=e;else throw Fr();i=n*r}else if(typeof e==`number`){if(isNaN(e))throw Fr();if(e<0&&(i=-yr,e=-e),e%1==0)n=BigInt(e);else if(e>0){let t=1,i=0,a=1,o=1,s=1,c=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);a<=c&&s<=c;){let t=(i+o)/(a+s);if(e===t){a+s<=c?(n=i+o,r=a+s):s>a?(n=o,r=s):(n=i,r=a);break}else e>t?(i+=o,a+=s):(o+=i,s+=a),a>c?(n=o,r=s):(n=i,r=a)}n=BigInt(n)*BigInt(t),r=BigInt(r)}}else if(typeof e==`string`){let t=0,a=Y,o=Y,s=Y,c=yr,l=yr,u=e.replace(/_/g,``).match(/\d+|./g);if(u===null)throw Fr();if(u[t]===`-`?(i=-yr,t++):u[t]===`+`&&t++,u.length===t+1?o=wr(u[t++],i):u[t+1]===`.`||u[t]===`.`?(u[t]!==`.`&&(a=wr(u[t++],i)),t++,(t+1===u.length||u[t+1]===`(`&&u[t+3]===`)`||u[t+1]===`'`&&u[t+3]===`'`)&&(o=wr(u[t],i),c=Sr**BigInt(u[t].length),t++),(u[t]===`(`&&u[t+2]===`)`||u[t]===`'`&&u[t+2]===`'`)&&(s=wr(u[t+1],i),l=Sr**BigInt(u[t+1].length)-yr,t+=3)):u[t+1]===`/`||u[t+1]===`:`?(o=wr(u[t],i),c=wr(u[t+2],yr),t+=3):u[t+3]===`/`&&u[t+1]===` `&&(a=wr(u[t],i),o=wr(u[t+2],i),c=wr(u[t+4],yr),t+=5),u.length<=t)r=c*l,i=n=s+r*a+l*o;else throw Fr()}else if(typeof e==`bigint`)n=e,i=e,r=yr;else throw Fr();if(r===Y)throw Pr();X.s=i<Y?-yr:yr,X.n=n<Y?-n:n,X.d=r<Y?-r:r};function kr(e,t,n){let r=yr;for(;t>Y;e=e*e%n,t>>=yr)t&yr&&(r=r*e%n);return r}function Ar(e,t){for(;t%br===Y;t/=br);for(;t%xr===Y;t/=xr);if(t===yr)return Y;let n=Sr%t,r=1;for(;n!==yr;r++)if(n=n*Sr%t,r>Cr)return Y;return BigInt(r)}function jr(e,t,n){let r=yr,i=kr(Sr,n,t);for(let e=0;e<300;e++){if(r===i)return BigInt(e);r=r*Sr%t,i=i*Sr%t}return 0}function Mr(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function Nr(e,t){if(Or(e,t),this instanceof Nr)e=Mr(X.d,X.n),this.s=X.s,this.n=X.n/e,this.d=X.d/e;else return Er(X.s*X.n,X.d)}var Pr=function(){return Error(`Division by Zero`)},Fr=function(){return Error(`Invalid argument`)},Ir=function(){return Error(`Parameters must be integer`)};Nr.prototype={s:yr,n:Y,d:yr,abs:function(){return Er(this.n,this.d)},neg:function(){return Er(-this.s*this.n,this.d)},add:function(e,t){return Or(e,t),Er(this.s*this.n*X.d+X.s*this.d*X.n,this.d*X.d)},sub:function(e,t){return Or(e,t),Er(this.s*this.n*X.d-X.s*this.d*X.n,this.d*X.d)},mul:function(e,t){return Or(e,t),Er(this.s*X.s*this.n*X.n,this.d*X.d)},div:function(e,t){return Or(e,t),Er(this.s*X.s*this.n*X.d,this.d*X.n)},clone:function(){return Er(this.s*this.n,this.d)},mod:function(e,t){if(e===void 0)return Er(this.s*this.n%this.d,yr);if(Or(e,t),Y===X.n*this.d)throw Pr();return Er(this.s*(X.d*this.n)%(X.n*this.d),X.d*this.d)},gcd:function(e,t){return Or(e,t),Er(Mr(X.n,this.n)*Mr(X.d,this.d),X.d*this.d)},lcm:function(e,t){return Or(e,t),X.n===Y&&this.n===Y?Er(Y,yr):Er(X.n*this.n,Mr(X.n,this.n)*Mr(X.d,this.d))},inverse:function(){return Er(this.s*this.d,this.n)},pow:function(e,t){if(Or(e,t),X.d===yr)return X.s<Y?Er((this.s*this.d)**X.n,this.n**X.n):Er((this.s*this.n)**X.n,this.d**X.n);if(this.s<Y)return null;let n=Dr(this.n),r=Dr(this.d),i=yr,a=yr;for(let e in n)if(e!==`1`){if(e===`0`){i=Y;break}if(n[e]*=X.n,n[e]%X.d===Y)n[e]/=X.d;else return null;i*=BigInt(e)**n[e]}for(let e in r)if(e!==`1`){if(r[e]*=X.n,r[e]%X.d===Y)r[e]/=X.d;else return null;a*=BigInt(e)**r[e]}return X.s<Y?Er(a,i):Er(i,a)},log:function(e,t){if(Or(e,t),this.s<=Y||X.s<=Y)return null;let n={},r=Dr(X.n),i=Dr(X.d),a=Dr(this.n),o=Dr(this.d);for(let e in i)r[e]=(r[e]||Y)-i[e];for(let e in o)a[e]=(a[e]||Y)-o[e];for(let e in r)e!==`1`&&(n[e]=!0);for(let e in a)e!==`1`&&(n[e]=!0);let s=null,c=null;for(let e in n){let t=r[e]||Y,n=a[e]||Y;if(t===Y){if(n!==Y)return null;continue}let i=n,o=t,l=Mr(i,o);if(i/=l,o/=l,s===null&&c===null)s=i,c=o;else if(i*c!==s*o)return null}return s!==null&&c!==null?Er(s,c):null},equals:function(e,t){return Or(e,t),this.s*this.n*X.d===X.s*X.n*this.d},lt:function(e,t){return Or(e,t),this.s*this.n*X.d<X.s*X.n*this.d},lte:function(e,t){return Or(e,t),this.s*this.n*X.d<=X.s*X.n*this.d},gt:function(e,t){return Or(e,t),this.s*this.n*X.d>X.s*X.n*this.d},gte:function(e,t){return Or(e,t),this.s*this.n*X.d>=X.s*X.n*this.d},compare:function(e,t){Or(e,t);let n=this.s*this.n*X.d-X.s*X.n*this.d;return(Y<n)-(n<Y)},ceil:function(e){return e=Sr**BigInt(e||0),Er(Tr(this.s*e*this.n/this.d)+(e*this.n%this.d>Y&&this.s>=Y?yr:Y),e)},floor:function(e){return e=Sr**BigInt(e||0),Er(Tr(this.s*e*this.n/this.d)-(e*this.n%this.d>Y&&this.s<Y?yr:Y),e)},round:function(e){return e=Sr**BigInt(e||0),Er(Tr(this.s*e*this.n/this.d)+this.s*((this.s>=Y?yr:Y)+br*(e*this.n%this.d)>this.d?yr:Y),e)},roundTo:function(e,t){Or(e,t);
9let n=this.n*X.d,r=this.d*X.n,i=n%r,a=Tr(n/r);return i+i>=r&&a++,Er(this.s*a*X.n,X.d)},divisible:function(e,t){return Or(e,t),!(!(X.n*this.d)||this.n*X.d%(X.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let t=this.n,n=this.d;e||=15;let r=Ar(t,n),i=jr(t,n,r),a=this.s<Y?`-`:``;if(a+=Tr(t/n),t%=n,t*=Sr,t&&(a+=`.`),r){for(let e=i;e--;)a+=Tr(t/n),t%=n,t*=Sr;a+=`(`;for(let e=r;e--;)a+=Tr(t/n),t%=n,t*=Sr;a+=`)`}else for(let r=e;t&&r--;)a+=Tr(t/n),t%=n,t*=Sr;return a},toFraction:function(e){let t=this.n,n=this.d,r=this.s<Y?`-`:``;if(n===yr)r+=t;else{let i=Tr(t/n);e&&i>Y&&(r+=i,r+=` `,t%=n),r+=t,r+=`/`,r+=n}return r},toLatex:function(e){let t=this.n,n=this.d,r=this.s<Y?`-`:``;if(n===yr)r+=t;else{let i=Tr(t/n);e&&i>Y&&(r+=i,t%=n),r+=`\\frac{`,r+=t,r+=`}{`,r+=n,r+=`}`}return r},toContinued:function(){let e=this.n,t=this.d,n=[];do{n.push(Tr(e/t));let r=e%t;e=t,t=r}while(e!==yr);return n},simplify:function(e){let t=BigInt(1/(e||.001)|0),n=this.abs(),r=n.toContinued();for(let e=1;e<r.length;e++){let i=Er(r[e-1],yr);for(let t=e-2;t>=0;t--)i=i.inverse().add(r[t]);let a=i.sub(n);if(a.n*t<a.d)return i.mul(this.s)}return this}};var Lr=W(`Fraction`,[],()=>(Object.defineProperty(Nr,"name",{value:`Fraction`}),Nr.prototype.constructor=Nr,Nr.prototype.type=`Fraction`,Nr.prototype.isFraction=!0,Nr.prototype.toJSON=function(){return{mathjs:`Fraction`,n:String(this.s*this.n),d:String(this.d)}},Nr.fromJSON=function(e){return new Nr(e)},Nr),{isClass:!0}),Rr=W(`Range`,[],()=>{function e(t,n,r){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`);var i=t!=null,a=n!=null,o=r!=null;if(i){if(x(t))t=t.toNumber();else if(typeof t!=`number`&&!S(t))throw TypeError(`Parameter start must be a number or bigint`)}if(a){if(x(n))n=n.toNumber();else if(typeof n!=`number`&&!S(n))throw TypeError(`Parameter end must be a number or bigint`)}if(o){if(x(r))r=r.toNumber();else if(typeof r!=`number`&&!S(r))throw TypeError(`Parameter step must be a number or bigint`)}if(this.start=i?parseFloat(t):0,this.end=a?parseFloat(n):0,this.step=o?parseFloat(r):1,o&&ot(this.step,0))throw Error(`Step must not be zero`)}return e.prototype.type=`Range`,e.prototype.isRange=!0,e.parse=function(t){if(typeof t!=`string`)return null;var n=t.split(`:`).map(function(e){return parseFloat(e)});if(n.some(function(e){return isNaN(e)}))return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,t=this.start,n=this.step,r=this.end-t;return Ue(n)===Ue(r)?e=Math.ceil(r/n):r===0&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},e.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},e.prototype.forEach=function(e){var t=this.start,n=this.step,r=this.end,i=0;if(n>0)for(;t<r;)e(t,[i],this),t+=n,i++;else if(n<0)for(;t>r;)e(t,[i],this),t+=n,i++},e.prototype.map=function(e){var t=[];return this.forEach(function(n,r,i){t[r[0]]=e(n,r,i)}),t},e.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n[0]]=t}),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=Xe(this.start,e);return this.step!==1&&(t+=`:`+Xe(this.step,e)),t+=`:`+Xe(this.end,e),t},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(t){return new e(t.start,t.end,t.step)},e},{isClass:!0}),zr=W(`Matrix`,[],()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function Br(e,t,n){var r=e.constructor,i=new r(2),a=``;if(n){if(n<1)throw Error(`size must be in greater than 0`);if(!G(n))throw Error(`size must be an integer`);if(e.greaterThan(i.pow(n-1).sub(1))||e.lessThan(i.pow(n-1).mul(-1)))throw Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);
9if(!e.isInteger())throw Error(`Value must be an integer`);e.lessThan(0)&&(e=e.add(i.pow(n))),a=`i${n}`}switch(t){case 2:return`${e.toBinary()}${a}`;case 8:return`${e.toOctal()}${a}`;case 16:return`${e.toHexadecimal()}${a}`;default:throw Error(`Base ${t} not supported `)}}function Vr(e,t){if(typeof t==`function`)return t(e);if(!e.isFinite())return e.isNaN()?`NaN`:e.gt(0)?`Infinity`:`-Infinity`;var{notation:n,precision:r,wordSize:i}=Ze(t);switch(n){case`fixed`:return Wr(e,r);case`exponential`:return Ur(e,r);case`engineering`:return Hr(e,r);case`bin`:return Br(e,2,i);case`oct`:return Br(e,8,i);case`hex`:return Br(e,16,i);case`auto`:var a=Gr(t?.lowerExp,-3),o=Gr(t?.upperExp,5);if(e.isZero())return`0`;var s,c=e.toSignificantDigits(r),l=c.e;return s=l>=a&&l<o?c.toFixed():Ur(e,r),s.replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return e===`.`?t:e+t});default:throw Error(`Unknown notation "`+n+`". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.`)}}function Hr(e,t){var n=e.e,r=n%3==0?n:n<0?n-3-n%3:n-n%3,i=e.mul(10**-r).toPrecision(t);if(i.includes(`e`)){var a=e.constructor;i=new a(i).toFixed()}return i+`e`+(n>=0?`+`:``)+r.toString()}function Ur(e,t){return t===void 0?e.toExponential():e.toExponential(t-1)}function Wr(e,t){return e.toFixed(t)}function Gr(e,t){return b(e)?e:x(e)?e.toNumber():t}function Kr(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t}function qr(e,t){var n=Jr(e,t);return t&&typeof t==`object`&&`truncate`in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+`...`:n}function Jr(e,t){return typeof e==`number`?Xe(e,t):x(e)?Vr(e,t):$r(e)?!t||t.fraction!==`decimal`?`${e.s*e.n}/${e.d}`:e.toString():Array.isArray(e)?Qr(e,t):E(e)?Yr(e):typeof e==`function`?e.syntax?String(e.syntax):`function`:e&&typeof e==`object`?typeof e.format==`function`?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):`{`+Object.keys(e).map(n=>Yr(n)+`: `+qr(e[n],t)).join(`, `)+`}`:String(e)}function Yr(e){for(var t=String(e),n=``,r=0;r<t.length;){var i=t.charAt(r);n+=i in Xr?Xr[i]:i,r++}return`"`+n+`"`}var Xr={'"':`\\"`,"\\":`\\\\`,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`,"	":`\\t`};function Zr(e){var t=String(e);return t=t.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),t}function Qr(e,t){if(Array.isArray(e)){for(var n=`[`,r=e.length,i=0;i<r;i++)i!==0&&(n+=`, `),n+=Qr(e[i],t);return n+=`]`,n}else return qr(e,t)}function $r(e){return e&&typeof e==`object`&&typeof e.s==`bigint`&&typeof e.n==`bigint`&&typeof e.d==`bigint`||!1}function ei(e,t){if(!E(e))throw TypeError(`Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: `+Ce(e)+`, index: 0)`);if(!E(t))throw TypeError(`Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: `+Ce(t)+`, index: 1)`);return e===t?0:e>t?1:-1}function ti(e,t,n){if(!(this instanceof ti))throw SyntaxError(`Constructor must be called with the new operator`);this.actual=e,this.expected=t,this.relation=n,this.message=`Dimension mismatch (`+(Array.isArray(e)?`[`+e.join(`, `)+`]`:e)+` `+(this.relation||`!=`)+` `+(Array.isArray(t)?`[`+t.join(`, `)+`]`:t)+`)`,this.stack=Error().stack}ti.prototype=RangeError(),ti.prototype.constructor=RangeError,ti.prototype.name=`DimensionError`,ti.prototype.isDimensionError=!0;function ni(e,t,n){if(!(this instanceof ni))throw SyntaxError(`Constructor must be called with the new operator`);this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),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=Error().stack}ni.prototype=RangeError(),ni.prototype.constructor=RangeError,ni.prototype.name=`IndexError`,ni.prototype.isIndexError=!0;function ri(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function ii(e,t,n){var r,i=e.length;if(i!==t[n])throw new ti(i,t[n]);if(n<t.length-1){var a=n+1;for(r=0;r<i;r++){var o=e[r];if(!Array.isArray(o))throw new ti(t.length-1,t.length,`<`);ii(e[r],t,a)}}else for(r=0;r<i;r++)if(Array.isArray(e[r]))throw new ti(t.length+1,t.length,`>`)}function ai(e,t){if(t.length===0){if(Array.isArray(e))throw new ti(e.length,0)}else ii(e,t,0)}function oi(e,t){var n=e.isMatrix?e._size:ri(e);t._sourceSize.forEach((e,t)=>{if(e!==null&&e!==n[t])throw new ti(e,n[t])})}function si(e,t){if(e!==void 0){if(!b(e)||!G(e))throw TypeError(`Index must be an integer (value: `+e+`)`);if(e<0||typeof t==`number`&&e>=t)throw new ni(e,t)}}function ci(e){for(var t=0;t<e._dimensions.length;++t){var n=e._dimensions[t];
9if(n._data&&D(n._data)){if(n._size[0]===0)return!0}else if(n.isRange){if(n.start===n.end)return!0}else if(E(n)&&n.length===0)return!0}return!1}function li(e,t,n){if(!Array.isArray(t))throw TypeError(`Array expected`);if(t.length===0)throw Error(`Resizing to scalar is not supported`);return t.forEach(function(e){if(!b(e)||!G(e)||e<0)throw TypeError(`Invalid size, must contain positive integers (size: `+qr(t)+`)`)}),(b(e)||x(e))&&(e=[e]),ui(e,t,0,n===void 0?0:n),e}function ui(e,t,n,r){var i,a,o=e.length,s=t[n],c=Math.min(o,s);if(e.length=s,n<t.length-1){var l=n+1;for(i=0;i<c;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),ui(a,t,l,r);for(i=c;i<s;i++)a=[],e[i]=a,ui(a,t,l,r)}else{for(i=0;i<c;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=c;i<s;i++)e[i]=r}}function di(e,t){var n=yi(e,!0),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError(`Array expected`);if(t.length===0)throw new ti(0,r,`!=`);t=fi(t,r);var i=pi(t);if(r!==i)throw new ti(i,r,`!=`);try{return mi(n,t)}catch(e){throw e instanceof ti?new ti(i,r,`!=`):e}}function fi(e,t){var n=pi(e),r=e.slice(),i=-1,a=e.indexOf(i);if(e.indexOf(i,a+1)>=0)throw Error(`More than one wildcard in sizes`);var o=a>=0,s=t%n===0;if(o)if(s)r[a]=-t/n;else throw Error(`Could not replace wildcard, since `+t+` is no multiple of `+-n);return r}function pi(e){return e.reduce((e,t)=>e*t,1)}function mi(e,t){for(var n=e,r,i=t.length-1;i>0;i--){var a=t[i];r=[];for(var o=n.length/a,s=0;s<o;s++)r.push(n.slice(s*a,(s+1)*a));n=r}return n}function hi(e,t){for(var n=t||ri(e);Array.isArray(e)&&e.length===1;)e=e[0],n.shift();for(var r=n.length;n[r-1]===1;)r--;return r<n.length&&(e=gi(e,r,0),n.length=r),e}function gi(e,t,n){var r,i;if(n<t){var a=n+1;for(r=0,i=e.length;r<i;r++)e[r]=gi(e[r],t,a)}else for(;Array.isArray(e);)e=e[0];return e}function _i(e,t,n,r){var i=r||ri(e);if(n)for(var a=0;a<n;a++)e=[e],i.unshift(1);for(e=vi(e,t,0);i.length<t;)i.push(1);return e}function vi(e,t,n){var r,i;if(Array.isArray(e)){var a=n+1;for(r=0,i=e.length;r<i;r++)e[r]=vi(e[r],t,a)}else for(var o=n;o<t;o++)e=[e];return e}function yi(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!Array.isArray(e))return e;if(typeof t!=`boolean`)throw TypeError(`Boolean expected for second argument of flatten`);var n=[];return t?i(e):r(e),n;function r(e){for(var t=0;t<e.length;t++){var i=e[t];Array.isArray(i)?r(i):n.push(i)}}function i(e){if(Array.isArray(e[0]))for(var t=0;t<e.length;t++)i(e[t]);else for(var r=0;r<e.length;r++)n.push(e[r])}}function bi(e,t){return Array.prototype.map.call(e,t)}function xi(e,t){Array.prototype.forEach.call(e,t)}function Si(e,t){if(ri(e).length!==1)throw Error(`Only one dimensional matrices supported`);return Array.prototype.filter.call(e,t)}function Ci(e,t){if(ri(e).length!==1)throw Error(`Only one dimensional matrices supported`);return Array.prototype.filter.call(e,e=>t.test(e))}function wi(e,t){return Array.prototype.join.call(e,t)}function Ti(e){if(!Array.isArray(e))throw TypeError(`Array input expected`);if(e.length===0)return e;var t=[],n=0;t[0]={value:e[0],identifier:0};for(var r=1;r<e.length;r++)e[r]===e[r-1]?n++:n=0,t.push({value:e[r],identifier:n});return t}function Ei(e){if(!Array.isArray(e))throw TypeError(`Array input expected`);if(e.length===0)return e;for(var t=[],n=0;n<e.length;n++)t.push(e[n].value);return t}function Di(e,t){for(var n,r=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(i===0&&o&&(r=a.length),o&&a.length!==r)return;var s=o?Di(a,t):t(a);if(n===void 0)n=s;else if(n!==s)return`mixed`}return n}function Oi(e,t,n,r){if(r<n){if(e.length!==t.length)throw new ti(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=Oi(e[a],t[a],n,r+1);return i}else return e.concat(t)}function ki(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(e.length===1)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,n){return Oi(e,n,t,0)},e[0]);throw Error(`Wrong number of arguments in function concat`)}function Ai(){for(var e=[...arguments],t=e.map(e=>e.length),n=Math.max(...t),r=Array(n).fill(null),i=0;i<e.length;i++)for(var a=e[i],o=t[i],s=0;s<o;s++){var c=n-o+s;a[s]>r[c]&&(r[c]=a[s])}for(var l=0;l<e.length;l++)ji(e[l],r);return r}function ji(e,t){for(var n=t.length,r=e.length,i=0;i<r;i++){var a=n-r+i;if(e[i]<t[a]&&e[i]>1||e[i]>t[a])throw Error(`shape mismatch: mismatch is found in arg with shape (${e}) not possible to broadcast dimension ${r} with size ${e[i]} to size ${t[a]}`)}}function Mi(e,t){var n=ri(e);if(De(n,t))return e;ji(n,t);var r=Ai(n,t),i=r.length,a=[...Array(i-n.length).fill(1),...n],o=Li(e);n.length<i&&(o=di(o,a),n=ri(o));for(var s=0;s<i;s++)n[s]<r[s]&&(o=Ni(o,r[s],s),n=ri(o));return o}function Ni(e,t,n){return ki(...Array(t).fill(e),n)}function Pi(e,t){if(!Array.isArray(e))throw Error(`Array expected`);if(!Array.isArray(t))throw Error(`Array expected for index`);var n=ri(e);if(t.length!==n.length)throw new ti(t.length,n.length);for(var r=0;r<t.length;r++)si(t[r],n[r]);return t.reduce((e,t)=>
9e[t],e)}function Fi(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e.length===0)return[];if(n)return a(e);var r=[];return i(e,0);function i(n,a){if(Array.isArray(n)){for(var o=n.length,s=Array(o),c=0;c<o;c++)r[a]=c,s[c]=i(n[c],a+1);return s}else return t(n,r.slice(0,a),e)}function a(e){if(Array.isArray(e)){for(var n=e.length,r=Array(n),i=0;i<n;i++)r[i]=a(e[i]);return r}else return t(e)}}function Ii(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e.length===0)return;if(n){a(e);return}var r=[];i(e,0);function i(n,a){if(Array.isArray(n))for(var o=n.length,s=0;s<o;s++)r[a]=s,i(n[s],a+1);else t(n,r.slice(0,a),e)}function a(e){if(Array.isArray(e))for(var n=e.length,r=0;r<n;r++)a(e[r]);else t(e)}}function Li(e){return r([],e)}function Ri(e,t,n,r){if(Le.default.isTypedFunction(e)){var i;if(r)i=1;else{var a=t.isMatrix?t.size():ri(t);if(!a.length||a[a.length-1]===0)return{isUnary:r,fn:e};var o=a.map(()=>0);i=Vi(e,t.isMatrix?t.get(o):Pi(t,o),o,t)}var s;if(t.isMatrix&&t.dataType!==`mixed`&&t.dataType!==void 0){var c=zi(e,i);s=c===void 0?e:c}else s=e;return i>=1&&i<=3?{isUnary:i===1,fn:function(){return Hi(s,[...arguments].slice(0,i),n,e.name)}}:{isUnary:!1,fn:function(){return Hi(s,[...arguments],n,e.name)}}}return r===void 0?{isUnary:Bi(e),fn:e}:{isUnary:r,fn:e}}function zi(e,t){var n=[];if(Object.entries(e.signatures).forEach(e=>{var[r,i]=e;r.split(`,`).length===t&&n.push(i)}),n.length===1)return n[0]}function Bi(e){if(e.length!==1)return!1;var t=e.toString();if(/arguments/.test(t))return!1;var n=t.match(/\(.*?\)/);return!/\.\.\./.test(n)}function Vi(e,t,n,r){for(var i=[t,n,r],a=3;a>0;a--){var o=i.slice(0,a);if(Le.default.resolve(e,o)!==null)return a}}function Hi(e,t,n,r){try{return e(...t)}catch(e){Ui(e,t,n,r)}}function Ui(e,t,n,r){if(e instanceof TypeError&&e.data?.category===`wrongType`){var i=[];throw i.push(`value: ${Ce(t[0])}`),t.length>=2&&i.push(`index: ${Ce(t[1])}`),t.length>=3&&i.push(`array: ${Ce(t[2])}`),TypeError(`Function ${n} cannot apply callback arguments ${r}(${i.join(`, `)}) at index ${JSON.stringify(t[1])}`)}else throw TypeError(`Function ${n} cannot apply callback arguments to function ${r}: ${e.message}`)}var Wi=W(`DenseMatrix`,[`Matrix`,`config`],e=>{var{Matrix:t,config:n}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!E(t))throw Error(`Invalid datatype: `+t);if(O(e))e.type===`DenseMatrix`?(this._data=V(e._data),this._size=V(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&D(e.data)&&D(e.size))this._data=e.data,this._size=e.size,ai(this._data,this._size),this._datatype=t||e.datatype;else if(D(e))this._data=u(e),this._size=ri(this._data),ai(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+Ce(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:`DenseMatrix`}),r.prototype.constructor=r,r.prototype.type=`DenseMatrix`,r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Di(this._data,Ce)},r.prototype.storage=function(){return`dense`},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return i(this,e);case 2:case 3:return o(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},r.prototype.get=function(e){return Pi(this._data,e)},r.prototype.set=function(e,t,n){if(!D(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new ti(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});l(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],si(a,s.length),s=s[a];return a=e[e.length-1],si(a,s.length),s[a]=t,this};function i(e,t){if(!N(t))throw TypeError(`Invalid index`);if(n.legacySubset?t.size().every(e=>e===1):t.isScalar())return e.get(t.min());var i=t.size();if(i.length!==e._size.length)throw new ti(i.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)si(o[c],e._size[c]),si(s[c],e._size[c]);var u=new r,d=a(e._data,t);return u._size=d.size,u._datatype=e._datatype,u._data=d.data,n.legacySubset?u.reshape(t.
9size()):u}function a(e,t){var n=t.size().length-1,r=Array(n);return{data:i(e),size:r.filter(e=>e!==null)};function i(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=t.dimension(a);function s(e,t){return b(e)?t(e):e.map(t).valueOf()}return b(o)?r[a]=null:r[a]=o.size()[0],a<n?s(o,t=>(si(t,e.length),i(e[t],a+1))):s(o,t=>(si(t,e.length),e[t]))}}function o(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),o;if(O(n)?(o=n.size(),n=n.valueOf()):o=ri(n),a){if(o.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!De(o,i)){if(o.length===0)n=Mi([n],i);else try{n=Mi(n,i)}catch{}o=ri(n)}if(i.length<e._size.length)throw new ti(i.length,e._size.length,`<`);if(o.length<i.length){for(var c=0,u=0;i[c]===1&&o[c]===1;)c++;for(;i[c]===1;)u++,c++;n=_i(n,i.length,u,o)}if(!De(i,o))throw new ti(i,o,`>`);l(e,t.max().map(function(e){return e+1}),r),s(e._data,t,n)}return e}function s(e,t,n){var r=t.size().length-1;i(e,n);function i(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=t.dimension(a),s=(t,r)=>{si(t,e.length),i(e[t],n[r[0]],a+1)},c=(t,r)=>{si(t,e.length),e[t]=n[r[0]]};a<r?b(o)?s(o,[0]):o.forEach(s):b(o)?c(o,[0]):o.forEach(c)}}r.prototype.resize=function(e,t,n){if(!k(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e);return c(n?this.clone():this,r,t)};function c(e,t,n){if(t.length===0){for(var r=e._data;D(r);)r=r[0];return r}return e._size=t.slice(0),e._data=li(e._data,e._size,n),e}r.prototype.reshape=function(e,t){var n=t?this.clone():this;return n._data=di(n._data,e),n._size=fi(e,n._size.reduce((e,t)=>e*t)),n};function l(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&c(e,r,n)}r.prototype.clone=function(){return new r({data:V(this._data),size:V(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){arguments.length>1&&arguments[1]!==void 0&&arguments[1];var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=this,r=n._size.length-1;if(r<0)return n.clone();var i=Ri(e,n,`map`,t),a=i.fn,o=n.create(void 0,n._datatype);if(o._size=n._size,t||i.isUnary)return o._data=f(n._data),o;
9if(r===0){for(var s=n.valueOf(),c=Array(s.length),l=0;l<s.length;l++)c[l]=a(s[l],[l],n);return o._data=c,o}var u=[];return o._data=d(n._data),o;function d(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Array(e.length);if(t<r)for(var o=0;o<e.length;o++)u[t]=o,i[o]=d(e[o],t+1);else for(var s=0;s<e.length;s++)u[t]=s,i[s]=a(e[s],u.slice(),n);return i}function f(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Array(e.length);if(t<r)for(var i=0;i<e.length;i++)n[i]=f(e[i],t+1);else for(var o=0;o<e.length;o++)n[o]=a(e[o]);return n}},r.prototype.forEach=function(e){arguments.length>1&&arguments[1]!==void 0&&arguments[1];var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=this,r=n._size.length-1;if(r<0)return;var i=Ri(e,n,`map`,t),a=i.fn;if(t||i.isUnary){l(n._data);return}if(r===0){for(var o=0;o<n._data.length;o++)a(n._data[o],[o],n);return}var s=[];c(n._data);function c(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t<r)for(var i=0;i<e.length;i++)s[t]=i,c(e[i],t+1);else for(var o=0;o<e.length;o++)s[t]=o,a(e[o],s.slice(),n)}function l(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t<r)for(var n=0;n<e.length;n++)l(e[n],t+1);else for(var i=0;i<e.length;i++)a(e[i])}},r.prototype[Symbol.iterator]=function*(){var e=this._size.length-1;if(!(e<0)){if(e===0){for(var t=0;t<this._data.length;t++)yield{value:this._data[t],index:[t]};return}for(var n=Array(e+1).fill(0),r=this._size.reduce((e,t)=>e*t,1),i=0;i<r;i++){for(var a=this._data,o=0;o<e;o++)a=a[n[o]];yield{value:a[n[e]],index:n.slice()};for(var s=e;s>=0&&(n[s]++,!(n[s]<this._size[s]));s--)n[s]=0}}},r.prototype.rows=function(){var e=[];if(this.size().length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(n.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(n){var a=i.map(e=>[e[n]]);t.push(new r(a,e._datatype))},o=0;o<n[1];o++)a(o);return t},r.prototype.toArray=function(){return V(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return qr(this._data,e)},r.prototype.toString=function(){return qr(this._data)},r.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(x(e)&&(e=e.toNumber()),!b(e)||!G(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-n,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+n][c+t];return new r({data:s,size:[o],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!D(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(x(e)&&(e=e.toNumber()),!b(e)||!G(e)||e<1)throw Error(`Size values must be positive integers`);return e}),n){if(x(n)&&(n=n.toNumber()),!b(n)||!G(n))throw TypeError(`The parameter k must be an integer number`)}else n=0;var a=n>0?n:0,o=n<0?-n:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(D(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(O(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=x(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=li(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new r({data:f,size:[s,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!b(e)||!G(e)||!b(t)||!G(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return si(e,this._size[0]),si(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function u(e){return O(e)?u(e.valueOf()):D(e)?e.map(u):e}return r},{isClass:!0}),Gi=`clone`,Ki=W(Gi,[`typed`],e=>{var{typed:t}=e;return t(Gi,{any:V})});function qi(e){var t=e.length,n=e[0].length,r,i,a=[];for(i=0;i<n;i++){var o=[];for(r=0;r<t;r++)o.push(e[r][i]);a.push(o)}return a}function Ji(e){for(var t=0;t<e.length;t++)if(k(e[t]))return!0;return!1}
9function Yi(e,t){O(e)?e.forEach(e=>t(e),!1,!0):Ii(e,t,!0)}function Xi(e,t,n){if(!n)return O(e)?e.map(e=>t(e),!1,!0):Fi(e,t,!0);var r=e=>e===0?e:t(e);return O(e)?e.map(e=>r(e),!1,!0):Fi(e,r,!0)}function Zi(e,t,n){var r=Array.isArray(e)?ri(e):e.size();if(t<0||t>=r.length)throw new ni(t,r.length);return O(e)?e.create(Qi(e.valueOf(),t,n),e.datatype()):Qi(e,t,n)}function Qi(e,t,n){var r,i,a,o;if(t<=0)if(Array.isArray(e[0])){for(o=qi(e),i=[],r=0;r<o.length;r++)i[r]=Qi(o[r],t-1,n);return i}else{for(a=e[0],r=1;r<e.length;r++)a=n(a,e[r]);return a}else{for(i=[],r=0;r<e.length;r++)i[r]=Qi(e[r],t-1,n);return i}}function $i(e,t,n,r,i,a,o,s,c,l,u){var d=e._values,f=e._index,p=e._ptr,m,h,g,_;if(r)for(h=p[t],g=p[t+1],m=h;m<g;m++)_=f[m],n[_]===a?(r[_]=c?s(d[m],r[_]):s(r[_],d[m]),i[_]=a):(n[_]=a,o.push(_),l?(r[_]=c?s(d[m],u):s(u,d[m]),i[_]=a):r[_]=d[m]);else for(h=p[t],g=p[t+1],m=h;m<g;m++)_=f[m],n[_]===a?i[_]=a:(n[_]=a,o.push(_))}var ea=`isInteger`,ta=W(ea,[`typed`,`equal`],e=>{var{typed:t,equal:n}=e;return t(ea,{number:e=>Number.isFinite(e)?n(e,Math.round(e)):!1,BigNumber:e=>e.isFinite()?n(e.round(),e):!1,bigint:e=>!0,Fraction:e=>e.d===1n,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),na=`number`,ra=`number, number`;function ia(e){return Math.abs(e)}ia.signature=na;function aa(e,t){return e+t}aa.signature=ra;function oa(e,t){return e-t}oa.signature=ra;function sa(e,t){return e*t}sa.signature=ra;function ca(e,t){return e/t}ca.signature=ra;function la(e){return-e}la.signature=na;function ua(e){return e}ua.signature=na;function da(e){return qe(e)}da.signature=na;function fa(e){return e*e*e}fa.signature=na;function pa(e){return Math.exp(e)}pa.signature=na;function ma(e){return Je(e)}ma.signature=na;function ha(e,t){if(!G(e)||!G(t))throw Error(`Parameters in function gcd must be integer numbers`);for(var n;t!==0;)n=e%t,e=t,t=n;return e<0?-e:e}ha.signature=ra;function ga(e,t){if(!G(e)||!G(t))throw Error(`Parameters in function lcm must be integer numbers`);if(e===0||t===0)return 0;for(var n,r=e*t;t!==0;)n=t,t=e%n,e=n;return Math.abs(r/e)}ga.signature=ra;function _a(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function va(e){return Ge(e)}va.signature=na;function ya(e){return We(e)}ya.signature=na;function ba(e){return Ke(e)}ba.signature=na;function xa(e,t){return t===0?e:e-t*Math.floor(e/t)}xa.signature=ra;function Sa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,n=t<0;if(n&&(t=-t),t===0)throw Error(`Root must be non-zero`);if(e<0&&Math.abs(t)%2!=1)throw Error(`Root must be odd when a is negative.`);if(e===0)return n?1/0:0;if(!isFinite(e))return n?0:e;var r=Math.abs(e)**(1/t);return r=e<0?-r:r,n?1/r:r}function Ca(e){return Ue(e)}Ca.signature=na;function wa(e){return Math.sqrt(e)}wa.signature=na;function Ta(e){return e*e}Ta.signature=na;function Ea(e,t){var n,r,i,a=0,o=1,s=1,c=0;if(!G(e)||!G(t))throw Error(`Parameters in function xgcd must be integer numbers`);for(;t;)r=Math.floor(e/t),i=e-r*t,n=a,a=o-r*a,o=n,n=s,s=c-r*s,c=n,e=t,t=i;return e<0?[-e,-o,-c]:[e,e?o:0,c]}Ea.signature=ra;function Da(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:e**+t}Da.signature=ra;function Oa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!G(t)||t<0||t>15)throw Error(`Number of decimals in function round must be an integer from 0 to 15 inclusive`);return parseFloat(et(e,t))}function ka(e){return Math.abs(e)}ka.signature=na;var Aa=`number`,ja=`number, number`;function Ma(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function bitAnd`);return e&t}Ma.signature=ja;function Na(e){if(!G(e))throw Error(`Integer expected in function bitNot`);return~e}Na.signature=Aa;function Pa(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function bitOr`);return e|t}Pa.signature=ja;function Fa(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function bitXor`);return e^t}Fa.signature=ja;function Ia(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function leftShift`);return e<<t}Ia.signature=ja;function La(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function rightArithShift`);return e>>t}La.signature=ja;function Ra(e,t){if(!G(e)||!G(t))throw Error(`Integers expected in function rightLogShift`);return e>>>t}Ra.signature=ja;function za(e,t){if(t<e)return 1;if(t===e)return t;var n=t+e>>1;return za(e,n)*za(n+1,t)}function Ba(e,t){if(!G(e)||e<0||!G(t)||t<0)throw TypeError(`Positive integer value expected in function combinations`);if(t>e)throw TypeError(`k must be less than or equal to n`);for(var n=e-t,r=1,i=t<n?n+1:t+1,a=2,o=t<n?t:n,s=i;s<=e;++s)for(r*=s;a<=o&&r%a===0;)r/=a,++a;return a<=o&&(r/=za(a,o)),r}Ba.signature=`number, number`;var Va=Math.PI,Ha=2*Math.PI,Ua=Math.E,Wa=1.618033988749895,Ga=`number`,Ka=`number, number`;function qa(e){return!e}qa.signature=Ga;function Ja(e,t){return!!(e||t)}Ja.signature=Ka;function Ya(e,t){return!!e!=!!t}Ya.signature=Ka;function Xa(e,t){return!!(e&&t)}Xa.signature=Ka;function Za(e){var t;if(G(e))return e<=0?Number.isFinite(e)?1/0:NaN:e>171?1/0:za(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Za(1-e));if(e>=171.35)return 1/0;if(e>85){var n=e*e,r=n*e,i=r*e,a=i*e;return Math.sqrt(2*Math.PI/e)*(e/Math.E)**+e*(1+1/(12*e)+1/(288*n)-139/(51840*r)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=$a[0];for(var o=1;o<$a.length;++o)t+=$a[o]/(e+o);var s=e+Qa+.5;return Math.sqrt(2*Math.PI)*s**+(e+.5)*Math.exp(-s)*t}Za.signature=`number`;var Qa=4.7421875,$a=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,339946499848
91189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],eo=.9189385332046728,to=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function no(e){if(e<0)return NaN;if(e===0)return 1/0;if(!Number.isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-no(1-e);--e;for(var t=e+5+.5,n=to[0],r=6;r>=1;r--)n+=to[r]/(e+r);return eo+(e+.5)*Math.log(t)-t+Math.log(n)}no.signature=`number`;var ro=`number`,io=`number, number`;function ao(e){return Math.acos(e)}ao.signature=ro;function oo(e){return st(e)}oo.signature=ro;function so(e){return Math.atan(1/e)}so.signature=ro;function co(e){return Number.isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}co.signature=ro;function lo(e){return Math.asin(1/e)}lo.signature=ro;function uo(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}uo.signature=ro;function fo(e){return Math.acos(1/e)}fo.signature=ro;function po(e){var t=1/e,n=Math.sqrt(t*t-1);return Math.log(n+t)}po.signature=ro;function mo(e){return Math.asin(e)}mo.signature=ro;function ho(e){return ct(e)}ho.signature=ro;function go(e){return Math.atan(e)}go.signature=ro;function _o(e,t){return Math.atan2(e,t)}_o.signature=io;function vo(e){return lt(e)}vo.signature=ro;function yo(e){return Math.cos(e)}yo.signature=ro;function bo(e){return ut(e)}bo.signature=ro;function xo(e){return 1/Math.tan(e)}xo.signature=ro;function So(e){var t=Math.exp(2*e);return(t+1)/(t-1)}So.signature=ro;function Co(e){return 1/Math.sin(e)}Co.signature=ro;function wo(e){return e===0?1/0:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Ue(e)}wo.signature=ro;function To(e){return 1/Math.cos(e)}To.signature=ro;function Eo(e){return 2/(Math.exp(e)+Math.exp(-e))}Eo.signature=ro;function Do(e){return Math.sin(e)}Do.signature=ro;function Oo(e){return dt(e)}Oo.signature=ro;function ko(e){return Math.tan(e)}ko.signature=ro;function Ao(e){return ft(e)}Ao.signature=ro;var jo=`number`;function Mo(e){return G(e)}Mo.signature=jo;function No(e){return e<0}No.signature=jo;function Po(e){return e>0}Po.signature=jo;function Fo(e){return e===0}Fo.signature=jo;function Io(e){return Number.isNaN(e)}Io.signature=jo;function Lo(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;
9if(n<=0)throw Error(`Relative tolerance must be greater than 0`);if(r<0)throw Error(`Absolute tolerance must be at least 0`);return e.isNaN()||t.isNaN()?!1:!e.isFinite()||!t.isFinite()?e.eq(t):e.eq(t)?!0:e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(n),r))}var Ro=`isNegative`,zo=W(Ro,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Ro,{number:e=>ot(e,0,n.relTol,n.absTol)?!1:No(e),BigNumber:e=>Lo(e,new e.constructor(0),n.relTol,n.absTol)?!1:e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Bo=`isNumeric`,Vo=W(Bo,[`typed`],e=>{var{typed:t}=e;return t(Bo,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Ho=`hasNumericValue`,Uo=W(Ho,[`typed`,`isNumeric`],e=>{var{typed:t,isNumeric:n}=e;return t(Ho,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),Wo=`isPositive`,Go=W(Wo,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Wo,{number:e=>ot(e,0,n.relTol,n.absTol)?!1:Po(e),BigNumber:e=>Lo(e,new e.constructor(0),n.relTol,n.absTol)?!1:!e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Ko=`isZero`,qo=W(Ko,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(Ko,{"number | BigNumber | Complex | Fraction":e=>n(e,0),bigint:e=>e===0n,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Jo=`isNaN`,Yo=W(Jo,[`typed`],e=>{var{typed:t}=e;return t(Jo,{number:Io,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Xo=`isBounded`,Zo=W(Xo,[`typed`],e=>{var{typed:t}=e;return t(Xo,{number:e=>Number.isFinite(e),"BigNumber | Complex":e=>e.isFinite(),"bigint | Fraction":()=>!0,"null | undefined":()=>!1,Unit:t.referToSelf(e=>t=>e(t.value)),"Array | Matrix":t.referToSelf(e=>t=>(Array.isArray(t)||(t=t.valueOf()),t.every(t=>e(t))))})}),Qo=`isFinite`,$o=W(Qo,[`typed`,`isBounded`,`map`],e=>{var{typed:t,isBounded:n,map:r}=e;return t(Qo,{"Array | Matrix":e=>r(e,n),any:e=>n(e)})}),es=`typeOf`,ts=W(es,[`typed`],e=>{var{typed:t}=e;return t(es,{any:Ce})});function ns(e,t,n,r){return ot(e.re,t.re,n,r)&&ot(e.im,t.im,n,r)}var rs=W(`compareUnits`,[`typed`],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(!n.equalBase(r))throw Error(`Cannot compare units with different base`);return t.find(e,[n.valueType(),r.valueType()])(n.value,r.value)})}}),is=`equalScalar`,as=W(is,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(is,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return ot(e,t,n.relTol,n.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||Lo(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return ns(e,t,n.relTol,n.absTol)}},rs({typed:t}))});W(is,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(is,{"number, number":function(e,t){return ot(e,t,n.relTol,n.absTol)}})});var os=W(`SparseMatrix`,[`typed`,`equalScalar`,`Matrix`],e=>{var{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!E(t))throw Error(`Invalid datatype: `+t);if(O(e))a(this,e,t);else if(e&&D(e.index)&&D(e.ptr)&&D(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(D(e))o(this,e,t);else if(e)throw TypeError(`Unsupported type of data (`+Ce(e)+`)`);else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function a(e,t,n){t.type===`SparseMatrix`?(e._values=t._values?V(t._values):void 0,e._index=V(t._index),e._ptr=V(t._ptr),e._size=V(t._size),e._datatype=n||t._datatype):o(e,t.valueOf(),n||t._datatype)}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=r.length,o=0,s=n,c=0;if(E(i)&&(s=t.find(n,[i,i])||n,c=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var u=0;u<a;u++){var d=r[u];if(D(d)){if(l===0&&o<d.length&&(o=d.length),l<d.length){var f=d[l];s(f,c)||(e._values.push(f),e._index.push(u))}}else l===0&&o<1&&(o=1),s(d,c)||(e._values.push(d),e._index.push(u))}l++}while(l<o)}for(;e._ptr.length<=o;)e._ptr.push(e._index.length);e._size=[a,o]}i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:`SparseMatrix`}),i.prototype.constructor=i,i.prototype.type=`SparseMatrix`,i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Di(this._values,Ce)},i.prototype.storage=function(){return`sparse`},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return e!==0&&t!==0?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw Error(`Cannot invoke subset on a Pattern only matrix`);switch(arguments.length){case 1:return s(this,e);case 2:case 3:return c(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}};function s(e,t){if(!N(t))throw TypeError(`Invalid index`);if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new ti(n.length,e._size.length);var r,a,o,s,c=t.min(),l=t.max();for(r=0,a=e._size.length;r<a;r++)si(c[r],e._size[r]),si(l[r],e._size[r]);var u=e._values,d=e._index,f=e._ptr,p=t.dimension(0),m=t.dimension(1),h=[],g=[];function _(e,t){g[e]=t[0],h[e]=!0}
9Number.isInteger(p)?_(p,[0]):p.forEach(_);var v=u?[]:void 0,y=[],b=[];function x(e){for(b.push(y.length),o=f[e],s=f[e+1];o<s;o++)r=d[o],h[r]===!0&&(y.push(g[r]),v&&v.push(u[o]))}return Number.isInteger(m)?x(m):m.forEach(x),b.push(y.length),new i({values:v,index:y,ptr:b,size:n,datatype:e._datatype})}function c(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),o;if(O(n)?(o=n.size(),n=n.toArray()):o=ri(n),a){if(o.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(i.length!==1&&i.length!==2)throw new ti(i.length,e._size.length,`<`);if(o.length<i.length){for(var s=0,c=0;i[s]===1&&o[s]===1;)s++;for(;i[s]===1;)c++,s++;n=_i(n,i.length,c,o)}if(!De(i,o))throw new ti(i,o,`>`);if(i.length===1)d(t.dimension(0),(t,i)=>{si(t),e.set([t,0],n[i[0]],r)});else{var l=t.dimension(0),u=t.dimension(1);d(l,(t,i)=>{si(t),d(u,(a,o)=>{si(a),e.set([t,a],n[i[0]][o[0]],r)})})}}return e;function d(e,t){b(e)?t(e,[0]):e.forEach(t)}}i.prototype.get=function(e){if(!D(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new ti(e.length,this._size.length);if(!this._values)throw Error(`Cannot invoke get on a Pattern only matrix`);var t=e[0],n=e[1];si(t,this._size[0]),si(n,this._size[1]);var r=l(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!D(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new ti(e.length,this._size.length);if(!this._values)throw Error(`Cannot invoke set on a Pattern only matrix`);var a=e[0],o=e[1],s=this._size[0],c=this._size[1],p=n,m=0;E(this._datatype)&&(p=t.find(n,[this._datatype,this._datatype])||n,m=t.convert(0,this._datatype)),(a>s-1||o>c-1)&&(f(this,Math.max(a+1,s),Math.max(o+1,c),i),s=this._size[0],c=this._size[1]),si(a,s),si(o,c);var h=l(a,this._ptr[o],this._ptr[o+1],this._index);return h<this._ptr[o+1]&&this._index[h]===a?p(r,m)?u(h,o,this._values,this._index,this._ptr):this._values[h]=r:p(r,m)||d(h,a,o,r,this._values,this._index,this._ptr),this};function l(e,t,n,r){if(n-t===0)return n;for(var i=t;i<n;i++)if(r[i]===e)return i;return t}function u(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}function d(e,t,n,r,i,a,o){i.splice(e,0,r),a.splice(e,0,t);for(var s=n+1;s<o.length;s++)o[s]++}i.prototype.resize=function(e,t,n){if(!k(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e);if(r.length!==2)throw Error(`Only two dimensions matrix are supported`);return r.forEach(function(e){if(!b(e)||!G(e)||e<0)throw TypeError(`Invalid size, must contain positive integers (size: `+qr(r)+`)`)}),f(n?this.clone():this,r[0],r[1],t)};function f(e,r,i,a){var o=a||0,s=n,c=0;E(e._datatype)&&(s=t.find(n,[e._datatype,e._datatype])||n,c=t.convert(0,e._datatype),o=t.convert(o,e._datatype));var l=!s(o,c),u=e._size[0],d=e._size[1],f,p,m;if(i>d){for(p=d;p<i;p++)if(e._ptr[p]=e._values.length,l)for(f=0;f<u;f++)e._values.push(o),e._index.push(f);e._ptr[i]=e._values.length}else i<d&&(e._ptr.splice(i+1,d-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(d=i,r>u){if(l){var h=0;for(p=0;p<d;p++){e._ptr[p]=e._ptr[p]+h,m=e._ptr[p+1]+h;var g=0;for(f=u;f<r;f++,g++)e._values.splice(m+g,0,o),e._index.splice(m+g,0,f),h++}e._ptr[d]=e._values.length}}else if(r<u){var _=0;for(p=0;p<d;p++){e._ptr[p]=e._ptr[p]-_;var v=e._ptr[p],y=e._ptr[p+1]-_;for(m=v;m<y;m++)f=e._index[m],f>r-1&&(e._values.splice(m,1),e._index.splice(m,1),_++)}e._ptr[p]=e._values.length}return e._size[0]=r,e._size[1]=i,e}i.prototype.reshape=function(e,t){if(!D(e))throw TypeError(`Array expected`);if(e.length!==2)throw Error(`Sparse matrices can only be reshaped in two dimensions`);e.forEach(function(t){if(!b(t)||!G(t)||t<=-2||t===0)throw TypeError(`Invalid size, must contain positive integers or -1 (size: `+qr(e)+`)`)});var n=this._size[0]*this._size[1];if(e=fi(e,n),n!==e[0]*e[1])throw Error(`Reshaping sparse matrix will result in the wrong number of elements`);var r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;for(var i=[],a=0;a<r._ptr.length;a++)for(var o=0;o<r._ptr[a+1]-r._ptr[a];o++)i.push(a);for(var s=r._values.slice(),c=r._index.slice(),u=0;u<r._index.length;u++){var f=c[u],p=i[u],m=f*r._size[1]+p;i[u]=m%e[1],c[u]=Math.floor(m/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(var h=0;h<r._ptr.length;h++)r._ptr[h]=0;for(var g=0;g<s.length;g++){var _=c[g],v=i[g],y=s[g];d(l(_,r._ptr[v],r._ptr[v+1],r._index),_,v,y,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?V(this._values):void 0,index:V(this._index),ptr:V(this._ptr),size:V(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,t){if(!this._values)throw Error(`Cannot invoke map on a Pattern only matrix`);var n=this,r=this._size[0],i=this._size[1],a=Ri(e,n,`map`);return p(this,0,r-1,0,i-1,function(e,t,r){return a.fn(e,[t,r],n)},t)};function p(e,r,a,o,s,c,l){var u=[],d=[],f=[],p=n,m=0;E(e._datatype)&&(p=t.find(n,[e._datatype,e._datatype])||n,m=t.convert(0,e._datatype));for(var h=function(e,t,n){var r=c(e,t,n);
9p(r,m)||(u.push(r),d.push(t))},g=o;g<=s;g++){f.push(u.length);var _=e._ptr[g],v=e._ptr[g+1];if(l)for(var y=_;y<v;y++){var b=e._index[y];b>=r&&b<=a&&h(e._values[y],b-r,g-o)}else{for(var x={},S=_;S<v;S++){var C=e._index[S];x[C]=e._values[S]}for(var w=r;w<=a;w++)h(w in x?x[w]:0,w-r,g-o)}}return f.push(u.length),new i({values:u,index:d,ptr:f,size:[a-r+1,s-o+1]})}i.prototype.forEach=function(e,t){if(!this._values)throw Error(`Cannot invoke forEach on a Pattern only matrix`);for(var n=this,r=this._size[0],i=this._size[1],a=Ri(e,n,`forEach`),o=0;o<i;o++){var s=this._ptr[o],c=this._ptr[o+1];if(t)for(var l=s;l<c;l++){var u=this._index[l];a.fn(this._values[l],[u,o],n)}else{for(var d={},f=s;f<c;f++){var p=this._index[f];d[p]=this._values[f]}for(var m=0;m<r;m++){var h=m in d?d[m]:0;a.fn(h,[m,o],n)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error(`Cannot iterate a Pattern only matrix`);for(var e=this._size[1],t=0;t<e;t++)for(var n=this._ptr[t],r=this._ptr[t+1],i=n;i<r;i++){var a=this._index[i];yield{value:this._values[i],index:[a,t]}}},i.prototype.toArray=function(){return m(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return m(this._values,this._index,this._ptr,this._size,!1)};function m(e,t,n,r,i){var a=r[0],o=r[1],s=[],c,l;for(c=0;c<a;c++)for(s[c]=[],l=0;l<o;l++)s[c][l]=0;for(l=0;l<o;l++)for(var u=n[l],d=n[l+1],f=u;f<d;f++)c=t[f],s[c][l]=e?i?V(e[f]):e[f]:1;return s}return i.prototype.format=function(e){for(var t=this._size[0],n=this._size[1],r=this.density(),i=`Sparse Matrix [`+qr(t,e)+` x `+qr(n,e)+`] density: `+qr(r,e)+`
10`,a=0;a<n;a++)for(var o=this._ptr[a],s=this._ptr[a+1],c=o;c<s;c++){var l=this._index[c];i+=`
11    (`+qr(l,e)+`, `+qr(a,e)+`) ==> `+(this._values?qr(this._values[c],e):`X`)}return i},i.prototype.toString=function(){return qr(this.toArray())},i.prototype.toJSON=function(){return{mathjs:`SparseMatrix`,values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(x(e)&&(e=e.toNumber()),!b(e)||!G(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;var t=e>0?e:0,n=e<0?-e:0,r=this._size[0],a=this._size[1],o=Math.min(r-n,a-t),s=[],c=[],l=[];l[0]=0;for(var u=t;u<a&&s.length<o;u++)for(var d=this._ptr[u],f=this._ptr[u+1],p=d;p<f;p++){var m=this._index[p];if(m===u-t+n){s.push(this._values[p]),c[s.length-1]=m-n;break}}return l.push(s.length),new i({values:s,index:c,ptr:l,size:[o,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,a,o,s){if(!D(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(x(e)&&(e=e.toNumber()),!b(e)||!G(e)||e<1)throw Error(`Size values must be positive integers`);return e}),a){if(x(a)&&(a=a.toNumber()),!b(a)||!G(a))throw TypeError(`The parameter k must be an integer number`)}else a=0;var c=n,l=0;E(s)&&(c=t.find(n,[s,s])||n,l=t.convert(0,s));var u=a>0?a:0,d=a<0?-a:0,f=e[0],p=e[1],m=Math.min(f-d,p-u),h;if(D(r)){if(r.length!==m)throw Error(`Invalid value array length`);h=function(e){return r[e]}}else if(O(r)){var g=r.size();if(g.length!==1||g[0]!==m)throw Error(`Invalid matrix length`);h=function(e){return r.get([e])}}else h=function(){return r};for(var _=[],v=[],y=[],S=0;S<p;S++){y.push(_.length);var C=S-u;if(C>=0&&C<m){var w=h(C);c(w,l)||(v.push(C+d),_.push(w))}}return y.push(_.length),new i({values:_,index:v,ptr:y,size:[f,p]})},i.prototype.swapRows=function(e,t){if(!b(e)||!G(e)||!b(t)||!G(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return si(e,this._size[0]),si(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){for(var a=r[e],o=r[e+1],s=a;s<o;s++)i(n[s],t[s])},i._swapRows=function(e,t,n,r,i,a){for(var o=0;o<n;o++){var s=a[o],c=a[o+1],u=l(e,s,c,i),d=l(t,s,c,i);if(u<c&&d<c&&i[u]===e&&i[d]===t){if(r){var f=r[u];r[u]=r[d],r[d]=f}continue}if(u<c&&i[u]===e&&(d>=c||i[d]!==t)){var p=r?r[u]:void 0;i.splice(d,0,t),r&&r.splice(d,0,p),i.splice(d<=u?u+1:u,1),r&&r.splice(d<=u?u+1:u,1);continue}if(d<c&&i[d]===t&&(u>=c||i[u]!==e)){var m=r?r[d]:void 0;i.splice(u,0,e),r&&r.splice(u,0,m),i.splice(u<=d?d+1:d,1),r&&r.splice(u<=d?d+1:d,1)}}},i},{isClass:!0}),ss=`number`,cs=[`typed`];function ls(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}function us(e){for(var t=parseInt(e.integerPart,e.radix),n=0,r=0;r<e.fractionalPart.length;r++){var i=parseInt(e.fractionalPart[r],e.radix);n+=i/e.radix**+(r+1)}var a=t+n;if(isNaN(a))throw SyntaxError(`String "`+e.input+`" is not a valid number`);return a}var ds=W(ss,cs,e=>{var{typed:t}=e,n=t(`number`,{"":function(){return 0},number:function(e){return e},string:function(e){if(e===`NaN`)return NaN;var t=ls(e);if(t)return us(t);var n=0,r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);r&&(n=Number(r[2]),e=r[1]);var i=Number(e);if(isNaN(i))throw SyntaxError(`String "`+e+`" is not a valid number`);if(r){if(i>2**n-1)throw SyntaxError(`String "${e}" is out of range`);i>=2**(n-1)&&(i-=2**n)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))});return n.fromJSON=function(e){return parseFloat(e.value)},n}),fs=W(`bigint`,[`typed`],e=>{var{typed:t}=e,n=t(`bigint`,{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))});return n.fromJSON=function(e){return BigInt(e.value)},n}),ps=`string`,ms=W(ps,[`typed`],e=>{var{typed:t}=e;return t(ps,{"":function(){return``},number:Xe,null:function(e){return`null`},boolean:function(e){return e+``},string:function(e){return e},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e)),any:function(e){return String(e)}})}),hs=`boolean`,gs=W(hs,[`typed`],e=>{var{typed:t}=e;return t(hs,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if(t===`true`)return!0;
11if(t===`false`)return!1;var n=Number(e);if(e!==``&&!isNaN(n))return!!n;throw Error(`Cannot convert "`+e+`" to a boolean`)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),_s=W(`bignumber`,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(`bignumber`,{"":function(){return new n(0)},number:function(e){return new n(e+``)},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var r=t[2],i=n(t[1]),a=new n(2).pow(Number(r));if(i.gt(a.sub(1)))throw SyntaxError(`String "${e}" is out of range`);var o=new n(2).pow(Number(r)-1);return i.gte(o)?i.sub(a):i}return new n(e)},BigNumber:function(e){return e},bigint:function(e){return new n(e.toString())},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),Fraction:function(e){return new n(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new n(0)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),vs=W(`complex`,[`typed`,`Complex`],e=>{var{typed:t,Complex:n}=e;return t(`complex`,{"":function(){return n.ZERO},number:function(e){return new n(e,0)},"number, number":function(e,t){return new n(e,t)},"BigNumber, BigNumber":function(e,t){return new n(e.toNumber(),t.toNumber())},Fraction:function(e){return new n(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return n(e)},null:function(e){return n(0)},Object:function(e){if(`re`in e&&`im`in e)return new n(e.re,e.im);if(`r`in e&&`phi`in e||`abs`in e&&`arg`in e)return new n(e);throw Error(`Expected object with properties (re and im) or (r and phi) or (abs and arg)`)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),ys=W(`fraction`,[`typed`,`Fraction`],e=>{var{typed:t,Fraction:n}=e;return t(`fraction`,{number:function(e){if(!Number.isFinite(e)||isNaN(e))throw Error(e+` cannot be represented as a fraction`);return new n(e)},string:function(e){return new n(e)},"number, number":function(e,t){return new n(e,t)},"bigint, bigint":function(e,t){return new n(e,t)},null:function(e){return new n(0)},BigNumber:function(e){return new n(e.toString())},bigint:function(e){return new n(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var n=t.clone();return n.value=e(t.value),n}),Object:function(e){return new n(e)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),bs=`matrix`,xs=W(bs,[`typed`,`Matrix`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(bs,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,t){return a([],e,t)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,t,n){if(t===`dense`||t==="default"||t===void 0)return new r(e,n);if(t===`sparse`)return new i(e,n);throw TypeError(`Unknown matrix type `+JSON.stringify(t)+`.`)}}),Ss=`matrixFromFunction`,Cs=W(Ss,[`typed`,`matrix`,`isZero`],e=>{var{typed:t,matrix:n,isZero:r}=e;return t(Ss,{"Array | Matrix, function, string, string":function(e,t,n,r){return i(e,t,n,r)},"Array | Matrix, function, string":function(e,t,n){return i(e,t,n)},"Matrix, function":function(e,t){return i(e,t,`dense`)},"Array, function":function(e,t){return i(e,t,`dense`).toArray()},"Array | Matrix, string, function":function(e,t,n){return i(e,n,t)},"Array | Matrix, string, string, function":function(e,t,n,r){return i(e,r,t,n)}});function i(e,t,i,a){var o=a===void 0?n(i):n(i,a);return o.resize(e),o.forEach(function(e,n){var i=t(n);r(i)||o.set(n,i)}),o}}),ws=`matrixFromRows`,Ts=W(ws,[`typed`,`matrix`,`flatten`,`size`],e=>{var{typed:t,matrix:n,flatten:r,size:i}=e;return t(ws,{"...Array":function(e){return a(e)},"...Matrix":function(e){return n(a(e.map(e=>e.toArray())))}});function a(e){if(e.length===0)throw TypeError(`At least one row is needed to construct a matrix.`);var t=o(e[0]),n=[];for(var i of e){var a=o(i);if(a!==t)throw TypeError(`The vectors had different length: `+(t|0)+` ≠ `+(a|0));n.push(r(i))}return n}function o(e){var t=i(e);if(t.length===1)return t[0];if(t.length===2){if(t[0]===1)return t[1];if(t[1]===1)return t[0];throw TypeError(`At least one of the arguments is not a vector.`)}else throw TypeError(`Only one- or two-dimensional vectors are supported.`)}}),Es=`matrixFromColumns`,Ds=W(Es,[`typed`,`matrix`,`flatten`,`size`],e=>{var{typed:t,matrix:n,flatten:r,size:i}=e;return t(Es,{"...Array":function(e){return a(e)},"...Matrix":function(e){return n(a(e.map(e=>e.toArray())))}});function a(e){if(e.length===0)throw TypeError(`At least one column is needed to construct a matrix.`);for(var t=o(e[0]),n=[],i=0;i<t;i++)n[i]=[];for(var a of e){var s=o(a);if(s!==t)throw TypeError(`The vectors had different length: `+(t|0)+` ≠ `+(s|0)
11);for(var c=r(a),l=0;l<t;l++)n[l].push(c[l])}return n}function o(e){var t=i(e);if(t.length===1)return t[0];if(t.length===2){if(t[0]===1)return t[1];if(t[1]===1)return t[0];throw TypeError(`At least one of the arguments is not a vector.`)}else throw TypeError(`Only one- or two-dimensional vectors are supported.`)}}),Os=`splitUnit`,ks=W(Os,[`typed`],e=>{var{typed:t}=e;return t(Os,{"Unit, Array":function(e,t){return e.splitUnit(t)}})}),As=`unaryMinus`,js=W(As,[`typed`],e=>{var{typed:t}=e;return t(As,{number:la,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf(e=>n=>{var r=n.clone();return r.value=t.find(e,r.valueType())(n.value),r}),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0))})}),Ms=`unaryPlus`,Ns=W(Ms,[`typed`,`config`,`numeric`],e=>{var{typed:t,config:n,numeric:r}=e;return t(Ms,{number:ua,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),boolean:function(e){return r(+!!e,n.number)},string:function(e){return r(e,He(e,n))}})}),Ps=`abs`,Fs=W(Ps,[`typed`],e=>{var{typed:t}=e;return t(Ps,{number:ia,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0))})}),Is=`mapSlices`,Ls=W(Is,[`typed`,`isInteger`],e=>{var{typed:t,isInteger:n}=e;return t(Is,{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!n(t))throw TypeError(`Integer number expected for dimension`);var i=Array.isArray(e)?ri(e):e.size();if(t<0||t>=i.length)throw new ni(t,i.length);return O(e)?e.create(Rs(e.valueOf(),t,r),e.datatype()):Rs(e,t,r)}})},{formerly:`apply`});function Rs(e,t,n){var r,i,a;if(t<=0)if(Array.isArray(e[0])){for(a=zs(e),i=[],r=0;r<a.length;r++)i[r]=Rs(a[r],t-1,n);return i}else return n(e);else{for(i=[],r=0;r<e.length;r++)i[r]=Rs(e[r],t-1,n);return i}}function zs(e){var t=e.length,n=e[0].length,r,i,a=[];for(i=0;i<n;i++){var o=[];for(r=0;r<t;r++)o.push(e[r][i]);a.push(o)}return a}var Bs=`addScalar`,Vs=W(Bs,[`typed`],e=>{var{typed:t}=e;return t(Bs,{"number, number":aa,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(n.value===null||n.value===void 0)throw Error(`Parameter x contains a unit with undefined value`);if(r.value===null||r.value===void 0)throw Error(`Parameter y contains a unit with undefined value`);if(!n.equalBase(r))throw Error(`Units do not match`);var i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})}),Hs=`subtractScalar`,Us=W(Hs,[`typed`],e=>{var{typed:t}=e;return t(Hs,{"number, number":oa,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(n,r)=>{if(n.value===null||n.value===void 0)throw Error(`Parameter x contains a unit with undefined value`);if(r.value===null||r.value===void 0)throw Error(`Parameter y contains a unit with undefined value`);if(!n.equalBase(r))throw Error(`Units do not match`);var i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i})})}),Ws=`cbrt`,Gs=W(Ws,[`config`,`typed`,`isNegative`,`unaryMinus`,`matrix`,`Complex`,`BigNumber`,`Fraction`],e=>{var{config:t,typed:n,isNegative:r,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:c}=e;return n(Ws,{number:da,Complex:l,"Complex, boolean":l,BigNumber:function(e){return e.cbrt()},Unit:u});function l(e,n){var r=e.arg()/3,i=e.abs(),s=new o(da(i),0).mul(new o(0,r).exp());if(n){var c=[s,new o(da(i),0).mul(new o(0,r+Math.PI*2/3).exp()),new o(da(i),0).mul(new o(0,r-Math.PI*2/3).exp())];return t.matrix===`Array`?c:a(c)}else return s}function u(e){if(e.value&&C(e.value)){var t=e.clone();return t.value=1,t=t.pow(1/3),t.value=l(e.value),t}else{var n=r(e.value);n&&(e.value=i(e.value));var a=x(e.value)?new s(1).div(3):w(e.value)?new c(1,3):1/3,o=e.pow(a);return n&&(o.value=i(o.value)),o}}}),Ks=W(`matAlgo11xS0s`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=n,h=0,g=i;typeof u==`string`&&(p=u,m=t.find(n,[p,p]),h=t.convert(0,p),r=t.convert(r,p),g=t.find(i,[p,p]));for(var _=[],v=[],y=[],b=0;b<f;b++){y[b]=v.length;for(var x=c[b],S=c[b+1],C=x;C<S;C++){var w=s[C],T=a?g(r,o[C]):g(o[C],r);m(T,h)||(v.push(w),_.push(T))}}return y[f]=v.length,e.createSparseMatrix({values:_,index:v,ptr:y,size:[d,f],datatype:p})}}),qs=W(`matAlgo12xSfs`,[`typed`,`DenseMatrix`],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=i;typeof u==`string`&&(p=u,r=t.convert(r,p),m=t.find(i,[p,p]));for(var h=[],g=[],_=[],v=0;v<f;v++){for(var y=v+1,b=c[v],x=c[v+1],S=b;S<x;S++){var C=s[S];g[C]=o[S],_[C]=y}for(var w=0;w<d;w++)v===0&&(h[w]=[]),_[w]===y?h[w][v]=a?m(r,g[w]):m(g[w],r):h[w][v]=a?m(r,0):m(0,r)}return new n({data:h,size:[d,f],datatype:p})}}),Js=W(`matAlgo14xDs`,[`typed`],e=>{var{typed:t}=e;return function(e,r,i,a){var o=e._data,s=e._size,c=e._datatype,l,u=i;typeof c==`string`&&(l=c,r=t.convert(r,l),u=t.find(i,[l,l]));var d=s.length>0?n(u,0,s,s[0],o,r,a):[];return e.createDenseMatrix({data:d,size:V(s),datatype:l})};function n(e,t,r,i,a,o,s){var c=[];if(t===r.length-1)for(var l=0;l<i;l++)c[l]=s?e(o,a[l]):e(a[l],o);else for(var u=0;u<i;u++)c[u]=n(e,t+1,r,r[t+1],a[u],o,s);return c}}),Ys=`ceil`,Xs=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`],Zs=new cr(10),Qs=W(Ys,[`typed`,`config`,`round`],e=>{var{typed:t,config:n,round:r}=e;function i(e){var t=Math.ceil(e),i=r(e);return t===i?t:ot(e,i,n.relTol,n.absTol)&&!ot(e,t,n.relTol,n.absTol)?i:t}return t(Ys,{number:i,"number, number":function(e,t){if(!G(t))throw RangeError(`number of decimals in function ceil must be an integer`);if(t<0||t>15)throw RangeError(`number of decimals in ceil number must be in range 0-15`);var n=10**t;return i(e*n)/n}})}),$s=W(Ys,Xs,e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,c=Ks({typed:t,equalScalar:a}),l=qs({typed:t,DenseMatrix:s}),u=Js({typed:t}),d=Qs({typed:t,config:n,round:r});function f(e){var t=(e,t)=>Lo(e,t,n.relTol,n.absTol),i=e.ceil(),a=r(e);return i.eq(a)?i:t(e,a)&&!t(e,i)?a:i}return t(`ceil`,{number:d.signatures.number,"number,number":d.signatures[`number,number`],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:f,"BigNumber, BigNumber":function(e,t){var n=Zs.pow(t);return f(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Xi(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>Xi(t,t=>e(t,n),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>
11c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(i(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>a(t,0)?o(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),ec=`cube`,tc=W(ec,[`typed`],e=>{var{typed:t}=e;return t(ec,{number:fa,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})}),nc=`exp`,rc=W(nc,[`typed`],e=>{var{typed:t}=e;return t(nc,{number:pa,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})}),ic=`expm1`,ac=W(ic,[`typed`,`Complex`],e=>{var{typed:t,Complex:n}=e;return t(ic,{number:ma,Complex:function(e){var t=Math.exp(e.re);return new n(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})}),oc=`fix`,sc=[`typed`,`Complex`,`matrix`,`ceil`,`floor`,`equalScalar`,`zeros`,`DenseMatrix`],cc=W(oc,[`typed`,`ceil`,`floor`],e=>{var{typed:t,ceil:n,floor:r}=e;return t(oc,{number:function(e){return e>0?r(e):n(e)},"number, number":function(e,t){return e>0?r(e,t):n(e,t)}})}),lc=W(oc,sc,e=>{var{typed:t,Complex:n,matrix:r,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:c}=e,l=qs({typed:t,DenseMatrix:c}),u=Js({typed:t}),d=cc({typed:t,ceil:i,floor:a});return t(`fix`,{number:d.signatures.number,"number, number | BigNumber":d.signatures[`number,number`],Complex:function(e){return new n(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new n(e.re>0?a(e.re,t):i(e.re,t),e.im>0?a(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){var r=t.toNumber();return new n(e.re>0?a(e.re,r):i(e.re,r),e.im>0?a(e.im,r):i(e.im,r))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):a(e,t)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):a(e,t)},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Xi(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),"Array | Matrix, number | BigNumber":t.referToSelf(e=>(t,n)=>Xi(t,t=>e(t,n),!0)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(r(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>o(t,0)?s(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),uc=`floor`,dc=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`],fc=new cr(10),pc=W(uc,[`typed`,`config`,`round`],e=>{var{typed:t,config:n,round:r}=e;function i(e){var t=Math.floor(e),i=r(e);return t===i?t:ot(e,i,n.relTol,n.absTol)&&!ot(e,t,n.relTol,n.absTol)?i:t}return t(uc,{number:i,"number, number":function(e,t){if(!G(t))throw RangeError(`number of decimals in function floor must be an integer`);if(t<0||t>15)throw RangeError(`number of decimals in floor number must be in range 0 - 15`);var n=10**t;return i(e*n)/n}})}),mc=W(uc,dc,e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,c=Ks({typed:t,equalScalar:a}),l=qs({typed:t,DenseMatrix:s}),u=Js({typed:t}),d=pc({typed:t,config:n,round:r});function f(e){var t=(e,t)=>Lo(e,t,n.relTol,n.absTol),i=e.floor(),a=r(e);return i.eq(a)?i:t(e,a)&&!t(e,i)?a:i}return t(`floor`,{number:d.signatures.number,"number,number":d.signatures[`number,number`],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:f,"BigNumber, BigNumber":function(e,t){var n=fc.pow(t);return f(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Xi(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>Xi(t,t=>e(t,n),!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>
11c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"number | Complex | Fraction | BigNumber, Array":t.referToSelf(e=>(t,n)=>u(i(n),t,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf(e=>(t,n)=>a(t,0)?o(n.size(),n.storage()):n.storage()===`dense`?u(n,t,e,!0):l(n,t,e,!0))})}),hc=W(`matAlgo02xDS0`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i,a){var o=e._data,s=e._size,c=e._datatype||e.getDataType(),l=r._values,u=r._index,d=r._ptr,f=r._size,p=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(s.length!==f.length)throw new ti(s.length,f.length);if(s[0]!==f[0]||s[1]!==f[1])throw RangeError(`Dimension mismatch. Matrix A (`+s+`) must match Matrix B (`+f+`)`);if(!l)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var m=s[0],h=s[1],g,_=n,v=0,y=i;typeof c==`string`&&c===p&&c!==`mixed`&&(g=c,_=t.find(n,[g,g]),v=t.convert(0,g),y=t.find(i,[g,g]));for(var b=[],x=[],S=[],C=0;C<h;C++){S[C]=x.length;for(var w=d[C],T=d[C+1],E=w;E<T;
11E++){var D=u[E],O=a?y(l[E],o[D][C]):y(o[D][C],l[E]);_(O,v)||(x.push(D),b.push(O))}}return S[h]=x.length,r.createSparseMatrix({values:b,index:x,ptr:S,size:[m,h],datatype:c===e._datatype&&p===r._datatype?g:void 0})}}),gc=W(`matAlgo03xDSf`,[`typed`],e=>{var{typed:t}=e;return function(e,n,r,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._values,l=n._index,u=n._ptr,d=n._size,f=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(o.length!==d.length)throw new ti(o.length,d.length);if(o[0]!==d[0]||o[1]!==d[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+d+`)`);if(!c)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var p=o[0],m=o[1],h,g=0,_=r;typeof s==`string`&&s===f&&s!==`mixed`&&(h=s,g=t.convert(0,h),_=t.find(r,[h,h]));for(var v=[],y=0;y<p;y++)v[y]=[];for(var b=[],x=[],S=0;S<m;S++){for(var C=S+1,w=u[S],T=u[S+1],E=w;E<T;E++){var D=l[E];b[D]=i?_(c[E],a[D][S]):_(a[D][S],c[E]),x[D]=C}for(var O=0;O<p;O++)x[O]===C?v[O][S]=b[O]:v[O][S]=i?_(g,a[O][S]):_(a[O][S],g)}return e.createDenseMatrix({data:v,size:[p,m],datatype:s===e._datatype&&f===n._datatype?h:void 0})}}),_c=W(`matAlgo05xSfSf`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new ti(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=x?[]:void 0,T=x?[]:void 0,E=[],D=[],O,k,A,j;for(k=0;k<g;k++){C[k]=S.length;var M=k+1;for(A=s[k],j=s[k+1];A<j;A++)O=o[A],S.push(O),E[O]=M,w&&(w[O]=a[A]);for(A=f[k],j=f[k+1];A<j;A++)O=d[A],E[O]!==M&&S.push(O),D[O]=M,T&&(T[O]=u[A]);if(x)for(A=C[k];A<S.length;){O=S[A];var N=E[O],P=D[O];if(N===M||P===M){var F=N===M?w[O]:y,ee=P===M?T[O]:y,te=b(F,ee);v(te,y)?S.splice(A,1):(x.push(te),A++)}}}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),vc=W(`matAlgo13xDD`,[`typed`],e=>{var{typed:t}=e;return function(e,r,i){var a=e._data,o=e._size,s=e._datatype,c=r._data,l=r._size,u=r._datatype,d=[];if(o.length!==l.length)throw new ti(o.length,l.length);for(var f=0;f<o.length;f++){if(o[f]!==l[f])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+l+`)`);d[f]=o[f]}var p,m=i;typeof s==`string`&&s===u&&(p=s,m=t.find(i,[p,p]));var h=d.length>0?n(m,0,d,d[0],a,c):[];return e.createDenseMatrix({data:h,size:d,datatype:p})};function n(e,t,r,i,a,o){var s=[];if(t===r.length-1)for(var c=0;c<i;c++)s[c]=e(a[c],o[c]);else for(var l=0;l<i;l++)s[l]=n(e,t+1,r,r[t+1],a[l],o[l]);return s}});function yc(e,t){if(De(e.size(),t.size()))return[e,t];var n=Ai(e.size(),t.size());return[e,t].map(e=>bc(e,n))}function bc(e,t){return De(e.size(),t)?e:e.create(Mi(e.valueOf(),t),e.datatype())}var xc=W(`matrixAlgorithmSuite`,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e,r=vc({typed:t}),i=Js({typed:t});return function(e){var a=e.elop,o=e.SD||e.DS,s;a?(s={"DenseMatrix, DenseMatrix":(e,t)=>r(...yc(e,t),a),"Array, Array":(e,t)=>r(...yc(n(e),n(t)),a).valueOf(),"Array, DenseMatrix":(e,t)=>r(...yc(n(e),t),a),"DenseMatrix, Array":(e,t)=>r(...yc(e,n(t)),a)},e.SS&&(s[`SparseMatrix, SparseMatrix`]=(t,n)=>e.SS(...yc(t,n),a,!1)),e.DS&&(s[`DenseMatrix, SparseMatrix`]=(t,n)=>e.DS(...yc(t,n),a,!1),s[`Array, SparseMatrix`]=(t,r)=>e.DS(...yc(n(t),r),a,!1)),o&&(s[`SparseMatrix, DenseMatrix`]=(e,t)=>o(...yc(t,e),a,!0),s[`SparseMatrix, Array`]=(e,t)=>o(...yc(n(t),e),a,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf(e=>(t,n)=>r(...yc(t,n),e)),"Array, Array":t.referToSelf(e=>(t,i)=>r(...yc(n(t),n(i)),e).valueOf()),"Array, DenseMatrix":t.referToSelf(e=>(t,i)=>r(...yc(n(t),i),e)),"DenseMatrix, Array":t.referToSelf(e=>(t,i)=>r(...yc(t,n(i)),e))},e.SS&&(s[`SparseMatrix, SparseMatrix`]=t.referToSelf(t=>(n,r)=>
11e.SS(...yc(n,r),t,!1))),e.DS&&(s[`DenseMatrix, SparseMatrix`]=t.referToSelf(t=>(n,r)=>e.DS(...yc(n,r),t,!1)),s[`Array, SparseMatrix`]=t.referToSelf(t=>(r,i)=>e.DS(...yc(n(r),i),t,!1))),o&&(s[`SparseMatrix, DenseMatrix`]=t.referToSelf(e=>(t,n)=>o(...yc(n,t),e,!0)),s[`SparseMatrix, Array`]=t.referToSelf(e=>(t,r)=>o(...yc(n(r),t),e,!0))));var c=e.scalar||`any`;(e.Ds||e.Ss)&&(a?(s[`DenseMatrix,`+c]=(e,t)=>i(e,t,a,!1),s[c+`, DenseMatrix`]=(e,t)=>i(t,e,a,!0),s[`Array,`+c]=(e,t)=>i(n(e),t,a,!1).valueOf(),s[c+`, Array`]=(e,t)=>i(n(t),e,a,!0).valueOf()):(s[`DenseMatrix,`+c]=t.referToSelf(e=>(t,n)=>i(t,n,e,!1)),s[c+`, DenseMatrix`]=t.referToSelf(e=>(t,n)=>i(n,t,e,!0)),s[`Array,`+c]=t.referToSelf(e=>(t,r)=>i(n(t),r,e,!1).valueOf()),s[c+`, Array`]=t.referToSelf(e=>(t,r)=>i(n(r),t,e,!0).valueOf())));var l=e.sS===void 0?e.Ss:e.sS;return a?(e.Ss&&(s[`SparseMatrix,`+c]=(t,n)=>e.Ss(t,n,a,!1)),l&&(s[c+`, SparseMatrix`]=(e,t)=>l(t,e,a,!0))):(e.Ss&&(s[`SparseMatrix,`+c]=t.referToSelf(t=>(n,r)=>e.Ss(n,r,t,!1))),l&&(s[c+`, SparseMatrix`]=t.referToSelf(e=>(t,n)=>l(n,t,e,!0)))),a&&a.signatures&&Te(s,a.signatures),s}}),Sc=`mod`,Cc=W(Sc,[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:c}=e,l=mc({typed:t,config:n,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),u=hc({typed:t,equalScalar:a}),d=gc({typed:t}),f=_c({typed:t,equalScalar:a}),p=Ks({typed:t,equalScalar:a}),m=qs({typed:t,DenseMatrix:s}),h=xc({typed:t,matrix:i,concat:c});return t(Sc,{"number, number":g,"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(l(e.div(t))))},"bigint, bigint":function(e,t){if(t===0n)return e;if(e<0){var n=e%t;return n===0n?n:n+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(l(e.div(t))))}},h({SS:f,DS:d,SD:u,Ss:p,sS:m}));function g(e,t){return t===0?e:e-t*l(e/t)}}),wc=W(`matAlgo01xDSid`,[`typed`],e=>{var{typed:t}=e;return function(e,n,r,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._values,l=n._index,u=n._ptr,d=n._size,f=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(o.length!==d.length)throw new ti(o.length,d.length);if(o[0]!==d[0]||o[1]!==d[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+d+`)`);if(!c)throw Error(`Cannot perform operation on Dense Matrix and Pattern Sparse Matrix`);var p=o[0],m=o[1],h=typeof s==`string`&&s!==`mixed`&&s===f?s:void 0,g=h?t.find(r,[h,h]):r,_,v,y=[];for(_=0;_<p;_++)y[_]=[];var b=[],x=[];for(v=0;v<m;v++){for(var S=v+1,C=u[v],w=u[v+1],T=C;T<w;T++)_=l[T],b[_]=i?g(c[T],a[_][v]):g(a[_][v],c[T]),x[_]=S;for(_=0;_<p;_++)x[_]===S?y[_][v]=b[_]:y[_][v]=a[_][v]}return e.createDenseMatrix({data:y,size:[p,m],datatype:s===e._datatype&&f===n._datatype?h:void 0})}}),Tc=W(`matAlgo04xSidSid`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new ti(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=a&&u?[]:void 0,T=a&&u?[]:void 0,E=[],D=[],O,k,A,j,M;for(k=0;k<g;k++){C[k]=S.length;var N=k+1;for(j=s[k],M=s[k+1],A=j;A<M;A++)O=o[A],S.push(O),E[O]=N,w&&(w[O]=a[A]);for(j=f[k],M=f[k+1],A=j;A<M;A++)if(O=d[A],E[O]===N){if(w){var P=b(w[O],u[A]);v(P,y)?E[O]=null:w[O]=P}}else S.push(O),D[O]=N,T&&(T[O]=u[A]);if(w&&T)for(A=C[k];A<S.length;)O=S[A],E[O]===N?(x[A]=w[O],A++):D[O]===N?(x[A]=T[O],A++):S.splice(A,1)}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),Ec=W(`matAlgo10xSids`,[`typed`,`DenseMatrix`],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,a){var o=e._values,s=e._index,c=e._ptr,l=e._size,u=e._datatype;if(!o)throw Error(`Cannot perform operation on Pattern Sparse Matrix and Scalar value`);var d=l[0],f=l[1],p,m=i;typeof u==`string`&&(p=u,r=t.convert(r,p),m=t.find(i,[p,p]));for(var h=[],g=[],_=[],v=0;v<f;v++){for(var y=v+1,b=c[v],x=c[v+1],S=b;S<x;S++){var C=s[S];g[C]=o[S],_[C]=y}for(var w=0;w<d;w++)v===0&&(h[w]=[]),_[w]===y?h[w][v]=a?m(r,g[w]):m(g[w],r):h[w][v]=r}return new n({data:h,size:[d,f],datatype:p})}});function Dc(e,t,n,r){if(!(this instanceof Dc))throw SyntaxError(`Constructor must be called with the new operator`);this.fn=e,this.count=t,this.min=n,this.max=r,this.message=`Wrong number of arguments in function `+e+` (`+t+` provided, `+n+(r==null?``:`-`+r)+` expected)`,this.stack=Error().stack}Dc.prototype=Error(),Dc.prototype.constructor=Error,Dc.prototype.name=`ArgumentsError`,Dc.prototype.isArgumentsError=!0;var Oc=`gcd`,kc=[`typed`,`config`,`round`,`matrix`,`equalScalar`,`zeros`,`BigNumber`,`DenseMatrix`,`concat`],Ac=`number | BigNumber | Fraction | Matrix | Array`,jc=`${Ac}, ${Ac}, ...${Ac}`;
11function Mc(e){return!e.some(e=>Array.isArray(e))}var Nc=W(Oc,kc,e=>{var{typed:t,matrix:n,config:r,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:c,concat:l}=e,u=Cc({typed:t,config:r,round:i,matrix:n,equalScalar:a,zeros:o,DenseMatrix:c,concat:l}),d=wc({typed:t}),f=Tc({typed:t,equalScalar:a}),p=Ec({typed:t,DenseMatrix:c}),m=xc({typed:t,matrix:n,concat:l});return t(Oc,{"number, number":h,"BigNumber, BigNumber":g,"Fraction, Fraction":(e,t)=>e.gcd(t)},m({SS:f,DS:d,Ss:p}),{[jc]:t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i}),Array:t.referToSelf(e=>t=>{if(t.length===1&&Array.isArray(t[0])&&Mc(t[0]))return e(...t[0]);if(Mc(t))return e(...t);throw new Dc(`gcd() supports only 1d matrices!`)}),Matrix:t.referToSelf(e=>t=>e(t.toArray()))});function h(e,t){if(!G(e)||!G(t))throw Error(`Parameters in function gcd must be integer numbers`);for(var n;t!==0;)n=u(e,t),e=t,t=n;return e<0?-e:e}function g(e,t){if(!e.isInt()||!t.isInt())throw Error(`Parameters in function gcd must be integer numbers`);for(var n=new s(0);!t.isZero();){var r=u(e,t);e=t,t=r}return e.lt(n)?e.neg():e}}),Pc=W(`matAlgo06xS0S0`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._size,s=e._datatype||e._data===void 0?e._datatype:e.getDataType(),c=r._values,l=r._size,u=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(o.length!==l.length)throw new ti(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+l+`)`);var d=o[0],f=o[1],p,m=n,h=0,g=i;typeof s==`string`&&s===u&&s!==`mixed`&&(p=s,m=t.find(n,[p,p]),h=t.convert(0,p),g=t.find(i,[p,p]));for(var _=a&&c?[]:void 0,v=[],y=[],b=_?[]:void 0,x=[],S=[],C=0;C<f;C++){y[C]=v.length;var w=C+1;if($i(e,C,x,b,S,w,v,g),$i(r,C,x,b,S,w,v,g),b)for(var T=y[C];T<v.length;){var E=v[T];if(S[E]===w){var D=b[E];m(D,h)?v.splice(T,1):(_.push(D),T++)}else v.splice(T,1)}else for(var O=y[C];O<v.length;)S[v[O]]===w?O++:v.splice(O,1)}return y[f]=v.length,e.createSparseMatrix({values:_,index:v,ptr:y,size:[d,f],datatype:s===e._datatype&&u===r._datatype?p:void 0})}}),Fc=`lcm`,Ic=W(Fc,[`typed`,`matrix`,`equalScalar`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,concat:i}=e,a=hc({typed:t,equalScalar:r}),o=Pc({typed:t,equalScalar:r}),s=Ks({typed:t,equalScalar:r}),c=xc({typed:t,matrix:n,concat:i}),l=`number | BigNumber | Fraction | Matrix | Array`,u={};return u[`${l}, ${l}, ...${l}`]=t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i}),t(Fc,{"number, number":ga,"BigNumber, BigNumber":d,"Fraction, Fraction":(e,t)=>e.lcm(t)},c({SS:o,DS:a,Ss:s}),u);function d(e,t){if(!e.isInt()||!t.isInt())throw Error(`Parameters in function lcm must be integer numbers`);if(e.isZero())return e;if(t.isZero())return t;for(var n=e.times(t);!t.isZero();){var r=t;t=e.mod(r),e=r}return n.div(e).abs()}});function Lc(e,t,n,r){return function(i){if(i>0||n.predictable){if(i<=0)return NaN;var a=i.toString(16),o=a.substring(0,15);return e*(a.length-o.length)+t(Number(`0x`+o))}return r(i.toNumber())}}var Rc=`log10`,zc=[`typed`,`config`,`Complex`],Bc=va(16),Vc=W(Rc,zc,e=>{var{typed:t,config:n,Complex:r}=e;function i(e){return e.log().div(Math.LN10)}function a(e){return i(new r(e,0))}return t(Rc,{number:function(e){return e>=0||n.predictable?va(e):a(e)},bigint:Lc(Bc,va,n,a),Complex:i,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log():a(e.toNumber())},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Hc=`log2`,Uc=W(Hc,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;function i(e){return a(new r(e,0))}return t(Hc,{number:function(e){return e>=0||n.predictable?ya(e):i(e)},bigint:Lc(4,ya,n,i),Complex:a,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))});function a(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}}),Wc=W(`multiplyScalar`,[`typed`],e=>{var{typed:t}=e;return t(`multiplyScalar`,{"number, number":sa,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),Gc=`multiply`,Kc=W(Gc,[`typed`,`matrix`,`addScalar`,`multiplyScalar`,`equalScalar`,`dot`],e=>{var{typed:t,matrix:n,addScalar:r,multiplyScalar:i,equalScalar:a,dot:o}=e,s=Ks({typed:t,equalScalar:a}),c=Js({typed:t});function l(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Vectors must have the same length`);break;case 2:if(e[0]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Vector length (`+e[0]+`) must match Matrix rows (`+t[0]+`)`);break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix B has `+t.length+` dimensions)`)}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Matrix columns (`+e[1]+`) must match Vector length (`+t[0]+`)`);break;case 2:if(e[1]!==t[0])throw RangeError(`Dimension mismatch in multiplication. Matrix A columns (`+e[1]+`) must match Matrix B rows (`+t[0]+`)`);break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix B has `+t.length+` dimensions)`)}break;default:throw Error(`Can only multiply a 1 or 2 dimensional matrix (Matrix A has `+e.length+` dimensions)`)}}function u(e,t,n){if(n===0)throw Error(`Cannot multiply two empty vectors`);return o(e,t)}function d(e,t){if(t.storage()!==`dense`)throw Error(`Support for SparseMatrix not implemented`);return f(e,t)}function f(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._size,u=n._datatype||n.getDataType(),d=o[0],f=l[1],p,m=r,h=i;s&&u&&s===u&&typeof s==`string`&&s!==`mixed`&&(p=s,m=t.find(r,[p,p]),h=t.find(i,[p,p]));for(var g=[],_=0;_<f;_++){for(var v=h(a[0],c[0][_]),y=1;y<d;y++)v=m(v,h(a[y],c[y][_]));g[_]=v}return e.createDenseMatrix({data:g,size:[f],datatype:s===e._datatype&&u===n._datatype?p:void 0})}
11var p=t(`_multiplyMatrixVector`,{"DenseMatrix, any":h,"SparseMatrix, any":v}),m=t(`_multiplyMatrixMatrix`,{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":_,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":b});function h(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._datatype||n.getDataType(),u=o[0],d=o[1],f,p=r,m=i;s&&l&&s===l&&typeof s==`string`&&s!==`mixed`&&(f=s,p=t.find(r,[f,f]),m=t.find(i,[f,f]));for(var h=[],g=0;g<u;g++){for(var _=a[g],v=m(_[0],c[0]),y=1;y<d;y++)v=p(v,m(_[y],c[y]));h[g]=v}return e.createDenseMatrix({data:h,size:[u],datatype:s===e._datatype&&l===n._datatype?f:void 0})}function g(e,n){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),c=n._data,l=n._size,u=n._datatype||n.getDataType(),d=o[0],f=o[1],p=l[1],m,h=r,g=i;s&&u&&s===u&&typeof s==`string`&&s!==`mixed`&&s!==`mixed`&&(m=s,h=t.find(r,[m,m]),g=t.find(i,[m,m]));for(var _=[],v=0;v<d;v++){var y=a[v];_[v]=[];for(var b=0;b<p;b++){for(var x=g(y[0],c[0][b]),S=1;S<f;S++)x=h(x,g(y[S],c[S][b]));_[v][b]=x}}return e.createDenseMatrix({data:_,size:[d,p],datatype:s===e._datatype&&u===n._datatype?m:void 0})}function _(e,n){var o=e._data,s=e._size,c=e._datatype||e.getDataType(),l=n._values,u=n._index,d=n._ptr,f=n._size,p=n._datatype||n._data===void 0?n._datatype:n.getDataType();if(!l)throw Error(`Cannot multiply Dense Matrix times Pattern only Matrix`);var m=s[0],h=f[1],g,_=r,v=i,y=a,b=0;c&&p&&c===p&&typeof c==`string`&&c!==`mixed`&&(g=c,_=t.find(r,[g,g]),v=t.find(i,[g,g]),y=t.find(a,[g,g]),b=t.convert(0,g));for(var x=[],S=[],C=[],w=n.createSparseMatrix({values:x,index:S,ptr:C,size:[m,h],datatype:c===e._datatype&&p===n._datatype?g:void 0}),T=0;T<h;T++){C[T]=S.length;var E=d[T],D=d[T+1];if(D>E)for(var O=0,k=0;k<m;k++){for(var A=k+1,j=void 0,M=E;M<D;M++){var N=u[M];O===A?j=_(j,v(o[k][N],l[M])):(j=v(o[k][N],l[M]),O=A)}O===A&&!y(j,b)&&(S.push(k),x.push(j))}}return C[h]=S.length,w}function v(e,n){var o=e._values,s=e._index,c=e._ptr,l=e._datatype||e._data===void 0?e._datatype:e.getDataType();if(!o)throw Error(`Cannot multiply Pattern only Matrix times Dense Matrix`);var u=n._data,d=n._datatype||n.getDataType(),f=e._size[0],p=n._size[0],m=[],h=[],g=[],_,v=r,y=i,b=a,x=0;l&&d&&l===d&&typeof l==`string`&&l!==`mixed`&&(_=l,v=t.find(r,[_,_]),y=t.find(i,[_,_]),b=t.find(a,[_,_]),x=t.convert(0,_));var S=[],C=[];g[0]=0;for(var w=0;w<p;w++){var T=u[w];if(!b(T,x))for(var E=c[w],D=c[w+1],O=E;O<D;O++){var k=s[O];C[k]?S[k]=v(S[k],y(T,o[O])):(C[k]=!0,h.push(k),S[k]=y(T,o[O]))}}for(var A=h.length,j=0;j<A;j++)m[j]=S[h[j]];return g[1]=h.length,e.createSparseMatrix({values:m,index:h,ptr:g,size:[f,1],datatype:l===e._datatype&&d===n._datatype?_:void 0})}function y(e,n){var o=e._values,s=e._index,c=e._ptr,l=e._datatype||e._data===void 0?e._datatype:e.getDataType();if(!o)throw Error(`Cannot multiply Pattern only Matrix times Dense Matrix`);var u=n._data,d=n._datatype||n.getDataType(),f=e._size[0],p=n._size[0],m=n._size[1],h,g=r,_=i,v=a,y=0;l&&d&&l===d&&typeof l==`string`&&l!==`mixed`&&(h=l,g=t.find(r,[h,h]),_=t.find(i,[h,h]),v=t.find(a,[h,h]),y=t.convert(0,h));for(var b=[],x=[],S=[],C=e.createSparseMatrix({values:b,index:x,ptr:S,size:[f,m],datatype:l===e._datatype&&d===n._datatype?h:void 0}),w=[],T=[],E=0;E<m;E++){S[E]=x.length;for(var D=E+1,O=0;O<p;O++){var k=u[O][E];if(!v(k,y))for(var A=c[O],j=c[O+1],M=A;M<j;M++){var N=s[M];T[N]===D?w[N]=g(w[N],_(k,o[M])):(T[N]=D,x.push(N),w[N]=_(k,o[M]))}}for(var P=S[E],F=x.length,ee=P;ee<F;ee++)b[ee]=w[x[ee]]}return S[m]=x.length,C}function b(e,n){var a=e._values,o=e._index,s=e._ptr,c=e._datatype||e._data===void 0?e._datatype:e.getDataType(),l=n._values,u=n._index,d=n._ptr,f=n._datatype||n._data===void 0?n._datatype:n.getDataType(),p=e._size[0],m=n._size[1],h=a&&l,g,_=r,v=i;c&&f&&c===f&&typeof c==`string`&&c!==`mixed`&&(g=c,_=t.find(r,[g,g]),v=t.find(i,[g,g]));for(var y=h?[]:void 0,b=[],x=[],S=e.createSparseMatrix({values:y,index:b,ptr:x,size:[p,m],datatype:c===e._datatype&&f===n._datatype?g:void 0}),C=h?[]:void 0,w=[],T,E,D,O,k,A,j,M,N=0;N<m;N++){x[N]=b.length;var P=N+1;for(k=d[N],A=d[N+1],O=k;O<A;O++)if(M=u[O],h)for(E=s[M],D=s[M+1],T=E;T<D;T++)j=o[T],w[j]===P?C[j]=_(C[j],v(l[O],a[T])):(w[j]=P,b.push(j),C[j]=v(l[O],a[T]));else for(E=s[M],D=s[M+1],T=E;T<D;T++)j=o[T],w[j]!==P&&(w[j]=P,b.push(j));if(h)for(var F=x[N],ee=b.length,te=F;te<ee;te++)y[te]=C[b[te]]}return x[m]=b.length,S}return t(Gc,i,{"Array, Array":t.referTo(`Matrix, Matrix`,e=>(t,r)=>{l(ri(t),ri(r));var i=e(n(t),n(r));return O(i)?i.valueOf():i}),"Matrix, Matrix":function(e,t){var n=e.size(),r=t.size();return l(n,r),n.length===1?r.length===1?u(e,t,n[0]):d(e,t):r.length===1?p(e,t):m(e,t)},"Matrix, Array":t.referTo(`Matrix,Matrix`,e=>(t,r)=>e(t,n(r))),"Array, Matrix":t.referToSelf(e=>(t,r)=>e(n(t,r.storage()),r)),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return c(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return c(t,e,i,!0)},"Array, any":function(e,t){return c(n(e),t,i,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i})})}
11),qc=`nthRoot`,Jc=W(qc,[`typed`,`matrix`,`equalScalar`,`BigNumber`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,concat:a}=e,o=wc({typed:t}),s=hc({typed:t,equalScalar:r}),c=Pc({typed:t,equalScalar:r}),l=Ks({typed:t,equalScalar:r}),u=xc({typed:t,matrix:n,concat:a});function d(){throw Error(`Complex number not supported in function nthRoot. Use nthRoots instead.`)}return t(qc,{number:Sa,"number, number":Sa,BigNumber:e=>f(e,new i(2)),"BigNumber, BigNumber":f,Complex:d,"Complex, number":d,Array:t.referTo(`DenseMatrix,number`,e=>t=>e(n(t),2).valueOf()),DenseMatrix:t.referTo(`DenseMatrix,number`,e=>t=>e(t,2)),SparseMatrix:t.referTo(`SparseMatrix,number`,e=>t=>e(t,2)),"SparseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return c(t,n,e);throw Error(`Root must be non-zero`)}),"DenseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return o(t,n,e,!1);throw Error(`Root must be non-zero`)}),"Array, SparseMatrix":t.referTo(`DenseMatrix,SparseMatrix`,e=>(t,r)=>e(n(t),r)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>{if(n.density()===1)return l(n,t,e,!0);throw Error(`Root must be non-zero`)})},u({scalar:`number | BigNumber`,SD:s,Ss:l,sS:!1}));function f(e,t){var n=i.precision,r=i.clone({precision:n+2}),a=new i(0),o=new r(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw Error(`Root must be non-zero`);if(e.isNegative()&&!t.abs().mod(2).equals(1))throw Error(`Root must be odd when a is negative.`);if(e.isZero())return s?new r(1/0):0;if(!e.isFinite())return s?a:e;var c=e.abs().pow(o.div(t));return c=e.isNeg()?c.neg():c,new i((s?o.div(c):c).toPrecision(n))}}),Yc=`sign`,Xc=W(Yc,[`typed`,`BigNumber`,`Fraction`,`complex`],e=>{var{typed:t,BigNumber:n,complex:r,Fraction:i}=e;return t(Yc,{number:Ca,Complex:function(e){return e.im===0?r(Ca(e.re)):e.sign()},BigNumber:function(e){return new n(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return e.n===0n?new i(0):new i(e.s)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),Unit:t.referToSelf(e=>n=>{if(!n._isDerived()&&n.units[0].unit.offset!==0)throw TypeError(`sign is ambiguous for units with offset`);return t.find(e,n.valueType())(n.value)})})}),Zc=W(`sqrt`,[`config`,`typed`,`Complex`],e=>{var{config:t,typed:n,Complex:r}=e;return n(`sqrt`,{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new r(e,0).sqrt()}}),Qc=`square`,$c=W(Qc,[`typed`],e=>{var{typed:t}=e;return t(Qc,{number:Ta,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})}),el=`subtract`,tl=W(el,[`typed`,`matrix`,`equalScalar`,`subtractScalar`,`unaryMinus`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,c=wc({typed:t}),l=gc({typed:t}),u=_c({typed:t,equalScalar:r}),d=Ec({typed:t,DenseMatrix:o}),f=qs({typed:t,DenseMatrix:o}),p=xc({typed:t,matrix:n,concat:s});return t(el,{"any, any":i},p({elop:i,SS:u,DS:c,SD:l,Ss:f,sS:d}))}),nl=`xgcd`,rl=W(nl,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(nl,{"number, number":function(e,t){var i=Ea(e,t);return n.matrix===`Array`?i:r(i)},"BigNumber, BigNumber":a});function a(e,t){var a,o,s,c=new i(0),l=new i(1),u=c,d=l,f=l,p=c;if(!e.isInt()||!t.isInt())throw Error(`Parameters in function xgcd must be integer numbers`);for(;!t.isZero();)o=e.div(t).floor(),s=e.mod(t),a=u,u=d.minus(o.times(u)),d=a,a=f,f=p.minus(o.times(f)),p=a,e=t,t=s;var m=e.lt(c)?[e.neg(),d.neg(),p.neg()]:[e,e.isZero()?0:d,p];return n.matrix===`Array`?m:r(m)}}),il=`invmod`,al=W(il,[`typed`,`config`,`BigNumber`,`xgcd`,`equal`,`smaller`,`mod`,`add`,`isInteger`],e=>{var{typed:t,config:n,BigNumber:r,xgcd:i,equal:a,smaller:o,mod:s,add:c,isInteger:l}=e;return t(il,{"number, number":u,"BigNumber, BigNumber":u});function u(e,t){if(!l(e)||!l(t))throw Error(`Parameters in function invmod must be integer numbers`);if(e=s(e,t),a(t,0))throw Error(`Divisor must be non zero`);var n=i(e,t);n=n.valueOf();var[u,d]=n;return a(u,r(1))?(d=s(d,t),o(d,r(0))&&(d=c(d,t)),d):NaN}}),ol=W(`matAlgo09xS0Sf`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new ti(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));var x=a&&u?[]:void 0,S=[],C=[],w=x?[]:void 0,T=[],E,D,O,k,A;for(D=0;D<g;D++){C[D]=S.length;var j=D+1;if(w)for(k=f[D],A=f[D+1],O=k;O<A;O++)E=d[O],T[E]=j,w[E]=u[O];for(k=s[D],A=s[D+1],O=k;O<A;O++)if(E=o[O],w){var M=T[E]===j?w[E]:y,N=b(a[O],M);v(N,y)||(S.push(E),x.push(N))}else S.push(E)}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),sl=`dotMultiply`,cl=W(sl,[`typed`,`matrix`,`equalScalar`,`multiplyScalar`,`concat`],e=>
11{var{typed:t,matrix:n,equalScalar:r,multiplyScalar:i,concat:a}=e,o=hc({typed:t,equalScalar:r}),s=ol({typed:t,equalScalar:r}),c=Ks({typed:t,equalScalar:r});return t(sl,xc({typed:t,matrix:n,concat:a})({elop:i,SS:s,DS:o,Ss:c}))});function ll(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitAnd`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return fl(e,t,function(e,t){return e&t})}function ul(e){if(e.isFinite()&&!e.isInteger())throw Error(`Integer expected in function bitNot`);var t=e.constructor,n=t.precision;t.config({precision:1e9});var r=e.plus(new t(1));return r.s=-r.s||null,t.config({precision:n}),r}function dl(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitOr`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);var r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:!e.isFinite()||!t.isFinite()?!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e:fl(e,t,function(e,t){return e|t})}function fl(e,t,n){var r=e.constructor,i,a,o=+(e.s<0),s=+(t.s<0);if(o){i=pl(ul(e));for(var c=0;c<i.length;++c)i[c]^=1}else i=pl(e);if(s){a=pl(ul(t));for(var l=0;l<a.length;++l)a[l]^=1}else a=pl(t);var u,d,f;i.length<=a.length?(u=i,d=a,f=o):(u=a,d=i,f=s);var p=u.length,m=d.length,h=n(o,s)^1,g=new r(h^1),_=new r(1),v=new r(2),y=r.precision;for(r.config({precision:1e9});p>0;)n(u[--p],d[--m])===h&&(g=g.plus(_)),_=_.times(v);for(;m>0;)n(f,d[--m])===h&&(g=g.plus(_)),_=_.times(v);return r.config({precision:y}),h===0&&(g.s=-g.s),g}function pl(e){for(var t=e.d,n=t[0]+``,r=1;r<t.length;++r){for(var i=t[r]+``,a=7-i.length;a--;)i=`0`+i;n+=i}for(var o=n.length;n.charAt(o)===`0`;)o--;var s=e.e,c=n.slice(0,o+1||1),l=c.length;if(s>0)if(++s>l)for(s-=l;s--;)c+=`0`;else s<l&&(c=c.slice(0,s)+`.`+c.slice(s));for(var u=[0],d=0;d<c.length;){for(var f=u.length;f--;)u[f]*=10;u[0]+=parseInt(c.charAt(d++));for(var p=0;p<u.length;++p)u[p]>1&&((u[p+1]===null||u[p+1]===void 0)&&(u[p+1]=0),u[p+1]+=u[p]>>1,u[p]&=1)}return u.reverse()}function ml(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function bitXor`);var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new n(0);var r=new n(-1);return e.eq(r)?ul(t):t.eq(r)?ul(e):!e.isFinite()||!t.isFinite()?!e.isFinite()&&!t.isFinite()?r:new n(e.isNegative()===t.isNegative()?1/0:-1/0):fl(e,t,function(e,t){return e^t})}function hl(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function leftShift`);var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:!e.isFinite()&&!t.isFinite()?new n(NaN):t.lt(55)?e.times(2**t.toNumber()+``):e.times(new n(2).pow(t))}function gl(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw Error(`Integers expected in function rightArithShift`);var n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(2**t.toNumber()+``).floor():e.div(new n(2).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}var _l=`bitAnd`,vl=W(_l,[`typed`,`matrix`,`equalScalar`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,concat:i}=e,a=hc({typed:t,equalScalar:r}),o=Pc({typed:t,equalScalar:r}),s=Ks({typed:t,equalScalar:r}),c=xc({typed:t,matrix:n,concat:i});return t(_l,{"number, number":Ma,"BigNumber, BigNumber":ll,"bigint, bigint":(e,t)=>e&t},c({SS:o,DS:a,Ss:s}))}),yl=`bitNot`,bl=W(yl,[`typed`],e=>{var{typed:t}=e;return t(yl,{number:Na,BigNumber:ul,bigint:e=>~e,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),xl=`bitOr`,Sl=W(xl,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=wc({typed:t}),s=Tc({typed:t,equalScalar:r}),c=Ec({typed:t,DenseMatrix:i}),l=xc({typed:t,matrix:n,concat:a});return t(xl,{"number, number":Pa,"BigNumber, BigNumber":dl,"bigint, bigint":(e,t)=>e|t},l({SS:s,DS:o,Ss:c}))}),Cl=W(`matAlgo07xSSf`,[`typed`,`SparseMatrix`],e=>{var{typed:t,SparseMatrix:n}=e;return function(e,i,a){var o=e._size,s=e._datatype||e._data===void 0?e._datatype:e.getDataType(),c=i._size,l=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(o.length!==c.length)throw new ti(o.length,c.length);if(o[0]!==c[0]||o[1]!==c[1])throw RangeError(`Dimension mismatch. Matrix A (`+o+`) must match Matrix B (`+c+`)`);var u=o[0],d=o[1],f,p=0,m=a;typeof s==`string`&&s===l&&s!==`mixed`&&(f=s,p=t.convert(0,f),m=t.find(a,[f,f]));for(var h=[],g=[],_=Array(d+1).fill(0),v=[],y=[],b=[],x=[],S=0;S<d;S++){var C=S+1,w=0;r(e,S,b,v,C),r(i,S,x,y,C);for(var T=0;T<u;T++){var E=b[T]===C?v[T]:p,D=x[T]===C?y[T]:p,O=m(E,D);O!==0&&O!==!1&&(g.push(T),h.push(O),w++)}_[S+1]=_[S]+w}return new n({values:h,index:g,ptr:_,size:[u,d],datatype:s===e._datatype&&l===i._datatype?f:void 0})};function r(e,t,n,r,i){for(var a=e._values,o=e._index,s=e._ptr,c=s[t],l=s[t+1];c<l;c++){var u=o[c];n[u]=i,r[u]=a[c]}}}),wl=`bitXor`,Tl=W(wl,[`typed`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:a}=e,o=gc({typed:t}),s=Cl({typed:t,SparseMatrix:a}),c=qs({typed:t,DenseMatrix:r}
11),l=xc({typed:t,matrix:n,concat:i});return t(wl,{"number, number":Fa,"BigNumber, BigNumber":ml,"bigint, bigint":(e,t)=>e^t},l({SS:s,DS:o,Ss:c}))}),El=`arg`,Dl=W(El,[`typed`],e=>{var{typed:t}=e;return t(El,{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Ol=`conj`,kl=W(Ol,[`typed`],e=>{var{typed:t}=e;return t(Ol,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),Unit:t.referToSelf(e=>t=>new t.constructor(e(t.toNumeric()),t.formatUnits())),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Al=`im`,jl=W(Al,[`typed`],e=>{var{typed:t}=e;return t(Al,{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Ml=`re`,Nl=W(Ml,[`typed`],e=>{var{typed:t}=e;return t(Ml,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Pl=`not`,Fl=W(Pl,[`typed`],e=>{var{typed:t}=e;return t(Pl,{"null | undefined":()=>!0,number:qa,Complex:function(e){return e.re===0&&e.im===0},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf(e=>n=>t.find(e,n.valueType())(n.value)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Il=`nullish`,Ll=W(Il,[`typed`,`matrix`,`size`,`flatten`,`deepEqual`],e=>{var{typed:t,matrix:n,size:r,flatten:i,deepEqual:a}=e,o=gc({typed:t}),s=Js({typed:t}),c=vc({typed:t});return t(Il,{"number|bigint|Complex|BigNumber|Fraction|Unit|string|boolean|SparseMatrix, any":(e,t)=>e,"null, any":(e,t)=>t,"undefined, any":(e,t)=>t,"SparseMatrix, Array | Matrix":(e,t)=>{var n=r(e),i=r(t);if(a(n,i))return e;throw new ti(n,i)},"DenseMatrix, DenseMatrix":t.referToSelf(e=>(t,n)=>c(t,n,e)),"DenseMatrix, SparseMatrix":t.referToSelf(e=>(t,n)=>o(t,n,e,!1)),"DenseMatrix, Array":t.referToSelf(e=>(t,r)=>c(t,n(r),e)),"DenseMatrix, any":t.referToSelf(e=>(t,n)=>s(t,n,e,!1)),"Array, Array":t.referToSelf(e=>(t,r)=>c(n(t),n(r),e).valueOf()),"Array, DenseMatrix":t.referToSelf(e=>(t,r)=>c(n(t),r,e)),"Array, SparseMatrix":t.referToSelf(e=>(t,r)=>o(n(t),r,e,!1)),"Array, any":t.referToSelf(e=>(t,r)=>s(n(t),r,e,!1).valueOf())})}),Rl=`or`,zl=W(Rl,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=gc({typed:t}),s=_c({typed:t,equalScalar:r}),c=qs({typed:t,DenseMatrix:i}),l=xc({typed:t,matrix:n,concat:a});return t(Rl,{"number, number":Ja,"Complex, Complex":function(e,t){return e.re!==0||e.im!==0||t.re!==0||t.im!==0},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":Ja,"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0))},l({SS:s,DS:o,Ss:c}))}),Bl=`xor`,Vl=W(Bl,[`typed`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:a}=e,o=gc({typed:t}),s=Cl({typed:t,SparseMatrix:a}),c=qs({typed:t,DenseMatrix:r}),l=xc({typed:t,matrix:n,concat:i});return t(Bl,{"number, number":Ya,"Complex, Complex":function(e,t){return(e.re!==0||e.im!==0)!=(t.re!==0||t.im!==0)},"bigint, bigint":Ya,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0))},l({SS:s,DS:o,Ss:c}))}),Hl=`concat`,Ul=W(Hl,[`typed`,`matrix`,`isInteger`],e=>{var{typed:t,matrix:n,isInteger:r}=e;return t(Hl,{"...Array | Matrix | number | BigNumber":function(e){var t,i=e.length,a=-1,o,s=!1,c=[];for(t=0;t<i;t++){var l=e[t];if(O(l)&&(s=!0),b(l)||x(l)){if(t!==i-1)throw Error(`Dimension must be specified as last argument`);if(o=a,a=l.valueOf(),!r(a))throw TypeError(`Integer number expected for dimension`);if(a<0||t>0&&a>o)throw new ni(a,o+1)}else{var u=V(l).valueOf(),d=ri(u);if(c[t]=u,o=a,a=d.length-1,t>0&&a!==o)throw new ti(o+1,a+1)}}if(c.length===0)throw SyntaxError(`At least one matrix expected`);for(var f=c.shift();c.length;)f=ki(f,c.shift(),a);return s?n(f):f},"...string":function(e){return e.join(``)}})}),Wl=`column`,Gl=W(Wl,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e;return t(Wl,{"Matrix, number":a,"Array, number":function(e,t){return a(r(V(e)),t).valueOf()}});function a(e,t){if(e.size().length!==2)throw Error(`Only two dimensional matrix is supported`);si(t,e.size()[1]);
11var a=new n(i(0,e.size()[0]),[t]),o=e.subset(a);return O(o)?o:r([[o]])}}),Kl=`count`,ql=W(Kl,[`typed`,`size`,`prod`],e=>{var{typed:t,size:n,prod:r}=e;return t(Kl,{string:function(e){return e.length},"Matrix | Array":function(e){return r(n(e))}})}),Jl=`cross`,Yl=W(Jl,[`typed`,`matrix`,`subtract`,`multiply`],e=>{var{typed:t,matrix:n,subtract:r,multiply:i}=e;return t(Jl,{"Matrix, Matrix":function(e,t){return n(a(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(a(e.toArray(),t))},"Array, Matrix":function(e,t){return n(a(e,t.toArray()))},"Array, Array":a});function a(e,t){var n=Math.max(ri(e).length,ri(t).length);e=hi(e),t=hi(t);var a=ri(e),o=ri(t);if(a.length!==1||o.length!==1||a[0]!==3||o[0]!==3)throw RangeError(`Vectors with length 3 expected (Size A = [`+a.join(`, `)+`], B = [`+o.join(`, `)+`])`);var s=[r(i(e[1],t[2]),i(e[2],t[1])),r(i(e[2],t[0]),i(e[0],t[2])),r(i(e[0],t[1]),i(e[1],t[0]))];return n>1?[s]:s}}),Xl=`diag`,Zl=W(Xl,[`typed`,`matrix`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(Xl,{Array:function(e){return a(e,0,ri(e),null)},"Array, number":function(e,t){return a(e,t,ri(e),null)},"Array, BigNumber":function(e,t){return a(e,t.toNumber(),ri(e),null)},"Array, string":function(e,t){return a(e,0,ri(e),t)},"Array, number, string":function(e,t,n){return a(e,t,ri(e),n)},"Array, BigNumber, string":function(e,t,n){return a(e,t.toNumber(),ri(e),n)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return a(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return a(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return a(e,0,e.size(),t)},"Matrix, number, string":function(e,t,n){return a(e,t,e.size(),n)},"Matrix, BigNumber, string":function(e,t,n){return a(e,t.toNumber(),e.size(),n)}});function a(e,t,n,r){if(!G(t))throw TypeError(`Second parameter in function diag must be an integer`);var i=t>0?t:0,a=t<0?-t:0;switch(n.length){case 1:return o(e,t,r,n[0],a,i);case 2:return s(e,t,r,n,a,i)}throw RangeError(`Matrix for function diag must be 2 dimensional`)}function o(e,t,n,a,o,s){var c=[a+o,a+s];if(n&&n!==`sparse`&&n!==`dense`)throw TypeError(`Unknown matrix type ${n}"`);var l=n===`sparse`?i.diagonal(c,e,t):r.diagonal(c,e,t);return n===null?l.valueOf():l}function s(e,t,r,i,a,o){if(O(e)){var s=e.diagonal(t);return r===null?s.valueOf():r===s.storage()?s:n(s,r)}for(var c=Math.min(i[0]-a,i[1]-o),l=[],u=0;u<c;u++)l[u]=e[u+a][u+o];return r===null?l:n(l)}}),Ql=W(`filter`,[`typed`],e=>{var{typed:t}=e;return t(`filter`,{"Array, function":$l,"Matrix, function":function(e,t){return e.create($l(e.valueOf(),t),e.datatype())},"Array, RegExp":Ci,"Matrix, RegExp":function(e,t){return e.create(Ci(e.valueOf(),t),e.datatype())}})});function $l(e,t){var n=Ri(t,e,`filter`);return n.isUnary?Si(e,n.fn):Si(e,function(e,t,r){return n.fn(e,[t],r)})}var eu=`flatten`,tu=W(eu,[`typed`],e=>{var{typed:t}=e;return t(eu,{Array:function(e){return yi(e)},DenseMatrix:function(e){return e.create(yi(e.valueOf(),!0),e.datatype())},SparseMatrix:function(e){throw TypeError(`SparseMatrix is not supported by function flatten because it does not support 1D vectors. Convert to a DenseMatrix or Array first. Example: flatten(x.toArray())`)}})}),nu=`forEach`,ru=W(nu,[`typed`],e=>{var{typed:t}=e;return t(nu,{"Array, function":iu,"Matrix, function":function(e,t){e.forEach(t)}})});function iu(e,t){var n=Ri(t,e,nu);Ii(e,n.fn,n.isUnary)}var au=`getMatrixDataType`,ou=W(au,[`typed`],e=>{var{typed:t}=e;return t(au,{Array:function(e){return Di(e,Ce)},Matrix:function(e){return e.getDataType()}})}),su=`identity`,cu=W(su,[`typed`,`config`,`matrix`,`BigNumber`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return t(su,{"":function(){return n.matrix===`Matrix`?r([]):[]},string:function(e){return r(e)},"number | BigNumber":function(e){return c(e,e,n.matrix===`Matrix`?`dense`:void 0)},"number | BigNumber, string":function(e,t){return c(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return c(e,t,n.matrix===`Matr
11ix`?`dense`:void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,n){return c(e,t,n)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?r(t):[];case 1:return c(e[0],e[0],t);case 2:return c(e[0],e[1],t);default:throw Error(`Vector containing two values expected`)}}function c(e,t,n){var r=x(e)||x(t)?i:null;if(x(e)&&(e=e.toNumber()),x(t)&&(t=t.toNumber()),!G(e)||e<1||!G(t)||t<1)throw Error(`Parameters in function identity must be positive integers`);var s=r?new i(1):1,c=r?new r(0):0,l=[e,t];if(n){if(n===`sparse`)return o.diagonal(l,s,0,c);if(n===`dense`)return a.diagonal(l,s,0,c);throw TypeError(`Unknown matrix type "${n}"`)}for(var u=li([],l,c),d=e<t?e:t,f=0;f<d;f++)u[f][f]=s;return u}}),lu=`kron`,uu=W(lu,[`typed`,`matrix`,`multiplyScalar`],e=>{var{typed:t,matrix:n,multiplyScalar:r}=e;return t(lu,{"Matrix, Matrix":function(e,t){return n(a(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(a(e.toArray(),t))},"Array, Matrix":function(e,t){return n(a(e,t.toArray()))},"Array, Array":a});function i(e,t){return e.flatMap(e=>t.map(t=>r(e,t)))}function a(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;if(n<0){var r=ri(e).length,o=ri(t).length;for(n=Math.max(r,o);r++<n;)e=[e];for(;o++<n;)t=[t]}return n===1?i(e,t):e.flatMap(e=>t.map(t=>a(e,t,n-1)))}}),du=`map`,fu=W(du,[`typed`],e=>{var{typed:t}=e;return t(du,{"Array, function":s,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,t,r)=>n([e,t,...r.slice(0,r.length-1)],r[r.length-1])});function n(e,n){if(typeof n!=`function`)throw Error(`Last argument must be a callback function`);var c=e[0].isMatrix,l=e.map(e=>e.isMatrix?e.size():ri(e)),u=Ai(...l),d=e.length,f=c?(e,t)=>e.get(t):Pi,p=e.map((e,t)=>{var n=l[t].map(()=>0);return e.isMatrix?e.get(n):Pi(e,n)}),m=t.isTypedFunction(n)?o(n,p,u.map(()=>0),e):a(n,d);if(m<2)return r(e,i(m,n,null));var h=c?e.map(t=>t.isMatrix?t.create(Mi(t.toArray(),u),t.datatype()):e[0].create(Mi(t.valueOf(),u))):e.map(e=>e.isMatrix?Mi(e.toArray(),u):Mi(e,u)),g=i(m,n,h),_=(e,t)=>g([e,...h.slice(1).map(e=>f(e,t))],t);return c?h[0].map(_):s(h[0],_)}function r(e,t){var n=e[0],r=e.map(e=>e.isMatrix?e.valueOf():e),i=e.map(e=>e.isMatrix?e.size():ri(e)),a=Ai(...i),o=i.map(e=>a.length-e.length),s=a.length-1,c=t.length>1?[]:null,l=d(r,0);if(n.isMatrix){var u=n.create();return u._data=l,u._size=a,u}else return l;function d(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=a[n],i=Array(r);if(n<s)for(var l=function(t){c&&(c[n]=t),i[t]=d(e.map((e,r)=>o[r]>n?e:e.length===1?e[0]:e[t]),n+1)},u=0;u<r;u++)l(u);else for(var f=function(r){c&&(c[n]=r),i[r]=t(e.map(e=>e.length===1?e[0]:e[r]),c?c.slice():void 0)},p=0;p<r;p++)f(p);return i}}function i(e,t,n){switch(e){case 0:return e=>t(...e);case 1:return(e,n)=>t(...e,n);case 2:return(e,r)=>t(...e,r,...n)}}function a(e,t){var n=e.toString();if(/arguments/.test(n))return 2;var r=n.match(/\(.*?\)/);return/\.\.\./.test(r)||e.length>t+1?2:+(e.length===t+1)}function o(e,n,r,i){return t.resolve(e,[...n,r,...i])===null?t.resolve(e,[...n,r])===null?(t.resolve(e,n),0):1:2}function s(e,t){var n=Ri(t,e,du);return Fi(e,n.fn,n.isUnary)}}),pu=`diff`,mu=W(pu,[`typed`,`matrix`,`subtract`,`number`],e=>{var{typed:t,matrix:n,subtract:r,number:i}=e;return t(pu,{"Array | Matrix":function(e){return O(e)?n(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,t){if(!G(t))throw RangeError(`Dimension must be a whole number`);return O(e)?n(a(e.toArray(),t)):a(e,t)},"Array, BigNumber":t.referTo(`Array,number`,e=>(t,n)=>e(t,i(n))),"Matrix, BigNumber":t.referTo(`Matrix,number`,e=>(t,n)=>e(t,i(n)))});function a(e,t){if(O(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError(`Array/Matrix does not have that many dimensions`);if(t>0){var n=[];return e.forEach(e=>{n.push(a(e,t-1))}),n}else if(t===0)return o(e);else throw RangeError(`Cannot have negative dimension`)}function o(e){for(var t=[],n=e.length,r=1;r<n;r++)t.push(s(e[r-1],e[r]));return t}function s(e,t){O(e)&&(e=e.toArray()),O(t)&&(t=t.toArray());var n=Array.isArray(e),i=Array.isArray(t);if(n&&i)return c(e,t);if(!n&&!i)return r(t,e);throw TypeError(`Cannot calculate difference between 1 array and 1 non-array`)}function c(e,t){if(e.length!==t.length)throw RangeError(`Not all sub-arrays have the same length`);for(var n=[],r=e.length,i=0;i<r;i++)n.push(s(e[i],t[i]));return n}}),hu=W(`ones`,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(`ones`,{"":function(){return n.matrix===`Array`?a([]):a([],`default`)},"...number | BigNumber | string":function(e){return typeof e[e.length-1]==`string`?a(e,e.pop()):n.matrix===`Array`?a(e):a(e,`default`)},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});
11function a(e,t){var n=o(e)?new i(1):1;if(s(e),t){var a=r(t);return e.length>0?a.resize(e,n):a}else{var c=[];return e.length>0?li(c,e,n):c}}function o(e){var t=!1;return e.forEach(function(e,n,r){x(e)&&(t=!0,r[n]=e.toNumber())}),t}function s(e){e.forEach(function(e){if(typeof e!=`number`||!G(e)||e<0)throw Error(`Parameters in function ones must be positive integers`)})}});function gu(){throw Error(`No "bignumber" implementation available`)}function _u(){throw Error(`No "fraction" implementation available`)}function vu(){throw Error(`No "matrix" implementation available`)}var yu=`range`,bu=W(yu,[`typed`,`config`,`?matrix`,`?bignumber`,`equal`,`smaller`,`smallerEq`,`larger`,`largerEq`,`add`,`isZero`,`isPositive`],e=>{var{typed:t,config:n,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:c,add:l,isZero:u,isPositive:d}=e;return t(yu,{string:p,"string, boolean":p,number:function(e){throw TypeError(`Too few arguments to function range(): ${e}`)},boolean:function(e){throw TypeError(`Unexpected type of argument 1 to function range(): ${e}, number|bigint|BigNumber|Fraction`)},"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,n){return f(m(e,t,n,!1))},"number, number, boolean":function(e,t,n){return f(m(e,t,1,n))},"number, number, number, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"bigint, bigint|number":function(e,t){return f(m(e,t,1n,!1))},"number, bigint":function(e,t){return f(m(BigInt(e),t,1n,!1))},"bigint, bigint|number, bigint|number":function(e,t,n){return f(m(e,t,BigInt(n),!1))},"number, bigint, bigint|number":function(e,t,n){return f(m(BigInt(e),t,BigInt(n),!1))},"bigint, bigint|number, boolean":function(e,t,n){return f(m(e,t,1n,n))},"number, bigint, boolean":function(e,t,n){return f(m(BigInt(e),t,1n,n))},"bigint, bigint|number, bigint|number, boolean":function(e,t,n,r){return f(m(e,t,BigInt(n),r))},"number, bigint, bigint|number, boolean":function(e,t,n,r){return f(m(BigInt(e),t,BigInt(n),r))},"BigNumber, BigNumber":function(e,t){var n=e.constructor;return f(m(e,t,new n(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,n){return f(m(e,t,n,!1))},"BigNumber, BigNumber, boolean":function(e,t,n){var r=e.constructor;return f(m(e,t,new r(1),n))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Fraction, Fraction":function(e,t){return f(m(e,t,1,!1))},"Fraction, Fraction, Fraction":function(e,t,n){return f(m(e,t,n,!1))},"Fraction, Fraction, boolean":function(e,t,n){return f(m(e,t,1,n))},"Fraction, Fraction, Fraction, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Unit, Unit, Unit":function(e,t,n){return f(m(e,t,n,!1))},"Unit, Unit, Unit, boolean":function(e,t,n,r){return f(m(e,t,n,r))}});function f(e){return n.matrix===`Matrix`?r?r(e):vu():e}function p(e,t){var r=h(e);if(!r)throw SyntaxError(`String "`+e+`" is no valid range`);return n.number===`BigNumber`?(i===void 0&&gu(),f(m(i(r.start),i(r.end),i(r.step)),t)):f(m(r.start,r.end,r.step,t))}function m(e,t,n,r){var i=[];if(u(n))throw Error(`Step must be non-zero`);for(var f=d(n)?r?o:a:r?c:s,p=e;f(p,t);)i.push(p),p=l(p,n);return i}function h(e){var t=e.split(`:`).map(function(e){return Number(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}}),xu=`reshape`,Su=W(xu,[`typed`,`isInteger`,`matrix`],e=>{var{typed:t,isInteger:n}=e;return t(xu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach(function(e){if(!n(e))throw TypeError(`Invalid size for dimension: `+e)}),di(e,t)}})}),Cu=W(`resize`,[`config`,`matrix`],e=>{var{config:t,matrix:n}=e;return function(e,i,a){if(arguments.length!==2&&arguments.length!==3)throw new Dc(`resize`,arguments.length,2,3);if(O(i)&&(i=i.valueOf()),x(i[0])&&(i=i.map(function(e){return x(e)?e.toNumber():e})),O(e))return e.resize(i,a,!0);if(typeof e==`string`)return r(e,i,a);var o=Array.isArray(e)?!1:t.matrix!==`Array`;if(i.length===0){for(;Array.isArray(e);)e=e[0];return V(e)}else{Array.isArray(e)||(e=[e]),e=V(e);var s=li(e,i,a);return o?n(s):s}};function r(e,t,n){if(n!==void 0){if(typeof n!=`string`||n.length!==1)throw TypeError(`Single character expected as defaultValue`)}else n=` `;if(t.length!==1)throw new ti(t.length,1);var r=t[0];if(typeof r!=`number`||!G(r))throw TypeError(`Invalid size, must contain positive integers (size: `+qr(t)+`)`);if(e.length>r)return e.substring(0,r);if(e.length<r){for(var i=e,a=0,o=r-e.length;a<o;a++)i+=n;return i}else return e}}),wu=`rotate`,Tu=W(wu,[`typed`,`multiply`,`rotationMatrix`],e=>{var{typed:t,multiply:n,rotationMatrix:r}=e;return t(wu,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r
11(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),n(r(t,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),n(r(t,a),e)}});function i(e,t){var n=Array.isArray(e)?ri(e):e.size();if(n.length>2||n.length===2&&n[1]!==1||n[0]!==t)throw RangeError(`Vector must be of dimensions 1x${t}`)}}),Eu=`rotationMatrix`,Du=W(Eu,[`typed`,`config`,`multiplyScalar`,`addScalar`,`unaryMinus`,`norm`,`matrix`,`BigNumber`,`DenseMatrix`,`SparseMatrix`,`cos`,`sin`],e=>{var{typed:t,config:n,multiplyScalar:r,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:c,DenseMatrix:l,SparseMatrix:u,cos:d,sin:f}=e;return t(Eu,{"":function(){return n.matrix===`Matrix`?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return p(e,n.matrix===`Matrix`?`dense`:void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return p(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){var n=c(t);return m(n),_(e,n,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){return m(t),_(e,t,t.storage()||(n.matrix===`Matrix`?`dense`:void 0))},"number | BigNumber | Complex | Unit, Array, string":function(e,t,n){var r=c(t);return m(r),_(e,r,n)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,n){return m(t),_(e,t,n)}});function p(e,t){var n=x(e)?new s(-1):-1,i=d(e),a=f(e);return g([[i,r(n,a)],[a,i]],t)}function m(e){var t=e.size();if(t.length<1||t[0]!==3)throw RangeError(`Vector must be of dimensions 1x3`)}function h(e){return e.reduce((e,t)=>r(e,t))}function g(e,t){if(t){if(t===`sparse`)return new u(e);
11if(t===`dense`)return new l(e);throw TypeError(`Unknown matrix type "${t}"`)}return e}function _(e,t,n){var r=o(t);if(r===0)throw RangeError(`Rotation around zero vector`);var c=x(e)?s:null,l=c?new c(1):1,u=c?new c(-1):-1,p=c?new c(t.get([0])/r):t.get([0])/r,m=c?new c(t.get([1])/r):t.get([1])/r,_=c?new c(t.get([2])/r):t.get([2])/r,v=d(e),y=i(l,a(v)),b=f(e),S=i(v,h([p,p,y])),C=i(h([p,m,y]),h([u,_,b])),w=i(h([p,_,y]),h([m,b])),T=i(h([p,m,y]),h([_,b])),E=i(v,h([m,m,y])),D=i(h([m,_,y]),h([u,p,b])),O=i(h([p,_,y]),h([u,m,b])),k=i(h([m,_,y]),h([p,b])),A=i(v,h([_,_,y]));return g([[S,C,w],[T,E,D],[O,k,A]],n)}}),Ou=`row`,ku=W(Ou,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e;return t(Ou,{"Matrix, number":a,"Array, number":function(e,t){return a(r(V(e)),t).valueOf()}});function a(e,t){if(e.size().length!==2)throw Error(`Only two dimensional matrix is supported`);si(t,e.size()[0]);var a=i(0,e.size()[1]),o=new n([t],a),s=e.subset(o);return O(s)?s:r([[s]])}}),Au=`size`,ju=W(Au,[`typed`],e=>{var{typed:t}=e;return t(Au,{Matrix:e=>e.size(),Array:ri,string:e=>[e.length],"number | Complex | BigNumber | Unit | boolean | null":e=>[]})}),Mu=`squeeze`,Nu=W(Mu,[`typed`],e=>{var{typed:t}=e;return t(Mu,{Array:function(e){return hi(V(e))},Matrix:function(e){var t=hi(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return V(e)}})}),Pu=`subset`,Fu=W(Pu,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e;return t(Pu,{"Matrix, Index":function(e,t){return ci(t)?n():(oi(e,t),e.subset(t))},"Array, Index":t.referTo(`Matrix, Index`,function(e){return function(t,r){var i=e(n(t),r);return r.isScalar()?i:i.valueOf()}}),"Object, Index":Ru,"string, Index":Iu,"Matrix, Index, any, any":function(e,t,n,r){return ci(t)?e:(oi(e,t),e.clone().subset(t,a(n,t),r))},"Array, Index, any, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,r,i,a){var o=e(n(t),r,i,a);return o.isMatrix?o.valueOf():o}}),"Array, Index, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,r,i){return e(n(t),r,i,void 0).valueOf()}}),"Matrix, Index, any":t.referTo(`Matrix, Index, any, any`,function(e){return function(t,n,r){return e(t,n,r,void 0)}}),"string, Index, string":Lu,"string, Index, string, string":Lu,"Object, Index, any":zu});function a(e,t){if(typeof e==`string`)throw Error(`can't boradcast a string`);if(t.isScalar())return e;var n=t.size();if(n.every(e=>e>0))try{return i(e,r(n))}catch{return e}else return e}});function Iu(e,t){if(!N(t))throw TypeError(`Index expected`);if(ci(t))return``;if(oi(Array.from(e),t),t.size().length!==1)throw new ti(t.size().length,1);var n=e.length;si(t.min()[0],n),si(t.max()[0],n);var r=t.dimension(0),i=``;function a(t){i+=e.charAt(t)}return Number.isInteger(r)?a(r):r.forEach(a),i}function Lu(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Index expected`);if(ci(t))return e;if(oi(Array.from(e),t),t.size().length!==1)throw new ti(t.size().length,1);if(r!==void 0){if(typeof r!=`string`||r.length!==1)throw TypeError(`Single character expected as defaultValue`)}else r=` `;var i=t.dimension(0);if((Number.isInteger(i)?1:i.size()[0])!==n.length)throw new ti(i.size()[0],n.length);var a=e.length;si(t.min()[0]),si(t.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);function c(e,t){o[e]=n.charAt(t[0])}if(Number.isInteger(i)?c(i,[0]):i.forEach(c),o.length>a)for(var l=a-1,u=o.length;l<u;l++)o[l]||(o[l]=r);return o.join(``)}function Ru(e,t){if(!ci(t)){if(t.size().length!==1)throw new ti(t.size(),1);var n=t.dimension(0);if(typeof n!=`string`)throw TypeError(`String expected as index to retrieve an object property`);return a(e,n)}}function zu(e,t,n){if(ci(t))return e;if(t.size().length!==1)throw new ti(t.size(),1);var r=t.dimension(0);if(typeof r!=`string`)throw TypeError(`String expected as index to retrieve an object property`);var i=V(e);return o(i,r,n),i}var Bu=`transpose`,Vu=W(Bu,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e;return t(Bu,{Array:e=>r(n(e)).valueOf(),Matrix:r,any:V});function r(e){var t=e.size(),n;switch(t.length){case 1:n=e.clone();break;case 2:var r=t[0],o=t[1];if(o===0)throw RangeError(`Cannot transpose a 2D matrix with no columns (size: `+qr(t)+`)`);switch(e.storage()){case`dense`:n=i(e,r,o);break;case`sparse`:n=a(e,r,o);break}break;default:throw RangeError(`Matrix must be a vector or two dimensional (size: `+qr(t)+`)`)}return n}function i(e,t,n){for(var r=e._data,i=[],a,o=0;o<n;o++){a=i[o]=[];for(var s=0;s<t;s++)a[s]=V(r[s][o])}return e.createDenseMatrix({data:i,size:[n,t],datatype:e._datatype})}function a(e,t,n){for(var r=e._values,i=e._index,a=e._ptr,o=r?[]:void 0,s=[],c=[],l=[],u=0;u<t;u++)l[u]=0;var d,f,p;for(d=0,f=i.length;d<f;d++)l[i[d]]++;for(var m=0,h=0;h<t;h++)c.push(m),m+=l[h],l[h]=c[h];for(c.push(m),p=0;p<n;p++)for(var g=a[p],_=a[p+1],v=g;v<_;v++){var y=l[i[v]]++;s[y]=p,r&&(o[y]=V(r[v]))}return e.createSparseMatrix({values:o,index:s,ptr:c,size:[n,t],datatype:e._datatype})}}),Hu=`ctranspose`,Uu=W(Hu,[`typed`,`transpose`,`conj`],e=>{var{typed:t,transpose:n,conj:r}=e;return t(Hu,{any:function(e){return r(n(e))}})}),Wu=`zeros`,Gu=W(Wu,[`typed`,`config`,`matrix`,`BigNumber`],e=>{var{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Wu,{"":function(){return n.matrix===`Array`?a([]):a([],`default`)},"...number | BigNumber | string":function(e){return typeof e[e.length-1]==`string`?a(e,e.pop()):n.matrix===`Array`?a(e):a(e,`default`)},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});
11function a(e,t){var n=o(e)?new i(0):0;if(s(e),t){var a=r(t);return e.length>0?a.resize(e,n):a}else{var c=[];return e.length>0?li(c,e,n):c}}function o(e){var t=!1;return e.forEach(function(e,n,r){x(e)&&(t=!0,r[n]=e.toNumber())}),t}function s(e){e.forEach(function(e){if(typeof e!=`number`||!G(e)||e<0)throw Error(`Parameters in function zeros must be positive integers`)})}}),Ku=`fft`,qu=W(Ku,[`typed`,`matrix`,`addScalar`,`multiplyScalar`,`divideScalar`,`exp`,`tau`,`i`,`dotDivide`,`conj`,`pow`,`ceil`,`log2`],e=>{var{typed:t,matrix:n,addScalar:r,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:c,dotDivide:l,conj:u,pow:d,ceil:f,log2:p}=e;return t(Ku,{Array:m,Matrix:function(e){return e.create(m(e.valueOf()),e.datatype())}});function m(e){var t=ri(e);return t.length===1?_(e,t[0]):h(e.map(e=>m(e,t.slice(1))),0)}function h(e,t){var n=ri(e);if(t!==0)return Array(n[0]).fill(0).map((n,r)=>h(e[r],t-1));if(n.length===1)return _(e);function r(e){var t=ri(e);return Array(t[1]).fill(0).map((n,r)=>Array(t[0]).fill(0).map((t,n)=>e[n][r]))}return r(h(r(e),1))}function g(e){for(var t=e.length,n=o(a(i(-1,i(c,s)),t)),r=[],h=1-t;h<t;h++)r.push(d(n,a(d(h,2),2)));for(var g=d(2,f(p(t+t-1))),v=[...Array(t).fill(0).map((n,a)=>i(e[a],r[t-1+a])),...Array(g-t).fill(0)],y=[...Array(t+t-1).fill(0).map((e,t)=>a(1,r[t])),...Array(g-(t+t-1)).fill(0)],b=_(v),x=_(y),S=l(u(m(u(Array(g).fill(0).map((e,t)=>i(b[t],x[t]))))),g),C=[],w=t-1;w<t+t-1;w++)C.push(i(S[w],r[w]));return C}function _(e){var t=e.length;if(t===1)return[e[0]];if(t%2==0){for(var n=[..._(e.filter((e,t)=>t%2==0),t/2),..._(e.filter((e,t)=>t%2==1),t/2)],l=0;l<t/2;l++){var u=n[l],d=i(n[l+t/2],o(i(i(s,c),a(-l,t))));n[l]=r(u,d),n[l+t/2]=r(u,i(-1,d))}return n}else return g(e)}}),Ju=`ifft`,Yu=W(Ju,[`typed`,`fft`,`dotDivide`,`conj`],e=>{var{typed:t,fft:n,dotDivide:r,conj:i}=e;return t(Ju,{"Array | Matrix":function(e){var t=O(e)?e.size():ri(e);return r(i(n(i(e))),t.reduce((e,t)=>e*t,1))}})});function Xu(e){"@babel/helpers - typeof";return Xu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Xu(e)}function Zu(e,t){if(Xu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Xu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Qu(e){var t=Zu(e,`string`);return Xu(t)==`symbol`?t:t+``}function $u(e,t,n){return(t=Qu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ed(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function td(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ed(Object(n),!0).forEach(function(t){$u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ed(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var nd=W(`solveODE`,[`typed`,`add`,`subtract`,`multiply`,`divide`,`max`,`map`,`abs`,`isPositive`,`isNegative`,`larger`,`smaller`,`matrix`,`bignumber`,`unaryMinus`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,max:o,map:s,abs:c,isPositive:l,isNegative:u,larger:d,smaller:f,matrix:p,bignumber:m,unaryMinus:h}=e;function g(e){return function(t,p,g,_){if(!(p.length===2&&(p.every(w)||p.every(T))))throw Error(`"tspan" must be an Array of two numeric values or two units [tStart, tEnd]`);var v=p[0],y=p[1],b=d(y,v),E=_.firstStep;if(E!==void 0&&!l(E))throw Error(`"firstStep" must be positive`);var D=_.maxStep;if(D!==void 0&&!l(D))throw Error(`"maxStep" must be positive`);var O=_.minStep;if(O&&u(O))throw Error(`"minStep" must be positive or zero`);var k=[v,y,E,O,D].filter(e=>e!==void 0);if(!(k.every(w)||k.every(T)))throw Error(`Inconsistent type of "t" dependant variables`);for(var A=1,j=_.tol?_.tol:1e-4,M=_.minDelta?_.minDelta:.2,N=_.maxDelta?_.maxDelta:5,P=_.max
11Iter?_.maxIter:1e4,F=[v,y,...g,D,O].some(x),[ee,te,ne,re]=F?[m(e.a),m(e.c),m(e.b),m(e.bp)]:[e.a,e.c,e.b,e.bp],ie=E?b?E:h(E):a(r(y,v),A),ae=[v],I=[g],oe=r(ne,re),L=0,se=0,ce=S(b),R=C(b);ce(ae[L],y);){var le=[];ie=R(ae[L],y,ie),le.push(t(ae[L],I[L]));for(var ue=1;ue<te.length;++ue)le.push(t(n(ae[L],i(te[ue],ie)),n(I[L],i(ie,ee[ue],le))));var z=o(c(s(i(oe,le),e=>T(e)?e.value:e)));z<j&&j/z>1/4&&(ae.push(n(ae[L],ie)),I.push(n(I[L],i(ie,ne,le))),L++);var B=.84*(j/z)**(1/5);if(f(B,M)?B=M:d(B,N)&&(B=N),B=F?m(B):B,ie=i(ie,B),D&&d(c(ie),D)?ie=b?D:h(D):O&&f(c(ie),O)&&(ie=b?O:h(O)),se++,se>P)throw Error(`Maximum number of iterations reached, try changing options`)}return{t:ae,y:I}}}function _(e,t,n,r){return g({a:[[],[1/2],[0,3/4],[2/9,1/3,4/9]],c:[null,1/2,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,t,n,r)}function v(e,t,n,r){return g({a:[[],[1/5],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,1/5,3/10,4/5,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,t,n,r)}function y(e,t,n,r){var i=r.method?r.method:`RK45`,a={RK23:_,RK45:v};if(i.toUpperCase()in a){var o=td({},r);return delete o.method,a[i.toUpperCase()](e,t,n,o)}else{var s=Object.keys(a).map(e=>`"${e}"`),c=`${s.slice(0,-1).join(`, `)} and ${s.slice(-1)}`;throw Error(`Unavailable method "${i}". Available methods are ${c}`)}}function S(e){return e?f:d}function C(e){var t=e?d:f;return function(e,i,a){return t(n(e,a),i)?r(i,e):a}}function w(e){return x(e)||b(e)}function E(e,t,n,r){var i=y(e,t.toArray(),n.toArray(),r);return{t:p(i.t),y:p(i.y)}}return t(`solveODE`,{"function, Array, Array, Object":y,"function, Matrix, Matrix, Object":E,"function, Array, Array":(e,t,n)=>y(e,t,n,{}
11),"function, Matrix, Matrix":(e,t,n)=>E(e,t,n,{}),"function, Array, number | BigNumber | Unit":(e,t,n)=>{var r=y(e,t,[n],{});return{t:r.t,y:r.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit":(e,t,n)=>{var r=y(e,t.toArray(),[n],{});return{t:p(r.t),y:p(r.y.map(e=>e[0]))}},"function, Array, number | BigNumber | Unit, Object":(e,t,n,r)=>{var i=y(e,t,[n],r);return{t:i.t,y:i.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,n,r)=>{var i=y(e,t.toArray(),[n],r);return{t:p(i.t),y:p(i.y.map(e=>e[0]))}}})}),rd=W(`erf`,[`typed`],e=>{var{typed:t}=e;return t(`name`,{number:function(e){var t=Math.abs(e);return t>=cd?Ue(e):t<=id?Ue(e)*n(t):t<=4?Ue(e)*(1-r(t)):Ue(e)*(1-i(t))},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))});function n(e){var t=e*e,n=od[0][4]*t,r=t,i;for(i=0;i<3;i+=1)n=(n+od[0][i])*t,r=(r+sd[0][i])*t;return e*(n+od[0][3])/(r+sd[0][3])}function r(e){var t=od[1][8]*e,n=e,r;for(r=0;r<7;r+=1)t=(t+od[1][r])*e,n=(n+sd[1][r])*e;var i=(t+od[1][7])/(n+sd[1][7]),a=parseInt(e*16)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}function i(e){var t=1/(e*e),n=od[2][5]*t,r=t,i;for(i=0;i<4;i+=1)n=(n+od[2][i])*t,r=(r+sd[2][i])*t;var a=t*(n+od[2][4])/(r+sd[2][4]);a=(ad-a)/e,t=parseInt(e*16)/16;var o=(e-t)*(e+t);return Math.exp(-t*t)*Math.exp(-o)*a}}),id=.46875,ad=.5641895835477563,od=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],sd=[[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]],cd=2**53,ld=`zeta`,ud=W(ld,[`typed`,`config`,`multiply`,`pow`,`divide`,`factorial`,`equal`,`smallerEq`,`isBounded`,`isNegative`,`gamma`,`sin`,`subtract`,`add`,`?Complex`,`?BigNumber`,`pi`],e=>{var{typed:t,config:n,multiply:r,pow:i,divide:a,factorial:o,equal:s,smallerEq:c,isBounded:l,isNegative:u,gamma:d,sin:f,subtract:p,add:m,Complex:h,BigNumber:g,pi:_}=e;return t(ld,{number:e=>v(e,e=>e,()=>20),BigNumber:e=>v(e,e=>new g(e),()=>Math.abs(Math.log10(n.relTol))),Complex:y});function v(e,t,n){return s(e,0)?t(-.5):s(e,1)?t(NaN):l(e)?b(e,t,n,e=>e):u(e)?t(NaN):t(1)}function y(e){return e.re===0&&e.im===0?new h(-.5):e.re===1?new h(NaN,NaN):e.re===1/0&&e.im===0?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):b(e,e=>e,e=>Math.round(1.3*15+.9*Math.abs(e.im)),e=>e.re)}function b(e,t,n,o){var s=n(e);if(o(e)>-(s-1)/2)return S(e,t(s),t);var c=r(i(2,e),i(t(_),p(e,1)));return c=r(c,f(r(a(t(_),2),e))),c=r(c,d(p(1,e))),r(c,b(p(1,e),t,n,o))}function x(e,t){for(var n=e,s=e;c(s,t);s=m(s,1)){var l=a(r(o(m(t,p(s,1))),i(4,s)),r(o(p(t,s)),o(r(2,s))));n=m(n,l)}return r(t,n)}function S(e,t,n){for(var o=a(1,r(x(n(0),t),p(1,i(2,p(1,e))))),s=n(0),l=n(1);c(l,t);l=m(l,1))s=m(s,a(r((-1)**(l-1),x(l,t)),i(l,e)));return r(o,s)}}),dd=`mode`,fd=W(dd,[`typed`,`isNaN`,`isNumeric`],e=>{var{typed:t,isNaN:n,isNumeric:r}=e;return t(dd,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(e=yi(e.valueOf()),e.length===0)throw Error(`Cannot calculate mode of an empty array`);for(var t={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(r(s)&&n(s))throw Error(`Cannot calculate mode of an array containing NaN values`);s in t||(t[s]=0),t[s]++,t[s]===a?i.push(s):t[s]>a&&(a=t[s],i=[s])}return i}});function pd(e,t,n){var r;return String(e).includes(`Unexpected type`)?(r=arguments.length>2?` (type: `+Ce(n)+`, value: `+JSON.stringify(n)+`)`:` (type: `+e.data.actual+`)`,TypeError(`Cannot calculate `+t+`, unexpected type of argument`+r)):String(e).includes(`complex numbers`)?(r=arguments.length>2?` (type: `+Ce(n)+`, value: `+JSON.stringify(n)+`)`:``,TypeError(`Cannot calculate `+t+`, no ordering relation is defined for c
11omplex numbers`+r)):e}var md=`prod`,hd=W(md,[`typed`,`config`,`multiplyScalar`,`numeric`],e=>{var{typed:t,config:n,multiplyScalar:r,numeric:i}=e;return t(md,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw Error(`prod(A, dim) is not yet supported`)},"...":function(e){return a(e)}});function a(e){var t;if(Yi(e,function(e){try{t=t===void 0?e:r(t,e)}catch(t){throw pd(t,`prod`,e)}}),typeof t==`string`&&(t=i(t,He(t,n))),t===void 0)throw Error(`Cannot calculate prod of an empty array`);return t}}),gd=`format`,_d=W(gd,[`typed`],e=>{var{typed:t}=e;return t(gd,{any:qr,"any, Object | function | number | BigNumber":qr})}),vd=`bin`,yd=W(vd,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(vd,{"number | BigNumber":function(e){return n(e,{notation:`bin`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`bin`,wordSize:t})}})}),bd=`oct`,xd=W(bd,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(bd,{"number | BigNumber":function(e){return n(e,{notation:`oct`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`oct`,wordSize:t})}})}),Sd=`hex`,Cd=W(Sd,[`typed`,`format`],e=>{var{typed:t,format:n}=e;return t(Sd,{"number | BigNumber":function(e){return n(e,{notation:`hex`})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:`hex`,wordSize:t})}})}),wd=/\$([\w.]+)/g,Td=`print`,Ed=W(Td,[`typed`],e=>{var{typed:t}=e;return t(Td,{"string, Object | Array":Dd,"string, Object | Array, number | Object":Dd})});function Dd(e,t,n){return e.replace(wd,function(e,r){var i=r.split(`.`),a=t[i.shift()];for(a!==void 0&&a.isMatrix&&(a=a.toArray());i.length&&a!==void 0;){var o=i.shift();a=o?a[o]:a+`.`}return a===void 0?e:E(a)?a:qr(a,n)})}var Od=`to`,kd=W(Od,[`typed`,`matrix`,`concat`],e=>{var{typed:t,matrix:n,concat:r}=e;return t(Od,{"Unit, Unit | string":(e,t)=>e.to(t)},xc({typed:t,matrix:n,concat:r})({Ds:!0}))}),Ad=`toBest`,jd=W(Ad,[`typed`],e=>{var{typed:t}=e;return t(Ad,{Unit:e=>e.toBest(),"Unit, string":(e,t)=>e.toBest(t.split(`,`)),"Unit, string, Object":(e,t,n)=>e.toBest(t.split(`,`),n),"Unit, Array":(e,t)=>e.toBest(t),"Unit, Array, Object":(e,t,n)=>e.toBest(t,n)})}),Md=`isPrime`,Nd=W(Md,[`typed`],e=>{var{typed:t}=e;return t(Md,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t===0||e%(t+2)===0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n==0n||e%3n==0n)return!1;for(var t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(2**32)){for(var t=e.toNumber(),n=5;n*n<=t;n+=6)if(t%n===0||t%(n+2)===0)return!1;return!0}function r(e,t,n){for(var r=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(n)):(t=t.sub(1),r=e.mul(r).mod(n));return r}e=new(e.constructor.clone({precision:e.toFixed(0).length*2}))(e);for(var i=0,a=e.sub(1);a.mod(2).eq(0);)a=a.div(2),i+=1;var o=null;if(e.lt(`3317044064679887385961981`))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(t=>t<e);else{var s=Math.min(e.toNumber()-2,Math.floor(2*(e.toFixed(0).length*Math.log(10))**2));o=[];for(var c=2;c<=s;c+=1)o.push(s)}for(var l=0;l<o.length;l+=1){var u=o[l],d=r(e.sub(e).add(u),a,e);if(!d.eq(1)){for(var f=0,p=d;!p.eq(e.sub(1));f+=1,p=p.mul(p).mod(e))if(f===i-1)return!1}}return!0},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Pd=W(`numeric`,[`number`,`?bignumber`,`?fraction`],e=>{var{number:t,bignumber:n,fraction:r}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>t(e),BigNumber:n?e=>n(e):gu,bigint:e=>BigInt(e),Fraction:r?e=>r(e):_u};return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`number`;if((arguments.length>2?arguments[2]:void 0)!==void 0)throw SyntaxError(`numeric() takes one or two arguments`);var n=Ce(e);if(!(n in i))throw TypeError(`Cannot convert `+e+` of type "`+n+`"; valid input types are `+Object.keys(i).join(`, `));if(!(t in a))throw TypeError(`Cannot convert `+e+` to type "`+t+`"; valid output types are `+Object.keys(a).join(`, `));return t===n?e:a[t](e)}}),Fd=`divideScalar`,Id=W(Fd,[`typed`,`numeric`],e=>{var{typed:t,numeric:n}=e;return t(Fd,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),Ld=`pow`,Rd=W(Ld,[`typed`,`config`,`identity`,`multiply`,`matrix`,`inv`,`fraction`,`number`,`Complex`],e=>{var{typed:t,config:n,identity:r,multiply:i,matrix:a,inv:o,number:s,fraction:c,Complex:l}=e;return t(Ld,{"number, number":u,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||n.predictable?e.pow(t):new l(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){var r=e.pow(t);if(r!=null)return r;if(n.predictable)throw Error(`Result of pow is non-rational and cannot be expressed as a fraction`);return u(e.valueOf(),t.valueOf())},"Array, number":d,"Array, BigNumber":function(e,t){return d(e,t.toNumber())}
11,"Matrix, number":f,"Matrix, BigNumber":function(e,t){return f(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function u(e,t){if(n.predictable&&!G(t)&&e<0)try{var r=c(t),i=s(r);if((t===i||Math.abs((t-i)/t)<1e-14)&&r.d%2n==1n)return(r.n%2n==0n?1:-1)*(-e)**+t}catch{}return n.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:G(t)||e>=0||n.predictable?Da(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new l(e,0).pow(t,0)}function d(e,t){if(!G(t))throw TypeError(`For A^b, b must be an integer (value is `+t+`)`);var n=ri(e);if(n.length!==2)throw Error(`For A^b, A must be 2 dimensional (A has `+n.length+` dimensions)`);if(n[0]!==n[1])throw Error(`For A^b, A must be square (size is `+n[0]+`x`+n[1]+`)`);if(t<0)try{return d(o(e),-t)}catch(e){throw e.message===`Cannot calculate inverse, determinant is zero`?TypeError(`For A^b, when A is not invertible, b must be a positive integer (value is `+t+`)`):e}for(var a=r(n[0]).valueOf(),s=e;t>=1;)(t&1)==1&&(a=i(s,a)),t>>=1,s=i(s,s);return a}function f(e,t){return a(d(e.valueOf(),t))}}),zd=`Number of decimals in function round must be an integer`,Bd=`round`,Vd=W(Bd,[`typed`,`config`,`matrix`,`equalScalar`,`zeros`,`BigNumber`,`DenseMatrix`],e=>{var{typed:t,config:n,matrix:r,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,c=Ks({typed:t,equalScalar:i}),l=qs({typed:t,DenseMatrix:s}),u=Js({typed:t});function d(e){return Math.abs(Qe(e).exponent)}return t(Bd,{number:function(e){var t=Oa(e,d(n.relTol));return Oa(ot(e,t,n.relTol,n.absTol)?t:e)},"number, number":function(e,t){var r=d(n.relTol);if(t>=r)return Oa(e,t);var i=Oa(e,r);return Oa(ot(e,i,n.relTol,n.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(zd);return new o(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw TypeError(zd);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(zd);var n=t.toNumber();return e.round(n)},BigNumber:function(e){var t=new o(e).toDecimalPlaces(d(n.relTol));return(Lo(e,t,n.relTol,n.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(zd);var r=d(n.relTol);if(t>=r)return e.toDecimalPlaces(t.toNumber());var i=e.toDecimalPlaces(r);return(Lo(e,i,n.relTol,n.absTol)?i:e).toDecimalPlaces(t.toNumber())},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw TypeError(zd);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw TypeError(zd);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf(e=>function(t,n,r){var i=t.toNumeric(r);return r.multiply(e(i,n))}),"Unit, BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>e(t,n.toNumber(),r)),"Array | Matrix, number | BigNumber, Unit":t.referToSelf(e=>(t,n,r)=>Xi(t,t=>e(t,n,r),!0)),"Array | Matrix | Unit, Unit":t.referToSelf(e=>(t,n)=>e(t,0,n)),"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e,!0)),"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>c(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>u(t,n,e,!1)),"Array, number | BigNumber":t.referToSelf(e=>(t,n)=>u(r(t),n,e,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf(e=>(t,n)=>i(t,0)?a(n.size(),n.storage()):l(n,t,e,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf(e=>(t,n)=>i(t,0)?a(n.size(),n.storage()):u(n,t,e,!0)),"number | Complex | BigNumber | Fraction, Array":t.referToSelf(e=>(t,n)=>u(r(n),t,e,!0).valueOf())})}),Hd=`log`,Ud=[`config`,`typed`,`typeOf`,`divideScalar`,`Complex`],Wd=Math.log(16),Gd=W(Hd,Ud,e=>{var{typed:t,typeOf:n,config:r,divideScalar:i,Complex:a}=e;function o(e){return e.log()}function s(e){return o(new a(e,0))}return t(Hd,{number:function(e){return e>=0||r.predictable?_a(e):s(e)},bigint:Lc(Wd,_a,r,s),Complex:o,BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():s(e.toNumber())},"any, any":t.referToSelf(e=>(t,r)=>{if(n(t)===`Fraction`&&n(r)===`Fraction`){var a=t.log(r);if(a!==null)return a}return i(e(t),e(r))})})}),Kd=`log1p`,qd=W(Kd,[`typed`,`config`,`divideScalar`,`log`,`Complex`],e=>{var{typed:t,config:n,divideScalar:r,log:i,Complex:a}=e;return t(Kd,{number:function(e){return e>=-1||n.predictable?Ke(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||n.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e)),"any, any":t.referToSelf(e=>(t,n)=>r(e(t),i(n)))});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}}),Jd=`nthRoots`,Yd=W(Jd,[`config`,`typed`,`divideScalar`,`Complex`],e=>{var{typed:t,config:n,divideScalar:r,Complex:i}=e,a=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function o(e,t){if(t<0)throw Error(`Root must be greater than zero`);if(t===0)throw Error(`Root must be non-zero`);if(t%1!=0)throw Error(`Root must be an integer`);if(e===0||e.abs()===0)return[new i(0,0)];var n=typeof e==`number`,r;(n||e.re===0||e.im===0)&&(r=n?2*(e<0):e.im===0?2*(e.re<0):2*(e.im<0)+1);for(var o=e.arg(),s=e.abs(),c=[],l=s**(1/t),u=0;u<t;u++){var d=(r+4*u)/t;if(d===Math.round(d)){c.push(a[d%4](l));continue}c.push(new i({r:l,phi:(o+2*Math.PI*u)/t}))}return c}return t(Jd,{Complex:function(e){return o(e,2)},"Complex, number":o})}),Xd=`dotPow`,Zd=W(Xd,[`typed`,`equalScalar`,`matrix`,`pow`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,equalScalar:n,matrix:r,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=gc({typed:t}),l=Cl({typed:t,SparseMatrix:s}),u=Ks({typed:t,equalScalar:n}),d=qs({typed:t,DenseMatrix:a}),f=xc({typed:t,matrix:r,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes(`Matr
11ix`)&&!m.includes(`Array`)&&(p[m]=i.signatures[m]);return t(Xd,f({elop:t(p),SS:l,DS:c,Ss:u,sS:d}))}),Qd=`dotDivide`,$d=W(Qd,[`typed`,`matrix`,`equalScalar`,`divideScalar`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,matrix:n,equalScalar:r,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=hc({typed:t,equalScalar:r}),l=gc({typed:t}),u=Cl({typed:t,SparseMatrix:s}),d=Ks({typed:t,equalScalar:r}),f=qs({typed:t,DenseMatrix:a});return t(Qd,xc({typed:t,matrix:n,concat:o})({elop:i,SS:u,DS:l,SD:c,Ss:d,sS:f}))});function ef(e){var{DenseMatrix:t}=e;return function(e,n,r){var i=e.size();if(i.length!==2)throw RangeError(`Matrix must be two dimensional (size: `+qr(i)+`)`);var a=i[0];if(a!==i[1])throw RangeError(`Matrix must be square (size: `+qr(i)+`)`);var o=[];if(O(n)){var s=n.size(),c=n._data;if(s.length===1){if(s[0]!==a)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var l=0;l<a;l++)o[l]=[c[l]];return new t({data:o,size:[a,1],datatype:n._datatype})}if(s.length===2){if(s[0]!==a||s[1]!==1)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);if(A(n)){if(r){o=[];for(var u=0;u<a;u++)o[u]=[c[u][0]];return new t({data:o,size:[a,1],datatype:n._datatype})}return n}if(j(n)){for(var d=0;d<a;d++)o[d]=[0];for(var f=n._values,p=n._index,m=n._ptr,h=m[1],g=m[0];g<h;g++){var _=p[g];o[_][0]=f[g]}return new t({data:o,size:[a,1],datatype:n._datatype})}}throw RangeError(`Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.`)}if(D(n)){var v=ri(n);if(v.length===1){if(v[0]!==a)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var y=0;y<a;y++)o[y]=[n[y]];return new t({data:o,size:[a,1]})}if(v.length===2){if(v[0]!==a||v[1]!==1)throw RangeError(`Dimension mismatch. Matrix columns must match vector length.`);for(var b=0;b<a;b++)o[b]=[n[b][0]];return new t({data:o,size:[a,1]})}throw RangeError(`Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.`)}}}var tf=`lsolve`,nf=W(tf,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ef({DenseMatrix:s});return t(tf,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).valueOf()}});function l(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=[],f=e._data,p=0;p<u;p++){var m=n[p][0]||0,h=void 0;if(o(m,0))h=0;else{var g=f[p][p];if(o(g,0))throw Error(`Linear system cannot be solved since matrix is singular`);h=r(m,g);for(var _=p+1;_<l;_++)n[_]=[a(n[_][0]||0,i(h,f[_][p]))]}d[p]=[h]}return new s({data:d,size:[l,1]})}function u(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=[],h=0;h<u;h++){var g=n[h][0]||0;if(o(g,0))m[h]=[0];else{for(var _=0,v=[],y=[],b=p[h],x=p[h+1],S=b;S<x;S++){var C=f[S];C===h?_=d[S]:C>h&&(v.push(d[S]),y.push(C))}if(o(_,0))throw Error(`Linear system cannot be solved since matrix is singular`);for(var w=r(g,_),T=0,E=y.length;T<E;T++){var D=y[T];n[D]=[a(n[D][0]||0,i(w,v[T]))]}m[h]=[w]}}return new s({data:m,size:[l,1]})}}),rf=`usolve`,af=W(rf,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ef({DenseMatrix:s});return t(rf,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).valueOf()}});function l(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=[],f=e._data,p=u-1;p>=0;p--){var m=n[p][0]||0,h=void 0;if(o(m,0))h=0;else{var g=f[p][p];if(o(g,0))throw Error(`Linear system cannot be solved since matrix is singular`);h=r(m,g);for(var _=p-1;_>=0;_--)n[_]=[a(n[_][0]||0,i(h,f[_][p]))]}d[p]=[h]}return new s({data:d,size:[l,1]})}function u(e,t){t=c(e,t,!0);for(var n=t._data,l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=[],h=u-1;h>=0;
11h--){var g=n[h][0]||0;if(o(g,0))m[h]=[0];else{for(var _=0,v=[],y=[],b=p[h],x=p[h+1]-1;x>=b;x--){var S=f[x];S===h?_=d[x]:S<h&&(v.push(d[x]),y.push(S))}if(o(_,0))throw Error(`Linear system cannot be solved since matrix is singular`);for(var C=r(g,_),w=0,T=y.length;w<T;w++){var E=y[w];n[E]=[a(n[E][0],i(C,v[w]))]}m[h]=[C]}}return new s({data:m,size:[l,1]})}}),of=`lsolveAll`,sf=W(of,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ef({DenseMatrix:s});return t(of,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).map(e=>e.valueOf())}});function l(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._data,u=e._size[0],d=e._size[1],f=0;f<d;f++)for(var p=n.length,m=0;m<p;m++){var h=n[m];if(!o(l[f][f],0)){h[f]=r(h[f],l[f][f]);for(var g=f+1;g<d;g++)h[g]=a(h[g],i(h[f],l[g][f]))}else if(!o(h[f],0)){if(m===0)return[];n.splice(m,1),--m,--p}else if(m===0){var _=[...h];_[f]=1;for(var v=f+1;v<d;v++)_[v]=a(_[v],l[v][f]);n.push(_)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[u,1]}))}function u(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=0;m<u;m++)for(var h=n.length,g=0;g<h;g++){for(var _=n[g],v=[],y=[],b=p[m],x=p[m+1],S=0,C=b;C<x;C++){var w=f[C];w===m?S=d[C]:w>m&&(v.push(d[C]),y.push(w))}if(!o(S,0)){_[m]=r(_[m],S);for(var T=0,E=y.length;T<E;T++){var D=y[T];_[D]=a(_[D],i(_[m],v[T]))}}else if(!o(_[m],0)){if(g===0)return[];n.splice(g,1),--g,--h}else if(g===0){var O=[..._];O[m]=1;for(var k=0,A=y.length;k<A;k++){var j=y[k];O[j]=a(O[j],v[k])}n.push(O)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),cf=`usolveAll`,lf=W(cf,[`typed`,`matrix`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`equalScalar`,`DenseMatrix`],e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,c=ef({DenseMatrix:s});return t(cf,{"SparseMatrix, Array | Matrix":function(e,t){return u(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return l(e,t)},"Array, Array | Matrix":function(e,t){return l(n(e),t).map(e=>e.valueOf())}});function l(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._data,u=e._size[0],d=e._size[1]-1;d>=0;d--)for(var f=n.length,p=0;p<f;p++){var m=n[p];if(!o(l[d][d],0)){m[d]=r(m[d],l[d][d]);for(var h=d-1;h>=0;h--)m[h]=a(m[h],i(m[d],l[h][d]))}else if(!o(m[d],0)){if(p===0)return[];n.splice(p,1),--p,--f}else if(p===0){var g=[...m];g[d]=1;for(var _=d-1;_>=0;_--)g[_]=a(g[_],l[_][d]);n.push(g)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[u,1]}))}function u(e,t){for(var n=[c(e,t,!0)._data.map(e=>e[0])],l=e._size[0],u=e._size[1],d=e._values,f=e._index,p=e._ptr,m=u-1;m>=0;m--)for(var h=n.length,g=0;g<h;g++){for(var _=n[g],v=[],y=[],b=p[m],x=p[m+1],S=0,C=x-1;C>=b;C--){var w=f[C];w===m?S=d[C]:w<m&&(v.push(d[C]),y.push(w))}if(!o(S,0)){_[m]=r(_[m],S);for(var T=0,E=y.length;T<E;T++){var D=y[T];_[D]=a(_[D],i(_[m],v[T]))}}else if(!o(_[m],0)){if(g===0)return[];n.splice(g,1),--g,--h}else if(g===0){var O=[..._];O[m]=1;for(var k=0,A=y.length;k<A;k++){var j=y[k];O[j]=a(O[j],v[k])}n.push(O)}}return n.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),uf=W(`matAlgo08xS0Sid`,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var a=e._values,o=e._index,s=e._ptr,c=e._size,l=e._datatype||e._data===void 0?e._datatype:e.getDataType(),u=r._values,d=r._index,f=r._ptr,p=r._size,m=r._datatype||r._data===void 0?r._datatype:r.getDataType();if(c.length!==p.length)throw new ti(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw RangeError(`Dimension mismatch. Matrix A (`+c+`) must match Matrix B (`+p+`)`);if(!a||!u)throw Error(`Cannot perform operation on Pattern Sparse Matrices`);var h=c[0],g=c[1],_,v=n,y=0,b=i;typeof l==`string`&&l===m&&l!==`mixed`&&(_=l,v=t.find(n,[_,_]),y=t.convert(0,_),b=t.find(i,[_,_]));for(var x=[],S=[],C=[],w=[],T=[],E,D,O,k,A=0;A<g;A++){C[A]=S.length;var j=A+1;for(D=s[A],O=s[A+1],E=D;E<O;E++)k=o[E],T[k]=j,w[k]=a[E],S.push(k);for(D=f[A],O=f[A+1],E=D;E<O;E++)k=d[E],T[k]===j&&(w[k]=b(w[k],u[E]));for(E=C[A];E<S.length;){k=S[E];var M=w[k];v(M,y)?S.splice(E,1):(x.push(M),E++)}}return C[g]=S.length,e.createSparseMatrix({values:x,index:S,ptr:C,size:[h,g],datatype:l===e._datatype&&m===r._datatype?_:void 0})}}),df=W(`useMatrixForArrayScalar`,[`typed`,`matrix`],e=>{var{typed:t,matrix:n}=e;return{"Array, number":t.referTo(`DenseMatrix, number`,e=>(t,r)=>e(n(t),r).valueOf()),"Array, BigNumber":t.referTo(`DenseMatrix, BigNumber`,e=>(t,r)=>e(n(t),r).valueOf()),"number, Array":t.referTo(`number, DenseMatrix`,e=>(t,r)=>e(t,n(r)).valueOf()),"BigNumber, Array":t.referTo(`BigNumber, DenseMatrix`,e=>(t,r)=>e(t,n(r)).valueOf())}}),ff=`leftShift`,pf=W(ff,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=wc({typed:t}),c=hc({typed:t,equalScalar:r}),l=uf({typed:t,equalScalar:r}),u=Ec({typed:t,DenseMatrix:a}),d=Ks({typed:t,equalScalar:r}),f=Js({typed:t}),p=xc({typed:t,matrix:n,concat:o}),m=df({typed:t,matrix:n});return t(ff,{"number, number":Ia,"BigNumber, BigNumber":hl,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>
11r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),mf=`rightArithShift`,hf=W(mf,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=wc({typed:t}),c=hc({typed:t,equalScalar:r}),l=uf({typed:t,equalScalar:r}),u=Ec({typed:t,DenseMatrix:a}),d=Ks({typed:t,equalScalar:r}),f=Js({typed:t}),p=xc({typed:t,matrix:n,concat:o}),m=df({typed:t,matrix:n});return t(mf,{"number, number":La,"BigNumber, BigNumber":gl,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),gf=`rightLogShift`,_f=W(gf,[`typed`,`matrix`,`equalScalar`,`zeros`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=e,s=wc({typed:t}),c=hc({typed:t,equalScalar:r}),l=uf({typed:t,equalScalar:r}),u=Ec({typed:t,DenseMatrix:a}),d=Ks({typed:t,equalScalar:r}),f=Js({typed:t}),p=xc({typed:t,matrix:n,concat:o}),m=df({typed:t,matrix:n});return t(gf,{"number, number":Ra,"SparseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():d(t,n,e,!1)),"DenseMatrix, number | BigNumber":t.referToSelf(e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1)),"number | BigNumber, SparseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):u(n,t,e,!0)),"number | BigNumber, DenseMatrix":t.referToSelf(e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):f(n,t,e,!0))},m,p({SS:l,DS:s,SD:c}))}),vf=`and`,yf=W(vf,[`typed`,`matrix`,`equalScalar`,`zeros`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=hc({typed:t,equalScalar:r}),c=Pc({typed:t,equalScalar:r}),l=Ks({typed:t,equalScalar:r}),u=Js({typed:t}),d=xc({typed:t,matrix:n,concat:o});return t(vf,{"number, number":Xa,"Complex, Complex":function(e,t){return(e.re!==0||e.im!==0)&&(t.re!==0||t.im!==0)},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!t.isZero()&&!e.isNaN()&&!t.isNaN()},"bigint, bigint":Xa,"Unit, Unit":t.referToSelf(e=>(t,n)=>e(t.value||0,n.value||0)),"SparseMatrix, any":t.referToSelf(e=>(t,n)=>a(n)?i(t.size(),t.storage()):l(t,n,e,!1)),"DenseMatrix, any":t.referToSelf(e=>(t,n)=>a(n)?i(t.size(),t.storage()):u(t,n,e,!1)),"any, SparseMatrix":t.referToSelf(e=>(t,n)=>a(t)?i(t.size(),t.storage()):l(n,t,e,!0)),"any, DenseMatrix":t.referToSelf(e=>(t,n)=>a(t)?i(t.size(),t.storage()):u(n,t,e,!0)),"Array, any":t.referToSelf(e=>(t,r)=>e(n(t),r).valueOf()),"any, Array":t.referToSelf(e=>(t,r)=>e(t,n(r)).valueOf())},d({SS:c,DS:s}))}),bf=`compare`,xf=W(bf,[`typed`,`config`,`matrix`,`equalScalar`,`BigNumber`,`Fraction`,`DenseMatrix`,`concat`],e=>{var{typed:t,config:n,equalScalar:r,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:c}=e,l=gc({typed:t}),u=_c({typed:t,equalScalar:r}),d=qs({typed:t,DenseMatrix:s}),f=xc({typed:t,matrix:i,concat:c}),p=rs({typed:t});return t(bf,Sf({typed:t,config:n}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return Lo(e,t,n.relTol,n.absTol)?new a(0):new a(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},p,f({SS:u,DS:l,Ss:d}))}),Sf=W(bf,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(bf,{"number, number":function(e,t){return ot(e,t,n.relTol,n.absTol)?0:e>t?1:-1}})}),Cf=e(n(((e,t)=>{t.exports=function e(t,n){var r=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,c=function(t){return e.insensitive&&(``+t).toLowerCase()||``+t},l=c(t).replace(i,``)||``,u=c(n).replace(i,``)||``,d=l.replace(r,`\0$1\0`).replace(/\0$/,``).replace(/^\0/,``).split(`\0`),f=u.replace(r,`\0$1\0`).replace(/\0$/,``).replace(/^\0/,``).split(`\0`),p=parseInt(l.match(o),16)||d.length!==1&&l.match(a)&&Date.parse(l),m=parseInt(u.match(o),16)||p&&u.match(a)&&Date.parse(u)||null,h,g;if(m){if(p<m)return-1;if(p>m)return 1}
11for(var _=0,v=Math.max(d.length,f.length);_<v;_++){if(h=!(d[_]||``).match(s)&&parseFloat(d[_])||d[_]||0,g=!(f[_]||``).match(s)&&parseFloat(f[_])||f[_]||0,isNaN(h)!==isNaN(g))return isNaN(h)?1:-1;if(typeof h!=typeof g&&(h+=``,g+=``),h<g)return-1;if(h>g)return 1}return 0}}))(),1),wf=`compareNatural`,Tf=W(wf,[`typed`,`compare`],e=>{var{typed:t,compare:n}=e,r=n.signatures[`boolean,boolean`];return t(wf,{"any, any":i});function i(e,t){var c=Ce(e),l=Ce(t),u;if((c===`number`||c===`BigNumber`||c===`Fraction`||c===`bigint`)&&(l===`number`||l===`BigNumber`||l===`Fraction`||l===`bigint`))return u=n(e,t),u.toString()===`0`?(0,Cf.default)(c,l):u>0?1:-1;var d=[`Array`,`DenseMatrix`,`SparseMatrix`];if(d.includes(c)||d.includes(l))return u=a(i,e,t),u===0?(0,Cf.default)(c,l):u;if(c!==l)return(0,Cf.default)(c,l);if(c===`Complex`)return Ef(e,t);if(c===`Unit`)return e.equalBase(t)?i(e.value,t.value):o(i,e.formatUnits(),t.formatUnits());if(c===`boolean`)return r(e,t);if(c===`string`)return(0,Cf.default)(e,t);if(c===`Object`)return s(i,e,t);if(c===`null`||c===`undefined`)return 0;throw TypeError(`Unsupported type of value "`+c+`"`)}function a(e,t,n){return j(t)&&j(n)?o(e,t.toJSON().values,n.toJSON().values):j(t)?a(e,t.toArray(),n):j(n)?a(e,t,n.toArray()):A(t)?a(e,t.toJSON().data,n):A(n)?a(e,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?o(e,t,n):a(e,t,[n]):a(e,[t],n)}function o(e,t,n){for(var r=0,i=Math.min(t.length,n.length);r<i;r++){var a=e(t[r],n[r]);if(a!==0)return a}return t.length>n.length?1:t.length<n.length?-1:0}function s(e,t,n){var r=Object.keys(t),i=Object.keys(n);r.sort(Cf.default),i.sort(Cf.default);var a=o(e,r,i);if(a!==0)return a;for(var s=0;s<r.length;s++){var c=e(t[r[s]],n[i[s]]);if(c!==0)return c}return 0}});function Ef(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}var Df=`compareText`,Of=[`typed`,`matrix`,`concat`];ei.signature=`any, any`;var kf=W(Df,Of,e=>{var{typed:t,matrix:n,concat:r}=e;return t(Df,ei,xc({typed:t,matrix:n,concat:r})({elop:ei,Ds:!0}))}),Af=`equal`,jf=W(Af,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`SparseMatrix`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=gc({typed:t}),c=Cl({typed:t,SparseMatrix:o}),l=qs({typed:t,DenseMatrix:i}),u=xc({typed:t,matrix:n});return t(Af,Mf({typed:t,equalScalar:r}),u({elop:r,SS:c,DS:s,Ss:l}))}),Mf=W(Af,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(Af,{"any, any":function(e,t){return e===null?t===null:t===null?e===null:e===void 0?t===void 0:t===void 0?e===void 0:n(e,t)}})}),Nf=`equalText`,Pf=W(Nf,[`typed`,`compareText`,`isZero`],e=>{var{typed:t,compareText:n,isZero:r}=e;return t(Nf,{"any, any":function(e,t){return r(n(e,t))}})}),Ff=`smaller`,If=W(Ff,[`typed`,`config`,`bignumber`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=gc({typed:t}),l=Cl({typed:t,SparseMatrix:s}),u=qs({typed:t,DenseMatrix:a}),d=xc({typed:t,matrix:i,concat:o}),f=rs({typed:t});function p(e,t){return e.lt(t)&&!Lo(e,t,n.relTol,n.absTol)}return t(Ff,Lf({typed:t,config:n}),{"boolean, boolean":(e,t)=>
11e<t,"BigNumber, BigNumber":p,"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>e.compare(t)===-1,"Fraction, BigNumber":function(e,t){return p(r(e),t)},"BigNumber, Fraction":function(e,t){return p(e,r(t))},"Complex, Complex":function(e,t){throw TypeError(`No ordering relation is defined for complex numbers`)}},f,d({SS:l,DS:c,Ss:u}))}),Lf=W(Ff,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Ff,{"number, number":function(e,t){return e<t&&!ot(e,t,n.relTol,n.absTol)}})}),Rf=`smallerEq`,zf=W(Rf,[`typed`,`config`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=gc({typed:t}),c=Cl({typed:t,SparseMatrix:o}),l=qs({typed:t,DenseMatrix:i}),u=xc({typed:t,matrix:r,concat:a}),d=rs({typed:t});return t(Rf,Bf({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||Lo(e,t,n.relTol,n.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>e.compare(t)!==1,"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},d,u({SS:c,DS:s,Ss:l}))}),Bf=W(Rf,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Rf,{"number, number":function(e,t){return e<=t||ot(e,t,n.relTol,n.absTol)}})}),Vf=`larger`,Hf=W(Vf,[`typed`,`config`,`bignumber`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=gc({typed:t}),l=Cl({typed:t,SparseMatrix:s}),u=qs({typed:t,DenseMatrix:a}),d=xc({typed:t,matrix:i,concat:o}),f=rs({typed:t});function p(e,t){return e.gt(t)&&!Lo(e,t,n.relTol,n.absTol)}return t(Vf,Uf({typed:t,config:n}),{"boolean, boolean":(e,t)=>
11e>t,"BigNumber, BigNumber":p,"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>e.compare(t)===1,"Fraction, BigNumber":function(e,t){return p(r(e),t)},"BigNumber, Fraction":function(e,t){return p(e,r(t))},"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},f,d({SS:l,DS:c,Ss:u}))}),Uf=W(Vf,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Vf,{"number, number":function(e,t){return e>t&&!ot(e,t,n.relTol,n.absTol)}})}),Wf=`largerEq`,Gf=W(Wf,[`typed`,`config`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,matrix:r,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=gc({typed:t}),c=Cl({typed:t,SparseMatrix:o}),l=qs({typed:t,DenseMatrix:i}),u=xc({typed:t,matrix:r,concat:a}),d=rs({typed:t});return t(Wf,Kf({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||Lo(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>e.compare(t)!==-1,"Complex, Complex":function(){throw TypeError(`No ordering relation is defined for complex numbers`)}},d,u({SS:c,DS:s,Ss:l}))}),Kf=W(Wf,[`typed`,`config`],e=>{var{typed:t,config:n}=e;return t(Wf,{"number, number":function(e,t){return e>=t||ot(e,t,n.relTol,n.absTol)}})}),qf=`deepEqual`,Jf=W(qf,[`typed`,`equal`],e=>{var{typed:t,equal:n}=e;return t(qf,{"any, any":function(e,t){return r(e.valueOf(),t.valueOf())}});function r(e,t){if(Array.isArray(e))if(Array.isArray(t)){var i=e.length;if(i!==t.length)return!1;for(var a=0;a<i;a++)if(!r(e[a],t[a]))return!1;return!0}else return!1;else if(Array.isArray(t))return!1;else return n(e,t)}}),Yf=`unequal`,Xf=W(Yf,[`typed`,`config`,`equalScalar`,`matrix`,`DenseMatrix`,`concat`,`SparseMatrix`],e=>{var{typed:t,config:n,equalScalar:r,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,c=gc({typed:t}),l=Cl({typed:t,SparseMatrix:s}),u=qs({typed:t,DenseMatrix:a}),d=xc({typed:t,matrix:i,concat:o});return t(Yf,Zf({typed:t,equalScalar:r}),d({elop:f,SS:l,DS:c,Ss:u}));function f(e,t){return!r(e,t)}}),Zf=W(Yf,[`typed`,`equalScalar`],e=>{var{typed:t,equalScalar:n}=e;return t(Yf,{"any, any":function(e,t){return e===null?t!==null:t===null?e!==null:e===void 0?t!==void 0:t===void 0?e!==void 0:!n(e,t)}})}),Qf=`partitionSelect`,$f=W(Qf,[`typed`,`isNumeric`,`isNaN`,`compare`],e=>{var{typed:t,isNumeric:n,isNaN:r,compare:i}=e,a=i,o=(e,t)=>-i(e,t);return t(Qf,{"Array | Matrix, number":function(e,t){return s(e,t,a)},"Array | Matrix, number, string":function(e,t,n){if(n===`asc`)return s(e,t,a);if(n===`desc`)return s(e,t,o);throw Error(`Compare string must be "asc" or "desc"`)},"Array | Matrix, number, function":s});function s(e,t,n){if(!G(t)||t<0)throw Error(`k must be a non-negative integer`);if(O(e)){if(e.size().length>1)throw Error(`Only one dimensional matrices supported`);return c(e.valueOf(),t,n)}if(Array.isArray(e))return c(e,t,n)}function c(e,t,i){if(t>=e.length)throw Error(`k out of bounds`);for(var a=0;a<e.length;a++)if(n(e[a])&&r(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var c=o,l=s,u=e[Math.floor(Math.random()*(s-o+1))+o];c<l;)if(i(e[c],u)>=0){var d=e[l];e[l]=e[c],e[c]=d,--l}else++c;i(e[c],u)>0&&--c,t<=c?s=c:o=c+1}return e[t]}}),ep=`sort`,tp=W(ep,[`typed`,`matrix`,`compare`,`compareNatural`],e=>{var{typed:t,matrix:n,compare:r,compareNatural:i}=e,a=r,o=(e,t)=>-r(e,t);return t(ep,{Array:function(e){return c(e),e.sort(a)},Matrix:function(e){return l(e),n(e.toArray().sort(a),e.storage())},"Array, function":function(e,t){return c(e),e.sort(t)},"Matrix, function":function(e,t){return l(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return c(e),e.sort(s(t))},"Matrix, string":function(e,t){return l(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if(e===`asc`)return a;
11if(e===`desc`)return o;if(e===`natural`)return i;throw Error(`String "asc", "desc", or "natural" expected`)}function c(e){if(ri(e).length!==1)throw Error(`One dimensional array expected`)}function l(e){if(e.size().length!==1)throw Error(`One dimensional matrix expected`)}}),np=`max`,rp=W(np,[`typed`,`config`,`numeric`,`larger`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,larger:i,isNaN:a}=e;return t(np,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return Zi(e,t.valueOf(),o)},"...":function(e){if(Ji(e))throw TypeError(`Scalar values expected in function max`);return s(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw pd(e,`max`,t)}}function s(e){var t;if(Yi(e,function(e){try{(a(e)||t===void 0||i(e,t))&&(t=e)}catch(t){throw pd(t,`max`,e)}}),t===void 0)throw Error(`Cannot calculate max of an empty array`);return typeof t==`string`&&(t=r(t,He(t,n))),t}}),ip=`min`,ap=W(ip,[`typed`,`config`,`numeric`,`smaller`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,smaller:i,isNaN:a}=e;return t(ip,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return Zi(e,t.valueOf(),o)},"...":function(e){if(Ji(e))throw TypeError(`Scalar values expected in function min`);return s(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw pd(e,`min`,t)}}function s(e){var t;if(Yi(e,function(e){try{(a(e)||t===void 0||i(e,t))&&(t=e)}catch(t){throw pd(t,`min`,e)}}),t===void 0)throw Error(`Cannot calculate min of an empty array`);return typeof t==`string`&&(t=r(t,He(t,n))),t}}),op=W(`ImmutableDenseMatrix`,[`smaller`,`DenseMatrix`],e=>{var{smaller:t,DenseMatrix:n}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!E(t))throw Error(`Invalid datatype: `+t);if(O(e)||D(e)){var i=new n(e,t);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&D(e.data)&&D(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=e.min===void 0?null:e.min,this._max=e.max===void 0?null:e.max;else if(e)throw TypeError(`Unsupported type of data (`+Ce(e)+`)`);else this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}return r.prototype=new n,r.prototype.type=`ImmutableDenseMatrix`,r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(e){switch(arguments.length){case 1:var t=n.prototype.subset.call(this,e);return O(t)?new r({data:t._data,size:t._size,datatype:t._datatype}):t;case 2:case 3:throw Error(`Cannot invoke set subset on an Immutable Matrix instance`);default:throw SyntaxError(`Wrong number of arguments`)}},r.prototype.set=function(){throw Error(`Cannot invoke set on an Immutable Matrix instance`)},r.prototype.resize=function(){throw Error(`Cannot invoke resize on an Immutable Matrix instance`)},r.prototype.reshape=function(){throw Error(`Cannot invoke reshape on an Immutable Matrix instance`)},r.prototype.clone=function(){return new r({data:V(this._data),size:V(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:`ImmutableDenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(){throw Error(`Cannot invoke swapRows on an Immutable Matrix instance`)},r.prototype.min=function(){if(this._min===null){var e=null;this.forEach(function(n){(e===null||t(n,e))&&(e=n)}),this._min=e===null?void 0:e}return this._min},r.prototype.max=function(){if(this._max===null){var e=null;this.forEach(function(n){(e===null||t(e,n))&&(e=n)}),this._max=e===null?void 0:e}return this._max},r},{isClass:!0}),sp=W(`Index`,[`ImmutableDenseMatrix`,`getMatrixDataType`],e=>{var{ImmutableDenseMatrix:t,getMatrixDataType:n}=e;function r(){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var e=0,t=arguments.length;e<t;e++){var a=e<0||arguments.length<=e?void 0:arguments[e],o=D(a),s=O(a),c=typeof a,l=null;if(M(a))this._dimensions.push(a),this._isScalar=!1;else if(o||s){var u=void 0;this._isScalar=!1,n(a)===`boolean`?(o&&(u=i(cp(a).valueOf())),s&&(u=i(cp(a._data).valueOf())),l=a.valueOf().length):u=i(a.valueOf()),this._dimensions.push(u)}else if(c===`number`)this._dimensions.push(a);else if(c===`bigint`)this._dimensions.push(Number(a));else if(c===`string`)this._dimensions.push(a);else throw TypeError(`Dimension must be an Array, Matrix, number, bigint, string, or Range`);this._sourceSize.push(l)}}r.prototype.type=`Index`,r.prototype.isIndex=!0;function i(e){for(var n=0,r=e.length;n<r;n++)if(!b(e[n])||!G(e[n]))throw TypeError(`Index parameters must be positive integer numbers`);var i=new t;return i._data=e,i._size=[e.length],i}return r.prototype.clone=function(){var e=new r;return e._dimensions=V(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},r.create=function(e){var t=new r;return r.apply(t,e),t},r.prototype.size=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=E(r)||b(r)?1:r.size()[0]}return e},r.prototype.max=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=E(r)||b(r)?r:r.max()}return e},r.prototype.min=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e[t]=E(r)||b(r)?r:r.min()}return e},r.prototype.forEach=function(e){for(var t=0,n=this._dimensions.length;t<n;t++)e(this._dimensions[t],t,this)},r.prototype.dimension=function(e){return b(e)?this._dimensions[e]??null:null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&E(this._dimensions[0])},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];e.push(E(r)||b(r)?r:r.toArray())}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var e=[],t=0,n=this._dimensions.length;t<n;t++){var r=this._dimensions[t];E(r)?e.push(JSON.stringify(r)):e.push(r.toString())}return`[`+e.join(`, `)+`]`},r.prototype.toJSON=function(){return{mathjs:`Index`,dimensions:this._dimensions}},r.fromJSON=function(e){return r.create(e.dimensions)},r},{isClass:!0});function cp(e){var t=[];return e.forEach((e,n)=>{e&&t.push(n)}),t}var lp=W(`FibonacciHeap`,[`smaller`,`larger`],e=>{var{smaller:t,larger:n}=e,r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);this._minimum=null,this._size=0}i.prototype.type=`FibonacciHeap`,i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,n){var r={key:e,value:n,degree:0};if(this._minimum){var i=this._minimum;r.left=i,r.right=i.right,i.right=r,r.right.left=r,t(e,i.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var e=this._minimum;if(e===null)return e;for(var t=this._minimum,n=e.degree,r=e.child;n>0;){var i=r.right;r.left.right=r.right,r.right.left=r.left,r.left=t,r.right=t.right,t.right=r,r.right.left=r,r.parent=null,r=i,n--}return e.left.right=e.right,e.right.left=e.left,e===e.right?t=null:(t=e.right,t=l(t,this._size)),this._size--,this._minimum=t,e},i.prototype.remove=function(e){this._minimum=a(this._minimum,e,-1),this.extractMinimum()};function a(e,n,r){n.key=r;var i=n.parent;return i&&t(n.key,i.key)&&(o(e,n,i),s(e,i)),t(n.key,e.key)&&(e=n),e}function o(e,t,n){t.left.right=t.right,t.right.left=t.left,n.degree--,n.child===t&&(n.child=t.right),n.degree===0&&(n.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function s(e,t){var n=t.parent;n&&(t.mark?(o(e,t,n),s(n)):t.mark=!0)}var c=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};function l(e,i){var a=Math.floor(Math.log(i)*r)+1,o=Array(a),s=0,l=e;if(l)for(s++,l=l.right;l!==e;)s++,l=l.right;for(var u;s>0;){for(var d=l.degree,f=l.right;u=o[d],u;){if(n(l.key,u.key)){var p=u;u=l,l=p}c(u,l),o[d]=null,d++}o[d]=l,l=f,s--}e=null;for(var m=0;m<a;m++)u=o[m],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}return i},{isClass:!0}),up=W(`Spa`,[`addScalar`,`equalScalar`,`FibonacciHeap`],e=>{var{addScalar:t,equalScalar:n,FibonacciHeap:r}=e;function i(){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);this._values=[],this._heap=new r}return i.prototype.type=`Spa`,i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{var n=this._heap.insert(e,t);this._values[e]=n}},i.prototype.get=function(e){var t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,n){var r=this._values[e];r?r.value=t(r.value,n):(r=this._heap.insert(e,n),this._values[e]=r)},i.prototype.forEach=function(e,t,r){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=t;)s.key>=e&&(n(s.value,0)||r(s.key,s.value,this)),s=i.extractMinimum(),s&&o.push(s);for(var c=0;c<o.length;c++){var l=o[c];s=i.insert(l.key,l.value),a[s.key]=s}},i.prototype.swap=function(e,t){var n=this._values[e],r=this._values[t];if(!n&&r)n=this._heap.insert(e,r.value),this._heap.remove(r),this._values[e]=n,this._values[t]=void 0;else if(n&&!r)r=this._heap.insert(t,n.value),this._heap.remove(n),this._values[t]=r,this._values[e]=void 0;else if(n&&r){var i=n.value;n.value=r.value,r.value=i}},i},{isClass:!0});function dp(e){var t=0,n=1,r=Object.create(null),i=Object.create(null),a=0,o=function(e){var o=i[e];if(o&&(delete r[o],delete i[e],--t,n===o)){if(!t){a=0,n=1;return}for(;!Object.prototype.hasOwnProperty.call(r,++n););}};return e=Math.abs(e),{hit:function(s){var c=i[s],l=++a;if(r[l]=s,i[s]=l,!c)return++t,t<=e?void 0:(s=r[n],o(s),s);if(delete r[c],n===c)for(;!Object.prototype.hasOwnProperty.call(r,++n););},delete:o,clear:function(){t=a=0,n=1,r=Object.create(null),i=Object.create(null)}}}function fp(e){var{hasher:t,limit:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n??=1/0,t??=JSON.stringify,function r(){typeof r.cache!=`object`&&(r.cache={values:new Map,lru:dp(n||1/0)});var i=[...arguments],a=t(i);if(r.cache.values.has(a))return r.cache.lru.hit(a),r.cache.values.get(a);var o=e.apply(e,i);return r.cache.values.set(a,o),r.cache.values.delete(r.cache.lru.hit(a)),o}}var pp=fp(function(e){return new e(1).exp()},{hasher:_p}),mp=fp(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:_p}),hp=fp(function(e){return e.acos(-1)},{hasher:_p}),gp=fp(function(e){return hp(e).times(2)},{hasher:_p});function _p(e){return e[0].precision}function vp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];
11t%2?vp(Object(n),!0).forEach(function(t){$u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var bp=W(`Unit`,[`?on`,`config`,`addScalar`,`subtractScalar`,`multiplyScalar`,`divideScalar`,`pow`,`abs`,`fix`,`round`,`equal`,`isNumeric`,`format`,`number`,`Complex`,`BigNumber`,`Fraction`],e=>{var{on:t,config:n,addScalar:i,subtractScalar:a,multiplyScalar:o,divideScalar:s,pow:c,abs:l,fix:u,round:d,equal:f,isNumeric:p,format:m,number:h,Complex:g,BigNumber:_,Fraction:v}=e,y=h,b=!1,x=!0;function S(e,t){if(!(this instanceof S))throw Error(`Constructor must be called with the new operator`);if(!(e==null||p(e)||C(e)))throw TypeError(`First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined`);if(this.fixPrefix=b,this.skipAutomaticSimplification=x,t===void 0)this.units=[],this.dimensions=oe.map(e=>0);else if(typeof t==`string`){var n=S.parse(t);this.units=n.units,this.dimensions=n.dimensions}else if(T(t)&&t.value===null)this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map(e=>r({},e));else throw TypeError(`Second parameter in Unit constructor must be a string or valueless Unit`);this.value=this._normalize(e)}Object.defineProperty(S,"name",{value:`Unit`}),S.prototype.constructor=S,S.prototype.type=`Unit`,S.prototype.isUnit=!0;var w,E,D;function O(){for(;D===` `||D===`	`;)j()}function k(e){return e>=`0`&&e<=`9`||e===`.`}function A(e){return e>=`0`&&e<=`9`}function j(){E++,D=w.charAt(E)}function M(e){E=e,D=w.charAt(E)}function N(){var e=``,t=E;if(D===`+`?j():D===`-`&&(e+=D,j()),!k(D))return M(t),null;if(D===`.`){if(e+=D,j(),!A(D))return M(t),null}else{for(;A(D);)e+=D,j();D===`.`&&(e+=D,j())}for(;A(D);)e+=D,j();if(D===`E`||D===`e`){var n=``,r=E;if(n+=D,j(),(D===`+`||D===`-`)&&(n+=D,j()),!A(D))return M(r),e;for(e+=n;A(D);)e+=D,j()}return e}function P(){for(var e=``;A(D)||S.isValidAlpha(D);)e+=D,j();var t=e.charAt(0);return S.isValidAlpha(t)?e:null}function F(e){return D===e?(j(),e):null}S.parse=function(e,t){if(t||={},w=e,E=-1,D=``,typeof w!=`string`)throw TypeError(`Invalid argument in Unit.parse, string expected`);var r=new S;r.units=[];var i=1,a=!1;j(),O();var o=N(),s=null;if(o){if(n.number===`BigNumber`)s=new _(o);else if(n.number===`Fraction`)try{s=new v(o)}catch{s=parseFloat(o)}else s=parseFloat(o);O(),F(`*`)?(i=1,a=!0):F(`/`)&&(i=-1,a=!0)}for(var c=[],l=1;;){for(O();D===`(`;)c.push(i),l*=i,i=1,j(),O();var u=void 0;if(D){var d=D;if(u=P(),u===null)throw SyntaxError(`Unexpected "`+d+`" in "`+w+`" at index `+E.toString())}else break;var f=ee(u);if(f===null)throw SyntaxError(`Unit "`+u+`" not found.`);var p=i*l;if(O(),F(`^`)){O();var m=N();if(m===null)throw SyntaxError(`In "`+e+`", "^" must be followed by a floating-point number`);p*=m}r.units.push({unit:f.unit,prefix:f.prefix,power:p});for(var h=0;h<oe.length;h++)r.dimensions[h]+=(f.unit.dimensions[h]||0)*p;for(O();D===`)`;){if(c.length===0)throw SyntaxError(`Unmatched ")" in "`+w+`" at index `+E.toString());l/=c.pop(),j(),O()}if(a=!1,F(`*`)?(i=1,a=!0):F(`/`)?(i=-1,a=!0):i=1,f.unit.base){var g=f.unit.base.key;z.auto[g]={unit:f.unit,prefix:f.prefix}}}if(O(),D)throw SyntaxError(`Could not parse: "`+e+`"`);if(a)throw SyntaxError(`Trailing characters: "`+e+`"`);if(c.length!==0)throw SyntaxError(`Unmatched "(" in "`+w+`"`);if(r.units.length===0&&!t.allowNoUnits)throw SyntaxError(`"`+e+`" contains no units`);return r.value=s===void 0?null:r._normalize(s),r},S.prototype.clone=function(){var e=new S;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=V(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var t=0;t<this.units.length;t++)for(var n in e.units[t]={},this.units[t])H(this.units[t],n)&&(e.units[t][n]=this.units[t][n]);return e},S.prototype.valueType=function(){return Ce(this.value)},S.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},S.prototype._normalize=function(e){if(e==null||this.units.length===0)return e;for(var t=e,n=S._getNumberConverter(Ce(e)),r=0;r<this.units.length;r++){var i=n(this.units[r].unit.value),a=n(this.units[r].prefix.value),s=n(this.units[r].power);t=o(t,c(o(i,a),s))}return t},S.prototype._denormalize=function(e,t){if(e==null||this.units.length===0)return e;for(var n=e,r=S._getNumberConverter(Ce(e)),i=0;i<this.units.length;i++){var a=r(this.units[i].unit.value),l=r(this.units[i].prefix.value),u=r(this.units[i].power);n=s(n,c(o(a,l),u))}return n};var ee=fp(e=>{if(H(R,e)){var t=R[e];return{unit:t,prefix:t.prefixes[``]}}for(var n in R)if(H(R,n)&&Kr(e,n)){var r=R[n],i=e.length-n.length,a=e.substring(0,i),o=H(r.prefixes,a)?r.prefixes[a]:void 0;if(o!==void 0)return{unit:r,prefix:o}}return null},{hasher:e=>e[0],limit:100});S.isValuelessUnit=function(e){return ee(e)!==null},S.prototype.hasBase=function(e){if(typeof e==`string`&&(e=L[e]),!e)return!1;for(var t=0;t<oe.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},S.prototype.equalBase=function(e){for(var t=0;t<oe.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},S.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},S.prototype.multiply=function(e){for(var t=this.clone(),n=T(e)?e:new S(e),r=0;r<oe.length;r++)t.dimensions[r]=(this.dimensions[r]||0)+(n.dimensions[r]||0);for(var i=0;i<n.units.length;i++){var a=yp({},n.units[i]);t.units.push(a)}return this.value!==null||n.value!==null?t.value=o(this.value===null?this._normalize(ne(n.value)):this.value,
11n.value===null?n._normalize(ne(this.value)):n.value):t.value=null,T(e)&&(t.skipAutomaticSimplification=!1),te(t)},S.prototype.divideInto=function(e){return new S(e).divide(this)},S.prototype.divide=function(e){for(var t=this.clone(),n=T(e)?e:new S(e),r=0;r<oe.length;r++)t.dimensions[r]=(this.dimensions[r]||0)-(n.dimensions[r]||0);for(var i=0;i<n.units.length;i++){var a=yp(yp({},n.units[i]),{},{power:-n.units[i].power});t.units.push(a)}return this.value!==null||n.value!==null?t.value=s(this.value===null?this._normalize(ne(n.value)):this.value,n.value===null?n._normalize(ne(this.value)):n.value):t.value=null,T(e)&&(t.skipAutomaticSimplification=!1),te(t)},S.prototype.pow=function(e){for(var t=this.clone(),n=0;n<oe.length;n++)t.dimensions[n]=(this.dimensions[n]||0)*e;for(var r=0;r<t.units.length;r++)t.units[r].power*=e;return t.value===null?t.value=null:t.value=c(t.value,e),t.skipAutomaticSimplification=!1,te(t)};function te(e){return e.equalBase(L.NONE)&&e.value!==null&&!n.predictable?e.value:e}function ne(e){return S._getNumberConverter(Ce(e))(1)}S.prototype.abs=function(){var e=this.clone();if(e.value!==null)if(e._isDerived()||e.units.length===0||e.units[0].unit.offset===0)e.value=l(e.value);else{var t=e._numberConverter(),n=o(t(e.units[0].unit.value),t(e.units[0].unit.offset));e.value=a(l(i(e.value,n)),n)}for(var r in e.units)(e.units[r].unit.name===`VA`||e.units[r].unit.name===`VAR`)&&(e.units[r].unit=R.W);return e},S.prototype.to=function(e){var t=this.value===null?this._normalize(1):this.value,n;if(typeof e==`string`)n=S.parse(e);else if(T(e))n=e.clone();else throw Error(`String or Unit expected as parameter`);if(!this.equalBase(n))throw Error(`Units do not match ('${n.toString()}' != '${this.toString()}')`);if(n.value!==null)throw Error(`Cannot convert to a unit with a value`);if(this.value===null||this._isDerived()||this.units.length===0||n.units.length===0||this.units[0].unit.offset===n.units[0].unit.offset)n.value=V(t);else{var r=S._getNumberConverter(Ce(t)),s=this.units[0].unit.value,c=this.units[0].unit.offset,l=o(s,c),u=n.units[0].unit.value,d=n.units[0].unit.offset,f=o(u,d);n.value=i(t,r(a(l,f)))}return n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n},S.prototype.toNumber=function(e){return y(this.toNumeric(e))},S.prototype.toNumeric=function(e){var t=e?this.to(e):this.clone();return t._isDerived()||t.units.length===0?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},S.prototype.toString=function(){return this.format()},S.prototype.toJSON=function(){return{mathjs:`Unit`,value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix,skipSimp:this.skipAutomaticSimplification}},S.fromJSON=function(e){var t=new S(e.value,e.unit??void 0);return t.fixPrefix=e.fixPrefix??b,t.skipAutomaticSimplification=e.skipSimp??x,t},S.prototype.valueOf=S.prototype.toString,S.prototype.simplify=function(){var e=this.clone(),t=[],n;for(var r in B)if(H(B,r)&&e.hasBase(L[r])){n=r;break}if(n===`NONE`)e.units=[];else{var i;if(n&&H(B,n)&&(i=B[n]),i)e.units=[{unit:i.unit,prefix:i.prefix,power:1}];else{for(var a=!1,o=0;o<oe.length;o++){var s=oe[o];Math.abs(e.dimensions[o]||0)>1e-12&&(H(B,s)?t.push({unit:B[s].unit,prefix:B[s].prefix,power:e.dimensions[o]||0}):a=!0)}t.length<e.units.length&&!a&&(e.units=t)}}return e},S.prototype.toSI=function(){for(var e=this.clone(),t=[],n=0;n<oe.length;n++){var r=oe[n];if(Math.abs(e.dimensions[n]||0)>1e-12)if(H(z.si,r))t.push({unit:z.si[r].unit,prefix:z.si[r].prefix,power:e.dimensions[n]||0});else throw Error(`Cannot express custom unit `+r+` in SI units`)}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,this.value===null?e:(e.value=null,this.to(e))},S.prototype.formatUnits=function(){for(var e=``,t=``,n=0,r=0,i=0;i<this.units.length;i++)this.units[i].power>0?(n++,e+=` `+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+=`^`+this.units[i].power)):this.units[i].power<0&&r++;if(r>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(n>0?(t+=` `+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(t+=`^`+-this.units[a].power)):(t+=` `+this.units[a].prefix.name+this.units[a].unit.name,t+=`^`+this.units[a].power));e=e.substr(1),t=t.substr(1),n>1&&r>0&&(e=`(`+e+`)`),r>1&&n>0&&(t=`(`+t+`)`);var o=e;return n>0&&r>0&&(o+=` / `),o+=t,o},S.prototype.toBest=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e&&!Array.isArray(e))throw Error(`Invalid unit type. Expected string or Unit.`);var n=this.units[0].unit.prefixes;if(e&&e.length>0){var r=e.map(e=>{var t=null;if(typeof e==`string`){if(t=S.parse(e),!t)throw Error(`Invalid unit type. Expected compatible string or Unit.`)}else if(!T(e))throw Error(`Invalid unit type. Expected compatible string or Unit.`);t===null&&(t=e.clone());try{return this.to(t.formatUnits()),t}catch{throw Error(`Invalid unit type. Expected compatible string or Unit.`)}}).map(e=>e.units[0].prefix);this.units[0].unit.prefixes=r.reduce((e,t)=>
11(e[t.name]=t,e),{}),this.units[0].prefix=r[0]}var i=re(this,t).simp;return this.units[0].unit.prefixes=n,i.fixPrefix=!0,i},S.prototype.format=function(e){var{simp:t,valueStr:n,unitStr:r}=re(this,e),i=n;return t.value&&C(t.value)&&(i=`(`+i+`)`),r.length>0&&i.length>0&&(i+=` `),i+=r,i};function re(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.skipAutomaticSimplification||e.value===null?e.clone():e.simplify();ie(n),ae(n,t.offset);var r=n._denormalize(n.value);return{simp:n,valueStr:n.value===null?``:m(r,t||{}),unitStr:n.formatUnits()}}function ie(e){var t=!1;for(var n in e.value!==void 0&&e.value!==null&&C(e.value)&&(t=Math.abs(e.value.re)<1e-14),e.units)H(e.units,n)&&e.units[n].unit&&(e.units[n].unit.name===`VA`&&t?e.units[n].unit=R.VAR:e.units[n].unit.name===`VAR`&&!t&&(e.units[n].unit=R.VA))}function ae(e,t){e.units.length===1&&!e.fixPrefix&&Math.abs(e.units[0].power-Math.round(e.units[0].power))<1e-14&&(e.units[0].prefix=e._bestPrefix(t))}S.prototype._bestPrefix=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1.2;if(this.units.length!==1||Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw Error(`Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!`);var t=this.value===null?0:l(this.value),n=l(this.units[0].unit.value),r=this.units[0].prefix;if(t===0)return r;var i=this.units[0].power,a=Math.log(t/(r.value*n)**+i)/Math.LN10-e;if(a>-2.200001&&a<1.800001)return r;a=Math.abs(a);var o=this.units[0].unit.prefixes;for(var s in o)if(H(o,s)){var c=o[s];if(c.scientific){var u=Math.abs(Math.log(t/(c.value*n)**+i)/Math.LN10-e);(u<a||u===a&&c.name.length<r.name.length)&&(r=c,a=u)}}return r},S.prototype.splitUnit=function(e){for(var t=this.clone(),n=[],r=0;r<e.length&&(t=t.to(e[r]),r!==e.length-1);r++){var o=t.toNumeric(),s=d(o),c=void 0;c=f(s,o)?s:u(t.toNumeric());var l=new S(c,e[r].toString());n.push(l),t=a(t,l)}for(var p=0,m=0;m<n.length;m++)p=i(p,n[m].value);return f(p,this.value)&&(t.value=0),n.push(t),n};var I={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:0xe8d4a51000,scientific:!0},P:{name:`P`,value:0x38d7ea4c68000,scientific:!0},E:{name:`E`,value:0xde0b6b3a7640000,scientific:!0},Z:{name:`Z`,value:1e21,scientific:!0},Y:{name:`Y`,value:1e24,scientific:!0},R:{name:`R`,value:1e27,scientific:!0},Q:{name:`Q`,value:1e30,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},r:{name:`r`,value:1e-27,scientific:!0},q:{name:`q`,value:1e-30,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:0xe8d4a51000,scientific:!0},peta:{name:`peta`,value:0x38d7ea4c68000,scientific:!0},exa:{name:`exa`,value:0xde0b6b3a7640000,scientific:!0},zetta:{name:`zetta`,value:1e21,scientific:!0},yotta:{name:`yotta`,value:1e24,scientific:!0},ronna:{name:`ronna`,value:1e27,scientific:!0},quetta:{name:`quetta`,value:1e30,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}
11,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},ronto:{name:`ronto`,value:1e-27,scientific:!0},quecto:{name:`quecto`,value:1e-30,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:0xe8d4a51000,scientific:!0},G:{name:`G`,value:0xde0b6b3a7640000,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},R:{name:`R`,value:1e54,scientific:!0},Q:{name:`Q`,value:1e60,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},r:{name:`r`,value:1e-54,scientific:!0},q:{name:`q`,value:1e-60,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:0xde0b6b3a7640000,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},R:{name:`R`,value:1e81,scientific:!0},Q:{name:`Q`,value:1e90,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},r:{name:`r`,value:1e-81,scientific:!0},q:{name:`q`,value:1e-90,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:0xe8d4a51000,scientific:!0},P:{name:`P`,value:0x38d7ea4c68000,scientific:!0},E:{name:`E`,value:0xde0b6b3a7640000,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:1024**2,scientific:!0},Gi:{name:`Gi`,value:1024**3,scientific:!0},Ti:{name:`Ti`,value:1024**4,scientific:!0},Pi:{name:`Pi`,value:1024**5,scientific:!0},Ei:{name:`Ei`,value:1024**6,scientific:!0},Zi:{name:`Zi`,value:1024**7,scientific:!0},Yi:{name:`Yi`,value: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:0xe8d4a51000,scientific:!0},peta:{name:`peta`,value:0x38d7ea4c68000,scientific:!0},exa:{name:`exa`,value:0xde0b6b3a7640000,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:1024**2,scientific:!0},gibi:{name:`gibi`,value:1024**3,scientific:!0},tebi:{name:`tebi`,value:1024**4,scientific:!0},pebi:{name:`pebi`,value:1024**5,scientific:!0},exi:{name:`exi`,value:1024**6,scientific:!0},zebi:{name:`zebi`,value:1024**7,scientific:!0},yobi:{name:`yobi`,value:1024**8,scientific:!0}},BTU:{"":{name:``,value:1,scientific:!0},MM:{name:`MM`,value:1e6,scientific:!0}}};I.SHORTLONG=r({},I.SHORT,I.LONG),I.BINARY_SHORT=r({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=r({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);var oe=[`MASS`,`LENGTH`,`TIME`,`CURRENT`,`TEMPERATURE`,`LUMINOUS_INTENSITY`,`AMOUNT_OF_SUBSTANCE`,`ANGLE`,`BIT`],L={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 se in L)H(L,se)&&(L[se].key=se);
11var ce={name:``,base:{},value:1,offset:0,dimensions:oe.map(e=>0)},R={meter:{name:`meter`,base:L.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:`inch`,base:L.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:`foot`,base:L.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:`yard`,base:L.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:`mile`,base:L.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:`link`,base:L.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:`rod`,base:L.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:`chain`,base:L.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:`angstrom`,base:L.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:`m`,base:L.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:`in`,base:L.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:`ft`,base:L.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:`yd`,base:L.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:`mi`,base:L.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:`li`,base:L.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:`rd`,base:L.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:`ch`,base:L.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:`mil`,base:L.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:`m2`,base:L.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:`sqin`,base:L.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:`sqft`,base:L.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:`sqyd`,base:L.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:`sqmi`,base:L.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:`sqrd`,base:L.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:`sqch`,base:L.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:`sqmil`,base:L.SURFACE,prefixes:I.NONE,value:64516e-14,offset:0},acre:{name:`acre`,base:L.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:`hectare`,base:L.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:`m3`,base:L.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:`L`,base:L.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:`l`,base:L.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:`litre`,base:L.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:`cuin`,base:L.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:`cuft`,base:L.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0}
11,cuyd:{name:`cuyd`,base:L.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:`teaspoon`,base:L.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:`tablespoon`,base:L.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:`drop`,base:L.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:`gtt`,base:L.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:`minim`,base:L.VOLUME,prefixes:I.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:`fluiddram`,base:L.VOLUME,prefixes:I.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:`fluidounce`,base:L.VOLUME,prefixes:I.NONE,value:295735295625e-16,offset:0},gill:{name:`gill`,base:L.VOLUME,prefixes:I.NONE,value:.00011829411825,offset:0},cc:{name:`cc`,base:L.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:`cup`,base:L.VOLUME,prefixes:I.NONE,value:.0002365882365,offset:0},pint:{name:`pint`,base:L.VOLUME,prefixes:I.NONE,value:.000473176473,offset:0},quart:{name:`quart`,base:L.VOLUME,prefixes:I.NONE,value:.000946352946,offset:0},gallon:{name:`gallon`,base:L.VOLUME,prefixes:I.NONE,value:.003785411784,offset:0},beerbarrel:{name:`beerbarrel`,base:L.VOLUME,prefixes:I.NONE,value:.117347765304,offset:0},oilbarrel:{name:`oilbarrel`,base:L.VOLUME,prefixes:I.NONE,value:.158987294928,offset:0},hogshead:{name:`hogshead`,base:L.VOLUME,prefixes:I.NONE,value:.238480942392,offset:0},g:{name:`g`,base:L.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:`gram`,base:L.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:`ton`,base:L.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:`t`,base:L.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:`tonne`,base:L.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:`grain`,base:L.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:`dram`,base:L.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:`ounce`,base:L.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:`poundmass`,base:L.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:`hundredweight`,base:L.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:`stick`,base:L.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:`stone`,base:L.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:`gr`,base:L.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:`dr`,base:L.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:`oz`,base:L.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:`lbm`,base:L.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:`cwt`,base:L.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:`s`,base:L.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:`min`,base:L.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:`h`,base:L.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:`second`,base:L.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:`sec`,base:L.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:`minute`,base:L.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:`hour`,base:L.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:`day`,base:L.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:`week`,base:L.TIME,prefixes:I.NONE,value:7*86400,offset:0},month:{name:`month`,base:L.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:`year`,base:L.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:`decade`,base:L.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:`century`,base:L.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:`millennium`,base:L.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:`Hertz`,base:L.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:`Hz`,base:L.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:`rad`,base:L.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:`radian`,base:L.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:`deg`,base:L.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:`degree`,base:L.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:`grad`,base:L.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:`gradian`,base:L.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:`cycle`,base:L.ANGLE,prefixes:I.NONE,value:null,offset:0}
11,arcsec:{name:`arcsec`,base:L.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:`arcmin`,base:L.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:`A`,base:L.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:`ampere`,base:L.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:`K`,base:L.TEMPERATURE,prefixes:I.SHORT,value:1,offset:0},degC:{name:`degC`,base:L.TEMPERATURE,prefixes:I.SHORT,value:1,offset:273.15},degF:{name:`degF`,base:L.TEMPERATURE,prefixes:I.SHORT,value:new v(5,9),offset:459.67},degR:{name:`degR`,base:L.TEMPERATURE,prefixes:I.SHORT,value:new v(5,9),offset:0},kelvin:{name:`kelvin`,base:L.TEMPERATURE,prefixes:I.LONG,value:1,offset:0},celsius:{name:`celsius`,base:L.TEMPERATURE,prefixes:I.LONG,value:1,offset:273.15},fahrenheit:{name:`fahrenheit`,base:L.TEMPERATURE,prefixes:I.LONG,value:new v(5,9),offset:459.67},rankine:{name:`rankine`,base:L.TEMPERATURE,prefixes:I.LONG,value:new v(5,9),offset:0},mol:{name:`mol`,base:L.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:`mole`,base:L.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:`cd`,base:L.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:`candela`,base:L.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:`N`,base:L.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:`newton`,base:L.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:`dyn`,base:L.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:`dyne`,base:L.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:`lbf`,base:L.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:`poundforce`,base:L.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:`kip`,base:L.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:`kilogramforce`,base:L.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:`J`,base:L.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:`joule`,base:L.ENERGY,prefixes:I.LONG,value:1,offset:0},erg:{name:`erg`,base:L.ENERGY,prefixes:I.SHORTLONG,value:1e-7,offset:0},Wh:{name:`Wh`,base:L.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:`BTU`,base:L.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:`eV`,base:L.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:`electronvolt`,base:L.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:`W`,base:L.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:`watt`,base:L.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:`hp`,base:L.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:`VAR`,base:L.POWER,prefixes:I.SHORT,value:g.I,offset:0},VA:{name:`VA`,base:L.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:`Pa`,base:L.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:`psi`,base:L.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:`atm`,base:L.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:`bar`,base:L.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:`torr`,base:L.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:`mmHg`,base:L.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:`mmH2O`,base:L.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:`cmH2O`,base:L.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:`coulomb`,base:L.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:`C`,base:L.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},Ah:{name:`Ah`,base:L.ELECTRIC_CHARGE,prefixes:I.SHORT,value:3600,offset:0},farad:{name:`farad`,base:L.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:`F`,base:L.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:`volt`,base:L.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:`V`,base:L.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:`ohm`,base:L.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:`henry`,base:L.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:`H`,base:L.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:`siemens`,base:L.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0}
11,S:{name:`S`,base:L.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:`weber`,base:L.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:`Wb`,base:L.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:`tesla`,base:L.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:`T`,base:L.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:`b`,base:L.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:`bits`,base:L.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:`B`,base:L.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:`bytes`,base:L.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},le={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`,fldr:`fluiddram`,fluiddrams:`fluiddram`,floz:`fluidounce`,fluidounces:`fluidounce`,gi:`gill`,gills:`gill`,cp:`cup`,cups:`cup`,pt:`pint`,pints:`pint`,qt:`quart`,quarts:`quart`,gal:`gallon`,gallons:`gallon`,bbl:`beerbarrel`,beerbarrels:`beerbarrel`,obl:`oilbarrel`,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 ue(e){if(e.number===`BigNumber`){var t=hp(_);R.rad.value=new _(1),R.deg.value=t.div(180),R.grad.value=t.div(200),R.cycle.value=t.times(2),R.arcsec.value=t.div(648e3),R.arcmin.value=t.div(10800)}else R.rad.value=1,R.deg.value=Math.PI/180,R.grad.value=Math.PI/200,R.cycle.value=Math.PI*2,R.arcsec.value=Math.PI/648e3,R.arcmin.value=Math.PI/10800;R.radian.value=R.rad.value,R.degree.value=R.deg.value,R.gradian.value=R.grad.value}ue(n),t&&t(`config`,function(e,t){e.number!==t.number&&ue(e)});var z={si:{NONE:{unit:ce,prefix:I.NONE[``]},LENGTH:{unit:R.m,prefix:I.SHORT[``]},MASS:{unit:R.g,prefix:I.SHORT.k},TIME:{unit:R.s,prefix:I.SHORT[``]},CURRENT:{unit:R.A,prefix:I.SHORT[``]},TEMPERATURE:{unit:R.K,prefix:I.SHORT[``]},LUMINOUS_INTENSITY:{unit:R.cd,prefix:I.SHORT[``]},AMOUNT_OF_SUBSTANCE:{unit:R.mol,prefix:I.SHORT[``]},ANGLE:{unit:R.rad,prefix:I.SHORT[``]},BIT:{unit:R.bits,prefix:I.SHORT[``]},FORCE:{unit:R.N,prefix:I.SHORT[``]},ENERGY:{unit:R.J,prefix:I.SHORT[``]},POWER:{unit:R.W,prefix:I.SHORT[``]},PRESSURE:{unit:R.Pa,prefix:I.SHORT[``]},ELECTRIC_CHARGE:{unit:R.C,prefix:I.SHORT[``]},ELECTRIC_CAPACITANCE:{unit:R.F,prefix:I.SHORT[``]},ELECTRIC_POTENTIAL:{unit:R.V,prefix:I.SHORT[``]},ELECTRIC_RESISTANCE:{unit:R.ohm,prefix:I.SHORT[``]},ELECTRIC_INDUCTANCE:{unit:R.H,prefix:I.SHORT[``]},ELECTRIC_CONDUCTANCE:{unit:R.S,prefix:I.SHORT[``]},MAGNETIC_FLUX:{unit:R.Wb,prefix:I.SHORT[``]},MAGNETIC_FLUX_DENSITY:{unit:R.T,prefix:I.SHORT[``]},FREQUENCY:{unit:R.Hz,prefix:I.SHORT[``]}}};z.cgs=JSON.parse(JSON.stringify(z.si)),z.cgs.LENGTH={unit:R.m,prefix:I.SHORT.c},z.cgs.MASS={unit:R.g,prefix:I.SHORT[``]},z.cgs.FORCE={unit:R.dyn,prefix:I.SHORT[``]},z.cgs.ENERGY={unit:R.erg,prefix:I.NONE[``]},z.us=JSON.parse(JSON.stringify(z.si)),z.us.LENGTH={unit:R.ft,prefix:I.NONE[``]},z.us.MASS={unit:R.lbm,prefix:I.NONE[``]},z.us.TEMPERATURE={unit:R.degF,prefix:I.NONE[``]},z.us.FORCE={unit:R.lbf,prefix:I.NONE[``]},z.us.ENERGY={unit:R.BTU,prefix:I.BTU[``]},z.us.POWER={unit:R.hp,prefix:I.NONE[``]},z.us.PRESSURE={unit:R.psi,prefix:I.NONE[``]},z.auto=JSON.parse(JSON.stringify(z.si));var B=z.auto;for(var de in S.setUnitSystem=function(e){if(H(z,e))B=z[e];else throw Error(`Unit system `+e+` does not exist. Choices are: `+Object.keys(z).join(`, `))},S.getUnitSystem=function(){for(var e in z)if(H(z,e)&&z[e]===B)return e},S.typeConverters={BigNumber:function(e){return e!=null&&e.isFraction?new _(String(e.n)).div(String(e.d)).times(String(e.s)):new _(e+``)},Fraction:function(e){return new v(e)},Complex:function(e){return e},number:function(e){return e!=null&&e.isFraction?h(e):e}},S.prototype._numberConverter=function(){var e=S.typeConverters[this.valueType()];if(e)return e;throw TypeError(`Unsupported Unit value type "`+this.valueType()+`"`)},S._getNumberConverter=function(e){if(!S.typeConverters[e])throw TypeError(`Unsupported type "`+e+`"`);return S.typeConverters[e]},R)if(H(R,de)){var fe=R[de];fe.dimensions=fe.base.dimensions}for(var pe in le)if(H(le,pe)){var me=R[le[pe]],he={};for(var ge in me)H(me,ge)&&(he[ge]=me[ge]);he.name=pe,R[pe]=he}S.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)};function _e(e){for(var t=0;t<e.length;t++){if(D=e.charAt(t),t===0&&!S.isValidAlpha(D))throw Error(`Invalid unit name (must begin with alpha character): "`+e+`"`);if(t>0&&!(S.isValidAlpha(D)||A(D)))throw Error(`Invalid unit name (only alphanumeric characters are allowed): "`+e+`"`)}}return S.createUnit=function(e,t){if(typeof e!=`object`)throw TypeError(`createUnit expects first parameter to be of type 'Object'`);if(t&&t.override){for(var n in e)if(H(e,n)&&S.deleteUnit(n),e[n].aliases)for(var r=0;r<e[n].aliases.length;r++)S.deleteUnit(e[n].aliases[r])}var i;for(var a in e)H(e,a)&&(i=S.createUnitSingle(a,e[a]));return i},S.createUnitSingle=function(e,t){if(t??={},typeof e!=`string`)throw TypeError(`createUnitSingle expects first parameter to be of type 'string'`);if(H(R,e))throw Error(`Cannot create unit "`+e+`": a unit with that name already exists`);_e(e);var n=null,r=[],i=0,a,o,s;if(t&&t.type===`Unit`)n=t.clone();else if(typeof t==`string`)t!==``&&(a=t);else if(typeof t==`object`)a=t.definition,o=t.prefixes,i=t.offset,s=t.baseName,t.aliases&&(r=t.aliases.valueOf());else throw TypeError(`Cannot create unit "`+e+`" from "`+t.toString()+`": expecting "string" or "Unit" or "Object"`);if(r){for(var c=0;c<r.length;c++)if(H(R,r[c]))throw Error(`Cannot create alias "`+r[c]+`": a unit with that name already exists`)}if(a&&typeof a==`string`&&!n)try{n=S.parse(a,{allowNoUnits:!0})}catch(t){throw t.message=`Could not create unit "`+e+`" from "`+a+`": `+t.message,t}else a&&a.type===`Unit`&&(n=a.clone());r||=[],i||=0,o=o&&o.toUpperCase&&I[o.toUpperCase()]||I.NONE;var l={};if(n){l={name:e,value:n.value,dimensions:n.dimensions.slice(0),prefixes:o,offset:i};var u=!1;for(var d in L)if(H(L,d)){for(var f=!0,p=0;p<oe.length;p++)if(Math.abs((l.dimensions[p]||0)-(L[d].dimensions[p]||0))>1e-12){f=!1;break}if(f){u=!0,l.base=L[d];break}}if(!u){s||=e+`_STUFF`;var m={dimensions:n.dimensions.slice(0)};m.key=s,L[s]=m,B[s]={unit:l,prefix:I.NONE[``]},l.base=L[s]}}else{if(s||=e+`_STUFF`,oe.indexOf(s)>=0)throw Error(`Cannot create new base unit "`+e+`": a base unit with that name already exists (and cannot be overridden)`);for(var h in oe.push(s),L)H(L,h)&&(L[h].dimensions[oe.length-1]=0);for(var g={dimensions:[]},_=0;_<oe.length;_++)g.dimensions[_]=0;g.dimensions[oe.length-1]=1,g.key=s,L[s]=g,l={name:e,value:1,dimensions:L[s].dimensions.slice(0),prefixes:o,offset:i,base:L[s]},B[s]={unit:l,prefix:I.NONE[``]}}S.UNITS[e]=l;for(var v=0;v<r.length;v++){var y=r[v],b={};for(var x in l)H(l,x)&&(b[x]=l[x]);b.name=y,S.UNITS[y]=b}return delete ee.cache,new S(null,e)},S.deleteUnit=function(e){delete S.UNITS[e],delete ee.cache},S.PREFIXES=I,S.BASE_DIMENSIONS=oe,S.BASE_UNITS=L,S.UNIT_SYSTEMS=z,S.UNITS=R,S},{isClass:!0}),xp=`unit`,Sp=W(xp,[`typed`,`Unit`],e=>{var{typed:t,Unit:n}=e;return t(xp,{Unit:function(e){return e.clone()},string:function(e){return n.isValuelessUnit(e)?new n(null,e):n.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new n(e,t)},"number | BigNumber | Fraction":function(e){return new n(e)},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),Cp=`sparse`,wp=W(Cp,[`typed`,`SparseMatrix`],e=>{var{typed:t,SparseMatrix:n}=e;return t(Cp,{"":function(){return new n([])}
11,string:function(e){return new n([],e)},"Array | Matrix":function(e){return new n(e)},"Array | Matrix, string":function(e,t){return new n(e,t)}})}),Tp=`createUnit`,Ep=W(Tp,[`typed`,`Unit`],e=>{var{typed:t,Unit:n}=e;return t(Tp,{"Object, Object":function(e,t){return n.createUnit(e,t)},Object:function(e){return n.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){var i={};return i[e]=t,n.createUnit(i,r)},"string, Unit | string | Object":function(e,t){var r={};return r[e]=t,n.createUnit(r,{})},string:function(e){var t={};return t[e]={},n.createUnit(t,{})}})}),Dp=`acos`,Op=W(Dp,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(Dp,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.acos(e):new r(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})}),kp=`acosh`,Ap=W(kp,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(kp,{number:function(e){return e>=1||n.predictable?oo(e):e<=-1?new r(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new r(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})}),jp=`acot`,Mp=W(jp,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(jp,{number:so,Complex:function(e){return e.acot()},BigNumber:function(e){return new n(1).div(e).atan()}})}),Np=`acoth`,Pp=W(Np,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Np,{number:function(e){return e>=1||e<=-1||n.predictable?co(e):new r(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})}),Fp=`acsc`,Ip=W(Fp,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Fp,{number:function(e){return e<=-1||e>=1||n.predictable?lo(e):new r(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})}),Lp=`acsch`,Rp=W(Lp,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(Lp,{number:uo,Complex:function(e){return e.acsch()},BigNumber:function(e){return new n(1).div(e).asinh()}})}),zp=`asec`,Bp=W(zp,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(zp,{number:function(e){return e<=-1||e>=1||n.predictable?fo(e):new r(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})}),Vp=`asech`,Hp=W(Vp,[`typed`,`config`,`Complex`,`BigNumber`],e=>{var{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Vp,{number:function(e){if(e<=1&&e>=-1||n.predictable){var t=1/e;if(t>0||n.predictable)return po(e);var i=Math.sqrt(t*t-1);return new r(Math.log(i-t),Math.PI)}return new r(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})}),Up=`asin`,Wp=W(Up,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(Up,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.asin(e):new r(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})}),Gp=W(`asinh`,[`typed`],e=>{var{typed:t}=e;return t(`asinh`,{number:ho,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})}),Kp=W(`atan`,[`typed`],e=>{var{typed:t}=e;return t(`atan`,{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})}),qp=`atan2`,Jp=W(qp,[`typed`,`matrix`,`equalScalar`,`BigNumber`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:a,concat:o}=e,s=hc({typed:t,equalScalar:r}),c=gc({typed:t}),l=ol({typed:t,equalScalar:r}),u=Ks({typed:t,equalScalar:r}),d=qs({typed:t,DenseMatrix:a}),f=xc({typed:t,matrix:n,concat:o});return t(qp,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},f({scalar:`number | BigNumber`,SS:l,DS:c,SD:s,Ss:u,sS:d}))}),Yp=`atanh`,Xp=W(Yp,[`typed`,`config`,`Complex`],e=>{var{typed:t,config:n,Complex:r}=e;return t(Yp,{number:function(e){return e<=1&&e>=-1||n.predictable?vo(e):new r(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})}),Zp=W(`trigUnit`,[`typed`],e=>{var{typed:t}=e;return{Unit:t.referToSelf(e=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw TypeError(`Unit in function cot is no angle`);return t.find(e,n.valueType())(n.value)})}}),Qp=`cos`,$p=W(Qp,[`typed`],e=>{var{typed:t}=e,n=Zp({typed:t});return t(Qp,{number:Math.cos,"Complex | BigNumber":e=>e.cos()},n)}),em=`cosh`,tm=W(em,[`typed`],e=>{var{typed:t}=e;return t(em,{number:ut,"Complex | BigNumber":e=>e.cosh()})}),nm=`cot`,rm=W(nm,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=Zp({typed:t});return t(nm,{number:xo,Complex:e=>e.cot(),BigNumber:e=>new n(1).div(e.tan())},r)}),im=`coth`,am=W(im,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(im,{number:So,Complex:e=>e.coth(),BigNumber:e=>new n(1).div(e.tanh())})}),om=`csc`,sm=W(om,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=Zp({typed:t});return t(om,{number:Co,Complex:e=>e.csc(),BigNumber:e=>new n(1).div(e.sin())},r)}),cm=`csch`,lm=W(cm,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(cm,{number:wo,Complex:e=>e.csch(),BigNumber:e=>new n(1).div(e.sinh())})}),um=`sec`,dm=W(um,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e,r=Zp({typed:t});return t(um,{number:To,Complex:e=>e.sec(),BigNumber:e=>new n(1).div(e.cos())},r)}),fm=`sech`,pm=W(fm,[`typed`,`BigNumber`],e=>{var{typed:t,BigNumber:n}=e;return t(fm,{number:Eo,Complex:e=>e.sech(),BigNumber:e=>new n(1).div(e.cosh())})}),mm=`sin`,hm=W(mm,[`typed`],e=>{var{typed:t}=e,n=Zp({typed:t});return t(mm,{number:Math.sin,"Complex | BigNumber":e=>e.sin()},n)}),gm=`sinh`,_m=W(gm,[`typed`],e=>{var{typed:t}=e;return t(gm,{number:Oo,"Complex | BigNumber":e=>e.sinh()})}),vm=`tan`,ym=W(vm,[`typed`],e=>{var{typed:t}=e,n=Zp({typed:t});return t(vm,{number:Math.tan,"Complex | BigNumber":e=>e.tan()},n)}),bm=W(`tanh`,[`typed`],e=>{var{typed:t}=e;return t(`tanh`,{number:ft,"Complex | BigNumber":e=>e.tanh()})}),xm=`setCartesian`,Sm=W(xm,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(xm,{"Array | Matrix, Array | Matrix":function(e,t){var s=[];if(r(n(e),new a(0))!==0&&r(n(t),new a(0))!==0){var c=yi(Array.isArray(e)?e:e.toArray()).sort(i),l=yi(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(var u=0;u<c.length;u++)for(var d=0;d<l.length;d++)s.push([c[u],l[d]])}return Array.isArray(e)&&Array.isArray(t)?s:new o(s)}})}),Cm=`setDifference`,wm=W(Cm,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Cm,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(r(n(e),new a(0))===0)s=[];else if(r(n(t),new a(0))===0)return yi(e.toArray());else{var c=Ti(yi(Array.isArray(e)?e:e.toArray()).sort(i)),l=Ti(yi(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var u,d=0;d<c.length;d++){u=!1;for(var f=0;f<l.length;
11f++)if(i(c[d].value,l[f].value)===0&&c[d].identifier===l[f].identifier){u=!0;break}u||s.push(c[d])}}return Array.isArray(e)&&Array.isArray(t)?Ei(s):new o(Ei(s))}})}),Tm=`setDistinct`,Em=W(Tm,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Tm,{"Array | Matrix":function(e){var t;if(r(n(e),new a(0))===0)t=[];else{var s=yi(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(s[0]);for(var c=1;c<s.length;c++)i(s[c],s[c-1])!==0&&t.push(s[c])}return Array.isArray(e)?t:new o(t)}})}),Dm=`setIntersect`,Om=W(Dm,[`typed`,`size`,`subset`,`compareNatural`,`Index`,`DenseMatrix`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Dm,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(r(n(e),new a(0))===0||r(n(t),new a(0))===0)s=[];else{var c=Ti(yi(Array.isArray(e)?e:e.toArray()).sort(i)),l=Ti(yi(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var u=0;u<c.length;u++)for(var d=0;d<l.length;d++)if(i(c[u].value,l[d].value)===0&&c[u].identifier===l[d].identifier){s.push(c[u]);break}}return Array.isArray(e)&&Array.isArray(t)?Ei(s):new o(Ei(s))}})}),km=`setIsSubset`,Am=W(km,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(km,{"Array | Matrix, Array | Matrix":function(e,t){if(r(n(e),new a(0))===0)return!0;if(r(n(t),new a(0))===0)return!1;for(var o=Ti(yi(Array.isArray(e)?e:e.toArray()).sort(i)),s=Ti(yi(Array.isArray(t)?t:t.toArray()).sort(i)),c,l=0;l<o.length;l++){c=!1;for(var u=0;u<s.length;u++)if(i(o[l].value,s[u].value)===0&&o[l].identifier===s[u].identifier){c=!0;break}if(c===!1)return!1}return!0}})}),jm=`setMultiplicity`,Mm=W(jm,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(jm,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(r(n(t),new a(0))===0)return 0;for(var o=yi(Array.isArray(t)?t:t.toArray()),s=0,c=0;c<o.length;c++)i(o[c],e)===0&&s++;return s}})}),Nm=`setPowerset`,Pm=W(Nm,[`typed`,`size`,`subset`,`compareNatural`,`Index`],e=>{var{typed:t,size:n,subset:r,compareNatural:i,Index:a}=e;return t(Nm,{"Array | Matrix":function(e){if(r(n(e),new a(0))===0)return[];for(var t=yi(Array.isArray(e)?e:e.toArray()).sort(i),c=[],l=0;l.toString(2).length<=t.length;)c.push(o(t,l.toString(2).split(``).reverse())),l++;return s(c)}});function o(e,t){for(var n=[],r=0;r<t.length;r++)t[r]===`1`&&n.push(e[r]);return n}function s(e){for(var t=[],n=e.length-1;n>0;n--)for(var r=0;r<n;r++)e[r].length>e[r+1].length&&(t=e[r],e[r]=e[r+1],e[r+1]=t);return e}}
11),Fm=`setSize`,Im=W(Fm,[`typed`,`compareNatural`],e=>{var{typed:t,compareNatural:n}=e;return t(Fm,{"Array | Matrix":function(e){return Array.isArray(e)?yi(e).length:yi(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(t===!1||e.length===0)return Array.isArray(e)?yi(e).length:yi(e.toArray()).length;for(var r=yi(Array.isArray(e)?e:e.toArray()).sort(n),i=1,a=1;a<r.length;a++)n(r[a],r[a-1])!==0&&i++;return i}})}),Lm=`setSymDifference`,Rm=W(Lm,[`typed`,`size`,`concat`,`subset`,`setDifference`,`Index`],e=>{var{typed:t,size:n,concat:r,subset:i,setDifference:a,Index:o}=e;return t(Lm,{"Array | Matrix, Array | Matrix":function(e,t){if(i(n(e),new o(0))===0)return yi(t);if(i(n(t),new o(0))===0)return yi(e);var s=yi(e),c=yi(t);return r(a(s,c),a(c,s))}})}),zm=`setUnion`,Bm=W(zm,[`typed`,`size`,`concat`,`subset`,`setIntersect`,`setSymDifference`,`Index`],e=>{var{typed:t,size:n,concat:r,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(zm,{"Array | Matrix, Array | Matrix":function(e,t){if(i(n(e),new s(0))===0)return yi(t);if(i(n(t),new s(0))===0)return yi(e);var c=yi(e),l=yi(t);return r(o(c,l),a(c,l))}})}),Vm=`add`,Hm=W(Vm,[`typed`,`matrix`,`addScalar`,`equalScalar`,`DenseMatrix`,`SparseMatrix`,`concat`],e=>{var{typed:t,matrix:n,addScalar:r,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,c=wc({typed:t}),l=Tc({typed:t,equalScalar:i}),u=Ec({typed:t,DenseMatrix:a}),d=xc({typed:t,matrix:n,concat:s});return t(Vm,{"any, any":r,"any, any, ...any":t.referToSelf(e=>(t,n,r)=>{for(var i=e(t,n),a=0;a<r.length;a++)i=e(i,r[a]);return i})},d({elop:r,DS:c,SS:l,Ss:u}))}),Um=`hypot`,Wm=W(Um,[`typed`,`abs`,`addScalar`,`divideScalar`,`multiplyScalar`,`sqrt`,`smaller`,`isPositive`],e=>{var{typed:t,abs:n,addScalar:r,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:c}=e;return t(Um,{"... number | BigNumber":l,Array:l,Matrix:e=>l(yi(e.toArray(),!0))});function l(e){for(var t=0,l=0,u=0;u<e.length;u++){if(C(e[u]))throw TypeError(`Unexpected type of argument to hypot`);var d=n(e[u]);s(l,d)?(t=a(t,a(i(l,d),i(l,d))),t=r(t,1),l=d):t=r(t,c(d)?a(i(d,l),i(d,l)):d)}return a(l,o(t))}}),Gm=`norm`,Km=W(Gm,[`typed`,`abs`,`add`,`pow`,`conj`,`sqrt`,`multiply`,`equalScalar`,`larger`,`smaller`,`matrix`,`ctranspose`,`eigs`],e=>{var{typed:t,abs:n,add:r,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:c,larger:l,smaller:u,matrix:d,ctranspose:f,eigs:p}=e;return t(Gm,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return S(d(e),2)},Matrix:function(e){return S(e,2)},"Array, number | BigNumber | string":function(e,t){return S(d(e),t)},"Matrix, number | BigNumber | string":function(e,t){return S(e,t)}});function m(e){var t=0;return e.forEach(function(e){var r=n(e);l(r,t)&&(t=r)},!0),t}function h(e){var t;return e.forEach(function(e){var r=n(e);(!t||u(r,t))&&(t=r)},!0),t||0}function g(e,t){if(t===1/0||t===`inf`)return m(e);if(t===-1/0||t===`-inf`)return h(e);if(t===`fro`)return S(e,2);if(typeof t==`number`&&!isNaN(t)){if(!c(t,0)){var a=0;return e.forEach(function(e){a=r(i(n(e),t),a)},!0),i(a,1/t)}return 1/0}throw Error(`Unsupported parameter value`)}function _(e){var t=0;return e.forEach(function(e,n){t=r(t,s(e,a(e)))}),n(o(t))}function v(e){var t=[],i=0;return e.forEach(function(e,a){var o=a[1],s=r(t[o]||0,n(e));l(s,i)&&(i=s),t[o]=s},!0),i}function y(e){var t=e.size();if(t[0]!==t[1])throw RangeError(`Invalid matrix dimensions`);var r=p(s(f(e),e)).values.toArray(),i=r[r.length-1];return n(o(i))}function b(e){var t=[],i=0;return e.forEach(function(e,a){var o=a[0],s=r(t[o]||0,n(e));l(s,i)&&(i=s),t[o]=s},!0),i}function x(e,t){if(t===1)return v(e);if(t===1/0||t===`inf`)return b(e);if(t===`fro`)return _(e);if(t===2)return y(e);throw Error(`Unsupported parameter value `+t)}function S(e,t){var n=e.size();if(n.length===1)return g(e,t);if(n.length===2){if(n[0]&&n[1])return x(e,t);throw RangeError(`Invalid matrix dimensions`)}}}),qm=`dot`,Jm=W(qm,[`typed`,`addScalar`,`multiplyScalar`,`conj`,`size`],e=>{var{typed:t,addScalar:n,multiplyScalar:r,conj:i,size:a}=e;return t(qm,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":c});function o(e,t){var n=a(e),r=a(t),i,o;if(n.length===1)i=n[0];else if(n.length===2&&n[1]===1)i=n[0];else throw RangeError(`Expected a column vector, instead got a matrix of size (`+n.join(`, `)+`)`);if(r.length===1)o=r[0];else if(r.length===2&&r[1]===1)o=r[0];else throw RangeError(`Expected a column vector, instead got a matrix of size (`+r.join(`, `)+`)`);if(i!==o)throw RangeError(`Vectors must have equal length (`+i+` != `+o+`)`);if(i===0)throw RangeError(`Cannot calculate the dot product of empty vectors`);return i}
11function s(e,s){var c=o(e,s),l=O(e)?e._data:e,u=O(e)?e._datatype||e.getDataType():void 0,d=O(s)?s._data:s,f=O(s)?s._datatype||s.getDataType():void 0,p=a(e).length===2,m=a(s).length===2,h=n,g=r;if(u&&f&&u===f&&typeof u==`string`&&u!==`mixed`){var _=u;h=t.find(n,[_,_]),g=t.find(r,[_,_])}if(!p&&!m){for(var v=g(i(l[0]),d[0]),y=1;y<c;y++)v=h(v,g(i(l[y]),d[y]));return v}if(!p&&m){for(var b=g(i(l[0]),d[0][0]),x=1;x<c;x++)b=h(b,g(i(l[x]),d[x][0]));return b}if(p&&!m){for(var S=g(i(l[0][0]),d[0]),C=1;C<c;C++)S=h(S,g(i(l[C][0]),d[C]));return S}if(p&&m){for(var w=g(i(l[0][0]),d[0][0]),T=1;T<c;T++)w=h(w,g(i(l[T][0]),d[T][0]));return w}}function c(e,t){o(e,t);for(var i=e._index,a=e._values,s=t._index,c=t._values,l=0,u=n,d=r,f=0,p=0;f<i.length&&p<s.length;){var m=i[f],h=s[p];if(m<h){f++;continue}if(m>h){p++;continue}m===h&&(l=u(l,d(a[f],c[p])),f++,p++)}return l}}),Ym=W(`trace`,[`typed`,`matrix`,`add`],e=>{var{typed:t,matrix:n,add:r}=e;return t(`trace`,{Array:function(e){return i(n(e))},SparseMatrix:a,DenseMatrix:i,any:V});function i(e){var t=e._size,n=e._data;switch(t.length){case 1:if(t[0]===1)return V(n[0]);throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);case 2:var i=t[0];if(i===t[1]){for(var a=0,o=0;o<i;o++)a=r(a,n[o][o]);return a}else throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+qr(t)+`)`)}}function a(e){var t=e._values,n=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var c=0;if(t.length>0)for(var l=0;l<s;l++)for(var u=i[l],d=i[l+1],f=u;f<d;f++){var p=n[f];if(p===l){c=r(c,t[f]);break}if(p>l)break}return c}throw RangeError(`Matrix must be square (size: `+qr(a)+`)`)}}),Xm=`index`,Zm=W(Xm,[`typed`,`Index`],e=>{var{typed:t,Index:n}=e;return t(Xm,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var t=e.map(function(e){return x(e)?e.toNumber():D(e)||O(e)?e.map(function(e){return x(e)?e.toNumber():e}):e}),r=new n;return n.apply(r,t),r}})}),Qm=new Set([`end`]),$m=W(`Node`,[`mathWithTransform`],e=>{var{mathWithTransform:t}=e;function n(e){for(var t of[...Qm])if(e.has(t))throw Error(`Scope contains an illegal symbol, "`+t+`" is a reserved keyword`)}class r{get type(){return`Node`}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){var e=this._compile(t,{}),r={},i=null;function a(t){var a=v(t);return n(a),e(a,r,i)}return{evaluate:a}}_compile(e,t){throw Error(`Method _compile must be implemented by type `+this.type)}forEach(e){throw Error(`Cannot run forEach on a Node interface`)}map(e){throw Error(`Cannot run map on a Node interface`)}_ifNode(e){if(!he(e))throw TypeError(`Callback function must return a Node`);return e}traverse(e){e(this,null,null);function t(e,n){e.forEach(function(e,r,i){n(e,r,i),t(e,n)})}t(this,e)}transform(e){function t(n,r,i){var a=e(n,r,i);return a===n?n.map(t):a}return t(this,null,null)}filter(e){var t=[];return this.traverse(function(n,r,i){e(n,r,i)&&t.push(n)}),t}clone(){throw Error(`Cannot clone a Node interface`)}cloneDeep(){return this.map(function(e){return e.cloneDeep()})}equals(e){return e?this.type===e.type&&De(this,e):!1}toString(e){var t=this._getCustomString(e);return t===void 0?this._toString(e):t}_toString(){throw Error(`_toString not implemented for `+this.type)}toJSON(){throw Error(`Cannot serialize object: toJSON not implemented by `+this.type)}toHTML(e){var t=this._getCustomString(e);return t===void 0?this._toHTML(e):t}_toHTML(){throw Error(`_toHTML not implemented for `+this.type)}toTex(e){var t=this._getCustomString(e);return t===void 0?this._toTex(e):t}_toTex(e){throw Error(`_toTex not implemented for `+this.type)}_getCustomString(e){if(e&&typeof e==`object`)switch(typeof e.handler){case`object`:case`undefined`:return;case`function`:return e.handler(this,e);default:throw TypeError(`Object or function expected as callback`)}}getIdentifier(){return this.type}getContent(){return this}}return r},{isClass:!0,isNode:!0});function eh(e){return e&&e.isIndexError?new ni(e.index+1,e.min+1,e.max===void 0?void 0:e.max+1):e}function th(e){var{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&typeof e.subset==`function`)return e.subset(n);if(typeof e==`string`)return t(e,n);if(typeof e==`object`){if(!n.isObjectProperty())throw TypeError(`Cannot apply a numeric index as object property`);return a(e,n.getObjectProperty())}else throw TypeError(`Cannot apply index: unsupported type of object`)}catch(e){throw eh(e)}}}var nh=`AccessorNode`,rh=W(nh,[`subset`,`Node`],e=>{var{subset:t,Node:n}=e,r=th({subset:t});function i(e){return!(ce(e)||R(e)||B(e)||pe(e)||ge(e)||ve(e)||xe(e))}class o extends n{constructor(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(super(),!he(e))throw TypeError(`Node expected for parameter "object"`);if(!me(t))throw TypeError(`IndexNode expected for parameter "index"`);this.object=e,this.index=t,this.optionalChaining=n}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():``:this.object.name||``}get type(){return nh}get isAccessorNode(){return!0}_compile(e,t){var n=this.object._compile(e,t),i=this.index._compile(e,t),o=this.optionalChaining,s=ce(this.object)&&this.object.optionalChaining;if(this.index.isObjectProperty()){var c=this.index.getObjectProperty();return function(e,t,r){var i=r||{},l=n(e,t,i);if(o&&l==null){i.optionalShortCircuit=!0;return}if(!(s&&i!=null&&i.optionalShortCircuit))return a(l,c)}}else return function(e,t,a){var c=a||{},l=n(e,t,c);if(o&&l==null){c.optionalShortCircuit=!0;return}if(!(s&&c!=null&&c.optionalShortCircuit))return r(l,i(e,t,l))}}forEach(e){e(this.object,`object`,this),e(this.index,`index`,this)}map(e){return new o(this._ifNode(e(this.object,`object`,this)),this._ifNode(e(this.index,`index`,this)),this.optionalChaining)}clone(){return new o(this.object,this.index,this.optionalChaining)}_toString(e){var t=this.object.toString(e);i(this.object)&&(t=`(`+t+`)`);var n=this.optionalChaining?this.index.dotNotation?`?`:`?.`:``;return t+n+this.index.toString(e)}_toHTML(e){var t=this.object.toHTML(e);return i(this.object)&&(t=`<span class="math-parenthesis math-round-parenthesis">(</span>`+t+`<span class="math-parenthesis math-round-parenthesis">)</span>`),t+this.index.toHTML(e)}_toTex(e){var t=this.object.toTex(e);return i(this.object)&&(t=`\\left(' + object + '\\right)`),t+this.index.toTex(e)}toJSON(){return{mathjs:nh,object:this.object,index:this.index,optionalChaining:this.optionalChaining}}static fromJSON(e){return new o(e.object,e.index,e.optionalChaining)}}return $u(o,`name`,nh),o},{isClass:!0,isNode:!0}),ih=`ArrayNode`,ah=W(ih,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(he))throw TypeError(`Array containing Nodes expected`)}get type(){return ih}get isArrayNode(){return!0}_compile(e,t){var n=bi(this.items,function(n){return n._compile(e,t)});if(e.config.matrix!==`Array`){var r=e.matrix;return function(e,t,i){return r(bi(n,function(n){return n(e,t,i)}))}}else return function(e,t,r){return bi(n,function(n){return n(e,t,r)})}}forEach(e){for(var t=0;t<this.items.length;t++){var n=this.items[t];e(n,`items[`+t+`]`,this)}}map(e){for(var t=[],r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],`items[`+r+`]`,this));return new n(t)}clone(){return new n(this.items.slice(0))}_toString(e){return`[`+this.items.map(function(t){return t.toString(e)}).join(`, `)+`]`}toJSON(){return{mathjs:ih,items:this.items}}static fromJSON(e){return new n(e.items)}_toHTML(e){return`<span class="math-parenthesis math-square-parenthesis">[</span>`+this.items.map(function(t){return t.toHTML(e)}).join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-square-parenthesis">]</span>`}_toTex(e){function t(n,r){var i=n.some(R)&&!n.every(R),a=r||i,o=a?`&`:`\\\\`,s=n.map(function(n){return n.items?t(n.items,!r):n.toTex(e)}).join(o);return i||!a||a&&!r?`\\begin{bmatrix}`+s+`\\end{bmatrix}`:s}return t(this.items,!1)}}return $u(n,`name`,ih),n},{isClass:!0,isNode:!0});function oh(e){var{subset:t,matrix:n}=e;return function(e,r,i){try{if(Array.isArray(e))return n(e).subset(r,i).valueOf().forEac
11h((t,n)=>{e[n]=t}),e;if(e&&typeof e.subset==`function`)return e.subset(r,i);if(typeof e==`string`)return t(e,r,i);if(typeof e==`object`){if(!r.isObjectProperty())throw TypeError(`Cannot apply a numeric index as object property`);return o(e,r.getObjectProperty(),i),e}else throw TypeError(`Cannot apply index: unsupported type of object`)}catch(e){throw eh(e)}}}var sh=[{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:nullish":{op:`??`,associativity:`left`,associativeWith:[]}},{"OperatorNode:factorial":{op:`!`,associativity:`left`}},{"OperatorNode:ctranspose":{op:`'`,associativity:`left`}}];function ch(e,t){if(!t||t!==`auto`)return e;for(var n=e;ve(n);)n=n.content;return n}function lh(e,t,n,r){var i=e;t!==`keep`&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<sh.length;s++)if(a in sh[s]){o=s;break}if(a===`OperatorNode:multiply`&&i.implicit&&n!==`show`){var c=ch(i.args[0],t);!(B(c)&&r&&r.getIdentifier()===`OperatorNode:divide`&&de(ch(r.args[0],t)))&&!(c.getIdentifier()===`OperatorNode:divide`&&de(ch(c.args[0],t))&&B(ch(c.args[1])))&&(o+=1)}return o}function uh(e,t){var n=e;t!==`keep`&&(n=e.getContent());var r=n.getIdentifier(),i=lh(n,t);if(i===null)return null;var a=sh[i][r];if(H(a,`associativity`)){if(a.associativity===`left`)return`left`;if(a.associativity===`right`)return`right`;throw Error(`'`+r+`' has the invalid associativity '`+a.associativity+`'.`)}return null}function dh(e,t,n){var r=n===`keep`?e:e.getContent(),i=n===`keep`?t:e.getContent(),a=r.getIdentifier(),o=i.getIdentifier(),s=lh(r,n);if(s===null)return null;var c=sh[s][a];if(H(c,`associativeWith`)&&c.associativeWith instanceof Array){for(var l=0;l<c.associativeWith.length;l++)if(c.associativeWith[l]===o)return!0;return!1}return null}function fh(e){var t=`OperatorNode:`+e;for(var n of sh)if(t in n)return n[t].op;return null}var ph=`AssignmentNode`,mh=W(ph,[`subset`,`?matrix`,`Node`],e=>{var{subset:t,matrix:n,Node:r}=e,i=th({subset:t}),s=oh({subset:t,matrix:n});
11function c(e,t,n){t||=`keep`;var r=lh(e,t,n),i=lh(e.value,t,n);return t===`all`||i!==null&&i<=r}class l extends r{constructor(e,t,n){if(super(),this.object=e,this.index=n?t:null,this.value=n||t,!xe(e)&&!ce(e))throw TypeError(`SymbolNode or AccessorNode expected as "object"`);if(xe(e)&&e.name===`end`)throw Error(`Cannot assign to symbol "end"`);if(this.index&&!me(this.index))throw TypeError(`IndexNode expected as "index"`);if(!he(this.value))throw TypeError(`Node expected as "value"`)}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():``:this.object.name||``}get type(){return ph}get isAssignmentNode(){return!0}_compile(e,t){var n=this.object._compile(e,t),r=this.index?this.index._compile(e,t):null,c=this.value._compile(e,t),l=this.object.name;if(!this.index){if(!xe(this.object))throw TypeError(`SymbolNode expected as object`);return function(e,t,n){var r=c(e,t,n);return e.set(l,r),r}}else if(this.index.isObjectProperty()){var u=this.index.getObjectProperty();return function(e,t,r){var i=n(e,t,r),a=c(e,t,r);return o(i,u,a),a}}else if(xe(this.object))return function(e,t,i){var a=n(e,t,i),o=c(e,t,i),u=r(e,t,a);return e.set(l,s(a,u,o)),o};else{var d=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){var f=this.object.index.getObjectProperty();return function(e,t,n){var i=d(e,t,n),l=a(i,f),u=r(e,t,l),p=c(e,t,n);return o(i,f,s(l,u,p)),p}}else{var p=this.object.index._compile(e,t);return function(e,t,n){var a=d(e,t,n),o=p(e,t,a),l=i(a,o),u=r(e,t,l),f=c(e,t,n);return s(a,o,s(l,u,f)),f}}}}forEach(e){e(this.object,`object`,this),this.index&&e(this.index,`index`,this),e(this.value,`value`,this)}map(e){var t=this._ifNode(e(this.object,`object`,this)),n=this.index?this._ifNode(e(this.index,`index`,this)):null,r=this._ifNode(e(this.value,`value`,this));return new l(t,n,r)}clone(){return new l(this.object,this.index,this.value)}_toString(e){var t=this.object.toString(e),n=this.index?this.index.toString(e):``,r=this.value.toString(e);return c(this,e&&e.parenthesis,e&&e.implicit)&&(r=`(`+r+`)`),t+n+` = `+r}toJSON(){return{mathjs:ph,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new l(e.object,e.index,e.value)}_toHTML(e){var t=this.object.toHTML(e),n=this.index?this.index.toHTML(e):``,r=this.value.toHTML(e);return c(this,e&&e.parenthesis,e&&e.implicit)&&(r=`<span class="math-paranthesis math-round-parenthesis">(</span>`+r+`<span class="math-paranthesis math-round-parenthesis">)</span>`),t+n+`<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>`+r}_toTex(e){var t=this.object.toTex(e),n=this.index?this.index.toTex(e):``,r=this.value.toTex(e);return c(this,e&&e.parenthesis,e&&e.implicit)&&(r=`\\left(${r}\\right)`),t+n+`=`+r}}return $u(l,`name`,ph),l},{isClass:!0,isNode:!0}),hh=`BlockNode`,gh=W(hh,[`ResultSet`,`Node`],e=>{var{ResultSet:t,Node:n}=e;class r extends n{constructor(e){if(super(),!Array.isArray(e))throw Error(`Array expected`);this.blocks=e.map(function(e){var t=e&&e.node,n=e&&e.visible!==void 0?e.visible:!0;if(!he(t))throw TypeError(`Property "node" must be a Node`);if(typeof n!=`boolean`)throw TypeError(`Property "visible" must be a boolean`);return{node:t,visible:n}})}get type(){return hh}get isBlockNode(){return!0}_compile(e,n){var r=bi(this.blocks,function(t){return{evaluate:t.node._compile(e,n),visible:t.visible}});return function(e,n,i){var a=[];return xi(r,function(t){var r=t.evaluate(e,n,i);t.visible&&a.push(r)}),new t(a)}}forEach(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,`blocks[`+t+`].node`,this)}map(e){for(var t=[],n=0;n<this.blocks.length;n++){var i=this.blocks[n];t[n]={node:this._ifNode(e(i.node,`blocks[`+n+`].node`,this)),visible:i.visible}}return new r(t)}clone(){var e=this.blocks.map(function(e){return{node:e.node,visible:e.visible}});return new r(e)}_toString(e){return this.blocks.map(function(t){return t.node.toString(e)+(t.visible?``:`;`)}).join(`
12`)}toJSON(){return{mathjs:hh,blocks:this.blocks}}static fromJSON(e){return new r(e.blocks)}_toHTML(e){return this.blocks.map(function(t){return t.node.toHTML(e)+(t.visible?``:`<span class="math-separator">;</span>`)}).join(`<span class="math-separator"><br /></span>`)}_toTex(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?``:`;`)}).join(`\\;\\;
13`)}}return $u(r,`name`,hh),r},{isClass:!0,isNode:!0}),_h=`ConditionalNode`,vh=W(_h,[`Node`],e=>{var{Node:t}=e;function n(e){if(typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return!!e;if(e){if(x(e))return!e.isZero();
13if(C(e))return!!(e.re||e.im);if(T(e))return!!e.value}if(e==null)return!1;throw TypeError(`Unsupported type of condition "`+Ce(e)+`"`)}class r extends t{constructor(e,t,n){if(super(),!he(e))throw TypeError(`Parameter condition must be a Node`);if(!he(t))throw TypeError(`Parameter trueExpr must be a Node`);if(!he(n))throw TypeError(`Parameter falseExpr must be a Node`);this.condition=e,this.trueExpr=t,this.falseExpr=n}get type(){return _h}get isConditionalNode(){return!0}_compile(e,t){var r=this.condition._compile(e,t),i=this.trueExpr._compile(e,t),a=this.falseExpr._compile(e,t);return function(e,t,o){return n(r(e,t,o))?i(e,t,o):a(e,t,o)}}forEach(e){e(this.condition,`condition`,this),e(this.trueExpr,`trueExpr`,this),e(this.falseExpr,`falseExpr`,this)}map(e){return new r(this._ifNode(e(this.condition,`condition`,this)),this._ifNode(e(this.trueExpr,`trueExpr`,this)),this._ifNode(e(this.falseExpr,`falseExpr`,this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=lh(this,t,e&&e.implicit),r=this.condition.toString(e),i=lh(this.condition,t,e&&e.implicit);(t===`all`||this.condition.type===`OperatorNode`||i!==null&&i<=n)&&(r=`(`+r+`)`);var a=this.trueExpr.toString(e),o=lh(this.trueExpr,t,e&&e.implicit);(t===`all`||this.trueExpr.type===`OperatorNode`||o!==null&&o<=n)&&(a=`(`+a+`)`);var s=this.falseExpr.toString(e),c=lh(this.falseExpr,t,e&&e.implicit);return(t===`all`||this.falseExpr.type===`OperatorNode`||c!==null&&c<=n)&&(s=`(`+s+`)`),r+` ? `+a+` : `+s}toJSON(){return{mathjs:_h,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new r(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=lh(this,t,e&&e.implicit),r=this.condition.toHTML(e),i=lh(this.condition,t,e&&e.implicit);(t===`all`||this.condition.type===`OperatorNode`||i!==null&&i<=n)&&(r=`<span class="math-parenthesis math-round-parenthesis">(</span>`+r+`<span class="math-parenthesis math-round-parenthesis">)</span>`);var a=this.trueExpr.toHTML(e),o=lh(this.trueExpr,t,e&&e.implicit);(t===`all`||this.trueExpr.type===`OperatorNode`||o!==null&&o<=n)&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`);var s=this.falseExpr.toHTML(e),c=lh(this.falseExpr,t,e&&e.implicit);return(t===`all`||this.falseExpr.type===`OperatorNode`||c!==null&&c<=n)&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),r+`<span class="math-operator math-conditional-operator">?</span>`+a+`<span class="math-operator math-conditional-operator">:</span>`+s}_toTex(e){return`\\begin{cases} {`+this.trueExpr.toTex(e)+`}, &\\quad{\\text{if }\\;`+this.condition.toTex(e)+`}\\\\{`+this.falseExpr.toTex(e)+`}, &\\quad{\\text{otherwise}}\\end{cases}`}}return $u(r,`name`,_h),r},{isClass:!0,isNode:!0}),yh=e(n(((e,t)=>{var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r={"{":`\\{`,"}":`\\}`,"\\":`\\textbackslash{}`,"#":`\\#`,$:`\\$`,"%":`\\%`,"&":`\\&`,"^":`\\textasciicircum{}`,_:`\\_`,"~":`\\textasciitilde{}`},i={"–":`\\--`,"—":`\\---`," ":`~`,"	":`\\qquad{}`,"\r\n":`\\newline{}`,"\n":`\\newline{}`},a=function(e,t){return n({},e,t)};t.exports=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t.preserveFormatting,s=o===void 0?!1:o,c=t.escapeMapFn,l=c===void 0?a:c,u=String(e),d=``,f=l(n({},r),s?n({},i):{}),p=Object.keys(f),m=function(){var e=!1;p.forEach(function(t,n){e||u.length>=t.length&&u.slice(0,t.length)===t&&(d+=f[p[n]],u=u.slice(t.length,u.length),e=!0)}),e||(d+=u.slice(0,1),u=u.slice(1,u.length))};u;)m();return d}}))(),1),bh={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{?}`},xh={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`},Sh={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${xh.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]}${xh.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${xh.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${xh.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${xh.pow}{\${args[0]}}-1\\right)`,fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},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]}${xh.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${xh.multiply}\${args[1]}\\right)`},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"}
13,nthRoots:{2:"\\{y : y^${args[1]} = {${args[0]}}\\}"},pow:{2:`\\left(\${args[0]}\\right)${xh.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]}${xh.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${xh.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${xh.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${xh.bitAnd}\${args[1]}\\right)`},bitNot:{1:xh.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${xh.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${xh.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${xh.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${xh.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${xh.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]}${xh.and}\${args[1]}\\right)`},not:{1:xh.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${xh.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${xh.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${xh.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]}}${xh.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${xh.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${xh.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${xh.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${xh.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${xh.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${xh.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${xh.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${xh.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]}${xh.to}\${args[1]}\\right)`},numeric:function(e,t){return e.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)"},bigint:{0:`0`,1:"\\left(${args[0]}\\right)"},complex:{0:`0`,1:"\\left(${args[0]}\\right)",2:`\\left(\\left(\${args[0]}\\right)+${bh.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)"}},Ch="\\mathrm{${name}}\\left(${args}\\right)",wh={deg:`^\\circ`};function Th(e){return(0,yh.default)(e,{preserveFormatting:!0})}function Eh(e,t){return t=t===void 0?!1:t,t?H(wh,e)?wh[e]:`\\mathrm{`+Th(e)+`}`:H(bh,e)?bh[e]:Th(e)}var Dh=`ConstantNode`,Oh=W(Dh,[`Node`,`isBounded`],e=>{var{Node:t,isBounded:n}=e;class r extends t{constructor(e){super(),this.value=e}get type(){return Dh}get isConstantNode(){return!0}_compile(e,t){var n=this.value;return function(){return n}}forEach(e){}map(e){return this.clone()}clone(){return new r(this.value)}_toString(e){return qr(this.value,e)}_toHTML(e){var t=this._toString(e);switch(Ce(this.value)){case`number`:case`bigint`:case`BigNumber`:case`Fraction`:return`<span class="math-number">
13`+t+`</span>`;case`string`:return`<span class="math-string">`+t+`</span>`;case`boolean`:return`<span class="math-boolean">`+t+`</span>`;case`null`:return`<span class="math-null-symbol">`+t+`</span>`;case`undefined`:return`<span class="math-undefined">`+t+`</span>`;default:return`<span class="math-symbol">`+t+`</span>`}}toJSON(){return{mathjs:Dh,value:this.value}}static fromJSON(e){return new r(e.value)}_toTex(e){var t=this._toString(e);switch(Ce(this.value)){case`string`:return`\\mathtt{`+Th(t)+`}`;case`number`:case`BigNumber`:if(!n(this.value))return this.value.valueOf()<0?`-\\infty`:`\\infty`;var r=t.toLowerCase().indexOf(`e`);return r===-1?t:t.substring(0,r)+`\\cdot10^{`+t.substring(r+1)+`}`;case`bigint`:return t.toString();case`Fraction`:return this.value.toLatex();default:return t}}}return $u(r,`name`,Dh),r},{isClass:!0,isNode:!0}),kh=`FunctionAssignmentNode`,Ah=W(kh,[`typed`,`Node`],e=>{var{typed:t,Node:n}=e;function r(e,t,n){var r=lh(e,t,n),i=lh(e.expr,t,n);return t===`all`||i!==null&&i<=r}class i extends n{constructor(e,t,n){if(super(),typeof e!=`string`)throw TypeError(`String expected for parameter "name"`);
13if(!Array.isArray(t))throw TypeError(`Array containing strings or objects expected for parameter "params"`);if(!he(n))throw TypeError(`Node expected for parameter "expr"`);if(Qm.has(e))throw Error(`Illegal function name, "`+e+`" is a reserved keyword`);var r=new Set;for(var i of t){var a=typeof i==`string`?i:i.name;if(r.has(a))throw Error(`Duplicate parameter name "${a}"`);r.add(a)}this.name=e,this.params=t.map(function(e){return e&&e.name||e}),this.types=t.map(function(e){return e&&e.type||`any`}),this.expr=n}get type(){return kh}get isFunctionAssignmentNode(){return!0}_compile(e,n){var r=Object.create(n);xi(this.params,function(e){r[e]=!0});var i=this.expr,a=i._compile(e,r),o=this.name,s=this.params,c=wi(this.types,`,`),l=o+`(`+wi(this.params,`, `)+`)`;return function(e,n,r){var u={};u[c]=function(){for(var t=Object.create(n),i=0;i<s.length;i++)t[s[i]]=arguments[i];return a(e,t,r)};var d=t(o,u);return d.syntax=l,d.expr=i.toString(),e.set(o,d),d}}forEach(e){e(this.expr,`expr`,this)}map(e){var t=this._ifNode(e(this.expr,`expr`,this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=this.expr.toString(e);return r(this,t,e&&e.implicit)&&(n=`(`+n+`)`),this.name+`(`+this.params.join(`, `)+`) = `+n}toJSON(){var e=this.types;return{mathjs:kh,name:this.name,params:this.params.map(function(t,n){return{name:t,type:e[n]}}),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,n=[],i=0;i<this.params.length;i++)n.push(`<span class="math-symbol math-parameter">`+Zr(this.params[i])+`</span>`);var a=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`),`<span class="math-function">`+Zr(this.name)+`</span><span class="math-parenthesis math-round-parenthesis">(</span>`+n.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>`+a}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n=`\\left(${n}\\right)`),`\\mathrm{`+this.name+`}\\left(`+this.params.map(Eh).join(`,`)+`\\right)=`+n}}return $u(i,`name`,kh),i},{isClass:!0,isNode:!0}),jh=`IndexNode`,Mh=W(jh,[`Node`,`size`],e=>{var{Node:t,size:n}=e;class r extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(he))throw TypeError(`Array containing Nodes expected for parameter "dimensions"`);if(this.dotNotation&&!this.isObjectProperty())throw Error(`dotNotation only applicable for object properties`)}get type(){return jh}get isIndexNode(){return!0}_compile(e,t){var r=bi(this.dimensions,function(r,i){if(r.filter(e=>e.isSymbolNode&&e.name===`end`).length>0){var a=Object.create(t);a.end=!0;var o=r._compile(e,a);return function(e,t,r){if(!O(r)&&!D(r)&&!E(r))throw TypeError(`Cannot resolve "end": context must be a Matrix, Array, or string but is `+Ce(r));var a=n(r),s=Object.create(t);return s.end=a[i],o(e,s,r)}}else return r._compile(e,t)}),i=a(e,`index`);return function(e,t,n){return i(...bi(r,function(r){return r(e,t,n)}))}}forEach(e){for(var t=0;t<this.dimensions.length;t++)e(this.dimensions[t],`dimensions[`+t+`]`,this)}map(e){for(var t=[],n=0;n<this.dimensions.length;n++)t[n]=this._ifNode(e(this.dimensions[n],`dimensions[`+n+`]`,this));return new r(t,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&B(this.dimensions[0])&&typeof this.dimensions[0].value==`string`}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?`.`+this.getObjectProperty():`[`+this.dimensions.join(`, `)+`]`}toJSON(){return{mathjs:jh,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new r(e.dimensions,e.dotNotation)}_toHTML(e){for(var t=[],n=0;n<this.dimensions.length;n++)t[n]=this.dimensions[n].toHTML();return this.dotNotation?`<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">`+Zr(this.getObjectProperty())+`</span>`:`<span class="math-parenthesis math-square-parenthesis">[</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-square-parenthesis">]</span>`}_toTex(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?`.`+this.getObjectProperty():`_{`+t.join(`,`)+`}`}}return $u(r,`name`,jh),r},{isClass:!0,isNode:!0}),Nh=`ObjectNode`,Ph=W(Nh,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),this.properties=e||{},e&&(typeof e!=`object`||!Object.keys(e).every(function(t){return he(e[t])})))throw TypeError(`Object containing Nodes expected`)}get type(){return Nh}get isObjectNode(){return!0}_compile(e,t){var n={};for(var r in this.properties)if(H(this.properties,r)){var i=Yr(r),o=JSON.parse(i);n[o]=a(this.properties,r)._compile(e,t)}return function(e,t,r){var i={};for(var a in n)H(n,a)&&(i[a]=n[a](e,t,r));return i}}forEach(e){for(var t in this.properties)H(this.properties,t)&&e(this.properties[t],`properties[`+Yr(t)+`]`,this)}map(e){var t={};for(var r in this.properties)H(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],`properties[`+Yr(r)+`]`,this)));return new n(t)}clone(){var e={};for(var t in this.properties)H(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)}_toString(e){var t=[];
13for(var n in this.properties)H(this.properties,n)&&t.push(Yr(n)+`: `+this.properties[n].toString(e));return`{`+t.join(`, `)+`}`}toJSON(){return{mathjs:Nh,properties:this.properties}}static fromJSON(e){return new n(e.properties)}_toHTML(e){var t=[];for(var n in this.properties)H(this.properties,n)&&t.push(`<span class="math-symbol math-property">`+Zr(n)+`</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>`+this.properties[n].toHTML(e));return`<span class="math-parenthesis math-curly-parenthesis">{</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-parenthesis math-curly-parenthesis">}</span>`}_toTex(e){var t=[];for(var n in this.properties)H(this.properties,n)&&t.push(`\\mathbf{`+n+`:} & `+this.properties[n].toTex(e)+`\\\\`);return`\\left\\{\\begin{array}{ll}`+t.join(`
14`)+`\\end{array}\\right\\}`}}return $u(n,`name`,Nh),n},{isClass:!0,isNode:!0});function Fh(e,t){return new h(e,new m(t),new Set(Object.keys(t)))}var Ih=`OperatorNode`,Lh=W(Ih,[`Node`],e=>{var{Node:t}=e;function n(e,t){var r=e;if(t===`auto`)for(;ve(r);)r=r.content;return B(r)?!0:_e(r)?n(r.args[0],t):!1}function r(e,t,r,i,a){var o=lh(e,t,r),s=uh(e,t);if(t===`all`||i.length>2&&e.getIdentifier()!==`OperatorNode:add`&&e.getIdentifier()!==`OperatorNode:multiply`)return i.map(function(e){switch(e.getContent().type){case`ArrayNode`:case`ConstantNode`:case`SymbolNode`:case`ParenthesisNode`:return!1;default:return!0}});var c;switch(i.length){case 0:c=[];break;case 1:var l=lh(i[0],t,r,e);if(a&&l!==null){var u,d;if(t===`keep`?(u=i[0].getIdentifier(),d=e.getIdentifier()):(u=i[0].getContent().getIdentifier(),d=e.getContent().getIdentifier()),sh[o][d].latexLeftParens===!1){c=[!1];break}if(sh[l][u].latexParens===!1){c=[!1];break}}if(l===null){c=[!1];break}if(l<=o){c=[!0];break}c=[!1];break;case 2:var f,p=lh(i[0],t,r,e),m=dh(e,i[0],t);f=p===null?!1:p===o&&s===`right`&&!m?!0:p<o;var h,g=lh(i[1],t,r,e),_=dh(e,i[1],t);if(h=g===null?!1:g===o&&s===`left`&&!_?!0:g<o,a){var v,y,b;t===`keep`?(v=e.getIdentifier(),y=e.args[0].getIdentifier(),b=e.args[1].getIdentifier()):(v=e.getContent().getIdentifier(),y=e.args[0].getContent().getIdentifier(),b=e.args[1].getContent().getIdentifier()),p!==null&&(sh[o][v].latexLeftParens===!1&&(f=!1),sh[p][y].latexParens===!1&&(f=!1)),g!==null&&(sh[o][v].latexRightParens===!1&&(h=!1),sh[g][b].latexParens===!1&&(h=!1))}c=[f,h];break;default:(e.getIdentifier()===`OperatorNode:add`||e.getIdentifier()===`OperatorNode:multiply`)&&(c=i.map(function(n){var i=lh(n,t,r,e),a=dh(e,n,t),c=uh(n,t);return i===null?!1:o===i&&s===c&&!a?!0:i<o}));break}if(i.length>=2&&e.getIdentifier()===`OperatorNode:multiply`&&e.implicit&&t!==`all`&&r===`hide`)for(var x=1;x<c.length;++x)n(i[x],t)&&!c[x-1]&&(t!==`keep`||!ve(i[x-1]))&&(c[x]=!0);return c}class i extends t{constructor(e,t,n,r,i){if(super(),typeof e!=`string`)throw TypeError(`string expected for parameter "op"`);if(typeof t!=`string`)throw TypeError(`string expected for parameter "fn"`);if(!Array.isArray(n)||!n.every(he))throw TypeError(`Array containing Nodes expected for parameter "args"`);this.implicit=r===!0,this.isPercentage=i===!0,this.op=e,this.fn=t,this.args=n||[]}get type(){return Ih}get isOperatorNode(){return!0}_compile(e,t){if(typeof this.fn!=`string`||!d(e,this.fn))throw e[this.fn]?Error(`No access to function "`+this.fn+`"`):Error(`Function `+this.fn+` missing in provided namespace "math"`);var n=a(e,this.fn),r=bi(this.args,function(n){return n._compile(e,t)});if(typeof n==`function`&&n.rawArgs===!0){var i=this.args;return function(t,r,a){return n(i,e,Fh(t,r))}}else if(r.length===1){var o=r[0];return function(e,t,r){return n(o(e,t,r))}}else if(r.length===2){var s=r[0],c=r[1];return function(e,t,r){return n(s(e,t,r),c(e,t,r))}}else return function(e,t,i){return n.apply(null,bi(r,function(n){return n(e,t,i)}))}}forEach(e){for(var t=0;t<this.args.length;t++)e(this.args[t],`args[`+t+`]`,this)}map(e){for(var t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],`args[`+n+`]`,this));
14return new i(this.op,this.fn,t,this.implicit,this.isPercentage)}clone(){return new i(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(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!1);if(i.length===1){var o=uh(this,t),s=i[0].toString(e);a[0]&&(s=`(`+s+`)`);var c=/[a-zA-Z]+/.test(this.op);return o===`right`?this.op+(c?` `:``)+s:o===`left`?s+(c?` `:``)+this.op:s+this.op}else if(i.length===2){var l=i[0].toString(e),u=i[1].toString(e);return a[0]&&(l=`(`+l+`)`),a[1]&&(u=`(`+u+`)`),this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?l+` `+u:l+` `+this.op+` `+u}else if(i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)){var d=i.map(function(t,n){return t=t.toString(e),a[n]&&(t=`(`+t+`)`),t});return this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?d.join(` `):d.join(` `+this.op+` `)}else return this.fn+`(`+this.args.join(`, `)+`)`}toJSON(){return{mathjs:Ih,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new i(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!1);if(i.length===1){var o=uh(this,t),s=i[0].toHTML(e);return a[0]&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),o===`right`?`<span class="math-operator math-unary-operator math-lefthand-unary-operator">`+Zr(this.op)+`</span>`+s:s+`<span class="math-operator math-unary-operator math-righthand-unary-operator">`+Zr(this.op)+`</span>`}else if(i.length===2){var c=i[0].toHTML(e),l=i[1].toHTML(e);return a[0]&&(c=`<span class="math-parenthesis math-round-parenthesis">(</span>`+c+`<span class="math-parenthesis math-round-parenthesis">)</span>`),a[1]&&(l=`<span class="math-parenthesis math-round-parenthesis">(</span>`+l+`<span class="math-parenthesis math-round-parenthesis">)</span>`),this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?c+`<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>`+l:c+`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+Zr(this.op)+`</span>`+l}else{var u=i.map(function(t,n){return t=t.toHTML(e),a[n]&&(t=`<span class="math-parenthesis math-round-parenthesis">(</span>`+t+`<span class="math-parenthesis math-round-parenthesis">)</span>`),t});return i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)?this.implicit&&this.getIdentifier()===`OperatorNode:multiply`&&n===`hide`?u.join(`<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>`):u.join(`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+Zr(this.op)+`</span>`):`<span class="math-function">`+Zr(this.fn)+`</span><span class="math-paranthesis math-round-parenthesis">(</span>`+u.join(`<span class="math-separator">,</span>`)+`<span class="math-paranthesis math-round-parenthesis">)</span>`}}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,n=e&&e.implicit?e.implicit:`hide`,i=this.args,a=r(this,t,n,i,!0),o=xh[this.fn];if(o=o===void 0?this.op:o,i.length===1){var s=uh(this,t),c=i[0].toTex(e);return a[0]&&(c=`\\left(${c}\\right)`),s===`right`?o+c:c+o}else if(i.length===2){var l=i[0],u=l.toTex(e);a[0]&&(u=`\\left(${u}\\right)`);var d=i[1].toTex(e);a[1]&&(d=`\\left(${d}\\right)`);var f=t===`keep`?l.getIdentifier():l.getContent().getIdentifier();switch(this.getIdentifier()){case`OperatorNode:divide`:return o+`{`+u+`}{`+d+`}`;case`OperatorNode:pow`:switch(u=`{`+u+`}`,d=`{`+d+`}`,f){case`ConditionalNode`:case`OperatorNode:divide`:u=`\\left(${u}\\right)`}break;case`OperatorNode:multiply`:if(this.implicit&&n===`hide`)return u+`~`+d}return u+o+d}else if(i.length>2&&(this.getIdentifier()===`OperatorNode:add`||this.getIdentifier()===`OperatorNode:multiply`)){var p=i.map(function(t,n){return t=t.toTex(e),a[n]&&(t=`\\left(${t}\\right)`),t});return this.getIdentifier()===`OperatorNode:multiply`&&this.impl
14icit&&n===`hide`?p.join(`~`):p.join(o)}else return`\\mathrm{`+this.fn+`}\\left(`+i.map(function(t){return t.toTex(e)}).join(`,`)+`\\right)`}getIdentifier(){return this.type+`:`+this.fn}}return $u(i,`name`,Ih),i},{isClass:!0,isNode:!0}),Rh=`ParenthesisNode`,zh=W(Rh,[`Node`],e=>{var{Node:t}=e;class n extends t{constructor(e){if(super(),!he(e))throw TypeError(`Node expected for parameter "content"`);this.content=e}get type(){return Rh}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,`content`,this)}map(e){var t=e(this.content,`content`,this);return new n(t)}clone(){return new n(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`(`+this.content.toString(e)+`)`:this.content.toString(e)}toJSON(){return{mathjs:Rh,content:this.content}}static fromJSON(e){return new n(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`<span class="math-parenthesis math-round-parenthesis">(</span>`+this.content.toHTML(e)+`<span class="math-parenthesis math-round-parenthesis">)</span>`:this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&e.parenthesis===`keep`?`\\left(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return $u(n,`name`,Rh),n},{isClass:!0,isNode:!0}),Bh=`RangeNode`,Vh=W(Bh,[`Node`],e=>{var{Node:t}=e;function n(e,t,n){var r=lh(e,t,n),i={},a=lh(e.start,t,n);if(i.start=a!==null&&a<=r||t===`all`,e.step){var o=lh(e.step,t,n);i.step=o!==null&&o<=r||t===`all`}var s=lh(e.end,t,n);return i.end=s!==null&&s<=r||t===`all`,i}class r extends t{constructor(e,t,n){if(super(),!he(e)||!he(t)||n&&!he(n))throw TypeError(`Node expected`);if(arguments.length>3)throw Error(`Too many arguments`);this.start=e,this.end=t,this.step=n||null}get type(){return Bh}get isRangeNode(){return!0}needsEnd(){return this.filter(function(e){return xe(e)&&e.name===`end`}).length>0}_compile(e,t){var n=e.range,r=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){var a=this.step._compile(e,t);return function(e,t,o){return n(r(e,t,o),i(e,t,o),a(e,t,o))}}else return function(e,t,a){return n(r(e,t,a),i(e,t,a))}}forEach(e){e(this.start,`start`,this),e(this.end,`end`,this),this.step&&e(this.step,`step`,this)}map(e){return new r(this._ifNode(e(this.start,`start`,this)),this._ifNode(e(this.end,`end`,this)),this.step&&this._ifNode(e(this.step,`step`,this)))}clone(){return new r(this.start,this.end,this.step&&this.step)}_toString(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i,a=this.start.toString(e);if(r.start&&(a=`(`+a+`)`),i=a,this.step){var o=this.step.toString(e);r.step&&(o=`(`+o+`)`),i+=`:`+o}var s=this.end.toString(e);return r.end&&(s=`(`+s+`)`),i+=`:`+s,i}toJSON(){return{mathjs:Bh,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new r(e.start,e.end,e.step)}_toHTML(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i,a=this.start.toHTML(e);if(r.start&&(a=`<span class="math-parenthesis math-round-parenthesis">(</span>`+a+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i=a,this.step){var o=this.step.toHTML(e);r.step&&(o=`<span class="math-parenthesis math-round-parenthesis">(</span>`+o+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i+=`<span class="math-operator math-range-operator">:</span>`+o}var s=this.end.toHTML(e);return r.end&&(s=`<span class="math-parenthesis math-round-parenthesis">(</span>`+s+`<span class="math-parenthesis math-round-parenthesis">)</span>`),i+=`<span class="math-operator math-range-operator">:</span>`+s,i}_toTex(e){var t=e&&e.parenthesis?e.parenthesis:`keep`,r=n(this,t,e&&e.implicit),i=this.start.toTex(e);if(r.start&&(i=`\\left(${i}\\right)`),this.step){var a=this.step.toTex(e);r.step&&(a=`\\left(${a}\\right)`),i+=`:`+a}var o=this.end.toTex(e);return r.end&&(o=`\\left(${o}\\right)`),i+=`:`+o,i}}return $u(r,`name`,Bh),r},{isClass:!0,isNode:!0}),Hh=`RelationalNode`,Uh=W(Hh,[`Node`],e=>{var{Node:t}=e,n={equal:`==`,unequal:`!=`,smaller:`<`,larger:`>`,smallerEq:`<=`,largerEq:`>=`};class r extends t{constructor(e,t){if(super(),!Array.isArray(e))throw TypeError(`Parameter conditionals must be an array`);if(!Array.isArray(t))throw TypeError(`Parameter params must be an array`);if(e.length!==t.length-1)throw TypeError(`Parameter params must contain exactly one more element than parameter conditionals`);this.conditionals=e,this.params=t}get type(){return Hh}get isRelationalNode(){return!0}_compile(e,t){var n=this,r=this.params.map(n=>n._compile(e,t));return function(t,i,o){for(var s,c=r[0](t,i,o),l=0;l<n.conditionals.length;l++)if(s=c,c=r[l+1](t,i,o),!a(e,n.conditionals[l])(s,c))return!1;return!0}}
14forEach(e){this.params.forEach((t,n)=>e(t,`params[`+n+`]`,this),this)}map(e){return new r(this.conditionals.slice(),this.params.map((t,n)=>this._ifNode(e(t,`params[`+n+`]`,this)),this))}clone(){return new r(this.conditionals,this.params)}_toString(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,r=lh(this,t,e&&e.implicit),i=this.params.map(function(n,i){var a=lh(n,t,e&&e.implicit);return t===`all`||a!==null&&a<=r?`(`+n.toString(e)+`)`:n.toString(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+=` `+n[this.conditionals[o]],a+=` `+i[o+1];return a}toJSON(){return{mathjs:Hh,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new r(e.conditionals,e.params)}_toHTML(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,r=lh(this,t,e&&e.implicit),i=this.params.map(function(n,i){var a=lh(n,t,e&&e.implicit);return t===`all`||a!==null&&a<=r?`<span class="math-parenthesis math-round-parenthesis">(</span>`+n.toHTML(e)+`<span class="math-parenthesis math-round-parenthesis">)</span>`:n.toHTML(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+=`<span class="math-operator math-binary-operator math-explicit-binary-operator">`+Zr(n[this.conditionals[o]])+`</span>`+i[o+1];return a}_toTex(e){for(var t=e&&e.parenthesis?e.parenthesis:`keep`,n=lh(this,t,e&&e.implicit),r=this.params.map(function(r,i){var a=lh(r,t,e&&e.implicit);return t===`all`||a!==null&&a<=n?`\\left(`+r.toTex(e)+`\right)`:r.toTex(e)}),i=r[0],a=0;a<this.conditionals.length;a++)i+=xh[this.conditionals[a]]+r[a+1];return i}}return $u(r,`name`,Hh),r},{isClass:!0,isNode:!0}),Wh=W(`SymbolNode`,[`math`,`?Unit`,`Node`],e=>{var{math:t,Unit:n,Node:r}=e;function i(e){return n?n.isValuelessUnit(e):!1}class o extends r{constructor(e){if(super(),typeof e!=`string`)throw TypeError(`String expected for parameter "name"`);this.name=e}get type(){return`SymbolNode`}get isSymbolNode(){return!0}_compile(e,t){var r=this.name;if(t[r]===!0)return function(e,t,n){return a(t,r)};if(r in e)return function(t,n,i){return t.has(r)?t.get(r):a(e,r)};var s=i(r);return function(e,t,i){return e.has(r)?e.get(r):s?new n(null,r):o.onUndefinedSymbol(r)}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw Error(`Undefined symbol `+e)}clone(){return new o(this.name)}_toString(e){return this.name}_toHTML(e){var t=Zr(this.name);return t===`true`||t===`false`?`<span class="math-symbol math-boolean">`+t+`</span>`:t===`i`?`<span class="math-symbol math-imaginary-symbol">`+t+`</span>`:t===`Infinity`?`<span class="math-symbol math-infinity-symbol">`+t+`</span>`:t===`NaN`?`<span class="math-symbol math-nan-symbol">`+t+`</span>`:t===`null`?`<span class="math-symbol math-null-symbol">`+t+`</span>`:t===`undefined`?`<span class="math-symbol math-undefined-symbol">`+t+`</span>`:`<span class="math-symbol">`+t+`</span>`}toJSON(){return{mathjs:`SymbolNode`,name:this.name}}static fromJSON(e){return new o(e.name)}_toTex(e){var n=!1;t[this.name]===void 0&&i(this.name)&&(n=!0);var r=Eh(this.name,n);return r[0]===`\\`?r:` `+r}}return o},{isClass:!0,isNode:!0}),Gh=`FunctionNode`,Kh=W(Gh,[`math`,`Node`,`SymbolNode`],e=>{var t,{math:n,Node:r,SymbolNode:i}=e,o=e=>qr(e,{truncate:78});function s(e,t,n){for(var r=``,i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,a=0,o;(o=i.exec(e))!==null;)if(r+=e.substring(a,o.index),a=o.index,o[0]===`$$`)r+=`$`,a++;else{a+=o[0].length;var s=t[o[1]];if(!s)throw ReferenceError(`Template: Property `+o[1]+` does not exist.`);if(o[2]===void 0)switch(typeof s){case`string`:r+=s;break;case`object`:if(he(s))r+=s.toTex(n);else if(Array.isArray(s))r+=s.map(function(e,t){if(he(e))return e.toTex(n);throw TypeError(`Template: `+o[1]+`[`+t+`] is not a Node.`)}).join(`,`);else throw TypeError(`Template: `+o[1]+` has to be a Node, String or array of Nodes`);break;default:throw TypeError(`Template: `+o[1]+` has to be a Node, String or array of Nodes`)}else if(he(s[o[2]]&&s[o[2]]))r+=s[o[2]].toTex(n);else throw TypeError(`Template: `+o[1]+`[`+o[2]+`] is not a Node.`)}return r+=e.slice(a),r}class c extends r{constructor(e,t,n){if(super(),typeof e==`string`&&(e=new i(e)),!he(e))throw TypeError(`Node expected as parameter "fn"`);if(!Array.isArray(t)||!t.every(he))throw TypeError(`Array containing Nodes expected for parameter "args"`);var r=typeof n;if(!(r===`undefined`||r===`boolean`))throw TypeError(`optional flag, if specified, must be boolean`);this.fn=e,this.args=t||[],this.optional=!!n}get name(){return this.fn.name||``}get type(){return Gh}get isFunctionNode(){return!0}_compile(e,t){var n=this.args.map(n=>n._compile(e,t)),r=this.optional||ce(this.fn)&&this.fn.optionalChaining;if(xe(this.fn)){var i=this.fn.name;if(t[i]){var s=this.args;return function(t,c,l){var u=a(c,i);if(!(r&&u===void 0)){if(typeof u!=`function`)throw TypeError(`Argument '${i}' was not a function; received: ${o(u)}`);
14if(u.rawArgs)return u(s,e,Fh(t,c));var d=n.map(e=>e(t,c,l));return u.apply(u,d)}}}else{var l=i in e?a(e,i):void 0,d=typeof l==`function`&&l.rawArgs===!0,f=t=>{var n;if(t.has(i))n=t.get(i);else if(i in e)n=a(e,i);else if(r)n=void 0;else return c.onUndefinedFunction(i);if(typeof n==`function`||r&&n===void 0)return n;throw TypeError(`'${i}' is not a function; its value is:
15  ${o(n)}`)};if(d){var p=this.args;return function(t,r,i){var a=f(t);return a.rawArgs===!0?a(p,e,Fh(t,r)):a(...n.map(e=>e(t,r,i)))}}else switch(n.length){case 0:return function(e,t,n){var i=f(e);if(!(r&&i===void 0))return i()};case 1:return function(e,t,i){var a=f(e);if(!(r&&a===void 0)){var o=n[0];return a(o(e,t,i))}};case 2:return function(e,t,i){var a=f(e);if(!(r&&a===void 0)){var o=n[0],s=n[1];return a(o(e,t,i),s(e,t,i))}};default:return function(e,t,i){var a=f(e);if(!(r&&a===void 0))return a(...n.map(n=>n(e,t,i)))}}}}else if(ce(this.fn)&&me(this.fn.index)&&this.fn.index.isObjectProperty()){var m=this.fn.object._compile(e,t),h=this.fn.index.getObjectProperty(),g=this.args;
15return function(t,i,a){var o=m(t,i,a);if(!(r&&(o==null||o[h]===void 0))){var s=u(o,h);if(s!=null&&s.rawArgs)return s(g,e,Fh(t,i));var c=n.map(e=>e(t,i,a));return s.apply(o,c)}}}else{var _=this.fn.toString(),v=this.fn._compile(e,t),y=this.args;return function(t,i,a){var s=v(t,i,a);if(!(r&&s===void 0)){if(typeof s!=`function`)throw TypeError(`Expression '${_}' did not evaluate to a function; value is:
16  ${o(s)}`);if(s.rawArgs)return s(y,e,Fh(t,i));var c=n.map(e=>e(t,i,a));return s.apply(s,c)}}}}forEach(e){e(this.fn,`fn`,this);for(var t=0;t<this.args.length;t++)e(this.args[t],`args[`+t+`]`,this)}map(e){for(var t=this._ifNode(e(this.fn,`fn`,this)),n=[],r=0;r<this.args.length;r++)n[r]=this._ifNode(e(this.args[r],`args[`+r+`]`,this));return new c(t,n)}clone(){return new c(this.fn,this.args.slice(0))}toString(e){var t,n=this.fn.toString(e);return e&&typeof e.handler==`object`&&H(e.handler,n)&&(t=e.handler[n](this,e)),t===void 0?super.toString(e):t}_toString(e){var t=this.args.map(function(t){return t.toString(e)});return(fe(this.fn)?`(`+this.fn.toString(e)+`)`:this.fn.toString(e))+`(`+t.join(`, `)+`)`}toJSON(){return{mathjs:Gh,fn:this.fn,args:this.args}}_toHTML(e){var t=this.args.map(function(t){return t.toHTML(e)});return`<span class="math-function">`+Zr(this.fn)+`</span><span class="math-paranthesis math-round-parenthesis">(</span>`+t.join(`<span class="math-separator">,</span>`)+`<span class="math-paranthesis math-round-parenthesis">)</span>`}toTex(e){var t;return e&&typeof e.handler==`object`&&H(e.handler,this.name)&&(t=e.handler[this.name](this,e)),t===void 0?super.toTex(e):t}_toTex(e){var t=this.args.map(function(t){return t.toTex(e)}),r;Sh[this.name]&&(r=Sh[this.name]),n[this.name]&&(typeof n[this.name].toTex==`function`||typeof n[this.name].toTex==`object`||typeof n[this.name].toTex==`string`)&&(r=n[this.name].toTex);var i;switch(typeof r){case`function`:i=r(this,e);break;case`string`:i=s(r,this,e);break;case`object`:switch(typeof r[t.length]){case`function`:i=r[t.length](this,e);break;case`string`:i=s(r[t.length],this,e);break}}return i===void 0?s(Ch,this,e):i}getIdentifier(){return this.type+`:`+this.name}}return t=c,$u(c,`name`,Gh),$u(c,`onUndefinedFunction`,function(e){throw Error(`Undefined function `+e)}),$u(c,`fromJSON`,function(e){return new t(e.fn,e.args)}),c},{isClass:!0,isNode:!0}),qh=`parse`,Jh=W(qh,[`typed`,`numeric`,`config`,`AccessorNode`,`ArrayNode`,`AssignmentNode`,`BlockNode`,`ConditionalNode`,`ConstantNode`,`FunctionAssignmentNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`RangeNode`,`RelationalNode`,`SymbolNode`],e=>{var{typed:t,numeric:n,config:i,AccessorNode:a,ArrayNode:o,AssignmentNode:s,BlockNode:c,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:d,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:g,RangeNode:_,RelationalNode:v,SymbolNode:y}=e,b=t(qh,{string:function(e){return ne(e,{})},"Array | Matrix":function(e){return x(e,{})},"string, Object":function(e,t){return ne(e,t.nodes===void 0?{}:t.nodes)},"Array | Matrix, Object":x});function x(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.nodes===void 0?{}:t.nodes;return Xi(e,function(e){if(typeof e!=`string`)throw TypeError(`String expected`);return ne(e,n)})}var S={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},C={",":!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,">>":!0,">>>":!0},w={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},T={true:!0,false:!1,null:null,undefined:void 0},E=[`NaN`,`Infinity`],D={'"':`"`,"'":`'`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
17`,r:`\r`,t:`	`};function O(){return{extraNodes:{},expression:``,comment:``,index:0,token:``,tokenType:S.NULL,nestingLevel:0,conditionalLevel:null}}function k(e,t){return e.expression.substr(e.index,t)}function A(e){return k(e,1)}function j(e){e.index++}function M(e){return e.expression.charAt(e.index-1)}function N(e){return e.expression.charAt(e.index+1)}function P(e){for(e.tokenType=S.NULL,e.token=``,e.comment=``;;){if(A(e)===`#`)for(;A(e)!==`
18`&&A(e)!==``;)e.comment+=A(e),j(e);if(b.isWhitespace(A(e),e.nestingLevel))j(e);else break}if(A(e)===``){e.tokenType=S.DELIMITER;return}if(A(e)===`
19`&&!e.nestingLevel){e.tokenType=S.DELIMITER,e.token=A(e),j(e);return}var t=A(e),n=k(e,2),r=k(e,3);if(r.length===3&&C[r]){e.tokenType=S.DELIMITER,e.token=r,j(e),j(e),j(e);return}if(n.length===2&&C[n]&&(n!==`?.`||!b.isDigit(e.expression.charAt(e.index+2)))){e.tokenType=S.DELIMITER,e.token=n,j(e),j(e);return}if(C[t]){e.tokenType=S.DELIMITER,e.token=t,j(e);return}if(b.isDigitDot(t)){e.tokenType=S.NUMBER;var i=k(e,2);if(i===`0b`||i===`0o`||i===`0x`){for(e.token+=A(e),j(e),e.token+=A(e),j(e);b.isAlpha(A(e),M(e),N(e))||b.isDigit(A(e));)e.token+=A(e),j(e);if(A(e)===`.`)for(e.token+=`.`,j(e);b.isAlpha(A(e),M(e),N(e))||b.isDigit(A(e));)e.token+=A(e),j(e);else if(A(e)===`i`)for(e.token+=`i`,j(e);b.isDigit(A(e));)e.token+=A(e),j(e);return}if(A(e)===`.`){if(e.token+=A(e),j(e),!b.isDigit(A(e))){e.tokenType=S.DELIMITER;return}}else{for(;b.isDigit(A(e));)e.token+=A(e),j(e);b.isDecimalMark(A(e),N(e))&&(e.token+=A(e),j(e))}for(;b.isDigit(A(e));)e.token+=A(e),j(e);if(A(e)===`E`||A(e)===`e`){if(b.isDigit(N(e))||N(e)===`-`||N(e)===`+`){if(e.token+=A(e),j(e),(A(e)===`+`||A(e)===`-`)&&(e.token+=A(e),j(e)),!b.isDigit(A(e)))throw U(e,`Digit expected, got "`+A(e)+`"`);for(;b.isDigit(A(e));)e.token+=A(e),j(e);if(b.isDecimalMark(A(e),N(e)))throw U(e,`Digit expected, got "`+A(e)+`"`)}else if(b.isDecimalMark(N(e),e.expression.charAt(e.index+2)))throw j(e),U(e,`Digit expected, got "`+A(e)+`"`)}return}if(b.isAlpha(A(e),M(e),N(e))){for(;b.isAlpha(A(e),M(e),N(e))||b.isDigit(A(e));)e.token+=A(e),j(e);H(w,e.token)?e.tokenType=S.DELIMITER:e.tokenType=S.SYMBOL;return}for(e.tokenType=S.UNKNOWN;A(e)!==``;)e.token+=A(e),j(e);throw U(e,`Syntax error in part "`+e.token+`"`)}function F(e){do P(e);while(e.token===`
20`)}function ee(e){e.nestingLevel++}function te(e){e.nestingLevel--}b.isAlpha=function(e,t,n){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,n)||b.isValidMathSymbol(t,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},b.isWhitespace=function(e,t){return e===` `||e===`	`||e===`\xA0`||e===`
21`&&t>0},b.isDecimalMark=function(e,t){return e===`.`&&t!==`/`&&t!==`*`&&t!==`^`},b.isDigitDot=function(e){return e>=`0`&&e<=`9`||e===`.`},b.isDigit=function(e){return e>=`0`&&e<=`9`};function ne(e,t){var n=O();r(n,{expression:e,extraNodes:t}),P(n);var i=re(n);if(n.token!==``)throw n.tokenType===S.DELIMITER?Le(n,`Unexpected operator `+n.token):U(n,`Unexpected part "`+n.token+`"`);return i}function re(e){var t,n=[],r;for(e.token!==``&&e.token!==`
22`&&e.token!==`;`&&(t=ie(e),e.comment&&(t.comment=e.comment));e.token===`
23`||e.token===`;`;)n.length===0&&t&&(r=e.token!==`;`,n.push({node:t,visible:r})),P(e),e.token!==`
24`&&e.token!==`;`&&e.token!==``&&(t=ie(e),e.comment&&(t.comment=e.comment),r=e.token!==`;`,n.push({node:t,visible:r}));return n.length>0?new c(n):(t||(t=new u(void 0),e.comment&&(t.comment=e.comment)),t)}function ie(e){var t,n,r,i,a=ae(e);if(e.token===`=`){if(xe(a))return t=a.name,F(e),r=ie(e),new s(new y(t),r);if(ce(a)){if(a.optionalChaining)throw U(e,`Cannot assign to optional chain`);return F(e),r=ie(e),new s(a.object,a.index,r)}
24else if(pe(a)&&xe(a.fn)&&(i=!0,n=[],t=a.name,a.args.forEach(function(e,t){xe(e)?n[t]=e.name:i=!1}),i))return F(e),r=ie(e),new d(t,n,r);throw U(e,`Invalid left hand side of assignment operator =`)}return a}function ae(e){for(var t=I(e);e.token===`?`;){var n=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,F(e);var r=t,i=ie(e);if(e.token!==`:`)throw U(e,`False part of conditional expression expected`);e.conditionalLevel=null,F(e),t=new l(r,i,ie(e)),e.conditionalLevel=n}return t}function I(e){for(var t=oe(e);e.token===`or`;)F(e),t=new h(`or`,`or`,[t,oe(e)]);return t}function oe(e){for(var t=L(e);e.token===`xor`;)F(e),t=new h(`xor`,`xor`,[t,L(e)]);return t}function L(e){for(var t=se(e);e.token===`and`;)F(e),t=new h(`and`,`and`,[t,se(e)]);return t}function se(e){for(var t=R(e);e.token===`|`;)F(e),t=new h(`|`,`bitOr`,[t,R(e)]);return t}function R(e){for(var t=le(e);e.token===`^|`;)F(e),t=new h(`^|`,`bitXor`,[t,le(e)]);return t}function le(e){for(var t=ue(e);e.token===`&`;)F(e),t=new h(`&`,`bitAnd`,[t,ue(e)]);return t}function ue(e){for(var t=[z(e)],n=[],r={"==":`equal`,"!=":`unequal`,"<":`smaller`,">":`larger`,"<=":`smallerEq`,">=":`largerEq`};H(r,e.token);){var i={name:e.token,fn:r[e.token]};n.push(i),F(e),t.push(z(e))}return t.length===1?t[0]:t.length===2?new h(n[0].name,n[0].fn,t):new v(n.map(e=>e.fn),t)}function z(e){for(var t=fe(e),n,r,i,a={"<<":`leftShift`,">>":`rightArithShift`,">>>":`rightLogShift`};H(a,e.token);)n=e.token,r=a[n],F(e),i=[t,fe(e)],t=new h(n,r,i);return t}function fe(e){for(var t=me(e),n,r,i,a={to:`to`,in:`to`};H(a,e.token);)n=e.token,r=a[n],F(e),n===`in`&&`])},;`.includes(e.token)?t=new h(`*`,`multiply`,[t,new y(`in`)],!0):(i=[t,me(e)],t=new h(n,r,i));return t}function me(e){var t,n=[];if(e.token===`:`){if(e.conditionalLevel===e.nestingLevel)throw U(e,`The true-expression of a conditional operator may not be empty`);t=new u(1)}else t=he(e);if(e.token===`:`&&e.conditionalLevel!==e.nestingLevel){for(n.push(t);e.token===`:`&&n.length<3;)F(e),e.token===`)`||e.token===`]`||e.token===`,`||e.token===``?n.push(new y(`end`)):n.push(he(e));t=n.length===3?new _(n[0],n[2],n[1]):new _(n[0],n[1])}return t}function he(e){for(var t=ge(e),n,r,i,a={"+":`add`,"-":`subtract`};H(a,e.token);){n=e.token,r=a[n],F(e);var o=ge(e);i=o.isPercentage?[t,new h(`*`,`multiply`,[t,o])]:[t,o],t=new h(n,r,i)}return t}function ge(e){for(var t=ve(e),n=t,r,i,a={"*":`multiply`,".*":`dotMultiply`,"/":`divide`,"./":`dotDivide`,"%":`mod`,mod:`mod`};H(a,e.token);)r=e.token,i=a[r],F(e),n=ve(e),t=new h(r,i,[t,n]);return t}function ve(e){for(var t=ye(e),n=t;e.tokenType===S.SYMBOL||e.token===`in`&&B(t)||e.token===`in`&&_e(t)&&t.fn===`unaryMinus`&&B(t.args[0])||e.tokenType===S.NUMBER&&!B(n)&&(!_e(n)||n.op===`!`)||e.token===`(`;)n=ye(e),t=new h(`*`,`multiply`,[t,n],!0);return t}function ye(e){for(var t=be(e),n=t,i=[];e.token===`/`&&de(n);)if(i.push(r({},e)),F(e),e.tokenType===S.NUMBER)if(i.push(r({},e)),F(e),e.tokenType===S.SYMBOL||e.token===`(`||e.token===`in`)r(e,i.pop()),i.pop(),n=be(e),t=new h(`/`,`divide`,[t,n]);else{i.pop(),r(e,i.pop());break}else{r(e,i.pop());break}return t}function be(e){var t=Se(e);if(e.token===`%`){var n=r({},e);F(e);try{Se(e),r(e,n)}catch{t=new h(`/`,`divide`,[t,new u(100)],!1,!0)}}return t}function Se(e){var t,n,r,i={"-":`unaryMinus`,"+":`unaryPlus`,"~":`bitNot`,not:`not`};return H(i,e.token)?(r=i[e.token],t=e.token,F(e),n=[Se(e)],new h(t,r,n)):Ce(e)}function Ce(e){var t=V(e),n,r,i;return(e.token===`^`||e.token===`.^`)&&(n=e.token,r=n===`^`?`pow`:`dotPow`,F(e),i=[t,Se(e)],t=new h(n,r,i)),t}function V(e){for(var t=we(e);e.token===`??`;)F(e),t=new h(`??`,`nullish`,[t,we(e)]);return t}function we(e){for(var t=Te(e),n,r,i,a={"!":`factorial`,"'":`ctranspose`};H(a,e.token);)n=e.token,r=a[n],P(e),i=[t],t=new h(n,r,i),t=De(e,t);return t}function Te(e){var t=[];if(e.tokenType===S.SYMBOL&&H(e.extraNodes,e.token)){var n=e.extraNodes[e.token];if(P(e),e.token===`(`){if(t=[],ee(e),P(e),e.token!==`)`)for(t.push(ie(e));e.token===`,`;)P(e),t.push(ie(e));if(e.token!==`)`)throw U(e,`Parenthesis ) expected`);te(e),P(e)}return new n(t)}return Ee(e)}function Ee(e){var t,r;return e.tokenType===S.SYMBOL||e.tokenType===S.DELIMITER&&e.token in w?(r=e.token,P(e),t=H(T,r)?new u(T[r]):E.includes(r)?new u(n(r,`number`)):new y(r),t=De(e,t),t):Oe(e)}function De(e,t,n){for(var r;;){var i=!1;e.token===`?.`&&(i=!0,P(e));var o=(e.token===`(`||e.token===`[`||e.token===`.`)&&(!n||n.includes(e.token));if(!(i||o))break;
24if(r=[],e.token===`(`)if(i||xe(t)||ce(t)){if(ee(e),P(e),e.token!==`)`)for(r.push(ie(e));e.token===`,`;)P(e),r.push(ie(e));if(e.token!==`)`)throw U(e,`Parenthesis ) expected`);te(e),P(e),t=new f(t,r,i)}else return t;else if(e.token===`[`){if(ee(e),P(e),e.token!==`]`)for(r.push(ie(e));e.token===`,`;)P(e),r.push(ie(e));if(e.token!==`]`)throw U(e,`Parenthesis ] expected`);te(e),P(e),t=new a(t,new p(r),i)}else{if(i||P(e),!(e.tokenType===S.SYMBOL||e.tokenType===S.DELIMITER&&e.token in w)){var s=`Property name expected after `;throw s+=i?`optional chain`:`dot`,U(e,s)}r.push(new u(e.token)),P(e),t=new a(t,new p(r,!0),i)}}return t}function Oe(e){var t,n;return e.token===`"`||e.token===`'`?(n=ke(e,e.token),t=new u(n),t=De(e,t),t):Ae(e)}function ke(e,t){for(var n=``;A(e)!==``&&A(e)!==t;)if(A(e)===`\\`){j(e);var r=A(e),i=D[r];if(i!==void 0)n+=i,e.index+=1;else if(r===`u`){var a=e.expression.slice(e.index+1,e.index+5);if(/^[0-9A-Fa-f]{4}$/.test(a))n+=String.fromCharCode(parseInt(a,16)),e.index+=5;else throw U(e,`Invalid unicode character \\u${a}`)}else throw U(e,`Bad escape character \\${r}`)}else n+=A(e),j(e);if(P(e),e.token!==t)throw U(e,`End of string ${t} expected`);return P(e),n}function Ae(e){var t,n,r,i;if(e.token===`[`){if(ee(e),P(e),e.token!==`]`){var a=je(e);if(e.token===`;`){for(r=1,n=[a];e.token===`;`;)P(e),e.token!==`]`&&(n[r]=je(e),r++);if(e.token!==`]`)throw U(e,`End of matrix ] expected`);te(e),P(e),i=n[0].items.length;for(var s=1;s<r;s++)if(n[s].items.length!==i)throw Le(e,`Column dimensions mismatch (`+n[s].items.length+` !== `+i+`)`);t=new o(n)}else{if(e.token!==`]`)throw U(e,`End of matrix ] expected`);te(e),P(e),t=a}}else te(e),P(e),t=new o([]);return De(e,t)}return Me(e)}function je(e){for(var t=[ie(e)],n=1;e.token===`,`;)P(e),e.token!==`]`&&e.token!==`;`&&(t[n]=ie(e),n++);return new o(t)}function Me(e){if(e.token===`{`){ee(e);var t,n={};do if(P(e),e.token!==`}`){if(e.token===`"`||e.token===`'`)t=ke(e,e.token);else if(e.tokenType===S.SYMBOL||e.tokenType===S.DELIMITER&&e.token in w)t=e.token,P(e);else throw U(e,`Symbol or string expected as object key`);if(e.token!==`:`)throw U(e,`Colon : expected after object key`);P(e),n[t]=ie(e)}while(e.token===`,`);if(e.token!==`}`)throw U(e,`Comma , or bracket } expected after object value`);te(e),P(e);var r=new m(n);return r=De(e,r),r}return Ne(e)}function Ne(e){var t;if(e.tokenType===S.NUMBER){t=e.token,P(e);var r=He(t,i);return new u(n(t,r))}return Pe(e)}function Pe(e){var t;if(e.token===`(`){if(ee(e),P(e),t=ie(e),e.token!==`)`)throw U(e,`Parenthesis ) expected`);return te(e),P(e),t=new g(t),t=De(e,t),t}return Fe(e)}function Fe(e){throw e.token===``?U(e,`Unexpected end of expression`):U(e,`Value expected`)}function Ie(e){return e.index-e.token.length+1}function U(e,t){var n=Ie(e),r=SyntaxError(t+` (char `+n+`)`);return r.char=n,r}function Le(e,t){var n=Ie(e),r=SyntaxError(t+` (char `+n+`)`);return r.char=n,r}return t.addConversion({from:`string`,to:`Node`,convert:b}),b}),Yh=`compile`,Xh=W(Yh,[`typed`,`parse`],e=>{var{typed:t,parse:n}=e;return t(Yh,{string:function(e){return n(e).compile()},"Array | Matrix":function(e){return Xi(e,function(e){return n(e).compile()})}})}),Zh=`evaluate`,Qh=W(Zh,[`typed`,`parse`],e=>{var{typed:t,parse:n}=e;return t(Zh,{string:function(e){var t=_();return n(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return n(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=_();return Xi(e,function(e){return n(e).compile().evaluate(t)})},"Array | Matrix, Map | Object":function(e,t){return Xi(e,function(e){return n(e).compile().evaluate(t)})}})}),$h=W(`Parser`,[`evaluate`,`parse`],e=>{var{evaluate:t,parse:n}=e;function r(){if(!(this instanceof r))throw SyntaxError(`Constructor must be called with the new operator`);Object.defineProperty(this,"scope",{value:_(),writable:!1})}r.prototype.type=`Parser`,r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){return y(this.scope)},r.prototype.getAllAsMap=function(){return this.scope};function i(e){if(e.length===0)return!1;for(var t=0;t<e.length;t++){var r=e.charAt(t-1),i=e.charAt(t),a=e.charAt(t+1);if(!(n.isAlpha(i,r,a)||t>0&&n.isDigit(i)))return!1}return!0}return r.prototype.set=function(e,t){if(!i(e))throw Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r.prototype.toJSON=function(){var e={mathjs:`Parser`,variables:{},functions:{}};
24for(var[t,n]of this.scope)if(te(n)){if(!eg(n))throw Error(`Cannot serialize external function ${t}`);e.functions[t]=`${n.syntax} = ${n.expr}`}else e.variables[t]=n;return e},r.fromJSON=function(e){var t=new r;return Object.entries(e.variables).forEach(e=>{var[n,r]=e;return t.set(n,r)}),Object.entries(e.functions).forEach(e=>{var[n,r]=e;return t.evaluate(r)}),t},r},{isClass:!0});function eg(e){return typeof e==`function`&&typeof e.syntax==`string`&&typeof e.expr==`string`}var tg=`parser`,ng=W(tg,[`typed`,`Parser`],e=>{var{typed:t,Parser:n}=e;return t(tg,{"":function(){return new n}})}),rg=`lup`,ig=W(rg,[`typed`,`matrix`,`abs`,`addScalar`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`larger`,`equalScalar`,`unaryMinus`,`DenseMatrix`,`SparseMatrix`,`Spa`],e=>{var{typed:t,matrix:n,abs:r,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:c,equalScalar:l,unaryMinus:u,DenseMatrix:d,SparseMatrix:f,Spa:p}=e;return t(rg,{DenseMatrix:function(e){return m(e)},SparseMatrix:function(e){return h(e)},Array:function(e){var t=m(n(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function m(e){var t=e._size[0],n=e._size[1],u=Math.min(t,n),f=V(e._data),p=[],m=[t,u],h=[],g=[u,n],_,v,y,b=[];for(_=0;_<t;_++)b[_]=_;for(v=0;v<n;v++){if(v>0)for(_=0;_<t;_++){var x=Math.min(_,v),S=0;for(y=0;y<x;y++)S=i(S,o(f[_][y],f[y][v]));f[_][v]=s(f[_][v],S)}var C=v,w=0,T=0;for(_=v;_<t;_++){var E=f[_][v],D=r(E);c(D,w)&&(C=_,w=D,T=E)}if(v!==C&&(b[v]=[b[C],b[C]=b[v]][0],d._swapRows(v,C,f)),v<t)for(_=v+1;_<t;_++){var O=f[_][v];l(O,0)||(f[_][v]=a(f[_][v],T))}}for(v=0;v<n;v++)for(_=0;_<t;_++){if(v===0&&(_<n&&(h[_]=[]),p[_]=[]),_<v){_<n&&(h[_][v]=f[_][v]),v<t&&(p[_][v]=0);continue}if(_===v){_<n&&(h[_][v]=f[_][v]),v<t&&(p[_][v]=1);continue}_<n&&(h[_][v]=0),v<t&&(p[_][v]=f[_][v])}var k=new d({data:p,size:m}),A=new d({data:h,size:g}),j=[];for(_=0,u=b.length;_<u;_++)j[b[_]]=_;return{L:k,U:A,p:j,toString:function(){return`L: `+this.L.toString()+`
25U: `+this.U.toString()+`
26P: `+this.p}}}function h(e){var t=e._size[0],n=e._size[1],i=Math.min(t,n),s=e._values,d=e._index,m=e._ptr,h=[],g=[],_=[],v=[t,i],y=[],b=[],x=[],S=[i,n],C,w,T,E=[],D=[];for(C=0;C<t;C++)E[C]=C,D[C]=C;var O=function(e,t){var n=D[e],r=D[t];E[n]=t,E[r]=e,D[e]=r,D[t]=n},k=function(){var e=new p;w<t&&(_.push(h.length),h.push(1),g.push(w)),x.push(y.length);var n=m[w],i=m[w+1];for(T=n;T<i;T++)C=d[T],e.set(E[C],s[T]);w>0&&e.forEach(0,w-1,function(t,n){f._forEachRow(t,h,g,_,function(r,i){r>t&&e.accumulate(r,u(o(i,n)))})});var D=w,k=e.get(w),A=r(k);e.forEach(w+1,t-1,function(e,t){var n=r(t);c(n,A)&&(D=e,A=n,k=t)}),w!==D&&(f._swapRows(w,D,v[1],h,g,_),f._swapRows(w,D,S[1],y,b,x),e.swap(w,D),O(w,D)),e.forEach(0,t-1,function(e,t){e<=w?(y.push(t),b.push(e)):(t=a(t,k),l(t,0)||(h.push(t),g.push(e)))})};for(w=0;w<n;w++)k();return x.push(y.length),_.push(h.length),{L:new f({values:h,index:g,ptr:_,size:v}),U:new f({values:y,index:b,ptr:x,size:S}),p:E,toString:function(){return`L: `+this.L.toString()+`
27U: `+this.U.toString()+`
28P: `+this.p}}}}),ag=`qr`,og=W(ag,[`typed`,`matrix`,`zeros`,`identity`,`isZero`,`equal`,`sign`,`sqrt`,`conj`,`unaryMinus`,`addScalar`,`divideScalar`,`multiplyScalar`,`subtractScalar`,`complex`],e=>{var{typed:t,matrix:n,zeros:i,identity:a,isZero:o,equal:s,sign:c,sqrt:l,conj:u,unaryMinus:d,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:g}=e;return r(t(ag,{DenseMatrix:function(e){return v(e)},SparseMatrix:function(e){return y(e)},Array:function(e){var t=v(n(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:_});function _(e){var t=e._size[0],n=e._size[1],r=a([t],`dense`),g=r._data,_=e.clone(),v=_._data,y,b,x,S=i([t],``);for(x=0;x<Math.min(n,t);++x){var C=v[x][x],w=d(s(C,0)?1:c(C)),T=u(w),E=0;for(y=x;y<t;y++)E=f(E,m(v[y][x],u(v[y][x])));var D=m(w,l(E));if(!o(D)){var O=h(C,D);for(S[x]=1,y=x+1;y<t;y++)S[y]=p(v[y][x],O);var k=d(u(p(O,D))),A=void 0;for(b=x;b<n;b++){for(A=0,y=x;y<t;y++)A=f(A,m(u(S[y]),v[y][b]));for(A=m(A,k),y=x;y<t;y++)v[y][b]=m(h(v[y][b],m(S[y],A)),T)}for(y=0;y<t;y++){for(A=0,b=x;b<t;b++)A=f(A,m(g[y][b],S[b]));for(A=m(A,k),b=x;b<t;++b)g[y][b]=p(h(g[y][b],m(A,u(S[b]))),T)}}}return{Q:r,R:_,toString:function(){return`Q: `+this.Q.toString()+`
29R: `+this.R.toString()}}}function v(e){var t=_(e),n=t.R._data;if(e._data.length>0)for(var r=n[0][0].type===`Complex`?g(0):0,i=0;i<n.length;++i)for(var a=0;a<i&&a<(n[0]||[]).length;++a)n[i][a]=r;return t}function y(e){throw Error(`qr not implemented for sparse matrices yet`)}});function sg(e,t,n,r){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,c=e._datatype,l=s[0],u=s[1],d=r&&e._values?[]:null,f=[],p=[],m=0,h=0;h<u;h++){p[h]=m;for(var g=n?n[h]:h,_=o[g],v=o[g+1],y=_;y<v;y++)f[m]=t?t[a[y]]:a[y],d&&(d[m]=i[y]),m++}return p[u]=m,e.createSparseMatrix({values:d,index:f,ptr:p,size:[l,u],datatype:c})}function cg(e,t,n,r,i,a,o){var s=0;for(n[o]=e;s>=0;){var c=n[o+s],l=n[r+c];l===-1?(s--,a[t++]=c):(n[r+c]=n[i+l],++s,n[o+s]=l)}return t}function lg(e,t){if(!e)return null;var n=0,r,i=[],a=[],o=0,s=t,c=2*t;
29for(r=0;r<t;r++)a[o+r]=-1;for(r=t-1;r>=0;r--)e[r]!==-1&&(a[s+r]=a[o+e[r]],a[o+e[r]]=r);for(r=0;r<t;r++)e[r]===-1&&(n=cg(r,n,a,o,s,i,c));return i}function ug(e,t){if(!e)return null;var n=e._index,r=e._ptr,i=e._size,a=i[0],o=i[1],s=[],c=[],l=0,u=o,d,f;if(t)for(d=0;d<a;d++)c[u+d]=-1;for(var p=0;p<o;p++){s[p]=-1,c[l+p]=-1;for(var m=r[p],h=r[p+1],g=m;g<h;g++){var _=n[g];for(d=t?c[u+_]:_;d!==-1&&d<p;d=f)f=c[l+d],c[l+d]=p,f===-1&&(s[d]=p);t&&(c[u+_]=p)}}return s}function dg(e,t,n){for(var r=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,c=0;c<o;c++){var l=a[c];for(a[c]=s;l<a[c+1];l++)t(i[l],c,r?r[l]:1,n)&&(i[s]=i[l],r&&(r[s]=r[l]),s++)}return a[o]=s,i.splice(s,i.length-s),r&&r.splice(s,r.length-s),s}function fg(e){return-e-2}var pg=W(`csAmd`,[`add`,`multiply`,`transpose`],e=>{var{add:t,multiply:n,transpose:r}=e;return function(e,t){if(!t||e<=0||e>3)return null;var n=t._size,r=n[0],l=n[1],u=0,d=Math.max(16,10*Math.sqrt(l));d=Math.min(l-2,d);var f=i(e,t,r,l,d);dg(f,c,null);for(var p=f._index,m=f._ptr,h=m[l],g=[],_=[],v=0,y=l+1,b=2*(l+1),x=3*(l+1),S=4*(l+1),C=5*(l+1),w=6*(l+1),T=7*(l+1),E=g,D=a(l,m,_,v,x,E,b,T,y,w,S,C),O=o(l,m,_,C,S,w,d,y,x,E,b),k=0,A,j,M,N,P,F,ee,te,ne,re,ie,ae,I,oe,L,se;O<l;){for(M=-1;k<l&&(M=_[x+k])===-1;k++);_[b+M]!==-1&&(E[_[b+M]]=-1),_[x+k]=_[b+M];var ce=_[S+M],R=_[y+M];O+=R;var le=0;_[y+M]=-R;var ue=m[M],z=ce===0?ue:h,B=z;for(N=1;N<=ce+1;N++){for(N>ce?(F=M,ee=ue,te=_[v+M]-ce):(F=p[ue++],ee=m[F],te=_[v+F]),P=1;P<=te;P++)A=p[ee++],!((ne=_[y+A])<=0)&&(le+=ne,_[y+A]=-ne,p[B++]=A,_[b+A]!==-1&&(E[_[b+A]]=E[A]),E[A]===-1?_[x+_[C+A]]=_[b+A]:_[b+E[A]]=_[b+A]);F!==M&&(m[F]=fg(M),_[w+F]=0)}for(ce!==0&&(h=B),_[C+M]=le,m[M]=z,_[v+M]=B-z,_[S+M]=-2,D=s(D,u,_,w,l),re=z;re<B;re++)if(A=p[re],!((ie=_[S+A])<=0)){ne=-_[y+A];var de=D-ne;for(ue=m[A],ae=m[A]+ie-1;ue<=ae;ue++)F=p[ue],_[w+F]>=D?_[w+F]-=ne:_[w+F]!==0&&(_[w+F]=_[C+F]+de)}for(re=z;re<B;re++){for(A=p[re],ae=m[A],I=ae+_[S+A]-1,oe=ae,L=0,se=0,ue=ae;ue<=I;ue++)if(F=p[ue],_[w+F]!==0){var fe=_[w+F]-D;fe>0?(se+=fe,p[oe++]=F,L+=F):(m[F]=fg(M),_[w+F]=0)}_[S+A]=oe-ae+1;var pe=oe,me=ae+_[v+A];for(ue=I+1;ue<me;ue++){j=p[ue];var he=_[y+j];he<=0||(se+=he,p[oe++]=j,L+=j)}se===0?(m[A]=fg(M),ne=-_[y+A],le-=ne,R+=ne,O+=ne,_[y+A]=0,_[S+A]=-1):(_[C+A]=Math.min(_[C+A],se),p[oe]=p[pe],p[pe]=p[ae],p[ae]=M,_[v+A]=oe-ae+1,L=(L<0?-L:L)%l,_[b+A]=_[T+L],_[T+L]=A,E[A]=L)}for(_[C+M]=le,u=Math.max(u,le),D=s(D+u,u,_,w,l),re=z;re<B;re++)if(A=p[re],!(_[y+A]>=0))for(L=E[A],A=_[T+L],_[T+L]=-1;A!==-1&&_[b+A]!==-1;A=_[b+A],D++){for(te=_[v+A],ie=_[S+A],ue=m[A]+1;ue<=m[A]+te-1;ue++)_[w+p[ue]]=D;var ge=A;for(j=_[b+A];j!==-1;){var _e=_[v+j]===te&&_[S+j]===ie;for(ue=m[j]+1;_e&&ue<=m[j]+te-1;ue++)_[w+p[ue]]!==D&&(_e=0);_e?(m[j]=fg(A),_[y+A]+=_[y+j],_[y+j]=0,_[S+j]=-1,j=_[b+j],_[b+ge]=j):(ge=j,j=_[b+j])}}for(ue=z,re=z;re<B;re++)A=p[re],!((ne=-_[y+A])<=0)&&(_[y+A]=ne,se=_[C+A]+le-ne,se=Math.min(se,l-O-ne),_[x+se]!==-1&&(E[_[x+se]]=A),_[b+A]=_[x+se],E[A]=-1,_[x+se]=A,k=Math.min(k,se),_[C+A]=se,p[ue++]=A);_[y+M]=R,(_[v+M]=ue-z)===0&&(m[M]=-1,_[w+M]=0),ce!==0&&(h=ue)}for(A=0;A<l;A++)m[A]=fg(m[A]);for(j=0;j<=l;j++)_[x+j]=-1;for(j=l;j>=0;j--)_[y+j]>0||(_[b+j]=_[x+m[j]],_[x+m[j]]=j);for(F=l;F>=0;F--)_[y+F]<=0||m[F]!==-1&&(_[b+F]=_[x+m[F]],_[x+m[F]]=F);for(M=0,A=0;A<=l;A++)m[A]===-1&&(M=cg(A,M,_,x,b,g,w));return g.splice(g.length-1,1),g};function i(e,i,a,o,s){var c=r(i);if(e===1&&o===a)return t(i,c);if(e===2){for(var l=c._index,u=c._ptr,d=0,f=0;f<a;f++){var p=u[f];if(u[f]=d,!(u[f+1]-p>s))for(var m=u[f+1];p<m;p++)l[d++]=l[p]}return u[a]=d,i=r(c),n(c,i)}return n(c,i)}function a(e,t,n,r,i,a,o,c,l,u,d,f){for(var p=0;p<e;p++)n[r+p]=t[p+1]-t[p];n[r+e]=0;for(var m=0;m<=e;m++)n[i+m]=-1,a[m]=-1,n[o+m]=-1,n[c+m]=-1,n[l+m]=1,n[u+m]=1,n[d+m]=0,n[f+m]=n[r+m];var h=s(0,0,n,u,e);return n[d+e]=-2,t[e]=-1,n[u+e]=0,h}function o(e,t,n,r,i,a,o,s,c,l,u){for(var d=0,f=0;f<e;f++){var p=n[r+f];if(p===0)n[i+f]=-2,d++,t[f]=-1,n[a+f]=0;else if(p>o)n[s+f]=0,n[i+f]=-1,d++,t[f]=fg(e),n[s+e]++;else{var m=n[c+p];m!==-1&&(l[m]=f),n[u+f]=n[c+p],n[c+p]=f}}return d}function s(e,t,n,r,i){if(e<2||e+t<0){for(var a=0;a<i;a++)n[r+a]!==0&&(n[r+a]=1);e=2}return e}function c(e,t){return e!==t}});function mg(e,t,n,r,i,a,o){var s,c,l=0,u;if(e<=t||n[r+t]<=n[i+e])return-1;n[i+e]=n[r+t];var d=n[a+e];if(n[a+e]=t,d===-1)l=1,u=e;else{for(l=2,u=d;u!==n[o+u];u=n[o+u]);for(s=d;s!==u;s=c)c=n[o+s],n[o+s]=u}return{jleaf:l,q:u}}var hg=W(`csCounts`,[`transpose`],e=>{var{transpose:t}=e;return function(e,n,r,i){if(!e||!n||!r)return null;var a=e._size,o=a[0],s=a[1],c,l,u,d,f,p,m,h=4*s+(i?s+o+1:0),g=[],_=0,v=s,y=2*s,b=3*s,x=4*s,S=5*s+1;for(u=0;
29u<h;u++)g[u]=-1;var C=[],w=t(e),T=w._index,E=w._ptr;for(u=0;u<s;u++)for(l=r[u],C[l]=+(g[b+l]===-1);l!==-1&&g[b+l]===-1;l=n[l])g[b+l]=u;if(i){for(u=0;u<s;u++)g[r[u]]=u;for(c=0;c<o;c++){for(u=s,p=E[c],m=E[c+1],f=p;f<m;f++)u=Math.min(u,g[T[f]]);g[S+c]=g[x+u],g[x+u]=c}}for(c=0;c<s;c++)g[_+c]=c;for(u=0;u<s;u++){for(l=r[u],n[l]!==-1&&C[n[l]]--,d=i?g[x+u]:l;d!==-1;d=i?g[S+d]:-1)for(f=E[d];f<E[d+1];f++){c=T[f];var D=mg(c,l,g,b,v,y,_);D.jleaf>=1&&C[l]++,D.jleaf===2&&C[D.q]--}n[l]!==-1&&(g[_+l]=n[l])}for(l=0;l<s;l++)n[l]!==-1&&(C[n[l]]+=C[l]);return C}}),gg=W(`csSqr`,[`add`,`multiply`,`transpose`],e=>{var{add:t,multiply:n,transpose:r}=e,i=pg({add:t,multiply:n,transpose:r}),a=hg({transpose:r});return function(e,t,n){var r=t._ptr,s=t._size[1],c,l={};if(l.q=i(e,t),e&&!l.q)return null;if(n){var u=e?sg(t,null,l.q,0):t;l.parent=ug(u,1);var d=lg(l.parent,s);if(l.cp=a(u,l.parent,d,1),u&&l.parent&&l.cp&&o(u,l))for(l.unz=0,c=0;c<s;c++)l.unz+=l.cp[c]}else l.unz=4*r[s]+s,l.lnz=l.unz;return l};function o(e,t){var n=e._ptr,r=e._index,i=e._size,a=i[0],o=i[1];t.pinv=[],t.leftmost=[];var s=t.parent,c=t.pinv,l=t.leftmost,u=[],d=0,f=a,p=a+o,m=a+2*o,h,g,_,v,y;for(g=0;g<o;g++)u[f+g]=-1,u[p+g]=-1,u[m+g]=0;for(h=0;h<a;h++)l[h]=-1;for(g=o-1;g>=0;g--)for(v=n[g],y=n[g+1],_=v;_<y;_++)l[r[_]]=g;for(h=a-1;h>=0;h--)c[h]=-1,g=l[h],g!==-1&&(u[m+g]++===0&&(u[p+g]=h),u[d+h]=u[f+g],u[f+g]=h);for(t.lnz=0,t.m2=a,g=0;g<o;g++)if(h=u[f+g],t.lnz++,h<0&&(h=t.m2++),c[h]=g,!(--m[g]<=0)){t.lnz+=u[m+g];var b=s[g];b!==-1&&(u[m+b]===0&&(u[p+b]=u[p+g]),u[d+u[p+g]]=u[f+b],u[f+b]=u[d+h],u[m+b]+=u[m+g])}for(h=0;h<a;h++)c[h]<0&&(c[h]=g++);return!0}});function _g(e,t){return e[t]<0}function vg(e,t){e[t]=fg(e[t])}function yg(e){return e<0?fg(e):e}function bg(e,t,n,r,i){var a=t._index,o=t._ptr,s=t._size[1],c,l,u,d=0;for(r[0]=e;d>=0;){e=r[d];var f=i?i[e]:e;_g(o,e)||(vg(o,e),r[s+d]=f<0?0:yg(o[f]));var p=1;for(l=r[s+d],u=f<0?0:yg(o[f+1]);l<u;l++)if(c=a[l],!_g(o,c)){r[s+d]=l,r[++d]=c,p=0;break}p&&(d--,r[--n]=e)}return n}function xg(e,t,n,r,i){var a=e._ptr,o=e._size,s=t._index,c=t._ptr,l=o[1],u,d,f,p=l;for(d=c[n],f=c[n+1],u=d;u<f;u++){var m=s[u];_g(a,m)||(p=bg(m,e,p,r,i))}for(u=p;u<l;u++)vg(a,r[u]);return p}var Sg=W(`csSpsolve`,[`divideScalar`,`multiply`,`subtract`],e=>{var{divideScalar:t,multiply:n,subtract:r}=e;return function(e,i,a,o,s,c,l){var u=e._values,d=e._index,f=e._ptr,p=e._size[1],m=i._values,h=i._index,g=i._ptr,_,v,y,b,x=xg(e,i,a,o,c);for(_=x;_<p;_++)s[o[_]]=0;for(v=g[a],y=g[a+1],_=v;_<y;_++)s[h[_]]=m[_];for(var S=x;
29S<p;S++){var C=o[S],w=c?c[C]:C;if(!(w<0))for(v=f[w],y=f[w+1],s[C]=t(s[C],u[l?v:y-1]),_=l?v+1:v,b=l?y:y-1;_<b;_++){var T=d[_];s[T]=r(s[T],n(u[_],s[C]))}}return x}}),Cg=W(`csLu`,[`abs`,`divideScalar`,`multiply`,`subtract`,`larger`,`largerEq`,`SparseMatrix`],e=>{var{abs:t,divideScalar:n,multiply:r,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,c=Sg({divideScalar:n,multiply:r,subtract:i});return function(e,i,l){if(!e)return null;var u=e._size[1],d,f=100,p=100;i&&(d=i.q,f=i.lnz||f,p=i.unz||p);var m=[],h=[],g=[],_=new s({values:m,index:h,ptr:g,size:[u,u]}),v=[],y=[],b=[],x=new s({values:v,index:y,ptr:b,size:[u,u]}),S=[],C,w,T=[],E=[];for(C=0;C<u;C++)T[C]=0,S[C]=-1,g[C+1]=0;f=0,p=0;for(var D=0;D<u;D++){g[D]=f,b[D]=p;var O=d?d[D]:D,k=c(_,e,O,E,T,S,1),A=-1,j=-1;for(w=k;w<u;w++)if(C=E[w],S[C]<0){var M=t(T[C]);a(M,j)&&(j=M,A=C)}else y[p]=S[C],v[p++]=T[C];if(A===-1||j<=0)return null;S[O]<0&&o(t(T[O]),r(j,l))&&(A=O);var N=T[A];for(y[p]=D,v[p++]=N,S[A]=D,h[f]=A,m[f++]=1,w=k;w<u;w++)C=E[w],S[C]<0&&(h[f]=C,m[f++]=n(T[C],N)),T[C]=0}for(g[u]=f,b[u]=p,w=0;w<f;w++)h[w]=S[h[w]];return m.splice(f,m.length-f),h.splice(f,h.length-f),v.splice(p,v.length-p),y.splice(p,y.length-p),{L:_,U:x,pinv:S}}}),wg=`slu`,Tg=W(wg,[`typed`,`abs`,`add`,`multiply`,`transpose`,`divideScalar`,`subtract`,`larger`,`largerEq`,`SparseMatrix`],e=>{var{typed:t,abs:n,add:r,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:c,largerEq:l,SparseMatrix:u}=e,d=gg({add:r,multiply:i,transpose:a}),f=Cg({abs:n,divideScalar:o,multiply:i,subtract:s,larger:c,largerEq:l,SparseMatrix:u});return t(wg,{"SparseMatrix, number, number":function(e,t,n){if(!G(t)||t<0||t>3)throw Error(`Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]`);if(n<0||n>1)throw Error(`Partial pivoting threshold must be a number from 0 to 1`);var r=d(t,e,!1),i=f(e,r,n);return{L:i.L,U:i.U,p:i.pinv,q:r.q,toString:function(){return`L: `+this.L.toString()+`
30U: `+this.U.toString()+`
31p: `+this.p.toString()+(this.q?`
32q: `+this.q.toString():``)+`
33`}}}})});function Eg(e,t){var n,r=t.length,i=[];if(e)for(n=0;n<r;n++)i[e[n]]=t[n];else for(n=0;n<r;n++)i[n]=t[n];return i}var Dg=`lusolve`,Og=W(Dg,[`typed`,`matrix`,`lup`,`slu`,`usolve`,`lsolve`,`DenseMatrix`],e=>{var{typed:t,matrix:n,lup:r,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,c=ef({DenseMatrix:s});return t(Dg,{"Array, Array | Matrix":function(e,t){e=n(e);var i=r(e);return u(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){var n=r(e);return u(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){var n=r(e);return u(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){var a=i(e,n,r);return u(a.L,a.U,a.p,a.q,t)},"Object, Array | Matrix":function(e,t){return u(e.L,e.U,e.p,e.q,t)}});function l(e){if(O(e))return e;if(D(e))return n(e);throw TypeError(`Invalid Matrix LU decomposition`)}function u(e,t,n,r,i){e=l(e),t=l(t),n&&(i=c(e,i,!0),i._data=Eg(n,i._data));var s=o(e,i),u=a(t,s);return r&&(u._data=Eg(r,u._data)),u}}),kg=`polynomialRoot`,Ag=W(kg,[`typed`,`isZero`,`equalScalar`,`add`,`subtract`,`multiply`,`divide`,`sqrt`,`unaryMinus`,`cbrt`,`typeOf`,`im`,`re`],e=>{var{typed:t,isZero:n,equalScalar:r,add:i,subtract:a,multiply:o,divide:s,sqrt:c,unaryMinus:l,cbrt:u,typeOf:d,im:f,re:p}=e;return t(kg,{"number|Complex, ...number|Complex":(e,t)=>{for(var m=[e,...t];m.length>0&&n(m[m.length-1]);)m.pop();if(m.length<2)throw RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(m.length){case 2:return[l(s(m[0],m[1]))];case 3:var[h,g,_]=m,v=o(2,_),y=o(g,g),b=o(4,_,h);if(r(y,b))return[s(l(g),v)];var x=c(a(y,b));return[s(a(x,g),v),s(a(l(x),g),v)];case 4:var[S,C,w,T]=m,E=l(o(3,T)),D=o(w,w),O=o(3,T,C),k=i(o(2,w,w,w),o(27,T,T,S)),A=o(9,T,w,C);if(r(D,O)&&r(k,A))return[s(w,E)];var j=a(D,O),M=a(k,A);return r(i(o(18,T,w,C,S),o(w,w,C,C)),i(o(4,w,w,w,S),o(4,T,C,C,C),o(27,T,T,S,S)))?[s(a(o(4,T,w,C),i(o(9,T,T,S),o(w,w,w))),o(T,j)),s(a(o(9,T,S),o(w,C)),o(2,j))]:u(r(D,O)?M:s(i(M,c(a(o(M,M),o(4,j,j,j)))),2),!0).toArray().map(e=>s(i(w,e,s(j,e)),E)).map(e=>d(e)===`Complex`&&r(p(e),p(e)+f(e))?p(e):e);default:throw RangeError(`only implemented for cubic or lower-order polynomials, not ${m}`)}}})}),jg=W(`Help`,[`evaluate`],e=>{var{evaluate:t}=e;function n(e){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(!e)throw Error(`Argument "doc" missing`);this.doc=e}return n.prototype.type=`Help`,n.prototype.isHelp=!0,n.prototype.toString=function(){var e=this.doc||{},n=`
34`;if(e.name&&(n+=`Name: `+e.name+`
35
36`),e.category&&(n+=`Category: `+e.category+`
37
38`),e.description&&(n+=`Description:
39    `+e.description+`
40
41`),e.syntax&&(n+=`Syntax:
42    `+e.syntax.join(`
43    `)+`
44
45`),e.examples){n+=`Examples:
46`;for(var r=!1,i=t(`config()`),a={config:e=>(r=!0,t(`config(newConfig)`,{newConfig:e}))},o=0;o<e.examples.length;o++){var s=e.examples[o];n+=`    `+s+`
47`;var c=void 0;try{c=t(s,a)}catch(e){c=e}c!==void 0&&!ee(c)&&(n+=`        `+qr(c,{precision:14})+`
48`)}n+=`
49`,r&&t(`config(originalConfig)`,{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(n+=`Throws: `+e.mayThrow.join(`, `)+`
50
51`),e.seealso&&e.seealso.length&&(n+=`See also: `+e.seealso.join(`, `)+`
52`),n},n.prototype.toJSON=function(){var e=V(this.doc);return e.mathjs=`Help`,e},n.fromJSON=function(e){var t={};return Object.keys(e).filter(e=>e!==`mathjs`).forEach(n=>{t[n]=e[n]}),new n(t)},n.prototype.valueOf=n.prototype.toString,n},{isClass:!0}
52),Mg=W(`Chain`,[`?on`,`math`,`typed`],e=>{var{on:t,math:n,typed:r}=e;function i(e){if(!(this instanceof i))throw SyntaxError(`Constructor must be called with the new operator`);Se(e)?this.value=e.value:this.value=e}i.prototype.type=`Chain`,i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return qr(this.value)},i.prototype.toJSON=function(){return{mathjs:`Chain`,value:this.value}},i.fromJSON=function(e){return new i(e.value)};function a(e,t){typeof t==`function`&&(i.prototype[e]=s(t))}function o(e,t){Ae(i.prototype,e,function(){var e=t();if(typeof e==`function`)return s(e)})}function s(e){return function(){if(arguments.length===0)return new i(e(this.value));for(var t=[this.value],n=0;n<arguments.length;n++)t[n+1]=arguments[n];if(r.isTypedFunction(e)){var a=r.resolve(e,t);if(a.params.length===1)throw Error(`chain function `+e.name+` cannot match rest parameter between chain value and additional arguments.`);return new i(a.implementation.apply(e,t))}return new i(e.apply(e,t))}}i.createProxy=function(e,t){if(typeof e==`string`)a(e,t);else{var n=function(t){H(e,t)&&c[t]===void 0&&o(t,()=>e[t])};for(var r in e)n(r)}};var c={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),t&&t(`import`,function(e,t,n){n||o(e,t)}),i},{isClass:!0}),Ng={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`]},Pg={name:`false`,category:`Constants`,syntax:[`false`],description:`Boolean value false`,examples:[`false`],seealso:[`true`]},Fg={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:[]},Ig={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:[]},Lg={name:`LN10`,category:`Constants`,syntax:[`LN10`],description:`Returns the natural logarithm of 10, approximately equal to 2.302`,examples:[`LN10`,`log(10)`],seealso:[]},Rg={name:`LN2`,category:`Constants`,syntax:[`LN2`],description:`Returns the natural logarithm of 2, approximately equal to 0.693`,examples:[`LN2`,`log(2)`],seealso:[]},zg={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:[]},Bg={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:[]},Vg={name:`NaN`,category:`Constants`,syntax:[`NaN`],description:`Not a number`,examples:[`NaN`,`0 / 0`],seealso:[]},Hg={name:`null`,category:`Constants`,syntax:[`null`],description:`Value null`,examples:[`null`],seealso:[`true`,`false`]},Ug={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:[]},Wg={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`]},Gg={bignumber:{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`,`bigint`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},bigint:{name:`bigint`,category:`Construction`,syntax:[`bigint(x)`],description:`Create a bigint, an integer with an arbitrary number of digits, from a number or string.`,examples:[`123123123123123123 # a large number will lose digits`,`bigint("123123123123123123")`,`bignumber(["1", "3", "5"])`],seealso:[`boolean`,`bignumber`,`number`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},boolean:{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`]},complex:{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`]},createUnit:{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`]},fraction:{name:`fraction`,category:`Construction`,syntax:[`fraction(num)`,`fraction(matrix)`,`fraction(num,de
52n)`,`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`]},index:{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:[`A = [1, 2, 3; 4, 5, 6]`,`A[1, :]`,`A[1, 2] = 50`,`A[1:2, 1:2] = 1`,`B = [1, 2, 3]`,`B[B>1 and B<3]`],seealso:[`bignumber`,`boolean`,`complex`,`matrix`,`number`,`range`,`string`,`unit`]},matrix:{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`]},number:{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`,`bigint`,`boolean`,`complex`,`fraction`,`index`,`matrix`,`string`,`unit`]},sparse:{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`]},splitUnit:{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`]},string:{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`]},unit:{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`]},e:Ng,E:Ng,false:Pg,i:Fg,Infinity:Ig,LN2:Rg,LN10:Lg,LOG2E:Bg,LOG10E:zg,NaN:Vg,null:Hg,pi:Wg,PI:Wg,phi:Ug,SQRT1_2:{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:[]},SQRT2:{name:`SQRT2`,category:`Constants`,syntax:[`SQRT2`],description:`Returns the square root of 2, approximately equal to 1.414`,examples:[`SQRT2`,`sqrt(2)`],seealso:[]},tau:{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`]},true:{name:`true`,category:`Constants`,syntax:[`true`],description:`Boolean value true`,examples:[`true`],seealso:[`false`]},version:{name:`version`,category:`Constants`,syntax:[`version`],description:`A string with the version number of math.js`,examples:[`version`],seealso:[]},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`]}
52,coulomb:{description:`Coulomb's constant. Deprecated in favor of coulombConstant`,examples:[`coulombConstant`]},coulombConstant:{description:`Coulomb's constant`,examples:[`coulombConstant`]},elementaryCharge:{description:`Elementary charge`,examples:[`elementaryCharge`]},bohrMagneton:{description:`Bohr 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:`Bohr 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:{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`]},lsolve:{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`]},lsolveAll:{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`]},lup:{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, 
521], [1, 4]])`,`lup(matrix([[2, 1], [1, 4]]))`,`lup(sparse([[2, 1], [1, 4]]))`],seealso:[`lusolve`,`lsolve`,`usolve`,`matrix`,`sparse`,`slu`,`qr`]},lusolve:{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`]},leafCount:{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`]},polynomialRoot:{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`]},resolve:{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`]},simplify:{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`]},simplifyConstant:{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`]},simplifyCore:{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`]},symbolicEqual:{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`]},rationalize:{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`]},slu:{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`]},usolve:{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`]},usolveAll:{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`]},qr:{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`]},abs:{name:`abs`,category:`Arithmetic`,syntax:[`abs(x)`],description:`Compute the absolute value.`,examples:[`abs(3.5)`,`abs(-4.2)`],seealso:[`sign`]},add:{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`]},cbrt:{name:`cbrt`,category:`Arithmetic`,syntax:[`cbrt(x)`,`cbrt(x, allRoots)`],description:"Compute the cub
52ic 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`]},ceil:{name:`ceil`,category:`Arithmetic`,syntax:[`ceil(x)`,`ceil(x, n)`,`ceil(unit, valuelessUnit)`,`ceil(unit, n, valuelessUnit)`],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)`,`ceil(3.241cm, cm)`,`ceil(3.241cm, 2, cm)`],seealso:[`floor`,`fix`,`round`]},cube:{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`]},divide:{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`]},dotDivide:{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`]},dotMultiply:{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`]},dotPow:{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`]},exp:{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`]},expm:{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`]},expm1:{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`]},fix:{name:`fix`,category:`Arithmetic`,syntax:[`fix(x)`,`fix(x, n)`,`fix(unit, valuelessUnit)`,`fix(unit, n, valuelessUnit)`],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)`,`fix(3.241cm, cm)`,`fix(3.241cm, 2, cm)`],seealso:[`ceil`,`floor`,`round`]},floor:{name:`floor`,category:`Arithmetic`,syntax:[`floor(x)`,`floor(x, n)`,`floor(unit, valuelessUnit)`,`floor(unit, n, valuelessUnit)`],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)`,`floor(3.241cm, cm)`,`floor(3.241cm, 2, cm)`],seealso:[`ceil`,`fix`,`round`]},gcd:{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`]},hypot:{name:`hypot`,category:`Arithmetic`,syntax:[`hypot(a, b, c, ...)`,`hypot([a, b, c, ...])`],description:`Calculate the hypotenuse of a list with values.`,examples:[`hypot(3, 4)`,`sqrt(3^2 + 4^2)`,`hypot(-2)`,`hypot([3, 4, 5])`],seealso:[`abs`,`norm`]},lcm:{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`]},log:{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`]},log2:{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`]},log1p:{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`]},log10:{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`]},mod:{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`]},multiply:{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`]},norm:{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")`]}
52,nthRoot:{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`]},nthRoots:{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`]},pow:{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`]},round:{name:`round`,category:`Arithmetic`,syntax:[`round(x)`,`round(x, n)`,`round(unit, valuelessUnit)`,`round(unit, n, valuelessUnit)`],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)`,`round(3.241cm, 2, cm)`,`round([3.2, 3.8, -4.7])`],seealso:[`ceil`,`floor`,`fix`]},sign:{name:`sign`,category:`Arithmetic`,syntax:[`sign(x)`],description:`Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.`,examples:[`sign(3.5)`,`sign(-4.2)`,`sign(0)`],seealso:[`abs`]},sqrt:{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`]},sqrtm:{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`]},square:{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`]},subtract:{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`]},unaryMinus:{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`]},unaryPlus:{name:`unaryPlus`,category:`Operators`,syntax:[`+x`,`unaryPlus(x)`],description:`Converts booleans and strings to numbers.`,examples:[`+true`,`+"2"`],seealso:[`add`,`subtract`,`unaryMinus`]},xgcd:{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`]}
52,invmod:{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`]},num:{name:`num`,category:`Fraction`,syntax:[`num(x)`],description:`Get the numerator of a fraction.`,examples:[`num(fraction(2, 3))`,`num(fraction(5, 8))`],seealso:[`den`,`fraction`]},den:{name:`den`,category:`Fraction`,syntax:[`den(x)`],description:`Get the denominator of a fraction.`,examples:[`den(fraction(2, 3))`,`den(fraction(5, 8))`],seealso:[`num`,`fraction`]},bitAnd:{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`]},bitNot:{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`]},bitOr:{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`]},bitXor:{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`]},leftShift:{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`]},rightArithShift:{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`]},rightLogShift:{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`]},bellNumbers:{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`]},catalan:{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`]},composition:{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`]},stirlingS2:{name:`stirlingS2`,category:`Combinatorics`,syntax:[`stirlingS2
52(n, k)`],description:"The 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`,`bernoulli`]},config:{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:[]},import:{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:[]},typed:{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:[]},arg:{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`]},conj:{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`]},re:{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`]},im:{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`]},evaluate:{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:[`parser`,`parse`,`compile`]},help:{name:`help`,category:`Expression`,syntax:[`help(object)`,`help(string)`],description:`Display documentation on a function or data type.`,examples:[`help(sqrt)`,`help("complex")`],seealso:[]},parse:{name:`parse`,category:`Expression`,syntax:[`parse(expr)`,`parse(expr, options)`,`parse([expr1, expr2, expr3, ...])`,`parse([expr1, expr2, expr3, ...], options)`],description:`Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().`,examples:[`node1 = parse("sqrt(3^2 + 4^2)")`,`node1.evaluate()`,`code1 = node1.compile()`,`code1.evaluate()`,`scope = {a: 3, b: 4}`,`node2 = parse("a * b")`,`node2.evaluate(scope)`,`code2 = node2.compile()`,`code2.evaluate(scope)`],seealso:[`parser`,`evaluate`,`compile`]},parser:{name:`parser`,category:`Expression`,syntax:[`parser()`],description:`Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.`,examples:[`myParser = parser()`,`myParser.evaluate("sqrt(3^2 + 4^2)")`,`myParser.set("x", 3)`,`myParser.evaluate("y = x + 3")`,`myParser.evaluate(["y = x + 3", "y = y + 1"])`,`myParser.get("y")`],seealso:[`evaluate`,`parse`,`compile`]},compile:{name:`compile`,category:`Expression`,syntax:[`compile(expr) `,`compile([expr1, expr2, expr3, ...])`],description:`Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.`,examples:[`code1 = compile("sqrt(3^2 + 4^2)")`,`code1.evaluate() `,`code2 = compile("a * b")`,`code2.evaluate({a: 3, b: 4})`],seealso:[`parser`,`parse`,`evaluate`]},distance:{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:[]},intersect:{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:[]},and:{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`]}
52,not:{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`]},nullish:{name:`nullish`,category:`Logical`,syntax:[`x ?? y`,`nullish(x, y)`],description:`Nullish coalescing operator. Returns the right-hand operand when the left-hand operand is null or undefined, and otherwise returns the left-hand operand.`,examples:[`null ?? 42`,`undefined ?? 42`,`0 ?? 42`,`false ?? 42`,`null ?? undefined ?? 42`],seealso:[`and`,`or`,`not`]},or:{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`]},xor:{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`]},mapSlices:{name:`mapSlices`,category:`Matrix`,syntax:[`mapSlices(A, dim, callback)`],description:`Generate a matrix one dimension less than A by applying callback to each slice of A along dimension dim.`,examples:[`A = [[1, 2], [3, 4]]`,`mapSlices(A, 1, sum)`,`mapSlices(A, 2, prod)`],seealso:[`map`,`forEach`]},concat:{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`]},count:{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`]},cross:{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`]},column:{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`]},ctranspose:{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`]},det:{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`]},diag:{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`]},diff:{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 indicate 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`]},dot:{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`,`
52cross`]},getMatrixDataType:{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`]},identity:{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`]},filter:{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`]},flatten:{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`]},forEach:{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`]},inv:{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`]},pinv:{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`]},eigs:{name:`eigs`,category:`Matrix`,syntax:[`eigs(x)`],description:`Calculate the eigenvalues and optionally eigenvectors of a square matrix`,examples:[`eigs([[5, 2.3], [2.3, 1]])`,`eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })`],seealso:[`inv`]},kron:{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`]},matrixFromFunction:{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
52)`],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`]},matrixFromRows:{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`]},matrixFromColumns:{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`]},map:{name:`map`,category:`Matrix`,syntax:[`map(x, callback)`,`map(x, y, ..., callback)`],description:`Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.`,examples:[`map([1, 2, 3], square)`,`map([1, 2], [3, 4], f(a,b) = a + b)`],seealso:[`filter`,`forEach`]},ones:{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`]},partitionSelect:{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`]},range:{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`]},resize:{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`]},reshape:{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`]},rotate:{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`]},rotationMatrix:{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`]},row:{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`]},size:{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`]},sort:{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`]}
52,squeeze:{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`]},subset:{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`]},trace:{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`]},transpose:{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`]},zeros:{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`]},fft:{name:`fft`,category:`Matrix`,syntax:[`fft(x)`],description:`Calculate N-dimensional Fourier transform`,examples:[`fft([[1, 0], [1, 0]])`],seealso:[`ifft`]},ifft:{name:`ifft`,category:`Matrix`,syntax:[`ifft(x)`],description:`Calculate N-dimensional inverse Fourier transform`,examples:[`ifft([[2, 2], [0, 0]])`],seealso:[`fft`]},sylvester:{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`]},schur:{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`]},lyap:{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`]},solveODE:{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`]},bernoulli:{name:`bernoulli`,category:`Probability`,syntax:[`bernoulli(n)`],description:`The nth Bernoulli number`,examples:[`bernoulli(4)`,`bernoulli(fraction(12))`],seealso:[`combinations`,`gamma`,`stirlingS2`]},combinations:{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`]},combinationsWithRep:{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`]},factorial:{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`]},gamma:{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`]},kldivergence:{name:`kldivergence`,category:`Probability`,syntax:[`kldivergence(x, y)`],description:`Calculate the Kullback-Leibler 
52(KL) divergence  between two distributions.`,examples:[`kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])`],seealso:[]},lgamma:{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`]},multinomial:{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`]},permutations:{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`]},pickRandom:{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`]},random:{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`]},randomInt:{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`]},compare:{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`]},compareNatural:{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`]},compareText:{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`]},deepEqual:{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`]},equal:{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`]},equalText:{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`]},larger:{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. Comparing a value with NaN returns false.`,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`]}
52,largerEq:{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`]},smaller:{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. Comparing a value with NaN returns false.`,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`]},smallerEq:{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`]},unequal:{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`]},setCartesian:{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`]},setDifference:{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`]},setDistinct:{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`]},setIntersect:{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`]},setIsSubset:{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`]},setMultiplicity:{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`]},setPowerset:{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`]},setSize:{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`]},setSymDifference:{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`]},setUnion:{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`]},zpk2tf:{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:[]},freqz:{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:[]},erf:{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:[]},zeta:{name:`zeta`,category:`Special`,syntax:[`zeta(s)`],description:`Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane`,examples:[`zeta(0.2)`,`zeta(-0.5)`,`zeta(4)`],seealso:[]},cumsum:{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;
52 3, 4], 1)`,`cumsum([1, 2; 3, 4], 2)`],seealso:[`max`,`mean`,`median`,`min`,`prod`,`std`,`sum`,`variance`]},mad:{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`]},max:{name:`max`,category:`Statistics`,syntax:[`max(a, b, c, ...)`,`max(A)`,`max(A, dimension)`],description:`Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.`,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`]},mean:{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`]},median:{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`]},min:{name:`min`,category:`Statistics`,syntax:[`min(a, b, c, ...)`,`min(A)`,`min(A, dimension)`],description:`Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.`,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`]},mode:{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`]},prod:{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`]},quantileSeq:{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 probability are: Number, BigNumber. 
53
54In 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`]},std:{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`]},sum:{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`,`variance`]},variance:{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`]}
54,corr:{name:`corr`,category:`Statistics`,syntax:[`corr(A,B)`],description:`Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.`,examples:[`corr([2, 4, 6, 8],[1, 2, 3, 6])`,`corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))`],seealso:[`max`,`mean`,`min`,`median`,`min`,`prod`,`std`,`sum`]},acos:{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`]},acosh:{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`]},acot:{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`]},acoth:{name:`acoth`,category:`Trigonometry`,syntax:[`acoth(x)`],description:"Calculate the inverse hyperbolic tangent 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`]},acsc:{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`]},acsch:{name:`acsch`,category:`Trigonometry`,syntax:[`acsch(x)`],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:[`acsch(0.5)`],seealso:[`asech`,`acoth`]},asec:{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`]},asech:{name:`asech`,category:`Trigonometry`,syntax:[`asech(x)`],description:`Calculate the inverse secant of a value.`,examples:[`asech(0.5)`],seealso:[`acsch`,`acoth`]},asin:{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`]},asinh:{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`]},atan:{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`]},atanh:{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`]},atan2:{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`]},cos:{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`]},cosh:{name:`cosh`,category:`Trigonometry`,syntax:[`cosh(x)`],description:`Compute the hyperbolic cosine of x in radians.`,examples:[`cosh(0.5)`],seealso:[`sinh`,`tanh`,`coth`]},cot:{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`]},coth:{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`]},csc:{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`]},csch:{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`]}
54,sec:{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`]},sech:{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`]},sin:{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`]},sinh:{name:`sinh`,category:`Trigonometry`,syntax:[`sinh(x)`],description:`Compute the hyperbolic sine of x in radians.`,examples:[`sinh(0.5)`],seealso:[`cosh`,`tanh`]},tan:{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`]},tanh:{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`]},to:{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:[]},toBest:{name:`toBest`,category:`Units`,syntax:[`toBest(x)`,`toBest(x, unitList)`,`toBest(x, unitList, options)`],description:`Converts to the most appropriate display unit.`,examples:[`toBest(unit(5000, "m"))`,`toBest(unit(3500000, "W"))`,`toBest(unit(0.000000123, "A"))`,`toBest(unit(10, "m"), "cm")`,`toBest(unit(10, "m"), "mm,km", {offset: 1.5})`],seealso:[]},clone:{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:[]},format:{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`]},bin:{name:`bin`,category:`Utils`,syntax:[`bin(value)`],description:`Format a number as binary`,examples:[`bin(2)`],seealso:[`oct`,`hex`]},oct:{name:`oct`,category:`Utils`,syntax:[`oct(value)`],description:`Format a number as octal`,examples:[`oct(56)`],seealso:[`bin`,`hex`]},hex:{name:`hex`,category:`Utils`,syntax:[`hex(value)`],description:`Format a number as hexadecimal`,examples:[`hex(240)`],seealso:[`bin`,`oct`]},isNaN:{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`,`isFinite`,`isBounded`]},isBounded:{name:`isBounded`,category:`Utils`,syntax:[`isBounded(x)`],description:`Test whether a value or its entries are bounded.`,examples:[`isBounded(Infinity)`,`isBounded(bigint(3))`,`isBounded([3, -Infinity, -3])`],seealso:[`isFinite`,`isNumeric`,`isNaN`,`isNegative`,`isPositive`]},isFinite:{name:`isFinite`,category:`Utils`,syntax:[`isFinite(x)`],description:`Test whether a value is finite, elementwise on collections.`,examples:[`isFinite(Infinity)`,`isFinite(bigint(3))`,`isFinite([3, -Infinity, -3])`],seealso:[`isBounded`,`isNumeric`,`isNaN`,`isNegative`,`isPositive`]},isInteger:{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`]},isNegative:{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`]},isNumeric:{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`,`isFinite`,`isBounded`]},hasNumericValue:{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`]},isPositive:{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`]}
54,isPrime:{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`]},isZero:{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`]},print:{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: $1, $2, $3", [6, 9, 4])`],seealso:[`format`]},typeOf:{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`]},numeric:{name:`numeric`,category:`Utils`,syntax:[`numeric(x)`],description:`Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.`,examples:[`numeric("4")`,`numeric("4", "number")`,`numeric("4", "bigint")`,`numeric("4", "BigNumber")`,`numeric("4", "Fraction")`,`numeric(4, "Fraction")`,`numeric(fraction(2, 5), "number")`],seealso:[`number`,`bigint`,`fraction`,`bignumber`,`string`,`format`]}},Kg=`help`,qg=W(Kg,[`typed`,`mathWithTransform`,`Help`],e=>{var{typed:t,mathWithTransform:n,Help:r}=e;return t(Kg,{any:function(e){var t,i=e;if(typeof e!=`string`){for(t in n)if(H(n,t)&&e===n[t]){i=t;break}}var o=a(Gg,i);if(!o){var s=typeof i==`function`?i.name:i;throw Error(`No documentation found on "`+s+`"`)}return new r(o)}})}),Jg=`chain`,Yg=W(Jg,[`typed`,`Chain`],e=>{var{typed:t,Chain:n}=e;return t(Jg,{"":function(){return new n},any:function(e){return new n(e)}})}),Xg=`det`,Zg=W(Xg,[`typed`,`matrix`,`subtractScalar`,`multiply`,`divideScalar`,`isZero`,`unaryMinus`],e=>{var{typed:t,matrix:n,subtractScalar:r,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return t(Xg,{any:function(e){return V(e)},"Array | Matrix":function(e){var t;switch(O(e)?t=e.size():Array.isArray(e)?(e=n(e),t=e.size()):t=[],t.length){case 0:return V(e);case 1:if(t[0]===1)return V(e.valueOf()[0]);if(t[0]===0)return 1;throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);case 2:var r=t[0],i=t[1];if(r===i)return c(e.clone().valueOf(),r,i);if(i===0)return 1;throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+qr(t)+`)`)}}});function c(e,t,n){if(t===1)return V(e[0][0]);if(t===2)return r(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var c=!1,l=Array(t).fill(0).map((e,t)=>t),u=0;u<t;u++){var d=l[u];if(o(e[d][u])){var f=void 0;for(f=u+1;f<t;f++)if(!o(e[l[f]][u])){d=l[f],l[f]=l[u],l[u]=d,c=!c;break}if(f===t)return e[d][u]}for(var p=e[d][u],m=u===0?1:e[l[u-1]][u-1],h=u+1;h<t;h++)for(var g=l[h],_=u+1;_<t;_++)e[g][_]=a(r(i(e[g][_],p),i(e[g][u],e[d][_])),m)}var v=e[l[t-1]][t-1];return c?s(v):v}}),Qg=`inv`,$g=W(Qg,[`typed`,`matrix`,`divideScalar`,`addScalar`,`multiply`,`unaryMinus`,`det`,`identity`,`abs`],e=>{var{typed:t,matrix:n,divideScalar:r,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:c,abs:l}=e;return t(Qg,{"Array | Matrix":function(e){var t=O(e)?e.size():ri(e);switch(t.length){case 1:if(t[0]===1)return O(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);case 2:var i=t[0],a=t[1];if(i===a)return O(e)?n(u(e.valueOf(),i,a),e.storage()):u(e,i,a);throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);default:throw RangeError(`Matrix must be two dimensional (size: `+qr(t)+`)`)}},any:function(e){return r(1,e)}});function u(e,t,n){var u,d,f,p,m;if(t===1){if(p=e[0][0],p===0)throw Error(`Cannot calculate inverse, determinant is zero`);return[[r(1,p)]]}else if(t===2){var h=s(e);if(h===0)throw Error(`Cannot calculate inverse, determinant is zero`);return[[r(e[1][1],h),r(o(e[0][1]),h)],[r(o(e[1][0]),h),r(e[0][0],h)]]}else{var g=e.concat();for(u=0;
54u<t;u++)g[u]=g[u].concat();for(var _=c(t).valueOf(),v=0;v<n;v++){var y=l(g[v][v]),b=v;for(u=v+1;u<t;)l(g[u][v])>y&&(y=l(g[u][v]),b=u),u++;if(y===0)throw Error(`Cannot calculate inverse, determinant is zero`);u=b,u!==v&&(m=g[v],g[v]=g[u],g[u]=m,m=_[v],_[v]=_[u],_[u]=m);var x=g[v],S=_[v];for(u=0;u<t;u++){var C=g[u],w=_[u];if(u!==v){if(C[v]!==0){for(f=r(o(C[v]),x[v]),d=v;d<n;d++)C[d]=i(C[d],a(f,x[d]));for(d=0;d<n;d++)w[d]=i(w[d],a(f,S[d]))}}else{for(f=x[v],d=v;d<n;d++)C[d]=r(C[d],f);for(d=0;d<n;d++)w[d]=r(w[d],f)}}}return _}}}),e_=`pinv`,t_=W(e_,[`typed`,`matrix`,`inv`,`deepEqual`,`equal`,`dotDivide`,`dot`,`ctranspose`,`divideScalar`,`multiply`,`add`,`Complex`],e=>{var{typed:t,matrix:n,inv:r,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:c,divideScalar:l,multiply:u,add:d,Complex:f}=e;return t(e_,{"Array | Matrix":function(e){var t=O(e)?e.size():ri(e);switch(t.length){case 1:return _(e)?c(e):t[0]===1?r(e):o(c(e),s(e,e));case 2:if(_(e))return c(e);var i=t[0],a=t[1];if(i===a)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return O(e)?n(p(e.valueOf(),i,a),e.storage()):p(e,i,a);default:throw RangeError(`Matrix must be two dimensional (size: `+qr(t)+`)`)}},any:function(e){return a(e,0)?V(e):l(1,e)}});function p(e,t,n){var{C:i,F:a}=h(e,t,n),o=u(r(u(c(i),i)),c(i));return u(u(c(a),r(u(a,c(a)))),o)}function m(e,t,n){for(var r=V(e),i=0,a=0;a<t;a++){if(n<=i)return r;for(var s=a;g(r[s][i]);)if(s++,t===s&&(s=a,i++,n===i))return r;[r[s],r[a]]=[r[a],r[s]];for(var c=r[a][i],l=0;l<n;l++)r[a][l]=o(r[a][l],c);for(var f=0;f<t;f++)if(f!==a){c=r[f][i];for(var p=0;p<n;p++)r[f][p]=d(r[f][p],u(-1,u(c,r[a][p])))}i++}return r}function h(e,t,n){var r=m(e,t,n);return{C:e.map((e,n)=>e.filter((e,n)=>n<t&&!g(s(r[n],r[n])))),F:r.filter((e,t)=>!g(s(r[t],r[t])))}}function g(e){return a(d(e,f(1,1)),d(0,f(1,1)))}function _(e){return i(d(e,f(1,1)),d(u(e,0),f(1,1)))}});function n_(e){var{addScalar:t,subtract:n,flatten:r,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:c,bignumber:l,diag:u,size:d,reshape:f,inv:p,qr:m,usolve:h,usolveAll:g,equal:_,complex:v,larger:y,smaller:b,matrixFromColumns:x,dot:S}=e;function C(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=w(e,t,n,r,i);T(e,t,n,r,i,a);var{values:o,C:s}=E(e,t,n,r,i);return i?{values:o,eigenvectors:D(e,t,s,a,o,n,r)}:{values:o}}function w(e,n,r,i,s){var d=i===`BigNumber`,f=i===`Complex`,p=d?l(0):0,m=d?l(1):f?v(1):1,h=d?l(1):1,g=d?l(10):2,x=a(g,g),S;s&&(S=Array(n).fill(m));for(var C=!1;!C;){C=!0;for(var w=0;w<n;w++){for(var T=p,E=p,D=0;D<n;D++)w!==D&&(T=t(T,c(e[D][w])),E=t(E,c(e[w][D])));if(!_(T,0)&&!_(E,0)){for(var O=h,k=T,A=o(E,g),j=a(E,g);b(k,A);)k=a(k,x),O=a(O,g);for(;y(k,j);)k=o(k,x),O=o(O,g);if(b(o(t(k,E),O),a(t(T,E),.95))){C=!1;for(var M=o(1,O),N=0;N<n;N++)w!==N&&(e[w][N]=a(e[w][N],M),e[N][w]=a(e[N][w],O));s&&(S[w]=a(S[w],M))}}}}return s?u(S):null}function T(e,r,i,s,u,d){var f=s===`BigNumber`,p=f?l(0):s===`Complex`?v(0):0;f&&(i=l(i));for(var m=0;m<r-2;m++){for(var h=0,g=p,_=m+1;_<r;_++){var y=e[_][m];b(c(g),c(y))&&(g=y,h=_)}if(!b(c(g),i)){if(h!==m+1){var x=e[h];e[h]=e[m+1],e[m+1]=x;for(var S=0;S<r;S++){var C=e[S][h];e[S][h]=e[S][m+1],e[S][m+1]=C}if(u){var w=d[h];d[h]=d[m+1],d[m+1]=w}}for(var T=m+2;T<r;T++){var E=o(e[T][m],g);if(E!==0){for(var D=0;D<r;D++)e[T][D]=n(e[T][D],a(E,e[m+1][D]));for(var O=0;O<r;O++)e[O][m+1]=t(e[O][m+1],a(E,e[O][T]));if(u)for(var k=0;k<r;k++)d[T][k]=n(d[T][k],a(E,d[m+1][k]))}}}}return d}function E(e,r,a,o,s){var d=o===`BigNumber`,f=d?l(1):o===`Complex`?v(1):1;d&&(a=l(a));for(var p=V(e),h=[],g=r,_=[],y=s?u(Array(r).fill(f)):void 0,x=s?u(Array(g).fill(f)):void 0,S=0;S<=100;){S+=1;for(var C=p[g-1][g-1],w=0;w<g;w++)p[w][w]=n(p[w][w],C);var{Q:T,R:E}=m(p);p=i(E,T);for(var D=0;D<g;D++)p[D][D]=t(p[D][D],C);if(s&&(x=i(x,T)),g===1||b(c(p[g-1][g-2]),a)){S=0,h.push(p[g-1][g-1]),s&&(_.unshift([[1]]),A(x,r),y=i(y,x),g>1&&(x=u(Array(g-1).fill(f)))),--g,p.pop();for(var M=0;M<g;M++)p[M].pop()}else if(g===2||b(c(p[g-2][g-3]),a)){S=0;var N=O(p[g-2][g-2],p[g-2][g-1],p[g-1][g-2],p[g-1][g-1]);h.push(...N),s&&(_.unshift(k(p[g-2][g-2],p[g-2][g-1],p[g-1][g-2],p[g-1][g-1],N[0],N[1],a,o)),A(x,r),y=i(y,x),g>2&&(x=u(Array(g-2).fill(f)))),g-=2,p.pop(),p.pop();for(var P=0;P<g;P++)p[P].pop(),p[P].pop()}if(g===0)break}if(h.sort((e,t)=>
54+n(c(e),c(t))),S>100){var F=Error(`The eigenvalues failed to converge. Only found these eigenvalues: `+h.join(`, `));throw F.values=h,F.vectors=[],F}return{values:h,C:s?i(y,j(_,r)):void 0}}function D(e,t,a,o,s,c,d){var f=i(p(a),e,a),m=d===`BigNumber`,h=d===`Complex`,y=m?l(0):h?v(0):0,b=m?l(1):h?v(1):1,x=[],S=[];for(var C of s){var w=M(x,C,_);w===-1?(x.push(C),S.push(1)):S[w]+=1}for(var T=[],E=x.length,D=Array(t).fill(y),O=u(Array(t).fill(b)),k=function(){var e=x[A],s=n(f,i(e,O)),l=g(s,D);for(l.shift();l.length<S[A];){var u=N(s,t,l,c,d);if(u===null)break;l.push(u)}var m=i(p(o),a);l=l.map(e=>i(m,e)),T.push(...l.map(t=>({value:e,vector:r(t)})))},A=0;A<E;A++)k();return T}function O(e,r,i,o){var c=t(e,o),l=n(a(e,o),a(r,i)),u=a(c,.5),d=a(s(n(a(c,c),a(4,l))),.5);return[t(u,d),n(u,d)]}function k(e,t,r,i,a,o,s,u){var d=u===`BigNumber`,f=u===`Complex`,p=d?l(0):f?v(0):0,m=d?l(1):f?v(1):1;if(b(c(r),s))return[[m,p],[p,m]];if(y(c(n(a,o)),s))return[[n(a,i),n(o,i)],[r,r]];var h=n(e,a),g=n(i,a);return b(c(t),s)&&b(c(g),s)?[[h,m],[r,p]]:[[t,p],[g,m]]}function A(e,t){for(var n=0;n<e.length;n++)e[n].push(...Array(t-e[n].length).fill(0));for(var r=e.length;r<t;r++)e.push(Array(t).fill(0)),e[r][r]=1;return e}function j(e,t){for(var n=[],r=0;r<t;r++)n[r]=Array(t).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var c=0;c<o;c++)n[i+s][i+c]=a[s][c];i+=o}return n}function M(e,t,n){for(var r=0;r<e.length;r++)if(n(e[r],t))return r;return-1}function N(e,t,n,r,i){for(var a=i===`BigNumber`?l(1e3):1e3,o,s=0;s<5;++s){o=P(t,n,i);try{o=h(e,o)}catch{continue}if(y(ee(o),a))break}if(s>=5)return null;for(s=0;;){var c=h(e,o);if(b(ee(F(o,[c])),r))break;if(++s>=10)return null;o=te(c)}return o}function P(e,t,n){var r=n===`BigNumber`,i=n===`Complex`,a=Array(e).fill(0).map(e=>2*Math.random()-1);return r&&(a=a.map(e=>l(e))),i&&(a=a.map(e=>v(e))),a=F(a,t),te(a,n)}function F(e,t){var r=d(e);for(var a of t)a=f(a,r),e=n(e,i(o(S(a,e),S(a,a)),a));return e}function ee(e){return c(s(S(e,e)))}function te(e,t){return i(o(t===`BigNumber`?l(1):t===`Complex`?v(1):1,ee(e)),e)}return C}function r_(e){var{config:t,addScalar:n,subtract:r,abs:i,atan:a,cos:o,sin:s,multiplyScalar:c,inv:l,bignumber:u,multiply:d,add:f}=e;function p(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.relTol,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if(i===`number`)return m(e,r,a);if(i===`BigNumber`)return h(e,r,a);throw TypeError(`Unsupported data type: `+i)}function m(e,t,n){var r=e.length,i=Math.abs(t/r),a,o;if(n){o=Array(r);for(var s=0;s<r;s++)o[s]=Array(r).fill(0),o[s][s]=1}for(var c=S(e);Math.abs(c[1])>=Math.abs(i);){var l=c[0][0],u=c[0][1];a=g(e[l][l],e[u][u],e[l][u]),e=x(e,a,l,u),n&&(o=v(o,a,l,u)),c=S(e)}for(var d=Array(r).fill(0),f=0;f<r;f++)d[f]=e[f][f];return w(V(d),o,n)}function h(e,t,n){var r=e.length,a=i(t/r),o,s;if(n){s=Array(r);for(var c=0;c<r;c++)s[c]=Array(r).fill(0),s[c][c]=1}for(var l=C(e);i(l[1])>=i(a);){var u=l[0][0],d=l[0][1];o=_(e[u][u],e[d][d],e[u][d]),e=b(e,o,u,d),n&&(s=y(s,o,u,d)),l=C(e)}for(var f=Array(r).fill(0),p=0;p<r;p++)f[p]=e[p][p];return w(V(f),s,n)}function g(e,n,r){var i=n-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*r/(n-e))}function _(e,n,o){var s=r(n,e);return i(s)<=t.relTol?u(-1).acos().div(4):c(.5,a(d(2,o,l(s))))}function v(e,t,n,r){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=Array(i).fill(0),c=Array(i).fill(0),l=0;l<i;l++)s[l]=a*e[l][n]-o*e[l][r],c[l]=o*e[l][n]+a*e[l][r];for(var u=0;u<i;u++)e[u][n]=s[u],e[u][r]=c[u];return e}function y(e,t,i,a){for(var l=e.length,d=o(t),f=s(t),p=Array(l).fill(u(0)),m=Array(l).fill(u(0)),h=0;h<l;h++)p[h]=r(c(d,e[h][i]),c(f,e[h][a])),m[h]=n(c(f,e[h][i]),c(d,e[h][a]));for(var g=0;g<l;g++)e[g][i]=p[g],e[g][a]=m[g];return e}function b(e,t,i,a){for(var l=e.length,p=u(o(t)),m=u(s(t)),h=c(p,p),g=c(m,m),_=Array(l).fill(u(0)),v=Array(l).fill(u(0)),y=d(u(2),p,m,e[i][a]),b=n(r(c(h,e[i][i]),y),c(g,e[a][a])),x=f(c(g,e[i][i]),y,c(h,e[a][a])),S=0;S<l;S++)_[S]=r(c(p,e[i][S]),c(m,e[a][S])),v[S]=n(c(m,e[i][S]),c(p,e[a][S]));e[i][i]=b,e[a][a]=x,e[i][a]=u(0),e[a][i]=u(0);for(var C=0;C<l;C++)C!==i&&C!==a&&(e[i][C]=_[C],e[C][i]=_[C],e[a][C]=v[C],e[C][a]=v[C]);return e}function x(e,t,n,r){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=a*a,c=o*o,l=Array(i).fill(0),u=Array(i).fill(0),d=s*e[n][n]-2*a*o*e[n][r]+c*e[r][r],f=c*e[n][n]+2*a*o*e[n][r]+s*e[r][r],p=0;p<i;p++)l[p]=a*e[n][p]-o*e[r][p],u[p]=o*e[n][p]+a*e[r][p];e[n][n]=d,e[r][r]=f,e[n][r]=0,e[r][n]=0;for(var m=0;m<i;m++)m!==n&&m!==r&&(e[n][m]=l[m],e[m][n]=l[m],e[r][m]=u[m],e[m][r]=u[m]);return e}function S(e){for(var t=e.length,n=0,r=[0,1],i=0;i<t;i++)for(var a=i+1;a<t;
54a++)Math.abs(n)<Math.abs(e[i][a])&&(n=Math.abs(e[i][a]),r=[i,a]);return[r,n]}function C(e){for(var t=e.length,n=0,r=[0,1],a=0;a<t;a++)for(var o=a+1;o<t;o++)i(n)<i(e[a][o])&&(n=i(e[a][o]),r=[a,o]);return[r,n]}function w(e,t,n){var r=e.length,a=Array(r),o;if(n){o=Array(r);for(var s=0;s<r;s++)o[s]=Array(r)}for(var c=0;c<r;c++){for(var l=0,u=e[0],d=0;d<e.length;d++)i(e[d])<i(u)&&(l=d,u=e[l]);if(a[c]=e.splice(l,1)[0],n)for(var f=0;f<r;f++)o[c][f]=t[f][l],t[f].splice(l,1)}return n?{values:a,eigenvectors:o.map((e,t)=>({value:a[t],vector:e}))}:{values:a}}return p}var i_=W(`eigs`,`config.typed.matrix.addScalar.equal.subtract.abs.atan.cos.sin.multiplyScalar.divideScalar.inv.bignumber.multiply.add.larger.column.flatten.number.complex.sqrt.diag.size.reshape.qr.usolve.usolveAll.im.re.smaller.matrixFromColumns.dot`.split(`.`),e=>{var{config:t,typed:n,matrix:i,addScalar:a,subtract:o,equal:s,abs:c,atan:l,cos:u,sin:d,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:g,add:_,larger:v,column:y,flatten:S,number:T,complex:E,sqrt:D,diag:O,size:k,reshape:A,qr:j,usolve:M,usolveAll:N,im:P,re:F,smaller:ee,matrixFromColumns:te,dot:ne}=e,re=r_({config:t,addScalar:a,subtract:o,column:y,flatten:S,equal:s,abs:c,atan:l,cos:u,sin:d,multiplyScalar:f,inv:m,bignumber:h,complex:E,multiply:g,add:_}),ie=n_({config:t,addScalar:a,subtract:o,multiply:g,multiplyScalar:f,flatten:S,divideScalar:p,sqrt:D,abs:c,bignumber:h,diag:O,size:k,reshape:A,qr:j,inv:m,usolve:M,usolveAll:N,equal:s,complex:E,larger:v,smaller:ee,matrixFromColumns:te,dot:ne});return n(`eigs`,{Array:function(e){return ae(i(e))},"Array, number|BigNumber":function(e,t){return ae(i(e),{precision:t})},"Array, Object"(e,t){return ae(i(e),t)},Matrix:function(e){return ae(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return ae(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){var n={matricize:!0};return r(n,t),ae(e,n)}});function ae(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=`eigenvectors`in n?n.eigenvectors:!0,a=I(e,n.precision??t.relTol,r);return n.matricize&&(a.values=i(a.values),r&&(a.eigenvectors=a.eigenvectors.map(e=>{var{value:t,vector:n}=e;return{value:t,vector:i(n)}}))),r&&Object.defineProperty(a,"vectors",{enumerable:!1,get:()=>{throw Error(`eigs(M).vectors replaced with eigs(M).eigenvectors`)}}),a}function I(e,t,n){var r=e.toArray(),i=e.size();if(i.length!==2||i[0]!==i[1])throw RangeError(`Matrix must be square (size: ${qr(i)})`);var a=i[0];return L(r,a,t)&&(se(r,a),oe(r,a,t))?re(r,a,t,ce(e,r,a),n):ie(r,a,t,ce(e,r,a),n)}function oe(e,t,n){for(var r=0;r<t;r++)for(var i=r;i<t;i++)if(v(h(c(o(e[r][i],e[i][r]))),n))return!1;return!0}function L(e,t,n){for(var r=0;r<t;r++)for(var i=0;i<t;i++)if(v(h(c(P(e[r][i]))),n))return!1;return!0}function se(e,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)e[n][r]=F(e[n][r])}function ce(e,t,n){var r=e.datatype();if(r===`number`||r===`BigNumber`||r===`Complex`)return r;for(var i=!1,a=!1,o=!1,s=0;s<n;s++)for(var c=0;c<n;c++){var l=t[s][c];if(b(l)||w(l))i=!0;else if(x(l))a=!0;else if(C(l))o=!0;else throw TypeError(`Unsupported type in Matrix: `+Ce(l))}if(a&&o&&console.warn(`Complex BigNumbers not supported, this operation will lose precission.`),o){for(var u=0;u<n;u++)for(var d=0;d<n;d++)t[u][d]=E(t[u][d]);return`Complex`}if(a){for(var f=0;f<n;f++)for(var p=0;p<n;p++)t[f][p]=h(t[f][p]);return`BigNumber`}if(i){for(var m=0;m<n;m++)for(var g=0;g<n;g++)t[m][g]=T(t[m][g]);return`number`}else throw TypeError(`Matrix contains unsupported types only.`)}}),a_=`expm`,o_=W(a_,[`typed`,`abs`,`add`,`identity`,`inv`,`multiply`],e=>{var{typed:t,abs:n,add:r,identity:i,inv:a,multiply:o}=e;return t(a_,{Matrix:function(e){var t=e.size();if(t.length!==2||t[0]!==t[1])throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);for(var n=t[0],l=c(s(e),1e-15),u=l.q,d=l.j,f=o(e,2**-d),p=i(n),m=i(n),h=1,g=f,_=-1,v=1;v<=u;v++)v>1&&(g=o(g,f),_=-_),h=h*(u-v+1)/((2*u-v+1)*v),p=r(p,o(h,g)),m=r(m,o(h*_,g));for(var y=o(a(m),p),b=0;b<d;b++)y=o(y,y);return j(e)?e.createSparseMatrix(y):y}});function s(e){for(var t=e.size()[0],r=0,i=0;i<t;i++){for(var a=0,o=0;o<t;o++)a+=n(e.get([i,o]));r=Math.max(a,r)}return r}function c(e,t){for(var n=30,r=0;r<n;r++)for(var i=0;i<=r;i++){var a=r-i;
54if(l(e,i,a)<t)return{q:i,j:a}}throw Error(`Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)`)}function l(e,t,n){for(var r=1,i=2;i<=t;i++)r*=i;for(var a=r,o=t+1;o<=2*t;o++)a*=o;var s=a*(2*t+1);return 8*(e/2**n)**(2*t)*r*r/(a*s)}}),s_=`sqrtm`,c_=W(s_,[`typed`,`abs`,`add`,`multiply`,`map`,`sqrt`,`subtract`,`inv`,`size`,`max`,`identity`],e=>{var{typed:t,abs:n,add:r,multiply:i,map:a,sqrt:o,subtract:s,inv:c,size:l,max:u,identity:d}=e,f=1e3,p=1e-6;function m(e){var t,a=0,o=e,m=d(l(e));do{var h=o;if(o=i(.5,r(h,c(m))),m=i(.5,r(m,c(h))),t=u(n(s(o,h))),t>p&&++a>f)throw Error(`computing square root of matrix: iterative method could not converge`)}while(t>p);return o}return t(s_,{"Array | Matrix":function(e){var t=O(e)?e.size():ri(e);switch(t.length){case 1:if(t[0]===1)return a(e,o);throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);case 2:if(t[0]===t[1])return m(e);throw RangeError(`Matrix must be square (size: `+qr(t)+`)`);default:throw RangeError(`Matrix must be at most two dimensional (size: `+qr(t)+`)`)}}})}),l_=`sylvester`,u_=W(l_,[`typed`,`schur`,`matrixFromColumns`,`matrix`,`multiply`,`range`,`concat`,`transpose`,`index`,`subset`,`add`,`subtract`,`identity`,`lusolve`,`abs`],e=>{var{typed:t,schur:n,matrixFromColumns:r,matrix:i,multiply:a,range:o,concat:s,transpose:c,index:l,subset:u,add:d,subtract:f,identity:p,lusolve:m,abs:h,config:g}=e;return t(l_,{"Matrix, Matrix, Matrix":_,"Array, Matrix, Matrix":function(e,t,n){return _(i(e),t,n)},"Array, Array, Matrix":function(e,t,n){return _(i(e),i(t),n)},"Array, Matrix, Array":function(e,t,n){return _(i(e),t,i(n))},"Matrix, Array, Matrix":function(e,t,n){return _(e,i(t),n)},"Matrix, Array, Array":function(e,t,n){return _(e,i(t),i(n))},"Matrix, Matrix, Array":function(e,t,n){return _(e,t,i(n))},"Array, Array, Array":function(e,t,n){return _(i(e),i(t),i(n)).toArray()}});function _(e,t,g){for(var _=t.size()[0],v=e.size()[0],y=n(e),b=y.T,x=y.U,S=n(a(-1,t)),C=S.T,w=S.U,T=a(a(c(x),g),w),E=o(0,v),D=[],O=(e,t)=>s(e,t,1),k=(e,t)=>s(e,t,0),A=0;A<_;A++)if(A<_-1&&h(u(C,l(A+1,A)))>1e-5){for(var j=k(u(T,l(E,[A])),u(T,l(E,[A+1]))),M=0;M<A;M++)j=d(j,k(a(D[M],u(C,l(M,A))),a(D[M],u(C,l(M,A+1)))));var N=a(p(v),a(-1,u(C,l(A,A)))),P=a(p(v),a(-1,u(C,l(A+1,A)))),F=a(p(v),a(-1,u(C,l(A,A+1)))),ee=a(p(v),a(-1,u(C,l(A+1,A+1)))),te=m(k(O(d(b,N),P),O(F,d(b,ee))),j);D[A]=te.subset(l(o(0,v),[0])),D[A+1]=te.subset(l(o(v,2*v),[0])),A++}else{for(var ne=u(T,l(E,[A])),re=0;re<A;re++)ne=d(ne,a(D[re],u(C,l(re,A))));D[A]=m(f(b,a(u(C,l(A,A)),p(v))),ne)}return a(x,a(i(r(...D)),c(w)))}}),d_=`schur`,f_=W(d_,[`typed`,`matrix`,`identity`,`multiply`,`qr`,`norm`,`subtract`],e=>{var{typed:t,matrix:n,identity:r,multiply:i,qr:a,norm:o,subtract:s}=e;return t(d_,{Array:function(e){var t=c(n(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return c(e)}});function c(e){var t=e.size()[0],n=e,c=r(t),l=0,u;do{u=n;var d=a(n),f=d.Q,p=d.R;if(n=i(p,f),c=i(c,f),l++>100)break}while(o(s(n,u))>1e-4);return{U:c,T:n}}}),p_=`lyap`,m_=W(p_,[`typed`,`matrix`,`sylvester`,`multiply`,`transpose`],e=>{var{typed:t,matrix:n,sylvester:r,multiply:i,transpose:a}=e;return t(p_,{"Matrix, Matrix":function(e,t){return r(e,a(e),i(-1,t))},"Array, Matrix":function(e,t){return r(n(e),a(n(e)),i(-1,t))},"Matrix, Array":function(e,t){return r(e,a(n(e)),n(i(-1,t)))},"Array, Array":function(e,t){return r(n(e),a(n(e)),n(i(-1,t))).toArray()}})}),h_=W(`divide`,[`typed`,`matrix`,`multiply`,`equalScalar`,`divideScalar`,`inv`],e=>{var{typed:t,matrix:n,multiply:r,equalScalar:i,divideScalar:a,inv:o}=e,s=Ks({typed:t,equalScalar:i}),c=Js({typed:t});return t(`divide`,Te({"Array | Matrix, Array | Matrix":function(e,t){return r(e,o(t))},"DenseMatrix, any":function(e,t){return c(e,t,a,!1)},"SparseMatrix, any":function(e,t){return s(e,t,a,!1)},"Array, any":function(e,t){return c(n(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,o(t))}},a.signatures))}),g_=`distance`,__=W(g_,[`typed`,`addScalar`,`subtractScalar`,`divideScalar`,`multiplyScalar`,`deepEqual`,`sqrt`,`abs`],e=>{var{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:c}=e;return t(g_,{"Array, Array, Array":function(e,t,n){if(e.length===2&&t.length===2&&n.length===2){if(!u(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!u(t))throw TypeError(`Array with 2 numbers or BigNumbers expected for second argument`);if(!u(n))throw TypeError(`Array with 2 numbers or BigNumbers expected for third argument`);if(o(t,n))throw TypeError(`LinePoint1 should not be same with LinePoint2`);var a=r(n[1],t[1]),s=r(t[0],n[0]),c=r(i(n[0],t[1]),i(t[0],n[1]));
54return g(e[0],e[1],a,s,c)}else throw TypeError(`Invalid Arguments: Try again`)},"Object, Object, Object":function(e,t,n){if(Object.keys(e).length===2&&Object.keys(t).length===2&&Object.keys(n).length===2){if(!u(e))throw TypeError(`Values of pointX and pointY should be numbers or BigNumbers`);if(!u(t))throw TypeError(`Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers`);if(!u(n))throw TypeError(`Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers`);if(o(m(t),m(n)))throw TypeError(`LinePoint1 should not be same with LinePoint2`);if(`pointX`in e&&`pointY`in e&&`lineOnePtX`in t&&`lineOnePtY`in t&&`lineTwoPtX`in n&&`lineTwoPtY`in n){var a=r(n.lineTwoPtY,t.lineOnePtY),s=r(t.lineOnePtX,n.lineTwoPtX),c=r(i(n.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,n.lineTwoPtY));return g(e.pointX,e.pointY,a,s,c)}else throw TypeError(`Key names do not match`)}else throw TypeError(`Invalid Arguments: Try again`)},"Array, Array":function(e,t){if(e.length===2&&t.length===3){if(!u(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!d(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);return g(e[0],e[1],t[0],t[1],t[2])}else if(e.length===3&&t.length===6){if(!d(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!p(t))throw TypeError(`Array with 6 numbers or BigNumbers expected for second argument`);return _(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}else if(e.length===t.length&&e.length>0){if(!f(e)||!f(t))throw TypeError(`All values of an array should be numbers or BigNumbers`);return v(e,t)}else throw TypeError(`Invalid Arguments: Try again`)},"Object, Object":function(e,t){if(Object.keys(e).length===2&&Object.keys(t).length===3){if(!u(e))throw TypeError(`Values of pointX and pointY should be numbers or BigNumbers`);if(!d(t))throw TypeError(`Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers`);if(`pointX`in e&&`pointY`in e&&`xCoeffLine`in t&&`yCoeffLine`in t&&`constant`in t)return g(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===3&&Object.keys(t).length===6){if(!d(e))throw TypeError(`Values of pointX, pointY and pointZ should be numbers or BigNumbers`);if(!p(t))throw TypeError(`Values of x0, y0, z0, a, b and c should be numbers or BigNumbers`);if(`pointX`in e&&`pointY`in e&&`x0`in t&&`y0`in t&&`z0`in t&&`a`in t&&`b`in t&&`c`in t)return _(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===2&&Object.keys(t).length===2){if(!u(e))throw TypeError(`Values of pointOneX and pointOneY should be numbers or BigNumbers`);if(!u(t))throw TypeError(`Values of pointTwoX and pointTwoY should be numbers or BigNumbers`);if(`pointOneX`in e&&`pointOneY`in e&&`pointTwoX`in t&&`pointTwoY`in t)return v([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw TypeError(`Key names do not match`)}else if(Object.keys(e).length===3&&Object.keys(t).length===3){if(!d(e))throw TypeError(`Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers`);if(!d(t))throw TypeError(`Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers`);if(`pointOneX`in e&&`pointOneY`in e&&`pointOneZ`in e&&`pointTwoX`in t&&`pointTwoY`in t&&`pointTwoZ`in t)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw TypeError(`Key names do not match`)}else throw TypeError(`Invalid Arguments: Try again`)},Array:function(e){if(!h(e))throw TypeError(`Incorrect array format entered for pairwise distance calculation`);return y(e)}});function l(e){return typeof e==`number`||x(e)}function u(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])}function d(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])&&l(e[2])}function f(e){return Array.isArray(e)||(e=m(e)),e.every(l)}function p(e){return e.constructor!==Array&&(e=m(e)),l(e[0])&&l(e[1])&&l(e[2])&&l(e[3])&&l(e[4])&&l(e[5])}function m(e){for(var t=Object.keys(e),n=[],r=0;r<t.length;r++)n.push(e[t[r]]);return n}function h(e){if(e[0].length===2&&l(e[0][0])&&l(e[0][1])){if(e.some(e=>e.length!==2||!l(e[0])||!l(e[1])))return!1}else if(e[0].length===3&&l(e[0][0])&&l(e[0][1])&&l(e[0][2])){if(e.some(e=>e.length!==3||!l(e[0])||!l(e[1])||!l(e[2])))return!1}else return!1;return!0}function g(e,t,r,o,l){return a(c(n(n(i(r,e),i(o,t)),l)),s(n(i(r,r),i(o,o))))}function _(e,t,o,c,l,u,d,f,p){var m=[r(i(r(l,t),p),i(r(u,o),f)),r(i(r(u,o),d),i(r(c,e),p)),r(i(r(c,e),f),i(r(l,t),d))];m=s(n(n(i(m[0],m[0]),i(m[1],m[1])),i(m[2],m[2])));var h=s(n(n(i(d,d),i(f,f)),i(p,p)));return a(m,h)}function v(e,t){for(var a=e.length,o=0,c=0,l=0;l<a;l++)c=r(e[l],t[l]),o=n(i(c,c),o);return s(o)}function y(e){for(var t=[],n=[],r=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)e[0].length===2?(n=[e[i][0],e[i][1]],r=[e[a][0],e[a][1]]):e[0].length===3&&(n=[e[i][0],e[i][1],e[i][2]],r=[e[a][0],e[a][1],e[a][2]]),t.push(v(n,r));return t}}),v_=W(`intersect`,[`typed`,`config`,`abs`,`add`,`addScalar`,`matrix`,`multiply`,`multiplyScalar`,`divideScalar`,`subtract`,`smaller`,`equalScalar`,`flatten`,`isZero`,`isNumeric`],e=>{var{typed:t,config:n,abs:r,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:c,divideScalar:l,subtract:u,smaller:d,equalScalar:f,flatten:p,isZero:m,isNumeric:h}=e;return t(`intersect`,{"Array, Array, Array":g,"Array, Array, Array, Array":_,"Matrix, Matrix, Matrix":function(e,t,n){var r=g(e.valueOf(),t.valueOf(),n.valueOf());return r===null?null:o(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){var i=_(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return i===null?null:o(i)}});function g(e,t,n){if(e=v(e),t=v(t),n=v(n),!b(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!b(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);if(!x(n))throw TypeError(`Array with 4 numbers expected as third argument`);return T(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function _(e,t,n,r){if(e=v(e),t=v(t),n=v(n),r=v(r),e.length===2){if(!y(e))throw TypeError(`Array with 2 numbers or BigNumbers expected for first argument`);if(!y(t))throw TypeError(`Array with 2 numbers or BigNumbers expected for second argument`);if(!y(n))throw TypeError(`Array with 2 numbers or BigNumbers expected for third argument`);if(!y(r))throw TypeError(`Array with 2 numbers or BigNumbers expected for fourth argument`);return S(e,t,n,r)}else if(e.length===3){if(!b(e))throw TypeError(`Array with 3 numbers or BigNumbers expected for first argument`);if(!b(t))throw TypeError(`Array with 3 numbers or BigNumbers expected for second argument`);if(!b(n))throw TypeError(`Array with 3 numbers or BigNumbers expected for third argument`);if(!b(r))throw TypeError(`Array with 3 numbers or BigNumbers expected for fourth argument`);return w(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],r[0],r[1],r[2])}else throw TypeError(`Arrays with two or thee dimensional points expected`)}function v(e){return e.length===1?e[0]:e.length>1&&Array.isArray(e[0])&&e.every(e=>Array.isArray(e)&&e.length===1)?p(e):e}function y(e){return e.length===2&&h(e[0])&&h(e[1])}function b(e){return e.length===3&&h(e[0])&&h(e[1])&&h(e[2])}function x(e){return e.length===4&&h(e[0])&&h(e[1])&&h(e[2])&&h(e[3])}function S(e,t,o,f){var p=e,h=o,g=u(p,t),_=u(h,f),v=u(c(g[0],_[1]),c(_[0],g[1]));if(m(v)||d(r(v),n.relTol))return null;var y=c(_[0],p[1]),b=c(_[1],p[0]),x=c(_[0],h[1]),S=c(_[1],h[0]);return i(s(g,l(a(u(u(y,b),x),S),v)),p)}function C(e,t,n,r,i,o,s,l,d,f,p,m){var h=c(u(e,t),u(n,r)),g=c(u(i,o),u(s,l)),_=c(u(d,f),u(p,m));return a(a(h,g),_)}function w(e,t,n,r,i,o,s,d,p,h,g,_){var v=C(e,s,h,s,t,d,g,d,n,p,_,p),y=C(h,s,r,e,g,d,i,t,_,p,o,n),b=C(e,s,r,e,t,d,i,t,n,p,o,n),x=C(h,s,h,s,g,d,g,d,_,p,_,p),S=C(r,e,r,e,i,t,i,t,o,n,o,n),w=u(c(v,y),c(b,x)),T=u(c(S,x),c(y,y));if(m(T))return null;
54var E=l(w,T),D=l(a(v,c(E,y)),x),O=a(e,c(E,u(r,e))),k=a(t,c(E,u(i,t))),A=a(n,c(E,u(o,n))),j=a(s,c(D,u(h,s))),M=a(d,c(D,u(g,d))),N=a(p,c(D,u(_,p)));return f(O,j)&&f(k,M)&&f(A,N)?[O,k,A]:null}function T(e,t,n,r,i,o,s,d,f,p){var m=c(e,s),h=c(r,s),g=c(t,d),_=c(i,d),v=c(n,f),y=c(o,f),b=l(u(u(u(p,m),g),v),u(u(u(a(a(h,_),y),m),g),v));return[a(e,c(b,u(r,e))),a(t,c(b,u(i,t))),a(n,c(b,u(o,n)))]}}),y_=`sum`,b_=W(y_,[`typed`,`config`,`add`,`numeric`],e=>{var{typed:t,config:n,add:r,numeric:i}=e;return t(y_,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(e){if(Ji(e))throw TypeError(`Scalar values expected in function sum`);return a(e)}});function a(e){var t;return Yi(e,function(e){try{t=t===void 0?e:r(t,e)}catch(t){throw pd(t,`sum`,e)}}),t===void 0&&(t=i(0,n.number)),typeof t==`string`&&(t=i(t,He(t,n))),t}function o(e,t){try{return Zi(e,t,r)}catch(e){throw pd(e,`sum`)}}}),x_=`cumsum`,S_=W(x_,[`typed`,`add`,`unaryPlus`],e=>{var{typed:t,add:n,unaryPlus:r}=e;return t(x_,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,t){return e.create(o(e.valueOf(),t),e.datatype())},"...":function(e){if(Ji(e))throw TypeError(`All values expected to be scalar in function cumsum`);return i(e)}});function i(e){try{return a(e)}catch(e){throw pd(e,x_)}}function a(e){if(e.length===0)return[];for(var t=[r(e[0])],i=1;i<e.length;++i)t.push(n(t[i-1],e[i]));return t}function o(e,t){var n=ri(e);if(t<0||t>=n.length)throw new ni(t,n.length);try{return s(e,t)}catch(e){throw pd(e,x_)}}function s(e,t){var n,r,i;if(t<=0){var o=e[0][0];if(Array.isArray(o)){for(i=qi(e),r=[],n=0;n<i.length;n++)r[n]=s(i[n],t-1);return r}else return a(e)}else{for(r=[],n=0;n<e.length;n++)r[n]=s(e[n],t-1);return r}}}),C_=`mean`,w_=W(C_,[`typed`,`add`,`divide`],e=>{var{typed:t,add:n,divide:r}=e;return t(C_,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(e){if(Ji(e))throw TypeError(`Scalar values expected in function mean`);return a(e)}});function i(e,t){try{return r(Zi(e,t,n),(Array.isArray(e)?ri(e):e.size())[t])}catch(e){throw pd(e,`mean`)}}function a(e){var t,i=0;if(Yi(e,function(e){try{t=t===void 0?e:n(t,e),i++}catch(t){throw pd(t,`mean`,e)}}),i===0)throw Error(`Cannot calculate the mean of an empty array`);return r(t,i)}}),T_=`median`,E_=W(T_,[`typed`,`add`,`divide`,`compare`,`partitionSelect`],e=>{var{typed:t,add:n,divide:r,compare:i,partitionSelect:a}=e;function o(e){try{e=yi(e.valueOf());var t=e.length;if(t===0)throw Error(`Cannot calculate median of an empty array`);if(t%2==0){for(var n=t/2-1,r=a(e,n+1),o=e[n],l=0;l<n;++l)i(e[l],o)>0&&(o=e[l]);return c(o,r)}else return s(a(e,(t-1)/2))}catch(e){throw pd(e,`median`)}}var s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),c=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(T_,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw Error(`median(A, dim) is not yet supported`)},"...":function(e){if(Ji(e))throw TypeError(`Scalar values expected in function median`);return o(e)}})}),D_=`mad`,O_=W(D_,[`typed`,`abs`,`map`,`median`,`subtract`],e=>{var{typed:t,abs:n,map:r,median:i,subtract:a}=e;return t(D_,{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(e=yi(e.valueOf()),e.length===0)throw Error(`Cannot calculate median absolute deviation (mad) of an empty array`);try{var t=i(e);return i(r(e,function(e){return n(a(e,t))}))}catch(e){throw e instanceof TypeError&&e.message.includes(`median`)?TypeError(e.message.replace(`median`,`mad`)):pd(e,`mad`)}}}),k_=`unbiased`,A_=`variance`,j_=W(A_,[`typed`,`add`,`subtract`,`multiply`,`divide`,`mapSlices`,`isNaN`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s}=e;return t(A_,{"Array | Matrix":function(e){return c(e,k_)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,t){return l(e,t,k_)},"Array | Matrix, number | BigNumber, string":l,"...":function(e){return c(e,k_)}});function c(e,t){var o,c=0;if(e.length===0)throw SyntaxError(`Function variance requires one or more parameters (0 provided)`);if(Yi(e,function(e){try{o=o===void 0?e:n(o,e),c++}catch(t){throw pd(t,`variance`,e)}}),c===0)throw Error(`Cannot calculate variance of an empty array`);var l=a(o,c);if(o=void 0,Yi(e,function(e){var t=r(e,l);o=o===void 0?i(t,t):n(o,i(t,t))}),s(o))return o;switch(t){case`uncorrected`:return a(o,c);case`biased`:return a(o,c+1);case`unbiased`:var u=x(o)?o.mul(0):0;return c===1?u:a(o,c-1);
54default:throw Error(`Unknown normalization "`+t+`". Choose "unbiased" (default), "uncorrected", or "biased".`)}}function l(e,t,n){try{if(e.length===0)throw SyntaxError(`Function variance requires one or more parameters (0 provided)`);return o(e,t,e=>c(e,n))}catch(e){throw pd(e,`variance`)}}}),M_=`quantileSeq`,N_=W(M_,[`typed`,`?bignumber`,`add`,`subtract`,`divide`,`multiply`,`partitionSelect`,`compare`,`isInteger`,`smaller`,`smallerEq`,`larger`,`mapSlices`],e=>{var{typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p}=e;return t(M_,{"Array | Matrix, number | BigNumber":(e,t)=>h(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,n)=>m(e,t,!1,n,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>m(e,t,n,r,h),"Array | Matrix, Array | Matrix":(e,t)=>g(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,n)=>m(e,t,!1,n,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>m(e,t,n,r,g)});function m(e,t,n,r,i){return p(e,r,e=>i(e,t,n))}function h(e,t,i){var o,s=e.valueOf();if(u(t,0))throw Error(`N/prob must be non-negative`);if(d(t,1))return b(t)?_(s,t,i):n(_(s,t,i));if(f(t,1)){if(!l(t))throw Error(`N must be a positive integer`);if(f(t,4294967295))throw Error(`N must be less than or equal to 2^32-1, as that is the maximum length of an Array`);var c=r(t,1);o=[];for(var p=0;u(p,t);p++){var m=a(p+1,c);o.push(_(s,m,i))}return b(t)?o:n(o)}}function g(e,t,n){for(var r=e.valueOf(),i=t.valueOf(),a=[],o=0;o<i.length;++o)a.push(_(r,i[o],n));return a}function _(e,t,n){var a=yi(e),u=a.length;if(u===0)throw Error(`Cannot calculate quantile of an empty sequence`);var d=b(t)?t*(u-1):t.times(u-1),f=b(t)?Math.floor(d):d.floor().toNumber(),p=b(t)?d%1:d.minus(f);if(l(d))return n?a[d]:s(a,b(t)?d:d.valueOf());var m,h;if(n)m=a[f],h=a[f+1];else{h=s(a,f+1),m=a[f];for(var g=0;g<f;++g)c(a[g],m)>0&&(m=a[g])}return r(o(m,i(1,p)),o(h,p))}}),P_=`std`,F_=W(P_,[`typed`,`map`,`sqrt`,`variance`],e=>{var{typed:t,map:n,sqrt:r,variance:i}=e;return t(P_,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,t){if(e.length===0)throw SyntaxError(`Function std requires one or more parameters (0 provided)`);try{var a=i.apply(null,arguments);return k(a)?n(a,r):r(a)}catch(e){throw e instanceof TypeError&&e.message.includes(` variance`)?TypeError(e.message.replace(` variance`,` std`)):e}}}),I_=`corr`,L_=W(I_,[`typed`,`matrix`,`mean`,`sqrt`,`sum`,`add`,`subtract`,`multiply`,`pow`,`divide`],e=>{var{typed:t,matrix:n,sqrt:r,sum:i,add:a,subtract:o,multiply:s,pow:c,divide:l}=e;return t(I_,{"Array, Array":function(e,t){return u(e,t)},"Matrix, Matrix":function(e,t){var r=u(e.toArray(),t.toArray());return Array.isArray(r)?n(r):r}});function u(e,t){var n=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same length.`);for(var r=0;r<e.length;r++){if(e[r].length!==t[r].length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same number of elements.`);n.push(d(e[r],t[r]))}return n}else{if(e.length!==t.length)throw SyntaxError(`Dimension mismatch. Array A and B must have the same number of elements.`);return d(e,t)}}function d(e,t){var n=e.length,u=i(e),d=i(t),f=e.reduce((e,n,r)=>a(e,s(n,t[r])),0),p=i(e.map(e=>c(e,2))),m=i(t.map(e=>c(e,2)));return l(o(s(n,f),s(u,d)),r(s(o(s(n,p),c(u,2)),o(s(n,m),c(d,2)))))}}),R_=`bernoulli`,z_=W(R_,[`typed`,`config`,`isInteger`,`number`,`?BigNumber`,`?Fraction`],e=>{var{typed:t,config:n,number:r,BigNumber:i,Fraction:a}=e,o=[void 0],s=[void 0],c=[void 0],l=50;return t(R_,{number:e=>B_(e,e=>e,o,(e,t)=>e+t,(e,t)=>e*t,(e,t)=>e/t),"bigint | Fraction":e=>B_(r(e),e=>new a(e),s,(e,t)=>e.add(t),(e,t)=>e.mul(t),(e,t)=>e.div(t)),BigNumber:e=>(n.precision!==l&&(c=[void 0],l=n.precision),B_(r(e),e=>new i(e),c,(e,t)=>e.add(t),(e,t)=>e.mul(t),(e,t)=>e.div(t)))})});function B_(e,t,n,r,i,a){if(e<0||!G(e))throw RangeError(`Bernoulli index must be nonnegative integer`);if(e===0)return t(1);if(e===1)return a(t(-1),t(2));if(e%2==1)return t(0);var o=t(1);n.length===1&&n.push([a(o,t(-3)),a(o,t(-2)),a(o,t(6))]);for(var s=e/2,c=t(0),l=t(2);n.length<=s;){for(var u=n.length,d=Math.floor((u+1)/2),f=c,p=1;p<d;++p)f=r(f,i(n[p][0],n[u-p][0]));f=i(f,l),u%2==0&&(f=r(f,i(n[d][0],n[d][0]))),f=a(f,t(-(2*u+1)));var m=a(i(n[u-1][1],t(-u*(2*u-1))),l);n.push([f,m,i(m,f)])}return n[s][2]}var V_=`combinations`,H_=W(V_,[`typed`],e=>{var{typed:t}=e;return t(V_,{"number, number":Ba,"BigNumber, BigNumber":function(e,t){var n=e.constructor,r,i,a=e.minus(t),o=new n(1);if(!U_(e)||!U_(t))throw TypeError(`Positive integer value expected in function combinations`);if(t.gt(e))throw TypeError(`k must be less than n in function combinations`);if(r=o,t.lt(a))for(i=o;i.lte(a);
54i=i.plus(o))r=r.times(t.plus(i)).dividedBy(i);else for(i=o;i.lte(t);i=i.plus(o))r=r.times(a.plus(i)).dividedBy(i);return r}})});function U_(e){return e.isInteger()&&e.gte(0)}var W_=`combinationsWithRep`,G_=W(W_,[`typed`],e=>{var{typed:t}=e;return t(W_,{"number, number":function(e,t){if(!G(e)||e<0||!G(t)||t<0)throw TypeError(`Positive integer value expected in function combinationsWithRep`);if(e<1)throw TypeError(`k must be less than or equal to n + k - 1`);return t<e-1?za(e,e+t-1)/za(1,t):za(t+1,e+t-1)/za(1,e-1)},"BigNumber, BigNumber":function(e,t){var n=e.constructor,r,i,a=new n(1),o=e.minus(a);if(!K_(e)||!K_(t))throw TypeError(`Positive integer value expected in function combinationsWithRep`);if(e.lt(a))throw TypeError(`k must be less than or equal to n + k - 1 in function combinationsWithRep`);if(r=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))r=r.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))r=r.times(o.plus(i)).dividedBy(i);return r}})});function K_(e){return e.isInteger()&&e.gte(0)}var q_=`gamma`,J_=W(q_,[`typed`,`config`,`multiplyScalar`,`pow`,`BigNumber`,`Complex`],e=>{var{typed:t,config:n,multiplyScalar:r,pow:i,BigNumber:a,Complex:o}=e;function s(e){if(e.im===0)return Za(e.re);if(e.re<.5){var t=new o(1-e.re,-e.im),n=new o(Math.PI*e.re,Math.PI*e.im);return new o(Math.PI).div(n.sin()).div(s(t))}e=new o(e.re-1,e.im);for(var r=new o($a[0],0),i=1;i<$a.length;++i){var a=new o($a[i],0);r=r.add(a.div(e.add(i)))}var c=new o(e.re+Qa+.5,e.im),l=Math.sqrt(2*Math.PI),u=c.pow(e.add(.5)),d=c.neg().exp();return r.mul(l).mul(u).mul(d)}return t(q_,{number:Za,Complex:s,BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):c(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw Error(`Integer BigNumber expected`)}});function c(e){if(e<8)return new a([1,1,2,6,24,120,720,5040][e]);var t=n.precision+(Math.log(e.toNumber())|0),r=a.clone({precision:t});if(e%2==1)return e.times(c(new a(e-1)));for(var i=e,o=new r(e),s=e.toNumber();i>2;)i-=2,s+=i,o=o.times(s);return new a(o.toPrecision(a.precision))}}),Y_=`lgamma`,X_=W(Y_,[`Complex`,`typed`],e=>{var{Complex:t,typed:n}=e,r=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(Y_,{number:no,Complex:o,BigNumber:function(){throw Error(`mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber`)}});function o(e){var n=6.283185307179586,a=1.1447298858494002,l=.1;if(e.isNaN())return new t(NaN,NaN);if(e.im===0)return new t(no(e.re),0);if(e.re>=r||Math.abs(e.im)>=i)return s(e);if(e.re<=l){var u=pt(n,e.im)*Math.floor(.5*e.re+.25),d=e.mul(Math.PI).sin().log(),f=o(new t(1-e.re,-e.im));return new t(a,u).sub(d).sub(f)}else if(e.im>=0)return c(e);else return c(e.conjugate()).conjugate()}function s(e){for(var n=e.sub(.5).mul(e.log()).sub(e).add(eo),r=new t(1,0).div(e),i=r.div(e),o=a[0],s=a[1],c=2*i.re,l=i.re*i.re+i.im*i.im,u=2;u<8;u++){var d=s;s=-l*o+a[u],o=c*o+d}var f=r.mul(i.mul(o).add(s));return n.add(f)}function c(e){var n=0,i=0,a=e;for(e=e.add(1);e.re<=r;){a=a.mul(e);var o=+(a.im<0);o!==0&&i===0&&n++,i=o,e=e.add(1)}return s(e).sub(a.log()).sub(new t(0,n*2*Math.PI*1))}}),Z_=`factorial`,Q_=W(Z_,[`typed`,`gamma`],e=>{var{typed:t,gamma:n}=e;return t(Z_,{number:function(e){if(e<0)throw Error(`Value must be non-negative`);return n(e+1)},BigNumber:function(e){if(e.isNegative())throw Error(`Value must be non-negative`);return n(e.plus(1))},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),$_=`kldivergence`,ev=W($_,[`typed`,`matrix`,`divide`,`sum`,`multiply`,`map`,`dotDivide`,`log`,`isNumeric`],e=>{var{typed:t,matrix:n,divide:r,sum:i,multiply:a,map:o,dotDivide:s,log:c,isNumeric:l}=e;return t($_,{"Array, Array":function(e,t){return u(n(e),n(t))},"Matrix, Array":function(e,t){return u(e,n(t))},"Array, Matrix":function(e,t){return u(n(e),t)},"Matrix, Matrix":function(e,t){return u(e,t)}});function u(e,t){var n=t.size().length,u=e.size().length;if(n>1)throw Error(`first object must be one dimensional`);if(u>1)throw Error(`second object must be one dimensional`);if(n!==u)throw Error(`Length of two vectors must be equal`);if(i(e)===0)throw Error(`Sum of elements in first object must be non zero`);if(i(t)===0)throw Error(`Sum of elements in second object must be non zero`);var d=r(e,i(e)),f=i(a(d,o(s(d,r(t,i(t))),e=>c(e))));return l(f)?f:NaN}}),tv=`multinomial`,nv=W(tv,[`typed`,`add`,`divide`,`multiply`,`factorial`,`isInteger`,`isPositive`],e=>{var{typed:t,add:n,divide:r,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(tv,{"Array | Matrix":function(e){var t=0,c=1;return Yi(e,function(e){if(!o(e)||!s(e))throw TypeError(`Positive integer value expected in function multinomial`);t=n(t,e),c=i(c,a(e))}),r(a(t),c)}})}),rv=`permutations`,iv=W(rv,[`typed`,`factorial`],e=>{var{typed:t,factorial:n}=e;return t(rv,{"number | BigNumber":n,"number, number":function(e,t){if(!G(e)||e<0||!G(t)||t<0)throw TypeError(`Positive integer value expected in function permutations`);if(t>e)throw TypeError(`second argument k must be less than or equal to first argument n`);return za(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var n,r;if(!av(e)||!av(t))throw TypeError(`Positive integer value expected in function permutations`);if(t.gt(e))throw TypeError(`second argument k must be less than or equal to first argument n`);
54for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})});function av(e){return e.isInteger()&&e.gte(0)}var ov=n(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=o();t.next=function(){var e=2091639*t.s0+t.c*23283064365386963e-26;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=e|0)},t.c=1,t.s0=n(` `),t.s1=n(` `),t.s2=n(` `),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function i(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function a(e,t){var n=new r(e),a=t&&t.state,o=n.next;return o.int32=function(){return n.next()*4294967296|0},o.double=function(){return o()+(o()*2097152|0)*11102230246251565e-32},o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}function o(){var e=4022871197;return function(t){t=String(t);for(var n=0;n<t.length;n++){e+=t.charCodeAt(n);var r=.02519603282416938*e;e=r>>>0,r-=e,r*=e,e=r>>>0,r-=e,e+=r*4294967296}return(e>>>0)*23283064365386963e-26}}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.alea=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),sv=n(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(e|0)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=n.charCodeAt(r)|0,t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xor128=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),cv=n(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^(e^e<<1))|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(e|0)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=n.charCodeAt(r)|0,r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function i(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xorwow=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),lv=n(((e,t)=>{(function(e,t,n){function r(e){var t=this;t.next=function(){var e=t.x,n=t.i,r=e[n],i;return r^=r>>>7,i=r^r<<24,r=e[n+1&7],i^=r^r>>>10,r=e[n+3&7],i^=r^r>>>3,r=e[n+4&7],i^=r^r<<7,r=e[n+7&7],r^=r<<13,i^=r^r<<9,e[n]=i,t.i=n+1&7,i};function n(e,t){var n,r=[];if(t===(t|0))r[0]=t;else for(t=``+t,n=0;n<t.length;++n)r[n&7]=r[n&7]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&r[n]===0;++n);for(n==8?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}n(t,e)}function i(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){e??=+new Date;var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(a.x&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xorshift7=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),uv=n(((e,t)=>{(function(e,t,n){function r(e){var t=this;t.next=function(){var e=t.w,n=t.X,r=t.i,i,a;
54return t.w=e=e+1640531527|0,a=n[r+34&127],i=n[r=r+1&127],a^=a<<13,i^=i<<17,a^=a>>>15,i^=i>>>12,a=n[r]=a^i,t.i=r,a+(e^e>>>16)|0};function n(e,t){var n,r,i,a,o,s=[],c=128;for(t===(t|0)?(r=t,t=null):(t+=`\0`,r=0,c=Math.max(c,t.length)),i=0,a=-32;a<c;++a)t&&(r^=t.charCodeAt((a+32)%t.length)),a===0&&(o=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,a>=0&&(o=o+1640531527|0,n=s[a&127]^=r+o,i=n==0?i+1:0);for(i>=128&&(s[(t&&t.length||0)&127]=-1),i=127,a=512;a>0;--a)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;e.w=o,e.X=s,e.i=i}n(t,e)}function i(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){e??=+new Date;var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(a.X&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.xor4096=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),dv=n(((e,t)=>{(function(e,t,n){function r(e){var t=this,n=``;t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=e|0):n+=e;for(var r=0;r<n.length+20;r++)t.b^=n.charCodeAt(r)|0,t.next()}function i(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function a(e,t){var n=new r(e),a=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21);while(e===0);return e},o.int32=n.next,o.quick=o,a&&(typeof a==`object`&&i(a,n),o.state=function(){return i(n,{})}),o}t&&t.exports?t.exports=a:n&&n.amd?n(function(){return a}):this.tychei=a})(e,typeof t==`object`&&t,typeof define==`function`&&define)})),fv=n(((e,t)=>{t.exports={}})),pv=n(((e,t)=>{(function(e,n,r){var i=256,a=6,o=52,s=`random`,c=r.pow(i,a),l=r.pow(2,o),u=l*2,d=i-1,f;function p(e,t,o){var d=[];t=t==1?{entropy:!0}:t||{};var f=_(g(t.entropy?[e,y(n)]:e??v(),3),d),p=new m(d),b=function(){for(var e=p.g(a),t=c,n=0;e<l;)e=(e+n)*i,t*=i,n=p.g(1);for(;e>=u;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return p.g(4)|0},b.quick=function(){return p.g(4)/4294967296},b.double=b,_(y(p.S),n),(t.pass||o||function(e,t,n,i){return i&&(i.S&&h(i,p),e.state=function(){return h(p,{})}),n?(r[s]=e,t):e})(b,f,`global`in t?t.global:this==r,t.state)}function m(e){var t,n=e.length,r=this,a=0,o=r.i=r.j=0,s=r.S=[];for(n||(e=[n++]);a<i;)s[a]=a++;for(a=0;a<i;a++)s[a]=s[o=d&o+e[a%n]+(t=s[a])],s[o]=t;(r.g=function(e){for(var t,n=0,a=r.i,o=r.j,s=r.S;e--;)t=s[a=d&a+1],n=n*i+s[d&(s[a]=s[o=d&o+t])+(s[o]=t)];return r.i=a,r.j=o,n})(i)}function h(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n=[],r=typeof e,i;if(t&&r==`object`)for(i in e)try{n.push(g(e[i],t-1))}catch{}return n.length?n:r==`string`?e:e+`\0`}function _(e,t){for(var n=e+``,r,i=0;i<n.length;)t[d&i]=d&(r^=t[d&i]*19)+n.charCodeAt(i++);return y(t)}function v(){try{var t;return f&&(t=f.randomBytes)?t=t(i):(t=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(t)),y(t)}catch{var r=e.navigator,a=r&&r.plugins;return[+new Date,e,a,e.screen,y(n)]}}function y(e){return String.fromCharCode.apply(0,e)}if(_(r.random(),n),typeof t==`object`&&t.exports){t.exports=p;try{f=fv()}catch{}}else typeof define==`function`&&define.amd?define(function(){return p}):r[`seed`+s]=p})(typeof self<`u`?self:e,[],Math)})),mv=e(n(((e,t)=>{var n=ov(),r=sv(),i=cv(),a=lv(),o=uv(),s=dv(),c=pv();c.alea=n,c.xor128=r,c.xorwow=i,c.xorshift7=a,c.xor4096=o,c.tychei=s,t.exports=c}))(),1),hv=(0,mv.default)(Date.now());function gv(e){var t;function n(e){t=e===null?hv:(0,mv.default)(String(e))}n(e);function r(){return t()}return r}var _v=`pickRandom`,vv=W(_v,[`typed`,`config`,`?on`],e=>{var{typed:t,config:n,on:r}=e,i=gv(n.randomSeed);return r&&r(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(i=gv(e.randomSeed))}),t(_v,{"Array | Matrix":function(e){return a(e,{})},"Array | Matrix, Object":function(e,t){return a(e,t)},"Array | Matrix, number":function(e,t){return a(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return a(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return a(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return a(e,{number:t,weights:n})}});function a(e,t){var{number:n,weights:r,elementWise:a=!0}=t,o=n===void 0;o&&(n=1);var s=O(e)?e.create:O(r)?r.create:null;e=e.valueOf(),r&&=r.valueOf(),a===!0&&(e=yi(e),r=yi(r));var c=0;if(r!==void 0){if(r.length!==e.length)throw Error(`Weights must have the same length as possibles`);for(var l=0,u=r.length;l<u;l++){if(!b(r[l])||r[l]<0)throw Error(`Weights must be an array of positive numbers`);c+=r[l]}}for(var d=e.length,f=[],p;f.length<n;){if(r===void 0)p=e[Math.floor(i()*d)];else for(var m=i()*c,h=0,g=e.length;h<g;h++)if(m-=r[h],m<0){p=e[h];break}f.push(p)}return o?f[0]:s?s(f):f}});function yv(e,t){var n=[];if(e=e.slice(0),e.length>1)for(var r=0,i=e.shift();r<i;r++)n.push(yv(e,t));else for(var a=0,o=e.shift();a<o;a++)n.push(t());return n}var bv=`random`,xv=W(bv,[`typed`,`config`,`?on`],e=>{var{typed:t,config:n,on:r}=e,i=gv(n.randomSeed);return r&&r(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(i=gv(e.randomSeed))}),t(bv,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,t)=>o(e,t),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,n)=>a(e,t,n)});function a(e,t,n){var r=yv(e.valueOf(),()=>o(t,n));return O(e)?e.create(r,`number`):r}function o(e,t){return e+i()*(t-e)}}),Sv=`randomInt`,Cv=W(Sv,[`typed`,`config`,`log2`,`?on`],e=>{var{typed:t,config:n,log2:r,on:i}=e,a=gv(n.randomSeed);return i&&i(`config`,function(e,t){e.randomSeed!==t.randomSeed&&(a=gv(e.randomSeed))}),t(Sv,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),bigint:e=>c(0n,e),"bigint, bigint":c,"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,n)=>o(e,t,n)});function o(e,t,n){var r=yv(e.valueOf(),()=>s(t,n));return O(e)?e.create(r,`number`):r}function s(e,t){return Math.floor(e+a()*(t-e))}function c(e,t){var n=2n**30n,i=t-e;if(i<=n)return e+BigInt(s(0,Number(i)));for(var o=r(i),c=i;c>=i;){c=0n;for(var l=0;l<o;++l)c=2n*c+(a()<.5?0n:1n)}return e+c}}),wv=`stirlingS2`,Tv=W(wv,[`typed`,`addScalar`,`subtractScalar`,`multiplyScalar`,`divideScalar`,`pow`,`factorial`,`combinations`,`isNegative`,`isInteger`,`number`,`?bignumber`,`larger`],e=>{var{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:c,isNegative:l,isInteger:u,number:d,bignumber:f,larger:p}=e,m=[],h=[];return t(wv,{"number | BigNumber, number | BigNumber":function(e,t){if(!u(e)||l(e)||!u(t)||l(t))throw TypeError(`Non-negative integer value expected in function stirlingS2`);if(p(t,e))throw TypeError(`k must be less than or equal to n in function stirlingS2`);var r=!(b(e)&&b(t)),a=r?h:m,o=r?f:d,s=d(e),c=d(t);if(a[s]&&a[s].length>c)return a[s][c];for(var g=0;g<=s;++g)if(a[g]||(a[g]=[o(+(g===0))]),g!==0)for(var _=a[g],v=a[g-1],y=_.length;y<=g&&y<=c;++y)y===g?_[y]=1:_[y]=n(i(o(y),v[y]),v[y-1]);return a[s][c]}})}),Ev=`bellNumbers`,Dv=W(Ev,[`typed`,`addScalar`,`isNegative`,`isInteger`,`stirlingS2`],e=>{var{typed:t,addScalar:n,isNegative:r,isInteger:i,stirlingS2:a}=e;return t(Ev,{"number | BigNumber":function(e){if(!i(e)||r(e))throw TypeError(`Non-negative integer value expected in function bellNumbers`);for(var t=0,o=0;o<=e;o++)t=n(t,a(e,o));return t}})}),Ov=`catalan`,kv=W(Ov,[`typed`,`addScalar`,`divideScalar`,`multiplyScalar`,`combinations`,`isNegative`,`isInteger`],e=>
54{var{typed:t,addScalar:n,divideScalar:r,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(Ov,{"number | BigNumber":function(e){if(!s(e)||o(e))throw TypeError(`Non-negative integer value expected in function catalan`);return r(a(i(e,2),e),n(e,1))}})}),Av=`composition`,jv=W(Av,[`typed`,`addScalar`,`combinations`,`isNegative`,`isPositive`,`isInteger`,`larger`],e=>{var{typed:t,addScalar:n,combinations:r,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(Av,{"number | BigNumber, number | BigNumber":function(e,t){if(!o(e)||!i(e)||!o(t)||!i(t))throw TypeError(`Positive integer value expected in function composition`);if(s(t,e))throw TypeError(`k must be less than or equal to n in function composition`);return r(n(e,-1),n(t,-1))}})}),Mv=`leafCount`,Nv=W(Mv,[`parse`,`typed`],e=>{var{parse:t,typed:n}=e;function r(e){var t=0;return e.forEach(e=>{t+=r(e)}),t||1}return n(Mv,{Node:function(e){return r(e)}})});function Pv(e){return B(e)||_e(e)&&e.isUnary()&&B(e.args[0])}function Fv(e){return!!(B(e)||(pe(e)||_e(e))&&e.args.every(Fv)||ve(e)&&Fv(e.content))}function Iv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Iv(Object(n),!0).forEach(function(t){$u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rv=W(`simplifyUtil`,[`FunctionNode`,`OperatorNode`,`SymbolNode`],e=>{var{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e,i=!0,a=!1,o=`defaultF`,s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},c={divide:{total:a},log:{total:a}},l={subtract:{total:a},abs:{trivial:i},log:{total:i}};function u(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,r=o;if(typeof e==`string`?r=e:_e(e)?r=e.fn.toString():pe(e)?r=e.name:ve(e)&&(r=`paren`),H(n,r)){var i=n[r];if(H(i,t))return i[t];if(H(s,r))return s[r][t]}if(H(n,o)){var a=n[o];return H(a,t)?a[t]:s[o][t]}if(H(s,r)){var c=s[r];if(H(c,t))return c[t]}return s[o][t]}function d(e){return u(e,`commutative`,arguments.length>1&&arguments[1]!==void 0?arguments[1]:s)}function f(e){return u(e,`associative`,arguments.length>1&&arguments[1]!==void 0?arguments[1]:s)}function p(e,t){var n=Lv({},e);for(var r in t)H(e,r)?n[r]=Lv(Lv({},t[r]),e[r]):n[r]=t[r];return n}function m(e,t){if(!e.args||e.args.length===0)return e;e.args=h(e,t);for(var n=0;n<e.args.length;n++)m(e.args[n],t)}function h(e,t){var n,r=[],i=function(e){for(var t=0;t<e.args.length;t++){var a=e.args[t];_e(a)&&n===a.op?i(a):r.push(a)}};return f(e,t)?(n=e.op,i(e),r):e.args}function g(e,t){if(!(!e.args||e.args.length===0)){for(var n=v(e),r=e.args.length,i=0;i<r;i++)g(e.args[i],t);if(r>2&&f(e,t)){for(var a=e.args.pop();e.args.length>0;)a=n([e.args.pop(),a]);e.args=a.args}}}function _(e,t){if(!(!e.args||e.args.length===0)){for(var n=v(e),r=e.args.length,i=0;i<r;i++)_(e.args[i],t);if(r>2&&f(e,t)){for(var a=e.args.shift();e.args.length>0;)a=n([a,e.args.shift()]);e.args=a.args}}}function v(e){return _e(e)?function(t){try{return new n(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(n){return new t(new r(e.name),n)}}return{createMakeNodeFunction:v,hasProperty:u,isCommutative:d,isAssociative:f,mergeContext:p,flatten:m,allChildren:h,unflattenr:g,unflattenl:_,defaultContext:s,realContext:c,positiveContext:l}}),zv=W(`simplify`,[`typed`,`parse`,`equal`,`resolve`,`simplifyConstant`,`simplifyCore`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`,`replacer`],e=>{var{typed:t,parse:n,equal:r,resolve:i,simplifyConstant:a,simplifyCore:o,AccessorNode:s,ArrayNode:c,ConstantNode:l,FunctionNode:u,IndexNode:d,ObjectNode:f,OperatorNode:p,ParenthesisNode:m,SymbolNode:h,replacer:g}=e,{hasProperty:y,isCommutative:b,isAssociative:x,mergeContext:S,flatten:C,unflattenr:w,unflattenl:T,createMakeNodeFunction:E,defaultContext:D,realContext:O,positiveContext:k}=Rv({FunctionNode:u,OperatorNode:p,SymbolNode:h});t.addConversion({from:`Object`,to:`Map`,convert:v});var A=t(`simplify`,{Node:te,"Node, Map":(e,t)=>
54te(e,!1,t),"Node, Map, Object":(e,t,n)=>te(e,!1,t,n),"Node, Array":te,"Node, Array, Map":te,"Node, Array, Map, Object":te});t.removeConversion({from:`Object`,to:`Map`,convert:v}),A.defaultContext=D,A.realContext=O,A.positiveContext=k;function j(e){return e.transform(function(e){return ve(e)?j(e.content):e})}var M={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};A.rules=[o,{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}}},a,{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}}},a,{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 N(e,t){var r={};if(e.s){var i=e.s.split(`->`);if(i.length===2)r.l=i[0],r.r=i[1];else throw SyntaxError(`Could not parse rule: `+e.s)}else r.l=e.l,r.r=e.r;r.l=j(n(r.l)),r.r=j(n(r.r));for(var a of[`imposeContext`,`repeat`,`assuming`])a in e&&(r[a]=e[a]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),x(r.l,t)){var o=!b(r.l,t),s;o&&(s=ee());var c=E(r.l),l=ee();r.expanded={},r.expanded.l=c([r.l,l]),C(r.expanded.l,t),w(r.expanded.l,t),r.expanded.r=c([r.r,l]),o&&(r.expandedNC1={},r.expandedNC1.l=c([s,r.l]),r.expandedNC1.r=c([s,r.r]),r.expandedNC2={},r.expandedNC2.l=c([s,r.expanded.l]),r.expandedNC2.r=c([s,r.expanded.r]))}return r}function P(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=void 0,o=typeof i;switch(o){case`string`:i={s:i};case`object`:a=N(i,t);break;case`function`:a=i;break;default:throw TypeError(`Unsupported type of rule: `+o)}n.push(a)}return n}var F=0;function ee(){return new h(`_p`+F++)}function te(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_(),r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.consoleDebug;t=P(t||A.rules,r.context);var o=i(e,n);o=j(o);for(var s={},c=o.toString({parenthesis:`all`});!s[c];){s[c]=!0,F=0;var l=c;a&&console.log(`Working on: `,c);for(var u=0;u<t.length;u++){var d=``;if(typeof t[u]==`function`?(o=t[u](o,r),a&&(d=t[u].name)):(C(o,r.context),o=re(o,t[u],r.context),a&&(d=`${t[u].l.toString()} -> ${t[u].r.toString()}`)),a){var f=o.toString({parenthesis:`all`});f!==l&&(console.log(`Applying`,d,`produced`,f),l=f)}T(o,r.context)}c=o.toString({parenthesis:`all`})}return o}function ne(e,t,n){var r=e;if(e)for(var i=0;i<e.length;++i){var a=re(e[i],t,n);a!==e[i]&&(r===e&&(r=e.slice()),r[i]=a)}return r}function re(e,t,n){if(t.assuming){for(var r in t.assuming)for(var i in t.assuming[r])if(y(r,i,n)!==t.assuming[r][i])return e}var a=S(t.imposeContext,n),o=e;if(o instanceof p||o instanceof u){var l=ne(o.args,t,n);l!==o.args&&(o=o.clone(),o.args=l)}else if(o instanceof m){if(o.content){var h=re(o.content,t,n);h!==o.content&&(o=new m(h))}}else if(o instanceof c){var g=ne(o.items,t,n);g!==o.items&&(o=new c(g))}else if(o instanceof s){var _=o.object;o.object&&(_=re(o.object,t,n));var v=o.index;o.index&&(v=re(o.index,t,n)),(_!==o.object||v!==o.index)&&(o=new s(_,v))}else if(o instanceof d){var b=ne(o.dimensions,t,n);b!==o.dimensions&&(o=new d(b))}else if(o instanceof f){var x=!1,C={};for(var w in o.properties)C[w]=re(o.properties[w],t,n),C[w]!==o.properties[w]&&(x=!0);x&&(o=new f(C))}var T=t.r,E=L(t.l,o,a)[0];if(!E&&t.expanded&&(T=t.expanded.r,E=L(t.expanded.l,o,a)[0]),!E&&t.expandedNC1&&(T=t.expandedNC1.r,E=L(t.expandedNC1.l,o,a)[0],E||=(T=t.expandedNC2.r,L(t.expandedNC2.l,o,a)[0])),E){var D=o.implicit;o=T.clone(),D&&`implicit`in T&&(o.implicit=!0),o=o.transform(function(e){return e.isSymbolNode&&H(E.placeholders,e.name)?E.placeholders[e.name].clone():e})}return t.repeat&&o!==e&&(o=re(o,t,n)),o}function ie(e,t){var n=[],r,i,a=E(e);if(b(e,t))for(var o=0;o<e.args.length;o++)i=e.args.slice(0),i.splice(o,1),r=i.length===1?i[0]:a(i),n.push(a([e.args[o],r]));else for(var s=1;s<e.args.length;s++){var c=e.args[0];s>1&&(c=a(e.args.slice(0,s))),i=e.args.slice(s),r=i.length===1?i[0]:a(i),n.push(a([c,r]))}return n}function ae(e,t){var n={placeholders:{}};if(!e.placeholders&&!t.placeholders)return n;if(!e.placeholders)return t;if(!t.placeholders)return e;for(var r in e.placeholders)if(H(e.placeholders,r)&&(n.placeholders[r]=e.placeholders[r],H(t.placeholders,r)&&!se(e.placeholders[r],t.placeholders[r])))return null;for(var i in t.placeholders)H(t.placeholders,i)&&(n.placeholders[i]=t.placeholders[i]);return n}function I(e,t){var n=[];if(e.length===0||t.length===0)return n;for(var r,i=0;i<e.length;i++)for(var a=0;a<t.length;a++)r=ae(e[i],t[a]),r&&n.push(r);return n}function oe(e){if(e.length===0)return e;for(var t=e.reduce(I),n=[],r={},i=0;i<t.length;i++){var a=JSON.stringify(t[i],g);r[a]||(r[a]=!0,n.push(t[i]))}return n}function L(e,t,n,i){var a=[{placeholders:{}}];if(e instanceof p&&t instanceof p||e instanceof u&&t instanceof u){if(e instanceof p){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof u&&e.name!==t.name)return[];if(t.args.length===1&&e.args.length===1||!x(t,n)&&t.args.length===e.args.length||i){for(var o=[],s=0;s<e.args.length;s++){var c=L(e.args[s],t.args[s],n);if(c.length===0)break;o.push(c)}if(o.length!==e.args.length){if(!b(t,n)||e.args.length===1)return[];if(e.args.length>2)throw Error(`permuting >2 commutative non-associative rule arguments not yet implemented`);var d=L(e.args[0],t.args[1],n);if(d.length===0)return[];var f=L(e.args[1],t.args[0],n);if(f.length===0)return[];o=[d,f]}a=oe(o)}else if(t.args.length>=2&&e.args.length===2){for(var m=ie(t,n),g=[],_=0;_<m.length;_++){var v=L(e,m[_],n,!0);g=g.concat(v)}return g}else if(e.args.length>2)throw Error(`Unexpected non-binary associative function: `+e.toString());else return[]}
54else if(e instanceof h){if(e.name.length===0)throw Error(`Symbol in rule has 0 length...!?`);if(M[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>=`a`&&e.name[1]<=`z`?e.name.substring(0,2):e.name[0]){case`n`:case`_p`:a[0].placeholders[e.name]=t;break;case`c`:case`cl`:if(B(t))a[0].placeholders[e.name]=t;else return[];break;case`v`:if(!B(t))a[0].placeholders[e.name]=t;else return[];break;case`vl`:if(xe(t))a[0].placeholders[e.name]=t;else return[];break;case`cd`:if(Pv(t))a[0].placeholders[e.name]=t;else return[];break;case`vd`:if(!Pv(t))a[0].placeholders[e.name]=t;else return[];break;case`ce`:if(Fv(t))a[0].placeholders[e.name]=t;else return[];break;case`ve`:if(!Fv(t))a[0].placeholders[e.name]=t;else return[];break;default:throw Error(`Invalid symbol in rule: `+e.name)}}else if(e instanceof l){if(!r(e.value,t.value))return[]}else return[];return a}function se(e,t){if(e instanceof l&&t instanceof l){if(!r(e.value,t.value))return!1}else if(e instanceof h&&t instanceof h){if(e.name!==t.name)return!1}else if(e instanceof p&&t instanceof p||e instanceof u&&t instanceof u){if(e instanceof p){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof u&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(var n=0;n<e.args.length;n++)if(!se(e.args[n],t.args[n]))return!1}else return!1;return!0}return A}),Bv=W(`simplifyConstant`,[`typed`,`config`,`mathWithTransform`,`matrix`,`isBounded`,`?fraction`,`?bignumber`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`SymbolNode`],e=>{var{typed:t,config:n,mathWithTransform:r,matrix:i,isBounded:a,fraction:o,bignumber:s,AccessorNode:c,ArrayNode:l,ConstantNode:u,FunctionNode:d,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e,{isCommutative:g,isAssociative:_,allChildren:v,createMakeNodeFunction:y}=Rv({FunctionNode:d,OperatorNode:m,SymbolNode:h}),b=t(`simplifyConstant`,{Node:e=>T(N(e,{})),"Node, Object":function(e,t){return T(N(e,t))}});function x(e){return w(e)?e.valueOf():e instanceof Array?e.map(x):O(e)?i(x(e.valueOf())):e}function S(e,t,n){try{return r[e].apply(null,t)}catch{return t=t.map(x),D(r[e].apply(null,t),n)}}var C=t({Fraction:A,number:function(e){return e<0?k(new u(-e)):new u(e)},BigNumber:function(e){return e<0?k(new u(-e)):new u(e)},bigint:function(e){return e<0n?k(new u(-e)):new u(e)},Complex:function(e){throw Error(`Cannot convert Complex number to Node`)},string:function(e){return new u(e)},Matrix:function(e){return new l(e.valueOf().map(e=>C(e)))}});function T(e){return he(e)?e:C(e)}function E(e,t){if(t&&t.exactFractions!==!1&&a(e)&&o){var n=o(e),r=t&&typeof t.fractionsLimit==`number`?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.n<r&&n.d<r)return n}return e}var D=t({"string, Object":function(e,t){var r=He(e,n);return r===`BigNumber`?(s===void 0&&gu(),s(e)):r===`bigint`?BigInt(e):r===`Fraction`?(o===void 0&&_u(),o(e)):E(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return E(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return e.im===0?E(e.re,t):e},"Matrix, Object":function(e,t){return i(E(e.valueOf()))},"Array, Object":function(e,t){return e.map(E)}});function k(e){return new m(`-`,`unaryMinus`,[e])}function A(e){var t=e=>n.number===`BigNumber`&&s?s(e):Number(e),r=e.s*e.n,i=r<0n?new m(`-`,`unaryMinus`,[new u(-t(r))]):new u(t(r));return e.d===1n?i:new m(`/`,`divide`,[i,new u(t(e.d))])}function j(e,t,n){if(!me(t))return new c(T(e),T(t));if(R(e)||O(e)){for(var r=Array.from(t.dimensions);r.length>0;)if(B(r[0])&&typeof r[0].value!=`string`){var a=D(r.shift().value,n);R(e)?e=e.items[a-1]:(e=e.valueOf()[a-1],e instanceof Array&&(e=i(e)))}else if(r.length>1&&B(r[1])&&typeof r[1].value!=`string`){var o=D(r[1].value,n),s=[],d=R(e)?e.items:e.valueOf();for(var p of d)if(R(p))s.push(p.items[o-1]);else if(O(e))s.push(p[o-1]);else break;if(s.length===d.length)e=R(e)?new l(s):i(s),r.splice(1,1);else break}else break;return r.length===t.dimensions.length?new c(T(e),t):r.length>0?(t=new f(r),new c(T(e),t)):e}if(ge(e)&&t.dimensions.length===1&&B(t.dimensions[0])){var m=t.dimensions[0].value;return m in e.properties?e.properties[m]:new u}return new c(T(e),t)}function M(e,t,n,r){var i=t.shift(),a=t.reduce((t,i)=>{if(!he(i)){var a=t.pop();if(he(a))return[a,i];try{return t.push(S(e,[a,i],r)),t}catch{t.push(a)}}
54return t.push(T(t.pop())),[n([t.length===1?t[0]:n(t),T(i)])]},[i]);return a.length===1?a[0]:n([a[0],C(a[1])])}function N(e,t){switch(e.type){case`SymbolNode`:return e;case`ConstantNode`:switch(typeof e.value){case`number`:return D(e.value,t);case`bigint`:return D(e.value,t);case`string`:return e.value;default:if(!isNaN(e.value))return D(e.value,t)}return e;case`FunctionNode`:if(r[e.name]&&r[e.name].rawArgs)return e;if(![`add`,`multiply`].includes(e.name)){var n=e.args.map(e=>N(e,t));if(!n.some(he))try{return S(e.name,n,t)}catch{}if(e.name===`size`&&n.length===1&&R(n[0])){for(var a=[],o=n[0];R(o);)a.push(o.items.length),o=o.items[0];return i(a)}return new d(e.name,n.map(T))}case`OperatorNode`:var s=e.fn.toString(),c,u,m=y(e);if(_e(e)&&e.isUnary())c=[N(e.args[0],t)],u=he(c[0])?m(c):S(s,c,t);else if(_(e,t.context))if(c=v(e,t.context),c=c.map(e=>N(e,t)),g(s,t.context)){for(var h=[],x=[],C=0;C<c.length;C++)he(c[C])?x.push(c[C]):h.push(c[C]);h.length>1?(u=M(s,h,m,t),x.unshift(u),u=M(s,x,m,t)):u=M(s,c,m,t)}else u=M(s,c,m,t);else c=e.args.map(e=>N(e,t)),u=M(s,c,m,t);return u;case`ParenthesisNode`:return N(e.content,t);case`AccessorNode`:return j(N(e.object,t),N(e.index,t),t);case`ArrayNode`:var w=e.items.map(e=>N(e,t));return w.some(he)?new l(w.map(T)):i(w);case`IndexNode`:return new f(e.dimensions.map(e=>b(e,t)));case`ObjectNode`:var E={};for(var O in e.properties)E[O]=b(e.properties[O],t);return new p(E);default:throw Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return b}),Vv=`simplifyCore`,Hv=W(Vv,[`typed`,`parse`,`equal`,`isZero`,`add`,`subtract`,`multiply`,`divide`,`pow`,`AccessorNode`,`ArrayNode`,`ConstantNode`,`FunctionNode`,`IndexNode`,`ObjectNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`],e=>{var{typed:t,parse:n,equal:r,isZero:i,add:a,subtract:o,multiply:s,divide:c,pow:l,AccessorNode:u,ArrayNode:d,ConstantNode:f,FunctionNode:p,IndexNode:m,ObjectNode:h,OperatorNode:g,ParenthesisNode:_,SymbolNode:v}=e,y=new f(0),b=new f(1),x=new f(!0),S=new f(!1);function C(e){return _e(e)&&[`and`,`not`,`or`].includes(e.op)}var{hasProperty:w,isCommutative:T}=Rv({FunctionNode:p,OperatorNode:g,SymbolNode:v});function E(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?t.context:void 0;if(w(e,`trivial`,n)){if(pe(e)&&e.args.length===1)return E(e.args[0],t);var a=!1,o=0;if(e.forEach(e=>{++o,o===1&&(a=E(e,t))}),o===1)return a}var s=e;if(pe(s)){var c=fh(s.name);if(c){if(s.args.length>2&&w(s,`associative`,n))for(;s.args.length>2;){var l=s.args.pop(),f=s.args.pop();s.args.push(new g(c,s.name,[l,f]))}s=new g(c,s.name,s.args)}else return new p(E(s.fn),s.args.map(e=>E(e,t)))}if(_e(s)&&s.isUnary()){var _=E(s.args[0],t);
54if(s.op===`~`&&_e(_)&&_.isUnary()&&_.op===`~`||s.op===`not`&&_e(_)&&_.isUnary()&&_.op===`not`&&C(_.args[0]))return _.args[0];var v=!0;if(s.op===`-`&&_e(_)&&(_.isBinary()&&_.fn===`subtract`&&(s=new g(`-`,`subtract`,[_.args[1],_.args[0]]),v=!1),_.isUnary()&&_.op===`-`))return _.args[0];if(v)return new g(s.op,s.fn,[_])}if(_e(s)&&s.isBinary()){var D=E(s.args[0],t),O=E(s.args[1],t);if(s.op===`+`){if(B(D)&&i(D.value))return O;if(B(O)&&i(O.value))return D;_e(O)&&O.isUnary()&&O.op===`-`&&(O=O.args[0],s=new g(`-`,`subtract`,[D,O]))}if(s.op===`-`)return _e(O)&&O.isUnary()&&O.op===`-`?E(new g(`+`,`add`,[D,O.args[0]]),t):B(D)&&i(D.value)?E(new g(`-`,`unaryMinus`,[O])):B(O)&&i(O.value)?D:new g(s.op,s.fn,[D,O]);if(s.op===`*`){if(B(D)){if(i(D.value))return y;if(r(D.value,1))return O}if(B(O)){if(i(O.value))return y;if(r(O.value,1))return D;if(T(s,n))return new g(s.op,s.fn,[O,D],s.implicit)}return new g(s.op,s.fn,[D,O],s.implicit)}if(s.op===`/`)return B(D)&&i(D.value)?y:B(O)&&r(O.value,1)?D:new g(s.op,s.fn,[D,O]);if(s.op===`^`&&B(O)){if(i(O.value))return b;if(r(O.value,1))return D}if(s.op===`and`){if(B(D))if(D.value){if(C(O))return O;if(B(O))return O.value?x:S}else return S;if(B(O))if(O.value){if(C(D))return D}else return S}if(s.op===`or`){if(B(D)){if(D.value)return x;if(C(O))return O}if(B(O)){if(O.value)return x;if(C(D))return D}}return new g(s.op,s.fn,[D,O])}if(_e(s))return new g(s.op,s.fn,s.args.map(e=>E(e,t)));if(R(s))return new d(s.items.map(e=>E(e,t)));if(ce(s))return new u(E(s.object,t),E(s.index,t));if(me(s))return new m(s.dimensions.map(e=>E(e,t)));if(ge(s)){var k={};for(var A in s.properties)k[A]=E(s.properties[A],t);return new h(k)}return s}return t(Vv,{Node:E,"Node,Object":E})}),Uv=W(`resolve`,[`typed`,`parse`,`ConstantNode`,`FunctionNode`,`OperatorNode`,`ParenthesisNode`],e=>{var{typed:t,parse:n,ConstantNode:r,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(e,t){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!t)return e;if(xe(e)){if(c.has(e.name)){var l=Array.from(c).join(`, `);throw ReferenceError(`recursive loop of variable definitions among {${l}}`)}var u=t.get(e.name);if(he(u)){var d=new Set(c);return d.add(e.name),s(u,t,d)}else if(typeof u==`number`)return n(String(u));else if(u!==void 0)return new r(u);else return e}else if(_e(e)){var f=e.args.map(function(e){return s(e,t,c)});return new a(e.op,e.fn,f,e.implicit)}else if(ve(e))return new o(s(e.content,t,c));else if(pe(e)){var p=e.args.map(function(e){return s(e,t,c)});return new i(e.name,p)}return e.map(e=>s(e,t,c))}return t(`resolve`,{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,v(t)),"Array | Matrix":t.referToSelf(e=>t=>t.map(t=>e(t))),"Array | Matrix, null | undefined":t.referToSelf(e=>t=>t.map(t=>e(t))),"Array, Object":t.referTo(`Array,Map`,e=>(t,n)=>e(t,v(n))),"Matrix, Object":t.referTo(`Matrix,Map`,e=>(t,n)=>e(t,v(n))),"Array | Matrix, Map":t.referToSelf(e=>(t,n)=>t.map(t=>e(t,n)))})}),Wv=`symbolicEqual`,Gv=W(Wv,[`parse`,`simplify`,`typed`,`OperatorNode`],e=>{var{parse:t,simplify:n,typed:r,OperatorNode:i}=e;function a(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n(new i(`-`,`subtract`,[e,t]),{},r);return B(a)&&!a.value}return r(Wv,{"Node, Node":a,"Node, Node, Object":a})}),Kv=`derivative`,qv=W(Kv,[`typed`,`config`,`parse`,`simplify`,`equal`,`isZero`,`numeric`,`ConstantNode`,`FunctionNode`,`OperatorNode`,`ParenthesisNode`,`SymbolNode`],e=>{var{typed:t,config:n,parse:r,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:c,FunctionNode:l,OperatorNode:u,ParenthesisNode:d,SymbolNode:f}=e;function p(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},r=new Map,a=t.name;function o(e){var t=r.get(e);if(t!==void 0)return t;var n=_(o,e,a);return r.set(e,n),n}var s=v(e,o);return n.simplify?i(s):s}function m(e){var t=r(e);if(!t.isSymbolNode)throw TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}var h=t(Kv,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(e,t)=>p(e,m(t)),"Node, string, Object":(e,t,n)=>p(e,m(t),n)});h._simplify=!0,h.toTex=function(e){return g.apply(null,e.args)};var g=t(`_derivTex`,{"Node, SymbolNode":function(e,t){return B(e)&&Ce(e.value)===`string`?g(r(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if(Ce(t.value)===`string`)return g(e,r(t.value));
54throw Error(`The second parameter to 'derivative' is a non-string constant`)},"Node, SymbolNode, ConstantNode":function(e,t,n){return g(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){return(n===1?`{d\\over d`+t+`}`:`{d^{`+n+`}\\over d`+t+`^{`+n+`}}`)+`\\left[${e}\\right]`}}),_=t(`_isConst`,{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,t,n){return t.name!==n},"function, ParenthesisNode, string":function(e,t,n){return e(t.content,n)},"function, FunctionAssignmentNode, string":function(e,t,n){return t.params.includes(n)?e(t.expr,n):!0},"function, FunctionNode | OperatorNode, string":function(e,t,n){return t.args.every(t=>e(t,n))}}),v=t(`_derivative`,{"ConstantNode, function":function(){return y(0)},"SymbolNode, function":function(e,t){return t(e)?y(0):y(1)},"ParenthesisNode, function":function(e,t){return new d(v(e.content,t))},"FunctionAssignmentNode, function":function(e,t){return t(e)?y(0):v(e.expr,t)},"FunctionNode, function":function(e,t){if(t(e))return y(0);var n=e.args[0],r,i=!1,a=!1,o;switch(e.name){case`cbrt`:i=!0,o=new u(`*`,`multiply`,[y(3),new u(`^`,`pow`,[n,new u(`/`,`divide`,[y(2),y(3)])])]);break;case`sqrt`:case`nthRoot`:if(e.args.length===1)i=!0,o=new u(`*`,`multiply`,[y(2),new l(`sqrt`,[n])]);else if(e.args.length===2)return r=new u(`/`,`divide`,[y(1),e.args[1]]),v(new u(`^`,`pow`,[n,r]),t);break;case`log10`:r=y(10);case`log`:if(!r&&e.args.length===1)o=n.clone(),i=!0;else if(e.args.length===1&&r||e.args.length===2&&t(e.args[1]))o=new u(`*`,`multiply`,[n.clone(),new l(`log`,[r||e.args[1]])]),i=!0;else if(e.args.length===2)return v(new u(`/`,`divide`,[new l(`log`,[n]),new l(`log`,[e.args[1]])]),t);break;case`pow`:if(e.args.length===2)return v(new u(`^`,`pow`,[n,e.args[1]]),t);break;case`exp`:o=new l(`exp`,[n.clone()]);break;case`sin`:o=new l(`cos`,[n.clone()]);break;case`cos`:o=new u(`-`,`unaryMinus`,[new l(`sin`,[n.clone()])]);break;case`tan`:o=new u(`^`,`pow`,[new l(`sec`,[n.clone()]),y(2)]);break;case`sec`:o=new u(`*`,`multiply`,[e,new l(`tan`,[n.clone()])]);break;case`csc`:a=!0,o=new u(`*`,`multiply`,[e,new l(`cot`,[n.clone()])]);break;case`cot`:a=!0,o=new u(`^`,`pow`,[new l(`csc`,[n.clone()]),y(2)]);break;case`asin`:i=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])]);break;case`acos`:i=!0,a=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])]);break;case`atan`:i=!0,o=new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)]);break;case`asec`:i=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acsc`:i=!0,a=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acot`:i=!0,a=!0,o=new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)]);break;case`sinh`:o=new l(`cosh`,[n.clone()]);break;case`cosh`:o=new l(`sinh`,[n.clone()]);break;case`tanh`:o=new u(`^`,`pow`,[new l(`sech`,[n.clone()]),y(2)]);break;case`sech`:a=!0,o=new u(`*`,`multiply`,[e,new l(`tanh`,[n.clone()])]);break;case`csch`:a=!0,o=new u(`*`,`multiply`,[e,new l(`coth`,[n.clone()])]);break;case`coth`:a=!0,o=new u(`^`,`pow`,[new l(`csch`,[n.clone()]),y(2)]);break;case`asinh`:i=!0,o=new l(`sqrt`,[new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])]);break;case`acosh`:i=!0,o=new l(`sqrt`,[new u(`-`,`subtract`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])]);break;case`atanh`:i=!0,o=new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])]);break;case`asech`:i=!0,a=!0,o=new u(`*`,`multiply`,[n.clone(),new l(`sqrt`,[new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])])])]);break;case`acsch`:i=!0,a=!0,o=new u(`*`,`multiply`,[new l(`abs`,[n.clone()]),new l(`sqrt`,[new u(`+`,`add`,[new u(`^`,`pow`,[n.clone(),y(2)]),y(1)])])]);break;case`acoth`:i=!0,a=!0,o=new u(`-`,`subtract`,[y(1),new u(`^`,`pow`,[n.clone(),y(2)])]);break;case`abs`:o=new u(`/`,`divide`,[new l(new f(`abs`),[n.clone()]),n.clone()]);break;default:throw Error(`Cannot process function "`+e.name+`" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported`)}var s,c;i?(s=`/`,c=`divide`):(s=`*`,c=`multiply`);var d=v(n,t);return a&&(d=new u(`-`,`unaryMinus`,[d])),new u(s,c,[d,o])},"OperatorNode, function":function(e,t){if(t(e))return y(0);if(e.op===`+`)return new u(e.op,e.fn,e.args.map(function(e){return v(e,t)}));if(e.op===`-`){if(e.isUnary())return new u(e.op,e.fn,[v(e.args[0],t)]);if(e.isBinary())return new u(e.op,e.fn,[v(e.args[0],t),v(e.args[1],t)])}if(e.op===`*`){var n=e.args.filter(function(e){return t(e)});if(n.length>0){var r=e.args.filter(function(e){return!t(e)}),i=r.length===1?r[0]:new u(`*`,`multiply`,r);return new u(`*`,`multiply`,n.concat(v(i,t)))}return new u(`+`,`add`,e.args.map(function(n){return new u(`*`,`multiply`,e.args.map(function(e){return e===n?v(e,t):e.clone()}))}))}if(e.op===`/`&&e.isBinary()){var s=e.args[0],c=e.args[1];return t(c)?new u(`/`,`divide`,[v(s,t),c]):t(s)?new u(`*`,`multiply`,[new u(`-`,`unaryMinus`,[s]),new u(`/`,`divide`,[v(c,t),new u(`^`,`pow`,[c.clone(),y(2)])])]):new u(`/`,`divide`,[new u(`-`,`subtract`,[new u(`*`,`multiply`,[v(s,t),c.clone()]),new u(`*`,`multiply`,[s.clone(),v(c,t)])]),new u(`^`,`pow`,[c.clone(),y(2)])])}if(e.op===`^`&&e.isBinary()){var d=e.args[0],f=e.args[1];if(t(d))return B(d)&&(o(d.value)||a(d.value,1))?y(0):new u(`*`,`multiply`,[e,new u(`*`,`multiply`,[new l(`log`,[d.clone()]),v(f.clone(),t)])]);if(t(f)){if(B(f)){if(o(f.value))return y(0);
54if(a(f.value,1))return v(d,t)}var p=new u(`^`,`pow`,[d.clone(),new u(`-`,`subtract`,[f,y(1)])]);return new u(`*`,`multiply`,[f.clone(),new u(`*`,`multiply`,[v(d,t),p])])}return new u(`*`,`multiply`,[new u(`^`,`pow`,[d.clone(),f.clone()]),new u(`+`,`add`,[new u(`*`,`multiply`,[v(d,t),new u(`/`,`divide`,[f.clone(),d.clone()])]),new u(`*`,`multiply`,[v(f,t),new l(`log`,[d.clone()])])])])}throw Error(`Cannot process operator "`+e.op+`" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported`)}});function y(e,t){return new c(s(e,t||He(String(e),n)))}return h}),Jv=`rationalize`,Yv=W(Jv,`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`.split(`.`),e=>{var{config:t,typed:n,equal:r,isZero:i,add:a,subtract:o,multiply:s,divide:c,pow:l,parse:u,simplifyConstant:d,simplifyCore:f,simplify:p,fraction:m,bignumber:h,mathWithTransform:g,matrix:_,AccessorNode:v,ArrayNode:y,ConstantNode:b,FunctionNode:x,IndexNode:S,ObjectNode:C,OperatorNode:w,SymbolNode:T,ParenthesisNode:E}=e;function D(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=k(),i=O(e,t,!0,r.firstRules),a=i.variables.length,o={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,a>=1){e=A(e);var c,l,u=!0,d=!1;e=p(e,r.firstRules,{},o);for(var f;l=u?r.distrDivRules:r.sucDivRules,e=p(e,l,{},s),u=!u,f=e.toString(),f!==c;)d=!0,c=f;d&&(e=p(e,r.firstRulesAgain,{},o)),e=p(e,r.finalRules,{},o)}var m=[],h={};return e.type===`OperatorNode`&&e.isBinary()&&e.op===`/`?(a===1&&(e.args[0]=j(e.args[0],m),e.args[1]=j(e.args[1])),n&&(h.numerator=e.args[0],h.denominator=e.args[1])):(a===1&&(e=j(e,m)),n&&(h.numerator=e,h.denominator=null)),n?(h.coefficients=m,h.variables=i.variables,h.expression=e,h):e}return n(Jv,{Node:D,"Node, boolean":(e,t)=>
54D(e,{},t),"Node, Object":D,"Node, Object, boolean":D});function O(e,t,n,r){var i=[],a=p(e,r,t,{exactFractions:!1});n=!!n;var o=`+-*`+(n?`/`:``);c(a);var s={};return s.expression=a,s.variables=i,s;function c(e){var t=e.type;if(t===`FunctionNode`)throw Error(`There is an unsolved function call`);if(t===`OperatorNode`)if(e.op===`^`){if(e.args[1].type!==`ConstantNode`||!G(parseFloat(e.args[1].value)))throw Error(`There is a non-integer exponent`);c(e.args[0])}else{if(!o.includes(e.op))throw Error(`Operator `+e.op+` invalid in polynomial expression`);for(var n=0;n<e.args.length;n++)c(e.args[n])}else if(t===`SymbolNode`){var r=e.name;i.indexOf(r)===-1&&i.push(r)}else if(t===`ParenthesisNode`)c(e.content);else if(t!==`ConstantNode`)throw Error(`type `+t+` is not allowed in polynomial expression`)}}function k(){var e=[f,{l:`n+n`,r:`2*n`},{l:`n+-n`,r:`0`},d,{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)`}],n=[{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)`}],r=[{l:`(n1/(n2/n3))`,r:`((n1*n3)/n2)`},{l:`(n1/n2/n3)`,r:`(n1/(n2*n3))`}],i={};return i.firstRules=e.concat(t,r),i.distrDivRules=n,i.sucDivRules=r,i.firstRulesAgain=e.concat(t),i.finalRules=[f,{l:`n*-n`,r:`-n^2`},{l:`n*n`,r:`n^2`},d,{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))`}],i}function A(e,t,n){var r=e.type,i=arguments.length>1;if(r===`OperatorNode`&&e.isBinary()){var a=!1,o;if(e.op===`^`&&(e.args[0].type===`ParenthesisNode`||e.args[0].type===`OperatorNode`)&&e.args[1].type===`ConstantNode`&&(o=parseFloat(e.args[1].value),a=o>=2&&G(o)),a){if(o>2){var s=e.args[0];e=new w(`*`,`multiply`,[s,new w(`^`,`pow`,[e.args[0].cloneDeep(),new b(o-1)])])}else e=new w(`*`,`multiply`,[e.args[0],e.args[0].cloneDeep()]);i&&(n===`content`?t.content=e:t.args[n]=e)}}if(r===`ParenthesisNode`)A(e.content,e,`content`);else if(r!==`ConstantNode`&&r!==`SymbolNode`)for(var c=0;c<e.args.length;c++)A(e.args[c],e,c);if(!i)return e}function j(e,t){t===void 0&&(t=[]),t[0]=0;var n={};n.cte=1,n.oper=`+`,n.fire=``;var r=0,i=``;f(e,null,n),r=t.length-1;for(var a=!0,o,s=r;s>=0;s--)if(t[s]!==0){var c=new b(a?t[s]:Math.abs(t[s])),l=t[s]<0?`-`:`+`;if(s>0){var u=new T(i);if(s>1){var d=new b(s);u=new w(`^`,`pow`,[u,d])}c=t[s]===-1&&a?new w(`-`,`unaryMinus`,[u]):Math.abs(t[s])===1?u:new w(`*`,`multiply`,[c,u])}o=a?c:l===`+`?new w(`+`,`add`,[o,c]):new w(`-`,`subtract`,[o,c]),a=!1}if(a)return new b(0);return o;function f(e,n,a){var o=e.type;if(o===`FunctionNode`)throw Error(`There is an unsolved function call`);if(o===`OperatorNode`){if(!`+-*^`.includes(e.op))throw Error(`Operator `+e.op+` invalid`);if(n!==null&&((e.fn===`unaryMinus`||e.fn===`pow`)&&n.fn!==`add`&&n.fn!==`subtract`&&n.fn!==`multiply`||(e.fn===`subtract`||e.fn===`add`||e.fn===`multiply`)&&n.fn!==`add`&&n.fn!==`subtract`||(e.fn===`subtract`||e.fn===`add`||e.fn===`unaryMinus`)&&a.noFil!==0))throw Error(`Invalid `+e.op+` placing`);(e.op===`^`||e.op===`*`)&&(a.fire=e.op);for(var s=0;s<e.args.length;s++)e.fn===`unaryMinus`&&(a.oper=`-`),(e.op===`+`||e.fn===`subtract`)&&(a.fire=``,a.cte=1,a.oper=s===0?`+`:e.op),a.noFil=s,f(e.args[s],e,a)}else if(o===`SymbolNode`){if(e.name!==i&&i!==``)throw Error(`There is more than one variable`);if(i=e.name,n===null){t[1]=1;return}if(n.op===`^`&&a.noFil!==0)throw Error(`In power the variable should be the first parameter`);if(n.op===`*`&&a.noFil!==1)throw Error(`In multiply the variable should be the second parameter`);(a.fire===``||a.fire===`*`)&&(r<1&&(t[1]=0),t[1]+=a.cte*(a.oper===`+`?1:-1),r=M
54ath.max(1,r))}else if(o===`ConstantNode`){var c=parseFloat(e.value);if(n===null){t[0]=c;return}if(n.op===`^`){if(a.noFil!==1)throw Error(`Constant cannot be powered`);if(!G(c)||c<=0)throw Error(`Non-integer exponent is not allowed`);for(var l=r+1;l<c;l++)t[l]=0;c>r&&(t[c]=0),t[c]+=a.cte*(a.oper===`+`?1:-1),r=Math.max(c,r);return}a.cte=c,a.fire===``&&(t[0]+=a.cte*(a.oper===`+`?1:-1))}else throw Error(`Type `+o+` is not allowed`)}}}),Xv=`zpk2tf`,Zv=W(Xv,[`typed`,`add`,`multiply`,`Complex`,`number`],e=>{var{typed:t,add:n,multiply:r,Complex:i,number:a}=e;return t(Xv,{"Array,Array,number":function(e,t,n){return o(e,t,n)},"Array,Array":function(e,t){return o(e,t,1)},"Matrix,Matrix,number":function(e,t,n){return o(e.valueOf(),t.valueOf(),n)},"Matrix,Matrix":function(e,t){return o(e.valueOf(),t.valueOf(),1)}});function o(e,t,n){e.some(e=>e.type===`BigNumber`)&&(e=e.map(e=>a(e))),t.some(e=>e.type===`BigNumber`)&&(t=t.map(e=>a(e)));for(var o=[i(1,0)],c=[i(1,0)],l=0;l<e.length;l++){var u=e[l];typeof u==`number`&&(u=i(u,0)),o=s(o,[i(1,0),i(-u.re,-u.im)])}for(var d=0;d<t.length;d++){var f=t[d];typeof f==`number`&&(f=i(f,0)),c=s(c,[i(1,0),i(-f.re,-f.im)])}for(var p=0;p<o.length;p++)o[p]=r(o[p],n);return[o,c]}function s(e,t){for(var a=[],o=0;o<e.length+t.length-1;o++){a[o]=i(0,0);for(var s=0;s<e.length;s++)o-s>=0&&o-s<t.length&&(a[o]=n(a[o],r(e[s],t[o-s])))}return a}}),Qv=`freqz`,$v=W(Qv,[`typed`,`add`,`multiply`,`Complex`,`divide`,`matrix`],e=>{var{typed:t,add:n,multiply:r,Complex:i,divide:a,matrix:o}=e;return t(Qv,{"Array, Array":function(e,t){return s(e,t,c(512))},"Array, Array, Array":function(e,t,n){return s(e,t,n)},"Array, Array, number":function(e,t,n){if(n<0)throw Error(`w must be a positive number`);return s(e,t,c(n))},"Matrix, Matrix":function(e,t){var n=c(512),{w:r,h:i}=s(e.valueOf(),t.valueOf(),n);return{w:o(r),h:o(i)}},"Matrix, Matrix, Matrix":function(e,t,n){var{h:r}=s(e.valueOf(),t.valueOf(),n.valueOf());return{h:o(r),w:o(n)}},"Matrix, Matrix, number":function(e,t,n){if(n<0)throw Error(`w must be a positive number`);var r=c(n),{h:i}=s(e.valueOf(),t.valueOf(),r);return{h:o(i),w:o(r)}}});function s(e,t,o){for(var s=[],c=[],l=0;l<o.length;l++){for(var u=i(0,0),d=i(0,0),f=0;f<e.length;f++)u=n(u,r(e[f],i(Math.cos(-f*o[l]),Math.sin(-f*o[l]))));for(var p=0;p<t.length;p++)d=n(d,r(t[p],i(Math.cos(-p*o[l]),Math.sin(-p*o[l]))));s.push(u),c.push(d)}for(var m=[],h=0;h<s.length;h++)m.push(a(s[h],c[h]));return{h:m,w:o}}function c(e){for(var t=[],n=0;n<e;n++)t.push(n/e*Math.PI);return t}}),ey=W(`reviver`,[`classes`],e=>{var{classes:t}=e;return function(e,n){var r=t[n&&n.mathjs];return r&&typeof r.fromJSON==`function`?r.fromJSON(n):n}}),ty=W(`replacer`,[],()=>function(e,t){return typeof t==`number`&&(!Number.isFinite(t)||isNaN(t))?{mathjs:`number`,value:String(t)}:typeof t==`bigint`?{mathjs:`bigint`,value:String(t)}:t}),ny=`15.2.0`,ry=W(`true`,[],()=>!0),iy=W(`false`,[],()=>!1),ay=W(`null`,[],()=>null),oy=Sy(`Infinity`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1/0):1/0}),sy=Sy(`NaN`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(NaN):NaN}),cy=Sy(`pi`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?hp(n):Va}),ly=Sy(`tau`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?gp(n):Ha}),uy=Sy(`e`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?pp(n):Ua}),dy=Sy(`phi`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?mp(n):Wa}),fy=Sy(`LN2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(2).ln():Math.LN2}),py=Sy(`LN10`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(10).ln():Math.LN10}),my=Sy(`LOG2E`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1).div(new n(2).ln()):Math.LOG2E}),hy=Sy(`LOG10E`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(1).div(new n(10).ln()):Math.LOG10E}),gy=Sy(`SQRT1_2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(`0.5`).sqrt():Math.SQRT1_2}),_y=Sy(`SQRT2`,[`config`,`?BigNumber`],e=>{var{config:t,BigNumber:n}=e;return t.number===`BigNumber`?new n(2).sqrt():Math.SQRT2}),vy=Sy(`i`,[`Complex`],e=>{var{Complex:t}=e;return t.I}),yy=W(`PI`,[`pi`],e=>{var{pi:t}=e;return t}),by=W(`E`,[`e`],e=>{var{e:t}=e;return t}),xy=W(`version`,[],()=>ny);function Sy(e,t,n){return W(e,t,n,{recreateOnConfigChange:!0})}var Cy=bb(`speedOfLight`,`299792458`,`m s^-1`),wy=bb(`gravitationConstant`,`6.67430e-11`,`m^3 kg^-1 s^-2`),Ty=bb(`planckConstant`,`6.62607015e-34`,`J s`),Ey=bb(`reducedPlanckConstant`,`1.0545718176461565e-34`,`J s`),Dy=bb(`magneticConstant`,`1.25663706212e-6`,`N A^-2`),Oy=bb(`electricConstant`,`8.8541878128e-12`,`F m^-1`),ky=bb(`vacuumImpedance`,`376.730313667`,`ohm`),Ay=bb(`coulomb`,`8.987551792261171e9`,`N m^2 C^-2`),jy=bb(`coulombConstant`,`8.987551792261171e9`,`N m^2 C^-2`),My=bb(`elementaryCharge`,`1.602176634e-19`,`C`),Ny=bb(`bohrMagneton`,`9.2740100783e-24`,`J T^-1`),Py=bb(`conductanceQuantum`,`7.748091729863649e-5`,`S`),Fy=bb(`inverseConductanceQuantum`,`12906.403729652257`,`ohm`),Iy=bb(`magneticFluxQuantum`,`2.0678338484619295e-15`,`Wb`),Ly=bb(`nuclearMagneton`,`5.0507837461e-27`,`J T^-1`),Ry=bb(`klitzing`,`25812.807459304513`,`ohm`),zy=bb(`bohrRadius`,`5.29177210903e-11`,`m`),By=bb(`classicalElectronRadius`,`2.8179403262e-15`,`m`),Vy=bb(`electronMass`,`9.1093837015e-31`,`kg`),Hy=bb(`fermiCoupling`,`1.1663787e-5`,`GeV^-2`),Uy=xb(`fineStructure`,.0072973525693),Wy=bb(`hartreeEnergy`,`4.3597447222071e-18`,`J`),Gy=bb(`protonMass`,`1.67262192369e-27`,`kg`),Ky=bb(`deuteronMass`,`3.3435830926e-27`,`kg`),qy=bb(`neutronMass`,`1.6749271613e-27`,`kg`),Jy=bb(`quantumOfCirculation`,`3.6369475516e-4`,`m^2 s^-1`),Yy=bb(`rydberg`,`10973731.568160`,`m^-1`),Xy=bb(`thomsonCrossSection`,`6.6524587321e-29`,`m^2`),Zy=xb(`weakMixingAngle`,.2229),Qy=xb(`efimovFactor`,22.7),$y=bb(`atomicMass`,`1.66053906660e-27`,`kg`),eb=bb(`avogadro`,`6.02214076e23`,`mol^-1`),tb=bb(`boltzmann`,`1.380649e-23`,`J K^-1`),nb=bb(`faraday`,`96485.33212331001`,`C mol^-1`),rb=bb(`firstRadiation`,`3.7417718521927573e-16`,`W m^2`),ib=bb(`loschmidt`,`2.686780111798444e25`,`m^-3`),ab=bb(`gasConstant`,`8.31446261815324`,`J K^-1 mol^-1`),ob=bb(`molarPlanckConstant`,`3.990312712893431e-10`,`J s mol^-1`),sb=bb(`molarVolume`,`0.022413969545014137`,`m^3 mol^-1`),cb=xb(`sackurTetrode`,-1.16487052358),lb=bb(`secondRadiation`,`0.014387768775039337`,`m K`),ub=bb(`stefanBoltzmann`,`5.67037441918443e-8`,`W m^-2 K^-4`),db=bb(`wienDisplacement`,`2.897771955e-3`,`m K`),fb=bb(`molarMass`,`0.99999999965e-3`,`kg mol^-1`),pb=bb(`molarMassC12`,`11.9999999958e-3`,`kg mol^-1`),mb=bb(`gravity`,`9.80665`,`m s^-2`),hb=bb(`planckLength`,`1.616255e-35`,`m`),gb=bb(`planckMass`,`2.176435e-8`,`kg`),_b=bb(`planckTime`,`5.391245e-44`,`s`),vb=bb(`planckCharge`,`1.87554603778e-18`,`C`),yb=bb(`planckTemperature`,`1.416785e+32`,`K`);function bb(e,t,n){return W(e,[`config`,`Unit`,`BigNumber`],e=>{var{config:r,Unit:i,BigNumber:a}=e,o=new i(r.number===`BigNumber`?new a(t):parseFloat(t),n);return o.fixPrefix=!0,o})}function xb(e,t){return W(e,[`config`,`BigNumber`],e=>{var{config:n,BigNumber:r}=e;return n.number===`BigNumber`?new r(t):t})}function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];
54t%2?Sb(Object(n),!0).forEach(function(t){$u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wb=W(`mapSlices`,[`typed`,`isInteger`],e=>{var{typed:t,isInteger:n}=e,r=Ls({typed:t,isInteger:n});return t(`mapSlices`,{"...any":function(e){var t=e[1];b(t)?e[1]=t-1:x(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw eh(e)}}})},Cb({isTransformFunction:!0},Ls.meta)),Tb=W(`column`,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e,a=Gl({typed:t,Index:n,matrix:r,range:i});return t(`column`,{"...any":function(e){var t=e.length-1,n=e[t];b(n)&&(e[t]=n-1);try{return a.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0});function Eb(e,t,n){var r=e.filter(function(e){return xe(e)&&!(e.name in t)&&!n.has(e.name)})[0];if(!r)throw Error(`No undefined variable found in inline expression "`+e+`"`);var i=r.name,a=new Map,o=new h(n,a,new Set([i])),s=e.compile();return function(e){return a.set(i,e),s.evaluate(o)}}var Db=W(`transformCallback`,[`typed`],e=>{var{typed:t}=e;return function(e,r){return t.isTypedFunction(e)?n(e,r):Ob(e,e.length,r)};function n(e,r){var i=Object.fromEntries(Object.entries(e.signatures).map(e=>{var[i,a]=e,o=i.split(`,`).length;return t.isTypedFunction(a)?[i,n(a,r)]:[i,Ob(a,o,r)]}));return typeof e.name==`string`?t(e.name,i):t(i)}});function Ob(e,t,n){return t===n?e:t===n+1?function(){var t=[...arguments],r=t.slice(0,n),i=kb(t[n]);return e(...r,i)}:t>n+1?function(){var t=[...arguments],r=t.slice(0,n),i=kb(t[n]),a=t.slice(n+1);return e(...r,i,...a)}:e}function kb(e){return e.map(e=>e+1)}var Ab=W(`filter`,[`typed`],e=>{var{typed:t}=e;function n(e,n,i){var a=Ql({typed:t}),o=Db({typed:t});if(e.length===0)return a();var s=e[0];if(e.length===1)return a(s);var c=e.length-1,l=e[c];return s&&=r(s,i),l&&=xe(l)||fe(l)?r(l,i):Eb(l,n,i),a(s,o(l,c))}n.rawArgs=!0;function r(e,t){return e.compile().evaluate(t)}return n},{isTransformFunction:!0}),jb=W(`forEach`,[`typed`],e=>{var{typed:t}=e,n=ru({typed:t}),r=Db({typed:t});function i(e,t,i){if(e.length===0)return n();var o=e[0];if(e.length===1)return n(o);var s=e.length-1,c=e[s];return o&&=a(o,i),c&&=xe(c)||fe(c)?a(c,i):Eb(c,t,i),n(o,r(c,s))}i.rawArgs=!0;function a(e,t){return e.compile().evaluate(t)}return i},{isTransformFunction:!0}),Mb=W(`index`,[`Index`,`getMatrixDataType`],e=>{var{Index:t,getMatrixDataType:n}=e;return function(){for(var e=[],r=0,i=arguments.length;r<i;r++){var a=arguments[r];if(M(a))a.start--,a.end-=a.step>0?0:2;else if(a&&a.isSet===!0)a=a.map(function(e){return e-1});else if(D(a)||O(a))n(a)!==`boolean`&&(a=a.map(function(e){return e-1}));else if(b(a)||S(a))a--;else if(x(a))a=a.toNumber()-1;else if(typeof a!=`string`)throw TypeError(`Dimension must be an Array, Matrix, number, bigint, string, or Range`);e[r]=a}var o=new t;return t.apply(o,e),o}},{isTransformFunction:!0}),Nb=W(`map`,[`typed`],e=>{var{typed:t}=e,n=fu({typed:t}),r=Db({typed:t});function i(e,t,i){if(e.length===0)return n();if(e.length===1)return n(e[0]);var a=e.length-1,o=e.slice(0,a),s=e[a];return o=o.map(e=>c(e,i)),s&&=xe(s)||fe(s)?c(s,i):Eb(s,t,i),n(...o,r(s,a));function c(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i},{isTransformFunction:!0});function Pb(e){return b(e)?e-1:x(e)?e.minus(1):e}function Fb(e){return b(e)||x(e)}function Ib(e){if(e.length===2&&k(e[0])){e=e.slice();var t=e[1];Fb(t)&&(e[1]=Pb(t))}return e}var Lb=W(`max`,[`typed`,`config`,`numeric`,`larger`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,larger:i,isNaN:a}=e,o=rp({typed:t,config:n,numeric:r,larger:i,isNaN:a});return t(`max`,{"...any":function(e){e=Ib(e);try{return o.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Rb=W(`mean`,[`typed`,`add`,`divide`],e=>{var{typed:t,add:n,divide:r}=e,i=w_({typed:t,add:n,divide:r});return t(`mean`,{"...any":function(e){e=Ib(e);try{return i.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),zb=W(`min`,[`typed`,`config`,`numeric`,`smaller`,`isNaN`],e=>{var{typed:t,config:n,numeric:r,smaller:i,isNaN:a}=e,o=ap({typed:t,config:n,numeric:r,smaller:i,isNaN:a});return t(`min`,{"...any":function(e){e=Ib(e);try{return o.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Bb=W(`range`,[`typed`,`config`,`?matrix`,`?bignumber`,`equal`,`smaller`,`smallerEq`,`larger`,`largerEq`,`add`,`isZero`,`isPositive`],e=>{var{typed:t,config:n,matrix:r,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:c,largerEq:l,add:u,isZero:d,isPositive:f}=e,p=bu({typed:t,config:n,matrix:r,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:c,largerEq:l,add:u,isZero:d,isPositive:f});return t(`range`,{"...any":function(e){return typeof e[e.length-1]!=`boolean`&&e.push(!0),p.apply(null,e)}})},{isTransformFunction:!0}),Vb=W(`row`,[`typed`,`Index`,`matrix`,`range`],e=>{var{typed:t,Index:n,matrix:r,range:i}=e,a=ku({typed:t,Index:n,matrix:r,range:i});return t(`row`,{"...any":function(e){var t=e.length-1,n=e[t];b(n)&&(e[t]=n-1);try{return a.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Hb=W(`subset`,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e,a=Fu({typed:t,matrix:n,zeros:r,add:i});return t(`subset`,{"...any":function(e){try{return a.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Ub=W(`concat`,[`typed`,`matrix`,`isInteger`],e=>{var{typed:t,matrix:n,isInteger:r}=e,i=Ul({typed:t,matrix:n,isInteger:r});return t(`concat`,{"...any":function(e){var t=e.length-1,n=e[t];b(n)?e[t]=n-1:x(n)&&(e[t]=n.minus(1));try{return i.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Wb=`diff`,Gb=W(Wb,[`typed`,`matrix`,`subtract`,`number`,`bignumber`],e=>{var{typed:t,matrix:n,subtract:r,number:i,bignumber:a}=e,o=mu({typed:t,matrix:n,subtract:r,number:i,bignumber:a});return t(Wb,{"...any":function(e){e=Ib(e);try{return o.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Kb=W(`std`,[`typed`,`map`,`sqrt`,`variance`],e=>{var{typed:t,map:n,sqrt:r,variance:i}=e,a=F_({typed:t,map:n,sqrt:r,variance:i});return t(`std`,{"...any":function(e){e=Ib(e);try{return a.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),qb=`sum`,Jb=W(qb,[`typed`,`config`,`add`,`numeric`],e=>{var{typed:t,config:n,add:r,numeric:i}=e,a=b_({typed:t,config:n,add:r,numeric:i});return t(qb,{"...any":function(e){e=Ib(e);try{return a.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Yb=W(`quantileSeq`,[`typed`,`bignumber`,`add`,`subtract`,`divide`,`multiply`,`partitionSelect`,`compare`,`isInteger`,`smaller`,`smallerEq`,`larger`,`mapSlices`],e=>{var{typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p}=e,m=N_({typed:t,bignumber:n,add:r,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:c,isInteger:l,smaller:u,smallerEq:d,larger:f,mapSlices:p});return t(`quantileSeq`,{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(e,t,n)=>m(e,t,h(n)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>m(e,t,n,h(r)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(e,t,n)=>m(e,t,h(n)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>m(e,t,n,h(r))});function h(e){return Ib([[],e])[1]}},{isTransformFunction:!0}),Xb=`cumsum`,Zb=W(Xb,[`typed`,`add`,`unaryPlus`],e=>{var{typed:t,add:n,unaryPlus:r}=e,i=S_({typed:t,add:n,unaryPlus:r});return t(Xb,{"...any":function(e){if(e.length===2&&k(e[0])){var t=e[1];b(t)?e[1]=t-1:x(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),Qb=`variance`,$b=W(Qb,[`typed`,`add`,`subtract`,`multiply`,`divide`,`mapSlices`,`isNaN`],e=>{var{typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s}=e,c=j_({typed:t,add:n,subtract:r,multiply:i,divide:a,mapSlices:o,isNaN:s});return t(Qb,{"...any":function(e){e=Ib(e);try{return c.apply(null,e)}catch(e){throw eh(e)}}})},{isTransformFunction:!0}),ex=`print`,tx=W(ex,[`typed`,`matrix`,`zeros`,`add`],e=>{var{typed:t,matrix:n,zeros:r,add:i}=e,a=Ed({typed:t,matrix:n,zeros:r,add:i});return t(ex,{"string, Object | Array":function(e,t){return a(o(e),t)},"string, Object | Array, number | Object":function(e,t,n){return a(o(e),t,n)}});function o(e){return e.replace(wd,e=>`$`+e.slice(1).split(`.`).map(function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e}).join(`.`))}},{isTransformFunction:!0}),nx=W(`and`,[`typed`,`matrix`,`zeros`,`add`,`equalScalar`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=yf({typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o});
54function c(e,t,n){var r=e[0].compile().evaluate(n);return!k(r)&&!s(r,!0)?!1:s(r,e[1].compile().evaluate(n))}return c.rawArgs=!0,c},{isTransformFunction:!0}),rx=W(`or`,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=zl({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a});function s(e,t,n){var r=e[0].compile().evaluate(n);return!k(r)&&o(r,!1)?!0:o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),ix=W(`nullish`,[`typed`,`matrix`,`size`,`flatten`,`deepEqual`],e=>{var{typed:t,matrix:n,size:r,flatten:i,deepEqual:a}=e,o=Ll({typed:t,matrix:n,size:r,flatten:i,deepEqual:a});function s(e,t,n){var r=e[0].compile().evaluate(n);return!k(r)&&r!=null&&r!==void 0?r:o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),ax=W(`bitAnd`,[`typed`,`matrix`,`zeros`,`add`,`equalScalar`,`not`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o}=e,s=vl({typed:t,matrix:n,equalScalar:r,zeros:i,not:a,concat:o});function c(e,t,n){var r=e[0].compile().evaluate(n);if(!k(r)){if(isNaN(r))return NaN;if(r===0||r===!1)return 0}return s(r,e[1].compile().evaluate(n))}return c.rawArgs=!0,c},{isTransformFunction:!0}),ox=W(`bitOr`,[`typed`,`matrix`,`equalScalar`,`DenseMatrix`,`concat`],e=>{var{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a}=e,o=Sl({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:a});function s(e,t,n){var r=e[0].compile().evaluate(n);if(!k(r)){if(isNaN(r))return NaN;if(r===-1)return-1;if(r===!0)return 1}return o(r,e[1].compile().evaluate(n))}return s.rawArgs=!0,s},{isTransformFunction:!0}),sx=`num`,cx=W(sx,[`typed`,`fraction`],e=>{var{typed:t,fraction:n}=e;return t(sx,{Fraction:e=>e.s*e.n,BigNumber:e=>{var t=n(e);return t.s*t.n},"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),lx=`den`,ux=W(lx,[`typed`,`fraction`],e=>{var{typed:t,fraction:n}=e;return t(lx,{Fraction:e=>e.d,BigNumber:e=>n(e).d,"Array | Matrix":t.referToSelf(e=>t=>Xi(t,e))})}),dx=t({createAbs:()=>Fs,createAccessorNode:()=>rh,createAcos:()=>Op,createAcosh:()=>Ap,createAcot:()=>Mp,createAcoth:()=>Pp,createAcsc:()=>Ip,createAcsch:()=>Rp,createAdd:()=>Hm,createAddScalar:()=>Vs,createAnd:()=>yf,createAndTransform:()=>nx,createArg:()=>Dl,createArrayNode:()=>ah,createAsec:()=>Bp,createAsech:()=>Hp,createAsin:()=>Wp,createAsinh:()=>Gp,createAssignmentNode:()=>mh,createAtan:()=>Kp,createAtan2:()=>Jp,createAtanh:()=>Xp,createAtomicMass:()=>$y,createAvogadro:()=>eb,createBellNumbers:()=>Dv,createBernoulli:()=>z_,createBigNumberClass:()=>lr,createBigint:()=>fs,createBignumber:()=>_s,createBin:()=>yd,createBitAnd:()=>vl,createBitAndTransform:()=>ax,createBitNot:()=>bl,createBitOr:()=>Sl,createBitOrTransform:()=>ox,createBitXor:()=>Tl,createBlockNode:()=>gh,createBohrMagneton:()=>Ny,createBohrRadius:()=>zy,createBoltzmann:()=>tb,createBoolean:()=>gs,createCatalan:()=>kv,createCbrt:()=>Gs,createCeil:()=>$s,createChain:()=>Yg,createChainClass:()=>Mg,createClassicalElectronRadius:()=>By,createClone:()=>Ki,createColumn:()=>Gl,createColumnTransform:()=>Tb,createCombinations:()=>H_,createCombinationsWithRep:()=>G_,createCompare:()=>xf,createCompareNatural:()=>Tf,createCompareText:()=>kf,createCompile:()=>Xh,createComplex:()=>vs,createComplexClass:()=>vr,createComposition:()=>jv,createConcat:()=>Ul,createConcatTransform:()=>Ub,createConditionalNode:()=>vh,createConductanceQuantum:()=>Py,createConj:()=>kl,createConstantNode:()=>Oh,createCorr:()=>L_,createCos:()=>$p,createCosh:()=>tm,createCot:()=>rm,createCoth:()=>am,createCoulomb:()=>Ay,createCoulombConstant:()=>jy,createCount:()=>ql,createCreateUnit:()=>Ep,createCross:()=>Yl,createCsc:()=>sm,createCsch:()=>lm,createCtranspose:()=>Uu,createCube:()=>tc,createCumSum:()=>S_,createCumSumTransform:()=>Zb,createDeepEqual:()=>Jf,createDen:()=>ux,createDenseMatrixClass:()=>Wi,createDerivative:()=>qv,createDet:()=>Zg,createDeuteronMass:()=>Ky,createDiag:()=>Zl,createDiff:()=>mu,createDiffTransform:()=>Gb,createDistance:()=>__,createDivide:()=>h_,createDivideScalar:()=>Id,createDot:()=>Jm,createDotDivide:()=>$d,createDotMultiply:()=>cl,createDotPow:()=>Zd,createE:()=>uy,createEfimovFactor:()=>Qy,createEigs:()=>i_,createElectricConstant:()=>Oy,createElectronMass:()=>Vy,createElementaryCharge:()=>My,createEqual:()=>jf,createEqualScalar:()=>as,createEqualText:()=>Pf,createErf:()=>rd,createEvaluate:()=>Qh,createExp:()=>rc,createExpm:()=>o_,createExpm1:()=>ac,createFactorial:()=>Q_,createFalse:()=>iy,createFaraday:()=>nb,createFermiCoupling:()=>Hy,createFft:()=>qu,createFibonacciHeapClass:()=>lp,createFilter:()=>Ql,createFilterTransform:()=>Ab,createFineStructure:()=>Uy,createFirstRadiation:()=>rb,createFix:()=>lc,createFlatten:()=>tu,createFloor:()=>mc,createForEach:()=>ru,createForEachTransform:()=>jb,createFormat:()=>_d,createFraction:()=>ys,createFractionClass:()=>Lr,createFreqz:()=>$v,createFunctionAssignmentNode:()=>Ah,createFunctionNode:()=>Kh,createGamma:()=>J_,createGasConstant:()=>ab,createGcd:()=>Nc,createGetMatrixDataType:()=>ou,createGravitationConstant:()=>wy,createGravity:()=>mb,createHartreeEnergy:()=>Wy,createHasNumericValue:()=>Uo,createHelp:()=>qg,createHelpClass:()=>jg,createHex:()=>Cd,createHypot:()=>Wm,createI:()=>vy,createIdentity:()=>cu,createIfft:()=>Yu,createIm:()=>jl,createImmutableDenseMatrixClass:()=>op,createIndex:()=>Zm,createIndexClass:()=>sp,createIndexNode:()=>Mh,createIndexTransform:()=>Mb,createInfinity:()=>oy,createIntersect:()=>v_,createInv:()=>$g,createInverseConductanceQuantum:()=>Fy,createInvmod:()=>al,createIsBounded:()=>Zo,createIsFinite:()=>$o,createIsInteger:()=>ta,createIsNaN:()=>Yo,createIsNegative:()=>zo,createIsNumeric:()=>Vo,createIsPositive:()=>Go,createIsPrime:()=>Nd,createIsZero:()=>qo,createKldivergence:()=>ev,createKlitzing:()=>Ry,createKron:()=>uu,createLN10:()=>py,createLN2:()=>fy,createLOG10E:()=>hy,createLOG2E:()=>my,createLarger:()=>Hf,createLargerEq:()=>Gf,createLcm:()=>Ic,createLeafCount:()=>Nv,createLeftShift:()=>pf,createLgamma:()=>X_,createLog:()=>Gd,createLog10:()=>Vc,createLog1p:()=>qd,createLog2:()=>Uc,createLoschmidt:()=>ib,createLsolve:()=>nf,createLsolveAll:()=>sf,createLup:()=>ig,createLusolve:()=>Og,createLyap:()=>m_,createMad:()=>O_,createMagneticConstant:()=>Dy,createMagneticFluxQuantum:()=>Iy,createMap:()=>fu,createMapSlices:()=>Ls,createMapSlicesTransform:()=>wb,createMapTransform:()=>Nb,createMatrix:()=>xs,createMatrixClass:()=>zr,createMatrixFromColumns:()=>Ds,createMatrixFromFunction:()=>Cs,createMatrixFromRows:()=>Ts,createMax:()=>rp,createMaxTransform:()=>Lb,createMean:()=>w_,createMeanTransform:()=>Rb,createMedian:()=>E_,createMin:()=>ap,createMinTransform:()=>zb,createMod:()=>Cc,createMode:()=>fd,createMolarMass:()=>fb,createMolarMassC12:()=>pb,createMolarPlanckConstant:()=>
54ob,createMolarVolume:()=>sb,createMultinomial:()=>nv,createMultiply:()=>Kc,createMultiplyScalar:()=>Wc,createNaN:()=>sy,createNeutronMass:()=>qy,createNode:()=>$m,createNorm:()=>Km,createNot:()=>Fl,createNthRoot:()=>Jc,createNthRoots:()=>Yd,createNuclearMagneton:()=>Ly,createNull:()=>ay,createNullish:()=>Ll,createNullishTransform:()=>ix,createNum:()=>cx,createNumber:()=>ds,createNumeric:()=>Pd,createObjectNode:()=>Ph,createOct:()=>xd,createOnes:()=>hu,createOperatorNode:()=>Lh,createOr:()=>zl,createOrTransform:()=>rx,createParenthesisNode:()=>zh,createParse:()=>Jh,createParser:()=>ng,createParserClass:()=>$h,createPartitionSelect:()=>$f,createPermutations:()=>iv,createPhi:()=>dy,createPi:()=>cy,createPickRandom:()=>vv,createPinv:()=>t_,createPlanckCharge:()=>vb,createPlanckConstant:()=>Ty,createPlanckLength:()=>hb,createPlanckMass:()=>gb,createPlanckTemperature:()=>yb,createPlanckTime:()=>_b,createPolynomialRoot:()=>Ag,createPow:()=>Rd,createPrint:()=>Ed,createPrintTransform:()=>tx,createProd:()=>hd,createProtonMass:()=>Gy,createQr:()=>og,createQuantileSeq:()=>N_,createQuantileSeqTransform:()=>Yb,createQuantumOfCirculation:()=>Jy,createRandom:()=>xv,createRandomInt:()=>Cv,createRange:()=>bu,createRangeClass:()=>Rr,createRangeNode:()=>Vh,createRangeTransform:()=>Bb,createRationalize:()=>Yv,createRe:()=>Nl,createReducedPlanckConstant:()=>Ey,createRelationalNode:()=>Uh,createReplacer:()=>ty,createReshape:()=>Su,createResize:()=>Cu,createResolve:()=>Uv,createResultSet:()=>St,createReviver:()=>ey,createRightArithShift:()=>hf,createRightLogShift:()=>_f,createRotate:()=>Tu,createRotationMatrix:()=>Du,createRound:()=>Vd,createRow:()=>ku,createRowTransform:()=>Vb,createRydberg:()=>Yy,createSQRT1_2:()=>gy,createSQRT2:()=>_y,createSackurTetrode:()=>cb,createSchur:()=>f_,createSec:()=>dm,createSech:()=>pm,createSecondRadiation:()=>lb,createSetCartesian:()=>Sm,createSetDifference:()=>wm,createSetDistinct:()=>Em,createSetIntersect:()=>Om,createSetIsSubset:()=>Am,createSetMultiplicity:()=>Mm,createSetPowerset:()=>Pm,createSetSize:()=>Im,createSetSymDifference:()=>Rm,createSetUnion:()=>Bm,createSign:()=>Xc,createSimplify:()=>zv,createSimplifyConstant:()=>Bv,createSimplifyCore:()=>Hv,createSin:()=>hm,createSinh:()=>_m,createSize:()=>ju,createSlu:()=>Tg,createSmaller:()=>If,createSmallerEq:()=>zf,createSolveODE:()=>nd,createSort:()=>tp,createSpaClass:()=>up,createSparse:()=>wp,createSparseMatrixClass:()=>os,createSpeedOfLight:()=>Cy,createSplitUnit:()=>ks,createSqrt:()=>Zc,createSqrtm:()=>c_,createSquare:()=>$c,createSqueeze:()=>Nu,createStd:()=>F_,createStdTransform:()=>Kb,createStefanBoltzmann:()=>ub,createStirlingS2:()=>Tv,createString:()=>ms,createSubset:()=>Fu,createSubsetTransform:()=>Hb,createSubtract:()=>tl,createSubtractScalar:()=>Us,createSum:()=>b_,createSumTransform:()=>Jb,createSylvester:()=>u_,createSymbolNode:()=>Wh,createSymbolicEqual:()=>Gv,createTan:()=>ym,createTanh:()=>bm,createTau:()=>ly,createThomsonCrossSection:()=>Xy,createTo:()=>kd,createToBest:()=>jd,createTrace:()=>Ym,createTranspose:()=>Vu,createTrue:()=>ry,createTypeOf:()=>ts,createTyped:()=>_t,createUnaryMinus:()=>js,createUnaryPlus:()=>Ns,createUnequal:()=>Xf,createUnitClass:()=>bp,createUnitFunction:()=>Sp,createUppercaseE:()=>by,createUppercasePi:()=>yy,createUsolve:()=>af,createUsolveAll:()=>lf,createVacuumImpedance:()=>ky,createVariance:()=>j_,createVarianceTransform:()=>$b,createVersion:()=>xy,createWeakMixingAngle:()=>Zy,createWienDisplacement:()=>db,createXgcd:()=>rl,createXor:()=>Vl,createZeros:()=>Gu,createZeta:()=>ud,createZpk2tf:()=>Zv}),Z=lr({config:U}),fx=vr({}),px=uy({BigNumber:Z,config:U}),mx=iy({}),hx=Uy({BigNumber:Z,config:U}),gx=Lr({}),_x=vy({Complex:fx}),vx=oy({BigNumber:Z,config:U}),yx=py({BigNumber:Z,config:U}),bx=hy({BigNumber:Z,config:U}),xx=zr({}),Sx=sy({BigNumber:Z,config:U}),Cx=ay({}),wx=dy({BigNumber:Z,config:U}),Tx=Rr({}),Ex=St({}),Dx=gy({BigNumber:Z,config:U}),Ox=cb({BigNumber:Z,config:U}),kx=ly({BigNumber:Z,config:U}),Ax=ry({}),jx=xy({}),Mx=Wi({Matrix:xx,config:U}),Nx=Qy({BigNumber:Z,config:U}),Px=fy({BigNumber:Z,config:U}),Fx=cy({BigNumber:Z,config:U}),Ix=ty({}),Lx=_y({BigNumber:Z,config:U}),Q=_t({BigNumber:Z,Complex:fx,DenseMatrix:Mx,Fraction:gx}),Rx=Zy({BigNumber:Z,config:U}),zx=Fs({typed:Q}),Bx=Op({Complex:fx,config:U,typed:Q}),Vx=Mp({BigNumber:Z,typed:Q}),Hx=Ip({BigNumber:Z,Complex:fx,config:U,typed:Q}),Ux=Vs({typed:Q}),Wx=Dl({typed:Q}),Gx=Hp({BigNumber:Z,Complex:fx,config:U,typed:Q}),Kx=Gp({typed:Q}),qx=Kp({typed:Q}),Jx=Xp({Complex:fx,config:U,typed:Q}),Yx=fs({typed:Q}),Xx=bl({typed:Q}),Zx=gs({typed:Q}),Qx=Ki({typed:Q}),$x=H_({typed:Q}),eS=vs({Complex:fx,typed:Q}),tS=kl({typed:Q}),nS=$p({typed:Q}),rS=rm({BigNumber:Z,typed:Q}),iS=sm({BigNumber:Z,typed:Q}),aS=tc({typed:Q}),oS=as({config:U,typed:Q}),sS=rd({typed:Q}),cS=rc({typed:Q}),lS=ac({Complex:fx,typed:Q}),uS=Ql({typed:Q}),dS=tu({typed:Q}),fS=ru({typed:Q}),pS=_d({typed:Q}),mS=ou({typed:Q}),hS=Cd({format:pS,typed:Q}),gS=jl({typed:Q}),_S=Zo({typed:Q}),vS=Yo({typed:Q}),yS=Vo({typed:Q}),bS=Nd({typed:Q}),xS=my({BigNumber:Z,config:U}),SS=X_({Complex:fx,typed:Q}),CS=Vc({Complex:fx,config:U,typed:Q}),wS=Uc({Complex:fx,config:U,typed:Q}),TS=fu({typed:Q}),ES=fd({isNaN:vS,isNumeric:yS,typed:Q}),DS=Wc({typed:Q}),OS=Fl({typed:Q}),kS=ds({typed:Q}),AS=xd({format:pS,typed:Q}),jS=vv({config:U,typed:Q}),MS=Ed({typed:Q}),NS=xv({config:U,typed:Q}),PS=Nl({typed:Q}),FS=dm({BigNumber:Z,typed:Q}),IS=Xc({BigNumber:Z,Fraction:gx,complex:eS,typed:Q}),LS=hm({typed:Q}),RS=ju({typed:Q}),zS=os({Matrix:xx,equalScalar:oS,typed:Q}),BS=ks({typed:Q}),VS=$c({typed:Q}),HS=ms({typed:Q}),US=Us({typed:Q}),WS=ym({typed:Q}),GS=jd({typed:Q}),KS=ts({typed:Q}),qS=Ap({Complex:fx,config:U,typed:Q}),JS=Rp({BigNumber:Z,typed:Q}),YS=Bp({BigNumber:Z,Complex:fx,config:U,typed:Q}),XS=_s({BigNumber:Z,typed:Q}),ZS=G_({typed:Q}),QS=tm({typed:Q}),$S=lm({BigNumber:Z,typed:Q}),eC=Jm({addScalar:Ux,conj:tS,multiplyScalar:DS,size:RS,typed:Q}),tC=Uo({isNumeric:yS,typed:Q}),nC=$o({isBounded:_S,map:TS,typed:Q}),rC=zo({config:U,typed:Q}),iC=qo({equalScalar:oS,typed:Q}),$=xs({DenseMatrix:Mx,Matrix:xx,SparseMatrix:zS,typed:Q}),aC=Cs({isZero:iC,matrix:$,typed:Q}),oC=Kc({addScalar:Ux,dot:eC,equalScalar:oS,matrix:$,multiplyScalar:DS,typed:Q}
54),sC=hu({BigNumber:Z,config:U,matrix:$,typed:Q}),cC=Cv({config:U,log2:wS,typed:Q}),lC=Cu({config:U,matrix:$}),uC=pm({BigNumber:Z,typed:Q}),dC=_m({typed:Q}),fC=wp({SparseMatrix:zS,typed:Q}),pC=Zc({Complex:fx,config:U,typed:Q}),mC=Nu({typed:Q}),hC=bm({typed:Q}),gC=Vu({matrix:$,typed:Q}),_C=rl({BigNumber:Z,config:U,matrix:$,typed:Q}),vC=Gu({BigNumber:Z,config:U,matrix:$,typed:Q}),yC=Pp({BigNumber:Z,Complex:fx,config:U,typed:Q}),bC=Wp({Complex:fx,config:U,typed:Q}),xC=yd({format:pS,typed:Q}),SC=am({BigNumber:Z,typed:Q}),CC=Uu({conj:tS,transpose:gC,typed:Q}),wC=Zl({DenseMatrix:Mx,SparseMatrix:zS,matrix:$,typed:Q}),TC=jf({DenseMatrix:Mx,SparseMatrix:zS,equalScalar:oS,matrix:$,typed:Q}),EC=ys({Fraction:gx,typed:Q}),DC=cu({BigNumber:Z,DenseMatrix:Mx,SparseMatrix:zS,config:U,matrix:$,typed:Q}),OC=ta({equal:TC,typed:Q}),kC=uu({matrix:$,multiplyScalar:DS,typed:Q}),AC=Ls({isInteger:OC,typed:Q}),jC=Ds({flatten:dS,matrix:$,size:RS,typed:Q}),MC=cx({fraction:EC,typed:Q}),NC=Su({isInteger:OC,matrix:$,typed:Q}),PC=Vd({BigNumber:Z,DenseMatrix:Mx,config:U,equalScalar:oS,matrix:$,typed:Q,zeros:vC}),FC=js({typed:Q}),IC=z_({BigNumber:Z,Fraction:gx,config:U,isInteger:OC,number:kS,typed:Q}),LC=Gs({BigNumber:Z,Complex:fx,Fraction:gx,config:U,isNegative:rC,matrix:$,typed:Q,unaryMinus:FC}),RC=Ul({isInteger:OC,matrix:$,typed:Q}),zC=Jf({equal:TC,typed:Q}),BC=cl({concat:RC,equalScalar:oS,matrix:$,multiplyScalar:DS,typed:Q}),VC=mc({DenseMatrix:Mx,config:U,equalScalar:oS,matrix:$,round:PC,typed:Q,zeros:vC}),HC=Nc({BigNumber:Z,DenseMatrix:Mx,concat:RC,config:U,equalScalar:oS,matrix:$,round:PC,typed:Q,zeros:vC}),UC=Go({config:U,typed:Q}),WC=Hf({DenseMatrix:Mx,SparseMatrix:zS,bignumber:XS,concat:RC,config:U,matrix:$,typed:Q}),GC=Ic({concat:RC,equalScalar:oS,matrix:$,typed:Q}),KC=pf({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q,zeros:vC}),qC=Cc({DenseMatrix:Mx,concat:RC,config:U,equalScalar:oS,matrix:$,round:PC,typed:Q,zeros:vC}),JC=Jc({BigNumber:Z,concat:RC,equalScalar:oS,matrix:$,typed:Q}),YC=Ll({deepEqual:zC,flatten:dS,matrix:$,size:RS,typed:Q}),XC=Pd({bignumber:XS,fraction:EC,number:kS}),ZC=hd({config:U,multiplyScalar:DS,numeric:XC,typed:Q}),QC=hf({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q,zeros:vC}),$C=If({DenseMatrix:Mx,SparseMatrix:zS,bignumber:XS,concat:RC,config:U,matrix:$,typed:Q}),ew=tl({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,subtractScalar:US,typed:Q,unaryMinus:FC}),tw=kd({concat:RC,matrix:$,typed:Q}),nw=Ns({config:U,numeric:XC,typed:Q}),rw=Vl({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,matrix:$,typed:Q}),iw=Hm({DenseMatrix:Mx,SparseMatrix:zS,addScalar:Ux,concat:RC,equalScalar:oS,matrix:$,typed:Q}),aw=Jp({BigNumber:Z,DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q}),ow=vl({concat:RC,equalScalar:oS,matrix:$,typed:Q}),sw=Sl({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q}),cw=Tl({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,matrix:$,typed:Q}),lw=$s({DenseMatrix:Mx,config:U,equalScalar:oS,matrix:$,round:PC,typed:Q,zeros:vC}),uw=xf({BigNumber:Z,DenseMatrix:Mx,Fraction:gx,concat:RC,config:U,equalScalar:oS,matrix:$,typed:Q}),dw=kf({concat:RC,matrix:$,typed:Q}),fw=jv({addScalar:Ux,combinations:$x,isInteger:OC,isNegative:rC,isPositive:UC,larger:WC,typed:Q}),pw=ql({prod:ZC,size:RS,typed:Q}),mw=Yl({matrix:$,multiply:oC,subtract:ew,typed:Q}),hw=mu({matrix:$,number:kS,subtract:ew,typed:Q}),gw=Id({numeric:XC,typed:Q}),_w=Pf({compareText:dw,isZero:iC,typed:Q}),vw=lp({larger:WC,smaller:$C}),yw=lc({Complex:fx,DenseMatrix:Mx,ceil:lw,equalScalar:oS,floor:VC,matrix:$,typed:Q,zeros:vC}),bw=Wm({abs:zx,addScalar:Ux,divideScalar:gw,isPositive:UC,multiplyScalar:DS,smaller:$C,sqrt:pC,typed:Q}),xw=op({DenseMatrix:Mx,smaller:$C}),Sw=sp({ImmutableDenseMatrix:xw,getMatrixDataType:mS}),Cw=v_({abs:zx,add:iw,addScalar:Ux,config:U,divideScalar:gw,equalScalar:oS,flatten:dS,isNumeric:yS,isZero:iC,matrix:$,multiply:oC,multiplyScalar:DS,smaller:$C,subtract:ew,typed:Q}),ww=al({BigNumber:Z,add:iw,config:U,equal:TC,isInteger:OC,mod:qC,smaller:$C,typed:Q,xgcd:_C}),Tw=Gf({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,config:U,matrix:$,typed:Q}),Ew=Gd({Complex:fx,config:U,divideScalar:gw,typeOf:KS,typed:Q}),Dw=nf({DenseMatrix:Mx,divideScalar:gw,equalScalar:oS,matrix:$,multiplyScalar:DS,subtractScalar:US,typed:Q}),Ow=Ts({flatten:dS,matrix:$,size:RS,typed:Q}),kw=ap({config:U,isNaN:vS,numeric:XC,smaller:$C,typed:Q}),Aw=Yd({Complex:fx,config:U,divideScalar:gw,typed:Q}),jw=$f({compare:uw,isNaN:vS,isNumeric:yS,typed:Q}),Mw=og({addScalar:Ux,complex:eS,conj:tS,divideScalar:gw,equal:TC,identity:DC,isZero:iC,matrix:$,multiplyScalar:DS,sign:IS,sqrt:pC,subtractScalar:US,typed:Q,unaryMinus:FC,zeros:vC}),Nw=_f({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q,zeros:vC}),Pw=Tg({SparseMatrix:zS,abs:zx,add:iw,divideScalar:gw,larger:WC,larger
54Eq:Tw,multiply:oC,subtract:ew,transpose:gC,typed:Q}),Fw=up({FibonacciHeap:vw,addScalar:Ux,equalScalar:oS}),Iw=Fu({add:iw,matrix:$,typed:Q,zeros:vC}),Lw=b_({add:iw,config:U,numeric:XC,typed:Q}),Rw=Ym({add:iw,matrix:$,typed:Q}),zw=af({DenseMatrix:Mx,divideScalar:gw,equalScalar:oS,matrix:$,multiplyScalar:DS,subtractScalar:US,typed:Q}),Bw=Zv({Complex:fx,add:iw,multiply:oC,number:kS,typed:Q}),Vw=kv({addScalar:Ux,combinations:$x,divideScalar:gw,isInteger:OC,isNegative:rC,multiplyScalar:DS,typed:Q}),Hw=Tf({compare:uw,typed:Q}),Uw=S_({add:iw,typed:Q,unaryPlus:nw}),Ww=Zg({divideScalar:gw,isZero:iC,matrix:$,multiply:oC,subtractScalar:US,typed:Q,unaryMinus:FC}),Gw=$d({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,divideScalar:gw,equalScalar:oS,matrix:$,typed:Q}),Kw=Zm({Index:Sw,typed:Q}),qw=$g({abs:zx,addScalar:Ux,det:Ww,divideScalar:gw,identity:DC,matrix:$,multiply:oC,typed:Q,unaryMinus:FC}),Jw=qd({Complex:fx,config:U,divideScalar:gw,log:Ew,typed:Q}),Yw=sf({DenseMatrix:Mx,divideScalar:gw,equalScalar:oS,matrix:$,multiplyScalar:DS,subtractScalar:US,typed:Q}),Xw=rp({config:U,isNaN:vS,larger:WC,numeric:XC,typed:Q}),Zw=zl({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q}),Qw=t_({Complex:fx,add:iw,ctranspose:CC,deepEqual:zC,divideScalar:gw,dot:eC,dotDivide:Gw,equal:TC,inv:qw,matrix:$,multiply:oC,typed:Q}),$w=Rd({Complex:fx,config:U,fraction:EC,identity:DC,inv:qw,matrix:$,multiply:oC,number:kS,typed:Q}),eT=Sm({DenseMatrix:Mx,Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),tT=Em({DenseMatrix:Mx,Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),nT=Am({Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),rT=Pm({Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),iT=zf({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,config:U,matrix:$,typed:Q}),aT=tp({compare:uw,compareNatural:Hw,matrix:$,typed:Q}),oT=c_({abs:zx,add:iw,identity:DC,inv:qw,map:TS,max:Xw,multiply:oC,size:RS,sqrt:pC,subtract:ew,typed:Q}),sT=Xf({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,config:U,equalScalar:oS,matrix:$,typed:Q}),cT=lf({DenseMatrix:Mx,divideScalar:gw,equalScalar:oS,matrix:$,multiplyScalar:DS,subtractScalar:US,typed:Q}),lT=yf({concat:RC,equalScalar:oS,matrix:$,not:OS,typed:Q,zeros:vC}),uT=ux({fraction:EC,typed:Q}),dT=__({abs:zx,addScalar:Ux,deepEqual:zC,divideScalar:gw,multiplyScalar:DS,sqrt:pC,subtractScalar:US,typed:Q}),fT=Zd({DenseMatrix:Mx,SparseMatrix:zS,concat:RC,equalScalar:oS,matrix:$,pow:$w,typed:Q}),pT=o_({abs:zx,add:iw,identity:DC,inv:qw,multiply:oC,typed:Q}),mT=qu({addScalar:Ux,ceil:lw,conj:tS,divideScalar:gw,dotDivide:Gw,exp:cS,i:_x,log2:wS,matrix:$,multiplyScalar:DS,pow:$w,tau:kx,typed:Q}),hT=J_({BigNumber:Z,Complex:fx,config:U,multiplyScalar:DS,pow:$w,typed:Q}),gT=Yu({conj:tS,dotDivide:Gw,fft:mT,typed:Q}),_T=ig({DenseMatrix:Mx,Spa:Fw,SparseMatrix:zS,abs:zx,addScalar:Ux,divideScalar:gw,equalScalar:oS,larger:WC,matrix:$,multiplyScalar:DS,subtractScalar:US,typed:Q,unaryMinus:FC}),vT=bu({bignumber:XS,matrix:$,add:iw,config:U,equal:TC,isPositive:UC,isZero:iC,larger:WC,larger
54Eq:Tw,smaller:$C,smallerEq:iT,typed:Q}),yT=ku({Index:Sw,matrix:$,range:vT,typed:Q}),bT=wm({DenseMatrix:Mx,Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),xT=Mm({Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),ST=Rm({Index:Sw,concat:RC,setDifference:bT,size:RS,subset:Iw,typed:Q}),CT=bp({BigNumber:Z,Complex:fx,Fraction:gx,abs:zx,addScalar:Ux,config:U,divideScalar:gw,equal:TC,fix:yw,format:pS,isNumeric:yS,multiplyScalar:DS,number:kS,pow:$w,round:PC,subtractScalar:US}),wT=ky({BigNumber:Z,Unit:CT,config:U}),TT=db({BigNumber:Z,Unit:CT,config:U}),ET=$y({BigNumber:Z,Unit:CT,config:U}),DT=Ny({BigNumber:Z,Unit:CT,config:U}),OT=tb({BigNumber:Z,Unit:CT,config:U}),kT=Gl({Index:Sw,matrix:$,range:vT,typed:Q}),AT=Py({BigNumber:Z,Unit:CT,config:U}),jT=Ay({BigNumber:Z,Unit:CT,config:U}),MT=Ep({Unit:CT,typed:Q}),NT=Ky({BigNumber:Z,Unit:CT,config:U}),PT=i_({abs:zx,add:iw,addScalar:Ux,atan:qx,bignumber:XS,column:kT,complex:eS,config:U,cos:nS,diag:wC,divideScalar:gw,dot:eC,equal:TC,flatten:dS,im:gS,inv:qw,larger:WC,matrix:$,matrixFromColumns:jC,multiply:oC,multiplyScalar:DS,number:kS,qr:Mw,re:PS,reshape:NC,sin:LS,size:RS,smaller:$C,sqrt:pC,subtract:ew,typed:Q,usolve:zw,usolveAll:cT}),FT=Vy({BigNumber:Z,Unit:CT,config:U}),IT=Q_({gamma:hT,typed:Q}),LT=Hy({BigNumber:Z,Unit:CT,config:U}),RT=ab({BigNumber:Z,Unit:CT,config:U}),zT=mb({BigNumber:Z,Unit:CT,config:U}),BT=Ry({BigNumber:Z,Unit:CT,config:U}),VT=ib({BigNumber:Z,Unit:CT,config:U}),HT=Dy({BigNumber:Z,Unit:CT,config:U}),UT=fb({BigNumber:Z,Unit:CT,config:U}),WT=ob({BigNumber:Z,Unit:CT,config:U}),GT=qy({BigNumber:Z,Unit:CT,config:U}),KT=Ly({BigNumber:Z,Unit:CT,config:U}),qT=iv({factorial:IT,typed:Q}),JT=Ty({BigNumber:Z,Unit:CT,config:U}),YT=gb({BigNumber:Z,Unit:CT,config:U}),XT=_b({BigNumber:Z,Unit:CT,config:U}),ZT=Gy({BigNumber:Z,Unit:CT,config:U}),QT=Jy({BigNumber:Z,Unit:CT,config:U}),$T=Ey({BigNumber:Z,Unit:CT,config:U}),eE=lb({BigNumber:Z,Unit:CT,config:U}),tE=Im({compareNatural:Hw,typed:Q}),nE=Cy({BigNumber:Z,Unit:CT,config:U}),rE=ub({BigNumber:Z,Unit:CT,config:U}),iE=Xy({BigNumber:Z,Unit:CT,config:U}),aE=eb({BigNumber:Z,Unit:CT,config:U}),oE=zy({BigNumber:Z,Unit:CT,config:U}),sE=jy({BigNumber:Z,Unit:CT,config:U}),cE=h_({divideScalar:gw,equalScalar:oS,inv:qw,matrix:$,multiply:oC,typed:Q}),lE=My({BigNumber:Z,Unit:CT,config:U}),uE=nb({BigNumber:Z,Unit:CT,config:U}),dE=$v({Complex:fx,add:iw,divide:cE,matrix:$,multiply:oC,typed:Q}),fE=wy({BigNumber:Z,Unit:CT,config:U}),pE=Fy({BigNumber:Z,Unit:CT,config:U}),mE=Og({DenseMatrix:Mx,lsolve:Dw,lup:_T,matrix:$,slu:Pw,typed:Q,usolve:zw}),hE=Iy({BigNumber:Z,Unit:CT,config:U}),gE=pb({BigNumber:Z,Unit:CT,config:U}),_E=nv({add:iw,divide:cE,factorial:IT,isInteger:OC,isPositive:UC,multiply:oC,typed:Q}),vE=vb({BigNumber:Z,Unit:CT,config:U}),yE=yb({BigNumber:Z,Unit:CT,config:U}),bE=N_({bignumber:XS,add:iw,compare:uw,divide:cE,isInteger:OC,larger:WC,mapSlices:AC,multiply:oC,partitionSelect:jw,smaller:$C,smallerEq:iT,subtract:ew,typed:Q}),xE=Yy({BigNumber:Z,Unit:CT,config:U}),SE=Om({DenseMatrix:Mx,Index:Sw,compareNatural:Hw,size:RS,subset:Iw,typed:Q}),CE=nd({abs:zx,add:iw,bignumber:XS,divide:cE,isNegative:rC,isPositive:UC,larger:WC,map:TS,matrix:$,max:Xw,multiply:oC,smaller:$C,subtract:ew,typed:Q,unaryMinus:FC}),wE=Tv({bignumber:XS,addScalar:Ux,combinations:$x,divideScalar:gw,factorial:IT,isInteger:OC,isNegative:rC,larger:WC,multiplyScalar:DS,number:kS,pow:$w,subtractScalar:US,typed:Q}),TE=Sp({Unit:CT,typed:Q}),EE=Dv({addScalar:Ux,isInteger:OC,isNegative:rC,stirlingS2:wE,typed:Q}),DE=Oy({BigNumber:Z,Unit:CT,config:U}),OE=rb({BigNumber:Z,Unit:CT,config:U}),kE=Wy({BigNumber:Z,Unit:CT,config:U}),AE=ev({divide:cE,dotDivide:Gw,isNumeric:yS,log:Ew,map:TS,matrix:$,multiply:oC,sum:Lw,typed:Q}),jE=w_({add:iw,divide:cE,typed:Q}),ME=sb({BigNumber:Z,Unit:CT,config:U}),NE=hb({BigNumber:Z,Unit:CT,config:U}),PE=Bm({Index:Sw,concat:RC,setIntersect:SE,setSymDifference:ST,size:RS,subset:Iw,typed:Q}),FE=j_({add:iw,divide:cE,isNaN:vS,mapSlices:AC,multiply:oC,subtract:ew,typed:Q}),IE=By({BigNumber:Z,Unit:CT,config:U}),LE=L_({add:iw,divide:cE,matrix:$,mean:jE,multiply:oC,pow:$w,sqrt:pC,subtract:ew,sum:Lw,typed:Q}),RE=E_({add:iw,compare:uw,divide:cE,partitionSelect:jw,typed:Q}),zE=Ag({add:iw,cbrt:LC,divide:cE,equalScalar:oS,im:gS,isZero:iC,multiply:oC,re:PS,sqrt:pC,subtract:ew,typeOf:KS,typed:Q,unaryMinus:FC}),BE=F_({map:TS,sqrt:pC,typed:Q,variance:FE}),VE=ud({BigNumber:Z,Complex:fx,add:iw,config:U,divide:cE,equal:TC,factorial:IT,gamma:hT,isBounded:_S,isNegative:rC,multiply:oC,pi:Fx,pow:$w,sin:LS,smallerEq:iT,subtract:ew,typed:Q}),HE=O_({abs:zx,map:TS,median:RE,subtract:ew,typed:Q}),UE=Km({abs:zx,add:iw,conj:tS,ctranspose:CC,eigs:PT,equalScalar:oS,larger:WC,matrix:$,multiply:oC,pow:$w,smaller:$C,sqrt:pC,typed:Q}),WE=Du({BigNumber:Z,DenseMatrix:Mx,SparseMatrix:zS,addScalar:Ux,config:U,cos:nS,matrix:$,multiplyScalar:DS,norm:UE,sin:LS,typed:Q,unaryMinus:FC}),GE=Tu({multiply:oC,rotationMatrix:WE,typed:Q}),KE=f_({identity:DC,matrix:$,multiply:oC,norm:UE,qr:Mw,subtract:ew,typed:Q}
54),qE=u_({abs:zx,add:iw,concat:RC,identity:DC,index:Kw,lusolve:mE,matrix:$,matrixFromColumns:jC,multiply:oC,range:vT,schur:KE,subset:Iw,subtract:ew,transpose:gC,typed:Q}),JE=m_({matrix:$,multiply:oC,sylvester:qE,transpose:gC,typed:Q}),YE={},XE={},ZE={},QE=$m({mathWithTransform:XE}),$E=Ph({Node:QE}),eD=Lh({Node:QE}),tD=zh({Node:QE}),nD=Uh({Node:QE}),rD=ah({Node:QE}),iD=gh({Node:QE,ResultSet:Ex}),aD=vh({Node:QE}),oD=Vh({Node:QE}),sD=ey({classes:ZE}),cD=Mg({math:YE,typed:Q}),lD=Ah({Node:QE,typed:Q}),uD=Yg({Chain:cD,typed:Q}),dD=Oh({Node:QE,isBounded:_S}),fD=Mh({Node:QE,size:RS}),pD=rh({Node:QE,subset:Iw}),mD=mh({matrix:$,Node:QE,subset:Iw}),hD=Wh({Unit:CT,Node:QE,math:YE}),gD=Kh({Node:QE,SymbolNode:hD,math:YE}),_D=Jh({AccessorNode:pD,ArrayNode:rD,AssignmentNode:mD,BlockNode:iD,ConditionalNode:aD,ConstantNode:dD,FunctionAssignmentNode:lD,FunctionNode:gD,IndexNode:fD,ObjectNode:$E,OperatorNode:eD,ParenthesisNode:tD,RangeNode:oD,RelationalNode:nD,SymbolNode:hD,config:U,numeric:XC,typed:Q}),vD=Uv({ConstantNode:dD,FunctionNode:gD,OperatorNode:eD,ParenthesisNode:tD,parse:_D,typed:Q}),yD=Bv({bignumber:XS,fraction:EC,AccessorNode:pD,ArrayNode:rD,ConstantNode:dD,FunctionNode:gD,IndexNode:fD,ObjectNode:$E,OperatorNode:eD,SymbolNode:hD,config:U,isBounded:_S,mathWithTransform:XE,matrix:$,typed:Q}),bD=Xh({parse:_D,typed:Q}),xD=Qh({parse:_D,typed:Q}),SD=jg({evaluate:xD}),CD=$h({evaluate:xD,parse:_D}),wD=Hv({AccessorNode:pD,ArrayNode:rD,ConstantNode:dD,FunctionNode:gD,IndexNode:fD,ObjectNode:$E,OperatorNode:eD,ParenthesisNode:tD,SymbolNode:hD,add:iw,divide:cE,equal:TC,isZero:iC,multiply:oC,parse:_D,pow:$w,subtract:ew,typed:Q}),TD=qg({Help:SD,mathWithTransform:XE,typed:Q}),ED=zv({AccessorNode:pD,ArrayNode:rD,ConstantNode:dD,FunctionNode:gD,IndexNode:fD,ObjectNode:$E,OperatorNode:eD,ParenthesisNode:tD,SymbolNode:hD,equal:TC,parse:_D,replacer:Ix,resolve:vD,simplifyConstant:yD,simplifyCore:wD,typed:Q}),DD=Gv({OperatorNode:eD,parse:_D,simplify:ED,typed:Q}),OD=qv({ConstantNode:dD,FunctionNode:gD,OperatorNode:eD,ParenthesisNode:tD,SymbolNode:hD,config:U,equal:TC,isZero:iC,numeric:XC,parse:_D,simplify:ED,typed:Q}),kD=ng({Parser:CD,typed:Q}),AD=Nv({parse:_D,typed:Q}),jD=Yv({bignumber:XS,fraction:EC,AccessorNode:pD,ArrayNode:rD,ConstantNode:dD,FunctionNode:gD,IndexNode:fD,ObjectNode:$E,OperatorNode:eD,ParenthesisNode:tD,SymbolNode:hD,add:iw,config:U,divide:cE,equal:TC,isZero:iC,mathWithTransform:XE,matrix:$,multiply:oC,parse:_D,pow:$w,simplify:ED,simplifyConstant:yD,simplifyCore:wD,subtract:ew,typed:Q});r(YE,{e:px,false:mx,fineStructure:hx,i:_x,Infinity:vx,LN10:yx,LOG10E:bx,NaN:Sx,null:Cx,phi:wx,SQRT1_2:Dx,sackurTetrode:Ox,tau:kx,true:Ax,E:px,version:jx,efimovFactor:Nx,LN2:Px,pi:Fx,replacer:Ix,reviver:sD,SQRT2:Lx,typed:Q,PI:Fx,weakMixingAngle:Rx,abs:zx,acos:Bx,acot:Vx,acsc:Hx,addScalar:Ux,arg:Wx,asech:Gx,asinh:Kx,atan:qx,atanh:Jx,bigint:Yx,bitNot:Xx,boolean:Zx,clone:Qx,combinations:$x,complex:eS,conj:tS,cos:nS,cot:rS,csc:iS,cube:aS,equalScalar:oS,erf:sS,exp:cS,expm1:lS,filter:uS,flatten:dS,forEach:fS,format:pS,getMatrixDataType:mS,hex:hS,im:gS,isBounded:_S,isNaN:vS,isNumeric:yS,isPrime:bS,LOG2E:xS,lgamma:SS,log10:CS,log2:wS,map:TS,mode:ES,multiplyScalar:DS,not:OS,number:kS,oct:AS,pickRandom:jS,print:MS,random:NS,re:PS,sec:FS,sign:IS,sin:LS,size:RS,splitUnit:BS,square:VS,string:HS,subtractScalar:US,tan:WS,toBest:GS,typeOf:KS,acosh:qS,acsch:JS,asec:YS,bignumber:XS,chain:uD,combinationsWithRep:ZS,cosh:QS,csch:$S,dot:eC,hasNumericValue:tC,isFinite:nC,isNegative:rC,isZero:iC,matrix:$,matrixFromFunction:aC,multiply:oC,ones:sC,randomInt:cC,resize:lC,sech:uC,sinh:dC,sparse:fC,sqrt:pC,squeeze:mC,tanh:hC,transpose:gC,xgcd:_C,zeros:vC,acoth:yC,asin:bC,bin:xC,coth:SC,ctranspose:CC,diag:wC,equal:TC,fraction:EC,identity:DC,isInteger:OC,kron:kC,mapSlices:AC,matrixFromColumns:jC,num:MC,reshape:NC,round:PC,unaryMinus:FC,bernoulli:IC,cbrt:LC,concat:RC,deepEqual:zC,dotMultiply:BC,floor:VC,gcd:HC,isPositive:UC,larger:WC,lcm:GC,leftShift:KC,mod:qC,nthRoot:JC,nullish:YC,numeric:XC,prod:ZC,rightArithShift:QC,smaller:$C,subtract:ew,to:tw,unaryPlus:nw,xor:rw,add:iw,atan2:aw,bitAnd:ow,bitOr:sw,bitXor:cw,ceil:lw,compare:uw,compareText:dw,composition:fw,count:pw,cross:mw,diff:hw,divideScalar:gw,equalText:_w,fix:yw,hypot:bw,intersect:Cw,invmod:ww,largerEq:Tw,log:Ew,lsolve:Dw,matrixFromRows:Ow,min:kw,nthRoots:Aw,partitionSelect:jw,qr:Mw,rightLogShift:Nw,slu:Pw,subset:Iw,sum:Lw,trace:Rw,usolve:zw,zpk2tf:Bw,catalan:Vw,compareNatural:Hw,cumsum:Uw,det:Ww,dotDivide:Gw,index:Kw,inv:qw,log1p:Jw,lsolveAll:Yw,max:Xw,or:Zw,pinv:Qw,pow:$w,setCartesian:eT,setDistinct:tT,setIsSubset:nT,setPowerset:rT,smallerEq:iT,sort:aT,sqrtm:oT,unequal:sT,usolveAll:cT,and:lT,den:uT,distance:dT,dotPow:fT,expm:pT,fft:mT,gamma:hT,ifft:gT,lup:_T,range:vT,row:yT,setDifference:bT,setMultiplicity:xT,setSymDifference:ST,vacuumImpedance:wT,wienDisplacement:TT,atomicMass:ET,bo
54hrMagneton:DT,boltzmann:OT,column:kT,conductanceQuantum:AT,coulomb:jT,createUnit:MT,deuteronMass:NT,eigs:PT,electronMass:FT,factorial:IT,fermiCoupling:LT,gasConstant:RT,gravity:zT,klitzing:BT,loschmidt:VT,magneticConstant:HT,molarMass:UT,molarPlanckConstant:WT,neutronMass:GT,nuclearMagneton:KT,permutations:qT,planckConstant:JT,planckMass:YT,planckTime:XT,protonMass:ZT,quantumOfCirculation:QT,reducedPlanckConstant:$T,secondRadiation:eE,setSize:tE,speedOfLight:nE,stefanBoltzmann:rE,thomsonCrossSection:iE,avogadro:aE,bohrRadius:oE,coulombConstant:sE,divide:cE,elementaryCharge:lE,faraday:uE,freqz:dE,gravitationConstant:fE,inverseConductanceQuantum:pE,lusolve:mE,magneticFluxQuantum:hE,molarMassC12:gE,multinomial:_E,planckCharge:vE,planckTemperature:yE,quantileSeq:bE,rydberg:xE,setIntersect:SE,solveODE:CE,stirlingS2:wE,unit:TE,bellNumbers:EE,electricConstant:DE,firstRadiation:OE,hartreeEnergy:kE,kldivergence:AE,mean:jE,molarVolume:ME,planckLength:NE,setUnion:PE,variance:FE,classicalElectronRadius:IE,corr:LE,median:RE,parse:_D,polynomialRoot:zE,resolve:vD,simplifyConstant:yD,std:BE,zeta:VE,compile:bD,evaluate:xD,mad:HE,simplifyCore:wD,help:TD,norm:UE,rotationMatrix:WE,simplify:ED,symbolicEqual:DD,derivative:OD,parser:kD,rotate:GE,leafCount:AD,rationalize:jD,schur:KE,sylvester:qE,lyap:JE,config:U}),r(XE,YE,{map:Nb({typed:Q}),filter:Ab({typed:Q}),forEach:jb({typed:Q}),mapSlices:wb({isInteger:OC,typed:Q}),or:rx({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q}),and:nx({add:iw,concat:RC,equalScalar:oS,matrix:$,not:OS,typed:Q,zeros:vC}),cumsum:Zb({add:iw,typed:Q,unaryPlus:nw}),max:Lb({config:U,isNaN:vS,larger:WC,numeric:XC,typed:Q}),nullish:ix({deepEqual:zC,flatten:dS,matrix:$,size:RS,typed:Q}),print:tx({add:iw,matrix:$,typed:Q,zeros:vC}),bitAnd:ax({add:iw,concat:RC,equalScalar:oS,matrix:$,not:OS,typed:Q,zeros:vC}),concat:Ub({isInteger:OC,matrix:$,typed:Q}),diff:Gb({bignumber:XS,matrix:$,number:kS,subtract:ew,typed:Q}),min:zb({config:U,isNaN:vS,numeric:XC,smaller:$C,typed:Q}),subset:Hb({add:iw,matrix:$,typed:Q,zeros:vC}),bitOr:ox({DenseMatrix:Mx,concat:RC,equalScalar:oS,matrix:$,typed:Q}),sum:Jb({add:iw,config:U,numeric:XC,typed:Q}),index:Mb({Index:Sw,getMatrixDataType:mS}),row:Vb({Index:Sw,matrix:$,range:vT,typed:Q}),column:Tb({Index:Sw,matrix:$,range:vT,typed:Q}),mean:Rb({add:iw,divide:cE,typed:Q}),range:Bb({bignumber:XS,matrix:$,add:iw,config:U,equal:TC,isPositive:UC,isZero:iC,larger:WC,larger
54Eq:Tw,smaller:$C,smallerEq:iT,typed:Q}),variance:$b({add:iw,divide:cE,isNaN:vS,mapSlices:AC,multiply:oC,subtract:ew,typed:Q}),quantileSeq:Yb({add:iw,bignumber:XS,compare:uw,divide:cE,isInteger:OC,larger:WC,mapSlices:AC,multiply:oC,partitionSelect:jw,smaller:$C,smallerEq:iT,subtract:ew,typed:Q}),std:Kb({map:TS,sqrt:pC,typed:Q,variance:FE})}),r(ZE,{BigNumber:Z,Complex:fx,Fraction:gx,Matrix:xx,Node:QE,ObjectNode:$E,OperatorNode:eD,ParenthesisNode:tD,Range:Tx,RelationalNode:nD,ResultSet:Ex,ArrayNode:rD,BlockNode:iD,ConditionalNode:aD,DenseMatrix:Mx,RangeNode:oD,Chain:cD,FunctionAssignmentNode:lD,SparseMatrix:zS,ConstantNode:dD,IndexNode:fD,FibonacciHeap:vw,ImmutableDenseMatrix:xw,Index:Sw,Spa:Fw,AccessorNode:pD,AssignmentNode:mD,Unit:CT,SymbolNode:hD,FunctionNode:gD,Help:SD,Parser:CD}),cD.createProxy(YE);var MD=dx,ND=e(n(((e,t)=>{function n(){}n.prototype={on:function(e,t,n){var r=this.e||={};return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||={})[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||={},r=n[e],i=[];if(r&&t)for(var a=0,o=r.length;a<o;a++)r[a].fn!==t&&r[a].fn._!==t&&i.push(r[a]);return i.length?n[e]=i:delete n[e],this}},t.exports=n,t.exports.TinyEmitter=n}))(),1);function PD(e){var t=new ND.default;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}function FD(e,t,n,r){function i(e,t){var n=arguments.length;if(n!==1&&n!==2)throw new Dc(`import`,n,1,2);t||={};function r(e,n,i){if(Array.isArray(n))n.forEach(t=>r(e,t));else if(ie(n)||d(n))for(var a in n)H(n,a)&&r(e,n[a],a);else if(Re(n)||i!==void 0){var o=Re(n)?h(n)?n.fn+`.transform`:n.fn:i;
54if(H(e,o)&&e[o]!==n&&!t.silent)throw Error(`Cannot import "`+o+`" twice`);e[o]=n}else if(!t.silent)throw TypeError(`Factory, Object, or Array expected`)}var i={};for(var o in r(i,e),i)if(H(i,o)){var s=i[o];if(Re(s))l(s,t);else if(u(s))a(o,s,t);else if(!t.silent)throw TypeError(`Factory, Object, or Array expected`)}}function a(t,i,a){if(a.wrap&&typeof i==`function`&&(i=c(i)),f(i)&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(n[t])&&e.isTypedFunction(i)){i=a.override?e(t,i.signatures):e(n[t],i),n[t]=i,delete r[t],o(t,i),n.emit(`import`,t,function(){return i});return}var s=n[t]!==void 0,l=n.Unit?.isValuelessUnit(t);if(!s&&!l||a.override){n[t]=i,delete r[t],o(t,i),n.emit(`import`,t,function(){return i});return}if(!a.silent)throw Error(`Cannot import "`+t+`": already exists`)}function o(e,t){t&&typeof t.transform==`function`?(n.expression.transform[e]=t.transform,p(e)&&(n.expression.mathWithTransform[e]=t.transform)):(delete n.expression.transform[e],p(e)&&(n.expression.mathWithTransform[e]=t))}function s(e){delete n.expression.transform[e],p(e)?n.expression.mathWithTransform[e]=n[e]:delete n.expression.mathWithTransform[e]}function c(e){var t=function(){for(var t=[],r=0,i=arguments.length;r<i;r++){var a=arguments[r];t[r]=a&&a.valueOf()}return e.apply(n,t)};return e.transform&&(t.transform=e.transform),t}function l(t,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.fn;if(a.includes(`.`))throw Error(`Factory name should not contain a nested path. Name: `+JSON.stringify(a));var o=h(t)?n.expression.transform:n,c=a in n.expression.transform,l=H(o,a)?o[a]:void 0,u=function(){var r={};t.dependencies.map(Ve).forEach(e=>{if(e.includes(`.`))throw Error(`Factory dependency should not contain a nested path. Name: `+JSON.stringify(e));e===`math`?r.math=n:e===`mathWithTransform`?r.mathWithTransform=n.expression.mathWithTransform:e===`classes`?r.classes=n:r[e]=n[e]});var o=t(r);if(o&&typeof o.transform==`function`)throw Error(`Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"`);if(l===void 0||i.override)return o;if(e.isTypedFunction(l)&&e.isTypedFunction(o))return e(l,o);if(i.silent)return l;throw Error(`Cannot import "`+a+`": already exists`)},d=t.meta?.formerly??``,f=h(t)||m(t),p=n.expression.mathWithTransform;!t.meta||t.meta.lazy!==!1?(Ae(o,a,u),d&&Ae(o,d,u),l&&c?(s(a),d&&s(d)):f&&(Ae(p,a,()=>o[a]),d&&Ae(p,d,()=>o[a]))):(o[a]=u(),d&&(o[d]=o[a]),l&&c?(s(a),d&&s(d)):f&&(Ae(p,a,()=>o[a]),d&&Ae(p,d,()=>o[a]))),r[a]=t,n.emit(`import`,a,u)}function u(e){return typeof e==`function`||typeof e==`number`||typeof e==`string`||typeof e==`boolean`||e===null||T(e)||C(e)||x(e)||w(e)||O(e)||Array.isArray(e)}function d(e){return typeof e==`object`&&e[Symbol.toStringTag]===`Module`}function f(e){return typeof e==`function`&&typeof e.signature==`string`}function p(e){return!H(g,e)}function m(e){return!e.fn.includes(`.`)&&!H(g,e.fn)&&(!e.meta||!e.meta.isClass)}function h(e){return e!==void 0&&e.meta!==void 0&&e.meta.isTransformFunction===!0||!1}var g={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return i}function ID(e,t){var n=r({},i,t);if(typeof Object.create!=`function`)throw Error(`ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.`);var a=PD({isNumber:b,isComplex:C,isBigNumber:x,isBigInt:S,isFraction:w,isUnit:T,isString:E,isArray:D,isMatrix:O,isCollection:k,isDenseMatrix:A,isSparseMatrix:j,isRange:M,isIndex:N,isBoolean:P,isResultSet:F,isHelp:ee,isFunction:te,isDate:ne,isRegExp:re,isObject:ie,isMap:ae,isPartitionedMap:I,isObjectWrappingMap:oe,isNull:L,isUndefined:se,isAccessorNode:ce,isArrayNode:R,isAssignmentNode:le,isBlockNode:ue,isConditionalNode:z,isConstantNode:B,isFunctionAssignmentNode:fe,isFunctionNode:pe,isIndexNode:me,isNode:he,isObjectNode:ge,isOperatorNode:_e,isParenthesisNode:ve,isRangeNode:ye,isRelationalNode:be,isSymbolNode:xe,isChain:Se});a.config=Fe(n,a.emit),a.expression={transform:{},mathWithTransform:{config:a.config}};var o=[],s=[];function c(e){if(Re(e))return e(a);var t=e[Object.keys(e)[0]];if(Re(t))return t(a);if(!je(e))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",e),Error("Factory object with properties `type`, `name`, and `factory` expected");var r=o.indexOf(e),i;return r===-1?(i=e.math===!0?e.factory(a.type,n,c,a.typed,a):e.factory(a.type,n,c,a.typed),o.push(e),s.push(i)):i=s[r],i}var l={};function u(){var e=[...arguments];return a.typed.apply(a.typed,e)}u.isTypedFunction=Le.default.isTypedFunction;var d=FD(u,c,a,l);return a.import=d,a.on(`config`,()=>
54{Object.values(l).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&d(e,{override:!0})})}),a.create=ID.bind(null,e),a.factory=W,a.import(Object.values(Oe(e))),a.ArgumentsError=Dc,a.DimensionError=ti,a.IndexError=ni,a}var LD=n(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l<u&&(o=m,m=h,h=o,s=l,l=u,u=s),o=[],s=l+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;
54)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||e<t||e>n)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+``,n=p-r.length,n&&(a+=w(n)),a+=r;o=e[t],r=o+``,n=p-r.length,n&&(a+=w(n))}else if(o===0)return`0`;for(;o%10==0;)o/=10;return a+o}var b=(function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%f|0,r=n/f|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]<t[n]),e[n]=r*f+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u<T||d)&&x--;u++)C=d*f+(M[u]||0),_[u]=C/N|0,d=C%N|0;else{for(d=f/(N[0]+1)|0,d>1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y<O;)v[y++]=0;k=N.slice(),k.unshift(0),E=N[0],N[1]>=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O<h?k:N,h))):(d==0&&(c=d=1),m=N.slice()),h=m.length,h<y&&m.unshift(0),n(v,m,y),c==-1&&(y=v.length,c=t(N,v,O,y),c<1&&(d++,n(v,O<y?k:N,y))),y=v.length):c===0&&(d++,v=[0]),_[u++]=d,c&&v[0]?v[y++]=M[w]||0:(v=[M[w]],y=1);while((w++<T||v[0]!==void 0)&&x--)}return _[0]||_.shift(),g.e=l,D(g,s?o+S(g)+1:o)}})();function x(e,t){var n,r,a,o,c,u,f=0,p=0,m=e.constructor,h=m.precision;if(S(e)>16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),r<a){for(r&&e.d.push(+t.slice(0,r)),a-=p;r<a;)e.d.push(+t.slice(r,r+=p));t=t.slice(r),r=p-t.length}else r-=a;for(;r--;)t+=`0`;if(e.d.push(+t),i&&(e.e>h||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a<c,d&&(c=a),a=0;a<c;a++)if(l[a]!=m[a]){d=l[a]<m[a];break}s=0}for(d&&(n=l,l=m,m=n,t.s=-t.s),c=l.length,a=m.length-c;a>
540;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]<m[a]){for(o=a;o&&l[--o]===0;)l[o]=f-1;--l[o],l[a]+=f}l[a]-=m[a]}for(;l[--c]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=r,i?D(t,g):t):new h(0)}function k(e,t,n){var r,i=S(e),a=y(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)<o&&(a=a.slice(0,r)+`.`+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function M(e){if(!e||typeof e!=`object`)throw Error(a+`Object expected`);var t,r,i,s=[`precision`,1,n,`rounding`,0,8,`toExpNeg`,-1/0,0,`toExpPos`,0,1/0];for(t=0;t<s.length;t+=3)if((i=e[r=s[t]])!==void 0)if(c(i)===i&&i>=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));export{b as C,cr as S,kS as _,xD as a,ew as b,cE as c,pS as d,vS as f,oC as g,Xw as h,uD as i,TC as l,WC as m,ID as n,zx as o,yS as p,MD as r,lw as s,LD as t,VC as u,PC as v,Lw as x,$C as y};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.